@payloadcms/richtext-lexical 3.0.0-beta.96 → 3.0.0-beta.97

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 (142) hide show
  1. package/dist/exports/client/Field-MPDY6IHA.js +2 -0
  2. package/dist/exports/client/Field-MPDY6IHA.js.map +7 -0
  3. package/dist/exports/client/{RelationshipComponent-EZORSGUZ.js → RelationshipComponent-CPYVT3XN.js} +2 -2
  4. package/dist/exports/client/bundled.css +1 -1
  5. package/dist/exports/client/{chunk-TD7O23AB.js → chunk-BR57XNHD.js} +2 -2
  6. package/dist/exports/client/{chunk-TD7O23AB.js.map → chunk-BR57XNHD.js.map} +1 -1
  7. package/dist/exports/client/{chunk-UJDWBQ2K.js → chunk-EPEFKP5H.js} +2 -2
  8. package/dist/exports/client/{chunk-UJDWBQ2K.js.map → chunk-EPEFKP5H.js.map} +1 -1
  9. package/dist/exports/client/chunk-GK7ZKYHL.js +2 -0
  10. package/dist/exports/client/chunk-GK7ZKYHL.js.map +7 -0
  11. package/dist/exports/client/{chunk-OLSILJA6.js → chunk-MFAXC4ZA.js} +2 -2
  12. package/dist/exports/client/{chunk-OLSILJA6.js.map → chunk-MFAXC4ZA.js.map} +2 -2
  13. package/dist/exports/client/{chunk-V2LKLT2F.js → chunk-PECDZEZY.js} +3 -3
  14. package/dist/exports/client/{chunk-V2LKLT2F.js.map → chunk-PECDZEZY.js.map} +3 -3
  15. package/dist/exports/client/{chunk-YL453UOS.js → chunk-XIBMVIFW.js} +2 -2
  16. package/dist/exports/client/{chunk-YL453UOS.js.map → chunk-XIBMVIFW.js.map} +1 -1
  17. package/dist/exports/client/{component-2YLEVOFH.js → component-3EGTURAI.js} +2 -2
  18. package/dist/exports/client/{component-2YLEVOFH.js.map → component-3EGTURAI.js.map} +1 -1
  19. package/dist/exports/client/{component-7RAP75FW.js → component-BRCRMQID.js} +2 -2
  20. package/dist/exports/client/{component-7RAP75FW.js.map → component-BRCRMQID.js.map} +1 -1
  21. package/dist/exports/client/{component-LLWMZU6K.js → component-GAX6BHKZ.js} +2 -2
  22. package/dist/exports/client/{componentInline-YSHGRL2J.js → componentInline-RETIC4OV.js} +2 -2
  23. package/dist/exports/client/index.d.ts +2 -2
  24. package/dist/exports/client/index.d.ts.map +1 -1
  25. package/dist/exports/client/index.js +5 -5
  26. package/dist/exports/client/index.js.map +4 -4
  27. package/dist/features/blocks/client/component/index.js.map +1 -1
  28. package/dist/features/blocks/client/plugin/index.js.map +1 -1
  29. package/dist/features/blocks/server/index.js +25 -25
  30. package/dist/features/blocks/server/index.js.map +1 -1
  31. package/dist/features/blocks/server/nodes/BlocksNode.d.ts +1 -1
  32. package/dist/features/blocks/server/nodes/BlocksNode.d.ts.map +1 -1
  33. package/dist/features/blocks/server/nodes/BlocksNode.js.map +1 -1
  34. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts +1 -1
  35. package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts.map +1 -1
  36. package/dist/features/blocks/server/nodes/InlineBlocksNode.js.map +1 -1
  37. package/dist/features/converters/html/converter/index.d.ts +5 -5
  38. package/dist/features/converters/html/converter/index.d.ts.map +1 -1
  39. package/dist/features/converters/html/converter/index.js.map +1 -1
  40. package/dist/features/converters/html/converter/types.d.ts +1 -1
  41. package/dist/features/converters/html/converter/types.d.ts.map +1 -1
  42. package/dist/features/converters/html/converter/types.js.map +1 -1
  43. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js +1 -1
  44. package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js.map +1 -1
  45. package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js.map +1 -1
  46. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.d.ts +1 -1
  47. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.d.ts.map +1 -1
  48. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js.map +1 -1
  49. package/dist/features/experimental_table/client/plugins/TablePlugin/index.js.map +1 -1
  50. package/dist/features/experimental_table/client/utils/debounce.js +4 -4
  51. package/dist/features/experimental_table/client/utils/debounce.js.map +1 -1
  52. package/dist/features/experimental_table/client/utils/useDebounce.js.map +1 -1
  53. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts.map +1 -1
  54. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js +1 -1
  55. package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js.map +1 -1
  56. package/dist/features/link/client/index.js +1 -1
  57. package/dist/features/link/client/index.js.map +1 -1
  58. package/dist/features/link/client/plugins/floatingLinkEditor/index.d.ts.map +1 -1
  59. package/dist/features/link/client/plugins/floatingLinkEditor/index.js.map +1 -1
  60. package/dist/features/link/nodes/LinkNode.d.ts.map +1 -1
  61. package/dist/features/link/nodes/LinkNode.js +1 -1
  62. package/dist/features/link/nodes/LinkNode.js.map +1 -1
  63. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts +1 -1
  64. package/dist/features/relationship/client/nodes/RelationshipNode.d.ts.map +1 -1
  65. package/dist/features/relationship/client/nodes/RelationshipNode.js.map +1 -1
  66. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts +1 -1
  67. package/dist/features/relationship/server/nodes/RelationshipNode.d.ts.map +1 -1
  68. package/dist/features/relationship/server/nodes/RelationshipNode.js.map +1 -1
  69. package/dist/features/toolbars/fixed/client/Toolbar/index.js +1 -1
  70. package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
  71. package/dist/features/toolbars/inline/client/Toolbar/index.js +1 -1
  72. package/dist/features/toolbars/inline/client/Toolbar/index.js.map +1 -1
  73. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts +2 -2
  74. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts.map +1 -1
  75. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js +1 -1
  76. package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
  77. package/dist/features/toolbars/shared/ToolbarDropdown/index.d.ts +2 -2
  78. package/dist/features/toolbars/shared/ToolbarDropdown/index.d.ts.map +1 -1
  79. package/dist/features/toolbars/shared/ToolbarDropdown/index.js +6 -6
  80. package/dist/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -1
  81. package/dist/features/typesClient.d.ts +6 -6
  82. package/dist/features/typesClient.d.ts.map +1 -1
  83. package/dist/features/typesClient.js.map +1 -1
  84. package/dist/features/typesServer.d.ts +8 -8
  85. package/dist/features/typesServer.d.ts.map +1 -1
  86. package/dist/features/typesServer.js.map +1 -1
  87. package/dist/features/upload/client/component/index.js.map +1 -1
  88. package/dist/features/upload/client/nodes/UploadNode.d.ts.map +1 -1
  89. package/dist/features/upload/client/nodes/UploadNode.js +1 -1
  90. package/dist/features/upload/client/nodes/UploadNode.js.map +1 -1
  91. package/dist/field/Field.js +1 -1
  92. package/dist/field/Field.js.map +1 -1
  93. package/dist/field/bundled.css +1 -1
  94. package/dist/field/index.js +1 -1
  95. package/dist/field/index.js.map +1 -1
  96. package/dist/index.d.ts +2 -2
  97. package/dist/index.d.ts.map +1 -1
  98. package/dist/index.js +3 -3
  99. package/dist/index.js.map +1 -1
  100. package/dist/lexical/LexicalEditor.d.ts.map +1 -1
  101. package/dist/lexical/LexicalEditor.js +5 -5
  102. package/dist/lexical/LexicalEditor.js.map +1 -1
  103. package/dist/lexical/LexicalProvider.js +1 -1
  104. package/dist/lexical/LexicalProvider.js.map +1 -1
  105. package/dist/lexical/config/client/EditorConfigProvider.d.ts +1 -1
  106. package/dist/lexical/config/client/EditorConfigProvider.d.ts.map +1 -1
  107. package/dist/lexical/config/client/EditorConfigProvider.js +1 -1
  108. package/dist/lexical/config/client/EditorConfigProvider.js.map +1 -1
  109. package/dist/lexical/config/client/sanitize.js +1 -1
  110. package/dist/lexical/config/client/sanitize.js.map +1 -1
  111. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts +3 -3
  112. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.d.ts.map +1 -1
  113. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +2 -2
  114. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
  115. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.d.ts +1 -1
  116. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.d.ts.map +1 -1
  117. package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js.map +1 -1
  118. package/dist/lexical/plugins/SlashMenu/index.d.ts.map +1 -1
  119. package/dist/lexical/plugins/SlashMenu/index.js +1 -1
  120. package/dist/lexical/plugins/SlashMenu/index.js.map +1 -1
  121. package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
  122. package/dist/lexical/plugins/handles/utils/getNodeCloseToPoint.js.map +1 -1
  123. package/dist/lexical/utils/nodeFormat.d.ts +2 -2
  124. package/dist/lexical/utils/nodeFormat.d.ts.map +1 -1
  125. package/dist/lexical/utils/nodeFormat.js.map +1 -1
  126. package/dist/lexical/utils/rect.d.ts.map +1 -1
  127. package/dist/lexical/utils/rect.js.map +1 -1
  128. package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
  129. package/dist/validate/index.js +1 -1
  130. package/dist/validate/index.js.map +1 -1
  131. package/dist/validate/validateNodes.d.ts +2 -2
  132. package/dist/validate/validateNodes.d.ts.map +1 -1
  133. package/dist/validate/validateNodes.js +2 -2
  134. package/dist/validate/validateNodes.js.map +1 -1
  135. package/package.json +7 -7
  136. package/dist/exports/client/Field-E27BVLS5.js +0 -2
  137. package/dist/exports/client/Field-E27BVLS5.js.map +0 -7
  138. package/dist/exports/client/chunk-ZH3MUMBJ.js +0 -2
  139. package/dist/exports/client/chunk-ZH3MUMBJ.js.map +0 -7
  140. /package/dist/exports/client/{RelationshipComponent-EZORSGUZ.js.map → RelationshipComponent-CPYVT3XN.js.map} +0 -0
  141. /package/dist/exports/client/{component-LLWMZU6K.js.map → component-GAX6BHKZ.js.map} +0 -0
  142. /package/dist/exports/client/{componentInline-YSHGRL2J.js.map → componentInline-RETIC4OV.js.map} +0 -0
