@payloadcms/richtext-lexical 3.57.0-internal.98b3a35 → 3.57.0-internal.d2ddce7

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 (92) hide show
  1. package/dist/exports/client/{Field-D5RCNN4A.js → Field-PKJPWZJL.js} +2 -2
  2. package/dist/exports/client/Field-PKJPWZJL.js.map +7 -0
  3. package/dist/exports/client/bundled.css +1 -1
  4. package/dist/exports/client/index.js +10 -10
  5. package/dist/exports/client/index.js.map +4 -4
  6. package/dist/features/align/server/i18n.d.ts.map +1 -1
  7. package/dist/features/align/server/i18n.js +0 -6
  8. package/dist/features/align/server/i18n.js.map +1 -1
  9. package/dist/features/blockquote/server/i18n.d.ts.map +1 -1
  10. package/dist/features/blockquote/server/i18n.js +0 -3
  11. package/dist/features/blockquote/server/i18n.js.map +1 -1
  12. package/dist/features/blocks/server/i18n.d.ts.map +1 -1
  13. package/dist/features/blocks/server/i18n.js +0 -9
  14. package/dist/features/blocks/server/i18n.js.map +1 -1
  15. package/dist/features/heading/server/i18n.d.ts.map +1 -1
  16. package/dist/features/heading/server/i18n.js +0 -3
  17. package/dist/features/heading/server/i18n.js.map +1 -1
  18. package/dist/features/horizontalRule/server/i18n.d.ts.map +1 -1
  19. package/dist/features/horizontalRule/server/i18n.js +0 -3
  20. package/dist/features/horizontalRule/server/i18n.js.map +1 -1
  21. package/dist/features/indent/server/i18n.d.ts.map +1 -1
  22. package/dist/features/indent/server/i18n.js +0 -4
  23. package/dist/features/indent/server/i18n.js.map +1 -1
  24. package/dist/features/link/server/i18n.d.ts.map +1 -1
  25. package/dist/features/link/server/i18n.js +0 -4
  26. package/dist/features/link/server/i18n.js.map +1 -1
  27. package/dist/features/lists/checklist/server/i18n.d.ts.map +1 -1
  28. package/dist/features/lists/checklist/server/i18n.js +0 -3
  29. package/dist/features/lists/checklist/server/i18n.js.map +1 -1
  30. package/dist/features/lists/orderedList/server/i18n.d.ts.map +1 -1
  31. package/dist/features/lists/orderedList/server/i18n.js +0 -3
  32. package/dist/features/lists/orderedList/server/i18n.js.map +1 -1
  33. package/dist/features/lists/unorderedList/server/i18n.d.ts.map +1 -1
  34. package/dist/features/lists/unorderedList/server/i18n.js +0 -3
  35. package/dist/features/lists/unorderedList/server/i18n.js.map +1 -1
  36. package/dist/features/paragraph/server/i18n.d.ts.map +1 -1
  37. package/dist/features/paragraph/server/i18n.js +0 -4
  38. package/dist/features/paragraph/server/i18n.js.map +1 -1
  39. package/dist/features/relationship/server/i18n.d.ts.map +1 -1
  40. package/dist/features/relationship/server/i18n.js +0 -3
  41. package/dist/features/relationship/server/i18n.js.map +1 -1
  42. package/dist/features/textState/i18n.d.ts.map +1 -1
  43. package/dist/features/textState/i18n.js +0 -3
  44. package/dist/features/textState/i18n.js.map +1 -1
  45. package/dist/features/upload/client/index.d.ts.map +1 -1
  46. package/dist/features/upload/client/index.js +1 -2
  47. package/dist/features/upload/client/index.js.map +1 -1
  48. package/dist/features/upload/client/nodes/UploadNode.d.ts +7 -2
  49. package/dist/features/upload/client/nodes/UploadNode.d.ts.map +1 -1
  50. package/dist/features/upload/client/nodes/UploadNode.js +27 -3
  51. package/dist/features/upload/client/nodes/UploadNode.js.map +1 -1
  52. package/dist/features/upload/client/plugin/index.d.ts +0 -6
  53. package/dist/features/upload/client/plugin/index.d.ts.map +1 -1
  54. package/dist/features/upload/client/plugin/index.js +22 -293
  55. package/dist/features/upload/client/plugin/index.js.map +1 -1
  56. package/dist/features/upload/server/i18n.d.ts.map +1 -1
  57. package/dist/features/upload/server/i18n.js +0 -3
  58. package/dist/features/upload/server/i18n.js.map +1 -1
  59. package/dist/features/upload/server/index.d.ts.map +1 -1
  60. package/dist/features/upload/server/index.js +1 -4
  61. package/dist/features/upload/server/index.js.map +1 -1
  62. package/dist/features/upload/server/nodes/UploadNode.d.ts +1 -0
  63. package/dist/features/upload/server/nodes/UploadNode.d.ts.map +1 -1
  64. package/dist/features/upload/server/nodes/UploadNode.js +37 -3
  65. package/dist/features/upload/server/nodes/UploadNode.js.map +1 -1
  66. package/dist/field/Field.d.ts.map +1 -1
  67. package/dist/field/Field.js +1 -1
  68. package/dist/field/Field.js.map +1 -1
  69. package/dist/field/bundled.css +1 -1
  70. package/dist/i18n.d.ts.map +1 -1
  71. package/dist/i18n.js +0 -6
  72. package/dist/i18n.js.map +1 -1
  73. package/package.json +6 -6
  74. package/dist/exports/client/Field-D5RCNN4A.js.map +0 -7
  75. package/dist/exports/client/pendingComponent-WFSCE6LJ.js +0 -2
  76. package/dist/exports/client/pendingComponent-WFSCE6LJ.js.map +0 -7
  77. package/dist/features/upload/client/nodes/PendingUploadNode.d.ts +0 -17
  78. package/dist/features/upload/client/nodes/PendingUploadNode.d.ts.map +0 -1
  79. package/dist/features/upload/client/nodes/PendingUploadNode.js +0 -57
  80. package/dist/features/upload/client/nodes/PendingUploadNode.js.map +0 -1
  81. package/dist/features/upload/client/pendingComponent/index.d.ts +0 -7
  82. package/dist/features/upload/client/pendingComponent/index.d.ts.map +0 -1
  83. package/dist/features/upload/client/pendingComponent/index.js +0 -14
  84. package/dist/features/upload/client/pendingComponent/index.js.map +0 -1
  85. package/dist/features/upload/server/nodes/PendingUploadNode.d.ts +0 -42
  86. package/dist/features/upload/server/nodes/PendingUploadNode.d.ts.map +0 -1
  87. package/dist/features/upload/server/nodes/PendingUploadNode.js +0 -93
  88. package/dist/features/upload/server/nodes/PendingUploadNode.js.map +0 -1
  89. package/dist/features/upload/server/nodes/conversions.d.ts +0 -9
  90. package/dist/features/upload/server/nodes/conversions.d.ts.map +0 -1
  91. package/dist/features/upload/server/nodes/conversions.js +0 -53
  92. package/dist/features/upload/server/nodes/conversions.js.map +0 -1
@@ -1,6 +1,6 @@
1
- "use client";import{a as pe,c as So,d as No,e as Lo}from"./chunk-3BY5IZJD.js";import{a as lt}from"./chunk-DBWINSQN.js";import{a as nt,b as $t,c as Ge}from"./chunk-CYLMY5ZJ.js";import{a as me}from"./chunk-INBEEENE.js";import{a as Fa}from"./chunk-F26IQ5RE.js";import{a as re,b as Ft,d as Vr,e as Kr,f as Pa,g as Ba,i as Ha,k as ja,l as Ua}from"./chunk-YCH4JNUH.js";import{a as $a,b as H}from"./chunk-BZZVLW4U.js";function Z(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{$isElementNode as Ne,$isRangeSelection as Bt,FORMAT_ELEMENT_COMMAND as Ht}from"lexical";import{jsx as yo,jsxs as Ga}from"react/jsx-runtime";import"react";var Jr=()=>Ga("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:[yo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),yo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),yo("path",{d:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Io,jsxs as Wa}from"react/jsx-runtime";import"react";var Xr=()=>Wa("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:[Io("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Io("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Io("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Ro,jsxs as Va}from"react/jsx-runtime";import"react";var Pt=()=>Va("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Ro("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ro("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ro("path",{d:"M2.5 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as vo,jsxs as Ka}from"react/jsx-runtime";import"react";var zr=()=>Ka("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[vo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),vo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),vo("path",{d:"M7.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});var v=t=>o=>{let r={clientFeatureProps:o};if(typeof t=="function")r.feature=({config:n,featureClientImportMap:l,featureClientSchemaMap:i,featureProviderMap:s,field:u,resolvedFeatures:c,schemaPath:d,unSanitizedEditorConfig:a})=>{let p=t({config:n,featureClientImportMap:l,featureClientSchemaMap:i,featureProviderMap:s,field:u,props:o,resolvedFeatures:c,schemaPath:d,unSanitizedEditorConfig:a});return p.sanitizedClientFeatureProps===null&&(p.sanitizedClientFeatureProps=o),p};else{let n={...t};n.sanitizedClientFeatureProps=o,r.feature=n}return r};var Zr=t=>({type:"dropdown",ChildComponent:Pt,items:t,key:"align",order:30});var Yr=[Zr([{ChildComponent:Pt,isActive:({selection:t})=>{if(!Bt(t))return!1;for(let e of t.getNodes()){if(Ne(e)&&e.getFormatType()==="left")continue;let o=e.getParent();if(!(Ne(o)&&o.getFormatType()==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Ht,"left")},order:1},{ChildComponent:Jr,isActive:({selection:t})=>{if(!Bt(t))return!1;for(let e of t.getNodes()){if(Ne(e)&&e.getFormatType()==="center")continue;let o=e.getParent();if(!(Ne(o)&&o.getFormatType()==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Ht,"center")},order:2},{ChildComponent:zr,isActive:({selection:t})=>{if(!Bt(t))return!1;for(let e of t.getNodes()){if(Ne(e)&&e.getFormatType()==="right")continue;let o=e.getParent();if(!(Ne(o)&&o.getFormatType()==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Ht,"right")},order:3},{ChildComponent:Xr,isActive:({selection:t})=>{if(!Bt(t))return!1;for(let e of t.getNodes()){if(Ne(e)&&e.getFormatType()==="justify")continue;let o=e.getParent();if(!(Ne(o)&&o.getFormatType()==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Ht,"justify")},order:4}])],Ja=v({toolbarFixed:{groups:Yr},toolbarInline:{groups:Yr}});import{$createQuoteNode as nn,$isQuoteNode as on,QuoteNode as Za}from"@lexical/rich-text";import{$setBlocksType as ln}from"@lexical/selection";import{$getSelection as sn,$isRangeSelection as Ya}from"lexical";import{jsx as qr}from"react/jsx-runtime";import"react";var Do=()=>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:"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 Qr}from"react/jsx-runtime";import"react";var it=()=>Qr("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:Qr("path",{d:"M11.708 14.5H7.79785V13.9414H8.01367C9.00391 13.9414 9.15625 13.9033 9.15625 13.6113V6.70508H8.07715C6.82031 6.70508 6.73145 7.08594 6.28711 8.67285H5.80469L5.91895 6.12109H13.5869L13.7012 8.67285H13.2188C12.7744 7.08594 12.6855 6.70508 11.4287 6.70508H10.3496V13.6113C10.3496 13.9033 10.502 13.9414 11.4922 13.9414H11.708V14.5Z",fill:"currentColor"})});var Q=t=>({type:"dropdown",ChildComponent:it,items:t,key:"text",order:25});import{$createQuoteNode as Xa,$isQuoteNode as en,QuoteNode as za}from"@lexical/rich-text";var tn={type:"element",dependencies:[za],export:(t,e)=>{if(!en(t))return null;let o=e(t).split(`
1
+ "use client";import{a as me,c as _o,d as To,e as wo}from"./chunk-3BY5IZJD.js";import{a as nt}from"./chunk-DBWINSQN.js";import{a as rt,b as At,c as Ue}from"./chunk-CYLMY5ZJ.js";import{a as de}from"./chunk-INBEEENE.js";import{a as _a}from"./chunk-F26IQ5RE.js";import{a as re,b as Ot,d as Pr,e as Br,f as Ta,g as wa,i as Ea,k as Sa,l as Na}from"./chunk-YCH4JNUH.js";import{a as ka,b as H}from"./chunk-BZZVLW4U.js";function Z(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{$isElementNode as Se,$isRangeSelection as $t,FORMAT_ELEMENT_COMMAND as Pt}from"lexical";import{jsx as Eo,jsxs as La}from"react/jsx-runtime";import"react";var Hr=()=>La("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:[Eo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Eo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Eo("path",{d:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as So,jsxs as ya}from"react/jsx-runtime";import"react";var jr=()=>ya("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:[So("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),So("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),So("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as No,jsxs as Ia}from"react/jsx-runtime";import"react";var Ft=()=>Ia("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:[No("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),No("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),No("path",{d:"M2.5 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Lo,jsxs as Ra}from"react/jsx-runtime";import"react";var Ur=()=>Ra("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:[Lo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Lo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Lo("path",{d:"M7.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});var y=t=>o=>{let r={clientFeatureProps:o};if(typeof t=="function")r.feature=({config:n,featureClientImportMap:l,featureClientSchemaMap:i,featureProviderMap:s,field:u,resolvedFeatures:c,schemaPath:d,unSanitizedEditorConfig:a})=>{let p=t({config:n,featureClientImportMap:l,featureClientSchemaMap:i,featureProviderMap:s,field:u,props:o,resolvedFeatures:c,schemaPath:d,unSanitizedEditorConfig:a});return p.sanitizedClientFeatureProps===null&&(p.sanitizedClientFeatureProps=o),p};else{let n={...t};n.sanitizedClientFeatureProps=o,r.feature=n}return r};var Gr=t=>({type:"dropdown",ChildComponent:Ft,items:t,key:"align",order:30});var Wr=[Gr([{ChildComponent:Ft,isActive:({selection:t})=>{if(!$t(t))return!1;for(let e of t.getNodes()){if(Se(e)&&e.getFormatType()==="left")continue;let o=e.getParent();if(!(Se(o)&&o.getFormatType()==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Pt,"left")},order:1},{ChildComponent:Hr,isActive:({selection:t})=>{if(!$t(t))return!1;for(let e of t.getNodes()){if(Se(e)&&e.getFormatType()==="center")continue;let o=e.getParent();if(!(Se(o)&&o.getFormatType()==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Pt,"center")},order:2},{ChildComponent:Ur,isActive:({selection:t})=>{if(!$t(t))return!1;for(let e of t.getNodes()){if(Se(e)&&e.getFormatType()==="right")continue;let o=e.getParent();if(!(Se(o)&&o.getFormatType()==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Pt,"right")},order:3},{ChildComponent:jr,isActive:({selection:t})=>{if(!$t(t))return!1;for(let e of t.getNodes()){if(Se(e)&&e.getFormatType()==="justify")continue;let o=e.getParent();if(!(Se(o)&&o.getFormatType()==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Pt,"justify")},order:4}])],va=y({toolbarFixed:{groups:Wr},toolbarInline:{groups:Wr}});import{$createQuoteNode as Yr,$isQuoteNode as zr,QuoteNode as Aa}from"@lexical/rich-text";import{$setBlocksType as qr}from"@lexical/selection";import{$getSelection as Qr,$isRangeSelection as Oa}from"lexical";import{jsx as Vr}from"react/jsx-runtime";import"react";var yo=()=>Vr("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:Vr("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 Kr}from"react/jsx-runtime";import"react";var lt=()=>Kr("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:Kr("path",{d:"M11.708 14.5H7.79785V13.9414H8.01367C9.00391 13.9414 9.15625 13.9033 9.15625 13.6113V6.70508H8.07715C6.82031 6.70508 6.73145 7.08594 6.28711 8.67285H5.80469L5.91895 6.12109H13.5869L13.7012 8.67285H13.2188C12.7744 7.08594 12.6855 6.70508 11.4287 6.70508H10.3496V13.6113C10.3496 13.9033 10.502 13.9414 11.4922 13.9414H11.708V14.5Z",fill:"currentColor"})});var Q=t=>({type:"dropdown",ChildComponent:lt,items:t,key:"text",order:25});import{$createQuoteNode as Ma,$isQuoteNode as Jr,QuoteNode as Da}from"@lexical/rich-text";var Xr={type:"element",dependencies:[Da],export:(t,e)=>{if(!Jr(t))return null;let o=e(t).split(`
2
2
  `),r=[];for(let n of o)r.push("> "+n);return r.join(`
3
- `)},regExp:/^>\s/,replace:(t,e,o,r)=>{if(r){let l=t.getPreviousSibling();if(en(l)){l.splice(l.getChildrenSize(),0,[...e]),l.select(0,0),t.remove();return}}let n=Xa();n.append(...e),t.replace(n),n.select(0,0)}};var rn=[Q([{ChildComponent:Do,isActive:({selection:t})=>{if(!Ya(t))return!1;for(let e of t.getNodes())if(!on(e)&&!on(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=sn();ln(e,()=>nn())})},order:20}])],qa=v({markdownTransformers:[tn],nodes:[Za],slashMenu:{groups:[Z([{Icon:Do,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=sn();ln(e,()=>nn())})}}])]},toolbarFixed:{groups:rn},toolbarInline:{groups:rn}});import{getTranslation as Xt}from"@payloadcms/translations";import{jsx as Mo,jsxs as Qa}from"react/jsx-runtime";import"react";var jt=()=>Qa("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Mo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),Mo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),Mo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as an}from"react/jsx-runtime";import"react";var Ut=()=>an("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:an("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 ec}from"react/jsx-runtime";import"react";function Gt(t,e){return t?()=>ec("img",{alt:e??"Block Image",className:"lexical-block-custom-image",src:t,style:{maxHeight:20,maxWidth:20}}):jt}import{jsx as Rc}from"react/jsx-runtime";import vc from"bson-objectid";import"react";import{DecoratorBlockNode as tc}from"@lexical/react/LexicalDecoratorBlockNode.js";import oc from"bson-objectid";var st=class extends tc{__cacheBuster;__fields;constructor({cacheBuster:e,fields:o,format:r,key:n}){super(r,n),this.__fields=o,this.__cacheBuster=e||0}static clone(e){return new this({cacheBuster:e.__cacheBuster,fields:e.__fields,format:e.__format,key:e.__key})}static getType(){return"block"}static importDOM(){return{}}static importJSON(e){e.version===1&&(e={...e,fields:{...e.fields.data},version:2});let o=rc(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}}getCacheBuster(){return this.getLatest().__cacheBuster}getFields(){return this.getLatest().__fields}getTextContent(){return"Block Field"}setFields(e,o){let r=this.getWritable();r.__fields=e,o||r.__cacheBuster++}};function rc(t){return new st({fields:{...t,id:t?.id||new oc.default().toHexString()}})}import{jsx as K,jsxs as at,Fragment as uc}from"react/jsx-runtime";import{Button as mn,Collapsible as dc,Drawer as mc,EditDepthProvider as pc,ErrorPill as fc,Form as hc,formatDrawerSlug as gc,FormSubmit as xc,Pill as Cc,RenderFields as bc,SectionTitle as kc,useConfig as _c,useDocumentForm as Tc,useDocumentInfo as pn,useEditDepth as wc,useFormSubmitted as Ec,useServerFunctions as Sc,useTranslation as Nc}from"@payloadcms/ui";import{abortAndIgnore as Oo}from"@payloadcms/ui/shared";import{deepCopyObjectSimpleWithoutReactComponents as Vt,reduceFieldsToValues as fn}from"payload/shared";import ct,{useCallback as Ao,useEffect as $o,useMemo as ut,useRef as Fo}from"react";import{useLexicalComposerContext as Lc}from"@lexical/react/LexicalComposerContext";import{getTranslation as yc}from"@payloadcms/translations";import{$getNodeByKey as Kt}from"lexical";import{v4 as Ic}from"uuid";import{c as nc}from"react/compiler-runtime";import{jsx as Wt,jsxs as lc}from"react/jsx-runtime";import{RenderFields as ic,useFormSubmitted as sc}from"@payloadcms/ui";import ac,{createContext as cc}from"react";var cn=cc({initialState:!1}),De=()=>ac.use(cn),un=t=>{let e=nc(13),{BlockDrawer:o,Collapsible:r,CustomBlock:n,EditButton:l,errorCount:i,formSchema:s,initialState:u,nodeKey:c,RemoveButton:d}=t,p=sc()&&i>0,m;e[0]!==r||e[1]!==i||e[2]!==p?(m=x=>Wt(r,{editButton:x.editButton,errorCount:i,fieldHasErrors:p,Label:x.Label,removeButton:x.removeButton,children:x.children}),e[0]=r,e[1]=i,e[2]=p,e[3]=m):m=e[3];let f=m,h;return e[4]!==o||e[5]!==f||e[6]!==n||e[7]!==l||e[8]!==d||e[9]!==s||e[10]!==u||e[11]!==c?(h=n?lc(cn,{value:{BlockCollapsible:f,EditButton:l,initialState:u,nodeKey:c,RemoveButton:d},children:[n,Wt(o,{})]}):Wt(f,{children:Wt(ic,{fields:s,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0})}),e[4]=o,e[5]=f,e[6]=n,e[7]=l,e[8]=d,e[9]=s,e[10]=u,e[11]=c,e[12]=h):h=e[12],h};function dn({fields:t}){for(let e in t){let o=t[e];Array.isArray(o?.rows)&&"value"in o&&(o.disableFormData=!0)}return t}var ne="lexical-block",hn=t=>{let{cacheBuster:e,formData:o,nodeKey:r}=t,n=Ec(),{id:l,collectionSlug:i,globalSlug:s}=pn(),{fieldProps:{featureClientSchemaMap:u,field:c,initialLexicalFormState:d,permissions:a,readOnly:p,schemaPath:m},uuid:f}=H(),{fields:h}=Tc(),x=Fo(new AbortController),b=wc(),[T,E]=ct.useState(0),{config:C}=_c(),k=gc({slug:`lexical-blocks-create-${f}-${o.id}`,depth:b}),{toggleDrawer:g}=me(k),{getDocPreferences:w,setDocFieldPreferences:N}=pn(),[M]=Lc(),{getFormState:$}=Sc(),R=`${m}.lexical_internal_feature.blocks.lexical_blocks.${o.blockType}.fields`,[S,_]=ct.useState(()=>d?.[o.id]?.formState?{...d?.[o.id]?.formState,blockName:{initialValue:o.blockName,passesCondition:!0,valid:!0,value:o.blockName}}:!1),L=Fo(!1),D=Fo(e);$o(()=>{L.current?(D.current!==e&&_(!1),D.current=e):L.current=!0},[e]);let[I,O]=ct.useState(S?._components?.customComponents?.BlockLabel),[y,F]=ct.useState(S?._components?.customComponents?.Block);$o(()=>{let j=new AbortController;return o&&!S&&(async()=>{let{state:W}=await $({id:l,collectionSlug:i,data:o,docPermissions:{fields:!0},docPreferences:await w(),documentFormState:Vt(h),globalSlug:s,initialBlockData:o,operation:"update",renderAllFields:!0,schemaPath:R,signal:j.signal});if(W){W.blockName={initialValue:o.blockName,passesCondition:!0,valid:!0,value:o.blockName};let z=fn(Vt(W),!0);M.update(()=>{let V=Kt(r);if(V&&dt(V)){let oe=z;oe.blockType=o.blockType,V.setFields(oe,!0)}}),_(W),O(W._components?.customComponents?.BlockLabel),F(W._components?.customComponents?.Block)}})(),()=>{Oo(j)}},[$,R,l,o,M,r,S,i,s,w,h]);let[G,q]=ct.useState(d?.[o.id]?.collapsed??!1),te=`${m}.lexical_internal_feature.blocks.lexical_blocks.${o.blockType}`,X=u.blocks?.[te]?.[0],U=X.blockReferences?typeof X?.blockReferences?.[0]=="string"?C.blocksMap[X?.blockReferences?.[0]]:X?.blockReferences?.[0]:X?.blocks?.[0],{i18n:He,t:Ee}=Nc(),de=Ao(async({formState:j,submit:se})=>{Oo(x.current);let W=new AbortController;x.current=W;let{state:z}=await $({id:l,collectionSlug:i,docPermissions:{fields:!0},docPreferences:await w(),documentFormState:Vt(h),formState:j,globalSlug:s,initialBlockFormState:j,operation:"update",renderAllFields:!!se,schemaPath:R,signal:W.signal});if(!z)return j;j.blockName&&(z.blockName=j.blockName);let V=fn(dn({fields:Vt(z)}),!0);if(setTimeout(()=>{M.update(()=>{let oe=Kt(r);if(oe&&dt(oe)){let Ue=V;Ue.blockType=o.blockType,oe.setFields(Ue,!0)}})},0),se){O(z._components?.customComponents?.BlockLabel),F(z._components?.customComponents?.Block);let oe=0;for(let Ue of Object.values(z))Ue?.valid===!1&&oe++;E(oe)}return z},[$,l,i,w,s,R,o.blockType,h,M,r]);$o(()=>()=>{Oo(x.current)},[]);let Mt=Ao(()=>{M.update(()=>{Kt(r)?.remove()})},[M,r]),Se=U?.labels?.singular?yc(U.labels.singular,He):U?.slug,Ot=Ao(j=>{w().then(se=>{let z=se?.fields?.[c.name]?.collapsed,V=z&&z?.length?z:[];j?V.includes(o.id)||V.push(o.id):V.includes(o.id)&&V.splice(V.indexOf(o.id),1),N(c.name,{collapsed:V,hello:"hi"})})},[w,c.name,N,o.id]),je=ut(()=>()=>K(mn,{buttonStyle:"icon-label",className:`${ne}__editButton`,disabled:p,el:"button",icon:"edit",onClick:j=>(j.preventDefault(),j.stopPropagation(),g(),!1),onMouseDown:j=>{j.preventDefault()},round:!0,size:"small",tooltip:Ee("lexical:blocks:inlineBlocks:edit",{label:Se})}),[Se,p,Ee,g]),At=ut(()=>()=>K(mn,{buttonStyle:"icon-label",className:`${ne}__removeButton`,disabled:c?.admin?.readOnly||!1,icon:"x",onClick:j=>{j.preventDefault(),Mt()},round:!0,tooltip:"Remove Block"}),[c?.admin?.readOnly,Mt]),Eo=ut(()=>({children:j,disableBlockName:se,editButton:W,errorCount:z,fieldHasErrors:V,Label:oe,removeButton:Ue})=>K("div",{className:ne+" "+ne+"-"+o.blockType,children:K(dc,{className:[`${ne}__row`,V?`${ne}__row--has-errors`:`${ne}__row--no-errors`].join(" "),collapsibleStyle:V?"error":"default",header:at("div",{className:`${ne}__block-header`,children:[oe??I?oe??I:at("div",{children:[K(Cc,{className:`${ne}__block-pill ${ne}__block-pill-${o?.blockType}`,pillStyle:"white",size:"small",children:Se??o?.blockType}),!se&&!U?.admin?.disableBlockName&&K(kc,{path:"blockName",readOnly:c?.admin?.readOnly||!1}),V&&K(fc,{count:z??0,i18n:He,withMessage:!0})]}),at("div",{children:[y&&W!==!1||!y&&W?K(je,{}):null,Ue!==!1&&M.isEditable()?K(At,{}):null]})]}),isCollapsed:G,onToggle:Wr=>{Ot(Wr),q(Wr)},children:j},0)}),[y,I,je,At,Se,U?.admin?.disableBlockName,M,o.blockType,He,G,Ot,c?.admin?.readOnly]),Gr=ut(()=>()=>K(pc,{children:K(mc,{className:"",slug:k,title:Ee(`lexical:blocks:inlineBlocks:${o?.id?"edit":"create"}`,{label:Se??Ee("lexical:blocks:inlineBlocks:label")}),children:S?at(uc,{children:[K(bc,{fields:U?.fields??[],forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:R,permissions:!0,readOnly:!1}),K(xc,{programmaticSubmit:!0,children:Ee("fields:saveChanges")})]}):null})}),[S,k,Se,Ee,U?.fields,R,a]),Aa=ut(()=>S?K(hc,{beforeSubmit:[async({formState:j})=>await de({formState:j,submit:!0})],el:"div",fields:U?.fields??[],initialState:S,onChange:[de],onSubmit:(j,se)=>{se.blockType=o.blockType,M.update(()=>{let W=Kt(r);W&&dt(W)&&W.setFields(se,!0)}),g()},submitted:n,uuid:Ic(),children:K(un,{baseClass:ne,BlockDrawer:Gr,Collapsible:Eo,CustomBlock:y,EditButton:je,errorCount:T,formSchema:U?.fields??[],initialState:S,nodeKey:r,RemoveButton:At})}):null,[Eo,Gr,y,U?.fields,At,je,M,T,g,U?.fields,S,r,de,n]);return U?Aa:K(Eo,{disableBlockName:!0,fieldHasErrors:!0,children:at("div",{className:"lexical-block-not-found",children:["Error: Block '",o.blockType,"' not found in the config but exists in the lexical data"]})})};var fe=class extends st{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){e.version===1&&(e={...e,fields:{...e.fields.data},version:2});let o=Jt(e.fields);return o.setFormat(e.format),o}decorate(e,o){return Rc(hn,{cacheBuster:this.getCacheBuster(),formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Jt(t){return new fe({fields:{...t,id:t?.id||new vc.default().toHexString()}})}function dt(t){return t instanceof fe}import{createCommand as gn}from"lexical";var We=gn("INSERT_BLOCK_COMMAND"),Ve=gn("INSERT_INLINE_BLOCK_COMMAND");import{c as Dc}from"react/compiler-runtime";import{useLexicalComposerContext as Mc}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Oc,$wrapNodeInElement as Ac,mergeRegister as $c}from"@lexical/utils";import{formatDrawerSlug as Fc,useEditDepth as Pc}from"@payloadcms/ui";import{$createParagraphNode as Bc,$getNodeByKey as Hc,$getPreviousSelection as jc,$getSelection as Uc,$insertNodes as Gc,$isParagraphNode as Wc,$isRangeSelection as Vc,$isRootOrShadowRoot as Kc,COMMAND_PRIORITY_EDITOR as xn}from"lexical";import{useEffect as Jc,useState as Xc}from"react";var Cn=()=>{let t=Dc(12),[e]=Mc(),[o,r]=Xc(null),{setCreatedInlineBlock:n,uuid:l}=H(),i=Pc(),s="lexical-inlineBlocks-create-"+l,u;t[0]!==i||t[1]!==s?(u=Fc({slug:s,depth:i}),t[0]=i,t[1]=s,t[2]=u):u=t[2];let c=u,{toggleDrawer:d}=me(c,!0),a;t[3]!==e||t[4]!==n||t[5]!==o?(a=()=>{if(!e.hasNodes([fe]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return $c(e.registerCommand(We,m=>(e.update(()=>{let f=Uc()||jc();if(Vc(f)){let h=Jt(m),{focus:x}=f,b=x.getNode();Oc(h),Wc(b)&&!b.__first&&b.remove()}}),!0),xn),e.registerCommand(Ve,m=>{if(o){let h=Hc(o);return!h||!Lo(h)?!1:(h.setFields(m),r(null),!0)}let f=No(m);return n?.(f),Gc([f]),Kc(f.getParentOrThrow())&&Ac(f,Bc).selectEnd(),!0},xn))},t[3]=e,t[4]=n,t[5]=o,t[6]=a):a=t[6];let p;return t[7]!==e||t[8]!==n||t[9]!==o||t[10]!==d?(p=[e,n,o,d],t[7]=e,t[8]=n,t[9]=o,t[10]=d,t[11]=p):p=t[11],Jc(a,p),null};var zc=v(({config:t,featureClientSchemaMap:e,props:o,schemaPath:r})=>{let n=`${r}.lexical_internal_feature.blocks.lexical_blocks`,l=`${r}.lexical_internal_feature.blocks.lexical_inline_blocks`,i=e.blocks;if(!i)return{};let s=Object.entries(i).filter(([a])=>a.startsWith(n+".")&&!a.replace(n+".","").includes(".")).map(([,a])=>a[0]),u=Object.entries(i).filter(([a])=>a.startsWith(l+".")&&!a.replace(l+".","").includes(".")).map(([,a])=>a[0]),c=s.map(a=>a.blockReferences?typeof a.blockReferences[0]=="string"?t.blocksMap[a.blockReferences[0]]:a.blockReferences[0]:a.blocks[0]).filter(a=>a!==void 0),d=u.map(a=>a.blockReferences?typeof a.blockReferences[0]=="string"?t.blocksMap[a.blockReferences[0]]:a.blockReferences[0]:a.blocks[0]).filter(a=>a!==void 0);return{nodes:[fe,So],plugins:[{Component:Cn,position:"normal"}],sanitizedClientFeatureProps:o,slashMenu:{groups:[c?.length?{items:c.map(a=>({Icon:Gt(a.imageURL,a.imageAltText),key:"block-"+a.slug,keywords:["block","blocks",a.slug],label:({i18n:p})=>a?.labels?.singular?Xt(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(We,{blockName:"",blockType:a.slug})}})),key:"blocks",label:({i18n:a})=>a.t("lexical:blocks:label")}:null,d?.length?{items:d.map(a=>({Icon:Ut,key:"inlineBlocks-"+a.slug,keywords:["inlineBlock","inline block",a.slug],label:({i18n:p})=>a?.labels?.singular?Xt(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(Ve,{blockName:"",blockType:a.slug})}})),key:"inlineBlocks",label:({i18n:a})=>a.t("lexical:blocks:inlineBlocks:label")}:null].filter(Boolean)},toolbarFixed:{groups:[c.length?{type:"dropdown",ChildComponent:jt,items:c.map((a,p)=>({ChildComponent:Gt(a.imageURL,a.imageAltText),isActive:void 0,key:"block-"+a.slug,label:({i18n:m})=>a?.labels?.singular?Xt(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(We,{blockName:"",blockType:a.slug})},order:p})),key:"blocks",order:20}:null,d?.length?{type:"dropdown",ChildComponent:Ut,items:d.map((a,p)=>({ChildComponent:a.imageURL?Gt(a.imageURL,a.imageAltText):Ut,isActive:void 0,key:"inlineBlock-"+a.slug,label:({i18n:m})=>a?.labels?.singular?Xt(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(Ve,{blockName:"",blockType:a.slug})},order:p})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}});import{c as qc}from"react/compiler-runtime";import{jsx as Oe,jsxs as jo}from"react/jsx-runtime";import{useLexicalComposerContext as Qc}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as eu,$createTextNode as tu,$getRoot as ou,getDOMSelection as Po}from"lexical";import*as wn from"react";import{useCallback as Me,useEffect as Bo,useLayoutEffect as kn,useRef as Ho,useState as zt}from"react";var Zc=re&&"documentMode"in document?document.documentMode:null,bn=re&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),J2=re&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),X2=re&&"InputEvent"in window&&!Zc?"getTargetRanges"in new window.InputEvent("input"):!1,z2=re&&/Version\/[\d.].*Safari/.test(navigator.userAgent),Z2=re&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Y2=re&&/Android/.test(navigator.userAgent),q2=re&&/Win/.test(navigator.platform),Yc=re&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Q2=re&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!Yc;var ru=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)},nu=(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)},lu=t=>{let o=((r,n)=>{switch(r){case"click":return` await page.mouse.click(${n.x}, ${n.y});`;case"keydown":return` await page.keyboard.keydown('${n}');`;case"keyup":return` await page.keyboard.keyup('${n}');`;case"press":return` await page.keyboard.press('${n}');`;case"selectAll":return" await selectAll(page);";case"snapshot":return` await assertHTMLSnapshot(page);
3
+ `)},regExp:/^>\s/,replace:(t,e,o,r)=>{if(r){let l=t.getPreviousSibling();if(Jr(l)){l.splice(l.getChildrenSize(),0,[...e]),l.select(0,0),t.remove();return}}let n=Ma();n.append(...e),t.replace(n),n.select(0,0)}};var Zr=[Q([{ChildComponent:yo,isActive:({selection:t})=>{if(!Oa(t))return!1;for(let e of t.getNodes())if(!zr(e)&&!zr(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Qr();qr(e,()=>Yr())})},order:20}])],Fa=y({markdownTransformers:[Xr],nodes:[Aa],slashMenu:{groups:[Z([{Icon:yo,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Qr();qr(e,()=>Yr())})}}])]},toolbarFixed:{groups:Zr},toolbarInline:{groups:Zr}});import{getTranslation as Kt}from"@payloadcms/translations";import{jsx as Io,jsxs as $a}from"react/jsx-runtime";import"react";var Bt=()=>$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:[Io("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),Io("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),Io("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as en}from"react/jsx-runtime";import"react";var Ht=()=>en("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:en("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 Pa}from"react/jsx-runtime";import"react";function jt(t,e){return t?()=>Pa("img",{alt:e??"Block Image",className:"lexical-block-custom-image",src:t,style:{maxHeight:20,maxWidth:20}}):Bt}import{jsx as fc}from"react/jsx-runtime";import hc from"bson-objectid";import"react";import{DecoratorBlockNode as Ba}from"@lexical/react/LexicalDecoratorBlockNode.js";import Ha from"bson-objectid";var it=class extends Ba{__cacheBuster;__fields;constructor({cacheBuster:e,fields:o,format:r,key:n}){super(r,n),this.__fields=o,this.__cacheBuster=e||0}static clone(e){return new this({cacheBuster:e.__cacheBuster,fields:e.__fields,format:e.__format,key:e.__key})}static getType(){return"block"}static importDOM(){return{}}static importJSON(e){e.version===1&&(e={...e,fields:{...e.fields.data},version:2});let o=ja(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}}getCacheBuster(){return this.getLatest().__cacheBuster}getFields(){return this.getLatest().__fields}getTextContent(){return"Block Field"}setFields(e,o){let r=this.getWritable();r.__fields=e,o||r.__cacheBuster++}};function ja(t){return new it({fields:{...t,id:t?.id||new Ha.default().toHexString()}})}import{jsx as K,jsxs as st,Fragment as Xa}from"react/jsx-runtime";import{Button as nn,Collapsible as za,Drawer as Za,EditDepthProvider as Ya,ErrorPill as qa,Form as Qa,formatDrawerSlug as ec,FormSubmit as tc,Pill as oc,RenderFields as rc,SectionTitle as nc,useConfig as lc,useDocumentForm as ic,useDocumentInfo as ln,useEditDepth as sc,useFormSubmitted as ac,useServerFunctions as cc,useTranslation as uc}from"@payloadcms/ui";import{abortAndIgnore as Ro}from"@payloadcms/ui/shared";import{deepCopyObjectSimpleWithoutReactComponents as Gt,reduceFieldsToValues as sn}from"payload/shared";import at,{useCallback as vo,useEffect as Mo,useMemo as ct,useRef as Do}from"react";import{useLexicalComposerContext as dc}from"@lexical/react/LexicalComposerContext";import{getTranslation as mc}from"@payloadcms/translations";import{$getNodeByKey as Wt}from"lexical";import{v4 as pc}from"uuid";import{c as Ua}from"react/compiler-runtime";import{jsx as Ut,jsxs as Ga}from"react/jsx-runtime";import{RenderFields as Wa,useFormSubmitted as Va}from"@payloadcms/ui";import Ka,{createContext as Ja}from"react";var tn=Ja({initialState:!1}),Re=()=>Ka.use(tn),on=t=>{let e=Ua(13),{BlockDrawer:o,Collapsible:r,CustomBlock:n,EditButton:l,errorCount:i,formSchema:s,initialState:u,nodeKey:c,RemoveButton:d}=t,p=Va()&&i>0,m;e[0]!==r||e[1]!==i||e[2]!==p?(m=g=>Ut(r,{editButton:g.editButton,errorCount:i,fieldHasErrors:p,Label:g.Label,removeButton:g.removeButton,children:g.children}),e[0]=r,e[1]=i,e[2]=p,e[3]=m):m=e[3];let f=m,h;return e[4]!==o||e[5]!==f||e[6]!==n||e[7]!==l||e[8]!==d||e[9]!==s||e[10]!==u||e[11]!==c?(h=n?Ga(tn,{value:{BlockCollapsible:f,EditButton:l,initialState:u,nodeKey:c,RemoveButton:d},children:[n,Ut(o,{})]}):Ut(f,{children:Ut(Wa,{fields:s,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0})}),e[4]=o,e[5]=f,e[6]=n,e[7]=l,e[8]=d,e[9]=s,e[10]=u,e[11]=c,e[12]=h):h=e[12],h};function rn({fields:t}){for(let e in t){let o=t[e];Array.isArray(o?.rows)&&"value"in o&&(o.disableFormData=!0)}return t}var ne="lexical-block",an=t=>{let{cacheBuster:e,formData:o,nodeKey:r}=t,n=ac(),{id:l,collectionSlug:i,globalSlug:s}=ln(),{fieldProps:{featureClientSchemaMap:u,field:c,initialLexicalFormState:d,permissions:a,readOnly:p,schemaPath:m},uuid:f}=H(),{fields:h}=ic(),g=Do(new AbortController),k=sc(),[T,I]=at.useState(0),{config:b}=lc(),_=ec({slug:`lexical-blocks-create-${f}-${o.id}`,depth:k}),{toggleDrawer:x}=de(_),{getDocPreferences:w,setDocFieldPreferences:v}=ln(),[O]=dc(),{getFormState:F}=cc(),R=`${m}.lexical_internal_feature.blocks.lexical_blocks.${o.blockType}.fields`,[E,C]=at.useState(()=>d?.[o.id]?.formState?{...d?.[o.id]?.formState,blockName:{initialValue:o.blockName,passesCondition:!0,valid:!0,value:o.blockName}}:!1),S=Do(!1),M=Do(e);Mo(()=>{S.current?(M.current!==e&&C(!1),M.current=e):S.current=!0},[e]);let[L,D]=at.useState(E?._components?.customComponents?.BlockLabel),[N,$]=at.useState(E?._components?.customComponents?.Block);Mo(()=>{let j=new AbortController;return o&&!E&&(async()=>{let{state:W}=await F({id:l,collectionSlug:i,data:o,docPermissions:{fields:!0},docPreferences:await w(),documentFormState:Gt(h),globalSlug:s,initialBlockData:o,operation:"update",renderAllFields:!0,schemaPath:R,signal:j.signal});if(W){W.blockName={initialValue:o.blockName,passesCondition:!0,valid:!0,value:o.blockName};let z=sn(Gt(W),!0);O.update(()=>{let V=Wt(r);if(V&&ut(V)){let oe=z;oe.blockType=o.blockType,V.setFields(oe,!0)}}),C(W),D(W._components?.customComponents?.BlockLabel),$(W._components?.customComponents?.Block)}})(),()=>{Ro(j)}},[F,R,l,o,O,r,E,i,s,w,h]);let[G,q]=at.useState(d?.[o.id]?.collapsed??!1),te=`${m}.lexical_internal_feature.blocks.lexical_blocks.${o.blockType}`,X=u.blocks?.[te]?.[0],U=X.blockReferences?typeof X?.blockReferences?.[0]=="string"?b.blocksMap[X?.blockReferences?.[0]]:X?.blockReferences?.[0]:X?.blocks?.[0],{i18n:Be,t:we}=uc(),ue=vo(async({formState:j,submit:se})=>{Ro(g.current);let W=new AbortController;g.current=W;let{state:z}=await F({id:l,collectionSlug:i,docPermissions:{fields:!0},docPreferences:await w(),documentFormState:Gt(h),formState:j,globalSlug:s,initialBlockFormState:j,operation:"update",renderAllFields:!!se,schemaPath:R,signal:W.signal});if(!z)return j;j.blockName&&(z.blockName=j.blockName);let V=sn(rn({fields:Gt(z)}),!0);if(setTimeout(()=>{O.update(()=>{let oe=Wt(r);if(oe&&ut(oe)){let je=V;je.blockType=o.blockType,oe.setFields(je,!0)}})},0),se){D(z._components?.customComponents?.BlockLabel),$(z._components?.customComponents?.Block);let oe=0;for(let je of Object.values(z))je?.valid===!1&&oe++;I(oe)}return z},[F,l,i,w,s,R,o.blockType,h,O,r]);Mo(()=>()=>{Ro(g.current)},[]);let vt=vo(()=>{O.update(()=>{Wt(r)?.remove()})},[O,r]),Ee=U?.labels?.singular?mc(U.labels.singular,Be):U?.slug,Mt=vo(j=>{w().then(se=>{let z=se?.fields?.[c.name]?.collapsed,V=z&&z?.length?z:[];j?V.includes(o.id)||V.push(o.id):V.includes(o.id)&&V.splice(V.indexOf(o.id),1),v(c.name,{collapsed:V,hello:"hi"})})},[w,c.name,v,o.id]),He=ct(()=>()=>K(nn,{buttonStyle:"icon-label",className:`${ne}__editButton`,disabled:p,el:"button",icon:"edit",onClick:j=>(j.preventDefault(),j.stopPropagation(),x(),!1),onMouseDown:j=>{j.preventDefault()},round:!0,size:"small",tooltip:we("lexical:blocks:inlineBlocks:edit",{label:Ee})}),[Ee,p,we,x]),Dt=ct(()=>()=>K(nn,{buttonStyle:"icon-label",className:`${ne}__removeButton`,disabled:c?.admin?.readOnly||!1,icon:"x",onClick:j=>{j.preventDefault(),vt()},round:!0,tooltip:"Remove Block"}),[c?.admin?.readOnly,vt]),ko=ct(()=>({children:j,disableBlockName:se,editButton:W,errorCount:z,fieldHasErrors:V,Label:oe,removeButton:je})=>K("div",{className:ne+" "+ne+"-"+o.blockType,children:K(za,{className:[`${ne}__row`,V?`${ne}__row--has-errors`:`${ne}__row--no-errors`].join(" "),collapsibleStyle:V?"error":"default",header:st("div",{className:`${ne}__block-header`,children:[oe??L?oe??L:st("div",{children:[K(oc,{className:`${ne}__block-pill ${ne}__block-pill-${o?.blockType}`,pillStyle:"white",size:"small",children:Ee??o?.blockType}),!se&&!U?.admin?.disableBlockName&&K(nc,{path:"blockName",readOnly:c?.admin?.readOnly||!1}),V&&K(qa,{count:z??0,i18n:Be,withMessage:!0})]}),st("div",{children:[N&&W!==!1||!N&&W?K(He,{}):null,je!==!1&&O.isEditable()?K(Dt,{}):null]})]}),isCollapsed:G,onToggle:$r=>{Mt($r),q($r)},children:j},0)}),[N,L,He,Dt,Ee,U?.admin?.disableBlockName,O,o.blockType,Be,G,Mt,c?.admin?.readOnly]),Fr=ct(()=>()=>K(Ya,{children:K(Za,{className:"",slug:_,title:we(`lexical:blocks:inlineBlocks:${o?.id?"edit":"create"}`,{label:Ee??we("lexical:blocks:inlineBlocks:label")}),children:E?st(Xa,{children:[K(rc,{fields:U?.fields??[],forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:R,permissions:!0,readOnly:!1}),K(tc,{programmaticSubmit:!0,children:we("fields:saveChanges")})]}):null})}),[E,_,Ee,we,U?.fields,R,a]),ba=ct(()=>E?K(Qa,{beforeSubmit:[async({formState:j})=>await ue({formState:j,submit:!0})],el:"div",fields:U?.fields??[],initialState:E,onChange:[ue],onSubmit:(j,se)=>{se.blockType=o.blockType,O.update(()=>{let W=Wt(r);W&&ut(W)&&W.setFields(se,!0)}),x()},submitted:n,uuid:pc(),children:K(on,{baseClass:ne,BlockDrawer:Fr,Collapsible:ko,CustomBlock:N,EditButton:He,errorCount:T,formSchema:U?.fields??[],initialState:E,nodeKey:r,RemoveButton:Dt})}):null,[ko,Fr,N,U?.fields,Dt,He,O,T,x,U?.fields,E,r,ue,n]);return U?ba:K(ko,{disableBlockName:!0,fieldHasErrors:!0,children:st("div",{className:"lexical-block-not-found",children:["Error: Block '",o.blockType,"' not found in the config but exists in the lexical data"]})})};var pe=class extends it{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=Vt(e.fields);return o.setFormat(e.format),o}decorate(e,o){return fc(an,{cacheBuster:this.getCacheBuster(),formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Vt(t){return new pe({fields:{...t,id:t?.id||new hc.default().toHexString()}})}function ut(t){return t instanceof pe}import{createCommand as cn}from"lexical";var Ge=cn("INSERT_BLOCK_COMMAND"),We=cn("INSERT_INLINE_BLOCK_COMMAND");import{c as gc}from"react/compiler-runtime";import{useLexicalComposerContext as xc}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Cc,$wrapNodeInElement as bc,mergeRegister as kc}from"@lexical/utils";import{formatDrawerSlug as _c,useEditDepth as Tc}from"@payloadcms/ui";import{$createParagraphNode as wc,$getNodeByKey as Ec,$getPreviousSelection as Sc,$getSelection as Nc,$insertNodes as Lc,$isParagraphNode as yc,$isRangeSelection as Ic,$isRootOrShadowRoot as Rc,COMMAND_PRIORITY_EDITOR as un}from"lexical";import{useEffect as vc,useState as Mc}from"react";var dn=()=>{let t=gc(12),[e]=xc(),[o,r]=Mc(null),{setCreatedInlineBlock:n,uuid:l}=H(),i=Tc(),s="lexical-inlineBlocks-create-"+l,u;t[0]!==i||t[1]!==s?(u=_c({slug:s,depth:i}),t[0]=i,t[1]=s,t[2]=u):u=t[2];let c=u,{toggleDrawer:d}=de(c,!0),a;t[3]!==e||t[4]!==n||t[5]!==o?(a=()=>{if(!e.hasNodes([pe]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return kc(e.registerCommand(Ge,m=>(e.update(()=>{let f=Nc()||Sc();if(Ic(f)){let h=Vt(m),{focus:g}=f,k=g.getNode();Cc(h),yc(k)&&!k.__first&&k.remove()}}),!0),un),e.registerCommand(We,m=>{if(o){let h=Ec(o);return!h||!wo(h)?!1:(h.setFields(m),r(null),!0)}let f=To(m);return n?.(f),Lc([f]),Rc(f.getParentOrThrow())&&bc(f,wc).selectEnd(),!0},un))},t[3]=e,t[4]=n,t[5]=o,t[6]=a):a=t[6];let p;return t[7]!==e||t[8]!==n||t[9]!==o||t[10]!==d?(p=[e,n,o,d],t[7]=e,t[8]=n,t[9]=o,t[10]=d,t[11]=p):p=t[11],vc(a,p),null};var Dc=y(({config:t,featureClientSchemaMap:e,props:o,schemaPath:r})=>{let n=`${r}.lexical_internal_feature.blocks.lexical_blocks`,l=`${r}.lexical_internal_feature.blocks.lexical_inline_blocks`,i=e.blocks;if(!i)return{};let s=Object.entries(i).filter(([a])=>a.startsWith(n+".")&&!a.replace(n+".","").includes(".")).map(([,a])=>a[0]),u=Object.entries(i).filter(([a])=>a.startsWith(l+".")&&!a.replace(l+".","").includes(".")).map(([,a])=>a[0]),c=s.map(a=>a.blockReferences?typeof a.blockReferences[0]=="string"?t.blocksMap[a.blockReferences[0]]:a.blockReferences[0]:a.blocks[0]).filter(a=>a!==void 0),d=u.map(a=>a.blockReferences?typeof a.blockReferences[0]=="string"?t.blocksMap[a.blockReferences[0]]:a.blockReferences[0]:a.blocks[0]).filter(a=>a!==void 0);return{nodes:[pe,_o],plugins:[{Component:dn,position:"normal"}],sanitizedClientFeatureProps:o,slashMenu:{groups:[c?.length?{items:c.map(a=>({Icon:jt(a.imageURL,a.imageAltText),key:"block-"+a.slug,keywords:["block","blocks",a.slug],label:({i18n:p})=>a?.labels?.singular?Kt(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(Ge,{blockName:"",blockType:a.slug})}})),key:"blocks",label:({i18n:a})=>a.t("lexical:blocks:label")}:null,d?.length?{items:d.map(a=>({Icon:Ht,key:"inlineBlocks-"+a.slug,keywords:["inlineBlock","inline block",a.slug],label:({i18n:p})=>a?.labels?.singular?Kt(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(We,{blockName:"",blockType:a.slug})}})),key:"inlineBlocks",label:({i18n:a})=>a.t("lexical:blocks:inlineBlocks:label")}:null].filter(Boolean)},toolbarFixed:{groups:[c.length?{type:"dropdown",ChildComponent:Bt,items:c.map((a,p)=>({ChildComponent:jt(a.imageURL,a.imageAltText),isActive:void 0,key:"block-"+a.slug,label:({i18n:m})=>a?.labels?.singular?Kt(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(Ge,{blockName:"",blockType:a.slug})},order:p})),key:"blocks",order:20}:null,d?.length?{type:"dropdown",ChildComponent:Ht,items:d.map((a,p)=>({ChildComponent:a.imageURL?jt(a.imageURL,a.imageAltText):Ht,isActive:void 0,key:"inlineBlock-"+a.slug,label:({i18n:m})=>a?.labels?.singular?Kt(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(We,{blockName:"",blockType:a.slug})},order:p})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}});import{c as Fc}from"react/compiler-runtime";import{jsx as Me,jsxs as $o}from"react/jsx-runtime";import{useLexicalComposerContext as $c}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as Pc,$createTextNode as Bc,$getRoot as Hc,getDOMSelection as Ao}from"lexical";import*as gn from"react";import{useCallback as ve,useEffect as Oo,useLayoutEffect as pn,useRef as Fo,useState as Jt}from"react";var Ac=re&&"documentMode"in document?document.documentMode:null,mn=re&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),xC=re&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),CC=re&&"InputEvent"in window&&!Ac?"getTargetRanges"in new window.InputEvent("input"):!1,bC=re&&/Version\/[\d.].*Safari/.test(navigator.userAgent),kC=re&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,_C=re&&/Android/.test(navigator.userAgent),TC=re&&/Win/.test(navigator.platform),Oc=re&&/^(?=.*Chrome).*/i.test(navigator.userAgent),wC=re&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!Oc;var jc=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)},Uc=(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)},Gc=t=>{let o=((r,n)=>{switch(r){case"click":return` await page.mouse.click(${n.x}, ${n.y});`;case"keydown":return` await page.keyboard.keydown('${n}');`;case"keyup":return` await page.keyboard.keyup('${n}');`;case"press":return` await page.keyboard.press('${n}');`;case"selectAll":return" await selectAll(page);";case"snapshot":return` await assertHTMLSnapshot(page);
4
4
  await assertSelection(page, {
5
5
  anchorPath: [${n.anchorPath.toString()}],
6
6
  anchorOffset: ${n.anchorOffset},
@@ -10,7 +10,7 @@
10
10
  `;case"type":return` await page.keyboard.type('${n}');`;default:return""}})(t.name,t.value);switch(t.count){case 1:return o;case 2:return[o,o].join(`
11
11
  `);default:return` await repeat(${t.count}, async () => {
12
12
  ${o}
13
- );`}};function iu(t){return t.key.toLowerCase()==="a"&&(bn?t.metaKey:t.ctrlKey)}function su(t){let{anchorNode:e,focusNode:o}=t,{anchorOffset:r,focusOffset:n}=t;return r!==0&&r--,n!==0&&n--,{anchorNode:e,anchorOffset:r,focusNode:o,focusOffset:n}}function _n(t,e){let o=t,r=[];for(;o!==e;)o!=null&&r.unshift(Array.from(o?.parentNode?.childNodes??[]).indexOf(o)),o=o?.parentNode;return r}var Tn=new Set(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Backspace","Delete","Enter","Escape"]);function au(t){let[e,o]=zt([]),[r,n]=zt(!1),[,l]=zt(""),[i,s]=zt(""),u=Ho(null),c=Ho(!1),d=Ho(null),a=Me(()=>t,[t]),p=Me(()=>{let C=t.getRootElement(),k=Po(t._window);return C==null||k==null||k.anchorNode==null||k.focusNode==null||!C.contains(k.anchorNode)||!C.contains(k.focusNode)?null:`
13
+ );`}};function Wc(t){return t.key.toLowerCase()==="a"&&(mn?t.metaKey:t.ctrlKey)}function Vc(t){let{anchorNode:e,focusNode:o}=t,{anchorOffset:r,focusOffset:n}=t;return r!==0&&r--,n!==0&&n--,{anchorNode:e,anchorOffset:r,focusNode:o,focusOffset:n}}function fn(t,e){let o=t,r=[];for(;o!==e;)o!=null&&r.unshift(Array.from(o?.parentNode?.childNodes??[]).indexOf(o)),o=o?.parentNode;return r}var hn=new Set(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Backspace","Delete","Enter","Escape"]);function Kc(t){let[e,o]=Jt([]),[r,n]=Jt(!1),[,l]=Jt(""),[i,s]=Jt(""),u=Fo(null),c=Fo(!1),d=Fo(null),a=ve(()=>t,[t]),p=ve(()=>{let b=t.getRootElement(),_=Ao(t._window);return b==null||_==null||_.anchorNode==null||_.focusNode==null||!b.contains(_.anchorNode)||!b.contains(_.focusNode)?null:`
14
14
  import {
15
15
  initializeE2E,
16
16
  assertHTMLSnapshot,
@@ -27,15 +27,15 @@ describe('Test case', () => {
27
27
  const {page} = e2e;
28
28
 
29
29
  await page.focus('div[contenteditable="true"]');
30
- ${e.map(lu).join(`
30
+ ${e.map(Gc).join(`
31
31
  `)}
32
32
  });
33
33
  });
34
- `},[t,e]),m=Me((C,k)=>{o(g=>{let w=e.length-1,N=e[w];if(N&&N.name===C){if(C==="type")return[...e.slice(0,w),{...N,value:N.value+k}];if(N.value===k)return[...e.slice(0,w),{...N,count:N.count+1}]}return[...g,{name:C,count:1,value:k}]})},[e,o]);kn(()=>{let C=g=>{if(!r)return;let w=g.key;iu(g)?m("selectAll",""):Tn.has(w)?m("press",g.key):[...w].length>1?m("keydown",g.key):m("type",g.key)},k=g=>{if(!r)return;let w=g.key;!Tn.has(w)&&[...w].length>1&&m("keyup",g.key)};return t.registerRootListener((g,w)=>{w!==null&&(w.removeEventListener("keydown",C),w.removeEventListener("keyup",k)),g!==null&&(g.addEventListener("keydown",C),g.addEventListener("keyup",k))})},[t,r,m]),kn(()=>{d.current&&d.current.scrollTo(0,d.current.scrollHeight)},[p]),Bo(()=>{if(e){let C=p();C!==null&&s(C),d.current&&d.current.scrollTo(0,d.current.scrollHeight)}},[p,e]),Bo(()=>t.registerUpdateListener(({dirtyElements:k,dirtyLeaves:g,editorState:w})=>{if(!r)return;let N=w._selection,M=u.current,$=c.current;if(M!==N){if(g.size===0&&k.size===0&&!$){let S=Po(t._window);if(S&&(S.anchorNode==null||S.focusNode==null))return}u.current=N}c.current=!1;let R=p();R!==null&&s(R)}),[t,p,r,m]),Bo(()=>r?t.registerUpdateListener(()=>{let k=t.getRootElement();k!==null&&l(k?.innerHTML)}):void 0,[t,r]);let f=Me(C=>{r||(C.update(()=>{let k=ou();k.clear();let g=tu();k.append(eu().append(g)),g.select()}),o([])),n(k=>!k)},[r]),h=Me(()=>{if(!r)return;let C=Po(t._window);if(C===null||C.anchorNode==null||C.focusNode==null)return;let{anchorNode:k,anchorOffset:g,focusNode:w,focusOffset:N}=su(C),M=a().getRootElement(),$;k!==null&&($=_n(k,M));let R;w!==null&&(R=_n(w,M)),m("snapshot",{anchorNode:k,anchorOffset:g,anchorPath:$,focusNode:w,focusOffset:N,focusPath:R})},[m,r,a]),x=Me(()=>{ru(p())},[p]),b=Me(()=>{nu("test.js",p())},[p]);return[Oe("button",{className:`editor-dev-button ${r?"active":""}`,id:"test-recorder-button",onClick:C=>{f(a()),C.preventDefault()},title:r?"Disable test recorder":"Enable test recorder",type:"button",children:r?"Disable test recorder":"Enable test recorder"}),r?jo("div",{className:"test-recorder-output",children:[jo("div",{className:"test-recorder-toolbar",children:[Oe("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:C=>{h(),C.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),Oe("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:C=>{x(),C.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),Oe("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:C=>{b(),C.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),Oe("pre",{id:"test-recorder",ref:d,children:i})]}):null]}var En=()=>{let t=qc(3),[e]=Qc(),[o,r]=au(e),n;return t[0]!==o||t[1]!==r?(n=jo(wn.Fragment,{children:[Oe("p",{children:"HI"}),o,r,Oe("p",{children:"DONE"})]}),t[0]=o,t[1]=r,t[2]=n):n=t[2],n};var cu=v({plugins:[{Component:En,position:"bottom"}]});import{c as uu}from"react/compiler-runtime";import{jsx as du}from"react/jsx-runtime";import{useLexicalComposerContext as mu}from"@lexical/react/LexicalComposerContext.js";import{TreeView as pu}from"@lexical/react/LexicalTreeView.js";import"react";var Sn=()=>{let t=uu(2),[e]=mu(),o;return t[0]!==e?(o=du(pu,{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 fu=v({plugins:[{Component:Sn,position:"bottom"}]});import{$isTableSelection as hu}from"@lexical/table";import{$isRangeSelection as gu,FORMAT_TEXT_COMMAND as xu}from"lexical";import{jsx as Nn}from"react/jsx-runtime";import"react";var Ln=()=>Nn("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:Nn("path",{d:"M10.6772 15H6.27017V5.718H10.4172C12.6792 5.718 13.8492 6.602 13.8492 8.292C13.8492 9.098 13.1992 9.982 12.4712 10.216C13.3812 10.476 14.1742 11.256 14.1742 12.322C14.1742 14.09 12.9002 15 10.6772 15ZM8.46717 9.501H10.3262C11.3012 9.501 11.7042 9.046 11.7042 8.409C11.7042 7.72 11.2362 7.317 10.3392 7.317H8.46717V9.501ZM8.46717 11.061V13.401H10.4822C11.4702 13.401 11.9642 12.959 11.9642 12.218C11.9642 11.49 11.4702 11.061 10.4822 11.061H8.46717Z",fill:"currentColor"})});var Y=t=>({type:"buttons",items:t,key:"format",order:40});var yn={type:"text-format",format:["bold","italic"],tag:"***"},In={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},Rn={type:"text-format",format:["bold"],tag:"**"},vn={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var Dn=[Y([{ChildComponent:Ln,isActive:({selection:t})=>gu(t)||hu(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(xu,"bold")},order:1}])],Cu=v(({featureProviderMap:t})=>{let e=[Rn,vn];return t.get("italic")&&e.push(In,yn),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:Dn},toolbarInline:{groups:Dn}}});import{$isTableSelection as ku}from"@lexical/table";import{$isRangeSelection as _u,FORMAT_TEXT_COMMAND as Tu}from"lexical";import{jsx as Mn,jsxs as bu}from"react/jsx-runtime";import"react";var On=()=>bu("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:[Mn("path",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),Mn("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var An={type:"text-format",format:["code"],tag:"`"};var $n=[Y([{ChildComponent:On,isActive:({selection:t})=>_u(t)||ku(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(Tu,"code")},order:7}])],wu=v({enableFormats:["code"],markdownTransformers:[An],toolbarFixed:{groups:$n},toolbarInline:{groups:$n}});import{$isTableSelection as Eu}from"@lexical/table";import{$isRangeSelection as Su,FORMAT_TEXT_COMMAND as Nu}from"lexical";import{jsx as Fn}from"react/jsx-runtime";import"react";var Pn=()=>Fn("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:Fn("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 Bn={type:"text-format",format:["italic"],tag:"*"},Hn={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var jn=[Y([{ChildComponent:Pn,isActive:({selection:t})=>Su(t)||Eu(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(Nu,"italic")},order:2}])],Lu=v({enableFormats:["italic"],markdownTransformers:[Bn,Hn],toolbarFixed:{groups:jn},toolbarInline:{groups:jn}});import{$isTableSelection as Iu}from"@lexical/table";import{$isRangeSelection as Ru,FORMAT_TEXT_COMMAND as vu}from"lexical";import{jsx as Un,jsxs as yu}from"react/jsx-runtime";import"react";var Gn=()=>yu("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:[Un("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"}),Un("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var Wn={type:"text-format",format:["strikethrough"],tag:"~~"};var Vn=[Y([{ChildComponent:Gn,isActive:({selection:t})=>Ru(t)||Iu(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(vu,"strikethrough")},order:4}])],Du=v({enableFormats:["strikethrough"],markdownTransformers:[Wn],toolbarFixed:{groups:Vn},toolbarInline:{groups:Vn}});import{$isTableSelection as Mu}from"@lexical/table";import{$isRangeSelection as Ou,FORMAT_TEXT_COMMAND as Au}from"lexical";import{jsx as Kn}from"react/jsx-runtime";import"react";var Jn=()=>Kn("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:Kn("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 13.258C16.7768 14.155 16.1398 14.532 15.2038 15C14.5538 15.325 14.2808 15.546 14.2418 15.78H16.7898V16.82H12.7208V16.339C12.7208 15.286 13.5918 14.675 14.3588 14.233C15.0868 13.83 15.4378 13.635 15.4378 13.232C15.4378 12.894 15.2038 12.686 14.8268 12.686C14.3848 12.686 14.1248 13.024 14.1118 13.427H12.7468C12.8248 12.426 13.5528 11.633 14.8398 11.633C15.9448 11.633 16.7768 12.257 16.7768 13.258Z",fill:"currentColor"})});var Xn=[Y([{ChildComponent:Jn,isActive:({selection:t})=>Ou(t)||Mu(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(Au,"subscript")},order:5}])],$u=v({enableFormats:["subscript"],toolbarFixed:{groups:Xn},toolbarInline:{groups:Xn}});import{$isTableSelection as Fu}from"@lexical/table";import{$isRangeSelection as Pu,FORMAT_TEXT_COMMAND as Bu}from"lexical";import{jsx as zn}from"react/jsx-runtime";import"react";var Zn=()=>zn("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:zn("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 Yn=[Y([{ChildComponent:Zn,isActive:({selection:t})=>Pu(t)||Fu(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(Bu,"superscript")},order:6}])],Hu=v({enableFormats:["superscript"],toolbarFixed:{groups:Yn},toolbarInline:{groups:Yn}});import{$isTableSelection as Uu}from"@lexical/table";import{$isRangeSelection as Gu,FORMAT_TEXT_COMMAND as Wu}from"lexical";import{jsx as qn,jsxs as ju}from"react/jsx-runtime";import"react";var Qn=()=>ju("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:[qn("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"}),qn("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var el=[Y([{ChildComponent:Qn,isActive:({selection:t})=>Gu(t)||Uu(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(Wu,"underline")},order:3}])],Vu=v({enableFormats:["underline"],toolbarFixed:{groups:el},toolbarInline:{groups:el}});import{jsx as Wo}from"react/jsx-runtime";import{jsx as Ku}from"react/jsx-runtime";function Ju(t){return t.replace(/-([a-z])/g,(e,o)=>o.toUpperCase())}var Zt=({css:t})=>{let e=t?Object.fromEntries(Object.entries(t).map(([o,r])=>[Ju(o),r])):{};return Ku("span",{style:{...e,alignItems:"center",borderRadius:"4px",display:"flex",fontSize:"16px",height:"20px",justifyContent:"center",width:"20px"},children:"A"})};import{useLexicalComposerContext as Xu}from"@lexical/react/LexicalComposerContext";import{$forEachSelectedTextNode as zu}from"@lexical/selection";import{$getNodeByKey as Zu,$getState as Yu,$setState as qu,createState as Qu,TextNode as ed}from"lexical";import{useEffect as td}from"react";var Uo=new Map;function tl(t){for(let e in t){let o=t[e],r=Qu(e,{parse:n=>typeof n=="string"&&Object.keys(o).includes(n)?n:void 0});Uo.set(e,{stateConfig:r,stateValues:o})}}function Go(t,e,o){t.update(()=>{zu(r=>{let n=Uo.get(e);if(!n)throw new Error(`State config for ${e} not found`);qu(r,n.stateConfig,o)})})}function ol(){let[t]=Xu();return td(()=>t.registerMutationListener(ed,e=>{t.getEditorState().read(()=>{for(let[o,r]of e){if(r==="destroyed")continue;let n=Zu(o),l=t.getElementByKey(o);if(!n||!l)continue;let i=Object.create(null);Uo.forEach((s,u)=>{let c=Yu(n,s.stateConfig);if(!c){delete l.dataset[u];return}l.dataset[u]=c;let d=s.stateValues[c]?.css;d&&Object.assign(i,d)}),l.style.cssText="",Object.assign(l.style,i)}})}),[t]),null}var rl=t=>{let e=[];for(let r in t.state){let n=t.state[r];for(let l in n){let i=n[l];e.push({ChildComponent:()=>Wo(Zt,{css:i.css}),key:l,label:i.label,onSelect:({editor:s})=>{Go(s,r,l)}})}}return[{type:"dropdown",ChildComponent:()=>Wo(Zt,{css:{color:"var(--theme-elevation-600)"}}),items:[...[{ChildComponent:()=>Wo(Zt,{}),key:"clear-style",label:({i18n:r})=>r.t("lexical:textState:defaultStyle"),onSelect:({editor:r})=>{for(let n in t.state)Go(r,n,void 0)},order:1}],...e],key:"textState",order:30}]},od=v(({props:t})=>(tl(t.state),{plugins:[{Component:ol,position:"normal"}],toolbarFixed:{groups:rl(t)},toolbarInline:{groups:rl(t)}}));import{c as id}from"react/compiler-runtime";import{useLexicalComposerContext as sd}from"@lexical/react/LexicalComposerContext";import{$createHeadingNode as ad,$isHeadingNode as xl,HeadingNode as kl}from"@lexical/rich-text";import{$setBlocksType as cd}from"@lexical/selection";import{$getSelection as ud,$isRangeSelection as dd}from"lexical";import{useEffect as md}from"react";import{jsx as nl}from"react/jsx-runtime";import"react";var ll=()=>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:nl("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 il}from"react/jsx-runtime";import"react";var sl=()=>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:il("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 al}from"react/jsx-runtime";import"react";var cl=()=>al("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:al("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 ul}from"react/jsx-runtime";import"react";var dl=()=>ul("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:ul("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.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 ml}from"react/jsx-runtime";import"react";var pl=()=>ml("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:ml("path",{d:"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 fl}from"react/jsx-runtime";import"react";var hl=()=>fl("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:fl("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 rd,$isHeadingNode as nd,HeadingNode as ld}from"@lexical/rich-text";var Vo=t=>(e,o,r)=>{let n=t(r);n&&(n.append(...o),e.replace(n),n.select(0,0))};var gl=t=>{let o=`^(${t.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`,r=new RegExp(o);return{type:"element",dependencies:[ld],export:(n,l)=>{if(!nd(n))return null;let i=Number(n.getTag().slice(1));return"#".repeat(i)+" "+l(n)},regExp:r,replace:Vo(n=>{let l="h"+n[1]?.length;return rd(l)})}};var Cl=t=>{let e=ud();cd(e,()=>ad(t))},bl={h1:ll,h2:sl,h3:cl,h4:dl,h5:pl,h6:hl},pd=v(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[Q(e.map((r,n)=>({ChildComponent:bl[r],isActive:({selection:l})=>{if(!dd(l))return!1;for(let i of l.getNodes()){if(xl(i)&&i.getTag()===r)continue;let s=i.getParent();if(!(xl(s)&&s.getTag()===r))return!1}return!0},key:r,label:({i18n:l})=>l.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:l})=>{l.update(()=>{Cl(r)})},order:n+2})))];return{markdownTransformers:[gl(e)],nodes:[kl],plugins:[{Component:fd,position:"normal"}],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[Z(e.map(r=>({Icon:bl[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(()=>{Cl(r)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}}),fd=t=>{let e=id(9),{clientProps:o}=t,{enabledHeadingSizes:r}=o,n;e[0]!==r?(n=r===void 0?["h1","h2","h3","h4","h5","h6"]:r,e[0]=r,e[1]=n):n=e[1];let l=n,i;e[2]!==l?(i=l.at(-1),e[2]=l,e[3]=i):i=e[3];let s=i,[u]=sd(),c,d;return e[4]!==u||e[5]!==l||e[6]!==s?(c=()=>{if(!(!s||l.length===6))return u.registerNodeTransform(kl,a=>{l.includes(a.getTag())||a.setTag(s)})},d=[u,l,s],e[4]=u,e[5]=l,e[6]=s,e[7]=c,e[8]=d):(c=e[7],d=e[8]),md(c,d),null};import{$isNodeSelection as Rd}from"lexical";import{jsx as _l}from"react/jsx-runtime";import"react";var Ko=()=>_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:_l("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as Tl,jsxs as hd}from"react/jsx-runtime";import"react";var wl=()=>hd("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Tl("path",{d:"M5 10h10",stroke:"currentColor"}),Tl("path",{d:"M10 15V5",stroke:"currentColor"})]});var he=t=>({type:"dropdown",ChildComponent:wl,items:t,key:"add",order:10});import{addClassNamesToElement as gd}from"@lexical/utils";import{$applyNodeReplacement as xd,createCommand as Cd,DecoratorNode as bd}from"lexical";var pt=Cd("INSERT_HORIZONTAL_RULE_COMMAND"),mt=class extends bd{static clone(e){return new this(e.__key)}static getType(){return"horizontalrule"}static importDOM(){return{hr:()=>({conversion:kd,priority:0})}}static importJSON(e){return El()}createDOM(e){let o=document.createElement("hr");return gd(o,e.theme.hr),o}decorate(){return null}exportDOM(){return{element:document.createElement("hr")}}exportJSON(){return{type:"horizontalrule",version:1}}getTextContent(){return`
35
- `}isInline(){return!1}updateDOM(){return!1}};function kd(){return{node:El()}}function El(){return xd(new mt)}import{$applyNodeReplacement as _d}from"lexical";import"react";var Le=class extends mt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return ft()}decorate(){return null}exportJSON(){return super.exportJSON()}};function ft(){return _d(new Le)}function Yt(t){return t instanceof Le}var Sl={type:"element",dependencies:[Le],export:(t,e)=>Yt(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=ft();e&&t.replace(e)}};import{c as Td}from"react/compiler-runtime";import{useLexicalComposerContext as wd}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Ed}from"@lexical/utils";import{$getSelection as Sd,$isRangeSelection as Nd,COMMAND_PRIORITY_EDITOR as Ld}from"lexical";import{useEffect as yd}from"react";var Nl=()=>{let t=Td(3),[e]=wd(),o,r;return t[0]!==e?(o=()=>e.registerCommand(pt,Id,Ld),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),yd(o,r),null};function Id(t){let e=Sd();if(!Nd(e))return!1;if(e.focus.getNode()!==null){let r=ft();Ed(r)}return!0}var vd=v({markdownTransformers:[Sl],nodes:[Le],plugins:[{Component:Nl,position:"normal"}],slashMenu:{groups:[Z([{Icon:Ko,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(pt,void 0)}}])]},toolbarFixed:{groups:[he([{ChildComponent:Ko,isActive:({selection:t})=>{if(!Rd(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Yt(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(pt,void 0)}}])]}});import{$findMatchingParent as $l}from"@lexical/utils";import{$isElementNode as Wd,INDENT_CONTENT_COMMAND as Vd,OUTDENT_CONTENT_COMMAND as Kd}from"lexical";import{jsx as qt,jsxs as Dd}from"react/jsx-runtime";import"react";var Ll=()=>Dd("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:[qt("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),qt("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),qt("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),qt("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as Qt,jsxs as Md}from"react/jsx-runtime";import"react";var yl=()=>Md("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:[Qt("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),Qt("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),Qt("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),Qt("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});import{jsx as Od}from"react/jsx-runtime";import{useLexicalComposerContext as Ad}from"@lexical/react/LexicalComposerContext";import{TabIndentationPlugin as $d}from"@lexical/react/LexicalTabIndentationPlugin";import{$findMatchingParent as Fd,mergeRegister as Il}from"@lexical/utils";import{$getSelection as Pd,$isElementNode as Ml,$isRangeSelection as Bd,COMMAND_PRIORITY_LOW as Rl,INDENT_CONTENT_COMMAND as vl,KEY_TAB_COMMAND as Hd,OUTDENT_CONTENT_COMMAND as jd,TabNode as Ud}from"lexical";import{useEffect as Dl}from"react";var Ol=({clientProps:t})=>{let[e]=Ad(),{disabledNodes:o,disableTabNode:r}=t;return Dl(()=>{if(!(!e||!o?.length))return Il(e.registerCommand(vl,()=>Gd(n=>{if(!o.includes(n.getType())){let l=n.getIndent();n.setIndent(l+1)}}),Rl),e.registerUpdateListener(({dirtyElements:n,editorState:l})=>{e.update(()=>{for(let[i]of n){let s=l._nodeMap.get(i);Ml(s)&&o.includes(s.getType())&&s.getIndent()>0&&s.setIndent(0)}})}))},[e,o]),Dl(()=>{if(!(!e||!r))return Il(e.registerCommand(Hd,n=>(n.preventDefault(),e.dispatchCommand(n.shiftKey?jd:vl,void 0)),Rl),e.registerNodeTransform(Ud,n=>{n.remove()}))},[e,r]),Od($d,{})};function Gd(t){let e=Pd();if(!Bd(e))return!1;let o=new Set,r=e.getNodes();for(let n=0;n<r.length;n++){let l=r[n],i=l.getKey();if(o.has(i))continue;let s=Fd(l,c=>Ml(c)&&!c.isInline());if(s===null)continue;let u=s.getKey();s.canIndent()&&!o.has(u)&&(o.add(u),t(s))}return o.size>0}var Al=t=>({type:"buttons",items:t,key:"indent",order:35});var Fl=({disabledNodes:t})=>[Al([{ChildComponent:Ll,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>Pl(n)&&n.getIndent()>0;return o.some(n=>r(n)||!!$l(n,r))},key:"indentDecrease",label:({i18n:e})=>e.t("lexical:indent:decreaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Kd,void 0)},order:1},{ChildComponent:yl,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>Pl(n)&&!(t??[]).includes(n.getType());return o.some(n=>r(n)||!!$l(n,r))},key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Vd,void 0)},order:2}])],Jd=v(({props:t})=>{let e=t.disabledNodes??[];return{plugins:[{Component:Ol,position:"normal"}],sanitizedClientFeatureProps:t,toolbarFixed:{groups:Fl({disabledNodes:e})},toolbarInline:{groups:Fl({disabledNodes:e})}}}),Pl=t=>Wd(t)&&t.canIndent();import{$findMatchingParent as lp}from"@lexical/utils";import{$getSelection as tr,$isRangeSelection as hi}from"lexical";import{jsx as Bl}from"react/jsx-runtime";import"react";var Hl=()=>Bl("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:Bl("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 jl}from"@lexical/selection";function Ke(t){let{anchor:e}=t,{focus:o}=t,r=t.anchor.getNode(),n=t.focus.getNode();return r===n?r:t.isBackward()?jl(o)?r:n:jl(e)?r:n}var Jo=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as nm}from"lexical";import{addClassNamesToElement as Xd,isHTMLAnchorElement as zd}from"@lexical/utils";import Zo from"bson-objectid";import{$applyNodeReplacement as Zd,$createTextNode as Ul,$getSelection as Yd,$isElementNode as Gl,$isRangeSelection as zo,createCommand as qd,ElementNode as Qd}from"lexical";var em=new Set(["http:","https:","mailto:","sms:","tel:"]),ee=class t extends Qd{__fields;__id;constructor({id:e,fields:o={linkType:"custom",newTab:!1},key:r}){super(r),this.__fields=o,this.__id=e}static clone(e){return new t({id:e.__id,fields:e.__fields,key:e.__key})}static getType(){return"link"}static importDOM(){return{a:e=>({conversion:tm,priority:1})}}static importJSON(e){let o=ge({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),e.version===2&&!e.id&&(e.id=new Zo.default().toHexString(),e.version=3),o}canBeEmpty(){return!1}canInsertTextAfter(){return!1}canInsertTextBefore(){return!1}createDOM(e){let o=document.createElement("a");return this.__fields?.linkType==="custom"&&(o.href=this.sanitizeUrl(this.__fields.url??"")),(this.__fields?.newTab??!1)&&(o.target="_blank"),this.__fields?.newTab===!0&&this.__fields?.linkType==="custom"&&(o.rel=Xo(o.rel,"add","noopener")),Xd(o,e.theme.link),o}exportJSON(){let e=this.getFields();e?.linkType==="internal"?delete e.url:e?.linkType==="custom"&&delete e.doc;let o={...super.exportJSON(),type:"link",fields:e,version:3},r=this.getID();return r&&(o.id=r),o}extractWithChild(e,o,r){if(!zo(o))return!1;let n=o.anchor.getNode(),l=o.focus.getNode();return this.isParentOf(n)&&this.isParentOf(l)&&o.getTextContent().length>0}getFields(){return this.getLatest().__fields}getID(){return this.getLatest().__id}insertNewAfter(e,o=!0){let r=this.getParentOrThrow().insertNewAfter(e,o);if(Gl(r)){let n=ge({fields:this.__fields});return r.append(n),n}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!em.has(o.protocol))return"about:blank"}catch{return"https://"}return e}setFields(e){let o=this.getWritable();return o.__fields=e,o}setID(e){let o=this.getWritable();return o.__id=e,o}updateDOM(e,o,r){let n=this.__fields?.url,l=this.__fields?.newTab;return n!=null&&n!==e.__fields?.url&&this.__fields?.linkType==="custom"&&(o.href=n),this.__fields?.linkType==="internal"&&e.__fields?.linkType==="custom"&&o.removeAttribute("href"),o.rel==null&&(o.rel=""),l!==e.__fields?.newTab&&(l??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=Xo(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=Xo(o.rel,"remove","noopener"))),!1}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields).setID(e.id)}};function tm(t){let e=null;if(zd(t)){let o=t.textContent;o!==null&&o!==""&&(e=ge({id:new Zo.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function ge({id:t,fields:e}){return Zd(new ee({id:t??new Zo.default().toHexString(),fields:e}))}function J(t){return t instanceof ee}var ae=qd("TOGGLE_LINK_COMMAND");function Yo(t){let e=Yd();if(!zo(e)&&(t===null||!t.selectedNodes?.length))return;let o=zo(e)?e.extract():t===null?[]:t.selectedNodes;if(t===null){o?.forEach(l=>{let i=l.getParent();J(i)&&(i.getChildren().forEach(u=>{i.insertBefore(u)}),i.remove())});return}if(o?.length===1){let l=o[0],i=J(l)?l:om(l);if(i!==null){i.setFields(t.fields),t.text!=null&&t.text!==i.getTextContent()&&(i.append(Ul(t.text)),i.getChildren().forEach(s=>{s!==i.getLastChild()&&s.remove()}));return}}let r=null,n=null;o?.forEach(l=>{let i=l.getParent();if(!(i===n||i===null||Gl(l)&&!l.isInline())){if(J(i)){n=i,i.setFields(t.fields),t.text!=null&&t.text!==i.getTextContent()&&(i.append(Ul(t.text)),i.getChildren().forEach(s=>{s!==i.getLastChild()&&s.remove()}));return}if(i.is(r)||(r=i,n=ge({fields:t.fields}),J(i)?l.getPreviousSibling()===null?i.insertBefore(n):i.insertAfter(n):l.insertBefore(n)),J(l)){if(l.is(n))return;if(n!==null){let s=l.getChildren();n.append(...s)}l.remove();return}n!==null&&n.append(l)}})}function om(t){return rm(t,e=>J(e))}function rm(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function Xo(t,e,o){let r,n=`${t}`;if(e==="add"){if(n.includes(o)){let l=new RegExp(o,"g");n=n.replace(l,"").trim()}n=n.trim(),r=n.length===0?`${o}`:`${n} ${o}`}else{let l=new RegExp(o,"g");r=n.replace(l,"").trim()}return r}var Wl={type:"text-match",dependencies:[ee],export:(t,e)=>{if(!J(t))return null;let o=t,{url:r}=o.getFields();return`[${e(o)}](${r})`},importRegExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:(t,e)=>{let[,o,r]=e,n=ge({fields:{doc:null,linkType:"custom",newTab:!1,url:r}}),l=nm(o);return l.setFormat(t.getFormat()),n.append(l),t.replace(n),l},trigger:")"};import{$applyNodeReplacement as lm,$isElementNode as im}from"lexical";var xe=class t extends ee{static clone(e){return new t({id:"",fields:e.__fields,key:e.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(e){let o=ht({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),o}exportJSON(){let e=super.exportJSON();return{type:"autolink",children:e.children,direction:e.direction,fields:e.fields,format:e.format,indent:e.indent,version:2}}insertNewAfter(e,o=!0){let r=this.getParentOrThrow().insertNewAfter(e,o);if(im(r)){let n=ht({fields:this.__fields});return r.append(n),n}return null}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields)}};function ht({fields:t}){return lm(new xe({id:"",fields:t}))}function Ce(t){return t instanceof xe}import{c as sm}from"react/compiler-runtime";import{useLexicalComposerContext as am}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as cm}from"@lexical/utils";import{$createTextNode as Vl,$getSelection as um,$isElementNode as Jl,$isLineBreakNode as Xl,$isNodeSelection as dm,$isRangeSelection as mm,$isTextNode as gt,TextNode as pm}from"lexical";import{useEffect as fm}from"react";function Kl(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 zl(t,e){for(let o of e){let r=o(t);if(r!=null)return r}return null}var hm=/[.,;\s]/;function to(t){return t!==void 0&&hm.test(t)}function Zl(t){return to(t[t.length-1])}function Qo(t){return to(t[0])}function gm(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function Yl(t){let e=t.getPreviousSibling();return Jl(e)&&(e=e.getLastDescendant()),e===null||Xl(e)||gt(e)&&Zl(e.getTextContent())}function ql(t){let e=t.getNextSibling();return Jl(e)&&(e=e.getFirstDescendant()),e===null||Xl(e)||gt(e)&&Qo(e.getTextContent())}function xm(t,e,o,r){return(t>0?to(o[t-1]):Yl(r[0]))?e<o.length?to(o[e]):ql(r[r.length-1]):!1}function Cm(t,e,o){let r=[],n=[],l=[],i=0,s=0,u=[...t];for(;u.length>0;){let c=u[0],a=c.getTextContent().length,p=s;s+a<=e?(r.push(c),i+=a):p>=o?l.push(c):n.push(c),s+=a,u.shift()}return[i,r,n,l]}function bm(t,e,o,r){let n={linkType:"custom",url:r.url,...r.fields},l=ht({fields:n});if(t.length===1){let i=t[0],s;if(e===0?[s]=i.splitText(o):[,s]=i.splitText(e,o),s){let u=Vl(r.text);u.setFormat(s.getFormat()),u.setDetail(s.getDetail()),u.setStyle(s.getStyle()),l.append(u),s.replace(l)}return i}else if(t.length>1){let i=t[0],s=i.getTextContent().length,u;e===0?u=i:[,u]=i.splitText(e);let c=[],d;if(t.forEach(a=>{let m=a.getTextContent().length,f=s,h=s+m;if(f<o)if(h<=o)c.push(a);else{let[x,b]=a.splitText(o-f);x&&c.push(x),d=b}s+=m}),u){let a=um(),p=a?a.getNodes().find(gt):void 0,m=Vl(u.getTextContent());return m.setFormat(u.getFormat()),m.setDetail(u.getDetail()),m.setStyle(u.getStyle()),l.append(m,...c),p&&p===u&&(mm(a)?m.select(a.anchor.offset,a.focus.offset):dm(a)&&m.select(0,m.getTextContent().length)),u.replace(l),d}}}function km(t,e,o){let r=[...t],n=r.map(u=>u.getTextContent()).join(""),l=n,i,s=0;for(;(i=zl(l,e))!=null&&i!==null;){let u=i.index,c=i.length,d=u+c;if(xm(s+u,s+d,n,r)){let[p,,m,f]=Cm(r,s+u,s+d),h=s+u-p,x=s+d-p,b=bm(m,h,x,i);r=b?[b,...f]:f,o(i.url,null),s=0}else s+=d;l=l.substring(d)}}function qo(t,e,o){let r=t.getChildren(),n=r.length;for(let u=0;u<n;u++){let c=r[u];if(!gt(c)||!c.isSimpleText()){eo(t),o(null,t.getFields()?.url??null);return}}let l=t.getTextContent(),i=zl(l,e);if(i===null||i.text!==l){eo(t),o(null,t.getFields()?.url??null);return}if(!Yl(t)||!ql(t)){eo(t),o(null,t.getFields()?.url??null);return}let s=t.getFields()?.url;if(s!==i?.url){let u=t.getFields();u.url=i?.url,t.setFields(u),o(i.url,s??null)}}function _m(t,e,o){let r=t.getPreviousSibling(),n=t.getNextSibling(),l=t.getTextContent();if(Ce(r)){let i=r.getFields()?.url?r.getFields()?.url?.startsWith("mailto:")??!1:!1;(!Qo(l)||gm(l,i))&&(r.append(t),qo(r,e,o),o(null,r.getFields()?.url??null))}Ce(n)&&!Zl(l)&&(eo(n),qo(n,e,o),o(null,n.getFields()?.url??null))}function eo(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 Tm(t){let e=[t],o=t.getNextSibling();for(;o!==null&&gt(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function wm(t,e,o){let r=sm(5),n,l;r[0]!==t||r[1]!==e||r[2]!==o?(n=()=>{if(!t.hasNodes([xe]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let i=(s,u)=>{o?.(s,u)};return cm(t.registerNodeTransform(pm,s=>{let u=s.getParentOrThrow(),c=s.getPreviousSibling();if(Ce(u))qo(u,e,i);else if(!J(u)){if(s.isSimpleText()&&(Qo(s.getTextContent())||!Ce(c))){let d=Tm(s);km(d,e,i)}_m(s,e,i)}}))},l=[t,e,o],r[0]=t,r[1]=e,r[2]=o,r[3]=n,r[4]=l):(n=r[3],l=r[4]),fm(n,l)}var Em=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,Sm=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,Nm=[Kl(Em,t=>t.startsWith("http")?t:`https://${t}`),Kl(Sm,t=>`mailto:${t}`)],Ql=()=>{let[t]=am();return wm(t,Nm),null};import{jsx as Lm}from"react/jsx-runtime";import{ClickableLinkPlugin as ym}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var ei=()=>Lm(ym,{});import{jsx as Km}from"react/jsx-runtime";import"react";import{createPortal as Jm}from"react-dom";import{jsx as be,jsxs as xt,Fragment as Rm}from"react/jsx-runtime";import{useLexicalComposerContext as vm}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as ti,mergeRegister as oi}from"@lexical/utils";import{getTranslation as er}from"@payloadcms/translations";import{CloseMenuIcon as Dm,EditIcon as Mm,ExternalLinkIcon as ri,formatDrawerSlug as Om,useConfig as Am,useEditDepth as $m,useLocale as Fm,useTranslation as Pm}from"@payloadcms/ui";import{requests as Bm}from"@payloadcms/ui/shared";import{$getSelection as ni,$isLineBreakNode as Hm,$isRangeSelection as li,COMMAND_PRIORITY_HIGH as jm,COMMAND_PRIORITY_LOW as ii,getDOMSelection as Um,KEY_ESCAPE_COMMAND as Gm,SELECTION_CHANGE_COMMAND as Wm}from"lexical";import si,{useCallback as ai,useEffect as no,useRef as Vm,useState as Ae}from"react";function oo(t,e,o,r=10,n=5){let l=o.parentElement;if(t===null||l==null){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let i=e.getBoundingClientRect(),s=o.getBoundingClientRect(),u=l.getBoundingClientRect(),c=t.top-r,d=t.left-n;c<u.top&&(c+=i.height+t.height+r*2),d+i.width>u.right&&(d=u.right-i.width-n),c-=s.top,d-=s.left,e.style.opacity="1",e.style.transform=`translate(${d}px, ${c}px)`}import{createCommand as Im}from"lexical";var ro=Im("TOGGLE_LINK_WITH_MODAL_COMMAND");function ci(t){t.preventDefault()}function ui({anchorElem:t}){let[e]=vm(),[o,r]=Ae(),n=Vm(null),[l,i]=Ae(null),[s,u]=Ae(null),{fieldProps:{schemaPath:c},uuid:d}=H(),{config:a,getEntityConfig:p}=Am(),{i18n:m,t:f}=Pm(),[h,x]=Ae(),b=$m(),[T,E]=Ae(!1),[C,k]=Ae([]),g=Fm(),[w,N]=Ae(!1),M=Om({slug:"lexical-rich-text-link-"+d,depth:b}),{toggleDrawer:$}=me(M),R=ai(()=>{E(!1),n&&n.current&&(n.current.style.opacity="0",n.current.style.transform="translate(-10000px, -10000px)"),N(!1),i(null),u(null),k([]),x(void 0)},[E,i,u,k]),S=ai(()=>{let _=ni(),L;if(!li(_)||!_){R();return}let D=Ke(_);L=e.getElementByKey(D.getKey())?.getBoundingClientRect();let I=ti(D,J),O=_.getNodes().filter(X=>!Hm(X)).find(X=>{let U=ti(X,J);return I&&!I.is(U)||U&&!U.is(I)});if(I==null||O){R();return}r(I);let y=I.getFields(),F={...y,id:I.getID(),text:I.getTextContent()};if(y?.linkType==="custom")i(y?.url??null),u(null);else{i(`${a.routes.admin==="/"?"":a.routes.admin}/collections/${y?.doc?.relationTo}/${y?.doc?.value}`);let X=y?.doc?.relationTo?p({collectionSlug:y?.doc?.relationTo}):void 0;if(!X)u(y?.label?String(y?.label):null),i(y?.url?String(y?.url):null);else{let U=typeof y.doc?.value=="object"?y.doc.value.id:y.doc?.value,He=y.doc?.relationTo;if(!U||!He)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let Ee=f("fields:linkedTo",{label:`${er(X.labels.singular,m)} - ${f("lexical:link:loadingWithEllipsis",m)}`}).replace(/<[^>]*>?/g,"");u(Ee),Bm.get(`${a.serverURL}${a.routes.api}/${He}/${U}`,{headers:{"Accept-Language":m.language},params:{depth:0,locale:g?.code}}).then(async de=>{if(!de.ok)throw new Error(`HTTP error! Status: ${de.status}`);let Mt=await de.json(),Se=X?.admin?.useAsTitle||"id",Ot=Mt[Se],je=f("fields:linkedTo",{label:`${er(X.labels.singular,m)} - ${Ot}`}).replace(/<[^>]*>?/g,"");u(je)}).catch(()=>{let de=f("fields:linkedTo",{label:`${er(X.labels.singular,m)} - ${f("general:untitled",m)} - ID: ${U}`}).replace(/<[^>]*>?/g,"");u(de)})}}x(F),E(!0),k(_?_?.getNodes():[]),Ce(I)?N(!0):N(!1);let G=n.current,q=Um(e._window),{activeElement:te}=document;if(G===null)return;let Dt=e.getRootElement();return q!==null&&Dt!==null&&Dt.contains(q.anchorNode)?(L||(L=q.getRangeAt(0).getBoundingClientRect()),L!=null&&(L.y+=40,oo(L,G,t))):(te==null||te.className!=="link-input")&&(Dt!==null&&oo(null,G,t),i(null),u(null)),!0},[e,R,a.routes.admin,a.routes.api,a.serverURL,p,f,m,g?.code,t]);return no(()=>oi(e.registerCommand(ro,_=>(e.dispatchCommand(ae,_),S(),$(),!0),ii)),[e,S,$,M]),no(()=>{let _=t.parentElement,L=()=>{e.getEditorState().read(()=>{S()})};return window.addEventListener("resize",L),_?.addEventListener("scroll",L),()=>{window.removeEventListener("resize",L),_?.removeEventListener("scroll",L)}},[t.parentElement,e,S]),no(()=>oi(e.registerUpdateListener(({editorState:_})=>{_.read(()=>{S()})}),e.registerCommand(Wm,()=>(S(),!0),ii),e.registerCommand(Gm,()=>T?(R(),!0):!1,jm)),[e,S,T,R]),no(()=>{e.getEditorState().read(()=>{S()})},[e,S]),xt(si.Fragment,{children:[be("div",{className:"link-editor",ref:n,children:xt("div",{className:"link-input",children:[l&&l.length>0?xt("a",{href:l,rel:"noopener noreferrer",target:"_blank",children:[o?.__fields.newTab?be(ri,{}):null,s!=null&&s.length>0?s:l]}):s!=null&&s.length>0?xt(Rm,{children:[o?.__fields.newTab?be(ri,{}):null,be("span",{className:"link-input__label-pure",children:s})]}):null,e.isEditable()&&xt(si.Fragment,{children:[be("button",{"aria-label":"Edit link",className:"link-edit",onClick:_=>{_.preventDefault(),$()},onMouseDown:ci,tabIndex:0,type:"button",children:be(Mm,{})}),!w&&be("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(ae,null)},onMouseDown:ci,tabIndex:0,type:"button",children:be(Dm,{})})]})]})}),be(nt,{className:"lexical-link-edit-drawer",data:h,drawerSlug:M,drawerTitle:f("fields:editLink"),featureKey:"link",handleDrawerSubmit:(_,L)=>{let D=L,I={...D};delete I.text,e.update(()=>{let O=ni(),y=null;if(li(O)?y=Ke(O).getParent():C.length&&(y=C[0]?.getParent()??null),y&&Ce(y)){let F=ge({fields:I});y.replace(F,!0)}}),e.dispatchCommand(ae,{fields:I,selectedNodes:C,text:D.text})},schemaPath:c,schemaPathSuffix:"fields"})]})}var di=t=>{let{anchorElem:e=document.body}=t;return Jm(Km(ui,{anchorElem:e}),e)};import{c as Zm}from"react/compiler-runtime";import{useLexicalComposerContext as Ym}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as qm}from"@lexical/utils";import{$getSelection as Qm,$isElementNode as ep,$isRangeSelection as tp,COMMAND_PRIORITY_LOW as pi,PASTE_COMMAND as op}from"lexical";import{useEffect as rp}from"react";var Xm=/^(?:[a-zA-Z][a-zA-Z\d+.-]*:(?:\/\/)?(?:[-;:&=+$,\w]+@)?[A-Za-z\d]+(?:\.[A-Za-z\d]+)+|www\.[A-Za-z\d]+(?:\.[A-Za-z\d]+)+|(?:tel|mailto):[\w+.-]+)(?:\/[+~%/\w-]*)?(?:\?[-;&=%\w]*)?(?:#\w+)?$/,zm=/^(?:\/[\w\-./]*(?:#\w[\w-]*)?|#[\w\-]+)$/;function mi(t){if(!t)return!1;if(t==="https://"||Xm.test(t)||zm.test(t))return!0;try{return new URL(t),!0}catch{}return!1}var fi=t=>{let e=Zm(5),{clientProps:o}=t,[r]=Ym(),n,l;return e[0]!==o.defaultLinkType||e[1]!==o.defaultLinkURL||e[2]!==r?(n=()=>{if(!r.hasNodes([ee]))throw new Error("LinkPlugin: LinkNode not registered on editor");return qm(r.registerCommand(ae,i=>i===null?(Yo(null),!0):(i.fields?.linkType||(i.fields.linkType=o.defaultLinkType),i.fields?.url||(i.fields.url=o.defaultLinkURL),Yo(i),!0),pi),r.registerCommand(op,i=>{let s=Qm();if(!tp(s)||s.isCollapsed()||!(i instanceof ClipboardEvent)||i.clipboardData==null)return!1;let u=i.clipboardData.getData("text");if(!mi(u))return!1;if(!s.getNodes().some(np)){let c={doc:null,linkType:"custom",newTab:!1,url:u};return r.dispatchCommand(ae,{fields:c,text:null}),i.preventDefault(),!0}return!1},pi))},l=[o.defaultLinkType,o.defaultLinkURL,r],e[0]=o.defaultLinkType,e[1]=o.defaultLinkURL,e[2]=r,e[3]=n,e[4]=l):(n=e[3],l=e[4]),rp(n,l),null};function np(t){return ep(t)}var gi=[Jo([{ChildComponent:Hl,isActive:({selection:t})=>{if(hi(t)){let e=Ke(t);return lp(e,J)!=null}return!1},isEnabled:({selection:t})=>!!(hi(t)&&tr()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(ae,null);else{let o,r=[];if(t.getEditorState().read(()=>{o=tr()?.getTextContent(),r=tr()?.getNodes()??[]}),!o?.length)return;let n={doc:null};t.dispatchCommand(ro,{fields:n,selectedNodes:r,text:o})}},order:1}])],ip=v(({props:t})=>({markdownTransformers:[Wl],nodes:[ee,t?.disableAutoLinks===!0?null:xe].filter(Boolean),plugins:[{Component:fi,position:"normal"},t?.disableAutoLinks===!0||t?.disableAutoLinks==="creationOnly"?null:{Component:Ql,position:"normal"},{Component:ei,position:"normal"},{Component:di,position:"floatingAnchorElem"}].filter(Boolean),sanitizedClientFeatureProps:t,toolbarFixed:{groups:gi},toolbarInline:{groups:gi}}));import{$isListNode as nr,INSERT_CHECK_LIST_COMMAND as Ti,ListItemNode as Cp,ListNode as bp}from"@lexical/list";import{$isRangeSelection as kp}from"lexical";import{jsx as xi,jsxs as sp}from"react/jsx-runtime";import"react";var or=()=>sp("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:[xi("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),xi("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as ap}from"react/jsx-runtime";import{ListPlugin as cp}from"@lexical/react/LexicalListPlugin.js";import"react";var Je=()=>ap(cp,{});function Xe(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as pp,ListItemNode as fp,ListNode as hp}from"@lexical/list";import{$createListItemNode as up,$createListNode as dp,$isListItemNode as mp,$isListNode as rr}from"@lexical/list";var Ci=4,ze=t=>(e,o,r)=>{let n=e.getPreviousSibling(),l=e.getNextSibling(),i=up(t==="check"?r[3]==="x":void 0);if(rr(l)&&l.getListType()===t){let u=l.getFirstChild();u!==null?u.insertBefore(i):l.append(i),e.remove()}else if(rr(n)&&n.getListType()===t)n.append(i),e.remove();else{let u=dp(t,t==="number"?Number(r[2]):void 0);u.append(i),e.replace(u)}i.append(...o),i.select(0,0);let s=Math.floor(r[1].length/Ci);s&&i.setIndent(s)},$e=(t,e,o)=>{let r=[],n=t.getChildren(),l=0;for(let i of n)if(mp(i)){if(i.getChildrenSize()===1){let d=i.getFirstChild();if(rr(d)){r.push($e(d,e,o+1));continue}}let s=" ".repeat(o*Ci),u=t.getListType(),c=u==="number"?`${t.getStart()+l}. `:u==="check"?`- [${i.getChecked()?"x":" "}] `:"- ";r.push(s+c+e(i)),l++}return r.join(`
36
- `)};var bi={type:"element",dependencies:[hp,fp],export:(t,e)=>pp(t)?$e(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:ze("check")};import{jsx as gp}from"react/jsx-runtime";import{CheckListPlugin as xp}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var ki=()=>gp(xp,{});var _i=[Q([{ChildComponent:or,isActive:({selection:t})=>{if(!kp(t))return!1;for(let e of t.getNodes()){if(nr(e)&&e.getListType()==="check")continue;let o=e.getParent();if(nr(o)&&o.getListType()==="check")continue;let r=o?.getParent();if(!(nr(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}])],_p=v(({featureProviderMap:t})=>{let e=[{Component:ki,position:"normal"}];return!t.has("unorderedList")&&!t.has("orderedList")&&e.push({Component:Je,position:"normal"}),{markdownTransformers:[bi],nodes:t.has("unorderedList")||t.has("orderedList")?[]:[bp,Cp],plugins:e,slashMenu:{groups:[Xe([{Icon:or,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:_i},toolbarInline:{groups:_i}}});import{$isListNode as ir,INSERT_ORDERED_LIST_COMMAND as Si,ListItemNode as Np,ListNode as Lp}from"@lexical/list";import{$isRangeSelection as yp}from"lexical";import{jsx as Ct,jsxs as Tp}from"react/jsx-runtime";import"react";var lr=()=>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:[Ct("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"}),Ct("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"}),Ct("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),Ct("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),Ct("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as wp,ListItemNode as Ep,ListNode as Sp}from"@lexical/list";var wi={type:"element",dependencies:[Sp,Ep],export:(t,e)=>wp(t)?$e(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:ze("number")};var Ei=[Q([{ChildComponent:lr,isActive:({selection:t})=>{if(!yp(t))return!1;for(let e of t.getNodes()){if(ir(e)&&e.getListType()==="number")continue;let o=e.getParent();if(ir(o)&&o.getListType()==="number")continue;let r=o?.getParent();if(!(ir(r)&&r.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Si,void 0)},order:10}])],Ip=v(({featureProviderMap:t})=>({markdownTransformers:[wi],nodes:t.has("orderedList")?[]:[Lp,Np],plugins:t.has("orderedList")?[]:[{Component:Je,position:"normal"}],slashMenu:{groups:[Xe([{Icon:lr,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:e})=>e.t("lexical:orderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(Si,void 0)}}])]},toolbarFixed:{groups:Ei},toolbarInline:{groups:Ei}}));import{$isListNode as ar,INSERT_UNORDERED_LIST_COMMAND as yi,ListItemNode as Op,ListNode as Ap}from"@lexical/list";import{$isRangeSelection as $p}from"lexical";import{jsx as Ze,jsxs as Rp}from"react/jsx-runtime";import"react";var sr=()=>Rp("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:[Ze("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Ze("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Ze("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Ze("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),Ze("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),Ze("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as vp,ListItemNode as Dp,ListNode as Mp}from"@lexical/list";var Ni={type:"element",dependencies:[Mp,Dp],export:(t,e)=>vp(t)?$e(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:ze("bullet")};var Li=[Q([{ChildComponent:sr,isActive:({selection:t})=>{if(!$p(t))return!1;for(let e of t.getNodes()){if(ar(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(ar(o)&&o.getListType()==="bullet")continue;let r=o?.getParent();if(!(ar(r)&&r.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(yi,void 0)},order:11}])],Fp=v({markdownTransformers:[Ni],nodes:[Ap,Op],plugins:[{Component:Je,position:"normal"}],slashMenu:{groups:[Xe([{Icon:sr,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(yi,void 0)}}])]},toolbarFixed:{groups:Li},toolbarInline:{groups:Li}});import{jsx as Pp}from"react/jsx-runtime";import{addClassNamesToElement as Bp}from"@lexical/utils";import{DecoratorNode as Hp}from"lexical";import*as Ii from"react";var jp=Ii.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),bt=class t extends Hp{__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 Up({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return Bp(o,"unknownConverted"),o}decorate(){return Pp(jp,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function Up({data:t}){return new bt({data:t})}var Gp=v(()=>({nodes:[bt]}));import{jsx as Wp}from"react/jsx-runtime";import{addClassNamesToElement as Vp}from"@lexical/utils";import{DecoratorNode as Kp}from"lexical";import*as Ri from"react";var Jp=Ri.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),kt=class t extends Kp{__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 Xp({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return Vp(o,"unknownConverted"),o}decorate(){return Wp(Jp,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function Xp({data:t}){return new kt({data:t})}var zp=v(()=>({nodes:[kt]}));import{$setBlocksType as Mi}from"@lexical/selection";import{$createParagraphNode as Oi,$getSelection as Ai,$isParagraphNode as vi,$isRangeSelection as Zp}from"lexical";var Di=[Q([{ChildComponent:it,isActive:({selection:t})=>{if(!Zp(t))return!1;for(let e of t.getNodes())if(!vi(e)&&!vi(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=Ai();Mi(e,()=>Oi())})},order:1}])],Yp=v({slashMenu:{groups:[Z([{Icon:it,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Ai();Mi(e,()=>Oi())})}}])]},toolbarFixed:{groups:Di},toolbarInline:{groups:Di}});import{c as bf}from"react/compiler-runtime";import{jsx as ts}from"react/jsx-runtime";import{useLexicalComposerContext as kf}from"@lexical/react/LexicalComposerContext";import{useEffect as _f,useState as Tf}from"react";import{jsx as es,Fragment as Cf}from"react/jsx-runtime";import"react";import{jsx as qp}from"react/jsx-runtime";var $i={quote:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return qp("blockquote",{children:o})}};import{jsx as Qp}from"react/jsx-runtime";var Fi={heading:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.tag;return Qp(r,{children:o})}};import{jsx as ef}from"react/jsx-runtime";var Pi={horizontalrule:ef("hr",{})};import{jsx as tf}from"react/jsx-runtime";var Bi={linebreak:tf("br",{})};import{jsx as Hi}from"react/jsx-runtime";var ji=({internalDocToHref:t})=>({autolink:({node:e,nodesToJSX:o})=>{let r=o({nodes:e.children}),n=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0;return Hi("a",{href:e.fields.url,rel:n,target:l,children:r})},link:({node:e,nodesToJSX:o})=>{let r=o({nodes:e.children}),n=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0,i=e.fields.url??"";return e.fields.linkType==="internal"&&(t?i=t({linkNode:e}):(console.error("Lexical => JSX converter: Link converter: found internal link, but internalDocToHref is not provided"),i="#")),Hi("a",{href:i,rel:n,target:l,children:r})}});import{jsx as Ye,jsxs as of,Fragment as rf}from"react/jsx-runtime";import{v4 as nf}from"uuid";var Ui={list:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.tag;return Ye(r,{className:`list-${t?.listType}`,children:o})},listitem:({node:t,nodesToJSX:e,parent:o})=>{let r=t.children.some(l=>l.type==="list"),n=e({nodes:t.children});if("listType"in o&&o?.listType==="check"){let l=nf();return Ye("li",{"aria-checked":t.checked?"true":"false",className:`list-item-checkbox${t.checked?" list-item-checkbox-checked":" list-item-checkbox-unchecked"}${r?" nestedListItem":""}`,role:"checkbox",style:{listStyleType:"none"},tabIndex:-1,value:t?.value,children:r?n:of(rf,{children:[Ye("input",{checked:t.checked,id:l,readOnly:!0,type:"checkbox"}),Ye("label",{htmlFor:l,children:n}),Ye("br",{})]})})}else return Ye("li",{className:`${r?"nestedListItem":""}`,style:r?{listStyleType:"none"}:void 0,value:t?.value,children:n})}};import{jsx as cr}from"react/jsx-runtime";var Gi={paragraph:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return o?.length?cr("p",{children:o}):cr("p",{children:cr("br",{})})}};var Wi={tab:" "};import{jsx as _t}from"react/jsx-runtime";var Vi={table:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return _t("div",{className:"lexical-table-container",children:_t("table",{className:"lexical-table",style:{borderCollapse:"collapse"},children:_t("tbody",{children:o})})})},tablecell:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.headerState>0?"th":"td",n=`lexical-table-cell-header-${t.headerState}`,l={backgroundColor:t.backgroundColor||void 0,border:"1px solid #ccc",padding:"8px"},i=t.colSpan&&t.colSpan>1?t.colSpan:void 0,s=t.rowSpan&&t.rowSpan>1?t.rowSpan:void 0;return _t(r,{className:`lexical-table-cell ${n}`,colSpan:i,rowSpan:s,style:l,children:o})},tablerow:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return _t("tr",{className:"lexical-table-row",children:o})}};import{jsx as Fe}from"react/jsx-runtime";import"react";var A={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},lf=A.IS_BOLD|A.IS_ITALIC|A.IS_STRIKETHROUGH|A.IS_UNDERLINE|A.IS_CODE|A.IS_SUBSCRIPT|A.IS_SUPERSCRIPT|A.IS_HIGHLIGHT,sf="\xA0",af=`
34
+ `},[t,e]),m=ve((b,_)=>{o(x=>{let w=e.length-1,v=e[w];if(v&&v.name===b){if(b==="type")return[...e.slice(0,w),{...v,value:v.value+_}];if(v.value===_)return[...e.slice(0,w),{...v,count:v.count+1}]}return[...x,{name:b,count:1,value:_}]})},[e,o]);pn(()=>{let b=x=>{if(!r)return;let w=x.key;Wc(x)?m("selectAll",""):hn.has(w)?m("press",x.key):[...w].length>1?m("keydown",x.key):m("type",x.key)},_=x=>{if(!r)return;let w=x.key;!hn.has(w)&&[...w].length>1&&m("keyup",x.key)};return t.registerRootListener((x,w)=>{w!==null&&(w.removeEventListener("keydown",b),w.removeEventListener("keyup",_)),x!==null&&(x.addEventListener("keydown",b),x.addEventListener("keyup",_))})},[t,r,m]),pn(()=>{d.current&&d.current.scrollTo(0,d.current.scrollHeight)},[p]),Oo(()=>{if(e){let b=p();b!==null&&s(b),d.current&&d.current.scrollTo(0,d.current.scrollHeight)}},[p,e]),Oo(()=>t.registerUpdateListener(({dirtyElements:_,dirtyLeaves:x,editorState:w})=>{if(!r)return;let v=w._selection,O=u.current,F=c.current;if(O!==v){if(x.size===0&&_.size===0&&!F){let E=Ao(t._window);if(E&&(E.anchorNode==null||E.focusNode==null))return}u.current=v}c.current=!1;let R=p();R!==null&&s(R)}),[t,p,r,m]),Oo(()=>r?t.registerUpdateListener(()=>{let _=t.getRootElement();_!==null&&l(_?.innerHTML)}):void 0,[t,r]);let f=ve(b=>{r||(b.update(()=>{let _=Hc();_.clear();let x=Bc();_.append(Pc().append(x)),x.select()}),o([])),n(_=>!_)},[r]),h=ve(()=>{if(!r)return;let b=Ao(t._window);if(b===null||b.anchorNode==null||b.focusNode==null)return;let{anchorNode:_,anchorOffset:x,focusNode:w,focusOffset:v}=Vc(b),O=a().getRootElement(),F;_!==null&&(F=fn(_,O));let R;w!==null&&(R=fn(w,O)),m("snapshot",{anchorNode:_,anchorOffset:x,anchorPath:F,focusNode:w,focusOffset:v,focusPath:R})},[m,r,a]),g=ve(()=>{jc(p())},[p]),k=ve(()=>{Uc("test.js",p())},[p]);return[Me("button",{className:`editor-dev-button ${r?"active":""}`,id:"test-recorder-button",onClick:b=>{f(a()),b.preventDefault()},title:r?"Disable test recorder":"Enable test recorder",type:"button",children:r?"Disable test recorder":"Enable test recorder"}),r?$o("div",{className:"test-recorder-output",children:[$o("div",{className:"test-recorder-toolbar",children:[Me("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:b=>{h(),b.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),Me("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:b=>{g(),b.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),Me("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:b=>{k(),b.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),Me("pre",{id:"test-recorder",ref:d,children:i})]}):null]}var xn=()=>{let t=Fc(3),[e]=$c(),[o,r]=Kc(e),n;return t[0]!==o||t[1]!==r?(n=$o(gn.Fragment,{children:[Me("p",{children:"HI"}),o,r,Me("p",{children:"DONE"})]}),t[0]=o,t[1]=r,t[2]=n):n=t[2],n};var Jc=y({plugins:[{Component:xn,position:"bottom"}]});import{c as Xc}from"react/compiler-runtime";import{jsx as zc}from"react/jsx-runtime";import{useLexicalComposerContext as Zc}from"@lexical/react/LexicalComposerContext.js";import{TreeView as Yc}from"@lexical/react/LexicalTreeView.js";import"react";var Cn=()=>{let t=Xc(2),[e]=Zc(),o;return t[0]!==e?(o=zc(Yc,{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 qc=y({plugins:[{Component:Cn,position:"bottom"}]});import{$isTableSelection as Qc}from"@lexical/table";import{$isRangeSelection as eu,FORMAT_TEXT_COMMAND as tu}from"lexical";import{jsx as bn}from"react/jsx-runtime";import"react";var kn=()=>bn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:bn("path",{d:"M10.6772 15H6.27017V5.718H10.4172C12.6792 5.718 13.8492 6.602 13.8492 8.292C13.8492 9.098 13.1992 9.982 12.4712 10.216C13.3812 10.476 14.1742 11.256 14.1742 12.322C14.1742 14.09 12.9002 15 10.6772 15ZM8.46717 9.501H10.3262C11.3012 9.501 11.7042 9.046 11.7042 8.409C11.7042 7.72 11.2362 7.317 10.3392 7.317H8.46717V9.501ZM8.46717 11.061V13.401H10.4822C11.4702 13.401 11.9642 12.959 11.9642 12.218C11.9642 11.49 11.4702 11.061 10.4822 11.061H8.46717Z",fill:"currentColor"})});var Y=t=>({type:"buttons",items:t,key:"format",order:40});var _n={type:"text-format",format:["bold","italic"],tag:"***"},Tn={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},wn={type:"text-format",format:["bold"],tag:"**"},En={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var Sn=[Y([{ChildComponent:kn,isActive:({selection:t})=>eu(t)||Qc(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(tu,"bold")},order:1}])],ou=y(({featureProviderMap:t})=>{let e=[wn,En];return t.get("italic")&&e.push(Tn,_n),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:Sn},toolbarInline:{groups:Sn}}});import{$isTableSelection as nu}from"@lexical/table";import{$isRangeSelection as lu,FORMAT_TEXT_COMMAND as iu}from"lexical";import{jsx as Nn,jsxs as ru}from"react/jsx-runtime";import"react";var Ln=()=>ru("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Nn("path",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),Nn("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var yn={type:"text-format",format:["code"],tag:"`"};var In=[Y([{ChildComponent:Ln,isActive:({selection:t})=>lu(t)||nu(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(iu,"code")},order:7}])],su=y({enableFormats:["code"],markdownTransformers:[yn],toolbarFixed:{groups:In},toolbarInline:{groups:In}});import{$isTableSelection as au}from"@lexical/table";import{$isRangeSelection as cu,FORMAT_TEXT_COMMAND as uu}from"lexical";import{jsx as Rn}from"react/jsx-runtime";import"react";var vn=()=>Rn("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:Rn("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 Mn={type:"text-format",format:["italic"],tag:"*"},Dn={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var An=[Y([{ChildComponent:vn,isActive:({selection:t})=>cu(t)||au(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(uu,"italic")},order:2}])],du=y({enableFormats:["italic"],markdownTransformers:[Mn,Dn],toolbarFixed:{groups:An},toolbarInline:{groups:An}});import{$isTableSelection as pu}from"@lexical/table";import{$isRangeSelection as fu,FORMAT_TEXT_COMMAND as hu}from"lexical";import{jsx as On,jsxs as mu}from"react/jsx-runtime";import"react";var Fn=()=>mu("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:[On("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"}),On("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var $n={type:"text-format",format:["strikethrough"],tag:"~~"};var Pn=[Y([{ChildComponent:Fn,isActive:({selection:t})=>fu(t)||pu(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(hu,"strikethrough")},order:4}])],gu=y({enableFormats:["strikethrough"],markdownTransformers:[$n],toolbarFixed:{groups:Pn},toolbarInline:{groups:Pn}});import{$isTableSelection as xu}from"@lexical/table";import{$isRangeSelection as Cu,FORMAT_TEXT_COMMAND as bu}from"lexical";import{jsx as Bn}from"react/jsx-runtime";import"react";var Hn=()=>Bn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Bn("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 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 jn=[Y([{ChildComponent:Hn,isActive:({selection:t})=>Cu(t)||xu(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(bu,"subscript")},order:5}])],ku=y({enableFormats:["subscript"],toolbarFixed:{groups:jn},toolbarInline:{groups:jn}});import{$isTableSelection as _u}from"@lexical/table";import{$isRangeSelection as Tu,FORMAT_TEXT_COMMAND as wu}from"lexical";import{jsx as Un}from"react/jsx-runtime";import"react";var Gn=()=>Un("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:Un("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 Wn=[Y([{ChildComponent:Gn,isActive:({selection:t})=>Tu(t)||_u(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(wu,"superscript")},order:6}])],Eu=y({enableFormats:["superscript"],toolbarFixed:{groups:Wn},toolbarInline:{groups:Wn}});import{$isTableSelection as Nu}from"@lexical/table";import{$isRangeSelection as Lu,FORMAT_TEXT_COMMAND as yu}from"lexical";import{jsx as Vn,jsxs as Su}from"react/jsx-runtime";import"react";var Kn=()=>Su("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:[Vn("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"}),Vn("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var Jn=[Y([{ChildComponent:Kn,isActive:({selection:t})=>Lu(t)||Nu(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(yu,"underline")},order:3}])],Iu=y({enableFormats:["underline"],toolbarFixed:{groups:Jn},toolbarInline:{groups:Jn}});import{jsx as Ho}from"react/jsx-runtime";import{jsx as Ru}from"react/jsx-runtime";function vu(t){return t.replace(/-([a-z])/g,(e,o)=>o.toUpperCase())}var Xt=({css:t})=>{let e=t?Object.fromEntries(Object.entries(t).map(([o,r])=>[vu(o),r])):{};return Ru("span",{style:{...e,alignItems:"center",borderRadius:"4px",display:"flex",fontSize:"16px",height:"20px",justifyContent:"center",width:"20px"},children:"A"})};import{useLexicalComposerContext as Mu}from"@lexical/react/LexicalComposerContext";import{$forEachSelectedTextNode as Du}from"@lexical/selection";import{$getNodeByKey as Au,$getState as Ou,$setState as Fu,createState as $u,TextNode as Pu}from"lexical";import{useEffect as Bu}from"react";var Po=new Map;function Xn(t){for(let e in t){let o=t[e],r=$u(e,{parse:n=>typeof n=="string"&&Object.keys(o).includes(n)?n:void 0});Po.set(e,{stateConfig:r,stateValues:o})}}function Bo(t,e,o){t.update(()=>{Du(r=>{let n=Po.get(e);if(!n)throw new Error(`State config for ${e} not found`);Fu(r,n.stateConfig,o)})})}function zn(){let[t]=Mu();return Bu(()=>t.registerMutationListener(Pu,e=>{t.getEditorState().read(()=>{for(let[o,r]of e){if(r==="destroyed")continue;let n=Au(o),l=t.getElementByKey(o);if(!n||!l)continue;let i=Object.create(null);Po.forEach((s,u)=>{let c=Ou(n,s.stateConfig);if(!c){delete l.dataset[u];return}l.dataset[u]=c;let d=s.stateValues[c]?.css;d&&Object.assign(i,d)}),l.style.cssText="",Object.assign(l.style,i)}})}),[t]),null}var Zn=t=>{let e=[];for(let r in t.state){let n=t.state[r];for(let l in n){let i=n[l];e.push({ChildComponent:()=>Ho(Xt,{css:i.css}),key:l,label:i.label,onSelect:({editor:s})=>{Bo(s,r,l)}})}}return[{type:"dropdown",ChildComponent:()=>Ho(Xt,{css:{color:"var(--theme-elevation-600)"}}),items:[...[{ChildComponent:()=>Ho(Xt,{}),key:"clear-style",label:({i18n:r})=>r.t("lexical:textState:defaultStyle"),onSelect:({editor:r})=>{for(let n in t.state)Bo(r,n,void 0)},order:1}],...e],key:"textState",order:30}]},Hu=y(({props:t})=>(Xn(t.state),{plugins:[{Component:zn,position:"normal"}],toolbarFixed:{groups:Zn(t)},toolbarInline:{groups:Zn(t)}}));import{c as Wu}from"react/compiler-runtime";import{useLexicalComposerContext as Vu}from"@lexical/react/LexicalComposerContext";import{$createHeadingNode as Ku,$isHeadingNode as ul,HeadingNode as pl}from"@lexical/rich-text";import{$setBlocksType as Ju}from"@lexical/selection";import{$getSelection as Xu,$isRangeSelection as zu}from"lexical";import{useEffect as Zu}from"react";import{jsx as Yn}from"react/jsx-runtime";import"react";var qn=()=>Yn("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:Yn("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 Qn}from"react/jsx-runtime";import"react";var el=()=>Qn("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:Qn("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 tl}from"react/jsx-runtime";import"react";var ol=()=>tl("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:tl("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 rl}from"react/jsx-runtime";import"react";var nl=()=>rl("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:rl("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 ll}from"react/jsx-runtime";import"react";var il=()=>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:ll("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 sl}from"react/jsx-runtime";import"react";var al=()=>sl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:sl("path",{d:"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 ju,$isHeadingNode as Uu,HeadingNode as Gu}from"@lexical/rich-text";var jo=t=>(e,o,r)=>{let n=t(r);n&&(n.append(...o),e.replace(n),n.select(0,0))};var cl=t=>{let o=`^(${t.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`,r=new RegExp(o);return{type:"element",dependencies:[Gu],export:(n,l)=>{if(!Uu(n))return null;let i=Number(n.getTag().slice(1));return"#".repeat(i)+" "+l(n)},regExp:r,replace:jo(n=>{let l="h"+n[1]?.length;return ju(l)})}};var dl=t=>{let e=Xu();Ju(e,()=>Ku(t))},ml={h1:qn,h2:el,h3:ol,h4:nl,h5:il,h6:al},Yu=y(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[Q(e.map((r,n)=>({ChildComponent:ml[r],isActive:({selection:l})=>{if(!zu(l))return!1;for(let i of l.getNodes()){if(ul(i)&&i.getTag()===r)continue;let s=i.getParent();if(!(ul(s)&&s.getTag()===r))return!1}return!0},key:r,label:({i18n:l})=>l.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:l})=>{l.update(()=>{dl(r)})},order:n+2})))];return{markdownTransformers:[cl(e)],nodes:[pl],plugins:[{Component:qu,position:"normal"}],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[Z(e.map(r=>({Icon:ml[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(()=>{dl(r)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}}),qu=t=>{let e=Wu(9),{clientProps:o}=t,{enabledHeadingSizes:r}=o,n;e[0]!==r?(n=r===void 0?["h1","h2","h3","h4","h5","h6"]:r,e[0]=r,e[1]=n):n=e[1];let l=n,i;e[2]!==l?(i=l.at(-1),e[2]=l,e[3]=i):i=e[3];let s=i,[u]=Vu(),c,d;return e[4]!==u||e[5]!==l||e[6]!==s?(c=()=>{if(!(!s||l.length===6))return u.registerNodeTransform(pl,a=>{l.includes(a.getTag())||a.setTag(s)})},d=[u,l,s],e[4]=u,e[5]=l,e[6]=s,e[7]=c,e[8]=d):(c=e[7],d=e[8]),Zu(c,d),null};import{$isNodeSelection as fd}from"lexical";import{jsx as fl}from"react/jsx-runtime";import"react";var Uo=()=>fl("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:fl("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as hl,jsxs as Qu}from"react/jsx-runtime";import"react";var gl=()=>Qu("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[hl("path",{d:"M5 10h10",stroke:"currentColor"}),hl("path",{d:"M10 15V5",stroke:"currentColor"})]});var fe=t=>({type:"dropdown",ChildComponent:gl,items:t,key:"add",order:10});import{addClassNamesToElement as ed}from"@lexical/utils";import{$applyNodeReplacement as td,createCommand as od,DecoratorNode as rd}from"lexical";var mt=od("INSERT_HORIZONTAL_RULE_COMMAND"),dt=class extends rd{static clone(e){return new this(e.__key)}static getType(){return"horizontalrule"}static importDOM(){return{hr:()=>({conversion:nd,priority:0})}}static importJSON(e){return xl()}createDOM(e){let o=document.createElement("hr");return ed(o,e.theme.hr),o}decorate(){return null}exportDOM(){return{element:document.createElement("hr")}}exportJSON(){return{type:"horizontalrule",version:1}}getTextContent(){return`
35
+ `}isInline(){return!1}updateDOM(){return!1}};function nd(){return{node:xl()}}function xl(){return td(new dt)}import{$applyNodeReplacement as ld}from"lexical";import"react";var Ne=class extends dt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return pt()}decorate(){return null}exportJSON(){return super.exportJSON()}};function pt(){return ld(new Ne)}function zt(t){return t instanceof Ne}var Cl={type:"element",dependencies:[Ne],export:(t,e)=>zt(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=pt();e&&t.replace(e)}};import{c as id}from"react/compiler-runtime";import{useLexicalComposerContext as sd}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as ad}from"@lexical/utils";import{$getSelection as cd,$isRangeSelection as ud,COMMAND_PRIORITY_EDITOR as dd}from"lexical";import{useEffect as md}from"react";var bl=()=>{let t=id(3),[e]=sd(),o,r;return t[0]!==e?(o=()=>e.registerCommand(mt,pd,dd),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),md(o,r),null};function pd(t){let e=cd();if(!ud(e))return!1;if(e.focus.getNode()!==null){let r=pt();ad(r)}return!0}var hd=y({markdownTransformers:[Cl],nodes:[Ne],plugins:[{Component:bl,position:"normal"}],slashMenu:{groups:[Z([{Icon:Uo,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(mt,void 0)}}])]},toolbarFixed:{groups:[fe([{ChildComponent:Uo,isActive:({selection:t})=>{if(!fd(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return zt(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(mt,void 0)}}])]}});import{$findMatchingParent as Il}from"@lexical/utils";import{$isElementNode as yd,INDENT_CONTENT_COMMAND as Id,OUTDENT_CONTENT_COMMAND as Rd}from"lexical";import{jsx as Zt,jsxs as gd}from"react/jsx-runtime";import"react";var kl=()=>gd("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Zt("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),Zt("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),Zt("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Zt("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as Yt,jsxs as xd}from"react/jsx-runtime";import"react";var _l=()=>xd("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:[Yt("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),Yt("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),Yt("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),Yt("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});import{jsx as Cd}from"react/jsx-runtime";import{useLexicalComposerContext as bd}from"@lexical/react/LexicalComposerContext";import{TabIndentationPlugin as kd}from"@lexical/react/LexicalTabIndentationPlugin";import{$findMatchingParent as _d,mergeRegister as Tl}from"@lexical/utils";import{$getSelection as Td,$isElementNode as Nl,$isRangeSelection as wd,COMMAND_PRIORITY_LOW as wl,INDENT_CONTENT_COMMAND as El,KEY_TAB_COMMAND as Ed,OUTDENT_CONTENT_COMMAND as Sd,TabNode as Nd}from"lexical";import{useEffect as Sl}from"react";var Ll=({clientProps:t})=>{let[e]=bd(),{disabledNodes:o,disableTabNode:r}=t;return Sl(()=>{if(!(!e||!o?.length))return Tl(e.registerCommand(El,()=>Ld(n=>{if(!o.includes(n.getType())){let l=n.getIndent();n.setIndent(l+1)}}),wl),e.registerUpdateListener(({dirtyElements:n,editorState:l})=>{e.update(()=>{for(let[i]of n){let s=l._nodeMap.get(i);Nl(s)&&o.includes(s.getType())&&s.getIndent()>0&&s.setIndent(0)}})}))},[e,o]),Sl(()=>{if(!(!e||!r))return Tl(e.registerCommand(Ed,n=>(n.preventDefault(),e.dispatchCommand(n.shiftKey?Sd:El,void 0)),wl),e.registerNodeTransform(Nd,n=>{n.remove()}))},[e,r]),Cd(kd,{})};function Ld(t){let e=Td();if(!wd(e))return!1;let o=new Set,r=e.getNodes();for(let n=0;n<r.length;n++){let l=r[n],i=l.getKey();if(o.has(i))continue;let s=_d(l,c=>Nl(c)&&!c.isInline());if(s===null)continue;let u=s.getKey();s.canIndent()&&!o.has(u)&&(o.add(u),t(s))}return o.size>0}var yl=t=>({type:"buttons",items:t,key:"indent",order:35});var Rl=({disabledNodes:t})=>[yl([{ChildComponent:kl,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>vl(n)&&n.getIndent()>0;return o.some(n=>r(n)||!!Il(n,r))},key:"indentDecrease",label:({i18n:e})=>e.t("lexical:indent:decreaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Rd,void 0)},order:1},{ChildComponent:_l,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>vl(n)&&!(t??[]).includes(n.getType());return o.some(n=>r(n)||!!Il(n,r))},key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Id,void 0)},order:2}])],vd=y(({props:t})=>{let e=t.disabledNodes??[];return{plugins:[{Component:Ll,position:"normal"}],sanitizedClientFeatureProps:t,toolbarFixed:{groups:Rl({disabledNodes:e})},toolbarInline:{groups:Rl({disabledNodes:e})}}}),vl=t=>yd(t)&&t.canIndent();import{$findMatchingParent as Gm}from"@lexical/utils";import{$getSelection as Yo,$isRangeSelection as ai}from"lexical";import{jsx as Ml}from"react/jsx-runtime";import"react";var Dl=()=>Ml("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:Ml("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 Al}from"@lexical/selection";function Ve(t){let{anchor:e}=t,{focus:o}=t,r=t.anchor.getNode(),n=t.focus.getNode();return r===n?r:t.isBackward()?Al(o)?r:n:Al(e)?r:n}var Go=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as Ud}from"lexical";import{addClassNamesToElement as Md,isHTMLAnchorElement as Dd}from"@lexical/utils";import Ko from"bson-objectid";import{$applyNodeReplacement as Ad,$createTextNode as Ol,$getSelection as Od,$isElementNode as Fl,$isRangeSelection as Vo,createCommand as Fd,ElementNode as $d}from"lexical";var Pd=new Set(["http:","https:","mailto:","sms:","tel:"]),ee=class t extends $d{__fields;__id;constructor({id:e,fields:o={linkType:"custom",newTab:!1},key:r}){super(r),this.__fields=o,this.__id=e}static clone(e){return new t({id:e.__id,fields:e.__fields,key:e.__key})}static getType(){return"link"}static importDOM(){return{a:e=>({conversion:Bd,priority:1})}}static importJSON(e){let o=he({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),e.version===2&&!e.id&&(e.id=new Ko.default().toHexString(),e.version=3),o}canBeEmpty(){return!1}canInsertTextAfter(){return!1}canInsertTextBefore(){return!1}createDOM(e){let o=document.createElement("a");return this.__fields?.linkType==="custom"&&(o.href=this.sanitizeUrl(this.__fields.url??"")),(this.__fields?.newTab??!1)&&(o.target="_blank"),this.__fields?.newTab===!0&&this.__fields?.linkType==="custom"&&(o.rel=Wo(o.rel,"add","noopener")),Md(o,e.theme.link),o}exportJSON(){let e=this.getFields();e?.linkType==="internal"?delete e.url:e?.linkType==="custom"&&delete e.doc;let o={...super.exportJSON(),type:"link",fields:e,version:3},r=this.getID();return r&&(o.id=r),o}extractWithChild(e,o,r){if(!Vo(o))return!1;let n=o.anchor.getNode(),l=o.focus.getNode();return this.isParentOf(n)&&this.isParentOf(l)&&o.getTextContent().length>0}getFields(){return this.getLatest().__fields}getID(){return this.getLatest().__id}insertNewAfter(e,o=!0){let r=this.getParentOrThrow().insertNewAfter(e,o);if(Fl(r)){let n=he({fields:this.__fields});return r.append(n),n}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!Pd.has(o.protocol))return"about:blank"}catch{return"https://"}return e}setFields(e){let o=this.getWritable();return o.__fields=e,o}setID(e){let o=this.getWritable();return o.__id=e,o}updateDOM(e,o,r){let n=this.__fields?.url,l=this.__fields?.newTab;return n!=null&&n!==e.__fields?.url&&this.__fields?.linkType==="custom"&&(o.href=n),this.__fields?.linkType==="internal"&&e.__fields?.linkType==="custom"&&o.removeAttribute("href"),o.rel==null&&(o.rel=""),l!==e.__fields?.newTab&&(l??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=Wo(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=Wo(o.rel,"remove","noopener"))),!1}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields).setID(e.id)}};function Bd(t){let e=null;if(Dd(t)){let o=t.textContent;o!==null&&o!==""&&(e=he({id:new Ko.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function he({id:t,fields:e}){return Ad(new ee({id:t??new Ko.default().toHexString(),fields:e}))}function J(t){return t instanceof ee}var ae=Fd("TOGGLE_LINK_COMMAND");function Jo(t){let e=Od();if(!Vo(e)&&(t===null||!t.selectedNodes?.length))return;let o=Vo(e)?e.extract():t===null?[]:t.selectedNodes;if(t===null){o?.forEach(l=>{let i=l.getParent();J(i)&&(i.getChildren().forEach(u=>{i.insertBefore(u)}),i.remove())});return}if(o?.length===1){let l=o[0],i=J(l)?l:Hd(l);if(i!==null){i.setFields(t.fields),t.text!=null&&t.text!==i.getTextContent()&&(i.append(Ol(t.text)),i.getChildren().forEach(s=>{s!==i.getLastChild()&&s.remove()}));return}}let r=null,n=null;o?.forEach(l=>{let i=l.getParent();if(!(i===n||i===null||Fl(l)&&!l.isInline())){if(J(i)){n=i,i.setFields(t.fields),t.text!=null&&t.text!==i.getTextContent()&&(i.append(Ol(t.text)),i.getChildren().forEach(s=>{s!==i.getLastChild()&&s.remove()}));return}if(i.is(r)||(r=i,n=he({fields:t.fields}),J(i)?l.getPreviousSibling()===null?i.insertBefore(n):i.insertAfter(n):l.insertBefore(n)),J(l)){if(l.is(n))return;if(n!==null){let s=l.getChildren();n.append(...s)}l.remove();return}n!==null&&n.append(l)}})}function Hd(t){return jd(t,e=>J(e))}function jd(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function Wo(t,e,o){let r,n=`${t}`;if(e==="add"){if(n.includes(o)){let l=new RegExp(o,"g");n=n.replace(l,"").trim()}n=n.trim(),r=n.length===0?`${o}`:`${n} ${o}`}else{let l=new RegExp(o,"g");r=n.replace(l,"").trim()}return r}var $l={type:"text-match",dependencies:[ee],export:(t,e)=>{if(!J(t))return null;let o=t,{url:r}=o.getFields();return`[${e(o)}](${r})`},importRegExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:(t,e)=>{let[,o,r]=e,n=he({fields:{doc:null,linkType:"custom",newTab:!1,url:r}}),l=Ud(o);return l.setFormat(t.getFormat()),n.append(l),t.replace(n),l},trigger:")"};import{$applyNodeReplacement as Gd,$isElementNode as Wd}from"lexical";var ge=class t extends ee{static clone(e){return new t({id:"",fields:e.__fields,key:e.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(e){let o=ft({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),o}exportJSON(){let e=super.exportJSON();return{type:"autolink",children:e.children,direction:e.direction,fields:e.fields,format:e.format,indent:e.indent,version:2}}insertNewAfter(e,o=!0){let r=this.getParentOrThrow().insertNewAfter(e,o);if(Wd(r)){let n=ft({fields:this.__fields});return r.append(n),n}return null}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields)}};function ft({fields:t}){return Gd(new ge({id:"",fields:t}))}function xe(t){return t instanceof ge}import{c as Vd}from"react/compiler-runtime";import{useLexicalComposerContext as Kd}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Jd}from"@lexical/utils";import{$createTextNode as Pl,$getSelection as Xd,$isElementNode as Hl,$isLineBreakNode as jl,$isNodeSelection as zd,$isRangeSelection as Zd,$isTextNode as ht,TextNode as Yd}from"lexical";import{useEffect as qd}from"react";function Bl(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 Ul(t,e){for(let o of e){let r=o(t);if(r!=null)return r}return null}var Qd=/[.,;\s]/;function Qt(t){return t!==void 0&&Qd.test(t)}function Gl(t){return Qt(t[t.length-1])}function zo(t){return Qt(t[0])}function em(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function Wl(t){let e=t.getPreviousSibling();return Hl(e)&&(e=e.getLastDescendant()),e===null||jl(e)||ht(e)&&Gl(e.getTextContent())}function Vl(t){let e=t.getNextSibling();return Hl(e)&&(e=e.getFirstDescendant()),e===null||jl(e)||ht(e)&&zo(e.getTextContent())}function tm(t,e,o,r){return(t>0?Qt(o[t-1]):Wl(r[0]))?e<o.length?Qt(o[e]):Vl(r[r.length-1]):!1}function om(t,e,o){let r=[],n=[],l=[],i=0,s=0,u=[...t];for(;u.length>0;){let c=u[0],a=c.getTextContent().length,p=s;s+a<=e?(r.push(c),i+=a):p>=o?l.push(c):n.push(c),s+=a,u.shift()}return[i,r,n,l]}function rm(t,e,o,r){let n={linkType:"custom",url:r.url,...r.fields},l=ft({fields:n});if(t.length===1){let i=t[0],s;if(e===0?[s]=i.splitText(o):[,s]=i.splitText(e,o),s){let u=Pl(r.text);u.setFormat(s.getFormat()),u.setDetail(s.getDetail()),u.setStyle(s.getStyle()),l.append(u),s.replace(l)}return i}else if(t.length>1){let i=t[0],s=i.getTextContent().length,u;e===0?u=i:[,u]=i.splitText(e);let c=[],d;if(t.forEach(a=>{let m=a.getTextContent().length,f=s,h=s+m;if(f<o)if(h<=o)c.push(a);else{let[g,k]=a.splitText(o-f);g&&c.push(g),d=k}s+=m}),u){let a=Xd(),p=a?a.getNodes().find(ht):void 0,m=Pl(u.getTextContent());return m.setFormat(u.getFormat()),m.setDetail(u.getDetail()),m.setStyle(u.getStyle()),l.append(m,...c),p&&p===u&&(Zd(a)?m.select(a.anchor.offset,a.focus.offset):zd(a)&&m.select(0,m.getTextContent().length)),u.replace(l),d}}}function nm(t,e,o){let r=[...t],n=r.map(u=>u.getTextContent()).join(""),l=n,i,s=0;for(;(i=Ul(l,e))!=null&&i!==null;){let u=i.index,c=i.length,d=u+c;if(tm(s+u,s+d,n,r)){let[p,,m,f]=om(r,s+u,s+d),h=s+u-p,g=s+d-p,k=rm(m,h,g,i);r=k?[k,...f]:f,o(i.url,null),s=0}else s+=d;l=l.substring(d)}}function Xo(t,e,o){let r=t.getChildren(),n=r.length;for(let u=0;u<n;u++){let c=r[u];if(!ht(c)||!c.isSimpleText()){qt(t),o(null,t.getFields()?.url??null);return}}let l=t.getTextContent(),i=Ul(l,e);if(i===null||i.text!==l){qt(t),o(null,t.getFields()?.url??null);return}if(!Wl(t)||!Vl(t)){qt(t),o(null,t.getFields()?.url??null);return}let s=t.getFields()?.url;if(s!==i?.url){let u=t.getFields();u.url=i?.url,t.setFields(u),o(i.url,s??null)}}function lm(t,e,o){let r=t.getPreviousSibling(),n=t.getNextSibling(),l=t.getTextContent();if(xe(r)){let i=r.getFields()?.url?r.getFields()?.url?.startsWith("mailto:")??!1:!1;(!zo(l)||em(l,i))&&(r.append(t),Xo(r,e,o),o(null,r.getFields()?.url??null))}xe(n)&&!Gl(l)&&(qt(n),Xo(n,e,o),o(null,n.getFields()?.url??null))}function qt(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 im(t){let e=[t],o=t.getNextSibling();for(;o!==null&&ht(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function sm(t,e,o){let r=Vd(5),n,l;r[0]!==t||r[1]!==e||r[2]!==o?(n=()=>{if(!t.hasNodes([ge]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let i=(s,u)=>{o?.(s,u)};return Jd(t.registerNodeTransform(Yd,s=>{let u=s.getParentOrThrow(),c=s.getPreviousSibling();if(xe(u))Xo(u,e,i);else if(!J(u)){if(s.isSimpleText()&&(zo(s.getTextContent())||!xe(c))){let d=im(s);nm(d,e,i)}lm(s,e,i)}}))},l=[t,e,o],r[0]=t,r[1]=e,r[2]=o,r[3]=n,r[4]=l):(n=r[3],l=r[4]),qd(n,l)}var am=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,cm=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,um=[Bl(am,t=>t.startsWith("http")?t:`https://${t}`),Bl(cm,t=>`mailto:${t}`)],Kl=()=>{let[t]=Kd();return sm(t,um),null};import{jsx as dm}from"react/jsx-runtime";import{ClickableLinkPlugin as mm}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var Jl=()=>dm(mm,{});import{jsx as Rm}from"react/jsx-runtime";import"react";import{createPortal as vm}from"react-dom";import{jsx as Ce,jsxs as gt,Fragment as fm}from"react/jsx-runtime";import{useLexicalComposerContext as hm}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as Xl,mergeRegister as zl}from"@lexical/utils";import{getTranslation as Zo}from"@payloadcms/translations";import{CloseMenuIcon as gm,EditIcon as xm,ExternalLinkIcon as Zl,formatDrawerSlug as Cm,useConfig as bm,useEditDepth as km,useLocale as _m,useTranslation as Tm}from"@payloadcms/ui";import{requests as wm}from"@payloadcms/ui/shared";import{$getSelection as Yl,$isLineBreakNode as Em,$isRangeSelection as ql,COMMAND_PRIORITY_HIGH as Sm,COMMAND_PRIORITY_LOW as Ql,getDOMSelection as Nm,KEY_ESCAPE_COMMAND as Lm,SELECTION_CHANGE_COMMAND as ym}from"lexical";import ei,{useCallback as ti,useEffect as oo,useRef as Im,useState as De}from"react";function eo(t,e,o,r=10,n=5){let l=o.parentElement;if(t===null||l==null){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let i=e.getBoundingClientRect(),s=o.getBoundingClientRect(),u=l.getBoundingClientRect(),c=t.top-r,d=t.left-n;c<u.top&&(c+=i.height+t.height+r*2),d+i.width>u.right&&(d=u.right-i.width-n),c-=s.top,d-=s.left,e.style.opacity="1",e.style.transform=`translate(${d}px, ${c}px)`}import{createCommand as pm}from"lexical";var to=pm("TOGGLE_LINK_WITH_MODAL_COMMAND");function oi(t){t.preventDefault()}function ri({anchorElem:t}){let[e]=hm(),[o,r]=De(),n=Im(null),[l,i]=De(null),[s,u]=De(null),{fieldProps:{schemaPath:c},uuid:d}=H(),{config:a,getEntityConfig:p}=bm(),{i18n:m,t:f}=Tm(),[h,g]=De(),k=km(),[T,I]=De(!1),[b,_]=De([]),x=_m(),[w,v]=De(!1),O=Cm({slug:"lexical-rich-text-link-"+d,depth:k}),{toggleDrawer:F}=de(O),R=ti(()=>{I(!1),n&&n.current&&(n.current.style.opacity="0",n.current.style.transform="translate(-10000px, -10000px)"),v(!1),i(null),u(null),_([]),g(void 0)},[I,i,u,_]),E=ti(()=>{let C=Yl(),S;if(!ql(C)||!C){R();return}let M=Ve(C);S=e.getElementByKey(M.getKey())?.getBoundingClientRect();let L=Xl(M,J),D=C.getNodes().filter(X=>!Em(X)).find(X=>{let U=Xl(X,J);return L&&!L.is(U)||U&&!U.is(L)});if(L==null||D){R();return}r(L);let N=L.getFields(),$={...N,id:L.getID(),text:L.getTextContent()};if(N?.linkType==="custom")i(N?.url??null),u(null);else{i(`${a.routes.admin==="/"?"":a.routes.admin}/collections/${N?.doc?.relationTo}/${N?.doc?.value}`);let X=N?.doc?.relationTo?p({collectionSlug:N?.doc?.relationTo}):void 0;if(!X)u(N?.label?String(N?.label):null),i(N?.url?String(N?.url):null);else{let U=typeof N.doc?.value=="object"?N.doc.value.id:N.doc?.value,Be=N.doc?.relationTo;if(!U||!Be)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let we=f("fields:linkedTo",{label:`${Zo(X.labels.singular,m)} - ${f("lexical:link:loadingWithEllipsis",m)}`}).replace(/<[^>]*>?/g,"");u(we),wm.get(`${a.serverURL}${a.routes.api}/${Be}/${U}`,{headers:{"Accept-Language":m.language},params:{depth:0,locale:x?.code}}).then(async ue=>{if(!ue.ok)throw new Error(`HTTP error! Status: ${ue.status}`);let vt=await ue.json(),Ee=X?.admin?.useAsTitle||"id",Mt=vt[Ee],He=f("fields:linkedTo",{label:`${Zo(X.labels.singular,m)} - ${Mt}`}).replace(/<[^>]*>?/g,"");u(He)}).catch(()=>{let ue=f("fields:linkedTo",{label:`${Zo(X.labels.singular,m)} - ${f("general:untitled",m)} - ID: ${U}`}).replace(/<[^>]*>?/g,"");u(ue)})}}g($),I(!0),_(C?C?.getNodes():[]),xe(L)?v(!0):v(!1);let G=n.current,q=Nm(e._window),{activeElement:te}=document;if(G===null)return;let Rt=e.getRootElement();return q!==null&&Rt!==null&&Rt.contains(q.anchorNode)?(S||(S=q.getRangeAt(0).getBoundingClientRect()),S!=null&&(S.y+=40,eo(S,G,t))):(te==null||te.className!=="link-input")&&(Rt!==null&&eo(null,G,t),i(null),u(null)),!0},[e,R,a.routes.admin,a.routes.api,a.serverURL,p,f,m,x?.code,t]);return oo(()=>zl(e.registerCommand(to,C=>(e.dispatchCommand(ae,C),E(),F(),!0),Ql)),[e,E,F,O]),oo(()=>{let C=t.parentElement,S=()=>{e.getEditorState().read(()=>{E()})};return window.addEventListener("resize",S),C?.addEventListener("scroll",S),()=>{window.removeEventListener("resize",S),C?.removeEventListener("scroll",S)}},[t.parentElement,e,E]),oo(()=>zl(e.registerUpdateListener(({editorState:C})=>{C.read(()=>{E()})}),e.registerCommand(ym,()=>(E(),!0),Ql),e.registerCommand(Lm,()=>T?(R(),!0):!1,Sm)),[e,E,T,R]),oo(()=>{e.getEditorState().read(()=>{E()})},[e,E]),gt(ei.Fragment,{children:[Ce("div",{className:"link-editor",ref:n,children:gt("div",{className:"link-input",children:[l&&l.length>0?gt("a",{href:l,rel:"noopener noreferrer",target:"_blank",children:[o?.__fields.newTab?Ce(Zl,{}):null,s!=null&&s.length>0?s:l]}):s!=null&&s.length>0?gt(fm,{children:[o?.__fields.newTab?Ce(Zl,{}):null,Ce("span",{className:"link-input__label-pure",children:s})]}):null,e.isEditable()&&gt(ei.Fragment,{children:[Ce("button",{"aria-label":"Edit link",className:"link-edit",onClick:C=>{C.preventDefault(),F()},onMouseDown:oi,tabIndex:0,type:"button",children:Ce(xm,{})}),!w&&Ce("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(ae,null)},onMouseDown:oi,tabIndex:0,type:"button",children:Ce(gm,{})})]})]})}),Ce(rt,{className:"lexical-link-edit-drawer",data:h,drawerSlug:O,drawerTitle:f("fields:editLink"),featureKey:"link",handleDrawerSubmit:(C,S)=>{let M=S,L={...M};delete L.text,e.update(()=>{let D=Yl(),N=null;if(ql(D)?N=Ve(D).getParent():b.length&&(N=b[0]?.getParent()??null),N&&xe(N)){let $=he({fields:L});N.replace($,!0)}}),e.dispatchCommand(ae,{fields:L,selectedNodes:b,text:M.text})},schemaPath:c,schemaPathSuffix:"fields"})]})}var ni=t=>{let{anchorElem:e=document.body}=t;return vm(Rm(ri,{anchorElem:e}),e)};import{c as Am}from"react/compiler-runtime";import{useLexicalComposerContext as Om}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Fm}from"@lexical/utils";import{$getSelection as $m,$isElementNode as Pm,$isRangeSelection as Bm,COMMAND_PRIORITY_LOW as ii,PASTE_COMMAND as Hm}from"lexical";import{useEffect as jm}from"react";var Mm=/^(?:[a-zA-Z][a-zA-Z\d+.-]*:(?:\/\/)?(?:[-;:&=+$,\w]+@)?[A-Za-z\d]+(?:\.[A-Za-z\d]+)+|www\.[A-Za-z\d]+(?:\.[A-Za-z\d]+)+|(?:tel|mailto):[\w+.-]+)(?:\/[+~%/\w-]*)?(?:\?[-;&=%\w]*)?(?:#\w+)?$/,Dm=/^(?:\/[\w\-./]*(?:#\w[\w-]*)?|#[\w\-]+)$/;function li(t){if(!t)return!1;if(t==="https://"||Mm.test(t)||Dm.test(t))return!0;try{return new URL(t),!0}catch{}return!1}var si=t=>{let e=Am(5),{clientProps:o}=t,[r]=Om(),n,l;return e[0]!==o.defaultLinkType||e[1]!==o.defaultLinkURL||e[2]!==r?(n=()=>{if(!r.hasNodes([ee]))throw new Error("LinkPlugin: LinkNode not registered on editor");return Fm(r.registerCommand(ae,i=>i===null?(Jo(null),!0):(i.fields?.linkType||(i.fields.linkType=o.defaultLinkType),i.fields?.url||(i.fields.url=o.defaultLinkURL),Jo(i),!0),ii),r.registerCommand(Hm,i=>{let s=$m();if(!Bm(s)||s.isCollapsed()||!(i instanceof ClipboardEvent)||i.clipboardData==null)return!1;let u=i.clipboardData.getData("text");if(!li(u))return!1;if(!s.getNodes().some(Um)){let c={doc:null,linkType:"custom",newTab:!1,url:u};return r.dispatchCommand(ae,{fields:c,text:null}),i.preventDefault(),!0}return!1},ii))},l=[o.defaultLinkType,o.defaultLinkURL,r],e[0]=o.defaultLinkType,e[1]=o.defaultLinkURL,e[2]=r,e[3]=n,e[4]=l):(n=e[3],l=e[4]),jm(n,l),null};function Um(t){return Pm(t)}var ci=[Go([{ChildComponent:Dl,isActive:({selection:t})=>{if(ai(t)){let e=Ve(t);return Gm(e,J)!=null}return!1},isEnabled:({selection:t})=>!!(ai(t)&&Yo()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(ae,null);else{let o,r=[];if(t.getEditorState().read(()=>{o=Yo()?.getTextContent(),r=Yo()?.getNodes()??[]}),!o?.length)return;let n={doc:null};t.dispatchCommand(to,{fields:n,selectedNodes:r,text:o})}},order:1}])],Wm=y(({props:t})=>({markdownTransformers:[$l],nodes:[ee,t?.disableAutoLinks===!0?null:ge].filter(Boolean),plugins:[{Component:si,position:"normal"},t?.disableAutoLinks===!0||t?.disableAutoLinks==="creationOnly"?null:{Component:Kl,position:"normal"},{Component:Jl,position:"normal"},{Component:ni,position:"floatingAnchorElem"}].filter(Boolean),sanitizedClientFeatureProps:t,toolbarFixed:{groups:ci},toolbarInline:{groups:ci}}));import{$isListNode as er,INSERT_CHECK_LIST_COMMAND as hi,ListItemNode as op,ListNode as rp}from"@lexical/list";import{$isRangeSelection as np}from"lexical";import{jsx as ui,jsxs as Vm}from"react/jsx-runtime";import"react";var qo=()=>Vm("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:[ui("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),ui("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Km}from"react/jsx-runtime";import{ListPlugin as Jm}from"@lexical/react/LexicalListPlugin.js";import"react";var Ke=()=>Km(Jm,{});function Je(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as Ym,ListItemNode as qm,ListNode as Qm}from"@lexical/list";import{$createListItemNode as Xm,$createListNode as zm,$isListItemNode as Zm,$isListNode as Qo}from"@lexical/list";var di=4,Xe=t=>(e,o,r)=>{let n=e.getPreviousSibling(),l=e.getNextSibling(),i=Xm(t==="check"?r[3]==="x":void 0);if(Qo(l)&&l.getListType()===t){let u=l.getFirstChild();u!==null?u.insertBefore(i):l.append(i),e.remove()}else if(Qo(n)&&n.getListType()===t)n.append(i),e.remove();else{let u=zm(t,t==="number"?Number(r[2]):void 0);u.append(i),e.replace(u)}i.append(...o),i.select(0,0);let s=Math.floor(r[1].length/di);s&&i.setIndent(s)},Ae=(t,e,o)=>{let r=[],n=t.getChildren(),l=0;for(let i of n)if(Zm(i)){if(i.getChildrenSize()===1){let d=i.getFirstChild();if(Qo(d)){r.push(Ae(d,e,o+1));continue}}let s=" ".repeat(o*di),u=t.getListType(),c=u==="number"?`${t.getStart()+l}. `:u==="check"?`- [${i.getChecked()?"x":" "}] `:"- ";r.push(s+c+e(i)),l++}return r.join(`
36
+ `)};var mi={type:"element",dependencies:[Qm,qm],export:(t,e)=>Ym(t)?Ae(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:Xe("check")};import{jsx as ep}from"react/jsx-runtime";import{CheckListPlugin as tp}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var pi=()=>ep(tp,{});var fi=[Q([{ChildComponent:qo,isActive:({selection:t})=>{if(!np(t))return!1;for(let e of t.getNodes()){if(er(e)&&e.getListType()==="check")continue;let o=e.getParent();if(er(o)&&o.getListType()==="check")continue;let r=o?.getParent();if(!(er(r)&&r.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(hi,void 0)},order:12}])],lp=y(({featureProviderMap:t})=>{let e=[{Component:pi,position:"normal"}];return!t.has("unorderedList")&&!t.has("orderedList")&&e.push({Component:Ke,position:"normal"}),{markdownTransformers:[mi],nodes:t.has("unorderedList")||t.has("orderedList")?[]:[rp,op],plugins:e,slashMenu:{groups:[Je([{Icon:qo,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:o})=>o.t("lexical:checklist:label"),onSelect:({editor:o})=>{o.dispatchCommand(hi,void 0)}}])]},toolbarFixed:{groups:fi},toolbarInline:{groups:fi}}});import{$isListNode as or,INSERT_ORDERED_LIST_COMMAND as Ci,ListItemNode as up,ListNode as dp}from"@lexical/list";import{$isRangeSelection as mp}from"lexical";import{jsx as xt,jsxs as ip}from"react/jsx-runtime";import"react";var tr=()=>ip("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:[xt("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"}),xt("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"}),xt("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),xt("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),xt("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as sp,ListItemNode as ap,ListNode as cp}from"@lexical/list";var gi={type:"element",dependencies:[cp,ap],export:(t,e)=>sp(t)?Ae(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:Xe("number")};var xi=[Q([{ChildComponent:tr,isActive:({selection:t})=>{if(!mp(t))return!1;for(let e of t.getNodes()){if(or(e)&&e.getListType()==="number")continue;let o=e.getParent();if(or(o)&&o.getListType()==="number")continue;let r=o?.getParent();if(!(or(r)&&r.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ci,void 0)},order:10}])],pp=y(({featureProviderMap:t})=>({markdownTransformers:[gi],nodes:t.has("orderedList")?[]:[dp,up],plugins:t.has("orderedList")?[]:[{Component:Ke,position:"normal"}],slashMenu:{groups:[Je([{Icon:tr,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:e})=>e.t("lexical:orderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(Ci,void 0)}}])]},toolbarFixed:{groups:xi},toolbarInline:{groups:xi}}));import{$isListNode as nr,INSERT_UNORDERED_LIST_COMMAND as _i,ListItemNode as Cp,ListNode as bp}from"@lexical/list";import{$isRangeSelection as kp}from"lexical";import{jsx as ze,jsxs as fp}from"react/jsx-runtime";import"react";var rr=()=>fp("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:[ze("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),ze("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),ze("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),ze("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),ze("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),ze("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as hp,ListItemNode as gp,ListNode as xp}from"@lexical/list";var bi={type:"element",dependencies:[xp,gp],export:(t,e)=>hp(t)?Ae(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:Xe("bullet")};var ki=[Q([{ChildComponent:rr,isActive:({selection:t})=>{if(!kp(t))return!1;for(let e of t.getNodes()){if(nr(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(nr(o)&&o.getListType()==="bullet")continue;let r=o?.getParent();if(!(nr(r)&&r.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(_i,void 0)},order:11}])],_p=y({markdownTransformers:[bi],nodes:[bp,Cp],plugins:[{Component:Ke,position:"normal"}],slashMenu:{groups:[Je([{Icon:rr,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(_i,void 0)}}])]},toolbarFixed:{groups:ki},toolbarInline:{groups:ki}});import{jsx as Tp}from"react/jsx-runtime";import{addClassNamesToElement as wp}from"@lexical/utils";import{DecoratorNode as Ep}from"lexical";import*as Ti from"react";var Sp=Ti.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),Ct=class t extends Ep{__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 Np({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return wp(o,"unknownConverted"),o}decorate(){return Tp(Sp,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function Np({data:t}){return new Ct({data:t})}var Lp=y(()=>({nodes:[Ct]}));import{jsx as yp}from"react/jsx-runtime";import{addClassNamesToElement as Ip}from"@lexical/utils";import{DecoratorNode as Rp}from"lexical";import*as wi from"react";var vp=wi.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),bt=class t extends Rp{__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 Mp({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return Ip(o,"unknownConverted"),o}decorate(){return yp(vp,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function Mp({data:t}){return new bt({data:t})}var Dp=y(()=>({nodes:[bt]}));import{$setBlocksType as Ni}from"@lexical/selection";import{$createParagraphNode as Li,$getSelection as yi,$isParagraphNode as Ei,$isRangeSelection as Ap}from"lexical";var Si=[Q([{ChildComponent:lt,isActive:({selection:t})=>{if(!Ap(t))return!1;for(let e of t.getNodes())if(!Ei(e)&&!Ei(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=yi();Ni(e,()=>Li())})},order:1}])],Op=y({slashMenu:{groups:[Z([{Icon:lt,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=yi();Ni(e,()=>Li())})}}])]},toolbarFixed:{groups:Si},toolbarInline:{groups:Si}});import{c as of}from"react/compiler-runtime";import{jsx as Xi}from"react/jsx-runtime";import{useLexicalComposerContext as rf}from"@lexical/react/LexicalComposerContext";import{useEffect as nf,useState as lf}from"react";import{jsx as Ji,Fragment as tf}from"react/jsx-runtime";import"react";import{jsx as Fp}from"react/jsx-runtime";var Ii={quote:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return Fp("blockquote",{children:o})}};import{jsx as $p}from"react/jsx-runtime";var Ri={heading:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.tag;return $p(r,{children:o})}};import{jsx as Pp}from"react/jsx-runtime";var vi={horizontalrule:Pp("hr",{})};import{jsx as Bp}from"react/jsx-runtime";var Mi={linebreak:Bp("br",{})};import{jsx as Di}from"react/jsx-runtime";var Ai=({internalDocToHref:t})=>({autolink:({node:e,nodesToJSX:o})=>{let r=o({nodes:e.children}),n=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0;return Di("a",{href:e.fields.url,rel:n,target:l,children:r})},link:({node:e,nodesToJSX:o})=>{let r=o({nodes:e.children}),n=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0,i=e.fields.url??"";return e.fields.linkType==="internal"&&(t?i=t({linkNode:e}):(console.error("Lexical => JSX converter: Link converter: found internal link, but internalDocToHref is not provided"),i="#")),Di("a",{href:i,rel:n,target:l,children:r})}});import{jsx as Ze,jsxs as Hp,Fragment as jp}from"react/jsx-runtime";import{v4 as Up}from"uuid";var Oi={list:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.tag;return Ze(r,{className:`list-${t?.listType}`,children:o})},listitem:({node:t,nodesToJSX:e,parent:o})=>{let r=t.children.some(l=>l.type==="list"),n=e({nodes:t.children});if("listType"in o&&o?.listType==="check"){let l=Up();return Ze("li",{"aria-checked":t.checked?"true":"false",className:`list-item-checkbox${t.checked?" list-item-checkbox-checked":" list-item-checkbox-unchecked"}${r?" nestedListItem":""}`,role:"checkbox",style:{listStyleType:"none"},tabIndex:-1,value:t?.value,children:r?n:Hp(jp,{children:[Ze("input",{checked:t.checked,id:l,readOnly:!0,type:"checkbox"}),Ze("label",{htmlFor:l,children:n}),Ze("br",{})]})})}else return Ze("li",{className:`${r?"nestedListItem":""}`,style:r?{listStyleType:"none"}:void 0,value:t?.value,children:n})}};import{jsx as lr}from"react/jsx-runtime";var Fi={paragraph:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return o?.length?lr("p",{children:o}):lr("p",{children:lr("br",{})})}};var $i={tab:" "};import{jsx as kt}from"react/jsx-runtime";var Pi={table:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return kt("div",{className:"lexical-table-container",children:kt("table",{className:"lexical-table",style:{borderCollapse:"collapse"},children:kt("tbody",{children:o})})})},tablecell:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.headerState>0?"th":"td",n=`lexical-table-cell-header-${t.headerState}`,l={backgroundColor:t.backgroundColor||void 0,border:"1px solid #ccc",padding:"8px"},i=t.colSpan&&t.colSpan>1?t.colSpan:void 0,s=t.rowSpan&&t.rowSpan>1?t.rowSpan:void 0;return kt(r,{className:`lexical-table-cell ${n}`,colSpan:i,rowSpan:s,style:l,children:o})},tablerow:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return kt("tr",{className:"lexical-table-row",children:o})}};import{jsx as Oe}from"react/jsx-runtime";import"react";var A={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},Gp=A.IS_BOLD|A.IS_ITALIC|A.IS_STRIKETHROUGH|A.IS_UNDERLINE|A.IS_CODE|A.IS_SUBSCRIPT|A.IS_SUPERSCRIPT|A.IS_HIGHLIGHT,Wp="\xA0",Vp=`
37
37
 
38
- `,Ki="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",Ji="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",cf=new RegExp("^[^"+Ji+"]*["+Ki+"]"),uf=new RegExp("^[^"+Ki+"]*["+Ji+"]"),df={bold:A.IS_BOLD,code:A.IS_CODE,highlight:A.IS_HIGHLIGHT,italic:A.IS_ITALIC,strikethrough:A.IS_STRIKETHROUGH,subscript:A.IS_SUBSCRIPT,superscript:A.IS_SUPERSCRIPT,underline:A.IS_UNDERLINE},mf={directionless:A.IS_DIRECTIONLESS,unmergeable:A.IS_UNMERGEABLE},pf={center:A.IS_ALIGN_CENTER,end:A.IS_ALIGN_END,justify:A.IS_ALIGN_JUSTIFY,left:A.IS_ALIGN_LEFT,right:A.IS_ALIGN_RIGHT,start:A.IS_ALIGN_START},ff={[A.IS_ALIGN_CENTER]:"center",[A.IS_ALIGN_END]:"end",[A.IS_ALIGN_JUSTIFY]:"justify",[A.IS_ALIGN_LEFT]:"left",[A.IS_ALIGN_RIGHT]:"right",[A.IS_ALIGN_START]:"start"},hf={normal:A.IS_NORMAL,segmented:A.IS_SEGMENTED,token:A.IS_TOKEN},gf={[A.IS_NORMAL]:"normal",[A.IS_SEGMENTED]:"segmented",[A.IS_TOKEN]:"token"};var Xi={text:({node:t})=>{let e=t.text;return t.format&A.IS_BOLD&&(e=Fe("strong",{children:e})),t.format&A.IS_ITALIC&&(e=Fe("em",{children:e})),t.format&A.IS_STRIKETHROUGH&&(e=Fe("span",{style:{textDecoration:"line-through"},children:e})),t.format&A.IS_UNDERLINE&&(e=Fe("span",{style:{textDecoration:"underline"},children:e})),t.format&A.IS_CODE&&(e=Fe("code",{children:e})),t.format&A.IS_SUBSCRIPT&&(e=Fe("sub",{children:e})),t.format&A.IS_SUPERSCRIPT&&(e=Fe("sup",{children:e})),e}};import{jsx as Tt}from"react/jsx-runtime";var zi={upload:({node:t})=>{let e=t;if(typeof e.value!="object")return null;let o=e.value,r=o.url;if(!o.mimeType.startsWith("image"))return Tt("a",{href:r,rel:"noopener noreferrer",children:o.filename});if(!o.sizes||!Object.keys(o.sizes).length)return Tt("img",{alt:o.filename,height:o.height,src:r,width:o.width});let n=[];for(let l in o.sizes){let i=o.sizes[l];if(!i||!i.width||!i.height||!i.mimeType||!i.filesize||!i.filename||!i.url)continue;let s=i?.url;n.push(Tt("source",{media:`(max-width: ${i.width}px)`,srcSet:s,type:i.mimeType},l))}return n.push(Tt("img",{alt:o?.filename,height:o?.height,src:r,width:o?.width},"image")),Tt("picture",{children:n})}};var qe={...Gi,...Xi,...Bi,...$i,...Vi,...Fi,...Pi,...Ui,...ji({}),...zi,...Wi};import{jsx as Yi,Fragment as xf}from"react/jsx-runtime";import ur from"react";function Zi(t){let e=!!t?.root?.children?.length,o=!1;if(t?.root?.children?.length===1&&t?.root?.children[0]?.type==="paragraph"){let r=t?.root?.children[0];if(!r?.children||r?.children?.length===0)o=!0;else if(r?.children?.length===1){let n=r?.children[0];n?.type==="text"&&(n?.text?.length||(o=!0))}}return!(!e||o)}function qi({converters:t,data:e,disableIndent:o,disableTextAlign:r}){return Zi(e)?Qi({converters:t,disableIndent:o,disableTextAlign:r,nodes:e?.root?.children,parent:e?.root}):Yi(xf,{})}function Qi({converters:t,disableIndent:e,disableTextAlign:o,nodes:r,parent:n}){let l=t.unknown;return r.map((s,u)=>{let c;s.type==="block"?(c=t?.blocks?.[s?.fields?.blockType],!c&&!l&&console.error(`Lexical => JSX converter: Blocks converter: found ${s?.fields?.blockType} block, but no converter is provided`)):s.type==="inlineBlock"?(c=t?.inlineBlocks?.[s?.fields?.blockType],!c&&!l&&console.error(`Lexical => JSX converter: Inline Blocks converter: found ${s?.fields?.blockType} inline block, but no converter is provided`)):c=t[s.type];try{!c&&l&&(c=l);let d;c?d=typeof c=="function"?c({childIndex:u,converters:t,node:s,nodesToJSX:m=>Qi({converters:m.converters??t,disableIndent:m.disableIndent??e,disableTextAlign:m.disableTextAlign??o,nodes:m.nodes,parent:m.parent??{...s,parent:n}}),parent:n}):c:d=Yi("span",{children:"unknown node"},u);let a={};if(!o&&(!Array.isArray(o)||!o?.includes(s.type))&&"format"in s&&s.format)switch(s.format){case"center":a.textAlign="center";break;case"end":a.textAlign="right";break;case"justify":a.textAlign="justify";break;case"left":break;case"right":a.textAlign="right";break;case"start":a.textAlign="left";break}if(!e&&(!Array.isArray(e)||!e?.includes(s.type))&&"indent"in s&&s.indent&&s.type!=="listitem"&&(a.paddingInlineStart=`${Number(s.indent)*40}px`),ur.isValidElement(d)){if(a.textAlign||a.paddingInlineStart){let p={...a,...d?.props?.style??{}};return ur.cloneElement(d,{key:u,style:p})}return ur.cloneElement(d,{key:u})}return d}catch(d){return console.error("Error converting lexical node to JSX:",d,"node:",s),null}}).filter(Boolean)}var dr=({className:t,converters:e,data:o,disableContainer:r,disableIndent:n,disableTextAlign:l})=>{if(!o)return null;let i={};e?typeof e=="function"?i=e({defaultConverters:qe}):i=e:i=qe;let s=o&&!Array.isArray(o)&&typeof o=="object"&&"root"in o&&qi({converters:i,data:o,disableIndent:n,disableTextAlign:l});return r?es(Cf,{children:s}):es("div",{className:t??"payload-richtext",children:s})};function os(){let t=bf(7),[e]=kf(),o;t[0]!==e?(o=e.getEditorState().toJSON(),t[0]=e,t[1]=o):o=t[1];let[r,n]=Tf(o),l,i;t[2]!==e?(l=()=>e.registerUpdateListener(u=>{let{editorState:c}=u;n(c.toJSON())}),i=[e],t[2]=e,t[3]=l,t[4]=i):(l=t[3],i=t[4]),_f(l,i);let s;return t[5]!==r?(s=ts("div",{className:"debug-jsx-converter",children:ts(dr,{converters:qe,data:r})}),t[5]=r,t[6]=s):s=t[6],s}var wf=v({plugins:[{Component:os,position:"bottom"}]});var B={amber:{50:"oklch(0.987 0.022 95.277)",100:"oklch(0.962 0.059 95.617)",200:"oklch(0.924 0.12 95.746)",300:"oklch(0.879 0.169 91.605)",400:"oklch(0.828 0.189 84.429)",500:"oklch(0.769 0.188 70.08)",600:"oklch(0.666 0.179 58.318)",700:"oklch(0.555 0.163 48.998)",800:"oklch(0.473 0.137 46.201)",900:"oklch(0.414 0.112 45.904)",950:"oklch(0.279 0.077 45.635)"},black:"#000",blue:{50:"oklch(0.97 0.014 254.604)",100:"oklch(0.932 0.032 255.585)",200:"oklch(0.882 0.059 254.128)",300:"oklch(0.809 0.105 251.813)",400:"oklch(0.707 0.165 254.624)",500:"oklch(0.623 0.214 259.815)",600:"oklch(0.546 0.245 262.881)",700:"oklch(0.488 0.243 264.376)",800:"oklch(0.424 0.199 265.638)",900:"oklch(0.379 0.146 265.522)",950:"oklch(0.282 0.091 267.935)"},current:"currentColor",cyan:{50:"oklch(0.984 0.019 200.873)",100:"oklch(0.956 0.045 203.388)",200:"oklch(0.917 0.08 205.041)",300:"oklch(0.865 0.127 207.078)",400:"oklch(0.789 0.154 211.53)",500:"oklch(0.715 0.143 215.221)",600:"oklch(0.609 0.126 221.723)",700:"oklch(0.52 0.105 223.128)",800:"oklch(0.45 0.085 224.283)",900:"oklch(0.398 0.07 227.392)",950:"oklch(0.302 0.056 229.695)"},emerald:{50:"oklch(0.979 0.021 166.113)",100:"oklch(0.95 0.052 163.051)",200:"oklch(0.905 0.093 164.15)",300:"oklch(0.845 0.143 164.978)",400:"oklch(0.765 0.177 163.223)",500:"oklch(0.696 0.17 162.48)",600:"oklch(0.596 0.145 163.225)",700:"oklch(0.508 0.118 165.612)",800:"oklch(0.432 0.095 166.913)",900:"oklch(0.378 0.077 168.94)",950:"oklch(0.262 0.051 172.552)"},fuchsia:{50:"oklch(0.977 0.017 320.058)",100:"oklch(0.952 0.037 318.852)",200:"oklch(0.903 0.076 319.62)",300:"oklch(0.833 0.145 321.434)",400:"oklch(0.74 0.238 322.16)",500:"oklch(0.667 0.295 322.15)",600:"oklch(0.591 0.293 322.896)",700:"oklch(0.518 0.253 323.949)",800:"oklch(0.452 0.211 324.591)",900:"oklch(0.401 0.17 325.612)",950:"oklch(0.293 0.136 325.661)"},gray:{50:"oklch(0.985 0.002 247.839)",100:"oklch(0.967 0.003 264.542)",200:"oklch(0.928 0.006 264.531)",300:"oklch(0.872 0.01 258.338)",400:"oklch(0.707 0.022 261.325)",500:"oklch(0.551 0.027 264.364)",600:"oklch(0.446 0.03 256.802)",700:"oklch(0.373 0.034 259.733)",800:"oklch(0.278 0.033 256.848)",900:"oklch(0.21 0.034 264.665)",950:"oklch(0.13 0.028 261.692)"},green:{50:"oklch(0.982 0.018 155.826)",100:"oklch(0.962 0.044 156.743)",200:"oklch(0.925 0.084 155.995)",300:"oklch(0.871 0.15 154.449)",400:"oklch(0.792 0.209 151.711)",500:"oklch(0.723 0.219 149.579)",600:"oklch(0.627 0.194 149.214)",700:"oklch(0.527 0.154 150.069)",800:"oklch(0.448 0.119 151.328)",900:"oklch(0.393 0.095 152.535)",950:"oklch(0.266 0.065 152.934)"},indigo:{50:"oklch(0.962 0.018 272.314)",100:"oklch(0.93 0.034 272.788)",200:"oklch(0.87 0.065 274.039)",300:"oklch(0.785 0.115 274.713)",400:"oklch(0.673 0.182 276.935)",500:"oklch(0.585 0.233 277.117)",600:"oklch(0.511 0.262 276.966)",700:"oklch(0.457 0.24 277.023)",800:"oklch(0.398 0.195 277.366)",900:"oklch(0.359 0.144 278.697)",950:"oklch(0.257 0.09 281.288)"},inherit:"inherit",lime:{50:"oklch(0.986 0.031 120.757)",100:"oklch(0.967 0.067 122.328)",200:"oklch(0.938 0.127 124.321)",300:"oklch(0.897 0.196 126.665)",400:"oklch(0.841 0.238 128.85)",500:"oklch(0.768 0.233 130.85)",600:"oklch(0.648 0.2 131.684)",700:"oklch(0.532 0.157 131.589)",800:"oklch(0.453 0.124 130.933)",900:"oklch(0.405 0.101 131.063)",950:"oklch(0.274 0.072 132.109)"},neutral:{50:"oklch(0.985 0 0)",100:"oklch(0.97 0 0)",200:"oklch(0.922 0 0)",300:"oklch(0.87 0 0)",400:"oklch(0.708 0 0)",500:"oklch(0.556 0 0)",600:"oklch(0.439 0 0)",700:"oklch(0.371 0 0)",800:"oklch(0.269 0 0)",900:"oklch(0.205 0 0)",950:"oklch(0.145 0 0)"},orange:{50:"oklch(0.98 0.016 73.684)",100:"oklch(0.954 0.038 75.164)",200:"oklch(0.901 0.076 70.697)",300:"oklch(0.837 0.128 66.29)",400:"oklch(0.75 0.183 55.934)",500:"oklch(0.705 0.213 47.604)",600:"oklch(0.646 0.222 41.116)",700:"oklch(0.553 0.195 38.402)",800:"oklch(0.47 0.157 37.304)",900:"oklch(0.408 0.123 38.172)",950:"oklch(0.266 0.079 36.259)"},pink:{50:"oklch(0.971 0.014 343.198)",100:"oklch(0.948 0.028 342.258)",200:"oklch(0.899 0.061 343.231)",300:"oklch(0.823 0.12 346.018)",400:"oklch(0.718 0.202 349.761)",500:"oklch(0.656 0.241 354.308)",600:"oklch(0.592 0.249 0.584)",700:"oklch(0.525 0.223 3.958)",800:"oklch(0.459 0.187 3.815)",900:"oklch(0.408 0.153 2.432)",950:"oklch(0.284 0.109 3.907)"},purple:{50:"oklch(0.977 0.014 308.299)",100:"oklch(0.946 0.033 307.174)",200:"oklch(0.902 0.063 306.703)",300:"oklch(0.827 0.119 306.383)",400:"oklch(0.714 0.203 305.504)",500:"oklch(0.627 0.265 303.9)",600:"oklch(0.558 0.288 302.321)",700:"oklch(0.496 0.265 301.924)",800:"oklch(0.438 0.218 303.724)",900:"oklch(0.381 0.176 304.987)",950:"oklch(0.291 0.149 302.717)"},red:{50:"oklch(0.971 0.013 17.38)",100:"oklch(0.936 0.032 17.717)",200:"oklch(0.885 0.062 18.334)",300:"oklch(0.808 0.114 19.571)",400:"oklch(0.704 0.191 22.216)",500:"oklch(0.637 0.237 25.331)",600:"oklch(0.577 0.245 27.325)",700:"oklch(0.505 0.213 27.518)",800:"oklch(0.444 0.177 26.899)",900:"oklch(0.396 0.141 25.723)",950:"oklch(0.258 0.092 26.042)"},rose:{50:"oklch(0.969 0.015 12.422)",100:"oklch(0.941 0.03 12.58)",200:"oklch(0.892 0.058 10.001)",300:"oklch(0.81 0.117 11.638)",400:"oklch(0.712 0.194 13.428)",500:"oklch(0.645 0.246 16.439)",600:"oklch(0.586 0.253 17.585)",700:"oklch(0.514 0.222 16.935)",800:"oklch(0.455 0.188 13.697)",900:"oklch(0.41 0.159 10.272)",950:"oklch(0.271 0.105 12.094)"},sky:{50:"oklch(0.977 0.013 236.62)",100:"oklch(0.951 0.026 236.824)",200:"oklch(0.901 0.058 230.902)",300:"oklch(0.828 0.111 230.318)",400:"oklch(0.746 0.16 232.661)",500:"oklch(0.685 0.169 237.323)",600:"oklch(0.588 0.158 241.966)",700:"oklch(0.5 0.134 242.749)",800:"oklch(0.443 0.11 240.79)",900:"oklch(0.391 0.09 240.876)",950:"oklch(0.293 0.066 243.157)"},slate:{50:"oklch(0.984 0.003 247.858)",100:"oklch(0.968 0.007 247.896)",200:"oklch(0.929 0.013 255.508)",300:"oklch(0.869 0.022 252.894)",400:"oklch(0.704 0.04 256.788)",500:"oklch(0.554 0.046 257.417)",600:"oklch(0.446 0.043 257.281)",700:"oklch(0.372 0.044 257.287)",800:"oklch(0.279 0.041 260.031)",900:"oklch(0.208 0.042 265.755)",950:"oklch(0.129 0.042 264.695)"},stone:{50:"oklch(0.985 0.001 106.423)",100:"oklch(0.97 0.001 106.424)",200:"oklch(0.923 0.003 48.717)",300:"oklch(0.869 0.005 56.366)",400:"oklch(0.709 0.01 56.259)",500:"oklch(0.553 0.013 58.071)",600:"oklch(0.444 0.011 73.639)",700:"oklch(0.374 0.01 67.558)",800:"oklch(0.268 0.007 34.298)",900:"oklch(0.216 0.006 56.043)",950:"oklch(0.147 0.004 49.25)"},teal:{50:"oklch(0.984 0.014 180.72)",100:"oklch(0.953 0.051 180.801)",200:"oklch(0.91 0.096 180.426)",300:"oklch(0.855 0.138 181.071)",400:"oklch(0.777 0.152 181.912)",500:"oklch(0.704 0.14 182.503)",600:"oklch(0.6 0.118 184.704)",700:"oklch(0.511 0.096 186.391)",800:"oklch(0.437 0.078 188.216)",900:"oklch(0.386 0.063 188.416)",950:"oklch(0.277 0.046 192.524)"},transparent:"transparent",violet:{50:"oklch(0.969 0.016 293.756)",100:"oklch(0.943 0.029 294.588)",200:"oklch(0.894 0.057 293.283)",300:"oklch(0.811 0.111 293.571)",400:"oklch(0.702 0.183 293.541)",500:"oklch(0.606 0.25 292.717)",600:"oklch(0.541 0.281 293.009)",700:"oklch(0.491 0.27 292.581)",800:"oklch(0.432 0.232 292.759)",900:"oklch(0.38 0.189 293.745)",950:"oklch(0.283 0.141 291.089)"},white:"#fff",yellow:{50:"oklch(0.987 0.026 102.212)",100:"oklch(0.973 0.071 103.193)",200:"oklch(0.945 0.129 101.54)",300:"oklch(0.905 0.182 98.111)",400:"oklch(0.852 0.199 91.936)",500:"oklch(0.795 0.184 86.047)",600:"oklch(0.681 0.162 75.834)",700:"oklch(0.554 0.135 66.442)",800:"oklch(0.476 0.114 61.907)",900:"oklch(0.421 0.095 57.708)",950:"oklch(0.286 0.066 53.813)"},zinc:{50:"oklch(0.985 0 0)",100:"oklch(0.967 0.001 286.375)",200:"oklch(0.92 0.004 286.32)",300:"oklch(0.871 0.006 286.286)",400:"oklch(0.705 0.015 286.067)",500:"oklch(0.552 0.016 285.938)",600:"oklch(0.442 0.017 285.786)",700:"oklch(0.37 0.013 285.805)",800:"oklch(0.274 0.006 286.033)",900:"oklch(0.21 0.006 285.885)",950:"oklch(0.141 0.005 285.823)"}},Ef={text:{"text-red":{css:{color:`light-dark(${B.red[600]}, ${B.red[400]})`},label:"Red"},"text-orange":{css:{color:`light-dark(${B.orange[600]}, ${B.orange[400]})`},label:"Orange"},"text-yellow":{css:{color:`light-dark(${B.yellow[700]}, ${B.yellow[300]})`},label:"Yellow"},"text-green":{css:{color:`light-dark(${B.green[700]}, ${B.green[400]})`},label:"Green"},"text-blue":{css:{color:`light-dark(${B.blue[600]}, ${B.blue[400]})`},label:"Blue"},"text-purple":{css:{color:`light-dark(${B.purple[600]}, ${B.purple[400]})`},label:"Purple"},"text-pink":{css:{color:`light-dark(${B.pink[600]}, ${B.pink[400]})`},label:"Pink"}},background:{"bg-red":{css:{"background-color":`light-dark(${B.red[400]}, ${B.red[600]})`},label:"Red"},"bg-orange":{css:{"background-color":`light-dark(${B.orange[400]}, ${B.orange[600]})`},label:"Orange"},"bg-yellow":{css:{"background-color":`light-dark(${B.yellow[300]}, ${B.yellow[700]})`},label:"Yellow"},"bg-green":{css:{"background-color":`light-dark(${B.green[400]}, ${B.green[700]})`},label:"Green"},"bg-blue":{css:{"background-color":`light-dark(${B.blue[400]}, ${B.blue[600]})`},label:"Blue"},"bg-purple":{css:{"background-color":`light-dark(${B.purple[400]}, ${B.purple[600]})`},label:"Purple"},"bg-pink":{css:{"background-color":`light-dark(${B.pink[400]}, ${B.pink[600]})`},label:"Pink"}}};import{$isNodeSelection as a0}from"lexical";import{jsx as wt,jsxs as Sf}from"react/jsx-runtime";import"react";var mr=()=>Sf("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:[wt("g",{clipPath:"url(#clip0_4397_10817)",children:wt("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"})}),wt("defs",{children:wt("clipPath",{id:"clip0_4397_10817",children:wt("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{jsx as yf}from"react/jsx-runtime";import*as ns from"react";import{DecoratorBlockNode as Nf}from"@lexical/react/LexicalDecoratorBlockNode.js";function Lf(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:rs({relationTo:o,value:e})}:null}var Et=class extends Nf{__data;constructor({data:e,format:o,key:r}){super(o,r),this.__data=e}static clone(e){return new this({data:e.__data,format:e.__format,key:e.__key})}static getType(){return"relationship"}static importDOM(){return{div:e=>!e.hasAttribute("data-lexical-relationship-relationTo")||!e.hasAttribute("data-lexical-relationship-id")?null:{conversion:Lf,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},r=rs(o);return r.setFormat(e.format),r}static isInline(){return!1}decorate(e,o){return null}exportDOM(){let e=document.createElement("div");e.setAttribute("data-lexical-relationship-id",String(typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value)),e.setAttribute("data-lexical-relationship-relationTo",this.__data?.relationTo);let o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"relationship",version:2}}getData(){return this.getLatest().__data}getTextContent(){return`${this.__data?.relationTo} relation to ${typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value}`}setData(e){let o=this.getWritable();o.__data=e}};function rs(t){return new Et({data:t})}var If=ns.lazy(()=>import("./RelationshipComponent-APF3CN47.js").then(t=>({default:t.RelationshipComponent})));function Rf(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Pe({relationTo:o,value:e})}:null}var ke=class extends Et{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{div:e=>!e.hasAttribute("data-lexical-relationship-relationTo")||!e.hasAttribute("data-lexical-relationship-id")?null:{conversion:Rf,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},r=Pe(o);return r.setFormat(e.format),r}decorate(e,o){return yf(If,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Pe(t){return new ke({data:t})}function pr(t){return t instanceof ke}import{c as Xf}from"react/compiler-runtime";import{jsx as zf}from"react/jsx-runtime";import{useLexicalComposerContext as Zf}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Yf}from"@lexical/utils";import{useConfig as qf}from"@payloadcms/ui";import{$getPreviousSelection as Qf,$getSelection as e0,$isParagraphNode as t0,$isRangeSelection as o0,COMMAND_PRIORITY_EDITOR as r0,createCommand as n0}from"lexical";import{useEffect as l0}from"react";import{c as Uf}from"react/compiler-runtime";import{jsx as lo}from"react/jsx-runtime";import{useLexicalComposerContext as Gf}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as Wf,COMMAND_PRIORITY_EDITOR as Vf}from"lexical";import{useEffect as Kf,useState as ss}from"react";import{c as vf}from"react/compiler-runtime";import{jsx as Df}from"react/jsx-runtime";import{useLexicalComposerContext as Mf}from"@lexical/react/LexicalComposerContext";import{useListDrawer as Of,useModal as Af}from"@payloadcms/ui";import{$getNodeByKey as ls,$getPreviousSelection as $f,$getRoot as Ff,$getSelection as Pf,$isRangeSelection as Bf,$setSelection as Hf}from"lexical";import{useEffect as jf,useState as is}from"react";var St=t=>{let e=vf(23),[o]=Mf(),[r,n]=is(null),[l,i]=is(!1),[s,u,c]=Of(t),{closeDrawer:d,drawerSlug:a,isDrawerOpen:p,openDrawer:m}=c,{modalState:f}=Af(),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let $=Pf()??$f();n($)},e[0]=h):h=e[0];let x=h,b;e[1]!==o||e[2]!==r?(b=()=>{r&&o.update(()=>{if(Bf(r)){let{anchor:$,focus:R}=r;ls($.key)&&ls(R.key)&&Hf(r.clone())}else Ff().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=r,e[3]=b):b=e[3];let T=b,E;e[4]!==d?(E=()=>{d()},e[4]=d,e[5]=E):E=e[5];let C=E,k,g;e[6]!==a||e[7]!==f||e[8]!==T||e[9]!==l?(k=()=>{if(!l)return;let $=f[a];$&&!$?.isOpen&&(i(!1),setTimeout(()=>{T()},1))},g=[f,a,T,l],e[6]=a,e[7]=f,e[8]=T,e[9]=l,e[10]=k,e[11]=g):(k=e[10],g=e[11]),jf(k,g);let w;e[12]!==u?(w=$=>Df(u,{...$,onClick:()=>{x()}}),e[12]=u,e[13]=w):w=e[13];let N;e[14]!==m?(N=()=>{x(),m(),i(!0)},e[14]=m,e[15]=N):N=e[15];let M;return e[16]!==s||e[17]!==C||e[18]!==p||e[19]!==a||e[20]!==w||e[21]!==N?(M={closeListDrawer:C,isListDrawerOpen:p,ListDrawer:s,listDrawerSlug:a,ListDrawerToggler:w,openListDrawer:N},e[16]=s,e[17]=C,e[18]=p,e[19]=a,e[20]=w,e[21]=N,e[22]=M):M=e[22],M};var Jf=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=Wf(o);n&&n.replace(Pe({relationTo:e,value:r}))}):t.dispatchCommand(fr,{relationTo:e,value:r})},as=t=>{let e=Uf(16),{enabledCollectionSlugs:o}=t,[r]=Gf(),n;e[0]!==o?.[0]?(n=()=>o?.[0],e[0]=o?.[0],e[1]=n):n=e[1];let[l]=ss(n),[i,s]=ss(null),u=o||void 0,c;e[2]!==l||e[3]!==u?(c={collectionSlugs:u,selectedCollection:l},e[2]=l,e[3]=u,e[4]=c):c=e[4];let{closeListDrawer:d,ListDrawer:a,openListDrawer:p}=St(c),m,f;e[5]!==r||e[6]!==p?(m=()=>r.registerCommand(lt,T=>(s(T?.replace?T?.replace.nodeKey:null),p(),!0),Vf),f=[r,p],e[5]=r,e[6]=p,e[7]=m,e[8]=f):(m=e[7],f=e[8]),Kf(m,f);let h;e[9]!==d||e[10]!==r||e[11]!==i?(h=T=>{let{collectionSlug:E,doc:C}=T;Jf({editor:r,relationTo:E,replaceNodeKey:i,value:C.id}),d()},e[9]=d,e[10]=r,e[11]=i,e[12]=h):h=e[12];let x=h,b;return e[13]!==a||e[14]!==x?(b=lo(a,{onSelect:x}),e[13]=a,e[14]=x,e[15]=b):b=e[15],b},cs=t=>(t?.enabledCollectionSlugs?.length??-1)>0?lo(as,{...t}):lo($t,{...t,children:lo(as,{...t})});var fr=n0("INSERT_RELATIONSHIP_COMMAND"),us=t=>{let e=Xf(5),{clientProps:o}=t,[r]=Zf(),{config:n}=qf(),{collections:l}=n,i=null;if(o?.enabledCollections)i=o?.enabledCollections;else if(o?.disabledCollections){let c;e[0]!==o?.disabledCollections?(c=d=>{let{slug:a}=d;return!o?.disabledCollections?.includes(a)},e[0]=o?.disabledCollections,e[1]=c):c=e[1],i=l.filter(c).map(i0)}let s,u;return e[2]!==r?(s=()=>{if(!r.hasNodes([ke]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return r.registerCommand(fr,s0,r0)},u=[r],e[2]=r,e[3]=s,e[4]=u):(s=e[3],u=e[4]),l0(s,u),zf(cs,{enabledCollectionSlugs:i})};function i0(t){let{slug:e}=t;return e}function s0(t){let e=e0()||Qf();if(o0(e)){let o=Pe(t),{focus:r}=e,n=r.getNode();Yf(o),t0(n)&&!n.__first&&n.remove()}return!0}var c0=v({nodes:[ke],plugins:[{Component:us,position:"normal"}],slashMenu:{groups:[Z([{Icon:mr,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(lt,{replace:!1})}}])]},toolbarFixed:{groups:[he([{ChildComponent:mr,isActive:({selection:t})=>{if(!a0(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return pr(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(lt,{replace:!1})}}])]}});import{c as bs}from"react/compiler-runtime";import{jsx as le,jsxs as $0}from"react/jsx-runtime";import{useLexicalComposerContext as F0}from"@lexical/react/LexicalComposerContext.js";import{useScrollInfo as P0,useThrottledEffect as B0,useTranslation as H0}from"@payloadcms/ui";import*as _e from"react";import{useMemo as j0}from"react";import{c as u0}from"react/compiler-runtime";import{jsx as d0}from"react/jsx-runtime";import{mergeRegister as m0}from"@lexical/utils";import{$addUpdateTag as p0,$getSelection as f0}from"lexical";import{useDeferredValue as h0,useEffect as g0,useState as x0}from"react";var ds="toolbar-popup__button",Nt=t=>{let e=u0(23),{children:o,editor:r,item:n}=t,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={active:!1,enabled:!0},e[0]=l):l=e[0];let[i,s]=x0(l),u=h0(i),c=H(),d=u.enabled?"":"disabled",a=u.active?"active":"",p=n.key?`${ds}-${n.key}`:"",m;e[1]!==d||e[2]!==a||e[3]!==p?(m=[ds,d,a,p].filter(Boolean),e[1]=d,e[2]=a,e[3]=p,e[4]=m):m=e[4];let f=m.join(" "),h;e[5]!==r||e[6]!==c||e[7]!==n?(h=()=>{r.getEditorState().read(()=>{let N=f0();if(!N)return;let M=n.isActive?n.isActive({editor:r,editorConfigContext:c,selection:N}):!1,$=n.isEnabled?n.isEnabled({editor:r,editorConfigContext:c,selection:N}):!0;s(R=>R.active===M&&R.enabled===$?R:{active:M,enabled:$})})},e[5]=r,e[6]=c,e[7]=n,e[8]=h):h=e[8];let x=h,b=Ft(),T,E;e[9]!==r||e[10]!==b||e[11]!==x?(T=()=>{b(x);let N=()=>b(x),M=m0(r.registerUpdateListener(N));return document.addEventListener("mouseup",N),()=>{M(),document.removeEventListener("mouseup",N)}},E=[r,b,x],e[9]=r,e[10]=b,e[11]=x,e[12]=T,e[13]=E):(T=e[12],E=e[13]),g0(T,E);let C;e[14]!==i||e[15]!==r||e[16]!==n?(C=()=>{i.enabled&&r.focus(()=>{r.update(C0),n.onSelect?.({editor:r,isActive:i.active})})},e[14]=i,e[15]=r,e[16]=n,e[17]=C):C=e[17];let k=C,g=b0,w;return e[18]!==o||e[19]!==f||e[20]!==k||e[21]!==n.key?(w=d0("button",{className:f,"data-button-key":n.key,onClick:k,onMouseDown:g,type:"button",children:o}),e[18]=o,e[19]=f,e[20]=k,e[21]=n.key,e[22]=w):w=e[22],w};function C0(){p0("toolbar")}function b0(t){t.preventDefault()}import{c as N0}from"react/compiler-runtime";import{jsx as Qe}from"react/jsx-runtime";import Cs,{useCallback as L0,useDeferredValue as y0,useEffect as I0,useMemo as R0}from"react";import{mergeRegister as v0}from"@lexical/utils";import{useTranslation as D0}from"@payloadcms/ui";import{$getSelection as M0}from"lexical";import{jsx as ye,jsxs as ms}from"react/jsx-runtime";import{Button as k0}from"@payloadcms/ui";import{$addUpdateTag as _0,isDOMNode as T0}from"lexical";import io,{useCallback as w0,useEffect as so,useMemo as fs,useRef as hr,useState as gr}from"react";import{createPortal as E0}from"react-dom";var ps="toolbar-popup__dropdown-item",hs=io.createContext(null);function gs({active:t,children:e,editor:o,enabled:r,Icon:n,item:l,itemKey:i,tooltip:s}){let u=fs(()=>[ps,r===!1?"disabled":"",t?"active":"",l?.key?`${ps}-${l.key}`:""].filter(Boolean).join(" "),[r,t,l.key]),c=hr(null),d=io.use(hs);if(d===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=d;return so(()=>{c?.current!=null&&a(c)},[c,a]),ye(k0,{"aria-label":s,buttonStyle:"none",className:u,disabled:r===!1,extraButtonProps:{"data-item-key":i},icon:n,iconPosition:"left",iconStyle:"none",onClick:()=>{r!==!1&&o.focus(()=>{o.update(()=>{_0("toolbar")}),l.onSelect?.({editor:o,isActive:t})})},onMouseDown:p=>{p.preventDefault()},ref:c,tooltip:s,type:"button",children:e})}function S0({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:r}){let[n,l]=gr(),[i,s]=gr(),u=w0(a=>{l(p=>p!=null?[...p,a]:[a])},[l]),c=a=>{if(n==null)return;let{key:p}=a;["ArrowDown","ArrowUp","Escape","Tab"].includes(p)&&a.preventDefault(),p==="Escape"||p==="Tab"?r():p==="ArrowUp"?s(m=>{if(m==null)return n[0];let f=n.indexOf(m)-1;return n[f===-1?n.length-1:f]}):p==="ArrowDown"&&s(m=>m==null?n[0]:n[n.indexOf(m)+1])},d=fs(()=>({registerItem:u}),[u]);return so(()=>{n!=null&&i==null&&s(n[0]),i!=null&&i?.current!=null&&i.current.focus()},[n,i]),ye(hs,{value:d,children:ye("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:c,ref:e,children:t})})}function xs({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:r=!1,dropdownKey:n,Icon:l,itemsContainerClassNames:i,label:s,stopCloseOnClickSelf:u}){let c=hr(null),d=hr(null),[a,p]=gr(!1),m=()=>{p(!1),d?.current!=null&&d.current.focus()};so(()=>{let h=d.current,x=c.current;if(a&&h!==null&&x!==null){let{left:b,top:T}=h.getBoundingClientRect(),E=window.scrollY||document.documentElement.scrollTop;x.style.top=`${T+E+h.offsetHeight+5}px`,x.style.left=`${Math.min(b-5,window.innerWidth-x.offsetWidth-20)}px`}},[c,d,a]),so(()=>{let h=d.current;if(h!==null&&a){let x=b=>{let T=b.target;T0(T)&&(u&&c.current&&c.current.contains(T)||h.contains(T)||p(!1))};return document.addEventListener("click",x),()=>{document.removeEventListener("click",x)}}},[c,d,a,u]);let f=E0(ye(S0,{dropDownRef:c,itemsContainerClassNames:i,onClose:m,children:o}),document.body);return ms(io.Fragment,{children:[ms("button",{"aria-label":t,className:e+(a?" active":""),"data-dropdown-key":n,disabled:r,onClick:h=>{h.preventDefault(),p(!a)},onMouseDown:h=>{h.preventDefault()},ref:d,type:"button",children:[l&&ye(l,{}),s&&ye("span",{className:"toolbar-popup__dropdown-label",children:s}),ye("i",{className:"toolbar-popup__dropdown-caret"})]}),a&&ye(io.Fragment,{children:f})]})}var xr="toolbar-popup__dropdown",O0=t=>{let e=N0(14),{active:o,anchorElem:r,editor:n,enabled:l,item:i}=t,{i18n:s}=D0(),{fieldProps:u}=H(),{featureClientSchemaMap:c,schemaPath:d}=u;if(i.Component){let p;return e[0]!==o||e[1]!==r||e[2]!==n||e[3]!==l||e[4]!==i?(p=i?.Component&&Qe(i.Component,{active:o,anchorElem:r,editor:n,enabled:l,item:i},i.key),e[0]=o,e[1]=r,e[2]=n,e[3]=l,e[4]=i,e[5]=p):p=e[5],p}let a;if(e[6]!==o||e[7]!==n||e[8]!==l||e[9]!==c||e[10]!==s||e[11]!==i||e[12]!==d){let p=i.key,m;i.label&&(p=typeof i.label=="function"?i.label({featureClientSchemaMap:c,i18n:s,schemaPath:d}):i.label),p.length>25?m=p.substring(0,25)+"...":m=p,a=Qe(gs,{active:o,editor:n,enabled:l,Icon:i?.ChildComponent?Qe(i.ChildComponent,{}):void 0,item:i,itemKey:i.key,tooltip:p,children:Qe("span",{className:"text",children:m})},i.key),e[6]=o,e[7]=n,e[8]=l,e[9]=c,e[10]=s,e[11]=i,e[12]=d,e[13]=a}else a=e[13];return a},A0=Cs.memo(O0),Be=({anchorElem:t,classNames:e,editor:o,group:r,Icon:n,itemsContainerClassNames:l,label:i,maxActiveItems:s,onActiveChange:u})=>{let[c,d]=Cs.useState({activeItemKeys:[],enabledGroup:!0,enabledItemKeys:[]}),a=y0(c),p=H(),{items:m,key:f}=r,h=Ft(),x=L0(()=>{o.getEditorState().read(()=>{let T=M0();if(!T)return;let E=[],C=[],k=[];for(let g of m)g.isActive&&(!s||E.length<s)&&g.isActive({editor:o,editorConfigContext:p,selection:T})&&(E.push(g.key),C.push(g)),g.isEnabled?g.isEnabled({editor:o,editorConfigContext:p,selection:T})&&k.push(g.key):k.push(g.key);d({activeItemKeys:E,enabledGroup:r.isEnabled?r.isEnabled({editor:o,editorConfigContext:p,selection:T}):!0,enabledItemKeys:k}),u&&u({activeItems:C})})},[o,p,r,m,s,u]);I0(()=>(h(x),v0(o.registerUpdateListener(async()=>{await h(x)}))),[o,h,x]);let b=R0(()=>m?.length?m.map(T=>Qe(A0,{active:a.activeItemKeys.includes(T.key),anchorElem:t,editor:o,enabled:a.enabledItemKeys.includes(T.key),item:T},T.key)):null,[m,a,t,o]);return Qe(xs,{buttonAriaLabel:`${f} dropdown`,buttonClassName:[xr,`${xr}-${f}`,...e||[]].filter(Boolean).join(" "),disabled:!a.enabledGroup,dropdownKey:f,Icon:n,itemsContainerClassNames:[`${xr}-items`,...l||[]],label:i,children:b},f)};function U0({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&le(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?le(Nt,{editor:e,item:o,children:le(o.ChildComponent,{})},o.key):null}function G0(t){let e=bs(23),{anchorElem:o,editor:r,editorConfig:n,group:l,index:i}=t,{i18n:s}=H0(),{fieldProps:u}=H(),{featureClientSchemaMap:c,schemaPath:d}=u,[a,p]=_e.useState(void 0),[m,f]=_e.useState(void 0),h;e[0]!==l.ChildComponent||e[1]!==l.items||e[2]!==l.type?(h=()=>{l?.type==="dropdown"&&l.items.length&&l.ChildComponent?f(()=>l.ChildComponent):f(void 0)},e[0]=l.ChildComponent,e[1]=l.items,e[2]=l.type,e[3]=h):h=e[3];let x;e[4]!==l?(x=[l],e[4]=l,e[5]=x):x=e[5],_e.useEffect(h,x);let b;e[6]!==c||e[7]!==l.ChildComponent||e[8]!==l.items||e[9]!==l.type||e[10]!==s||e[11]!==d?(b=k=>{let{activeItems:g}=k;if(!g.length){l?.type==="dropdown"&&l.items.length&&l.ChildComponent?(f(()=>l.ChildComponent),p(void 0)):(f(void 0),p(void 0));return}let w=g[0],N=w.key;w.label&&(N=typeof w.label=="function"?w.label({featureClientSchemaMap:c,i18n:s,schemaPath:d}):w.label),N.length>25&&(N=N.substring(0,25)+"..."),g.length===1?(p(N),f(()=>w.ChildComponent)):(p(s.t("lexical:general:toolbarItemsActive",{count:g.length})),l?.type==="dropdown"&&l.items.length&&l.ChildComponent?f(()=>l.ChildComponent):f(void 0))},e[6]=c,e[7]=l.ChildComponent,e[8]=l.items,e[9]=l.type,e[10]=s,e[11]=d,e[12]=b):b=e[12];let T=b,E=`fixed-toolbar__group fixed-toolbar__group-${l.key}`,C;return e[13]!==m||e[14]!==o||e[15]!==a||e[16]!==r||e[17]!==n.features.toolbarFixed?.groups.length||e[18]!==l||e[19]!==i||e[20]!==T||e[21]!==E?(C=$0("div",{className:E,"data-toolbar-group-key":l.key,children:[l.type==="dropdown"&&l.items.length?m?le(Be,{anchorElem:o,editor:r,group:l,Icon:m,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:l.maxActiveItems??1,onActiveChange:T}):le(Be,{anchorElem:o,editor:r,group:l,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:l.maxActiveItems??1,onActiveChange:T}):null,l.type==="buttons"&&l.items.length?l.items.map(k=>le(U0,{anchorElem:o,editor:r,item:k},k.key)):null,i<n.features.toolbarFixed?.groups.length-1&&le("div",{className:"divider"})]},l.key),e[13]=m,e[14]=o,e[15]=a,e[16]=r,e[17]=n.features.toolbarFixed?.groups.length,e[18]=l,e[19]=i,e[20]=T,e[21]=E,e[22]=C):C=e[22],C}function W0({anchorElem:t,clientProps:e,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let l=_e.useRef(null),{y:i}=P0(),s=j0(()=>{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 B0(()=>{if(!s)return;let u=l.current;if(!u)return;let c=u.getBoundingClientRect(),d=s.getBoundingClientRect();if(!(c.bottom<d.top||c.top>d.bottom))u.classList.remove("fixed-toolbar"),u.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),s.classList.remove("fixed-toolbar"),s.classList.add("fixed-toolbar","fixed-toolbar--hide");else{if(!u.classList.contains("fixed-toolbar--overlapping"))return;u.classList.remove("fixed-toolbar--overlapping"),u.classList.add("fixed-toolbar"),s.classList.remove("fixed-toolbar--hide"),s.classList.add("fixed-toolbar")}},50,[l,s,i]),le("div",{className:"fixed-toolbar",onFocus:u=>{u.stopPropagation()},ref:l,children:o.isEditable()&&le(_e.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((u,c)=>le(G0,{anchorElem:t,editor:o,editorConfig:r,group:u,index:c},u.key))})})}var ks=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return ks(t.parentEditor)}return!1},_s=t=>{let e=bs(6),{clientProps:o}=t,[r]=F0(),n=H(),{editorConfig:l}=n,i=o.applyToFocusedEditor&&n.focusedEditor?.editor||r,s=o.applyToFocusedEditor&&n.focusedEditor?.editorConfig||l,u,c;if(e[0]!==o.disableIfParentHasFixedToolbar||e[1]!==i||e[2]!==s||e[3]!==n){c=Symbol.for("react.early_return_sentinel");e:{let d=ks(n);if(o?.disableIfParentHasFixedToolbar&&d){c=null;break e}if(!s?.features?.toolbarFixed?.groups?.length){c=null;break e}u=le(W0,{anchorElem:document.body,editor:i,editorConfig:s,parentWithFixedToolbar:d})}e[0]=o.disableIfParentHasFixedToolbar,e[1]=i,e[2]=s,e[3]=n,e[4]=u,e[5]=c}else u=e[4],c=e[5];return c!==Symbol.for("react.early_return_sentinel")?c:u};var V0=v({plugins:[{Component:_s,position:"aboveContainer"}]});import{c as Es}from"react/compiler-runtime";import{jsx as ce,jsxs as Ss}from"react/jsx-runtime";import{useLexicalComposerContext as K0}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Ns}from"@lexical/utils";import{$getSelection as Ls,$isRangeSelection as Ts,$isTextNode as J0,COMMAND_PRIORITY_LOW as X0,getDOMSelection as ys,SELECTION_CHANGE_COMMAND as z0}from"lexical";import{useCallback as co,useEffect as Lt,useRef as ws,useState as Z0}from"react";import*as uo from"react";import{createPortal as Y0}from"react-dom";function Cr(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 ao(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:r=0,floatingElem:n,horizontalOffset:l=32,horizontalPosition:i="left",specialHandlingForCaret:s=!1,targetRect:u,verticalGap:c=10}=t,d=o.parentElement;if(u===null||d==null){n.style.opacity="0",n.style.transform="translate(-10000px, -10000px)";return}let a=n.getBoundingClientRect(),p=o.getBoundingClientRect(),m=d.getBoundingClientRect(),f=u.top-a.height-c,h=u.left-l;i==="center"&&(h=u.left+u.width/2-a.width/2);let x=0;return!e&&f<m.top&&!s&&(x=a.height+u.height+c*2,f+=x),i==="center"?h+a.width>m.right?h=m.right-a.width-l:h<m.left&&(h=m.left+l):h+a.width>m.right&&(h=m.right-a.width-l),h-=p.left,n.style.opacity="1",s&&r!==0?(f-=p.bottom-r+a.height-3,n.style.transform=`translate(${h}px, ${f}px) rotate(180deg)`):(f-=p.top,n.style.transform=`translate(${h}px, ${f}px)`),x}function q0({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&ce(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?ce(Nt,{editor:e,item:o,children:ce(o.ChildComponent,{})},o.key):null}function Q0(t){let e=Es(19),{anchorElem:o,editor:r,group:n,index:l}=t,{editorConfig:i}=H(),[s,u]=uo.useState(),c;e[0]!==n.ChildComponent||e[1]!==n.items||e[2]!==n.type?(c=()=>{n?.type==="dropdown"&&n.items.length&&n.ChildComponent?u(()=>n.ChildComponent):u(void 0)},e[0]=n.ChildComponent,e[1]=n.items,e[2]=n.type,e[3]=c):c=e[3];let d;e[4]!==n?(d=[n],e[4]=n,e[5]=d):d=e[5],uo.useEffect(c,d);let a;e[6]!==n.ChildComponent||e[7]!==n.items||e[8]!==n.type?(a=h=>{let{activeItems:x}=h;if(!x.length){n?.type==="dropdown"&&n.items.length&&n.ChildComponent?u(()=>n.ChildComponent):u(void 0);return}let b=x[0];u(()=>b?.ChildComponent)},e[6]=n.ChildComponent,e[7]=n.items,e[8]=n.type,e[9]=a):a=e[9];let p=a,m=`inline-toolbar-popup__group inline-toolbar-popup__group-${n.key}`,f;return e[10]!==s||e[11]!==o||e[12]!==r||e[13]!==i.features.toolbarInline?.groups.length||e[14]!==n||e[15]!==l||e[16]!==p||e[17]!==m?(f=Ss("div",{className:m,"data-toolbar-group-key":n.key,children:[n.type==="dropdown"&&n.items.length?s?ce(Be,{anchorElem:o,editor:r,group:n,Icon:s,maxActiveItems:n.maxActiveItems??1,onActiveChange:p}):ce(Be,{anchorElem:o,editor:r,group:n,maxActiveItems:n.maxActiveItems??1,onActiveChange:p}):null,n.type==="buttons"&&n.items.length?n.items.map(h=>ce(q0,{anchorElem:o,editor:r,item:h},h.key)):null,l<i.features.toolbarInline?.groups.length-1&&ce("div",{className:"divider"})]},n.key),e[10]=s,e[11]=o,e[12]=r,e[13]=i.features.toolbarInline?.groups.length,e[14]=n,e[15]=l,e[16]=p,e[17]=m,e[18]=f):f=e[18],f}function e1({anchorElem:t,editor:e}){let o=ws(null),r=ws(null),{editorConfig:n}=H(),l=co(()=>{if(o?.current){let c=o.current.style.opacity==="0",d=o.current.style.pointerEvents==="none";c||(o.current.style.opacity="0"),d||(o.current.style.pointerEvents="none")}},[o]),i=co(c=>{if(o?.current&&(c.buttons===1||c.buttons===3)){let d=o.current.style.opacity==="0",a=o.current.style.pointerEvents==="none";if(!d||!a){let p=c.clientX,m=c.clientY,f=document.elementFromPoint(p,m);o.current.contains(f)||l()}}},[l]),s=co(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);Lt(()=>(document.addEventListener("mousemove",i),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",s)}),[o,i,s]);let u=co(()=>{let c=Ls(),d=ys(e._window);if(o.current===null)return;let a=t.querySelector(":scope > .link-editor"),p=a!==null&&"style"in a&&a?.style?.opacity==="1",m=e.getRootElement();if(c!==null&&d!==null&&!d.isCollapsed&&m!==null&&m.contains(d.anchorNode)){let f=Cr(d,m),h=ao({alwaysDisplayOnTop:p,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});r.current&&ao({anchorElem:o.current,anchorFlippedOffset:h,floatingElem:r.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else l()},[e,l,t]);return Lt(()=>{let c=t.parentElement,d=()=>{e.getEditorState().read(()=>{u()})};return window.addEventListener("resize",d),c&&c.addEventListener("scroll",d),()=>{window.removeEventListener("resize",d),c&&c.removeEventListener("scroll",d)}},[e,u,t]),Lt(()=>(e.getEditorState().read(()=>{u()}),Ns(e.registerUpdateListener(({editorState:c})=>{c.read(()=>{u()})}),e.registerCommand(z0,()=>(u(),!1),X0))),[e,u]),Ss("div",{className:"inline-toolbar-popup",ref:o,children:[ce("div",{className:"caret",ref:r}),n?.features&&n.features?.toolbarInline?.groups.map((c,d)=>ce(Q0,{anchorElem:t,editor:e,group:c,index:d},c.key))]})}function t1(t,e){let o=Es(12),[r,n]=Z0(!1),l;o[0]!==t?(l=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let p=Ls(),m=ys(t._window),f=t.getRootElement();if(m!==null&&(!Ts(p)||f===null||!f.contains(m.anchorNode))){n(!1);return}if(!Ts(p))return;if(p.getTextContent()!==""){let x=p.getNodes(),b=!1;for(let T of x)if(J0(T)){n(!0),b=!0;break}b||n(!1)}else n(!1);let h=p.getTextContent().replace(/\n/g,"");if(!p.isCollapsed()&&h===""){n(!1);return}})},o[0]=t,o[1]=l):l=o[1];let i=l,s,u;o[2]!==i?(s=()=>(document.addEventListener("selectionchange",i),document.addEventListener("mouseup",i),()=>{document.removeEventListener("selectionchange",i),document.removeEventListener("mouseup",i)}),u=[i],o[2]=i,o[3]=s,o[4]=u):(s=o[3],u=o[4]),Lt(s,u);let c,d;if(o[5]!==t||o[6]!==i?(c=()=>Ns(t.registerUpdateListener(()=>{i()}),t.registerRootListener(()=>{t.getRootElement()===null&&n(!1)})),d=[t,i],o[5]=t,o[6]=i,o[7]=c,o[8]=d):(c=o[7],d=o[8]),Lt(c,d),!r||!t.isEditable())return null;let a;return o[9]!==e||o[10]!==t?(a=Y0(ce(e1,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=a):a=o[11],a}var Is=t=>{let{anchorElem:e}=t,[o]=K0();return t1(o,e)};var o1=v({plugins:[{Component:Is,position:"floatingAnchorElem"}]});import{TableCellNode as Wh,TableNode as Vh,TableRowNode as Kh}from"@lexical/table";import{jsx as Rs}from"react/jsx-runtime";import"react";var br=()=>Rs("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Rs("path",{clipRule:"evenodd",d:"M5.33333 4.5C4.8731 4.5 4.5 4.8731 4.5 5.33333V7.5H9.5V4.5H5.33333ZM5.33333 3.5C4.32081 3.5 3.5 4.32081 3.5 5.33333V14.6667C3.5 15.6792 4.32081 16.5 5.33333 16.5H14.6667C15.6792 16.5 16.5 15.6792 16.5 14.6667V5.33333C16.5 4.32081 15.6792 3.5 14.6667 3.5H5.33333ZM10.5 4.5V7.5H15.5V5.33333C15.5 4.8731 15.1269 4.5 14.6667 4.5H10.5ZM15.5 8.5H10.5V11.5H15.5V8.5ZM15.5 12.5H10.5V15.5H14.6667C15.1269 15.5 15.5 15.1269 15.5 14.6667V12.5ZM9.5 15.5V12.5H4.5V14.6667C4.5 15.1269 4.8731 15.5 5.33333 15.5H9.5ZM4.5 11.5H9.5V8.5H4.5V11.5Z",fill:"currentColor",fillRule:"evenodd"})});import{$createTableCellNode as r1,$createTableNode as n1,$createTableRowNode as l1,$isTableCellNode as vs,$isTableNode as kr,$isTableRowNode as _r,TableCellHeaderStates as mo,TableCellNode as i1,TableNode as s1,TableRowNode as a1}from"@lexical/table";import{$isParagraphNode as c1,$isTextNode as u1}from"lexical";var Ms=/^\|(.+)\|\s?$/,d1=/^(\| ?:?-*:? ?)+\|\s?$/,Os=({allTransformers:t})=>({type:"element",dependencies:[s1,a1,i1],export:e=>{if(!kr(e))return null;let o=[];for(let r of e.getChildren()){let n=[];if(!_r(r))continue;let l=!1;for(let i of r.getChildren())vs(i)&&(n.push(Kr(t,i).replace(/\n/g,"\\n").trim()),i.__headerState===mo.ROW&&(l=!0));o.push(`| ${n.join(" | ")} |`),l&&o.push(`| ${n.map(i=>"---").join(" | ")} |`)}return o.join(`
39
- `)},regExp:Ms,replace:(e,o,r)=>{let n=r[0];if(!n)return;if(d1.test(n)){let a=e.getPreviousSibling();if(!a||!kr(a))return;let p=a.getChildren(),m=p[p.length-1];if(!m||!_r(m))return;m.getChildren().forEach(f=>{vs(f)&&f.setHeaderStyles(mo.ROW,mo.ROW)}),e.remove();return}let l=Ds(n,t);if(l==null)return;let i=[l],s=e.getPreviousSibling(),u=l.length;for(;s&&!(!c1(s)||s.getChildrenSize()!==1);){let a=s.getFirstChild();if(!u1(a))break;let p=Ds(a.getTextContent(),t);if(p==null)break;u=Math.max(u,p.length),i.unshift(p);let m=s.getPreviousSibling();s.remove(),s=m}let c=n1();for(let a of i){let p=l1();c.append(p);for(let m=0;m<u;m++)p.append(m<a.length?a[m]:As("",t))}let d=e.getPreviousSibling();kr(d)&&m1(d)===u?(d.append(...c.getChildren()),e.remove()):e.replace(c),c.selectEnd()}});function m1(t){let e=t.getFirstChild();return _r(e)?e.getChildrenSize():0}var As=(t,e)=>{t=t.replace(/\\n/g,`
40
- `);let o=r1(mo.NO_STATUS);return Vr(t,e,o),o},Ds=(t,e)=>{let o=t.match(Ms);return!o||!o[1]?null:o[1].split("|").map(r=>As(r,e))};import{c as f1}from"react/compiler-runtime";import{jsx as P,jsxs as Te}from"react/jsx-runtime";import{useLexicalComposerContext as Hs}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as h1}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as Fs,$deleteTableColumnAtSelection as g1,$deleteTableRowAtSelection as x1,$getNodeTriplet as C1,$getTableCellNodeFromLexicalNode as Ps,$getTableColumnIndexFromTableCellNode as b1,$getTableNodeFromLexicalNodeOrThrow as Re,$getTableRowIndexFromTableCellNode as k1,$insertTableColumnAtSelection as _1,$insertTableRowAtSelection as T1,$isTableCellNode as js,$isTableSelection as yt,$mergeCells as w1,$unmergeCell as E1,getTableElement as wr,getTableObserverFromTableElement as Er,TableCellHeaderStates as Ie,TableCellNode as S1}from"@lexical/table";import{mergeRegister as N1}from"@lexical/utils";import{useScrollInfo as L1}from"@payloadcms/ui";import{$getSelection as fo,$isElementNode as y1,$isRangeSelection as Sr,$isTextNode as I1,$setSelection as R1,COMMAND_PRIORITY_CRITICAL as v1,getDOMSelection as D1,isDOMNode as M1,SELECTION_CHANGE_COMMAND as O1}from"lexical";import*as Nr from"react";import{useCallback as ie,useEffect as et,useRef as po,useState as tt}from"react";import{createPortal as Us}from"react-dom";import{jsx as Tr,jsxs as p1}from"react/jsx-runtime";import"react";var $s=()=>p1("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[Tr("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"}),Tr("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"}),Tr("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 Bs(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function A1(){let t=fo();if(Sr(t)&&!t.isCollapsed()||yt(t)&&!t.anchor.is(t.focus)||!Sr(t)&&!yt(t))return!1;let[e]=C1(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function $1(t){let e=t.getLastDescendant();I1(e)?e.select():y1(e)?e.selectEnd():e!==null&&e.selectNext()}function F1({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[l]=Hs(),i=po(null),[s,u]=tt(n),[c,d]=tt({columns:1,rows:1}),[a,p]=tt(!1),[m,f]=tt(!1),{y:h}=L1();et(()=>l.registerMutationListener(S1,_=>{_.get(s.getKey())==="updated"&&l.getEditorState().read(()=>{u(s.getLatest())})},{skipInitialization:!0}),[l,s]),et(()=>{l.getEditorState().read(()=>{let _=fo();if(yt(_)){let L=Bs(_);d(Bs(_)),p(L.columns>1||L.rows>1)}f(A1())})},[l]),et(()=>{let _=e.current,L=i.current,D=l.getRootElement();if(_!=null&&L!=null&&D!=null){let I=D.getBoundingClientRect(),O=_.getBoundingClientRect();L.style.opacity="1";let y=L.getBoundingClientRect(),F=5,G=O.right+F;if(G+y.width>window.innerWidth||G+y.width>I.right){let te=O.left-y.width-F;G=(te<0?F:te)+window.pageXOffset}L.style.left=`${G+window.pageXOffset}px`;let q=O.top;if(q+y.height>window.innerHeight){let te=O.bottom-y.height;q=te<0?F:te}L.style.top=`${q}px`}},[e,i,l,h]),et(()=>{function _(L){i.current!=null&&e.current!=null&&M1(L.target)&&!i.current.contains(L.target)&&!e.current.contains(L.target)&&r(!1)}return window.addEventListener("click",_),()=>window.removeEventListener("click",_)},[r,e]);let x=ie(()=>{l.update(()=>{if(s.isAttached()){let _=Re(s),L=wr(_,l.getElementByKey(_.getKey()));if(L===null)throw new Error("Expected to find tableElement in DOM");let D=Er(L);D!==null&&D.$clearHighlight(),_.markDirty(),u(s.getLatest())}R1(null)})},[l,s]),b=()=>{l.update(()=>{let _=fo();if(!yt(_))return;let D=_.getNodes().filter(js),I=w1(D);I&&($1(I),o())})},T=()=>{l.update(()=>{E1()})},E=ie(_=>{l.update(()=>{for(let L=0;L<c.rows;L++)T1(_);o()})},[l,o,c.rows]),C=ie(_=>{l.update(()=>{for(let L=0;L<c.columns;L++)_1(_);o()})},[l,o,c.columns]),k=ie(()=>{l.update(()=>{x1(),o()})},[l,o]),g=ie(()=>{l.update(()=>{Re(s).remove(),x(),o()})},[l,s,x,o]),w=ie(()=>{l.update(()=>{g1(),o()})},[l,o]),N=ie(()=>{l.update(()=>{let _=Re(s),L=k1(s),[D]=Fs(_,null,null),I=new Set,O=s.getHeaderStyles()^Ie.ROW;if(D[L])for(let y=0;y<D[L].length;y++){let F=D[L][y];F?.cell&&(I.has(F.cell)||(I.add(F.cell),F.cell.setHeaderStyles(O,Ie.ROW)))}x(),o()})},[l,s,x,o]),M=ie(()=>{l.update(()=>{let _=Re(s),L=b1(s),[D]=Fs(_,null,null),I=new Set,O=s.getHeaderStyles()^Ie.COLUMN;if(D)for(let y=0;y<D.length;y++){let F=D?.[y]?.[L];F?.cell&&(I.has(F.cell)||(I.add(F.cell),F.cell.setHeaderStyles(O,Ie.COLUMN)))}x(),o()})},[l,s,x,o]),$=ie(()=>{l.update(()=>{if(s.isAttached()){let _=Re(s);_&&_.setRowStriping(!_.getRowStriping())}x(),o()})},[l,s,x,o]),R=ie(()=>{l.update(()=>{if(s.isAttached()){let _=Re(s);_&&_.setFrozenColumns(_.getFrozenColumns()===0?1:0)}x(),o()})},[l,s,x,o]),S=null;return t&&(a?S=P("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>b(),type:"button",children:P("span",{className:"text",children:"Merge cells"})}):m&&(S=P("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>T(),type:"button",children:P("span",{className:"text",children:"Unmerge cells"})}))),Us(Te("div",{className:"table-action-menu-dropdown",onClick:_=>{_.stopPropagation()},ref:i,children:[S?Te(Nr.Fragment,{children:[S,P("hr",{})]}):null,P("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>$(),type:"button",children:P("span",{className:"text",children:"Toggle Row Striping"})}),P("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>R(),type:"button",children:P("span",{className:"text",children:"Toggle First Column Freeze"})}),P("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>E(!1),type:"button",children:Te("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," above"]})}),P("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>E(!0),type:"button",children:Te("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," below"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>C(!1),type:"button",children:Te("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","left"]})}),P("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>C(!0),type:"button",children:Te("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","right"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>w(),type:"button",children:P("span",{className:"text",children:"Delete column"})}),P("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>k(),type:"button",children:P("span",{className:"text",children:"Delete row"})}),P("button",{className:"item","data-test-id":"table-delete",onClick:()=>g(),type:"button",children:P("span",{className:"text",children:"Delete table"})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-row-header",onClick:()=>N(),type:"button",children:Te("span",{className:"text",children:[(s.__headerState&Ie.ROW)===Ie.ROW?"Remove":"Add"," ","row header"]})}),P("button",{className:"item","data-test-id":"table-column-header",onClick:()=>M(),type:"button",children:Te("span",{className:"text",children:[(s.__headerState&Ie.COLUMN)===Ie.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function P1({anchorElem:t,cellMerge:e}){let[o]=Hs(),r=po(null),n=po(null),[l,i]=tt(!1),[s,u]=tt(null),c=ie(()=>{let a=r.current,p=fo(),m=D1(o._window),f=document.activeElement;function h(){a&&(a.classList.remove("table-cell-action-button-container--active"),a.classList.add("table-cell-action-button-container--inactive")),u(null)}if(p==null||a==null)return h();let x=o.getRootElement(),b=null,T=null;if(Sr(p)&&x!==null&&m!==null&&x.contains(m.anchorNode)){let C=Ps(p.anchor.getNode());if(C==null||(T=o.getElementByKey(C.getKey()),T==null||!C.isAttached()))return h();let k=Re(C),g=wr(k,o.getElementByKey(k.getKey()));if(g===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");b=Er(g),u(C)}else if(yt(p)){let C=Ps(p.anchor.getNode());if(!js(C))throw new Error("TableSelection anchorNode must be a TableCellNode");let k=Re(C),g=wr(k,o.getElementByKey(k.getKey()));if(g===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");b=Er(g),T=o.getElementByKey(C.getKey())}else if(!f)return h();if(b===null||T===null)return h();let E=!b||!b.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",E),a.classList.toggle("table-cell-action-button-container--inactive",!E),E){let C=T.getBoundingClientRect(),k=t.getBoundingClientRect(),g=C.top-k.top,w=C.right-k.left;a.style.transform=`translate(${w}px, ${g}px)`}},[o,t]);et(()=>{let a,p=()=>{a=void 0,o.getEditorState().read(c)},m=()=>(a===void 0&&(a=setTimeout(p,0)),!1);return N1(o.registerUpdateListener(m),o.registerCommand(O1,m,v1),o.registerRootListener((f,h)=>{h&&h.removeEventListener("pointerup",m),f&&(f.addEventListener("pointerup",m),m())}),()=>clearTimeout(a))});let d=po(s);return et(()=>{d.current!==s&&i(!1),d.current=s},[d,s]),P("div",{className:"table-cell-action-button-container",ref:r,children:s!=null&&Te(Nr.Fragment,{children:[P("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),i(!l)},ref:n,type:"button",children:P($s,{})}),l&&P(F1,{cellMerge:e,contextRef:n,onClose:()=>i(!1),setIsMenuOpen:i,tableCellNode:s})]})})}var Gs=t=>{let e=f1(3),{anchorElem:o}=t,r=h1(),n;return e[0]!==o||e[1]!==r?(n=Us(r?P(P1,{anchorElem:o??document.body,cellMerge:!0}):null,o??document.body),e[0]=o,e[1]=r,e[2]=n):n=e[2],n};import{c as B1}from"react/compiler-runtime";import{jsx as go,jsxs as H1}from"react/jsx-runtime";import{useLexicalComposerContext as j1}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as U1}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as G1,$getTableNodeFromLexicalNodeOrThrow as Lr,$getTableRowIndexFromTableCellNode as W1,$isTableCellNode as Ws,$isTableRowNode as V1,getDOMCellFromTarget as K1,getTableElement as J1,TableNode as Vs}from"@lexical/table";import{calculateZoomLevel as Ks,mergeRegister as X1}from"@lexical/utils";import{$getNearestNodeFromDOMNode as yr,isHTMLElement as z1,SKIP_SCROLL_INTO_VIEW_TAG as Js}from"lexical";import*as zs from"react";import{useCallback as It,useEffect as Ir,useRef as ho,useState as ot}from"react";import{createPortal as Z1}from"react-dom";var Y1=33,Xs=92;function q1({editor:t}){let e=ho(null),o=ho(null),r=ho(null),[n,l]=ot(!1),i=H(),s=ho(null),[u,c]=ot(null),[d,a]=ot(null),[p,m]=ot(!1),[f,h]=ot(null),x=It(()=>{a(null),e.current=null,h(null),s.current=null,r.current=null},[]),b=R=>(R.buttons&1)===1;Ir(()=>{let R=new Set;return X1(t.registerMutationListener(Vs,S=>{for(let[_,L]of S)L==="destroyed"?R.delete(_):R.add(_);l(R.size>0)}),t.registerNodeTransform(Vs,S=>{if(S.getColWidths())return S;let _=S.getColumnCount(),L=Xs;return S.setColWidths(Array(_).fill(L)),S}))},[t]),Ir(()=>{if(!n)return;let R=D=>{let I=D.target;if(z1(I)){if(f){c({x:D.clientX,y:D.clientY});return}if(m(b(D)),!(o.current&&o.current.contains(I))&&e.current!==I){e.current=I;let O=K1(I);O&&d!==O?t.getEditorState().read(()=>{let y=yr(O.elem);if(!y)throw new Error("TableCellResizer: Table cell node not found.");let F=Lr(y),G=J1(F,t.getElementByKey(F.getKey()));if(!G)throw new Error("TableCellResizer: Table element not found.");e.current=I,r.current=G.getBoundingClientRect(),a(O)},{editor:t}):O==null&&x()}}},S=D=>{m(!0)},_=D=>{m(!1)},L=t.registerRootListener((D,I)=>{I?.removeEventListener("mousemove",R),I?.removeEventListener("mousedown",S),I?.removeEventListener("mouseup",_),D?.addEventListener("mousemove",R),D?.addEventListener("mousedown",S),D?.addEventListener("mouseup",_)});return()=>{L()}},[d,f,t,n,x]);let T=R=>R==="bottom",E=It(R=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let S=yr(d.elem);if(!Ws(S))throw new Error("TableCellResizer: Table cell node not found.");let _=Lr(S),L=W1(S),D=_.getChildren(),O=S.getColSpan()===_.getColumnCount()?L:L+S.getRowSpan()-1;if(O>=D.length||O<0)throw new Error("Expected table cell to be inside of table row.");let y=D[O];if(!V1(y))throw new Error("Expected table row");let F=y.getHeight();if(F===void 0){let q=y.getChildren();F=Math.min(...q.map(te=>C(te,t)??1/0))}let G=Math.max(F+R,Y1);y.setHeight(G)},{tag:Js})},[d,t]),C=(R,S)=>S.getElementByKey(R.getKey())?.clientHeight,k=(R,S)=>{let _;return S.forEach(L=>{L.forEach((D,I)=>{D.cell===R&&(_=I)})}),_},g=It(R=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let S=yr(d.elem);if(!Ws(S))throw new Error("TableCellResizer: Table cell node not found.");let _=Lr(S),[L]=G1(_,null,null),D=k(S,L);if(D===void 0)throw new Error("TableCellResizer: Table column not found.");let I=_.getColWidths();if(!I)return;let O=I[D];if(O===void 0)return;let y=[...I],F=Math.max(O+R,Xs);y[D]=F,_.setColWidths(y)},{tag:Js})},[d,t]),w=It(R=>{let S=_=>{if(_.preventDefault(),_.stopPropagation(),!d)throw new Error("TableCellResizer: Expected active cell.");if(s.current){let{x:L,y:D}=s.current;if(d===null)return;let I=Ks(_.target);if(T(R)){let O=(_.clientY-D)/I;E(O)}else{let O=(_.clientX-L)/I;g(O)}x(),document.removeEventListener("mouseup",S)}};return S},[d,x,g,E]),N=It(R=>S=>{if(S.preventDefault(),S.stopPropagation(),!d)throw new Error("TableCellResizer: Expected active cell.");s.current={x:S.clientX,y:S.clientY},c(s.current),h(R),document.addEventListener("mouseup",w(R))},[d,w]),[M,$]=ot({bottom:null,left:null,right:null,top:null});return Ir(()=>{if(d){let{height:R,left:S,top:_,width:L}=d.elem.getBoundingClientRect(),D=Ks(d.elem),I=10,O={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${I}px`,left:`${window.scrollX+S}px`,top:`${window.scrollY+_+R-I/2}px`,width:`${L}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${R}px`,left:`${window.scrollX+S+L-I/2}px`,top:`${window.scrollY+_}px`,width:`${I}px`}},y=r.current;f&&u&&y&&(T(f)?(O[f].left=`${window.scrollX+y.left}px`,O[f].top=`${window.scrollY+u.y/D}px`,O[f].height="3px",O[f].width=`${y.width}px`):(O[f].top=`${window.scrollY+y.top}px`,O[f].left=`${window.scrollX+u.x/D}px`,O[f].width="3px",O[f].height=`${y.height}px`),O[f].backgroundColor="#adf"),$(O)}else $({bottom:null,left:null,right:null,top:null})},[d,f,u]),go("div",{ref:o,children:d!=null&&!p&&H1(zs.Fragment,{children:[go("div",{className:`${i.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:N("right"),style:M.right||void 0}),go("div",{className:`${i.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:N("bottom"),style:M.bottom||void 0})]})})}var Zs=()=>{let t=B1(3),[e]=j1(),o=U1(),r;return t[0]!==e||t[1]!==o?(r=o?Z1(go(q1,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=r):r=t[2],r};import{c as ih}from"react/compiler-runtime";import{jsx as Rr,jsxs as sh,Fragment as ah}from"react/jsx-runtime";import{useLexicalComposerContext as na}from"@lexical/react/LexicalComposerContext";import{$getTableAndElementByKey as ch,$getTableColumnIndexFromTableCellNode as uh,$getTableRowIndexFromTableCellNode as dh,$insertTableColumnAtSelection as mh,$insertTableRowAtSelection as ph,$isTableCellNode as fh,$isTableNode as Qs,getTableElement as hh,TableNode as gh}from"@lexical/table";import{$findMatchingParent as xh,mergeRegister as Ch}from"@lexical/utils";import{$getNearestNodeFromDOMNode as ea,isHTMLElement as bh}from"lexical";import{useEffect as ta,useMemo as kh,useRef as oa,useState as xo}from"react";import"react";import{createPortal as _h}from"react-dom";import{c as rh}from"react/compiler-runtime";import{useEffect as nh,useRef as lh}from"react";var Q1="Expected a function",eh=Math.max,th=Math.min;function oh(t,e,o){let r,n,l=0,i,s=!1,u=!1,c,d,a,p=!0;if(typeof t!="function")throw new TypeError(Q1);e=e||0,typeof o=="object"&&(s=!!o.leading,u="maxWait"in o,c=u?eh(o.maxWait||0,e):c,p="trailing"in o?!!o.trailing:p);function m(g){let w=r,N=i;return r=i=void 0,l=g,d=t.apply(N,w),d}function f(g){return l=g,a=setTimeout(b,e),s?m(g):d}function h(g){let w=g-n,N=g-l,M=e-w;return u?th(M,c-N):M}function x(g){let w=g-n,N=g-l;return n===void 0||w>=e||w<0||u&&N>=c}function b(){let g=Date.now();if(x(g))return T(g);a=setTimeout(b,h(g))}function T(g){return a=void 0,p&&r?m(g):(r=i=void 0,d)}function E(){a!==void 0&&clearTimeout(a),l=0,r=n=i=a=void 0}function C(){return a===void 0?d:T(Date.now())}function k(){let g=Date.now(),w=x(g);if(r=arguments,i=this,n=g,w){if(a===void 0)return f(n);if(u)return clearTimeout(a),a=setTimeout(b,e),m(n)}return a===void 0&&(a=setTimeout(b,e)),d}return k.cancel=E,k.flush=C,k}var Ys=oh;function qs(t,e,o){let r=rh(6),n=lh(null),l,i;r[0]!==t||r[1]!==o||r[2]!==e?(l=()=>(n.current=Ys(t,e,{maxWait:o}),()=>{n.current?.cancel()}),i=[t,e,o],r[0]=t,r[1]=o,r[2]=e,r[3]=l,r[4]=i):(l=r[3],i=r[4]),nh(l,i);let s;return r[5]===Symbol.for("react.memo_cache_sentinel")?(s=(...c)=>{let d=c;n.current&&n.current(...d)},r[5]=s):s=r[5],s}var ra=20;function Th({anchorElem:t}){let[e]=na(),o=H(),[r,n]=xo(!1),[l,i]=xo(!1),[s,u]=xo(!1),[c,d]=xo({}),a=oa(new Set),p=oa(null),m=qs(x=>{let{isOutside:b,tableDOMNode:T}=wh(x,o.editorConfig?.lexical);if(b){n(!1),i(!1);return}if(!T)return;p.current=T;let E=null,C=null,k=null;if(e.getEditorState().read(()=>{let I=ea(T);if(fh(I)){let O=xh(I,y=>Qs(y));if(!Qs(O))return;if(k=hh(O,e.getElementByKey(O.getKey())),k){let y=O.getChildrenSize(),F=O.getChildAtIndex(0)?.getChildrenSize(),G=dh(I),q=uh(I);G===y-1?E=I:q===F-1&&(C=I)}}},{editor:e}),!k)return;let g=k.parentElement;if(!g)return;let{bottom:w,height:N,left:M,right:$,width:R,y:S}=k.getBoundingClientRect(),_=!1;g&&g.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(_=g.scrollWidth>g.clientWidth);let{left:L,y:D}=t.getBoundingClientRect();E?(i(!1),n(!0),d({height:ra,left:_&&g?g.offsetLeft:M-L,top:w-D+5,width:_&&g?g.offsetWidth:R})):C&&(i(!0),n(!1),d({height:N,left:$-L+5,top:S-D,width:ra}))},50,250),f=kh(()=>new ResizeObserver(()=>{n(!1),i(!1)}),[]);ta(()=>{if(s)return document.addEventListener("mousemove",m),()=>{n(!1),i(!1),document.removeEventListener("mousemove",m)}},[s,m]),ta(()=>Ch(e.registerMutationListener(gh,x=>{e.getEditorState().read(()=>{let b=!1;for(let[T,E]of x)switch(E){case"created":{a.current.add(T),b=!0;break}case"destroyed":{a.current.delete(T),b=!0;break}default:break}if(b){f.disconnect();for(let T of a.current){let{tableElement:E}=ch(T);f.observe(E)}u(a.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,f]);let h=x=>{e.update(()=>{p.current&&(ea(p.current)?.selectEnd(),x?(ph(),n(!1)):(mh(),i(!1)))})};return e?.isEditable()?sh(ah,{children:[r&&Rr("button",{"aria-label":"Add Row",className:o.editorConfig.lexical.theme.tableAddRows,onClick:()=>h(!0),style:{...c},type:"button"}),l&&Rr("button",{"aria-label":"Add Column",className:o.editorConfig.lexical.theme.tableAddColumns,onClick:()=>h(!1),style:{...c},type:"button"})]}):null}function wh(t,e){let o=t.target;if(bh(o)){let r=o.closest(`td.${e.theme.tableCell}, th.${e.theme.tableCell}`);return{isOutside:!(r||o.closest(`button.${e.theme.tableAddRows}`)||o.closest(`button.${e.theme.tableAddColumns}`)||o.closest(`div.${e.theme.tableCellResizer}`)),tableDOMNode:r}}else return{isOutside:!0,tableDOMNode:null}}function la(t){let e=ih(2),{anchorElem:o}=t,r=o===void 0?document.body:o,[n]=na();if(!n?.isEditable())return null;let l;return e[0]!==r?(l=_h(Rr(Th,{anchorElem:r}),r),e[0]=r,e[1]=l):l=e[1],l}import{c as Eh}from"react/compiler-runtime";import{jsx as vr,jsxs as Sh}from"react/jsx-runtime";import{useLexicalComposerContext as Nh}from"@lexical/react/LexicalComposerContext";import{TablePlugin as Lh}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as yh,TableCellNode as Ih,TableNode as Rh,TableRowNode as vh}from"@lexical/table";import{mergeRegister as Dh}from"@lexical/utils";import{formatDrawerSlug as Mh,useEditDepth as Oh}from"@payloadcms/ui";import{$getSelection as Ah,$isRangeSelection as $h,COMMAND_PRIORITY_EDITOR as Fh,createCommand as Ph}from"lexical";import{createContext as Bh,use as Hh,useEffect as jh,useMemo as Uh,useState as Gh}from"react";import*as ia from"react";var Co=Ph("OPEN_EMBED_DRAWER_COMMAND"),sa=Bh({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function aa({children:t}){let[e,o]=Gh({cellEditorConfig:null,cellEditorPlugins:null});return vr(sa,{value:Uh(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var ca=()=>{let t=Eh(16),[e]=Nh(),o=Hh(sa),r=Oh(),{fieldProps:n,uuid:l}=H(),{schemaPath:i}=n,s="lexical-table-create-"+l,u;t[0]!==r||t[1]!==s?(u=Mh({slug:s,depth:r}),t[0]=r,t[1]=s,t[2]=u):u=t[2];let c=u,{toggleDrawer:d}=me(c,!0),a;t[3]!==e||t[4]!==d?(a=()=>{if(!e.hasNodes([Rh,vh,Ih]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return Dh(e.registerCommand(Co,()=>{let h=null;return e.getEditorState().read(()=>{let x=Ah();$h(x)&&(h=x)}),h&&d(),!0},Fh))},t[3]=e,t[4]=d,t[5]=a):a=t[5];let p;t[6]!==o||t[7]!==e||t[8]!==d?(p=[o,e,d],t[6]=o,t[7]=e,t[8]=d,t[9]=p):p=t[9],jh(a,p);let m;t[10]!==e?(m=(h,x)=>{!x.columns||!x.rows||e.dispatchCommand(yh,{columns:String(x.columns),rows:String(x.rows)})},t[10]=e,t[11]=m):m=t[11];let f;return t[12]!==c||t[13]!==i||t[14]!==m?(f=Sh(ia.Fragment,{children:[vr(nt,{drawerSlug:c,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:m,schemaPath:i,schemaPathSuffix:"fields"}),vr(Lh,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]}),t[12]=c,t[13]=i,t[14]=m,t[15]=f):f=t[15],f};var Jh=v({markdownTransformers:[Os],nodes:[Vh,Wh,Kh],plugins:[{Component:ca,position:"normal"},{Component:Zs,position:"normal"},{Component:Gs,position:"floatingAnchorElem"},{Component:la,position:"floatingAnchorElem"}],providers:[aa],slashMenu:{groups:[Z([{Icon:br,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Co,{})}}])]},toolbarFixed:{groups:[he([{ChildComponent:br,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Co,{})}}])]}});import{$isNodeSelection as Pg}from"lexical";import{jsx as Dr,jsxs as Xh}from"react/jsx-runtime";import"react";var Mr=()=>Xh("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:[Dr("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"}),Dr("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"}),Dr("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{jsx as Qh}from"react/jsx-runtime";import{$applyNodeReplacement as eg}from"lexical";import*as ma from"react";import zh from"bson-objectid";function bo(t,e){if(t.hasAttribute("data-lexical-pending-upload-form-id")){let r=t.getAttribute("data-lexical-pending-upload-form-id");if(r!=null)return{node:e({data:{formID:r,src:t.getAttribute("src")||""}})}}return{node:e({data:{formID:new zh.default().toHexString(),src:t.getAttribute("src")||""}})}}function ko(t,e){if(t.hasAttribute("data-lexical-upload-relation-to")&&t.hasAttribute("data-lexical-upload-id")){let o=t.getAttribute("data-lexical-upload-id"),r=t.getAttribute("data-lexical-upload-relation-to");if(o!=null&&r!=null)return{node:e({data:{fields:{},relationTo:r,value:o}})}}return null}import{jsx as Zh}from"react/jsx-runtime";import{DecoratorBlockNode as Yh}from"@lexical/react/LexicalDecoratorBlockNode.js";import{$applyNodeReplacement as qh}from"lexical";import"react";var Rt=class extends Yh{__data;constructor({data:e,format:o,key:r}){super(o,r),this.__data=e}static clone(e){return new this({data:e.__data,format:e.__format,key:e.__key})}static getType(){return"pendingUpload"}static importDOM(){return{img:e=>({conversion:o=>bo(o,ua),priority:0})}}static importJSON(e){let o={formID:e.formID,src:e.src},r=ua({data:o});return r.setFormat(e.format),r}static isInline(){return!1}decorate(){return Zh(RawUploadComponent,{data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportDOM(){let e=document.createElement("img");return e.setAttribute("data-lexical-pending-upload-form-id",String(this.__data?.formID)),e.setAttribute("src",this.__data?.src||""),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"pendingUpload",version:1}}getData(){return this.getLatest().__data}setData(e){let o=this.getWritable();o.__data=e}updateDOM(){return!1}};function ua({data:t}){return qh(new Rt({data:t}))}var tg=ma.lazy(()=>import("./pendingComponent-WFSCE6LJ.js").then(t=>({default:t.PendingUploadComponent}))),ue=class extends Rt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{img:()=>({conversion:e=>bo(e,da),priority:0})}}static importJSON(e){let o={formID:e.formID,src:e.src},r=da({data:o});return r.setFormat(e.format),r}decorate(){return Qh(tg,{data:this.__data,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function da({data:t}){return eg(new ue({data:t}))}function Or(t){return t instanceof ue}import{jsx as ng}from"react/jsx-runtime";import ha from"bson-objectid";import{$applyNodeReplacement as lg}from"lexical";import*as ga from"react";import{DecoratorBlockNode as og}from"@lexical/react/LexicalDecoratorBlockNode.js";import fa from"bson-objectid";import{$applyNodeReplacement as rg}from"lexical";var vt=class extends og{__data;constructor({data:e,format:o,key:r}){super(o,r),this.__data=e}static clone(e){return new this({data:e.__data,format:e.__format,key:e.__key})}static getType(){return"upload"}static importDOM(){return{img:e=>({conversion:o=>ko(o,pa),priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new fa.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,relationTo:e.relationTo,value:e.value},r=pa({data:o});return r.setFormat(e.format),r}static isInline(){return!1}decorate(){return null}exportDOM(){let e=document.createElement("img");return e.setAttribute("data-lexical-upload-id",String(this.__data?.value)),e.setAttribute("data-lexical-upload-relation-to",this.__data?.relationTo),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"upload",version:3}}getData(){return this.getLatest().__data}setData(e){let o=this.getWritable();o.__data=e}updateDOM(){return!1}};function pa({data:t}){return t?.id||(t.id=new fa.default().toHexString()),rg(new vt({data:t}))}var ig=ga.lazy(()=>import("./component-3PENNOM3.js").then(t=>({default:t.UploadComponent}))),we=class extends vt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{img:e=>({conversion:o=>ko(o,ve),priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new ha.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,relationTo:e.relationTo,value:e.value},r=ve({data:o});return r.setFormat(e.format),r}decorate(){return ng(ig,{data:this.__data,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function ve({data:t}){return t?.id||(t.id=new ha.default().toHexString()),lg(new we({data:t}))}function Ar(t){return t instanceof we}import{c as fg}from"react/compiler-runtime";import{jsx as hg}from"react/jsx-runtime";import{useLexicalComposerContext as gg}from"@lexical/react/LexicalComposerContext.js";import{$dfsIterator as La,$insertNodeToNearestRoot as Pr,mergeRegister as xg}from"@lexical/utils";import{useBulkUpload as Cg,useConfig as bg,useEffectEvent as kg,useModal as _g}from"@payloadcms/ui";import Br from"bson-objectid";import{$createRangeSelection as Tg,$getPreviousSelection as Ta,$getSelection as wa,$isParagraphNode as Hr,$isRangeSelection as Ea,$setSelection as wg,COMMAND_PRIORITY_EDITOR as Eg,COMMAND_PRIORITY_LOW as Sa,createCommand as Sg,DROP_COMMAND as Ng,getDOMSelectionFromTarget as Lg,isHTMLElement as Na,PASTE_COMMAND as yg}from"lexical";import{useEffect as Ig}from"react";import{c as xa}from"react/compiler-runtime";import{jsx as $r}from"react/jsx-runtime";import{useLexicalComposerContext as Ca}from"@lexical/react/LexicalComposerContext.js";import{toast as sg}from"@payloadcms/ui";import{$getNodeByKey as ag,COMMAND_PRIORITY_EDITOR as ba}from"lexical";import{useEffect as ka,useState as cg}from"react";var ug=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=ag(o);n&&n.replace(ve({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(Fr,{fields:null,relationTo:e,value:r})},dg=t=>{let e=xa(13),{enabledCollectionSlugs:o}=t,[r]=Ca(),[n,l]=cg(null),i;e[0]!==o?(i={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=i):i=e[1];let{closeListDrawer:s,ListDrawer:u,openListDrawer:c}=St(i),d,a;e[2]!==r||e[3]!==c?(d=()=>r.registerCommand(Ge,h=>(l(h?.replace?h?.replace.nodeKey:null),c(),!0),ba),a=[r,c],e[2]=r,e[3]=c,e[4]=d,e[5]=a):(d=e[4],a=e[5]),ka(d,a);let p;e[6]!==s||e[7]!==r||e[8]!==n?(p=h=>{let{collectionSlug:x,doc:b}=h;s(),ug({editor:r,relationTo:x,replaceNodeKey:n,value:b.id})},e[6]=s,e[7]=r,e[8]=n,e[9]=p):p=e[9];let m=p,f;return e[10]!==u||e[11]!==m?(f=$r(u,{onSelect:m}),e[10]=u,e[11]=m,e[12]=f):f=e[12],f},mg=()=>{let t=xa(3),[e]=Ca(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Ge,pg,ba),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),ka(o,r),null},_a=t=>$r($t,{...t,FallbackComponent:mg,uploads:!0,children:$r(dg,{...t})});function pg(){return sg.error("No upload collections enabled"),!0}function Rg(t){let e=t.target;return!!(Na(e)&&!e.closest("code, span.editor-image")&&Na(e.parentElement)&&e.parentElement.closest("div.ContentEditable__root"))}function vg(t){let e,o=Lg(t.target);if(document.caretRangeFromPoint)e=document.caretRangeFromPoint(t.clientX,t.clientY);else if(t.rangeParent&&o!==null)o.collapse(t.rangeParent,t.rangeOffset||0),e=o.getRangeAt(0);else throw Error("Cannot get the selection when dragging");return e}var Fr=Sg("INSERT_UPLOAD_COMMAND"),ya=()=>{let t=fg(18),[e]=gg(),{config:o}=bg(),{collections:r}=o,{drawerSlug:n,setCollectionSlug:l,setInitialForms:i,setOnCancel:s,setOnSuccess:u,setSelectableCollections:c}=Cg(),{isModalOpen:d,openModal:a}=_g(),p;t[0]!==n||t[1]!==r||t[2]!==e||t[3]!==d||t[4]!==a||t[5]!==l||t[6]!==i||t[7]!==s||t[8]!==u||t[9]!==c?(p=b=>{let{files:T}=b;if(T?.length!==0&&(i(E=>[...E??[],...T.map(Dg)]),!d(n))){let E=r.filter(Mg).map(Og);if(!E.length||!E[0])return;l(E[0]),c(E),s(()=>{e.update(Ag)}),u(C=>{let k=new Map(C.map($g));e.update(()=>{for(let g of La()){let w=g.node;if(Or(w)){let N=k.get(w.getData().formID);N&&w.replace(ve({data:{id:new Br.default().toHexString(),fields:N.doc,relationTo:N.collectionSlug,value:N.doc.id}}))}}})}),a(n)}},t[0]=n,t[1]=r,t[2]=e,t[3]=d,t[4]=a,t[5]=l,t[6]=i,t[7]=s,t[8]=u,t[9]=c,t[10]=p):p=t[10];let m=kg(p),f;t[11]!==e||t[12]!==m?(f=()=>{if(!e.hasNodes([we]))throw new Error("UploadPlugin: UploadNode not registered on editor");return xg(e.registerNodeTransform(ue,b=>{let T=b.getData();(async function(){let k=null,g=T.src,w=T.formID;if(g.startsWith("data:")){let N=g.match(/data:(image\/[a-zA-Z]+);base64,/),M=N?N[1]:"image/png",$=g.replace(/^data:image\/[a-zA-Z]+;base64,/,""),R=atob($),S=new Array(R.length);for(let D=0;D<R.length;D++)S[D]=R.charCodeAt(D);let _=new Uint8Array(S);k={alt:void 0,file:new File([_],"pasted-image."+M?.split("/")[1],{type:M}),formID:w}}else if(g.startsWith("http")||g.startsWith("https")){let M=await(await fetch(g)).blob(),$=g.split("/").pop()||"pasted-image"+M.type.split("/")[1];k={alt:void 0,file:new File([M],$,{type:M.type}),formID:w}}k&&m({files:[k]})})()}),e.registerCommand(Fr,b=>(e.update(()=>{let T=wa()||Ta();if(Ea(T)){let E=ve({data:{id:b.id,fields:b.fields,relationTo:b.relationTo,value:b.value}}),{focus:C}=T,k=C.getNode();Pr(E),Hr(k)&&!k.__first&&k.remove()}}),!0),Eg),e.registerCommand(yg,b=>{if(!(b instanceof ClipboardEvent))return!1;let T=b.clipboardData;if(!T?.types?.length||T?.types?.includes("text/html"))return!1;let E=[];return T?.files?.length&&Array.from(T.files).forEach(C=>{E.push({alt:"",file:C,formID:new Br.default().toHexString()})}),E.length?(e.update(()=>{let C=wa()||Ta();if(Ea(C))for(let k of E){let g=new ue({data:{formID:k.formID,src:URL.createObjectURL(k.file)}}),{focus:w}=C,N=w.getNode();Pr(g),Hr(N)&&!N.__first&&N.remove()}}),m({files:E}),!0):!1},Sa),e.registerCommand(Ng,b=>{if(!(b instanceof DragEvent))return!1;let T=b.dataTransfer;if(!T?.types?.length)return!1;let E=[];return T?.files?.length&&Array.from(T.files).forEach(C=>{E.push({alt:"",file:C,formID:new Br.default().toHexString()})}),E.length?(b.preventDefault(),b.stopPropagation(),e.update(()=>{if(Rg(b)){let C=vg(b),k=Tg();C!=null&&k.applyDOMRange(C),wg(k);for(let g of E){let w=new ue({data:{formID:g.formID,src:URL.createObjectURL(g.file)}}),{focus:N}=k,M=N.getNode();Pr(w),Hr(M)&&!M.__first&&M.remove()}}}),m({files:E}),!0):!1},Sa))},t[11]=e,t[12]=m,t[13]=f):f=t[13];let h;t[14]!==e?(h=[e],t[14]=e,t[15]=h):h=t[15],Ig(f,h);let x;return t[16]!==r?(x=hg(_a,{enabledCollectionSlugs:r.map(Fg)}),t[16]=r,t[17]=x):x=t[17],x};function Dg(t){return{file:t.file,formID:t.formID}}function Mg(t){let{upload:e}=t;return!!e}function Og(t){let{slug:e}=t;return e}function Ag(){for(let t of La()){let e=t.node;Or(e)&&e.remove()}}function $g(t){return[t.formID,t]}function Fg(t){let{slug:e}=t;return e}var Bg=v({nodes:[we,ue],plugins:[{Component:ya,position:"normal"}],slashMenu:{groups:[Z([{Icon:Mr,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ge,{replace:!1})}}])]},toolbarFixed:{groups:[he([{ChildComponent:Mr,isActive:({selection:t})=>{if(!Pg(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Ar(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ge,{replace:!1})}}])]}});import{c as jg}from"react/compiler-runtime";import{jsx as Ur}from"react/jsx-runtime";import{ShimmerEffect as Ug,useConfig as Gg}from"@payloadcms/ui";import{lazy as Wg,Suspense as Vg,useEffect as Kg,useState as Jg}from"react";var Ia={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",hrSelected:"LexicalEditorTheme__hrSelected",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",tab:"LexicalEditorTheme__tabNode",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableAlignment:{center:"LexicalEditorTheme__tableAlignmentCenter",right:"LexicalEditorTheme__tableAlignmentRight"},tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableFrozenColumn:"LexicalEditorTheme__tableFrozenColumn",tableRowStriping:"LexicalEditorTheme__tableRowStriping",tableScrollableWrapper:"LexicalEditorTheme__tableScrollableWrapper",tableSelected:"LexicalEditorTheme__tableSelected",tableSelection:"LexicalEditorTheme__tableSelection",text:{bold:"LexicalEditorTheme__textBold",code:"LexicalEditorTheme__textCode",italic:"LexicalEditorTheme__textItalic",strikethrough:"LexicalEditorTheme__textStrikethrough",subscript:"LexicalEditorTheme__textSubscript",superscript:"LexicalEditorTheme__textSuperscript",underline:"LexicalEditorTheme__textUnderline",underlineStrikethrough:"LexicalEditorTheme__textUnderlineStrikethrough"},upload:"editor-upload"};var _o={namespace:"lexical",theme:Ia};function Ra({config:t,featureClientImportMap:e,featureClientSchemaMap:o,field:r,schemaPath:n,unSanitizedEditorConfig:l}){for(let c of l.features)if(!c?.clientFeatureProps?.featureKey||c?.clientFeatureProps?.order===void 0||c?.clientFeatureProps?.order===null)throw new Error("A Feature you have installed does not return the client props as clientFeatureProps. Please make sure to always return those props, even if they are null, as other important props like order and featureKey are later on injected.");l.features=l.features.sort((c,d)=>c.clientFeatureProps.order-d.clientFeatureProps.order);let i=new Map;for(let c of l.features)i.set(c.clientFeatureProps.featureKey,c);let s=new Map,u=0;for(let c of l.features){let d=typeof c.feature=="function"?c.feature({config:t,featureClientImportMap:e,featureClientSchemaMap:o,featureProviderMap:i,field:r,resolvedFeatures:s,schemaPath:n,unSanitizedEditorConfig:l}):c.feature;d.key=c.clientFeatureProps.featureKey,d.order=u,s.set(c.clientFeatureProps.featureKey,d),u++}return s}import{deepMerge as Hg}from"payload/shared";var va=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}},o={};if(t.forEach(r=>{r.key==="toolbarFixed"&&r.sanitizedClientFeatureProps?.customGroups&&(o={...o,...r.sanitizedClientFeatureProps.customGroups})}),!t?.size)return e;t.forEach(r=>{if(r.providers?.length&&(e.providers=e.providers.concat(r.providers)),r.enableFormats?.length&&e.enabledFormats.push(...r.enableFormats),r.nodes?.length)for(let n of r.nodes)e.nodes.push(n);if(r.plugins?.length&&r.plugins.forEach((n,l)=>{e.plugins?.push({clientProps:r.sanitizedClientFeatureProps,Component:n.Component,key:r.key+l,position:n.position})}),r.toolbarInline?.groups?.length)for(let n of r.toolbarInline.groups){let l=e.toolbarInline.groups.find(i=>i.key===n.key);l?e.toolbarInline.groups=e.toolbarInline.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.toolbarInline?.groups.push(l)}if(r.toolbarFixed?.groups?.length)for(let n of r.toolbarFixed.groups){let l=e.toolbarFixed.groups.find(i=>i.key===n.key);l?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.toolbarFixed?.groups.push(l)}if(r.slashMenu?.groups){r.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(r.slashMenu.dynamicGroups));for(let n of r.slashMenu.groups){let l=e.slashMenu.groups.find(i=>i.key===n.key);l?e.slashMenu.groups=e.slashMenu.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.slashMenu.groups.push(l)}}if(r.markdownTransformers?.length)for(let n of r.markdownTransformers)typeof n=="function"?e.markdownTransformers.push(n({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(n);e.enabledFeatures.push(r.key)}),Object.keys(o).length>0&&(e.toolbarFixed.groups=e.toolbarFixed.groups.map(r=>{let n=o[r.key];return n?Hg(r,n):r})),e.toolbarInline.groups.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0),e.toolbarFixed.groups.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);for(let r of e.toolbarInline.groups)r.items.sort((n,l)=>n.order&&l.order?n.order-l.order:n.order?-1:l.order?1:0);for(let r of e.toolbarFixed.groups)r.items.sort((n,l)=>n.order&&l.order?n.order-l.order:n.order?-1:l.order?1:0);return e};function jr(t,e,o){return{admin:o,features:va(t),lexical:e,resolvedFeatureMap:t}}var Xg=Wg(()=>import("./Field-D5RCNN4A.js").then(t=>({default:t.RichText}))),zg=t=>{let e=jg(16),{admin:o,clientFeatures:r,featureClientImportMap:n,featureClientSchemaMap:l,field:i,lexicalEditorConfig:s,schemaPath:u}=t,c;e[0]!==o?(c=o===void 0?{}:o,e[0]=o,e[1]=c):c=e[1];let d=c,a=s===void 0?_o:s,{config:p}=Gg(),[m,f]=Jg(null),h,x;e[2]!==d||e[3]!==r||e[4]!==p||e[5]!==n||e[6]!==l||e[7]!==i||e[8]!==m||e[9]!==a||e[10]!==u?(h=()=>{if(m)return;let T=[];for(let[k,g]of Object.entries(r))g.clientFeatureProvider&&T.push(g.clientFeatureProvider(g.clientFeatureProps));let E=a||_o,C=Ra({config:p,featureClientImportMap:n,featureClientSchemaMap:l,field:i,schemaPath:u??i.name,unSanitizedEditorConfig:{features:T,lexical:E}});f(jr(C,E,d))},x=[a,d,m,r,n,l,i,p,u],e[2]=d,e[3]=r,e[4]=p,e[5]=n,e[6]=l,e[7]=i,e[8]=m,e[9]=a,e[10]=u,e[11]=h,e[12]=x):(h=e[11],x=e[12]),Kg(h,x);let b;return e[13]!==m||e[14]!==t?(b=Ur(Vg,{fallback:Ur(Ug,{height:"35vh"}),children:m&&Ur(Xg,{...t,editorConfig:m})}),e[13]=m,e[14]=t,e[15]=b):b=e[15],b};function Zg(t){return t instanceof HTMLElement}function Yg(...t){return t.filter(Boolean).join(" ")}var To=new WeakMap;function Da(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function wo(t,e){let o=To.get(t);if(o===void 0){let r=new Set,n=i=>{o!==void 0&&(o.start=Da(i))},l=i=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let u=Da(i);for(let c of r)u!==null&&c([u[0]-s[0],u[1]-s[1]],i)};t.addEventListener("touchstart",n),t.addEventListener("touchend",l),o={handleTouchend:l,handleTouchstart:n,listeners:r,start:null},To.set(t,o)}return o.listeners.add(e),()=>{qg(t,e)}}function qg(t,e){let o=To.get(t);if(o===void 0)return;let{listeners:r}=o;r.delete(e),r.size===0&&(To.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function Qg(t,e){return wo(t,(o,r)=>{let[n,l]=o;n<0&&-n>Math.abs(l)&&e(n,r)})}function ex(t,e){return wo(t,(o,r)=>{let[n,l]=o;n>0&&n>Math.abs(l)&&e(n,r)})}function tx(t,e){return wo(t,(o,r)=>{let[n,l]=o;l<0&&-l>Math.abs(n)&&e(n,r)})}function ox(t,e){return wo(t,(o,r)=>{let[n,l]=o;l>0&&l>Math.abs(n)&&e(n,r)})}import{c as rx}from"react/compiler-runtime";import{jsx as nx}from"react/jsx-runtime";import"react";var lx=()=>{let t=rx(2),{EditButton:e}=pe(),o;return t[0]!==e?(o=e?nx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as ix}from"react/compiler-runtime";import{jsx as sx}from"react/jsx-runtime";import"react";var ax=()=>{let t=ix(2),{RemoveButton:e}=pe(),o;return t[0]!==e?(o=e?sx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as cx}from"react/compiler-runtime";import{jsx as ux}from"react/jsx-runtime";import"react";var dx=()=>{let t=cx(2),{Label:e}=pe(),o;return t[0]!==e?(o=e?ux(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as mx}from"react/compiler-runtime";import{jsx as px}from"react/jsx-runtime";import"react";var fx=t=>{let e=mx(3),{children:o}=t,{InlineBlockContainer:r}=pe(),n;return e[0]!==r||e[1]!==o?(n=r?px(r,{children:o}):null,e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{c as hx}from"react/compiler-runtime";import{jsx as gx}from"react/jsx-runtime";import"react";var xx=t=>{let e=hx(6),{children:o,editButton:r,Label:n,removeButton:l}=t,{BlockCollapsible:i}=De(),s;return e[0]!==i||e[1]!==n||e[2]!==o||e[3]!==r||e[4]!==l?(s=i?gx(i,{editButton:r,Label:n,removeButton:l,children:o}):null,e[0]=i,e[1]=n,e[2]=o,e[3]=r,e[4]=l,e[5]=s):s=e[5],s};import{c as Cx}from"react/compiler-runtime";import{jsx as bx}from"react/jsx-runtime";import"react";var kx=()=>{let t=Cx(2),{EditButton:e}=De(),o;return t[0]!==e?(o=e?bx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as _x}from"react/compiler-runtime";import{jsx as Tx}from"react/jsx-runtime";import"react";var wx=()=>{let t=_x(2),{RemoveButton:e}=De(),o;return t[0]!==e?(o=e?Tx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as Ex}from"qs-esm";var Sx=({apiURL:t,depth:e,draft:o,locale:r})=>async({id:l,collectionSlug:i,select:s})=>{let u=Ex({depth:e??0,draft:o??!1,locale:r,select:s},{addQueryPrefix:!0});return await fetch(`${t}/${i}/${l}${u}`,{credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json"},method:"GET"}).then(d=>d.json())};import{c as Nx}from"react/compiler-runtime";import{jsx as rt}from"react/jsx-runtime";import{FieldContext as Lx,FieldPathContext as Ma,ServerFunctionsContext as Oa,ShimmerEffect as yx,useServerFunctions as Ix}from"@payloadcms/ui";import Rx,{useEffect as vx,useRef as Dx}from"react";var Mx=t=>{let e=Nx(9),{field:o,initialValue:r,Loading:n,path:l,schemaPath:i,setValue:s,value:u}=t,[c,d]=Rx.useState(null),a=Ix(),{_internal_renderField:p}=a,[m,f]=i.split("."),h=l??(o&&"name"in o?o?.name:"")??"",x;e[0]!==p||e[1]!==o||e[2]!==r||e[3]!==l||e[4]!==i?(x=()=>{(async function(){let{Field:M}=await p({field:{...o||{},type:"richText",admin:{hidden:!1}},initialValue:r??void 0,path:l,schemaPath:i});d(M)})()},e[0]=p,e[1]=o,e[2]=r,e[3]=l,e[4]=i,e[5]=x):x=e[5];let b=x,T=Dx(!1),E,C;if(e[6]!==b?(E=()=>{T.current||(T.current=!0,b())},C=[b],e[6]=b,e[7]=E,e[8]=C):(E=e[7],C=e[8]),vx(E,C),!c)return typeof n<"u"?n:rt(yx,{});let k={...a,getFormState:async w=>a.getFormState({...w,collectionSlug:m==="collection"?f:void 0,globalSlug:m==="global"?f:void 0})};if(typeof u>"u"&&!s)return rt(Oa,{value:{...k},children:rt(Ma,{value:h,children:c},h)});let g={disabled:!1,formInitializing:!1,formProcessing:!1,formSubmitted:!1,initialValue:u,path:h,setValue:s??Ox,showError:!1,value:u};return rt(Oa,{value:{...k},children:rt(Ma,{value:h,children:rt(Lx,{value:g,children:c})},h)})};function Ox(){}function Ax({nodes:t,text:e}){let o={root:{type:"root",children:[],direction:"ltr",format:"",indent:0,version:1}};return e&&o.root.children.push({type:"paragraph",children:[{type:"text",detail:0,format:0,mode:"normal",style:"",text:e,version:1}],direction:"ltr",format:"",indent:0,textFormat:0,textStyle:"",version:1}),t?.length&&o.root.children.push(...t),o}export{ht as $createAutoLinkNode,Jt as $createBlockNode,No as $createInlineBlockNode,ge as $createLinkNode,Pe as $createRelationshipNode,ve as $createUploadNode,Ce as $isAutoLinkNode,dt as $isBlockNode,Lo as $isInlineBlockNode,J as $isLinkNode,pr as $isRelationshipNode,Ar as $isUploadNode,Ja as AlignFeatureClient,xe as AutoLinkNode,xx as BlockCollapsible,kx as BlockEditButton,fe as BlockNode,wx as BlockRemoveButton,qa as BlockquoteFeatureClient,zc as BlocksFeatureClient,Cu as BoldFeatureClient,re as CAN_USE_DOM,_p as ChecklistFeatureClient,mf as DETAIL_TYPE_TO_DETAIL,af as DOUBLE_LINE_BREAK,wf as DebugJsxConverterFeatureClient,ff as ELEMENT_FORMAT_TO_TYPE,pf as ELEMENT_TYPE_TO_FORMAT,Ha as ENABLE_SLASH_MENU_COMMAND,$a as EditorConfigProvider,nt as FieldsDrawer,V0 as FixedToolbarFeatureClient,pd as HeadingFeatureClient,vd as HorizontalRuleFeatureClient,We as INSERT_BLOCK_COMMAND,Ve as INSERT_INLINE_BLOCK_COMMAND,lf as IS_ALL_FORMATTING,Jd as IndentFeatureClient,fx as InlineBlockContainer,lx as InlineBlockEditButton,dx as InlineBlockLabel,So as InlineBlockNode,ax as InlineBlockRemoveButton,wu as InlineCodeFeatureClient,o1 as InlineToolbarFeatureClient,Lu as ItalicFeatureClient,uf as LTR_REGEX,Gp as LexicalPluginToLexicalFeatureClient,ip as LinkFeatureClient,ee as LinkNode,sf as NON_BREAKING_SPACE,A as NodeFormat,Ip as OrderedListFeatureClient,Yp as ParagraphFeatureClient,Pa as Point,cf as RTL_REGEX,ja as Rect,c0 as RelationshipFeatureClient,ke as RelationshipNode,Mx as RenderLexical,zg as RichTextField,zp as SlateToLexicalFeatureClient,Du as StrikethroughFeatureClient,$u as SubscriptFeatureClient,Hu as SuperscriptFeatureClient,hf as TEXT_MODE_TO_TYPE,df as TEXT_TYPE_TO_FORMAT,gf as TEXT_TYPE_TO_MODE,ae as TOGGLE_LINK_COMMAND,Jh as TableFeatureClient,cu as TestRecorderFeatureClient,od as TextStateFeatureClient,Nt as ToolbarButton,Be as ToolbarDropdown,fu as TreeViewFeatureClient,Vu as UnderlineFeatureClient,Fp as UnorderedListFeatureClient,Bg as UploadFeatureClient,we as UploadNode,ox as addSwipeDownListener,Qg as addSwipeLeftListener,ex as addSwipeRightListener,tx as addSwipeUpListener,Ax as buildEditorState,Vo as createBlockNode,v as createClientFeature,Ef as defaultColors,_o as defaultEditorLexicalConfig,Cr as getDOMRangeRect,Ua as getEnabledNodes,Sx as getRestPopulateFn,Ke as getSelectedNode,Zg as isHTMLElement,Ba as isPoint,Yg as joinClasses,jr as sanitizeClientEditorConfig,va as sanitizeClientFeatures,ao as setFloatingElemPosition,oo as setFloatingElemPositionForLinkEditor,Z as slashMenuBasicGroupWithItems,he as toolbarAddDropdownGroupWithItems,Jo as toolbarFeatureButtonsGroupWithItems,Y as toolbarFormatGroupWithItems,Q as toolbarTextDropdownGroupWithItems,De as useBlockComponentContext,H as useEditorConfigContext,pe as useInlineBlockComponentContext,Fa as useLexicalDocumentDrawer,me as useLexicalDrawer,St as useLexicalListDrawer};
38
+ `,Bi="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",Hi="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",Kp=new RegExp("^[^"+Hi+"]*["+Bi+"]"),Jp=new RegExp("^[^"+Bi+"]*["+Hi+"]"),Xp={bold:A.IS_BOLD,code:A.IS_CODE,highlight:A.IS_HIGHLIGHT,italic:A.IS_ITALIC,strikethrough:A.IS_STRIKETHROUGH,subscript:A.IS_SUBSCRIPT,superscript:A.IS_SUPERSCRIPT,underline:A.IS_UNDERLINE},zp={directionless:A.IS_DIRECTIONLESS,unmergeable:A.IS_UNMERGEABLE},Zp={center:A.IS_ALIGN_CENTER,end:A.IS_ALIGN_END,justify:A.IS_ALIGN_JUSTIFY,left:A.IS_ALIGN_LEFT,right:A.IS_ALIGN_RIGHT,start:A.IS_ALIGN_START},Yp={[A.IS_ALIGN_CENTER]:"center",[A.IS_ALIGN_END]:"end",[A.IS_ALIGN_JUSTIFY]:"justify",[A.IS_ALIGN_LEFT]:"left",[A.IS_ALIGN_RIGHT]:"right",[A.IS_ALIGN_START]:"start"},qp={normal:A.IS_NORMAL,segmented:A.IS_SEGMENTED,token:A.IS_TOKEN},Qp={[A.IS_NORMAL]:"normal",[A.IS_SEGMENTED]:"segmented",[A.IS_TOKEN]:"token"};var ji={text:({node:t})=>{let e=t.text;return t.format&A.IS_BOLD&&(e=Oe("strong",{children:e})),t.format&A.IS_ITALIC&&(e=Oe("em",{children:e})),t.format&A.IS_STRIKETHROUGH&&(e=Oe("span",{style:{textDecoration:"line-through"},children:e})),t.format&A.IS_UNDERLINE&&(e=Oe("span",{style:{textDecoration:"underline"},children:e})),t.format&A.IS_CODE&&(e=Oe("code",{children:e})),t.format&A.IS_SUBSCRIPT&&(e=Oe("sub",{children:e})),t.format&A.IS_SUPERSCRIPT&&(e=Oe("sup",{children:e})),e}};import{jsx as _t}from"react/jsx-runtime";var Ui={upload:({node:t})=>{let e=t;if(typeof e.value!="object")return null;let o=e.value,r=o.url;if(!o.mimeType.startsWith("image"))return _t("a",{href:r,rel:"noopener noreferrer",children:o.filename});if(!o.sizes||!Object.keys(o.sizes).length)return _t("img",{alt:o.filename,height:o.height,src:r,width:o.width});let n=[];for(let l in o.sizes){let i=o.sizes[l];if(!i||!i.width||!i.height||!i.mimeType||!i.filesize||!i.filename||!i.url)continue;let s=i?.url;n.push(_t("source",{media:`(max-width: ${i.width}px)`,srcSet:s,type:i.mimeType},l))}return n.push(_t("img",{alt:o?.filename,height:o?.height,src:r,width:o?.width},"image")),_t("picture",{children:n})}};var Ye={...Fi,...ji,...Mi,...Ii,...Pi,...Ri,...vi,...Oi,...Ai({}),...Ui,...$i};import{jsx as Wi,Fragment as ef}from"react/jsx-runtime";import ir from"react";function Gi(t){let e=!!t?.root?.children?.length,o=!1;if(t?.root?.children?.length===1&&t?.root?.children[0]?.type==="paragraph"){let r=t?.root?.children[0];if(!r?.children||r?.children?.length===0)o=!0;else if(r?.children?.length===1){let n=r?.children[0];n?.type==="text"&&(n?.text?.length||(o=!0))}}return!(!e||o)}function Vi({converters:t,data:e,disableIndent:o,disableTextAlign:r}){return Gi(e)?Ki({converters:t,disableIndent:o,disableTextAlign:r,nodes:e?.root?.children,parent:e?.root}):Wi(ef,{})}function Ki({converters:t,disableIndent:e,disableTextAlign:o,nodes:r,parent:n}){let l=t.unknown;return r.map((s,u)=>{let c;s.type==="block"?(c=t?.blocks?.[s?.fields?.blockType],!c&&!l&&console.error(`Lexical => JSX converter: Blocks converter: found ${s?.fields?.blockType} block, but no converter is provided`)):s.type==="inlineBlock"?(c=t?.inlineBlocks?.[s?.fields?.blockType],!c&&!l&&console.error(`Lexical => JSX converter: Inline Blocks converter: found ${s?.fields?.blockType} inline block, but no converter is provided`)):c=t[s.type];try{!c&&l&&(c=l);let d;c?d=typeof c=="function"?c({childIndex:u,converters:t,node:s,nodesToJSX:m=>Ki({converters:m.converters??t,disableIndent:m.disableIndent??e,disableTextAlign:m.disableTextAlign??o,nodes:m.nodes,parent:m.parent??{...s,parent:n}}),parent:n}):c:d=Wi("span",{children:"unknown node"},u);let a={};if(!o&&(!Array.isArray(o)||!o?.includes(s.type))&&"format"in s&&s.format)switch(s.format){case"center":a.textAlign="center";break;case"end":a.textAlign="right";break;case"justify":a.textAlign="justify";break;case"left":break;case"right":a.textAlign="right";break;case"start":a.textAlign="left";break}if(!e&&(!Array.isArray(e)||!e?.includes(s.type))&&"indent"in s&&s.indent&&s.type!=="listitem"&&(a.paddingInlineStart=`${Number(s.indent)*40}px`),ir.isValidElement(d)){if(a.textAlign||a.paddingInlineStart){let p={...a,...d?.props?.style??{}};return ir.cloneElement(d,{key:u,style:p})}return ir.cloneElement(d,{key:u})}return d}catch(d){return console.error("Error converting lexical node to JSX:",d,"node:",s),null}}).filter(Boolean)}var sr=({className:t,converters:e,data:o,disableContainer:r,disableIndent:n,disableTextAlign:l})=>{if(!o)return null;let i={};e?typeof e=="function"?i=e({defaultConverters:Ye}):i=e:i=Ye;let s=o&&!Array.isArray(o)&&typeof o=="object"&&"root"in o&&Vi({converters:i,data:o,disableIndent:n,disableTextAlign:l});return r?Ji(tf,{children:s}):Ji("div",{className:t??"payload-richtext",children:s})};function zi(){let t=of(7),[e]=rf(),o;t[0]!==e?(o=e.getEditorState().toJSON(),t[0]=e,t[1]=o):o=t[1];let[r,n]=lf(o),l,i;t[2]!==e?(l=()=>e.registerUpdateListener(u=>{let{editorState:c}=u;n(c.toJSON())}),i=[e],t[2]=e,t[3]=l,t[4]=i):(l=t[3],i=t[4]),nf(l,i);let s;return t[5]!==r?(s=Xi("div",{className:"debug-jsx-converter",children:Xi(sr,{converters:Ye,data:r})}),t[5]=r,t[6]=s):s=t[6],s}var sf=y({plugins:[{Component:zi,position:"bottom"}]});var B={amber:{50:"oklch(0.987 0.022 95.277)",100:"oklch(0.962 0.059 95.617)",200:"oklch(0.924 0.12 95.746)",300:"oklch(0.879 0.169 91.605)",400:"oklch(0.828 0.189 84.429)",500:"oklch(0.769 0.188 70.08)",600:"oklch(0.666 0.179 58.318)",700:"oklch(0.555 0.163 48.998)",800:"oklch(0.473 0.137 46.201)",900:"oklch(0.414 0.112 45.904)",950:"oklch(0.279 0.077 45.635)"},black:"#000",blue:{50:"oklch(0.97 0.014 254.604)",100:"oklch(0.932 0.032 255.585)",200:"oklch(0.882 0.059 254.128)",300:"oklch(0.809 0.105 251.813)",400:"oklch(0.707 0.165 254.624)",500:"oklch(0.623 0.214 259.815)",600:"oklch(0.546 0.245 262.881)",700:"oklch(0.488 0.243 264.376)",800:"oklch(0.424 0.199 265.638)",900:"oklch(0.379 0.146 265.522)",950:"oklch(0.282 0.091 267.935)"},current:"currentColor",cyan:{50:"oklch(0.984 0.019 200.873)",100:"oklch(0.956 0.045 203.388)",200:"oklch(0.917 0.08 205.041)",300:"oklch(0.865 0.127 207.078)",400:"oklch(0.789 0.154 211.53)",500:"oklch(0.715 0.143 215.221)",600:"oklch(0.609 0.126 221.723)",700:"oklch(0.52 0.105 223.128)",800:"oklch(0.45 0.085 224.283)",900:"oklch(0.398 0.07 227.392)",950:"oklch(0.302 0.056 229.695)"},emerald:{50:"oklch(0.979 0.021 166.113)",100:"oklch(0.95 0.052 163.051)",200:"oklch(0.905 0.093 164.15)",300:"oklch(0.845 0.143 164.978)",400:"oklch(0.765 0.177 163.223)",500:"oklch(0.696 0.17 162.48)",600:"oklch(0.596 0.145 163.225)",700:"oklch(0.508 0.118 165.612)",800:"oklch(0.432 0.095 166.913)",900:"oklch(0.378 0.077 168.94)",950:"oklch(0.262 0.051 172.552)"},fuchsia:{50:"oklch(0.977 0.017 320.058)",100:"oklch(0.952 0.037 318.852)",200:"oklch(0.903 0.076 319.62)",300:"oklch(0.833 0.145 321.434)",400:"oklch(0.74 0.238 322.16)",500:"oklch(0.667 0.295 322.15)",600:"oklch(0.591 0.293 322.896)",700:"oklch(0.518 0.253 323.949)",800:"oklch(0.452 0.211 324.591)",900:"oklch(0.401 0.17 325.612)",950:"oklch(0.293 0.136 325.661)"},gray:{50:"oklch(0.985 0.002 247.839)",100:"oklch(0.967 0.003 264.542)",200:"oklch(0.928 0.006 264.531)",300:"oklch(0.872 0.01 258.338)",400:"oklch(0.707 0.022 261.325)",500:"oklch(0.551 0.027 264.364)",600:"oklch(0.446 0.03 256.802)",700:"oklch(0.373 0.034 259.733)",800:"oklch(0.278 0.033 256.848)",900:"oklch(0.21 0.034 264.665)",950:"oklch(0.13 0.028 261.692)"},green:{50:"oklch(0.982 0.018 155.826)",100:"oklch(0.962 0.044 156.743)",200:"oklch(0.925 0.084 155.995)",300:"oklch(0.871 0.15 154.449)",400:"oklch(0.792 0.209 151.711)",500:"oklch(0.723 0.219 149.579)",600:"oklch(0.627 0.194 149.214)",700:"oklch(0.527 0.154 150.069)",800:"oklch(0.448 0.119 151.328)",900:"oklch(0.393 0.095 152.535)",950:"oklch(0.266 0.065 152.934)"},indigo:{50:"oklch(0.962 0.018 272.314)",100:"oklch(0.93 0.034 272.788)",200:"oklch(0.87 0.065 274.039)",300:"oklch(0.785 0.115 274.713)",400:"oklch(0.673 0.182 276.935)",500:"oklch(0.585 0.233 277.117)",600:"oklch(0.511 0.262 276.966)",700:"oklch(0.457 0.24 277.023)",800:"oklch(0.398 0.195 277.366)",900:"oklch(0.359 0.144 278.697)",950:"oklch(0.257 0.09 281.288)"},inherit:"inherit",lime:{50:"oklch(0.986 0.031 120.757)",100:"oklch(0.967 0.067 122.328)",200:"oklch(0.938 0.127 124.321)",300:"oklch(0.897 0.196 126.665)",400:"oklch(0.841 0.238 128.85)",500:"oklch(0.768 0.233 130.85)",600:"oklch(0.648 0.2 131.684)",700:"oklch(0.532 0.157 131.589)",800:"oklch(0.453 0.124 130.933)",900:"oklch(0.405 0.101 131.063)",950:"oklch(0.274 0.072 132.109)"},neutral:{50:"oklch(0.985 0 0)",100:"oklch(0.97 0 0)",200:"oklch(0.922 0 0)",300:"oklch(0.87 0 0)",400:"oklch(0.708 0 0)",500:"oklch(0.556 0 0)",600:"oklch(0.439 0 0)",700:"oklch(0.371 0 0)",800:"oklch(0.269 0 0)",900:"oklch(0.205 0 0)",950:"oklch(0.145 0 0)"},orange:{50:"oklch(0.98 0.016 73.684)",100:"oklch(0.954 0.038 75.164)",200:"oklch(0.901 0.076 70.697)",300:"oklch(0.837 0.128 66.29)",400:"oklch(0.75 0.183 55.934)",500:"oklch(0.705 0.213 47.604)",600:"oklch(0.646 0.222 41.116)",700:"oklch(0.553 0.195 38.402)",800:"oklch(0.47 0.157 37.304)",900:"oklch(0.408 0.123 38.172)",950:"oklch(0.266 0.079 36.259)"},pink:{50:"oklch(0.971 0.014 343.198)",100:"oklch(0.948 0.028 342.258)",200:"oklch(0.899 0.061 343.231)",300:"oklch(0.823 0.12 346.018)",400:"oklch(0.718 0.202 349.761)",500:"oklch(0.656 0.241 354.308)",600:"oklch(0.592 0.249 0.584)",700:"oklch(0.525 0.223 3.958)",800:"oklch(0.459 0.187 3.815)",900:"oklch(0.408 0.153 2.432)",950:"oklch(0.284 0.109 3.907)"},purple:{50:"oklch(0.977 0.014 308.299)",100:"oklch(0.946 0.033 307.174)",200:"oklch(0.902 0.063 306.703)",300:"oklch(0.827 0.119 306.383)",400:"oklch(0.714 0.203 305.504)",500:"oklch(0.627 0.265 303.9)",600:"oklch(0.558 0.288 302.321)",700:"oklch(0.496 0.265 301.924)",800:"oklch(0.438 0.218 303.724)",900:"oklch(0.381 0.176 304.987)",950:"oklch(0.291 0.149 302.717)"},red:{50:"oklch(0.971 0.013 17.38)",100:"oklch(0.936 0.032 17.717)",200:"oklch(0.885 0.062 18.334)",300:"oklch(0.808 0.114 19.571)",400:"oklch(0.704 0.191 22.216)",500:"oklch(0.637 0.237 25.331)",600:"oklch(0.577 0.245 27.325)",700:"oklch(0.505 0.213 27.518)",800:"oklch(0.444 0.177 26.899)",900:"oklch(0.396 0.141 25.723)",950:"oklch(0.258 0.092 26.042)"},rose:{50:"oklch(0.969 0.015 12.422)",100:"oklch(0.941 0.03 12.58)",200:"oklch(0.892 0.058 10.001)",300:"oklch(0.81 0.117 11.638)",400:"oklch(0.712 0.194 13.428)",500:"oklch(0.645 0.246 16.439)",600:"oklch(0.586 0.253 17.585)",700:"oklch(0.514 0.222 16.935)",800:"oklch(0.455 0.188 13.697)",900:"oklch(0.41 0.159 10.272)",950:"oklch(0.271 0.105 12.094)"},sky:{50:"oklch(0.977 0.013 236.62)",100:"oklch(0.951 0.026 236.824)",200:"oklch(0.901 0.058 230.902)",300:"oklch(0.828 0.111 230.318)",400:"oklch(0.746 0.16 232.661)",500:"oklch(0.685 0.169 237.323)",600:"oklch(0.588 0.158 241.966)",700:"oklch(0.5 0.134 242.749)",800:"oklch(0.443 0.11 240.79)",900:"oklch(0.391 0.09 240.876)",950:"oklch(0.293 0.066 243.157)"},slate:{50:"oklch(0.984 0.003 247.858)",100:"oklch(0.968 0.007 247.896)",200:"oklch(0.929 0.013 255.508)",300:"oklch(0.869 0.022 252.894)",400:"oklch(0.704 0.04 256.788)",500:"oklch(0.554 0.046 257.417)",600:"oklch(0.446 0.043 257.281)",700:"oklch(0.372 0.044 257.287)",800:"oklch(0.279 0.041 260.031)",900:"oklch(0.208 0.042 265.755)",950:"oklch(0.129 0.042 264.695)"},stone:{50:"oklch(0.985 0.001 106.423)",100:"oklch(0.97 0.001 106.424)",200:"oklch(0.923 0.003 48.717)",300:"oklch(0.869 0.005 56.366)",400:"oklch(0.709 0.01 56.259)",500:"oklch(0.553 0.013 58.071)",600:"oklch(0.444 0.011 73.639)",700:"oklch(0.374 0.01 67.558)",800:"oklch(0.268 0.007 34.298)",900:"oklch(0.216 0.006 56.043)",950:"oklch(0.147 0.004 49.25)"},teal:{50:"oklch(0.984 0.014 180.72)",100:"oklch(0.953 0.051 180.801)",200:"oklch(0.91 0.096 180.426)",300:"oklch(0.855 0.138 181.071)",400:"oklch(0.777 0.152 181.912)",500:"oklch(0.704 0.14 182.503)",600:"oklch(0.6 0.118 184.704)",700:"oklch(0.511 0.096 186.391)",800:"oklch(0.437 0.078 188.216)",900:"oklch(0.386 0.063 188.416)",950:"oklch(0.277 0.046 192.524)"},transparent:"transparent",violet:{50:"oklch(0.969 0.016 293.756)",100:"oklch(0.943 0.029 294.588)",200:"oklch(0.894 0.057 293.283)",300:"oklch(0.811 0.111 293.571)",400:"oklch(0.702 0.183 293.541)",500:"oklch(0.606 0.25 292.717)",600:"oklch(0.541 0.281 293.009)",700:"oklch(0.491 0.27 292.581)",800:"oklch(0.432 0.232 292.759)",900:"oklch(0.38 0.189 293.745)",950:"oklch(0.283 0.141 291.089)"},white:"#fff",yellow:{50:"oklch(0.987 0.026 102.212)",100:"oklch(0.973 0.071 103.193)",200:"oklch(0.945 0.129 101.54)",300:"oklch(0.905 0.182 98.111)",400:"oklch(0.852 0.199 91.936)",500:"oklch(0.795 0.184 86.047)",600:"oklch(0.681 0.162 75.834)",700:"oklch(0.554 0.135 66.442)",800:"oklch(0.476 0.114 61.907)",900:"oklch(0.421 0.095 57.708)",950:"oklch(0.286 0.066 53.813)"},zinc:{50:"oklch(0.985 0 0)",100:"oklch(0.967 0.001 286.375)",200:"oklch(0.92 0.004 286.32)",300:"oklch(0.871 0.006 286.286)",400:"oklch(0.705 0.015 286.067)",500:"oklch(0.552 0.016 285.938)",600:"oklch(0.442 0.017 285.786)",700:"oklch(0.37 0.013 285.805)",800:"oklch(0.274 0.006 286.033)",900:"oklch(0.21 0.006 285.885)",950:"oklch(0.141 0.005 285.823)"}},af={text:{"text-red":{css:{color:`light-dark(${B.red[600]}, ${B.red[400]})`},label:"Red"},"text-orange":{css:{color:`light-dark(${B.orange[600]}, ${B.orange[400]})`},label:"Orange"},"text-yellow":{css:{color:`light-dark(${B.yellow[700]}, ${B.yellow[300]})`},label:"Yellow"},"text-green":{css:{color:`light-dark(${B.green[700]}, ${B.green[400]})`},label:"Green"},"text-blue":{css:{color:`light-dark(${B.blue[600]}, ${B.blue[400]})`},label:"Blue"},"text-purple":{css:{color:`light-dark(${B.purple[600]}, ${B.purple[400]})`},label:"Purple"},"text-pink":{css:{color:`light-dark(${B.pink[600]}, ${B.pink[400]})`},label:"Pink"}},background:{"bg-red":{css:{"background-color":`light-dark(${B.red[400]}, ${B.red[600]})`},label:"Red"},"bg-orange":{css:{"background-color":`light-dark(${B.orange[400]}, ${B.orange[600]})`},label:"Orange"},"bg-yellow":{css:{"background-color":`light-dark(${B.yellow[300]}, ${B.yellow[700]})`},label:"Yellow"},"bg-green":{css:{"background-color":`light-dark(${B.green[400]}, ${B.green[700]})`},label:"Green"},"bg-blue":{css:{"background-color":`light-dark(${B.blue[400]}, ${B.blue[600]})`},label:"Blue"},"bg-purple":{css:{"background-color":`light-dark(${B.purple[400]}, ${B.purple[600]})`},label:"Purple"},"bg-pink":{css:{"background-color":`light-dark(${B.pink[400]}, ${B.pink[600]})`},label:"Pink"}}};import{$isNodeSelection as Kf}from"lexical";import{jsx as Tt,jsxs as cf}from"react/jsx-runtime";import"react";var ar=()=>cf("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Tt("g",{clipPath:"url(#clip0_4397_10817)",children:Tt("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"})}),Tt("defs",{children:Tt("clipPath",{id:"clip0_4397_10817",children:Tt("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{jsx as mf}from"react/jsx-runtime";import*as Yi from"react";import{DecoratorBlockNode as uf}from"@lexical/react/LexicalDecoratorBlockNode.js";function df(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Zi({relationTo:o,value:e})}:null}var wt=class extends uf{__data;constructor({data:e,format:o,key:r}){super(o,r),this.__data=e}static clone(e){return new this({data:e.__data,format:e.__format,key:e.__key})}static getType(){return"relationship"}static importDOM(){return{div:e=>!e.hasAttribute("data-lexical-relationship-relationTo")||!e.hasAttribute("data-lexical-relationship-id")?null:{conversion:df,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},r=Zi(o);return r.setFormat(e.format),r}static isInline(){return!1}decorate(e,o){return null}exportDOM(){let e=document.createElement("div");e.setAttribute("data-lexical-relationship-id",String(typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value)),e.setAttribute("data-lexical-relationship-relationTo",this.__data?.relationTo);let o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"relationship",version:2}}getData(){return this.getLatest().__data}getTextContent(){return`${this.__data?.relationTo} relation to ${typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value}`}setData(e){let o=this.getWritable();o.__data=e}};function Zi(t){return new wt({data:t})}var pf=Yi.lazy(()=>import("./RelationshipComponent-APF3CN47.js").then(t=>({default:t.RelationshipComponent})));function ff(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Fe({relationTo:o,value:e})}:null}var be=class extends wt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{div:e=>!e.hasAttribute("data-lexical-relationship-relationTo")||!e.hasAttribute("data-lexical-relationship-id")?null:{conversion:ff,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},r=Fe(o);return r.setFormat(e.format),r}decorate(e,o){return mf(pf,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Fe(t){return new be({data:t})}function cr(t){return t instanceof be}import{c as Mf}from"react/compiler-runtime";import{jsx as Df}from"react/jsx-runtime";import{useLexicalComposerContext as Af}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Of}from"@lexical/utils";import{useConfig as Ff}from"@payloadcms/ui";import{$getPreviousSelection as $f,$getSelection as Pf,$isParagraphNode as Bf,$isRangeSelection as Hf,COMMAND_PRIORITY_EDITOR as jf,createCommand as Uf}from"lexical";import{useEffect as Gf}from"react";import{c as Nf}from"react/compiler-runtime";import{jsx as ro}from"react/jsx-runtime";import{useLexicalComposerContext as Lf}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as yf,COMMAND_PRIORITY_EDITOR as If}from"lexical";import{useEffect as Rf,useState as es}from"react";import{c as hf}from"react/compiler-runtime";import{jsx as gf}from"react/jsx-runtime";import{useLexicalComposerContext as xf}from"@lexical/react/LexicalComposerContext";import{useListDrawer as Cf,useModal as bf}from"@payloadcms/ui";import{$getNodeByKey as qi,$getPreviousSelection as kf,$getRoot as _f,$getSelection as Tf,$isRangeSelection as wf,$setSelection as Ef}from"lexical";import{useEffect as Sf,useState as Qi}from"react";var Et=t=>{let e=hf(23),[o]=xf(),[r,n]=Qi(null),[l,i]=Qi(!1),[s,u,c]=Cf(t),{closeDrawer:d,drawerSlug:a,isDrawerOpen:p,openDrawer:m}=c,{modalState:f}=bf(),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let F=Tf()??kf();n(F)},e[0]=h):h=e[0];let g=h,k;e[1]!==o||e[2]!==r?(k=()=>{r&&o.update(()=>{if(wf(r)){let{anchor:F,focus:R}=r;qi(F.key)&&qi(R.key)&&Ef(r.clone())}else _f().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=r,e[3]=k):k=e[3];let T=k,I;e[4]!==d?(I=()=>{d()},e[4]=d,e[5]=I):I=e[5];let b=I,_,x;e[6]!==a||e[7]!==f||e[8]!==T||e[9]!==l?(_=()=>{if(!l)return;let F=f[a];F&&!F?.isOpen&&(i(!1),setTimeout(()=>{T()},1))},x=[f,a,T,l],e[6]=a,e[7]=f,e[8]=T,e[9]=l,e[10]=_,e[11]=x):(_=e[10],x=e[11]),Sf(_,x);let w;e[12]!==u?(w=F=>gf(u,{...F,onClick:()=>{g()}}),e[12]=u,e[13]=w):w=e[13];let v;e[14]!==m?(v=()=>{g(),m(),i(!0)},e[14]=m,e[15]=v):v=e[15];let O;return e[16]!==s||e[17]!==b||e[18]!==p||e[19]!==a||e[20]!==w||e[21]!==v?(O={closeListDrawer:b,isListDrawerOpen:p,ListDrawer:s,listDrawerSlug:a,ListDrawerToggler:w,openListDrawer:v},e[16]=s,e[17]=b,e[18]=p,e[19]=a,e[20]=w,e[21]=v,e[22]=O):O=e[22],O};var vf=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=yf(o);n&&n.replace(Fe({relationTo:e,value:r}))}):t.dispatchCommand(ur,{relationTo:e,value:r})},ts=t=>{let e=Nf(16),{enabledCollectionSlugs:o}=t,[r]=Lf(),n;e[0]!==o?.[0]?(n=()=>o?.[0],e[0]=o?.[0],e[1]=n):n=e[1];let[l]=es(n),[i,s]=es(null),u=o||void 0,c;e[2]!==l||e[3]!==u?(c={collectionSlugs:u,selectedCollection:l},e[2]=l,e[3]=u,e[4]=c):c=e[4];let{closeListDrawer:d,ListDrawer:a,openListDrawer:p}=Et(c),m,f;e[5]!==r||e[6]!==p?(m=()=>r.registerCommand(nt,T=>(s(T?.replace?T?.replace.nodeKey:null),p(),!0),If),f=[r,p],e[5]=r,e[6]=p,e[7]=m,e[8]=f):(m=e[7],f=e[8]),Rf(m,f);let h;e[9]!==d||e[10]!==r||e[11]!==i?(h=T=>{let{collectionSlug:I,doc:b}=T;vf({editor:r,relationTo:I,replaceNodeKey:i,value:b.id}),d()},e[9]=d,e[10]=r,e[11]=i,e[12]=h):h=e[12];let g=h,k;return e[13]!==a||e[14]!==g?(k=ro(a,{onSelect:g}),e[13]=a,e[14]=g,e[15]=k):k=e[15],k},os=t=>(t?.enabledCollectionSlugs?.length??-1)>0?ro(ts,{...t}):ro(At,{...t,children:ro(ts,{...t})});var ur=Uf("INSERT_RELATIONSHIP_COMMAND"),rs=t=>{let e=Mf(5),{clientProps:o}=t,[r]=Af(),{config:n}=Ff(),{collections:l}=n,i=null;if(o?.enabledCollections)i=o?.enabledCollections;else if(o?.disabledCollections){let c;e[0]!==o?.disabledCollections?(c=d=>{let{slug:a}=d;return!o?.disabledCollections?.includes(a)},e[0]=o?.disabledCollections,e[1]=c):c=e[1],i=l.filter(c).map(Wf)}let s,u;return e[2]!==r?(s=()=>{if(!r.hasNodes([be]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return r.registerCommand(ur,Vf,jf)},u=[r],e[2]=r,e[3]=s,e[4]=u):(s=e[3],u=e[4]),Gf(s,u),Df(os,{enabledCollectionSlugs:i})};function Wf(t){let{slug:e}=t;return e}function Vf(t){let e=Pf()||$f();if(Hf(e)){let o=Fe(t),{focus:r}=e,n=r.getNode();Of(o),Bf(n)&&!n.__first&&n.remove()}return!0}var Jf=y({nodes:[be],plugins:[{Component:rs,position:"normal"}],slashMenu:{groups:[Z([{Icon:ar,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(nt,{replace:!1})}}])]},toolbarFixed:{groups:[fe([{ChildComponent:ar,isActive:({selection:t})=>{if(!Kf(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return cr(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(nt,{replace:!1})}}])]}});import{c as ms}from"react/compiler-runtime";import{jsx as le,jsxs as k0}from"react/jsx-runtime";import{useLexicalComposerContext as _0}from"@lexical/react/LexicalComposerContext.js";import{useScrollInfo as T0,useThrottledEffect as w0,useTranslation as E0}from"@payloadcms/ui";import*as ke from"react";import{useMemo as S0}from"react";import{c as Xf}from"react/compiler-runtime";import{jsx as zf}from"react/jsx-runtime";import{mergeRegister as Zf}from"@lexical/utils";import{$addUpdateTag as Yf,$getSelection as qf}from"lexical";import{useDeferredValue as Qf,useEffect as e0,useState as t0}from"react";var ns="toolbar-popup__button",St=t=>{let e=Xf(23),{children:o,editor:r,item:n}=t,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={active:!1,enabled:!0},e[0]=l):l=e[0];let[i,s]=t0(l),u=Qf(i),c=H(),d=u.enabled?"":"disabled",a=u.active?"active":"",p=n.key?`${ns}-${n.key}`:"",m;e[1]!==d||e[2]!==a||e[3]!==p?(m=[ns,d,a,p].filter(Boolean),e[1]=d,e[2]=a,e[3]=p,e[4]=m):m=e[4];let f=m.join(" "),h;e[5]!==r||e[6]!==c||e[7]!==n?(h=()=>{r.getEditorState().read(()=>{let v=qf();if(!v)return;let O=n.isActive?n.isActive({editor:r,editorConfigContext:c,selection:v}):!1,F=n.isEnabled?n.isEnabled({editor:r,editorConfigContext:c,selection:v}):!0;s(R=>R.active===O&&R.enabled===F?R:{active:O,enabled:F})})},e[5]=r,e[6]=c,e[7]=n,e[8]=h):h=e[8];let g=h,k=Ot(),T,I;e[9]!==r||e[10]!==k||e[11]!==g?(T=()=>{k(g);let v=()=>k(g),O=Zf(r.registerUpdateListener(v));return document.addEventListener("mouseup",v),()=>{O(),document.removeEventListener("mouseup",v)}},I=[r,k,g],e[9]=r,e[10]=k,e[11]=g,e[12]=T,e[13]=I):(T=e[12],I=e[13]),e0(T,I);let b;e[14]!==i||e[15]!==r||e[16]!==n?(b=()=>{i.enabled&&r.focus(()=>{r.update(o0),n.onSelect?.({editor:r,isActive:i.active})})},e[14]=i,e[15]=r,e[16]=n,e[17]=b):b=e[17];let _=b,x=r0,w;return e[18]!==o||e[19]!==f||e[20]!==_||e[21]!==n.key?(w=zf("button",{className:f,"data-button-key":n.key,onClick:_,onMouseDown:x,type:"button",children:o}),e[18]=o,e[19]=f,e[20]=_,e[21]=n.key,e[22]=w):w=e[22],w};function o0(){Yf("toolbar")}function r0(t){t.preventDefault()}import{c as u0}from"react/compiler-runtime";import{jsx as qe}from"react/jsx-runtime";import ds,{useCallback as d0,useDeferredValue as m0,useEffect as p0,useMemo as f0}from"react";import{mergeRegister as h0}from"@lexical/utils";import{useTranslation as g0}from"@payloadcms/ui";import{$getSelection as x0}from"lexical";import{jsx as Le,jsxs as ls}from"react/jsx-runtime";import{Button as n0}from"@payloadcms/ui";import{$addUpdateTag as l0,isDOMNode as i0}from"lexical";import no,{useCallback as s0,useEffect as lo,useMemo as ss,useRef as dr,useState as mr}from"react";import{createPortal as a0}from"react-dom";var is="toolbar-popup__dropdown-item",as=no.createContext(null);function cs({active:t,children:e,editor:o,enabled:r,Icon:n,item:l,itemKey:i,tooltip:s}){let u=ss(()=>[is,r===!1?"disabled":"",t?"active":"",l?.key?`${is}-${l.key}`:""].filter(Boolean).join(" "),[r,t,l.key]),c=dr(null),d=no.use(as);if(d===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=d;return lo(()=>{c?.current!=null&&a(c)},[c,a]),Le(n0,{"aria-label":s,buttonStyle:"none",className:u,disabled:r===!1,extraButtonProps:{"data-item-key":i},icon:n,iconPosition:"left",iconStyle:"none",onClick:()=>{r!==!1&&o.focus(()=>{o.update(()=>{l0("toolbar")}),l.onSelect?.({editor:o,isActive:t})})},onMouseDown:p=>{p.preventDefault()},ref:c,tooltip:s,type:"button",children:e})}function c0({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:r}){let[n,l]=mr(),[i,s]=mr(),u=s0(a=>{l(p=>p!=null?[...p,a]:[a])},[l]),c=a=>{if(n==null)return;let{key:p}=a;["ArrowDown","ArrowUp","Escape","Tab"].includes(p)&&a.preventDefault(),p==="Escape"||p==="Tab"?r():p==="ArrowUp"?s(m=>{if(m==null)return n[0];let f=n.indexOf(m)-1;return n[f===-1?n.length-1:f]}):p==="ArrowDown"&&s(m=>m==null?n[0]:n[n.indexOf(m)+1])},d=ss(()=>({registerItem:u}),[u]);return lo(()=>{n!=null&&i==null&&s(n[0]),i!=null&&i?.current!=null&&i.current.focus()},[n,i]),Le(as,{value:d,children:Le("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:c,ref:e,children:t})})}function us({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:r=!1,dropdownKey:n,Icon:l,itemsContainerClassNames:i,label:s,stopCloseOnClickSelf:u}){let c=dr(null),d=dr(null),[a,p]=mr(!1),m=()=>{p(!1),d?.current!=null&&d.current.focus()};lo(()=>{let h=d.current,g=c.current;if(a&&h!==null&&g!==null){let{left:k,top:T}=h.getBoundingClientRect(),I=window.scrollY||document.documentElement.scrollTop;g.style.top=`${T+I+h.offsetHeight+5}px`,g.style.left=`${Math.min(k-5,window.innerWidth-g.offsetWidth-20)}px`}},[c,d,a]),lo(()=>{let h=d.current;if(h!==null&&a){let g=k=>{let T=k.target;i0(T)&&(u&&c.current&&c.current.contains(T)||h.contains(T)||p(!1))};return document.addEventListener("click",g),()=>{document.removeEventListener("click",g)}}},[c,d,a,u]);let f=a0(Le(c0,{dropDownRef:c,itemsContainerClassNames:i,onClose:m,children:o}),document.body);return ls(no.Fragment,{children:[ls("button",{"aria-label":t,className:e+(a?" active":""),"data-dropdown-key":n,disabled:r,onClick:h=>{h.preventDefault(),p(!a)},onMouseDown:h=>{h.preventDefault()},ref:d,type:"button",children:[l&&Le(l,{}),s&&Le("span",{className:"toolbar-popup__dropdown-label",children:s}),Le("i",{className:"toolbar-popup__dropdown-caret"})]}),a&&Le(no.Fragment,{children:f})]})}var pr="toolbar-popup__dropdown",C0=t=>{let e=u0(14),{active:o,anchorElem:r,editor:n,enabled:l,item:i}=t,{i18n:s}=g0(),{fieldProps:u}=H(),{featureClientSchemaMap:c,schemaPath:d}=u;if(i.Component){let p;return e[0]!==o||e[1]!==r||e[2]!==n||e[3]!==l||e[4]!==i?(p=i?.Component&&qe(i.Component,{active:o,anchorElem:r,editor:n,enabled:l,item:i},i.key),e[0]=o,e[1]=r,e[2]=n,e[3]=l,e[4]=i,e[5]=p):p=e[5],p}let a;if(e[6]!==o||e[7]!==n||e[8]!==l||e[9]!==c||e[10]!==s||e[11]!==i||e[12]!==d){let p=i.key,m;i.label&&(p=typeof i.label=="function"?i.label({featureClientSchemaMap:c,i18n:s,schemaPath:d}):i.label),p.length>25?m=p.substring(0,25)+"...":m=p,a=qe(cs,{active:o,editor:n,enabled:l,Icon:i?.ChildComponent?qe(i.ChildComponent,{}):void 0,item:i,itemKey:i.key,tooltip:p,children:qe("span",{className:"text",children:m})},i.key),e[6]=o,e[7]=n,e[8]=l,e[9]=c,e[10]=s,e[11]=i,e[12]=d,e[13]=a}else a=e[13];return a},b0=ds.memo(C0),$e=({anchorElem:t,classNames:e,editor:o,group:r,Icon:n,itemsContainerClassNames:l,label:i,maxActiveItems:s,onActiveChange:u})=>{let[c,d]=ds.useState({activeItemKeys:[],enabledGroup:!0,enabledItemKeys:[]}),a=m0(c),p=H(),{items:m,key:f}=r,h=Ot(),g=d0(()=>{o.getEditorState().read(()=>{let T=x0();if(!T)return;let I=[],b=[],_=[];for(let x of m)x.isActive&&(!s||I.length<s)&&x.isActive({editor:o,editorConfigContext:p,selection:T})&&(I.push(x.key),b.push(x)),x.isEnabled?x.isEnabled({editor:o,editorConfigContext:p,selection:T})&&_.push(x.key):_.push(x.key);d({activeItemKeys:I,enabledGroup:r.isEnabled?r.isEnabled({editor:o,editorConfigContext:p,selection:T}):!0,enabledItemKeys:_}),u&&u({activeItems:b})})},[o,p,r,m,s,u]);p0(()=>(h(g),h0(o.registerUpdateListener(async()=>{await h(g)}))),[o,h,g]);let k=f0(()=>m?.length?m.map(T=>qe(b0,{active:a.activeItemKeys.includes(T.key),anchorElem:t,editor:o,enabled:a.enabledItemKeys.includes(T.key),item:T},T.key)):null,[m,a,t,o]);return qe(us,{buttonAriaLabel:`${f} dropdown`,buttonClassName:[pr,`${pr}-${f}`,...e||[]].filter(Boolean).join(" "),disabled:!a.enabledGroup,dropdownKey:f,Icon:n,itemsContainerClassNames:[`${pr}-items`,...l||[]],label:i,children:k},f)};function N0({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&le(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?le(St,{editor:e,item:o,children:le(o.ChildComponent,{})},o.key):null}function L0(t){let e=ms(23),{anchorElem:o,editor:r,editorConfig:n,group:l,index:i}=t,{i18n:s}=E0(),{fieldProps:u}=H(),{featureClientSchemaMap:c,schemaPath:d}=u,[a,p]=ke.useState(void 0),[m,f]=ke.useState(void 0),h;e[0]!==l.ChildComponent||e[1]!==l.items||e[2]!==l.type?(h=()=>{l?.type==="dropdown"&&l.items.length&&l.ChildComponent?f(()=>l.ChildComponent):f(void 0)},e[0]=l.ChildComponent,e[1]=l.items,e[2]=l.type,e[3]=h):h=e[3];let g;e[4]!==l?(g=[l],e[4]=l,e[5]=g):g=e[5],ke.useEffect(h,g);let k;e[6]!==c||e[7]!==l.ChildComponent||e[8]!==l.items||e[9]!==l.type||e[10]!==s||e[11]!==d?(k=_=>{let{activeItems:x}=_;if(!x.length){l?.type==="dropdown"&&l.items.length&&l.ChildComponent?(f(()=>l.ChildComponent),p(void 0)):(f(void 0),p(void 0));return}let w=x[0],v=w.key;w.label&&(v=typeof w.label=="function"?w.label({featureClientSchemaMap:c,i18n:s,schemaPath:d}):w.label),v.length>25&&(v=v.substring(0,25)+"..."),x.length===1?(p(v),f(()=>w.ChildComponent)):(p(s.t("lexical:general:toolbarItemsActive",{count:x.length})),l?.type==="dropdown"&&l.items.length&&l.ChildComponent?f(()=>l.ChildComponent):f(void 0))},e[6]=c,e[7]=l.ChildComponent,e[8]=l.items,e[9]=l.type,e[10]=s,e[11]=d,e[12]=k):k=e[12];let T=k,I=`fixed-toolbar__group fixed-toolbar__group-${l.key}`,b;return e[13]!==m||e[14]!==o||e[15]!==a||e[16]!==r||e[17]!==n.features.toolbarFixed?.groups.length||e[18]!==l||e[19]!==i||e[20]!==T||e[21]!==I?(b=k0("div",{className:I,"data-toolbar-group-key":l.key,children:[l.type==="dropdown"&&l.items.length?m?le($e,{anchorElem:o,editor:r,group:l,Icon:m,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:l.maxActiveItems??1,onActiveChange:T}):le($e,{anchorElem:o,editor:r,group:l,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:l.maxActiveItems??1,onActiveChange:T}):null,l.type==="buttons"&&l.items.length?l.items.map(_=>le(N0,{anchorElem:o,editor:r,item:_},_.key)):null,i<n.features.toolbarFixed?.groups.length-1&&le("div",{className:"divider"})]},l.key),e[13]=m,e[14]=o,e[15]=a,e[16]=r,e[17]=n.features.toolbarFixed?.groups.length,e[18]=l,e[19]=i,e[20]=T,e[21]=I,e[22]=b):b=e[22],b}function y0({anchorElem:t,clientProps:e,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let l=ke.useRef(null),{y:i}=T0(),s=S0(()=>{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 w0(()=>{if(!s)return;let u=l.current;if(!u)return;let c=u.getBoundingClientRect(),d=s.getBoundingClientRect();if(!(c.bottom<d.top||c.top>d.bottom))u.classList.remove("fixed-toolbar"),u.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),s.classList.remove("fixed-toolbar"),s.classList.add("fixed-toolbar","fixed-toolbar--hide");else{if(!u.classList.contains("fixed-toolbar--overlapping"))return;u.classList.remove("fixed-toolbar--overlapping"),u.classList.add("fixed-toolbar"),s.classList.remove("fixed-toolbar--hide"),s.classList.add("fixed-toolbar")}},50,[l,s,i]),le("div",{className:"fixed-toolbar",onFocus:u=>{u.stopPropagation()},ref:l,children:o.isEditable()&&le(ke.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((u,c)=>le(L0,{anchorElem:t,editor:o,editorConfig:r,group:u,index:c},u.key))})})}var ps=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return ps(t.parentEditor)}return!1},fs=t=>{let e=ms(6),{clientProps:o}=t,[r]=_0(),n=H(),{editorConfig:l}=n,i=o.applyToFocusedEditor&&n.focusedEditor?.editor||r,s=o.applyToFocusedEditor&&n.focusedEditor?.editorConfig||l,u,c;if(e[0]!==o.disableIfParentHasFixedToolbar||e[1]!==i||e[2]!==s||e[3]!==n){c=Symbol.for("react.early_return_sentinel");e:{let d=ps(n);if(o?.disableIfParentHasFixedToolbar&&d){c=null;break e}if(!s?.features?.toolbarFixed?.groups?.length){c=null;break e}u=le(y0,{anchorElem:document.body,editor:i,editorConfig:s,parentWithFixedToolbar:d})}e[0]=o.disableIfParentHasFixedToolbar,e[1]=i,e[2]=s,e[3]=n,e[4]=u,e[5]=c}else u=e[4],c=e[5];return c!==Symbol.for("react.early_return_sentinel")?c:u};var I0=y({plugins:[{Component:fs,position:"aboveContainer"}]});import{c as xs}from"react/compiler-runtime";import{jsx as ce,jsxs as Cs}from"react/jsx-runtime";import{useLexicalComposerContext as R0}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as bs}from"@lexical/utils";import{$getSelection as ks,$isRangeSelection as hs,$isTextNode as v0,COMMAND_PRIORITY_LOW as M0,getDOMSelection as _s,SELECTION_CHANGE_COMMAND as D0}from"lexical";import{useCallback as so,useEffect as Nt,useRef as gs,useState as A0}from"react";import*as ao from"react";import{createPortal as O0}from"react-dom";function fr(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 io(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:r=0,floatingElem:n,horizontalOffset:l=32,horizontalPosition:i="left",specialHandlingForCaret:s=!1,targetRect:u,verticalGap:c=10}=t,d=o.parentElement;if(u===null||d==null){n.style.opacity="0",n.style.transform="translate(-10000px, -10000px)";return}let a=n.getBoundingClientRect(),p=o.getBoundingClientRect(),m=d.getBoundingClientRect(),f=u.top-a.height-c,h=u.left-l;i==="center"&&(h=u.left+u.width/2-a.width/2);let g=0;return!e&&f<m.top&&!s&&(g=a.height+u.height+c*2,f+=g),i==="center"?h+a.width>m.right?h=m.right-a.width-l:h<m.left&&(h=m.left+l):h+a.width>m.right&&(h=m.right-a.width-l),h-=p.left,n.style.opacity="1",s&&r!==0?(f-=p.bottom-r+a.height-3,n.style.transform=`translate(${h}px, ${f}px) rotate(180deg)`):(f-=p.top,n.style.transform=`translate(${h}px, ${f}px)`),g}function F0({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&ce(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?ce(St,{editor:e,item:o,children:ce(o.ChildComponent,{})},o.key):null}function $0(t){let e=xs(19),{anchorElem:o,editor:r,group:n,index:l}=t,{editorConfig:i}=H(),[s,u]=ao.useState(),c;e[0]!==n.ChildComponent||e[1]!==n.items||e[2]!==n.type?(c=()=>{n?.type==="dropdown"&&n.items.length&&n.ChildComponent?u(()=>n.ChildComponent):u(void 0)},e[0]=n.ChildComponent,e[1]=n.items,e[2]=n.type,e[3]=c):c=e[3];let d;e[4]!==n?(d=[n],e[4]=n,e[5]=d):d=e[5],ao.useEffect(c,d);let a;e[6]!==n.ChildComponent||e[7]!==n.items||e[8]!==n.type?(a=h=>{let{activeItems:g}=h;if(!g.length){n?.type==="dropdown"&&n.items.length&&n.ChildComponent?u(()=>n.ChildComponent):u(void 0);return}let k=g[0];u(()=>k?.ChildComponent)},e[6]=n.ChildComponent,e[7]=n.items,e[8]=n.type,e[9]=a):a=e[9];let p=a,m=`inline-toolbar-popup__group inline-toolbar-popup__group-${n.key}`,f;return e[10]!==s||e[11]!==o||e[12]!==r||e[13]!==i.features.toolbarInline?.groups.length||e[14]!==n||e[15]!==l||e[16]!==p||e[17]!==m?(f=Cs("div",{className:m,"data-toolbar-group-key":n.key,children:[n.type==="dropdown"&&n.items.length?s?ce($e,{anchorElem:o,editor:r,group:n,Icon:s,maxActiveItems:n.maxActiveItems??1,onActiveChange:p}):ce($e,{anchorElem:o,editor:r,group:n,maxActiveItems:n.maxActiveItems??1,onActiveChange:p}):null,n.type==="buttons"&&n.items.length?n.items.map(h=>ce(F0,{anchorElem:o,editor:r,item:h},h.key)):null,l<i.features.toolbarInline?.groups.length-1&&ce("div",{className:"divider"})]},n.key),e[10]=s,e[11]=o,e[12]=r,e[13]=i.features.toolbarInline?.groups.length,e[14]=n,e[15]=l,e[16]=p,e[17]=m,e[18]=f):f=e[18],f}function P0({anchorElem:t,editor:e}){let o=gs(null),r=gs(null),{editorConfig:n}=H(),l=so(()=>{if(o?.current){let c=o.current.style.opacity==="0",d=o.current.style.pointerEvents==="none";c||(o.current.style.opacity="0"),d||(o.current.style.pointerEvents="none")}},[o]),i=so(c=>{if(o?.current&&(c.buttons===1||c.buttons===3)){let d=o.current.style.opacity==="0",a=o.current.style.pointerEvents==="none";if(!d||!a){let p=c.clientX,m=c.clientY,f=document.elementFromPoint(p,m);o.current.contains(f)||l()}}},[l]),s=so(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);Nt(()=>(document.addEventListener("mousemove",i),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",s)}),[o,i,s]);let u=so(()=>{let c=ks(),d=_s(e._window);if(o.current===null)return;let a=t.querySelector(":scope > .link-editor"),p=a!==null&&"style"in a&&a?.style?.opacity==="1",m=e.getRootElement();if(c!==null&&d!==null&&!d.isCollapsed&&m!==null&&m.contains(d.anchorNode)){let f=fr(d,m),h=io({alwaysDisplayOnTop:p,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});r.current&&io({anchorElem:o.current,anchorFlippedOffset:h,floatingElem:r.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else l()},[e,l,t]);return Nt(()=>{let c=t.parentElement,d=()=>{e.getEditorState().read(()=>{u()})};return window.addEventListener("resize",d),c&&c.addEventListener("scroll",d),()=>{window.removeEventListener("resize",d),c&&c.removeEventListener("scroll",d)}},[e,u,t]),Nt(()=>(e.getEditorState().read(()=>{u()}),bs(e.registerUpdateListener(({editorState:c})=>{c.read(()=>{u()})}),e.registerCommand(D0,()=>(u(),!1),M0))),[e,u]),Cs("div",{className:"inline-toolbar-popup",ref:o,children:[ce("div",{className:"caret",ref:r}),n?.features&&n.features?.toolbarInline?.groups.map((c,d)=>ce($0,{anchorElem:t,editor:e,group:c,index:d},c.key))]})}function B0(t,e){let o=xs(12),[r,n]=A0(!1),l;o[0]!==t?(l=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let p=ks(),m=_s(t._window),f=t.getRootElement();if(m!==null&&(!hs(p)||f===null||!f.contains(m.anchorNode))){n(!1);return}if(!hs(p))return;if(p.getTextContent()!==""){let g=p.getNodes(),k=!1;for(let T of g)if(v0(T)){n(!0),k=!0;break}k||n(!1)}else n(!1);let h=p.getTextContent().replace(/\n/g,"");if(!p.isCollapsed()&&h===""){n(!1);return}})},o[0]=t,o[1]=l):l=o[1];let i=l,s,u;o[2]!==i?(s=()=>(document.addEventListener("selectionchange",i),document.addEventListener("mouseup",i),()=>{document.removeEventListener("selectionchange",i),document.removeEventListener("mouseup",i)}),u=[i],o[2]=i,o[3]=s,o[4]=u):(s=o[3],u=o[4]),Nt(s,u);let c,d;if(o[5]!==t||o[6]!==i?(c=()=>bs(t.registerUpdateListener(()=>{i()}),t.registerRootListener(()=>{t.getRootElement()===null&&n(!1)})),d=[t,i],o[5]=t,o[6]=i,o[7]=c,o[8]=d):(c=o[7],d=o[8]),Nt(c,d),!r||!t.isEditable())return null;let a;return o[9]!==e||o[10]!==t?(a=O0(ce(P0,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=a):a=o[11],a}var Ts=t=>{let{anchorElem:e}=t,[o]=R0();return B0(o,e)};var H0=y({plugins:[{Component:Ts,position:"floatingAnchorElem"}]});import{TableCellNode as yh,TableNode as Ih,TableRowNode as Rh}from"@lexical/table";import{jsx as ws}from"react/jsx-runtime";import"react";var hr=()=>ws("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:ws("path",{clipRule:"evenodd",d:"M5.33333 4.5C4.8731 4.5 4.5 4.8731 4.5 5.33333V7.5H9.5V4.5H5.33333ZM5.33333 3.5C4.32081 3.5 3.5 4.32081 3.5 5.33333V14.6667C3.5 15.6792 4.32081 16.5 5.33333 16.5H14.6667C15.6792 16.5 16.5 15.6792 16.5 14.6667V5.33333C16.5 4.32081 15.6792 3.5 14.6667 3.5H5.33333ZM10.5 4.5V7.5H15.5V5.33333C15.5 4.8731 15.1269 4.5 14.6667 4.5H10.5ZM15.5 8.5H10.5V11.5H15.5V8.5ZM15.5 12.5H10.5V15.5H14.6667C15.1269 15.5 15.5 15.1269 15.5 14.6667V12.5ZM9.5 15.5V12.5H4.5V14.6667C4.5 15.1269 4.8731 15.5 5.33333 15.5H9.5ZM4.5 11.5H9.5V8.5H4.5V11.5Z",fill:"currentColor",fillRule:"evenodd"})});import{$createTableCellNode as j0,$createTableNode as U0,$createTableRowNode as G0,$isTableCellNode as Es,$isTableNode as gr,$isTableRowNode as xr,TableCellHeaderStates as co,TableCellNode as W0,TableNode as V0,TableRowNode as K0}from"@lexical/table";import{$isParagraphNode as J0,$isTextNode as X0}from"lexical";var Ns=/^\|(.+)\|\s?$/,z0=/^(\| ?:?-*:? ?)+\|\s?$/,Ls=({allTransformers:t})=>({type:"element",dependencies:[V0,K0,W0],export:e=>{if(!gr(e))return null;let o=[];for(let r of e.getChildren()){let n=[];if(!xr(r))continue;let l=!1;for(let i of r.getChildren())Es(i)&&(n.push(Br(t,i).replace(/\n/g,"\\n").trim()),i.__headerState===co.ROW&&(l=!0));o.push(`| ${n.join(" | ")} |`),l&&o.push(`| ${n.map(i=>"---").join(" | ")} |`)}return o.join(`
39
+ `)},regExp:Ns,replace:(e,o,r)=>{let n=r[0];if(!n)return;if(z0.test(n)){let a=e.getPreviousSibling();if(!a||!gr(a))return;let p=a.getChildren(),m=p[p.length-1];if(!m||!xr(m))return;m.getChildren().forEach(f=>{Es(f)&&f.setHeaderStyles(co.ROW,co.ROW)}),e.remove();return}let l=Ss(n,t);if(l==null)return;let i=[l],s=e.getPreviousSibling(),u=l.length;for(;s&&!(!J0(s)||s.getChildrenSize()!==1);){let a=s.getFirstChild();if(!X0(a))break;let p=Ss(a.getTextContent(),t);if(p==null)break;u=Math.max(u,p.length),i.unshift(p);let m=s.getPreviousSibling();s.remove(),s=m}let c=U0();for(let a of i){let p=G0();c.append(p);for(let m=0;m<u;m++)p.append(m<a.length?a[m]:ys("",t))}let d=e.getPreviousSibling();gr(d)&&Z0(d)===u?(d.append(...c.getChildren()),e.remove()):e.replace(c),c.selectEnd()}});function Z0(t){let e=t.getFirstChild();return xr(e)?e.getChildrenSize():0}var ys=(t,e)=>{t=t.replace(/\\n/g,`
40
+ `);let o=j0(co.NO_STATUS);return Pr(t,e,o),o},Ss=(t,e)=>{let o=t.match(Ns);return!o||!o[1]?null:o[1].split("|").map(r=>ys(r,e))};import{c as q0}from"react/compiler-runtime";import{jsx as P,jsxs as _e}from"react/jsx-runtime";import{useLexicalComposerContext as Ds}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Q0}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as Rs,$deleteTableColumnAtSelection as e1,$deleteTableRowAtSelection as t1,$getNodeTriplet as o1,$getTableCellNodeFromLexicalNode as vs,$getTableColumnIndexFromTableCellNode as r1,$getTableNodeFromLexicalNodeOrThrow as Ie,$getTableRowIndexFromTableCellNode as n1,$insertTableColumnAtSelection as l1,$insertTableRowAtSelection as i1,$isTableCellNode as As,$isTableSelection as Lt,$mergeCells as s1,$unmergeCell as a1,getTableElement as br,getTableObserverFromTableElement as kr,TableCellHeaderStates as ye,TableCellNode as c1}from"@lexical/table";import{mergeRegister as u1}from"@lexical/utils";import{useScrollInfo as d1}from"@payloadcms/ui";import{$getSelection as mo,$isElementNode as m1,$isRangeSelection as _r,$isTextNode as p1,$setSelection as f1,COMMAND_PRIORITY_CRITICAL as h1,getDOMSelection as g1,isDOMNode as x1,SELECTION_CHANGE_COMMAND as C1}from"lexical";import*as Tr from"react";import{useCallback as ie,useEffect as Qe,useRef as uo,useState as et}from"react";import{createPortal as Os}from"react-dom";import{jsx as Cr,jsxs as Y0}from"react/jsx-runtime";import"react";var Is=()=>Y0("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[Cr("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"}),Cr("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"}),Cr("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 Ms(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function b1(){let t=mo();if(_r(t)&&!t.isCollapsed()||Lt(t)&&!t.anchor.is(t.focus)||!_r(t)&&!Lt(t))return!1;let[e]=o1(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function k1(t){let e=t.getLastDescendant();p1(e)?e.select():m1(e)?e.selectEnd():e!==null&&e.selectNext()}function _1({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[l]=Ds(),i=uo(null),[s,u]=et(n),[c,d]=et({columns:1,rows:1}),[a,p]=et(!1),[m,f]=et(!1),{y:h}=d1();Qe(()=>l.registerMutationListener(c1,C=>{C.get(s.getKey())==="updated"&&l.getEditorState().read(()=>{u(s.getLatest())})},{skipInitialization:!0}),[l,s]),Qe(()=>{l.getEditorState().read(()=>{let C=mo();if(Lt(C)){let S=Ms(C);d(Ms(C)),p(S.columns>1||S.rows>1)}f(b1())})},[l]),Qe(()=>{let C=e.current,S=i.current,M=l.getRootElement();if(C!=null&&S!=null&&M!=null){let L=M.getBoundingClientRect(),D=C.getBoundingClientRect();S.style.opacity="1";let N=S.getBoundingClientRect(),$=5,G=D.right+$;if(G+N.width>window.innerWidth||G+N.width>L.right){let te=D.left-N.width-$;G=(te<0?$:te)+window.pageXOffset}S.style.left=`${G+window.pageXOffset}px`;let q=D.top;if(q+N.height>window.innerHeight){let te=D.bottom-N.height;q=te<0?$:te}S.style.top=`${q}px`}},[e,i,l,h]),Qe(()=>{function C(S){i.current!=null&&e.current!=null&&x1(S.target)&&!i.current.contains(S.target)&&!e.current.contains(S.target)&&r(!1)}return window.addEventListener("click",C),()=>window.removeEventListener("click",C)},[r,e]);let g=ie(()=>{l.update(()=>{if(s.isAttached()){let C=Ie(s),S=br(C,l.getElementByKey(C.getKey()));if(S===null)throw new Error("Expected to find tableElement in DOM");let M=kr(S);M!==null&&M.$clearHighlight(),C.markDirty(),u(s.getLatest())}f1(null)})},[l,s]),k=()=>{l.update(()=>{let C=mo();if(!Lt(C))return;let M=C.getNodes().filter(As),L=s1(M);L&&(k1(L),o())})},T=()=>{l.update(()=>{a1()})},I=ie(C=>{l.update(()=>{for(let S=0;S<c.rows;S++)i1(C);o()})},[l,o,c.rows]),b=ie(C=>{l.update(()=>{for(let S=0;S<c.columns;S++)l1(C);o()})},[l,o,c.columns]),_=ie(()=>{l.update(()=>{t1(),o()})},[l,o]),x=ie(()=>{l.update(()=>{Ie(s).remove(),g(),o()})},[l,s,g,o]),w=ie(()=>{l.update(()=>{e1(),o()})},[l,o]),v=ie(()=>{l.update(()=>{let C=Ie(s),S=n1(s),[M]=Rs(C,null,null),L=new Set,D=s.getHeaderStyles()^ye.ROW;if(M[S])for(let N=0;N<M[S].length;N++){let $=M[S][N];$?.cell&&(L.has($.cell)||(L.add($.cell),$.cell.setHeaderStyles(D,ye.ROW)))}g(),o()})},[l,s,g,o]),O=ie(()=>{l.update(()=>{let C=Ie(s),S=r1(s),[M]=Rs(C,null,null),L=new Set,D=s.getHeaderStyles()^ye.COLUMN;if(M)for(let N=0;N<M.length;N++){let $=M?.[N]?.[S];$?.cell&&(L.has($.cell)||(L.add($.cell),$.cell.setHeaderStyles(D,ye.COLUMN)))}g(),o()})},[l,s,g,o]),F=ie(()=>{l.update(()=>{if(s.isAttached()){let C=Ie(s);C&&C.setRowStriping(!C.getRowStriping())}g(),o()})},[l,s,g,o]),R=ie(()=>{l.update(()=>{if(s.isAttached()){let C=Ie(s);C&&C.setFrozenColumns(C.getFrozenColumns()===0?1:0)}g(),o()})},[l,s,g,o]),E=null;return t&&(a?E=P("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>k(),type:"button",children:P("span",{className:"text",children:"Merge cells"})}):m&&(E=P("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>T(),type:"button",children:P("span",{className:"text",children:"Unmerge cells"})}))),Os(_e("div",{className:"table-action-menu-dropdown",onClick:C=>{C.stopPropagation()},ref:i,children:[E?_e(Tr.Fragment,{children:[E,P("hr",{})]}):null,P("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>F(),type:"button",children:P("span",{className:"text",children:"Toggle Row Striping"})}),P("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>R(),type:"button",children:P("span",{className:"text",children:"Toggle First Column Freeze"})}),P("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>I(!1),type:"button",children:_e("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," above"]})}),P("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>I(!0),type:"button",children:_e("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," below"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>b(!1),type:"button",children:_e("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","left"]})}),P("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>b(!0),type:"button",children:_e("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","right"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>w(),type:"button",children:P("span",{className:"text",children:"Delete column"})}),P("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>_(),type:"button",children:P("span",{className:"text",children:"Delete row"})}),P("button",{className:"item","data-test-id":"table-delete",onClick:()=>x(),type:"button",children:P("span",{className:"text",children:"Delete table"})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-row-header",onClick:()=>v(),type:"button",children:_e("span",{className:"text",children:[(s.__headerState&ye.ROW)===ye.ROW?"Remove":"Add"," ","row header"]})}),P("button",{className:"item","data-test-id":"table-column-header",onClick:()=>O(),type:"button",children:_e("span",{className:"text",children:[(s.__headerState&ye.COLUMN)===ye.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function T1({anchorElem:t,cellMerge:e}){let[o]=Ds(),r=uo(null),n=uo(null),[l,i]=et(!1),[s,u]=et(null),c=ie(()=>{let a=r.current,p=mo(),m=g1(o._window),f=document.activeElement;function h(){a&&(a.classList.remove("table-cell-action-button-container--active"),a.classList.add("table-cell-action-button-container--inactive")),u(null)}if(p==null||a==null)return h();let g=o.getRootElement(),k=null,T=null;if(_r(p)&&g!==null&&m!==null&&g.contains(m.anchorNode)){let b=vs(p.anchor.getNode());if(b==null||(T=o.getElementByKey(b.getKey()),T==null||!b.isAttached()))return h();let _=Ie(b),x=br(_,o.getElementByKey(_.getKey()));if(x===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");k=kr(x),u(b)}else if(Lt(p)){let b=vs(p.anchor.getNode());if(!As(b))throw new Error("TableSelection anchorNode must be a TableCellNode");let _=Ie(b),x=br(_,o.getElementByKey(_.getKey()));if(x===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");k=kr(x),T=o.getElementByKey(b.getKey())}else if(!f)return h();if(k===null||T===null)return h();let I=!k||!k.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",I),a.classList.toggle("table-cell-action-button-container--inactive",!I),I){let b=T.getBoundingClientRect(),_=t.getBoundingClientRect(),x=b.top-_.top,w=b.right-_.left;a.style.transform=`translate(${w}px, ${x}px)`}},[o,t]);Qe(()=>{let a,p=()=>{a=void 0,o.getEditorState().read(c)},m=()=>(a===void 0&&(a=setTimeout(p,0)),!1);return u1(o.registerUpdateListener(m),o.registerCommand(C1,m,h1),o.registerRootListener((f,h)=>{h&&h.removeEventListener("pointerup",m),f&&(f.addEventListener("pointerup",m),m())}),()=>clearTimeout(a))});let d=uo(s);return Qe(()=>{d.current!==s&&i(!1),d.current=s},[d,s]),P("div",{className:"table-cell-action-button-container",ref:r,children:s!=null&&_e(Tr.Fragment,{children:[P("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),i(!l)},ref:n,type:"button",children:P(Is,{})}),l&&P(_1,{cellMerge:e,contextRef:n,onClose:()=>i(!1),setIsMenuOpen:i,tableCellNode:s})]})})}var Fs=t=>{let e=q0(3),{anchorElem:o}=t,r=Q0(),n;return e[0]!==o||e[1]!==r?(n=Os(r?P(T1,{anchorElem:o??document.body,cellMerge:!0}):null,o??document.body),e[0]=o,e[1]=r,e[2]=n):n=e[2],n};import{c as w1}from"react/compiler-runtime";import{jsx as fo,jsxs as E1}from"react/jsx-runtime";import{useLexicalComposerContext as S1}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as N1}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as L1,$getTableNodeFromLexicalNodeOrThrow as wr,$getTableRowIndexFromTableCellNode as y1,$isTableCellNode as $s,$isTableRowNode as I1,getDOMCellFromTarget as R1,getTableElement as v1,TableNode as Ps}from"@lexical/table";import{calculateZoomLevel as Bs,mergeRegister as M1}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Er,isHTMLElement as D1,SKIP_SCROLL_INTO_VIEW_TAG as Hs}from"lexical";import*as Us from"react";import{useCallback as yt,useEffect as Sr,useRef as po,useState as tt}from"react";import{createPortal as A1}from"react-dom";var O1=33,js=92;function F1({editor:t}){let e=po(null),o=po(null),r=po(null),[n,l]=tt(!1),i=H(),s=po(null),[u,c]=tt(null),[d,a]=tt(null),[p,m]=tt(!1),[f,h]=tt(null),g=yt(()=>{a(null),e.current=null,h(null),s.current=null,r.current=null},[]),k=R=>(R.buttons&1)===1;Sr(()=>{let R=new Set;return M1(t.registerMutationListener(Ps,E=>{for(let[C,S]of E)S==="destroyed"?R.delete(C):R.add(C);l(R.size>0)}),t.registerNodeTransform(Ps,E=>{if(E.getColWidths())return E;let C=E.getColumnCount(),S=js;return E.setColWidths(Array(C).fill(S)),E}))},[t]),Sr(()=>{if(!n)return;let R=M=>{let L=M.target;if(D1(L)){if(f){c({x:M.clientX,y:M.clientY});return}if(m(k(M)),!(o.current&&o.current.contains(L))&&e.current!==L){e.current=L;let D=R1(L);D&&d!==D?t.getEditorState().read(()=>{let N=Er(D.elem);if(!N)throw new Error("TableCellResizer: Table cell node not found.");let $=wr(N),G=v1($,t.getElementByKey($.getKey()));if(!G)throw new Error("TableCellResizer: Table element not found.");e.current=L,r.current=G.getBoundingClientRect(),a(D)},{editor:t}):D==null&&g()}}},E=M=>{m(!0)},C=M=>{m(!1)},S=t.registerRootListener((M,L)=>{L?.removeEventListener("mousemove",R),L?.removeEventListener("mousedown",E),L?.removeEventListener("mouseup",C),M?.addEventListener("mousemove",R),M?.addEventListener("mousedown",E),M?.addEventListener("mouseup",C)});return()=>{S()}},[d,f,t,n,g]);let T=R=>R==="bottom",I=yt(R=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let E=Er(d.elem);if(!$s(E))throw new Error("TableCellResizer: Table cell node not found.");let C=wr(E),S=y1(E),M=C.getChildren(),D=E.getColSpan()===C.getColumnCount()?S:S+E.getRowSpan()-1;if(D>=M.length||D<0)throw new Error("Expected table cell to be inside of table row.");let N=M[D];if(!I1(N))throw new Error("Expected table row");let $=N.getHeight();if($===void 0){let q=N.getChildren();$=Math.min(...q.map(te=>b(te,t)??1/0))}let G=Math.max($+R,O1);N.setHeight(G)},{tag:Hs})},[d,t]),b=(R,E)=>E.getElementByKey(R.getKey())?.clientHeight,_=(R,E)=>{let C;return E.forEach(S=>{S.forEach((M,L)=>{M.cell===R&&(C=L)})}),C},x=yt(R=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let E=Er(d.elem);if(!$s(E))throw new Error("TableCellResizer: Table cell node not found.");let C=wr(E),[S]=L1(C,null,null),M=_(E,S);if(M===void 0)throw new Error("TableCellResizer: Table column not found.");let L=C.getColWidths();if(!L)return;let D=L[M];if(D===void 0)return;let N=[...L],$=Math.max(D+R,js);N[M]=$,C.setColWidths(N)},{tag:Hs})},[d,t]),w=yt(R=>{let E=C=>{if(C.preventDefault(),C.stopPropagation(),!d)throw new Error("TableCellResizer: Expected active cell.");if(s.current){let{x:S,y:M}=s.current;if(d===null)return;let L=Bs(C.target);if(T(R)){let D=(C.clientY-M)/L;I(D)}else{let D=(C.clientX-S)/L;x(D)}g(),document.removeEventListener("mouseup",E)}};return E},[d,g,x,I]),v=yt(R=>E=>{if(E.preventDefault(),E.stopPropagation(),!d)throw new Error("TableCellResizer: Expected active cell.");s.current={x:E.clientX,y:E.clientY},c(s.current),h(R),document.addEventListener("mouseup",w(R))},[d,w]),[O,F]=tt({bottom:null,left:null,right:null,top:null});return Sr(()=>{if(d){let{height:R,left:E,top:C,width:S}=d.elem.getBoundingClientRect(),M=Bs(d.elem),L=10,D={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${L}px`,left:`${window.scrollX+E}px`,top:`${window.scrollY+C+R-L/2}px`,width:`${S}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${R}px`,left:`${window.scrollX+E+S-L/2}px`,top:`${window.scrollY+C}px`,width:`${L}px`}},N=r.current;f&&u&&N&&(T(f)?(D[f].left=`${window.scrollX+N.left}px`,D[f].top=`${window.scrollY+u.y/M}px`,D[f].height="3px",D[f].width=`${N.width}px`):(D[f].top=`${window.scrollY+N.top}px`,D[f].left=`${window.scrollX+u.x/M}px`,D[f].width="3px",D[f].height=`${N.height}px`),D[f].backgroundColor="#adf"),F(D)}else F({bottom:null,left:null,right:null,top:null})},[d,f,u]),fo("div",{ref:o,children:d!=null&&!p&&E1(Us.Fragment,{children:[fo("div",{className:`${i.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:v("right"),style:O.right||void 0}),fo("div",{className:`${i.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:v("bottom"),style:O.bottom||void 0})]})})}var Gs=()=>{let t=w1(3),[e]=S1(),o=N1(),r;return t[0]!==e||t[1]!==o?(r=o?A1(fo(F1,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=r):r=t[2],r};import{c as W1}from"react/compiler-runtime";import{jsx as Nr,jsxs as V1,Fragment as K1}from"react/jsx-runtime";import{useLexicalComposerContext as Ys}from"@lexical/react/LexicalComposerContext";import{$getTableAndElementByKey as J1,$getTableColumnIndexFromTableCellNode as X1,$getTableRowIndexFromTableCellNode as z1,$insertTableColumnAtSelection as Z1,$insertTableRowAtSelection as Y1,$isTableCellNode as q1,$isTableNode as Ks,getTableElement as Q1,TableNode as eh}from"@lexical/table";import{$findMatchingParent as th,mergeRegister as oh}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Js,isHTMLElement as rh}from"lexical";import{useEffect as Xs,useMemo as nh,useRef as zs,useState as ho}from"react";import"react";import{createPortal as lh}from"react-dom";import{c as j1}from"react/compiler-runtime";import{useEffect as U1,useRef as G1}from"react";var $1="Expected a function",P1=Math.max,B1=Math.min;function H1(t,e,o){let r,n,l=0,i,s=!1,u=!1,c,d,a,p=!0;if(typeof t!="function")throw new TypeError($1);e=e||0,typeof o=="object"&&(s=!!o.leading,u="maxWait"in o,c=u?P1(o.maxWait||0,e):c,p="trailing"in o?!!o.trailing:p);function m(x){let w=r,v=i;return r=i=void 0,l=x,d=t.apply(v,w),d}function f(x){return l=x,a=setTimeout(k,e),s?m(x):d}function h(x){let w=x-n,v=x-l,O=e-w;return u?B1(O,c-v):O}function g(x){let w=x-n,v=x-l;return n===void 0||w>=e||w<0||u&&v>=c}function k(){let x=Date.now();if(g(x))return T(x);a=setTimeout(k,h(x))}function T(x){return a=void 0,p&&r?m(x):(r=i=void 0,d)}function I(){a!==void 0&&clearTimeout(a),l=0,r=n=i=a=void 0}function b(){return a===void 0?d:T(Date.now())}function _(){let x=Date.now(),w=g(x);if(r=arguments,i=this,n=x,w){if(a===void 0)return f(n);if(u)return clearTimeout(a),a=setTimeout(k,e),m(n)}return a===void 0&&(a=setTimeout(k,e)),d}return _.cancel=I,_.flush=b,_}var Ws=H1;function Vs(t,e,o){let r=j1(6),n=G1(null),l,i;r[0]!==t||r[1]!==o||r[2]!==e?(l=()=>(n.current=Ws(t,e,{maxWait:o}),()=>{n.current?.cancel()}),i=[t,e,o],r[0]=t,r[1]=o,r[2]=e,r[3]=l,r[4]=i):(l=r[3],i=r[4]),U1(l,i);let s;return r[5]===Symbol.for("react.memo_cache_sentinel")?(s=(...c)=>{let d=c;n.current&&n.current(...d)},r[5]=s):s=r[5],s}var Zs=20;function ih({anchorElem:t}){let[e]=Ys(),o=H(),[r,n]=ho(!1),[l,i]=ho(!1),[s,u]=ho(!1),[c,d]=ho({}),a=zs(new Set),p=zs(null),m=Vs(g=>{let{isOutside:k,tableDOMNode:T}=sh(g,o.editorConfig?.lexical);if(k){n(!1),i(!1);return}if(!T)return;p.current=T;let I=null,b=null,_=null;if(e.getEditorState().read(()=>{let L=Js(T);if(q1(L)){let D=th(L,N=>Ks(N));if(!Ks(D))return;if(_=Q1(D,e.getElementByKey(D.getKey())),_){let N=D.getChildrenSize(),$=D.getChildAtIndex(0)?.getChildrenSize(),G=z1(L),q=X1(L);G===N-1?I=L:q===$-1&&(b=L)}}},{editor:e}),!_)return;let x=_.parentElement;if(!x)return;let{bottom:w,height:v,left:O,right:F,width:R,y:E}=_.getBoundingClientRect(),C=!1;x&&x.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(C=x.scrollWidth>x.clientWidth);let{left:S,y:M}=t.getBoundingClientRect();I?(i(!1),n(!0),d({height:Zs,left:C&&x?x.offsetLeft:O-S,top:w-M+5,width:C&&x?x.offsetWidth:R})):b&&(i(!0),n(!1),d({height:v,left:F-S+5,top:E-M,width:Zs}))},50,250),f=nh(()=>new ResizeObserver(()=>{n(!1),i(!1)}),[]);Xs(()=>{if(s)return document.addEventListener("mousemove",m),()=>{n(!1),i(!1),document.removeEventListener("mousemove",m)}},[s,m]),Xs(()=>oh(e.registerMutationListener(eh,g=>{e.getEditorState().read(()=>{let k=!1;for(let[T,I]of g)switch(I){case"created":{a.current.add(T),k=!0;break}case"destroyed":{a.current.delete(T),k=!0;break}default:break}if(k){f.disconnect();for(let T of a.current){let{tableElement:I}=J1(T);f.observe(I)}u(a.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,f]);let h=g=>{e.update(()=>{p.current&&(Js(p.current)?.selectEnd(),g?(Y1(),n(!1)):(Z1(),i(!1)))})};return e?.isEditable()?V1(K1,{children:[r&&Nr("button",{"aria-label":"Add Row",className:o.editorConfig.lexical.theme.tableAddRows,onClick:()=>h(!0),style:{...c},type:"button"}),l&&Nr("button",{"aria-label":"Add Column",className:o.editorConfig.lexical.theme.tableAddColumns,onClick:()=>h(!1),style:{...c},type:"button"})]}):null}function sh(t,e){let o=t.target;if(rh(o)){let r=o.closest(`td.${e.theme.tableCell}, th.${e.theme.tableCell}`);return{isOutside:!(r||o.closest(`button.${e.theme.tableAddRows}`)||o.closest(`button.${e.theme.tableAddColumns}`)||o.closest(`div.${e.theme.tableCellResizer}`)),tableDOMNode:r}}else return{isOutside:!0,tableDOMNode:null}}function qs(t){let e=W1(2),{anchorElem:o}=t,r=o===void 0?document.body:o,[n]=Ys();if(!n?.isEditable())return null;let l;return e[0]!==r?(l=lh(Nr(ih,{anchorElem:r}),r),e[0]=r,e[1]=l):l=e[1],l}import{c as ah}from"react/compiler-runtime";import{jsx as Lr,jsxs as ch}from"react/jsx-runtime";import{useLexicalComposerContext as uh}from"@lexical/react/LexicalComposerContext";import{TablePlugin as dh}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as mh,TableCellNode as ph,TableNode as fh,TableRowNode as hh}from"@lexical/table";import{mergeRegister as gh}from"@lexical/utils";import{formatDrawerSlug as xh,useEditDepth as Ch}from"@payloadcms/ui";import{$getSelection as bh,$isRangeSelection as kh,COMMAND_PRIORITY_EDITOR as _h,createCommand as Th}from"lexical";import{createContext as wh,use as Eh,useEffect as Sh,useMemo as Nh,useState as Lh}from"react";import*as Qs from"react";var go=Th("OPEN_EMBED_DRAWER_COMMAND"),ea=wh({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function ta({children:t}){let[e,o]=Lh({cellEditorConfig:null,cellEditorPlugins:null});return Lr(ea,{value:Nh(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var oa=()=>{let t=ah(16),[e]=uh(),o=Eh(ea),r=Ch(),{fieldProps:n,uuid:l}=H(),{schemaPath:i}=n,s="lexical-table-create-"+l,u;t[0]!==r||t[1]!==s?(u=xh({slug:s,depth:r}),t[0]=r,t[1]=s,t[2]=u):u=t[2];let c=u,{toggleDrawer:d}=de(c,!0),a;t[3]!==e||t[4]!==d?(a=()=>{if(!e.hasNodes([fh,hh,ph]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return gh(e.registerCommand(go,()=>{let h=null;return e.getEditorState().read(()=>{let g=bh();kh(g)&&(h=g)}),h&&d(),!0},_h))},t[3]=e,t[4]=d,t[5]=a):a=t[5];let p;t[6]!==o||t[7]!==e||t[8]!==d?(p=[o,e,d],t[6]=o,t[7]=e,t[8]=d,t[9]=p):p=t[9],Sh(a,p);let m;t[10]!==e?(m=(h,g)=>{!g.columns||!g.rows||e.dispatchCommand(mh,{columns:String(g.columns),rows:String(g.rows)})},t[10]=e,t[11]=m):m=t[11];let f;return t[12]!==c||t[13]!==i||t[14]!==m?(f=ch(Qs.Fragment,{children:[Lr(rt,{drawerSlug:c,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:m,schemaPath:i,schemaPathSuffix:"fields"}),Lr(dh,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]}),t[12]=c,t[13]=i,t[14]=m,t[15]=f):f=t[15],f};var vh=y({markdownTransformers:[Ls],nodes:[Ih,yh,Rh],plugins:[{Component:oa,position:"normal"},{Component:Gs,position:"normal"},{Component:Fs,position:"floatingAnchorElem"},{Component:qs,position:"floatingAnchorElem"}],providers:[ta],slashMenu:{groups:[Z([{Icon:hr,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(go,{})}}])]},toolbarFixed:{groups:[fe([{ChildComponent:hr,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(go,{})}}])]}});import{$isNodeSelection as ag}from"lexical";import{jsx as yr,jsxs as Mh}from"react/jsx-runtime";import"react";var Ir=()=>Mh("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:"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"}),yr("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"}),yr("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{jsx as $h}from"react/jsx-runtime";import la from"bson-objectid";import{$applyNodeReplacement as Ph}from"lexical";import*as ia from"react";import{jsx as Dh}from"react/jsx-runtime";import{DecoratorBlockNode as Ah}from"@lexical/react/LexicalDecoratorBlockNode.js";import ra from"bson-objectid";import{$applyNodeReplacement as Oh}from"lexical";import"react";function Rr(t){return t.parentElement!=null&&t.parentElement.tagName==="LI"&&t.previousSibling===null&&t.getAttribute("aria-roledescription")==="checkbox"}function Fh(t){if(t.hasAttribute("data-lexical-upload-relation-to")&&t.hasAttribute("data-lexical-upload-id")){let o=t.getAttribute("data-lexical-upload-id"),r=t.getAttribute("data-lexical-upload-relation-to");if(o!=null&&r!=null)return{node:na({data:{fields:{},relationTo:r,value:o}})}}let e=t;return e.src.startsWith("file:///")||Rr(e),null}var It=class extends Ah{__data;constructor({data:e,format:o,key:r}){super(o,r),this.__data=e}static clone(e){return new this({data:e.__data,format:e.__format,key:e.__key})}static getType(){return"upload"}static importDOM(){return{img:e=>({conversion:Fh,priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new ra.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,relationTo:e.relationTo,value:e.value},r=na({data:o});return r.setFormat(e.format),r}static isInline(){return!1}decorate(){return Dh(RawUploadComponent,{data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportDOM(){let e=document.createElement("img");return e.setAttribute("data-lexical-upload-id",String(this.__data?.value)),e.setAttribute("data-lexical-upload-relation-to",this.__data?.relationTo),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"upload",version:3}}getData(){return this.getLatest().__data}setData(e){let o=this.getWritable();o.__data=e}updateDOM(){return!1}};function na({data:t}){return t?.id||(t.id=new ra.default().toHexString()),Oh(new It({data:t}))}var Bh=ia.lazy(()=>import("./component-3PENNOM3.js").then(t=>({default:t.UploadComponent})));function Hh(t){if(t.hasAttribute("data-lexical-upload-relation-to")&&t.hasAttribute("data-lexical-upload-id")){let o=t.getAttribute("data-lexical-upload-id"),r=t.getAttribute("data-lexical-upload-relation-to");if(o!=null&&r!=null)return{node:Pe({data:{fields:{},relationTo:r,value:o}})}}let e=t;return e.src.startsWith("file:///")||Rr(e),null}var Te=class extends It{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{img:e=>({conversion:Hh,priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new la.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,relationTo:e.relationTo,value:e.value},r=Pe({data:o});return r.setFormat(e.format),r}decorate(){return $h(Bh,{data:this.__data,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Pe({data:t}){return t?.id||(t.id=new la.default().toHexString()),Ph(new Te({data:t}))}function vr(t){return t instanceof Te}import{c as Xh}from"react/compiler-runtime";import{jsx as zh}from"react/jsx-runtime";import{useLexicalComposerContext as Zh}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Yh,mergeRegister as qh}from"@lexical/utils";import{useConfig as Qh}from"@payloadcms/ui";import{$getPreviousSelection as eg,$getSelection as tg,$isParagraphNode as og,$isRangeSelection as rg,COMMAND_PRIORITY_EDITOR as ng,createCommand as lg}from"lexical";import{useEffect as ig}from"react";import{c as sa}from"react/compiler-runtime";import{jsx as Mr}from"react/jsx-runtime";import{useLexicalComposerContext as aa}from"@lexical/react/LexicalComposerContext.js";import{toast as jh}from"@payloadcms/ui";import{$getNodeByKey as Uh,COMMAND_PRIORITY_EDITOR as ca}from"lexical";import{useEffect as ua,useState as Gh}from"react";var Wh=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=Uh(o);n&&n.replace(Pe({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(Dr,{fields:null,relationTo:e,value:r})},Vh=t=>{let e=sa(13),{enabledCollectionSlugs:o}=t,[r]=aa(),[n,l]=Gh(null),i;e[0]!==o?(i={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=i):i=e[1];let{closeListDrawer:s,ListDrawer:u,openListDrawer:c}=Et(i),d,a;e[2]!==r||e[3]!==c?(d=()=>r.registerCommand(Ue,h=>(l(h?.replace?h?.replace.nodeKey:null),c(),!0),ca),a=[r,c],e[2]=r,e[3]=c,e[4]=d,e[5]=a):(d=e[4],a=e[5]),ua(d,a);let p;e[6]!==s||e[7]!==r||e[8]!==n?(p=h=>{let{collectionSlug:g,doc:k}=h;s(),Wh({editor:r,relationTo:g,replaceNodeKey:n,value:k.id})},e[6]=s,e[7]=r,e[8]=n,e[9]=p):p=e[9];let m=p,f;return e[10]!==u||e[11]!==m?(f=Mr(u,{onSelect:m}),e[10]=u,e[11]=m,e[12]=f):f=e[12],f},Kh=()=>{let t=sa(3),[e]=aa(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Ue,Jh,ca),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),ua(o,r),null},da=t=>Mr(At,{...t,FallbackComponent:Kh,uploads:!0,children:Mr(Vh,{...t})});function Jh(){return jh.error("No upload collections enabled"),!0}var Dr=lg("INSERT_UPLOAD_COMMAND"),ma=t=>{let e=Xh(5),[o]=Zh(),{config:r}=Qh(),{collections:n}=r,l,i;e[0]!==o?(l=()=>{if(!o.hasNodes([Te]))throw new Error("UploadPlugin: UploadNode not registered on editor");return qh(o.registerCommand(Dr,u=>(o.update(()=>{let c=tg()||eg();if(rg(c)){let d=Pe({data:{id:u.id,fields:u.fields,relationTo:u.relationTo,value:u.value}}),{focus:a}=c,p=a.getNode();Yh(d),og(p)&&!p.__first&&p.remove()}}),!0),ng))},i=[o],e[0]=o,e[1]=l,e[2]=i):(l=e[1],i=e[2]),ig(l,i);let s;return e[3]!==n?(s=zh(da,{enabledCollectionSlugs:n.map(sg)}),e[3]=n,e[4]=s):s=e[4],s};function sg(t){let{slug:e}=t;return e}var cg=y({nodes:[Te],plugins:[{Component:ma,position:"normal"}],slashMenu:{groups:[Z([{Icon:Ir,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ue,{replace:!1})}}])]},toolbarFixed:{groups:[fe([{ChildComponent:Ir,isActive:({selection:t})=>{if(!ag(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return vr(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ue,{replace:!1})}}])]}});import{c as dg}from"react/compiler-runtime";import{jsx as Or}from"react/jsx-runtime";import{ShimmerEffect as mg,useConfig as pg}from"@payloadcms/ui";import{lazy as fg,Suspense as hg,useEffect as gg,useState as xg}from"react";var pa={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",hrSelected:"LexicalEditorTheme__hrSelected",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",tab:"LexicalEditorTheme__tabNode",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableAlignment:{center:"LexicalEditorTheme__tableAlignmentCenter",right:"LexicalEditorTheme__tableAlignmentRight"},tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableFrozenColumn:"LexicalEditorTheme__tableFrozenColumn",tableRowStriping:"LexicalEditorTheme__tableRowStriping",tableScrollableWrapper:"LexicalEditorTheme__tableScrollableWrapper",tableSelected:"LexicalEditorTheme__tableSelected",tableSelection:"LexicalEditorTheme__tableSelection",text:{bold:"LexicalEditorTheme__textBold",code:"LexicalEditorTheme__textCode",italic:"LexicalEditorTheme__textItalic",strikethrough:"LexicalEditorTheme__textStrikethrough",subscript:"LexicalEditorTheme__textSubscript",superscript:"LexicalEditorTheme__textSuperscript",underline:"LexicalEditorTheme__textUnderline",underlineStrikethrough:"LexicalEditorTheme__textUnderlineStrikethrough"},upload:"editor-upload"};var xo={namespace:"lexical",theme:pa};function fa({config:t,featureClientImportMap:e,featureClientSchemaMap:o,field:r,schemaPath:n,unSanitizedEditorConfig:l}){for(let c of l.features)if(!c?.clientFeatureProps?.featureKey||c?.clientFeatureProps?.order===void 0||c?.clientFeatureProps?.order===null)throw new Error("A Feature you have installed does not return the client props as clientFeatureProps. Please make sure to always return those props, even if they are null, as other important props like order and featureKey are later on injected.");l.features=l.features.sort((c,d)=>c.clientFeatureProps.order-d.clientFeatureProps.order);let i=new Map;for(let c of l.features)i.set(c.clientFeatureProps.featureKey,c);let s=new Map,u=0;for(let c of l.features){let d=typeof c.feature=="function"?c.feature({config:t,featureClientImportMap:e,featureClientSchemaMap:o,featureProviderMap:i,field:r,resolvedFeatures:s,schemaPath:n,unSanitizedEditorConfig:l}):c.feature;d.key=c.clientFeatureProps.featureKey,d.order=u,s.set(c.clientFeatureProps.featureKey,d),u++}return s}import{deepMerge as ug}from"payload/shared";var ha=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}},o={};if(t.forEach(r=>{r.key==="toolbarFixed"&&r.sanitizedClientFeatureProps?.customGroups&&(o={...o,...r.sanitizedClientFeatureProps.customGroups})}),!t?.size)return e;t.forEach(r=>{if(r.providers?.length&&(e.providers=e.providers.concat(r.providers)),r.enableFormats?.length&&e.enabledFormats.push(...r.enableFormats),r.nodes?.length)for(let n of r.nodes)e.nodes.push(n);if(r.plugins?.length&&r.plugins.forEach((n,l)=>{e.plugins?.push({clientProps:r.sanitizedClientFeatureProps,Component:n.Component,key:r.key+l,position:n.position})}),r.toolbarInline?.groups?.length)for(let n of r.toolbarInline.groups){let l=e.toolbarInline.groups.find(i=>i.key===n.key);l?e.toolbarInline.groups=e.toolbarInline.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.toolbarInline?.groups.push(l)}if(r.toolbarFixed?.groups?.length)for(let n of r.toolbarFixed.groups){let l=e.toolbarFixed.groups.find(i=>i.key===n.key);l?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.toolbarFixed?.groups.push(l)}if(r.slashMenu?.groups){r.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(r.slashMenu.dynamicGroups));for(let n of r.slashMenu.groups){let l=e.slashMenu.groups.find(i=>i.key===n.key);l?e.slashMenu.groups=e.slashMenu.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.slashMenu.groups.push(l)}}if(r.markdownTransformers?.length)for(let n of r.markdownTransformers)typeof n=="function"?e.markdownTransformers.push(n({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(n);e.enabledFeatures.push(r.key)}),Object.keys(o).length>0&&(e.toolbarFixed.groups=e.toolbarFixed.groups.map(r=>{let n=o[r.key];return n?ug(r,n):r})),e.toolbarInline.groups.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0),e.toolbarFixed.groups.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);for(let r of e.toolbarInline.groups)r.items.sort((n,l)=>n.order&&l.order?n.order-l.order:n.order?-1:l.order?1:0);for(let r of e.toolbarFixed.groups)r.items.sort((n,l)=>n.order&&l.order?n.order-l.order:n.order?-1:l.order?1:0);return e};function Ar(t,e,o){return{admin:o,features:ha(t),lexical:e,resolvedFeatureMap:t}}var Cg=fg(()=>import("./Field-PKJPWZJL.js").then(t=>({default:t.RichText}))),bg=t=>{let e=dg(16),{admin:o,clientFeatures:r,featureClientImportMap:n,featureClientSchemaMap:l,field:i,lexicalEditorConfig:s,schemaPath:u}=t,c;e[0]!==o?(c=o===void 0?{}:o,e[0]=o,e[1]=c):c=e[1];let d=c,a=s===void 0?xo:s,{config:p}=pg(),[m,f]=xg(null),h,g;e[2]!==d||e[3]!==r||e[4]!==p||e[5]!==n||e[6]!==l||e[7]!==i||e[8]!==m||e[9]!==a||e[10]!==u?(h=()=>{if(m)return;let T=[];for(let[_,x]of Object.entries(r))x.clientFeatureProvider&&T.push(x.clientFeatureProvider(x.clientFeatureProps));let I=a||xo,b=fa({config:p,featureClientImportMap:n,featureClientSchemaMap:l,field:i,schemaPath:u??i.name,unSanitizedEditorConfig:{features:T,lexical:I}});f(Ar(b,I,d))},g=[a,d,m,r,n,l,i,p,u],e[2]=d,e[3]=r,e[4]=p,e[5]=n,e[6]=l,e[7]=i,e[8]=m,e[9]=a,e[10]=u,e[11]=h,e[12]=g):(h=e[11],g=e[12]),gg(h,g);let k;return e[13]!==m||e[14]!==t?(k=Or(hg,{fallback:Or(mg,{height:"35vh"}),children:m&&Or(Cg,{...t,editorConfig:m})}),e[13]=m,e[14]=t,e[15]=k):k=e[15],k};function kg(t){return t instanceof HTMLElement}function _g(...t){return t.filter(Boolean).join(" ")}var Co=new WeakMap;function ga(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function bo(t,e){let o=Co.get(t);if(o===void 0){let r=new Set,n=i=>{o!==void 0&&(o.start=ga(i))},l=i=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let u=ga(i);for(let c of r)u!==null&&c([u[0]-s[0],u[1]-s[1]],i)};t.addEventListener("touchstart",n),t.addEventListener("touchend",l),o={handleTouchend:l,handleTouchstart:n,listeners:r,start:null},Co.set(t,o)}return o.listeners.add(e),()=>{Tg(t,e)}}function Tg(t,e){let o=Co.get(t);if(o===void 0)return;let{listeners:r}=o;r.delete(e),r.size===0&&(Co.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function wg(t,e){return bo(t,(o,r)=>{let[n,l]=o;n<0&&-n>Math.abs(l)&&e(n,r)})}function Eg(t,e){return bo(t,(o,r)=>{let[n,l]=o;n>0&&n>Math.abs(l)&&e(n,r)})}function Sg(t,e){return bo(t,(o,r)=>{let[n,l]=o;l<0&&-l>Math.abs(n)&&e(n,r)})}function Ng(t,e){return bo(t,(o,r)=>{let[n,l]=o;l>0&&l>Math.abs(n)&&e(n,r)})}import{c as Lg}from"react/compiler-runtime";import{jsx as yg}from"react/jsx-runtime";import"react";var Ig=()=>{let t=Lg(2),{EditButton:e}=me(),o;return t[0]!==e?(o=e?yg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Rg}from"react/compiler-runtime";import{jsx as vg}from"react/jsx-runtime";import"react";var Mg=()=>{let t=Rg(2),{RemoveButton:e}=me(),o;return t[0]!==e?(o=e?vg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Dg}from"react/compiler-runtime";import{jsx as Ag}from"react/jsx-runtime";import"react";var Og=()=>{let t=Dg(2),{Label:e}=me(),o;return t[0]!==e?(o=e?Ag(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Fg}from"react/compiler-runtime";import{jsx as $g}from"react/jsx-runtime";import"react";var Pg=t=>{let e=Fg(3),{children:o}=t,{InlineBlockContainer:r}=me(),n;return e[0]!==r||e[1]!==o?(n=r?$g(r,{children:o}):null,e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{c as Bg}from"react/compiler-runtime";import{jsx as Hg}from"react/jsx-runtime";import"react";var jg=t=>{let e=Bg(6),{children:o,editButton:r,Label:n,removeButton:l}=t,{BlockCollapsible:i}=Re(),s;return e[0]!==i||e[1]!==n||e[2]!==o||e[3]!==r||e[4]!==l?(s=i?Hg(i,{editButton:r,Label:n,removeButton:l,children:o}):null,e[0]=i,e[1]=n,e[2]=o,e[3]=r,e[4]=l,e[5]=s):s=e[5],s};import{c as Ug}from"react/compiler-runtime";import{jsx as Gg}from"react/jsx-runtime";import"react";var Wg=()=>{let t=Ug(2),{EditButton:e}=Re(),o;return t[0]!==e?(o=e?Gg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Vg}from"react/compiler-runtime";import{jsx as Kg}from"react/jsx-runtime";import"react";var Jg=()=>{let t=Vg(2),{RemoveButton:e}=Re(),o;return t[0]!==e?(o=e?Kg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as Xg}from"qs-esm";var zg=({apiURL:t,depth:e,draft:o,locale:r})=>async({id:l,collectionSlug:i,select:s})=>{let u=Xg({depth:e??0,draft:o??!1,locale:r,select:s},{addQueryPrefix:!0});return await fetch(`${t}/${i}/${l}${u}`,{credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json"},method:"GET"}).then(d=>d.json())};import{c as Zg}from"react/compiler-runtime";import{jsx as ot}from"react/jsx-runtime";import{FieldContext as Yg,FieldPathContext as xa,ServerFunctionsContext as Ca,ShimmerEffect as qg,useServerFunctions as Qg}from"@payloadcms/ui";import ex,{useEffect as tx,useRef as ox}from"react";var rx=t=>{let e=Zg(9),{field:o,initialValue:r,Loading:n,path:l,schemaPath:i,setValue:s,value:u}=t,[c,d]=ex.useState(null),a=Qg(),{_internal_renderField:p}=a,[m,f]=i.split("."),h=l??(o&&"name"in o?o?.name:"")??"",g;e[0]!==p||e[1]!==o||e[2]!==r||e[3]!==l||e[4]!==i?(g=()=>{(async function(){let{Field:O}=await p({field:{...o||{},type:"richText",admin:{hidden:!1}},initialValue:r??void 0,path:l,schemaPath:i});d(O)})()},e[0]=p,e[1]=o,e[2]=r,e[3]=l,e[4]=i,e[5]=g):g=e[5];let k=g,T=ox(!1),I,b;if(e[6]!==k?(I=()=>{T.current||(T.current=!0,k())},b=[k],e[6]=k,e[7]=I,e[8]=b):(I=e[7],b=e[8]),tx(I,b),!c)return typeof n<"u"?n:ot(qg,{});let _={...a,getFormState:async w=>a.getFormState({...w,collectionSlug:m==="collection"?f:void 0,globalSlug:m==="global"?f:void 0})};if(typeof u>"u"&&!s)return ot(Ca,{value:{..._},children:ot(xa,{value:h,children:c},h)});let x={disabled:!1,formInitializing:!1,formProcessing:!1,formSubmitted:!1,initialValue:u,path:h,setValue:s??nx,showError:!1,value:u};return ot(Ca,{value:{..._},children:ot(xa,{value:h,children:ot(Yg,{value:x,children:c})},h)})};function nx(){}function lx({nodes:t,text:e}){let o={root:{type:"root",children:[],direction:"ltr",format:"",indent:0,version:1}};return e&&o.root.children.push({type:"paragraph",children:[{type:"text",detail:0,format:0,mode:"normal",style:"",text:e,version:1}],direction:"ltr",format:"",indent:0,textFormat:0,textStyle:"",version:1}),t?.length&&o.root.children.push(...t),o}export{ft as $createAutoLinkNode,Vt as $createBlockNode,To as $createInlineBlockNode,he as $createLinkNode,Fe as $createRelationshipNode,Pe as $createUploadNode,xe as $isAutoLinkNode,ut as $isBlockNode,wo as $isInlineBlockNode,J as $isLinkNode,cr as $isRelationshipNode,vr as $isUploadNode,va as AlignFeatureClient,ge as AutoLinkNode,jg as BlockCollapsible,Wg as BlockEditButton,pe as BlockNode,Jg as BlockRemoveButton,Fa as BlockquoteFeatureClient,Dc as BlocksFeatureClient,ou as BoldFeatureClient,re as CAN_USE_DOM,lp as ChecklistFeatureClient,zp as DETAIL_TYPE_TO_DETAIL,Vp as DOUBLE_LINE_BREAK,sf as DebugJsxConverterFeatureClient,Yp as ELEMENT_FORMAT_TO_TYPE,Zp as ELEMENT_TYPE_TO_FORMAT,Ea as ENABLE_SLASH_MENU_COMMAND,ka as EditorConfigProvider,rt as FieldsDrawer,I0 as FixedToolbarFeatureClient,Yu as HeadingFeatureClient,hd as HorizontalRuleFeatureClient,Ge as INSERT_BLOCK_COMMAND,We as INSERT_INLINE_BLOCK_COMMAND,Gp as IS_ALL_FORMATTING,vd as IndentFeatureClient,Pg as InlineBlockContainer,Ig as InlineBlockEditButton,Og as InlineBlockLabel,_o as InlineBlockNode,Mg as InlineBlockRemoveButton,su as InlineCodeFeatureClient,H0 as InlineToolbarFeatureClient,du as ItalicFeatureClient,Jp as LTR_REGEX,Lp as LexicalPluginToLexicalFeatureClient,Wm as LinkFeatureClient,ee as LinkNode,Wp as NON_BREAKING_SPACE,A as NodeFormat,pp as OrderedListFeatureClient,Op as ParagraphFeatureClient,Ta as Point,Kp as RTL_REGEX,Sa as Rect,Jf as RelationshipFeatureClient,be as RelationshipNode,rx as RenderLexical,bg as RichTextField,Dp as SlateToLexicalFeatureClient,gu as StrikethroughFeatureClient,ku as SubscriptFeatureClient,Eu as SuperscriptFeatureClient,qp as TEXT_MODE_TO_TYPE,Xp as TEXT_TYPE_TO_FORMAT,Qp as TEXT_TYPE_TO_MODE,ae as TOGGLE_LINK_COMMAND,vh as TableFeatureClient,Jc as TestRecorderFeatureClient,Hu as TextStateFeatureClient,St as ToolbarButton,$e as ToolbarDropdown,qc as TreeViewFeatureClient,Iu as UnderlineFeatureClient,_p as UnorderedListFeatureClient,cg as UploadFeatureClient,Te as UploadNode,Ng as addSwipeDownListener,wg as addSwipeLeftListener,Eg as addSwipeRightListener,Sg as addSwipeUpListener,lx as buildEditorState,jo as createBlockNode,y as createClientFeature,af as defaultColors,xo as defaultEditorLexicalConfig,fr as getDOMRangeRect,Na as getEnabledNodes,zg as getRestPopulateFn,Ve as getSelectedNode,kg as isHTMLElement,wa as isPoint,_g as joinClasses,Ar as sanitizeClientEditorConfig,ha as sanitizeClientFeatures,io as setFloatingElemPosition,eo as setFloatingElemPositionForLinkEditor,Z as slashMenuBasicGroupWithItems,fe as toolbarAddDropdownGroupWithItems,Go as toolbarFeatureButtonsGroupWithItems,Y as toolbarFormatGroupWithItems,Q as toolbarTextDropdownGroupWithItems,Re as useBlockComponentContext,H as useEditorConfigContext,me as useInlineBlockComponentContext,_a as useLexicalDocumentDrawer,de as useLexicalDrawer,Et as useLexicalListDrawer};
41
41
  //# sourceMappingURL=index.js.map