@@ -1,6 +1,6 @@
1
- "use client";import{a as Ft,c as pl,e as fl,f as hl,g as gl,h as Cl}from"./chunk-ZH3MUMBJ.js";import{a as ke,b as At,c as Ne,d as Ho,e as Bo}from"./chunk-YL453UOS.js";import{a as Le,b as Ye,c as Xe,d as Je}from"./chunk-V2LKLT2F.js";import{a as Ie,b as Re,c as ye,d as Dt}from"./chunk-UJDWBQ2K.js";import{a as ae,b as qe,c as Se,d as Me,e as ve,f as Ot}from"./chunk-TD7O23AB.js";import{a as ml,b as $}from"./chunk-OLSILJA6.js";function G(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{jsx as Uo,jsxs as xl}from"react/jsx-runtime";import{createHeadlessEditor as bl}from"@lexical/headless";import{useClientFunctions as _l,useTableCell as Tl}from"@payloadcms/ui";import{$getRoot as El}from"lexical";import Pt,{useEffect as Wo,useState as $t}from"react";var jo={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",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 Fe={namespace:"lexical",theme:jo};function Qe({clientFunctions:t,schemaPath:e,unSanitizedEditorConfig:o}){for(let l of o.features)if(!l?.clientFeatureProps?.featureKey||l?.clientFeatureProps?.order===void 0||l?.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.");o.features=o.features.sort((l,s)=>l.clientFeatureProps.order-s.clientFeatureProps.order);let r=new Map(o.features.map(l=>[l.clientFeatureProps.featureKey,l])),n=new Map,i=0;for(let l of o.features){let s={};Object.entries(t).forEach(([c,u])=>{if(c.startsWith(`lexicalFeature.${e}.${l.clientFeatureProps.featureKey}.components.`)){let d=c.split(`${e}.${l.clientFeatureProps.featureKey}.components.`)[1];s[d]=u}});let a=typeof l.feature=="function"?l.feature({clientFunctions:s,featureProviderMap:r,resolvedFeatures:n,unSanitizedEditorConfig:o}):l.feature;n.set(l.clientFeatureProps.featureKey,{...a,key:l.clientFeatureProps.featureKey,order:i}),i++}return n}var Go=t=>{let e={enabledFeatures:[],hooks:{load:[],save:[]},markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}};if(!t?.size)return e;t.forEach(o=>{if(o.hooks&&(o.hooks?.load?.length&&(e.hooks.load=e.hooks.load.concat(o.hooks.load)),o.hooks?.save?.length&&(e.hooks.save=e.hooks.save.concat(o.hooks.save))),o.providers?.length&&(e.providers=e.providers.concat(o.providers)),o.nodes?.length&&(e.nodes=e.nodes.concat(o.nodes)),o.plugins?.length&&o.plugins.forEach((r,n)=>{e.plugins.push({Component:r.Component,clientProps:o.sanitizedClientFeatureProps,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)}}o.markdownTransformers?.length&&(e.markdownTransformers=e.markdownTransformers.concat(o.markdownTransformers)),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 Ae(t,e,o){return{admin:o,features:Go(e),lexical:t,resolvedFeatureMap:e}}var wl=t=>{let{admin:e,field:{_schemaPath:o,richTextComponentMap:r},lexicalEditorConfig:n}=t,[i,l]=Pt.useState("Loading..."),{cellData:s}=Tl(),a=_l(),[c,u]=$t(!1),[d,m]=$t([]),[p,f]=$t(null),h=r.get("features").sort((g,v)=>g.order-v.order),_=0;for(let g of h){let v=Array.from(r.keys()).filter(M=>M.startsWith(`feature.${g.key}.components.`));_+=1,_+=v.length}return Wo(()=>{if(!c){let g=[],v=0;if(Object.entries(a).forEach(([M,b])=>{M.startsWith(`lexicalFeature.${o}.`)&&(M.includes(".lexical_internal_components.")||g.push(b),v++)}),v===_){m(g),u(!0);let M=Qe({clientFunctions:a,schemaPath:o,unSanitizedEditorConfig:{features:g,lexical:n}});f(Ae(n||Fe,M,e))}}},[e,h,c,a,o,h.length,d,p,n,r,_]),Wo(()=>{if(!c)return;let g=s;if(g==null||!c||!p){l("");return}if(p?.features?.hooks?.load?.length&&p.features.hooks.load.forEach(b=>{g=b({incomingEditorState:g})}),!g||typeof g!="object"){l("");return}if(Array.isArray(g)&&!("root"in g)){l("");return}if("jsonContent"in g){l("");return}let v=bl({namespace:p.lexical.namespace,nodes:Ft({editorConfig:p}),theme:p.lexical.theme});v.setEditorState(v.parseEditorState(g));let M=v.getEditorState().read(()=>El().getTextContent())||"";l(M)},[s,n,c,p]),c?Uo("span",{children:i}):Uo(Pt.Fragment,{children:Array.isArray(h)&&h.map(g=>{let M=Array.from(r.keys()).filter(b=>b.startsWith(`lexical_internal_feature.${g.key}.lexical_internal_components.`)).map(b=>r.get(b));return xl(Pt.Fragment,{children:[M?.length?M.map(b=>b):null,g.ClientFeature]},g.key)})})};import{$isElementNode as ie,$isRangeSelection as tt,FORMAT_ELEMENT_COMMAND as ot}from"lexical";import{jsx as Ht,jsxs as kl}from"react/jsx-runtime";import"react";var Vo=()=>kl("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:[Ht("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ht("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ht("path",{d:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Bt,jsxs as Nl}from"react/jsx-runtime";import"react";var Ko=()=>Nl("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:[Bt("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Bt("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Bt("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as jt,jsxs as Ll}from"react/jsx-runtime";import"react";var et=()=>Ll("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:[jt("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),jt("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),jt("path",{d:"M2.5 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Gt,jsxs as Il}from"react/jsx-runtime";import"react";var zo=()=>Il("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:[Gt("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Gt("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Gt("path",{d:"M7.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{useAddClientFunction as Rl,useFieldProps as yl,useTableCell as Sl}from"@payloadcms/ui";var Zo=(t,e)=>{let{schemaPath:o}=yl(),i=Sl()?.cellProps?.field?._schemaPath||o;Rl(`lexicalFeature.${i}.${t}`,e)};var Ut=t=>e=>(Zo(e.featureKey,t(e)),null);var y=t=>Ut(o=>{let r={clientFeatureProps:o};if(typeof t=="function")r.feature=({clientFunctions:n,featureProviderMap:i,resolvedFeatures:l,unSanitizedEditorConfig:s})=>{let a=t({clientFunctions:n,featureProviderMap:i,props:o,resolvedFeatures:l,unSanitizedEditorConfig:s});return a.sanitizedClientFeatureProps===null&&(a.sanitizedClientFeatureProps=o),a};else{let n={...t};n.sanitizedClientFeatureProps=o,r.feature=n}return r});var Yo=t=>({type:"dropdown",ChildComponent:et,items:t,key:"align",order:30});var Xo=[Yo([{ChildComponent:et,isActive:({selection:t})=>{if(!tt(t))return!1;for(let e of t.getNodes()){if(ie(e)&&e.getFormatType()==="left")continue;let o=e.getParent();if(!(ie(o)&&o.getFormatType()==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(ot,"left")},order:1},{ChildComponent:Vo,isActive:({selection:t})=>{if(!tt(t))return!1;for(let e of t.getNodes()){if(ie(e)&&e.getFormatType()==="center")continue;let o=e.getParent();if(!(ie(o)&&o.getFormatType()==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(ot,"center")},order:2},{ChildComponent:zo,isActive:({selection:t})=>{if(!tt(t))return!1;for(let e of t.getNodes()){if(ie(e)&&e.getFormatType()==="right")continue;let o=e.getParent();if(!(ie(o)&&o.getFormatType()==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(ot,"right")},order:3},{ChildComponent:Ko,isActive:({selection:t})=>{if(!tt(t))return!1;for(let e of t.getNodes()){if(ie(e)&&e.getFormatType()==="justify")continue;let o=e.getParent();if(!(ie(o)&&o.getFormatType()==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(ot,"justify")},order:4}])],Ml=y({toolbarFixed:{groups:Xo},toolbarInline:{groups:Xo}});import{$createQuoteNode as rr,$isQuoteNode as tr,QuoteNode as Dl}from"@lexical/rich-text";import{$setBlocksType as nr}from"@lexical/selection";import{$getSelection as ir,$isRangeSelection as Ol}from"lexical";import{jsx as Jo}from"react/jsx-runtime";import"react";var Wt=()=>Jo("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:Jo("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 qo}from"react/jsx-runtime";import"react";var De=()=>qo("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:qo("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 W=t=>({type:"dropdown",ChildComponent:De,items:t,key:"text",order:25});import{$createQuoteNode as vl,$isQuoteNode as Qo,QuoteNode as Fl}from"@lexical/rich-text";import{$createLineBreakNode as Al}from"lexical";var er={type:"element",dependencies:[Fl],export:(t,e)=>{if(!Qo(t))return null;let o=e(t).split(`
1
+ "use client";import{a as Ft,b as pl,c as fl,d as hl,f as gl,h as Cl}from"./chunk-GK7ZKYHL.js";import{a as ke,b as At,c as Ne,d as Ho,e as Bo}from"./chunk-XIBMVIFW.js";import{a as Le,b as Ye,c as Xe,d as Je}from"./chunk-PECDZEZY.js";import{a as Ie,b as Re,c as ye,d as Dt}from"./chunk-EPEFKP5H.js";import{a as ae,b as qe,c as Se,d as Me,e as ve,f as Ot}from"./chunk-BR57XNHD.js";import{a as ml,b as $}from"./chunk-MFAXC4ZA.js";function G(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{jsx as Uo,jsxs as xl}from"react/jsx-runtime";import{createHeadlessEditor as bl}from"@lexical/headless";import{useClientFunctions as _l,useTableCell as Tl}from"@payloadcms/ui";import{$getRoot as El}from"lexical";import Pt,{useEffect as Wo,useState as $t}from"react";var jo={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",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 Fe={namespace:"lexical",theme:jo};function Qe({clientFunctions:t,schemaPath:e,unSanitizedEditorConfig:o}){for(let l of o.features)if(!l?.clientFeatureProps?.featureKey||l?.clientFeatureProps?.order===void 0||l?.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.");o.features=o.features.sort((l,s)=>l.clientFeatureProps.order-s.clientFeatureProps.order);let r=new Map(o.features.map(l=>[l.clientFeatureProps.featureKey,l])),n=new Map,i=0;for(let l of o.features){let s={};Object.entries(t).forEach(([c,u])=>{if(c.startsWith(`lexicalFeature.${e}.${l.clientFeatureProps.featureKey}.components.`)){let d=c.split(`${e}.${l.clientFeatureProps.featureKey}.components.`)[1];s[d]=u}});let a=typeof l.feature=="function"?l.feature({clientFunctions:s,featureProviderMap:r,resolvedFeatures:n,unSanitizedEditorConfig:o}):l.feature;n.set(l.clientFeatureProps.featureKey,{...a,key:l.clientFeatureProps.featureKey,order:i}),i++}return n}var Go=t=>{let e={enabledFeatures:[],hooks:{load:[],save:[]},markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}};if(!t?.size)return e;t.forEach(o=>{if(o.hooks&&(o.hooks?.load?.length&&(e.hooks.load=e.hooks.load.concat(o.hooks.load)),o.hooks?.save?.length&&(e.hooks.save=e.hooks.save.concat(o.hooks.save))),o.providers?.length&&(e.providers=e.providers.concat(o.providers)),o.nodes?.length&&(e.nodes=e.nodes.concat(o.nodes)),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)}}o.markdownTransformers?.length&&(e.markdownTransformers=e.markdownTransformers.concat(o.markdownTransformers)),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 Ae(t,e,o){return{admin:o,features:Go(e),lexical:t,resolvedFeatureMap:e}}var wl=t=>{let{admin:e,field:{_schemaPath:o,richTextComponentMap:r},lexicalEditorConfig:n}=t,[i,l]=Pt.useState("Loading..."),{cellData:s}=Tl(),a=_l(),[c,u]=$t(!1),[d,m]=$t([]),[p,f]=$t(null),h=r.get("features").sort((g,v)=>g.order-v.order),_=0;for(let g of h){let v=Array.from(r.keys()).filter(M=>M.startsWith(`feature.${g.key}.components.`));_+=1,_+=v.length}return Wo(()=>{if(!c){let g=[],v=0;if(Object.entries(a).forEach(([M,b])=>{M.startsWith(`lexicalFeature.${o}.`)&&(M.includes(".lexical_internal_components.")||g.push(b),v++)}),v===_){m(g),u(!0);let M=Qe({clientFunctions:a,schemaPath:o,unSanitizedEditorConfig:{features:g,lexical:n}});f(Ae(n||Fe,M,e))}}},[e,h,c,a,o,h.length,d,p,n,r,_]),Wo(()=>{if(!c)return;let g=s;if(g==null||!c||!p){l("");return}if(p?.features?.hooks?.load?.length&&p.features.hooks.load.forEach(b=>{g=b({incomingEditorState:g})}),!g||typeof g!="object"){l("");return}if(Array.isArray(g)&&!("root"in g)){l("");return}if("jsonContent"in g){l("");return}let v=bl({namespace:p.lexical.namespace,nodes:Ft({editorConfig:p}),theme:p.lexical.theme});v.setEditorState(v.parseEditorState(g));let M=v.getEditorState().read(()=>El().getTextContent())||"";l(M)},[s,n,c,p]),c?Uo("span",{children:i}):Uo(Pt.Fragment,{children:Array.isArray(h)&&h.map(g=>{let M=Array.from(r.keys()).filter(b=>b.startsWith(`lexical_internal_feature.${g.key}.lexical_internal_components.`)).map(b=>r.get(b));return xl(Pt.Fragment,{children:[M?.length?M.map(b=>b):null,g.ClientFeature]},g.key)})})};import{$isElementNode as ie,$isRangeSelection as tt,FORMAT_ELEMENT_COMMAND as ot}from"lexical";import{jsx as Ht,jsxs as kl}from"react/jsx-runtime";import"react";var Vo=()=>kl("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:[Ht("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ht("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ht("path",{d:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Bt,jsxs as Nl}from"react/jsx-runtime";import"react";var Ko=()=>Nl("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:[Bt("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Bt("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Bt("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as jt,jsxs as Ll}from"react/jsx-runtime";import"react";var et=()=>Ll("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:[jt("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),jt("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),jt("path",{d:"M2.5 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Gt,jsxs as Il}from"react/jsx-runtime";import"react";var zo=()=>Il("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:[Gt("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Gt("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Gt("path",{d:"M7.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{useAddClientFunction as Rl,useFieldProps as yl,useTableCell as Sl}from"@payloadcms/ui";var Zo=(t,e)=>{let{schemaPath:o}=yl(),i=Sl()?.cellProps?.field?._schemaPath||o;Rl(`lexicalFeature.${i}.${t}`,e)};var Ut=t=>e=>(Zo(e.featureKey,t(e)),null);var y=t=>Ut(o=>{let r={clientFeatureProps:o};if(typeof t=="function")r.feature=({clientFunctions:n,featureProviderMap:i,resolvedFeatures:l,unSanitizedEditorConfig:s})=>{let a=t({clientFunctions:n,featureProviderMap:i,props:o,resolvedFeatures:l,unSanitizedEditorConfig:s});return a.sanitizedClientFeatureProps===null&&(a.sanitizedClientFeatureProps=o),a};else{let n={...t};n.sanitizedClientFeatureProps=o,r.feature=n}return r});var Yo=t=>({type:"dropdown",ChildComponent:et,items:t,key:"align",order:30});var Xo=[Yo([{ChildComponent:et,isActive:({selection:t})=>{if(!tt(t))return!1;for(let e of t.getNodes()){if(ie(e)&&e.getFormatType()==="left")continue;let o=e.getParent();if(!(ie(o)&&o.getFormatType()==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(ot,"left")},order:1},{ChildComponent:Vo,isActive:({selection:t})=>{if(!tt(t))return!1;for(let e of t.getNodes()){if(ie(e)&&e.getFormatType()==="center")continue;let o=e.getParent();if(!(ie(o)&&o.getFormatType()==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(ot,"center")},order:2},{ChildComponent:zo,isActive:({selection:t})=>{if(!tt(t))return!1;for(let e of t.getNodes()){if(ie(e)&&e.getFormatType()==="right")continue;let o=e.getParent();if(!(ie(o)&&o.getFormatType()==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(ot,"right")},order:3},{ChildComponent:Ko,isActive:({selection:t})=>{if(!tt(t))return!1;for(let e of t.getNodes()){if(ie(e)&&e.getFormatType()==="justify")continue;let o=e.getParent();if(!(ie(o)&&o.getFormatType()==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(ot,"justify")},order:4}])],Ml=y({toolbarFixed:{groups:Xo},toolbarInline:{groups:Xo}});import{$createQuoteNode as rr,$isQuoteNode as tr,QuoteNode as Dl}from"@lexical/rich-text";import{$setBlocksType as nr}from"@lexical/selection";import{$getSelection as ir,$isRangeSelection as Ol}from"lexical";import{jsx as Jo}from"react/jsx-runtime";import"react";var Wt=()=>Jo("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:Jo("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 qo}from"react/jsx-runtime";import"react";var De=()=>qo("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:qo("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 W=t=>({type:"dropdown",ChildComponent:De,items:t,key:"text",order:25});import{$createQuoteNode as vl,$isQuoteNode as Qo,QuoteNode as Fl}from"@lexical/rich-text";import{$createLineBreakNode as Al}from"lexical";var er={type:"element",dependencies:[Fl],export:(t,e)=>{if(!Qo(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(Qo(i)){i.splice(i.getChildrenSize(),0,[Al(),...e]),i.select(0,0),t.remove();return}}let n=vl();n.append(...e),t.replace(n),n.select(0,0)}};var or=[W([{ChildComponent:Wt,isActive:({selection:t})=>{if(!Ol(t))return!1;for(let e of t.getNodes())if(!tr(e)&&!tr(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=ir();nr(e,()=>rr())})},order:20}])],Pl=y({markdownTransformers:[er],nodes:[Dl],slashMenu:{groups:[G([{Icon:Wt,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=ir();nr(e,()=>rr())})}}])]},toolbarFixed:{groups:or},toolbarInline:{groups:or}});import{getTranslation as lt}from"@payloadcms/translations";import{jsx as Vt,jsxs as $l}from"react/jsx-runtime";import"react";var rt=()=>$l("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("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),Vt("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),Vt("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as lr}from"react/jsx-runtime";import"react";var nt=()=>lr("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:lr("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 Ul}from"react/jsx-runtime";import Wl from"bson-objectid";import Vl from"react";import{DecoratorBlockNode as Hl}from"@lexical/react/LexicalDecoratorBlockNode.js";import Bl from"bson-objectid";import{deepCopyObjectSimple as jl}from"payload/shared";var Oe=class extends Hl{__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=Gl(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=jl(e),r=this.getWritable();r.__fields=o}};function Gl(t){return new Oe({fields:{...t,id:t?.id||new Bl.default().toHexString()}})}var Kl=Vl.lazy(()=>import("./component-7RAP75FW.js").then(t=>({default:t.BlockComponent}))),X=class extends Oe{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 Ul(Kl,{formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function it(t){return new X({fields:{...t,id:t?.id||new Wl.default().toHexString()}})}function zl(t){return t instanceof X}import{c as Zl}from"react/compiler-runtime";import{jsx as Yl}from"react/jsx-runtime";import{useLexicalComposerContext as Xl}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Jl,$wrapNodeInElement as ql,mergeRegister as Ql}from"@lexical/utils";import{getTranslation as es}from"@payloadcms/translations";import{formatDrawerSlug as ts,useEditDepth as os,useFieldProps as rs,useModal as ns,useTranslation as is}from"@payloadcms/ui";import{$createParagraphNode as ls,$getNodeByKey as ss,$getPreviousSelection as as,$getSelection as sr,$insertNodes as cs,$isParagraphNode as ar,$isRangeSelection as cr,$isRootOrShadowRoot as us,COMMAND_PRIORITY_EDITOR as Kt}from"lexical";import{useEffect as ds,useState as zt}from"react";var ur=()=>{let t=Zl(25),[e]=Xl(),{closeModal:o,toggleModal:r}=ns(),[n,i]=zt(null),[l,s]=zt(""),[a,c]=zt(null),{i18n:u,t:d}=is(),{schemaPath:m}=rs(),{uuid:p}=$(),f=os(),h="lexical-inlineBlocks-create-"+p,_;t[0]!==h||t[1]!==f?(_=ts({slug:h,depth:f}),t[0]=h,t[1]=f,t[2]=_):_=t[2];let g=_,{field:v}=$(),{richTextComponentMap:M}=v,b,E;if(t[3]!==e||t[4]!==a||t[5]!==r||t[6]!==g?(b=()=>{if(!e.hasNodes([X]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return Ql(e.registerCommand(ke,w=>(e.update(()=>{let x=sr()||as();if(cr(x)){let C=it(w);Jl(C);let{focus:N}=x,L=N.getNode();ar(L)&&L.getTextContentSize()===0&&L.getParent().getChildren().filter(k=>ar(k)).length>1&&L.remove()}}),!0),Kt),e.registerCommand(At,w=>{if(a){let C=ss(a);return C?(C.setFields(w),c(null),!0):!1}let x=Bo(w);return cs([x]),us(x.getParentOrThrow())&&ql(x,ls).selectEnd(),!0},Kt),e.registerCommand(Ne,w=>{let{fields:x,nodeKey:C}=w;if(i(x??null),c(C??null),s(x?.blockType??""),C)return r(g),!0;let N;return N=null,e.getEditorState().read(()=>{let L=sr();cr(L)&&(N=L)}),N&&r(g),!0},Kt))},E=[e,a,r,g],t[3]=e,t[4]=a,t[5]=r,t[6]=g,t[7]=b,t[8]=E):(b=t[7],E=t[8]),ds(b,E),!n)return null;let T=`${m}.lexical_internal_feature.blocks.lexical_inline_blocks.lexical_inline_blocks.${n?.blockType}`,I="lexical_internal_feature.blocks.fields.lexical_inline_blocks",S,R;if(t[9]!==M||t[10]!==n||t[11]!==u||t[12]!==d||t[13]!==o||t[14]!==g||t[15]!==l||t[16]!==e||t[17]!==T){R=Symbol.for("react.early_return_sentinel");e:{let w=M.has(I)?M.get(I)[0]:null,x=w?w.blocks.find(L=>L.slug===n?.blockType):null;if(!w){R=null;break e}let C=x?.labels?.singular?es(x?.labels?.singular,u):x?.slug,N;t[20]!==o||t[21]!==g||t[22]!==l||t[23]!==e?(N=(L,k)=>{o(g),k&&(k.blockType=l,e.dispatchCommand(At,k))},t[20]=o,t[21]=g,t[22]=l,t[23]=e,t[24]=N):N=t[24],S=Yl(ae,{data:n,drawerSlug:g,drawerTitle:d(`lexical:blocks:inlineBlocks:${n?.id?"edit":"create"}`,{label:C??d("lexical:blocks:inlineBlocks:label")}),featureKey:"blocks",fieldMapOverride:x?.fields,handleDrawerSubmit:N,schemaFieldsPathOverride:T,schemaPathSuffix:n?.blockType})}t[9]=M,t[10]=n,t[11]=u,t[12]=d,t[13]=o,t[14]=g,t[15]=l,t[16]=e,t[17]=T,t[18]=S,t[19]=R}else S=t[18],R=t[19];return R!==Symbol.for("react.early_return_sentinel")?R:S};var ms=y(({props:t})=>({nodes:[X,Ho],plugins:[{Component:ur,position:"normal"}],sanitizedClientFeatureProps:t,slashMenu:{groups:[t.clientBlockSlugs?.length?{items:t.clientBlockSlugs.map(e=>({Icon:rt,key:"block-"+e,keywords:["block","blocks",e],label:({i18n:o,richTextComponentMap:r})=>{let l=r.get("lexical_internal_feature.blocks.fields.lexical_blocks")[0].blocks.find(a=>a.slug===e);return l.labels.singular?lt(l.labels.singular,o):l.slug},onSelect:({editor:o})=>{o.dispatchCommand(ke,{id:null,blockName:"",blockType:e})}})),key:"blocks",label:({i18n:e})=>e.t("lexical:blocks:label")}:null,t.clientInlineBlockSlugs?.length?{items:t.clientInlineBlockSlugs.map(e=>({Icon:nt,key:"inlineBlocks-"+e,keywords:["inlineBlock","inline block",e],label:({i18n:o,richTextComponentMap:r})=>{let l=r.get("lexical_internal_feature.blocks.fields.lexical_inline_blocks")[0].blocks.find(a=>a.slug===e);return l.labels.singular?lt(l.labels.singular,o):l.slug},onSelect:({editor:o})=>{o.dispatchCommand(Ne,{fields:{id:null,blockName:"",blockType:e}})}})),key:"inlineBlocks",label:({i18n:e})=>e.t("lexical:blocks:inlineBlocks:label")}:null].filter(Boolean)},toolbarFixed:{groups:[t.clientBlockSlugs?.length?{type:"dropdown",ChildComponent:rt,items:t.clientBlockSlugs.map((e,o)=>({ChildComponent:rt,isActive:void 0,key:"block-"+e,label:({i18n:r,richTextComponentMap:n})=>{let s=n.get("lexical_internal_feature.blocks.fields.lexical_blocks")[0].blocks.find(c=>c.slug===e);return s.labels.singular?lt(s.labels.singular,r):s.slug},onSelect:({editor:r})=>{r.dispatchCommand(ke,{id:null,blockName:"",blockType:e})},order:o})),key:"blocks",order:20}:null,t.clientInlineBlockSlugs?.length?{type:"dropdown",ChildComponent:nt,items:t.clientInlineBlockSlugs.map((e,o)=>({ChildComponent:nt,isActive:void 0,key:"inlineBlock-"+e,label:({i18n:r,richTextComponentMap:n})=>{let s=n.get("lexical_internal_feature.blocks.fields.lexical_inline_blocks")[0].blocks.find(c=>c.slug===e);return s.labels.singular?lt(s.labels.singular,r):s.slug},onSelect:({editor:r})=>{r.dispatchCommand(Ne,{fields:{blockType:e}})},order:o})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}));import{jsx as ue,jsxs as Xt}from"react/jsx-runtime";import{useLexicalComposerContext as hs}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as gs,$createTextNode as Cs,$getRoot as xs}from"lexical";import*as hr from"react";import{useCallback as ce,useEffect as Zt,useLayoutEffect as mr,useRef as Yt,useState as st}from"react";var K=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";var ps=K&&"documentMode"in document?document.documentMode:null,dr=K&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),nh=K&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),ih=K&&"InputEvent"in window&&!ps?"getTargetRanges"in new window.InputEvent("input"):!1,lh=K&&/Version\/[\d.].*Safari/.test(navigator.userAgent),sh=K&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,ah=K&&/Android/.test(navigator.userAgent),ch=K&&/Win/.test(navigator.platform),fs=K&&/^(?=.*Chrome).*/i.test(navigator.userAgent),uh=K&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!fs;var bs=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)},_s=(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)},Ts=t=>{let o=((r,n)=>{switch(r){case"click":return` await page.mouse.click(${n.x}, ${n.y});`;case"press":return` await page.keyboard.press('${n}');`;case"keydown":return` await page.keyboard.keydown('${n}');`;case"keyup":return` await page.keyboard.keyup('${n}');`;case"type":return` await page.keyboard.type('${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(Qo(i)){i.splice(i.getChildrenSize(),0,[Al(),...e]),i.select(0,0),t.remove();return}}let n=vl();n.append(...e),t.replace(n),n.select(0,0)}};var or=[W([{ChildComponent:Wt,isActive:({selection:t})=>{if(!Ol(t))return!1;for(let e of t.getNodes())if(!tr(e)&&!tr(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=ir();nr(e,()=>rr())})},order:20}])],Pl=y({markdownTransformers:[er],nodes:[Dl],slashMenu:{groups:[G([{Icon:Wt,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=ir();nr(e,()=>rr())})}}])]},toolbarFixed:{groups:or},toolbarInline:{groups:or}});import{getTranslation as lt}from"@payloadcms/translations";import{jsx as Vt,jsxs as $l}from"react/jsx-runtime";import"react";var rt=()=>$l("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("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),Vt("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),Vt("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as lr}from"react/jsx-runtime";import"react";var nt=()=>lr("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:lr("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 Ul}from"react/jsx-runtime";import Wl from"bson-objectid";import Vl from"react";import{DecoratorBlockNode as Hl}from"@lexical/react/LexicalDecoratorBlockNode.js";import Bl from"bson-objectid";import{deepCopyObjectSimple as jl}from"payload/shared";var Oe=class extends Hl{__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=Gl(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=jl(e),r=this.getWritable();r.__fields=o}};function Gl(t){return new Oe({fields:{...t,id:t?.id||new Bl.default().toHexString()}})}var Kl=Vl.lazy(()=>import("./component-BRCRMQID.js").then(t=>({default:t.BlockComponent}))),X=class extends Oe{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 Ul(Kl,{formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function it(t){return new X({fields:{...t,id:t?.id||new Wl.default().toHexString()}})}function zl(t){return t instanceof X}import{c as Zl}from"react/compiler-runtime";import{jsx as Yl}from"react/jsx-runtime";import{useLexicalComposerContext as Xl}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Jl,$wrapNodeInElement as ql,mergeRegister as Ql}from"@lexical/utils";import{getTranslation as es}from"@payloadcms/translations";import{formatDrawerSlug as ts,useEditDepth as os,useFieldProps as rs,useModal as ns,useTranslation as is}from"@payloadcms/ui";import{$createParagraphNode as ls,$getNodeByKey as ss,$getPreviousSelection as as,$getSelection as sr,$insertNodes as cs,$isParagraphNode as ar,$isRangeSelection as cr,$isRootOrShadowRoot as us,COMMAND_PRIORITY_EDITOR as Kt}from"lexical";import{useEffect as ds,useState as zt}from"react";var ur=()=>{let t=Zl(25),[e]=Xl(),{closeModal:o,toggleModal:r}=ns(),[n,i]=zt(null),[l,s]=zt(""),[a,c]=zt(null),{i18n:u,t:d}=is(),{schemaPath:m}=rs(),{uuid:p}=$(),f=os(),h="lexical-inlineBlocks-create-"+p,_;t[0]!==h||t[1]!==f?(_=ts({slug:h,depth:f}),t[0]=h,t[1]=f,t[2]=_):_=t[2];let g=_,{field:v}=$(),{richTextComponentMap:M}=v,b,E;if(t[3]!==e||t[4]!==a||t[5]!==r||t[6]!==g?(b=()=>{if(!e.hasNodes([X]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return Ql(e.registerCommand(ke,w=>(e.update(()=>{let x=sr()||as();if(cr(x)){let C=it(w);Jl(C);let{focus:N}=x,L=N.getNode();ar(L)&&L.getTextContentSize()===0&&L.getParent().getChildren().filter(k=>ar(k)).length>1&&L.remove()}}),!0),Kt),e.registerCommand(At,w=>{if(a){let C=ss(a);return C?(C.setFields(w),c(null),!0):!1}let x=Bo(w);return cs([x]),us(x.getParentOrThrow())&&ql(x,ls).selectEnd(),!0},Kt),e.registerCommand(Ne,w=>{let{fields:x,nodeKey:C}=w;if(i(x??null),c(C??null),s(x?.blockType??""),C)return r(g),!0;let N;return N=null,e.getEditorState().read(()=>{let L=sr();cr(L)&&(N=L)}),N&&r(g),!0},Kt))},E=[e,a,r,g],t[3]=e,t[4]=a,t[5]=r,t[6]=g,t[7]=b,t[8]=E):(b=t[7],E=t[8]),ds(b,E),!n)return null;let T=`${m}.lexical_internal_feature.blocks.lexical_inline_blocks.lexical_inline_blocks.${n?.blockType}`,I="lexical_internal_feature.blocks.fields.lexical_inline_blocks",S,R;if(t[9]!==M||t[10]!==n||t[11]!==u||t[12]!==d||t[13]!==o||t[14]!==g||t[15]!==l||t[16]!==e||t[17]!==T){R=Symbol.for("react.early_return_sentinel");e:{let w=M.has(I)?M.get(I)[0]:null,x=w?w.blocks.find(L=>L.slug===n?.blockType):null;if(!w){R=null;break e}let C=x?.labels?.singular?es(x?.labels?.singular,u):x?.slug,N;t[20]!==o||t[21]!==g||t[22]!==l||t[23]!==e?(N=(L,k)=>{o(g),k&&(k.blockType=l,e.dispatchCommand(At,k))},t[20]=o,t[21]=g,t[22]=l,t[23]=e,t[24]=N):N=t[24],S=Yl(ae,{data:n,drawerSlug:g,drawerTitle:d(`lexical:blocks:inlineBlocks:${n?.id?"edit":"create"}`,{label:C??d("lexical:blocks:inlineBlocks:label")}),featureKey:"blocks",fieldMapOverride:x?.fields,handleDrawerSubmit:N,schemaFieldsPathOverride:T,schemaPathSuffix:n?.blockType})}t[9]=M,t[10]=n,t[11]=u,t[12]=d,t[13]=o,t[14]=g,t[15]=l,t[16]=e,t[17]=T,t[18]=S,t[19]=R}else S=t[18],R=t[19];return R!==Symbol.for("react.early_return_sentinel")?R:S};var ms=y(({props:t})=>({nodes:[X,Ho],plugins:[{Component:ur,position:"normal"}],sanitizedClientFeatureProps:t,slashMenu:{groups:[t.clientBlockSlugs?.length?{items:t.clientBlockSlugs.map(e=>({Icon:rt,key:"block-"+e,keywords:["block","blocks",e],label:({i18n:o,richTextComponentMap:r})=>{let l=r.get("lexical_internal_feature.blocks.fields.lexical_blocks")[0].blocks.find(a=>a.slug===e);return l.labels.singular?lt(l.labels.singular,o):l.slug},onSelect:({editor:o})=>{o.dispatchCommand(ke,{id:null,blockName:"",blockType:e})}})),key:"blocks",label:({i18n:e})=>e.t("lexical:blocks:label")}:null,t.clientInlineBlockSlugs?.length?{items:t.clientInlineBlockSlugs.map(e=>({Icon:nt,key:"inlineBlocks-"+e,keywords:["inlineBlock","inline block",e],label:({i18n:o,richTextComponentMap:r})=>{let l=r.get("lexical_internal_feature.blocks.fields.lexical_inline_blocks")[0].blocks.find(a=>a.slug===e);return l.labels.singular?lt(l.labels.singular,o):l.slug},onSelect:({editor:o})=>{o.dispatchCommand(Ne,{fields:{id:null,blockName:"",blockType:e}})}})),key:"inlineBlocks",label:({i18n:e})=>e.t("lexical:blocks:inlineBlocks:label")}:null].filter(Boolean)},toolbarFixed:{groups:[t.clientBlockSlugs?.length?{type:"dropdown",ChildComponent:rt,items:t.clientBlockSlugs.map((e,o)=>({ChildComponent:rt,isActive:void 0,key:"block-"+e,label:({i18n:r,richTextComponentMap:n})=>{let s=n.get("lexical_internal_feature.blocks.fields.lexical_blocks")[0].blocks.find(c=>c.slug===e);return s.labels.singular?lt(s.labels.singular,r):s.slug},onSelect:({editor:r})=>{r.dispatchCommand(ke,{id:null,blockName:"",blockType:e})},order:o})),key:"blocks",order:20}:null,t.clientInlineBlockSlugs?.length?{type:"dropdown",ChildComponent:nt,items:t.clientInlineBlockSlugs.map((e,o)=>({ChildComponent:nt,isActive:void 0,key:"inlineBlock-"+e,label:({i18n:r,richTextComponentMap:n})=>{let s=n.get("lexical_internal_feature.blocks.fields.lexical_inline_blocks")[0].blocks.find(c=>c.slug===e);return s.labels.singular?lt(s.labels.singular,r):s.slug},onSelect:({editor:r})=>{r.dispatchCommand(Ne,{fields:{blockType:e}})},order:o})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}));import{jsx as ue,jsxs as Xt}from"react/jsx-runtime";import{useLexicalComposerContext as hs}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as gs,$createTextNode as Cs,$getRoot as xs}from"lexical";import*as hr from"react";import{useCallback as ce,useEffect as Zt,useLayoutEffect as mr,useRef as Yt,useState as st}from"react";var K=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";var ps=K&&"documentMode"in document?document.documentMode:null,dr=K&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),nh=K&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),ih=K&&"InputEvent"in window&&!ps?"getTargetRanges"in new window.InputEvent("input"):!1,lh=K&&/Version\/[\d.].*Safari/.test(navigator.userAgent),sh=K&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,ah=K&&/Android/.test(navigator.userAgent),ch=K&&/Win/.test(navigator.platform),fs=K&&/^(?=.*Chrome).*/i.test(navigator.userAgent),uh=K&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!fs;var bs=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)},_s=(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)},Ts=t=>{let o=((r,n)=>{switch(r){case"click":return` await page.mouse.click(${n.x}, ${n.y});`;case"press":return` await page.keyboard.press('${n}');`;case"keydown":return` await page.keyboard.keydown('${n}');`;case"keyup":return` await page.keyboard.keyup('${n}');`;case"type":return` await page.keyboard.type('${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},
@@ -31,8 +31,8 @@ ${e.map(Ts).join(`
31
31
  `)}
32
32
  });
33
33
  });
34
- `},[t,e]),p=ce((b,E)=>{o(T=>{let I=e.length-1,S=e[I];if(S&&S.name===b){if(b==="type")return[...e.slice(0,I),{...S,value:S.value+E}];if(S.value===E)return[...e.slice(0,I),{...S,count:S.count+1}]}return[...T,{name:b,count:1,value:E}]})},[e,o]);mr(()=>{let b=T=>{if(!r)return;let I=T.key;Es(T)?p("selectAll",""):fr.has(I)?p("press",T.key):[...I].length>1?p("keydown",T.key):p("type",T.key)},E=T=>{if(!r)return;let I=T.key;!fr.has(I)&&[...I].length>1&&p("keyup",T.key)};return t.registerRootListener((T,I)=>{I!==null&&(I.removeEventListener("keydown",b),I.removeEventListener("keyup",E)),T!==null&&(T.addEventListener("keydown",b),T.addEventListener("keyup",E))})},[t,r,p]),mr(()=>{u.current&&u.current.scrollTo(0,u.current.scrollHeight)},[m]),Zt(()=>{if(e){let b=m();b!==null&&s(b),u.current&&u.current.scrollTo(0,u.current.scrollHeight)}},[m,e]),Zt(()=>t.registerUpdateListener(({dirtyElements:E,dirtyLeaves:T,editorState:I})=>{if(!r)return;let S=I._selection,R=a.current,w=c.current;if(R!==S){if(T.size===0&&E.size===0&&!w){let C=window.getSelection();if(C&&(C.anchorNode==null||C.focusNode==null))return}a.current=S}c.current=!1;let x=m();x!==null&&s(x)}),[t,m,r,p]),Zt(()=>r?t.registerUpdateListener(()=>{let E=t.getRootElement();E!==null&&i(E?.innerHTML)}):void 0,[t,r]);let f=ce(b=>{r||(b.update(()=>{let E=xs();E.clear();let T=Cs();E.append(gs().append(T)),T.select()}),o([])),n(E=>!E)},[r]),h=ce(()=>{if(!r)return;let b=window.getSelection();if(b===null||b.anchorNode==null||b.focusNode==null)return;let{anchorNode:E,anchorOffset:T,focusNode:I,focusOffset:S}=ws(b),R=d().getRootElement(),w;E!==null&&(w=pr(E,R));let x;I!==null&&(x=pr(I,R)),p("snapshot",{anchorNode:E,anchorOffset:T,anchorPath:w,focusNode:I,focusOffset:S,focusPath:x})},[p,r,d]),_=ce(()=>{bs(m())},[m]),g=ce(()=>{_s("test.js",m())},[m]);return[ue("button",{className:`editor-dev-button ${r?"active":""}`,id:"test-recorder-button",onClick:b=>{f(d()),b.preventDefault()},title:r?"Disable test recorder":"Enable test recorder",type:"button",children:r?"Disable test recorder":"Enable test recorder"}),r?Xt("div",{className:"test-recorder-output",children:[Xt("div",{className:"test-recorder-toolbar",children:[ue("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:b=>{h(),b.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),ue("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:b=>{_(),b.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),ue("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:b=>{g(),b.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),ue("pre",{id:"test-recorder",ref:u,children:l})]}):null]}var gr=()=>{let[t]=hs(),[e,o]=ks(t);return Xt(hr.Fragment,{children:[ue("p",{children:"HI"}),e,o,ue("p",{children:"DONE"})]})};var Ns=y({plugins:[{Component:gr,position:"bottom"}]});import{c as Ls}from"react/compiler-runtime";import{jsx as Is}from"react/jsx-runtime";import{useLexicalComposerContext as Rs}from"@lexical/react/LexicalComposerContext.js";import{TreeView as ys}from"@lexical/react/LexicalTreeView.js";import"react";var Cr=()=>{let t=Ls(2),[e]=Rs(),o;return t[0]!==e?(o=Is(ys,{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 Ss=y({plugins:[{Component:Cr,position:"bottom"}]});import{$isRangeSelection as Ms,FORMAT_TEXT_COMMAND as vs}from"lexical";import{jsx as xr}from"react/jsx-runtime";import"react";var br=()=>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 U=t=>({type:"buttons",items:t,key:"format",order:40});var _r={type:"text-format",format:["bold","italic"],tag:"***"},Tr={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},Er={type:"text-format",format:["bold"],tag:"**"},wr={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var kr=[U([{ChildComponent:br,isActive:({selection:t})=>Ms(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(vs,"bold")},order:1}])],Fs=y(({featureProviderMap:t})=>{let e=[Er,wr];return t.get("italic")&&e.push(Tr,_r),{markdownTransformers:e,toolbarFixed:{groups:kr},toolbarInline:{groups:kr}}});import{$isRangeSelection as Ds,FORMAT_TEXT_COMMAND as Os}from"lexical";import{jsx as Nr,jsxs as As}from"react/jsx-runtime";import"react";var Lr=()=>As("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:[Nr("path",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),Nr("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var Ir={type:"text-format",format:["code"],tag:"`"};var Rr=[U([{ChildComponent:Lr,isActive:({selection:t})=>Ds(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(Os,"code")},order:7}])],Ps=y({markdownTransformers:[Ir],toolbarFixed:{groups:Rr},toolbarInline:{groups:Rr}});import{$isRangeSelection as $s,FORMAT_TEXT_COMMAND as Hs}from"lexical";import{jsx as yr}from"react/jsx-runtime";import"react";var Sr=()=>yr("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:yr("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 Mr={type:"text-format",format:["italic"],tag:"*"},vr={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var Fr=[U([{ChildComponent:Sr,isActive:({selection:t})=>$s(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(Hs,"italic")},order:2}])],Bs=y({markdownTransformers:[Mr,vr],toolbarFixed:{groups:Fr},toolbarInline:{groups:Fr}});import{$isRangeSelection as Gs,FORMAT_TEXT_COMMAND as Us}from"lexical";import{jsx as Ar,jsxs as js}from"react/jsx-runtime";import"react";var Dr=()=>js("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:[Ar("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"}),Ar("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var Or={type:"text-format",format:["strikethrough"],tag:"~~"};var Pr=[U([{ChildComponent:Dr,isActive:({selection:t})=>Gs(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(Us,"strikethrough")},order:4}])],Ws=y({markdownTransformers:[Or],toolbarFixed:{groups:Pr},toolbarInline:{groups:Pr}});import{$isRangeSelection as Vs,FORMAT_TEXT_COMMAND as Ks}from"lexical";import{jsx as $r}from"react/jsx-runtime";import"react";var Hr=()=>$r("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:$r("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 Br=[U([{ChildComponent:Hr,isActive:({selection:t})=>Vs(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(Ks,"subscript")},order:5}])],zs=y({toolbarFixed:{groups:Br},toolbarInline:{groups:Br}});import{$isRangeSelection as Zs,FORMAT_TEXT_COMMAND as Ys}from"lexical";import{jsx as jr}from"react/jsx-runtime";import"react";var Gr=()=>jr("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:jr("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 Ur=[U([{ChildComponent:Gr,isActive:({selection:t})=>Zs(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(Ys,"superscript")},order:6}])],Xs=y({toolbarFixed:{groups:Ur},toolbarInline:{groups:Ur}});import{$isRangeSelection as qs,FORMAT_TEXT_COMMAND as Qs}from"lexical";import{jsx as Wr,jsxs as Js}from"react/jsx-runtime";import"react";var Vr=()=>Js("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:[Wr("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"}),Wr("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var Kr=[U([{ChildComponent:Vr,isActive:({selection:t})=>qs(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(Qs,"underline")},order:3}])],ea=y({toolbarFixed:{groups:Kr},toolbarInline:{groups:Kr}});import{$createHeadingNode as na,$isHeadingNode as sn,HeadingNode as ia}from"@lexical/rich-text";import{$setBlocksType as la}from"@lexical/selection";import{$getSelection as sa,$isRangeSelection as aa}from"lexical";import{jsx as zr}from"react/jsx-runtime";import"react";var Zr=()=>zr("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:zr("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 Yr}from"react/jsx-runtime";import"react";var Xr=()=>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",{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 Jr}from"react/jsx-runtime";import"react";var qr=()=>Jr("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:Jr("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 Qr}from"react/jsx-runtime";import"react";var en=()=>Qr("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Qr("path",{d:"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 tn}from"react/jsx-runtime";import"react";var on=()=>tn("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:tn("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 rn}from"react/jsx-runtime";import"react";var nn=()=>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:"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 ta,$isHeadingNode as oa,HeadingNode as ra}from"@lexical/rich-text";var Jt=t=>(e,o,r)=>{let n=t(r);n&&(n.append(...o),e.replace(n),n.select(0,0))};var ln=t=>{let o=`^(${t.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`,r=new RegExp(o);return{type:"element",dependencies:[ra],export:(n,i)=>{if(!oa(n))return null;let l=Number(n.getTag().slice(1));return"#".repeat(l)+" "+i(n)},regExp:r,replace:Jt(n=>{let i="h"+n[1].length;return ta(i)})}};var an=t=>{let e=sa();la(e,()=>na(t))},cn={h1:Zr,h2:Xr,h3:qr,h4:en,h5:on,h6:nn},ca=y(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[W(e.map((r,n)=>({ChildComponent:cn[r],isActive:({selection:i})=>{if(!aa(i))return!1;for(let l of i.getNodes()){if(sn(l)&&l.getTag()===r)continue;let s=l.getParent();if(!(sn(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(()=>{an(r)})},order:n+2})))];return{markdownTransformers:[ln(e)],nodes:[ia],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[G(e.map(r=>({Icon:cn[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(()=>{an(r)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}});import{$isNodeSelection as xa}from"lexical";import{jsx as un}from"react/jsx-runtime";import"react";var qt=()=>un("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:un("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as dn,jsxs as ua}from"react/jsx-runtime";import"react";var mn=()=>ua("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[dn("path",{d:"M5 10h10",stroke:"currentColor"}),dn("path",{d:"M10 15V5",stroke:"currentColor"})]});var J=t=>({type:"dropdown",ChildComponent:mn,items:t,key:"add",order:10});var pn={type:"element",dependencies:[Ye],export:(t,e)=>Je(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=Xe();e&&t.replace(e)}};import{c as da}from"react/compiler-runtime";import{useLexicalComposerContext as ma}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as pa}from"@lexical/utils";import{$getSelection as fa,$isRangeSelection as ha,COMMAND_PRIORITY_EDITOR as ga}from"lexical";import{useEffect as Ca}from"react";var fn=()=>{let t=da(3),[e]=ma(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Le,n=>{let i=fa();if(!ha(i))return!1;if(i.focus.getNode()!==null){let s=Xe();pa(s)}return!0},ga),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Ca(o,r),null};var ba=y({markdownTransformers:[pn],nodes:[Ye],plugins:[{Component:fn,position:"normal"}],slashMenu:{groups:[G([{Icon:qt,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Le,void 0)}}])]},toolbarFixed:{groups:[J([{ChildComponent:qt,isActive:({selection:t})=>{if(!xa(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Je(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Le,void 0)}}])]}});import{INDENT_CONTENT_COMMAND as Ea,OUTDENT_CONTENT_COMMAND as wa}from"lexical";import{jsx as at,jsxs as _a}from"react/jsx-runtime";import"react";var hn=()=>_a("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:[at("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),at("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),at("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),at("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as ct,jsxs as Ta}from"react/jsx-runtime";import"react";var gn=()=>Ta("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:[ct("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),ct("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),ct("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),ct("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});var Cn=t=>({type:"buttons",items:t,key:"indent",order:35});var xn=[Cn([{ChildComponent:hn,isActive:()=>!1,isEnabled:({selection:t})=>{if(!t||!t?.getNodes()?.length)return!1;for(let e of t.getNodes())if("__indent"in e&&e.__indent>0||e.getParent()&&"__indent"in e.getParent()&&e.getParent().__indent>0)return!0;return!1},key:"indentDecrease",label:({i18n:t})=>t.t("lexical:indent:decreaseLabel"),onSelect:({editor:t})=>{t.dispatchCommand(wa,void 0)},order:1},{ChildComponent:gn,isActive:()=>!1,key:"indentIncrease",label:({i18n:t})=>t.t("lexical:indent:increaseLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Ea,void 0)},order:2}])],ka=y({toolbarFixed:{groups:xn},toolbarInline:{groups:xn}});import{$findMatchingParent as Ac}from"@lexical/utils";import{$getSelection as lo,$isRangeSelection as Zn}from"lexical";import{jsx as bn}from"react/jsx-runtime";import"react";var _n=()=>bn("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:bn("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 Tn}from"@lexical/selection";function fe(t){let{anchor:e}=t,{focus:o}=t,r=t.anchor.getNode(),n=t.focus.getNode();return r===n?r:t.isBackward()?Tn(o)?r:n:Tn(e)?r:n}var Qt=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as Da,$isTextNode as Oa}from"lexical";import{addClassNamesToElement as Na,isHTMLAnchorElement as La}from"@lexical/utils";import oo from"bson-objectid";import{$applyNodeReplacement as Ia,$createTextNode as En,$getSelection as Ra,$isElementNode as wn,$isRangeSelection as to,ElementNode as ya,createCommand as Sa}from"lexical";var Ma=new Set(["http:","https:","mailto:","sms:","tel:"]),V=class t extends ya{__fields;__id;constructor({id:e,fields:o={doc:null,linkType:"custom",newTab:!1,url:void 0},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:va,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 oo.default().toHexString(),e.version=3);let o=q({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=eo(o.rel,"add","noopener")),Na(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(!to(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(wn(r)){let n=q({fields:this.__fields});return r.append(n),n}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!Ma.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=eo(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=eo(o.rel,"remove","noopener"))),!1}};function va(t){let e=null;if(La(t)){let o=t.textContent;o!==null&&o!==""&&(e=q({id:new oo.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function q({id:t,fields:e}){return Ia(new V({id:t??new oo.default().toHexString(),fields:e}))}function j(t){return t instanceof V}var Y=Sa("TOGGLE_LINK_COMMAND");function kn(t){let e=Ra();if(!to(e)&&!t.selectedNodes.length)return;let o=to(e)?e.extract():t.selectedNodes;if(t===null)o.forEach(r=>{let n=r.getParent();if(j(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=j(i)?i:Fa(i);if(l!==null){l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append(En(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||wn(i)&&!i.isInline())){if(j(l)){n=l,l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append(En(t.text)),l.getChildren().forEach(s=>{s!==l.getLastChild()&&s.remove()}));return}if(l.is(r)||(r=l,n=q({fields:t.fields}),j(l)?i.getPreviousSibling()===null?l.insertBefore(n):l.insertAfter(n):i.insertBefore(n)),j(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 Fa(t){return Aa(t,e=>j(e))}function Aa(t,e){let o=t;for(;o!==null&&(o=o.getParent())!==null&&!e(o););return o}function eo(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 Nn={type:"text-match",dependencies:[V],export:(t,e,o)=>{if(!j(t))return null;let r=t,{url:n}=r.getFields(),i=`[${r.getTextContent()}](${n})`,l=r.getFirstChild();return r.getChildrenSize()===1&&Oa(l)?o(l,i):i},importRegExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:(t,e)=>{let[,o,r]=e,n=q({fields:{doc:null,linkType:"custom",newTab:!1,url:r}}),i=Da(o);i.setFormat(t.getFormat()),n.append(i),t.replace(n)},trigger:")"};import{$applyNodeReplacement as Pa,$isElementNode as $a}from"lexical";var Q=class t extends V{static clone(e){return new t({id:void 0,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=Pe({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($a(r)){let n=Pe({fields:this.__fields});return r.append(n),n}return null}};function Pe({fields:t}){return Pa(new Q({id:void 0,fields:t}))}function ee(t){return t instanceof Q}import{c as Ha}from"react/compiler-runtime";import{useLexicalComposerContext as Ba}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as ja}from"@lexical/utils";import{$createTextNode as Ln,$getSelection as Ga,$isElementNode as Rn,$isLineBreakNode as yn,$isNodeSelection as Ua,$isRangeSelection as Wa,$isTextNode as $e,TextNode as Va}from"lexical";import{useEffect as Ka}from"react";function In(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 Sn(t,e){for(let o=0;o<e.length;o++){let r=e[o](t);if(r!=null)return r}return null}var za=/[.,;\s]/;function dt(t){return za.test(t)}function Mn(t){return dt(t[t.length-1])}function no(t){return dt(t[0])}function Za(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function vn(t){let e=t.getPreviousSibling();return Rn(e)&&(e=e.getLastDescendant()),e===null||yn(e)||$e(e)&&Mn(e.getTextContent())}function Fn(t){let e=t.getNextSibling();return Rn(e)&&(e=e.getFirstDescendant()),e===null||yn(e)||$e(e)&&no(e.getTextContent())}function Ya(t,e,o,r){return(t>0?dt(o[t-1]):vn(r[0]))?e<o.length?dt(o[e]):Fn(r[r.length-1]):!1}function Xa(t,e,o){let r=[],n=[],i=[],l=0,s=0,a=[...t];for(;a.length>0;){let c=a[0],d=c.getTextContent().length,m=s;s+d<=e?(r.push(c),l+=d):m>=o?i.push(c):n.push(c),s+=d,a.shift()}return[l,r,n,i]}function Ja(t,e,o,r){let n={linkType:"custom",url:r.url,...r.fields},i=Pe({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=Ln(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 c=[],u;for(let f=1;f<t.length;f++){let h=t[f],g=h.getTextContent().length,v=s,M=s+g;if(v<o)if(M<=o)c.push(h);else{let[b,E]=h.splitText(o-v);c.push(b),u=E}s+=g}let d=Ga(),m=d?d.getNodes().find($e):void 0,p=Ln(a.getTextContent());return p.setFormat(a.getFormat()),p.setDetail(a.getDetail()),p.setStyle(a.getStyle()),i.append(p,...c),m&&m===a&&(Wa(d)?p.select(d.anchor.offset,d.focus.offset):Ua(d)&&p.select(0,p.getTextContent().length)),a.replace(i),u}}function qa(t,e,o){let r=[...t],n=r.map(a=>a.getTextContent()).join(""),i=n,l,s=0;for(;(l=Sn(i,e))!=null&&l!==null;){let a=l.index,c=l.length,u=a+c;if(Ya(s+a,s+u,n,r)){let[m,,p,f]=Xa(r,s+a,s+u),h=s+a-m,_=s+u-m,g=Ja(p,h,_,l);r=g?[g,...f]:f,o(l.url,null),s=0}else s+=u;i=i.substring(u)}}function ro(t,e,o){let r=t.getChildren(),n=r.length;for(let a=0;a<n;a++){let c=r[a];if(!$e(c)||!c.isSimpleText()){ut(t),o(null,t.getFields()?.url??null);return}}let i=t.getTextContent(),l=Sn(i,e);if(l===null||l.text!==i){ut(t),o(null,t.getFields()?.url??null);return}if(!vn(t)||!Fn(t)){ut(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 Qa(t,e,o){let r=t.getPreviousSibling(),n=t.getNextSibling(),i=t.getTextContent();if(ee(r)){let l=r.getFields()?.url?r.getFields()?.url?.startsWith("mailto:"):!1;(!no(i)||Za(i,l))&&(r.append(t),ro(r,e,o),o(null,r.getFields()?.url??null))}ee(n)&&!Mn(i)&&(ut(n),ro(n,e,o),o(null,n.getFields()?.url??null))}function ut(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 ec(t){let e=[t],o=t.getNextSibling();for(;o!==null&&$e(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function tc(t,e,o){let r=Ha(5),n,i;r[0]!==t||r[1]!==o||r[2]!==e?(n=()=>{if(!t.hasNodes([Q]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let l=(s,a)=>{o?.(s,a)};return ja(t.registerNodeTransform(Va,s=>{let a=s.getParentOrThrow(),c=s.getPreviousSibling();if(ee(a))ro(a,e,l);else if(!j(a)){if(s.isSimpleText()&&(no(s.getTextContent())||!ee(c))){let u=ec(s);qa(u,e,l)}Qa(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]),Ka(n,i)}var oc=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,rc=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,nc=[In(oc,t=>t.startsWith("http")?t:`https://${t}`),In(rc,t=>`mailto:${t}`)],An=()=>{let[t]=Ba();return tc(t,nc),null};import{jsx as ic}from"react/jsx-runtime";import{ClickableLinkPlugin as lc}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var Dn=()=>ic(lc,{});import{createCommand as sc}from"lexical";var mt=sc("TOGGLE_LINK_WITH_MODAL_COMMAND");import{jsx as Ec}from"react/jsx-runtime";import"react";import{createPortal as wc}from"react-dom";import{jsx as le,jsxs as io}from"react/jsx-runtime";import{useLexicalComposerContext as ac}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as On,mergeRegister as Pn}from"@lexical/utils";import{getTranslation as cc}from"@payloadcms/translations";import{CloseMenuIcon as uc,EditIcon as dc,formatDrawerSlug as mc,useConfig as pc,useEditDepth as fc,useModal as hc,useTranslation as gc}from"@payloadcms/ui";import{$getSelection as $n,$isLineBreakNode as Cc,$isRangeSelection as Hn,COMMAND_PRIORITY_HIGH as xc,COMMAND_PRIORITY_LOW as Bn,KEY_ESCAPE_COMMAND as bc,SELECTION_CHANGE_COMMAND as _c}from"lexical";import jn,{useCallback as Gn,useEffect as ft,useRef as Tc,useState as he}from"react";function pt(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(),c=t.top-r,u=t.left-n;c<a.top&&(c+=l.height+t.height+r*2),u+l.width>a.right&&(u=a.right-l.width-n),c-=s.top,u-=s.left,e.style.opacity="1",e.style.transform=`translate(${u}px, ${c}px)`}function Un({anchorElem:t}){let[e]=ac(),o=Tc(null),[r,n]=he(null),[i,l]=he(null),{uuid:s}=$(),{config:a}=pc(),{i18n:c,t:u}=gc(),[d,m]=he(null),{closeModal:p,toggleModal:f}=hc(),h=fc(),[_,g]=he(!1),[v,M]=he([]),[b,E]=he(!1),T=mc({slug:"lexical-rich-text-link-"+s,depth:h}),I=Gn(()=>{g(!1),o&&o.current&&(o.current.style.opacity="0",o.current.style.transform="translate(-10000px, -10000px)"),E(!1),n(null),l(null),M([]),m(null)},[g,n,l,M]),S=Gn(()=>{let R=$n(),w=null;if(!Hn(R)||!R){I();return}let x=fe(R);w=e.getElementByKey(x.getKey())?.getBoundingClientRect();let C=On(x,j),N=R.getNodes().filter(P=>!Cc(P)).find(P=>{let B=On(P,j);return C&&!C.is(B)||B&&!B.is(C)});if(C==null||N){I();return}let L={doc:void 0,linkType:void 0,newTab:void 0,url:"",...C.getFields(),id:C.getID(),text:C.getTextContent()};if(C.getFields()?.linkType==="custom")n(C.getFields()?.url??null),l(null);else{n(`/admin/collections/${C.getFields()?.doc?.relationTo}/${C.getFields()?.doc?.value}`);let P=a.collections.find(B=>B.slug===C.getFields()?.doc?.relationTo);if(!P)l(C.getFields()?.label?String(C.getFields()?.label):null),n(C.getFields()?.url?String(C.getFields()?.url):null);else{let B=u("fields:linkedTo",{label:cc(P.labels.singular,c)}).replace(/<[^>]*>?/g,"");l(B)}}m(L),g(!0),M(R?R?.getNodes():[]),ee(C)?E(!0):E(!1);let k=o.current,F=window.getSelection(),{activeElement:A}=document;if(k===null)return;let O=e.getRootElement();return F!==null&&O!==null&&O.contains(F.anchorNode)?(w||(w=F.getRangeAt(0).getBoundingClientRect()),w!=null&&(w.y+=40,pt(w,k,t))):(A==null||A.className!=="link-input")&&(O!==null&&pt(null,k,t),n(null),l(null)),!0},[e,I,a.collections,u,c,t]);return ft(()=>Pn(e.registerCommand(mt,R=>(e.dispatchCommand(Y,R),S(),f(T),!0),Bn)),[e,S,f,T]),ft(()=>{let R=t.parentElement,w=()=>{e.getEditorState().read(()=>{S()})};return window.addEventListener("resize",w),R?.addEventListener("scroll",w),()=>{window.removeEventListener("resize",w),R?.removeEventListener("scroll",w)}},[t.parentElement,e,S]),ft(()=>Pn(e.registerUpdateListener(({editorState:R})=>{R.read(()=>{S()})}),e.registerCommand(_c,()=>(S(),!0),Bn),e.registerCommand(bc,()=>_?(I(),!0):!1,xc)),[e,S,_,I]),ft(()=>{e.getEditorState().read(()=>{S()})},[e,S]),io(jn.Fragment,{children:[le("div",{className:"link-editor",ref:o,children:io("div",{className:"link-input",children:[r&&r.length>0?le("a",{href:r,rel:"noopener noreferrer",target:"_blank",children:i!=null&&i.length>0?i:r}):i!=null&&i.length>0?le("span",{className:"link-input__label-pure",children:i}):null,e.isEditable()&&io(jn.Fragment,{children:[le("button",{"aria-label":"Edit link",className:"link-edit",onClick:()=>{f(T)},onMouseDown:R=>{R.preventDefault()},tabIndex:0,type:"button",children:le(dc,{})}),!b&&le("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(Y,null)},onMouseDown:R=>{R.preventDefault()},tabIndex:0,type:"button",children:le(uc,{})})]})]})}),le(ae,{className:"lexical-link-edit-drawer",data:d,drawerSlug:T,drawerTitle:u("fields:editLink"),featureKey:"link",handleDrawerSubmit:(R,w)=>{p(T);let x=w,C={...x};delete C.text,e.update(()=>{let N=$n(),L=null;if(Hn(N)?L=fe(N).getParent():v.length&&(L=v[0].getParent()),L&&ee(L)){let k=q({fields:C});L.replace(k,!0)}}),e.dispatchCommand(Y,{fields:C,selectedNodes:v,text:x.text})},schemaPathSuffix:"fields"})]})}var Wn=t=>{let{anchorElem:e=document.body}=t;return wc(Ec(Un,{anchorElem:e}),e)};import{c as Lc}from"react/compiler-runtime";import{useLexicalComposerContext as Ic}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Rc}from"@lexical/utils";import{$getSelection as yc,$isElementNode as Sc,$isRangeSelection as Mc,COMMAND_PRIORITY_LOW as Kn,PASTE_COMMAND as vc}from"lexical";import{useEffect as Fc}from"react";var kc=/(?:[A-Za-z]{3,9}:(?:\/\/)?(?:[-;:&=+$,\w]+@)?[A-Za-z\d.-]+|(?:www.|[-;:&=+$,\w]+@)[A-Za-z\d.-]+)(?:\/[+~%/.\w-]*)?\??[-+=&;%@.\w]*#?\w*/,Nc=/^[\w\-./]*(?:#\w[\w-]*)?$/;function Vn(t){if(!t)return!1;if(t==="https://"||kc.test(t)||Nc.test(t))return!0;try{return new URL(t),!0}catch{}return!1}var zn=()=>{let t=Lc(3),[e]=Ic(),o,r;return t[0]!==e?(o=()=>{if(!e.hasNodes([V]))throw new Error("LinkPlugin: LinkNode not registered on editor");return Rc(e.registerCommand(Y,n=>(kn(n),!0),Kn),e.registerCommand(vc,n=>{let i=yc();if(!Mc(i)||i.isCollapsed()||!(n instanceof ClipboardEvent)||n.clipboardData==null)return!1;let l=n.clipboardData.getData("text");if(!Vn(l))return!1;if(!i.getNodes().some(s=>Sc(s))){let s={doc:null,linkType:"custom",newTab:!1,url:l};return e.dispatchCommand(Y,{fields:s,text:null}),n.preventDefault(),!0}return!1},Kn))},r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Fc(o,r),null};var Yn=[Qt([{ChildComponent:_n,isActive:({selection:t})=>{if(Zn(t)){let e=fe(t);return Ac(e,j)!=null}return!1},isEnabled:({selection:t})=>!!(Zn(t)&&lo()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(Y,null);else{let o=null,r=[];if(t.getEditorState().read(()=>{o=lo()?.getTextContent(),r=lo()?.getNodes()??[]}),!o?.length)return;let n={doc:null,linkType:"custom",newTab:!1,url:"https://"};t.dispatchCommand(mt,{fields:n,selectedNodes:r,text:o})}},order:1}])],Dc=y({markdownTransformers:[Nn],nodes:[V,Q],plugins:[{Component:zn,position:"normal"},{Component:An,position:"normal"},{Component:Dn,position:"normal"},{Component:Wn,position:"floatingAnchorElem"}],toolbarFixed:{groups:Yn},toolbarInline:{groups:Yn}});import{$isListNode as co,INSERT_CHECK_LIST_COMMAND as ti,ListItemNode as zc,ListNode as Zc}from"@lexical/list";import{$isRangeSelection as Yc}from"lexical";import{jsx as Xn,jsxs as Oc}from"react/jsx-runtime";import"react";var so=()=>Oc("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:[Xn("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),Xn("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Pc}from"react/jsx-runtime";import{ListPlugin as $c}from"@lexical/react/LexicalListPlugin.js";import"react";var ge=()=>Pc($c,{});function Ce(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as Gc,ListItemNode as Uc,ListNode as Wc}from"@lexical/list";import{$createListItemNode as Hc,$createListNode as Bc,$isListItemNode as jc,$isListNode as ao}from"@lexical/list";var Jn=4,xe=t=>(e,o,r)=>{let n=e.getPreviousSibling(),i=e.getNextSibling(),l=Hc(t==="check"?r[3]==="x":void 0);if(ao(i)&&i.getListType()===t){let a=i.getFirstChild();a!==null?a.insertBefore(l):i.append(l),e.remove()}else if(ao(n)&&n.getListType()===t)n.append(l),e.remove();else{let a=Bc(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/Jn);s&&l.setIndent(s)},de=(t,e,o)=>{let r=[],n=t.getChildren(),i=0;for(let l of n)if(jc(l)){if(l.getChildrenSize()===1){let u=l.getFirstChild();if(ao(u)){r.push(de(u,e,o+1));continue}}let s=" ".repeat(o*Jn),a=t.getListType(),c=a==="number"?`${t.getStart()+i}. `:a==="check"?`- [${l.getChecked()?"x":" "}] `:"- ";r.push(s+c+e(l)),i++}return r.join(`
35
- `)};var qn={type:"element",dependencies:[Wc,Uc],export:(t,e)=>Gc(t)?de(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:xe("check")};import{jsx as Vc}from"react/jsx-runtime";import{CheckListPlugin as Kc}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var Qn=()=>Vc(Kc,{});var ei=[W([{ChildComponent:so,isActive:({selection:t})=>{if(!Yc(t))return!1;for(let e of t.getNodes()){if(co(e)&&e.getListType()==="check")continue;let o=e.getParent();if(co(o)&&o.getListType()==="check")continue;let r=o?.getParent();if(!(co(r)&&r.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(ti,void 0)},order:12}])],Xc=y(({featureProviderMap:t})=>{let e=[{Component:Qn,position:"normal"}];return!t.has("unorderedList")&&!t.has("orderedList")&&e.push({Component:ge,position:"normal"}),{markdownTransformers:[qn],nodes:t.has("unorderedList")||t.has("orderedList")?[]:[Zc,zc],plugins:e,slashMenu:{groups:[Ce([{Icon:so,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:o})=>o.t("lexical:checklist:label"),onSelect:({editor:o})=>{o.dispatchCommand(ti,void 0)}}])]},toolbarFixed:{groups:ei},toolbarInline:{groups:ei}}});import{$isListNode as mo,INSERT_ORDERED_LIST_COMMAND as ni,ListItemNode as tu,ListNode as ou}from"@lexical/list";import{$isRangeSelection as ru}from"lexical";import{jsx as He,jsxs as Jc}from"react/jsx-runtime";import"react";var uo=()=>Jc("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[He("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"}),He("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"}),He("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),He("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),He("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as qc,ListItemNode as Qc,ListNode as eu}from"@lexical/list";var oi={type:"element",dependencies:[eu,Qc],export:(t,e)=>qc(t)?de(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:xe("number")};var ri=[W([{ChildComponent:uo,isActive:({selection:t})=>{if(!ru(t))return!1;for(let e of t.getNodes()){if(mo(e)&&e.getListType()==="number")continue;let o=e.getParent();if(mo(o)&&o.getListType()==="number")continue;let r=o?.getParent();if(!(mo(r)&&r.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(ni,void 0)},order:10}])],nu=y(({featureProviderMap:t})=>({markdownTransformers:[oi],nodes:t.has("orderedList")?[]:[ou,tu],plugins:t.has("orderedList")?[]:[{Component:ge,position:"normal"}],slashMenu:{groups:[Ce([{Icon:uo,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:e})=>e.t("lexical:orderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(ni,void 0)}}])]},toolbarFixed:{groups:ri},toolbarInline:{groups:ri}}));import{$isListNode as fo,INSERT_UNORDERED_LIST_COMMAND as si,ListItemNode as cu,ListNode as uu}from"@lexical/list";import{$isRangeSelection as du}from"lexical";import{jsx as be,jsxs as iu}from"react/jsx-runtime";import"react";var po=()=>iu("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:[be("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),be("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),be("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),be("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),be("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),be("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as lu,ListItemNode as su,ListNode as au}from"@lexical/list";var ii={type:"element",dependencies:[au,su],export:(t,e)=>lu(t)?de(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:xe("bullet")};var li=[W([{ChildComponent:po,isActive:({selection:t})=>{if(!du(t))return!1;for(let e of t.getNodes()){if(fo(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(fo(o)&&o.getListType()==="bullet")continue;let r=o?.getParent();if(!(fo(r)&&r.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(si,void 0)},order:11}])],mu=y({markdownTransformers:[ii],nodes:[uu,cu],plugins:[{Component:ge,position:"normal"}],slashMenu:{groups:[Ce([{Icon:po,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(si,void 0)}}])]},toolbarFixed:{groups:li},toolbarInline:{groups:li}});import{jsx as pu}from"react/jsx-runtime";import{addClassNamesToElement as fu}from"@lexical/utils";import{DecoratorNode as hu}from"lexical";import*as ai from"react";var gu=ai.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),Be=class t extends hu{__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 Cu({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return fu(o,"unknownConverted"),o}decorate(){return pu(gu,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function Cu({data:t}){return new Be({data:t})}var xu=y(()=>({nodes:[Be]}));import{jsx as bu}from"react/jsx-runtime";import{addClassNamesToElement as _u}from"@lexical/utils";import{DecoratorNode as Tu}from"lexical";import*as ci from"react";var Eu=ci.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),je=class t extends Tu{__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 wu({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return _u(o,"unknownConverted"),o}decorate(){return bu(Eu,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function wu({data:t}){return new je({data:t})}var ku=y(({clientFunctions:t})=>({nodes:[je]}));import{$setBlocksType as mi}from"@lexical/selection";import{$createParagraphNode as pi,$getSelection as fi,$isParagraphNode as ui,$isRangeSelection as Nu}from"lexical";var di=[W([{ChildComponent:De,isActive:({selection:t})=>{if(!Nu(t))return!1;for(let e of t.getNodes())if(!ui(e)&&!ui(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=fi();mi(e,()=>pi())})},order:1}])],Lu=y({slashMenu:{groups:[G([{Icon:De,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=fi();mi(e,()=>pi())})}}])]},toolbarFixed:{groups:di},toolbarInline:{groups:di}});import{$isNodeSelection as Ku}from"lexical";import{jsx as Ge,jsxs as Iu}from"react/jsx-runtime";import"react";var ho=()=>Iu("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:[Ge("g",{clipPath:"url(#clip0_4397_10817)",children:Ge("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"})}),Ge("defs",{children:Ge("clipPath",{id:"clip0_4397_10817",children:Ge("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{c as Au}from"react/compiler-runtime";import{jsx as Du}from"react/jsx-runtime";import{useLexicalComposerContext as Ou}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Pu}from"@lexical/utils";import{useConfig as $u}from"@payloadcms/ui";import{$getPreviousSelection as Hu,$getSelection as Bu,$isParagraphNode as bi,$isRangeSelection as ju,COMMAND_PRIORITY_EDITOR as Gu,createCommand as Uu}from"lexical";import{useEffect as Wu}from"react";import{c as Ru}from"react/compiler-runtime";import{jsx as ht}from"react/jsx-runtime";import{useLexicalComposerContext as yu}from"@lexical/react/LexicalComposerContext.js";import{useListDrawer as Su}from"@payloadcms/ui";import{$getNodeByKey as Mu,COMMAND_PRIORITY_EDITOR as vu}from"lexical";import{useEffect as hi,useState as gi}from"react";var Fu=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=Mu(o);n&&n.replace(ye({relationTo:e,value:r}))}):t.dispatchCommand(go,{relationTo:e,value:r})},Ci=t=>{let e=Ru(21),{enabledCollectionSlugs:o}=t,[r]=yu(),n;e[0]!==o?(n=()=>o[0],e[0]=o,e[1]=n):n=e[1];let[i,l]=gi(n),[s,a]=gi(null),c;e[2]!==o||e[3]!==i?(c={collectionSlugs:o,selectedCollection:i},e[2]=o,e[3]=i,e[4]=c):c=e[4];let[u,d,m]=Su(c),{closeDrawer:p,isDrawerOpen:f,openDrawer:h}=m,_,g;e[5]!==r||e[6]!==h?(_=()=>r.registerCommand(Ie,I=>(a(I?.replace?I?.replace.nodeKey:null),h(),!0),vu),g=[r,h],e[5]=r,e[6]=h,e[7]=_,e[8]=g):(_=e[7],g=e[8]),hi(_,g);let v;e[9]!==r||e[10]!==s||e[11]!==p?(v=I=>{let{collectionSlug:S,docID:R}=I;Fu({editor:r,relationTo:S,replaceNodeKey:s,value:R}),p()},e[9]=r,e[10]=s,e[11]=p,e[12]=v):v=e[12];let M=v,b;e[13]!==o?(b=()=>{l(o[0])},e[13]=o,e[14]=b):b=e[14];let E;e[15]!==f||e[16]!==o?(E=[f,o],e[15]=f,e[16]=o,e[17]=E):E=e[17],hi(b,E);let T;return e[18]!==M||e[19]!==u?(T=ht(u,{onSelect:M}),e[18]=M,e[19]=u,e[20]=T):T=e[20],T},xi=t=>t?.enabledCollectionSlugs?.length>0?ht(Ci,{...t}):ht(qe,{...t,children:ht(Ci,{...t})});var go=Uu("INSERT_RELATIONSHIP_COMMAND"),_i=t=>{let e=Au(10),{clientProps:o}=t,[r]=Ou(),{config:n}=$u(),{collections:i}=n,l=null;if(o?.enabledCollections)l=o?.enabledCollections;else if(o?.disabledCollections){let u;if(e[0]!==o||e[1]!==i){let d;e[3]!==o?(d=m=>{let{slug:p}=m;return!o?.disabledCollections?.includes(p)},e[3]=o,e[4]=d):d=e[4],u=i.filter(d).map(Vu),e[0]=o,e[1]=i,e[2]=u}else u=e[2];l=u}let s,a;e[5]!==r?(s=()=>{if(!r.hasNodes([Re]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return r.registerCommand(go,u=>{let d=Bu()||Hu();if(ju(d)){let m=ye(u);Pu(m);let{focus:p}=d,f=p.getNode();bi(f)&&f.getTextContentSize()===0&&f.getParent().getChildren().filter(h=>bi(h)).length>1&&f.remove()}return!0},Gu)},a=[r],e[5]=r,e[6]=s,e[7]=a):(s=e[6],a=e[7]),Wu(s,a);let c;return e[8]!==l?(c=Du(xi,{enabledCollectionSlugs:l}),e[8]=l,e[9]=c):c=e[9],c};function Vu(t){let{slug:e}=t;return e}var zu=y({nodes:[Re],plugins:[{Component:_i,position:"normal"}],slashMenu:{groups:[G([{Icon:ho,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ie,{replace:!1})}}])]},toolbarFixed:{groups:[J([{ChildComponent:ho,isActive:({selection:t})=>{if(!Ku(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Dt(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ie,{replace:!1})}}])]}});import{c as sd}from"react/compiler-runtime";import{jsx as z,jsxs as ad}from"react/jsx-runtime";import{useLexicalComposerContext as cd}from"@lexical/react/LexicalComposerContext.js";import{useScrollInfo as ud,useThrottledEffect as dd,useTranslation as md}from"@payloadcms/ui";import*as te from"react";import{useMemo as pd}from"react";import{jsx as Zu}from"react/jsx-runtime";import{mergeRegister as Yu}from"@lexical/utils";import{$getSelection as Xu}from"lexical";import{useCallback as Ju,useEffect as gt,useState as Co}from"react";var xo="toolbar-popup__button",Ue=({children:t,editor:e,item:o})=>{let[r,n]=Co(!0),[i,l]=Co(!1),[s,a]=Co(xo),c=$(),u=Ju(()=>{e.getEditorState().read(()=>{let d=Xu();if(o.isActive){let m=o.isActive({editor:e,editorConfigContext:c,selection:d});i!==m&&l(m)}if(o.isEnabled){let m=o.isEnabled({editor:e,editorConfigContext:c,selection:d});r!==m&&n(m)}})},[i,e,c,r,o]);return gt(()=>{u()},[u]),gt(()=>(document.addEventListener("mouseup",u),()=>{document.removeEventListener("mouseup",u)}),[u]),gt(()=>Yu(e.registerUpdateListener(()=>{u()})),[e,u]),gt(()=>{a([xo,r===!1?"disabled":"",i?"active":"",o?.key?`${xo}-`+o.key:""].filter(Boolean).join(" "))},[r,i,s,o.key]),Zu("button",{className:s,onClick:()=>{if(r!==!1)return e._updateTags=new Set([...e._updateTags,"toolbar"]),e.focus(()=>{o.onSelect({editor:e,isActive:i})}),!0},onMouseDown:d=>{d.preventDefault()},type:"button",children:t})};import{c as Li}from"react/compiler-runtime";import{jsx as Ve,jsxs as od}from"react/jsx-runtime";import Ni,{useEffect as To}from"react";import{mergeRegister as rd}from"@lexical/utils";import{useTranslation as nd}from"@payloadcms/ui";import{$getSelection as id}from"lexical";import{jsx as se,jsxs as Ti}from"react/jsx-runtime";import Ct,{useCallback as qu,useEffect as We,useMemo as Qu,useRef as _o,useState as xt}from"react";import{createPortal as ed}from"react-dom";var bo="toolbar-popup__dropdown-item",Ei=Ct.createContext(null);function wi({active:t,children:e,editor:o,enabled:r,item:n,title:i}){let[l,s]=xt(bo);We(()=>{s([bo,r===!1?"disabled":"",t?"active":"",n?.key?`${bo}-${n.key}`:""].filter(Boolean).join(" "))},[r,t,l,n.key]);let a=_o(null),c=Ct.useContext(Ei);if(c===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:u}=c;return We(()=>{a?.current!=null&&u(a)},[a,u]),se("button",{className:l,onClick:()=>{r!==!1&&(o._updateTags=new Set([...o._updateTags,"toolbar"]),o.focus(()=>{n.onSelect({editor:o,isActive:t})}))},onMouseDown:d=>{d.preventDefault()},ref:a,title:i,type:"button",children:e})}function td({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:r}){let[n,i]=xt(),[l,s]=xt(),a=qu(d=>{i(m=>m!=null?[...m,d]:[d])},[i]),c=d=>{if(n==null)return;let{key:m}=d;["ArrowDown","ArrowUp","Escape","Tab"].includes(m)&&d.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])},u=Qu(()=>({registerItem:a}),[a]);return We(()=>{n!=null&&l==null&&s(n[0]),l!=null&&l?.current!=null&&l.current.focus()},[n,l]),se(Ei.Provider,{value:u,children:se("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:c,ref:e,children:t})})}function ki({Icon:t,buttonAriaLabel:e,buttonClassName:o,children:r,disabled:n=!1,itemsContainerClassNames:i,label:l,stopCloseOnClickSelf:s}){let a=_o(null),c=_o(null),[u,d]=xt(!1),m=()=>{d(!1),c?.current!=null&&c.current.focus()};We(()=>{let f=c.current,h=a.current;if(u&&f!==null&&h!==null){let{left:_,top:g}=f.getBoundingClientRect(),v=window.scrollY||document.documentElement.scrollTop;h.style.top=`${g+v+f.offsetHeight+5}px`,h.style.left=`${Math.min(_-5,window.innerWidth-h.offsetWidth-20)}px`}},[a,c,u]),We(()=>{let f=c.current;if(f!==null&&u){let h=_=>{let{target:g}=_;s!=null&&a.current!=null&&a.current.contains(g)||f.contains(g)||d(!1)};return document.addEventListener("click",h),()=>{document.removeEventListener("click",h)}}},[a,c,u,s]);let p=ed(se(td,{dropDownRef:a,itemsContainerClassNames:i,onClose:m,children:r}),document.body);return Ti(Ct.Fragment,{children:[Ti("button",{"aria-label":e,className:o+(u?" active":""),disabled:n,onClick:f=>{f.preventDefault(),d(!u)},onMouseDown:f=>{f.preventDefault()},ref:c,type:"button",children:[t&&se(t,{}),l&&se("span",{className:"toolbar-popup__dropdown-label",children:l}),se("i",{className:"toolbar-popup__dropdown-caret"})]}),u&&se(Ct.Fragment,{children:p})]})}var Eo="toolbar-popup__dropdown",ld=t=>{let e=Li(19),{active:o,anchorElem:r,editor:n,enabled:i,item:l}=t,{i18n:s}=nd(),{field:a}=$(),{richTextComponentMap:c}=a;if(l.Component){let p;return e[0]!==l||e[1]!==o||e[2]!==r||e[3]!==n||e[4]!==i?(p=l?.Component&&Ve(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]=p):p=e[5],p}let u=l.key;if(l.label){let p;e[6]!==l||e[7]!==s||e[8]!==c?(p=typeof l.label=="function"?l.label({i18n:s,richTextComponentMap:c}):l.label,e[6]=l,e[7]=s,e[8]=c,e[9]=p):p=e[9],u=p}u.length>25&&(u=u.substring(0,25)+"...");let d;e[10]!==l?(d=l?.ChildComponent&&Ve(l.ChildComponent,{}),e[10]=l,e[11]=d):d=e[11];let m;return e[12]!==u||e[13]!==d||e[14]!==o||e[15]!==n||e[16]!==i||e[17]!==l?(m=od(wi,{active:o,editor:n,enabled:i,item:l,children:[d,Ve("span",{className:"text",children:u})]},l.key),e[12]=u,e[13]=d,e[14]=o,e[15]=n,e[16]=i,e[17]=l,e[18]=m):m=e[18],m},me=t=>{let e=Li(43),{Icon:o,anchorElem:r,classNames:n,editor:i,groupKey:l,items:s,itemsContainerClassNames:a,label:c,maxActiveItems:u,onActiveChange:d}=t,m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=[],e[0]=m):m=e[0];let[p,f]=Ni.useState(m),h;e[1]===Symbol.for("react.memo_cache_sentinel")?(h=[],e[1]=h):h=e[1];let[_,g]=Ni.useState(h),v=$(),M;e[2]!==i||e[3]!==s||e[4]!==u||e[5]!==v||e[6]!==d?(M=()=>{i.getEditorState().read(()=>{let O=id(),P=[],B=[],vt=[];for(let ne of s)ne.isActive&&(!u||P.length<u)&&ne.isActive({editor:i,editorConfigContext:v,selection:O})&&(P.push(ne.key),B.push(ne)),ne.isEnabled?ne.isEnabled({editor:i,editorConfigContext:v,selection:O})&&vt.push(ne.key):vt.push(ne.key);f(P),g(vt),d&&d({activeItems:B})})},e[2]=i,e[3]=s,e[4]=u,e[5]=v,e[6]=d,e[7]=M):M=e[7];let b=M,E,T;e[8]!==b?(E=()=>{b()},T=[b],e[8]=b,e[9]=E,e[10]=T):(E=e[9],T=e[10]),To(E,T);let I,S;e[11]!==b?(I=()=>(document.addEventListener("mouseup",b),()=>{document.removeEventListener("mouseup",b)}),S=[b],e[11]=b,e[12]=I,e[13]=S):(I=e[12],S=e[13]),To(I,S);let R,w;e[14]!==i||e[15]!==b?(R=()=>rd(i.registerUpdateListener(()=>{b()})),w=[i,b],e[14]=i,e[15]=b,e[16]=R,e[17]=w):(R=e[16],w=e[17]),To(R,w);let x=`${l} dropdown`,C=`${Eo}-${l}`,N;e[18]!==n?(N=n||[],e[18]=n,e[19]=N):N=e[19];let L;e[20]!==C||e[21]!==N?(L=[Eo,C,...N].filter(Boolean),e[20]=C,e[21]=N,e[22]=L):L=e[22];let k=L.join(" "),F;e[23]!==a?(F=a||[],e[23]=a,e[24]=F):F=e[24];let A;if(e[25]!==F||e[26]!==s||e[27]!==p||e[28]!==r||e[29]!==i||e[30]!==_||e[31]!==o||e[32]!==x||e[33]!==k||e[34]!==c||e[35]!==l){let O;e[37]!==s||e[38]!==p||e[39]!==r||e[40]!==i||e[41]!==_?(O=s.length&&s.map(P=>Ve(ld,{active:p.includes(P.key),anchorElem:r,editor:i,enabled:_.includes(P.key),item:P},P.key)),e[37]=s,e[38]=p,e[39]=r,e[40]=i,e[41]=_,e[42]=O):O=e[42],A=Ve(ki,{Icon:o,buttonAriaLabel:x,buttonClassName:k,itemsContainerClassNames:[`${Eo}-items`,...F],label:c,children:O},l),e[25]=F,e[26]=s,e[27]=p,e[28]=r,e[29]=i,e[30]=_,e[31]=o,e[32]=x,e[33]=k,e[34]=c,e[35]=l,e[36]=A}else A=e[36];return A};function fd({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&z(o.Component,{anchorElem:t,editor:e,item:o},o.key):z(Ue,{editor:e,item:o,children:o?.ChildComponent&&z(o.ChildComponent,{})},o.key)}function hd(t){let e=sd(27),{anchorElem:o,editor:r,editorConfig:n,group:i,index:l}=t,{i18n:s}=md(),{field:a}=$(),{richTextComponentMap:c}=a,[u,d]=te.useState(null),[m,p]=te.useState(null),f,h;e[0]!==i?(f=()=>{i?.type==="dropdown"&&i.items.length&&i.ChildComponent?p(()=>i.ChildComponent):p(null)},h=[i],e[0]=i,e[1]=f,e[2]=h):(f=e[1],h=e[2]),te.useEffect(f,h);let _;e[3]!==i||e[4]!==s||e[5]!==c?(_=T=>{let{activeItems:I}=T;if(!I.length){i?.type==="dropdown"&&i.items.length&&i.ChildComponent?(p(()=>i.ChildComponent),d(null)):(p(null),d(null));return}let S=I[0],R=S.key;S.label&&(R=typeof S.label=="function"?S.label({i18n:s,richTextComponentMap:c}):S.label),R.length>25&&(R=R.substring(0,25)+"..."),d(R),p(()=>S.ChildComponent)},e[3]=i,e[4]=s,e[5]=c,e[6]=_):_=e[6];let g=_,v=`fixed-toolbar__group fixed-toolbar__group-${i.key}`,M;e[7]!==i.type||e[8]!==i.items||e[9]!==i.key||e[10]!==m||e[11]!==o||e[12]!==r||e[13]!==u||e[14]!==g?(M=i.type==="dropdown"&&i.items.length&&(m?z(me,{Icon:m,anchorElem:o,editor:r,groupKey:i.key,items:i.items,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:u,maxActiveItems:1,onActiveChange:g}):z(me,{anchorElem:o,editor:r,groupKey:i.key,items:i.items,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:u,maxActiveItems:1,onActiveChange:g})),e[7]=i.type,e[8]=i.items,e[9]=i.key,e[10]=m,e[11]=o,e[12]=r,e[13]=u,e[14]=g,e[15]=M):M=e[15];let b;e[16]!==i||e[17]!==o||e[18]!==r?(b=i.type==="buttons"&&i.items.length&&i.items.map(T=>z(fd,{anchorElem:o,editor:r,item:T},T.key)),e[16]=i,e[17]=o,e[18]=r,e[19]=b):b=e[19];let E;return e[20]!==n.features.toolbarFixed||e[21]!==l||e[22]!==M||e[23]!==b||e[24]!==v||e[25]!==i.key?(E=ad("div",{className:v,children:[M,b,l<n.features.toolbarFixed?.groups.length-1&&z("div",{className:"divider"})]},i.key),e[20]=n.features.toolbarFixed,e[21]=l,e[22]=M,e[23]=b,e[24]=v,e[25]=i.key,e[26]=E):E=e[26],E}function gd({anchorElem:t,clientProps:e,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let i=te.useRef(null),{y:l}=ud(),s=pd(()=>{if(!n||e?.disableIfParentHasFixedToolbar)return null;let c=n.editorContainerRef.current.previousElementSibling;for(;c;){if(c.classList.contains("fixed-toolbar"))return c;c=c.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,n]);return dd(()=>{if(!s)return;let a=i.current;if(!a)return;let c=a.getBoundingClientRect(),u=s.getBoundingClientRect();if(!(c.bottom<u.top||c.top>u.bottom))i.current.className="fixed-toolbar fixed-toolbar--overlapping",s.className="fixed-toolbar fixed-toolbar--hide";else{if(!i.current.classList.contains("fixed-toolbar--overlapping"))return;i.current.className="fixed-toolbar",s.className="fixed-toolbar"}},50,[i,s,l]),z("div",{className:"fixed-toolbar",onFocus:a=>{a.stopPropagation()},ref:i,children:o.isEditable()&&z(te.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((a,c)=>z(hd,{anchorElem:t,editor:o,editorConfig:r,group:a,index:c},a.key))})})}var Ii=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return Ii(t.parentEditor)}return!1},Ri=({anchorElem:t,clientProps:e})=>{let[o]=cd(),r=$(),{editorConfig:n}=r,i=e.applyToFocusedEditor&&r.focusedEditor?.editor||o,l=e.applyToFocusedEditor&&r.focusedEditor?.editorConfig||n,s=Ii(r);return e?.disableIfParentHasFixedToolbar&&s||!l?.features?.toolbarFixed?.groups?.length?null:z(gd,{anchorElem:t,editor:i,editorConfig:l,parentWithFixedToolbar:s})};var Cd=y({plugins:[{Component:Ri,position:"aboveContainer"}]});import{c as xd}from"react/compiler-runtime";import{jsx as Z,jsxs as Mi}from"react/jsx-runtime";import{useLexicalComposerContext as bd}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as vi}from"@lexical/utils";import{$getSelection as Fi,$isRangeSelection as yi,$isTextNode as _d,COMMAND_PRIORITY_LOW as Td,SELECTION_CHANGE_COMMAND as Ed}from"lexical";import{useCallback as Ke,useEffect as ze,useRef as Si,useState as wd}from"react";import*as _e from"react";import{createPortal as kd}from"react-dom";function wo(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 bt(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:r=0,floatingElem:n,horizontalOffset:i=32,horizontalPosition:l="left",specialHandlingForCaret:s=!1,targetRect:a,verticalGap:c=10}=t,u=o.parentElement;if(a===null||u==null){n.style.opacity="0",n.style.transform="translate(-10000px, -10000px)";return}let d=n.getBoundingClientRect(),m=o.getBoundingClientRect(),p=u.getBoundingClientRect(),f=a.top-d.height-c,h=a.left-i;l==="center"&&(h=a.left+a.width/2-d.width/2);let _=0;return!e&&f<p.top&&!s&&(_=d.height+a.height+c*2,f+=_),l==="center"?h+d.width>p.right?h=p.right-d.width-i:h<p.left&&(h=p.left+i):h+d.width>p.right&&(h=p.right-d.width-i),h-=m.left,n.style.opacity="1",s&&r!==0?(f-=m.bottom-r+d.height-3,n.style.transform=`translate(${h}px, ${f}px) rotate(180deg)`):(f-=m.top,n.style.transform=`translate(${h}px, ${f}px)`),_}function Nd({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&Z(o.Component,{anchorElem:t,editor:e,item:o},o.key):Z(Ue,{editor:e,item:o,children:o?.ChildComponent&&Z(o.ChildComponent,{})},o.key)}function Ld(t){let e=xd(24),{anchorElem:o,editor:r,group:n,index:i}=t,{editorConfig:l}=$(),[s,a]=_e.useState(null),c,u;e[0]!==n?(c=()=>{n?.type==="dropdown"&&n.items.length&&n.ChildComponent?a(()=>n.ChildComponent):a(null)},u=[n],e[0]=n,e[1]=c,e[2]=u):(c=e[1],u=e[2]),_e.useEffect(c,u);let d;e[3]!==n?(d=g=>{let{activeItems:v}=g;if(!v.length){n?.type==="dropdown"&&n.items.length&&n.ChildComponent?a(()=>n.ChildComponent):a(null);return}let M=v[0];a(()=>M.ChildComponent)},e[3]=n,e[4]=d):d=e[4];let m=d,p=`inline-toolbar-popup__group inline-toolbar-popup__group-${n.key}`,f;e[5]!==n.type||e[6]!==n.items||e[7]!==n.key||e[8]!==s||e[9]!==o||e[10]!==r||e[11]!==m?(f=n.type==="dropdown"&&n.items.length&&(s?Z(me,{Icon:s,anchorElem:o,editor:r,groupKey:n.key,items:n.items,maxActiveItems:1,onActiveChange:m}):Z(me,{anchorElem:o,editor:r,groupKey:n.key,items:n.items,maxActiveItems:1,onActiveChange:m})),e[5]=n.type,e[6]=n.items,e[7]=n.key,e[8]=s,e[9]=o,e[10]=r,e[11]=m,e[12]=f):f=e[12];let h;e[13]!==n||e[14]!==o||e[15]!==r?(h=n.type==="buttons"&&n.items.length&&n.items.map(g=>Z(Nd,{anchorElem:o,editor:r,item:g},g.key)),e[13]=n,e[14]=o,e[15]=r,e[16]=h):h=e[16];let _;return e[17]!==l.features.toolbarInline||e[18]!==i||e[19]!==f||e[20]!==h||e[21]!==p||e[22]!==n.key?(_=Mi("div",{className:p,children:[f,h,i<l.features.toolbarInline?.groups.length-1&&Z("div",{className:"divider"})]},n.key),e[17]=l.features.toolbarInline,e[18]=i,e[19]=f,e[20]=h,e[21]=p,e[22]=n.key,e[23]=_):_=e[23],_}function Id({anchorElem:t,editor:e}){let o=Si(null),r=Si(null),{editorConfig:n}=$(),i=Ke(()=>{if(o?.current){let c=o.current.style.opacity==="0",u=o.current.style.pointerEvents==="none";c||(o.current.style.opacity="0"),u||(o.current.style.pointerEvents="none")}},[o]),l=Ke(c=>{if(o?.current&&(c.buttons===1||c.buttons===3)){let u=o.current.style.opacity==="0",d=o.current.style.pointerEvents==="none";if(!u||!d){let m=c.clientX,p=c.clientY,f=document.elementFromPoint(m,p);o.current.contains(f)||i()}}},[i]),s=Ke(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);ze(()=>(document.addEventListener("mousemove",l),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",s)}),[o,l,s]);let a=Ke(()=>{let c=Fi(),u=window.getSelection();if(o.current===null)return;let d=t.querySelector(":scope > .link-editor"),m=d!==null&&"style"in d&&d?.style?.opacity==="1",p=e.getRootElement();if(c!==null&&u!==null&&!u.isCollapsed&&p!==null&&p.contains(u.anchorNode)){let f=wo(u,p),h=bt({alwaysDisplayOnTop:m,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});r.current&&bt({anchorElem:o.current,anchorFlippedOffset:h,floatingElem:r.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else i()},[e,i,t]);return ze(()=>{let c=t.parentElement,u=()=>{e.getEditorState().read(()=>{a()})};return window.addEventListener("resize",u),c&&c.addEventListener("scroll",u),()=>{window.removeEventListener("resize",u),c&&c.removeEventListener("scroll",u)}},[e,a,t]),ze(()=>(e.getEditorState().read(()=>{a()}),vi(e.registerUpdateListener(({editorState:c})=>{c.read(()=>{a()})}),e.registerCommand(Ed,()=>(a(),!1),Td))),[e,a]),Mi("div",{className:"inline-toolbar-popup",ref:o,children:[Z("div",{className:"caret",ref:r}),e.isEditable()&&Z(_e.Fragment,{children:n?.features&&n.features?.toolbarInline?.groups.map((c,u)=>Z(Ld,{anchorElem:t,editor:e,group:c,index:u},c.key))})]})}function Rd(t,e){let[o,r]=wd(!1),n=Ke(()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let i=Fi(),l=window.getSelection(),s=t.getRootElement();if(l!==null&&(!yi(i)||s===null||!s.contains(l.anchorNode))){r(!1);return}if(!yi(i))return;if(i.getTextContent()!==""){let c=i.getNodes(),u=!1;for(let d of c)if(_d(d)){r(!0),u=!0;break}u||r(!1)}else r(!1);let a=i.getTextContent().replace(/\n/g,"");if(!i.isCollapsed()&&a===""){r(!1);return}})},[t]);return ze(()=>(document.addEventListener("selectionchange",n),document.addEventListener("mouseup",n),()=>{document.removeEventListener("selectionchange",n),document.removeEventListener("mouseup",n)}),[n]),ze(()=>vi(t.registerUpdateListener(()=>{n()}),t.registerRootListener(()=>{t.getRootElement()===null&&r(!1)})),[t,n]),o?kd(Z(Id,{anchorElem:e,editor:t}),e):null}var Ai=({anchorElem:t})=>{let[e]=bd();return Rd(e,t)};var yd=y({plugins:[{Component:Ai,position:"floatingAnchorElem"}]});import{TableCellNode as Jm,TableNode as qm,TableRowNode as Qm}from"@lexical/table";import{jsx as Di}from"react/jsx-runtime";import"react";var ko=()=>Di("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Di("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{jsx as H,jsxs as oe}from"react/jsx-runtime";import{useLexicalComposerContext as $i}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Md}from"@lexical/react/useLexicalEditable";import{$deleteTableColumn__EXPERIMENTAL as vd,$deleteTableRow__EXPERIMENTAL as Fd,$getNodeTriplet as Ad,$getTableCellNodeFromLexicalNode as Dd,$getTableColumnIndexFromTableCellNode as Od,$getTableNodeFromLexicalNodeOrThrow as _t,$getTableRowIndexFromTableCellNode as Pd,$insertTableColumn__EXPERIMENTAL as $d,$insertTableRow__EXPERIMENTAL as Hd,$isTableCellNode as Ze,$isTableRowNode as Io,$isTableSelection as Et,$unmergeCell as Bd,TableCellHeaderStates as Te,TableCellNode as jd,getTableObserverFromTableElement as Gd}from"@lexical/table";import{useScrollInfo as Ud}from"@payloadcms/ui";import{$createParagraphNode as Wd,$getRoot as Vd,$getSelection as wt,$isElementNode as Kd,$isParagraphNode as Hi,$isRangeSelection as Ro,$isTextNode as zd}from"lexical";import*as yo from"react";import{useCallback as re,useEffect as pe,useRef as Tt,useState as Ee}from"react";import{createPortal as Bi}from"react-dom";import{jsx as No,jsxs as Sd}from"react/jsx-runtime";import"react";var Oi=()=>Sd("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[No("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"}),No("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"}),No("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 Lo(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function Zd(t){let e=t.getNodes(),o=[],r=null,n=null,i=0;for(let l=0;l<e.length;l++){let s=e[l];if(Ze(s)){let a=s.getParentOrThrow();if(Io(a))throw new Error("Expected CellNode to have a RowNode parent");if(r!==a){if(n!==null&&i!==n)return!1;r!==null&&(n=i),r=a,i=0}let c=s.__colSpan;for(let u=0;u<c;u++)o[i+u]===void 0&&(o[i+u]=0),o[i+u]+=s.__rowSpan;i+=c}}return(n===null||i===n)&&o.every(l=>l===o[0])}function Yd(){let t=wt();if(Ro(t)&&!t.isCollapsed()||Et(t)&&!t.anchor.is(t.focus)||!Ro(t)&&!Et(t))return!1;let[e]=Ad(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function Pi(t){if(t.getChildrenSize()!==1)return!1;let e=t.getFirstChildOrThrow();return!(!Hi(e)||!e.isEmpty())}function Xd(t){let e=t.getLastDescendant();zd(e)?e.select():Kd(e)?e.selectEnd():e!==null&&e.selectNext()}function Jd({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[i]=$i(),l=Tt(null),[s,a]=Ee(n),[c,u]=Ee({columns:1,rows:1}),[d,m]=Ee(!1),[p,f]=Ee(!1),{y:h}=Ud();pe(()=>i.registerMutationListener(jd,x=>{x.get(s.getKey())==="updated"&&i.getEditorState().read(()=>{a(s.getLatest())})},{skipInitialization:!0}),[i,s]),pe(()=>{i.getEditorState().read(()=>{let x=wt();if(Et(x)){let C=Lo(x);u(Lo(x)),m(Zd(x)&&(C.columns>1||C.rows>1))}f(Yd())})},[i]),pe(()=>{let x=e.current,C=l.current,N=i.getRootElement();if(x!=null&&C!=null&&N!=null){let L=N.getBoundingClientRect(),k=x.getBoundingClientRect();C.style.opacity="1";let F=C.getBoundingClientRect(),A=5,O=k.right+A;if(O+F.width>window.innerWidth||O+F.width>L.right){let B=k.left-F.width-A;O=(B<0?A:B)+window.pageXOffset}C.style.left=`${O+window.pageXOffset}px`;let P=k.top;if(P+F.height>window.innerHeight){let B=k.bottom-F.height;P=(B<0?A:B)+window.pageYOffset}C.style.top=`${P}px`}},[e,l,i,h]),pe(()=>{function x(C){l.current!=null&&e.current!=null&&!l.current.contains(C.target)&&!e.current.contains(C.target)&&r(!1)}return window.addEventListener("click",x),()=>window.removeEventListener("click",x)},[r,e]);let _=re(()=>{i.update(()=>{if(s.isAttached()){let C=_t(s),N=i.getElementByKey(C.getKey());if(!N)throw new Error("Expected to find tableElement in DOM");let L=Gd(N);L!==null&&L.clearHighlight(),C.markDirty(),a(s.getLatest())}Vd().selectStart()})},[i,s]),g=()=>{i.update(()=>{let x=wt();if(Et(x)){let{columns:C,rows:N}=Lo(x),L=x.getNodes(),k=null;for(let F=0;F<L.length;F++){let A=L[F];if(Ze(A))if(k===null){A.setColSpan(C).setRowSpan(N),k=A;let O=Pi(A),P;O&&Hi(P=A.getFirstChild())&&P.remove()}else Ze(k)&&(Pi(A)||k.append(...A.getChildren()),A.remove())}k!==null&&(k.getChildrenSize()===0&&k.append(Wd()),Xd(k)),o()}})},v=()=>{i.update(()=>{Bd()})},M=re(x=>{i.update(()=>{Hd(x),o()})},[i,o]),b=re(x=>{i.update(()=>{for(let C=0;C<c.columns;C++)$d(x);o()})},[i,o,c.columns]),E=re(()=>{i.update(()=>{Fd(),o()})},[i,o]),T=re(()=>{i.update(()=>{_t(s).remove(),_(),o()})},[i,s,_,o]),I=re(()=>{i.update(()=>{vd(),o()})},[i,o]),S=re(()=>{i.update(()=>{let x=_t(s),C=Pd(s),N=x.getChildren();if(C>=N.length||C<0)throw new Error("Expected table cell to be inside of table row.");let L=N[C];if(!Io(L))throw new Error("Expected table row");L.getChildren().forEach(k=>{if(!Ze(k))throw new Error("Expected table cell");k.toggleHeaderStyle(Te.ROW)}),_(),o()})},[i,s,_,o]),R=re(()=>{i.update(()=>{let x=_t(s),C=Od(s),N=x.getChildren(),L=Math.max(...N.map(k=>k.getChildren().length));if(C>=L||C<0)throw new Error("Expected table cell to be inside of table row.");for(let k=0;k<N.length;k++){let F=N[k];if(!Io(F))throw new Error("Expected table row");let A=F.getChildren();if(C>=A.length)continue;let O=A[C];if(!Ze(O))throw new Error("Expected table cell");O.toggleHeaderStyle(Te.COLUMN)}_(),o()})},[i,s,_,o]),w=null;return t&&(d?w=H("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>g(),type:"button",children:"Merge cells"}):p&&(w=H("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>v(),type:"button",children:"Unmerge cells"}))),Bi(oe("div",{className:"table-action-menu-dropdown",onClick:x=>{x.stopPropagation()},ref:l,children:[w?oe(yo.Fragment,{children:[w,H("hr",{})]}):null,H("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>M(!1),type:"button",children:oe("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," above"]})}),H("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>M(!0),type:"button",children:oe("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," below"]})}),H("hr",{}),H("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>b(!1),type:"button",children:oe("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","left"]})}),H("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>b(!0),type:"button",children:oe("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","right"]})}),H("hr",{}),H("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>I(),type:"button",children:H("span",{className:"text",children:"Delete column"})}),H("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>E(),type:"button",children:H("span",{className:"text",children:"Delete row"})}),H("button",{className:"item","data-test-id":"table-delete",onClick:()=>T(),type:"button",children:H("span",{className:"text",children:"Delete table"})}),H("hr",{}),H("button",{className:"item",onClick:()=>S(),type:"button",children:oe("span",{className:"text",children:[(s.__headerState&Te.ROW)===Te.ROW?"Remove":"Add"," ","row header"]})}),H("button",{className:"item","data-test-id":"table-column-header",onClick:()=>R(),type:"button",children:oe("span",{className:"text",children:[(s.__headerState&Te.COLUMN)===Te.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function qd({anchorElem:t,cellMerge:e}){let[o]=$i(),r=Tt(null),n=Tt(null),[i,l]=Ee(!1),[s,a]=Ee(null),c=re(()=>{let d=r.current,m=wt(),p=window.getSelection(),f=document.activeElement;if(m==null||d==null){a(null);return}let h=o.getRootElement();if(Ro(m)&&h!==null&&p!==null&&h.contains(p.anchorNode)){let _=Dd(m.anchor.getNode());if(_==null){a(null);return}if(o.getElementByKey(_.getKey())==null){a(null);return}a(_)}else f||a(null)},[o]);pe(()=>o.registerUpdateListener(()=>{o.getEditorState().read(()=>{c()})})),pe(()=>{let d=r.current;if(d!=null&&s!=null){let m=o.getElementByKey(s.getKey());if(m!=null){let p=m.getBoundingClientRect(),f=d.getBoundingClientRect(),h=t.getBoundingClientRect(),_=p.top-h.top+4,g=p.right-f.width-10-h.left;d.style.opacity="1",d.style.transform=`translate(${g}px, ${_}px)`}else d.style.opacity="0",d.style.transform="translate(-10000px, -10000px)"}},[r,s,o,t]);let u=Tt(s);return pe(()=>{u.current!==s&&l(!1),u.current=s},[u,s]),H("div",{className:"table-cell-action-button-container",ref:r,children:s!=null&&oe(yo.Fragment,{children:[H("button",{className:"table-cell-action-button",onClick:d=>{d.stopPropagation(),l(!i)},ref:n,type:"button",children:H(Oi,{})}),i&&H(Jd,{cellMerge:e,contextRef:n,onClose:()=>l(!1),setIsMenuOpen:l,tableCellNode:s})]})})}var ji=({anchorElem:t})=>{let e=Md();return Bi(e?H(qd,{anchorElem:t??document.body,cellMerge:!0}):null,t??document.body)};import{jsx as Lt,jsxs as Qd}from"react/jsx-runtime";import{useLexicalComposerContext as em}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as tm}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as om,$getTableNodeFromLexicalNodeOrThrow as So,$getTableRowIndexFromTableCellNode as rm,$isTableCellNode as Gi,$isTableRowNode as nm,getDOMCellFromTarget as im}from"@lexical/table";import{calculateZoomLevel as Ui}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Mo}from"lexical";import*as Wi from"react";import{useCallback as we,useEffect as lm,useMemo as sm,useRef as kt,useState as Nt}from"react";import{createPortal as am}from"react-dom";var cm=33,um=50;function dm({editor:t}){let e=kt(null),o=kt(null),r=kt(null),n=$(),i=kt(null),[l,s]=Nt(null),[a,c]=Nt(null),[u,d]=Nt(!1),[m,p]=Nt(null),f=we(()=>{c(null),e.current=null,p(null),i.current=null,r.current=null},[]),h=w=>(w.buttons&1)===1;lm(()=>{let w=L=>{setTimeout(()=>{let k=L.target;if(m){s({x:L.clientX,y:L.clientY});return}if(d(h(L)),!(o.current&&o.current.contains(k))&&e.current!==k){e.current=k;let F=im(k);F&&a!==F?t.update(()=>{let A=Mo(F.elem);if(!A)throw new Error("TableCellResizer: Table cell node not found.");let O=So(A),P=t.getElementByKey(O.getKey());if(!P)throw new Error("TableCellResizer: Table element not found.");e.current=k,r.current=P.getBoundingClientRect(),c(F)}):F==null&&f()}},0)},x=L=>{setTimeout(()=>{d(!0)},0)},C=L=>{setTimeout(()=>{d(!1)},0)},N=t.registerRootListener((L,k)=>{L?.addEventListener("mousemove",w),L?.addEventListener("mousedown",x),L?.addEventListener("mouseup",C),k?.removeEventListener("mousemove",w),k?.removeEventListener("mousedown",x),k?.removeEventListener("mouseup",C)});return()=>{N()}},[a,m,t,f]);let _=w=>w==="bottom",g=we(w=>{if(!a)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let x=Mo(a.elem);if(!Gi(x))throw new Error("TableCellResizer: Table cell node not found.");let C=So(x),N=rm(x),L=C.getChildren();if(N>=L.length||N<0)throw new Error("Expected table cell to be inside of table row.");let k=L[N];if(!nm(k))throw new Error("Expected table row");let F=k.getHeight();if(F===void 0){let O=k.getChildren();F=Math.min(...O.map(P=>M(P,t)??1/0))}let A=Math.max(F+w,cm);k.setHeight(A)},{tag:"skip-scroll-into-view"})},[a,t]),v=(w,x)=>{let C=w.getWidth();if(C!==void 0)return C;let N=x.getElementByKey(w.getKey());if(N==null)return;let L=getComputedStyle(N);return N.clientWidth-parseFloat(L.paddingLeft)-parseFloat(L.paddingRight)},M=(w,x)=>x.getElementByKey(w.getKey())?.clientHeight,b=(w,x)=>{for(let C=0;C<x.length;C++)for(let N=0;N<x[C].length;N++)if(x[C][N].cell===w)return N},E=we(w=>{if(!a)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let x=Mo(a.elem);if(!Gi(x))throw new Error("TableCellResizer: Table cell node not found.");let C=So(x),[N]=om(C,null,null),L=b(x,N);if(L===void 0)throw new Error("TableCellResizer: Table column not found.");for(let k=0;k<N.length;k++){let F=N[k][L];if(F.startRow===k&&(L===N[k].length-1||N[k][L].cell!==N[k][L+1].cell)){let A=v(F.cell,t);if(A===void 0)continue;let O=Math.max(A+w,um);F.cell.setWidth(O)}}},{tag:"skip-scroll-into-view"})},[a,t]),T=we(w=>{let x=C=>{if(C.preventDefault(),C.stopPropagation(),!a)throw new Error("TableCellResizer: Expected active cell.");if(i.current){let{x:N,y:L}=i.current;if(a===null)return;let k=Ui(C.target);if(_(w)){let F=(C.clientY-L)/k;g(F)}else{let F=(C.clientX-N)/k;E(F)}f(),document.removeEventListener("mouseup",x)}};return x},[a,f,E,g]),I=we(w=>x=>{if(x.preventDefault(),x.stopPropagation(),!a)throw new Error("TableCellResizer: Expected active cell.");i.current={x:x.clientX,y:x.clientY},s(i.current),p(w),document.addEventListener("mouseup",T(w))},[a,T]),R=we(()=>{if(a){let{height:w,left:x,top:C,width:N}=a.elem.getBoundingClientRect(),L=Ui(a.elem),k=10,F={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${k}px`,left:`${window.pageXOffset+x}px`,top:`${window.pageYOffset+C+w-k/2}px`,width:`${N}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${w}px`,left:`${window.pageXOffset+x+N-k/2}px`,top:`${window.pageYOffset+C}px`,width:`${k}px`}},A=r.current;return m&&l&&A&&(_(m)?(F[m].left=`${window.pageXOffset+A.left}px`,F[m].top=`${window.pageYOffset+l.y/L}px`,F[m].height="3px",F[m].width=`${A.width}px`):(F[m].top=`${window.pageYOffset+A.top}px`,F[m].left=`${window.pageXOffset+l.x/L}px`,F[m].width="3px",F[m].height=`${A.height}px`),F[m].backgroundColor="#adf"),F}return{bottom:null,left:null,right:null,top:null}},[a,m,l])();return Lt("div",{ref:o,children:a!=null&&!u&&Qd(Wi.Fragment,{children:[Lt("div",{className:`${n.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:I("right"),style:R.right||void 0}),Lt("div",{className:`${n.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:I("bottom"),style:R.bottom||void 0})]})})}var Vi=()=>{let[t]=em(),e=tm();return sm(()=>e?am(Lt(dm,{editor:t}),document.body):null,[t,e])};import{jsx as vo,jsxs as xm,Fragment as bm}from"react/jsx-runtime";import{useLexicalComposerContext as _m}from"@lexical/react/LexicalComposerContext";import{$getTableColumnIndexFromTableCellNode as Tm,$getTableRowIndexFromTableCellNode as Em,$insertTableColumn__EXPERIMENTAL as wm,$insertTableRow__EXPERIMENTAL as km,$isTableCellNode as Nm,$isTableNode as Zi,TableNode as Lm}from"@lexical/table";import{$findMatchingParent as Im,mergeRegister as Rm}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Yi}from"lexical";import{useEffect as Xi,useRef as Ji,useState as It}from"react";import"react";import{createPortal as ym}from"react-dom";import{useMemo as gm,useRef as Cm}from"react";var mm="Expected a function",pm=Math.max,fm=Math.min;function hm(t,e,o){let r,n,i,l,s,a,c=0,u=!1,d=!1,m=!0;if(typeof t!="function")throw new TypeError(mm);e=e||0,typeof o=="object"&&(u=!!o.leading,d="maxWait"in o,i=d?pm(o.maxWait||0,e):i,m="trailing"in o?!!o.trailing:m);function p(T){let I=r,S=n;return r=n=void 0,c=T,l=t.apply(S,I),l}function f(T){return c=T,s=setTimeout(g,e),u?p(T):l}function h(T){let I=T-a,S=T-c,R=e-I;return d?fm(R,i-S):R}function _(T){let I=T-a,S=T-c;return a===void 0||I>=e||I<0||d&&S>=i}function g(){let T=Date.now();if(_(T))return v(T);s=setTimeout(g,h(T))}function v(T){return s=void 0,m&&r?p(T):(r=n=void 0,l)}function M(){s!==void 0&&clearTimeout(s),c=0,r=a=n=s=void 0}function b(){return s===void 0?l:v(Date.now())}function E(){let T=Date.now(),I=_(T);if(r=arguments,n=this,a=T,I){if(s===void 0)return f(a);if(d)return clearTimeout(s),s=setTimeout(g,e),p(a)}return s===void 0&&(s=setTimeout(g,e)),l}return E.cancel=M,E.flush=b,E}var Ki=hm;function zi(t,e,o){let r=Cm(null);return r.current=t,gm(()=>Ki((...n)=>{r.current&&r.current(...n)},e,{maxWait:o}),[e,o])}var qi=20;function Sm({anchorElem:t}){let[e]=_m(),o=$(),[r,n]=It(!1),[i,l]=It(!1),[s,a]=It(!1),[c,u]=It({}),d=Ji(new Set),m=Ji(null),p=zi(h=>{let{isOutside:_,tableDOMNode:g}=Mm(h,o.editorConfig?.lexical);if(_){n(!1),l(!1);return}if(!g)return;m.current=g;let v=null,M=null,b=null;if(e.update(()=>{let E=Yi(g);if(Nm(E)){let T=Im(E,I=>Zi(I));if(!Zi(T))return;if(b=e.getElementByKey(T?.getKey()),b){let I=T.getChildrenSize(),S=T.getChildAtIndex(0)?.getChildrenSize(),R=Em(E),w=Tm(E);R===I-1?v=E:w===S-1&&(M=E)}}}),b){let{bottom:E,height:T,right:I,width:S,x:R,y:w}=b.getBoundingClientRect(),{left:x,y:C}=t.getBoundingClientRect();v?(l(!1),n(!0),u({height:qi,left:R-x,top:E-C+5,width:S})):M&&(l(!0),n(!1),u({height:T,left:I-x+5,top:w-C,width:qi}))}},50,250);Xi(()=>{if(s)return document.addEventListener("mousemove",p),()=>{n(!1),l(!1),document.removeEventListener("mousemove",p)}},[s,p]),Xi(()=>Rm(e.registerMutationListener(Lm,h=>{e.getEditorState().read(()=>{for(let[_,g]of h)switch(g){case"created":d.current.add(_),a(d.current.size>0);break;case"destroyed":d.current.delete(_),a(d.current.size>0);break;default:break}})},{skipInitialization:!1})),[e]);let f=h=>{e.update(()=>{m.current&&(Yi(m.current)?.selectEnd(),h?(km(),n(!1)):(wm(),l(!1)))})};return xm(bm,{children:[r&&vo("button",{className:o.editorConfig.lexical.theme.tableAddRows,onClick:()=>f(!0),style:{...c}}),i&&vo("button",{className:o.editorConfig.lexical.theme.tableAddColumns,onClick:()=>f(!1),style:{...c}})]})}function Mm(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 Qi({anchorElem:t=document.body}){return ym(vo(Sm,{anchorElem:t}),t)}import{c as vm}from"react/compiler-runtime";import{jsx as Fo,jsxs as Fm}from"react/jsx-runtime";import{useLexicalComposerContext as Am}from"@lexical/react/LexicalComposerContext";import{TablePlugin as Dm}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as Om,TableNode as Pm}from"@lexical/table";import{mergeRegister as $m}from"@lexical/utils";import{formatDrawerSlug as Hm,useEditDepth as Bm,useModal as jm}from"@payloadcms/ui";import{$getSelection as Gm,$isRangeSelection as Um,COMMAND_PRIORITY_EDITOR as Wm,createCommand as Vm}from"lexical";import{createContext as Km,useContext as zm,useEffect as Zm,useMemo as Ym,useState as Xm}from"react";import*as el from"react";var Rt=Vm("OPEN_EMBED_DRAWER_COMMAND"),tl=Km({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function ol({children:t}){let[e,o]=Xm({cellEditorConfig:null,cellEditorPlugins:null});return Fo(tl.Provider,{value:Ym(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var rl=()=>{let t=vm(18),[e]=Am(),o=zm(tl),{closeModal:r,toggleModal:n}=jm(),i=Bm(),{uuid:l}=$(),s="lexical-table-create-"+l,a;t[0]!==s||t[1]!==i?(a=Hm({slug:s,depth:i}),t[0]=s,t[1]=i,t[2]=a):a=t[2];let c=a,u;t[3]!==e||t[4]!==n||t[5]!==c?(u=()=>{if(!e.hasNodes([Pm]))throw new Error("TablePlugin: TableNode is not registered on editor");return $m(e.registerCommand(Rt,()=>{let f;return f=null,e.getEditorState().read(()=>{let h=Gm();Um(h)&&(f=h)}),f&&n(c),!0},Wm))},t[3]=e,t[4]=n,t[5]=c,t[6]=u):u=t[6];let d;t[7]!==o||t[8]!==e||t[9]!==n?(d=[o,e,n],t[7]=o,t[8]=e,t[9]=n,t[10]=d):d=t[10],Zm(u,d);let m;t[11]!==r||t[12]!==c||t[13]!==e?(m=(f,h)=>{r(c),!(!h.columns||!h.rows)&&e.dispatchCommand(Om,{columns:String(h.columns),rows:String(h.rows)})},t[11]=r,t[12]=c,t[13]=e,t[14]=m):m=t[14];let p;return t[15]!==c||t[16]!==m?(p=Fm(el.Fragment,{children:[Fo(ae,{drawerSlug:c,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:m,schemaPathSuffix:"fields"}),Fo(Dm,{hasCellBackgroundColor:!1,hasCellMerge:!0})]}),t[15]=c,t[16]=m,t[17]=p):p=t[17],p};var ep=y({nodes:[qm,Jm,Qm],plugins:[{Component:rl,position:"normal"},{Component:Vi,position:"normal"},{Component:ji,position:"floatingAnchorElem"},{Component:Qi,position:"floatingAnchorElem"}],providers:[ol],slashMenu:{groups:[G([{Icon:ko,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Rt,{})}}])]},toolbarFixed:{groups:[J([{ChildComponent:ko,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Rt,{})}}])]}});import{$isNodeSelection as kp}from"lexical";import{jsx as Ao,jsxs as tp}from"react/jsx-runtime";import"react";var Do=()=>tp("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:"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"}),Ao("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"}),Ao("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 dp}from"react/compiler-runtime";import{jsx as mp}from"react/jsx-runtime";import{useLexicalComposerContext as pp}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as fp,mergeRegister as hp}from"@lexical/utils";import{useConfig as gp}from"@payloadcms/ui";import{$getPreviousSelection as Cp,$getSelection as xp,$isParagraphNode as il,$isRangeSelection as bp,COMMAND_PRIORITY_EDITOR as _p,createCommand as Tp}from"lexical";import{useEffect as Ep}from"react";import{c as op}from"react/compiler-runtime";import{jsx as Oo}from"react/jsx-runtime";import{useLexicalComposerContext as rp}from"@lexical/react/LexicalComposerContext.js";import{useListDrawer as np}from"@payloadcms/ui";import{$getNodeByKey as ip,COMMAND_PRIORITY_EDITOR as lp}from"lexical";import{useEffect as sp,useState as ap}from"react";var cp=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=ip(o);n&&n.replace(ve({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(Po,{fields:null,relationTo:e,value:r})},up=t=>{let e=op(13),{enabledCollectionSlugs:o}=t,[r]=rp(),[n,i]=ap(null),l;e[0]!==o?(l={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=l):l=e[1];let[s,a,c]=np(l),{closeDrawer:u,openDrawer:d}=c,m,p;e[2]!==r||e[3]!==d?(m=()=>r.registerCommand(Se,g=>(i(g?.replace?g?.replace.nodeKey:null),d(),!0),lp),p=[r,d],e[2]=r,e[3]=d,e[4]=m,e[5]=p):(m=e[4],p=e[5]),sp(m,p);let f;e[6]!==r||e[7]!==n||e[8]!==u?(f=g=>{let{collectionSlug:v,docID:M}=g;cp({editor:r,relationTo:v,replaceNodeKey:n,value:M}),u()},e[6]=r,e[7]=n,e[8]=u,e[9]=f):f=e[9];let h=f,_;return e[10]!==h||e[11]!==s?(_=Oo(s,{onSelect:h}),e[10]=h,e[11]=s,e[12]=_):_=e[12],_},nl=t=>Oo(qe,{...t,uploads:!0,children:Oo(up,{...t})});var Po=Tp("INSERT_UPLOAD_COMMAND"),ll=t=>{let e=dp(5),[o]=pp(),{config:r}=gp(),{collections:n}=r,i,l;e[0]!==o?(i=()=>{if(!o.hasNodes([Me]))throw new Error("UploadPlugin: UploadNode not registered on editor");return hp(o.registerCommand(Po,a=>(o.update(()=>{let c=xp()||Cp();if(bp(c)){let u=ve({data:{id:a.id,fields:a.fields,relationTo:a.relationTo,value:a.value}});fp(u);let{focus:d}=c,m=d.getNode();il(m)&&m.getTextContentSize()===0&&m.getParent().getChildren().filter(p=>il(p)).length>1&&m.remove()}}),!0),_p))},l=[o],e[0]=o,e[1]=i,e[2]=l):(i=e[1],l=e[2]),Ep(i,l);let s;return e[3]!==n?(s=mp(nl,{enabledCollectionSlugs:n.map(wp)}),e[3]=n,e[4]=s):s=e[4],s};function wp(t){let{slug:e}=t;return e}var Np=y({nodes:[Me],plugins:[{Component:ll,position:"normal"}],slashMenu:{groups:[G([{Icon:Do,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Se,{replace:!1})}}])]},toolbarFixed:{groups:[J([{ChildComponent:Do,isActive:({selection:t})=>{if(!kp(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Ot(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Se,{replace:!1})}}])]}});import{jsx as yt,jsxs as Lp}from"react/jsx-runtime";import{ShimmerEffect as Ip,useClientFunctions as Rp,useFieldProps as yp}from"@payloadcms/ui";import sl,{Suspense as Sp,lazy as Mp,useEffect as vp,useState as $o}from"react";var Fp=Mp(()=>import("./Field-E27BVLS5.js").then(t=>({default:t.RichText}))),Ap=t=>{let{admin:e={},field:{richTextComponentMap:o},lexicalEditorConfig:r}=t,{schemaPath:n}=yp(),i=Rp(),[l,s]=$o(!1),[a,c]=$o([]),[u,d]=$o(null),m=o.get("features");m=m.sort((f,h)=>f.order-h.order);let p=0;for(let f of m){let h=Array.from(o.keys()).filter(_=>_.startsWith(`lexical_internal_feature.${f.key}.lexical_internal_components.`));p+=1,p+=h.length}return vp(()=>{if(!l){let f=[],h=0;if(Object.entries(i).forEach(([_,g])=>{_.startsWith(`lexicalFeature.${n}.`)&&(_.includes(".lexical_internal_components.")||f.push(g),h++)}),h===p){c(f),s(!0);let _=Qe({clientFunctions:i,schemaPath:n,unSanitizedEditorConfig:{features:f,lexical:r}});d(Ae(r||Fe,_,e))}}},[e,l,i,n,m.length,a,u,r,p]),l?yt(Sp,{fallback:yt(Ip,{height:"35vh"}),children:u&&yt(Fp,{...t,editorConfig:u})}):yt(sl.Fragment,{children:Array.isArray(m)&&m.map(f=>{let _=Array.from(o.keys()).filter(g=>g.startsWith(`lexical_internal_feature.${f.key}.lexical_internal_components.`)).map(g=>o.get(g));return Lp(sl.Fragment,{children:[_?.length?_.map(g=>g):null,f.ClientFeature]},f.key)})})};function Dp(...t){return t.filter(Boolean).join(" ")}var St=new WeakMap;function al(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function Mt(t,e){let o=St.get(t);if(o===void 0){let r=new Set,n=l=>{o!==void 0&&(o.start=al(l))},i=l=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let a=al(l);for(let c of r)a!==null&&c([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},St.set(t,o)}return o.listeners.add(e),()=>{Op(t,e)}}function Op(t,e){let o=St.get(t);if(o===void 0)return;let{listeners:r}=o;r.delete(e),r.size===0&&(St.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function Pp(t,e){return Mt(t,(o,r)=>{let[n,i]=o;n<0&&-n>Math.abs(i)&&e(n,r)})}function $p(t,e){return Mt(t,(o,r)=>{let[n,i]=o;n>0&&n>Math.abs(i)&&e(n,r)})}function Hp(t,e){return Mt(t,(o,r)=>{let[n,i]=o;i<0&&-i>Math.abs(n)&&e(n,r)})}function Bp(t,e){return Mt(t,(o,r)=>{let[n,i]=o;i>0&&i>Math.abs(n)&&e(n,r)})}var D={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},jp=D.IS_BOLD|D.IS_ITALIC|D.IS_STRIKETHROUGH|D.IS_UNDERLINE|D.IS_CODE|D.IS_SUBSCRIPT|D.IS_SUPERSCRIPT|D.IS_HIGHLIGHT,Gp="\xA0",Up=`
34
+ `},[t,e]),p=ce((b,E)=>{o(T=>{let I=e.length-1,S=e[I];if(S&&S.name===b){if(b==="type")return[...e.slice(0,I),{...S,value:S.value+E}];if(S.value===E)return[...e.slice(0,I),{...S,count:S.count+1}]}return[...T,{name:b,count:1,value:E}]})},[e,o]);mr(()=>{let b=T=>{if(!r)return;let I=T.key;Es(T)?p("selectAll",""):fr.has(I)?p("press",T.key):[...I].length>1?p("keydown",T.key):p("type",T.key)},E=T=>{if(!r)return;let I=T.key;!fr.has(I)&&[...I].length>1&&p("keyup",T.key)};return t.registerRootListener((T,I)=>{I!==null&&(I.removeEventListener("keydown",b),I.removeEventListener("keyup",E)),T!==null&&(T.addEventListener("keydown",b),T.addEventListener("keyup",E))})},[t,r,p]),mr(()=>{u.current&&u.current.scrollTo(0,u.current.scrollHeight)},[m]),Zt(()=>{if(e){let b=m();b!==null&&s(b),u.current&&u.current.scrollTo(0,u.current.scrollHeight)}},[m,e]),Zt(()=>t.registerUpdateListener(({dirtyElements:E,dirtyLeaves:T,editorState:I})=>{if(!r)return;let S=I._selection,R=a.current,w=c.current;if(R!==S){if(T.size===0&&E.size===0&&!w){let C=window.getSelection();if(C&&(C.anchorNode==null||C.focusNode==null))return}a.current=S}c.current=!1;let x=m();x!==null&&s(x)}),[t,m,r,p]),Zt(()=>r?t.registerUpdateListener(()=>{let E=t.getRootElement();E!==null&&i(E?.innerHTML)}):void 0,[t,r]);let f=ce(b=>{r||(b.update(()=>{let E=xs();E.clear();let T=Cs();E.append(gs().append(T)),T.select()}),o([])),n(E=>!E)},[r]),h=ce(()=>{if(!r)return;let b=window.getSelection();if(b===null||b.anchorNode==null||b.focusNode==null)return;let{anchorNode:E,anchorOffset:T,focusNode:I,focusOffset:S}=ws(b),R=d().getRootElement(),w;E!==null&&(w=pr(E,R));let x;I!==null&&(x=pr(I,R)),p("snapshot",{anchorNode:E,anchorOffset:T,anchorPath:w,focusNode:I,focusOffset:S,focusPath:x})},[p,r,d]),_=ce(()=>{bs(m())},[m]),g=ce(()=>{_s("test.js",m())},[m]);return[ue("button",{className:`editor-dev-button ${r?"active":""}`,id:"test-recorder-button",onClick:b=>{f(d()),b.preventDefault()},title:r?"Disable test recorder":"Enable test recorder",type:"button",children:r?"Disable test recorder":"Enable test recorder"}),r?Xt("div",{className:"test-recorder-output",children:[Xt("div",{className:"test-recorder-toolbar",children:[ue("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:b=>{h(),b.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),ue("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:b=>{_(),b.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),ue("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:b=>{g(),b.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),ue("pre",{id:"test-recorder",ref:u,children:l})]}):null]}var gr=()=>{let[t]=hs(),[e,o]=ks(t);return Xt(hr.Fragment,{children:[ue("p",{children:"HI"}),e,o,ue("p",{children:"DONE"})]})};var Ns=y({plugins:[{Component:gr,position:"bottom"}]});import{c as Ls}from"react/compiler-runtime";import{jsx as Is}from"react/jsx-runtime";import{useLexicalComposerContext as Rs}from"@lexical/react/LexicalComposerContext.js";import{TreeView as ys}from"@lexical/react/LexicalTreeView.js";import"react";var Cr=()=>{let t=Ls(2),[e]=Rs(),o;return t[0]!==e?(o=Is(ys,{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 Ss=y({plugins:[{Component:Cr,position:"bottom"}]});import{$isRangeSelection as Ms,FORMAT_TEXT_COMMAND as vs}from"lexical";import{jsx as xr}from"react/jsx-runtime";import"react";var br=()=>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 U=t=>({type:"buttons",items:t,key:"format",order:40});var _r={type:"text-format",format:["bold","italic"],tag:"***"},Tr={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},Er={type:"text-format",format:["bold"],tag:"**"},wr={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var kr=[U([{ChildComponent:br,isActive:({selection:t})=>Ms(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(vs,"bold")},order:1}])],Fs=y(({featureProviderMap:t})=>{let e=[Er,wr];return t.get("italic")&&e.push(Tr,_r),{markdownTransformers:e,toolbarFixed:{groups:kr},toolbarInline:{groups:kr}}});import{$isRangeSelection as Ds,FORMAT_TEXT_COMMAND as Os}from"lexical";import{jsx as Nr,jsxs as As}from"react/jsx-runtime";import"react";var Lr=()=>As("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:[Nr("path",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),Nr("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var Ir={type:"text-format",format:["code"],tag:"`"};var Rr=[U([{ChildComponent:Lr,isActive:({selection:t})=>Ds(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(Os,"code")},order:7}])],Ps=y({markdownTransformers:[Ir],toolbarFixed:{groups:Rr},toolbarInline:{groups:Rr}});import{$isRangeSelection as $s,FORMAT_TEXT_COMMAND as Hs}from"lexical";import{jsx as yr}from"react/jsx-runtime";import"react";var Sr=()=>yr("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:yr("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 Mr={type:"text-format",format:["italic"],tag:"*"},vr={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var Fr=[U([{ChildComponent:Sr,isActive:({selection:t})=>$s(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(Hs,"italic")},order:2}])],Bs=y({markdownTransformers:[Mr,vr],toolbarFixed:{groups:Fr},toolbarInline:{groups:Fr}});import{$isRangeSelection as Gs,FORMAT_TEXT_COMMAND as Us}from"lexical";import{jsx as Ar,jsxs as js}from"react/jsx-runtime";import"react";var Dr=()=>js("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:[Ar("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"}),Ar("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var Or={type:"text-format",format:["strikethrough"],tag:"~~"};var Pr=[U([{ChildComponent:Dr,isActive:({selection:t})=>Gs(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(Us,"strikethrough")},order:4}])],Ws=y({markdownTransformers:[Or],toolbarFixed:{groups:Pr},toolbarInline:{groups:Pr}});import{$isRangeSelection as Vs,FORMAT_TEXT_COMMAND as Ks}from"lexical";import{jsx as $r}from"react/jsx-runtime";import"react";var Hr=()=>$r("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:$r("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 Br=[U([{ChildComponent:Hr,isActive:({selection:t})=>Vs(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(Ks,"subscript")},order:5}])],zs=y({toolbarFixed:{groups:Br},toolbarInline:{groups:Br}});import{$isRangeSelection as Zs,FORMAT_TEXT_COMMAND as Ys}from"lexical";import{jsx as jr}from"react/jsx-runtime";import"react";var Gr=()=>jr("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:jr("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 Ur=[U([{ChildComponent:Gr,isActive:({selection:t})=>Zs(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(Ys,"superscript")},order:6}])],Xs=y({toolbarFixed:{groups:Ur},toolbarInline:{groups:Ur}});import{$isRangeSelection as qs,FORMAT_TEXT_COMMAND as Qs}from"lexical";import{jsx as Wr,jsxs as Js}from"react/jsx-runtime";import"react";var Vr=()=>Js("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:[Wr("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"}),Wr("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var Kr=[U([{ChildComponent:Vr,isActive:({selection:t})=>qs(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(Qs,"underline")},order:3}])],ea=y({toolbarFixed:{groups:Kr},toolbarInline:{groups:Kr}});import{$createHeadingNode as na,$isHeadingNode as sn,HeadingNode as ia}from"@lexical/rich-text";import{$setBlocksType as la}from"@lexical/selection";import{$getSelection as sa,$isRangeSelection as aa}from"lexical";import{jsx as zr}from"react/jsx-runtime";import"react";var Zr=()=>zr("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:zr("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 Yr}from"react/jsx-runtime";import"react";var Xr=()=>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",{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 Jr}from"react/jsx-runtime";import"react";var qr=()=>Jr("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:Jr("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 Qr}from"react/jsx-runtime";import"react";var en=()=>Qr("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Qr("path",{d:"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 tn}from"react/jsx-runtime";import"react";var on=()=>tn("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:tn("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 rn}from"react/jsx-runtime";import"react";var nn=()=>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:"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 ta,$isHeadingNode as oa,HeadingNode as ra}from"@lexical/rich-text";var Jt=t=>(e,o,r)=>{let n=t(r);n&&(n.append(...o),e.replace(n),n.select(0,0))};var ln=t=>{let o=`^(${t.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`,r=new RegExp(o);return{type:"element",dependencies:[ra],export:(n,i)=>{if(!oa(n))return null;let l=Number(n.getTag().slice(1));return"#".repeat(l)+" "+i(n)},regExp:r,replace:Jt(n=>{let i="h"+n[1].length;return ta(i)})}};var an=t=>{let e=sa();la(e,()=>na(t))},cn={h1:Zr,h2:Xr,h3:qr,h4:en,h5:on,h6:nn},ca=y(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[W(e.map((r,n)=>({ChildComponent:cn[r],isActive:({selection:i})=>{if(!aa(i))return!1;for(let l of i.getNodes()){if(sn(l)&&l.getTag()===r)continue;let s=l.getParent();if(!(sn(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(()=>{an(r)})},order:n+2})))];return{markdownTransformers:[ln(e)],nodes:[ia],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[G(e.map(r=>({Icon:cn[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(()=>{an(r)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}});import{$isNodeSelection as xa}from"lexical";import{jsx as un}from"react/jsx-runtime";import"react";var qt=()=>un("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:un("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as dn,jsxs as ua}from"react/jsx-runtime";import"react";var mn=()=>ua("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[dn("path",{d:"M5 10h10",stroke:"currentColor"}),dn("path",{d:"M10 15V5",stroke:"currentColor"})]});var J=t=>({type:"dropdown",ChildComponent:mn,items:t,key:"add",order:10});var pn={type:"element",dependencies:[Ye],export:(t,e)=>Je(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=Xe();e&&t.replace(e)}};import{c as da}from"react/compiler-runtime";import{useLexicalComposerContext as ma}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as pa}from"@lexical/utils";import{$getSelection as fa,$isRangeSelection as ha,COMMAND_PRIORITY_EDITOR as ga}from"lexical";import{useEffect as Ca}from"react";var fn=()=>{let t=da(3),[e]=ma(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Le,n=>{let i=fa();if(!ha(i))return!1;if(i.focus.getNode()!==null){let s=Xe();pa(s)}return!0},ga),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Ca(o,r),null};var ba=y({markdownTransformers:[pn],nodes:[Ye],plugins:[{Component:fn,position:"normal"}],slashMenu:{groups:[G([{Icon:qt,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Le,void 0)}}])]},toolbarFixed:{groups:[J([{ChildComponent:qt,isActive:({selection:t})=>{if(!xa(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Je(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Le,void 0)}}])]}});import{INDENT_CONTENT_COMMAND as Ea,OUTDENT_CONTENT_COMMAND as wa}from"lexical";import{jsx as at,jsxs as _a}from"react/jsx-runtime";import"react";var hn=()=>_a("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:[at("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),at("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),at("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),at("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as ct,jsxs as Ta}from"react/jsx-runtime";import"react";var gn=()=>Ta("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:[ct("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),ct("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),ct("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),ct("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});var Cn=t=>({type:"buttons",items:t,key:"indent",order:35});var xn=[Cn([{ChildComponent:hn,isActive:()=>!1,isEnabled:({selection:t})=>{if(!t||!t?.getNodes()?.length)return!1;for(let e of t.getNodes())if("__indent"in e&&e.__indent>0||e.getParent()&&"__indent"in e.getParent()&&e.getParent().__indent>0)return!0;return!1},key:"indentDecrease",label:({i18n:t})=>t.t("lexical:indent:decreaseLabel"),onSelect:({editor:t})=>{t.dispatchCommand(wa,void 0)},order:1},{ChildComponent:gn,isActive:()=>!1,key:"indentIncrease",label:({i18n:t})=>t.t("lexical:indent:increaseLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Ea,void 0)},order:2}])],ka=y({toolbarFixed:{groups:xn},toolbarInline:{groups:xn}});import{$findMatchingParent as Ac}from"@lexical/utils";import{$getSelection as lo,$isRangeSelection as Zn}from"lexical";import{jsx as bn}from"react/jsx-runtime";import"react";var _n=()=>bn("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:bn("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 Tn}from"@lexical/selection";function fe(t){let{anchor:e}=t,{focus:o}=t,r=t.anchor.getNode(),n=t.focus.getNode();return r===n?r:t.isBackward()?Tn(o)?r:n:Tn(e)?r:n}var Qt=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as Da,$isTextNode as Oa}from"lexical";import{addClassNamesToElement as Na,isHTMLAnchorElement as La}from"@lexical/utils";import oo from"bson-objectid";import{$applyNodeReplacement as Ia,$createTextNode as En,$getSelection as Ra,$isElementNode as wn,$isRangeSelection as to,createCommand as ya,ElementNode as Sa}from"lexical";var Ma=new Set(["http:","https:","mailto:","sms:","tel:"]),V=class t extends Sa{__fields;__id;constructor({id:e,fields:o={doc:null,linkType:"custom",newTab:!1,url:void 0},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:va,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 oo.default().toHexString(),e.version=3);let o=q({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=eo(o.rel,"add","noopener")),Na(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(!to(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(wn(r)){let n=q({fields:this.__fields});return r.append(n),n}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!Ma.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=eo(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=eo(o.rel,"remove","noopener"))),!1}};function va(t){let e=null;if(La(t)){let o=t.textContent;o!==null&&o!==""&&(e=q({id:new oo.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function q({id:t,fields:e}){return Ia(new V({id:t??new oo.default().toHexString(),fields:e}))}function j(t){return t instanceof V}var Y=ya("TOGGLE_LINK_COMMAND");function kn(t){let e=Ra();if(!to(e)&&!t.selectedNodes.length)return;let o=to(e)?e.extract():t.selectedNodes;if(t===null)o.forEach(r=>{let n=r.getParent();if(j(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=j(i)?i:Fa(i);if(l!==null){l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append(En(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||wn(i)&&!i.isInline())){if(j(l)){n=l,l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append(En(t.text)),l.getChildren().forEach(s=>{s!==l.getLastChild()&&s.remove()}));return}if(l.is(r)||(r=l,n=q({fields:t.fields}),j(l)?i.getPreviousSibling()===null?l.insertBefore(n):l.insertAfter(n):i.insertBefore(n)),j(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 Fa(t){return Aa(t,e=>j(e))}function Aa(t,e){let o=t;for(;o!==null&&(o=o.getParent())!==null&&!e(o););return o}function eo(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 Nn={type:"text-match",dependencies:[V],export:(t,e,o)=>{if(!j(t))return null;let r=t,{url:n}=r.getFields(),i=`[${r.getTextContent()}](${n})`,l=r.getFirstChild();return r.getChildrenSize()===1&&Oa(l)?o(l,i):i},importRegExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:(t,e)=>{let[,o,r]=e,n=q({fields:{doc:null,linkType:"custom",newTab:!1,url:r}}),i=Da(o);i.setFormat(t.getFormat()),n.append(i),t.replace(n)},trigger:")"};import{$applyNodeReplacement as Pa,$isElementNode as $a}from"lexical";var Q=class t extends V{static clone(e){return new t({id:void 0,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=Pe({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($a(r)){let n=Pe({fields:this.__fields});return r.append(n),n}return null}};function Pe({fields:t}){return Pa(new Q({id:void 0,fields:t}))}function ee(t){return t instanceof Q}import{c as Ha}from"react/compiler-runtime";import{useLexicalComposerContext as Ba}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as ja}from"@lexical/utils";import{$createTextNode as Ln,$getSelection as Ga,$isElementNode as Rn,$isLineBreakNode as yn,$isNodeSelection as Ua,$isRangeSelection as Wa,$isTextNode as $e,TextNode as Va}from"lexical";import{useEffect as Ka}from"react";function In(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 Sn(t,e){for(let o=0;o<e.length;o++){let r=e[o](t);if(r!=null)return r}return null}var za=/[.,;\s]/;function dt(t){return za.test(t)}function Mn(t){return dt(t[t.length-1])}function no(t){return dt(t[0])}function Za(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function vn(t){let e=t.getPreviousSibling();return Rn(e)&&(e=e.getLastDescendant()),e===null||yn(e)||$e(e)&&Mn(e.getTextContent())}function Fn(t){let e=t.getNextSibling();return Rn(e)&&(e=e.getFirstDescendant()),e===null||yn(e)||$e(e)&&no(e.getTextContent())}function Ya(t,e,o,r){return(t>0?dt(o[t-1]):vn(r[0]))?e<o.length?dt(o[e]):Fn(r[r.length-1]):!1}function Xa(t,e,o){let r=[],n=[],i=[],l=0,s=0,a=[...t];for(;a.length>0;){let c=a[0],d=c.getTextContent().length,m=s;s+d<=e?(r.push(c),l+=d):m>=o?i.push(c):n.push(c),s+=d,a.shift()}return[l,r,n,i]}function Ja(t,e,o,r){let n={linkType:"custom",url:r.url,...r.fields},i=Pe({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=Ln(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 c=[],u;for(let f=1;f<t.length;f++){let h=t[f],g=h.getTextContent().length,v=s,M=s+g;if(v<o)if(M<=o)c.push(h);else{let[b,E]=h.splitText(o-v);c.push(b),u=E}s+=g}let d=Ga(),m=d?d.getNodes().find($e):void 0,p=Ln(a.getTextContent());return p.setFormat(a.getFormat()),p.setDetail(a.getDetail()),p.setStyle(a.getStyle()),i.append(p,...c),m&&m===a&&(Wa(d)?p.select(d.anchor.offset,d.focus.offset):Ua(d)&&p.select(0,p.getTextContent().length)),a.replace(i),u}}function qa(t,e,o){let r=[...t],n=r.map(a=>a.getTextContent()).join(""),i=n,l,s=0;for(;(l=Sn(i,e))!=null&&l!==null;){let a=l.index,c=l.length,u=a+c;if(Ya(s+a,s+u,n,r)){let[m,,p,f]=Xa(r,s+a,s+u),h=s+a-m,_=s+u-m,g=Ja(p,h,_,l);r=g?[g,...f]:f,o(l.url,null),s=0}else s+=u;i=i.substring(u)}}function ro(t,e,o){let r=t.getChildren(),n=r.length;for(let a=0;a<n;a++){let c=r[a];if(!$e(c)||!c.isSimpleText()){ut(t),o(null,t.getFields()?.url??null);return}}let i=t.getTextContent(),l=Sn(i,e);if(l===null||l.text!==i){ut(t),o(null,t.getFields()?.url??null);return}if(!vn(t)||!Fn(t)){ut(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 Qa(t,e,o){let r=t.getPreviousSibling(),n=t.getNextSibling(),i=t.getTextContent();if(ee(r)){let l=r.getFields()?.url?r.getFields()?.url?.startsWith("mailto:"):!1;(!no(i)||Za(i,l))&&(r.append(t),ro(r,e,o),o(null,r.getFields()?.url??null))}ee(n)&&!Mn(i)&&(ut(n),ro(n,e,o),o(null,n.getFields()?.url??null))}function ut(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 ec(t){let e=[t],o=t.getNextSibling();for(;o!==null&&$e(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function tc(t,e,o){let r=Ha(5),n,i;r[0]!==t||r[1]!==o||r[2]!==e?(n=()=>{if(!t.hasNodes([Q]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let l=(s,a)=>{o?.(s,a)};return ja(t.registerNodeTransform(Va,s=>{let a=s.getParentOrThrow(),c=s.getPreviousSibling();if(ee(a))ro(a,e,l);else if(!j(a)){if(s.isSimpleText()&&(no(s.getTextContent())||!ee(c))){let u=ec(s);qa(u,e,l)}Qa(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]),Ka(n,i)}var oc=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,rc=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,nc=[In(oc,t=>t.startsWith("http")?t:`https://${t}`),In(rc,t=>`mailto:${t}`)],An=()=>{let[t]=Ba();return tc(t,nc),null};import{jsx as ic}from"react/jsx-runtime";import{ClickableLinkPlugin as lc}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var Dn=()=>ic(lc,{});import{jsx as Ec}from"react/jsx-runtime";import"react";import{createPortal as wc}from"react-dom";import{jsx as le,jsxs as io}from"react/jsx-runtime";import{useLexicalComposerContext as ac}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as On,mergeRegister as Pn}from"@lexical/utils";import{getTranslation as cc}from"@payloadcms/translations";import{CloseMenuIcon as uc,EditIcon as dc,formatDrawerSlug as mc,useConfig as pc,useEditDepth as fc,useModal as hc,useTranslation as gc}from"@payloadcms/ui";import{$getSelection as $n,$isLineBreakNode as Cc,$isRangeSelection as Hn,COMMAND_PRIORITY_HIGH as xc,COMMAND_PRIORITY_LOW as Bn,KEY_ESCAPE_COMMAND as bc,SELECTION_CHANGE_COMMAND as _c}from"lexical";import jn,{useCallback as Gn,useEffect as ft,useRef as Tc,useState as he}from"react";function mt(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(),c=t.top-r,u=t.left-n;c<a.top&&(c+=l.height+t.height+r*2),u+l.width>a.right&&(u=a.right-l.width-n),c-=s.top,u-=s.left,e.style.opacity="1",e.style.transform=`translate(${u}px, ${c}px)`}import{createCommand as sc}from"lexical";var pt=sc("TOGGLE_LINK_WITH_MODAL_COMMAND");function Un({anchorElem:t}){let[e]=ac(),o=Tc(null),[r,n]=he(null),[i,l]=he(null),{uuid:s}=$(),{config:a}=pc(),{i18n:c,t:u}=gc(),[d,m]=he(null),{closeModal:p,toggleModal:f}=hc(),h=fc(),[_,g]=he(!1),[v,M]=he([]),[b,E]=he(!1),T=mc({slug:"lexical-rich-text-link-"+s,depth:h}),I=Gn(()=>{g(!1),o&&o.current&&(o.current.style.opacity="0",o.current.style.transform="translate(-10000px, -10000px)"),E(!1),n(null),l(null),M([]),m(null)},[g,n,l,M]),S=Gn(()=>{let R=$n(),w=null;if(!Hn(R)||!R){I();return}let x=fe(R);w=e.getElementByKey(x.getKey())?.getBoundingClientRect();let C=On(x,j),N=R.getNodes().filter(P=>!Cc(P)).find(P=>{let B=On(P,j);return C&&!C.is(B)||B&&!B.is(C)});if(C==null||N){I();return}let L={doc:void 0,linkType:void 0,newTab:void 0,url:"",...C.getFields(),id:C.getID(),text:C.getTextContent()};if(C.getFields()?.linkType==="custom")n(C.getFields()?.url??null),l(null);else{n(`/admin/collections/${C.getFields()?.doc?.relationTo}/${C.getFields()?.doc?.value}`);let P=a.collections.find(B=>B.slug===C.getFields()?.doc?.relationTo);if(!P)l(C.getFields()?.label?String(C.getFields()?.label):null),n(C.getFields()?.url?String(C.getFields()?.url):null);else{let B=u("fields:linkedTo",{label:cc(P.labels.singular,c)}).replace(/<[^>]*>?/g,"");l(B)}}m(L),g(!0),M(R?R?.getNodes():[]),ee(C)?E(!0):E(!1);let k=o.current,F=window.getSelection(),{activeElement:A}=document;if(k===null)return;let O=e.getRootElement();return F!==null&&O!==null&&O.contains(F.anchorNode)?(w||(w=F.getRangeAt(0).getBoundingClientRect()),w!=null&&(w.y+=40,mt(w,k,t))):(A==null||A.className!=="link-input")&&(O!==null&&mt(null,k,t),n(null),l(null)),!0},[e,I,a.collections,u,c,t]);return ft(()=>Pn(e.registerCommand(pt,R=>(e.dispatchCommand(Y,R),S(),f(T),!0),Bn)),[e,S,f,T]),ft(()=>{let R=t.parentElement,w=()=>{e.getEditorState().read(()=>{S()})};return window.addEventListener("resize",w),R?.addEventListener("scroll",w),()=>{window.removeEventListener("resize",w),R?.removeEventListener("scroll",w)}},[t.parentElement,e,S]),ft(()=>Pn(e.registerUpdateListener(({editorState:R})=>{R.read(()=>{S()})}),e.registerCommand(_c,()=>(S(),!0),Bn),e.registerCommand(bc,()=>_?(I(),!0):!1,xc)),[e,S,_,I]),ft(()=>{e.getEditorState().read(()=>{S()})},[e,S]),io(jn.Fragment,{children:[le("div",{className:"link-editor",ref:o,children:io("div",{className:"link-input",children:[r&&r.length>0?le("a",{href:r,rel:"noopener noreferrer",target:"_blank",children:i!=null&&i.length>0?i:r}):i!=null&&i.length>0?le("span",{className:"link-input__label-pure",children:i}):null,e.isEditable()&&io(jn.Fragment,{children:[le("button",{"aria-label":"Edit link",className:"link-edit",onClick:()=>{f(T)},onMouseDown:R=>{R.preventDefault()},tabIndex:0,type:"button",children:le(dc,{})}),!b&&le("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(Y,null)},onMouseDown:R=>{R.preventDefault()},tabIndex:0,type:"button",children:le(uc,{})})]})]})}),le(ae,{className:"lexical-link-edit-drawer",data:d,drawerSlug:T,drawerTitle:u("fields:editLink"),featureKey:"link",handleDrawerSubmit:(R,w)=>{p(T);let x=w,C={...x};delete C.text,e.update(()=>{let N=$n(),L=null;if(Hn(N)?L=fe(N).getParent():v.length&&(L=v[0].getParent()),L&&ee(L)){let k=q({fields:C});L.replace(k,!0)}}),e.dispatchCommand(Y,{fields:C,selectedNodes:v,text:x.text})},schemaPathSuffix:"fields"})]})}var Wn=t=>{let{anchorElem:e=document.body}=t;return wc(Ec(Un,{anchorElem:e}),e)};import{c as Lc}from"react/compiler-runtime";import{useLexicalComposerContext as Ic}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Rc}from"@lexical/utils";import{$getSelection as yc,$isElementNode as Sc,$isRangeSelection as Mc,COMMAND_PRIORITY_LOW as Kn,PASTE_COMMAND as vc}from"lexical";import{useEffect as Fc}from"react";var kc=/(?:[A-Za-z]{3,9}:(?:\/\/)?(?:[-;:&=+$,\w]+@)?[A-Za-z\d.-]+|(?:www.|[-;:&=+$,\w]+@)[A-Za-z\d.-]+)(?:\/[+~%/.\w-]*)?\??[-+=&;%@.\w]*#?\w*/,Nc=/^[\w\-./]*(?:#\w[\w-]*)?$/;function Vn(t){if(!t)return!1;if(t==="https://"||kc.test(t)||Nc.test(t))return!0;try{return new URL(t),!0}catch{}return!1}var zn=()=>{let t=Lc(3),[e]=Ic(),o,r;return t[0]!==e?(o=()=>{if(!e.hasNodes([V]))throw new Error("LinkPlugin: LinkNode not registered on editor");return Rc(e.registerCommand(Y,n=>(kn(n),!0),Kn),e.registerCommand(vc,n=>{let i=yc();if(!Mc(i)||i.isCollapsed()||!(n instanceof ClipboardEvent)||n.clipboardData==null)return!1;let l=n.clipboardData.getData("text");if(!Vn(l))return!1;if(!i.getNodes().some(s=>Sc(s))){let s={doc:null,linkType:"custom",newTab:!1,url:l};return e.dispatchCommand(Y,{fields:s,text:null}),n.preventDefault(),!0}return!1},Kn))},r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Fc(o,r),null};var Yn=[Qt([{ChildComponent:_n,isActive:({selection:t})=>{if(Zn(t)){let e=fe(t);return Ac(e,j)!=null}return!1},isEnabled:({selection:t})=>!!(Zn(t)&&lo()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(Y,null);else{let o=null,r=[];if(t.getEditorState().read(()=>{o=lo()?.getTextContent(),r=lo()?.getNodes()??[]}),!o?.length)return;let n={doc:null,linkType:"custom",newTab:!1,url:"https://"};t.dispatchCommand(pt,{fields:n,selectedNodes:r,text:o})}},order:1}])],Dc=y({markdownTransformers:[Nn],nodes:[V,Q],plugins:[{Component:zn,position:"normal"},{Component:An,position:"normal"},{Component:Dn,position:"normal"},{Component:Wn,position:"floatingAnchorElem"}],toolbarFixed:{groups:Yn},toolbarInline:{groups:Yn}});import{$isListNode as co,INSERT_CHECK_LIST_COMMAND as ti,ListItemNode as zc,ListNode as Zc}from"@lexical/list";import{$isRangeSelection as Yc}from"lexical";import{jsx as Xn,jsxs as Oc}from"react/jsx-runtime";import"react";var so=()=>Oc("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:[Xn("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),Xn("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Pc}from"react/jsx-runtime";import{ListPlugin as $c}from"@lexical/react/LexicalListPlugin.js";import"react";var ge=()=>Pc($c,{});function Ce(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as Gc,ListItemNode as Uc,ListNode as Wc}from"@lexical/list";import{$createListItemNode as Hc,$createListNode as Bc,$isListItemNode as jc,$isListNode as ao}from"@lexical/list";var Jn=4,xe=t=>(e,o,r)=>{let n=e.getPreviousSibling(),i=e.getNextSibling(),l=Hc(t==="check"?r[3]==="x":void 0);if(ao(i)&&i.getListType()===t){let a=i.getFirstChild();a!==null?a.insertBefore(l):i.append(l),e.remove()}else if(ao(n)&&n.getListType()===t)n.append(l),e.remove();else{let a=Bc(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/Jn);s&&l.setIndent(s)},de=(t,e,o)=>{let r=[],n=t.getChildren(),i=0;for(let l of n)if(jc(l)){if(l.getChildrenSize()===1){let u=l.getFirstChild();if(ao(u)){r.push(de(u,e,o+1));continue}}let s=" ".repeat(o*Jn),a=t.getListType(),c=a==="number"?`${t.getStart()+i}. `:a==="check"?`- [${l.getChecked()?"x":" "}] `:"- ";r.push(s+c+e(l)),i++}return r.join(`
35
+ `)};var qn={type:"element",dependencies:[Wc,Uc],export:(t,e)=>Gc(t)?de(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:xe("check")};import{jsx as Vc}from"react/jsx-runtime";import{CheckListPlugin as Kc}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var Qn=()=>Vc(Kc,{});var ei=[W([{ChildComponent:so,isActive:({selection:t})=>{if(!Yc(t))return!1;for(let e of t.getNodes()){if(co(e)&&e.getListType()==="check")continue;let o=e.getParent();if(co(o)&&o.getListType()==="check")continue;let r=o?.getParent();if(!(co(r)&&r.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(ti,void 0)},order:12}])],Xc=y(({featureProviderMap:t})=>{let e=[{Component:Qn,position:"normal"}];return!t.has("unorderedList")&&!t.has("orderedList")&&e.push({Component:ge,position:"normal"}),{markdownTransformers:[qn],nodes:t.has("unorderedList")||t.has("orderedList")?[]:[Zc,zc],plugins:e,slashMenu:{groups:[Ce([{Icon:so,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:o})=>o.t("lexical:checklist:label"),onSelect:({editor:o})=>{o.dispatchCommand(ti,void 0)}}])]},toolbarFixed:{groups:ei},toolbarInline:{groups:ei}}});import{$isListNode as mo,INSERT_ORDERED_LIST_COMMAND as ni,ListItemNode as tu,ListNode as ou}from"@lexical/list";import{$isRangeSelection as ru}from"lexical";import{jsx as He,jsxs as Jc}from"react/jsx-runtime";import"react";var uo=()=>Jc("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[He("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"}),He("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"}),He("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),He("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),He("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as qc,ListItemNode as Qc,ListNode as eu}from"@lexical/list";var oi={type:"element",dependencies:[eu,Qc],export:(t,e)=>qc(t)?de(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:xe("number")};var ri=[W([{ChildComponent:uo,isActive:({selection:t})=>{if(!ru(t))return!1;for(let e of t.getNodes()){if(mo(e)&&e.getListType()==="number")continue;let o=e.getParent();if(mo(o)&&o.getListType()==="number")continue;let r=o?.getParent();if(!(mo(r)&&r.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(ni,void 0)},order:10}])],nu=y(({featureProviderMap:t})=>({markdownTransformers:[oi],nodes:t.has("orderedList")?[]:[ou,tu],plugins:t.has("orderedList")?[]:[{Component:ge,position:"normal"}],slashMenu:{groups:[Ce([{Icon:uo,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:e})=>e.t("lexical:orderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(ni,void 0)}}])]},toolbarFixed:{groups:ri},toolbarInline:{groups:ri}}));import{$isListNode as fo,INSERT_UNORDERED_LIST_COMMAND as si,ListItemNode as cu,ListNode as uu}from"@lexical/list";import{$isRangeSelection as du}from"lexical";import{jsx as be,jsxs as iu}from"react/jsx-runtime";import"react";var po=()=>iu("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:[be("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),be("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),be("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),be("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),be("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),be("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as lu,ListItemNode as su,ListNode as au}from"@lexical/list";var ii={type:"element",dependencies:[au,su],export:(t,e)=>lu(t)?de(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:xe("bullet")};var li=[W([{ChildComponent:po,isActive:({selection:t})=>{if(!du(t))return!1;for(let e of t.getNodes()){if(fo(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(fo(o)&&o.getListType()==="bullet")continue;let r=o?.getParent();if(!(fo(r)&&r.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(si,void 0)},order:11}])],mu=y({markdownTransformers:[ii],nodes:[uu,cu],plugins:[{Component:ge,position:"normal"}],slashMenu:{groups:[Ce([{Icon:po,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(si,void 0)}}])]},toolbarFixed:{groups:li},toolbarInline:{groups:li}});import{jsx as pu}from"react/jsx-runtime";import{addClassNamesToElement as fu}from"@lexical/utils";import{DecoratorNode as hu}from"lexical";import*as ai from"react";var gu=ai.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),Be=class t extends hu{__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 Cu({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return fu(o,"unknownConverted"),o}decorate(){return pu(gu,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function Cu({data:t}){return new Be({data:t})}var xu=y(()=>({nodes:[Be]}));import{jsx as bu}from"react/jsx-runtime";import{addClassNamesToElement as _u}from"@lexical/utils";import{DecoratorNode as Tu}from"lexical";import*as ci from"react";var Eu=ci.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),je=class t extends Tu{__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 wu({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return _u(o,"unknownConverted"),o}decorate(){return bu(Eu,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function wu({data:t}){return new je({data:t})}var ku=y(({clientFunctions:t})=>({nodes:[je]}));import{$setBlocksType as mi}from"@lexical/selection";import{$createParagraphNode as pi,$getSelection as fi,$isParagraphNode as ui,$isRangeSelection as Nu}from"lexical";var di=[W([{ChildComponent:De,isActive:({selection:t})=>{if(!Nu(t))return!1;for(let e of t.getNodes())if(!ui(e)&&!ui(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=fi();mi(e,()=>pi())})},order:1}])],Lu=y({slashMenu:{groups:[G([{Icon:De,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=fi();mi(e,()=>pi())})}}])]},toolbarFixed:{groups:di},toolbarInline:{groups:di}});import{$isNodeSelection as Ku}from"lexical";import{jsx as Ge,jsxs as Iu}from"react/jsx-runtime";import"react";var ho=()=>Iu("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:[Ge("g",{clipPath:"url(#clip0_4397_10817)",children:Ge("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"})}),Ge("defs",{children:Ge("clipPath",{id:"clip0_4397_10817",children:Ge("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{c as Au}from"react/compiler-runtime";import{jsx as Du}from"react/jsx-runtime";import{useLexicalComposerContext as Ou}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Pu}from"@lexical/utils";import{useConfig as $u}from"@payloadcms/ui";import{$getPreviousSelection as Hu,$getSelection as Bu,$isParagraphNode as bi,$isRangeSelection as ju,COMMAND_PRIORITY_EDITOR as Gu,createCommand as Uu}from"lexical";import{useEffect as Wu}from"react";import{c as Ru}from"react/compiler-runtime";import{jsx as ht}from"react/jsx-runtime";import{useLexicalComposerContext as yu}from"@lexical/react/LexicalComposerContext.js";import{useListDrawer as Su}from"@payloadcms/ui";import{$getNodeByKey as Mu,COMMAND_PRIORITY_EDITOR as vu}from"lexical";import{useEffect as hi,useState as gi}from"react";var Fu=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=Mu(o);n&&n.replace(ye({relationTo:e,value:r}))}):t.dispatchCommand(go,{relationTo:e,value:r})},Ci=t=>{let e=Ru(21),{enabledCollectionSlugs:o}=t,[r]=yu(),n;e[0]!==o?(n=()=>o[0],e[0]=o,e[1]=n):n=e[1];let[i,l]=gi(n),[s,a]=gi(null),c;e[2]!==o||e[3]!==i?(c={collectionSlugs:o,selectedCollection:i},e[2]=o,e[3]=i,e[4]=c):c=e[4];let[u,d,m]=Su(c),{closeDrawer:p,isDrawerOpen:f,openDrawer:h}=m,_,g;e[5]!==r||e[6]!==h?(_=()=>r.registerCommand(Ie,I=>(a(I?.replace?I?.replace.nodeKey:null),h(),!0),vu),g=[r,h],e[5]=r,e[6]=h,e[7]=_,e[8]=g):(_=e[7],g=e[8]),hi(_,g);let v;e[9]!==r||e[10]!==s||e[11]!==p?(v=I=>{let{collectionSlug:S,docID:R}=I;Fu({editor:r,relationTo:S,replaceNodeKey:s,value:R}),p()},e[9]=r,e[10]=s,e[11]=p,e[12]=v):v=e[12];let M=v,b;e[13]!==o?(b=()=>{l(o[0])},e[13]=o,e[14]=b):b=e[14];let E;e[15]!==f||e[16]!==o?(E=[f,o],e[15]=f,e[16]=o,e[17]=E):E=e[17],hi(b,E);let T;return e[18]!==M||e[19]!==u?(T=ht(u,{onSelect:M}),e[18]=M,e[19]=u,e[20]=T):T=e[20],T},xi=t=>t?.enabledCollectionSlugs?.length>0?ht(Ci,{...t}):ht(qe,{...t,children:ht(Ci,{...t})});var go=Uu("INSERT_RELATIONSHIP_COMMAND"),_i=t=>{let e=Au(10),{clientProps:o}=t,[r]=Ou(),{config:n}=$u(),{collections:i}=n,l=null;if(o?.enabledCollections)l=o?.enabledCollections;else if(o?.disabledCollections){let u;if(e[0]!==o||e[1]!==i){let d;e[3]!==o?(d=m=>{let{slug:p}=m;return!o?.disabledCollections?.includes(p)},e[3]=o,e[4]=d):d=e[4],u=i.filter(d).map(Vu),e[0]=o,e[1]=i,e[2]=u}else u=e[2];l=u}let s,a;e[5]!==r?(s=()=>{if(!r.hasNodes([Re]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return r.registerCommand(go,u=>{let d=Bu()||Hu();if(ju(d)){let m=ye(u);Pu(m);let{focus:p}=d,f=p.getNode();bi(f)&&f.getTextContentSize()===0&&f.getParent().getChildren().filter(h=>bi(h)).length>1&&f.remove()}return!0},Gu)},a=[r],e[5]=r,e[6]=s,e[7]=a):(s=e[6],a=e[7]),Wu(s,a);let c;return e[8]!==l?(c=Du(xi,{enabledCollectionSlugs:l}),e[8]=l,e[9]=c):c=e[9],c};function Vu(t){let{slug:e}=t;return e}var zu=y({nodes:[Re],plugins:[{Component:_i,position:"normal"}],slashMenu:{groups:[G([{Icon:ho,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ie,{replace:!1})}}])]},toolbarFixed:{groups:[J([{ChildComponent:ho,isActive:({selection:t})=>{if(!Ku(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Dt(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ie,{replace:!1})}}])]}});import{c as sd}from"react/compiler-runtime";import{jsx as z,jsxs as ad}from"react/jsx-runtime";import{useLexicalComposerContext as cd}from"@lexical/react/LexicalComposerContext.js";import{useScrollInfo as ud,useThrottledEffect as dd,useTranslation as md}from"@payloadcms/ui";import*as te from"react";import{useMemo as pd}from"react";import{jsx as Zu}from"react/jsx-runtime";import{mergeRegister as Yu}from"@lexical/utils";import{$getSelection as Xu}from"lexical";import{useCallback as Ju,useEffect as gt,useState as Co}from"react";var xo="toolbar-popup__button",Ue=({children:t,editor:e,item:o})=>{let[r,n]=Co(!0),[i,l]=Co(!1),[s,a]=Co(xo),c=$(),u=Ju(()=>{e.getEditorState().read(()=>{let d=Xu();if(o.isActive){let m=o.isActive({editor:e,editorConfigContext:c,selection:d});i!==m&&l(m)}if(o.isEnabled){let m=o.isEnabled({editor:e,editorConfigContext:c,selection:d});r!==m&&n(m)}})},[i,e,c,r,o]);return gt(()=>{u()},[u]),gt(()=>(document.addEventListener("mouseup",u),()=>{document.removeEventListener("mouseup",u)}),[u]),gt(()=>Yu(e.registerUpdateListener(()=>{u()})),[e,u]),gt(()=>{a([xo,r===!1?"disabled":"",i?"active":"",o?.key?`${xo}-`+o.key:""].filter(Boolean).join(" "))},[r,i,s,o.key]),Zu("button",{className:s,onClick:()=>{if(r!==!1)return e._updateTags=new Set([...e._updateTags,"toolbar"]),e.focus(()=>{o.onSelect({editor:e,isActive:i})}),!0},onMouseDown:d=>{d.preventDefault()},type:"button",children:t})};import{c as Li}from"react/compiler-runtime";import{jsx as Ve,jsxs as od}from"react/jsx-runtime";import Ni,{useEffect as To}from"react";import{mergeRegister as rd}from"@lexical/utils";import{useTranslation as nd}from"@payloadcms/ui";import{$getSelection as id}from"lexical";import{jsx as se,jsxs as Ti}from"react/jsx-runtime";import Ct,{useCallback as qu,useEffect as We,useMemo as Qu,useRef as _o,useState as xt}from"react";import{createPortal as ed}from"react-dom";var bo="toolbar-popup__dropdown-item",Ei=Ct.createContext(null);function wi({active:t,children:e,editor:o,enabled:r,item:n,title:i}){let[l,s]=xt(bo);We(()=>{s([bo,r===!1?"disabled":"",t?"active":"",n?.key?`${bo}-${n.key}`:""].filter(Boolean).join(" "))},[r,t,l,n.key]);let a=_o(null),c=Ct.useContext(Ei);if(c===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:u}=c;return We(()=>{a?.current!=null&&u(a)},[a,u]),se("button",{className:l,onClick:()=>{r!==!1&&(o._updateTags=new Set([...o._updateTags,"toolbar"]),o.focus(()=>{n.onSelect({editor:o,isActive:t})}))},onMouseDown:d=>{d.preventDefault()},ref:a,title:i,type:"button",children:e})}function td({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:r}){let[n,i]=xt(),[l,s]=xt(),a=qu(d=>{i(m=>m!=null?[...m,d]:[d])},[i]),c=d=>{if(n==null)return;let{key:m}=d;["ArrowDown","ArrowUp","Escape","Tab"].includes(m)&&d.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])},u=Qu(()=>({registerItem:a}),[a]);return We(()=>{n!=null&&l==null&&s(n[0]),l!=null&&l?.current!=null&&l.current.focus()},[n,l]),se(Ei.Provider,{value:u,children:se("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:c,ref:e,children:t})})}function ki({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:r=!1,Icon:n,itemsContainerClassNames:i,label:l,stopCloseOnClickSelf:s}){let a=_o(null),c=_o(null),[u,d]=xt(!1),m=()=>{d(!1),c?.current!=null&&c.current.focus()};We(()=>{let f=c.current,h=a.current;if(u&&f!==null&&h!==null){let{left:_,top:g}=f.getBoundingClientRect(),v=window.scrollY||document.documentElement.scrollTop;h.style.top=`${g+v+f.offsetHeight+5}px`,h.style.left=`${Math.min(_-5,window.innerWidth-h.offsetWidth-20)}px`}},[a,c,u]),We(()=>{let f=c.current;if(f!==null&&u){let h=_=>{let{target:g}=_;s!=null&&a.current!=null&&a.current.contains(g)||f.contains(g)||d(!1)};return document.addEventListener("click",h),()=>{document.removeEventListener("click",h)}}},[a,c,u,s]);let p=ed(se(td,{dropDownRef:a,itemsContainerClassNames:i,onClose:m,children:o}),document.body);return Ti(Ct.Fragment,{children:[Ti("button",{"aria-label":t,className:e+(u?" active":""),disabled:r,onClick:f=>{f.preventDefault(),d(!u)},onMouseDown:f=>{f.preventDefault()},ref:c,type:"button",children:[n&&se(n,{}),l&&se("span",{className:"toolbar-popup__dropdown-label",children:l}),se("i",{className:"toolbar-popup__dropdown-caret"})]}),u&&se(Ct.Fragment,{children:p})]})}var Eo="toolbar-popup__dropdown",ld=t=>{let e=Li(19),{active:o,anchorElem:r,editor:n,enabled:i,item:l}=t,{i18n:s}=nd(),{field:a}=$(),{richTextComponentMap:c}=a;if(l.Component){let p;return e[0]!==l||e[1]!==o||e[2]!==r||e[3]!==n||e[4]!==i?(p=l?.Component&&Ve(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]=p):p=e[5],p}let u=l.key;if(l.label){let p;e[6]!==l||e[7]!==s||e[8]!==c?(p=typeof l.label=="function"?l.label({i18n:s,richTextComponentMap:c}):l.label,e[6]=l,e[7]=s,e[8]=c,e[9]=p):p=e[9],u=p}u.length>25&&(u=u.substring(0,25)+"...");let d;e[10]!==l?(d=l?.ChildComponent&&Ve(l.ChildComponent,{}),e[10]=l,e[11]=d):d=e[11];let m;return e[12]!==u||e[13]!==d||e[14]!==o||e[15]!==n||e[16]!==i||e[17]!==l?(m=od(wi,{active:o,editor:n,enabled:i,item:l,children:[d,Ve("span",{className:"text",children:u})]},l.key),e[12]=u,e[13]=d,e[14]=o,e[15]=n,e[16]=i,e[17]=l,e[18]=m):m=e[18],m},me=t=>{let e=Li(43),{anchorElem:o,classNames:r,editor:n,groupKey:i,Icon:l,items:s,itemsContainerClassNames:a,label:c,maxActiveItems:u,onActiveChange:d}=t,m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=[],e[0]=m):m=e[0];let[p,f]=Ni.useState(m),h;e[1]===Symbol.for("react.memo_cache_sentinel")?(h=[],e[1]=h):h=e[1];let[_,g]=Ni.useState(h),v=$(),M;e[2]!==n||e[3]!==s||e[4]!==u||e[5]!==v||e[6]!==d?(M=()=>{n.getEditorState().read(()=>{let O=id(),P=[],B=[],vt=[];for(let ne of s)ne.isActive&&(!u||P.length<u)&&ne.isActive({editor:n,editorConfigContext:v,selection:O})&&(P.push(ne.key),B.push(ne)),ne.isEnabled?ne.isEnabled({editor:n,editorConfigContext:v,selection:O})&&vt.push(ne.key):vt.push(ne.key);f(P),g(vt),d&&d({activeItems:B})})},e[2]=n,e[3]=s,e[4]=u,e[5]=v,e[6]=d,e[7]=M):M=e[7];let b=M,E,T;e[8]!==b?(E=()=>{b()},T=[b],e[8]=b,e[9]=E,e[10]=T):(E=e[9],T=e[10]),To(E,T);let I,S;e[11]!==b?(I=()=>(document.addEventListener("mouseup",b),()=>{document.removeEventListener("mouseup",b)}),S=[b],e[11]=b,e[12]=I,e[13]=S):(I=e[12],S=e[13]),To(I,S);let R,w;e[14]!==n||e[15]!==b?(R=()=>rd(n.registerUpdateListener(()=>{b()})),w=[n,b],e[14]=n,e[15]=b,e[16]=R,e[17]=w):(R=e[16],w=e[17]),To(R,w);let x=`${i} dropdown`,C=`${Eo}-${i}`,N;e[18]!==r?(N=r||[],e[18]=r,e[19]=N):N=e[19];let L;e[20]!==C||e[21]!==N?(L=[Eo,C,...N].filter(Boolean),e[20]=C,e[21]=N,e[22]=L):L=e[22];let k=L.join(" "),F;e[23]!==a?(F=a||[],e[23]=a,e[24]=F):F=e[24];let A;if(e[25]!==F||e[26]!==s||e[27]!==p||e[28]!==o||e[29]!==n||e[30]!==_||e[31]!==x||e[32]!==k||e[33]!==l||e[34]!==c||e[35]!==i){let O;e[37]!==s||e[38]!==p||e[39]!==o||e[40]!==n||e[41]!==_?(O=s.length&&s.map(P=>Ve(ld,{active:p.includes(P.key),anchorElem:o,editor:n,enabled:_.includes(P.key),item:P},P.key)),e[37]=s,e[38]=p,e[39]=o,e[40]=n,e[41]=_,e[42]=O):O=e[42],A=Ve(ki,{buttonAriaLabel:x,buttonClassName:k,Icon:l,itemsContainerClassNames:[`${Eo}-items`,...F],label:c,children:O},i),e[25]=F,e[26]=s,e[27]=p,e[28]=o,e[29]=n,e[30]=_,e[31]=x,e[32]=k,e[33]=l,e[34]=c,e[35]=i,e[36]=A}else A=e[36];return A};function fd({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&z(o.Component,{anchorElem:t,editor:e,item:o},o.key):z(Ue,{editor:e,item:o,children:o?.ChildComponent&&z(o.ChildComponent,{})},o.key)}function hd(t){let e=sd(27),{anchorElem:o,editor:r,editorConfig:n,group:i,index:l}=t,{i18n:s}=md(),{field:a}=$(),{richTextComponentMap:c}=a,[u,d]=te.useState(null),[m,p]=te.useState(null),f,h;e[0]!==i?(f=()=>{i?.type==="dropdown"&&i.items.length&&i.ChildComponent?p(()=>i.ChildComponent):p(null)},h=[i],e[0]=i,e[1]=f,e[2]=h):(f=e[1],h=e[2]),te.useEffect(f,h);let _;e[3]!==i||e[4]!==s||e[5]!==c?(_=T=>{let{activeItems:I}=T;if(!I.length){i?.type==="dropdown"&&i.items.length&&i.ChildComponent?(p(()=>i.ChildComponent),d(null)):(p(null),d(null));return}let S=I[0],R=S.key;S.label&&(R=typeof S.label=="function"?S.label({i18n:s,richTextComponentMap:c}):S.label),R.length>25&&(R=R.substring(0,25)+"..."),d(R),p(()=>S.ChildComponent)},e[3]=i,e[4]=s,e[5]=c,e[6]=_):_=e[6];let g=_,v=`fixed-toolbar__group fixed-toolbar__group-${i.key}`,M;e[7]!==i.type||e[8]!==i.items||e[9]!==i.key||e[10]!==m||e[11]!==o||e[12]!==r||e[13]!==u||e[14]!==g?(M=i.type==="dropdown"&&i.items.length&&(m?z(me,{anchorElem:o,editor:r,groupKey:i.key,Icon:m,items:i.items,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:u,maxActiveItems:1,onActiveChange:g}):z(me,{anchorElem:o,editor:r,groupKey:i.key,items:i.items,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:u,maxActiveItems:1,onActiveChange:g})),e[7]=i.type,e[8]=i.items,e[9]=i.key,e[10]=m,e[11]=o,e[12]=r,e[13]=u,e[14]=g,e[15]=M):M=e[15];let b;e[16]!==i||e[17]!==o||e[18]!==r?(b=i.type==="buttons"&&i.items.length&&i.items.map(T=>z(fd,{anchorElem:o,editor:r,item:T},T.key)),e[16]=i,e[17]=o,e[18]=r,e[19]=b):b=e[19];let E;return e[20]!==n.features.toolbarFixed||e[21]!==l||e[22]!==M||e[23]!==b||e[24]!==v||e[25]!==i.key?(E=ad("div",{className:v,children:[M,b,l<n.features.toolbarFixed?.groups.length-1&&z("div",{className:"divider"})]},i.key),e[20]=n.features.toolbarFixed,e[21]=l,e[22]=M,e[23]=b,e[24]=v,e[25]=i.key,e[26]=E):E=e[26],E}function gd({anchorElem:t,clientProps:e,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let i=te.useRef(null),{y:l}=ud(),s=pd(()=>{if(!n||e?.disableIfParentHasFixedToolbar)return null;let c=n.editorContainerRef.current.previousElementSibling;for(;c;){if(c.classList.contains("fixed-toolbar"))return c;c=c.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,n]);return dd(()=>{if(!s)return;let a=i.current;if(!a)return;let c=a.getBoundingClientRect(),u=s.getBoundingClientRect();if(!(c.bottom<u.top||c.top>u.bottom))i.current.className="fixed-toolbar fixed-toolbar--overlapping",s.className="fixed-toolbar fixed-toolbar--hide";else{if(!i.current.classList.contains("fixed-toolbar--overlapping"))return;i.current.className="fixed-toolbar",s.className="fixed-toolbar"}},50,[i,s,l]),z("div",{className:"fixed-toolbar",onFocus:a=>{a.stopPropagation()},ref:i,children:o.isEditable()&&z(te.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((a,c)=>z(hd,{anchorElem:t,editor:o,editorConfig:r,group:a,index:c},a.key))})})}var Ii=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return Ii(t.parentEditor)}return!1},Ri=({anchorElem:t,clientProps:e})=>{let[o]=cd(),r=$(),{editorConfig:n}=r,i=e.applyToFocusedEditor&&r.focusedEditor?.editor||o,l=e.applyToFocusedEditor&&r.focusedEditor?.editorConfig||n,s=Ii(r);return e?.disableIfParentHasFixedToolbar&&s||!l?.features?.toolbarFixed?.groups?.length?null:z(gd,{anchorElem:t,editor:i,editorConfig:l,parentWithFixedToolbar:s})};var Cd=y({plugins:[{Component:Ri,position:"aboveContainer"}]});import{c as xd}from"react/compiler-runtime";import{jsx as Z,jsxs as Mi}from"react/jsx-runtime";import{useLexicalComposerContext as bd}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as vi}from"@lexical/utils";import{$getSelection as Fi,$isRangeSelection as yi,$isTextNode as _d,COMMAND_PRIORITY_LOW as Td,SELECTION_CHANGE_COMMAND as Ed}from"lexical";import{useCallback as Ke,useEffect as ze,useRef as Si,useState as wd}from"react";import*as _e from"react";import{createPortal as kd}from"react-dom";function wo(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 bt(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:r=0,floatingElem:n,horizontalOffset:i=32,horizontalPosition:l="left",specialHandlingForCaret:s=!1,targetRect:a,verticalGap:c=10}=t,u=o.parentElement;if(a===null||u==null){n.style.opacity="0",n.style.transform="translate(-10000px, -10000px)";return}let d=n.getBoundingClientRect(),m=o.getBoundingClientRect(),p=u.getBoundingClientRect(),f=a.top-d.height-c,h=a.left-i;l==="center"&&(h=a.left+a.width/2-d.width/2);let _=0;return!e&&f<p.top&&!s&&(_=d.height+a.height+c*2,f+=_),l==="center"?h+d.width>p.right?h=p.right-d.width-i:h<p.left&&(h=p.left+i):h+d.width>p.right&&(h=p.right-d.width-i),h-=m.left,n.style.opacity="1",s&&r!==0?(f-=m.bottom-r+d.height-3,n.style.transform=`translate(${h}px, ${f}px) rotate(180deg)`):(f-=m.top,n.style.transform=`translate(${h}px, ${f}px)`),_}function Nd({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&Z(o.Component,{anchorElem:t,editor:e,item:o},o.key):Z(Ue,{editor:e,item:o,children:o?.ChildComponent&&Z(o.ChildComponent,{})},o.key)}function Ld(t){let e=xd(24),{anchorElem:o,editor:r,group:n,index:i}=t,{editorConfig:l}=$(),[s,a]=_e.useState(null),c,u;e[0]!==n?(c=()=>{n?.type==="dropdown"&&n.items.length&&n.ChildComponent?a(()=>n.ChildComponent):a(null)},u=[n],e[0]=n,e[1]=c,e[2]=u):(c=e[1],u=e[2]),_e.useEffect(c,u);let d;e[3]!==n?(d=g=>{let{activeItems:v}=g;if(!v.length){n?.type==="dropdown"&&n.items.length&&n.ChildComponent?a(()=>n.ChildComponent):a(null);return}let M=v[0];a(()=>M.ChildComponent)},e[3]=n,e[4]=d):d=e[4];let m=d,p=`inline-toolbar-popup__group inline-toolbar-popup__group-${n.key}`,f;e[5]!==n.type||e[6]!==n.items||e[7]!==n.key||e[8]!==s||e[9]!==o||e[10]!==r||e[11]!==m?(f=n.type==="dropdown"&&n.items.length&&(s?Z(me,{anchorElem:o,editor:r,groupKey:n.key,Icon:s,items:n.items,maxActiveItems:1,onActiveChange:m}):Z(me,{anchorElem:o,editor:r,groupKey:n.key,items:n.items,maxActiveItems:1,onActiveChange:m})),e[5]=n.type,e[6]=n.items,e[7]=n.key,e[8]=s,e[9]=o,e[10]=r,e[11]=m,e[12]=f):f=e[12];let h;e[13]!==n||e[14]!==o||e[15]!==r?(h=n.type==="buttons"&&n.items.length&&n.items.map(g=>Z(Nd,{anchorElem:o,editor:r,item:g},g.key)),e[13]=n,e[14]=o,e[15]=r,e[16]=h):h=e[16];let _;return e[17]!==l.features.toolbarInline||e[18]!==i||e[19]!==f||e[20]!==h||e[21]!==p||e[22]!==n.key?(_=Mi("div",{className:p,children:[f,h,i<l.features.toolbarInline?.groups.length-1&&Z("div",{className:"divider"})]},n.key),e[17]=l.features.toolbarInline,e[18]=i,e[19]=f,e[20]=h,e[21]=p,e[22]=n.key,e[23]=_):_=e[23],_}function Id({anchorElem:t,editor:e}){let o=Si(null),r=Si(null),{editorConfig:n}=$(),i=Ke(()=>{if(o?.current){let c=o.current.style.opacity==="0",u=o.current.style.pointerEvents==="none";c||(o.current.style.opacity="0"),u||(o.current.style.pointerEvents="none")}},[o]),l=Ke(c=>{if(o?.current&&(c.buttons===1||c.buttons===3)){let u=o.current.style.opacity==="0",d=o.current.style.pointerEvents==="none";if(!u||!d){let m=c.clientX,p=c.clientY,f=document.elementFromPoint(m,p);o.current.contains(f)||i()}}},[i]),s=Ke(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);ze(()=>(document.addEventListener("mousemove",l),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",s)}),[o,l,s]);let a=Ke(()=>{let c=Fi(),u=window.getSelection();if(o.current===null)return;let d=t.querySelector(":scope > .link-editor"),m=d!==null&&"style"in d&&d?.style?.opacity==="1",p=e.getRootElement();if(c!==null&&u!==null&&!u.isCollapsed&&p!==null&&p.contains(u.anchorNode)){let f=wo(u,p),h=bt({alwaysDisplayOnTop:m,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});r.current&&bt({anchorElem:o.current,anchorFlippedOffset:h,floatingElem:r.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else i()},[e,i,t]);return ze(()=>{let c=t.parentElement,u=()=>{e.getEditorState().read(()=>{a()})};return window.addEventListener("resize",u),c&&c.addEventListener("scroll",u),()=>{window.removeEventListener("resize",u),c&&c.removeEventListener("scroll",u)}},[e,a,t]),ze(()=>(e.getEditorState().read(()=>{a()}),vi(e.registerUpdateListener(({editorState:c})=>{c.read(()=>{a()})}),e.registerCommand(Ed,()=>(a(),!1),Td))),[e,a]),Mi("div",{className:"inline-toolbar-popup",ref:o,children:[Z("div",{className:"caret",ref:r}),e.isEditable()&&Z(_e.Fragment,{children:n?.features&&n.features?.toolbarInline?.groups.map((c,u)=>Z(Ld,{anchorElem:t,editor:e,group:c,index:u},c.key))})]})}function Rd(t,e){let[o,r]=wd(!1),n=Ke(()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let i=Fi(),l=window.getSelection(),s=t.getRootElement();if(l!==null&&(!yi(i)||s===null||!s.contains(l.anchorNode))){r(!1);return}if(!yi(i))return;if(i.getTextContent()!==""){let c=i.getNodes(),u=!1;for(let d of c)if(_d(d)){r(!0),u=!0;break}u||r(!1)}else r(!1);let a=i.getTextContent().replace(/\n/g,"");if(!i.isCollapsed()&&a===""){r(!1);return}})},[t]);return ze(()=>(document.addEventListener("selectionchange",n),document.addEventListener("mouseup",n),()=>{document.removeEventListener("selectionchange",n),document.removeEventListener("mouseup",n)}),[n]),ze(()=>vi(t.registerUpdateListener(()=>{n()}),t.registerRootListener(()=>{t.getRootElement()===null&&r(!1)})),[t,n]),o?kd(Z(Id,{anchorElem:e,editor:t}),e):null}var Ai=({anchorElem:t})=>{let[e]=bd();return Rd(e,t)};var yd=y({plugins:[{Component:Ai,position:"floatingAnchorElem"}]});import{TableCellNode as Jm,TableNode as qm,TableRowNode as Qm}from"@lexical/table";import{jsx as Di}from"react/jsx-runtime";import"react";var ko=()=>Di("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Di("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{jsx as H,jsxs as oe}from"react/jsx-runtime";import{useLexicalComposerContext as $i}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Md}from"@lexical/react/useLexicalEditable";import{$deleteTableColumn__EXPERIMENTAL as vd,$deleteTableRow__EXPERIMENTAL as Fd,$getNodeTriplet as Ad,$getTableCellNodeFromLexicalNode as Dd,$getTableColumnIndexFromTableCellNode as Od,$getTableNodeFromLexicalNodeOrThrow as _t,$getTableRowIndexFromTableCellNode as Pd,$insertTableColumn__EXPERIMENTAL as $d,$insertTableRow__EXPERIMENTAL as Hd,$isTableCellNode as Ze,$isTableRowNode as Io,$isTableSelection as Et,$unmergeCell as Bd,getTableObserverFromTableElement as jd,TableCellHeaderStates as Te,TableCellNode as Gd}from"@lexical/table";import{useScrollInfo as Ud}from"@payloadcms/ui";import{$createParagraphNode as Wd,$getRoot as Vd,$getSelection as wt,$isElementNode as Kd,$isParagraphNode as Hi,$isRangeSelection as Ro,$isTextNode as zd}from"lexical";import*as yo from"react";import{useCallback as re,useEffect as pe,useRef as Tt,useState as Ee}from"react";import{createPortal as Bi}from"react-dom";import{jsx as No,jsxs as Sd}from"react/jsx-runtime";import"react";var Oi=()=>Sd("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[No("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"}),No("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"}),No("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 Lo(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function Zd(t){let e=t.getNodes(),o=[],r=null,n=null,i=0;for(let l=0;l<e.length;l++){let s=e[l];if(Ze(s)){let a=s.getParentOrThrow();if(Io(a))throw new Error("Expected CellNode to have a RowNode parent");if(r!==a){if(n!==null&&i!==n)return!1;r!==null&&(n=i),r=a,i=0}let c=s.__colSpan;for(let u=0;u<c;u++)o[i+u]===void 0&&(o[i+u]=0),o[i+u]+=s.__rowSpan;i+=c}}return(n===null||i===n)&&o.every(l=>l===o[0])}function Yd(){let t=wt();if(Ro(t)&&!t.isCollapsed()||Et(t)&&!t.anchor.is(t.focus)||!Ro(t)&&!Et(t))return!1;let[e]=Ad(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function Pi(t){if(t.getChildrenSize()!==1)return!1;let e=t.getFirstChildOrThrow();return!(!Hi(e)||!e.isEmpty())}function Xd(t){let e=t.getLastDescendant();zd(e)?e.select():Kd(e)?e.selectEnd():e!==null&&e.selectNext()}function Jd({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[i]=$i(),l=Tt(null),[s,a]=Ee(n),[c,u]=Ee({columns:1,rows:1}),[d,m]=Ee(!1),[p,f]=Ee(!1),{y:h}=Ud();pe(()=>i.registerMutationListener(Gd,x=>{x.get(s.getKey())==="updated"&&i.getEditorState().read(()=>{a(s.getLatest())})},{skipInitialization:!0}),[i,s]),pe(()=>{i.getEditorState().read(()=>{let x=wt();if(Et(x)){let C=Lo(x);u(Lo(x)),m(Zd(x)&&(C.columns>1||C.rows>1))}f(Yd())})},[i]),pe(()=>{let x=e.current,C=l.current,N=i.getRootElement();if(x!=null&&C!=null&&N!=null){let L=N.getBoundingClientRect(),k=x.getBoundingClientRect();C.style.opacity="1";let F=C.getBoundingClientRect(),A=5,O=k.right+A;if(O+F.width>window.innerWidth||O+F.width>L.right){let B=k.left-F.width-A;O=(B<0?A:B)+window.pageXOffset}C.style.left=`${O+window.pageXOffset}px`;let P=k.top;if(P+F.height>window.innerHeight){let B=k.bottom-F.height;P=(B<0?A:B)+window.pageYOffset}C.style.top=`${P}px`}},[e,l,i,h]),pe(()=>{function x(C){l.current!=null&&e.current!=null&&!l.current.contains(C.target)&&!e.current.contains(C.target)&&r(!1)}return window.addEventListener("click",x),()=>window.removeEventListener("click",x)},[r,e]);let _=re(()=>{i.update(()=>{if(s.isAttached()){let C=_t(s),N=i.getElementByKey(C.getKey());if(!N)throw new Error("Expected to find tableElement in DOM");let L=jd(N);L!==null&&L.clearHighlight(),C.markDirty(),a(s.getLatest())}Vd().selectStart()})},[i,s]),g=()=>{i.update(()=>{let x=wt();if(Et(x)){let{columns:C,rows:N}=Lo(x),L=x.getNodes(),k=null;for(let F=0;F<L.length;F++){let A=L[F];if(Ze(A))if(k===null){A.setColSpan(C).setRowSpan(N),k=A;let O=Pi(A),P;O&&Hi(P=A.getFirstChild())&&P.remove()}else Ze(k)&&(Pi(A)||k.append(...A.getChildren()),A.remove())}k!==null&&(k.getChildrenSize()===0&&k.append(Wd()),Xd(k)),o()}})},v=()=>{i.update(()=>{Bd()})},M=re(x=>{i.update(()=>{Hd(x),o()})},[i,o]),b=re(x=>{i.update(()=>{for(let C=0;C<c.columns;C++)$d(x);o()})},[i,o,c.columns]),E=re(()=>{i.update(()=>{Fd(),o()})},[i,o]),T=re(()=>{i.update(()=>{_t(s).remove(),_(),o()})},[i,s,_,o]),I=re(()=>{i.update(()=>{vd(),o()})},[i,o]),S=re(()=>{i.update(()=>{let x=_t(s),C=Pd(s),N=x.getChildren();if(C>=N.length||C<0)throw new Error("Expected table cell to be inside of table row.");let L=N[C];if(!Io(L))throw new Error("Expected table row");L.getChildren().forEach(k=>{if(!Ze(k))throw new Error("Expected table cell");k.toggleHeaderStyle(Te.ROW)}),_(),o()})},[i,s,_,o]),R=re(()=>{i.update(()=>{let x=_t(s),C=Od(s),N=x.getChildren(),L=Math.max(...N.map(k=>k.getChildren().length));if(C>=L||C<0)throw new Error("Expected table cell to be inside of table row.");for(let k=0;k<N.length;k++){let F=N[k];if(!Io(F))throw new Error("Expected table row");let A=F.getChildren();if(C>=A.length)continue;let O=A[C];if(!Ze(O))throw new Error("Expected table cell");O.toggleHeaderStyle(Te.COLUMN)}_(),o()})},[i,s,_,o]),w=null;return t&&(d?w=H("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>g(),type:"button",children:"Merge cells"}):p&&(w=H("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>v(),type:"button",children:"Unmerge cells"}))),Bi(oe("div",{className:"table-action-menu-dropdown",onClick:x=>{x.stopPropagation()},ref:l,children:[w?oe(yo.Fragment,{children:[w,H("hr",{})]}):null,H("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>M(!1),type:"button",children:oe("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," above"]})}),H("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>M(!0),type:"button",children:oe("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," below"]})}),H("hr",{}),H("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>b(!1),type:"button",children:oe("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","left"]})}),H("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>b(!0),type:"button",children:oe("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","right"]})}),H("hr",{}),H("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>I(),type:"button",children:H("span",{className:"text",children:"Delete column"})}),H("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>E(),type:"button",children:H("span",{className:"text",children:"Delete row"})}),H("button",{className:"item","data-test-id":"table-delete",onClick:()=>T(),type:"button",children:H("span",{className:"text",children:"Delete table"})}),H("hr",{}),H("button",{className:"item",onClick:()=>S(),type:"button",children:oe("span",{className:"text",children:[(s.__headerState&Te.ROW)===Te.ROW?"Remove":"Add"," ","row header"]})}),H("button",{className:"item","data-test-id":"table-column-header",onClick:()=>R(),type:"button",children:oe("span",{className:"text",children:[(s.__headerState&Te.COLUMN)===Te.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function qd({anchorElem:t,cellMerge:e}){let[o]=$i(),r=Tt(null),n=Tt(null),[i,l]=Ee(!1),[s,a]=Ee(null),c=re(()=>{let d=r.current,m=wt(),p=window.getSelection(),f=document.activeElement;if(m==null||d==null){a(null);return}let h=o.getRootElement();if(Ro(m)&&h!==null&&p!==null&&h.contains(p.anchorNode)){let _=Dd(m.anchor.getNode());if(_==null){a(null);return}if(o.getElementByKey(_.getKey())==null){a(null);return}a(_)}else f||a(null)},[o]);pe(()=>o.registerUpdateListener(()=>{o.getEditorState().read(()=>{c()})})),pe(()=>{let d=r.current;if(d!=null&&s!=null){let m=o.getElementByKey(s.getKey());if(m!=null){let p=m.getBoundingClientRect(),f=d.getBoundingClientRect(),h=t.getBoundingClientRect(),_=p.top-h.top+4,g=p.right-f.width-10-h.left;d.style.opacity="1",d.style.transform=`translate(${g}px, ${_}px)`}else d.style.opacity="0",d.style.transform="translate(-10000px, -10000px)"}},[r,s,o,t]);let u=Tt(s);return pe(()=>{u.current!==s&&l(!1),u.current=s},[u,s]),H("div",{className:"table-cell-action-button-container",ref:r,children:s!=null&&oe(yo.Fragment,{children:[H("button",{className:"table-cell-action-button",onClick:d=>{d.stopPropagation(),l(!i)},ref:n,type:"button",children:H(Oi,{})}),i&&H(Jd,{cellMerge:e,contextRef:n,onClose:()=>l(!1),setIsMenuOpen:l,tableCellNode:s})]})})}var ji=({anchorElem:t})=>{let e=Md();return Bi(e?H(qd,{anchorElem:t??document.body,cellMerge:!0}):null,t??document.body)};import{jsx as Lt,jsxs as Qd}from"react/jsx-runtime";import{useLexicalComposerContext as em}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as tm}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as om,$getTableNodeFromLexicalNodeOrThrow as So,$getTableRowIndexFromTableCellNode as rm,$isTableCellNode as Gi,$isTableRowNode as nm,getDOMCellFromTarget as im}from"@lexical/table";import{calculateZoomLevel as Ui}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Mo}from"lexical";import*as Wi from"react";import{useCallback as we,useEffect as lm,useMemo as sm,useRef as kt,useState as Nt}from"react";import{createPortal as am}from"react-dom";var cm=33,um=50;function dm({editor:t}){let e=kt(null),o=kt(null),r=kt(null),n=$(),i=kt(null),[l,s]=Nt(null),[a,c]=Nt(null),[u,d]=Nt(!1),[m,p]=Nt(null),f=we(()=>{c(null),e.current=null,p(null),i.current=null,r.current=null},[]),h=w=>(w.buttons&1)===1;lm(()=>{let w=L=>{setTimeout(()=>{let k=L.target;if(m){s({x:L.clientX,y:L.clientY});return}if(d(h(L)),!(o.current&&o.current.contains(k))&&e.current!==k){e.current=k;let F=im(k);F&&a!==F?t.update(()=>{let A=Mo(F.elem);if(!A)throw new Error("TableCellResizer: Table cell node not found.");let O=So(A),P=t.getElementByKey(O.getKey());if(!P)throw new Error("TableCellResizer: Table element not found.");e.current=k,r.current=P.getBoundingClientRect(),c(F)}):F==null&&f()}},0)},x=L=>{setTimeout(()=>{d(!0)},0)},C=L=>{setTimeout(()=>{d(!1)},0)},N=t.registerRootListener((L,k)=>{L?.addEventListener("mousemove",w),L?.addEventListener("mousedown",x),L?.addEventListener("mouseup",C),k?.removeEventListener("mousemove",w),k?.removeEventListener("mousedown",x),k?.removeEventListener("mouseup",C)});return()=>{N()}},[a,m,t,f]);let _=w=>w==="bottom",g=we(w=>{if(!a)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let x=Mo(a.elem);if(!Gi(x))throw new Error("TableCellResizer: Table cell node not found.");let C=So(x),N=rm(x),L=C.getChildren();if(N>=L.length||N<0)throw new Error("Expected table cell to be inside of table row.");let k=L[N];if(!nm(k))throw new Error("Expected table row");let F=k.getHeight();if(F===void 0){let O=k.getChildren();F=Math.min(...O.map(P=>M(P,t)??1/0))}let A=Math.max(F+w,cm);k.setHeight(A)},{tag:"skip-scroll-into-view"})},[a,t]),v=(w,x)=>{let C=w.getWidth();if(C!==void 0)return C;let N=x.getElementByKey(w.getKey());if(N==null)return;let L=getComputedStyle(N);return N.clientWidth-parseFloat(L.paddingLeft)-parseFloat(L.paddingRight)},M=(w,x)=>x.getElementByKey(w.getKey())?.clientHeight,b=(w,x)=>{for(let C=0;C<x.length;C++)for(let N=0;N<x[C].length;N++)if(x[C][N].cell===w)return N},E=we(w=>{if(!a)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let x=Mo(a.elem);if(!Gi(x))throw new Error("TableCellResizer: Table cell node not found.");let C=So(x),[N]=om(C,null,null),L=b(x,N);if(L===void 0)throw new Error("TableCellResizer: Table column not found.");for(let k=0;k<N.length;k++){let F=N[k][L];if(F.startRow===k&&(L===N[k].length-1||N[k][L].cell!==N[k][L+1].cell)){let A=v(F.cell,t);if(A===void 0)continue;let O=Math.max(A+w,um);F.cell.setWidth(O)}}},{tag:"skip-scroll-into-view"})},[a,t]),T=we(w=>{let x=C=>{if(C.preventDefault(),C.stopPropagation(),!a)throw new Error("TableCellResizer: Expected active cell.");if(i.current){let{x:N,y:L}=i.current;if(a===null)return;let k=Ui(C.target);if(_(w)){let F=(C.clientY-L)/k;g(F)}else{let F=(C.clientX-N)/k;E(F)}f(),document.removeEventListener("mouseup",x)}};return x},[a,f,E,g]),I=we(w=>x=>{if(x.preventDefault(),x.stopPropagation(),!a)throw new Error("TableCellResizer: Expected active cell.");i.current={x:x.clientX,y:x.clientY},s(i.current),p(w),document.addEventListener("mouseup",T(w))},[a,T]),R=we(()=>{if(a){let{height:w,left:x,top:C,width:N}=a.elem.getBoundingClientRect(),L=Ui(a.elem),k=10,F={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${k}px`,left:`${window.pageXOffset+x}px`,top:`${window.pageYOffset+C+w-k/2}px`,width:`${N}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${w}px`,left:`${window.pageXOffset+x+N-k/2}px`,top:`${window.pageYOffset+C}px`,width:`${k}px`}},A=r.current;return m&&l&&A&&(_(m)?(F[m].left=`${window.pageXOffset+A.left}px`,F[m].top=`${window.pageYOffset+l.y/L}px`,F[m].height="3px",F[m].width=`${A.width}px`):(F[m].top=`${window.pageYOffset+A.top}px`,F[m].left=`${window.pageXOffset+l.x/L}px`,F[m].width="3px",F[m].height=`${A.height}px`),F[m].backgroundColor="#adf"),F}return{bottom:null,left:null,right:null,top:null}},[a,m,l])();return Lt("div",{ref:o,children:a!=null&&!u&&Qd(Wi.Fragment,{children:[Lt("div",{className:`${n.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:I("right"),style:R.right||void 0}),Lt("div",{className:`${n.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:I("bottom"),style:R.bottom||void 0})]})})}var Vi=()=>{let[t]=em(),e=tm();return sm(()=>e?am(Lt(dm,{editor:t}),document.body):null,[t,e])};import{jsx as vo,jsxs as xm,Fragment as bm}from"react/jsx-runtime";import{useLexicalComposerContext as _m}from"@lexical/react/LexicalComposerContext";import{$getTableColumnIndexFromTableCellNode as Tm,$getTableRowIndexFromTableCellNode as Em,$insertTableColumn__EXPERIMENTAL as wm,$insertTableRow__EXPERIMENTAL as km,$isTableCellNode as Nm,$isTableNode as Zi,TableNode as Lm}from"@lexical/table";import{$findMatchingParent as Im,mergeRegister as Rm}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Yi}from"lexical";import{useEffect as Xi,useRef as Ji,useState as It}from"react";import"react";import{createPortal as ym}from"react-dom";import{useMemo as gm,useRef as Cm}from"react";var mm="Expected a function",pm=Math.max,fm=Math.min;function hm(t,e,o){let r,n,i=0,l,s=!1,a=!1,c,u,d,m=!0;if(typeof t!="function")throw new TypeError(mm);e=e||0,typeof o=="object"&&(s=!!o.leading,a="maxWait"in o,c=a?pm(o.maxWait||0,e):c,m="trailing"in o?!!o.trailing:m);function p(T){let I=r,S=l;return r=l=void 0,i=T,u=t.apply(S,I),u}function f(T){return i=T,d=setTimeout(g,e),s?p(T):u}function h(T){let I=T-n,S=T-i,R=e-I;return a?fm(R,c-S):R}function _(T){let I=T-n,S=T-i;return n===void 0||I>=e||I<0||a&&S>=c}function g(){let T=Date.now();if(_(T))return v(T);d=setTimeout(g,h(T))}function v(T){return d=void 0,m&&r?p(T):(r=l=void 0,u)}function M(){d!==void 0&&clearTimeout(d),i=0,r=n=l=d=void 0}function b(){return d===void 0?u:v(Date.now())}function E(){let T=Date.now(),I=_(T);if(r=arguments,l=this,n=T,I){if(d===void 0)return f(n);if(a)return clearTimeout(d),d=setTimeout(g,e),p(n)}return d===void 0&&(d=setTimeout(g,e)),u}return E.cancel=M,E.flush=b,E}var Ki=hm;function zi(t,e,o){let r=Cm(null);return r.current=t,gm(()=>Ki((...n)=>{r.current&&r.current(...n)},e,{maxWait:o}),[e,o])}var qi=20;function Sm({anchorElem:t}){let[e]=_m(),o=$(),[r,n]=It(!1),[i,l]=It(!1),[s,a]=It(!1),[c,u]=It({}),d=Ji(new Set),m=Ji(null),p=zi(h=>{let{isOutside:_,tableDOMNode:g}=Mm(h,o.editorConfig?.lexical);if(_){n(!1),l(!1);return}if(!g)return;m.current=g;let v=null,M=null,b=null;if(e.update(()=>{let E=Yi(g);if(Nm(E)){let T=Im(E,I=>Zi(I));if(!Zi(T))return;if(b=e.getElementByKey(T?.getKey()),b){let I=T.getChildrenSize(),S=T.getChildAtIndex(0)?.getChildrenSize(),R=Em(E),w=Tm(E);R===I-1?v=E:w===S-1&&(M=E)}}}),b){let{bottom:E,height:T,right:I,width:S,x:R,y:w}=b.getBoundingClientRect(),{left:x,y:C}=t.getBoundingClientRect();v?(l(!1),n(!0),u({height:qi,left:R-x,top:E-C+5,width:S})):M&&(l(!0),n(!1),u({height:T,left:I-x+5,top:w-C,width:qi}))}},50,250);Xi(()=>{if(s)return document.addEventListener("mousemove",p),()=>{n(!1),l(!1),document.removeEventListener("mousemove",p)}},[s,p]),Xi(()=>Rm(e.registerMutationListener(Lm,h=>{e.getEditorState().read(()=>{for(let[_,g]of h)switch(g){case"created":d.current.add(_),a(d.current.size>0);break;case"destroyed":d.current.delete(_),a(d.current.size>0);break;default:break}})},{skipInitialization:!1})),[e]);let f=h=>{e.update(()=>{m.current&&(Yi(m.current)?.selectEnd(),h?(km(),n(!1)):(wm(),l(!1)))})};return xm(bm,{children:[r&&vo("button",{className:o.editorConfig.lexical.theme.tableAddRows,onClick:()=>f(!0),style:{...c}}),i&&vo("button",{className:o.editorConfig.lexical.theme.tableAddColumns,onClick:()=>f(!1),style:{...c}})]})}function Mm(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 Qi({anchorElem:t=document.body}){return ym(vo(Sm,{anchorElem:t}),t)}import{c as vm}from"react/compiler-runtime";import{jsx as Fo,jsxs as Fm}from"react/jsx-runtime";import{useLexicalComposerContext as Am}from"@lexical/react/LexicalComposerContext";import{TablePlugin as Dm}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as Om,TableNode as Pm}from"@lexical/table";import{mergeRegister as $m}from"@lexical/utils";import{formatDrawerSlug as Hm,useEditDepth as Bm,useModal as jm}from"@payloadcms/ui";import{$getSelection as Gm,$isRangeSelection as Um,COMMAND_PRIORITY_EDITOR as Wm,createCommand as Vm}from"lexical";import{createContext as Km,useContext as zm,useEffect as Zm,useMemo as Ym,useState as Xm}from"react";import*as el from"react";var Rt=Vm("OPEN_EMBED_DRAWER_COMMAND"),tl=Km({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function ol({children:t}){let[e,o]=Xm({cellEditorConfig:null,cellEditorPlugins:null});return Fo(tl.Provider,{value:Ym(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var rl=()=>{let t=vm(18),[e]=Am(),o=zm(tl),{closeModal:r,toggleModal:n}=jm(),i=Bm(),{uuid:l}=$(),s="lexical-table-create-"+l,a;t[0]!==s||t[1]!==i?(a=Hm({slug:s,depth:i}),t[0]=s,t[1]=i,t[2]=a):a=t[2];let c=a,u;t[3]!==e||t[4]!==n||t[5]!==c?(u=()=>{if(!e.hasNodes([Pm]))throw new Error("TablePlugin: TableNode is not registered on editor");return $m(e.registerCommand(Rt,()=>{let f;return f=null,e.getEditorState().read(()=>{let h=Gm();Um(h)&&(f=h)}),f&&n(c),!0},Wm))},t[3]=e,t[4]=n,t[5]=c,t[6]=u):u=t[6];let d;t[7]!==o||t[8]!==e||t[9]!==n?(d=[o,e,n],t[7]=o,t[8]=e,t[9]=n,t[10]=d):d=t[10],Zm(u,d);let m;t[11]!==r||t[12]!==c||t[13]!==e?(m=(f,h)=>{r(c),!(!h.columns||!h.rows)&&e.dispatchCommand(Om,{columns:String(h.columns),rows:String(h.rows)})},t[11]=r,t[12]=c,t[13]=e,t[14]=m):m=t[14];let p;return t[15]!==c||t[16]!==m?(p=Fm(el.Fragment,{children:[Fo(ae,{drawerSlug:c,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:m,schemaPathSuffix:"fields"}),Fo(Dm,{hasCellBackgroundColor:!1,hasCellMerge:!0})]}),t[15]=c,t[16]=m,t[17]=p):p=t[17],p};var ep=y({nodes:[qm,Jm,Qm],plugins:[{Component:rl,position:"normal"},{Component:Vi,position:"normal"},{Component:ji,position:"floatingAnchorElem"},{Component:Qi,position:"floatingAnchorElem"}],providers:[ol],slashMenu:{groups:[G([{Icon:ko,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Rt,{})}}])]},toolbarFixed:{groups:[J([{ChildComponent:ko,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Rt,{})}}])]}});import{$isNodeSelection as kp}from"lexical";import{jsx as Ao,jsxs as tp}from"react/jsx-runtime";import"react";var Do=()=>tp("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:"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"}),Ao("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"}),Ao("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 dp}from"react/compiler-runtime";import{jsx as mp}from"react/jsx-runtime";import{useLexicalComposerContext as pp}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as fp,mergeRegister as hp}from"@lexical/utils";import{useConfig as gp}from"@payloadcms/ui";import{$getPreviousSelection as Cp,$getSelection as xp,$isParagraphNode as il,$isRangeSelection as bp,COMMAND_PRIORITY_EDITOR as _p,createCommand as Tp}from"lexical";import{useEffect as Ep}from"react";import{c as op}from"react/compiler-runtime";import{jsx as Oo}from"react/jsx-runtime";import{useLexicalComposerContext as rp}from"@lexical/react/LexicalComposerContext.js";import{useListDrawer as np}from"@payloadcms/ui";import{$getNodeByKey as ip,COMMAND_PRIORITY_EDITOR as lp}from"lexical";import{useEffect as sp,useState as ap}from"react";var cp=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=ip(o);n&&n.replace(ve({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(Po,{fields:null,relationTo:e,value:r})},up=t=>{let e=op(13),{enabledCollectionSlugs:o}=t,[r]=rp(),[n,i]=ap(null),l;e[0]!==o?(l={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=l):l=e[1];let[s,a,c]=np(l),{closeDrawer:u,openDrawer:d}=c,m,p;e[2]!==r||e[3]!==d?(m=()=>r.registerCommand(Se,g=>(i(g?.replace?g?.replace.nodeKey:null),d(),!0),lp),p=[r,d],e[2]=r,e[3]=d,e[4]=m,e[5]=p):(m=e[4],p=e[5]),sp(m,p);let f;e[6]!==r||e[7]!==n||e[8]!==u?(f=g=>{let{collectionSlug:v,docID:M}=g;cp({editor:r,relationTo:v,replaceNodeKey:n,value:M}),u()},e[6]=r,e[7]=n,e[8]=u,e[9]=f):f=e[9];let h=f,_;return e[10]!==h||e[11]!==s?(_=Oo(s,{onSelect:h}),e[10]=h,e[11]=s,e[12]=_):_=e[12],_},nl=t=>Oo(qe,{...t,uploads:!0,children:Oo(up,{...t})});var Po=Tp("INSERT_UPLOAD_COMMAND"),ll=t=>{let e=dp(5),[o]=pp(),{config:r}=gp(),{collections:n}=r,i,l;e[0]!==o?(i=()=>{if(!o.hasNodes([Me]))throw new Error("UploadPlugin: UploadNode not registered on editor");return hp(o.registerCommand(Po,a=>(o.update(()=>{let c=xp()||Cp();if(bp(c)){let u=ve({data:{id:a.id,fields:a.fields,relationTo:a.relationTo,value:a.value}});fp(u);let{focus:d}=c,m=d.getNode();il(m)&&m.getTextContentSize()===0&&m.getParent().getChildren().filter(p=>il(p)).length>1&&m.remove()}}),!0),_p))},l=[o],e[0]=o,e[1]=i,e[2]=l):(i=e[1],l=e[2]),Ep(i,l);let s;return e[3]!==n?(s=mp(nl,{enabledCollectionSlugs:n.map(wp)}),e[3]=n,e[4]=s):s=e[4],s};function wp(t){let{slug:e}=t;return e}var Np=y({nodes:[Me],plugins:[{Component:ll,position:"normal"}],slashMenu:{groups:[G([{Icon:Do,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Se,{replace:!1})}}])]},toolbarFixed:{groups:[J([{ChildComponent:Do,isActive:({selection:t})=>{if(!kp(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Ot(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Se,{replace:!1})}}])]}});import{jsx as yt,jsxs as Lp}from"react/jsx-runtime";import{ShimmerEffect as Ip,useClientFunctions as Rp,useFieldProps as yp}from"@payloadcms/ui";import sl,{lazy as Sp,Suspense as Mp,useEffect as vp,useState as $o}from"react";var Fp=Sp(()=>import("./Field-MPDY6IHA.js").then(t=>({default:t.RichText}))),Ap=t=>{let{admin:e={},field:{richTextComponentMap:o},lexicalEditorConfig:r}=t,{schemaPath:n}=yp(),i=Rp(),[l,s]=$o(!1),[a,c]=$o([]),[u,d]=$o(null),m=o.get("features");m=m.sort((f,h)=>f.order-h.order);let p=0;for(let f of m){let h=Array.from(o.keys()).filter(_=>_.startsWith(`lexical_internal_feature.${f.key}.lexical_internal_components.`));p+=1,p+=h.length}return vp(()=>{if(!l){let f=[],h=0;if(Object.entries(i).forEach(([_,g])=>{_.startsWith(`lexicalFeature.${n}.`)&&(_.includes(".lexical_internal_components.")||f.push(g),h++)}),h===p){c(f),s(!0);let _=Qe({clientFunctions:i,schemaPath:n,unSanitizedEditorConfig:{features:f,lexical:r}});d(Ae(r||Fe,_,e))}}},[e,l,i,n,m.length,a,u,r,p]),l?yt(Mp,{fallback:yt(Ip,{height:"35vh"}),children:u&&yt(Fp,{...t,editorConfig:u})}):yt(sl.Fragment,{children:Array.isArray(m)&&m.map(f=>{let _=Array.from(o.keys()).filter(g=>g.startsWith(`lexical_internal_feature.${f.key}.lexical_internal_components.`)).map(g=>o.get(g));return Lp(sl.Fragment,{children:[_?.length?_.map(g=>g):null,f.ClientFeature]},f.key)})})};function Dp(...t){return t.filter(Boolean).join(" ")}var St=new WeakMap;function al(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function Mt(t,e){let o=St.get(t);if(o===void 0){let r=new Set,n=l=>{o!==void 0&&(o.start=al(l))},i=l=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let a=al(l);for(let c of r)a!==null&&c([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},St.set(t,o)}return o.listeners.add(e),()=>{Op(t,e)}}function Op(t,e){let o=St.get(t);if(o===void 0)return;let{listeners:r}=o;r.delete(e),r.size===0&&(St.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function Pp(t,e){return Mt(t,(o,r)=>{let[n,i]=o;n<0&&-n>Math.abs(i)&&e(n,r)})}function $p(t,e){return Mt(t,(o,r)=>{let[n,i]=o;n>0&&n>Math.abs(i)&&e(n,r)})}function Hp(t,e){return Mt(t,(o,r)=>{let[n,i]=o;i<0&&-i>Math.abs(n)&&e(n,r)})}function Bp(t,e){return Mt(t,(o,r)=>{let[n,i]=o;i>0&&i>Math.abs(n)&&e(n,r)})}var D={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},jp=D.IS_BOLD|D.IS_ITALIC|D.IS_STRIKETHROUGH|D.IS_UNDERLINE|D.IS_CODE|D.IS_SUBSCRIPT|D.IS_SUPERSCRIPT|D.IS_HIGHLIGHT,Gp="\xA0",Up=`
36
36
 
37
- `,cl="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",ul="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",Wp=new RegExp("^[^"+ul+"]*["+cl+"]"),Vp=new RegExp("^[^"+cl+"]*["+ul+"]"),Kp={bold:D.IS_BOLD,code:D.IS_CODE,highlight:D.IS_HIGHLIGHT,italic:D.IS_ITALIC,strikethrough:D.IS_STRIKETHROUGH,subscript:D.IS_SUBSCRIPT,superscript:D.IS_SUPERSCRIPT,underline:D.IS_UNDERLINE},zp={directionless:D.IS_DIRECTIONLESS,unmergeable:D.IS_UNMERGEABLE},Zp={center:D.IS_ALIGN_CENTER,end:D.IS_ALIGN_END,justify:D.IS_ALIGN_JUSTIFY,left:D.IS_ALIGN_LEFT,right:D.IS_ALIGN_RIGHT,start:D.IS_ALIGN_START},Yp={[D.IS_ALIGN_CENTER]:"center",[D.IS_ALIGN_END]:"end",[D.IS_ALIGN_JUSTIFY]:"justify",[D.IS_ALIGN_LEFT]:"left",[D.IS_ALIGN_RIGHT]:"right",[D.IS_ALIGN_START]:"start"},Xp={normal:D.IS_NORMAL,segmented:D.IS_SEGMENTED,token:D.IS_TOKEN},Jp={[D.IS_NORMAL]:"normal",[D.IS_SEGMENTED]:"segmented",[D.IS_TOKEN]:"token"};export{Pe as $createAutoLinkNode,it as $createBlockNode,q as $createLinkNode,ye as $createRelationshipNode,ve as $createUploadNode,ee as $isAutoLinkNode,zl as $isBlockNode,j as $isLinkNode,Dt as $isRelationshipNode,Ot as $isUploadNode,Ml as AlignFeatureClient,Q as AutoLinkNode,X as BlockNode,Pl as BlockquoteFeatureClient,ms as BlocksFeatureClient,Fs as BoldFeatureClient,K as CAN_USE_DOM,Xc as ChecklistFeatureClient,zp as DETAIL_TYPE_TO_DETAIL,Up as DOUBLE_LINE_BREAK,Yp as ELEMENT_FORMAT_TO_TYPE,Zp as ELEMENT_TYPE_TO_FORMAT,pl as ENABLE_SLASH_MENU_COMMAND,ml as EditorConfigProvider,ae as FieldsDrawer,Cd as FixedToolbarFeatureClient,ca as HeadingFeatureClient,ba as HorizontalRuleFeatureClient,jp as IS_ALL_FORMATTING,ka as IndentFeatureClient,Ps as InlineCodeFeatureClient,yd as InlineToolbarFeatureClient,Bs as ItalicFeatureClient,Vp as LTR_REGEX,xu as LexicalPluginToLexicalFeatureClient,Dc as LinkFeatureClient,V as LinkNode,Gp as NON_BREAKING_SPACE,D as NodeFormat,nu as OrderedListFeatureClient,Lu as ParagraphFeatureClient,hl as Point,Wp as RTL_REGEX,Cl as Rect,zu as RelationshipFeatureClient,Re as RelationshipNode,wl as RichTextCell,Ap as RichTextField,ku as SlateToLexicalFeatureClient,Ws as StrikethroughFeatureClient,zs as SubscriptFeatureClient,Xs as SuperscriptFeatureClient,Xp as TEXT_MODE_TO_TYPE,Kp as TEXT_TYPE_TO_FORMAT,Jp as TEXT_TYPE_TO_MODE,Y as TOGGLE_LINK_COMMAND,ep as TableFeatureClient,Ns as TestRecorderFeatureClient,Ue as ToolbarButton,me as ToolbarDropdown,Ss as TreeViewFeatureClient,ea as UnderlineFeatureClient,mu as UnorderedListFeatureClient,Np as UploadFeatureClient,Me as UploadNode,Bp as addSwipeDownListener,Pp as addSwipeLeftListener,$p as addSwipeRightListener,Hp as addSwipeUpListener,Jt as createBlockNode,Ut as createClientComponent,y as createClientFeature,Fe as defaultEditorLexicalConfig,wo as getDOMRangeRect,Ft as getEnabledNodes,fe as getSelectedNode,fl as isHTMLElement,gl as isPoint,Dp as joinClasses,Ae as sanitizeClientEditorConfig,Go as sanitizeClientFeatures,bt as setFloatingElemPosition,pt as setFloatingElemPositionForLinkEditor,G as slashMenuBasicGroupWithItems,J as toolbarAddDropdownGroupWithItems,Qt as toolbarFeatureButtonsGroupWithItems,U as toolbarFormatGroupWithItems,W as toolbarTextDropdownGroupWithItems,$ as useEditorConfigContext};
37
+ `,cl="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",ul="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",Wp=new RegExp("^[^"+ul+"]*["+cl+"]"),Vp=new RegExp("^[^"+cl+"]*["+ul+"]"),Kp={bold:D.IS_BOLD,code:D.IS_CODE,highlight:D.IS_HIGHLIGHT,italic:D.IS_ITALIC,strikethrough:D.IS_STRIKETHROUGH,subscript:D.IS_SUBSCRIPT,superscript:D.IS_SUPERSCRIPT,underline:D.IS_UNDERLINE},zp={directionless:D.IS_DIRECTIONLESS,unmergeable:D.IS_UNMERGEABLE},Zp={center:D.IS_ALIGN_CENTER,end:D.IS_ALIGN_END,justify:D.IS_ALIGN_JUSTIFY,left:D.IS_ALIGN_LEFT,right:D.IS_ALIGN_RIGHT,start:D.IS_ALIGN_START},Yp={[D.IS_ALIGN_CENTER]:"center",[D.IS_ALIGN_END]:"end",[D.IS_ALIGN_JUSTIFY]:"justify",[D.IS_ALIGN_LEFT]:"left",[D.IS_ALIGN_RIGHT]:"right",[D.IS_ALIGN_START]:"start"},Xp={normal:D.IS_NORMAL,segmented:D.IS_SEGMENTED,token:D.IS_TOKEN},Jp={[D.IS_NORMAL]:"normal",[D.IS_SEGMENTED]:"segmented",[D.IS_TOKEN]:"token"};export{Pe as $createAutoLinkNode,it as $createBlockNode,q as $createLinkNode,ye as $createRelationshipNode,ve as $createUploadNode,ee as $isAutoLinkNode,zl as $isBlockNode,j as $isLinkNode,Dt as $isRelationshipNode,Ot as $isUploadNode,Ml as AlignFeatureClient,Q as AutoLinkNode,X as BlockNode,Pl as BlockquoteFeatureClient,ms as BlocksFeatureClient,Fs as BoldFeatureClient,K as CAN_USE_DOM,Xc as ChecklistFeatureClient,zp as DETAIL_TYPE_TO_DETAIL,Up as DOUBLE_LINE_BREAK,Yp as ELEMENT_FORMAT_TO_TYPE,Zp as ELEMENT_TYPE_TO_FORMAT,gl as ENABLE_SLASH_MENU_COMMAND,ml as EditorConfigProvider,ae as FieldsDrawer,Cd as FixedToolbarFeatureClient,ca as HeadingFeatureClient,ba as HorizontalRuleFeatureClient,jp as IS_ALL_FORMATTING,ka as IndentFeatureClient,Ps as InlineCodeFeatureClient,yd as InlineToolbarFeatureClient,Bs as ItalicFeatureClient,Vp as LTR_REGEX,xu as LexicalPluginToLexicalFeatureClient,Dc as LinkFeatureClient,V as LinkNode,Gp as NON_BREAKING_SPACE,D as NodeFormat,nu as OrderedListFeatureClient,Lu as ParagraphFeatureClient,fl as Point,Wp as RTL_REGEX,Cl as Rect,zu as RelationshipFeatureClient,Re as RelationshipNode,wl as RichTextCell,Ap as RichTextField,ku as SlateToLexicalFeatureClient,Ws as StrikethroughFeatureClient,zs as SubscriptFeatureClient,Xs as SuperscriptFeatureClient,Xp as TEXT_MODE_TO_TYPE,Kp as TEXT_TYPE_TO_FORMAT,Jp as TEXT_TYPE_TO_MODE,Y as TOGGLE_LINK_COMMAND,ep as TableFeatureClient,Ns as TestRecorderFeatureClient,Ue as ToolbarButton,me as ToolbarDropdown,Ss as TreeViewFeatureClient,ea as UnderlineFeatureClient,mu as UnorderedListFeatureClient,Np as UploadFeatureClient,Me as UploadNode,Bp as addSwipeDownListener,Pp as addSwipeLeftListener,$p as addSwipeRightListener,Hp as addSwipeUpListener,Jt as createBlockNode,Ut as createClientComponent,y as createClientFeature,Fe as defaultEditorLexicalConfig,wo as getDOMRangeRect,Ft as getEnabledNodes,fe as getSelectedNode,pl as isHTMLElement,hl as isPoint,Dp as joinClasses,Ae as sanitizeClientEditorConfig,Go as sanitizeClientFeatures,bt as setFloatingElemPosition,mt as setFloatingElemPositionForLinkEditor,G as slashMenuBasicGroupWithItems,J as toolbarAddDropdownGroupWithItems,Qt as toolbarFeatureButtonsGroupWithItems,U as toolbarFormatGroupWithItems,W as toolbarTextDropdownGroupWithItems,$ as useEditorConfigContext};
38
38
  //# sourceMappingURL=index.js.map