@payloadcms/richtext-lexical 3.84.1 → 4.0.0-internal.d28e9fb

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 (331) hide show
  1. package/dist/exports/client/{Field-4UEGQMIN.js → Field-NXLXFFLW.js} +2 -2
  2. package/dist/exports/client/Field-NXLXFFLW.js.map +7 -0
  3. package/dist/exports/client/bundled.css +1 -1
  4. package/dist/exports/client/chunk-DZDHVMML.js +2 -0
  5. package/dist/exports/client/chunk-DZDHVMML.js.map +7 -0
  6. package/dist/exports/client/componentInline-LCHKRXOV.js +2 -0
  7. package/dist/exports/client/index.d.ts +0 -2
  8. package/dist/exports/client/index.d.ts.map +1 -1
  9. package/dist/exports/client/index.js +32 -32
  10. package/dist/exports/client/index.js.map +4 -4
  11. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  12. package/dist/features/blocks/client/component/index.js +17 -2
  13. package/dist/features/blocks/client/component/index.js.map +1 -1
  14. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  15. package/dist/features/blocks/client/componentInline/index.js +13 -3
  16. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  17. package/dist/field/Field.d.ts.map +1 -1
  18. package/dist/field/Field.js +1 -1
  19. package/dist/field/Field.js.map +1 -1
  20. package/dist/field/bundled.css +1 -1
  21. package/dist/index.d.ts +0 -1
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +11 -2
  24. package/dist/index.js.map +1 -1
  25. package/dist/lexical/config/server/loader.d.ts.map +1 -1
  26. package/dist/lexical/config/server/loader.js +12 -9
  27. package/dist/lexical/config/server/loader.js.map +1 -1
  28. package/dist/lexical/ui/icons/Add/index.d.ts +4 -1
  29. package/dist/lexical/ui/icons/Add/index.d.ts.map +1 -1
  30. package/dist/lexical/ui/icons/Add/index.js +19 -12
  31. package/dist/lexical/ui/icons/Add/index.js.map +1 -1
  32. package/dist/lexical/ui/icons/Add/index.svg +2 -3
  33. package/dist/lexical/ui/icons/Add/light.svg +2 -3
  34. package/dist/lexical/ui/icons/AlignCenter/index.d.ts +3 -1
  35. package/dist/lexical/ui/icons/AlignCenter/index.d.ts.map +1 -1
  36. package/dist/lexical/ui/icons/AlignCenter/index.js +15 -19
  37. package/dist/lexical/ui/icons/AlignCenter/index.js.map +1 -1
  38. package/dist/lexical/ui/icons/AlignJustify/index.d.ts +3 -1
  39. package/dist/lexical/ui/icons/AlignJustify/index.d.ts.map +1 -1
  40. package/dist/lexical/ui/icons/AlignJustify/index.js +15 -19
  41. package/dist/lexical/ui/icons/AlignJustify/index.js.map +1 -1
  42. package/dist/lexical/ui/icons/AlignLeft/index.d.ts +3 -1
  43. package/dist/lexical/ui/icons/AlignLeft/index.d.ts.map +1 -1
  44. package/dist/lexical/ui/icons/AlignLeft/index.js +15 -19
  45. package/dist/lexical/ui/icons/AlignLeft/index.js.map +1 -1
  46. package/dist/lexical/ui/icons/AlignRight/index.d.ts +3 -1
  47. package/dist/lexical/ui/icons/AlignRight/index.d.ts.map +1 -1
  48. package/dist/lexical/ui/icons/AlignRight/index.js +15 -19
  49. package/dist/lexical/ui/icons/AlignRight/index.js.map +1 -1
  50. package/dist/lexical/ui/icons/Block/index.d.ts +3 -1
  51. package/dist/lexical/ui/icons/Block/index.d.ts.map +1 -1
  52. package/dist/lexical/ui/icons/Block/index.js +13 -28
  53. package/dist/lexical/ui/icons/Block/index.js.map +1 -1
  54. package/dist/lexical/ui/icons/Blockquote/index.d.ts +3 -1
  55. package/dist/lexical/ui/icons/Blockquote/index.d.ts.map +1 -1
  56. package/dist/lexical/ui/icons/Blockquote/index.js +9 -6
  57. package/dist/lexical/ui/icons/Blockquote/index.js.map +1 -1
  58. package/dist/lexical/ui/icons/Bold/index.d.ts +3 -1
  59. package/dist/lexical/ui/icons/Bold/index.d.ts.map +1 -1
  60. package/dist/lexical/ui/icons/Bold/index.js +13 -8
  61. package/dist/lexical/ui/icons/Bold/index.js.map +1 -1
  62. package/dist/lexical/ui/icons/Checklist/index.d.ts +4 -1
  63. package/dist/lexical/ui/icons/Checklist/index.d.ts.map +1 -1
  64. package/dist/lexical/ui/icons/Checklist/index.js +17 -18
  65. package/dist/lexical/ui/icons/Checklist/index.js.map +1 -1
  66. package/dist/lexical/ui/icons/Code/index.d.ts +3 -1
  67. package/dist/lexical/ui/icons/Code/index.d.ts.map +1 -1
  68. package/dist/lexical/ui/icons/Code/index.js +15 -13
  69. package/dist/lexical/ui/icons/Code/index.js.map +1 -1
  70. package/dist/lexical/ui/icons/CodeBlock/index.d.ts +4 -1
  71. package/dist/lexical/ui/icons/CodeBlock/index.d.ts.map +1 -1
  72. package/dist/lexical/ui/icons/CodeBlock/index.js +18 -7
  73. package/dist/lexical/ui/icons/CodeBlock/index.js.map +1 -1
  74. package/dist/lexical/ui/icons/Collapse/index.d.ts +3 -1
  75. package/dist/lexical/ui/icons/Collapse/index.d.ts.map +1 -1
  76. package/dist/lexical/ui/icons/Collapse/index.js +10 -8
  77. package/dist/lexical/ui/icons/Collapse/index.js.map +1 -1
  78. package/dist/lexical/ui/icons/DraggableBlock/index.svg +7 -7
  79. package/dist/lexical/ui/icons/DraggableBlock/light.svg +7 -7
  80. package/dist/lexical/ui/icons/Expand/index.d.ts +5 -0
  81. package/dist/lexical/ui/icons/Expand/index.d.ts.map +1 -0
  82. package/dist/lexical/ui/icons/Expand/index.js +22 -0
  83. package/dist/lexical/ui/icons/Expand/index.js.map +1 -0
  84. package/dist/lexical/ui/icons/H1/index.d.ts +3 -1
  85. package/dist/lexical/ui/icons/H1/index.d.ts.map +1 -1
  86. package/dist/lexical/ui/icons/H1/index.js +9 -6
  87. package/dist/lexical/ui/icons/H1/index.js.map +1 -1
  88. package/dist/lexical/ui/icons/H2/index.d.ts +3 -1
  89. package/dist/lexical/ui/icons/H2/index.d.ts.map +1 -1
  90. package/dist/lexical/ui/icons/H2/index.js +9 -6
  91. package/dist/lexical/ui/icons/H2/index.js.map +1 -1
  92. package/dist/lexical/ui/icons/H3/index.d.ts +3 -1
  93. package/dist/lexical/ui/icons/H3/index.d.ts.map +1 -1
  94. package/dist/lexical/ui/icons/H3/index.js +9 -6
  95. package/dist/lexical/ui/icons/H3/index.js.map +1 -1
  96. package/dist/lexical/ui/icons/H4/index.d.ts +3 -1
  97. package/dist/lexical/ui/icons/H4/index.d.ts.map +1 -1
  98. package/dist/lexical/ui/icons/H4/index.js +9 -6
  99. package/dist/lexical/ui/icons/H4/index.js.map +1 -1
  100. package/dist/lexical/ui/icons/H5/index.d.ts +3 -1
  101. package/dist/lexical/ui/icons/H5/index.d.ts.map +1 -1
  102. package/dist/lexical/ui/icons/H5/index.js +9 -6
  103. package/dist/lexical/ui/icons/H5/index.js.map +1 -1
  104. package/dist/lexical/ui/icons/H6/index.d.ts +3 -1
  105. package/dist/lexical/ui/icons/H6/index.d.ts.map +1 -1
  106. package/dist/lexical/ui/icons/H6/index.js +9 -6
  107. package/dist/lexical/ui/icons/H6/index.js.map +1 -1
  108. package/dist/lexical/ui/icons/HorizontalRule/index.d.ts +3 -1
  109. package/dist/lexical/ui/icons/HorizontalRule/index.d.ts.map +1 -1
  110. package/dist/lexical/ui/icons/HorizontalRule/index.js +11 -11
  111. package/dist/lexical/ui/icons/HorizontalRule/index.js.map +1 -1
  112. package/dist/lexical/ui/icons/IndentDecrease/index.d.ts +3 -1
  113. package/dist/lexical/ui/icons/IndentDecrease/index.d.ts.map +1 -1
  114. package/dist/lexical/ui/icons/IndentDecrease/index.js +18 -22
  115. package/dist/lexical/ui/icons/IndentDecrease/index.js.map +1 -1
  116. package/dist/lexical/ui/icons/IndentIncrease/index.d.ts +3 -1
  117. package/dist/lexical/ui/icons/IndentIncrease/index.d.ts.map +1 -1
  118. package/dist/lexical/ui/icons/IndentIncrease/index.js +15 -22
  119. package/dist/lexical/ui/icons/IndentIncrease/index.js.map +1 -1
  120. package/dist/lexical/ui/icons/InlineBlocks/index.d.ts +3 -1
  121. package/dist/lexical/ui/icons/InlineBlocks/index.d.ts.map +1 -1
  122. package/dist/lexical/ui/icons/InlineBlocks/index.js +9 -6
  123. package/dist/lexical/ui/icons/InlineBlocks/index.js.map +1 -1
  124. package/dist/lexical/ui/icons/Italic/index.d.ts +3 -1
  125. package/dist/lexical/ui/icons/Italic/index.d.ts.map +1 -1
  126. package/dist/lexical/ui/icons/Italic/index.js +13 -8
  127. package/dist/lexical/ui/icons/Italic/index.js.map +1 -1
  128. package/dist/lexical/ui/icons/Link/index.d.ts +4 -1
  129. package/dist/lexical/ui/icons/Link/index.d.ts.map +1 -1
  130. package/dist/lexical/ui/icons/Link/index.js +14 -9
  131. package/dist/lexical/ui/icons/Link/index.js.map +1 -1
  132. package/dist/lexical/ui/icons/Meatballs/index.d.ts +4 -1
  133. package/dist/lexical/ui/icons/Meatballs/index.d.ts.map +1 -1
  134. package/dist/lexical/ui/icons/Meatballs/index.js +19 -15
  135. package/dist/lexical/ui/icons/Meatballs/index.js.map +1 -1
  136. package/dist/lexical/ui/icons/OrderedList/index.d.ts +4 -1
  137. package/dist/lexical/ui/icons/OrderedList/index.d.ts.map +1 -1
  138. package/dist/lexical/ui/icons/OrderedList/index.js +19 -25
  139. package/dist/lexical/ui/icons/OrderedList/index.js.map +1 -1
  140. package/dist/lexical/ui/icons/Relationship/index.d.ts +3 -1
  141. package/dist/lexical/ui/icons/Relationship/index.d.ts.map +1 -1
  142. package/dist/lexical/ui/icons/Relationship/index.js +13 -25
  143. package/dist/lexical/ui/icons/Relationship/index.js.map +1 -1
  144. package/dist/lexical/ui/icons/Strikethrough/index.d.ts +3 -1
  145. package/dist/lexical/ui/icons/Strikethrough/index.d.ts.map +1 -1
  146. package/dist/lexical/ui/icons/Strikethrough/index.js +13 -13
  147. package/dist/lexical/ui/icons/Strikethrough/index.js.map +1 -1
  148. package/dist/lexical/ui/icons/Subscript/index.d.ts +3 -1
  149. package/dist/lexical/ui/icons/Subscript/index.d.ts.map +1 -1
  150. package/dist/lexical/ui/icons/Subscript/index.js +10 -7
  151. package/dist/lexical/ui/icons/Subscript/index.js.map +1 -1
  152. package/dist/lexical/ui/icons/Superscript/index.d.ts +3 -1
  153. package/dist/lexical/ui/icons/Superscript/index.d.ts.map +1 -1
  154. package/dist/lexical/ui/icons/Superscript/index.js +10 -7
  155. package/dist/lexical/ui/icons/Superscript/index.js.map +1 -1
  156. package/dist/lexical/ui/icons/Table/index.d.ts +4 -1
  157. package/dist/lexical/ui/icons/Table/index.d.ts.map +1 -1
  158. package/dist/lexical/ui/icons/Table/index.js +20 -15
  159. package/dist/lexical/ui/icons/Table/index.js.map +1 -1
  160. package/dist/lexical/ui/icons/Text/index.d.ts +4 -1
  161. package/dist/lexical/ui/icons/Text/index.d.ts.map +1 -1
  162. package/dist/lexical/ui/icons/Text/index.js +17 -8
  163. package/dist/lexical/ui/icons/Text/index.js.map +1 -1
  164. package/dist/lexical/ui/icons/Underline/index.d.ts +3 -1
  165. package/dist/lexical/ui/icons/Underline/index.d.ts.map +1 -1
  166. package/dist/lexical/ui/icons/Underline/index.js +16 -14
  167. package/dist/lexical/ui/icons/Underline/index.js.map +1 -1
  168. package/dist/lexical/ui/icons/UnorderedList/index.d.ts +3 -1
  169. package/dist/lexical/ui/icons/UnorderedList/index.d.ts.map +1 -1
  170. package/dist/lexical/ui/icons/UnorderedList/index.js +13 -40
  171. package/dist/lexical/ui/icons/UnorderedList/index.js.map +1 -1
  172. package/dist/lexical/ui/icons/Upload/index.d.ts +3 -1
  173. package/dist/lexical/ui/icons/Upload/index.d.ts.map +1 -1
  174. package/dist/lexical/ui/icons/Upload/index.js +15 -22
  175. package/dist/lexical/ui/icons/Upload/index.js.map +1 -1
  176. package/dist/utilities/buildEditorState.d.ts.map +1 -1
  177. package/dist/utilities/buildEditorState.js +13 -0
  178. package/dist/utilities/buildEditorState.js.map +1 -1
  179. package/package.json +10 -15
  180. package/dist/exports/client/Component-DOSSWC76.js +0 -2
  181. package/dist/exports/client/Component-DOSSWC76.js.map +0 -7
  182. package/dist/exports/client/Component-MBLHTKDK.js +0 -2
  183. package/dist/exports/client/Component-MBLHTKDK.js.map +0 -7
  184. package/dist/exports/client/Field-4UEGQMIN.js.map +0 -7
  185. package/dist/exports/client/chunk-YWIZCGSY.js +0 -2
  186. package/dist/exports/client/chunk-YWIZCGSY.js.map +0 -7
  187. package/dist/exports/client/componentInline-CBBUBQ7P.js +0 -2
  188. package/dist/exports/server/migrate.d.ts +0 -16
  189. package/dist/exports/server/migrate.d.ts.map +0 -1
  190. package/dist/exports/server/migrate.js +0 -16
  191. package/dist/exports/server/migrate.js.map +0 -1
  192. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/heading/converter.d.ts +0 -3
  193. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/heading/converter.d.ts.map +0 -1
  194. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/heading/converter.js +0 -22
  195. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/heading/converter.js.map +0 -1
  196. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/link/converter.d.ts +0 -3
  197. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/link/converter.d.ts.map +0 -1
  198. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/link/converter.js +0 -33
  199. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/link/converter.js.map +0 -1
  200. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/list/converter.d.ts +0 -3
  201. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/list/converter.d.ts.map +0 -1
  202. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/list/converter.js +0 -24
  203. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/list/converter.js.map +0 -1
  204. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/listItem/converter.d.ts +0 -3
  205. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/listItem/converter.d.ts.map +0 -1
  206. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/listItem/converter.js +0 -25
  207. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/listItem/converter.js.map +0 -1
  208. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/quote/converter.d.ts +0 -3
  209. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/quote/converter.d.ts.map +0 -1
  210. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/quote/converter.js +0 -22
  211. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/quote/converter.js.map +0 -1
  212. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/unknown/converter.d.ts +0 -3
  213. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/unknown/converter.d.ts.map +0 -1
  214. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/unknown/converter.js +0 -28
  215. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/unknown/converter.js.map +0 -1
  216. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/upload/converter.d.ts +0 -3
  217. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/upload/converter.d.ts.map +0 -1
  218. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/upload/converter.js +0 -22
  219. package/dist/features/migrations/lexicalPluginToLexical/converter/converters/upload/converter.js.map +0 -1
  220. package/dist/features/migrations/lexicalPluginToLexical/converter/defaultConverters.d.ts +0 -3
  221. package/dist/features/migrations/lexicalPluginToLexical/converter/defaultConverters.d.ts.map +0 -1
  222. package/dist/features/migrations/lexicalPluginToLexical/converter/defaultConverters.js +0 -9
  223. package/dist/features/migrations/lexicalPluginToLexical/converter/defaultConverters.js.map +0 -1
  224. package/dist/features/migrations/lexicalPluginToLexical/converter/index.d.ts +0 -19
  225. package/dist/features/migrations/lexicalPluginToLexical/converter/index.d.ts.map +0 -1
  226. package/dist/features/migrations/lexicalPluginToLexical/converter/index.js +0 -78
  227. package/dist/features/migrations/lexicalPluginToLexical/converter/index.js.map +0 -1
  228. package/dist/features/migrations/lexicalPluginToLexical/converter/types.d.ts +0 -23
  229. package/dist/features/migrations/lexicalPluginToLexical/converter/types.d.ts.map +0 -1
  230. package/dist/features/migrations/lexicalPluginToLexical/converter/types.js +0 -2
  231. package/dist/features/migrations/lexicalPluginToLexical/converter/types.js.map +0 -1
  232. package/dist/features/migrations/lexicalPluginToLexical/feature.client.d.ts +0 -2
  233. package/dist/features/migrations/lexicalPluginToLexical/feature.client.d.ts.map +0 -1
  234. package/dist/features/migrations/lexicalPluginToLexical/feature.client.js +0 -10
  235. package/dist/features/migrations/lexicalPluginToLexical/feature.client.js.map +0 -1
  236. package/dist/features/migrations/lexicalPluginToLexical/feature.server.d.ts +0 -10
  237. package/dist/features/migrations/lexicalPluginToLexical/feature.server.d.ts.map +0 -1
  238. package/dist/features/migrations/lexicalPluginToLexical/feature.server.js +0 -49
  239. package/dist/features/migrations/lexicalPluginToLexical/feature.server.js.map +0 -1
  240. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.d.ts +0 -9
  241. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.d.ts.map +0 -1
  242. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.js +0 -15
  243. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/Component.js.map +0 -1
  244. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.d.ts +0 -33
  245. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.d.ts.map +0 -1
  246. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js +0 -74
  247. package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js.map +0 -1
  248. package/dist/features/migrations/slateToLexical/converter/converters/blockquote/converter.d.ts +0 -3
  249. package/dist/features/migrations/slateToLexical/converter/converters/blockquote/converter.d.ts.map +0 -1
  250. package/dist/features/migrations/slateToLexical/converter/converters/blockquote/converter.js +0 -23
  251. package/dist/features/migrations/slateToLexical/converter/converters/blockquote/converter.js.map +0 -1
  252. package/dist/features/migrations/slateToLexical/converter/converters/heading/converter.d.ts +0 -3
  253. package/dist/features/migrations/slateToLexical/converter/converters/heading/converter.d.ts.map +0 -1
  254. package/dist/features/migrations/slateToLexical/converter/converters/heading/converter.js +0 -24
  255. package/dist/features/migrations/slateToLexical/converter/converters/heading/converter.js.map +0 -1
  256. package/dist/features/migrations/slateToLexical/converter/converters/indent/converter.d.ts +0 -3
  257. package/dist/features/migrations/slateToLexical/converter/converters/indent/converter.d.ts.map +0 -1
  258. package/dist/features/migrations/slateToLexical/converter/converters/indent/converter.js +0 -33
  259. package/dist/features/migrations/slateToLexical/converter/converters/indent/converter.js.map +0 -1
  260. package/dist/features/migrations/slateToLexical/converter/converters/link/converter.d.ts +0 -3
  261. package/dist/features/migrations/slateToLexical/converter/converters/link/converter.d.ts.map +0 -1
  262. package/dist/features/migrations/slateToLexical/converter/converters/link/converter.js +0 -30
  263. package/dist/features/migrations/slateToLexical/converter/converters/link/converter.js.map +0 -1
  264. package/dist/features/migrations/slateToLexical/converter/converters/listItem/converter.d.ts +0 -3
  265. package/dist/features/migrations/slateToLexical/converter/converters/listItem/converter.d.ts.map +0 -1
  266. package/dist/features/migrations/slateToLexical/converter/converters/listItem/converter.js +0 -26
  267. package/dist/features/migrations/slateToLexical/converter/converters/listItem/converter.js.map +0 -1
  268. package/dist/features/migrations/slateToLexical/converter/converters/orderedList/converter.d.ts +0 -3
  269. package/dist/features/migrations/slateToLexical/converter/converters/orderedList/converter.d.ts.map +0 -1
  270. package/dist/features/migrations/slateToLexical/converter/converters/orderedList/converter.js +0 -26
  271. package/dist/features/migrations/slateToLexical/converter/converters/orderedList/converter.js.map +0 -1
  272. package/dist/features/migrations/slateToLexical/converter/converters/relationship/converter.d.ts +0 -3
  273. package/dist/features/migrations/slateToLexical/converter/converters/relationship/converter.d.ts.map +0 -1
  274. package/dist/features/migrations/slateToLexical/converter/converters/relationship/converter.js +0 -15
  275. package/dist/features/migrations/slateToLexical/converter/converters/relationship/converter.js.map +0 -1
  276. package/dist/features/migrations/slateToLexical/converter/converters/unknown/converter.d.ts +0 -3
  277. package/dist/features/migrations/slateToLexical/converter/converters/unknown/converter.d.ts.map +0 -1
  278. package/dist/features/migrations/slateToLexical/converter/converters/unknown/converter.js +0 -27
  279. package/dist/features/migrations/slateToLexical/converter/converters/unknown/converter.js.map +0 -1
  280. package/dist/features/migrations/slateToLexical/converter/converters/unorderedList/converter.d.ts +0 -3
  281. package/dist/features/migrations/slateToLexical/converter/converters/unorderedList/converter.d.ts.map +0 -1
  282. package/dist/features/migrations/slateToLexical/converter/converters/unorderedList/converter.js +0 -26
  283. package/dist/features/migrations/slateToLexical/converter/converters/unorderedList/converter.js.map +0 -1
  284. package/dist/features/migrations/slateToLexical/converter/converters/upload/converter.d.ts +0 -3
  285. package/dist/features/migrations/slateToLexical/converter/converters/upload/converter.d.ts.map +0 -1
  286. package/dist/features/migrations/slateToLexical/converter/converters/upload/converter.js +0 -18
  287. package/dist/features/migrations/slateToLexical/converter/converters/upload/converter.js.map +0 -1
  288. package/dist/features/migrations/slateToLexical/converter/defaultConverters.d.ts +0 -3
  289. package/dist/features/migrations/slateToLexical/converter/defaultConverters.d.ts.map +0 -1
  290. package/dist/features/migrations/slateToLexical/converter/defaultConverters.js +0 -12
  291. package/dist/features/migrations/slateToLexical/converter/defaultConverters.js.map +0 -1
  292. package/dist/features/migrations/slateToLexical/converter/index.d.ts +0 -19
  293. package/dist/features/migrations/slateToLexical/converter/index.d.ts.map +0 -1
  294. package/dist/features/migrations/slateToLexical/converter/index.js +0 -130
  295. package/dist/features/migrations/slateToLexical/converter/index.js.map +0 -1
  296. package/dist/features/migrations/slateToLexical/converter/types.d.ts +0 -16
  297. package/dist/features/migrations/slateToLexical/converter/types.d.ts.map +0 -1
  298. package/dist/features/migrations/slateToLexical/converter/types.js +0 -2
  299. package/dist/features/migrations/slateToLexical/converter/types.js.map +0 -1
  300. package/dist/features/migrations/slateToLexical/feature.client.d.ts +0 -2
  301. package/dist/features/migrations/slateToLexical/feature.client.d.ts.map +0 -1
  302. package/dist/features/migrations/slateToLexical/feature.client.js +0 -10
  303. package/dist/features/migrations/slateToLexical/feature.client.js.map +0 -1
  304. package/dist/features/migrations/slateToLexical/feature.server.d.ts +0 -40
  305. package/dist/features/migrations/slateToLexical/feature.server.d.ts.map +0 -1
  306. package/dist/features/migrations/slateToLexical/feature.server.js +0 -68
  307. package/dist/features/migrations/slateToLexical/feature.server.js.map +0 -1
  308. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.d.ts +0 -9
  309. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.d.ts.map +0 -1
  310. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.js +0 -15
  311. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/Component.js.map +0 -1
  312. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.d.ts +0 -33
  313. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.d.ts.map +0 -1
  314. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js +0 -74
  315. package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js.map +0 -1
  316. package/dist/lexical/ui/icons/AI/index.d.ts +0 -3
  317. package/dist/lexical/ui/icons/AI/index.d.ts.map +0 -1
  318. package/dist/lexical/ui/icons/AI/index.js +0 -34
  319. package/dist/lexical/ui/icons/AI/index.js.map +0 -1
  320. package/dist/lexical/ui/icons/Caret/index.svg +0 -3
  321. package/dist/lexical/ui/icons/Edit/index.svg +0 -10
  322. package/dist/lexical/ui/icons/Remove/index.svg +0 -4
  323. package/dist/utilities/migrateSlateToLexical/index.d.ts +0 -15
  324. package/dist/utilities/migrateSlateToLexical/index.d.ts.map +0 -1
  325. package/dist/utilities/migrateSlateToLexical/index.js +0 -152
  326. package/dist/utilities/migrateSlateToLexical/index.js.map +0 -1
  327. package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.d.ts +0 -10
  328. package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.d.ts.map +0 -1
  329. package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.js +0 -85
  330. package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.js.map +0 -1
  331. /package/dist/exports/client/{componentInline-CBBUBQ7P.js.map → componentInline-LCHKRXOV.js.map} +0 -0
@@ -1,36 +1,36 @@
1
- "use client";import{a as Ce,c as ht,d as gt,e as xt}from"./chunk-YWIZCGSY.js";import{a as Xe}from"./chunk-DBWINSQN.js";import{a as Ct,b as ze}from"./chunk-QJ5EETIB.js";import{a as xe}from"./chunk-INBEEENE.js";import{a as Nc}from"./chunk-F26IQ5RE.js";import{b as Xt,c as zt,d as le,e as hn,f as Uo,g as Wo,h as Lc,i as yc,k as Rc,m as Ic,p as vc}from"./chunk-FTT5KJ6W.js";import{a as Ec,b as U}from"./chunk-BZZVLW4U.js";function X(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{c as Ac}from"react/compiler-runtime";import{useLexicalComposerContext as Fc}from"@lexical/react/LexicalComposerContext";import{$isDecoratorBlockNode as be}from"@lexical/react/LexicalDecoratorBlockNode";import{$findMatchingParent as Pc}from"@lexical/utils";import{$getSelection as Bc,$isElementNode as ue,$isNodeSelection as jc,$isRangeSelection as bt,COMMAND_PRIORITY_LOW as Hc,FORMAT_ELEMENT_COMMAND as kt}from"lexical";import{useEffect as Uc}from"react";import{jsx as Go,jsxs as Mc}from"react/jsx-runtime";import"react";var gn=()=>Mc("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:[Go("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Go("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Go("path",{d:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Vo,jsxs as Dc}from"react/jsx-runtime";import"react";var xn=()=>Dc("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Vo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Vo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Vo("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Jo,jsxs as $c}from"react/jsx-runtime";import"react";var Zt=()=>$c("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Jo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Jo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Jo("path",{d:"M2.5 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Ko,jsxs as Oc}from"react/jsx-runtime";import"react";var Cn=()=>Oc("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Ko("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ko("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ko("path",{d:"M7.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});var M=t=>o=>{let r={clientFeatureProps:o};if(typeof t=="function")r.feature=({config:n,featureClientImportMap:l,featureClientSchemaMap:s,featureProviderMap:i,field:d,resolvedFeatures:c,schemaPath:u,unSanitizedEditorConfig:a})=>{let m=t({config:n,featureClientImportMap:l,featureClientSchemaMap:s,featureProviderMap:i,field:d,props:o,resolvedFeatures:c,schemaPath:u,unSanitizedEditorConfig:a});return m.sanitizedClientFeatureProps===null&&(m.sanitizedClientFeatureProps=o),m};else{let n={...t};n.sanitizedClientFeatureProps=o,r.feature=n}return r};var bn=t=>({type:"dropdown",ChildComponent:Zt,items:t,key:"align",order:30});var ve=t=>ue(t)?t.getFormatType():t.__format,kn=[bn([{ChildComponent:Zt,isActive:({selection:t})=>{if(!bt(t))return!1;for(let e of t.getNodes()){if((ue(e)||be(e))&&ve(e)==="left")continue;let o=e.getParent();if(!((ue(o)||be(o))&&ve(o)==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(kt,"left")},order:1},{ChildComponent:gn,isActive:({selection:t})=>{if(!bt(t))return!1;for(let e of t.getNodes()){if((ue(e)||be(e))&&ve(e)==="center")continue;let o=e.getParent();if(!((ue(o)||be(o))&&ve(o)==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(kt,"center")},order:2},{ChildComponent:Cn,isActive:({selection:t})=>{if(!bt(t))return!1;for(let e of t.getNodes()){if((ue(e)||be(e))&&ve(e)==="right")continue;let o=e.getParent();if(!((ue(o)||be(o))&&ve(o)==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(kt,"right")},order:3},{ChildComponent:xn,isActive:({selection:t})=>{if(!bt(t))return!1;for(let e of t.getNodes()){if((ue(e)||be(e))&&ve(e)==="justify")continue;let o=e.getParent();if(!((ue(o)||be(o))&&ve(o)==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(kt,"justify")},order:4}])],Wc=()=>{let t=Ac(3),[e]=Fc(),o,r;return t[0]!==e?(o=()=>e.registerCommand(kt,Jc,Hc),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Uc(o,r),null},Gc=M({plugins:[{Component:Wc,position:"normal"}],toolbarFixed:{groups:kn},toolbarInline:{groups:kn}});function Vc(t){return(ue(t)||be(t))&&!t.isInline()}function Jc(t){let e=Bc();if(!bt(e)&&!jc(e))return!1;let o=e.getNodes();for(let r of o){let n=Pc(r,Vc);n!==null&&n.setFormat(t)}return!0}import{$createQuoteNode as Ln,$isQuoteNode as En,QuoteNode as zc}from"@lexical/rich-text";import{$setBlocksType as yn}from"@lexical/selection";import{$getSelection as Rn,$isRangeSelection as Zc}from"lexical";import{jsx as _n}from"react/jsx-runtime";import"react";var Xo=()=>_n("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:_n("path",{d:"M13.5353 10.5725C13.5353 9.47709 11.0456 9.99991 11.0456 7.85883C11.0456 6.46464 12.1162 5.61816 13.361 5.61816C14.805 5.61816 16 6.86298 16 8.92937C16 11.2945 14.4564 13.7841 11.1203 14.3816L10.8216 13.1368C12.888 12.4895 13.5353 11.4937 13.5353 10.5725ZM6.71369 10.5725C6.71369 9.47709 4.22407 9.99991 4.22407 7.85883C4.22407 6.46464 5.29461 5.61816 6.53942 5.61816C7.9834 5.61816 9.17842 6.86298 9.17842 8.92937C9.17842 11.2945 7.63485 13.7841 4.29876 14.3816L4 13.1368C6.06639 12.4895 6.71369 11.4937 6.71369 10.5725Z",fill:"currentColor"})});import{jsx as Tn}from"react/jsx-runtime";import"react";var _t=()=>Tn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Tn("path",{d:"M11.708 14.5H7.79785V13.9414H8.01367C9.00391 13.9414 9.15625 13.9033 9.15625 13.6113V6.70508H8.07715C6.82031 6.70508 6.73145 7.08594 6.28711 8.67285H5.80469L5.91895 6.12109H13.5869L13.7012 8.67285H13.2188C12.7744 7.08594 12.6855 6.70508 11.4287 6.70508H10.3496V13.6113C10.3496 13.9033 10.502 13.9414 11.4922 13.9414H11.708V14.5Z",fill:"currentColor"})});var ee=t=>({type:"dropdown",ChildComponent:_t,items:t,key:"text",order:25});import{$createQuoteNode as Kc,$isQuoteNode as wn,QuoteNode as Xc}from"@lexical/rich-text";var Sn={type:"element",dependencies:[Xc],export:(t,e)=>{if(!wn(t))return null;let o=e(t).split(`
2
- `),r=[];for(let n of o)r.push("> "+n);return r.join(`
3
- `)},regExp:/^>\s/,replace:(t,e,o,r)=>{if(r){let l=t.getPreviousSibling();if(wn(l)){l.splice(l.getChildrenSize(),0,[...e]),l.select(0,0),t.remove();return}}let n=Kc();n.append(...e),t.replace(n),n.select(0,0)}};var Nn=[ee([{ChildComponent:Xo,isActive:({selection:t})=>{if(!Zc(t))return!1;for(let e of t.getNodes())if(!En(e)&&!En(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Rn();yn(e,()=>Ln())})},order:20}])],Yc=M({markdownTransformers:[Sn],nodes:[zc],slashMenu:{groups:[X([{Icon:Xo,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Rn();yn(e,()=>Ln())})}}])]},toolbarFixed:{groups:Nn},toolbarInline:{groups:Nn}});import{getTranslation as io}from"@payloadcms/translations";import{jsx as zo,jsxs as qc}from"react/jsx-runtime";import"react";var Yt=()=>qc("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[zo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),zo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),zo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as In}from"react/jsx-runtime";import"react";var qt=()=>In("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:In("path",{clipRule:"evenodd",d:"M5.33333 6.5C5.11232 6.5 4.90036 6.5878 4.74408 6.74408C4.5878 6.90036 4.5 7.11232 4.5 7.33333V12.1667C4.5 12.3877 4.5878 12.5996 4.74408 12.7559C4.90036 12.9122 5.11232 13 5.33333 13H14.6667C14.8877 13 15.0996 12.9122 15.2559 12.7559C15.4122 12.5996 15.5 12.3877 15.5 12.1667V11.6667C15.5 11.3905 15.7239 11.1667 16 11.1667C16.2761 11.1667 16.5 11.3905 16.5 11.6667V12.1667C16.5 12.6529 16.3068 13.1192 15.963 13.463C15.6192 13.8068 15.1529 14 14.6667 14H5.33333C4.8471 14 4.38079 13.8068 4.03697 13.463C3.69315 13.1192 3.5 12.6529 3.5 12.1667V7.33333C3.5 6.8471 3.69315 6.38079 4.03697 6.03697C4.38079 5.69315 4.8471 5.5 5.33333 5.5H10.3333C10.6095 5.5 10.8333 5.72386 10.8333 6C10.8333 6.27614 10.6095 6.5 10.3333 6.5H5.33333ZM13 6.5C12.7239 6.5 12.5 6.27614 12.5 6C12.5 5.72386 12.7239 5.5 13 5.5H16C16.2761 5.5 16.5 5.72386 16.5 6V9C16.5 9.27614 16.2761 9.5 16 9.5C15.7239 9.5 15.5 9.27614 15.5 9V7.20711L13.3536 9.35355C13.1583 9.54882 12.8417 9.54882 12.6464 9.35355C12.4512 9.15829 12.4512 8.84171 12.6464 8.64645L14.7929 6.5H13ZM6.16699 8.33325C6.16699 8.05711 6.39085 7.83325 6.66699 7.83325H11.0003C11.2765 7.83325 11.5003 8.05711 11.5003 8.33325C11.5003 8.60939 11.2765 8.83325 11.0003 8.83325H6.66699C6.39085 8.83325 6.16699 8.60939 6.16699 8.33325ZM6.16699 10.9999C6.16699 10.7238 6.39085 10.4999 6.66699 10.4999H13.3337C13.6098 10.4999 13.8337 10.7238 13.8337 10.9999C13.8337 11.2761 13.6098 11.4999 13.3337 11.4999H6.66699C6.39085 11.4999 6.16699 11.2761 6.16699 10.9999Z",fill:"currentColor",fillRule:"evenodd"})});import{jsx as Qc}from"react/jsx-runtime";import"react";function Qt(t,e){let{admin:o,imageAltText:r,imageURL:n}=t,l=o?.images,s,i;if(l?.icon?(s=typeof l.icon=="string"?l.icon:l.icon.url,i=typeof l.icon=="string"?void 0:l.icon.alt):l?.thumbnail?(s=typeof l.thumbnail=="string"?l.thumbnail:l.thumbnail.url,i=typeof l.thumbnail=="string"?void 0:l.thumbnail.alt):(s=n,i=r),!s)return e;let d=i??"Block Image";return()=>Qc("img",{alt:d,className:"lexical-block-custom-image",src:s,style:{maxHeight:20,maxWidth:20}})}import{$parseSerializedNode as Hn}from"lexical";import{JSOX as Zo}from"jsox";function eo({propsString:t}){let e={},o="",r=!0;for(let n=0;n<t.length;n++){let l=t[n];if(r)l==="="||l===" "?o&&(l===" "?(e[o]=!0,o=""):r=!1):o+=l;else{let s=eu(t,n);e[o]=s.value,n=s.newIndex,o="",r=!0}}return o&&(e[o]=!0),e}function eu(t,e){let o=t[e];return o==='"'?vn(t,e):o==="'"?vn(t,e,!0):o==="{"?ou(t,e):o==="["?tu(t,e):nu(t,e)}function tu(t,e){let o=1,r="",n=e+1;for(;n<t.length&&o>0;)t[n]==="["?o++:t[n]==="]"&&o--,o>0&&(r+=t[n]),n++;return{newIndex:n,value:Zo.parse(`[${r}]`)}}function vn(t,e,o=!1){let r="",n=e+1;for(;n<t.length&&(t[n]!==(o?"'":'"')||t[n-1]==="\\");)r+=t[n],n++;return{newIndex:n,value:r}}function ou(t,e){let o=1,r="",n=e+1;for(;n<t.length&&o>0;)t[n]==="{"?o++:t[n]==="}"&&o--,o>0&&(r+=t[n]),n++;return{newIndex:n,value:ru(r)}}function ru(t){return t[0]!=="{"?Zo.parse(t):Zo.parse(t.replace(/(\w+):/g,'"$1":'))}function nu(t,e){let o="",r=e;for(;r<t.length&&t[r]!==" ";)o+=t[r],r++;return{newIndex:r-1,value:o}}function Tt({props:t}){let e=[];for(let[o,r]of Object.entries(t))typeof r=="string"?e.push(`${o}="${lu(r)}"`):typeof r=="number"?e.push(`${o}={${r}}`):typeof r=="boolean"?r&&e.push(`${o}`):r!==null&&typeof r=="object"&&(Array.isArray(r)?e.push(`${o}={[${r.map(n=>JSON.stringify(n,Mn)).join(", ")}]}`):e.push(`${o}={${JSON.stringify(r,Mn)}}`));return e.join(" ")}function lu(t){return t.replace(/"/g,"&quot;")}function Mn(t,e){return typeof e=="string"?e.replace(/'/g,"\\'"):e}function to({isEndOptional:t,lines:e,regexpEndRegex:o,startLineIndex:r,startMatch:n,trimChildren:l}){let s="",i="",d=e.slice(r),c=!1,u=0,a=0,m=null,p=!1,h=0,f=d[0].slice(0,n.index),g=0,k=r;e:for(let[R,T]of d.entries()){let C=l?T.trim():T,x=0;if(l)for(let _=0;_<T.length&&T[_]===" ";_++)x++;let b=0;for(R===0&&(b=(n.index??0)+n[0].length-x);b<C.length;){let _=C[b],D=C[b+1];if(c){if(_==="`"&&h++,h%2===0)if(_==="<"&&D==="/"){if(u--,u<0){i[i.length-1]===`
4
- `&&(i=i.slice(0,-1)),k=R;for(let I=b;I<C.length;I++)if(C[I]===">"){g=I+1;break}break e}}else if(_==="/"&&D===">"){if(u--,u<0){i[i.length-1]===`
5
- `&&(i=i.slice(0,-1)),k=R,g=b+2;break e}}else _==="<"&&D!=="/"&&u++;i+=_}else{if(_==="{"&&!m?a++:_==="}"&&!m?a--:(_==='"'||_==="'")&&!m?m=_:_===m&&(m=null),_==="/"&&D===">"&&a===0&&!m){p=!0,k=R,g=b+2;break e}else if(_===">"&&a===0&&!m){c=!0,b++;continue}s+=_}b++}if(c?i?.length>0&&R>0&&(i+=`
1
+ "use client";import{a as Ce,c as pt,d as ht,e as gt}from"./chunk-DZDHVMML.js";import{a as Je}from"./chunk-DBWINSQN.js";import{a as xt,b as Xe}from"./chunk-QJ5EETIB.js";import{a as xe}from"./chunk-INBEEENE.js";import{a as wc}from"./chunk-F26IQ5RE.js";import{b as Gt,c as Vt,d as le,e as nr,f as Do,g as Oo,h as Sc,i as Ec,k as Nc,m as Lc,p as yc}from"./chunk-FTT5KJ6W.js";import{a as Tc,b as U}from"./chunk-BZZVLW4U.js";function J(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{c as $c}from"react/compiler-runtime";import{useLexicalComposerContext as Ac}from"@lexical/react/LexicalComposerContext";import{$isDecoratorBlockNode as be}from"@lexical/react/LexicalDecoratorBlockNode";import{$findMatchingParent as Dc}from"@lexical/utils";import{$getSelection as Oc,$isElementNode as ue,$isNodeSelection as Fc,$isRangeSelection as Ct,COMMAND_PRIORITY_LOW as Bc,FORMAT_ELEMENT_COMMAND as bt}from"lexical";import{useEffect as Pc}from"react";import{jsx as rr}from"react/jsx-runtime";import"react";var Rc="M5 7.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m3 4a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5M7.5 15a.5.5 0 0 0 0 1h9a.5.5 0 0 0 0-1z",lr=({className:t})=>rr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:rr("path",{clipRule:"evenodd",d:Rc,fill:"currentColor",fillRule:"evenodd"})});import{jsx as ir}from"react/jsx-runtime";import"react";var vc="M5 7.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m0 4a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m.5 3.5a.5.5 0 0 0 0 1h13a.5.5 0 0 0 0-1z",sr=({className:t})=>ir("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:ir("path",{clipRule:"evenodd",d:vc,fill:"currentColor",fillRule:"evenodd"})});import{jsx as ar}from"react/jsx-runtime";import"react";var Ic="M5 7.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m0 4a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5m.5 3.5a.5.5 0 0 0 0 1h9a.5.5 0 0 0 0-1z",Wt=({className:t})=>ar("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:ar("path",{clipRule:"evenodd",d:Ic,fill:"currentColor",fillRule:"evenodd"})});import{jsx as cr}from"react/jsx-runtime";import"react";var Mc="M19 7.5a.5.5 0 0 0-.5-.5h-13a.5.5 0 0 0 0 1h13a.5.5 0 0 0 .5-.5m0 4a.5.5 0 0 0-.5-.5h-7a.5.5 0 0 0 0 1h7a.5.5 0 0 0 .5-.5m-.5 3.5a.5.5 0 0 1 0 1h-9a.5.5 0 0 1 0-1z",ur=({className:t})=>cr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:cr("path",{clipRule:"evenodd",d:Mc,fill:"currentColor",fillRule:"evenodd"})});var $=t=>o=>{let n={clientFeatureProps:o};if(typeof t=="function")n.feature=({config:r,featureClientImportMap:l,featureClientSchemaMap:s,featureProviderMap:i,field:d,resolvedFeatures:c,schemaPath:u,unSanitizedEditorConfig:a})=>{let m=t({config:r,featureClientImportMap:l,featureClientSchemaMap:s,featureProviderMap:i,field:d,props:o,resolvedFeatures:c,schemaPath:u,unSanitizedEditorConfig:a});return m.sanitizedClientFeatureProps===null&&(m.sanitizedClientFeatureProps=o),m};else{let r={...t};r.sanitizedClientFeatureProps=o,n.feature=r}return n};var dr=t=>({type:"dropdown",ChildComponent:Wt,items:t,key:"align",order:30});var Ie=t=>ue(t)?t.getFormatType():t.__format,mr=[dr([{ChildComponent:Wt,isActive:({selection:t})=>{if(!Ct(t))return!1;for(let e of t.getNodes()){if((ue(e)||be(e))&&Ie(e)==="left")continue;let o=e.getParent();if(!((ue(o)||be(o))&&Ie(o)==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(bt,"left")},order:1},{ChildComponent:lr,isActive:({selection:t})=>{if(!Ct(t))return!1;for(let e of t.getNodes()){if((ue(e)||be(e))&&Ie(e)==="center")continue;let o=e.getParent();if(!((ue(o)||be(o))&&Ie(o)==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(bt,"center")},order:2},{ChildComponent:ur,isActive:({selection:t})=>{if(!Ct(t))return!1;for(let e of t.getNodes()){if((ue(e)||be(e))&&Ie(e)==="right")continue;let o=e.getParent();if(!((ue(o)||be(o))&&Ie(o)==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(bt,"right")},order:3},{ChildComponent:sr,isActive:({selection:t})=>{if(!Ct(t))return!1;for(let e of t.getNodes()){if((ue(e)||be(e))&&Ie(e)==="justify")continue;let o=e.getParent();if(!((ue(o)||be(o))&&Ie(o)==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(bt,"justify")},order:4}])],jc=()=>{let t=$c(3),[e]=Ac(),o,n;return t[0]!==e?(o=()=>e.registerCommand(bt,Gc,Bc),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),Pc(o,n),null},Hc=$({plugins:[{Component:jc,position:"normal"}],toolbarFixed:{groups:mr},toolbarInline:{groups:mr}});function Uc(t){return(ue(t)||be(t))&&!t.isInline()}function Gc(t){let e=Oc();if(!Ct(e)&&!Fc(e))return!1;let o=e.getNodes();for(let n of o){let r=Dc(n,Uc);r!==null&&r.setFormat(t)}return!0}import{$createQuoteNode as br,$isQuoteNode as xr,QuoteNode as Jc}from"@lexical/rich-text";import{$setBlocksType as kr}from"@lexical/selection";import{$getSelection as _r,$isRangeSelection as Xc}from"lexical";import{jsx as fr}from"react/jsx-runtime";import"react";var Vc="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",Fo=({className:t})=>fr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:fr("path",{d:Vc,fill:"currentColor"})});import{jsx as pr}from"react/jsx-runtime";import"react";var Wc={16:"M3 3.5a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 .5.5V5a.5.5 0 0 1-1 0V4H8.5v8h1a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1h1V4H4v1a.5.5 0 0 1-1 0z",24:"M6 6.5a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 .5.5V9a.5.5 0 0 1-1 0V7h-4.5v10h2a.5.5 0 0 1 0 1h-5a.5.5 0 0 1 0-1h2V7H7v2a.5.5 0 0 1-1 0z"},kt=({className:t,size:e=24})=>pr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:pr("path",{clipRule:"evenodd",d:Wc[e],fill:"currentColor",fillRule:"evenodd"})});var ee=t=>({type:"dropdown",ChildComponent:kt,items:t,key:"text",order:25});import{$createQuoteNode as zc,$isQuoteNode as hr,QuoteNode as Kc}from"@lexical/rich-text";var gr={type:"element",dependencies:[Kc],export:(t,e)=>{if(!hr(t))return null;let o=e(t).split(`
2
+ `),n=[];for(let r of o)n.push("> "+r);return n.join(`
3
+ `)},regExp:/^>\s/,replace:(t,e,o,n)=>{if(n){let l=t.getPreviousSibling();if(hr(l)){l.splice(l.getChildrenSize(),0,[...e]),l.select(0,0),t.remove();return}}let r=zc();r.append(...e),t.replace(r),r.select(0,0)}};var Cr=[ee([{ChildComponent:Fo,isActive:({selection:t})=>{if(!Xc(t))return!1;for(let e of t.getNodes())if(!xr(e)&&!xr(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=_r();kr(e,()=>br())})},order:20}])],Zc=$({markdownTransformers:[gr],nodes:[Jc],slashMenu:{groups:[J([{Icon:Fo,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=_r();kr(e,()=>br())})}}])]},toolbarFixed:{groups:Cr},toolbarInline:{groups:Cr}});import{getTranslation as to}from"@payloadcms/translations";import{jsx as Tr}from"react/jsx-runtime";import"react";var Yc="M10.5 7C11.3284 7 12 7.67157 12 8.5V11.5C12 11.7329 11.9453 11.9527 11.8506 12.1494C12.0473 12.0547 12.2671 12 12.5 12H15.5C16.3284 12 17 12.6716 17 13.5V16.5C17 17.3284 16.3284 18 15.5 18H12.5C12.1151 18 11.7655 17.8535 11.5 17.6152C11.2345 17.8535 10.8849 18 10.5 18H7.5C6.67157 18 6 17.3284 6 16.5V13.5C6 13.1154 6.14578 12.7655 6.38379 12.5C6.14578 12.2345 6 11.8846 6 11.5V8.5C6 7.67157 6.67157 7 7.5 7H10.5ZM12.5 13C12.2239 13 12 13.2239 12 13.5V16.5C12 16.7761 12.2239 17 12.5 17H15.5C15.7761 17 16 16.7761 16 16.5V13.5C16 13.2239 15.7761 13 15.5 13H12.5ZM7.5 13C7.22386 13 7 13.2239 7 13.5V16.5C7 16.7761 7.22386 17 7.5 17H10.5C10.7761 17 11 16.7761 11 16.5V13.5C11 13.2239 10.7761 13 10.5 13H7.5ZM7.5 8C7.22386 8 7 8.22386 7 8.5V11.5C7 11.7761 7.22386 12 7.5 12H10.5C10.7761 12 11 11.7761 11 11.5V8.5C11 8.22386 10.7761 8 10.5 8H7.5ZM17.5 5C18.3284 5 19 5.67157 19 6.5V9.5C19 10.3284 18.3284 11 17.5 11H14.5C13.6716 11 13 10.3284 13 9.5V6.5C13 5.67157 13.6716 5 14.5 5H17.5ZM14.5 6C14.2239 6 14 6.22386 14 6.5V9.5C14 9.77614 14.2239 10 14.5 10H17.5C17.7761 10 18 9.77614 18 9.5V6.5C18 6.22386 17.7761 6 17.5 6H14.5Z",zt=({className:t})=>Tr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Tr("path",{d:Yc,fill:"currentColor"})});import{jsx as wr}from"react/jsx-runtime";import"react";var qc="M17 8C18.1046 8 19 8.89543 19 10V14L18.9893 14.2041C18.8938 15.1457 18.1457 15.8938 17.2041 15.9893L17 16H7L6.7959 15.9893C5.78722 15.887 5 15.0357 5 14V10C5 8.89543 5.89543 8 7 8H17ZM7 9C6.44772 9 6 9.44772 6 10V14C6 14.5523 6.44772 15 7 15H17C17.5523 15 18 14.5523 18 14V10C18 9.44772 17.5523 9 17 9H7ZM9 11C9.55228 11 10 11.4477 10 12C10 12.5523 9.55228 13 9 13C8.44772 13 8 12.5523 8 12C8 11.4477 8.44772 11 9 11ZM12 11C12.5523 11 13 11.4477 13 12C13 12.5523 12.5523 13 12 13C11.4477 13 11 12.5523 11 12C11 11.4477 11.4477 11 12 11ZM15 11C15.5523 11 16 11.4477 16 12C16 12.5523 15.5523 13 15 13C14.4477 13 14 12.5523 14 12C14 11.4477 14.4477 11 15 11Z",Kt=({className:t})=>wr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:wr("path",{clipRule:"evenodd",d:qc,fill:"currentColor",fillRule:"evenodd"})});import{jsx as Qc}from"react/jsx-runtime";import"react";function Jt(t,e){let{admin:o,imageAltText:n,imageURL:r}=t,l=o?.images,s,i;if(l?.icon?(s=typeof l.icon=="string"?l.icon:l.icon.url,i=typeof l.icon=="string"?void 0:l.icon.alt):l?.thumbnail?(s=typeof l.thumbnail=="string"?l.thumbnail:l.thumbnail.url,i=typeof l.thumbnail=="string"?void 0:l.thumbnail.alt):(s=r,i=n),!s)return e;let d=i??"Block Image";return()=>Qc("img",{alt:d,className:"lexical-block-custom-image",src:s,style:{maxHeight:20,maxWidth:20}})}import{$parseSerializedNode as Ar}from"lexical";import{JSOX as Bo}from"jsox";function Xt({propsString:t}){let e={},o="",n=!0;for(let r=0;r<t.length;r++){let l=t[r];if(n)l==="="||l===" "?o&&(l===" "?(e[o]=!0,o=""):n=!1):o+=l;else{let s=eu(t,r);e[o]=s.value,r=s.newIndex,o="",n=!0}}return o&&(e[o]=!0),e}function eu(t,e){let o=t[e];return o==='"'?Sr(t,e):o==="'"?Sr(t,e,!0):o==="{"?ou(t,e):o==="["?tu(t,e):ru(t,e)}function tu(t,e){let o=1,n="",r=e+1;for(;r<t.length&&o>0;)t[r]==="["?o++:t[r]==="]"&&o--,o>0&&(n+=t[r]),r++;return{newIndex:r,value:Bo.parse(`[${n}]`)}}function Sr(t,e,o=!1){let n="",r=e+1;for(;r<t.length&&(t[r]!==(o?"'":'"')||t[r-1]==="\\");)n+=t[r],r++;return{newIndex:r,value:n}}function ou(t,e){let o=1,n="",r=e+1;for(;r<t.length&&o>0;)t[r]==="{"?o++:t[r]==="}"&&o--,o>0&&(n+=t[r]),r++;return{newIndex:r,value:nu(n)}}function nu(t){return t[0]!=="{"?Bo.parse(t):Bo.parse(t.replace(/(\w+):/g,'"$1":'))}function ru(t,e){let o="",n=e;for(;n<t.length&&t[n]!==" ";)o+=t[n],n++;return{newIndex:n-1,value:o}}function _t({props:t}){let e=[];for(let[o,n]of Object.entries(t))typeof n=="string"?e.push(`${o}="${lu(n)}"`):typeof n=="number"?e.push(`${o}={${n}}`):typeof n=="boolean"?n&&e.push(`${o}`):n!==null&&typeof n=="object"&&(Array.isArray(n)?e.push(`${o}={[${n.map(r=>JSON.stringify(r,Er)).join(", ")}]}`):e.push(`${o}={${JSON.stringify(n,Er)}}`));return e.join(" ")}function lu(t){return t.replace(/"/g,"&quot;")}function Er(t,e){return typeof e=="string"?e.replace(/'/g,"\\'"):e}function Zt({isEndOptional:t,lines:e,regexpEndRegex:o,startLineIndex:n,startMatch:r,trimChildren:l}){let s="",i="",d=e.slice(n),c=!1,u=0,a=0,m=null,f=!1,h=0,p=d[0].slice(0,r.index),g=0,k=n;e:for(let[R,T]of d.entries()){let C=l?T.trim():T,x=0;if(l)for(let _=0;_<T.length&&T[_]===" ";_++)x++;let b=0;for(R===0&&(b=(r.index??0)+r[0].length-x);b<C.length;){let _=C[b],M=C[b+1];if(c){if(_==="`"&&h++,h%2===0)if(_==="<"&&M==="/"){if(u--,u<0){i[i.length-1]===`
4
+ `&&(i=i.slice(0,-1)),k=R;for(let v=b;v<C.length;v++)if(C[v]===">"){g=v+1;break}break e}}else if(_==="/"&&M===">"){if(u--,u<0){i[i.length-1]===`
5
+ `&&(i=i.slice(0,-1)),k=R,g=b+2;break e}}else _==="<"&&M!=="/"&&u++;i+=_}else{if(_==="{"&&!m?a++:_==="}"&&!m?a--:(_==='"'||_==="'")&&!m?m=_:_===m&&(m=null),_==="/"&&M===">"&&a===0&&!m){f=!0,k=R,g=b+2;break e}else if(_===">"&&a===0&&!m){c=!0,b++;continue}s+=_}b++}if(c?i?.length>0&&R>0&&(i+=`
6
6
  `):s+=`
7
- `,o&&u<0){let _=C.match(o);if(_?.index!==void 0){k=R,g=_.index+_[0].length-1;break}}if(R===d.length-1&&!t&&!p)throw new Error("End match not found for lines "+e.join(`
7
+ `,o&&u<0){let _=C.match(o);if(_?.index!==void 0){k=R,g=_.index+_[0].length-1;break}}if(R===d.length-1&&!t&&!f)throw new Error("End match not found for lines "+e.join(`
8
8
  `)+`
9
9
 
10
- . Start match: `+JSON.stringify(n))}return{afterEndLine:d[k].trim().slice(g),beforeStartLine:f,content:i,endLineIndex:r+k,endlineLastCharIndex:g,propsString:s}}import{jsx as Pu}from"react/jsx-runtime";import Bu from"bson-objectid";import{$applyNodeReplacement as ju}from"lexical";import"react";import{DecoratorBlockNode as iu}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as su}from"@lexical/utils";import au from"bson-objectid";import{$applyNodeReplacement as cu}from"lexical";var wt=class extends iu{__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=uu(e.fields);return o.setFormat(e.format),o}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return su(o,e?.theme?.block),o}decorate(e,o){return null}exportDOM(){let e=document.createElement("div"),o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),type:"block",fields:this.getFields(),version:2}}getCacheBuster(){return this.getLatest().__cacheBuster}getFields(){return this.getLatest().__fields}getTextContent(){return"Block Field"}setFields(e,o){let r=this.getWritable();r.__fields=e,o||r.__cacheBuster++}};function uu(t){return cu(new wt({fields:{...t,id:t?.id||new au.default().toHexString()}}))}import{jsx as G,jsxs as St,Fragment as An}from"react/jsx-runtime";import{useLexicalComposerContext as Cu}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as bu}from"@lexical/react/useLexicalEditable";import{getTranslation as ku}from"@payloadcms/translations";import{Button as Fn,Collapsible as _u,Drawer as Tu,EditDepthProvider as wu,ErrorPill as Su,Form as Eu,formatDrawerSlug as Nu,FormSubmit as Lu,Pill as yu,RenderFields as Ru,SectionTitle as Iu,useConfig as vu,useDocumentForm as Mu,useDocumentInfo as Pn,useEditDepth as Du,useFormSubmitted as $u,useServerFunctions as Ou,useTranslation as Au}from"@payloadcms/ui";import{abortAndIgnore as Yo}from"@payloadcms/ui/shared";import{$getNodeByKey as ro}from"lexical";import{deepCopyObjectSimpleWithoutReactComponents as no,reduceFieldsToValues as Bn}from"payload/shared";import Ze,{useCallback as qo,useEffect as Qo,useMemo as Oe,useRef as er}from"react";import{v4 as Fu}from"uuid";import{c as du}from"react/compiler-runtime";import{jsx as oo,jsxs as mu}from"react/jsx-runtime";import{useLexicalEditable as pu}from"@lexical/react/useLexicalEditable";import{RenderFields as fu,useFormSubmitted as hu}from"@payloadcms/ui";import gu,{createContext as xu}from"react";var Dn=xu({baseClass:"LexicalEditorTheme__block",BlockCollapsible:()=>null,BlockDrawer:()=>null,EditButton:()=>null,errorCount:0,formSchema:[],initialState:!1,nodeKey:"",RemoveButton:()=>null}),ie=()=>gu.use(Dn),$n=t=>{let e=du(4),{Collapsible:o,CustomBlock:r,CustomLabel:n,...l}=t,{BlockDrawer:s,errorCount:i,formSchema:d}=l,u=hu()&&i>0,a=pu(),m;e[0]!==o||e[1]!==i||e[2]!==u?(m=f=>{let{children:g,...k}=f;return oo(o,{errorCount:i,fieldHasErrors:u,...k,children:g})},e[0]=o,e[1]=i,e[2]=u,e[3]=m):m=e[3];let p=m,h={...l,BlockCollapsible:p};return r?mu(Dn,{value:h,children:[r,oo(s,{})]}):oo(p,{children:oo(fu,{fields:d,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!a})})};function On({fields:t}){for(let e in t){let o=t[e];Array.isArray(o?.rows)&&"value"in o&&(o.disableFormData=!0)}return t}var jn=t=>{let{cacheBuster:e,className:o,CustomBlock:r,CustomLabel:n,formData:l,nodeKey:s}=t,i=$u(),{id:d,collectionSlug:c,globalSlug:u}=Pn(),{fieldProps:{featureClientSchemaMap:a,field:m,initialLexicalFormState:p,schemaPath:h},uuid:f}=U(),{fields:g}=Mu(),k=er(new AbortController),N=Du(),[R,T]=Ze.useState(0),{config:C}=vu(),x=Nu({slug:`lexical-blocks-create-${f}-${l.id}`,depth:N}),{toggleDrawer:b}=xe(x),{getDocPreferences:_,setDocFieldPreferences:D}=Pn(),[I]=Cu(),y=bu(),S=l.blockType,{getFormState:w}=Ou(),L=`${h}.lexical_internal_feature.blocks.lexical_blocks.${S}.fields`,[E,v]=Ze.useState(()=>{let H=p?.[l.id]?.formState;if(!H)return!1;let Q=Object.fromEntries(Object.entries(H).map(([W,V])=>[W,W in l?{...V,initialValue:l[W],value:l[W]}:V]));return Q.blockName={initialValue:l.blockName,passesCondition:!0,valid:!0,value:l.blockName},Q}),$=er(!1),O=er(e);Qo(()=>{$.current?(O.current!==e&&v(!1),O.current=e):$.current=!0},[e]);let[F]=Ze.useState(()=>Fu()),[P,Z]=Ze.useState(()=>{if(!n)return E?._components?.customComponents?.BlockLabel??void 0}),[K,Ve]=Ze.useState(()=>{if(!r)return E?._components?.customComponents?.Block??void 0}),Re=Oe(()=>r?G(r,{className:o,formData:l,isEditor:!0,isJSXConverter:!1,nodeKey:s,useBlockComponentContext:ie}):K,[r,o,l,s,K]),he=Oe(()=>n?G(n,{className:o,formData:l,isEditor:!0,isJSXConverter:!1,nodeKey:s,useBlockComponentContext:ie}):P,[n,o,l,s,P]);Qo(()=>{let H=new AbortController;return l&&!E&&(async()=>{let{state:W}=await w({id:d,collectionSlug:c,data:l,docPermissions:{fields:!0},docPreferences:await _(),documentFormState:no(g,{excludeFiles:!0}),globalSlug:u,initialBlockData:l,operation:"update",readOnly:!y,renderAllFields:!0,schemaPath:L,signal:H.signal});if(W){W.blockName={initialValue:l.blockName,passesCondition:!0,valid:!0,value:l.blockName};let V=Bn(no(W,{excludeFiles:!0}),!0);I.update(()=>{let Y=ro(s);if(Y&&Ae(Y)){let ne=V;ne.blockType=S,Y.setFields(ne,!0)}}),v(W),n||Z(W._components?.customComponents?.BlockLabel??void 0),r||Ve(W._components?.customComponents?.Block??void 0)}})(),()=>{Yo(H)}},[w,L,y,d,n,r,l,I,s,E,c,u,_,g,S]);let[re,ge]=Ze.useState(p?.[l.id]?.collapsed??!1),Vt=`${h}.lexical_internal_feature.blocks.lexical_blocks.${S}`,se=a.blocks?.[Vt]?.[0],q=se.blockReferences?typeof se?.blockReferences?.[0]=="string"?C.blocksMap[se?.blockReferences?.[0]]:se?.blockReferences?.[0]:se?.blocks?.[0],{i18n:pt,t:Ie}=Au(),ft=qo(async({formState:H,submit:Q})=>{Yo(k.current);let W=new AbortController;k.current=W;let{state:V}=await w({id:d,collectionSlug:c,docPermissions:{fields:!0},docPreferences:await _(),documentFormState:no(g,{excludeFiles:!0}),formState:H,globalSlug:u,initialBlockFormState:H,operation:"update",readOnly:!y,renderAllFields:!!Q,schemaPath:L,signal:W.signal});if(!V)return H;H.blockName&&(V.blockName=H.blockName);let Y=Bn(On({fields:no(V,{excludeFiles:!0})}),!0);if(setTimeout(()=>{I.update(()=>{let ne=ro(s);if(ne&&Ae(ne)){let Ke=Y;Ke.blockType=S,ne.setFields(Ke,!0)}})},0),Q){n||Z(V._components?.customComponents?.BlockLabel??void 0),r||Ve(V._components?.customComponents?.Block??void 0);let ne=0;for(let Ke of Object.values(V))Ke?.valid===!1&&ne++;T(ne)}return V},[w,d,c,_,u,L,S,g,y,I,s,r,n]);Qo(()=>()=>{Yo(k.current)},[]);let an=qo(()=>{I.update(()=>{ro(s)?.remove()})},[I,s]),Je=q?.labels?.singular?ku(q.labels.singular,pt):q?.slug,cn=qo(H=>{_().then(Q=>{let V=Q?.fields?.[m.name]?.collapsed,Y=V&&V?.length?V:[];H?Y.includes(l.id)||Y.push(l.id):Y.includes(l.id)&&Y.splice(Y.indexOf(l.id),1),D(m.name,{collapsed:Y,hello:"hi"})})},[_,m.name,D,l.id]),Jt=Oe(()=>()=>G(Fn,{buttonStyle:"icon-label",className:`${o}__editButton`,disabled:!y,el:"button",icon:"edit",onClick:H=>(H.preventDefault(),H.stopPropagation(),b(),!1),onMouseDown:H=>{H.preventDefault()},round:!0,size:"small",tooltip:Ie("lexical:blocks:inlineBlocks:edit",{label:Je})}),[o,y,Ie,Je,b]),Kt=Oe(()=>()=>G(Fn,{buttonStyle:"icon-label",className:`${o}__removeButton`,disabled:!y,icon:"x",onClick:H=>{H.preventDefault(),an()},round:!0,tooltip:"Remove Block"}),[o,y,an]),jo=Oe(()=>({Actions:H,children:Q,className:W,collapsibleProps:V,disableBlockName:Y,editButton:ne,errorCount:Ke,fieldHasErrors:Ho,Label:mn,Pill:pn,removeButton:Sc})=>G("div",{className:`${o}__container ${o}-${S}`,children:G(_u,{className:[`${o}__row`,Ho?`${o}__row--has-errors`:`${o}__row--no-errors`,W].filter(Boolean).join(" "),collapsibleStyle:Ho?"error":"default",header:St("div",{className:`${o}__block-header`,children:[typeof mn<"u"?mn:typeof he<"u"?he:St("div",{className:`${o}__block-label`,children:[typeof pn<"u"?pn:G(yu,{className:`${o}__block-pill ${o}__block-pill-${S}`,pillStyle:"white",size:"small",children:Je??S}),!Y&&!q?.admin?.disableBlockName&&G(Iu,{path:"blockName",readOnly:!y}),Ho&&G(Su,{count:Ke??0,i18n:pt,withMessage:!0})]}),G("div",{className:`${o}__block-actions`,children:typeof H<"u"?H:St(An,{children:[Re&&ne!==!1||!Re&&ne?G(Jt,{}):null,Sc!==!1&&y?G(Kt,{}):null]})})]}),isCollapsed:re,onToggle:fn=>{cn(fn),ge(fn)},...V||{},children:Q},0)}),[Re,he,Jt,Kt,Je,o,q?.admin?.disableBlockName,S,pt,re,cn,y]),un=l?.id,dn=Oe(()=>()=>G(wu,{children:G(Tu,{className:"",slug:x,title:Ie(`lexical:blocks:inlineBlocks:${un?"edit":"create"}`,{label:Je??Ie("lexical:blocks:inlineBlocks:label")}),children:E?St(An,{children:[G(Ru,{fields:q?.fields??[],forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:L,permissions:!0,readOnly:!y}),G(Lu,{programmaticSubmit:!0,children:Ie("fields:saveChanges")})]}):null})}),[E,x,un,Je,Ie,y,q?.fields,L]),wc=Oe(()=>E?G("div",{"data-block-drawer-slug":x,style:{display:"contents"},children:G(Eu,{beforeSubmit:[async({formState:H})=>await ft({formState:H,submit:!0})],el:"div",fields:q?.fields??[],initialState:E,onChange:[ft],onSubmit:(H,Q)=>{Q.blockType=S,I.update(()=>{let W=ro(s);W&&Ae(W)&&W.setFields(Q,!0)}),b()},submitted:i,uuid:F,children:G($n,{baseClass:o,BlockDrawer:dn,Collapsible:jo,CustomBlock:Re,CustomLabel:he,EditButton:Jt,errorCount:R,formSchema:q?.fields??[],initialState:E,nodeKey:s,RemoveButton:Kt})})}):null,[jo,dn,Re,he,S,x,Kt,Jt,o,I,R,b,q?.fields,F,E,s,ft,i]);return q?wc:G(jo,{disableBlockName:!0,fieldHasErrors:!0,children:St("div",{className:`${o}-not-found`,children:["Error: Block '",S,"' not found in the config but exists in the lexical data"]})})};var ae=class extends wt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){e.version===1&&(e={...e,fields:{...e.fields.data},version:2});let o=Fe(e.fields);return o.setFormat(e.format),o}decorate(...[e,o,r,n]){return Pu(jn,{cacheBuster:this.getCacheBuster(),className:o.theme.block??"LexicalEditorTheme__block",CustomBlock:r,CustomLabel:n,formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Fe(t){return ju(new ae({fields:{...t,id:t?.id||new Bu.default().toHexString()}}))}function Ae(t){return t instanceof ae}import{createHeadlessEditor as Hu}from"@lexical/headless";function tr(t,e){return({editorState:r})=>{let n=Hu({nodes:t});try{n.setEditorState(n.parseEditorState(r))}catch(s){console.error("getLexicalToMarkdown: ERROR parsing editor state",s)}let l="";return n.getEditorState().read(()=>{l=zt(e)}),l}}import{createHeadlessEditor as Uu}from"@lexical/headless";function lo(t,e){return({markdown:r})=>{let n=Uu({nodes:t});return n.update(()=>{Xt(r,e)},{discrete:!0}),n.getEditorState().toJSON()}}function Wu(t){let e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{regExpEnd:new RegExp(`</(${e})\\s*>|<${e}[^>]*?/>`,"i"),regExpStart:new RegExp(`<(${e})([^>]*?)\\s*(/?)>`,"i")}}var Wn=({blocks:t,inlineBlocks:e})=>{if(!t?.length&&!e?.length)return[];let o=[];if(t?.length)for(let r of t){let n=Un(r,!1);n&&(o=o.concat(n))}if(e?.length)for(let r of e){let n=Un(r,!0);n&&(o=o.concat(n))}return o};function Un(t,e){if(!t.jsx)return null;let o=Wu(t.slug),r=[];return e?(r.push(({allNodes:n,allTransformers:l})=>({type:"text-match",dependencies:[ht],export:s=>{if(!xt(s)||s.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let i=s.getFields(),d=tr(n,l),c=t.jsx.export({fields:i,lexicalToMarkdown:d});if(c===!1)return null;if(typeof c=="string")return c;let u=c.props&&Object.keys(c.props)?.length>0,a=c.props??{};return c?.children?.length?`<${i.blockType}${u?" "+Tt({props:a}):""}>${c.children}</${i.blockType}>`:`<${i.blockType}${u?" "+Tt({props:a}):""}/>`},getEndIndex:(s,i)=>{let{endlineLastCharIndex:d}=to({isEndOptional:!1,lines:[s.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:i,trimChildren:!1});return d},importRegExp:t.jsx?.customStartRegex??o.regExpStart,regExp:/___ignoreignoreignore___/g,replace(s,i){let{content:d,propsString:c}=to({isEndOptional:!1,lines:[s.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:{...i,index:0},trimChildren:!1});if(!t?.jsx?.import)return;let u=lo(n,l),a=t.jsx.import({children:d,closeMatch:null,htmlToLexical:null,markdownToLexical:u,openMatch:i,props:c?eo({propsString:c}):{}});if(a===!1)return;let m=gt({blockType:t.slug,...a});s.replace(m)}})),r):(r.push(({allNodes:n,allTransformers:l})=>({dependencies:[ae],export:s=>{if(!Ae(s)||s.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let i=s.getFields(),d=tr(n,l),c=t.jsx.export({fields:i,lexicalToMarkdown:d});if(c===!1)return null;if(typeof c=="string")return c;let u=c.props&&Object.keys(c.props)?.length>0,a=c.props??{};if(c?.children?.length){let m=c.children,p="";if(m.includes(`
10
+ . Start match: `+JSON.stringify(r))}return{afterEndLine:d[k].trim().slice(g),beforeStartLine:p,content:i,endLineIndex:n+k,endlineLastCharIndex:g,propsString:s}}import{jsx as Bu}from"react/jsx-runtime";import Pu from"bson-objectid";import{$applyNodeReplacement as ju}from"lexical";import"react";import{DecoratorBlockNode as iu}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as su}from"@lexical/utils";import au from"bson-objectid";import{$applyNodeReplacement as cu}from"lexical";var Tt=class extends iu{__cacheBuster;__fields;constructor({cacheBuster:e,fields:o,format:n,key:r}){super(n,r),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=uu(e.fields);return o.setFormat(e.format),o}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return su(o,e?.theme?.block),o}decorate(e,o){return null}exportDOM(){let e=document.createElement("div"),o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),type:"block",fields:this.getFields(),version:2}}getCacheBuster(){return this.getLatest().__cacheBuster}getFields(){return this.getLatest().__fields}getTextContent(){return"Block Field"}setFields(e,o){let n=this.getWritable();n.__fields=e,o||n.__cacheBuster++}};function uu(t){return cu(new Tt({fields:{...t,id:t?.id||new au.default().toHexString()}}))}import{jsx as V,jsxs as wt,Fragment as Rr}from"react/jsx-runtime";import{useLexicalComposerContext as Cu}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as bu}from"@lexical/react/useLexicalEditable";import{getTranslation as ku}from"@payloadcms/translations";import{Button as vr,Collapsible as _u,Drawer as Tu,EditDepthProvider as wu,ErrorPill as Su,Form as Eu,formatDrawerSlug as Nu,FormSubmit as Lu,Pill as yu,RenderFields as Ru,SectionTitle as vu,useConfig as Iu,useDocumentForm as Mu,useDocumentInfo as Ir,useEditDepth as $u,useFormSubmitted as Au,useServerFunctions as Du,useTranslation as Ou}from"@payloadcms/ui";import{abortAndIgnore as Po}from"@payloadcms/ui/shared";import{$getNodeByKey as qt,SKIP_DOM_SELECTION_TAG as jo}from"lexical";import{deepCopyObjectSimpleWithoutReactComponents as Qt,reduceFieldsToValues as Mr}from"payload/shared";import Ze,{useCallback as Ho,useEffect as Uo,useMemo as De,useRef as Go}from"react";import{v4 as Fu}from"uuid";import{c as du}from"react/compiler-runtime";import{jsx as Yt,jsxs as mu}from"react/jsx-runtime";import{useLexicalEditable as fu}from"@lexical/react/useLexicalEditable";import{RenderFields as pu,useFormSubmitted as hu}from"@payloadcms/ui";import gu,{createContext as xu}from"react";var Nr=xu({baseClass:"LexicalEditorTheme__block",BlockCollapsible:()=>null,BlockDrawer:()=>null,EditButton:()=>null,errorCount:0,formSchema:[],initialState:!1,nodeKey:"",RemoveButton:()=>null}),ie=()=>gu.use(Nr),Lr=t=>{let e=du(4),{Collapsible:o,CustomBlock:n,CustomLabel:r,...l}=t,{BlockDrawer:s,errorCount:i,formSchema:d}=l,u=hu()&&i>0,a=fu(),m;e[0]!==o||e[1]!==i||e[2]!==u?(m=p=>{let{children:g,...k}=p;return Yt(o,{errorCount:i,fieldHasErrors:u,...k,children:g})},e[0]=o,e[1]=i,e[2]=u,e[3]=m):m=e[3];let f=m,h={...l,BlockCollapsible:f};return n?mu(Nr,{value:h,children:[n,Yt(s,{})]}):Yt(f,{children:Yt(pu,{fields:d,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!a})})};function yr({fields:t}){for(let e in t){let o=t[e];Array.isArray(o?.rows)&&"value"in o&&(o.disableFormData=!0)}return t}var $r=t=>{let{cacheBuster:e,className:o,CustomBlock:n,CustomLabel:r,formData:l,nodeKey:s}=t,i=Au(),{id:d,collectionSlug:c,globalSlug:u}=Ir(),{fieldProps:{featureClientSchemaMap:a,field:m,initialLexicalFormState:f,schemaPath:h},uuid:p}=U(),{fields:g}=Mu(),k=Go(new AbortController),N=$u(),[R,T]=Ze.useState(0),{config:C}=Iu(),x=Nu({slug:`lexical-blocks-create-${p}-${l.id}`,depth:N}),{toggleDrawer:b}=xe(x),{getDocPreferences:_,setDocFieldPreferences:M}=Ir(),[v]=Cu(),y=bu(),S=l.blockType,{getFormState:w}=Du(),L=`${h}.lexical_internal_feature.blocks.lexical_blocks.${S}.fields`,[E,I]=Ze.useState(()=>{let H=f?.[l.id]?.formState;if(!H)return!1;let Q=Object.fromEntries(Object.entries(H).map(([G,W])=>[G,G in l?{...W,initialValue:l[G],value:l[G]}:W]));return Q.blockName={initialValue:l.blockName,passesCondition:!0,valid:!0,value:l.blockName},Q}),A=Go(!1),D=Go(e);Uo(()=>{A.current?(D.current!==e&&I(!1),D.current=e):A.current=!0},[e]);let[F]=Ze.useState(()=>Fu()),[B,Z]=Ze.useState(()=>{if(!r)return E?._components?.customComponents?.BlockLabel??void 0}),[K,We]=Ze.useState(()=>{if(!n)return E?._components?.customComponents?.Block??void 0}),Re=De(()=>n?V(n,{className:o,formData:l,isEditor:!0,isJSXConverter:!1,nodeKey:s,useBlockComponentContext:ie}):K,[n,o,l,s,K]),he=De(()=>r?V(r,{className:o,formData:l,isEditor:!0,isJSXConverter:!1,nodeKey:s,useBlockComponentContext:ie}):B,[r,o,l,s,B]);Uo(()=>{let H=new AbortController;return l&&!E&&(async()=>{let{state:G}=await w({id:d,collectionSlug:c,data:l,docPermissions:{fields:!0},docPreferences:await _(),documentFormState:Qt(g,{excludeFiles:!0}),globalSlug:u,initialBlockData:l,operation:"update",readOnly:!y,renderAllFields:!0,schemaPath:L,signal:H.signal});if(G){G.blockName={initialValue:l.blockName,passesCondition:!0,valid:!0,value:l.blockName};let W=Mr(Qt(G,{excludeFiles:!0}),!0);v.update(()=>{let Y=qt(s);if(Y&&Oe(Y)){let re=W;re.blockType=S,Y.setFields(re,!0)}},{tag:jo}),I(G),r||Z(G._components?.customComponents?.BlockLabel??void 0),n||We(G._components?.customComponents?.Block??void 0)}})(),()=>{Po(H)}},[w,L,y,d,r,n,l,v,s,E,c,u,_,g,S]);let[ne,ge]=Ze.useState(f?.[l.id]?.collapsed??!1),jt=`${h}.lexical_internal_feature.blocks.lexical_blocks.${S}`,se=a.blocks?.[jt]?.[0],q=se.blockReferences?typeof se?.blockReferences?.[0]=="string"?C.blocksMap[se?.blockReferences?.[0]]:se?.blockReferences?.[0]:se?.blocks?.[0],{i18n:mt,t:ve}=Ou(),ft=Ho(async({formState:H,submit:Q})=>{Po(k.current);let G=new AbortController;k.current=G;let{state:W}=await w({id:d,collectionSlug:c,docPermissions:{fields:!0},docPreferences:await _(),documentFormState:Qt(g,{excludeFiles:!0}),formState:H,globalSlug:u,initialBlockFormState:H,operation:"update",readOnly:!y,renderAllFields:!!Q,schemaPath:L,signal:G.signal});if(!W)return H;H.blockName&&(W.blockName=H.blockName);let Y=Mr(yr({fields:Qt(W,{excludeFiles:!0})}),!0);if(setTimeout(()=>{v.update(()=>{let re=qt(s);if(re&&Oe(re)){let Ke=Y;Ke.blockType=S,re.setFields(Ke,!0)}},{tag:jo})},0),Q){r||Z(W._components?.customComponents?.BlockLabel??void 0),n||We(W._components?.customComponents?.Block??void 0);let re=0;for(let Ke of Object.values(W))Ke?.valid===!1&&re++;T(re)}return W},[w,d,c,_,u,L,S,g,y,v,s,n,r]);Uo(()=>()=>{Po(k.current)},[]);let Zn=Ho(()=>{v.update(()=>{qt(s)?.remove()})},[v,s]),ze=q?.labels?.singular?ku(q.labels.singular,mt):q?.slug,Yn=Ho(H=>{_().then(Q=>{let W=Q?.fields?.[m.name]?.collapsed,Y=W&&W?.length?W:[];H?Y.includes(l.id)||Y.push(l.id):Y.includes(l.id)&&Y.splice(Y.indexOf(l.id),1),M(m.name,{collapsed:Y,hello:"hi"})})},[_,m.name,M,l.id]),Ht=De(()=>()=>V(vr,{buttonStyle:"icon-label",className:`${o}__editButton`,disabled:!y,el:"button",icon:"edit",onClick:H=>(H.preventDefault(),H.stopPropagation(),b(),!1),onMouseDown:H=>{H.preventDefault()},round:!0,size:"medium",tooltip:ve("lexical:blocks:inlineBlocks:edit",{label:ze})}),[o,y,ve,ze,b]),Ut=De(()=>()=>V(vr,{buttonStyle:"icon-label",className:`${o}__removeButton`,disabled:!y,icon:"x",onClick:H=>{H.preventDefault(),Zn()},round:!0,tooltip:"Remove Block"}),[o,y,Zn]),$o=De(()=>({Actions:H,children:Q,className:G,collapsibleProps:W,disableBlockName:Y,editButton:re,errorCount:Ke,fieldHasErrors:Ao,Label:er,Pill:tr,removeButton:_c})=>V("div",{className:`${o}__container ${o}-${S}`,children:V(_u,{className:[`${o}__row`,Ao?`${o}__row--has-errors`:`${o}__row--no-errors`,G].filter(Boolean).join(" "),collapsibleStyle:Ao?"error":"default",header:wt("div",{className:`${o}__block-header`,children:[typeof er<"u"?er:typeof he<"u"?he:wt("div",{className:`${o}__block-label`,children:[typeof tr<"u"?tr:V(yu,{className:`${o}__block-pill ${o}__block-pill-${S}`,pillStyle:"white",size:"small",children:ze??S}),!Y&&!q?.admin?.disableBlockName&&V(vu,{path:"blockName",readOnly:!y}),Ao&&V(Su,{count:Ke??0,i18n:mt,withMessage:!0})]}),V("div",{className:`${o}__block-actions`,children:typeof H<"u"?H:wt(Rr,{children:[Re&&re!==!1||!Re&&re?V(Ht,{}):null,_c!==!1&&y?V(Ut,{}):null]})})]}),isCollapsed:ne,onToggle:or=>{Yn(or),ge(or)},...W||{},children:Q},0)}),[Re,he,Ht,Ut,ze,o,q?.admin?.disableBlockName,S,mt,ne,Yn,y]),qn=l?.id,Qn=De(()=>()=>V(wu,{children:V(Tu,{className:"",slug:x,title:ve(`lexical:blocks:inlineBlocks:${qn?"edit":"create"}`,{label:ze??ve("lexical:blocks:inlineBlocks:label")}),children:E?wt(Rr,{children:[V(Ru,{fields:q?.fields??[],forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:L,permissions:!0,readOnly:!y}),V(Lu,{programmaticSubmit:!0,children:ve("fields:saveChanges")})]}):null})}),[E,x,qn,ze,ve,y,q?.fields,L]),kc=De(()=>E?V("div",{"data-block-drawer-slug":x,style:{display:"contents"},children:V(Eu,{beforeSubmit:[async({formState:H})=>await ft({formState:H,submit:!0})],el:"div",fields:q?.fields??[],initialState:E,onChange:[ft],onSubmit:(H,Q)=>{Q.blockType=S,v.update(()=>{let G=qt(s);G&&Oe(G)&&G.setFields(Q,!0)},{tag:jo}),b()},submitted:i,uuid:F,children:V(Lr,{baseClass:o,BlockDrawer:Qn,Collapsible:$o,CustomBlock:Re,CustomLabel:he,EditButton:Ht,errorCount:R,formSchema:q?.fields??[],initialState:E,nodeKey:s,RemoveButton:Ut})})}):null,[$o,Qn,Re,he,S,x,Ut,Ht,o,v,R,b,q?.fields,F,E,s,ft,i]);return q?kc:V($o,{disableBlockName:!0,fieldHasErrors:!0,children:wt("div",{className:`${o}-not-found`,children:["Error: Block '",S,"' not found in the config but exists in the lexical data"]})})};var ae=class extends Tt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){e.version===1&&(e={...e,fields:{...e.fields.data},version:2});let o=Fe(e.fields);return o.setFormat(e.format),o}decorate(...[e,o,n,r]){return Bu($r,{cacheBuster:this.getCacheBuster(),className:o.theme.block??"LexicalEditorTheme__block",CustomBlock:n,CustomLabel:r,formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Fe(t){return ju(new ae({fields:{...t,id:t?.id||new Pu.default().toHexString()}}))}function Oe(t){return t instanceof ae}import{createHeadlessEditor as Hu}from"@lexical/headless";function Vo(t,e){return({editorState:n})=>{let r=Hu({nodes:t});try{r.setEditorState(r.parseEditorState(n))}catch(s){console.error("getLexicalToMarkdown: ERROR parsing editor state",s)}let l="";return r.getEditorState().read(()=>{l=Vt(e)}),l}}import{createHeadlessEditor as Uu}from"@lexical/headless";function eo(t,e){return({markdown:n})=>{let r=Uu({nodes:t});return r.update(()=>{Gt(n,e)},{discrete:!0}),r.getEditorState().toJSON()}}function Gu(t){let e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{regExpEnd:new RegExp(`</(${e})\\s*>|<${e}[^>]*?/>`,"i"),regExpStart:new RegExp(`<(${e})([^>]*?)\\s*(/?)>`,"i")}}var Or=({blocks:t,inlineBlocks:e})=>{if(!t?.length&&!e?.length)return[];let o=[];if(t?.length)for(let n of t){let r=Dr(n,!1);r&&(o=o.concat(r))}if(e?.length)for(let n of e){let r=Dr(n,!0);r&&(o=o.concat(r))}return o};function Dr(t,e){if(!t.jsx)return null;let o=Gu(t.slug),n=[];return e?(n.push(({allNodes:r,allTransformers:l})=>({type:"text-match",dependencies:[pt],export:s=>{if(!gt(s)||s.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let i=s.getFields(),d=Vo(r,l),c=t.jsx.export({fields:i,lexicalToMarkdown:d});if(c===!1)return null;if(typeof c=="string")return c;let u=c.props&&Object.keys(c.props)?.length>0,a=c.props??{};return c?.children?.length?`<${i.blockType}${u?" "+_t({props:a}):""}>${c.children}</${i.blockType}>`:`<${i.blockType}${u?" "+_t({props:a}):""}/>`},getEndIndex:(s,i)=>{let{endlineLastCharIndex:d}=Zt({isEndOptional:!1,lines:[s.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:i,trimChildren:!1});return d},importRegExp:t.jsx?.customStartRegex??o.regExpStart,regExp:/___ignoreignoreignore___/g,replace(s,i){let{content:d,propsString:c}=Zt({isEndOptional:!1,lines:[s.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:{...i,index:0},trimChildren:!1});if(!t?.jsx?.import)return;let u=eo(r,l),a=t.jsx.import({children:d,closeMatch:null,htmlToLexical:null,markdownToLexical:u,openMatch:i,props:c?Xt({propsString:c}):{}});if(a===!1)return;let m=ht({blockType:t.slug,...a});s.replace(m)}})),n):(n.push(({allNodes:r,allTransformers:l})=>({dependencies:[ae],export:s=>{if(!Oe(s)||s.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let i=s.getFields(),d=Vo(r,l),c=t.jsx.export({fields:i,lexicalToMarkdown:d});if(c===!1)return null;if(typeof c=="string")return c;let u=c.props&&Object.keys(c.props)?.length>0,a=c.props??{};if(c?.children?.length){let m=c.children,f="";if(m.includes(`
11
11
  `))for(let h of m.split(`
12
- `)){let f="";!t?.jsx?.doNotTrimChildren&&h!==""&&(f=" "),f+=h+`
13
- `,p+=f}else p=(t?.jsx?.doNotTrimChildren?"":" ")+m+`
14
- `;return`<${i.blockType}${u?" "+Tt({props:a}):""}>
15
- ${p}</${i.blockType}>`}return`<${i.blockType}${u?" "+Tt({props:a}):""}/>`},handleImportAfterStartMatch:t.jsx?.customEndRegex?void 0:({lines:s,rootNode:i,startLineIndex:d,startMatch:c,transformer:u})=>{let a=typeof u.regExpEnd=="object"&&"regExp"in u.regExpEnd?u.regExpEnd.regExp:u.regExpEnd,m=u.regExpEnd&&typeof u.regExpEnd=="object"&&"optional"in u.regExpEnd?u.regExpEnd.optional:!u.regExpEnd,{afterEndLine:p,beforeStartLine:h,content:f,endLineIndex:g,propsString:k}=to({isEndOptional:m,lines:s,regexpEndRegex:a,startLineIndex:d,startMatch:c,trimChildren:!1}),N="";if(t?.jsx?.doNotTrimChildren)N=f.endsWith(`
16
- `)?f.slice(0,-1):f;else if(f.includes(`
17
- `)){let x=f.split(`
18
- `),b=0;for(let _ of x){if(b++,_.startsWith(" "))N+=_.slice(2);else if(_==="")N+=_;else{N=f.endsWith(`
19
- `)?f.slice(0,-1):f;break}N+=b===x.length?"":`
20
- `}}else N=(f.startsWith(" ")?f.slice(2):f)+`
21
- `;if(!t?.jsx?.import)return[!1,d];let R=lo(n,l),T=t.jsx.import({children:N,closeMatch:null,htmlToLexical:null,markdownToLexical:R,openMatch:c,props:k?eo({propsString:k}):{}});if(T===!1)return[!1,d];let C=Fe({blockType:t.slug,...T});if(C){let x=null,b=null;if(h?.length){x=R({markdown:h})?.root?.children??[];let _=x?.[0];_&&i.append(Hn(_))}if(i.append(C),p?.length){b=R({markdown:p})?.root?.children;let _=i.getChildren()[i.getChildren().length-1],D=Hn(b[0])?.getChildren();if(D?.length)for(let I of D)_.append(I)}}return[!0,g]},regExpEnd:t.jsx?.customEndRegex??o.regExpEnd,regExpStart:t.jsx?.customStartRegex??o.regExpStart,type:"multiline-element",replace:(s,i,d,c,u)=>{if(t?.jsx?.import){if(!u){let g="";if(i)for(let k of i)g+=k.getTextContent();u=[g]}let a="";t?.jsx?.doNotTrimChildren?a=u.join(`
12
+ `)){let p="";!t?.jsx?.doNotTrimChildren&&h!==""&&(p=" "),p+=h+`
13
+ `,f+=p}else f=(t?.jsx?.doNotTrimChildren?"":" ")+m+`
14
+ `;return`<${i.blockType}${u?" "+_t({props:a}):""}>
15
+ ${f}</${i.blockType}>`}return`<${i.blockType}${u?" "+_t({props:a}):""}/>`},handleImportAfterStartMatch:t.jsx?.customEndRegex?void 0:({lines:s,rootNode:i,startLineIndex:d,startMatch:c,transformer:u})=>{let a=typeof u.regExpEnd=="object"&&"regExp"in u.regExpEnd?u.regExpEnd.regExp:u.regExpEnd,m=u.regExpEnd&&typeof u.regExpEnd=="object"&&"optional"in u.regExpEnd?u.regExpEnd.optional:!u.regExpEnd,{afterEndLine:f,beforeStartLine:h,content:p,endLineIndex:g,propsString:k}=Zt({isEndOptional:m,lines:s,regexpEndRegex:a,startLineIndex:d,startMatch:c,trimChildren:!1}),N="";if(t?.jsx?.doNotTrimChildren)N=p.endsWith(`
16
+ `)?p.slice(0,-1):p;else if(p.includes(`
17
+ `)){let x=p.split(`
18
+ `),b=0;for(let _ of x){if(b++,_.startsWith(" "))N+=_.slice(2);else if(_==="")N+=_;else{N=p.endsWith(`
19
+ `)?p.slice(0,-1):p;break}N+=b===x.length?"":`
20
+ `}}else N=(p.startsWith(" ")?p.slice(2):p)+`
21
+ `;if(!t?.jsx?.import)return[!1,d];let R=eo(r,l),T=t.jsx.import({children:N,closeMatch:null,htmlToLexical:null,markdownToLexical:R,openMatch:c,props:k?Xt({propsString:k}):{}});if(T===!1)return[!1,d];let C=Fe({blockType:t.slug,...T});if(C){let x=null,b=null;if(h?.length){x=R({markdown:h})?.root?.children??[];let _=x?.[0];_&&i.append(Ar(_))}if(i.append(C),f?.length){b=R({markdown:f})?.root?.children;let _=i.getChildren()[i.getChildren().length-1],M=Ar(b[0])?.getChildren();if(M?.length)for(let v of M)_.append(v)}}return[!0,g]},regExpEnd:t.jsx?.customEndRegex??o.regExpEnd,regExpStart:t.jsx?.customStartRegex??o.regExpStart,type:"multiline-element",replace:(s,i,d,c,u)=>{if(t?.jsx?.import){if(!u){let g="";if(i)for(let k of i)g+=k.getTextContent();u=[g]}let a="";t?.jsx?.doNotTrimChildren?a=u.join(`
22
22
  `):a=u.join(`
23
- `).trim();let m=d[1]?.trim(),p=lo(n,l),h=t.jsx.import({children:a,closeMatch:c,htmlToLexical:null,markdownToLexical:p,openMatch:d,props:m?eo({propsString:m}):{}});if(h===!1)return!1;let f=Fe({blockType:t.slug,...h});f&&s.append(f);return}return!1}})),r)}import{createCommand as Gn}from"lexical";var Ye=Gn("INSERT_BLOCK_COMMAND"),qe=Gn("INSERT_INLINE_BLOCK_COMMAND");import{c as Gu}from"react/compiler-runtime";import{useLexicalComposerContext as Vu}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Ju,$wrapNodeInElement as Ku,mergeRegister as Xu}from"@lexical/utils";import{formatDrawerSlug as zu,useEditDepth as Zu}from"@payloadcms/ui";import{$createParagraphNode as Yu,$getNodeByKey as qu,$getPreviousSelection as Qu,$getSelection as ed,$insertNodes as td,$isParagraphNode as od,$isRangeSelection as rd,$isRootOrShadowRoot as nd,COMMAND_PRIORITY_EDITOR as Vn}from"lexical";import{useEffect as ld,useState as id}from"react";var Jn=()=>{let t=Gu(12),[e]=Vu(),[o,r]=id(null),{setCreatedInlineBlock:n,uuid:l}=U(),s=Zu(),i="lexical-inlineBlocks-create-"+l,d;t[0]!==s||t[1]!==i?(d=zu({slug:i,depth:s}),t[0]=s,t[1]=i,t[2]=d):d=t[2];let c=d,{toggleDrawer:u}=xe(c,!0),a;t[3]!==e||t[4]!==n||t[5]!==o?(a=()=>{if(!e.hasNodes([ae]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return Xu(e.registerCommand(Ye,p=>(e.update(()=>{let h=ed()||Qu();if(rd(h)){let f=Fe(p),{focus:g}=h,k=g.getNode();Ju(f),od(k)&&!k.__first&&k.remove()}}),!0),Vn),e.registerCommand(qe,p=>{if(o){let f=qu(o);return!f||!xt(f)?!1:(f.setFields(p),r(null),!0)}let h=gt(p);return n?.(h),td([h]),nd(h.getParentOrThrow())&&Ku(h,Yu).selectEnd(),!0},Vn))},t[3]=e,t[4]=n,t[5]=o,t[6]=a):a=t[6];let m;return t[7]!==e||t[8]!==n||t[9]!==o||t[10]!==u?(m=[e,n,o,u],t[7]=e,t[8]=n,t[9]=o,t[10]=u,t[11]=m):m=t[11],ld(a,m),null};var sd=M(({config:t,featureClientSchemaMap:e,props:o,schemaPath:r})=>{let n=`${r}.lexical_internal_feature.blocks.lexical_blocks`,l=`${r}.lexical_internal_feature.blocks.lexical_inline_blocks`,s=e.blocks;if(!s)return{};let i=Object.entries(s).filter(([a])=>a.startsWith(n+".")&&!a.replace(n+".","").includes(".")).map(([,a])=>a[0]),d=Object.entries(s).filter(([a])=>a.startsWith(l+".")&&!a.replace(l+".","").includes(".")).map(([,a])=>a[0]),c=i.map(a=>a.blockReferences?typeof a.blockReferences[0]=="string"?t.blocksMap[a.blockReferences[0]]:a.blockReferences[0]:a.blocks[0]).filter(a=>a!==void 0),u=d.map(a=>a.blockReferences?typeof a.blockReferences[0]=="string"?t.blocksMap[a.blockReferences[0]]:a.blockReferences[0]:a.blocks[0]).filter(a=>a!==void 0);return{markdownTransformers:Wn({blocks:c,inlineBlocks:u}),nodes:[ae,ht],plugins:[{Component:Jn,position:"normal"}],sanitizedClientFeatureProps:o,slashMenu:{groups:[c?.length?{items:c.map(a=>({Icon:Qt(a,Yt),key:"block-"+a.slug,keywords:["block","blocks",a.slug],label:({i18n:m})=>a?.labels?.singular?io(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(Ye,{blockName:"",blockType:a.slug})}})),key:"blocks",label:({i18n:a})=>a.t("lexical:blocks:label")}:null,u?.length?{items:u.map(a=>({Icon:qt,key:"inlineBlocks-"+a.slug,keywords:["inlineBlock","inline block",a.slug],label:({i18n:m})=>a?.labels?.singular?io(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(qe,{blockName:"",blockType:a.slug})}})),key:"inlineBlocks",label:({i18n:a})=>a.t("lexical:blocks:inlineBlocks:label")}:null].filter(Boolean)},toolbarFixed:{groups:[c.length?{type:"dropdown",ChildComponent:Yt,items:c.map((a,m)=>({ChildComponent:Qt(a,Yt),isActive:void 0,key:"block-"+a.slug,label:({i18n:p})=>a?.labels?.singular?io(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(Ye,{blockName:"",blockType:a.slug})},order:m})),key:"blocks",order:20}:null,u?.length?{type:"dropdown",ChildComponent:qt,items:u.map((a,m)=>({ChildComponent:Qt(a,qt),isActive:void 0,key:"inlineBlock-"+a.slug,label:({i18n:p})=>a?.labels?.singular?io(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(qe,{blockName:"",blockType:a.slug})},order:m})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}});import{c as ud}from"react/compiler-runtime";import{jsx as Be,jsxs as lr}from"react/jsx-runtime";import{useLexicalComposerContext as dd}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as md,$createTextNode as pd,$getRoot as fd,getDOMSelection as or}from"lexical";import*as Yn from"react";import{useCallback as Pe,useEffect as rr,useLayoutEffect as Xn,useRef as nr,useState as so}from"react";var ad=le&&"documentMode"in document?document.documentMode:null,Kn=le&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),a6=le&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),c6=le&&"InputEvent"in window&&!ad?"getTargetRanges"in new window.InputEvent("input"):!1,u6=le&&/Version\/[\d.].*Safari/.test(navigator.userAgent),d6=le&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,m6=le&&/Android/.test(navigator.userAgent),p6=le&&/Win/.test(navigator.platform),cd=le&&/^(?=.*Chrome).*/i.test(navigator.userAgent),f6=le&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!cd;var hd=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)},gd=(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)},xd=t=>{let o=((r,n)=>{switch(r){case"click":return` await page.mouse.click(${n.x}, ${n.y});`;case"keydown":return` await page.keyboard.keydown('${n}');`;case"keyup":return` await page.keyboard.keyup('${n}');`;case"press":return` await page.keyboard.press('${n}');`;case"selectAll":return" await selectAll(page);";case"snapshot":return` await assertHTMLSnapshot(page);
23
+ `).trim();let m=d[1]?.trim(),f=eo(r,l),h=t.jsx.import({children:a,closeMatch:c,htmlToLexical:null,markdownToLexical:f,openMatch:d,props:m?Xt({propsString:m}):{}});if(h===!1)return!1;let p=Fe({blockType:t.slug,...h});p&&s.append(p);return}return!1}})),n)}import{createCommand as Fr}from"lexical";var Ye=Fr("INSERT_BLOCK_COMMAND"),qe=Fr("INSERT_INLINE_BLOCK_COMMAND");import{c as Vu}from"react/compiler-runtime";import{useLexicalComposerContext as Wu}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as zu,$wrapNodeInElement as Ku,mergeRegister as Ju}from"@lexical/utils";import{formatDrawerSlug as Xu,useEditDepth as Zu}from"@payloadcms/ui";import{$createParagraphNode as Yu,$getNodeByKey as qu,$getPreviousSelection as Qu,$getSelection as ed,$insertNodes as td,$isParagraphNode as od,$isRangeSelection as nd,$isRootOrShadowRoot as rd,COMMAND_PRIORITY_EDITOR as Br}from"lexical";import{useEffect as ld,useState as id}from"react";var Pr=()=>{let t=Vu(12),[e]=Wu(),[o,n]=id(null),{setCreatedInlineBlock:r,uuid:l}=U(),s=Zu(),i="lexical-inlineBlocks-create-"+l,d;t[0]!==s||t[1]!==i?(d=Xu({slug:i,depth:s}),t[0]=s,t[1]=i,t[2]=d):d=t[2];let c=d,{toggleDrawer:u}=xe(c,!0),a;t[3]!==e||t[4]!==r||t[5]!==o?(a=()=>{if(!e.hasNodes([ae]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return Ju(e.registerCommand(Ye,f=>(e.update(()=>{let h=ed()||Qu();if(nd(h)){let p=Fe(f),{focus:g}=h,k=g.getNode();zu(p),od(k)&&!k.__first&&k.remove()}}),!0),Br),e.registerCommand(qe,f=>{if(o){let p=qu(o);return!p||!gt(p)?!1:(p.setFields(f),n(null),!0)}let h=ht(f);return r?.(h),td([h]),rd(h.getParentOrThrow())&&Ku(h,Yu).selectEnd(),!0},Br))},t[3]=e,t[4]=r,t[5]=o,t[6]=a):a=t[6];let m;return t[7]!==e||t[8]!==r||t[9]!==o||t[10]!==u?(m=[e,r,o,u],t[7]=e,t[8]=r,t[9]=o,t[10]=u,t[11]=m):m=t[11],ld(a,m),null};var sd=$(({config:t,featureClientSchemaMap:e,props:o,schemaPath:n})=>{let r=`${n}.lexical_internal_feature.blocks.lexical_blocks`,l=`${n}.lexical_internal_feature.blocks.lexical_inline_blocks`,s=e.blocks;if(!s)return{};let i=Object.entries(s).filter(([a])=>a.startsWith(r+".")&&!a.replace(r+".","").includes(".")).map(([,a])=>a[0]),d=Object.entries(s).filter(([a])=>a.startsWith(l+".")&&!a.replace(l+".","").includes(".")).map(([,a])=>a[0]),c=i.map(a=>a.blockReferences?typeof a.blockReferences[0]=="string"?t.blocksMap[a.blockReferences[0]]:a.blockReferences[0]:a.blocks[0]).filter(a=>a!==void 0),u=d.map(a=>a.blockReferences?typeof a.blockReferences[0]=="string"?t.blocksMap[a.blockReferences[0]]:a.blockReferences[0]:a.blocks[0]).filter(a=>a!==void 0);return{markdownTransformers:Or({blocks:c,inlineBlocks:u}),nodes:[ae,pt],plugins:[{Component:Pr,position:"normal"}],sanitizedClientFeatureProps:o,slashMenu:{groups:[c?.length?{items:c.map(a=>({Icon:Jt(a,zt),key:"block-"+a.slug,keywords:["block","blocks",a.slug],label:({i18n:m})=>a?.labels?.singular?to(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(Ye,{blockName:"",blockType:a.slug})}})),key:"blocks",label:({i18n:a})=>a.t("lexical:blocks:label")}:null,u?.length?{items:u.map(a=>({Icon:Kt,key:"inlineBlocks-"+a.slug,keywords:["inlineBlock","inline block",a.slug],label:({i18n:m})=>a?.labels?.singular?to(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(qe,{blockName:"",blockType:a.slug})}})),key:"inlineBlocks",label:({i18n:a})=>a.t("lexical:blocks:inlineBlocks:label")}:null].filter(Boolean)},toolbarFixed:{groups:[c.length?{type:"dropdown",ChildComponent:zt,items:c.map((a,m)=>({ChildComponent:Jt(a,zt),isActive:void 0,key:"block-"+a.slug,label:({i18n:f})=>a?.labels?.singular?to(a.labels.singular,f):a?.slug,onSelect:({editor:f})=>{f.dispatchCommand(Ye,{blockName:"",blockType:a.slug})},order:m})),key:"blocks",order:20}:null,u?.length?{type:"dropdown",ChildComponent:Kt,items:u.map((a,m)=>({ChildComponent:Jt(a,Kt),isActive:void 0,key:"inlineBlock-"+a.slug,label:({i18n:f})=>a?.labels?.singular?to(a.labels.singular,f):a?.slug,onSelect:({editor:f})=>{f.dispatchCommand(qe,{blockName:"",blockType:a.slug})},order:m})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}});import{c as ud}from"react/compiler-runtime";import{jsx as Pe,jsxs as Jo}from"react/jsx-runtime";import{useLexicalComposerContext as dd}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as md,$createTextNode as fd,$getRoot as pd,getDOMSelection as Wo}from"lexical";import*as Vr from"react";import{useCallback as Be,useEffect as zo,useLayoutEffect as Hr,useRef as Ko,useState as oo}from"react";var ad=le&&"documentMode"in document?document.documentMode:null,jr=le&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),c4=le&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),u4=le&&"InputEvent"in window&&!ad?"getTargetRanges"in new window.InputEvent("input"):!1,d4=le&&/Version\/[\d.].*Safari/.test(navigator.userAgent),m4=le&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,f4=le&&/Android/.test(navigator.userAgent),p4=le&&/Win/.test(navigator.platform),cd=le&&/^(?=.*Chrome).*/i.test(navigator.userAgent),h4=le&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!cd;var hd=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)},gd=(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)},xd=t=>{let o=((n,r)=>{switch(n){case"click":return` await page.mouse.click(${r.x}, ${r.y});`;case"keydown":return` await page.keyboard.keydown('${r}');`;case"keyup":return` await page.keyboard.keyup('${r}');`;case"press":return` await page.keyboard.press('${r}');`;case"selectAll":return" await selectAll(page);";case"snapshot":return` await assertHTMLSnapshot(page);
24
24
  await assertSelection(page, {
25
- anchorPath: [${n.anchorPath.toString()}],
26
- anchorOffset: ${n.anchorOffset},
27
- focusPath: [${n.focusPath.toString()}],
28
- focusOffset: ${n.focusOffset},
25
+ anchorPath: [${r.anchorPath.toString()}],
26
+ anchorOffset: ${r.anchorOffset},
27
+ focusPath: [${r.focusPath.toString()}],
28
+ focusOffset: ${r.focusOffset},
29
29
  });
30
- `;case"type":return` await page.keyboard.type('${n}');`;default:return""}})(t.name,t.value);switch(t.count){case 1:return o;case 2:return[o,o].join(`
30
+ `;case"type":return` await page.keyboard.type('${r}');`;default:return""}})(t.name,t.value);switch(t.count){case 1:return o;case 2:return[o,o].join(`
31
31
  `);default:return` await repeat(${t.count}, async () => {
32
32
  ${o}
33
- );`}};function Cd(t){return t.key.toLowerCase()==="a"&&(Kn?t.metaKey:t.ctrlKey)}function bd(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 zn(t,e){let o=t,r=[];for(;o!==e;)o!=null&&r.unshift(Array.from(o?.parentNode?.childNodes??[]).indexOf(o)),o=o?.parentNode;return r}var Zn=new Set(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Backspace","Delete","Enter","Escape"]);function kd(t){let[e,o]=so([]),[r,n]=so(!1),[,l]=so(""),[s,i]=so(""),d=nr(null),c=nr(!1),u=nr(null),a=Pe(()=>t,[t]),m=Pe(()=>{let T=t.getRootElement(),C=or(t._window);return T==null||C==null||C.anchorNode==null||C.focusNode==null||!T.contains(C.anchorNode)||!T.contains(C.focusNode)?null:`
33
+ );`}};function Cd(t){return t.key.toLowerCase()==="a"&&(jr?t.metaKey:t.ctrlKey)}function bd(t){let{anchorNode:e,focusNode:o}=t,{anchorOffset:n,focusOffset:r}=t;return n!==0&&n--,r!==0&&r--,{anchorNode:e,anchorOffset:n,focusNode:o,focusOffset:r}}function Ur(t,e){let o=t,n=[];for(;o!==e;)o!=null&&n.unshift(Array.from(o?.parentNode?.childNodes??[]).indexOf(o)),o=o?.parentNode;return n}var Gr=new Set(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Backspace","Delete","Enter","Escape"]);function kd(t){let[e,o]=oo([]),[n,r]=oo(!1),[,l]=oo(""),[s,i]=oo(""),d=Ko(null),c=Ko(!1),u=Ko(null),a=Be(()=>t,[t]),m=Be(()=>{let T=t.getRootElement(),C=Wo(t._window);return T==null||C==null||C.anchorNode==null||C.focusNode==null||!T.contains(C.anchorNode)||!T.contains(C.focusNode)?null:`
34
34
  import {
35
35
  initializeE2E,
36
36
  assertHTMLSnapshot,
@@ -51,16 +51,16 @@ ${e.map(xd).join(`
51
51
  `)}
52
52
  });
53
53
  });
54
- `},[t,e]),p=Pe((T,C)=>{o(x=>{let b=e.length-1,_=e[b];if(_&&_.name===T){if(T==="type")return[...e.slice(0,b),{..._,value:_.value+C}];if(_.value===C)return[...e.slice(0,b),{..._,count:_.count+1}]}return[...x,{name:T,count:1,value:C}]})},[e,o]);Xn(()=>{let T=x=>{if(!r)return;let b=x.key;Cd(x)?p("selectAll",""):Zn.has(b)?p("press",x.key):[...b].length>1?p("keydown",x.key):p("type",x.key)},C=x=>{if(!r)return;let b=x.key;!Zn.has(b)&&[...b].length>1&&p("keyup",x.key)};return t.registerRootListener((x,b)=>{b!==null&&(b.removeEventListener("keydown",T),b.removeEventListener("keyup",C)),x!==null&&(x.addEventListener("keydown",T),x.addEventListener("keyup",C))})},[t,r,p]),Xn(()=>{u.current&&u.current.scrollTo(0,u.current.scrollHeight)},[m]),rr(()=>{if(e){let T=m();T!==null&&i(T),u.current&&u.current.scrollTo(0,u.current.scrollHeight)}},[m,e]),rr(()=>t.registerUpdateListener(({dirtyElements:C,dirtyLeaves:x,editorState:b})=>{if(!r)return;let _=b._selection,D=d.current,I=c.current;if(D!==_){if(x.size===0&&C.size===0&&!I){let S=or(t._window);if(S&&(S.anchorNode==null||S.focusNode==null))return}d.current=_}c.current=!1;let y=m();y!==null&&i(y)}),[t,m,r,p]),rr(()=>r?t.registerUpdateListener(()=>{let C=t.getRootElement();C!==null&&l(C?.innerHTML)}):void 0,[t,r]);let h=Pe(T=>{r||(T.update(()=>{let C=fd();C.clear();let x=pd();C.append(md().append(x)),x.select()}),o([])),n(C=>!C)},[r]),f=Pe(()=>{if(!r)return;let T=or(t._window);if(T===null||T.anchorNode==null||T.focusNode==null)return;let{anchorNode:C,anchorOffset:x,focusNode:b,focusOffset:_}=bd(T),D=a().getRootElement(),I;C!==null&&(I=zn(C,D));let y;b!==null&&(y=zn(b,D)),p("snapshot",{anchorNode:C,anchorOffset:x,anchorPath:I,focusNode:b,focusOffset:_,focusPath:y})},[p,r,a]),g=Pe(()=>{hd(m())},[m]),k=Pe(()=>{gd("test.js",m())},[m]);return[Be("button",{className:`editor-dev-button ${r?"active":""}`,id:"test-recorder-button",onClick:T=>{h(a()),T.preventDefault()},title:r?"Disable test recorder":"Enable test recorder",type:"button",children:r?"Disable test recorder":"Enable test recorder"}),r?lr("div",{className:"test-recorder-output",children:[lr("div",{className:"test-recorder-toolbar",children:[Be("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:T=>{f(),T.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),Be("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:T=>{g(),T.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),Be("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:T=>{k(),T.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),Be("pre",{id:"test-recorder",ref:u,children:s})]}):null]}var qn=()=>{let t=ud(3),[e]=dd(),[o,r]=kd(e),n;return t[0]!==o||t[1]!==r?(n=lr(Yn.Fragment,{children:[Be("p",{children:"HI"}),o,r,Be("p",{children:"DONE"})]}),t[0]=o,t[1]=r,t[2]=n):n=t[2],n};var _d=M({plugins:[{Component:qn,position:"bottom"}]});import{c as Td}from"react/compiler-runtime";import{jsx as wd}from"react/jsx-runtime";import{useLexicalComposerContext as Sd}from"@lexical/react/LexicalComposerContext.js";import{TreeView as Ed}from"@lexical/react/LexicalTreeView.js";import"react";var Qn=()=>{let t=Td(2),[e]=Sd(),o;return t[0]!==e?(o=wd(Ed,{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 Nd=M({plugins:[{Component:Qn,position:"bottom"}]});import{$isTableSelection as Ld}from"@lexical/table";import{$isRangeSelection as yd,FORMAT_TEXT_COMMAND as Rd}from"lexical";import{jsx as el}from"react/jsx-runtime";import"react";var tl=()=>el("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:el("path",{d:"M10.6772 15H6.27017V5.718H10.4172C12.6792 5.718 13.8492 6.602 13.8492 8.292C13.8492 9.098 13.1992 9.982 12.4712 10.216C13.3812 10.476 14.1742 11.256 14.1742 12.322C14.1742 14.09 12.9002 15 10.6772 15ZM8.46717 9.501H10.3262C11.3012 9.501 11.7042 9.046 11.7042 8.409C11.7042 7.72 11.2362 7.317 10.3392 7.317H8.46717V9.501ZM8.46717 11.061V13.401H10.4822C11.4702 13.401 11.9642 12.959 11.9642 12.218C11.9642 11.49 11.4702 11.061 10.4822 11.061H8.46717Z",fill:"currentColor"})});var z=t=>({type:"buttons",items:t,key:"format",order:40});var ol={type:"text-format",format:["bold","italic"],tag:"***"},rl={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},nl={type:"text-format",format:["bold"],tag:"**"},ll={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var il=[z([{ChildComponent:tl,isActive:({selection:t})=>yd(t)||Ld(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(Rd,"bold")},order:1}])],Id=M(({featureProviderMap:t})=>{let e=[nl,ll];return t.get("italic")&&e.push(rl,ol),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:il},toolbarInline:{groups:il}}});import{$isTableSelection as Md}from"@lexical/table";import{$isRangeSelection as Dd,FORMAT_TEXT_COMMAND as $d}from"lexical";import{jsx as sl,jsxs as vd}from"react/jsx-runtime";import"react";var al=()=>vd("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[sl("path",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),sl("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var cl={type:"text-format",format:["code"],tag:"`"};var ul=[z([{ChildComponent:al,isActive:({selection:t})=>Dd(t)||Md(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand($d,"code")},order:7}])],Od=M({enableFormats:["code"],markdownTransformers:[cl],toolbarFixed:{groups:ul},toolbarInline:{groups:ul}});import{$isTableSelection as Ad}from"@lexical/table";import{$isRangeSelection as Fd,FORMAT_TEXT_COMMAND as Pd}from"lexical";import{jsx as dl}from"react/jsx-runtime";import"react";var ml=()=>dl("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:dl("path",{d:"M11.311 14.2969L11.0327 15H6.18408L6.4624 14.2969C7.54639 14.2969 7.70752 14.209 7.83936 13.8721L10.8423 6.45996C10.8716 6.38672 10.8862 6.32812 10.8862 6.26953C10.8862 6.09375 10.6519 6.03516 9.80225 6.03516L10.0952 5.33203H14.9438L14.6509 6.03516C13.5669 6.03516 13.4204 6.12305 13.2886 6.45996L10.2856 13.8721C10.2563 13.9453 10.2271 14.0039 10.2271 14.0625C10.2271 14.2383 10.4614 14.2969 11.311 14.2969Z",fill:"currentColor"})});var pl={type:"text-format",format:["italic"],tag:"*"},fl={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var hl=[z([{ChildComponent:ml,isActive:({selection:t})=>Fd(t)||Ad(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(Pd,"italic")},order:2}])],Bd=M({enableFormats:["italic"],markdownTransformers:[pl,fl],toolbarFixed:{groups:hl},toolbarInline:{groups:hl}});import{$isTableSelection as Hd}from"@lexical/table";import{$isRangeSelection as Ud,FORMAT_TEXT_COMMAND as Wd}from"lexical";import{jsx as gl,jsxs as jd}from"react/jsx-runtime";import"react";var xl=()=>jd("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[gl("path",{d:"M5.50756 12.76H7.42756C7.56256 14.215 8.82256 14.71 10.1576 14.71C11.4326 14.71 12.4226 14.14 12.4226 13.06C12.4226 12.28 11.9576 11.845 10.6676 11.605L8.70256 11.245C7.12756 10.96 5.85256 10.21 5.85256 8.335C5.85256 6.43 7.53256 5.11 9.87256 5.11C12.4226 5.11 13.9526 6.22 14.1626 8.23H12.2876C12.1526 7.18 11.2226 6.595 9.88756 6.595C8.59756 6.595 7.78756 7.27 7.78756 8.215C7.78756 9.1 8.34256 9.385 9.49756 9.61L11.5676 10.015C13.3226 10.345 14.3726 11.215 14.3726 12.94C14.3726 14.89 12.5876 16.18 10.2176 16.18C7.66756 16.18 5.70256 15.115 5.50756 12.76Z",fill:"currentColor"}),gl("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var Cl={type:"text-format",format:["strikethrough"],tag:"~~"};var bl=[z([{ChildComponent:xl,isActive:({selection:t})=>Ud(t)||Hd(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(Wd,"strikethrough")},order:4}])],Gd=M({enableFormats:["strikethrough"],markdownTransformers:[Cl],toolbarFixed:{groups:bl},toolbarInline:{groups:bl}});import{$isTableSelection as Vd}from"@lexical/table";import{$isRangeSelection as Jd,FORMAT_TEXT_COMMAND as Kd}from"lexical";import{jsx as kl}from"react/jsx-runtime";import"react";var _l=()=>kl("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:kl("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 13.258C16.7768 14.155 16.1398 14.532 15.2038 15C14.5538 15.325 14.2808 15.546 14.2418 15.78H16.7898V16.82H12.7208V16.339C12.7208 15.286 13.5918 14.675 14.3588 14.233C15.0868 13.83 15.4378 13.635 15.4378 13.232C15.4378 12.894 15.2038 12.686 14.8268 12.686C14.3848 12.686 14.1248 13.024 14.1118 13.427H12.7468C12.8248 12.426 13.5528 11.633 14.8398 11.633C15.9448 11.633 16.7768 12.257 16.7768 13.258Z",fill:"currentColor"})});var Tl=[z([{ChildComponent:_l,isActive:({selection:t})=>Jd(t)||Vd(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(Kd,"subscript")},order:5}])],Xd=M({enableFormats:["subscript"],toolbarFixed:{groups:Tl},toolbarInline:{groups:Tl}});import{$isTableSelection as zd}from"@lexical/table";import{$isRangeSelection as Zd,FORMAT_TEXT_COMMAND as Yd}from"lexical";import{jsx as wl}from"react/jsx-runtime";import"react";var Sl=()=>wl("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:wl("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 7.252C16.7768 8.149 16.1398 8.526 15.2038 8.994C14.5538 9.319 14.2808 9.54 14.2418 9.774H16.7898V10.814H12.7208V10.333C12.7208 9.28 13.5918 8.669 14.3588 8.227C15.0868 7.824 15.4378 7.629 15.4378 7.226C15.4378 6.888 15.2038 6.68 14.8268 6.68C14.3848 6.68 14.1248 7.018 14.1118 7.421H12.7468C12.8248 6.42 13.5528 5.627 14.8398 5.627C15.9448 5.627 16.7768 6.251 16.7768 7.252Z",fill:"currentColor"})});var El=[z([{ChildComponent:Sl,isActive:({selection:t})=>Zd(t)||zd(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(Yd,"superscript")},order:6}])],qd=M({enableFormats:["superscript"],toolbarFixed:{groups:El},toolbarInline:{groups:El}});import{$isTableSelection as em}from"@lexical/table";import{$isRangeSelection as tm,FORMAT_TEXT_COMMAND as om}from"lexical";import{jsx as Nl,jsxs as Qd}from"react/jsx-runtime";import"react";var Ll=()=>Qd("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Nl("path",{d:"M13.9656 11.256C13.9656 13.791 12.5096 15.156 10.0006 15.156C7.50461 15.156 6.03561 13.791 6.03561 11.23V5.718H7.76461V11.243C7.76461 12.868 8.50561 13.778 10.0006 13.778C11.4956 13.778 12.2496 12.868 12.2496 11.243V5.718H13.9656V11.256Z",fill:"currentColor"}),Nl("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var yl=[z([{ChildComponent:Ll,isActive:({selection:t})=>tm(t)||em(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(om,"underline")},order:3}])],rm=M({enableFormats:["underline"],toolbarFixed:{groups:yl},toolbarInline:{groups:yl}});import{jsx as sr}from"react/jsx-runtime";import{jsx as nm}from"react/jsx-runtime";function lm(t){return t.replace(/-([a-z])/g,(e,o)=>o.toUpperCase())}var ao=({css:t})=>{let e=t?Object.fromEntries(Object.entries(t).map(([o,r])=>[lm(o),r])):{};return nm("span",{style:{...e,alignItems:"center",borderRadius:"4px",display:"flex",fontSize:"16px",height:"20px",justifyContent:"center",width:"20px"},children:"A"})};import{useLexicalComposerContext as im}from"@lexical/react/LexicalComposerContext";import{$forEachSelectedTextNode as sm}from"@lexical/selection";import{$getNodeByKey as am,$getState as cm,$setState as um,createState as dm,TextNode as mm}from"lexical";import{useEffect as pm}from"react";function Rl(t){let e=new Map;for(let o in t){let r=t[o],n=dm(o,{parse:l=>typeof l=="string"&&Object.keys(r).includes(l)?l:void 0});e.set(o,{stateConfig:n,stateValues:r})}return e}function ir(t,e,o,r){t.update(()=>{sm(n=>{let l=e.get(o);if(!l)throw new Error(`State config for ${o} not found`);um(n,l.stateConfig,r)})})}function Il({stateMap:t}){let[e]=im();return pm(()=>e.registerMutationListener(mm,o=>{e.getEditorState().read(()=>{for(let[r,n]of o){if(n==="destroyed")continue;let l=am(r),s=e.getElementByKey(r);if(!l||!s)continue;let i=Object.create(null);t.forEach((d,c)=>{let u=cm(l,d.stateConfig);if(!u){delete s.dataset[c];return}s.dataset[c]=u;let a=d.stateValues[u]?.css;a&&Object.assign(i,a)}),s.style.cssText="",Object.assign(s.style,i)}})}),[e]),null}var vl=(t,e)=>{let o=[];for(let n in t.state){let l=t.state[n];for(let s in l){let i=l[s];o.push({ChildComponent:()=>sr(ao,{css:i.css}),key:s,label:i.label,onSelect:({editor:d})=>{ir(d,e,n,s)}})}}return[{type:"dropdown",ChildComponent:()=>sr(ao,{css:{color:"var(--theme-elevation-600)"}}),items:[...[{ChildComponent:()=>sr(ao,{}),key:"clear-style",label:({i18n:n})=>n.t("lexical:textState:defaultStyle"),onSelect:({editor:n})=>{for(let l in t.state)ir(n,e,l,void 0)},order:1}],...o],key:"textState",order:30}]},fm=M(({props:t})=>{let e=Rl(t.state);return{plugins:[{Component:()=>Il({stateMap:e}),position:"normal"}],toolbarFixed:{groups:vl(t,e)},toolbarInline:{groups:vl(t,e)}}});import{c as Cm}from"react/compiler-runtime";import{useLexicalComposerContext as bm}from"@lexical/react/LexicalComposerContext";import{$createHeadingNode as km,$isHeadingNode as Vl,HeadingNode as Xl}from"@lexical/rich-text";import{$setBlocksType as _m}from"@lexical/selection";import{$getSelection as Tm,$isRangeSelection as wm}from"lexical";import{useEffect as Sm}from"react";import{jsx as Ml}from"react/jsx-runtime";import"react";var Dl=()=>Ml("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Ml("path",{d:"M4.639 13.5V7.074H6.196V9.648H9.076V7.074H10.642V13.5H9.076V10.836H6.196V13.5H4.639ZM11.5656 9.045V8.019C12.6636 8.019 13.1316 7.731 13.2846 7.065H14.4006V13.5H12.8436V9.045H11.5656Z",fill:"currentColor"})});import{jsx as $l}from"react/jsx-runtime";import"react";var Ol=()=>$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("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 Fl=()=>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 Pl}from"react/jsx-runtime";import"react";var Bl=()=>Pl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Pl("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM15.1736 7.074V10.854H16.3706V12.033H15.1736V13.5H13.6796V12.033H10.5116V10.845L13.4996 7.074H15.1736ZM13.6796 8.46L11.8256 10.854H13.6796V8.46Z",fill:"currentColor"})});import{jsx as jl}from"react/jsx-runtime";import"react";var Hl=()=>jl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:jl("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.1576 10.269C12.6896 10.269 12.3746 10.494 12.2216 10.737H10.8176L11.1956 7.074H15.2546V8.28H12.3206L12.1856 9.549C12.4016 9.351 12.8516 9.126 13.4636 9.126C14.7866 9.126 15.6596 10.053 15.6596 11.358C15.6596 12.609 14.7326 13.608 13.1756 13.608C11.5826 13.608 10.6556 12.753 10.5566 11.511H12.1136C12.1586 12.06 12.5456 12.465 13.1576 12.465C13.8236 12.465 14.1746 11.97 14.1746 11.376C14.1746 10.764 13.8416 10.269 13.1576 10.269Z",fill:"currentColor"})});import{jsx as Ul}from"react/jsx-runtime";import"react";var Wl=()=>Ul("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Ul("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.3646 8.127C12.5456 8.127 12.0416 8.937 12.0416 9.999C12.3296 9.54 12.8246 9.207 13.5536 9.207C14.8586 9.207 15.8036 10.134 15.8036 11.376C15.8036 12.645 14.8226 13.608 13.3196 13.608C11.7266 13.608 10.6196 12.393 10.6196 10.395C10.6196 8.316 11.7716 6.966 13.4186 6.966C14.7056 6.966 15.5786 7.749 15.7316 8.829H14.3186C14.2016 8.415 13.9226 8.127 13.3646 8.127ZM13.3106 12.51C13.9586 12.51 14.3816 12.042 14.3816 11.385C14.3816 10.737 13.9586 10.278 13.3106 10.278C12.6536 10.278 12.2126 10.737 12.2126 11.385C12.2126 12.042 12.6536 12.51 13.3106 12.51Z",fill:"currentColor"})});import{$createHeadingNode as hm,$isHeadingNode as gm,HeadingNode as xm}from"@lexical/rich-text";var ar=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:[xm],export:(n,l)=>{if(!gm(n))return null;let s=Number(n.getTag().slice(1));return"#".repeat(s)+" "+l(n)},regExp:r,replace:ar(n=>{let l="h"+n[1]?.length;return hm(l)})}};var Jl=t=>{let e=Tm();_m(e,()=>km(t))},Kl={h1:Dl,h2:Ol,h3:Fl,h4:Bl,h5:Hl,h6:Wl},Em=M(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[ee(e.map((r,n)=>({ChildComponent:Kl[r],isActive:({selection:l})=>{if(!wm(l))return!1;for(let s of l.getNodes()){if(Vl(s)&&s.getTag()===r)continue;let i=s.getParent();if(!(Vl(i)&&i.getTag()===r))return!1}return!0},key:r,label:({i18n:l})=>l.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:l})=>{l.update(()=>{Jl(r)})},order:n+2})))];return{markdownTransformers:[Gl(e)],nodes:[Xl],plugins:[{Component:Nm,position:"normal"}],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[X(e.map(r=>({Icon:Kl[r],key:`heading-${r.charAt(1)}`,keywords:["heading",r],label:({i18n:n})=>n.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:n})=>{n.update(()=>{Jl(r)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}}),Nm=t=>{let e=Cm(9),{clientProps:o}=t,{enabledHeadingSizes:r}=o,n;e[0]!==r?(n=r===void 0?["h1","h2","h3","h4","h5","h6"]:r,e[0]=r,e[1]=n):n=e[1];let l=n,s;e[2]!==l?(s=l.at(-1),e[2]=l,e[3]=s):s=e[3];let i=s,[d]=bm(),c,u;return e[4]!==d||e[5]!==l||e[6]!==i?(c=()=>{if(!(!i||l.length===6))return d.registerNodeTransform(Xl,a=>{l.includes(a.getTag())||a.setTag(i)})},u=[d,l,i],e[4]=d,e[5]=l,e[6]=i,e[7]=c,e[8]=u):(c=e[7],u=e[8]),Sm(c,u),null};import{$isNodeSelection as Um}from"lexical";import{jsx as zl}from"react/jsx-runtime";import"react";var cr=()=>zl("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:zl("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as Zl,jsxs as Lm}from"react/jsx-runtime";import"react";var Yl=()=>Lm("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Zl("path",{d:"M5 10h10",stroke:"currentColor"}),Zl("path",{d:"M10 15V5",stroke:"currentColor"})]});var ke=t=>({type:"dropdown",ChildComponent:Yl,items:t,key:"add",order:10});import{addClassNamesToElement as ym}from"@lexical/utils";import{$applyNodeReplacement as Rm,createCommand as Im,DecoratorNode as vm}from"lexical";var Nt=Im("INSERT_HORIZONTAL_RULE_COMMAND"),Et=class extends vm{static clone(e){return new this(e.__key)}static getType(){return"horizontalrule"}static importDOM(){return{hr:()=>({conversion:Mm,priority:0})}}static importJSON(e){return ql()}createDOM(e){let o=document.createElement("hr");return ym(o,e.theme.hr),o}decorate(){return null}exportDOM(){return{element:document.createElement("hr")}}exportJSON(){return{type:"horizontalrule",version:1}}getTextContent(){return`
55
- `}isInline(){return!1}updateDOM(){return!1}};function Mm(){return{node:ql()}}function ql(){return Rm(new Et)}import{$applyNodeReplacement as Dm}from"lexical";import"react";var _e=class extends Et{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return Qe()}decorate(){return null}exportJSON(){return super.exportJSON()}};function Qe(){return Dm(new _e)}function Lt(t){return t instanceof _e}var Ql={type:"element",dependencies:[_e],export:(t,e)=>Lt(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=Qe();e&&t.replace(e)}};import{c as $m}from"react/compiler-runtime";import{useLexicalComposerContext as Om}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Am}from"@lexical/utils";import{$getSelection as Fm,$isRangeSelection as Pm,COMMAND_PRIORITY_EDITOR as Bm}from"lexical";import{useEffect as jm}from"react";var ei=()=>{let t=$m(3),[e]=Om(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Nt,Hm,Bm),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),jm(o,r),null};function Hm(t){let e=Fm();if(!Pm(e))return!1;if(e.focus.getNode()!==null){let r=Qe();Am(r)}return!0}var Wm=M({markdownTransformers:[Ql],nodes:[_e],plugins:[{Component:ei,position:"normal"}],slashMenu:{groups:[X([{Icon:cr,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Nt,void 0)}}])]},toolbarFixed:{groups:[ke([{ChildComponent:cr,isActive:({selection:t})=>{if(!Um(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Lt(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Nt,void 0)}}])]}});import{$findMatchingParent as ui}from"@lexical/utils";import{$isElementNode as op,INDENT_CONTENT_COMMAND as rp,OUTDENT_CONTENT_COMMAND as np}from"lexical";import{jsx as co,jsxs as Gm}from"react/jsx-runtime";import"react";var ti=()=>Gm("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[co("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),co("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),co("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),co("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as uo,jsxs as Vm}from"react/jsx-runtime";import"react";var oi=()=>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:[uo("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),uo("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),uo("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),uo("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});import{jsx as Jm}from"react/jsx-runtime";import{useLexicalComposerContext as Km}from"@lexical/react/LexicalComposerContext";import{TabIndentationPlugin as Xm}from"@lexical/react/LexicalTabIndentationPlugin";import{$findMatchingParent as zm,mergeRegister as ri}from"@lexical/utils";import{$getSelection as Zm,$isElementNode as si,$isRangeSelection as Ym,COMMAND_PRIORITY_LOW as ni,INDENT_CONTENT_COMMAND as li,KEY_TAB_COMMAND as qm,OUTDENT_CONTENT_COMMAND as Qm,TabNode as ep}from"lexical";import{useEffect as ii}from"react";var ai=({clientProps:t})=>{let[e]=Km(),{disabledNodes:o,disableTabNode:r}=t;return ii(()=>{if(!(!e||!o?.length))return ri(e.registerCommand(li,()=>tp(n=>{if(!o.includes(n.getType())){let l=n.getIndent();n.setIndent(l+1)}}),ni),e.registerUpdateListener(({dirtyElements:n,editorState:l})=>{e.update(()=>{for(let[s]of n){let i=l._nodeMap.get(s);si(i)&&o.includes(i.getType())&&i.getIndent()>0&&i.setIndent(0)}})}))},[e,o]),ii(()=>{if(!(!e||!r))return ri(e.registerCommand(qm,n=>(n.preventDefault(),e.dispatchCommand(n.shiftKey?Qm:li,void 0)),ni),e.registerNodeTransform(ep,n=>{n.remove()}))},[e,r]),Jm(Xm,{})};function tp(t){let e=Zm();if(!Ym(e))return!1;let o=new Set,r=e.getNodes();for(let n=0;n<r.length;n++){let l=r[n],s=l.getKey();if(o.has(s))continue;let i=zm(l,c=>si(c)&&!c.isInline());if(i===null)continue;let d=i.getKey();i.canIndent()&&!o.has(d)&&(o.add(d),t(i))}return o.size>0}var ci=t=>({type:"buttons",items:t,key:"indent",order:35});var di=({disabledNodes:t})=>[ci([{ChildComponent:ti,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>mi(n)&&n.getIndent()>0;return o.some(n=>r(n)||!!ui(n,r))},key:"indentDecrease",label:({i18n:e})=>e.t("lexical:indent:decreaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(np,void 0)},order:1},{ChildComponent:oi,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>mi(n)&&!(t??[]).includes(n.getType());return o.some(n=>r(n)||!!ui(n,r))},key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(rp,void 0)},order:2}])],lp=M(({props:t})=>{let e=t.disabledNodes??[];return{plugins:[{Component:ai,position:"normal"}],sanitizedClientFeatureProps:t,toolbarFixed:{groups:di({disabledNodes:e})},toolbarInline:{groups:di({disabledNodes:e})}}}),mi=t=>op(t)&&t.canIndent();import{$findMatchingParent as Tf}from"@lexical/utils";import{$getSelection as br,$isRangeSelection as Gi}from"lexical";import{jsx as pi}from"react/jsx-runtime";import"react";var fi=()=>pi("svg",{"aria-hidden":"true",className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:pi("path",{d:"M8.5 11.5L11.5 8.5M8.5 7L9.625 5.875C10.868 4.633 12.882 4.633 14.125 5.875C15.368 7.118 15.368 9.133 14.125 10.375L13 11.5M7 8.5L5.746 9.754C4.56 10.94 4.519 12.85 5.652 14.087C6.814 15.354 8.78 15.449 10.058 14.298L11.5 13",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})});import{$isAtNodeEnd as hi}from"@lexical/selection";function et(t){let{anchor:e}=t,{focus:o}=t,r=t.anchor.getNode(),n=t.focus.getNode();return r===n?r:t.isBackward()?hi(o)?r:n:hi(e)?r:n}var ur=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as Cp}from"lexical";function dr(t){let e=/^(?:(?:https?|mailto|ftp|tel|file|sms):|[^&:/?#]*(?:[/?#]|$))/gi,o=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z\d+/]+=*$/i;return t=String(t).trim(),t.match(e)!=null||t.match(o)!=null?t:"https://"}var ip=/^(?:[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+)?$/,sp=/^(?:\/[\w\-./]*(?:\?[-;&=%\w]*)?(?:#[\w-]+)?|#[\w\-]+)$/;function gi(t){if(!t||t.includes(" ")||/^[a-z][a-z\d+.-]*:\/[^/]/i.test(t))return!1;if(t==="https://"||ip.test(t)||sp.test(t))return!0;try{let e=new URL(t);return!(["ftp:","http:","https:"].includes(e.protocol)&&!e.hostname.includes("."))}catch{}return!1}import{addClassNamesToElement as ap,isHTMLAnchorElement as cp}from"@lexical/utils";import fr from"bson-objectid";import{$applyNodeReplacement as up,$createTextNode as xi,$getSelection as dp,$isElementNode as Ci,$isRangeSelection as pr,createCommand as mp,ElementNode as pp}from"lexical";var fp=new Set(["http:","https:","mailto:","sms:","tel:"]),te=class extends pp{__fields;__id;constructor({id:e,fields:o={linkType:"custom",newTab:!1},key:r}){super(r),this.__fields=o,this.__id=e}static clone(e){return new this({id:e.__id,fields:e.__fields,key:e.__key})}static getType(){return"link"}static importDOM(){return{a:e=>({conversion:hp,priority:1})}}static importJSON(e){let o=Te({}).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 fr.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=mr(o.rel,"add","noopener")),ap(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(!pr(o))return!1;let n=o.anchor.getNode(),l=o.focus.getNode();return this.isParentOf(n)&&this.isParentOf(l)&&o.getTextContent().length>0}getFields(){return this.getLatest().__fields}getID(){return this.getLatest().__id}insertNewAfter(e,o=!0){let r=this.getParentOrThrow().insertNewAfter(e,o);if(Ci(r)){let n=Te({fields:this.__fields});return r.append(n),n}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!fp.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=mr(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=mr(o.rel,"remove","noopener"))),!1}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields).setID(e.id)}};function hp(t){let e=null;if(cp(t)){let o=t.textContent;o!==null&&o!==""&&(e=Te({id:new fr.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function Te({id:t,fields:e}){return up(new te({id:t??new fr.default().toHexString(),fields:e}))}function J(t){return t instanceof te}var de=mp("TOGGLE_LINK_COMMAND");function hr(t){let e=dp();if(!pr(e)&&(t===null||!t.selectedNodes?.length))return;let o=pr(e)?e.extract():t===null?[]:t.selectedNodes;if(t===null){o?.forEach(l=>{let s=l.getParent();J(s)&&(s.getChildren().forEach(d=>{s.insertBefore(d)}),s.remove())});return}if(o?.length===1){let l=o[0],s=J(l)?l:gp(l);if(s!==null){s.setFields(t.fields),t.text!=null&&t.text!==s.getTextContent()&&(s.append(xi(t.text)),s.getChildren().forEach(i=>{i!==s.getLastChild()&&i.remove()}));return}}let r=null,n=null;o?.forEach(l=>{let s=l.getParent();if(!(s===n||s===null||Ci(l)&&!l.isInline())){if(J(s)){n=s,s.setFields(t.fields),t.text!=null&&t.text!==s.getTextContent()&&(s.append(xi(t.text)),s.getChildren().forEach(i=>{i!==s.getLastChild()&&i.remove()}));return}if(s.is(r)||(r=s,n=Te({fields:t.fields}),J(s)?l.getPreviousSibling()===null?s.insertBefore(n):s.insertAfter(n):l.insertBefore(n)),J(l)){if(l.is(n))return;if(n!==null){let i=l.getChildren();n.append(...i)}l.remove();return}n!==null&&n.append(l)}})}function gp(t){return xp(t,e=>J(e))}function xp(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function mr(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 bp=(t,e)=>{let[,o,r]=e,n=Te({fields:{doc:null,linkType:"custom",newTab:!1,url:r}}),l=Cp(o);return l.setFormat(t.getFormat()),n.append(l),t.replace(n),l},kp=t=>({type:"text-match",dependencies:[te],export:(e,o)=>{if(!J(e))return null;let r=e,n=r.getFields(),l;return n.linkType==="internal"?t?.internalDocToHref?l=dr(t.internalDocToHref({linkNode:r.exportJSON()})):(console.warn("Lexical \u2192 Markdown converter: found internal link but internalDocToHref is not provided \u2014 link will have an empty href"),l=""):l=dr(n.url??""),`[${o(r)}](${l})`},importRegExp:/(?<!!)\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/(?<!!)\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:bp,trigger:")"}),bi=kp();import{$applyNodeReplacement as _p,$isElementNode as Tp}from"lexical";var we=class extends te{static clone(e){return new this({id:"",fields:e.__fields,key:e.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(e){let o=yt({}).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(Tp(r)){let n=yt({fields:this.__fields});return r.append(n),n}return null}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields)}};function yt({fields:t}){return _p(new we({id:"",fields:t}))}function Se(t){return t instanceof we}import{c as wp}from"react/compiler-runtime";import{useLexicalComposerContext as Sp}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Ep}from"@lexical/utils";import{$createTextNode as ki,$getSelection as Np,$isElementNode as Ti,$isLineBreakNode as wi,$isNodeSelection as Lp,$isRangeSelection as yp,$isTextNode as Rt,TextNode as Rp}from"lexical";import{useEffect as Ip}from"react";function _i(t,e=o=>o){return o=>{let r=t.exec(o);return r===null?null:{index:r.index,length:r[0].length,text:r[0],url:e(r[0])}}}function Si(t,e){for(let o of e){let r=o(t);if(r!=null)return r}return null}var vp=/[.,;\s]/;function po(t){return t!==void 0&&vp.test(t)}function Ei(t){return po(t[t.length-1])}function xr(t){return po(t[0])}function Mp(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function Ni(t){let e=t.getPreviousSibling();return Ti(e)&&(e=e.getLastDescendant()),e===null||wi(e)||Rt(e)&&Ei(e.getTextContent())}function Li(t){let e=t.getNextSibling();return Ti(e)&&(e=e.getFirstDescendant()),e===null||wi(e)||Rt(e)&&xr(e.getTextContent())}function Dp(t,e,o,r){return(t>0?po(o[t-1]):Ni(r[0]))?e<o.length?po(o[e]):Li(r[r.length-1]):!1}function $p(t,e,o){let r=[],n=[],l=[],s=0,i=0,d=[...t];for(;d.length>0;){let c=d[0],a=c.getTextContent().length,m=i;i+a<=e?(r.push(c),s+=a):m>=o?l.push(c):n.push(c),i+=a,d.shift()}return[s,r,n,l]}function Op(t,e,o,r){let n={linkType:"custom",url:r.url,...r.fields},l=yt({fields:n});if(t.length===1){let s=t[0],i;if(e===0?[i]=s.splitText(o):[,i]=s.splitText(e,o),i){let d=ki(r.text);d.setFormat(i.getFormat()),d.setDetail(i.getDetail()),d.setStyle(i.getStyle()),l.append(d),i.replace(l)}return s}else if(t.length>1){let s=t[0],i=s.getTextContent().length,d;e===0?d=s:[,d]=s.splitText(e);let c=[],u;if(t.forEach(a=>{let p=a.getTextContent().length,h=i,f=i+p;if(h<o)if(f<=o)c.push(a);else{let[g,k]=a.splitText(o-h);g&&c.push(g),u=k}i+=p}),d){let a=Np(),m=a?a.getNodes().find(Rt):void 0,p=ki(d.getTextContent());return p.setFormat(d.getFormat()),p.setDetail(d.getDetail()),p.setStyle(d.getStyle()),l.append(p,...c),m&&m===d&&(yp(a)?p.select(a.anchor.offset,a.focus.offset):Lp(a)&&p.select(0,p.getTextContent().length)),d.replace(l),u}}}function Ap(t,e,o){let r=[...t],n=r.map(d=>d.getTextContent()).join(""),l=n,s,i=0;for(;(s=Si(l,e))!=null&&s!==null;){let d=s.index,c=s.length,u=d+c;if(Dp(i+d,i+u,n,r)){let[m,,p,h]=$p(r,i+d,i+u),f=i+d-m,g=i+u-m,k=Op(p,f,g,s);r=k?[k,...h]:h,o(s.url,null),i=0}else i+=u;l=l.substring(u)}}function gr(t,e,o){let r=t.getChildren(),n=r.length;for(let d=0;d<n;d++){let c=r[d];if(!Rt(c)||!c.isSimpleText()){mo(t),o(null,t.getFields()?.url??null);return}}let l=t.getTextContent(),s=Si(l,e);if(s===null||s.text!==l){mo(t),o(null,t.getFields()?.url??null);return}if(!Ni(t)||!Li(t)){mo(t),o(null,t.getFields()?.url??null);return}let i=t.getFields()?.url;if(i!==s?.url){let d=t.getFields();d.url=s?.url,t.setFields(d),o(s.url,i??null)}}function Fp(t,e,o){let r=t.getPreviousSibling(),n=t.getNextSibling(),l=t.getTextContent();if(Se(r)){let s=r.getFields()?.url?r.getFields()?.url?.startsWith("mailto:")??!1:!1;(!xr(l)||Mp(l,s))&&(r.append(t),gr(r,e,o),o(null,r.getFields()?.url??null))}Se(n)&&!Ei(l)&&(mo(n),gr(n,e,o),o(null,n.getFields()?.url??null))}function mo(t){let e=t.getChildren(),o=e.length;for(let r=o-1;r>=0;r--)t.insertAfter(e[r]);return t.remove(),e.map(r=>r.getLatest())}function Pp(t){let e=[t],o=t.getNextSibling();for(;o!==null&&Rt(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function Bp(t,e,o){let r=wp(5),n,l;r[0]!==t||r[1]!==e||r[2]!==o?(n=()=>{if(!t.hasNodes([we]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let s=(i,d)=>{o?.(i,d)};return Ep(t.registerNodeTransform(Rp,i=>{let d=i.getParentOrThrow(),c=i.getPreviousSibling();if(Se(d))gr(d,e,s);else if(!J(d)){if(i.isSimpleText()&&(xr(i.getTextContent())||!Se(c))){let u=Pp(i);Ap(u,e,s)}Fp(i,e,s)}}))},l=[t,e,o],r[0]=t,r[1]=e,r[2]=o,r[3]=n,r[4]=l):(n=r[3],l=r[4]),Ip(n,l)}var jp=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,Hp=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,Up=[_i(jp,t=>t.startsWith("http")?t:`https://${t}`),_i(Hp,t=>`mailto:${t}`)],yi=()=>{let[t]=Sp();return Bp(t,Up),null};import{jsx as Wp}from"react/jsx-runtime";import{ClickableLinkPlugin as Gp}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var Ri=()=>Wp(Gp,{});import{jsx as df}from"react/jsx-runtime";import"react";import{createPortal as mf}from"react-dom";import{jsx as Ee,jsxs as It,Fragment as Jp}from"react/jsx-runtime";import{useLexicalComposerContext as Kp}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as Xp}from"@lexical/react/useLexicalEditable";import{$findMatchingParent as Ii,mergeRegister as vi}from"@lexical/utils";import{getTranslation as Cr}from"@payloadcms/translations";import{CloseMenuIcon as zp,EditIcon as Zp,ExternalLinkIcon as Mi,formatDrawerSlug as Yp,useConfig as qp,useEditDepth as Qp,useLocale as ef,useTranslation as tf}from"@payloadcms/ui";import{requests as of}from"@payloadcms/ui/shared";import{$getSelection as Di,$isLineBreakNode as rf,$isRangeSelection as $i,COMMAND_PRIORITY_HIGH as nf,COMMAND_PRIORITY_LOW as Oi,getDOMSelection as lf,KEY_ESCAPE_COMMAND as sf,SELECTION_CHANGE_COMMAND as af}from"lexical";import{formatAdminURL as cf}from"payload/shared";import Ai,{useCallback as Fi,useEffect as go,useLayoutEffect as uf,useRef as Pi,useState as je}from"react";function fo(t,e,o,r=10,n=5){let l=o.parentElement;if(t===null||l==null){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let s=o.getBoundingClientRect(),i=l.getBoundingClientRect(),d=t.top-r,c=t.left-n;e.style.width="max-content",e.style.maxWidth="none";let u=e.scrollWidth,a=i.right-c,m=c-i.left,p;if(u<=a)p=e.getBoundingClientRect();else{let h=m+t.width,f=m>a,k=Math.min(u,f?h:a);k<u&&(e.style.width=`${k}px`,e.style.maxWidth=`${k}px`,e.offsetHeight),f&&(c=t.right-k),p=e.getBoundingClientRect()}d<i.top&&(d+=p.height+t.height+r*2),c+p.width>i.right&&(c=i.right-p.width-n),d-=s.top,c-=s.left,e.style.opacity="1",e.style.transform=`translate(${c}px, ${d}px)`}import{createCommand as Vp}from"lexical";var ho=Vp("TOGGLE_LINK_WITH_MODAL_COMMAND");function Bi(t){t.preventDefault()}function ji({anchorElem:t}){let[e]=Kp(),[o,r]=je(),n=Pi(null),l=Pi(null),[s,i]=je(null),[d,c]=je(null),{fieldProps:{schemaPath:u},uuid:a}=U(),m=Xp(),{config:p,getEntityConfig:h}=qp(),{i18n:f,t:g}=tf(),[k,N]=je(),R=Qp(),[T,C]=je(!1),[x,b]=je([]),_=ef(),[D,I]=je(!1),y=Yp({slug:"lexical-rich-text-link-"+a,depth:R}),{toggleDrawer:S}=xe(y),w=Fi(()=>{C(!1),n&&n.current&&(n.current.style.opacity="0",n.current.style.transform="translate(-10000px, -10000px)"),I(!1),i(null),c(null),b([]),N(void 0)},[C,i,c,b]),L=Fi(()=>{let E=Di(),v;if(!$i(E)||!E){w();return}let $=et(E);v=e.getElementByKey($.getKey())?.getBoundingClientRect();let O=Ii($,J),F=E.getNodes().filter(re=>!rf(re)).find(re=>{let ge=Ii(re,J);return O&&!O.is(ge)||ge&&!ge.is(O)});if(O==null||F){w();return}r(O);let P=O.getFields(),Z={...P,id:O.getID(),text:O.getTextContent()};if(P?.linkType==="custom")i(P?.url??null),c(null);else{i(`${p.routes.admin==="/"?"":p.routes.admin}/collections/${P?.doc?.relationTo}/${P?.doc?.value}`);let re=P?.doc?.relationTo?h({collectionSlug:P?.doc?.relationTo}):void 0;if(!re)c(P?.label?String(P?.label):null),i(P?.url?String(P?.url):null);else{let ge=typeof P.doc?.value=="object"?P.doc.value.id:P.doc?.value,Vt=P.doc?.relationTo;if(!ge||!Vt)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let sn=g("fields:linkedTo",{label:`${Cr(re.labels.singular,f)} - ${g("lexical:link:loadingWithEllipsis",f)}`}).replace(/<[^>]*>?/g,"");c(sn),of.get(cf({apiRoute:p.routes.api,path:`/${Vt}/${ge}`,serverURL:p.serverURL}),{headers:{"Accept-Language":f.language},params:{depth:0,locale:_?.code}}).then(async se=>{if(!se.ok)throw new Error(`HTTP error! Status: ${se.status}`);let q=await se.json(),pt=re?.admin?.useAsTitle||"id",Ie=q[pt],ft=g("fields:linkedTo",{label:`${Cr(re.labels.singular,f)} - ${Ie}`}).replace(/<[^>]*>?/g,"");c(ft)}).catch(()=>{let se=g("fields:linkedTo",{label:`${Cr(re.labels.singular,f)} - ${g("general:untitled",f)} - ID: ${ge}`}).replace(/<[^>]*>?/g,"");c(se)})}}N(Z),C(!0),b(E?E?.getNodes():[]),Se(O)?I(!0):I(!1);let K=n.current,Ve=lf(e._window),{activeElement:Re}=document;if(K===null)return;let he=e.getRootElement();return Ve!==null&&he!==null&&he.contains(Ve.anchorNode)?(v||(v=Ve.getRangeAt(0).getBoundingClientRect()),v!=null&&(v.y+=40,l.current=v)):(Re==null||Re.className!=="link-input")&&(he!==null&&fo(null,K,t),i(null),c(null)),!0},[e,w,p.routes.admin,p.routes.api,p.serverURL,h,g,f,_?.code,t]);return go(()=>vi(e.registerCommand(ho,E=>(e.dispatchCommand(de,E),L(),S(),!0),Oi)),[e,L,S,y]),go(()=>{let E=t.parentElement,v=()=>{e.getEditorState().read(()=>{L()})};return window.addEventListener("resize",v),E?.addEventListener("scroll",v),()=>{window.removeEventListener("resize",v),E?.removeEventListener("scroll",v)}},[t.parentElement,e,L]),go(()=>vi(e.registerUpdateListener(({editorState:E})=>{E.read(()=>{L()})}),e.registerCommand(af,()=>(L(),!0),Oi),e.registerCommand(sf,()=>T?(w(),!0):!1,nf)),[e,L,T,w]),go(()=>{e.getEditorState().read(()=>{L()})},[e,L]),uf(()=>{!T||!n.current||!t||!l.current||fo(l.current,n.current,t)},[s,d,T,t,o]),It(Ai.Fragment,{children:[Ee("div",{className:"link-editor",ref:n,children:It("div",{className:"link-input",children:[s&&s.length>0?It("a",{href:s,rel:"noopener noreferrer",target:"_blank",children:[o?.__fields.newTab?Ee(Mi,{}):null,d!=null&&d.length>0?d:s]}):d!=null&&d.length>0?It(Jp,{children:[o?.__fields.newTab?Ee(Mi,{}):null,Ee("span",{className:"link-input__label-pure",children:d})]}):null,m&&It(Ai.Fragment,{children:[Ee("button",{"aria-label":"Edit link",className:"link-edit",onClick:E=>{E.preventDefault(),S()},onMouseDown:Bi,tabIndex:0,type:"button",children:Ee(Zp,{})}),!D&&Ee("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(de,null)},onMouseDown:Bi,tabIndex:0,type:"button",children:Ee(zp,{})})]})]})}),Ee(Ct,{className:"lexical-link-edit-drawer",data:k,drawerSlug:y,drawerTitle:g("fields:editLink"),featureKey:"link",handleDrawerSubmit:(E,v)=>{let $=v,O={...$};delete O.text,e.update(()=>{let F=Di(),P=null;if($i(F)?P=et(F).getParent():x.length&&(P=x[0]?.getParent()??null),P&&Se(P)){let Z=Te({fields:O});P.replace(Z,!0)}}),e.dispatchCommand(de,{fields:O,selectedNodes:x,text:$.text})},schemaPath:u,schemaPathSuffix:"fields"})]})}var Hi=t=>{let{anchorElem:e=document.body}=t;return mf(df(ji,{anchorElem:e}),e)};import{c as pf}from"react/compiler-runtime";import{useLexicalComposerContext as ff}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as hf}from"@lexical/utils";import{$getSelection as gf,$isElementNode as xf,$isRangeSelection as Cf,COMMAND_PRIORITY_LOW as Ui,PASTE_COMMAND as bf}from"lexical";import{useEffect as kf}from"react";var Wi=t=>{let e=pf(5),{clientProps:o}=t,[r]=ff(),n,l;return e[0]!==o.defaultLinkType||e[1]!==o.defaultLinkURL||e[2]!==r?(n=()=>{if(!r.hasNodes([te]))throw new Error("LinkPlugin: LinkNode not registered on editor");return hf(r.registerCommand(de,s=>s===null?(hr(null),!0):(s.fields?.linkType||(s.fields.linkType=o.defaultLinkType),s.fields?.url||(s.fields.url=o.defaultLinkURL),hr(s),!0),Ui),r.registerCommand(bf,s=>{let i=gf();if(!Cf(i)||i.isCollapsed()||!(s instanceof ClipboardEvent)||s.clipboardData==null)return!1;let d=s.clipboardData.getData("text");if(!gi(d))return!1;if(!i.getNodes().some(_f)){let c={doc:null,linkType:"custom",newTab:!1,url:d};return r.dispatchCommand(de,{fields:c,text:null}),s.preventDefault(),!0}return!1},Ui))},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]),kf(n,l),null};function _f(t){return xf(t)}var Vi=[ur([{ChildComponent:fi,isActive:({selection:t})=>{if(Gi(t)){let e=et(t);return Tf(e,J)!=null}return!1},isEnabled:({selection:t})=>!!(Gi(t)&&br()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(de,null);else{let o,r=[];if(t.getEditorState().read(()=>{o=br()?.getTextContent(),r=br()?.getNodes()??[]}),!o?.length)return;let n={doc:null};t.dispatchCommand(ho,{fields:n,selectedNodes:r,text:o})}},order:1}])],wf=M(({props:t})=>({markdownTransformers:[bi],nodes:[te,t?.disableAutoLinks===!0?null:we].filter(Boolean),plugins:[{Component:Wi,position:"normal"},t?.disableAutoLinks===!0||t?.disableAutoLinks==="creationOnly"?null:{Component:yi,position:"normal"},{Component:Ri,position:"normal"},{Component:Hi,position:"floatingAnchorElem"}].filter(Boolean),sanitizedClientFeatureProps:t,toolbarFixed:{groups:Vi},toolbarInline:{groups:Vi}}));import{$isListNode as Tr,INSERT_CHECK_LIST_COMMAND as Yi,ListItemNode as Of,ListNode as Af}from"@lexical/list";import{$isRangeSelection as Ff}from"lexical";import{jsx as Ji,jsxs as Sf}from"react/jsx-runtime";import"react";var kr=()=>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:[Ji("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),Ji("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Ef}from"react/jsx-runtime";import{ListPlugin as Nf}from"@lexical/react/LexicalListPlugin.js";import"react";var tt=()=>Ef(Nf,{});function xo(t,e){return t==="ordered"?!e.has("unorderedList"):t==="checklist"?!e.has("unorderedList")&&!e.has("orderedList"):!1}function ot(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as If,ListItemNode as vf,ListNode as Mf}from"@lexical/list";import{$createListItemNode as Lf,$createListNode as yf,$isListItemNode as Rf,$isListNode as _r}from"@lexical/list";var Ki=4,rt=t=>(e,o,r)=>{let n=e.getPreviousSibling(),l=e.getNextSibling(),s=Lf(t==="check"?r[3]==="x":void 0);if(_r(l)&&l.getListType()===t){let d=l.getFirstChild();d!==null?d.insertBefore(s):l.append(s),e.remove()}else if(_r(n)&&n.getListType()===t)n.append(s),e.remove();else{let d=yf(t,t==="number"?Number(r[2]):void 0);d.append(s),e.replace(d)}s.append(...o),s.select(0,0);let i=Math.floor(r[1].length/Ki);i&&s.setIndent(i)},He=(t,e,o)=>{let r=[],n=t.getChildren(),l=0;for(let s of n)if(Rf(s)){if(s.getChildrenSize()===1){let u=s.getFirstChild();if(_r(u)){r.push(He(u,e,o+1));continue}}let i=" ".repeat(o*Ki),d=t.getListType(),c=d==="number"?`${t.getStart()+l}. `:d==="check"?`- [${s.getChecked()?"x":" "}] `:"- ";r.push(i+c+e(s)),l++}return r.join(`
56
- `)};var Xi={type:"element",dependencies:[Mf,vf],export:(t,e)=>If(t)?He(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:rt("check")};import{jsx as Df}from"react/jsx-runtime";import{CheckListPlugin as $f}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var zi=()=>Df($f,{});var Zi=[ee([{ChildComponent:kr,isActive:({selection:t})=>{if(!Ff(t))return!1;for(let e of t.getNodes()){if(Tr(e)&&e.getListType()==="check")continue;let o=e.getParent();if(Tr(o)&&o.getListType()==="check")continue;let r=o?.getParent();if(!(Tr(r)&&r.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(Yi,void 0)},order:12}])],Pf=M(({featureProviderMap:t})=>{let e=[{Component:zi,position:"normal"}],o=xo("checklist",t);return o&&e.push({Component:tt,position:"normal"}),{markdownTransformers:[Xi],nodes:o?[Af,Of]:[],plugins:e,slashMenu:{groups:[ot([{Icon:kr,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:r})=>r.t("lexical:checklist:label"),onSelect:({editor:r})=>{r.dispatchCommand(Yi,void 0)}}])]},toolbarFixed:{groups:Zi},toolbarInline:{groups:Zi}}});import{$isListNode as Sr,INSERT_ORDERED_LIST_COMMAND as es,ListItemNode as Wf,ListNode as Gf}from"@lexical/list";import{$isRangeSelection as Vf}from"lexical";import{jsx as vt,jsxs as Bf}from"react/jsx-runtime";import"react";var wr=()=>Bf("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[vt("path",{d:"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"}),vt("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"}),vt("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),vt("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),vt("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as jf,ListItemNode as Hf,ListNode as Uf}from"@lexical/list";var qi={type:"element",dependencies:[Uf,Hf],export:(t,e)=>jf(t)?He(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:rt("number")};var Qi=[ee([{ChildComponent:wr,isActive:({selection:t})=>{if(!Vf(t))return!1;for(let e of t.getNodes()){if(Sr(e)&&e.getListType()==="number")continue;let o=e.getParent();if(Sr(o)&&o.getListType()==="number")continue;let r=o?.getParent();if(!(Sr(r)&&r.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(es,void 0)},order:10}])],Jf=M(({featureProviderMap:t})=>{let e=xo("ordered",t);return{markdownTransformers:[qi],nodes:e?[Gf,Wf]:[],plugins:e?[{Component:tt,position:"normal"}]:[],slashMenu:{groups:[ot([{Icon:wr,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:o})=>o.t("lexical:orderedList:label"),onSelect:({editor:o})=>{o.dispatchCommand(es,void 0)}}])]},toolbarFixed:{groups:Qi},toolbarInline:{groups:Qi}}});import{$isListNode as Nr,INSERT_UNORDERED_LIST_COMMAND as rs,ListItemNode as Yf,ListNode as qf}from"@lexical/list";import{$isRangeSelection as Qf}from"lexical";import{jsx as nt,jsxs as Kf}from"react/jsx-runtime";import"react";var Er=()=>Kf("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:[nt("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),nt("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),nt("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),nt("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),nt("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),nt("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Xf,ListItemNode as zf,ListNode as Zf}from"@lexical/list";var ts={type:"element",dependencies:[Zf,zf],export:(t,e)=>Xf(t)?He(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:rt("bullet")};var os=[ee([{ChildComponent:Er,isActive:({selection:t})=>{if(!Qf(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(rs,void 0)},order:11}])],e0=M({markdownTransformers:[ts],nodes:[qf,Yf],plugins:[{Component:tt,position:"normal"}],slashMenu:{groups:[ot([{Icon:Er,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(rs,void 0)}}])]},toolbarFixed:{groups:os},toolbarInline:{groups:os}});import{jsx as t0}from"react/jsx-runtime";import{addClassNamesToElement as o0}from"@lexical/utils";import{$applyNodeReplacement as r0,DecoratorNode as n0}from"lexical";import*as ns from"react";var l0=ns.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),Mt=class extends n0{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new this({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return i0({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return o0(o,"unknownConverted"),o}decorate(){return t0(l0,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function i0({data:t}){return r0(new Mt({data:t}))}var s0=M(()=>({nodes:[Mt]}));import{jsx as a0}from"react/jsx-runtime";import{addClassNamesToElement as c0}from"@lexical/utils";import{$applyNodeReplacement as u0,DecoratorNode as d0}from"lexical";import*as ls from"react";var m0=ls.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),Dt=class extends d0{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new this({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return p0({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return c0(o,"unknownConverted"),o}decorate(){return a0(m0,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function p0({data:t}){return u0(new Dt({data:t}))}var f0=M(()=>({nodes:[Dt]}));import{$setBlocksType as as}from"@lexical/selection";import{$createParagraphNode as cs,$getSelection as us,$isParagraphNode as is,$isRangeSelection as h0}from"lexical";var ss=[ee([{ChildComponent:_t,isActive:({selection:t})=>{if(!h0(t))return!1;for(let e of t.getNodes())if(!is(e)&&!is(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=us();as(e,()=>cs())})},order:1}])],g0=M({slashMenu:{groups:[X([{Icon:_t,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=us();as(e,()=>cs())})}}])]},toolbarFixed:{groups:ss},toolbarInline:{groups:ss}});import{c as B0}from"react/compiler-runtime";import{jsx as Is}from"react/jsx-runtime";import{useLexicalComposerContext as j0}from"@lexical/react/LexicalComposerContext";import{useEffect as H0,useState as U0}from"react";import{jsx as Rs,Fragment as P0}from"react/jsx-runtime";import"react";import{jsx as x0}from"react/jsx-runtime";var ds={quote:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return x0("blockquote",{children:o})}};import{jsx as C0}from"react/jsx-runtime";var ms={heading:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.tag;return C0(r,{children:o})}};import{jsx as b0}from"react/jsx-runtime";var ps={horizontalrule:b0("hr",{})};import{jsx as k0}from"react/jsx-runtime";var fs={linebreak:k0("br",{})};import{jsx as hs}from"react/jsx-runtime";var gs=({internalDocToHref:t})=>({autolink:({node:e,nodesToJSX:o})=>{let r=o({nodes:e.children}),n=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0;return hs("a",{href:e.fields.url,rel:n,target:l,children:r})},link:({node:e,nodesToJSX:o})=>{let r=o({nodes:e.children}),n=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0,s=e.fields.url??"";return e.fields.linkType==="internal"&&(t?s=t({linkNode:e}):(console.error("Lexical => JSX converter: Link converter: found internal link, but internalDocToHref is not provided"),s="#")),hs("a",{href:s,rel:n,target:l,children:r})}});import{jsx as lt,jsxs as _0,Fragment as T0}from"react/jsx-runtime";import{v4 as w0}from"uuid";var xs={list:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.tag;return lt(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=w0();return lt("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:_0(T0,{children:[lt("input",{checked:t.checked,id:l,readOnly:!0,type:"checkbox"}),lt("label",{htmlFor:l,children:n}),lt("br",{})]})})}else return lt("li",{className:`${r?"nestedListItem":""}`,style:r?{listStyleType:"none"}:void 0,value:t?.value,children:n})}};import{jsx as Lr}from"react/jsx-runtime";var Cs={paragraph:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return o?.length?Lr("p",{children:o}):Lr("p",{children:Lr("br",{})})}};var bs={tab:" "};import{jsx as $t}from"react/jsx-runtime";var ks={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"},s=t.colSpan&&t.colSpan>1?t.colSpan:void 0,i=t.rowSpan&&t.rowSpan>1?t.rowSpan:void 0;return $t(r,{className:`lexical-table-cell ${n}`,colSpan:s,rowSpan:i,style:l,children:o})},tablerow:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return $t("tr",{className:"lexical-table-row",children:o})}};import{jsx as Ue}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},S0=A.IS_BOLD|A.IS_ITALIC|A.IS_STRIKETHROUGH|A.IS_UNDERLINE|A.IS_CODE|A.IS_SUBSCRIPT|A.IS_SUPERSCRIPT|A.IS_HIGHLIGHT,E0="\xA0",N0=`
54
+ `},[t,e]),f=Be((T,C)=>{o(x=>{let b=e.length-1,_=e[b];if(_&&_.name===T){if(T==="type")return[...e.slice(0,b),{..._,value:_.value+C}];if(_.value===C)return[...e.slice(0,b),{..._,count:_.count+1}]}return[...x,{name:T,count:1,value:C}]})},[e,o]);Hr(()=>{let T=x=>{if(!n)return;let b=x.key;Cd(x)?f("selectAll",""):Gr.has(b)?f("press",x.key):[...b].length>1?f("keydown",x.key):f("type",x.key)},C=x=>{if(!n)return;let b=x.key;!Gr.has(b)&&[...b].length>1&&f("keyup",x.key)};return t.registerRootListener((x,b)=>{b!==null&&(b.removeEventListener("keydown",T),b.removeEventListener("keyup",C)),x!==null&&(x.addEventListener("keydown",T),x.addEventListener("keyup",C))})},[t,n,f]),Hr(()=>{u.current&&u.current.scrollTo(0,u.current.scrollHeight)},[m]),zo(()=>{if(e){let T=m();T!==null&&i(T),u.current&&u.current.scrollTo(0,u.current.scrollHeight)}},[m,e]),zo(()=>t.registerUpdateListener(({dirtyElements:C,dirtyLeaves:x,editorState:b})=>{if(!n)return;let _=b._selection,M=d.current,v=c.current;if(M!==_){if(x.size===0&&C.size===0&&!v){let S=Wo(t._window);if(S&&(S.anchorNode==null||S.focusNode==null))return}d.current=_}c.current=!1;let y=m();y!==null&&i(y)}),[t,m,n,f]),zo(()=>n?t.registerUpdateListener(()=>{let C=t.getRootElement();C!==null&&l(C?.innerHTML)}):void 0,[t,n]);let h=Be(T=>{n||(T.update(()=>{let C=pd();C.clear();let x=fd();C.append(md().append(x)),x.select()}),o([])),r(C=>!C)},[n]),p=Be(()=>{if(!n)return;let T=Wo(t._window);if(T===null||T.anchorNode==null||T.focusNode==null)return;let{anchorNode:C,anchorOffset:x,focusNode:b,focusOffset:_}=bd(T),M=a().getRootElement(),v;C!==null&&(v=Ur(C,M));let y;b!==null&&(y=Ur(b,M)),f("snapshot",{anchorNode:C,anchorOffset:x,anchorPath:v,focusNode:b,focusOffset:_,focusPath:y})},[f,n,a]),g=Be(()=>{hd(m())},[m]),k=Be(()=>{gd("test.js",m())},[m]);return[Pe("button",{className:`editor-dev-button ${n?"active":""}`,id:"test-recorder-button",onClick:T=>{h(a()),T.preventDefault()},title:n?"Disable test recorder":"Enable test recorder",type:"button",children:n?"Disable test recorder":"Enable test recorder"}),n?Jo("div",{className:"test-recorder-output",children:[Jo("div",{className:"test-recorder-toolbar",children:[Pe("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:T=>{p(),T.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),Pe("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:T=>{g(),T.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),Pe("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:T=>{k(),T.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),Pe("pre",{id:"test-recorder",ref:u,children:s})]}):null]}var Wr=()=>{let t=ud(3),[e]=dd(),[o,n]=kd(e),r;return t[0]!==o||t[1]!==n?(r=Jo(Vr.Fragment,{children:[Pe("p",{children:"HI"}),o,n,Pe("p",{children:"DONE"})]}),t[0]=o,t[1]=n,t[2]=r):r=t[2],r};var _d=$({plugins:[{Component:Wr,position:"bottom"}]});import{c as Td}from"react/compiler-runtime";import{jsx as wd}from"react/jsx-runtime";import{useLexicalComposerContext as Sd}from"@lexical/react/LexicalComposerContext.js";import{TreeView as Ed}from"@lexical/react/LexicalTreeView.js";import"react";var zr=()=>{let t=Td(2),[e]=Sd(),o;return t[0]!==e?(o=wd(Ed,{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 Nd=$({plugins:[{Component:zr,position:"bottom"}]});import{$isTableSelection as yd}from"@lexical/table";import{$isRangeSelection as Rd,FORMAT_TEXT_COMMAND as vd}from"lexical";import{jsx as Kr}from"react/jsx-runtime";import"react";var Ld="M14.5 9.25A1.75 1.75 0 0 1 12.75 11H9.5V7.5h3.25c.966 0 1.75.784 1.75 1.75M8 11V7.5A1.5 1.5 0 0 1 9.5 6h3.25a3.25 3.25 0 0 1 2.418 5.422A3.5 3.5 0 0 1 13.5 18h-4A1.5 1.5 0 0 1 8 16.5zm1.5 1.5v4h4a2 2 0 1 0 0-4z",Jr=({className:t})=>Kr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Kr("path",{clipRule:"evenodd",d:Ld,fill:"currentColor",fillRule:"evenodd"})});var X=t=>({type:"buttons",items:t,key:"format",order:40});var Xr={type:"text-format",format:["bold","italic"],tag:"***"},Zr={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},Yr={type:"text-format",format:["bold"],tag:"**"},qr={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var Qr=[X([{ChildComponent:Jr,isActive:({selection:t})=>Rd(t)||yd(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(vd,"bold")},order:1}])],Id=$(({featureProviderMap:t})=>{let e=[Yr,qr];return t.get("italic")&&e.push(Zr,Xr),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:Qr},toolbarInline:{groups:Qr}}});import{$isTableSelection as $d}from"@lexical/table";import{$isRangeSelection as Ad,FORMAT_TEXT_COMMAND as Dd}from"lexical";import{jsx as el}from"react/jsx-runtime";import"react";var Md="M16.5 6C17.3284 6 18 6.67157 18 7.5V16.5C18 17.3284 17.3284 18 16.5 18H7.5C6.67157 18 6 17.3284 6 16.5V12.5C6 12.2239 6.22386 12 6.5 12C6.77614 12 7 12.2239 7 12.5V16.5C7 16.7761 7.22386 17 7.5 17H16.5C16.7761 17 17 16.7761 17 16.5V7.5C17 7.22386 16.7761 7 16.5 7H15.5C15.2239 7 15 6.77614 15 6.5C15 6.22386 15.2239 6 15.5 6H16.5ZM8.14648 6.14648C8.34175 5.95122 8.65825 5.95122 8.85352 6.14648C9.04878 6.34175 9.04878 6.65825 8.85352 6.85352L7.20703 8.5L8.85352 10.1465C9.04878 10.3417 9.04878 10.6583 8.85352 10.8535C8.65825 11.0488 8.34175 11.0488 8.14648 10.8535L6.14648 8.85352C5.95122 8.65825 5.95122 8.34175 6.14648 8.14648L8.14648 6.14648ZM11.1465 6.14648C11.3417 5.95122 11.6583 5.95122 11.8535 6.14648L13.8535 8.14648C14.0488 8.34175 14.0488 8.65825 13.8535 8.85352L11.8535 10.8535C11.6583 11.0488 11.3417 11.0488 11.1465 10.8535C10.9512 10.6583 10.9512 10.3417 11.1465 10.1465L12.793 8.5L11.1465 6.85352C10.9512 6.65825 10.9512 6.34175 11.1465 6.14648Z",tl=({className:t})=>el("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:el("path",{clipRule:"evenodd",d:Md,fill:"currentColor",fillRule:"evenodd"})});var ol={type:"text-format",format:["code"],tag:"`"};var nl=[X([{ChildComponent:tl,isActive:({selection:t})=>Ad(t)||$d(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(Dd,"code")},order:7}])],Od=$({enableFormats:["code"],markdownTransformers:[ol],toolbarFixed:{groups:nl},toolbarInline:{groups:nl}});import{$isTableSelection as Bd}from"@lexical/table";import{$isRangeSelection as Pd,FORMAT_TEXT_COMMAND as jd}from"lexical";import{jsx as rl}from"react/jsx-runtime";import"react";var Fd="M10 6.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1h-2.083L11.6 17h1.9a.5.5 0 0 1 0 1h-5a.5.5 0 0 1 0-1h2.083L12.4 7h-1.9a.5.5 0 0 1-.5-.5",ll=({className:t})=>rl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:rl("path",{clipRule:"evenodd",d:Fd,fill:"currentColor",fillRule:"evenodd"})});var il={type:"text-format",format:["italic"],tag:"*"},sl={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var al=[X([{ChildComponent:ll,isActive:({selection:t})=>Pd(t)||Bd(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(jd,"italic")},order:2}])],Hd=$({enableFormats:["italic"],markdownTransformers:[il,sl],toolbarFixed:{groups:al},toolbarInline:{groups:al}});import{$isTableSelection as Gd}from"@lexical/table";import{$isRangeSelection as Vd,FORMAT_TEXT_COMMAND as Wd}from"lexical";import{jsx as cl}from"react/jsx-runtime";import"react";var Ud="M15.835 13.5a.27.27 0 0 1 .24.138q.306.554.306 1.316 0 1.01-.543 1.816-.543.8-1.554 1.268-1.01.462-2.409.462-1.323 0-2.295-.419-.972-.424-1.534-1.175a3.2 3.2 0 0 1-.533-1.135c-.082-.326.187-.614.522-.614.299 0 .539.233.625.519q.13.43.415.768.448.524 1.17.8.73.271 1.63.272.996 0 1.764-.32.773-.327 1.215-.906a2.16 2.16 0 0 0 .44-1.348q0-.645-.345-1.09c-.1-.132-.016-.352.15-.352zm-3.846-8q1.215 0 2.142.438.933.43 1.476 1.187.38.518.519 1.134c.07.31-.19.577-.507.577-.286 0-.518-.22-.6-.493q-.22-.738-.875-1.224-.864-.646-2.18-.646-.92 0-1.63.313-.703.308-1.1.85a2.04 2.04 0 0 0-.395 1.237q0 .492.217.874.216.376.588.652.376.278.843.475.474.197.972.338l1.052.288H18.5a.5.5 0 0 1 0 1h-13a.5.5 0 0 1 0-1h3.94a4.4 4.4 0 0 1-.844-.602q-.844-.781-.844-1.982 0-1.009.562-1.778t1.522-1.2q.959-.438 2.153-.438",ul=({className:t})=>cl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:cl("path",{d:Ud,fill:"currentColor"})});var dl={type:"text-format",format:["strikethrough"],tag:"~~"};var ml=[X([{ChildComponent:ul,isActive:({selection:t})=>Vd(t)||Gd(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(Wd,"strikethrough")},order:4}])],zd=$({enableFormats:["strikethrough"],markdownTransformers:[dl],toolbarFixed:{groups:ml},toolbarInline:{groups:ml}});import{$isTableSelection as Jd}from"@lexical/table";import{$isRangeSelection as Xd,FORMAT_TEXT_COMMAND as Zd}from"lexical";import{jsx as fl}from"react/jsx-runtime";import"react";var Kd="M7.51 15.65a.523.523 0 1 1-.985-.352l2.377-6.534a.83.83 0 0 1 1.56 0l2.374 6.534a.523.523 0 1 1-.985.351L9.722 9.57a.043.043 0 0 0-.08 0zm.162-2.238c0-.252.204-.456.456-.456h3.1a.456.456 0 0 1 0 .912h-3.1a.456.456 0 0 1-.456-.456m6.652 3.925a.436.436 0 0 1-.287-.765l1.64-1.431q.259-.228.433-.407.175-.178.266-.345a.76.76 0 0 0 .091-.365.61.61 0 0 0-.258-.52q-.255-.195-.63-.195-.4 0-.643.21a.7.7 0 0 0-.133.151c-.127.197-.3.403-.534.403s-.432-.194-.367-.418q.11-.378.434-.642.494-.402 1.257-.403.513 0 .897.183.387.181.604.501.217.316.217.714 0 .316-.13.586-.125.27-.395.555a9 9 0 0 1-.695.634l-.927.798a.023.023 0 0 0 .016.042h1.895a.357.357 0 0 1 0 .714z",pl=({className:t})=>fl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:fl("path",{d:Kd,fill:"currentColor"})});var hl=[X([{ChildComponent:pl,isActive:({selection:t})=>Xd(t)||Jd(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(Zd,"subscript")},order:5}])],Yd=$({enableFormats:["subscript"],toolbarFixed:{groups:hl},toolbarInline:{groups:hl}});import{$isTableSelection as Qd}from"@lexical/table";import{$isRangeSelection as em,FORMAT_TEXT_COMMAND as tm}from"lexical";import{jsx as gl}from"react/jsx-runtime";import"react";var qd="M7.51 15.65a.523.523 0 1 1-.985-.352l2.377-6.534a.83.83 0 0 1 1.56 0l2.374 6.534a.523.523 0 1 1-.985.351L9.722 9.57a.043.043 0 0 0-.08 0zm.162-2.238c0-.252.204-.456.456-.456h3.1a.456.456 0 0 1 0 .912h-3.1a.456.456 0 0 1-.456-.456m6.652-1.303a.436.436 0 0 1-.287-.765l1.64-1.432q.259-.228.433-.406.175-.179.266-.346a.76.76 0 0 0 .091-.365.61.61 0 0 0-.258-.52q-.255-.195-.63-.194-.4 0-.643.209a.7.7 0 0 0-.133.152c-.127.196-.3.403-.534.403s-.432-.194-.367-.419q.11-.378.434-.641.494-.403 1.257-.403.513 0 .897.182.387.183.604.502.217.315.217.714 0 .315-.13.585-.125.27-.395.555a9 9 0 0 1-.695.635l-.927.798a.023.023 0 0 0 .016.041h1.895a.357.357 0 1 1 0 .715z",xl=({className:t})=>gl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:gl("path",{d:qd,fill:"currentColor"})});var Cl=[X([{ChildComponent:xl,isActive:({selection:t})=>em(t)||Qd(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(tm,"superscript")},order:6}])],om=$({enableFormats:["superscript"],toolbarFixed:{groups:Cl},toolbarInline:{groups:Cl}});import{$isTableSelection as rm}from"@lexical/table";import{$isRangeSelection as lm,FORMAT_TEXT_COMMAND as im}from"lexical";import{jsx as bl}from"react/jsx-runtime";import"react";var nm="M9 7.5a.5.5 0 0 0-1 0V12a4 4 0 0 0 8 0V7.5a.5.5 0 0 0-1 0V12a3 3 0 1 1-6 0zM16.5 19a.5.5 0 0 0 0-1h-9a.5.5 0 0 0 0 1z",kl=({className:t})=>bl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:bl("path",{clipRule:"evenodd",d:nm,fill:"currentColor",fillRule:"evenodd"})});var _l=[X([{ChildComponent:kl,isActive:({selection:t})=>lm(t)||rm(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(im,"underline")},order:3}])],sm=$({enableFormats:["underline"],toolbarFixed:{groups:_l},toolbarInline:{groups:_l}});import{jsx as Zo}from"react/jsx-runtime";import{jsx as am}from"react/jsx-runtime";function cm(t){return t.replace(/-([a-z])/g,(e,o)=>o.toUpperCase())}var no=({css:t})=>{let e=t?Object.fromEntries(Object.entries(t).map(([o,n])=>[cm(o),n])):{};return am("span",{style:{...e,alignItems:"center",borderRadius:"4px",display:"flex",fontSize:"16px",height:"20px",justifyContent:"center",width:"20px"},children:"A"})};import{useLexicalComposerContext as um}from"@lexical/react/LexicalComposerContext";import{$forEachSelectedTextNode as dm}from"@lexical/selection";import{$getNodeByKey as mm,$getState as fm,$setState as pm,createState as hm,TextNode as gm}from"lexical";import{useEffect as xm}from"react";function Tl(t){let e=new Map;for(let o in t){let n=t[o],r=hm(o,{parse:l=>typeof l=="string"&&Object.keys(n).includes(l)?l:void 0});e.set(o,{stateConfig:r,stateValues:n})}return e}function Xo(t,e,o,n){t.update(()=>{dm(r=>{let l=e.get(o);if(!l)throw new Error(`State config for ${o} not found`);pm(r,l.stateConfig,n)})})}function wl({stateMap:t}){let[e]=um();return xm(()=>e.registerMutationListener(gm,o=>{e.getEditorState().read(()=>{for(let[n,r]of o){if(r==="destroyed")continue;let l=mm(n),s=e.getElementByKey(n);if(!l||!s)continue;let i=Object.create(null);t.forEach((d,c)=>{let u=fm(l,d.stateConfig);if(!u){delete s.dataset[c];return}s.dataset[c]=u;let a=d.stateValues[u]?.css;a&&Object.assign(i,a)}),s.style.cssText="",Object.assign(s.style,i)}})}),[e]),null}var Sl=(t,e)=>{let o=[];for(let r in t.state){let l=t.state[r];for(let s in l){let i=l[s];o.push({ChildComponent:()=>Zo(no,{css:i.css}),key:s,label:i.label,onSelect:({editor:d})=>{Xo(d,e,r,s)}})}}return[{type:"dropdown",ChildComponent:()=>Zo(no,{css:{color:"var(--theme-elevation-600)"}}),items:[...[{ChildComponent:()=>Zo(no,{}),key:"clear-style",label:({i18n:r})=>r.t("lexical:textState:defaultStyle"),onSelect:({editor:r})=>{for(let l in t.state)Xo(r,e,l,void 0)},order:1}],...o],key:"textState",order:30}]},Cm=$(({props:t})=>{let e=Tl(t.state);return{plugins:[{Component:()=>wl({stateMap:e}),position:"normal"}],toolbarFixed:{groups:Sl(t,e)},toolbarInline:{groups:Sl(t,e)}}});import{c as ym}from"react/compiler-runtime";import{useLexicalComposerContext as Rm}from"@lexical/react/LexicalComposerContext";import{$createHeadingNode as vm,$isHeadingNode as Bl,HeadingNode as Hl}from"@lexical/rich-text";import{$setBlocksType as Im}from"@lexical/selection";import{$getSelection as Mm,$isRangeSelection as $m}from"lexical";import{useEffect as Am}from"react";import{jsx as El}from"react/jsx-runtime";import"react";var bm="M7 6.5a.5.5 0 0 0-1 0v11a.5.5 0 0 0 1 0V12h6v5.5a.5.5 0 0 0 1 0v-11a.5.5 0 0 0-1 0V11H7zm11 6a.5.5 0 0 0-.777-.416l-1.5 1a.5.5 0 1 0 .554.832l.723-.482V17.5a.5.5 0 0 0 1 0z",Nl=({className:t})=>El("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:El("path",{d:bm,fill:"currentColor"})});import{jsx as Ll}from"react/jsx-runtime";import"react";var km="M7 6.5a.5.5 0 0 0-1 0v11a.5.5 0 0 0 1 0V12h6v5.5a.5.5 0 0 0 1 0v-11a.5.5 0 0 0-1 0V11H7zm9.034 10.952c0 .303.245.548.548.548h2.97a.448.448 0 0 0 0-.896H17.48v-.04l.997-1.038q.562-.555.873-.945.314-.39.438-.711t.124-.653q0-.497-.245-.885a1.7 1.7 0 0 0-.684-.61A2.24 2.24 0 0 0 17.96 12a2.2 2.2 0 0 0-1.017.228 1.71 1.71 0 0 0-.888 1.13c-.064.268.168.495.444.495.275 0 .479-.236.595-.485l.019-.039q.12-.22.333-.338a1 1 0 0 1 .5-.121q.278 0 .495.11a.83.83 0 0 1 .341.312.9.9 0 0 1 .125.48q0 .245-.096.462t-.288.448-.48.529l-1.85 1.854a.55.55 0 0 0-.16.387",yl=({className:t})=>Ll("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Ll("path",{d:km,fill:"currentColor"})});import{jsx as Rl}from"react/jsx-runtime";import"react";var _m="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",vl=({className:t})=>Rl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Rl("path",{d:_m,fill:"currentColor"})});import{jsx as Il}from"react/jsx-runtime";import"react";var Tm="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",Ml=({className:t})=>Il("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Il("path",{d:Tm,fill:"currentColor"})});import{jsx as $l}from"react/jsx-runtime";import"react";var wm="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",Al=({className:t})=>$l("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:$l("path",{d:wm,fill:"currentColor"})});import{jsx as Dl}from"react/jsx-runtime";import"react";var Sm="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",Ol=({className:t})=>Dl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Dl("path",{d:Sm,fill:"currentColor"})});import{$createHeadingNode as Em,$isHeadingNode as Nm,HeadingNode as Lm}from"@lexical/rich-text";var Yo=t=>(e,o,n)=>{let r=t(n);r&&(r.append(...o),e.replace(r),r.select(0,0))};var Fl=t=>{let o=`^(${t.map(r=>Number(r.slice(1))).map(r=>`#{${r}}`).join("|")})\\s`,n=new RegExp(o);return{type:"element",dependencies:[Lm],export:(r,l)=>{if(!Nm(r))return null;let s=Number(r.getTag().slice(1));return"#".repeat(s)+" "+l(r)},regExp:n,replace:Yo(r=>{let l="h"+r[1]?.length;return Em(l)})}};var Pl=t=>{let e=Mm();Im(e,()=>vm(t))},jl={h1:Nl,h2:yl,h3:vl,h4:Ml,h5:Al,h6:Ol},Dm=$(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[ee(e.map((n,r)=>({ChildComponent:jl[n],isActive:({selection:l})=>{if(!$m(l))return!1;for(let s of l.getNodes()){if(Bl(s)&&s.getTag()===n)continue;let i=s.getParent();if(!(Bl(i)&&i.getTag()===n))return!1}return!0},key:n,label:({i18n:l})=>l.t("lexical:heading:label",{headingLevel:n.charAt(1)}),onSelect:({editor:l})=>{l.update(()=>{Pl(n)})},order:r+2})))];return{markdownTransformers:[Fl(e)],nodes:[Hl],plugins:[{Component:Om,position:"normal"}],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[J(e.map(n=>({Icon:jl[n],key:`heading-${n.charAt(1)}`,keywords:["heading",n],label:({i18n:r})=>r.t("lexical:heading:label",{headingLevel:n.charAt(1)}),onSelect:({editor:r})=>{r.update(()=>{Pl(n)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}}),Om=t=>{let e=ym(9),{clientProps:o}=t,{enabledHeadingSizes:n}=o,r;e[0]!==n?(r=n===void 0?["h1","h2","h3","h4","h5","h6"]:n,e[0]=n,e[1]=r):r=e[1];let l=r,s;e[2]!==l?(s=l.at(-1),e[2]=l,e[3]=s):s=e[3];let i=s,[d]=Rm(),c,u;return e[4]!==d||e[5]!==l||e[6]!==i?(c=()=>{if(!(!i||l.length===6))return d.registerNodeTransform(Hl,a=>{l.includes(a.getTag())||a.setTag(i)})},u=[d,l,i],e[4]=d,e[5]=l,e[6]=i,e[7]=c,e[8]=u):(c=e[7],u=e[8]),Am(c,u),null};import{$isNodeSelection as Qm}from"lexical";import{jsx as Ul}from"react/jsx-runtime";import"react";var Fm="M18 12a.5.5 0 0 1-.5.5h-11a.5.5 0 0 1 0-1h11a.5.5 0 0 1 .5.5",qo=({className:t})=>Ul("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Ul("path",{d:Fm,fill:"currentColor"})});import{jsx as Gl}from"react/jsx-runtime";import"react";var Bm={16:"M8.5 3.5a.5.5 0 0 0-1 0v4h-4a.5.5 0 0 0 0 1h4v4a.5.5 0 0 0 1 0v-4h4a.5.5 0 0 0 0-1h-4z",24:"M12 6a.5.5 0 0 1 .5.5v5h5a.5.5 0 0 1 0 1h-5v5a.5.5 0 0 1-1 0v-5h-5a.5.5 0 0 1 0-1h5v-5A.5.5 0 0 1 12 6"},Vl=({className:t,size:e=24})=>Gl("svg",{className:t,fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:Gl("path",{clipRule:"evenodd",d:Bm[e],fill:"currentColor",fillRule:"evenodd"})});var ke=t=>({type:"dropdown",ChildComponent:Vl,items:t,key:"add",order:10});import{addClassNamesToElement as Pm}from"@lexical/utils";import{$applyNodeReplacement as jm,createCommand as Hm,DecoratorNode as Um}from"lexical";var Et=Hm("INSERT_HORIZONTAL_RULE_COMMAND"),St=class extends Um{static clone(e){return new this(e.__key)}static getType(){return"horizontalrule"}static importDOM(){return{hr:()=>({conversion:Gm,priority:0})}}static importJSON(e){return Wl()}createDOM(e){let o=document.createElement("hr");return Pm(o,e.theme.hr),o}decorate(){return null}exportDOM(){return{element:document.createElement("hr")}}exportJSON(){return{type:"horizontalrule",version:1}}getTextContent(){return`
55
+ `}isInline(){return!1}updateDOM(){return!1}};function Gm(){return{node:Wl()}}function Wl(){return jm(new St)}import{$applyNodeReplacement as Vm}from"lexical";import"react";var _e=class extends St{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return Qe()}decorate(){return null}exportJSON(){return super.exportJSON()}};function Qe(){return Vm(new _e)}function Nt(t){return t instanceof _e}var zl={type:"element",dependencies:[_e],export:(t,e)=>Nt(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=Qe();e&&t.replace(e)}};import{c as Wm}from"react/compiler-runtime";import{useLexicalComposerContext as zm}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Km}from"@lexical/utils";import{$getSelection as Jm,$isRangeSelection as Xm,COMMAND_PRIORITY_EDITOR as Zm}from"lexical";import{useEffect as Ym}from"react";var Kl=()=>{let t=Wm(3),[e]=zm(),o,n;return t[0]!==e?(o=()=>e.registerCommand(Et,qm,Zm),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),Ym(o,n),null};function qm(t){let e=Jm();if(!Xm(e))return!1;if(e.focus.getNode()!==null){let n=Qe();Km(n)}return!0}var ef=$({markdownTransformers:[zl],nodes:[_e],plugins:[{Component:Kl,position:"normal"}],slashMenu:{groups:[J([{Icon:qo,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Et,void 0)}}])]},toolbarFixed:{groups:[ke([{ChildComponent:qo,isActive:({selection:t})=>{if(!Qm(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Nt(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Et,void 0)}}])]}});import{$findMatchingParent as ri}from"@lexical/utils";import{$isElementNode as pf,INDENT_CONTENT_COMMAND as hf,OUTDENT_CONTENT_COMMAND as gf}from"lexical";import{jsx as Qo}from"react/jsx-runtime";import"react";var tf="M7.854 6.146a.5.5 0 1 0-.708.708L8.293 8H5.5a.5.5 0 0 0 0 1h2.793l-1.147 1.146a.5.5 0 0 0 .708.708l2-2a.5.5 0 0 0 0-.708zM11.5 8a.5.5 0 0 0 0 1h7a.5.5 0 0 0 0-1zM5 12.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m.5 3.5a.5.5 0 0 0 0 1h13a.5.5 0 0 0 0-1z",Jl=({className:t})=>Qo("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Qo("g",{transform:"scale(-1, 1) translate(-24, 0)",children:Qo("path",{clipRule:"evenodd",d:tf,fill:"currentColor",fillRule:"evenodd"})})});import{jsx as Xl}from"react/jsx-runtime";import"react";var of="M7.854 6.146a.5.5 0 1 0-.708.708L8.293 8H5.5a.5.5 0 0 0 0 1h2.793l-1.147 1.146a.5.5 0 0 0 .708.708l2-2a.5.5 0 0 0 0-.708zM11.5 8a.5.5 0 0 0 0 1h7a.5.5 0 0 0 0-1zM5 12.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m.5 3.5a.5.5 0 0 0 0 1h13a.5.5 0 0 0 0-1z",Zl=({className:t})=>Xl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Xl("path",{clipRule:"evenodd",d:of,fill:"currentColor",fillRule:"evenodd"})});import{jsx as nf}from"react/jsx-runtime";import{useLexicalComposerContext as rf}from"@lexical/react/LexicalComposerContext";import{TabIndentationPlugin as lf}from"@lexical/react/LexicalTabIndentationPlugin";import{$findMatchingParent as sf,mergeRegister as Yl}from"@lexical/utils";import{$getSelection as af,$isElementNode as ti,$isRangeSelection as cf,COMMAND_PRIORITY_LOW as ql,INDENT_CONTENT_COMMAND as Ql,KEY_TAB_COMMAND as uf,OUTDENT_CONTENT_COMMAND as df,TabNode as mf}from"lexical";import{useEffect as ei}from"react";var oi=({clientProps:t})=>{let[e]=rf(),{disabledNodes:o,disableTabNode:n}=t;return ei(()=>{if(!(!e||!o?.length))return Yl(e.registerCommand(Ql,()=>ff(r=>{if(!o.includes(r.getType())){let l=r.getIndent();r.setIndent(l+1)}}),ql),e.registerUpdateListener(({dirtyElements:r,editorState:l})=>{e.update(()=>{for(let[s]of r){let i=l._nodeMap.get(s);ti(i)&&o.includes(i.getType())&&i.getIndent()>0&&i.setIndent(0)}})}))},[e,o]),ei(()=>{if(!(!e||!n))return Yl(e.registerCommand(uf,r=>(r.preventDefault(),e.dispatchCommand(r.shiftKey?df:Ql,void 0)),ql),e.registerNodeTransform(mf,r=>{r.remove()}))},[e,n]),nf(lf,{})};function ff(t){let e=af();if(!cf(e))return!1;let o=new Set,n=e.getNodes();for(let r=0;r<n.length;r++){let l=n[r],s=l.getKey();if(o.has(s))continue;let i=sf(l,c=>ti(c)&&!c.isInline());if(i===null)continue;let d=i.getKey();i.canIndent()&&!o.has(d)&&(o.add(d),t(i))}return o.size>0}var ni=t=>({type:"buttons",items:t,key:"indent",order:35});var li=({disabledNodes:t})=>[ni([{ChildComponent:Jl,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],n=r=>ii(r)&&r.getIndent()>0;return o.some(r=>n(r)||!!ri(r,n))},key:"indentDecrease",label:({i18n:e})=>e.t("lexical:indent:decreaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(gf,void 0)},order:1},{ChildComponent:Zl,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],n=r=>ii(r)&&!(t??[]).includes(r.getType());return o.some(r=>n(r)||!!ri(r,n))},key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(hf,void 0)},order:2}])],xf=$(({props:t})=>{let e=t.disabledNodes??[];return{plugins:[{Component:oi,position:"normal"}],sanitizedClientFeatureProps:t,toolbarFixed:{groups:li({disabledNodes:e})},toolbarInline:{groups:li({disabledNodes:e})}}}),ii=t=>pf(t)&&t.canIndent();import{$findMatchingParent as Ap}from"@lexical/utils";import{$getSelection as un,$isRangeSelection as Bi}from"lexical";import{jsx as si}from"react/jsx-runtime";import"react";var Cf={16:"M8.38 6.381a.29.29 0 0 1 .347-.056q.293.161.541.408a2.5 2.5 0 0 1 0 3.535l-2 2a2.5 2.5 0 0 1-3.535-3.535l.571-.573c.25-.249.692-.107.81.224a.46.46 0 0 1-.098.478l-.576.578a1.5 1.5 0 1 0 2.121 2.12l2-2a1.5 1.5 0 0 0 0-2.12c-.23-.23-.493-.509-.358-.805a.9.9 0 0 1 .178-.254m.352-2.648a2.5 2.5 0 1 1 3.535 3.535l-.471.47c-.253.254-.717.082-.819-.261a.44.44 0 0 1 .102-.435l.481-.481A1.5 1.5 0 0 0 9.44 4.44l-2 2a1.5 1.5 0 0 0 0 2.12c.136.138.168.365.031.502l-.182.181c-.154.154-.403.179-.557.025a2.5 2.5 0 0 1 0-3.535z",24:"M11.713 9.585c.26-.261.648-.367.982-.21.41.193.795.46 1.133.797l.141.148c1.371 1.517 1.401 3.859.027 5.384l-.143.15-3 3c-1.518 1.517-3.966 1.532-5.533.116l-.149-.142c-1.557-1.558-1.591-4.115-.025-5.682l1.917-1.918c.276-.275.79-.046.836.341a.43.43 0 0 1-.12.357l-1.926 1.927c-1.167 1.167-1.15 3.092.025 4.268l.113.107c1.183 1.07 3.024 1.048 4.155-.082l3-3 .105-.111c1.025-1.137 1.011-2.899-.023-4.044l-.107-.112a3 3 0 0 0-1.3-.769c-.211-.061-.327-.305-.172-.46zm1.583-4.581c1.576-1.42 4.024-1.341 5.532.168l.142.148c1.37 1.517 1.401 3.859.027 5.384l-.143.15-1.918 1.917c-.276.276-.79.047-.835-.34a.43.43 0 0 1 .12-.358l1.926-1.927.105-.111c1.025-1.137 1.011-2.899-.023-4.044l-.107-.112c-1.14-1.14-2.982-1.19-4.157-.131l-.111.105-3 3c-1.167 1.167-1.151 3.092.025 4.268l.113.107c.399.36.872.596 1.369.707.128.029.198.174.116.276l-.126.14-.065.064c-.26.26-.647.367-.98.21a4 4 0 0 1-.985-.655l-.149-.142c-1.557-1.557-1.592-4.115-.025-5.682l3-3z"},ai=({className:t,size:e=24})=>si("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:si("path",{d:Cf[e],fill:"currentColor"})});import{$isAtNodeEnd as ci}from"@lexical/selection";function et(t){let{anchor:e}=t,{focus:o}=t,n=t.anchor.getNode(),r=t.focus.getNode();return n===r?n:t.isBackward()?ci(o)?n:r:ci(e)?n:r}var en=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as If}from"lexical";function tn(t){let e=/^(?:(?:https?|mailto|ftp|tel|file|sms):|[^&:/?#]*(?:[/?#]|$))/gi,o=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z\d+/]+=*$/i;return t=String(t).trim(),t.match(e)!=null||t.match(o)!=null?t:"https://"}var bf=/^(?:[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+)?$/,kf=/^(?:\/[\w\-./]*(?:\?[-;&=%\w]*)?(?:#[\w-]+)?|#[\w\-]+)$/;function ui(t){if(!t||t.includes(" ")||/^[a-z][a-z\d+.-]*:\/[^/]/i.test(t))return!1;if(t==="https://"||bf.test(t)||kf.test(t))return!0;try{let e=new URL(t);return!(["ftp:","http:","https:"].includes(e.protocol)&&!e.hostname.includes("."))}catch{}return!1}import{addClassNamesToElement as _f,isHTMLAnchorElement as Tf}from"@lexical/utils";import rn from"bson-objectid";import{$applyNodeReplacement as wf,$createTextNode as di,$getSelection as Sf,$isElementNode as mi,$isRangeSelection as nn,createCommand as Ef,ElementNode as Nf}from"lexical";var Lf=new Set(["http:","https:","mailto:","sms:","tel:"]),te=class extends Nf{__fields;__id;constructor({id:e,fields:o={linkType:"custom",newTab:!1},key:n}){super(n),this.__fields=o,this.__id=e}static clone(e){return new this({id:e.__id,fields:e.__fields,key:e.__key})}static getType(){return"link"}static importDOM(){return{a:e=>({conversion:yf,priority:1})}}static importJSON(e){let o=Te({}).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 rn.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=on(o.rel,"add","noopener")),_f(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},n=this.getID();return n&&(o.id=n),o}extractWithChild(e,o,n){if(!nn(o))return!1;let r=o.anchor.getNode(),l=o.focus.getNode();return this.isParentOf(r)&&this.isParentOf(l)&&o.getTextContent().length>0}getFields(){return this.getLatest().__fields}getID(){return this.getLatest().__id}insertNewAfter(e,o=!0){let n=this.getParentOrThrow().insertNewAfter(e,o);if(mi(n)){let r=Te({fields:this.__fields});return n.append(r),r}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!Lf.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,n){let r=this.__fields?.url,l=this.__fields?.newTab;return r!=null&&r!==e.__fields?.url&&this.__fields?.linkType==="custom"&&(o.href=r),this.__fields?.linkType==="internal"&&e.__fields?.linkType==="custom"&&o.removeAttribute("href"),o.rel==null&&(o.rel=""),l!==e.__fields?.newTab&&(l??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=on(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=on(o.rel,"remove","noopener"))),!1}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields).setID(e.id)}};function yf(t){let e=null;if(Tf(t)){let o=t.textContent;o!==null&&o!==""&&(e=Te({id:new rn.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function Te({id:t,fields:e}){return wf(new te({id:t??new rn.default().toHexString(),fields:e}))}function z(t){return t instanceof te}var de=Ef("TOGGLE_LINK_COMMAND");function ln(t){let e=Sf();if(!nn(e)&&(t===null||!t.selectedNodes?.length))return;let o=nn(e)?e.extract():t===null?[]:t.selectedNodes;if(t===null){o?.forEach(l=>{let s=l.getParent();z(s)&&(s.getChildren().forEach(d=>{s.insertBefore(d)}),s.remove())});return}if(o?.length===1){let l=o[0],s=z(l)?l:Rf(l);if(s!==null){s.setFields(t.fields),t.text!=null&&t.text!==s.getTextContent()&&(s.append(di(t.text)),s.getChildren().forEach(i=>{i!==s.getLastChild()&&i.remove()}));return}}let n=null,r=null;o?.forEach(l=>{let s=l.getParent();if(!(s===r||s===null||mi(l)&&!l.isInline())){if(z(s)){r=s,s.setFields(t.fields),t.text!=null&&t.text!==s.getTextContent()&&(s.append(di(t.text)),s.getChildren().forEach(i=>{i!==s.getLastChild()&&i.remove()}));return}if(s.is(n)||(n=s,r=Te({fields:t.fields}),z(s)?l.getPreviousSibling()===null?s.insertBefore(r):s.insertAfter(r):l.insertBefore(r)),z(l)){if(l.is(r))return;if(r!==null){let i=l.getChildren();r.append(...i)}l.remove();return}r!==null&&r.append(l)}})}function Rf(t){return vf(t,e=>z(e))}function vf(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function on(t,e,o){let n,r=`${t}`;if(e==="add"){if(r.includes(o)){let l=new RegExp(o,"g");r=r.replace(l,"").trim()}r=r.trim(),n=r.length===0?`${o}`:`${r} ${o}`}else{let l=new RegExp(o,"g");n=r.replace(l,"").trim()}return n}var Mf=(t,e)=>{let[,o,n]=e,r=Te({fields:{doc:null,linkType:"custom",newTab:!1,url:n}}),l=If(o);return l.setFormat(t.getFormat()),r.append(l),t.replace(r),l},$f=t=>({type:"text-match",dependencies:[te],export:(e,o)=>{if(!z(e))return null;let n=e,r=n.getFields(),l;return r.linkType==="internal"?t?.internalDocToHref?l=tn(t.internalDocToHref({linkNode:n.exportJSON()})):(console.warn("Lexical \u2192 Markdown converter: found internal link but internalDocToHref is not provided \u2014 link will have an empty href"),l=""):l=tn(r.url??""),`[${o(n)}](${l})`},importRegExp:/(?<!!)\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/(?<!!)\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:Mf,trigger:")"}),fi=$f();import{$applyNodeReplacement as Af,$isElementNode as Df}from"lexical";var we=class extends te{static clone(e){return new this({id:"",fields:e.__fields,key:e.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(e){let o=Lt({}).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 n=this.getParentOrThrow().insertNewAfter(e,o);if(Df(n)){let r=Lt({fields:this.__fields});return n.append(r),r}return null}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields)}};function Lt({fields:t}){return Af(new we({id:"",fields:t}))}function Se(t){return t instanceof we}import{c as Of}from"react/compiler-runtime";import{useLexicalComposerContext as Ff}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Bf}from"@lexical/utils";import{$createTextNode as pi,$getSelection as Pf,$isElementNode as gi,$isLineBreakNode as xi,$isNodeSelection as jf,$isRangeSelection as Hf,$isTextNode as yt,TextNode as Uf}from"lexical";import{useEffect as Gf}from"react";function hi(t,e=o=>o){return o=>{let n=t.exec(o);return n===null?null:{index:n.index,length:n[0].length,text:n[0],url:e(n[0])}}}function Ci(t,e){for(let o of e){let n=o(t);if(n!=null)return n}return null}var Vf=/[.,;\s]/;function lo(t){return t!==void 0&&Vf.test(t)}function bi(t){return lo(t[t.length-1])}function an(t){return lo(t[0])}function Wf(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function ki(t){let e=t.getPreviousSibling();return gi(e)&&(e=e.getLastDescendant()),e===null||xi(e)||yt(e)&&bi(e.getTextContent())}function _i(t){let e=t.getNextSibling();return gi(e)&&(e=e.getFirstDescendant()),e===null||xi(e)||yt(e)&&an(e.getTextContent())}function zf(t,e,o,n){return(t>0?lo(o[t-1]):ki(n[0]))?e<o.length?lo(o[e]):_i(n[n.length-1]):!1}function Kf(t,e,o){let n=[],r=[],l=[],s=0,i=0,d=[...t];for(;d.length>0;){let c=d[0],a=c.getTextContent().length,m=i;i+a<=e?(n.push(c),s+=a):m>=o?l.push(c):r.push(c),i+=a,d.shift()}return[s,n,r,l]}function Jf(t,e,o,n){let r={linkType:"custom",url:n.url,...n.fields},l=Lt({fields:r});if(t.length===1){let s=t[0],i;if(e===0?[i]=s.splitText(o):[,i]=s.splitText(e,o),i){let d=pi(n.text);d.setFormat(i.getFormat()),d.setDetail(i.getDetail()),d.setStyle(i.getStyle()),l.append(d),i.replace(l)}return s}else if(t.length>1){let s=t[0],i=s.getTextContent().length,d;e===0?d=s:[,d]=s.splitText(e);let c=[],u;if(t.forEach(a=>{let f=a.getTextContent().length,h=i,p=i+f;if(h<o)if(p<=o)c.push(a);else{let[g,k]=a.splitText(o-h);g&&c.push(g),u=k}i+=f}),d){let a=Pf(),m=a?a.getNodes().find(yt):void 0,f=pi(d.getTextContent());return f.setFormat(d.getFormat()),f.setDetail(d.getDetail()),f.setStyle(d.getStyle()),l.append(f,...c),m&&m===d&&(Hf(a)?f.select(a.anchor.offset,a.focus.offset):jf(a)&&f.select(0,f.getTextContent().length)),d.replace(l),u}}}function Xf(t,e,o){let n=[...t],r=n.map(d=>d.getTextContent()).join(""),l=r,s,i=0;for(;(s=Ci(l,e))!=null&&s!==null;){let d=s.index,c=s.length,u=d+c;if(zf(i+d,i+u,r,n)){let[m,,f,h]=Kf(n,i+d,i+u),p=i+d-m,g=i+u-m,k=Jf(f,p,g,s);n=k?[k,...h]:h,o(s.url,null),i=0}else i+=u;l=l.substring(u)}}function sn(t,e,o){let n=t.getChildren(),r=n.length;for(let d=0;d<r;d++){let c=n[d];if(!yt(c)||!c.isSimpleText()){ro(t),o(null,t.getFields()?.url??null);return}}let l=t.getTextContent(),s=Ci(l,e);if(s===null||s.text!==l){ro(t),o(null,t.getFields()?.url??null);return}if(!ki(t)||!_i(t)){ro(t),o(null,t.getFields()?.url??null);return}let i=t.getFields()?.url;if(i!==s?.url){let d=t.getFields();d.url=s?.url,t.setFields(d),o(s.url,i??null)}}function Zf(t,e,o){let n=t.getPreviousSibling(),r=t.getNextSibling(),l=t.getTextContent();if(Se(n)){let s=n.getFields()?.url?n.getFields()?.url?.startsWith("mailto:")??!1:!1;(!an(l)||Wf(l,s))&&(n.append(t),sn(n,e,o),o(null,n.getFields()?.url??null))}Se(r)&&!bi(l)&&(ro(r),sn(r,e,o),o(null,r.getFields()?.url??null))}function ro(t){let e=t.getChildren(),o=e.length;for(let n=o-1;n>=0;n--)t.insertAfter(e[n]);return t.remove(),e.map(n=>n.getLatest())}function Yf(t){let e=[t],o=t.getNextSibling();for(;o!==null&&yt(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function qf(t,e,o){let n=Of(5),r,l;n[0]!==t||n[1]!==e||n[2]!==o?(r=()=>{if(!t.hasNodes([we]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let s=(i,d)=>{o?.(i,d)};return Bf(t.registerNodeTransform(Uf,i=>{let d=i.getParentOrThrow(),c=i.getPreviousSibling();if(Se(d))sn(d,e,s);else if(!z(d)){if(i.isSimpleText()&&(an(i.getTextContent())||!Se(c))){let u=Yf(i);Xf(u,e,s)}Zf(i,e,s)}}))},l=[t,e,o],n[0]=t,n[1]=e,n[2]=o,n[3]=r,n[4]=l):(r=n[3],l=n[4]),Gf(r,l)}var Qf=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,ep=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,tp=[hi(Qf,t=>t.startsWith("http")?t:`https://${t}`),hi(ep,t=>`mailto:${t}`)],Ti=()=>{let[t]=Ff();return qf(t,tp),null};import{jsx as op}from"react/jsx-runtime";import{ClickableLinkPlugin as np}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var wi=()=>op(np,{});import{jsx as wp}from"react/jsx-runtime";import"react";import{createPortal as Sp}from"react-dom";import{jsx as Ee,jsxs as Rt,Fragment as lp}from"react/jsx-runtime";import{useLexicalComposerContext as ip}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as sp}from"@lexical/react/useLexicalEditable";import{$findMatchingParent as Si,mergeRegister as Ei}from"@lexical/utils";import{getTranslation as cn}from"@payloadcms/translations";import{CloseMenuIcon as ap,EditIcon as cp,ExternalLinkIcon as Ni,formatDrawerSlug as up,useConfig as dp,useEditDepth as mp,useLocale as fp,useTranslation as pp}from"@payloadcms/ui";import{requests as hp}from"@payloadcms/ui/shared";import{$getSelection as Li,$isLineBreakNode as gp,$isRangeSelection as yi,COMMAND_PRIORITY_HIGH as xp,COMMAND_PRIORITY_LOW as Ri,getDOMSelection as Cp,KEY_ESCAPE_COMMAND as bp,SELECTION_CHANGE_COMMAND as kp}from"lexical";import{formatAdminURL as _p}from"payload/shared";import vi,{useCallback as Ii,useEffect as ao,useLayoutEffect as Tp,useRef as Mi,useState as je}from"react";function io(t,e,o,n=10,r=5){let l=o.parentElement;if(t===null||l==null){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let s=o.getBoundingClientRect(),i=l.getBoundingClientRect(),d=t.top-n,c=t.left-r;e.style.width="max-content",e.style.maxWidth="none";let u=e.scrollWidth,a=i.right-c,m=c-i.left,f;if(u<=a)f=e.getBoundingClientRect();else{let h=m+t.width,p=m>a,k=Math.min(u,p?h:a);k<u&&(e.style.width=`${k}px`,e.style.maxWidth=`${k}px`,e.offsetHeight),p&&(c=t.right-k),f=e.getBoundingClientRect()}d<i.top&&(d+=f.height+t.height+n*2),c+f.width>i.right&&(c=i.right-f.width-r),d-=s.top,c-=s.left,e.style.opacity="1",e.style.transform=`translate(${c}px, ${d}px)`}import{createCommand as rp}from"lexical";var so=rp("TOGGLE_LINK_WITH_MODAL_COMMAND");function $i(t){t.preventDefault()}function Ai({anchorElem:t}){let[e]=ip(),[o,n]=je(),r=Mi(null),l=Mi(null),[s,i]=je(null),[d,c]=je(null),{fieldProps:{schemaPath:u},uuid:a}=U(),m=sp(),{config:f,getEntityConfig:h}=dp(),{i18n:p,t:g}=pp(),[k,N]=je(),R=mp(),[T,C]=je(!1),[x,b]=je([]),_=fp(),[M,v]=je(!1),y=up({slug:"lexical-rich-text-link-"+a,depth:R}),{toggleDrawer:S}=xe(y),w=Ii(()=>{C(!1),r&&r.current&&(r.current.style.opacity="0",r.current.style.transform="translate(-10000px, -10000px)"),v(!1),i(null),c(null),b([]),N(void 0)},[C,i,c,b]),L=Ii(()=>{let E=Li(),I;if(!yi(E)||!E){w();return}let A=et(E);I=e.getElementByKey(A.getKey())?.getBoundingClientRect();let D=Si(A,z),F=E.getNodes().filter(ne=>!gp(ne)).find(ne=>{let ge=Si(ne,z);return D&&!D.is(ge)||ge&&!ge.is(D)});if(D==null||F){w();return}n(D);let B=D.getFields(),Z={...B,id:D.getID(),text:D.getTextContent()};if(B?.linkType==="custom")i(B?.url??null),c(null);else{i(`${f.routes.admin==="/"?"":f.routes.admin}/collections/${B?.doc?.relationTo}/${B?.doc?.value}`);let ne=B?.doc?.relationTo?h({collectionSlug:B?.doc?.relationTo}):void 0;if(!ne)c(B?.label?String(B?.label):null),i(B?.url?String(B?.url):null);else{let ge=typeof B.doc?.value=="object"?B.doc.value.id:B.doc?.value,jt=B.doc?.relationTo;if(!ge||!jt)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let Xn=g("fields:linkedTo",{label:`${cn(ne.labels.singular,p)} - ${g("lexical:link:loadingWithEllipsis",p)}`}).replace(/<[^>]*>?/g,"");c(Xn),hp.get(_p({apiRoute:f.routes.api,path:`/${jt}/${ge}`,serverURL:f.serverURL}),{headers:{"Accept-Language":p.language},params:{depth:0,locale:_?.code}}).then(async se=>{if(!se.ok)throw new Error(`HTTP error! Status: ${se.status}`);let q=await se.json(),mt=ne?.admin?.useAsTitle||"id",ve=q[mt],ft=g("fields:linkedTo",{label:`${cn(ne.labels.singular,p)} - ${ve}`}).replace(/<[^>]*>?/g,"");c(ft)}).catch(()=>{let se=g("fields:linkedTo",{label:`${cn(ne.labels.singular,p)} - ${g("general:untitled",p)} - ID: ${ge}`}).replace(/<[^>]*>?/g,"");c(se)})}}N(Z),C(!0),b(E?E?.getNodes():[]),Se(D)?v(!0):v(!1);let K=r.current,We=Cp(e._window),{activeElement:Re}=document;if(K===null)return;let he=e.getRootElement();return We!==null&&he!==null&&he.contains(We.anchorNode)?(I||(I=We.getRangeAt(0).getBoundingClientRect()),I!=null&&(I.y+=40,l.current=I)):(Re==null||Re.className!=="link-input")&&(he!==null&&io(null,K,t),i(null),c(null)),!0},[e,w,f.routes.admin,f.routes.api,f.serverURL,h,g,p,_?.code,t]);return ao(()=>Ei(e.registerCommand(so,E=>(e.dispatchCommand(de,E),L(),S(),!0),Ri)),[e,L,S,y]),ao(()=>{let E=t.parentElement,I=()=>{e.getEditorState().read(()=>{L()})};return window.addEventListener("resize",I),E?.addEventListener("scroll",I),()=>{window.removeEventListener("resize",I),E?.removeEventListener("scroll",I)}},[t.parentElement,e,L]),ao(()=>Ei(e.registerUpdateListener(({editorState:E})=>{E.read(()=>{L()})}),e.registerCommand(kp,()=>(L(),!0),Ri),e.registerCommand(bp,()=>T?(w(),!0):!1,xp)),[e,L,T,w]),ao(()=>{e.getEditorState().read(()=>{L()})},[e,L]),Tp(()=>{!T||!r.current||!t||!l.current||io(l.current,r.current,t)},[s,d,T,t,o]),Rt(vi.Fragment,{children:[Ee("div",{className:"link-editor",ref:r,children:Rt("div",{className:"link-input",children:[s&&s.length>0?Rt("a",{href:s,rel:"noopener noreferrer",target:"_blank",children:[o?.__fields.newTab?Ee(Ni,{}):null,d!=null&&d.length>0?d:s]}):d!=null&&d.length>0?Rt(lp,{children:[o?.__fields.newTab?Ee(Ni,{}):null,Ee("span",{className:"link-input__label-pure",children:d})]}):null,m&&Rt(vi.Fragment,{children:[Ee("button",{"aria-label":"Edit link",className:"link-edit",onClick:E=>{E.preventDefault(),S()},onMouseDown:$i,tabIndex:0,type:"button",children:Ee(cp,{})}),!M&&Ee("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(de,null)},onMouseDown:$i,tabIndex:0,type:"button",children:Ee(ap,{})})]})]})}),Ee(xt,{className:"lexical-link-edit-drawer",data:k,drawerSlug:y,drawerTitle:g("fields:editLink"),featureKey:"link",handleDrawerSubmit:(E,I)=>{let A=I,D={...A};delete D.text,e.update(()=>{let F=Li(),B=null;if(yi(F)?B=et(F).getParent():x.length&&(B=x[0]?.getParent()??null),B&&Se(B)){let Z=Te({fields:D});B.replace(Z,!0)}}),e.dispatchCommand(de,{fields:D,selectedNodes:x,text:A.text})},schemaPath:u,schemaPathSuffix:"fields"})]})}var Di=t=>{let{anchorElem:e=document.body}=t;return Sp(wp(Ai,{anchorElem:e}),e)};import{c as Ep}from"react/compiler-runtime";import{useLexicalComposerContext as Np}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Lp}from"@lexical/utils";import{$getSelection as yp,$isElementNode as Rp,$isRangeSelection as vp,COMMAND_PRIORITY_LOW as Oi,PASTE_COMMAND as Ip}from"lexical";import{useEffect as Mp}from"react";var Fi=t=>{let e=Ep(5),{clientProps:o}=t,[n]=Np(),r,l;return e[0]!==o.defaultLinkType||e[1]!==o.defaultLinkURL||e[2]!==n?(r=()=>{if(!n.hasNodes([te]))throw new Error("LinkPlugin: LinkNode not registered on editor");return Lp(n.registerCommand(de,s=>s===null?(ln(null),!0):(s.fields?.linkType||(s.fields.linkType=o.defaultLinkType),s.fields?.url||(s.fields.url=o.defaultLinkURL),ln(s),!0),Oi),n.registerCommand(Ip,s=>{let i=yp();if(!vp(i)||i.isCollapsed()||!(s instanceof ClipboardEvent)||s.clipboardData==null)return!1;let d=s.clipboardData.getData("text");if(!ui(d))return!1;if(!i.getNodes().some($p)){let c={doc:null,linkType:"custom",newTab:!1,url:d};return n.dispatchCommand(de,{fields:c,text:null}),s.preventDefault(),!0}return!1},Oi))},l=[o.defaultLinkType,o.defaultLinkURL,n],e[0]=o.defaultLinkType,e[1]=o.defaultLinkURL,e[2]=n,e[3]=r,e[4]=l):(r=e[3],l=e[4]),Mp(r,l),null};function $p(t){return Rp(t)}var Pi=[en([{ChildComponent:ai,isActive:({selection:t})=>{if(Bi(t)){let e=et(t);return Ap(e,z)!=null}return!1},isEnabled:({selection:t})=>!!(Bi(t)&&un()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(de,null);else{let o,n=[];if(t.getEditorState().read(()=>{o=un()?.getTextContent(),n=un()?.getNodes()??[]}),!o?.length)return;let r={doc:null};t.dispatchCommand(so,{fields:r,selectedNodes:n,text:o})}},order:1}])],Dp=$(({props:t})=>({markdownTransformers:[fi],nodes:[te,t?.disableAutoLinks===!0?null:we].filter(Boolean),plugins:[{Component:Fi,position:"normal"},t?.disableAutoLinks===!0||t?.disableAutoLinks==="creationOnly"?null:{Component:Ti,position:"normal"},{Component:wi,position:"normal"},{Component:Di,position:"floatingAnchorElem"}].filter(Boolean),sanitizedClientFeatureProps:t,toolbarFixed:{groups:Pi},toolbarInline:{groups:Pi}}));import{$isListNode as fn,INSERT_CHECK_LIST_COMMAND as Wi,ListItemNode as Kp,ListNode as Jp}from"@lexical/list";import{$isRangeSelection as Xp}from"lexical";import{jsx as ji}from"react/jsx-runtime";import"react";var Op={16:"M5.584 8.223a.5.5 0 0 1 .832.554l-2 3a.502.502 0 0 1-.77.076l-1-1a.5.5 0 1 1 .708-.707l.568.569zM13 10a.5.5 0 0 1 0 1H8a.5.5 0 0 1 0-1zM5.583 3.223a.5.5 0 0 1 .832.554l-2 3a.502.502 0 0 1-.77.076l-1-1a.5.5 0 0 1 .708-.707l.568.569zM13 5a.5.5 0 1 1 0 1H8a.5.5 0 0 1 0-1z",24:"M9.084 15.223a.5.5 0 1 1 .832.554l-2 3a.5.5 0 0 1-.77.076l-1-1a.5.5 0 1 1 .708-.707l.568.569zM17.5 17a.5.5 0 0 1 0 1h-6a.5.5 0 0 1 0-1zm-8.416-6.777a.5.5 0 0 1 .832.554l-2 3a.5.5 0 0 1-.77.077l-1-1a.5.5 0 1 1 .708-.707l.568.568zM17.5 12a.5.5 0 0 1 0 1h-6a.5.5 0 0 1 0-1zM9.084 5.223a.5.5 0 0 1 .832.554l-2 3a.502.502 0 0 1-.77.077l-1-1a.5.5 0 1 1 .708-.708l.568.569zM17.5 7a.5.5 0 0 1 0 1h-6a.5.5 0 0 1 0-1z"},dn=({className:t,size:e=24})=>ji("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:ji("path",{d:Op[e],fill:"currentColor"})});import{jsx as Fp}from"react/jsx-runtime";import{ListPlugin as Bp}from"@lexical/react/LexicalListPlugin.js";import"react";var tt=()=>Fp(Bp,{});function co(t,e){return t==="ordered"?!e.has("unorderedList"):t==="checklist"?!e.has("unorderedList")&&!e.has("orderedList"):!1}function ot(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as Up,ListItemNode as Gp,ListNode as Vp}from"@lexical/list";import{$createListItemNode as Pp,$createListNode as jp,$isListItemNode as Hp,$isListNode as mn}from"@lexical/list";var Hi=4,nt=t=>(e,o,n)=>{let r=e.getPreviousSibling(),l=e.getNextSibling(),s=Pp(t==="check"?n[3]==="x":void 0);if(mn(l)&&l.getListType()===t){let d=l.getFirstChild();d!==null?d.insertBefore(s):l.append(s),e.remove()}else if(mn(r)&&r.getListType()===t)r.append(s),e.remove();else{let d=jp(t,t==="number"?Number(n[2]):void 0);d.append(s),e.replace(d)}s.append(...o),s.select(0,0);let i=Math.floor(n[1].length/Hi);i&&s.setIndent(i)},He=(t,e,o)=>{let n=[],r=t.getChildren(),l=0;for(let s of r)if(Hp(s)){if(s.getChildrenSize()===1){let u=s.getFirstChild();if(mn(u)){n.push(He(u,e,o+1));continue}}let i=" ".repeat(o*Hi),d=t.getListType(),c=d==="number"?`${t.getStart()+l}. `:d==="check"?`- [${s.getChecked()?"x":" "}] `:"- ";n.push(i+c+e(s)),l++}return n.join(`
56
+ `)};var Ui={type:"element",dependencies:[Vp,Gp],export:(t,e)=>Up(t)?He(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:nt("check")};import{jsx as Wp}from"react/jsx-runtime";import{CheckListPlugin as zp}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var Gi=()=>Wp(zp,{});var Vi=[ee([{ChildComponent:dn,isActive:({selection:t})=>{if(!Xp(t))return!1;for(let e of t.getNodes()){if(fn(e)&&e.getListType()==="check")continue;let o=e.getParent();if(fn(o)&&o.getListType()==="check")continue;let n=o?.getParent();if(!(fn(n)&&n.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(Wi,void 0)},order:12}])],Zp=$(({featureProviderMap:t})=>{let e=[{Component:Gi,position:"normal"}],o=co("checklist",t);return o&&e.push({Component:tt,position:"normal"}),{markdownTransformers:[Ui],nodes:o?[Jp,Kp]:[],plugins:e,slashMenu:{groups:[ot([{Icon:dn,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:n})=>n.t("lexical:checklist:label"),onSelect:({editor:n})=>{n.dispatchCommand(Wi,void 0)}}])]},toolbarFixed:{groups:Vi},toolbarInline:{groups:Vi}}});import{$isListNode as hn,INSERT_ORDERED_LIST_COMMAND as Xi,ListItemNode as t1,ListNode as o1}from"@lexical/list";import{$isRangeSelection as n1}from"lexical";import{jsx as zi}from"react/jsx-runtime";import"react";var Yp={16:"M5.6 9.01a.5.5 0 0 1 .4.49v1a.5.5 0 0 1-.276.447L4 11.81V12h1.5a.5.5 0 0 1 0 1h-2a.5.5 0 0 1-.5-.5v-1l.005-.07a.5.5 0 0 1 .271-.377L5 10.19V10H3.5a.5.5 0 0 1 0-1h2zM12.5 12a.5.5 0 0 1 0 1h-4a.5.5 0 0 1 0-1zm0-4.5a.5.5 0 0 1 0 1h-4a.5.5 0 0 1 0-1zM4.6 3.01a.5.5 0 0 1 .4.49v3a.5.5 0 0 1-1 0V4h-.5a.5.5 0 0 1 0-1h1zM12.5 3a.5.5 0 0 1 0 1h-4a.5.5 0 0 1 0-1z",24:"M11 7a.5.5 0 0 1 .5-.5h6a.5.5 0 0 1 0 1h-6A.5.5 0 0 1 11 7M6 7a.5.5 0 0 1 .5-.5h1A.5.5 0 0 1 8 7v3.5a.5.5 0 1 1-1 0v-3h-.5A.5.5 0 0 1 6 7m0 6.5a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 .5.5V15a.5.5 0 0 1-.276.447L7 16.31v.191h1.5a.5.5 0 0 1 0 1h-2A.5.5 0 0 1 6 17v-1a.5.5 0 0 1 .276-.447L8 14.69V14H6.5a.5.5 0 0 1-.5-.5m5.5 3a.5.5 0 1 0 0 1h6a.5.5 0 0 0 0-1zm0-5a.5.5 0 1 0 0 1h6a.5.5 0 0 0 0-1z"},pn=({className:t,size:e=24})=>zi("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:zi("path",{clipRule:"evenodd",d:Yp[e],fill:"currentColor",fillRule:"evenodd"})});import{$isListNode as qp,ListItemNode as Qp,ListNode as e1}from"@lexical/list";var Ki={type:"element",dependencies:[e1,Qp],export:(t,e)=>qp(t)?He(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:nt("number")};var Ji=[ee([{ChildComponent:pn,isActive:({selection:t})=>{if(!n1(t))return!1;for(let e of t.getNodes()){if(hn(e)&&e.getListType()==="number")continue;let o=e.getParent();if(hn(o)&&o.getListType()==="number")continue;let n=o?.getParent();if(!(hn(n)&&n.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Xi,void 0)},order:10}])],r1=$(({featureProviderMap:t})=>{let e=co("ordered",t);return{markdownTransformers:[Ki],nodes:e?[o1,t1]:[],plugins:e?[{Component:tt,position:"normal"}]:[],slashMenu:{groups:[ot([{Icon:pn,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:o})=>o.t("lexical:orderedList:label"),onSelect:({editor:o})=>{o.dispatchCommand(Xi,void 0)}}])]},toolbarFixed:{groups:Ji},toolbarInline:{groups:Ji}}});import{$isListNode as xn,INSERT_UNORDERED_LIST_COMMAND as Qi,ListItemNode as c1,ListNode as u1}from"@lexical/list";import{$isRangeSelection as d1}from"lexical";import{jsx as Zi}from"react/jsx-runtime";import"react";var l1="M7 16C7.55228 16 8 16.4477 8 17C8 17.5523 7.55228 18 7 18C6.44772 18 6 17.5523 6 17C6 16.4477 6.44772 16 7 16ZM17.5 16.5C17.7761 16.5 18 16.7239 18 17C18 17.2761 17.7761 17.5 17.5 17.5H10.5C10.2239 17.5 10 17.2761 10 17C10 16.7239 10.2239 16.5 10.5 16.5H17.5ZM7 11C7.55228 11 8 11.4477 8 12C8 12.5523 7.55228 13 7 13C6.44772 13 6 12.5523 6 12C6 11.4477 6.44772 11 7 11ZM17.5 11.5C17.7761 11.5 18 11.7239 18 12C18 12.2761 17.7761 12.5 17.5 12.5H10.5C10.2239 12.5 10 12.2761 10 12C10 11.7239 10.2239 11.5 10.5 11.5H17.5ZM7 6C7.55228 6 8 6.44772 8 7C8 7.55228 7.55228 8 7 8C6.44772 8 6 7.55228 6 7C6 6.44772 6.44772 6 7 6ZM17.5 6.5C17.7761 6.5 18 6.72386 18 7C18 7.27614 17.7761 7.5 17.5 7.5H10.5C10.2239 7.5 10 7.27614 10 7C10 6.72386 10.2239 6.5 10.5 6.5H17.5Z",gn=({className:t})=>Zi("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Zi("path",{d:l1,fill:"currentColor"})});import{$isListNode as i1,ListItemNode as s1,ListNode as a1}from"@lexical/list";var Yi={type:"element",dependencies:[a1,s1],export:(t,e)=>i1(t)?He(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:nt("bullet")};var qi=[ee([{ChildComponent:gn,isActive:({selection:t})=>{if(!d1(t))return!1;for(let e of t.getNodes()){if(xn(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(xn(o)&&o.getListType()==="bullet")continue;let n=o?.getParent();if(!(xn(n)&&n.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Qi,void 0)},order:11}])],m1=$({markdownTransformers:[Yi],nodes:[u1,c1],plugins:[{Component:tt,position:"normal"}],slashMenu:{groups:[ot([{Icon:gn,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Qi,void 0)}}])]},toolbarFixed:{groups:qi},toolbarInline:{groups:qi}});import{$setBlocksType as os}from"@lexical/selection";import{$createParagraphNode as ns,$getSelection as rs,$isParagraphNode as es,$isRangeSelection as f1}from"lexical";var ts=[ee([{ChildComponent:kt,isActive:({selection:t})=>{if(!f1(t))return!1;for(let e of t.getNodes())if(!es(e)&&!es(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=rs();os(e,()=>ns())})},order:1}])],p1=$({slashMenu:{groups:[J([{Icon:kt,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=rs();os(e,()=>ns())})}}])]},toolbarFixed:{groups:ts},toolbarInline:{groups:ts}});import{c as F1}from"react/compiler-runtime";import{jsx as Ss}from"react/jsx-runtime";import{useLexicalComposerContext as B1}from"@lexical/react/LexicalComposerContext";import{useEffect as P1,useState as j1}from"react";import{jsx as ws,Fragment as O1}from"react/jsx-runtime";import"react";import{jsx as h1}from"react/jsx-runtime";var ls={quote:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return h1("blockquote",{children:o})}};import{jsx as g1}from"react/jsx-runtime";var is={heading:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),n=t.tag;return g1(n,{children:o})}};import{jsx as x1}from"react/jsx-runtime";var ss={horizontalrule:x1("hr",{})};import{jsx as C1}from"react/jsx-runtime";var as={linebreak:C1("br",{})};import{jsx as cs}from"react/jsx-runtime";var us=({internalDocToHref:t})=>({autolink:({node:e,nodesToJSX:o})=>{let n=o({nodes:e.children}),r=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0;return cs("a",{href:e.fields.url,rel:r,target:l,children:n})},link:({node:e,nodesToJSX:o})=>{let n=o({nodes:e.children}),r=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0,s=e.fields.url??"";return e.fields.linkType==="internal"&&(t?s=t({linkNode:e}):(console.error("Lexical => JSX converter: Link converter: found internal link, but internalDocToHref is not provided"),s="#")),cs("a",{href:s,rel:r,target:l,children:n})}});import{jsx as rt,jsxs as b1,Fragment as k1}from"react/jsx-runtime";import{v4 as _1}from"uuid";var ds={list:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),n=t.tag;return rt(n,{className:`list-${t?.listType}`,children:o})},listitem:({node:t,nodesToJSX:e,parent:o})=>{let n=t.children.some(l=>l.type==="list"),r=e({nodes:t.children});if("listType"in o&&o?.listType==="check"){let l=_1();return rt("li",{"aria-checked":t.checked?"true":"false",className:`list-item-checkbox${t.checked?" list-item-checkbox-checked":" list-item-checkbox-unchecked"}${n?" nestedListItem":""}`,role:"checkbox",style:{listStyleType:"none"},tabIndex:-1,value:t?.value,children:n?r:b1(k1,{children:[rt("input",{checked:t.checked,id:l,readOnly:!0,type:"checkbox"}),rt("label",{htmlFor:l,children:r}),rt("br",{})]})})}else return rt("li",{className:`${n?"nestedListItem":""}`,style:n?{listStyleType:"none"}:void 0,value:t?.value,children:r})}};import{jsx as Cn}from"react/jsx-runtime";var ms={paragraph:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return o?.length?Cn("p",{children:o}):Cn("p",{children:Cn("br",{})})}};var fs={tab:" "};import{jsx as vt}from"react/jsx-runtime";var ps={table:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return vt("div",{className:"lexical-table-container",children:vt("table",{className:"lexical-table",style:{borderCollapse:"collapse"},children:vt("tbody",{children:o})})})},tablecell:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),n=t.headerState>0?"th":"td",r=`lexical-table-cell-header-${t.headerState}`,l={backgroundColor:t.backgroundColor||void 0,border:"1px solid #ccc",padding:"8px"},s=t.colSpan&&t.colSpan>1?t.colSpan:void 0,i=t.rowSpan&&t.rowSpan>1?t.rowSpan:void 0;return vt(n,{className:`lexical-table-cell ${r}`,colSpan:s,rowSpan:i,style:l,children:o})},tablerow:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return vt("tr",{className:"lexical-table-row",children:o})}};import{jsx as Ue}from"react/jsx-runtime";import"react";var O={DOM_ELEMENT_TYPE:1,DOM_TEXT_TYPE:3,NO_DIRTY_NODES:0,HAS_DIRTY_NODES:1,FULL_RECONCILE:2,IS_NORMAL:0,IS_TOKEN:1,IS_SEGMENTED:2,IS_INERT:3,IS_BOLD:1,IS_ITALIC:2,IS_STRIKETHROUGH:4,IS_UNDERLINE:8,IS_CODE:16,IS_SUBSCRIPT:32,IS_SUPERSCRIPT:64,IS_HIGHLIGHT:128,IS_DIRECTIONLESS:1,IS_UNMERGEABLE:2,IS_ALIGN_LEFT:1,IS_ALIGN_CENTER:2,IS_ALIGN_RIGHT:3,IS_ALIGN_JUSTIFY:4,IS_ALIGN_START:5,IS_ALIGN_END:6},T1=O.IS_BOLD|O.IS_ITALIC|O.IS_STRIKETHROUGH|O.IS_UNDERLINE|O.IS_CODE|O.IS_SUBSCRIPT|O.IS_SUPERSCRIPT|O.IS_HIGHLIGHT,w1="\xA0",S1=`
57
57
 
58
- `,_s="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",Ts="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",L0=new RegExp("^[^"+Ts+"]*["+_s+"]"),y0=new RegExp("^[^"+_s+"]*["+Ts+"]"),R0={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},I0={directionless:A.IS_DIRECTIONLESS,unmergeable:A.IS_UNMERGEABLE},v0={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},M0={[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"},D0={normal:A.IS_NORMAL,segmented:A.IS_SEGMENTED,token:A.IS_TOKEN},$0={[A.IS_NORMAL]:"normal",[A.IS_SEGMENTED]:"segmented",[A.IS_TOKEN]:"token"};var ws={text:({node:t})=>{let e=t.text;return t.format&A.IS_BOLD&&(e=Ue("strong",{children:e})),t.format&A.IS_ITALIC&&(e=Ue("em",{children:e})),t.format&A.IS_STRIKETHROUGH&&(e=Ue("span",{style:{textDecoration:"line-through"},children:e})),t.format&A.IS_UNDERLINE&&(e=Ue("span",{style:{textDecoration:"underline"},children:e})),t.format&A.IS_CODE&&(e=Ue("code",{children:e})),t.format&A.IS_SUBSCRIPT&&(e=Ue("sub",{children:e})),t.format&A.IS_SUPERSCRIPT&&(e=Ue("sup",{children:e})),e}};import{jsx as Ot}from"react/jsx-runtime";var Ss={upload:({node:t})=>{let e=t;if(typeof e.value!="object")return null;let o=e.value,r=e.fields?.alt||o?.alt||"",n=o.url;if(!o.mimeType.startsWith("image"))return Ot("a",{href:n,rel:"noopener noreferrer",children:o.filename});if(!o.sizes||!Object.keys(o.sizes).length)return Ot("img",{alt:r,height:o.height,src:n,width:o.width});let l=[];for(let s in o.sizes){let i=o.sizes[s];if(!i||!i.width||!i.height||!i.mimeType||!i.filesize||!i.filename||!i.url)continue;let d=i?.url;l.push(Ot("source",{media:`(max-width: ${i.width}px)`,srcSet:d,type:i.mimeType},s))}return l.push(Ot("img",{alt:r,height:o?.height,src:n,width:o?.width},"image")),Ot("picture",{children:l})}};var it={...Cs,...ws,...fs,...ds,...ks,...ms,...ps,...xs,...gs({}),...Ss,...bs};import{jsx as bo,Fragment as O0}from"react/jsx-runtime";import Co from"react";function Es(t){if(!!!t?.root?.children?.length)return!1;let o=!1;if(t?.root?.children?.length===1&&t?.root?.children[0]?.type==="paragraph"){let r=t?.root?.children[0];if(!r?.children||r?.children?.length===0)o=!0;else if(r?.children?.length===1){let n=r?.children[0];n?.type==="text"&&(n?.text?.length||(o=!0))}}return!o}function A0(t){return e=>{let o={...e,isEditor:!1,isJSXConverter:!0};if(t.Component)return t.Component(o);if(t.html){let r=typeof t.html=="function"?t.html(o):t.html;return bo("span",{dangerouslySetInnerHTML:{__html:r}})}return null}}function Ns(t){return e=>{if(t.Component){let o={...e,isEditor:!1,isJSXConverter:!0};return t.Component(o)}if(t.Block){let o=e.node,r={childIndex:e.childIndex,converters:e.converters,formData:o.fields??{},isEditor:!1,isJSXConverter:!0,node:o,nodesToJSX:e.nodesToJSX,parent:e.parent};return Co.createElement(t.Block,r)}if(t.html){let o={...e,isEditor:!1,isJSXConverter:!0},r=typeof t.html=="function"?t.html(o):t.html;return bo("span",{dangerouslySetInnerHTML:{__html:r}})}return null}}function F0(t){let e={};for(let[o,r]of Object.entries(t)){if(!r||typeof r!="object")continue;if(o==="blocks"){e.blocks={};for(let[l,s]of Object.entries(r)){let i=s;(i.Component||i.Block||i.html)&&(e.blocks[l]=Ns(i))}continue}if(o==="inlineBlocks"){e.inlineBlocks={};for(let[l,s]of Object.entries(r)){let i=s;(i.Component||i.Block||i.html)&&(e.inlineBlocks[l]=Ns(i))}continue}let n=r;(n.Component||n.html)&&(e[o]=A0(n))}return e}function Ls({converters:t,data:e,disableIndent:o,disableTextAlign:r,nodeMap:n}){if(Es(e)){let l=n?F0(n):void 0,s=l?{...t,...l,blocks:{...t.blocks,...l.blocks},inlineBlocks:{...t.inlineBlocks,...l.inlineBlocks}}:t;return ys({converters:s,disableIndent:o,disableTextAlign:r,nodes:e.root.children,parent:e.root})}return bo(O0,{})}function ys({converters:t,disableIndent:e,disableTextAlign:o,nodes:r,parent:n}){let l=t.unknown;return r.map((i,d)=>{let c;i.type==="block"?(c=t?.blocks?.[i?.fields?.blockType],!c&&!l&&console.error(`Lexical => JSX converter: Blocks converter: found ${i?.fields?.blockType} block, but no converter is provided`)):i.type==="inlineBlock"?(c=t?.inlineBlocks?.[i?.fields?.blockType],!c&&!l&&console.error(`Lexical => JSX converter: Inline Blocks converter: found ${i?.fields?.blockType} inline block, but no converter is provided`)):c=t[i.type];try{!c&&l&&(c=l);let u;c?u=typeof c=="function"?c({childIndex:d,converters:t,node:i,nodesToJSX:p=>ys({converters:p.converters??t,disableIndent:p.disableIndent??e,disableTextAlign:p.disableTextAlign??o,nodes:p.nodes,parent:p.parent??{...i,parent:n}}),parent:n}):c:u=bo("span",{children:"unknown node"},d);let a={};if(!o&&(!Array.isArray(o)||!o?.includes(i.type))&&"format"in i&&i.format)switch(i.format){case"center":a.textAlign="center";break;case"end":a.textAlign="right";break;case"justify":a.textAlign="justify";break;case"left":break;case"right":a.textAlign="right";break;case"start":a.textAlign="left";break}if(!e&&(!Array.isArray(e)||!e?.includes(i.type))&&"indent"in i&&i.indent&&i.type!=="listitem"&&(a.paddingInlineStart=`${Number(i.indent)*40}px`),Co.isValidElement(u)){if(a.textAlign||a.paddingInlineStart){let m={...a,...u?.props?.style??{}};return Co.cloneElement(u,{key:d,style:m})}return Co.cloneElement(u,{key:d})}return u}catch(u){return console.error("Error converting lexical node to JSX:",u,"node:",i),null}}).filter(Boolean)}function yr({className:t,converters:e,data:o,disableContainer:r,disableIndent:n,disableTextAlign:l,nodeMap:s}){if(!o)return null;let i={};e?typeof e=="function"?i=e({defaultConverters:it}):i=e:i=it;let d=o&&!Array.isArray(o)&&typeof o=="object"&&"root"in o&&Ls({converters:i,data:o,disableIndent:n,disableTextAlign:l,nodeMap:s});return r?Rs(P0,{children:d}):Rs("div",{className:t??"payload-richtext",children:d})}function vs(){let t=B0(7),[e]=j0(),o;t[0]!==e?(o=()=>e.getEditorState().toJSON(),t[0]=e,t[1]=o):o=t[1];let[r,n]=U0(o),l,s;t[2]!==e?(l=()=>e.registerUpdateListener(d=>{let{editorState:c}=d;n(c.toJSON())}),s=[e],t[2]=e,t[3]=l,t[4]=s):(l=t[3],s=t[4]),H0(l,s);let i;return t[5]!==r?(i=Is("div",{className:"debug-jsx-converter",children:Is(yr,{converters:it,data:r})}),t[5]=r,t[6]=i):i=t[6],i}var W0=M({plugins:[{Component:vs,position:"bottom"}]});var j={amber:{50:"oklch(0.987 0.022 95.277)",100:"oklch(0.962 0.059 95.617)",200:"oklch(0.924 0.12 95.746)",300:"oklch(0.879 0.169 91.605)",400:"oklch(0.828 0.189 84.429)",500:"oklch(0.769 0.188 70.08)",600:"oklch(0.666 0.179 58.318)",700:"oklch(0.555 0.163 48.998)",800:"oklch(0.473 0.137 46.201)",900:"oklch(0.414 0.112 45.904)",950:"oklch(0.279 0.077 45.635)"},black:"#000",blue:{50:"oklch(0.97 0.014 254.604)",100:"oklch(0.932 0.032 255.585)",200:"oklch(0.882 0.059 254.128)",300:"oklch(0.809 0.105 251.813)",400:"oklch(0.707 0.165 254.624)",500:"oklch(0.623 0.214 259.815)",600:"oklch(0.546 0.245 262.881)",700:"oklch(0.488 0.243 264.376)",800:"oklch(0.424 0.199 265.638)",900:"oklch(0.379 0.146 265.522)",950:"oklch(0.282 0.091 267.935)"},current:"currentColor",cyan:{50:"oklch(0.984 0.019 200.873)",100:"oklch(0.956 0.045 203.388)",200:"oklch(0.917 0.08 205.041)",300:"oklch(0.865 0.127 207.078)",400:"oklch(0.789 0.154 211.53)",500:"oklch(0.715 0.143 215.221)",600:"oklch(0.609 0.126 221.723)",700:"oklch(0.52 0.105 223.128)",800:"oklch(0.45 0.085 224.283)",900:"oklch(0.398 0.07 227.392)",950:"oklch(0.302 0.056 229.695)"},emerald:{50:"oklch(0.979 0.021 166.113)",100:"oklch(0.95 0.052 163.051)",200:"oklch(0.905 0.093 164.15)",300:"oklch(0.845 0.143 164.978)",400:"oklch(0.765 0.177 163.223)",500:"oklch(0.696 0.17 162.48)",600:"oklch(0.596 0.145 163.225)",700:"oklch(0.508 0.118 165.612)",800:"oklch(0.432 0.095 166.913)",900:"oklch(0.378 0.077 168.94)",950:"oklch(0.262 0.051 172.552)"},fuchsia:{50:"oklch(0.977 0.017 320.058)",100:"oklch(0.952 0.037 318.852)",200:"oklch(0.903 0.076 319.62)",300:"oklch(0.833 0.145 321.434)",400:"oklch(0.74 0.238 322.16)",500:"oklch(0.667 0.295 322.15)",600:"oklch(0.591 0.293 322.896)",700:"oklch(0.518 0.253 323.949)",800:"oklch(0.452 0.211 324.591)",900:"oklch(0.401 0.17 325.612)",950:"oklch(0.293 0.136 325.661)"},gray:{50:"oklch(0.985 0.002 247.839)",100:"oklch(0.967 0.003 264.542)",200:"oklch(0.928 0.006 264.531)",300:"oklch(0.872 0.01 258.338)",400:"oklch(0.707 0.022 261.325)",500:"oklch(0.551 0.027 264.364)",600:"oklch(0.446 0.03 256.802)",700:"oklch(0.373 0.034 259.733)",800:"oklch(0.278 0.033 256.848)",900:"oklch(0.21 0.034 264.665)",950:"oklch(0.13 0.028 261.692)"},green:{50:"oklch(0.982 0.018 155.826)",100:"oklch(0.962 0.044 156.743)",200:"oklch(0.925 0.084 155.995)",300:"oklch(0.871 0.15 154.449)",400:"oklch(0.792 0.209 151.711)",500:"oklch(0.723 0.219 149.579)",600:"oklch(0.627 0.194 149.214)",700:"oklch(0.527 0.154 150.069)",800:"oklch(0.448 0.119 151.328)",900:"oklch(0.393 0.095 152.535)",950:"oklch(0.266 0.065 152.934)"},indigo:{50:"oklch(0.962 0.018 272.314)",100:"oklch(0.93 0.034 272.788)",200:"oklch(0.87 0.065 274.039)",300:"oklch(0.785 0.115 274.713)",400:"oklch(0.673 0.182 276.935)",500:"oklch(0.585 0.233 277.117)",600:"oklch(0.511 0.262 276.966)",700:"oklch(0.457 0.24 277.023)",800:"oklch(0.398 0.195 277.366)",900:"oklch(0.359 0.144 278.697)",950:"oklch(0.257 0.09 281.288)"},inherit:"inherit",lime:{50:"oklch(0.986 0.031 120.757)",100:"oklch(0.967 0.067 122.328)",200:"oklch(0.938 0.127 124.321)",300:"oklch(0.897 0.196 126.665)",400:"oklch(0.841 0.238 128.85)",500:"oklch(0.768 0.233 130.85)",600:"oklch(0.648 0.2 131.684)",700:"oklch(0.532 0.157 131.589)",800:"oklch(0.453 0.124 130.933)",900:"oklch(0.405 0.101 131.063)",950:"oklch(0.274 0.072 132.109)"},neutral:{50:"oklch(0.985 0 0)",100:"oklch(0.97 0 0)",200:"oklch(0.922 0 0)",300:"oklch(0.87 0 0)",400:"oklch(0.708 0 0)",500:"oklch(0.556 0 0)",600:"oklch(0.439 0 0)",700:"oklch(0.371 0 0)",800:"oklch(0.269 0 0)",900:"oklch(0.205 0 0)",950:"oklch(0.145 0 0)"},orange:{50:"oklch(0.98 0.016 73.684)",100:"oklch(0.954 0.038 75.164)",200:"oklch(0.901 0.076 70.697)",300:"oklch(0.837 0.128 66.29)",400:"oklch(0.75 0.183 55.934)",500:"oklch(0.705 0.213 47.604)",600:"oklch(0.646 0.222 41.116)",700:"oklch(0.553 0.195 38.402)",800:"oklch(0.47 0.157 37.304)",900:"oklch(0.408 0.123 38.172)",950:"oklch(0.266 0.079 36.259)"},pink:{50:"oklch(0.971 0.014 343.198)",100:"oklch(0.948 0.028 342.258)",200:"oklch(0.899 0.061 343.231)",300:"oklch(0.823 0.12 346.018)",400:"oklch(0.718 0.202 349.761)",500:"oklch(0.656 0.241 354.308)",600:"oklch(0.592 0.249 0.584)",700:"oklch(0.525 0.223 3.958)",800:"oklch(0.459 0.187 3.815)",900:"oklch(0.408 0.153 2.432)",950:"oklch(0.284 0.109 3.907)"},purple:{50:"oklch(0.977 0.014 308.299)",100:"oklch(0.946 0.033 307.174)",200:"oklch(0.902 0.063 306.703)",300:"oklch(0.827 0.119 306.383)",400:"oklch(0.714 0.203 305.504)",500:"oklch(0.627 0.265 303.9)",600:"oklch(0.558 0.288 302.321)",700:"oklch(0.496 0.265 301.924)",800:"oklch(0.438 0.218 303.724)",900:"oklch(0.381 0.176 304.987)",950:"oklch(0.291 0.149 302.717)"},red:{50:"oklch(0.971 0.013 17.38)",100:"oklch(0.936 0.032 17.717)",200:"oklch(0.885 0.062 18.334)",300:"oklch(0.808 0.114 19.571)",400:"oklch(0.704 0.191 22.216)",500:"oklch(0.637 0.237 25.331)",600:"oklch(0.577 0.245 27.325)",700:"oklch(0.505 0.213 27.518)",800:"oklch(0.444 0.177 26.899)",900:"oklch(0.396 0.141 25.723)",950:"oklch(0.258 0.092 26.042)"},rose:{50:"oklch(0.969 0.015 12.422)",100:"oklch(0.941 0.03 12.58)",200:"oklch(0.892 0.058 10.001)",300:"oklch(0.81 0.117 11.638)",400:"oklch(0.712 0.194 13.428)",500:"oklch(0.645 0.246 16.439)",600:"oklch(0.586 0.253 17.585)",700:"oklch(0.514 0.222 16.935)",800:"oklch(0.455 0.188 13.697)",900:"oklch(0.41 0.159 10.272)",950:"oklch(0.271 0.105 12.094)"},sky:{50:"oklch(0.977 0.013 236.62)",100:"oklch(0.951 0.026 236.824)",200:"oklch(0.901 0.058 230.902)",300:"oklch(0.828 0.111 230.318)",400:"oklch(0.746 0.16 232.661)",500:"oklch(0.685 0.169 237.323)",600:"oklch(0.588 0.158 241.966)",700:"oklch(0.5 0.134 242.749)",800:"oklch(0.443 0.11 240.79)",900:"oklch(0.391 0.09 240.876)",950:"oklch(0.293 0.066 243.157)"},slate:{50:"oklch(0.984 0.003 247.858)",100:"oklch(0.968 0.007 247.896)",200:"oklch(0.929 0.013 255.508)",300:"oklch(0.869 0.022 252.894)",400:"oklch(0.704 0.04 256.788)",500:"oklch(0.554 0.046 257.417)",600:"oklch(0.446 0.043 257.281)",700:"oklch(0.372 0.044 257.287)",800:"oklch(0.279 0.041 260.031)",900:"oklch(0.208 0.042 265.755)",950:"oklch(0.129 0.042 264.695)"},stone:{50:"oklch(0.985 0.001 106.423)",100:"oklch(0.97 0.001 106.424)",200:"oklch(0.923 0.003 48.717)",300:"oklch(0.869 0.005 56.366)",400:"oklch(0.709 0.01 56.259)",500:"oklch(0.553 0.013 58.071)",600:"oklch(0.444 0.011 73.639)",700:"oklch(0.374 0.01 67.558)",800:"oklch(0.268 0.007 34.298)",900:"oklch(0.216 0.006 56.043)",950:"oklch(0.147 0.004 49.25)"},teal:{50:"oklch(0.984 0.014 180.72)",100:"oklch(0.953 0.051 180.801)",200:"oklch(0.91 0.096 180.426)",300:"oklch(0.855 0.138 181.071)",400:"oklch(0.777 0.152 181.912)",500:"oklch(0.704 0.14 182.503)",600:"oklch(0.6 0.118 184.704)",700:"oklch(0.511 0.096 186.391)",800:"oklch(0.437 0.078 188.216)",900:"oklch(0.386 0.063 188.416)",950:"oklch(0.277 0.046 192.524)"},transparent:"transparent",violet:{50:"oklch(0.969 0.016 293.756)",100:"oklch(0.943 0.029 294.588)",200:"oklch(0.894 0.057 293.283)",300:"oklch(0.811 0.111 293.571)",400:"oklch(0.702 0.183 293.541)",500:"oklch(0.606 0.25 292.717)",600:"oklch(0.541 0.281 293.009)",700:"oklch(0.491 0.27 292.581)",800:"oklch(0.432 0.232 292.759)",900:"oklch(0.38 0.189 293.745)",950:"oklch(0.283 0.141 291.089)"},white:"#fff",yellow:{50:"oklch(0.987 0.026 102.212)",100:"oklch(0.973 0.071 103.193)",200:"oklch(0.945 0.129 101.54)",300:"oklch(0.905 0.182 98.111)",400:"oklch(0.852 0.199 91.936)",500:"oklch(0.795 0.184 86.047)",600:"oklch(0.681 0.162 75.834)",700:"oklch(0.554 0.135 66.442)",800:"oklch(0.476 0.114 61.907)",900:"oklch(0.421 0.095 57.708)",950:"oklch(0.286 0.066 53.813)"},zinc:{50:"oklch(0.985 0 0)",100:"oklch(0.967 0.001 286.375)",200:"oklch(0.92 0.004 286.32)",300:"oklch(0.871 0.006 286.286)",400:"oklch(0.705 0.015 286.067)",500:"oklch(0.552 0.016 285.938)",600:"oklch(0.442 0.017 285.786)",700:"oklch(0.37 0.013 285.805)",800:"oklch(0.274 0.006 286.033)",900:"oklch(0.21 0.006 285.885)",950:"oklch(0.141 0.005 285.823)"}},G0={text:{"text-red":{css:{color:`light-dark(${j.red[600]}, ${j.red[400]})`},label:"Red"},"text-orange":{css:{color:`light-dark(${j.orange[600]}, ${j.orange[400]})`},label:"Orange"},"text-yellow":{css:{color:`light-dark(${j.yellow[700]}, ${j.yellow[300]})`},label:"Yellow"},"text-green":{css:{color:`light-dark(${j.green[700]}, ${j.green[400]})`},label:"Green"},"text-blue":{css:{color:`light-dark(${j.blue[600]}, ${j.blue[400]})`},label:"Blue"},"text-purple":{css:{color:`light-dark(${j.purple[600]}, ${j.purple[400]})`},label:"Purple"},"text-pink":{css:{color:`light-dark(${j.pink[600]}, ${j.pink[400]})`},label:"Pink"}},background:{"bg-red":{css:{"background-color":`light-dark(${j.red[400]}, ${j.red[600]})`},label:"Red"},"bg-orange":{css:{"background-color":`light-dark(${j.orange[400]}, ${j.orange[600]})`},label:"Orange"},"bg-yellow":{css:{"background-color":`light-dark(${j.yellow[300]}, ${j.yellow[700]})`},label:"Yellow"},"bg-green":{css:{"background-color":`light-dark(${j.green[400]}, ${j.green[700]})`},label:"Green"},"bg-blue":{css:{"background-color":`light-dark(${j.blue[400]}, ${j.blue[600]})`},label:"Blue"},"bg-purple":{css:{"background-color":`light-dark(${j.purple[400]}, ${j.purple[600]})`},label:"Purple"},"bg-pink":{css:{"background-color":`light-dark(${j.pink[400]}, ${j.pink[600]})`},label:"Pink"}}};import{$isNodeSelection as M1}from"lexical";import{jsx as At,jsxs as V0}from"react/jsx-runtime";import"react";var Rr=()=>V0("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[At("g",{clipPath:"url(#clip0_4397_10817)",children:At("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"})}),At("defs",{children:At("clipPath",{id:"clip0_4397_10817",children:At("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{jsx as Z0}from"react/jsx-runtime";import{$applyNodeReplacement as Y0}from"lexical";import*as Ds from"react";import{DecoratorBlockNode as J0}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as K0}from"@lexical/utils";import{$applyNodeReplacement as X0}from"lexical";function z0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Ms({relationTo:o,value:e})}:null}var Ft=class extends J0{__data;constructor({data:e,format:o,key:r}){super(o,r),this.__data=e}static clone(e){return new this({data:e.__data,format:e.__format,key:e.__key})}static getType(){return"relationship"}static importDOM(){return{div:e=>!e.hasAttribute("data-lexical-relationship-relationTo")||!e.hasAttribute("data-lexical-relationship-id")?null:{conversion:z0,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=Ms(o);return r.setFormat(e.format),r}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return K0(o,e?.theme?.relationship),o}decorate(e,o){return null}exportDOM(){let e=document.createElement("div");e.setAttribute("data-lexical-relationship-id",String(typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value)),e.setAttribute("data-lexical-relationship-relationTo",this.__data?.relationTo);let o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"relationship",version:2}}getData(){return this.getLatest().__data}getTextContent(){return`${this.__data?.relationTo} relation to ${typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value}`}setData(e){let o=this.getWritable();o.__data=e}};function Ms(t){return X0(new Ft({data:t}))}var q0=Ds.lazy(()=>import("./RelationshipComponent-BG3DPV3T.js").then(t=>({default:t.RelationshipComponent})));function Q0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:We({relationTo:o,value:e})}:null}var Ne=class extends Ft{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:Q0,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=We(o);return r.setFormat(e.format),r}decorate(e,o){return Z0(q0,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function We(t){return Y0(new Ne({data:t}))}function Ir(t){return t instanceof Ne}import{c as k1}from"react/compiler-runtime";import{jsx as _1}from"react/jsx-runtime";import{useLexicalComposerContext as T1}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as w1}from"@lexical/utils";import{$getPreviousSelection as S1,$getSelection as E1,$isParagraphNode as N1,$isRangeSelection as L1,COMMAND_PRIORITY_EDITOR as y1,createCommand as R1}from"lexical";import{useEffect as I1}from"react";import{c as As}from"react/compiler-runtime";import{jsx as vr}from"react/jsx-runtime";import{useLexicalComposerContext as Fs}from"@lexical/react/LexicalComposerContext.js";import{toast as d1}from"@payloadcms/ui";import{$getNodeByKey as m1,COMMAND_PRIORITY_EDITOR as Ps}from"lexical";import{useEffect as Bs,useState as p1}from"react";import{c as e1}from"react/compiler-runtime";import{jsx as t1}from"react/jsx-runtime";import{useLexicalComposerContext as o1}from"@lexical/react/LexicalComposerContext";import{useListDrawer as r1,useModal as n1}from"@payloadcms/ui";import{$getNodeByKey as $s,$getPreviousSelection as l1,$getRoot as i1,$getSelection as s1,$isRangeSelection as a1,$setSelection as c1}from"lexical";import{useEffect as u1,useState as Os}from"react";var Pt=t=>{let e=e1(23),[o]=o1(),[r,n]=Os(null),[l,s]=Os(!1),[i,d,c]=r1(t),{closeDrawer:u,drawerSlug:a,isDrawerOpen:m,openDrawer:p}=c,{modalState:h}=n1(),f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=()=>{let I=s1()??l1();n(I)},e[0]=f):f=e[0];let g=f,k;e[1]!==o||e[2]!==r?(k=()=>{r&&o.update(()=>{if(a1(r)){let{anchor:I,focus:y}=r;$s(I.key)&&$s(y.key)&&c1(r.clone())}else i1().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=r,e[3]=k):k=e[3];let N=k,R;e[4]!==u?(R=()=>{u()},e[4]=u,e[5]=R):R=e[5];let T=R,C,x;e[6]!==a||e[7]!==h||e[8]!==N||e[9]!==l?(C=()=>{if(!l)return;let I=h[a];I&&!I?.isOpen&&(s(!1),setTimeout(()=>{N()},1))},x=[h,a,N,l],e[6]=a,e[7]=h,e[8]=N,e[9]=l,e[10]=C,e[11]=x):(C=e[10],x=e[11]),u1(C,x);let b;e[12]!==d?(b=I=>t1(d,{...I,onClick:()=>{g()}}),e[12]=d,e[13]=b):b=e[13];let _;e[14]!==p?(_=()=>{g(),p(),s(!0)},e[14]=p,e[15]=_):_=e[15];let D;return e[16]!==i||e[17]!==T||e[18]!==m||e[19]!==a||e[20]!==b||e[21]!==_?(D={closeListDrawer:T,isListDrawerOpen:m,ListDrawer:i,listDrawerSlug:a,ListDrawerToggler:b,openListDrawer:_},e[16]=i,e[17]=T,e[18]=m,e[19]=a,e[20]=b,e[21]=_,e[22]=D):D=e[22],D};var f1=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=m1(o);n&&n.replace(We({relationTo:e,value:r}))}):t.dispatchCommand(Mr,{relationTo:e,value:r})},h1=t=>{let e=As(14),{enabledCollectionSlugs:o}=t,[r]=Fs(),[n,l]=p1(null),s=o?.[0],i;e[0]!==o||e[1]!==s?(i={collectionSlugs:o,selectedCollection:s},e[0]=o,e[1]=s,e[2]=i):i=e[2];let{closeListDrawer:d,ListDrawer:c,openListDrawer:u}=Pt(i),a,m;e[3]!==r||e[4]!==u?(a=()=>r.registerCommand(Xe,g=>(l(g?.replace?g?.replace.nodeKey:null),u(),!0),Ps),m=[r,u],e[3]=r,e[4]=u,e[5]=a,e[6]=m):(a=e[5],m=e[6]),Bs(a,m);let p;e[7]!==d||e[8]!==r||e[9]!==n?(p=g=>{let{collectionSlug:k,doc:N}=g;f1({editor:r,relationTo:k,replaceNodeKey:n,value:N.id}),d()},e[7]=d,e[8]=r,e[9]=n,e[10]=p):p=e[10];let h=p,f;return e[11]!==c||e[12]!==h?(f=vr(c,{onSelect:h}),e[11]=c,e[12]=h,e[13]=f):f=e[13],f},g1=()=>{let t=As(3),[e]=Fs(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Xe,x1,Ps),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Bs(o,r),null},js=({enabledCollectionSlugs:t})=>t?.length?vr(h1,{enabledCollectionSlugs:t}):vr(g1,{});function x1(){return d1.error("No relationship collections enabled"),!0}import{useConfig as C1,useEntityVisibility as b1}from"@payloadcms/ui";import*as Hs from"react";var ko=t=>{let{collectionSlugsBlacklist:e,collectionSlugsWhitelist:o,uploads:r=!1}=t||{},{config:{collections:n}}=C1(),{visibleEntities:l}=b1();return Hs.useMemo(()=>{let i=[],d=[],c=o?new Set(o):null,u=e?new Set(e):null;for(let a of n){let{slug:m,admin:{enableRichTextRelationship:p},upload:h}=a;if(l?.collections.includes(m)){if(r){if(!p||!h)continue}else if(h||!p)continue;c&&!c.has(m)||u&&u.has(m)||(i.push(m),d.push(a))}}return{enabledCollections:d,enabledCollectionSlugs:i}},[n,l,r,o,e])};var Mr=R1("INSERT_RELATIONSHIP_COMMAND"),Us=t=>{let e=k1(8),{clientProps:o}=t,[r]=T1(),n=o?.disabledCollections,l=o?.enabledCollections,s;e[0]!==n||e[1]!==l?(s={collectionSlugsBlacklist:n,collectionSlugsWhitelist:l},e[0]=n,e[1]=l,e[2]=s):s=e[2];let{enabledCollectionSlugs:i}=ko(s),d,c;e[3]!==r?(d=()=>{if(!r.hasNodes([Ne]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return r.registerCommand(Mr,v1,y1)},c=[r],e[3]=r,e[4]=d,e[5]=c):(d=e[4],c=e[5]),I1(d,c);let u;return e[6]!==i?(u=_1(js,{enabledCollectionSlugs:i}),e[6]=i,e[7]=u):u=e[7],u};function v1(t){let e=E1()||S1();if(L1(e)){let o=We(t),{focus:r}=e,n=r.getNode();w1(o),N1(n)&&!n.__first&&n.remove()}return!0}var D1=M({nodes:[Ne],plugins:[{Component:Us,position:"normal"}],slashMenu:{groups:[X([{Icon:Rr,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Xe,{replace:!1})}}])]},toolbarFixed:{groups:[ke([{ChildComponent:Rr,isActive:({selection:t})=>{if(!M1(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Ir(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Xe,{replace:!1})}}])]}});import{c as nh}from"react/compiler-runtime";import{jsx as me,jsxs as lh}from"react/jsx-runtime";import{useLexicalComposerContext as ih}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as Ys}from"@lexical/react/useLexicalEditable";import{useScrollInfo as sh,useThrottledEffect as ah,useTranslation as ch}from"@payloadcms/ui";import*as So from"react";import{useMemo as Ar}from"react";import{c as $1}from"react/compiler-runtime";import{jsx as O1}from"react/jsx-runtime";import{$addUpdateTag as A1}from"lexical";import"react";var Ws="toolbar-popup__button",Bt=t=>{let e=$1(14),{active:o,children:r,editor:n,enabled:l,item:s}=t,i=o===void 0?!1:o,d=l===void 0?!0:l,c=d?"":"disabled",u=i?"active":"",a=s.key?`${Ws}-${s.key}`:"",m;e[0]!==c||e[1]!==u||e[2]!==a?(m=[Ws,c,u,a].filter(Boolean),e[0]=c,e[1]=u,e[2]=a,e[3]=m):m=e[3];let p=m.join(" "),h;e[4]!==i||e[5]!==n||e[6]!==d||e[7]!==s?(h=()=>{d&&n.focus(()=>{n.update(F1),s.onSelect?.({editor:n,isActive:i})})},e[4]=i,e[5]=n,e[6]=d,e[7]=s,e[8]=h):h=e[8];let f=h,g=P1,k;return e[9]!==r||e[10]!==p||e[11]!==f||e[12]!==s.key?(k=O1("button",{className:p,"data-button-key":s.key,onClick:f,onMouseDown:g,type:"button",children:r}),e[9]=r,e[10]=p,e[11]=f,e[12]=s.key,e[13]=k):k=e[13],k};function F1(){A1("toolbar")}function P1(t){t.preventDefault()}import{c as V1}from"react/compiler-runtime";import{jsx as st}from"react/jsx-runtime";import J1,{useMemo as K1}from"react";import{useTranslation as X1}from"@payloadcms/ui";import{jsx as Me,jsxs as Gs}from"react/jsx-runtime";import{Button as B1}from"@payloadcms/ui";import{$addUpdateTag as j1,isDOMNode as H1}from"lexical";import _o,{useCallback as U1,useEffect as To,useMemo as Js,useRef as Dr,useState as $r}from"react";import{createPortal as W1}from"react-dom";var Vs="toolbar-popup__dropdown-item",Ks=_o.createContext(null);function Xs({active:t,children:e,editor:o,enabled:r,Icon:n,item:l,itemKey:s,tooltip:i}){let d=Js(()=>[Vs,r===!1?"disabled":"",t?"active":"",l?.key?`${Vs}-${l.key}`:""].filter(Boolean).join(" "),[r,t,l.key]),c=Dr(null),u=_o.use(Ks);if(u===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=u;return To(()=>{c?.current!=null&&a(c)},[c,a]),Me(B1,{"aria-label":i,buttonStyle:"none",className:d,disabled:r===!1,extraButtonProps:{"data-item-key":s},icon:n,iconPosition:"left",iconStyle:"none",onClick:()=>{r!==!1&&o.focus(()=>{o.update(()=>{j1("toolbar")}),l.onSelect?.({editor:o,isActive:t})})},onMouseDown:m=>{m.preventDefault()},ref:c,tooltip:i,type:"button",children:e})}function G1({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:r}){let[n,l]=$r(),[s,i]=$r(),d=U1(a=>{l(m=>m!=null?[...m,a]:[a])},[l]),c=a=>{if(n==null)return;let{key:m}=a;["ArrowDown","ArrowUp","Escape","Tab"].includes(m)&&a.preventDefault(),m==="Escape"||m==="Tab"?r():m==="ArrowUp"?i(p=>{if(p==null)return n[0];let h=n.indexOf(p)-1;return n[h===-1?n.length-1:h]}):m==="ArrowDown"&&i(p=>p==null?n[0]:n[n.indexOf(p)+1])},u=Js(()=>({registerItem:d}),[d]);return To(()=>{n!=null&&s==null&&i(n[0]),s!=null&&s?.current!=null&&s.current.focus()},[n,s]),Me(Ks,{value:u,children:Me("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:c,ref:e,children:t})})}function zs({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:r=!1,dropdownKey:n,Icon:l,itemsContainerClassNames:s,label:i,stopCloseOnClickSelf:d}){let c=Dr(null),u=Dr(null),[a,m]=$r(!1),p=()=>{m(!1),u?.current!=null&&u.current.focus()};To(()=>{let f=u.current,g=c.current;if(a&&f!==null&&g!==null){let{left:k,top:N}=f.getBoundingClientRect(),R=window.scrollY||document.documentElement.scrollTop;g.style.top=`${N+R+f.offsetHeight+5}px`,g.style.left=`${Math.min(k-5,window.innerWidth-g.offsetWidth-20)}px`}},[c,u,a]),To(()=>{let f=u.current;if(f!==null&&a){let g=k=>{let N=k.target;H1(N)&&(d&&c.current&&c.current.contains(N)||f.contains(N)||m(!1))};return document.addEventListener("click",g),()=>{document.removeEventListener("click",g)}}},[c,u,a,d]);let h=W1(Me(G1,{dropDownRef:c,itemsContainerClassNames:s,onClose:p,children:o}),document.body);return Gs(_o.Fragment,{children:[Gs("button",{"aria-label":t,className:e+(a?" active":""),"data-dropdown-key":n,disabled:r,onClick:f=>{f.preventDefault(),m(!a)},onMouseDown:f=>{f.preventDefault()},ref:u,type:"button",children:[l&&Me(l,{}),i&&Me("span",{className:"toolbar-popup__dropdown-label",children:i}),Me("i",{className:"toolbar-popup__dropdown-caret"})]}),a&&Me(_o.Fragment,{children:h})]})}var Or="toolbar-popup__dropdown",z1=t=>{let e=V1(14),{active:o,anchorElem:r,editor:n,enabled:l,item:s}=t,{i18n:i}=X1(),{fieldProps:d}=U(),{featureClientSchemaMap:c,schemaPath:u}=d;if(s.Component){let m;return e[0]!==o||e[1]!==r||e[2]!==n||e[3]!==l||e[4]!==s?(m=s?.Component&&st(s.Component,{active:o,anchorElem:r,editor:n,enabled:l,item:s},s.key),e[0]=o,e[1]=r,e[2]=n,e[3]=l,e[4]=s,e[5]=m):m=e[5],m}let a;if(e[6]!==o||e[7]!==n||e[8]!==l||e[9]!==c||e[10]!==i||e[11]!==s||e[12]!==u){let m=s.key,p;s.label&&(m=typeof s.label=="function"?s.label({featureClientSchemaMap:c,i18n:i,schemaPath:u}):s.label),m.length>25?p=m.substring(0,25)+"...":p=m,a=st(Xs,{active:o,editor:n,enabled:l,Icon:s?.ChildComponent?st(s.ChildComponent,{}):void 0,item:s,itemKey:s.key,tooltip:m,children:st("span",{className:"text",children:p})},s.key),e[6]=o,e[7]=n,e[8]=l,e[9]=c,e[10]=i,e[11]=s,e[12]=u,e[13]=a}else a=e[13];return a},Z1=J1.memo(z1),jt=({anchorElem:t,classNames:e,editor:o,group:r,groupState:n,Icon:l,itemsContainerClassNames:s,label:i})=>{let{items:d,key:c}=r,u=K1(()=>d?.length?d.map(a=>st(Z1,{active:n.activeItemKeys.includes(a.key),anchorElem:t,editor:o,enabled:n.enabledItemKeys.includes(a.key),item:a},a.key)):null,[d,n.activeItemKeys,n.enabledItemKeys,t,o]);return st(zs,{buttonAriaLabel:`${c} dropdown`,buttonClassName:[Or,`${Or}-${c}`,...e||[]].filter(Boolean).join(" "),disabled:!n.enabledGroup,dropdownKey:c,Icon:l,itemsContainerClassNames:[`${Or}-items`,...s||[]],label:i,children:u},c)};import{mergeRegister as Y1}from"@lexical/utils";import{$getSelection as q1}from"lexical";import{useCallback as Q1,useDeferredValue as eh,useEffect as th,useRef as Zs,useState as oh}from"react";function rh(t){let e=new Map,o=new Map;if(!t?.length)return{groupStates:o,itemStates:e};for(let r of t){let n=[];for(let l of r.items)e.set(l.key,{active:!1,enabled:!0}),n.push(l.key);o.set(r.key,{activeItemKeys:[],activeItems:[],enabledGroup:!0,enabledItemKeys:n})}return{groupStates:o,itemStates:e}}function wo(t,e){let[o,r]=oh(()=>rh(e)),n=eh(o),l=U(),s=Zs(l);s.current=l;let i=Zs(e);i.current=e;let d=hn(),c=Q1(()=>{t.getEditorState().read(()=>{let u=q1();if(!u)return;let a=i.current;if(!a?.length)return;let m=s.current,p=new Map,h=new Map;for(let f of a){let g=[],k=[],N=[],R=f.type==="dropdown"?f.maxActiveItems??1:void 0;for(let C of f.items){let x=C.isActive?(!R||g.length<R)&&C.isActive({editor:t,editorConfigContext:m,selection:u}):!1,b=C.isEnabled?C.isEnabled({editor:t,editorConfigContext:m,selection:u}):!0;x&&(g.push(C.key),k.push(C)),b&&N.push(C.key),p.set(C.key,{active:x,enabled:b})}let T=f.type==="dropdown"&&f.isEnabled?f.isEnabled({editor:t,editorConfigContext:m,selection:u}):!0;h.set(f.key,{activeItemKeys:g,activeItems:k,enabledGroup:T,enabledItemKeys:N})}r({groupStates:h,itemStates:p})})},[t]);return th(()=>{d(c);let u=()=>d(c),a=Y1(t.registerUpdateListener(u));return document.addEventListener("mouseup",u),()=>{a(),document.removeEventListener("mouseup",u)}},[t,d,c]),n}function uh({active:t,anchorElem:e,editor:o,enabled:r,item:n}){return n.Component?n?.Component&&me(n.Component,{anchorElem:e,editor:o,item:n},n.key):n.ChildComponent?me(Bt,{active:t,editor:o,enabled:r,item:n,children:me(n.ChildComponent,{})},n.key):null}function dh({anchorElem:t,editor:e,editorConfig:o,group:r,index:n,toolbarStates:l}){let{i18n:s}=ch(),{fieldProps:{featureClientSchemaMap:i,schemaPath:d}}=U(),c=l.groupStates.get(r.key),u=Ar(()=>{if(r.type!=="dropdown")return;let m=c?.activeItems?.[0];return m?m.ChildComponent:r.ChildComponent},[r,c?.activeItems]),a=Ar(()=>{if(r.type!=="dropdown")return;let m=c?.activeItems;if(!m?.length)return;if(m.length>1)return s.t("lexical:general:toolbarItemsActive",{count:m.length});let p=m[0],h=p.key;return p.label&&(h=typeof p.label=="function"?p.label({featureClientSchemaMap:i,i18n:s,schemaPath:d}):p.label),h.length>25&&(h=h.substring(0,25)+"..."),h},[r,c?.activeItems,s,i,d]);return lh("div",{className:`fixed-toolbar__group fixed-toolbar__group-${r.key}`,"data-toolbar-group-key":r.key,children:[r.type==="dropdown"&&r.items.length&&c?me(jt,{anchorElem:t,editor:e,group:r,groupState:c,Icon:u,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a}):null,r.type==="buttons"&&r.items.length?r.items.map(m=>{let p=l.itemStates.get(m.key);return me(uh,{active:p?.active??!1,anchorElem:t,editor:e,enabled:p?.enabled??!0,item:m},m.key)}):null,n<o.features.toolbarFixed?.groups.length-1&&me("div",{className:"divider"})]},r.key)}function mh({anchorElem:t,clientProps:e,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let l=So.useRef(null),s=Ys(),{y:i}=sh(),d=wo(o,r?.features?.toolbarFixed?.groups),c=Ar(()=>{if(!n||e?.disableIfParentHasFixedToolbar)return null;let a=n.editorContainerRef.current.previousElementSibling;for(;a;){if(a.classList.contains("fixed-toolbar"))return a;a=a.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,n]);return ah(()=>{if(!c)return;let u=l.current;if(!u)return;let a=u.getBoundingClientRect(),m=c.getBoundingClientRect();if(!(a.bottom<m.top||a.top>m.bottom))u.classList.remove("fixed-toolbar"),u.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),c.classList.remove("fixed-toolbar"),c.classList.add("fixed-toolbar","fixed-toolbar--hide");else{if(!u.classList.contains("fixed-toolbar--overlapping"))return;u.classList.remove("fixed-toolbar--overlapping"),u.classList.add("fixed-toolbar"),c.classList.remove("fixed-toolbar--hide"),c.classList.add("fixed-toolbar")}},50,[l,c,i]),me("div",{className:"fixed-toolbar",onFocus:u=>{u.stopPropagation()},ref:l,children:s&&me(So.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((u,a)=>me(dh,{anchorElem:t,editor:o,editorConfig:r,group:u,index:a,toolbarStates:d},u.key))})})}var qs=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return qs(t.parentEditor)}return!1},Qs=t=>{let e=nh(6),{clientProps:o}=t,[r]=ih(),n=U();if(!Ys())return null;let{editorConfig:s}=n,i=o.applyToFocusedEditor&&n.focusedEditor?.editor||r,d=o.applyToFocusedEditor&&n.focusedEditor?.editorConfig||s,c,u;if(e[0]!==o||e[1]!==i||e[2]!==d||e[3]!==n){u=Symbol.for("react.early_return_sentinel");e:{let a=qs(n);if(o?.disableIfParentHasFixedToolbar&&a){u=null;break e}if(!d?.features?.toolbarFixed?.groups?.length){u=null;break e}c=me(mh,{anchorElem:document.body,clientProps:o,editor:i,editorConfig:d,parentWithFixedToolbar:a})}e[0]=o,e[1]=i,e[2]=d,e[3]=n,e[4]=c,e[5]=u}else c=e[4],u=e[5];return u!==Symbol.for("react.early_return_sentinel")?u:c};var ph=M({plugins:[{Component:Qs,position:"aboveContainer"}]});import{c as fh}from"react/compiler-runtime";import{jsx as Le,jsxs as oa}from"react/jsx-runtime";import{useLexicalComposerContext as hh}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as gh}from"@lexical/react/useLexicalEditable";import{mergeRegister as ra}from"@lexical/utils";import{$getSelection as na,$isRangeSelection as ea,$isTextNode as xh,COMMAND_PRIORITY_LOW as Ch,getDOMSelection as la,SELECTION_CHANGE_COMMAND as bh}from"lexical";import{useCallback as No,useEffect as Ht,useMemo as kh,useRef as ta,useState as _h}from"react";import"react";import{createPortal as Th}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 Eo(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:r=0,floatingElem:n,horizontalOffset:l=32,horizontalPosition:s="left",specialHandlingForCaret:i=!1,targetRect:d,verticalGap:c=10}=t,u=o.parentElement;if(d===null||u==null){n.style.opacity="0",n.style.transform="translate(-10000px, -10000px)";return}let a=n.getBoundingClientRect(),m=o.getBoundingClientRect(),p=u.getBoundingClientRect(),h=d.top-a.height-c,f=d.left-l;s==="center"&&(f=d.left+d.width/2-a.width/2);let g=0;return!e&&h<p.top&&!i&&(g=a.height+d.height+c*2,h+=g),s==="center"?f+a.width>p.right?f=p.right-a.width-l:f<p.left&&(f=p.left+l):f+a.width>p.right&&(f=p.right-a.width-l),f-=m.left,n.style.opacity="1",i&&r!==0?(h-=m.bottom-r+a.height-3,n.style.transform=`translate(${f}px, ${h}px) rotate(180deg)`):(h-=m.top,n.style.transform=`translate(${f}px, ${h}px)`),g}function wh({active:t,anchorElem:e,editor:o,enabled:r,item:n}){return n.Component?n?.Component&&Le(n.Component,{anchorElem:e,editor:o,item:n},n.key):n.ChildComponent?Le(Bt,{active:t,editor:o,enabled:r,item:n,children:Le(n.ChildComponent,{})},n.key):null}function Sh({anchorElem:t,editor:e,group:o,index:r,toolbarStates:n}){let{editorConfig:l}=U(),s=n.groupStates.get(o.key),i=kh(()=>o.type!=="dropdown"?void 0:s?.activeItems?.[0]?.ChildComponent??o.ChildComponent,[o,s?.activeItems]);return oa("div",{className:`inline-toolbar-popup__group inline-toolbar-popup__group-${o.key}`,"data-toolbar-group-key":o.key,children:[o.type==="dropdown"&&o.items.length&&s?Le(jt,{anchorElem:t,editor:e,group:o,groupState:s,Icon:i}):null,o.type==="buttons"&&o.items.length?o.items.map(d=>{let c=n.itemStates.get(d.key);return Le(wh,{active:c?.active??!1,anchorElem:t,editor:e,enabled:c?.enabled??!0,item:d},d.key)}):null,r<l.features.toolbarInline?.groups.length-1&&Le("div",{className:"divider"})]},o.key)}function Eh({anchorElem:t,editor:e}){let o=ta(null),r=ta(null),{editorConfig:n}=U(),l=wo(e,n?.features?.toolbarInline?.groups),s=No(()=>{if(o?.current){let u=o.current.style.opacity==="0",a=o.current.style.pointerEvents==="none";u||(o.current.style.opacity="0"),a||(o.current.style.pointerEvents="none")}},[o]),i=No(u=>{if(o?.current&&(u.buttons===1||u.buttons===3)){let a=o.current.style.opacity==="0",m=o.current.style.pointerEvents==="none";if(!a||!m){let p=u.clientX,h=u.clientY,f=document.elementFromPoint(p,h);o.current.contains(f)||s()}}},[s]),d=No(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);Ht(()=>(document.addEventListener("mousemove",i),document.addEventListener("mouseup",d),()=>{document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",d)}),[o,i,d]);let c=No(()=>{let u=na(),a=la(e._window);if(o.current===null)return;let m=t.querySelector(":scope > .link-editor"),p=m!==null&&"style"in m&&m?.style?.opacity==="1",h=e.getRootElement();if(u!==null&&a!==null&&!a.isCollapsed&&h!==null&&h.contains(a.anchorNode)){let f=Fr(a,h),g=Eo({alwaysDisplayOnTop:p,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});r.current&&Eo({anchorElem:o.current,anchorFlippedOffset:g,floatingElem:r.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else s()},[e,s,t]);return Ht(()=>{let u=t.parentElement,a=()=>{e.getEditorState().read(()=>{c()})};return window.addEventListener("resize",a),u&&u.addEventListener("scroll",a),()=>{window.removeEventListener("resize",a),u&&u.removeEventListener("scroll",a)}},[e,c,t]),Ht(()=>(e.getEditorState().read(()=>{c()}),ra(e.registerUpdateListener(({editorState:u})=>{u.read(()=>{c()})}),e.registerCommand(bh,()=>(c(),!1),Ch))),[e,c]),oa("div",{className:"inline-toolbar-popup",ref:o,children:[Le("div",{className:"caret",ref:r}),n?.features&&n.features?.toolbarInline?.groups.map((u,a)=>Le(Sh,{anchorElem:t,editor:e,group:u,index:a,toolbarStates:l},u.key))]})}function Nh(t,e){let o=fh(12),[r,n]=_h(!1),l=gh(),s;o[0]!==t?(s=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let p=na(),h=la(t._window),f=t.getRootElement();if(h!==null&&(!ea(p)||f===null||!f.contains(h.anchorNode))){n(!1);return}if(!ea(p))return;if(p.getTextContent()!==""){let k=p.getNodes(),N=!1;for(let R of k)if(xh(R)){n(!0),N=!0;break}N||n(!1)}else n(!1);let g=p.getTextContent().replace(/\n/g,"");if(!p.isCollapsed()&&g===""){n(!1);return}})},o[0]=t,o[1]=s):s=o[1];let i=s,d,c;o[2]!==i?(d=()=>(document.addEventListener("selectionchange",i),document.addEventListener("mouseup",i),()=>{document.removeEventListener("selectionchange",i),document.removeEventListener("mouseup",i)}),c=[i],o[2]=i,o[3]=d,o[4]=c):(d=o[3],c=o[4]),Ht(d,c);let u,a;if(o[5]!==t||o[6]!==i?(u=()=>ra(t.registerUpdateListener(()=>{i()}),t.registerRootListener(()=>{t.getRootElement()===null&&n(!1)})),a=[t,i],o[5]=t,o[6]=i,o[7]=u,o[8]=a):(u=o[7],a=o[8]),Ht(u,a),!r||!l)return null;let m;return o[9]!==e||o[10]!==t?(m=Th(Le(Eh,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=m):m=o[11],m}var ia=t=>{let{anchorElem:e}=t,[o]=hh();return Nh(o,e)};var Lh=M({plugins:[{Component:ia,position:"floatingAnchorElem"}]});import{TableCellNode as gx,TableNode as xx,TableRowNode as Cx}from"@lexical/table";import{jsx as sa}from"react/jsx-runtime";import"react";var Pr=()=>sa("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:sa("path",{clipRule:"evenodd",d:"M5.33333 4.5C4.8731 4.5 4.5 4.8731 4.5 5.33333V7.5H9.5V4.5H5.33333ZM5.33333 3.5C4.32081 3.5 3.5 4.32081 3.5 5.33333V14.6667C3.5 15.6792 4.32081 16.5 5.33333 16.5H14.6667C15.6792 16.5 16.5 15.6792 16.5 14.6667V5.33333C16.5 4.32081 15.6792 3.5 14.6667 3.5H5.33333ZM10.5 4.5V7.5H15.5V5.33333C15.5 4.8731 15.1269 4.5 14.6667 4.5H10.5ZM15.5 8.5H10.5V11.5H15.5V8.5ZM15.5 12.5H10.5V15.5H14.6667C15.1269 15.5 15.5 15.1269 15.5 14.6667V12.5ZM9.5 15.5V12.5H4.5V14.6667C4.5 15.1269 4.8731 15.5 5.33333 15.5H9.5ZM4.5 11.5H9.5V8.5H4.5V11.5Z",fill:"currentColor",fillRule:"evenodd"})});import{$createTableCellNode as yh,$createTableNode as Rh,$createTableRowNode as Ih,$isTableCellNode as aa,$isTableNode as Br,$isTableRowNode as jr,TableCellHeaderStates as Lo,TableCellNode as vh,TableNode as Mh,TableRowNode as Dh}from"@lexical/table";import{$isParagraphNode as $h,$isTextNode as Oh}from"lexical";var ua=/^\|(.+)\|\s?$/,Ah=/^(\| ?:?-*:? ?)+\|\s?$/,da=({allTransformers:t})=>({type:"element",dependencies:[Mh,Dh,vh],export:e=>{if(!Br(e))return null;let o=[];for(let r of e.getChildren()){let n=[];if(!jr(r))continue;let l=!1;for(let s of r.getChildren())aa(s)&&(n.push(zt(t,s).replace(/\n/g,"\\n").trim()),s.__headerState===Lo.ROW&&(l=!0));o.push(`| ${n.join(" | ")} |`),l&&o.push(`| ${n.map(s=>"---").join(" | ")} |`)}return o.join(`
59
- `)},regExp:ua,replace:(e,o,r)=>{let n=r[0];if(!n)return;if(Ah.test(n)){let a=e.getPreviousSibling();if(!a||!Br(a))return;let m=a.getChildren(),p=m[m.length-1];if(!p||!jr(p))return;p.getChildren().forEach(h=>{aa(h)&&h.setHeaderStyles(Lo.ROW,Lo.ROW)}),e.remove();return}let l=ca(n,t);if(l==null)return;let s=[l],i=e.getPreviousSibling(),d=l.length;for(;i&&!(!$h(i)||i.getChildrenSize()!==1);){let a=i.getFirstChild();if(!Oh(a))break;let m=ca(a.getTextContent(),t);if(m==null)break;d=Math.max(d,m.length),s.unshift(m);let p=i.getPreviousSibling();i.remove(),i=p}let c=Rh();for(let a of s){let m=Ih();c.append(m);for(let p=0;p<d;p++)m.append(p<a.length?a[p]:ma("",t))}let u=e.getPreviousSibling();Br(u)&&Fh(u)===d?(u.append(...c.getChildren()),e.remove()):e.replace(c),c.selectEnd()}});function Fh(t){let e=t.getFirstChild();return jr(e)?e.getChildrenSize():0}var ma=(t,e)=>{t=t.replace(/\\n/g,`
60
- `);let o=yh(Lo.NO_STATUS);return Xt(t,e,o),o},ca=(t,e)=>{let o=t.match(ua);return!o||!o[1]?null:o[1].split("|").map(r=>ma(r,e))};import{c as Bh}from"react/compiler-runtime";import{jsx as B,jsxs as ye}from"react/jsx-runtime";import{useLexicalComposerContext as xa}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as jh}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as fa,$deleteTableColumnAtSelection as Hh,$deleteTableRowAtSelection as Uh,$getNodeTriplet as Wh,$getTableCellNodeFromLexicalNode as ha,$getTableColumnIndexFromTableCellNode as Gh,$getTableNodeFromLexicalNodeOrThrow as $e,$getTableRowIndexFromTableCellNode as Vh,$insertTableColumnAtSelection as Jh,$insertTableRowAtSelection as Kh,$isTableCellNode as Ca,$isTableSelection as Ut,$mergeCells as Xh,$unmergeCell as zh,getTableElement as Ur,getTableObserverFromTableElement as Wr,TableCellHeaderStates as De,TableCellNode as Zh}from"@lexical/table";import{mergeRegister as Yh}from"@lexical/utils";import{useScrollInfo as qh}from"@payloadcms/ui";import{$getSelection as Ro,$isElementNode as Qh,$isRangeSelection as Gr,$isTextNode as eg,$setSelection as tg,COMMAND_PRIORITY_CRITICAL as og,getDOMSelection as rg,isDOMNode as ng,SELECTION_CHANGE_COMMAND as lg}from"lexical";import*as Vr from"react";import{useCallback as ce,useEffect as at,useRef as yo,useState as ct}from"react";import{createPortal as ba}from"react-dom";import{jsx as Hr,jsxs as Ph}from"react/jsx-runtime";import"react";var pa=()=>Ph("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[Hr("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"}),Hr("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"}),Hr("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 ga(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function ig(){let t=Ro();if(Gr(t)&&!t.isCollapsed()||Ut(t)&&!t.anchor.is(t.focus)||!Gr(t)&&!Ut(t))return!1;let[e]=Wh(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function sg(t){let e=t.getLastDescendant();eg(e)?e.select():Qh(e)?e.selectEnd():e!==null&&e.selectNext()}function ag({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[l]=xa(),s=yo(null),[i,d]=ct(n),[c,u]=ct({columns:1,rows:1}),[a,m]=ct(!1),[p,h]=ct(!1),{y:f}=qh();at(()=>l.registerMutationListener(Zh,w=>{w.get(i.getKey())==="updated"&&l.getEditorState().read(()=>{d(i.getLatest())})},{skipInitialization:!0}),[l,i]),at(()=>{l.getEditorState().read(()=>{let w=Ro();if(Ut(w)){let L=ga(w);u(ga(w)),m(L.columns>1||L.rows>1)}h(ig())})},[l]),at(()=>{let w=e.current,L=s.current,E=l.getRootElement();if(w!=null&&L!=null&&E!=null){let v=E.getBoundingClientRect(),$=w.getBoundingClientRect();L.style.opacity="1";let O=L.getBoundingClientRect(),F=5,P=$.right+F;if(P+O.width>window.innerWidth||P+O.width>v.right){let K=$.left-O.width-F;P=(K<0?F:K)+window.pageXOffset}L.style.left=`${P+window.pageXOffset}px`;let Z=$.top;if(Z+O.height>window.innerHeight){let K=$.bottom-O.height;Z=K<0?F:K}L.style.top=`${Z}px`}},[e,s,l,f]),at(()=>{function w(L){s.current!=null&&e.current!=null&&ng(L.target)&&!s.current.contains(L.target)&&!e.current.contains(L.target)&&r(!1)}return window.addEventListener("click",w),()=>window.removeEventListener("click",w)},[r,e]);let g=ce(()=>{l.update(()=>{if(i.isAttached()){let w=$e(i),L=Ur(w,l.getElementByKey(w.getKey()));if(L===null)throw new Error("Expected to find tableElement in DOM");let E=Wr(L);E!==null&&E.$clearHighlight(),w.markDirty(),d(i.getLatest())}tg(null)})},[l,i]),k=()=>{l.update(()=>{let w=Ro();if(!Ut(w))return;let E=w.getNodes().filter(Ca),v=Xh(E);v&&(sg(v),o())})},N=()=>{l.update(()=>{zh()})},R=ce(w=>{l.update(()=>{for(let L=0;L<c.rows;L++)Kh(w);o()})},[l,o,c.rows]),T=ce(w=>{l.update(()=>{for(let L=0;L<c.columns;L++)Jh(w);o()})},[l,o,c.columns]),C=ce(()=>{l.update(()=>{Uh(),o()})},[l,o]),x=ce(()=>{l.update(()=>{$e(i).remove(),g(),o()})},[l,i,g,o]),b=ce(()=>{l.update(()=>{Hh(),o()})},[l,o]),_=ce(()=>{l.update(()=>{let w=$e(i),L=Vh(i),[E]=fa(w,null,null),v=new Set,$=i.getHeaderStyles()^De.ROW;if(E[L])for(let O=0;O<E[L].length;O++){let F=E[L][O];F?.cell&&(v.has(F.cell)||(v.add(F.cell),F.cell.setHeaderStyles($,De.ROW)))}g(),o()})},[l,i,g,o]),D=ce(()=>{l.update(()=>{let w=$e(i),L=Gh(i),[E]=fa(w,null,null),v=new Set,$=i.getHeaderStyles()^De.COLUMN;if(E)for(let O=0;O<E.length;O++){let F=E?.[O]?.[L];F?.cell&&(v.has(F.cell)||(v.add(F.cell),F.cell.setHeaderStyles($,De.COLUMN)))}g(),o()})},[l,i,g,o]),I=ce(()=>{l.update(()=>{if(i.isAttached()){let w=$e(i);w&&w.setRowStriping(!w.getRowStriping())}g(),o()})},[l,i,g,o]),y=ce(()=>{l.update(()=>{if(i.isAttached()){let w=$e(i);w&&w.setFrozenColumns(w.getFrozenColumns()===0?1:0)}g(),o()})},[l,i,g,o]),S=null;return t&&(a?S=B("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>k(),type:"button",children:B("span",{className:"text",children:"Merge cells"})}):p&&(S=B("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>N(),type:"button",children:B("span",{className:"text",children:"Unmerge cells"})}))),ba(ye("div",{className:"table-action-menu-dropdown",onClick:w=>{w.stopPropagation()},ref:s,children:[S?ye(Vr.Fragment,{children:[S,B("hr",{})]}):null,B("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>I(),type:"button",children:B("span",{className:"text",children:"Toggle Row Striping"})}),B("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>y(),type:"button",children:B("span",{className:"text",children:"Toggle First Column Freeze"})}),B("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>R(!1),type:"button",children:ye("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," above"]})}),B("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>R(!0),type:"button",children:ye("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," below"]})}),B("hr",{}),B("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>T(!1),type:"button",children:ye("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","left"]})}),B("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>T(!0),type:"button",children:ye("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","right"]})}),B("hr",{}),B("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>b(),type:"button",children:B("span",{className:"text",children:"Delete column"})}),B("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>C(),type:"button",children:B("span",{className:"text",children:"Delete row"})}),B("button",{className:"item","data-test-id":"table-delete",onClick:()=>x(),type:"button",children:B("span",{className:"text",children:"Delete table"})}),B("hr",{}),B("button",{className:"item","data-test-id":"table-row-header",onClick:()=>_(),type:"button",children:ye("span",{className:"text",children:[(i.__headerState&De.ROW)===De.ROW?"Remove":"Add"," ","row header"]})}),B("button",{className:"item","data-test-id":"table-column-header",onClick:()=>D(),type:"button",children:ye("span",{className:"text",children:[(i.__headerState&De.COLUMN)===De.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function cg({anchorElem:t,cellMerge:e}){let[o]=xa(),r=yo(null),n=yo(null),[l,s]=ct(!1),[i,d]=ct(null),c=ce(()=>{let a=r.current,m=Ro(),p=rg(o._window),h=document.activeElement;function f(){a&&(a.classList.remove("table-cell-action-button-container--active"),a.classList.add("table-cell-action-button-container--inactive")),d(null)}if(m==null||a==null)return f();let g=o.getRootElement(),k=null,N=null;if(Gr(m)&&g!==null&&p!==null&&g.contains(p.anchorNode)){let T=ha(m.anchor.getNode());if(T==null||(N=o.getElementByKey(T.getKey()),N==null||!T.isAttached()))return f();let C=$e(T),x=Ur(C,o.getElementByKey(C.getKey()));if(x===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");k=Wr(x),d(T)}else if(Ut(m)){let T=ha(m.anchor.getNode());if(!Ca(T))throw new Error("TableSelection anchorNode must be a TableCellNode");let C=$e(T),x=Ur(C,o.getElementByKey(C.getKey()));if(x===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");k=Wr(x),N=o.getElementByKey(T.getKey())}else if(!h)return f();if(k===null||N===null)return f();let R=!k||!k.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",R),a.classList.toggle("table-cell-action-button-container--inactive",!R),R){let T=N.getBoundingClientRect(),C=t.getBoundingClientRect(),x=T.top-C.top,b=T.right-C.left;a.style.transform=`translate(${b}px, ${x}px)`}},[o,t]);at(()=>{let a,m=()=>{a=void 0,o.getEditorState().read(c)},p=()=>(a===void 0&&(a=setTimeout(m,0)),!1);return Yh(o.registerUpdateListener(p),o.registerCommand(lg,p,og),o.registerRootListener((h,f)=>{f&&f.removeEventListener("pointerup",p),h&&(h.addEventListener("pointerup",p),p())}),()=>clearTimeout(a))});let u=yo(i);return at(()=>{u.current!==i&&s(!1),u.current=i},[u,i]),B("div",{className:"table-cell-action-button-container",ref:r,children:i!=null&&ye(Vr.Fragment,{children:[B("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),s(!l)},ref:n,type:"button",children:B(pa,{})}),l&&B(ag,{cellMerge:e,contextRef:n,onClose:()=>s(!1),setIsMenuOpen:s,tableCellNode:i})]})})}var ka=t=>{let e=Bh(3),{anchorElem:o}=t,r=jh(),n;return e[0]!==o||e[1]!==r?(n=ba(r?B(cg,{anchorElem:o??document.body,cellMerge:!0}):null,o??document.body),e[0]=o,e[1]=r,e[2]=n):n=e[2],n};import{c as ug}from"react/compiler-runtime";import{jsx as vo,jsxs as dg}from"react/jsx-runtime";import{useLexicalComposerContext as mg}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as pg}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as fg,$getTableNodeFromLexicalNodeOrThrow as Jr,$getTableRowIndexFromTableCellNode as hg,$isTableCellNode as _a,$isTableRowNode as gg,getDOMCellFromTarget as xg,getTableElement as Cg,TableNode as Ta}from"@lexical/table";import{calculateZoomLevel as wa,mergeRegister as bg}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Kr,isHTMLElement as kg,SKIP_SCROLL_INTO_VIEW_TAG as Sa}from"lexical";import*as Na from"react";import{useCallback as Wt,useEffect as Xr,useRef as Io,useState as ut}from"react";import{createPortal as _g}from"react-dom";var Tg=33,Ea=92;function wg({editor:t}){let e=Io(null),o=Io(null),r=Io(null),[n,l]=ut(!1),s=U(),i=Io(null),[d,c]=ut(null),[u,a]=ut(null),[m,p]=ut(!1),[h,f]=ut(null),g=Wt(()=>{a(null),e.current=null,f(null),i.current=null,r.current=null},[]),k=y=>(y.buttons&1)===1;Xr(()=>{let y=new Set;return bg(t.registerMutationListener(Ta,S=>{for(let[w,L]of S)L==="destroyed"?y.delete(w):y.add(w);l(y.size>0)}),t.registerNodeTransform(Ta,S=>{if(S.getColWidths())return S;let w=S.getColumnCount(),L=Ea;return S.setColWidths(Array(w).fill(L)),S}))},[t]),Xr(()=>{if(!n)return;let y=E=>{let v=E.target;if(kg(v)){if(h){c({x:E.clientX,y:E.clientY});return}if(p(k(E)),!(o.current&&o.current.contains(v))&&e.current!==v){e.current=v;let $=xg(v);$&&u!==$?t.getEditorState().read(()=>{let O=Kr($.elem);if(!O)throw new Error("TableCellResizer: Table cell node not found.");let F=Jr(O),P=Cg(F,t.getElementByKey(F.getKey()));if(!P)throw new Error("TableCellResizer: Table element not found.");e.current=v,r.current=P.getBoundingClientRect(),a($)},{editor:t}):$==null&&g()}}},S=E=>{p(!0)},w=E=>{p(!1)},L=t.registerRootListener((E,v)=>{v?.removeEventListener("mousemove",y),v?.removeEventListener("mousedown",S),v?.removeEventListener("mouseup",w),E?.addEventListener("mousemove",y),E?.addEventListener("mousedown",S),E?.addEventListener("mouseup",w)});return()=>{L()}},[u,h,t,n,g]);let N=y=>y==="bottom",R=Wt(y=>{if(!u)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let S=Kr(u.elem);if(!_a(S))throw new Error("TableCellResizer: Table cell node not found.");let w=Jr(S),L=hg(S),E=w.getChildren(),$=S.getColSpan()===w.getColumnCount()?L:L+S.getRowSpan()-1;if($>=E.length||$<0)throw new Error("Expected table cell to be inside of table row.");let O=E[$];if(!gg(O))throw new Error("Expected table row");let F=O.getHeight();if(F===void 0){let Z=O.getChildren();F=Math.min(...Z.map(K=>T(K,t)??1/0))}let P=Math.max(F+y,Tg);O.setHeight(P)},{tag:Sa})},[u,t]),T=(y,S)=>S.getElementByKey(y.getKey())?.clientHeight,C=(y,S)=>{let w;return S.forEach(L=>{L.forEach((E,v)=>{E.cell===y&&(w=v)})}),w},x=Wt(y=>{if(!u)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let S=Kr(u.elem);if(!_a(S))throw new Error("TableCellResizer: Table cell node not found.");let w=Jr(S),[L]=fg(w,null,null),E=C(S,L);if(E===void 0)throw new Error("TableCellResizer: Table column not found.");let v=w.getColWidths();if(!v)return;let $=v[E];if($===void 0)return;let O=[...v],F=Math.max($+y,Ea);O[E]=F,w.setColWidths(O)},{tag:Sa})},[u,t]),b=Wt(y=>{let S=w=>{if(w.preventDefault(),w.stopPropagation(),!u)throw new Error("TableCellResizer: Expected active cell.");if(i.current){let{x:L,y:E}=i.current;if(u===null)return;let v=wa(w.target);if(N(y)){let $=(w.clientY-E)/v;R($)}else{let $=(w.clientX-L)/v;x($)}g(),document.removeEventListener("mouseup",S)}};return S},[u,g,x,R]),_=Wt(y=>S=>{if(S.preventDefault(),S.stopPropagation(),!u)throw new Error("TableCellResizer: Expected active cell.");i.current={x:S.clientX,y:S.clientY},c(i.current),f(y),document.addEventListener("mouseup",b(y))},[u,b]),[D,I]=ut({bottom:null,left:null,right:null,top:null});return Xr(()=>{if(u){let{height:y,left:S,top:w,width:L}=u.elem.getBoundingClientRect(),E=wa(u.elem),v=10,$={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${v}px`,left:`${window.scrollX+S}px`,top:`${window.scrollY+w+y-v/2}px`,width:`${L}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${y}px`,left:`${window.scrollX+S+L-v/2}px`,top:`${window.scrollY+w}px`,width:`${v}px`}},O=r.current;h&&d&&O&&(N(h)?($[h].left=`${window.scrollX+O.left}px`,$[h].top=`${window.scrollY+d.y/E}px`,$[h].height="3px",$[h].width=`${O.width}px`):($[h].top=`${window.scrollY+O.top}px`,$[h].left=`${window.scrollX+d.x/E}px`,$[h].width="3px",$[h].height=`${O.height}px`),$[h].backgroundColor="#adf"),I($)}else I({bottom:null,left:null,right:null,top:null})},[u,h,d]),vo("div",{ref:o,children:u!=null&&!m&&dg(Na.Fragment,{children:[vo("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:_("right"),style:D.right||void 0}),vo("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:_("bottom"),style:D.bottom||void 0})]})})}var La=()=>{let t=ug(3),[e]=mg(),o=pg(),r;return t[0]!==e||t[1]!==o?(r=o?_g(vo(wg,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=r):r=t[2],r};import{c as vg}from"react/compiler-runtime";import{jsx as zr,jsxs as Mg,Fragment as Dg}from"react/jsx-runtime";import{useLexicalComposerContext as $g}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Oa}from"@lexical/react/useLexicalEditable";import{$getTableAndElementByKey as Og,$getTableColumnIndexFromTableCellNode as Ag,$getTableRowIndexFromTableCellNode as Fg,$insertTableColumnAtSelection as Pg,$insertTableRowAtSelection as Bg,$isTableCellNode as jg,$isTableNode as Ia,getTableElement as Hg,TableNode as Ug}from"@lexical/table";import{$findMatchingParent as Wg,mergeRegister as Gg}from"@lexical/utils";import{$getNearestNodeFromDOMNode as va,isHTMLElement as Vg}from"lexical";import{useEffect as Ma,useMemo as Jg,useRef as Da,useState as Mo}from"react";import"react";import{createPortal as Kg}from"react-dom";import{c as yg}from"react/compiler-runtime";import{useEffect as Rg,useRef as Ig}from"react";var Sg="Expected a function",Eg=Math.max,Ng=Math.min;function Lg(t,e,o){let r,n,l=0,s,i=!1,d=!1,c,u,a,m=!0;if(typeof t!="function")throw new TypeError(Sg);e=e||0,typeof o=="object"&&(i=!!o.leading,d="maxWait"in o,c=d?Eg(o.maxWait||0,e):c,m="trailing"in o?!!o.trailing:m);function p(x){let b=r,_=s;return r=s=void 0,l=x,u=t.apply(_,b),u}function h(x){return l=x,a=setTimeout(k,e),i?p(x):u}function f(x){let b=x-n,_=x-l,D=e-b;return d?Ng(D,c-_):D}function g(x){let b=x-n,_=x-l;return n===void 0||b>=e||b<0||d&&_>=c}function k(){let x=Date.now();if(g(x))return N(x);a=setTimeout(k,f(x))}function N(x){return a=void 0,m&&r?p(x):(r=s=void 0,u)}function R(){a!==void 0&&clearTimeout(a),l=0,r=n=s=a=void 0}function T(){return a===void 0?u:N(Date.now())}function C(){let x=Date.now(),b=g(x);if(r=arguments,s=this,n=x,b){if(a===void 0)return h(n);if(d)return clearTimeout(a),a=setTimeout(k,e),p(n)}return a===void 0&&(a=setTimeout(k,e)),u}return C.cancel=R,C.flush=T,C}var ya=Lg;function Ra(t,e,o){let r=yg(6),n=Ig(null),l,s;r[0]!==t||r[1]!==o||r[2]!==e?(l=()=>(n.current=ya(t,e,{maxWait:o}),()=>{n.current?.cancel()}),s=[t,e,o],r[0]=t,r[1]=o,r[2]=e,r[3]=l,r[4]=s):(l=r[3],s=r[4]),Rg(l,s);let i;return r[5]===Symbol.for("react.memo_cache_sentinel")?(i=(...c)=>{let u=c;n.current&&n.current(...u)},r[5]=i):i=r[5],i}var $a=20;function Xg({anchorElem:t}){let[e]=$g(),o=Oa(),r=U(),[n,l]=Mo(!1),[s,i]=Mo(!1),[d,c]=Mo(!1),[u,a]=Mo({}),m=Da(new Set),p=Da(null),h=Ra(k=>{let{isOutside:N,tableDOMNode:R}=zg(k,r.editorConfig?.lexical);if(N){l(!1),i(!1);return}if(!R)return;p.current=R;let T=null,C=null,x=null;if(e.getEditorState().read(()=>{let $=va(R);if(jg($)){let O=Wg($,F=>Ia(F));if(!Ia(O))return;if(x=Hg(O,e.getElementByKey(O.getKey())),x){let F=O.getChildrenSize(),P=O.getChildAtIndex(0)?.getChildrenSize(),Z=Fg($),K=Ag($);Z===F-1?T=$:K===P-1&&(C=$)}}},{editor:e}),!x)return;let b=x.parentElement;if(!b)return;let{bottom:_,height:D,left:I,right:y,width:S,y:w}=x.getBoundingClientRect(),L=!1;b&&b.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(L=b.scrollWidth>b.clientWidth);let{left:E,y:v}=t.getBoundingClientRect();T?(i(!1),l(!0),a({height:$a,left:L&&b?b.offsetLeft:I-E,top:_-v+5,width:L&&b?b.offsetWidth:S})):C&&(i(!0),l(!1),a({height:D,left:y-E+5,top:w-v,width:$a}))},50,250),f=Jg(()=>new ResizeObserver(()=>{l(!1),i(!1)}),[]);Ma(()=>{if(d)return document.addEventListener("mousemove",h),()=>{l(!1),i(!1),document.removeEventListener("mousemove",h)}},[d,h]),Ma(()=>Gg(e.registerMutationListener(Ug,k=>{e.getEditorState().read(()=>{let N=!1;for(let[R,T]of k)switch(T){case"created":{m.current.add(R),N=!0;break}case"destroyed":{m.current.delete(R),N=!0;break}default:break}if(N){f.disconnect();for(let R of m.current){let{tableElement:T}=Og(R);f.observe(T)}c(m.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,f]);let g=k=>{e.update(()=>{p.current&&(va(p.current)?.selectEnd(),k?(Bg(),l(!1)):(Pg(),i(!1)))})};return o?Mg(Dg,{children:[n&&zr("button",{"aria-label":"Add Row",className:r.editorConfig.lexical.theme.tableAddRows,onClick:()=>g(!0),style:{...u},type:"button"}),s&&zr("button",{"aria-label":"Add Column",className:r.editorConfig.lexical.theme.tableAddColumns,onClick:()=>g(!1),style:{...u},type:"button"})]}):null}function zg(t,e){let o=t.target;if(Vg(o)){let r=o.closest(`td.${e.theme.tableCell}, th.${e.theme.tableCell}`);return{isOutside:!(r||o.closest(`button.${e.theme.tableAddRows}`)||o.closest(`button.${e.theme.tableAddColumns}`)||o.closest(`div.${e.theme.tableCellResizer}`)),tableDOMNode:r}}else return{isOutside:!0,tableDOMNode:null}}function Aa(t){let e=vg(2),{anchorElem:o}=t,r=o===void 0?document.body:o;if(!Oa())return null;let l;return e[0]!==r?(l=Kg(zr(Xg,{anchorElem:r}),r),e[0]=r,e[1]=l):l=e[1],l}import{c as Zg}from"react/compiler-runtime";import{jsx as Zr,jsxs as Yg}from"react/jsx-runtime";import{useLexicalComposerContext as qg}from"@lexical/react/LexicalComposerContext";import{TablePlugin as Qg}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as ex,TableCellNode as tx,TableNode as ox,TableRowNode as rx}from"@lexical/table";import{mergeRegister as nx}from"@lexical/utils";import{formatDrawerSlug as lx,useEditDepth as ix}from"@payloadcms/ui";import{$getSelection as sx,$isRangeSelection as ax,COMMAND_PRIORITY_EDITOR as cx,createCommand as ux}from"lexical";import{createContext as dx,use as mx,useEffect as px,useMemo as fx,useState as hx}from"react";import*as Fa from"react";var Do=ux("OPEN_EMBED_DRAWER_COMMAND"),Pa=dx({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function Ba({children:t}){let[e,o]=hx({cellEditorConfig:null,cellEditorPlugins:null});return Zr(Pa,{value:fx(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var ja=()=>{let t=Zg(16),[e]=qg(),o=mx(Pa),r=ix(),{fieldProps:n,uuid:l}=U(),{schemaPath:s}=n,i="lexical-table-create-"+l,d;t[0]!==r||t[1]!==i?(d=lx({slug:i,depth:r}),t[0]=r,t[1]=i,t[2]=d):d=t[2];let c=d,{toggleDrawer:u}=xe(c,!0),a;t[3]!==e||t[4]!==u?(a=()=>{if(!e.hasNodes([ox,rx,tx]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return nx(e.registerCommand(Do,()=>{let f=null;return e.getEditorState().read(()=>{let g=sx();ax(g)&&(f=g)}),f&&u(),!0},cx))},t[3]=e,t[4]=u,t[5]=a):a=t[5];let m;t[6]!==o||t[7]!==e||t[8]!==u?(m=[o,e,u],t[6]=o,t[7]=e,t[8]=u,t[9]=m):m=t[9],px(a,m);let p;t[10]!==e?(p=(f,g)=>{!g.columns||!g.rows||e.dispatchCommand(ex,{columns:String(g.columns),rows:String(g.rows)})},t[10]=e,t[11]=p):p=t[11];let h;return t[12]!==c||t[13]!==s||t[14]!==p?(h=Yg(Fa.Fragment,{children:[Zr(Ct,{drawerSlug:c,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:p,schemaPath:s,schemaPathSuffix:"fields"}),Zr(Qg,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]}),t[12]=c,t[13]=s,t[14]=p,t[15]=h):h=t[15],h};var bx=M({markdownTransformers:[da],nodes:[xx,gx,Cx],plugins:[{Component:ja,position:"normal"},{Component:La,position:"normal"},{Component:ka,position:"floatingAnchorElem"},{Component:Aa,position:"floatingAnchorElem"}],providers:[Ba],slashMenu:{groups:[X([{Icon:Pr,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Do,{})}}])]},toolbarFixed:{groups:[ke([{ChildComponent:Pr,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Do,{})}}])]}});import{$isNodeSelection as tC}from"lexical";import{jsx as Yr,jsxs as kx}from"react/jsx-runtime";import"react";var qr=()=>kx("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[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 Va}from"react/jsx-runtime";import Ja from"bson-objectid";import{$applyNodeReplacement as Nx}from"lexical";import*as Ka from"react";import _x from"bson-objectid";function $o(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:{pending:{formID:r,src:t.getAttribute("src")||""}}})}}if(t.hasAttribute("data-lexical-upload-relation-to")&&t.hasAttribute("data-lexical-upload-id")){let r=t.getAttribute("data-lexical-upload-id"),n=t.getAttribute("data-lexical-upload-relation-to");if(r!=null&&n!=null)return{node:e({data:{fields:{},relationTo:n,value:r}})}}return{node:e({data:{pending:{formID:new _x.default().toHexString(),src:t.getAttribute("src")||""}}})}}import{DecoratorBlockNode as Tx}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as wx}from"@lexical/utils";import Ua from"bson-objectid";import{$applyNodeReplacement as Sx}from"lexical";var Gt=class extends Tx{__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=>$o(o,Ha),priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new Ua.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,pending:e.pending,relationTo:e.relationTo,value:e.value},r=Ha({data:o});return r.setFormat(e.format),r}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return wx(o,e?.theme?.upload),o}decorate(){return null}exportDOM(){let e=document.createElement("img"),o=this.__data;return o.pending?(e.setAttribute("data-lexical-pending-upload-form-id",String(o?.pending?.formID)),e.setAttribute("src",o?.pending?.src||"")):(e.setAttribute("data-lexical-upload-id",String(o?.value)),e.setAttribute("data-lexical-upload-relation-to",o?.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 Ha({data:t}){return t?.id||(t.id=new Ua.default().toHexString()),Sx(new Gt({data:t}))}import{jsx as Wa}from"react/jsx-runtime";import{ShimmerEffect as Ex}from"@payloadcms/ui";var Ga=()=>Wa("div",{className:"lexical-upload",children:Wa(Ex,{height:"95px",width:"203px"})});var Lx=Ka.lazy(()=>import("./component-XIHC3W6W.js").then(t=>({default:t.UploadComponent}))),pe=class extends Gt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{img:e=>({conversion:o=>$o(o,fe),priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new Ja.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,pending:e.pending,relationTo:e.relationTo,value:e.value},r=fe({data:o});return r.setFormat(e.format),r}decorate(e,o){return this.__data.pending?Va(Ga,{}):Va(Lx,{className:o?.theme?.upload??"LexicalEditorTheme__upload",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function fe({data:t}){return t?.id||(t.id=new Ja.default().toHexString()),Nx(new pe({data:t}))}function dt(t){return t instanceof pe}import{c as Ox}from"react/compiler-runtime";import{jsx as Ax}from"react/jsx-runtime";import{useLexicalComposerContext as Fx}from"@lexical/react/LexicalComposerContext.js";import{$dfsIterator as nc,$insertNodeToNearestRoot as tn,mergeRegister as Px}from"@lexical/utils";import{useBulkUpload as Bx,useEffectEvent as jx,useModal as Hx}from"@payloadcms/ui";import on from"bson-objectid";import{$createRangeSelection as Ux,$getPreviousSelection as Qa,$getSelection as ec,$isParagraphNode as rn,$isRangeSelection as tc,$setSelection as Wx,COMMAND_PRIORITY_EDITOR as Gx,COMMAND_PRIORITY_LOW as oc,createCommand as Vx,DROP_COMMAND as Jx,getDOMSelectionFromTarget as Kx,isHTMLElement as rc,PASTE_COMMAND as Xx}from"lexical";import{useEffect as zx}from"react";import{c as Xa}from"react/compiler-runtime";import{jsx as Qr}from"react/jsx-runtime";import{useLexicalComposerContext as za}from"@lexical/react/LexicalComposerContext.js";import{toast as yx}from"@payloadcms/ui";import{$getNodeByKey as Rx,COMMAND_PRIORITY_EDITOR as Za}from"lexical";import{useEffect as Ya,useState as Ix}from"react";var vx=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=Rx(o);n&&n.replace(fe({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(en,{fields:null,relationTo:e,value:r})},Mx=t=>{let e=Xa(13),{enabledCollectionSlugs:o}=t,[r]=za(),[n,l]=Ix(null),s;e[0]!==o?(s={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=s):s=e[1];let{closeListDrawer:i,ListDrawer:d,openListDrawer:c}=Pt(s),u,a;e[2]!==r||e[3]!==c?(u=()=>r.registerCommand(ze,f=>(l(f?.replace?f?.replace.nodeKey:null),c(),!0),Za),a=[r,c],e[2]=r,e[3]=c,e[4]=u,e[5]=a):(u=e[4],a=e[5]),Ya(u,a);let m;e[6]!==i||e[7]!==r||e[8]!==n?(m=f=>{let{collectionSlug:g,doc:k}=f;i(),vx({editor:r,relationTo:g,replaceNodeKey:n,value:k.id})},e[6]=i,e[7]=r,e[8]=n,e[9]=m):m=e[9];let p=m,h;return e[10]!==d||e[11]!==p?(h=Qr(d,{onSelect:p}),e[10]=d,e[11]=p,e[12]=h):h=e[12],h},Dx=()=>{let t=Xa(3),[e]=za(),o,r;return t[0]!==e?(o=()=>e.registerCommand(ze,$x,Za),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Ya(o,r),null},qa=({enabledCollectionSlugs:t})=>t?.length?Qr(Mx,{enabledCollectionSlugs:t}):Qr(Dx,{});function $x(){return yx.error("No upload collections enabled"),!0}function Zx(t){let e=t.target;return!!(rc(e)&&!e.closest("code, span.editor-image")&&rc(e.parentElement)&&e.parentElement.closest("div.ContentEditable__root"))}function Yx(t){let e,o=Kx(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 en=Vx("INSERT_UPLOAD_COMMAND"),lc=t=>{let e=Ox(21),{clientProps:o}=t,[r]=Fx(),n=o?.disabledCollections,l=o?.enabledCollections,s;e[0]!==n||e[1]!==l?(s={collectionSlugsBlacklist:n,collectionSlugsWhitelist:l,uploads:!0},e[0]=n,e[1]=l,e[2]=s):s=e[2];let{enabledCollectionSlugs:i}=ko(s),{drawerSlug:d,setCollectionSlug:c,setInitialForms:u,setOnCancel:a,setOnSuccess:m,setSelectableCollections:p}=Bx(),{isModalOpen:h,openModal:f}=Hx(),g;e[3]!==d||e[4]!==r||e[5]!==i||e[6]!==h||e[7]!==f||e[8]!==c||e[9]!==u||e[10]!==a||e[11]!==m||e[12]!==p?(g=C=>{let{files:x}=C;if(x?.length!==0&&(u(b=>[...b??[],...x.map(qx)]),!h(d))){if(!i.length||!i[0])return;c(i[0]),p(i),a(()=>{r.update(Qx)}),m(b=>{let _=new Map(b.map(eC));r.update(()=>{for(let D of nc()){let I=D.node;if(dt(I)){let y=I.getData();if(y?.pending){let S=_.get(y.pending?.formID);S&&I.replace(fe({data:{id:new on.default().toHexString(),fields:{},relationTo:S.collectionSlug,value:S.doc.id}}))}}}})}),f(d)}},e[3]=d,e[4]=r,e[5]=i,e[6]=h,e[7]=f,e[8]=c,e[9]=u,e[10]=a,e[11]=m,e[12]=p,e[13]=g):g=e[13];let k=jx(g),N;e[14]!==r||e[15]!==k?(N=()=>{if(!r.hasNodes([pe]))throw new Error("UploadPlugin: UploadNode not registered on editor");return Px(r.registerNodeTransform(pe,C=>{let x=C.getData();if(!x?.pending)return;(async function(){let D=null,I=x?.pending?.src,y=x?.pending?.formID;if(I?.startsWith("data:")){let S=I.match(/data:(image\/[a-zA-Z]+);base64,/),w=S?S[1]:"image/png",L=I.replace(/^data:image\/[a-zA-Z]+;base64,/,""),E=atob(L),v=new Array(E.length);for(let F=0;F<E.length;F++)v[F]=E.charCodeAt(F);let $=new Uint8Array(v);D={alt:void 0,file:new File([$],"pasted-image."+w?.split("/",2)[1],{type:w}),formID:y}}else if(I?.startsWith("http")||I?.startsWith("https")){let w=await(await fetch(I)).blob(),L=I.split("/").pop()||"pasted-image"+w.type.split("/",2)[1];D={alt:void 0,file:new File([w],L,{type:w.type}),formID:y}}D&&k({files:[D]})})()}),r.registerCommand(en,C=>(r.update(()=>{let x=ec()||Qa();if(tc(x)){let b=fe({data:{id:C.id,fields:C.fields,relationTo:C.relationTo,value:C.value}}),{focus:_}=x,D=_.getNode();tn(b),rn(D)&&!D.__first&&D.remove()}}),!0),Gx),r.registerCommand(Xx,C=>{if(!(C instanceof ClipboardEvent))return!1;let x=C.clipboardData;if(!x?.types?.length||x?.types?.includes("text/html"))return!1;let b=[];return x?.files?.length&&Array.from(x.files).forEach(_=>{b.push({alt:"",file:_,formID:new on.default().toHexString()})}),b.length?(r.update(()=>{let _=ec()||Qa();if(tc(_))for(let D of b){let I=fe({data:{pending:{formID:D.formID,src:URL.createObjectURL(D.file)}}}),{focus:y}=_,S=y.getNode();tn(I),rn(S)&&!S.__first&&S.remove()}}),k({files:b}),!0):!1},oc),r.registerCommand(Jx,C=>{if(!(C instanceof DragEvent))return!1;let x=C.dataTransfer;if(!x?.types?.length)return!1;let b=[];return x?.files?.length&&Array.from(x.files).forEach(_=>{b.push({alt:"",file:_,formID:new on.default().toHexString()})}),b.length?(C.preventDefault(),C.stopPropagation(),r.update(()=>{if(Zx(C)){let _=Yx(C),D=Ux();_!=null&&D.applyDOMRange(_),Wx(D);for(let I of b){let y=fe({data:{pending:{formID:I.formID,src:URL.createObjectURL(I.file)}}}),{focus:S}=D,w=S.getNode();tn(y),rn(w)&&!w.__first&&w.remove()}}}),k({files:b}),!0):!1},oc))},e[14]=r,e[15]=k,e[16]=N):N=e[16];let R;e[17]!==r?(R=[r],e[17]=r,e[18]=R):R=e[18],zx(N,R);let T;return e[19]!==i?(T=Ax(qa,{enabledCollectionSlugs:i}),e[19]=i,e[20]=T):T=e[20],T};function qx(t){return{file:t.file,formID:t.formID}}function Qx(){for(let t of nc()){let e=t.node;dt(e)&&e.getData()?.pending&&e.remove()}}function eC(t){return[t.formID,t]}var oC=M({nodes:[pe],plugins:[{Component:lc,position:"normal"}],slashMenu:{groups:[X([{Icon:qr,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(ze,{replace:!1})}}])]},toolbarFixed:{groups:[ke([{ChildComponent:qr,isActive:({selection:t})=>{if(!tC(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return dt(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(ze,{replace:!1})}}])]}});import{c as nC}from"react/compiler-runtime";import{jsx as Oo}from"react/jsx-runtime";import{createElement as lC}from"react";import{ShimmerEffect as iC,useConfig as sC}from"@payloadcms/ui";import{lazy as aC,Suspense as cC,useEffect as uC,useState as dC}from"react";var ic={block:"LexicalEditorTheme__block",blockCursor:"LexicalEditorTheme__blockCursor",characterLimit:"LexicalEditorTheme__characterLimit",code:"LexicalEditorTheme__code",inlineBlock:"LexicalEditorTheme__inlineBlock",heading:{h1:"LexicalEditorTheme__h1",h2:"LexicalEditorTheme__h2",h3:"LexicalEditorTheme__h3",h4:"LexicalEditorTheme__h4",h5:"LexicalEditorTheme__h5",h6:"LexicalEditorTheme__h6"},hr:"LexicalEditorTheme__hr",hrSelected:"LexicalEditorTheme__hrSelected",indent:"LexicalEditorTheme__indent",link:"LexicalEditorTheme__link",list:{checklist:"LexicalEditorTheme__checklist",listitem:"LexicalEditorTheme__listItem",listitemChecked:"LexicalEditorTheme__listItemChecked",listitemUnchecked:"LexicalEditorTheme__listItemUnchecked",nested:{listitem:"LexicalEditorTheme__nestedListItem"},olDepth:["LexicalEditorTheme__ol1","LexicalEditorTheme__ol2","LexicalEditorTheme__ol3","LexicalEditorTheme__ol4","LexicalEditorTheme__ol5"],ul:"LexicalEditorTheme__ul"},ltr:"LexicalEditorTheme__ltr",mark:"LexicalEditorTheme__mark",markOverlap:"LexicalEditorTheme__markOverlap",paragraph:"LexicalEditorTheme__paragraph",placeholder:"LexicalEditorTheme__placeholder",quote:"LexicalEditorTheme__quote",relationship:"LexicalEditorTheme__relationship",rtl:"LexicalEditorTheme__rtl",tab:"LexicalEditorTheme__tabNode",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableAlignment:{center:"LexicalEditorTheme__tableAlignmentCenter",right:"LexicalEditorTheme__tableAlignmentRight"},tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableFrozenColumn:"LexicalEditorTheme__tableFrozenColumn",tableRowStriping:"LexicalEditorTheme__tableRowStriping",tableScrollableWrapper:"LexicalEditorTheme__tableScrollableWrapper",tableSelected:"LexicalEditorTheme__tableSelected",tableSelection:"LexicalEditorTheme__tableSelection",text:{bold:"LexicalEditorTheme__textBold",code:"LexicalEditorTheme__textCode",italic:"LexicalEditorTheme__textItalic",strikethrough:"LexicalEditorTheme__textStrikethrough",subscript:"LexicalEditorTheme__textSubscript",superscript:"LexicalEditorTheme__textSuperscript",underline:"LexicalEditorTheme__textUnderline",underlineStrikethrough:"LexicalEditorTheme__textUnderlineStrikethrough"},upload:"LexicalEditorTheme__upload"};var nn={namespace:"lexical",theme:ic};function sc({config:t,featureClientImportMap:e,featureClientSchemaMap:o,field:r,schemaPath:n,unSanitizedEditorConfig:l}){let s=new Map;for(let c of l.features){if(!c?.clientFeatureProps?.featureKey||c?.clientFeatureProps?.order===void 0||c?.clientFeatureProps?.order===null)throw new Error("A Feature you have installed does not return the client props as clientFeatureProps. Please make sure to always return those props, even if they are null, as other important props like order and featureKey are later on injected.");s.set(c.clientFeatureProps.featureKey,c)}l.features=l.features.sort((c,u)=>c.clientFeatureProps.order-u.clientFeatureProps.order);let i=new Map,d=0;for(let c of l.features){let u=typeof c.feature=="function"?c.feature({config:t,featureClientImportMap:e,featureClientSchemaMap:o,featureProviderMap:s,field:r,resolvedFeatures:i,schemaPath:n,unSanitizedEditorConfig:l}):c.feature;u.key=c.clientFeatureProps.featureKey,u.order=d,i.set(c.clientFeatureProps.featureKey,u),d++}return i}import{deepMerge as rC}from"payload/shared";var ac=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}},o={};if(t.forEach(r=>{r.key==="toolbarFixed"&&r.sanitizedClientFeatureProps?.customGroups&&(o={...o,...r.sanitizedClientFeatureProps.customGroups})}),!t?.size)return e;t.forEach(r=>{if(r.providers?.length&&(e.providers=e.providers.concat(r.providers)),r.enableFormats?.length&&e.enabledFormats.push(...r.enableFormats),r.nodes?.length)for(let n of r.nodes)e.nodes.push(n);if(r.plugins?.length&&r.plugins.forEach((n,l)=>{e.plugins?.push({clientProps:r.sanitizedClientFeatureProps,Component:n.Component,key:r.key+l,position:n.position})}),r.toolbarInline?.groups?.length)for(let n of r.toolbarInline.groups){let l=e.toolbarInline.groups.find(s=>s.key===n.key);l?e.toolbarInline.groups=e.toolbarInline.groups.filter(s=>s.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.toolbarInline?.groups.push(l)}if(r.toolbarFixed?.groups?.length)for(let n of r.toolbarFixed.groups){let l=e.toolbarFixed.groups.find(s=>s.key===n.key);l?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(s=>s.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.toolbarFixed?.groups.push(l)}if(r.slashMenu?.groups){r.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(r.slashMenu.dynamicGroups));for(let n of r.slashMenu.groups){let l=e.slashMenu.groups.find(s=>s.key===n.key);l?e.slashMenu.groups=e.slashMenu.groups.filter(s=>s.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.slashMenu.groups.push(l)}}if(r.markdownTransformers?.length)for(let n of r.markdownTransformers)typeof n=="function"?e.markdownTransformers.push(n({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(n);e.enabledFeatures.push(r.key)}),Object.keys(o).length>0&&(e.toolbarFixed.groups=e.toolbarFixed.groups.map(r=>{let n=o[r.key];return n?rC(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 ln(t,e,o,r){return{admin:o,features:ac(t),lexical:e,resolvedFeatureMap:t,view:r}}var mC=aC(()=>import("./Field-4UEGQMIN.js").then(t=>({default:t.RichText}))),pC=t=>Oo(Uo,{inheritable:!0,views:t.views,children:Oo(fC,{...t})}),fC=t=>{let e=nC(23),{admin:o,clientFeatures:r,featureClientImportMap:n,featureClientSchemaMap:l,field:s,lexicalEditorConfig:i,schemaPath:d,views:c}=t,u;e[0]!==o?(u=o===void 0?{}:o,e[0]=o,e[1]=u):u=e[1];let a=u,m;e[2]!==n?(m=n===void 0?{}:n,e[2]=n,e[3]=m):m=e[3];let p=m,h=i===void 0?nn:i,{currentView:f}=Wo(),g=c?.[f]?.admin??a,k=c?.[f]?.lexical,N;e[4]!==h||e[5]!==k?(N=typeof k=="function"?k(h):k??h,e[4]=h,e[5]=k,e[6]=N):N=e[6];let R=N,{config:T}=sC(),[C,x]=dC(null),b,_;e[7]!==r||e[8]!==T||e[9]!==f||e[10]!==g||e[11]!==R||e[12]!==p||e[13]!==l||e[14]!==s||e[15]!==C||e[16]!==d||e[17]!==c?(b=()=>{if(C&&C.view===f)return;let I=c?.[f],y=I?.filterFeatures?I.filterFeatures(r):r,S=[];for(let L of Object.values(y))L.clientFeatureProvider&&S.push(L.clientFeatureProvider(L.clientFeatureProps));let w=sc({config:T,featureClientImportMap:p,featureClientSchemaMap:l,field:s,schemaPath:d??s.name,unSanitizedEditorConfig:{features:S,lexical:R}});x(ln(w,R,g,f))},_=[g,r,T,p,l,s,C,R,d,f,c],e[7]=r,e[8]=T,e[9]=f,e[10]=g,e[11]=R,e[12]=p,e[13]=l,e[14]=s,e[15]=C,e[16]=d,e[17]=c,e[18]=b,e[19]=_):(b=e[18],_=e[19]),uC(b,_);let D;return e[20]!==C||e[21]!==t?(D=Oo(cC,{fallback:Oo(iC,{height:"35vh"}),children:C&&lC(mC,{...t,editorConfig:C,key:C.view})}),e[20]=C,e[21]=t,e[22]=D):D=e[22],D};function hC(t){return t instanceof HTMLElement}function gC(...t){return t.filter(Boolean).join(" ")}var Ao=new WeakMap;function cc(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function Fo(t,e){let o=Ao.get(t);if(o===void 0){let r=new Set,n=s=>{o!==void 0&&(o.start=cc(s))},l=s=>{if(o===void 0)return;let{start:i}=o;if(i===null)return;let d=cc(s);for(let c of r)d!==null&&c([d[0]-i[0],d[1]-i[1]],s)};t.addEventListener("touchstart",n),t.addEventListener("touchend",l),o={handleTouchend:l,handleTouchstart:n,listeners:r,start:null},Ao.set(t,o)}return o.listeners.add(e),()=>{xC(t,e)}}function xC(t,e){let o=Ao.get(t);if(o===void 0)return;let{listeners:r}=o;r.delete(e),r.size===0&&(Ao.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function CC(t,e){return Fo(t,(o,r)=>{let[n,l]=o;n<0&&-n>Math.abs(l)&&e(n,r)})}function bC(t,e){return Fo(t,(o,r)=>{let[n,l]=o;n>0&&n>Math.abs(l)&&e(n,r)})}function kC(t,e){return Fo(t,(o,r)=>{let[n,l]=o;l<0&&-l>Math.abs(n)&&e(n,r)})}function _C(t,e){return Fo(t,(o,r)=>{let[n,l]=o;l>0&&l>Math.abs(n)&&e(n,r)})}import{c as TC}from"react/compiler-runtime";import{jsx as wC}from"react/jsx-runtime";import"react";var SC=()=>{let t=TC(2),{EditButton:e}=Ce(),o;return t[0]!==e?(o=e?wC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as EC}from"react/compiler-runtime";import{jsx as NC}from"react/jsx-runtime";import"react";var LC=()=>{let t=EC(2),{RemoveButton:e}=Ce(),o;return t[0]!==e?(o=e?NC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as yC}from"react/compiler-runtime";import{jsx as RC}from"react/jsx-runtime";import"react";var IC=()=>{let t=yC(2),{Label:e}=Ce(),o;return t[0]!==e?(o=e?RC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as vC}from"react/compiler-runtime";import{jsx as MC}from"react/jsx-runtime";import"react";var DC=t=>{let e=vC(3),{children:o}=t,{InlineBlockContainer:r}=Ce(),n;return e[0]!==r||e[1]!==o?(n=r?MC(r,{children:o}):null,e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{jsx as $C}from"react/jsx-runtime";import"react";var OC=t=>{let{children:e,...o}=t,{BlockCollapsible:r}=ie();return r?$C(r,{...o,children:e}):null};import{c as AC}from"react/compiler-runtime";import{jsx as FC}from"react/jsx-runtime";import"react";var PC=()=>{let t=AC(2),{EditButton:e}=ie(),o;return t[0]!==e?(o=e?FC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as BC}from"react/compiler-runtime";import{jsx as jC}from"react/jsx-runtime";import"react";var HC=()=>{let t=BC(2),{RemoveButton:e}=ie(),o;return t[0]!==e?(o=e?jC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as UC}from"qs-esm";var WC=({apiURL:t,depth:e,draft:o,locale:r})=>async({id:l,collectionSlug:s,select:i})=>{let d=UC({depth:e??0,draft:o??!1,locale:r,select:i},{addQueryPrefix:!0});return await fetch(`${t}/${s}/${l}${d}`,{credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json"},method:"GET"}).then(u=>u.json())};var uc={customEndRegex:{optional:!0,regExp:/[ \t]*```$/},customStartRegex:/^[ \t]*```(\w+)?/,doNotTrimChildren:!0,export:({fields:t})=>!t.code.includes(`
58
+ `,hs="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",gs="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",E1=new RegExp("^[^"+gs+"]*["+hs+"]"),N1=new RegExp("^[^"+hs+"]*["+gs+"]"),L1={bold:O.IS_BOLD,code:O.IS_CODE,highlight:O.IS_HIGHLIGHT,italic:O.IS_ITALIC,strikethrough:O.IS_STRIKETHROUGH,subscript:O.IS_SUBSCRIPT,superscript:O.IS_SUPERSCRIPT,underline:O.IS_UNDERLINE},y1={directionless:O.IS_DIRECTIONLESS,unmergeable:O.IS_UNMERGEABLE},R1={center:O.IS_ALIGN_CENTER,end:O.IS_ALIGN_END,justify:O.IS_ALIGN_JUSTIFY,left:O.IS_ALIGN_LEFT,right:O.IS_ALIGN_RIGHT,start:O.IS_ALIGN_START},v1={[O.IS_ALIGN_CENTER]:"center",[O.IS_ALIGN_END]:"end",[O.IS_ALIGN_JUSTIFY]:"justify",[O.IS_ALIGN_LEFT]:"left",[O.IS_ALIGN_RIGHT]:"right",[O.IS_ALIGN_START]:"start"},I1={normal:O.IS_NORMAL,segmented:O.IS_SEGMENTED,token:O.IS_TOKEN},M1={[O.IS_NORMAL]:"normal",[O.IS_SEGMENTED]:"segmented",[O.IS_TOKEN]:"token"};var xs={text:({node:t})=>{let e=t.text;return t.format&O.IS_BOLD&&(e=Ue("strong",{children:e})),t.format&O.IS_ITALIC&&(e=Ue("em",{children:e})),t.format&O.IS_STRIKETHROUGH&&(e=Ue("span",{style:{textDecoration:"line-through"},children:e})),t.format&O.IS_UNDERLINE&&(e=Ue("span",{style:{textDecoration:"underline"},children:e})),t.format&O.IS_CODE&&(e=Ue("code",{children:e})),t.format&O.IS_SUBSCRIPT&&(e=Ue("sub",{children:e})),t.format&O.IS_SUPERSCRIPT&&(e=Ue("sup",{children:e})),e}};import{jsx as It}from"react/jsx-runtime";var Cs={upload:({node:t})=>{let e=t;if(typeof e.value!="object")return null;let o=e.value,n=e.fields?.alt||o?.alt||"",r=o.url;if(!o.mimeType.startsWith("image"))return It("a",{href:r,rel:"noopener noreferrer",children:o.filename});if(!o.sizes||!Object.keys(o.sizes).length)return It("img",{alt:n,height:o.height,src:r,width:o.width});let l=[];for(let s in o.sizes){let i=o.sizes[s];if(!i||!i.width||!i.height||!i.mimeType||!i.filesize||!i.filename||!i.url)continue;let d=i?.url;l.push(It("source",{media:`(max-width: ${i.width}px)`,srcSet:d,type:i.mimeType},s))}return l.push(It("img",{alt:n,height:o?.height,src:r,width:o?.width},"image")),It("picture",{children:l})}};var lt={...ms,...xs,...as,...ls,...ps,...is,...ss,...ds,...us({}),...Cs,...fs};import{jsx as mo,Fragment as $1}from"react/jsx-runtime";import uo from"react";function bs(t){if(!!!t?.root?.children?.length)return!1;let o=!1;if(t?.root?.children?.length===1&&t?.root?.children[0]?.type==="paragraph"){let n=t?.root?.children[0];if(!n?.children||n?.children?.length===0)o=!0;else if(n?.children?.length===1){let r=n?.children[0];r?.type==="text"&&(r?.text?.length||(o=!0))}}return!o}function A1(t){return e=>{let o={...e,isEditor:!1,isJSXConverter:!0};if(t.Component)return t.Component(o);if(t.html){let n=typeof t.html=="function"?t.html(o):t.html;return mo("span",{dangerouslySetInnerHTML:{__html:n}})}return null}}function ks(t){return e=>{if(t.Component){let o={...e,isEditor:!1,isJSXConverter:!0};return t.Component(o)}if(t.Block){let o=e.node,n={childIndex:e.childIndex,converters:e.converters,formData:o.fields??{},isEditor:!1,isJSXConverter:!0,node:o,nodesToJSX:e.nodesToJSX,parent:e.parent};return uo.createElement(t.Block,n)}if(t.html){let o={...e,isEditor:!1,isJSXConverter:!0},n=typeof t.html=="function"?t.html(o):t.html;return mo("span",{dangerouslySetInnerHTML:{__html:n}})}return null}}function D1(t){let e={};for(let[o,n]of Object.entries(t)){if(!n||typeof n!="object")continue;if(o==="blocks"){e.blocks={};for(let[l,s]of Object.entries(n)){let i=s;(i.Component||i.Block||i.html)&&(e.blocks[l]=ks(i))}continue}if(o==="inlineBlocks"){e.inlineBlocks={};for(let[l,s]of Object.entries(n)){let i=s;(i.Component||i.Block||i.html)&&(e.inlineBlocks[l]=ks(i))}continue}let r=n;(r.Component||r.html)&&(e[o]=A1(r))}return e}function _s({converters:t,data:e,disableIndent:o,disableTextAlign:n,nodeMap:r}){if(bs(e)){let l=r?D1(r):void 0,s=l?{...t,...l,blocks:{...t.blocks,...l.blocks},inlineBlocks:{...t.inlineBlocks,...l.inlineBlocks}}:t;return Ts({converters:s,disableIndent:o,disableTextAlign:n,nodes:e.root.children,parent:e.root})}return mo($1,{})}function Ts({converters:t,disableIndent:e,disableTextAlign:o,nodes:n,parent:r}){let l=t.unknown;return n.map((i,d)=>{let c;i.type==="block"?(c=t?.blocks?.[i?.fields?.blockType],!c&&!l&&console.error(`Lexical => JSX converter: Blocks converter: found ${i?.fields?.blockType} block, but no converter is provided`)):i.type==="inlineBlock"?(c=t?.inlineBlocks?.[i?.fields?.blockType],!c&&!l&&console.error(`Lexical => JSX converter: Inline Blocks converter: found ${i?.fields?.blockType} inline block, but no converter is provided`)):c=t[i.type];try{!c&&l&&(c=l);let u;c?u=typeof c=="function"?c({childIndex:d,converters:t,node:i,nodesToJSX:f=>Ts({converters:f.converters??t,disableIndent:f.disableIndent??e,disableTextAlign:f.disableTextAlign??o,nodes:f.nodes,parent:f.parent??{...i,parent:r}}),parent:r}):c:u=mo("span",{children:"unknown node"},d);let a={};if(!o&&(!Array.isArray(o)||!o?.includes(i.type))&&"format"in i&&i.format)switch(i.format){case"center":a.textAlign="center";break;case"end":a.textAlign="right";break;case"justify":a.textAlign="justify";break;case"left":break;case"right":a.textAlign="right";break;case"start":a.textAlign="left";break}if(!e&&(!Array.isArray(e)||!e?.includes(i.type))&&"indent"in i&&i.indent&&i.type!=="listitem"&&(a.paddingInlineStart=`${Number(i.indent)*40}px`),uo.isValidElement(u)){if(a.textAlign||a.paddingInlineStart){let m={...a,...u?.props?.style??{}};return uo.cloneElement(u,{key:d,style:m})}return uo.cloneElement(u,{key:d})}return u}catch(u){return console.error("Error converting lexical node to JSX:",u,"node:",i),null}}).filter(Boolean)}function bn({className:t,converters:e,data:o,disableContainer:n,disableIndent:r,disableTextAlign:l,nodeMap:s}){if(!o)return null;let i={};e?typeof e=="function"?i=e({defaultConverters:lt}):i=e:i=lt;let d=o&&!Array.isArray(o)&&typeof o=="object"&&"root"in o&&_s({converters:i,data:o,disableIndent:r,disableTextAlign:l,nodeMap:s});return n?ws(O1,{children:d}):ws("div",{className:t??"payload-richtext",children:d})}function Es(){let t=F1(7),[e]=B1(),o;t[0]!==e?(o=()=>e.getEditorState().toJSON(),t[0]=e,t[1]=o):o=t[1];let[n,r]=j1(o),l,s;t[2]!==e?(l=()=>e.registerUpdateListener(d=>{let{editorState:c}=d;r(c.toJSON())}),s=[e],t[2]=e,t[3]=l,t[4]=s):(l=t[3],s=t[4]),P1(l,s);let i;return t[5]!==n?(i=Ss("div",{className:"debug-jsx-converter",children:Ss(bn,{converters:lt,data:n})}),t[5]=n,t[6]=i):i=t[6],i}var H1=$({plugins:[{Component:Es,position:"bottom"}]});var j={amber:{50:"oklch(0.987 0.022 95.277)",100:"oklch(0.962 0.059 95.617)",200:"oklch(0.924 0.12 95.746)",300:"oklch(0.879 0.169 91.605)",400:"oklch(0.828 0.189 84.429)",500:"oklch(0.769 0.188 70.08)",600:"oklch(0.666 0.179 58.318)",700:"oklch(0.555 0.163 48.998)",800:"oklch(0.473 0.137 46.201)",900:"oklch(0.414 0.112 45.904)",950:"oklch(0.279 0.077 45.635)"},black:"#000",blue:{50:"oklch(0.97 0.014 254.604)",100:"oklch(0.932 0.032 255.585)",200:"oklch(0.882 0.059 254.128)",300:"oklch(0.809 0.105 251.813)",400:"oklch(0.707 0.165 254.624)",500:"oklch(0.623 0.214 259.815)",600:"oklch(0.546 0.245 262.881)",700:"oklch(0.488 0.243 264.376)",800:"oklch(0.424 0.199 265.638)",900:"oklch(0.379 0.146 265.522)",950:"oklch(0.282 0.091 267.935)"},current:"currentColor",cyan:{50:"oklch(0.984 0.019 200.873)",100:"oklch(0.956 0.045 203.388)",200:"oklch(0.917 0.08 205.041)",300:"oklch(0.865 0.127 207.078)",400:"oklch(0.789 0.154 211.53)",500:"oklch(0.715 0.143 215.221)",600:"oklch(0.609 0.126 221.723)",700:"oklch(0.52 0.105 223.128)",800:"oklch(0.45 0.085 224.283)",900:"oklch(0.398 0.07 227.392)",950:"oklch(0.302 0.056 229.695)"},emerald:{50:"oklch(0.979 0.021 166.113)",100:"oklch(0.95 0.052 163.051)",200:"oklch(0.905 0.093 164.15)",300:"oklch(0.845 0.143 164.978)",400:"oklch(0.765 0.177 163.223)",500:"oklch(0.696 0.17 162.48)",600:"oklch(0.596 0.145 163.225)",700:"oklch(0.508 0.118 165.612)",800:"oklch(0.432 0.095 166.913)",900:"oklch(0.378 0.077 168.94)",950:"oklch(0.262 0.051 172.552)"},fuchsia:{50:"oklch(0.977 0.017 320.058)",100:"oklch(0.952 0.037 318.852)",200:"oklch(0.903 0.076 319.62)",300:"oklch(0.833 0.145 321.434)",400:"oklch(0.74 0.238 322.16)",500:"oklch(0.667 0.295 322.15)",600:"oklch(0.591 0.293 322.896)",700:"oklch(0.518 0.253 323.949)",800:"oklch(0.452 0.211 324.591)",900:"oklch(0.401 0.17 325.612)",950:"oklch(0.293 0.136 325.661)"},gray:{50:"oklch(0.985 0.002 247.839)",100:"oklch(0.967 0.003 264.542)",200:"oklch(0.928 0.006 264.531)",300:"oklch(0.872 0.01 258.338)",400:"oklch(0.707 0.022 261.325)",500:"oklch(0.551 0.027 264.364)",600:"oklch(0.446 0.03 256.802)",700:"oklch(0.373 0.034 259.733)",800:"oklch(0.278 0.033 256.848)",900:"oklch(0.21 0.034 264.665)",950:"oklch(0.13 0.028 261.692)"},green:{50:"oklch(0.982 0.018 155.826)",100:"oklch(0.962 0.044 156.743)",200:"oklch(0.925 0.084 155.995)",300:"oklch(0.871 0.15 154.449)",400:"oklch(0.792 0.209 151.711)",500:"oklch(0.723 0.219 149.579)",600:"oklch(0.627 0.194 149.214)",700:"oklch(0.527 0.154 150.069)",800:"oklch(0.448 0.119 151.328)",900:"oklch(0.393 0.095 152.535)",950:"oklch(0.266 0.065 152.934)"},indigo:{50:"oklch(0.962 0.018 272.314)",100:"oklch(0.93 0.034 272.788)",200:"oklch(0.87 0.065 274.039)",300:"oklch(0.785 0.115 274.713)",400:"oklch(0.673 0.182 276.935)",500:"oklch(0.585 0.233 277.117)",600:"oklch(0.511 0.262 276.966)",700:"oklch(0.457 0.24 277.023)",800:"oklch(0.398 0.195 277.366)",900:"oklch(0.359 0.144 278.697)",950:"oklch(0.257 0.09 281.288)"},inherit:"inherit",lime:{50:"oklch(0.986 0.031 120.757)",100:"oklch(0.967 0.067 122.328)",200:"oklch(0.938 0.127 124.321)",300:"oklch(0.897 0.196 126.665)",400:"oklch(0.841 0.238 128.85)",500:"oklch(0.768 0.233 130.85)",600:"oklch(0.648 0.2 131.684)",700:"oklch(0.532 0.157 131.589)",800:"oklch(0.453 0.124 130.933)",900:"oklch(0.405 0.101 131.063)",950:"oklch(0.274 0.072 132.109)"},neutral:{50:"oklch(0.985 0 0)",100:"oklch(0.97 0 0)",200:"oklch(0.922 0 0)",300:"oklch(0.87 0 0)",400:"oklch(0.708 0 0)",500:"oklch(0.556 0 0)",600:"oklch(0.439 0 0)",700:"oklch(0.371 0 0)",800:"oklch(0.269 0 0)",900:"oklch(0.205 0 0)",950:"oklch(0.145 0 0)"},orange:{50:"oklch(0.98 0.016 73.684)",100:"oklch(0.954 0.038 75.164)",200:"oklch(0.901 0.076 70.697)",300:"oklch(0.837 0.128 66.29)",400:"oklch(0.75 0.183 55.934)",500:"oklch(0.705 0.213 47.604)",600:"oklch(0.646 0.222 41.116)",700:"oklch(0.553 0.195 38.402)",800:"oklch(0.47 0.157 37.304)",900:"oklch(0.408 0.123 38.172)",950:"oklch(0.266 0.079 36.259)"},pink:{50:"oklch(0.971 0.014 343.198)",100:"oklch(0.948 0.028 342.258)",200:"oklch(0.899 0.061 343.231)",300:"oklch(0.823 0.12 346.018)",400:"oklch(0.718 0.202 349.761)",500:"oklch(0.656 0.241 354.308)",600:"oklch(0.592 0.249 0.584)",700:"oklch(0.525 0.223 3.958)",800:"oklch(0.459 0.187 3.815)",900:"oklch(0.408 0.153 2.432)",950:"oklch(0.284 0.109 3.907)"},purple:{50:"oklch(0.977 0.014 308.299)",100:"oklch(0.946 0.033 307.174)",200:"oklch(0.902 0.063 306.703)",300:"oklch(0.827 0.119 306.383)",400:"oklch(0.714 0.203 305.504)",500:"oklch(0.627 0.265 303.9)",600:"oklch(0.558 0.288 302.321)",700:"oklch(0.496 0.265 301.924)",800:"oklch(0.438 0.218 303.724)",900:"oklch(0.381 0.176 304.987)",950:"oklch(0.291 0.149 302.717)"},red:{50:"oklch(0.971 0.013 17.38)",100:"oklch(0.936 0.032 17.717)",200:"oklch(0.885 0.062 18.334)",300:"oklch(0.808 0.114 19.571)",400:"oklch(0.704 0.191 22.216)",500:"oklch(0.637 0.237 25.331)",600:"oklch(0.577 0.245 27.325)",700:"oklch(0.505 0.213 27.518)",800:"oklch(0.444 0.177 26.899)",900:"oklch(0.396 0.141 25.723)",950:"oklch(0.258 0.092 26.042)"},rose:{50:"oklch(0.969 0.015 12.422)",100:"oklch(0.941 0.03 12.58)",200:"oklch(0.892 0.058 10.001)",300:"oklch(0.81 0.117 11.638)",400:"oklch(0.712 0.194 13.428)",500:"oklch(0.645 0.246 16.439)",600:"oklch(0.586 0.253 17.585)",700:"oklch(0.514 0.222 16.935)",800:"oklch(0.455 0.188 13.697)",900:"oklch(0.41 0.159 10.272)",950:"oklch(0.271 0.105 12.094)"},sky:{50:"oklch(0.977 0.013 236.62)",100:"oklch(0.951 0.026 236.824)",200:"oklch(0.901 0.058 230.902)",300:"oklch(0.828 0.111 230.318)",400:"oklch(0.746 0.16 232.661)",500:"oklch(0.685 0.169 237.323)",600:"oklch(0.588 0.158 241.966)",700:"oklch(0.5 0.134 242.749)",800:"oklch(0.443 0.11 240.79)",900:"oklch(0.391 0.09 240.876)",950:"oklch(0.293 0.066 243.157)"},slate:{50:"oklch(0.984 0.003 247.858)",100:"oklch(0.968 0.007 247.896)",200:"oklch(0.929 0.013 255.508)",300:"oklch(0.869 0.022 252.894)",400:"oklch(0.704 0.04 256.788)",500:"oklch(0.554 0.046 257.417)",600:"oklch(0.446 0.043 257.281)",700:"oklch(0.372 0.044 257.287)",800:"oklch(0.279 0.041 260.031)",900:"oklch(0.208 0.042 265.755)",950:"oklch(0.129 0.042 264.695)"},stone:{50:"oklch(0.985 0.001 106.423)",100:"oklch(0.97 0.001 106.424)",200:"oklch(0.923 0.003 48.717)",300:"oklch(0.869 0.005 56.366)",400:"oklch(0.709 0.01 56.259)",500:"oklch(0.553 0.013 58.071)",600:"oklch(0.444 0.011 73.639)",700:"oklch(0.374 0.01 67.558)",800:"oklch(0.268 0.007 34.298)",900:"oklch(0.216 0.006 56.043)",950:"oklch(0.147 0.004 49.25)"},teal:{50:"oklch(0.984 0.014 180.72)",100:"oklch(0.953 0.051 180.801)",200:"oklch(0.91 0.096 180.426)",300:"oklch(0.855 0.138 181.071)",400:"oklch(0.777 0.152 181.912)",500:"oklch(0.704 0.14 182.503)",600:"oklch(0.6 0.118 184.704)",700:"oklch(0.511 0.096 186.391)",800:"oklch(0.437 0.078 188.216)",900:"oklch(0.386 0.063 188.416)",950:"oklch(0.277 0.046 192.524)"},transparent:"transparent",violet:{50:"oklch(0.969 0.016 293.756)",100:"oklch(0.943 0.029 294.588)",200:"oklch(0.894 0.057 293.283)",300:"oklch(0.811 0.111 293.571)",400:"oklch(0.702 0.183 293.541)",500:"oklch(0.606 0.25 292.717)",600:"oklch(0.541 0.281 293.009)",700:"oklch(0.491 0.27 292.581)",800:"oklch(0.432 0.232 292.759)",900:"oklch(0.38 0.189 293.745)",950:"oklch(0.283 0.141 291.089)"},white:"#fff",yellow:{50:"oklch(0.987 0.026 102.212)",100:"oklch(0.973 0.071 103.193)",200:"oklch(0.945 0.129 101.54)",300:"oklch(0.905 0.182 98.111)",400:"oklch(0.852 0.199 91.936)",500:"oklch(0.795 0.184 86.047)",600:"oklch(0.681 0.162 75.834)",700:"oklch(0.554 0.135 66.442)",800:"oklch(0.476 0.114 61.907)",900:"oklch(0.421 0.095 57.708)",950:"oklch(0.286 0.066 53.813)"},zinc:{50:"oklch(0.985 0 0)",100:"oklch(0.967 0.001 286.375)",200:"oklch(0.92 0.004 286.32)",300:"oklch(0.871 0.006 286.286)",400:"oklch(0.705 0.015 286.067)",500:"oklch(0.552 0.016 285.938)",600:"oklch(0.442 0.017 285.786)",700:"oklch(0.37 0.013 285.805)",800:"oklch(0.274 0.006 286.033)",900:"oklch(0.21 0.006 285.885)",950:"oklch(0.141 0.005 285.823)"}},U1={text:{"text-red":{css:{color:`light-dark(${j.red[600]}, ${j.red[400]})`},label:"Red"},"text-orange":{css:{color:`light-dark(${j.orange[600]}, ${j.orange[400]})`},label:"Orange"},"text-yellow":{css:{color:`light-dark(${j.yellow[700]}, ${j.yellow[300]})`},label:"Yellow"},"text-green":{css:{color:`light-dark(${j.green[700]}, ${j.green[400]})`},label:"Green"},"text-blue":{css:{color:`light-dark(${j.blue[600]}, ${j.blue[400]})`},label:"Blue"},"text-purple":{css:{color:`light-dark(${j.purple[600]}, ${j.purple[400]})`},label:"Purple"},"text-pink":{css:{color:`light-dark(${j.pink[600]}, ${j.pink[400]})`},label:"Pink"}},background:{"bg-red":{css:{"background-color":`light-dark(${j.red[400]}, ${j.red[600]})`},label:"Red"},"bg-orange":{css:{"background-color":`light-dark(${j.orange[400]}, ${j.orange[600]})`},label:"Orange"},"bg-yellow":{css:{"background-color":`light-dark(${j.yellow[300]}, ${j.yellow[700]})`},label:"Yellow"},"bg-green":{css:{"background-color":`light-dark(${j.green[400]}, ${j.green[700]})`},label:"Green"},"bg-blue":{css:{"background-color":`light-dark(${j.blue[400]}, ${j.blue[600]})`},label:"Blue"},"bg-purple":{css:{"background-color":`light-dark(${j.purple[400]}, ${j.purple[600]})`},label:"Purple"},"bg-pink":{css:{"background-color":`light-dark(${j.pink[400]}, ${j.pink[600]})`},label:"Pink"}}};import{$isNodeSelection as v0}from"lexical";import{jsx as Ns}from"react/jsx-runtime";import"react";var G1="M9.5 6C9.77614 6 10 6.22386 10 6.5C10 6.77614 9.77614 7 9.5 7H7.5C7.22386 7 7 7.22386 7 7.5V16.5C7 16.7761 7.22386 17 7.5 17H16.5C16.7761 17 17 16.7761 17 16.5V14.5C17 14.2239 17.2239 14 17.5 14C17.7761 14 18 14.2239 18 14.5V16.5C18 17.3284 17.3284 18 16.5 18H7.5C6.67157 18 6 17.3284 6 16.5V7.5C6 6.67157 6.67157 6 7.5 6H9.5ZM17.5 6C17.7761 6 18 6.22386 18 6.5V11.5C18 11.7761 17.7761 12 17.5 12C17.2239 12 17 11.7761 17 11.5V7.70703L12.8535 11.8535C12.6583 12.0488 12.3417 12.0488 12.1465 11.8535C11.9512 11.6583 11.9512 11.3417 12.1465 11.1465L16.293 7H12.5C12.2239 7 12 6.77614 12 6.5C12 6.22386 12.2239 6 12.5 6H17.5Z",kn=({className:t})=>Ns("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Ns("path",{d:G1,fill:"currentColor"})});import{jsx as J1}from"react/jsx-runtime";import{$applyNodeReplacement as X1}from"lexical";import*as ys from"react";import{DecoratorBlockNode as V1}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as W1}from"@lexical/utils";import{$applyNodeReplacement as z1}from"lexical";function K1(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Ls({relationTo:o,value:e})}:null}var Mt=class extends V1{__data;constructor({data:e,format:o,key:n}){super(o,n),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:K1,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},n=Ls(o);return n.setFormat(e.format),n}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return W1(o,e?.theme?.relationship),o}decorate(e,o){return null}exportDOM(){let e=document.createElement("div");e.setAttribute("data-lexical-relationship-id",String(typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value)),e.setAttribute("data-lexical-relationship-relationTo",this.__data?.relationTo);let o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"relationship",version:2}}getData(){return this.getLatest().__data}getTextContent(){return`${this.__data?.relationTo} relation to ${typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value}`}setData(e){let o=this.getWritable();o.__data=e}};function Ls(t){return z1(new Mt({data:t}))}var Z1=ys.lazy(()=>import("./RelationshipComponent-BG3DPV3T.js").then(t=>({default:t.RelationshipComponent})));function Y1(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Ge({relationTo:o,value:e})}:null}var Ne=class extends Mt{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:Y1,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},n=Ge(o);return n.setFormat(e.format),n}decorate(e,o){return J1(Z1,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Ge(t){return X1(new Ne({data:t}))}function _n(t){return t instanceof Ne}import{c as C0}from"react/compiler-runtime";import{jsx as b0}from"react/jsx-runtime";import{useLexicalComposerContext as k0}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as _0}from"@lexical/utils";import{$getPreviousSelection as T0,$getSelection as w0,$isParagraphNode as S0,$isRangeSelection as E0,COMMAND_PRIORITY_EDITOR as N0,createCommand as L0}from"lexical";import{useEffect as y0}from"react";import{c as Is}from"react/compiler-runtime";import{jsx as Tn}from"react/jsx-runtime";import{useLexicalComposerContext as Ms}from"@lexical/react/LexicalComposerContext.js";import{toast as c0}from"@payloadcms/ui";import{$getNodeByKey as u0,COMMAND_PRIORITY_EDITOR as $s}from"lexical";import{useEffect as As,useState as d0}from"react";import{c as q1}from"react/compiler-runtime";import{jsx as Q1}from"react/jsx-runtime";import{useLexicalComposerContext as e0}from"@lexical/react/LexicalComposerContext";import{useListDrawer as t0,useModal as o0}from"@payloadcms/ui";import{$getNodeByKey as Rs,$getPreviousSelection as n0,$getRoot as r0,$getSelection as l0,$isRangeSelection as i0,$setSelection as s0}from"lexical";import{useEffect as a0,useState as vs}from"react";var $t=t=>{let e=q1(23),[o]=e0(),[n,r]=vs(null),[l,s]=vs(!1),[i,d,c]=t0(t),{closeDrawer:u,drawerSlug:a,isDrawerOpen:m,openDrawer:f}=c,{modalState:h}=o0(),p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=()=>{let v=l0()??n0();r(v)},e[0]=p):p=e[0];let g=p,k;e[1]!==o||e[2]!==n?(k=()=>{n&&o.update(()=>{if(i0(n)){let{anchor:v,focus:y}=n;Rs(v.key)&&Rs(y.key)&&s0(n.clone())}else r0().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=n,e[3]=k):k=e[3];let N=k,R;e[4]!==u?(R=()=>{u()},e[4]=u,e[5]=R):R=e[5];let T=R,C,x;e[6]!==a||e[7]!==h||e[8]!==N||e[9]!==l?(C=()=>{if(!l)return;let v=h[a];v&&!v?.isOpen&&(s(!1),setTimeout(()=>{N()},1))},x=[h,a,N,l],e[6]=a,e[7]=h,e[8]=N,e[9]=l,e[10]=C,e[11]=x):(C=e[10],x=e[11]),a0(C,x);let b;e[12]!==d?(b=v=>Q1(d,{...v,onClick:()=>{g()}}),e[12]=d,e[13]=b):b=e[13];let _;e[14]!==f?(_=()=>{g(),f(),s(!0)},e[14]=f,e[15]=_):_=e[15];let M;return e[16]!==i||e[17]!==T||e[18]!==m||e[19]!==a||e[20]!==b||e[21]!==_?(M={closeListDrawer:T,isListDrawerOpen:m,ListDrawer:i,listDrawerSlug:a,ListDrawerToggler:b,openListDrawer:_},e[16]=i,e[17]=T,e[18]=m,e[19]=a,e[20]=b,e[21]=_,e[22]=M):M=e[22],M};var m0=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=u0(o);r&&r.replace(Ge({relationTo:e,value:n}))}):t.dispatchCommand(wn,{relationTo:e,value:n})},f0=t=>{let e=Is(14),{enabledCollectionSlugs:o}=t,[n]=Ms(),[r,l]=d0(null),s=o?.[0],i;e[0]!==o||e[1]!==s?(i={collectionSlugs:o,selectedCollection:s},e[0]=o,e[1]=s,e[2]=i):i=e[2];let{closeListDrawer:d,ListDrawer:c,openListDrawer:u}=$t(i),a,m;e[3]!==n||e[4]!==u?(a=()=>n.registerCommand(Je,g=>(l(g?.replace?g?.replace.nodeKey:null),u(),!0),$s),m=[n,u],e[3]=n,e[4]=u,e[5]=a,e[6]=m):(a=e[5],m=e[6]),As(a,m);let f;e[7]!==d||e[8]!==n||e[9]!==r?(f=g=>{let{collectionSlug:k,doc:N}=g;m0({editor:n,relationTo:k,replaceNodeKey:r,value:N.id}),d()},e[7]=d,e[8]=n,e[9]=r,e[10]=f):f=e[10];let h=f,p;return e[11]!==c||e[12]!==h?(p=Tn(c,{onSelect:h}),e[11]=c,e[12]=h,e[13]=p):p=e[13],p},p0=()=>{let t=Is(3),[e]=Ms(),o,n;return t[0]!==e?(o=()=>e.registerCommand(Je,h0,$s),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),As(o,n),null},Ds=({enabledCollectionSlugs:t})=>t?.length?Tn(f0,{enabledCollectionSlugs:t}):Tn(p0,{});function h0(){return c0.error("No relationship collections enabled"),!0}import{useConfig as g0,useEntityVisibility as x0}from"@payloadcms/ui";import*as Os from"react";var fo=t=>{let{collectionSlugsBlacklist:e,collectionSlugsWhitelist:o,uploads:n=!1}=t||{},{config:{collections:r}}=g0(),{visibleEntities:l}=x0();return Os.useMemo(()=>{let i=[],d=[],c=o?new Set(o):null,u=e?new Set(e):null;for(let a of r){let{slug:m,admin:{enableRichTextRelationship:f},upload:h}=a;if(l?.collections.includes(m)){if(n){if(!f||!h)continue}else if(h||!f)continue;c&&!c.has(m)||u&&u.has(m)||(i.push(m),d.push(a))}}return{enabledCollections:d,enabledCollectionSlugs:i}},[r,l,n,o,e])};var wn=L0("INSERT_RELATIONSHIP_COMMAND"),Fs=t=>{let e=C0(8),{clientProps:o}=t,[n]=k0(),r=o?.disabledCollections,l=o?.enabledCollections,s;e[0]!==r||e[1]!==l?(s={collectionSlugsBlacklist:r,collectionSlugsWhitelist:l},e[0]=r,e[1]=l,e[2]=s):s=e[2];let{enabledCollectionSlugs:i}=fo(s),d,c;e[3]!==n?(d=()=>{if(!n.hasNodes([Ne]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return n.registerCommand(wn,R0,N0)},c=[n],e[3]=n,e[4]=d,e[5]=c):(d=e[4],c=e[5]),y0(d,c);let u;return e[6]!==i?(u=b0(Ds,{enabledCollectionSlugs:i}),e[6]=i,e[7]=u):u=e[7],u};function R0(t){let e=w0()||T0();if(E0(e)){let o=Ge(t),{focus:n}=e,r=n.getNode();_0(o),S0(r)&&!r.__first&&r.remove()}return!0}var I0=$({nodes:[Ne],plugins:[{Component:Fs,position:"normal"}],slashMenu:{groups:[J([{Icon:kn,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Je,{replace:!1})}}])]},toolbarFixed:{groups:[ke([{ChildComponent:kn,isActive:({selection:t})=>{if(!v0(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return _n(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Je,{replace:!1})}}])]}});import{c as oh}from"react/compiler-runtime";import{jsx as me,jsxs as nh}from"react/jsx-runtime";import{useLexicalComposerContext as rh}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as zs}from"@lexical/react/useLexicalEditable";import{useScrollInfo as lh,useThrottledEffect as ih,useTranslation as sh}from"@payloadcms/ui";import*as xo from"react";import{useMemo as Ln}from"react";import{c as M0}from"react/compiler-runtime";import{jsx as $0}from"react/jsx-runtime";import{$addUpdateTag as A0}from"lexical";import"react";var Bs="toolbar-popup__button",At=t=>{let e=M0(14),{active:o,children:n,editor:r,enabled:l,item:s}=t,i=o===void 0?!1:o,d=l===void 0?!0:l,c=d?"":"disabled",u=i?"active":"",a=s.key?`${Bs}-${s.key}`:"",m;e[0]!==c||e[1]!==u||e[2]!==a?(m=[Bs,c,u,a].filter(Boolean),e[0]=c,e[1]=u,e[2]=a,e[3]=m):m=e[3];let f=m.join(" "),h;e[4]!==i||e[5]!==r||e[6]!==d||e[7]!==s?(h=()=>{d&&r.focus(()=>{r.update(D0),s.onSelect?.({editor:r,isActive:i})})},e[4]=i,e[5]=r,e[6]=d,e[7]=s,e[8]=h):h=e[8];let p=h,g=O0,k;return e[9]!==n||e[10]!==f||e[11]!==p||e[12]!==s.key?(k=$0("button",{className:f,"data-button-key":s.key,onClick:p,onMouseDown:g,type:"button",children:n}),e[9]=n,e[10]=f,e[11]=p,e[12]=s.key,e[13]=k):k=e[13],k};function D0(){A0("toolbar")}function O0(t){t.preventDefault()}import{c as G0}from"react/compiler-runtime";import{jsx as it}from"react/jsx-runtime";import V0,{useMemo as W0}from"react";import{useTranslation as z0}from"@payloadcms/ui";import{jsx as Me,jsxs as Ps}from"react/jsx-runtime";import{Button as F0}from"@payloadcms/ui";import{$addUpdateTag as B0,isDOMNode as P0}from"lexical";import po,{useCallback as j0,useEffect as ho,useMemo as Hs,useRef as Sn,useState as En}from"react";import{createPortal as H0}from"react-dom";var js="toolbar-popup__dropdown-item",Us=po.createContext(null);function Gs({active:t,children:e,editor:o,enabled:n,Icon:r,item:l,itemKey:s,tooltip:i}){let d=Hs(()=>[js,n===!1?"disabled":"",t?"active":"",l?.key?`${js}-${l.key}`:""].filter(Boolean).join(" "),[n,t,l.key]),c=Sn(null),u=po.use(Us);if(u===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=u;return ho(()=>{c?.current!=null&&a(c)},[c,a]),Me(F0,{"aria-label":i,buttonStyle:"none",className:d,disabled:n===!1,extraButtonProps:{"data-item-key":s},icon:r,iconPosition:"left",iconStyle:"none",onClick:()=>{n!==!1&&o.focus(()=>{o.update(()=>{B0("toolbar")}),l.onSelect?.({editor:o,isActive:t})})},onMouseDown:m=>{m.preventDefault()},ref:c,tooltip:i,type:"button",children:e})}function U0({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:n}){let[r,l]=En(),[s,i]=En(),d=j0(a=>{l(m=>m!=null?[...m,a]:[a])},[l]),c=a=>{if(r==null)return;let{key:m}=a;["ArrowDown","ArrowUp","Escape","Tab"].includes(m)&&a.preventDefault(),m==="Escape"||m==="Tab"?n():m==="ArrowUp"?i(f=>{if(f==null)return r[0];let h=r.indexOf(f)-1;return r[h===-1?r.length-1:h]}):m==="ArrowDown"&&i(f=>f==null?r[0]:r[r.indexOf(f)+1])},u=Hs(()=>({registerItem:d}),[d]);return ho(()=>{r!=null&&s==null&&i(r[0]),s!=null&&s?.current!=null&&s.current.focus()},[r,s]),Me(Us,{value:u,children:Me("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:c,ref:e,children:t})})}function Vs({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:n=!1,dropdownKey:r,Icon:l,itemsContainerClassNames:s,label:i,stopCloseOnClickSelf:d}){let c=Sn(null),u=Sn(null),[a,m]=En(!1),f=()=>{m(!1),u?.current!=null&&u.current.focus()};ho(()=>{let p=u.current,g=c.current;if(a&&p!==null&&g!==null){let{left:k,top:N}=p.getBoundingClientRect(),R=window.scrollY||document.documentElement.scrollTop;g.style.top=`${N+R+p.offsetHeight+5}px`,g.style.left=`${Math.min(k-5,window.innerWidth-g.offsetWidth-20)}px`}},[c,u,a]),ho(()=>{let p=u.current;if(p!==null&&a){let g=k=>{let N=k.target;P0(N)&&(d&&c.current&&c.current.contains(N)||p.contains(N)||m(!1))};return document.addEventListener("click",g),()=>{document.removeEventListener("click",g)}}},[c,u,a,d]);let h=H0(Me(U0,{dropDownRef:c,itemsContainerClassNames:s,onClose:f,children:o}),document.body);return Ps(po.Fragment,{children:[Ps("button",{"aria-label":t,className:e+(a?" active":""),"data-dropdown-key":r,disabled:n,onClick:p=>{p.preventDefault(),m(!a)},onMouseDown:p=>{p.preventDefault()},ref:u,type:"button",children:[l&&Me(l,{}),i&&Me("span",{className:"toolbar-popup__dropdown-label",children:i}),Me("i",{className:"toolbar-popup__dropdown-caret"})]}),a&&Me(po.Fragment,{children:h})]})}var Nn="toolbar-popup__dropdown",K0=t=>{let e=G0(14),{active:o,anchorElem:n,editor:r,enabled:l,item:s}=t,{i18n:i}=z0(),{fieldProps:d}=U(),{featureClientSchemaMap:c,schemaPath:u}=d;if(s.Component){let m;return e[0]!==o||e[1]!==n||e[2]!==r||e[3]!==l||e[4]!==s?(m=s?.Component&&it(s.Component,{active:o,anchorElem:n,editor:r,enabled:l,item:s},s.key),e[0]=o,e[1]=n,e[2]=r,e[3]=l,e[4]=s,e[5]=m):m=e[5],m}let a;if(e[6]!==o||e[7]!==r||e[8]!==l||e[9]!==c||e[10]!==i||e[11]!==s||e[12]!==u){let m=s.key,f;s.label&&(m=typeof s.label=="function"?s.label({featureClientSchemaMap:c,i18n:i,schemaPath:u}):s.label),m.length>25?f=m.substring(0,25)+"...":f=m,a=it(Gs,{active:o,editor:r,enabled:l,Icon:s?.ChildComponent?it(s.ChildComponent,{}):void 0,item:s,itemKey:s.key,tooltip:m,children:it("span",{className:"text",children:f})},s.key),e[6]=o,e[7]=r,e[8]=l,e[9]=c,e[10]=i,e[11]=s,e[12]=u,e[13]=a}else a=e[13];return a},J0=V0.memo(K0),Dt=({anchorElem:t,classNames:e,editor:o,group:n,groupState:r,Icon:l,itemsContainerClassNames:s,label:i})=>{let{items:d,key:c}=n,u=W0(()=>d?.length?d.map(a=>it(J0,{active:r.activeItemKeys.includes(a.key),anchorElem:t,editor:o,enabled:r.enabledItemKeys.includes(a.key),item:a},a.key)):null,[d,r.activeItemKeys,r.enabledItemKeys,t,o]);return it(Vs,{buttonAriaLabel:`${c} dropdown`,buttonClassName:[Nn,`${Nn}-${c}`,...e||[]].filter(Boolean).join(" "),disabled:!r.enabledGroup,dropdownKey:c,Icon:l,itemsContainerClassNames:[`${Nn}-items`,...s||[]],label:i,children:u},c)};import{mergeRegister as X0}from"@lexical/utils";import{$getSelection as Z0}from"lexical";import{useCallback as Y0,useDeferredValue as q0,useEffect as Q0,useRef as Ws,useState as eh}from"react";function th(t){let e=new Map,o=new Map;if(!t?.length)return{groupStates:o,itemStates:e};for(let n of t){let r=[];for(let l of n.items)e.set(l.key,{active:!1,enabled:!0}),r.push(l.key);o.set(n.key,{activeItemKeys:[],activeItems:[],enabledGroup:!0,enabledItemKeys:r})}return{groupStates:o,itemStates:e}}function go(t,e){let[o,n]=eh(()=>th(e)),r=q0(o),l=U(),s=Ws(l);s.current=l;let i=Ws(e);i.current=e;let d=nr(),c=Y0(()=>{t.getEditorState().read(()=>{let u=Z0();if(!u)return;let a=i.current;if(!a?.length)return;let m=s.current,f=new Map,h=new Map;for(let p of a){let g=[],k=[],N=[],R=p.type==="dropdown"?p.maxActiveItems??1:void 0;for(let C of p.items){let x=C.isActive?(!R||g.length<R)&&C.isActive({editor:t,editorConfigContext:m,selection:u}):!1,b=C.isEnabled?C.isEnabled({editor:t,editorConfigContext:m,selection:u}):!0;x&&(g.push(C.key),k.push(C)),b&&N.push(C.key),f.set(C.key,{active:x,enabled:b})}let T=p.type==="dropdown"&&p.isEnabled?p.isEnabled({editor:t,editorConfigContext:m,selection:u}):!0;h.set(p.key,{activeItemKeys:g,activeItems:k,enabledGroup:T,enabledItemKeys:N})}n({groupStates:h,itemStates:f})})},[t]);return Q0(()=>{d(c);let u=()=>d(c),a=X0(t.registerUpdateListener(u));return document.addEventListener("mouseup",u),()=>{a(),document.removeEventListener("mouseup",u)}},[t,d,c]),r}function ah({active:t,anchorElem:e,editor:o,enabled:n,item:r}){return r.Component?r?.Component&&me(r.Component,{anchorElem:e,editor:o,item:r},r.key):r.ChildComponent?me(At,{active:t,editor:o,enabled:n,item:r,children:me(r.ChildComponent,{})},r.key):null}function ch({anchorElem:t,editor:e,editorConfig:o,group:n,index:r,toolbarStates:l}){let{i18n:s}=sh(),{fieldProps:{featureClientSchemaMap:i,schemaPath:d}}=U(),c=l.groupStates.get(n.key),u=Ln(()=>{if(n.type!=="dropdown")return;let m=c?.activeItems?.[0];return m?m.ChildComponent:n.ChildComponent},[n,c?.activeItems]),a=Ln(()=>{if(n.type!=="dropdown")return;let m=c?.activeItems;if(!m?.length)return;if(m.length>1)return s.t("lexical:general:toolbarItemsActive",{count:m.length});let f=m[0],h=f.key;return f.label&&(h=typeof f.label=="function"?f.label({featureClientSchemaMap:i,i18n:s,schemaPath:d}):f.label),h.length>25&&(h=h.substring(0,25)+"..."),h},[n,c?.activeItems,s,i,d]);return nh("div",{className:`fixed-toolbar__group fixed-toolbar__group-${n.key}`,"data-toolbar-group-key":n.key,children:[n.type==="dropdown"&&n.items.length&&c?me(Dt,{anchorElem:t,editor:e,group:n,groupState:c,Icon:u,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a}):null,n.type==="buttons"&&n.items.length?n.items.map(m=>{let f=l.itemStates.get(m.key);return me(ah,{active:f?.active??!1,anchorElem:t,editor:e,enabled:f?.enabled??!0,item:m},m.key)}):null,r<o.features.toolbarFixed?.groups.length-1&&me("div",{className:"divider"})]},n.key)}function uh({anchorElem:t,clientProps:e,editor:o,editorConfig:n,parentWithFixedToolbar:r}){let l=xo.useRef(null),s=zs(),{y:i}=lh(),d=go(o,n?.features?.toolbarFixed?.groups),c=Ln(()=>{if(!r||e?.disableIfParentHasFixedToolbar)return null;let a=r.editorContainerRef.current.previousElementSibling;for(;a;){if(a.classList.contains("fixed-toolbar"))return a;a=a.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,r]);return ih(()=>{if(!c)return;let u=l.current;if(!u)return;let a=u.getBoundingClientRect(),m=c.getBoundingClientRect();if(!(a.bottom<m.top||a.top>m.bottom))u.classList.remove("fixed-toolbar"),u.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),c.classList.remove("fixed-toolbar"),c.classList.add("fixed-toolbar","fixed-toolbar--hide");else{if(!u.classList.contains("fixed-toolbar--overlapping"))return;u.classList.remove("fixed-toolbar--overlapping"),u.classList.add("fixed-toolbar"),c.classList.remove("fixed-toolbar--hide"),c.classList.add("fixed-toolbar")}},50,[l,c,i]),me("div",{className:"fixed-toolbar",onFocus:u=>{u.stopPropagation()},ref:l,children:s&&me(xo.Fragment,{children:n?.features&&n.features?.toolbarFixed?.groups.map((u,a)=>me(ch,{anchorElem:t,editor:o,editorConfig:n,group:u,index:a,toolbarStates:d},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},Js=t=>{let e=oh(6),{clientProps:o}=t,[n]=rh(),r=U();if(!zs())return null;let{editorConfig:s}=r,i=o.applyToFocusedEditor&&r.focusedEditor?.editor||n,d=o.applyToFocusedEditor&&r.focusedEditor?.editorConfig||s,c,u;if(e[0]!==o||e[1]!==i||e[2]!==d||e[3]!==r){u=Symbol.for("react.early_return_sentinel");e:{let a=Ks(r);if(o?.disableIfParentHasFixedToolbar&&a){u=null;break e}if(!d?.features?.toolbarFixed?.groups?.length){u=null;break e}c=me(uh,{anchorElem:document.body,clientProps:o,editor:i,editorConfig:d,parentWithFixedToolbar:a})}e[0]=o,e[1]=i,e[2]=d,e[3]=r,e[4]=c,e[5]=u}else c=e[4],u=e[5];return u!==Symbol.for("react.early_return_sentinel")?u:c};var dh=$({plugins:[{Component:Js,position:"aboveContainer"}]});import{c as mh}from"react/compiler-runtime";import{jsx as Le,jsxs as Ys}from"react/jsx-runtime";import{useLexicalComposerContext as fh}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as ph}from"@lexical/react/useLexicalEditable";import{mergeRegister as qs}from"@lexical/utils";import{$getSelection as Qs,$isRangeSelection as Xs,$isTextNode as hh,COMMAND_PRIORITY_LOW as gh,getDOMSelection as ea,SELECTION_CHANGE_COMMAND as xh}from"lexical";import{useCallback as bo,useEffect as Ot,useMemo as Ch,useRef as Zs,useState as bh}from"react";import"react";import{createPortal as kh}from"react-dom";function yn(t,e){let o=t.getRangeAt(0),n;if(t.anchorNode===e){let r=e;for(;r.firstElementChild!=null;)r=r.firstElementChild;n=r.getBoundingClientRect()}else n=o.getBoundingClientRect();return n}function Co(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:n=0,floatingElem:r,horizontalOffset:l=32,horizontalPosition:s="left",specialHandlingForCaret:i=!1,targetRect:d,verticalGap:c=10}=t,u=o.parentElement;if(d===null||u==null){r.style.opacity="0",r.style.transform="translate(-10000px, -10000px)";return}let a=r.getBoundingClientRect(),m=o.getBoundingClientRect(),f=u.getBoundingClientRect(),h=d.top-a.height-c,p=d.left-l;s==="center"&&(p=d.left+d.width/2-a.width/2);let g=0;return!e&&h<f.top&&!i&&(g=a.height+d.height+c*2,h+=g),s==="center"?p+a.width>f.right?p=f.right-a.width-l:p<f.left&&(p=f.left+l):p+a.width>f.right&&(p=f.right-a.width-l),p-=m.left,r.style.opacity="1",i&&n!==0?(h-=m.bottom-n+a.height-3,r.style.transform=`translate(${p}px, ${h}px) rotate(180deg)`):(h-=m.top,r.style.transform=`translate(${p}px, ${h}px)`),g}function _h({active:t,anchorElem:e,editor:o,enabled:n,item:r}){return r.Component?r?.Component&&Le(r.Component,{anchorElem:e,editor:o,item:r},r.key):r.ChildComponent?Le(At,{active:t,editor:o,enabled:n,item:r,children:Le(r.ChildComponent,{})},r.key):null}function Th({anchorElem:t,editor:e,group:o,index:n,toolbarStates:r}){let{editorConfig:l}=U(),s=r.groupStates.get(o.key),i=Ch(()=>o.type!=="dropdown"?void 0:s?.activeItems?.[0]?.ChildComponent??o.ChildComponent,[o,s?.activeItems]);return Ys("div",{className:`inline-toolbar-popup__group inline-toolbar-popup__group-${o.key}`,"data-toolbar-group-key":o.key,children:[o.type==="dropdown"&&o.items.length&&s?Le(Dt,{anchorElem:t,editor:e,group:o,groupState:s,Icon:i}):null,o.type==="buttons"&&o.items.length?o.items.map(d=>{let c=r.itemStates.get(d.key);return Le(_h,{active:c?.active??!1,anchorElem:t,editor:e,enabled:c?.enabled??!0,item:d},d.key)}):null,n<l.features.toolbarInline?.groups.length-1&&Le("div",{className:"divider"})]},o.key)}function wh({anchorElem:t,editor:e}){let o=Zs(null),n=Zs(null),{editorConfig:r}=U(),l=go(e,r?.features?.toolbarInline?.groups),s=bo(()=>{if(o?.current){let u=o.current.style.opacity==="0",a=o.current.style.pointerEvents==="none";u||(o.current.style.opacity="0"),a||(o.current.style.pointerEvents="none")}},[o]),i=bo(u=>{if(o?.current&&(u.buttons===1||u.buttons===3)){let a=o.current.style.opacity==="0",m=o.current.style.pointerEvents==="none";if(!a||!m){let f=u.clientX,h=u.clientY,p=document.elementFromPoint(f,h);o.current.contains(p)||s()}}},[s]),d=bo(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);Ot(()=>(document.addEventListener("mousemove",i),document.addEventListener("mouseup",d),()=>{document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",d)}),[o,i,d]);let c=bo(()=>{let u=Qs(),a=ea(e._window);if(o.current===null)return;let m=t.querySelector(":scope > .link-editor"),f=m!==null&&"style"in m&&m?.style?.opacity==="1",h=e.getRootElement();if(u!==null&&a!==null&&!a.isCollapsed&&h!==null&&h.contains(a.anchorNode)){let p=yn(a,h),g=Co({alwaysDisplayOnTop:f,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:p});n.current&&Co({anchorElem:o.current,anchorFlippedOffset:g,floatingElem:n.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:p,verticalGap:8})}else s()},[e,s,t]);return Ot(()=>{let u=t.parentElement,a=()=>{e.getEditorState().read(()=>{c()})};return window.addEventListener("resize",a),u&&u.addEventListener("scroll",a),()=>{window.removeEventListener("resize",a),u&&u.removeEventListener("scroll",a)}},[e,c,t]),Ot(()=>(e.getEditorState().read(()=>{c()}),qs(e.registerUpdateListener(({editorState:u})=>{u.read(()=>{c()})}),e.registerCommand(xh,()=>(c(),!1),gh))),[e,c]),Ys("div",{className:"inline-toolbar-popup",ref:o,children:[Le("div",{className:"caret",ref:n}),r?.features&&r.features?.toolbarInline?.groups.map((u,a)=>Le(Th,{anchorElem:t,editor:e,group:u,index:a,toolbarStates:l},u.key))]})}function Sh(t,e){let o=mh(12),[n,r]=bh(!1),l=ph(),s;o[0]!==t?(s=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let f=Qs(),h=ea(t._window),p=t.getRootElement();if(h!==null&&(!Xs(f)||p===null||!p.contains(h.anchorNode))){r(!1);return}if(!Xs(f))return;if(f.getTextContent()!==""){let k=f.getNodes(),N=!1;for(let R of k)if(hh(R)){r(!0),N=!0;break}N||r(!1)}else r(!1);let g=f.getTextContent().replace(/\n/g,"");if(!f.isCollapsed()&&g===""){r(!1);return}})},o[0]=t,o[1]=s):s=o[1];let i=s,d,c;o[2]!==i?(d=()=>(document.addEventListener("selectionchange",i),document.addEventListener("mouseup",i),()=>{document.removeEventListener("selectionchange",i),document.removeEventListener("mouseup",i)}),c=[i],o[2]=i,o[3]=d,o[4]=c):(d=o[3],c=o[4]),Ot(d,c);let u,a;if(o[5]!==t||o[6]!==i?(u=()=>qs(t.registerUpdateListener(()=>{i()}),t.registerRootListener(()=>{t.getRootElement()===null&&r(!1)})),a=[t,i],o[5]=t,o[6]=i,o[7]=u,o[8]=a):(u=o[7],a=o[8]),Ot(u,a),!n||!l)return null;let m;return o[9]!==e||o[10]!==t?(m=kh(Le(wh,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=m):m=o[11],m}var ta=t=>{let{anchorElem:e}=t,[o]=fh();return Sh(o,e)};var Eh=$({plugins:[{Component:ta,position:"floatingAnchorElem"}]});import{TableCellNode as hg,TableNode as gg,TableRowNode as xg}from"@lexical/table";import{jsx as oa}from"react/jsx-runtime";import"react";var Nh={16:"M7 4h4.5a.5.5 0 0 1 .5.5V6H7zM6 4H4.5a.5.5 0 0 0-.5.5V6h2zm0 3H4v2h2zm0 3H4v1.5a.5.5 0 0 0 .5.5H6zm1 2h4.5a.5.5 0 0 0 .5-.5V10H7zm0-3V7h5v2zM3 4.5A1.5 1.5 0 0 1 4.5 3h7A1.5 1.5 0 0 1 13 4.5v7a1.5 1.5 0 0 1-1.5 1.5h-7A1.5 1.5 0 0 1 3 11.5z",24:"M17.204 6.51A2 2 0 0 1 19 8.5V16l-.011.204a2 2 0 0 1-1.785 1.785L17 18H7l-.204-.01a2 2 0 0 1-1.786-1.786L5 16V8.5a2 2 0 0 1 1.796-1.99L7 6.5h10zM6 16a1 1 0 0 0 1 1h2v-2.5H6zm4-1.5V17h7a1 1 0 0 0 .995-.898L18 16v-1.5zm-4-1h3V11H6zm4-2.5v2.5h8V11zM7 7.5a1 1 0 0 0-.995.897L6 8.5V10h3V7.5zm3 2.5h8V8.5a1 1 0 0 0-1-1h-7z"},Rn=({className:t,size:e=24})=>oa("svg",{className:["icon",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:oa("path",{clipRule:"evenodd",d:Nh[e],fill:"currentColor",fillRule:"evenodd"})});import{$createTableCellNode as Lh,$createTableNode as yh,$createTableRowNode as Rh,$isTableCellNode as na,$isTableNode as vn,$isTableRowNode as In,TableCellHeaderStates as ko,TableCellNode as vh,TableNode as Ih,TableRowNode as Mh}from"@lexical/table";import{$isParagraphNode as $h,$isTextNode as Ah}from"lexical";var la=/^\|(.+)\|\s?$/,Dh=/^(\| ?:?-*:? ?)+\|\s?$/,ia=({allTransformers:t})=>({type:"element",dependencies:[Ih,Mh,vh],export:e=>{if(!vn(e))return null;let o=[];for(let n of e.getChildren()){let r=[];if(!In(n))continue;let l=!1;for(let s of n.getChildren())na(s)&&(r.push(Vt(t,s).replace(/\n/g,"\\n").trim()),s.__headerState===ko.ROW&&(l=!0));o.push(`| ${r.join(" | ")} |`),l&&o.push(`| ${r.map(s=>"---").join(" | ")} |`)}return o.join(`
59
+ `)},regExp:la,replace:(e,o,n)=>{let r=n[0];if(!r)return;if(Dh.test(r)){let a=e.getPreviousSibling();if(!a||!vn(a))return;let m=a.getChildren(),f=m[m.length-1];if(!f||!In(f))return;f.getChildren().forEach(h=>{na(h)&&h.setHeaderStyles(ko.ROW,ko.ROW)}),e.remove();return}let l=ra(r,t);if(l==null)return;let s=[l],i=e.getPreviousSibling(),d=l.length;for(;i&&!(!$h(i)||i.getChildrenSize()!==1);){let a=i.getFirstChild();if(!Ah(a))break;let m=ra(a.getTextContent(),t);if(m==null)break;d=Math.max(d,m.length),s.unshift(m);let f=i.getPreviousSibling();i.remove(),i=f}let c=yh();for(let a of s){let m=Rh();c.append(m);for(let f=0;f<d;f++)m.append(f<a.length?a[f]:sa("",t))}let u=e.getPreviousSibling();vn(u)&&Oh(u)===d?(u.append(...c.getChildren()),e.remove()):e.replace(c),c.selectEnd()}});function Oh(t){let e=t.getFirstChild();return In(e)?e.getChildrenSize():0}var sa=(t,e)=>{t=t.replace(/\\n/g,`
60
+ `);let o=Lh(ko.NO_STATUS);return Gt(t,e,o),o},ra=(t,e)=>{let o=t.match(la);return!o||!o[1]?null:o[1].split("|").map(n=>sa(n,e))};import{c as Bh}from"react/compiler-runtime";import{jsx as P,jsxs as ye}from"react/jsx-runtime";import{useLexicalComposerContext as fa}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Ph}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as ua,$deleteTableColumnAtSelection as jh,$deleteTableRowAtSelection as Hh,$getNodeTriplet as Uh,$getTableCellNodeFromLexicalNode as da,$getTableColumnIndexFromTableCellNode as Gh,$getTableNodeFromLexicalNodeOrThrow as Ae,$getTableRowIndexFromTableCellNode as Vh,$insertTableColumnAtSelection as Wh,$insertTableRowAtSelection as zh,$isTableCellNode as pa,$isTableSelection as Ft,$mergeCells as Kh,$unmergeCell as Jh,getTableElement as Mn,getTableObserverFromTableElement as $n,TableCellHeaderStates as $e,TableCellNode as Xh}from"@lexical/table";import{mergeRegister as Zh}from"@lexical/utils";import{useScrollInfo as Yh}from"@payloadcms/ui";import{$getSelection as To,$isElementNode as qh,$isRangeSelection as An,$isTextNode as Qh,$setSelection as e5,COMMAND_PRIORITY_CRITICAL as t5,getDOMSelection as o5,isDOMNode as n5,SELECTION_CHANGE_COMMAND as r5}from"lexical";import*as Dn from"react";import{useCallback as ce,useEffect as st,useRef as _o,useState as at}from"react";import{createPortal as ha}from"react-dom";import{jsx as aa}from"react/jsx-runtime";import"react";var Fh={16:"M5 8a1 1 0 1 1-2 0 1 1 0 0 1 2 0m4 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0m3 1a1 1 0 1 0 0-2 1 1 0 0 0 0 2",24:"M7.5 12a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m6 0a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m4.5 1.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3"},ca=({className:t,size:e=24})=>aa("svg",{className:t,fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:aa("path",{clipRule:"evenodd",d:Fh[e],fill:"currentColor",fillRule:"evenodd"})});function ma(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function l5(){let t=To();if(An(t)&&!t.isCollapsed()||Ft(t)&&!t.anchor.is(t.focus)||!An(t)&&!Ft(t))return!1;let[e]=Uh(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function i5(t){let e=t.getLastDescendant();Qh(e)?e.select():qh(e)?e.selectEnd():e!==null&&e.selectNext()}function s5({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:n,tableCellNode:r}){let[l]=fa(),s=_o(null),[i,d]=at(r),[c,u]=at({columns:1,rows:1}),[a,m]=at(!1),[f,h]=at(!1),{y:p}=Yh();st(()=>l.registerMutationListener(Xh,w=>{w.get(i.getKey())==="updated"&&l.getEditorState().read(()=>{d(i.getLatest())})},{skipInitialization:!0}),[l,i]),st(()=>{l.getEditorState().read(()=>{let w=To();if(Ft(w)){let L=ma(w);u(ma(w)),m(L.columns>1||L.rows>1)}h(l5())})},[l]),st(()=>{let w=e.current,L=s.current,E=l.getRootElement();if(w!=null&&L!=null&&E!=null){let I=E.getBoundingClientRect(),A=w.getBoundingClientRect();L.style.opacity="1";let D=L.getBoundingClientRect(),F=5,B=A.right+F;if(B+D.width>window.innerWidth||B+D.width>I.right){let K=A.left-D.width-F;B=(K<0?F:K)+window.pageXOffset}L.style.left=`${B+window.pageXOffset}px`;let Z=A.top;if(Z+D.height>window.innerHeight){let K=A.bottom-D.height;Z=K<0?F:K}L.style.top=`${Z}px`}},[e,s,l,p]),st(()=>{function w(L){s.current!=null&&e.current!=null&&n5(L.target)&&!s.current.contains(L.target)&&!e.current.contains(L.target)&&n(!1)}return window.addEventListener("click",w),()=>window.removeEventListener("click",w)},[n,e]);let g=ce(()=>{l.update(()=>{if(i.isAttached()){let w=Ae(i),L=Mn(w,l.getElementByKey(w.getKey()));if(L===null)throw new Error("Expected to find tableElement in DOM");let E=$n(L);E!==null&&E.$clearHighlight(),w.markDirty(),d(i.getLatest())}e5(null)})},[l,i]),k=()=>{l.update(()=>{let w=To();if(!Ft(w))return;let E=w.getNodes().filter(pa),I=Kh(E);I&&(i5(I),o())})},N=()=>{l.update(()=>{Jh()})},R=ce(w=>{l.update(()=>{for(let L=0;L<c.rows;L++)zh(w);o()})},[l,o,c.rows]),T=ce(w=>{l.update(()=>{for(let L=0;L<c.columns;L++)Wh(w);o()})},[l,o,c.columns]),C=ce(()=>{l.update(()=>{Hh(),o()})},[l,o]),x=ce(()=>{l.update(()=>{Ae(i).remove(),g(),o()})},[l,i,g,o]),b=ce(()=>{l.update(()=>{jh(),o()})},[l,o]),_=ce(()=>{l.update(()=>{let w=Ae(i),L=Vh(i),[E]=ua(w,null,null),I=new Set,A=i.getHeaderStyles()^$e.ROW;if(E[L])for(let D=0;D<E[L].length;D++){let F=E[L][D];F?.cell&&(I.has(F.cell)||(I.add(F.cell),F.cell.setHeaderStyles(A,$e.ROW)))}g(),o()})},[l,i,g,o]),M=ce(()=>{l.update(()=>{let w=Ae(i),L=Gh(i),[E]=ua(w,null,null),I=new Set,A=i.getHeaderStyles()^$e.COLUMN;if(E)for(let D=0;D<E.length;D++){let F=E?.[D]?.[L];F?.cell&&(I.has(F.cell)||(I.add(F.cell),F.cell.setHeaderStyles(A,$e.COLUMN)))}g(),o()})},[l,i,g,o]),v=ce(()=>{l.update(()=>{if(i.isAttached()){let w=Ae(i);w&&w.setRowStriping(!w.getRowStriping())}g(),o()})},[l,i,g,o]),y=ce(()=>{l.update(()=>{if(i.isAttached()){let w=Ae(i);w&&w.setFrozenColumns(w.getFrozenColumns()===0?1:0)}g(),o()})},[l,i,g,o]),S=null;return t&&(a?S=P("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>k(),type:"button",children:P("span",{className:"text",children:"Merge cells"})}):f&&(S=P("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>N(),type:"button",children:P("span",{className:"text",children:"Unmerge cells"})}))),ha(ye("div",{className:"table-action-menu-dropdown",onClick:w=>{w.stopPropagation()},ref:s,children:[S?ye(Dn.Fragment,{children:[S,P("hr",{})]}):null,P("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>v(),type:"button",children:P("span",{className:"text",children:"Toggle Row Striping"})}),P("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>y(),type:"button",children:P("span",{className:"text",children:"Toggle First Column Freeze"})}),P("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>R(!1),type:"button",children:ye("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:()=>R(!0),type:"button",children:ye("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:()=>T(!1),type:"button",children:ye("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:()=>T(!0),type:"button",children:ye("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:()=>b(),type:"button",children:P("span",{className:"text",children:"Delete column"})}),P("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>C(),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:()=>_(),type:"button",children:ye("span",{className:"text",children:[(i.__headerState&$e.ROW)===$e.ROW?"Remove":"Add"," ","row header"]})}),P("button",{className:"item","data-test-id":"table-column-header",onClick:()=>M(),type:"button",children:ye("span",{className:"text",children:[(i.__headerState&$e.COLUMN)===$e.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function a5({anchorElem:t,cellMerge:e}){let[o]=fa(),n=_o(null),r=_o(null),[l,s]=at(!1),[i,d]=at(null),c=ce(()=>{let a=n.current,m=To(),f=o5(o._window),h=document.activeElement;function p(){a&&(a.classList.remove("table-cell-action-button-container--active"),a.classList.add("table-cell-action-button-container--inactive")),d(null)}if(m==null||a==null)return p();let g=o.getRootElement(),k=null,N=null;if(An(m)&&g!==null&&f!==null&&g.contains(f.anchorNode)){let T=da(m.anchor.getNode());if(T==null||(N=o.getElementByKey(T.getKey()),N==null||!T.isAttached()))return p();let C=Ae(T),x=Mn(C,o.getElementByKey(C.getKey()));if(x===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");k=$n(x),d(T)}else if(Ft(m)){let T=da(m.anchor.getNode());if(!pa(T))throw new Error("TableSelection anchorNode must be a TableCellNode");let C=Ae(T),x=Mn(C,o.getElementByKey(C.getKey()));if(x===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");k=$n(x),N=o.getElementByKey(T.getKey())}else if(!h)return p();if(k===null||N===null)return p();let R=!k||!k.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",R),a.classList.toggle("table-cell-action-button-container--inactive",!R),R){let T=N.getBoundingClientRect(),C=t.getBoundingClientRect(),x=T.top-C.top,b=T.right-C.left;a.style.transform=`translate(${b}px, ${x}px)`}},[o,t]);st(()=>{let a,m=()=>{a=void 0,o.getEditorState().read(c)},f=()=>(a===void 0&&(a=setTimeout(m,0)),!1);return Zh(o.registerUpdateListener(f),o.registerCommand(r5,f,t5),o.registerRootListener((h,p)=>{p&&p.removeEventListener("pointerup",f),h&&(h.addEventListener("pointerup",f),f())}),()=>clearTimeout(a))});let u=_o(i);return st(()=>{u.current!==i&&s(!1),u.current=i},[u,i]),P("div",{className:"table-cell-action-button-container",ref:n,children:i!=null&&ye(Dn.Fragment,{children:[P("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),s(!l)},ref:r,type:"button",children:P(ca,{})}),l&&P(s5,{cellMerge:e,contextRef:r,onClose:()=>s(!1),setIsMenuOpen:s,tableCellNode:i})]})})}var ga=t=>{let e=Bh(3),{anchorElem:o}=t,n=Ph(),r;return e[0]!==o||e[1]!==n?(r=ha(n?P(a5,{anchorElem:o??document.body,cellMerge:!0}):null,o??document.body),e[0]=o,e[1]=n,e[2]=r):r=e[2],r};import{c as c5}from"react/compiler-runtime";import{jsx as So,jsxs as u5}from"react/jsx-runtime";import{useLexicalComposerContext as d5}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as m5}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as f5,$getTableNodeFromLexicalNodeOrThrow as On,$getTableRowIndexFromTableCellNode as p5,$isTableCellNode as xa,$isTableRowNode as h5,getDOMCellFromTarget as g5,getTableElement as x5,TableNode as Ca}from"@lexical/table";import{calculateZoomLevel as ba,mergeRegister as C5}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Fn,isHTMLElement as b5,SKIP_SCROLL_INTO_VIEW_TAG as ka}from"lexical";import*as Ta from"react";import{useCallback as Bt,useEffect as Bn,useRef as wo,useState as ct}from"react";import{createPortal as k5}from"react-dom";var _5=33,_a=92;function T5({editor:t}){let e=wo(null),o=wo(null),n=wo(null),[r,l]=ct(!1),s=U(),i=wo(null),[d,c]=ct(null),[u,a]=ct(null),[m,f]=ct(!1),[h,p]=ct(null),g=Bt(()=>{a(null),e.current=null,p(null),i.current=null,n.current=null},[]),k=y=>(y.buttons&1)===1;Bn(()=>{let y=new Set;return C5(t.registerMutationListener(Ca,S=>{for(let[w,L]of S)L==="destroyed"?y.delete(w):y.add(w);l(y.size>0)}),t.registerNodeTransform(Ca,S=>{if(S.getColWidths())return S;let w=S.getColumnCount(),L=_a;return S.setColWidths(Array(w).fill(L)),S}))},[t]),Bn(()=>{if(!r)return;let y=E=>{let I=E.target;if(b5(I)){if(h){c({x:E.clientX,y:E.clientY});return}if(f(k(E)),!(o.current&&o.current.contains(I))&&e.current!==I){e.current=I;let A=g5(I);A&&u!==A?t.getEditorState().read(()=>{let D=Fn(A.elem);if(!D)throw new Error("TableCellResizer: Table cell node not found.");let F=On(D),B=x5(F,t.getElementByKey(F.getKey()));if(!B)throw new Error("TableCellResizer: Table element not found.");e.current=I,n.current=B.getBoundingClientRect(),a(A)},{editor:t}):A==null&&g()}}},S=E=>{f(!0)},w=E=>{f(!1)},L=t.registerRootListener((E,I)=>{I?.removeEventListener("mousemove",y),I?.removeEventListener("mousedown",S),I?.removeEventListener("mouseup",w),E?.addEventListener("mousemove",y),E?.addEventListener("mousedown",S),E?.addEventListener("mouseup",w)});return()=>{L()}},[u,h,t,r,g]);let N=y=>y==="bottom",R=Bt(y=>{if(!u)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let S=Fn(u.elem);if(!xa(S))throw new Error("TableCellResizer: Table cell node not found.");let w=On(S),L=p5(S),E=w.getChildren(),A=S.getColSpan()===w.getColumnCount()?L:L+S.getRowSpan()-1;if(A>=E.length||A<0)throw new Error("Expected table cell to be inside of table row.");let D=E[A];if(!h5(D))throw new Error("Expected table row");let F=D.getHeight();if(F===void 0){let Z=D.getChildren();F=Math.min(...Z.map(K=>T(K,t)??1/0))}let B=Math.max(F+y,_5);D.setHeight(B)},{tag:ka})},[u,t]),T=(y,S)=>S.getElementByKey(y.getKey())?.clientHeight,C=(y,S)=>{let w;return S.forEach(L=>{L.forEach((E,I)=>{E.cell===y&&(w=I)})}),w},x=Bt(y=>{if(!u)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let S=Fn(u.elem);if(!xa(S))throw new Error("TableCellResizer: Table cell node not found.");let w=On(S),[L]=f5(w,null,null),E=C(S,L);if(E===void 0)throw new Error("TableCellResizer: Table column not found.");let I=w.getColWidths();if(!I)return;let A=I[E];if(A===void 0)return;let D=[...I],F=Math.max(A+y,_a);D[E]=F,w.setColWidths(D)},{tag:ka})},[u,t]),b=Bt(y=>{let S=w=>{if(w.preventDefault(),w.stopPropagation(),!u)throw new Error("TableCellResizer: Expected active cell.");if(i.current){let{x:L,y:E}=i.current;if(u===null)return;let I=ba(w.target);if(N(y)){let A=(w.clientY-E)/I;R(A)}else{let A=(w.clientX-L)/I;x(A)}g(),document.removeEventListener("mouseup",S)}};return S},[u,g,x,R]),_=Bt(y=>S=>{if(S.preventDefault(),S.stopPropagation(),!u)throw new Error("TableCellResizer: Expected active cell.");i.current={x:S.clientX,y:S.clientY},c(i.current),p(y),document.addEventListener("mouseup",b(y))},[u,b]),[M,v]=ct({bottom:null,left:null,right:null,top:null});return Bn(()=>{if(u){let{height:y,left:S,top:w,width:L}=u.elem.getBoundingClientRect(),E=ba(u.elem),I=10,A={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${I}px`,left:`${window.scrollX+S}px`,top:`${window.scrollY+w+y-I/2}px`,width:`${L}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${y}px`,left:`${window.scrollX+S+L-I/2}px`,top:`${window.scrollY+w}px`,width:`${I}px`}},D=n.current;h&&d&&D&&(N(h)?(A[h].left=`${window.scrollX+D.left}px`,A[h].top=`${window.scrollY+d.y/E}px`,A[h].height="3px",A[h].width=`${D.width}px`):(A[h].top=`${window.scrollY+D.top}px`,A[h].left=`${window.scrollX+d.x/E}px`,A[h].width="3px",A[h].height=`${D.height}px`),A[h].backgroundColor="#adf"),v(A)}else v({bottom:null,left:null,right:null,top:null})},[u,h,d]),So("div",{ref:o,children:u!=null&&!m&&u5(Ta.Fragment,{children:[So("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:_("right"),style:M.right||void 0}),So("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:_("bottom"),style:M.bottom||void 0})]})})}var wa=()=>{let t=c5(3),[e]=d5(),o=m5(),n;return t[0]!==e||t[1]!==o?(n=o?k5(So(T5,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=n):n=t[2],n};import{c as v5}from"react/compiler-runtime";import{jsx as Pn,jsxs as I5,Fragment as M5}from"react/jsx-runtime";import{useLexicalComposerContext as $5}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Ia}from"@lexical/react/useLexicalEditable";import{$getTableAndElementByKey as A5,$getTableColumnIndexFromTableCellNode as D5,$getTableRowIndexFromTableCellNode as O5,$insertTableColumnAtSelection as F5,$insertTableRowAtSelection as B5,$isTableCellNode as P5,$isTableNode as Na,getTableElement as j5,TableNode as H5}from"@lexical/table";import{$findMatchingParent as U5,mergeRegister as G5}from"@lexical/utils";import{$getNearestNodeFromDOMNode as La,isHTMLElement as V5}from"lexical";import{useEffect as ya,useMemo as W5,useRef as Ra,useState as Eo}from"react";import"react";import{createPortal as z5}from"react-dom";import{c as L5}from"react/compiler-runtime";import{useEffect as y5,useRef as R5}from"react";var w5="Expected a function",S5=Math.max,E5=Math.min;function N5(t,e,o){let n,r,l=0,s,i=!1,d=!1,c,u,a,m=!0;if(typeof t!="function")throw new TypeError(w5);e=e||0,typeof o=="object"&&(i=!!o.leading,d="maxWait"in o,c=d?S5(o.maxWait||0,e):c,m="trailing"in o?!!o.trailing:m);function f(x){let b=n,_=s;return n=s=void 0,l=x,u=t.apply(_,b),u}function h(x){return l=x,a=setTimeout(k,e),i?f(x):u}function p(x){let b=x-r,_=x-l,M=e-b;return d?E5(M,c-_):M}function g(x){let b=x-r,_=x-l;return r===void 0||b>=e||b<0||d&&_>=c}function k(){let x=Date.now();if(g(x))return N(x);a=setTimeout(k,p(x))}function N(x){return a=void 0,m&&n?f(x):(n=s=void 0,u)}function R(){a!==void 0&&clearTimeout(a),l=0,n=r=s=a=void 0}function T(){return a===void 0?u:N(Date.now())}function C(){let x=Date.now(),b=g(x);if(n=arguments,s=this,r=x,b){if(a===void 0)return h(r);if(d)return clearTimeout(a),a=setTimeout(k,e),f(r)}return a===void 0&&(a=setTimeout(k,e)),u}return C.cancel=R,C.flush=T,C}var Sa=N5;function Ea(t,e,o){let n=L5(6),r=R5(null),l,s;n[0]!==t||n[1]!==o||n[2]!==e?(l=()=>(r.current=Sa(t,e,{maxWait:o}),()=>{r.current?.cancel()}),s=[t,e,o],n[0]=t,n[1]=o,n[2]=e,n[3]=l,n[4]=s):(l=n[3],s=n[4]),y5(l,s);let i;return n[5]===Symbol.for("react.memo_cache_sentinel")?(i=(...c)=>{let u=c;r.current&&r.current(...u)},n[5]=i):i=n[5],i}var va=20;function K5({anchorElem:t}){let[e]=$5(),o=Ia(),n=U(),[r,l]=Eo(!1),[s,i]=Eo(!1),[d,c]=Eo(!1),[u,a]=Eo({}),m=Ra(new Set),f=Ra(null),h=Ea(k=>{let{isOutside:N,tableDOMNode:R}=J5(k,n.editorConfig?.lexical);if(N){l(!1),i(!1);return}if(!R)return;f.current=R;let T=null,C=null,x=null;if(e.getEditorState().read(()=>{let A=La(R);if(P5(A)){let D=U5(A,F=>Na(F));if(!Na(D))return;if(x=j5(D,e.getElementByKey(D.getKey())),x){let F=D.getChildrenSize(),B=D.getChildAtIndex(0)?.getChildrenSize(),Z=O5(A),K=D5(A);Z===F-1?T=A:K===B-1&&(C=A)}}},{editor:e}),!x)return;let b=x.parentElement;if(!b)return;let{bottom:_,height:M,left:v,right:y,width:S,y:w}=x.getBoundingClientRect(),L=!1;b&&b.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(L=b.scrollWidth>b.clientWidth);let{left:E,y:I}=t.getBoundingClientRect();T?(i(!1),l(!0),a({height:va,left:L&&b?b.offsetLeft:v-E,top:_-I+5,width:L&&b?b.offsetWidth:S})):C&&(i(!0),l(!1),a({height:M,left:y-E+5,top:w-I,width:va}))},50,250),p=W5(()=>new ResizeObserver(()=>{l(!1),i(!1)}),[]);ya(()=>{if(d)return document.addEventListener("mousemove",h),()=>{l(!1),i(!1),document.removeEventListener("mousemove",h)}},[d,h]),ya(()=>G5(e.registerMutationListener(H5,k=>{e.getEditorState().read(()=>{let N=!1;for(let[R,T]of k)switch(T){case"created":{m.current.add(R),N=!0;break}case"destroyed":{m.current.delete(R),N=!0;break}default:break}if(N){p.disconnect();for(let R of m.current){let{tableElement:T}=A5(R);p.observe(T)}c(m.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,p]);let g=k=>{e.update(()=>{f.current&&(La(f.current)?.selectEnd(),k?(B5(),l(!1)):(F5(),i(!1)))})};return o?I5(M5,{children:[r&&Pn("button",{"aria-label":"Add Row",className:n.editorConfig.lexical.theme.tableAddRows,onClick:()=>g(!0),style:{...u},type:"button"}),s&&Pn("button",{"aria-label":"Add Column",className:n.editorConfig.lexical.theme.tableAddColumns,onClick:()=>g(!1),style:{...u},type:"button"})]}):null}function J5(t,e){let o=t.target;if(V5(o)){let n=o.closest(`td.${e.theme.tableCell}, th.${e.theme.tableCell}`);return{isOutside:!(n||o.closest(`button.${e.theme.tableAddRows}`)||o.closest(`button.${e.theme.tableAddColumns}`)||o.closest(`div.${e.theme.tableCellResizer}`)),tableDOMNode:n}}else return{isOutside:!0,tableDOMNode:null}}function Ma(t){let e=v5(2),{anchorElem:o}=t,n=o===void 0?document.body:o;if(!Ia())return null;let l;return e[0]!==n?(l=z5(Pn(K5,{anchorElem:n}),n),e[0]=n,e[1]=l):l=e[1],l}import{c as X5}from"react/compiler-runtime";import{jsx as jn,jsxs as Z5}from"react/jsx-runtime";import{useLexicalComposerContext as Y5}from"@lexical/react/LexicalComposerContext";import{TablePlugin as q5}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as Q5,TableCellNode as eg,TableNode as tg,TableRowNode as og}from"@lexical/table";import{mergeRegister as ng}from"@lexical/utils";import{formatDrawerSlug as rg,useEditDepth as lg}from"@payloadcms/ui";import{$getSelection as ig,$isRangeSelection as sg,COMMAND_PRIORITY_EDITOR as ag,createCommand as cg}from"lexical";import{createContext as ug,use as dg,useEffect as mg,useMemo as fg,useState as pg}from"react";import*as $a from"react";var No=cg("OPEN_EMBED_DRAWER_COMMAND"),Aa=ug({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function Da({children:t}){let[e,o]=pg({cellEditorConfig:null,cellEditorPlugins:null});return jn(Aa,{value:fg(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(n,r)=>{o({cellEditorConfig:n,cellEditorPlugins:r})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var Oa=()=>{let t=X5(16),[e]=Y5(),o=dg(Aa),n=lg(),{fieldProps:r,uuid:l}=U(),{schemaPath:s}=r,i="lexical-table-create-"+l,d;t[0]!==n||t[1]!==i?(d=rg({slug:i,depth:n}),t[0]=n,t[1]=i,t[2]=d):d=t[2];let c=d,{toggleDrawer:u}=xe(c,!0),a;t[3]!==e||t[4]!==u?(a=()=>{if(!e.hasNodes([tg,og,eg]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return ng(e.registerCommand(No,()=>{let p=null;return e.getEditorState().read(()=>{let g=ig();sg(g)&&(p=g)}),p&&u(),!0},ag))},t[3]=e,t[4]=u,t[5]=a):a=t[5];let m;t[6]!==o||t[7]!==e||t[8]!==u?(m=[o,e,u],t[6]=o,t[7]=e,t[8]=u,t[9]=m):m=t[9],mg(a,m);let f;t[10]!==e?(f=(p,g)=>{!g.columns||!g.rows||e.dispatchCommand(Q5,{columns:String(g.columns),rows:String(g.rows)})},t[10]=e,t[11]=f):f=t[11];let h;return t[12]!==c||t[13]!==s||t[14]!==f?(h=Z5($a.Fragment,{children:[jn(xt,{drawerSlug:c,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:f,schemaPath:s,schemaPathSuffix:"fields"}),jn(q5,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]}),t[12]=c,t[13]=s,t[14]=f,t[15]=h):h=t[15],h};var Cg=$({markdownTransformers:[ia],nodes:[gg,hg,xg],plugins:[{Component:Oa,position:"normal"},{Component:wa,position:"normal"},{Component:ga,position:"floatingAnchorElem"},{Component:Ma,position:"floatingAnchorElem"}],providers:[Da],slashMenu:{groups:[J([{Icon:Rn,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(No,{})}}])]},toolbarFixed:{groups:[ke([{ChildComponent:Rn,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(No,{})}}])]}});import{$isNodeSelection as e2}from"lexical";import{jsx as Fa}from"react/jsx-runtime";import"react";var bg="M16.2041 6.01074C17.2128 6.113 18 6.96435 18 8V16L17.9893 16.2041C17.8938 17.1457 17.1457 17.8938 16.2041 17.9893L16 18H8C6.96435 18 6.113 17.2128 6.01074 16.2041L6 16V8C6 6.89543 6.89543 6 8 6H16L16.2041 6.01074ZM8 7C7.44772 7 7 7.44772 7 8V16C7 16.5523 7.44772 17 8 17H16C16.5523 17 17 16.5523 17 16V8C17 7.44772 16.5523 7 16 7H8ZM9.72461 11.582C9.91869 11.4539 10.1827 11.4756 10.3535 11.6465L13.8535 15.1465C14.0488 15.3417 14.0488 15.6583 13.8535 15.8535C13.6583 16.0488 13.3417 16.0488 13.1465 15.8535L10 12.707L8.85352 13.8535C8.65825 14.0488 8.34175 14.0488 8.14648 13.8535C7.95122 13.6583 7.95122 13.3417 8.14648 13.1465L9.64648 11.6465L9.72461 11.582ZM14 8C15.1046 8 16 8.89543 16 10C16 11.1046 15.1046 12 14 12C12.8954 12 12 11.1046 12 10C12 8.89543 12.8954 8 14 8ZM14 9C13.4477 9 13 9.44772 13 10C13 10.5523 13.4477 11 14 11C14.5523 11 15 10.5523 15 10C15 9.44772 14.5523 9 14 9Z",Hn=({className:t})=>Fa("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Fa("path",{clipRule:"evenodd",d:bg,fill:"currentColor",fillRule:"evenodd"})});import{jsx as Ua}from"react/jsx-runtime";import Ga from"bson-objectid";import{$applyNodeReplacement as Eg}from"lexical";import*as Va from"react";import kg from"bson-objectid";function Lo(t,e){if(t.hasAttribute("data-lexical-pending-upload-form-id")){let n=t.getAttribute("data-lexical-pending-upload-form-id");if(n!=null)return{node:e({data:{pending:{formID:n,src:t.getAttribute("src")||""}}})}}if(t.hasAttribute("data-lexical-upload-relation-to")&&t.hasAttribute("data-lexical-upload-id")){let n=t.getAttribute("data-lexical-upload-id"),r=t.getAttribute("data-lexical-upload-relation-to");if(n!=null&&r!=null)return{node:e({data:{fields:{},relationTo:r,value:n}})}}return{node:e({data:{pending:{formID:new kg.default().toHexString(),src:t.getAttribute("src")||""}}})}}import{DecoratorBlockNode as _g}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as Tg}from"@lexical/utils";import Pa from"bson-objectid";import{$applyNodeReplacement as wg}from"lexical";var Pt=class extends _g{__data;constructor({data:e,format:o,key:n}){super(o,n),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=>Lo(o,Ba),priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new Pa.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,pending:e.pending,relationTo:e.relationTo,value:e.value},n=Ba({data:o});return n.setFormat(e.format),n}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return Tg(o,e?.theme?.upload),o}decorate(){return null}exportDOM(){let e=document.createElement("img"),o=this.__data;return o.pending?(e.setAttribute("data-lexical-pending-upload-form-id",String(o?.pending?.formID)),e.setAttribute("src",o?.pending?.src||"")):(e.setAttribute("data-lexical-upload-id",String(o?.value)),e.setAttribute("data-lexical-upload-relation-to",o?.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 Ba({data:t}){return t?.id||(t.id=new Pa.default().toHexString()),wg(new Pt({data:t}))}import{jsx as ja}from"react/jsx-runtime";import{ShimmerEffect as Sg}from"@payloadcms/ui";var Ha=()=>ja("div",{className:"lexical-upload",children:ja(Sg,{height:"95px",width:"203px"})});var Ng=Va.lazy(()=>import("./component-XIHC3W6W.js").then(t=>({default:t.UploadComponent}))),fe=class extends Pt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{img:e=>({conversion:o=>Lo(o,pe),priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new Ga.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,pending:e.pending,relationTo:e.relationTo,value:e.value},n=pe({data:o});return n.setFormat(e.format),n}decorate(e,o){return this.__data.pending?Ua(Ha,{}):Ua(Ng,{className:o?.theme?.upload??"LexicalEditorTheme__upload",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function pe({data:t}){return t?.id||(t.id=new Ga.default().toHexString()),Eg(new fe({data:t}))}function ut(t){return t instanceof fe}import{c as Ag}from"react/compiler-runtime";import{jsx as Dg}from"react/jsx-runtime";import{useLexicalComposerContext as Og}from"@lexical/react/LexicalComposerContext.js";import{$dfsIterator as tc,$insertNodeToNearestRoot as Vn,mergeRegister as Fg}from"@lexical/utils";import{useBulkUpload as Bg,useEffectEvent as Pg,useModal as jg}from"@payloadcms/ui";import Wn from"bson-objectid";import{$createRangeSelection as Hg,$getPreviousSelection as Za,$getSelection as Ya,$isParagraphNode as zn,$isRangeSelection as qa,$setSelection as Ug,COMMAND_PRIORITY_EDITOR as Gg,COMMAND_PRIORITY_LOW as Qa,createCommand as Vg,DROP_COMMAND as Wg,getDOMSelectionFromTarget as zg,isHTMLElement as ec,PASTE_COMMAND as Kg}from"lexical";import{useEffect as Jg}from"react";import{c as Wa}from"react/compiler-runtime";import{jsx as Un}from"react/jsx-runtime";import{useLexicalComposerContext as za}from"@lexical/react/LexicalComposerContext.js";import{toast as Lg}from"@payloadcms/ui";import{$getNodeByKey as yg,COMMAND_PRIORITY_EDITOR as Ka}from"lexical";import{useEffect as Ja,useState as Rg}from"react";var vg=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=yg(o);r&&r.replace(pe({data:{fields:null,relationTo:e,value:n}}))}):t.dispatchCommand(Gn,{fields:null,relationTo:e,value:n})},Ig=t=>{let e=Wa(13),{enabledCollectionSlugs:o}=t,[n]=za(),[r,l]=Rg(null),s;e[0]!==o?(s={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=s):s=e[1];let{closeListDrawer:i,ListDrawer:d,openListDrawer:c}=$t(s),u,a;e[2]!==n||e[3]!==c?(u=()=>n.registerCommand(Xe,p=>(l(p?.replace?p?.replace.nodeKey:null),c(),!0),Ka),a=[n,c],e[2]=n,e[3]=c,e[4]=u,e[5]=a):(u=e[4],a=e[5]),Ja(u,a);let m;e[6]!==i||e[7]!==n||e[8]!==r?(m=p=>{let{collectionSlug:g,doc:k}=p;i(),vg({editor:n,relationTo:g,replaceNodeKey:r,value:k.id})},e[6]=i,e[7]=n,e[8]=r,e[9]=m):m=e[9];let f=m,h;return e[10]!==d||e[11]!==f?(h=Un(d,{onSelect:f}),e[10]=d,e[11]=f,e[12]=h):h=e[12],h},Mg=()=>{let t=Wa(3),[e]=za(),o,n;return t[0]!==e?(o=()=>e.registerCommand(Xe,$g,Ka),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),Ja(o,n),null},Xa=({enabledCollectionSlugs:t})=>t?.length?Un(Ig,{enabledCollectionSlugs:t}):Un(Mg,{});function $g(){return Lg.error("No upload collections enabled"),!0}function Xg(t){let e=t.target;return!!(ec(e)&&!e.closest("code, span.editor-image")&&ec(e.parentElement)&&e.parentElement.closest("div.ContentEditable__root"))}function Zg(t){let e,o=zg(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 Gn=Vg("INSERT_UPLOAD_COMMAND"),oc=t=>{let e=Ag(21),{clientProps:o}=t,[n]=Og(),r=o?.disabledCollections,l=o?.enabledCollections,s;e[0]!==r||e[1]!==l?(s={collectionSlugsBlacklist:r,collectionSlugsWhitelist:l,uploads:!0},e[0]=r,e[1]=l,e[2]=s):s=e[2];let{enabledCollectionSlugs:i}=fo(s),{drawerSlug:d,setCollectionSlug:c,setInitialForms:u,setOnCancel:a,setOnSuccess:m,setSelectableCollections:f}=Bg(),{isModalOpen:h,openModal:p}=jg(),g;e[3]!==d||e[4]!==n||e[5]!==i||e[6]!==h||e[7]!==p||e[8]!==c||e[9]!==u||e[10]!==a||e[11]!==m||e[12]!==f?(g=C=>{let{files:x}=C;if(x?.length!==0&&(u(b=>[...b??[],...x.map(Yg)]),!h(d))){if(!i.length||!i[0])return;c(i[0]),f(i),a(()=>{n.update(qg)}),m(b=>{let _=new Map(b.map(Qg));n.update(()=>{for(let M of tc()){let v=M.node;if(ut(v)){let y=v.getData();if(y?.pending){let S=_.get(y.pending?.formID);S&&v.replace(pe({data:{id:new Wn.default().toHexString(),fields:{},relationTo:S.collectionSlug,value:S.doc.id}}))}}}})}),p(d)}},e[3]=d,e[4]=n,e[5]=i,e[6]=h,e[7]=p,e[8]=c,e[9]=u,e[10]=a,e[11]=m,e[12]=f,e[13]=g):g=e[13];let k=Pg(g),N;e[14]!==n||e[15]!==k?(N=()=>{if(!n.hasNodes([fe]))throw new Error("UploadPlugin: UploadNode not registered on editor");return Fg(n.registerNodeTransform(fe,C=>{let x=C.getData();if(!x?.pending)return;(async function(){let M=null,v=x?.pending?.src,y=x?.pending?.formID;if(v?.startsWith("data:")){let S=v.match(/data:(image\/[a-zA-Z]+);base64,/),w=S?S[1]:"image/png",L=v.replace(/^data:image\/[a-zA-Z]+;base64,/,""),E=atob(L),I=new Array(E.length);for(let F=0;F<E.length;F++)I[F]=E.charCodeAt(F);let A=new Uint8Array(I);M={alt:void 0,file:new File([A],"pasted-image."+w?.split("/",2)[1],{type:w}),formID:y}}else if(v?.startsWith("http")||v?.startsWith("https")){let w=await(await fetch(v)).blob(),L=v.split("/").pop()||"pasted-image"+w.type.split("/",2)[1];M={alt:void 0,file:new File([w],L,{type:w.type}),formID:y}}M&&k({files:[M]})})()}),n.registerCommand(Gn,C=>(n.update(()=>{let x=Ya()||Za();if(qa(x)){let b=pe({data:{id:C.id,fields:C.fields,relationTo:C.relationTo,value:C.value}}),{focus:_}=x,M=_.getNode();Vn(b),zn(M)&&!M.__first&&M.remove()}}),!0),Gg),n.registerCommand(Kg,C=>{if(!(C instanceof ClipboardEvent))return!1;let x=C.clipboardData;if(!x?.types?.length||x?.types?.includes("text/html"))return!1;let b=[];return x?.files?.length&&Array.from(x.files).forEach(_=>{b.push({alt:"",file:_,formID:new Wn.default().toHexString()})}),b.length?(n.update(()=>{let _=Ya()||Za();if(qa(_))for(let M of b){let v=pe({data:{pending:{formID:M.formID,src:URL.createObjectURL(M.file)}}}),{focus:y}=_,S=y.getNode();Vn(v),zn(S)&&!S.__first&&S.remove()}}),k({files:b}),!0):!1},Qa),n.registerCommand(Wg,C=>{if(!(C instanceof DragEvent))return!1;let x=C.dataTransfer;if(!x?.types?.length)return!1;let b=[];return x?.files?.length&&Array.from(x.files).forEach(_=>{b.push({alt:"",file:_,formID:new Wn.default().toHexString()})}),b.length?(C.preventDefault(),C.stopPropagation(),n.update(()=>{if(Xg(C)){let _=Zg(C),M=Hg();_!=null&&M.applyDOMRange(_),Ug(M);for(let v of b){let y=pe({data:{pending:{formID:v.formID,src:URL.createObjectURL(v.file)}}}),{focus:S}=M,w=S.getNode();Vn(y),zn(w)&&!w.__first&&w.remove()}}}),k({files:b}),!0):!1},Qa))},e[14]=n,e[15]=k,e[16]=N):N=e[16];let R;e[17]!==n?(R=[n],e[17]=n,e[18]=R):R=e[18],Jg(N,R);let T;return e[19]!==i?(T=Dg(Xa,{enabledCollectionSlugs:i}),e[19]=i,e[20]=T):T=e[20],T};function Yg(t){return{file:t.file,formID:t.formID}}function qg(){for(let t of tc()){let e=t.node;ut(e)&&e.getData()?.pending&&e.remove()}}function Qg(t){return[t.formID,t]}var t2=$({nodes:[fe],plugins:[{Component:oc,position:"normal"}],slashMenu:{groups:[J([{Icon:Hn,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Xe,{replace:!1})}}])]},toolbarFixed:{groups:[ke([{ChildComponent:Hn,isActive:({selection:t})=>{if(!e2(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return ut(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Xe,{replace:!1})}}])]}});import{c as n2}from"react/compiler-runtime";import{jsx as yo}from"react/jsx-runtime";import{createElement as r2}from"react";import{ShimmerEffect as l2,useConfig as i2}from"@payloadcms/ui";import{lazy as s2,Suspense as a2,useEffect as c2,useState as u2}from"react";var nc={block:"LexicalEditorTheme__block",blockCursor:"LexicalEditorTheme__blockCursor",characterLimit:"LexicalEditorTheme__characterLimit",code:"LexicalEditorTheme__code",inlineBlock:"LexicalEditorTheme__inlineBlock",heading:{h1:"LexicalEditorTheme__h1",h2:"LexicalEditorTheme__h2",h3:"LexicalEditorTheme__h3",h4:"LexicalEditorTheme__h4",h5:"LexicalEditorTheme__h5",h6:"LexicalEditorTheme__h6"},hr:"LexicalEditorTheme__hr",hrSelected:"LexicalEditorTheme__hrSelected",indent:"LexicalEditorTheme__indent",link:"LexicalEditorTheme__link",list:{checklist:"LexicalEditorTheme__checklist",listitem:"LexicalEditorTheme__listItem",listitemChecked:"LexicalEditorTheme__listItemChecked",listitemUnchecked:"LexicalEditorTheme__listItemUnchecked",nested:{listitem:"LexicalEditorTheme__nestedListItem"},olDepth:["LexicalEditorTheme__ol1","LexicalEditorTheme__ol2","LexicalEditorTheme__ol3","LexicalEditorTheme__ol4","LexicalEditorTheme__ol5"],ul:"LexicalEditorTheme__ul"},ltr:"LexicalEditorTheme__ltr",mark:"LexicalEditorTheme__mark",markOverlap:"LexicalEditorTheme__markOverlap",paragraph:"LexicalEditorTheme__paragraph",placeholder:"LexicalEditorTheme__placeholder",quote:"LexicalEditorTheme__quote",relationship:"LexicalEditorTheme__relationship",rtl:"LexicalEditorTheme__rtl",tab:"LexicalEditorTheme__tabNode",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableAlignment:{center:"LexicalEditorTheme__tableAlignmentCenter",right:"LexicalEditorTheme__tableAlignmentRight"},tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableFrozenColumn:"LexicalEditorTheme__tableFrozenColumn",tableRowStriping:"LexicalEditorTheme__tableRowStriping",tableScrollableWrapper:"LexicalEditorTheme__tableScrollableWrapper",tableSelected:"LexicalEditorTheme__tableSelected",tableSelection:"LexicalEditorTheme__tableSelection",text:{bold:"LexicalEditorTheme__textBold",code:"LexicalEditorTheme__textCode",italic:"LexicalEditorTheme__textItalic",strikethrough:"LexicalEditorTheme__textStrikethrough",subscript:"LexicalEditorTheme__textSubscript",superscript:"LexicalEditorTheme__textSuperscript",underline:"LexicalEditorTheme__textUnderline",underlineStrikethrough:"LexicalEditorTheme__textUnderlineStrikethrough"},upload:"LexicalEditorTheme__upload"};var Kn={namespace:"lexical",theme:nc};function rc({config:t,featureClientImportMap:e,featureClientSchemaMap:o,field:n,schemaPath:r,unSanitizedEditorConfig:l}){let s=new Map;for(let c of l.features){if(!c?.clientFeatureProps?.featureKey||c?.clientFeatureProps?.order===void 0||c?.clientFeatureProps?.order===null)throw new Error("A Feature you have installed does not return the client props as clientFeatureProps. Please make sure to always return those props, even if they are null, as other important props like order and featureKey are later on injected.");s.set(c.clientFeatureProps.featureKey,c)}l.features=l.features.sort((c,u)=>c.clientFeatureProps.order-u.clientFeatureProps.order);let i=new Map,d=0;for(let c of l.features){let u=typeof c.feature=="function"?c.feature({config:t,featureClientImportMap:e,featureClientSchemaMap:o,featureProviderMap:s,field:n,resolvedFeatures:i,schemaPath:r,unSanitizedEditorConfig:l}):c.feature;u.key=c.clientFeatureProps.featureKey,u.order=d,i.set(c.clientFeatureProps.featureKey,u),d++}return i}import{deepMerge as o2}from"payload/shared";var lc=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}},o={};if(t.forEach(n=>{n.key==="toolbarFixed"&&n.sanitizedClientFeatureProps?.customGroups&&(o={...o,...n.sanitizedClientFeatureProps.customGroups})}),!t?.size)return e;t.forEach(n=>{if(n.providers?.length&&(e.providers=e.providers.concat(n.providers)),n.enableFormats?.length&&e.enabledFormats.push(...n.enableFormats),n.nodes?.length)for(let r of n.nodes)e.nodes.push(r);if(n.plugins?.length&&n.plugins.forEach((r,l)=>{e.plugins?.push({clientProps:n.sanitizedClientFeatureProps,Component:r.Component,key:n.key+l,position:r.position})}),n.toolbarInline?.groups?.length)for(let r of n.toolbarInline.groups){let l=e.toolbarInline.groups.find(s=>s.key===r.key);l?e.toolbarInline.groups=e.toolbarInline.groups.filter(s=>s.key!==r.key):l={...r,items:[]},r?.items?.length&&(l.items=l.items.concat(r.items)),e.toolbarInline?.groups.push(l)}if(n.toolbarFixed?.groups?.length)for(let r of n.toolbarFixed.groups){let l=e.toolbarFixed.groups.find(s=>s.key===r.key);l?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(s=>s.key!==r.key):l={...r,items:[]},r?.items?.length&&(l.items=l.items.concat(r.items)),e.toolbarFixed?.groups.push(l)}if(n.slashMenu?.groups){n.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(n.slashMenu.dynamicGroups));for(let r of n.slashMenu.groups){let l=e.slashMenu.groups.find(s=>s.key===r.key);l?e.slashMenu.groups=e.slashMenu.groups.filter(s=>s.key!==r.key):l={...r,items:[]},r?.items?.length&&(l.items=l.items.concat(r.items)),e.slashMenu.groups.push(l)}}if(n.markdownTransformers?.length)for(let r of n.markdownTransformers)typeof r=="function"?e.markdownTransformers.push(r({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(r);e.enabledFeatures.push(n.key)}),Object.keys(o).length>0&&(e.toolbarFixed.groups=e.toolbarFixed.groups.map(n=>{let r=o[n.key];return r?o2(n,r):n})),e.toolbarInline.groups.sort((n,r)=>n.order&&r.order?n.order-r.order:n.order?-1:r.order?1:0),e.toolbarFixed.groups.sort((n,r)=>n.order&&r.order?n.order-r.order:n.order?-1:r.order?1:0);for(let n of e.toolbarInline.groups)n.items.sort((r,l)=>r.order&&l.order?r.order-l.order:r.order?-1:l.order?1:0);for(let n of e.toolbarFixed.groups)n.items.sort((r,l)=>r.order&&l.order?r.order-l.order:r.order?-1:l.order?1:0);return e};function Jn(t,e,o,n){return{admin:o,features:lc(t),lexical:e,resolvedFeatureMap:t,view:n}}var d2=s2(()=>import("./Field-NXLXFFLW.js").then(t=>({default:t.RichText}))),m2=t=>yo(Do,{inheritable:!0,views:t.views,children:yo(f2,{...t})}),f2=t=>{let e=n2(23),{admin:o,clientFeatures:n,featureClientImportMap:r,featureClientSchemaMap:l,field:s,lexicalEditorConfig:i,schemaPath:d,views:c}=t,u;e[0]!==o?(u=o===void 0?{}:o,e[0]=o,e[1]=u):u=e[1];let a=u,m;e[2]!==r?(m=r===void 0?{}:r,e[2]=r,e[3]=m):m=e[3];let f=m,h=i===void 0?Kn:i,{currentView:p}=Oo(),g=c?.[p]?.admin??a,k=c?.[p]?.lexical,N;e[4]!==h||e[5]!==k?(N=typeof k=="function"?k(h):k??h,e[4]=h,e[5]=k,e[6]=N):N=e[6];let R=N,{config:T}=i2(),[C,x]=u2(null),b,_;e[7]!==n||e[8]!==T||e[9]!==p||e[10]!==g||e[11]!==R||e[12]!==f||e[13]!==l||e[14]!==s||e[15]!==C||e[16]!==d||e[17]!==c?(b=()=>{if(C&&C.view===p)return;let v=c?.[p],y=v?.filterFeatures?v.filterFeatures(n):n,S=[];for(let L of Object.values(y))L.clientFeatureProvider&&S.push(L.clientFeatureProvider(L.clientFeatureProps));let w=rc({config:T,featureClientImportMap:f,featureClientSchemaMap:l,field:s,schemaPath:d??s.name,unSanitizedEditorConfig:{features:S,lexical:R}});x(Jn(w,R,g,p))},_=[g,n,T,f,l,s,C,R,d,p,c],e[7]=n,e[8]=T,e[9]=p,e[10]=g,e[11]=R,e[12]=f,e[13]=l,e[14]=s,e[15]=C,e[16]=d,e[17]=c,e[18]=b,e[19]=_):(b=e[18],_=e[19]),c2(b,_);let M;return e[20]!==C||e[21]!==t?(M=yo(a2,{fallback:yo(l2,{height:"35vh"}),children:C&&r2(d2,{...t,editorConfig:C,key:C.view})}),e[20]=C,e[21]=t,e[22]=M):M=e[22],M};function p2(t){return t instanceof HTMLElement}function h2(...t){return t.filter(Boolean).join(" ")}var Ro=new WeakMap;function ic(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function vo(t,e){let o=Ro.get(t);if(o===void 0){let n=new Set,r=s=>{o!==void 0&&(o.start=ic(s))},l=s=>{if(o===void 0)return;let{start:i}=o;if(i===null)return;let d=ic(s);for(let c of n)d!==null&&c([d[0]-i[0],d[1]-i[1]],s)};t.addEventListener("touchstart",r),t.addEventListener("touchend",l),o={handleTouchend:l,handleTouchstart:r,listeners:n,start:null},Ro.set(t,o)}return o.listeners.add(e),()=>{g2(t,e)}}function g2(t,e){let o=Ro.get(t);if(o===void 0)return;let{listeners:n}=o;n.delete(e),n.size===0&&(Ro.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function x2(t,e){return vo(t,(o,n)=>{let[r,l]=o;r<0&&-r>Math.abs(l)&&e(r,n)})}function C2(t,e){return vo(t,(o,n)=>{let[r,l]=o;r>0&&r>Math.abs(l)&&e(r,n)})}function b2(t,e){return vo(t,(o,n)=>{let[r,l]=o;l<0&&-l>Math.abs(r)&&e(r,n)})}function k2(t,e){return vo(t,(o,n)=>{let[r,l]=o;l>0&&l>Math.abs(r)&&e(r,n)})}import{c as _2}from"react/compiler-runtime";import{jsx as T2}from"react/jsx-runtime";import"react";var w2=()=>{let t=_2(2),{EditButton:e}=Ce(),o;return t[0]!==e?(o=e?T2(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as S2}from"react/compiler-runtime";import{jsx as E2}from"react/jsx-runtime";import"react";var N2=()=>{let t=S2(2),{RemoveButton:e}=Ce(),o;return t[0]!==e?(o=e?E2(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as L2}from"react/compiler-runtime";import{jsx as y2}from"react/jsx-runtime";import"react";var R2=()=>{let t=L2(2),{Label:e}=Ce(),o;return t[0]!==e?(o=e?y2(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as v2}from"react/compiler-runtime";import{jsx as I2}from"react/jsx-runtime";import"react";var M2=t=>{let e=v2(3),{children:o}=t,{InlineBlockContainer:n}=Ce(),r;return e[0]!==n||e[1]!==o?(r=n?I2(n,{children:o}):null,e[0]=n,e[1]=o,e[2]=r):r=e[2],r};import{jsx as $2}from"react/jsx-runtime";import"react";var A2=t=>{let{children:e,...o}=t,{BlockCollapsible:n}=ie();return n?$2(n,{...o,children:e}):null};import{c as D2}from"react/compiler-runtime";import{jsx as O2}from"react/jsx-runtime";import"react";var F2=()=>{let t=D2(2),{EditButton:e}=ie(),o;return t[0]!==e?(o=e?O2(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as B2}from"react/compiler-runtime";import{jsx as P2}from"react/jsx-runtime";import"react";var j2=()=>{let t=B2(2),{RemoveButton:e}=ie(),o;return t[0]!==e?(o=e?P2(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as H2}from"qs-esm";var U2=({apiURL:t,depth:e,draft:o,locale:n})=>async({id:l,collectionSlug:s,select:i})=>{let d=H2({depth:e??0,draft:o??!1,locale:n,select:i},{addQueryPrefix:!0});return await fetch(`${t}/${s}/${l}${d}`,{credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json"},method:"GET"}).then(u=>u.json())};var sc={customEndRegex:{optional:!0,regExp:/[ \t]*```$/},customStartRegex:/^[ \t]*```(\w+)?/,doNotTrimChildren:!0,export:({fields:t})=>!t.code.includes(`
61
61
  `)&&!t.language?.length?"```"+t.code+"```":"```"+(t.language||"")+(t.code?`
62
- `+t.code:"")+"\n```",import:({children:t,closeMatch:e,openMatch:o})=>{let r=o?.[1];return t.startsWith(`
62
+ `+t.code:"")+"\n```",import:({children:t,closeMatch:e,openMatch:o})=>{let n=o?.[1];return t.startsWith(`
63
63
  `)&&(t=t.slice(1)),t.endsWith(`
64
64
  `)&&(t=t.slice(0,-1)),!!e&&!t.includes(`
65
- `)&&o?.input?.trim()!=="```"+r?{code:r+(t?.length?t:""),language:""}:{code:t,language:r}}};import{jsx as GC}from"react/jsx-runtime";import{CodeField as VC,useFormFields as JC}from"@payloadcms/ui";import{useId as KC,useMemo as XC}from"react";var Po={abap:"ABAP",apex:"Apex",azcli:"Azure CLI",bat:"Batch",bicep:"Bicep",cameligo:"CameLIGO",clojure:"Clojure",coffee:"CoffeeScript",cpp:"C++",csharp:"C#",csp:"CSP",css:"CSS",cypher:"Cypher",dart:"Dart",dockerfile:"Dockerfile",ecl:"ECL",elixir:"Elixir",flow9:"Flow9",freemarker2:"FreeMarker 2",fsharp:"F#",go:"Go",graphql:"GraphQL",handlebars:"Handlebars",hcl:"HCL",html:"HTML",ini:"INI",java:"Java",javascript:"JavaScript",julia:"Julia",kotlin:"Kotlin",less:"Less",lexon:"Lexon",liquid:"Liquid",lua:"Lua",m3:"M3",markdown:"Markdown",mdx:"MDX",mips:"MIPS",msdax:"DAX",mysql:"MySQL","objective-c":"Objective-C",pascal:"Pascal",pascaligo:"PascaLIGO",perl:"Perl",pgsql:"PostgreSQL",php:"PHP",pla:"PLA",plaintext:"Plain Text",postiats:"Postiats",powerquery:"Power Query",powershell:"PowerShell",protobuf:"Protobuf",pug:"Pug",python:"Python",qsharp:"Q#",r:"R",razor:"Razor",redis:"Redis",redshift:"Amazon Redshift",restructuredtext:"reStructuredText",ruby:"Ruby",rust:"Rust",sb:"Small Basic",scala:"Scala",scheme:"Scheme",scss:"SCSS",shell:"Shell",solidity:"Solidity",sophia:"Sophia",sparql:"SPARQL",sql:"SQL",st:"Structured Text",swift:"Swift",systemverilog:"SystemVerilog",tcl:"Tcl",twig:"Twig",typescript:"TypeScript",typespec:"TypeSpec",vb:"Visual Basic",wgsl:"WGSL",xml:"XML",yaml:"YAML"};var zC=({autoComplete:t,field:e,forceRender:o,languages:r=Po,path:n,permissions:l,readOnly:s,renderedBlocks:i,schemaPath:d,typescript:c,validate:u})=>{let a=JC(([k])=>k.language),m=a?.value||a?.initialValue||"typescript",p=KC(),h=r[m],f=XC(()=>({...e,type:"code",admin:{...e.admin,editorOptions:{},editorProps:{defaultPath:m==="ts"?`file-${e.name}-${p}.tsx`:void 0},language:m}}),[e,m,p]),g=`${e.name}-${m}-${h}`;return f&&GC(VC,{autoComplete:t,field:f,forceRender:o,onMount:(k,N)=>{N.editor.defineTheme("vs-dark",{base:"vs-dark",colors:{"editor.background":"#222222"},inherit:!0,rules:[]}),N.editor.defineTheme("vs",{base:"vs",colors:{"editor.background":"#f5f5f5"},inherit:!0,rules:[]}),N.languages.typescript.typescriptDefaults.setCompilerOptions({allowNonTsExtensions:!0,allowJs:!0,allowSyntheticDefaultImports:!0,esModuleInterop:!0,jsx:N.languages.typescript.JsxEmit.React,moduleResolution:N.languages.typescript.ModuleResolutionKind.NodeJs,noEmit:!0,paths:c?.paths,reactNamespace:"React",target:N.languages.typescript.ScriptTarget[c?.target??"ESNext"],typeRoots:c?.typeRoots??["node_modules/@types"]}),N.languages.typescript.typescriptDefaults.setDiagnosticsOptions({noSemanticValidation:!c?.enableSemanticValidation,noSyntaxValidation:!1}),(async()=>c?.fetchTypes&&Array.isArray(c.fetchTypes)&&c.fetchTypes.length>0&&await Promise.all(c.fetchTypes.map(async T=>{let x=await(await fetch(T.url)).text();N.languages.typescript.typescriptDefaults.addExtraLib(x,T.filePath)})))()},path:n,permissions:l,readOnly:s,renderedBlocks:i,schemaPath:d,validate:u},g)};import{jsx as oe,jsxs as Cc}from"react/jsx-runtime";import{useLexicalEditable as ob}from"@lexical/react/useLexicalEditable";import{ChevronIcon as rb,Combobox as nb,CopyToClipboard as lb,PopupList as ib,RenderFields as sb,useForm as ab,useFormFields as bc,useTranslation as cb}from"@payloadcms/ui";import ub from"react";import{jsx as dc}from"react/jsx-runtime";import"react";var mc=()=>dc("svg",{fill:"none",height:"12",viewBox:"0 0 15 12",width:"15",xmlns:"http://www.w3.org/2000/svg",children:dc("path",{d:"M11.3738 8.62598L14.0404 5.95931L11.3738 3.29264M3.37376 3.29264L0.707092 5.95931L3.37376 8.62598M9.04043 0.625977L5.70709 11.2926",stroke:"currentColor",strokeLinecap:"square"})});import{jsx as fc}from"react/jsx-runtime";import"react";import{useCollapsible as YC}from"@payloadcms/ui";import{jsx as pc}from"react/jsx-runtime";import"react";var Bo=()=>pc("svg",{fill:"none",height:"15",viewBox:"0 0 15 15",width:"15",xmlns:"http://www.w3.org/2000/svg",children:pc("path",{d:"M7.16667 13.8333V9.83333M7.16667 9.83333L9.16667 11.8333M7.16667 9.83333L5.16667 11.8333M7.16667 4.5V0.5M7.16667 4.5L9.16667 2.5M7.16667 4.5L5.16667 2.5M1.83333 7.16667H0.5M5.83333 7.16667H4.5M9.83333 7.16667H8.5M13.8333 7.16667H12.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})});var ZC="code-block-collapse-button",hc=()=>{let{toggle:t}=YC();return fc("button",{className:ZC,onClick:t,type:"button",children:fc(Bo,{})})};import{jsx as gc,jsxs as qC}from"react/jsx-runtime";import"react";import{useCollapsible as eb,useTranslation as tb}from"@payloadcms/ui";var QC="code-block-floating-collapse-button",xc=()=>{let{isCollapsed:t,toggle:e}=eb(),{t:o}=tb();return t?qC("button",{className:QC,onClick:e,type:"button",children:[gc("span",{children:o("general:collapse")}),gc(Bo,{})]}):null};var Ge="payload-richtext-code-block",db=t=>{let{languages:e}=t,o=e||Po,{BlockCollapsible:r,formSchema:n,RemoveButton:l}=ie(),{setModified:s}=ab(),{t:i}=cb(),{codeField:d}=bc(([h])=>({codeField:h?.code})),{selectedLanguageField:c,setSelectedLanguage:u}=bc(([h,f])=>({selectedLanguageField:h?.language,setSelectedLanguage:g=>{f({type:"UPDATE",path:"language",value:g}),s(!0)}})),a=o[c?.value],m=ob(),p=ub.useMemo(()=>Object.entries(o).map(([h,f])=>({name:`${h} ${f}`,Component:oe(ib.Button,{active:!1,disabled:!1,onClick:()=>{u(h)},children:oe("span",{className:`${Ge}__language-code`,"data-language":h,children:f})})})),[o,u]);return oe(r,{Actions:Cc("div",{className:`${Ge}__actions`,children:[oe(nb,{button:Cc("div",{className:`${Ge}__language-selector-button`,"data-selected-language":c?.value,children:[oe("span",{children:a}),oe(rb,{className:`${Ge}__chevron`})]}),buttonType:"custom",className:`${Ge}__language-selector`,disabled:!m,entries:p,horizontalAlign:"right",minEntriesForSearch:8,searchPlaceholder:i("fields:searchForLanguage"),showScrollbar:!0,size:"large"}),oe(lb,{value:d?.value??""}),oe(hc,{}),m&&oe(l,{})]}),className:Ge,collapsibleProps:{AfterCollapsible:oe(xc,{}),disableHeaderToggle:!0,disableToggleIndicator:!0},Pill:oe("div",{className:`${Ge}__pill`,children:oe(mc,{})}),children:oe(sb,{fields:n,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!m})})};import{c as mb}from"react/compiler-runtime";import{jsx as mt}from"react/jsx-runtime";import{FieldContext as pb,FieldPathContext as kc,ServerFunctionsContext as _c,ShimmerEffect as fb,useServerFunctions as hb}from"@payloadcms/ui";import gb,{useEffect as xb,useRef as Cb}from"react";var bb=t=>{let e=mb(9),{field:o,initialValue:r,Loading:n,path:l,schemaPath:s,setValue:i,value:d}=t,[c,u]=gb.useState(null),a=hb(),{_internal_renderField:m}=a,[p,h]=s.split(".",2),f=l??(o&&"name"in o?o?.name:"")??"",g;e[0]!==m||e[1]!==o||e[2]!==r||e[3]!==l||e[4]!==s?(g=()=>{(async function(){let{Field:D}=await m({field:{...o||{},type:"richText",admin:{...o?.admin||{},hidden:!1}},initialValue:r??void 0,path:l,schemaPath:s});u(D)})()},e[0]=m,e[1]=o,e[2]=r,e[3]=l,e[4]=s,e[5]=g):g=e[5];let k=g,N=Cb(!1),R,T;if(e[6]!==k?(R=()=>{N.current||(N.current=!0,k())},T=[k],e[6]=k,e[7]=R,e[8]=T):(R=e[7],T=e[8]),xb(R,T),!c)return typeof n<"u"?n:mt(fb,{});let C={...a,getFormState:async b=>a.getFormState({...b,collectionSlug:p==="collection"?h:void 0,globalSlug:p==="global"?h:void 0})};if(typeof d>"u"&&!i)return mt(_c,{value:{...C},children:mt(kc,{value:f,children:c},f)});let x={disabled:!1,formInitializing:!1,formProcessing:!1,formSubmitted:!1,initialValue:d,path:f,setValue:i??kb,showError:!1,value:d};return mt(_c,{value:{...C},children:mt(kc,{value:f,children:mt(pb,{value:x,children:c})},f)})};function kb(){}function Tc({nodes:t,text:e}){let o={root:{type:"root",children:[],direction:"ltr",format:"",indent:0,version:1}};return e&&o.root.children.push({type:"paragraph",children:[{type:"text",detail:0,format:0,mode:"normal",style:"",text:e,version:1}],direction:"ltr",format:"",indent:0,textFormat:0,textStyle:"",version:1}),t?.length&&o.root.children.push(...t),o}var _b=Tc;export{yt as $createAutoLinkNode,Fe as $createBlockNode,Qe as $createHorizontalRuleNode,gt as $createInlineBlockNode,Te as $createLinkNode,We as $createRelationshipNode,fe as $createUploadNode,Se as $isAutoLinkNode,Ae as $isBlockNode,Lt as $isHorizontalRuleNode,xt as $isInlineBlockNode,J as $isLinkNode,Ir as $isRelationshipNode,dt as $isUploadNode,Gc as AlignFeatureClient,we as AutoLinkNode,OC as BlockCollapsible,PC as BlockEditButton,ae as BlockNode,HC as BlockRemoveButton,Yc as BlockquoteFeatureClient,sd as BlocksFeatureClient,Id as BoldFeatureClient,le as CAN_USE_DOM,Pf as ChecklistFeatureClient,db as CodeBlockBlockComponent,zC as CodeComponent,I0 as DETAIL_TYPE_TO_DETAIL,N0 as DOUBLE_LINE_BREAK,W0 as DebugJsxConverterFeatureClient,M0 as ELEMENT_FORMAT_TO_TYPE,v0 as ELEMENT_TYPE_TO_FORMAT,Rc as ENABLE_SLASH_MENU_COMMAND,Ec as EditorConfigProvider,Ct as FieldsDrawer,ph as FixedToolbarFeatureClient,Em as HeadingFeatureClient,Wm as HorizontalRuleFeatureClient,_e as HorizontalRuleNode,Ye as INSERT_BLOCK_COMMAND,qe as INSERT_INLINE_BLOCK_COMMAND,S0 as IS_ALL_FORMATTING,lp as IndentFeatureClient,DC as InlineBlockContainer,SC as InlineBlockEditButton,IC as InlineBlockLabel,ht as InlineBlockNode,LC as InlineBlockRemoveButton,Od as InlineCodeFeatureClient,Lh as InlineToolbarFeatureClient,Bd as ItalicFeatureClient,y0 as LTR_REGEX,s0 as LexicalPluginToLexicalFeatureClient,wf as LinkFeatureClient,te as LinkNode,E0 as NON_BREAKING_SPACE,A as NodeFormat,Jf as OrderedListFeatureClient,g0 as ParagraphFeatureClient,Lc as Point,L0 as RTL_REGEX,Ic as Rect,D1 as RelationshipFeatureClient,Ne as RelationshipNode,bb as RenderLexical,pC as RichTextField,Uo as RichTextViewProvider,f0 as SlateToLexicalFeatureClient,Gd as StrikethroughFeatureClient,Xd as SubscriptFeatureClient,qd as SuperscriptFeatureClient,D0 as TEXT_MODE_TO_TYPE,R0 as TEXT_TYPE_TO_FORMAT,$0 as TEXT_TYPE_TO_MODE,de as TOGGLE_LINK_COMMAND,bx as TableFeatureClient,_d as TestRecorderFeatureClient,fm as TextStateFeatureClient,Bt as ToolbarButton,jt as ToolbarDropdown,Nd as TreeViewFeatureClient,rm as UnderlineFeatureClient,e0 as UnorderedListFeatureClient,oC as UploadFeatureClient,pe as UploadNode,_C as addSwipeDownListener,CC as addSwipeLeftListener,bC as addSwipeRightListener,kC as addSwipeUpListener,_b as buildDefaultEditorState,Tc as buildEditorState,uc as codeConverterClient,ar as createBlockNode,M as createClientFeature,G0 as defaultColors,nn as defaultEditorLexicalConfig,Fr as getDOMRangeRect,vc as getEnabledNodes,WC as getRestPopulateFn,et as getSelectedNode,hC as isHTMLElement,yc as isPoint,gC as joinClasses,ln as sanitizeClientEditorConfig,ac as sanitizeClientFeatures,Eo as setFloatingElemPosition,fo as setFloatingElemPositionForLinkEditor,X as slashMenuBasicGroupWithItems,ke as toolbarAddDropdownGroupWithItems,ur as toolbarFeatureButtonsGroupWithItems,z as toolbarFormatGroupWithItems,ee as toolbarTextDropdownGroupWithItems,ie as useBlockComponentContext,U as useEditorConfigContext,Ce as useInlineBlockComponentContext,Nc as useLexicalDocumentDrawer,xe as useLexicalDrawer,Pt as useLexicalListDrawer,Wo as useRichTextView};
65
+ `)&&o?.input?.trim()!=="```"+n?{code:n+(t?.length?t:""),language:""}:{code:t,language:n}}};import{jsx as G2}from"react/jsx-runtime";import{CodeField as V2,useFormFields as W2}from"@payloadcms/ui";import{useId as z2,useMemo as K2}from"react";var Io={abap:"ABAP",apex:"Apex",azcli:"Azure CLI",bat:"Batch",bicep:"Bicep",cameligo:"CameLIGO",clojure:"Clojure",coffee:"CoffeeScript",cpp:"C++",csharp:"C#",csp:"CSP",css:"CSS",cypher:"Cypher",dart:"Dart",dockerfile:"Dockerfile",ecl:"ECL",elixir:"Elixir",flow9:"Flow9",freemarker2:"FreeMarker 2",fsharp:"F#",go:"Go",graphql:"GraphQL",handlebars:"Handlebars",hcl:"HCL",html:"HTML",ini:"INI",java:"Java",javascript:"JavaScript",julia:"Julia",kotlin:"Kotlin",less:"Less",lexon:"Lexon",liquid:"Liquid",lua:"Lua",m3:"M3",markdown:"Markdown",mdx:"MDX",mips:"MIPS",msdax:"DAX",mysql:"MySQL","objective-c":"Objective-C",pascal:"Pascal",pascaligo:"PascaLIGO",perl:"Perl",pgsql:"PostgreSQL",php:"PHP",pla:"PLA",plaintext:"Plain Text",postiats:"Postiats",powerquery:"Power Query",powershell:"PowerShell",protobuf:"Protobuf",pug:"Pug",python:"Python",qsharp:"Q#",r:"R",razor:"Razor",redis:"Redis",redshift:"Amazon Redshift",restructuredtext:"reStructuredText",ruby:"Ruby",rust:"Rust",sb:"Small Basic",scala:"Scala",scheme:"Scheme",scss:"SCSS",shell:"Shell",solidity:"Solidity",sophia:"Sophia",sparql:"SPARQL",sql:"SQL",st:"Structured Text",swift:"Swift",systemverilog:"SystemVerilog",tcl:"Tcl",twig:"Twig",typescript:"TypeScript",typespec:"TypeSpec",vb:"Visual Basic",wgsl:"WGSL",xml:"XML",yaml:"YAML"};var J2=({autoComplete:t,field:e,forceRender:o,languages:n=Io,path:r,permissions:l,readOnly:s,renderedBlocks:i,schemaPath:d,typescript:c,validate:u})=>{let a=W2(([k])=>k.language),m=a?.value||a?.initialValue||"typescript",f=z2(),h=n[m],p=K2(()=>({...e,type:"code",admin:{...e.admin,editorOptions:{},editorProps:{defaultPath:m==="ts"?`file-${e.name}-${f}.tsx`:void 0},language:m}}),[e,m,f]),g=`${e.name}-${m}-${h}`;return p&&G2(V2,{autoComplete:t,field:p,forceRender:o,onMount:(k,N)=>{N.editor.defineTheme("vs-dark",{base:"vs-dark",colors:{"editor.background":"#222222"},inherit:!0,rules:[]}),N.editor.defineTheme("vs",{base:"vs",colors:{"editor.background":"#f5f5f5"},inherit:!0,rules:[]}),N.languages.typescript.typescriptDefaults.setCompilerOptions({allowNonTsExtensions:!0,allowJs:!0,allowSyntheticDefaultImports:!0,esModuleInterop:!0,jsx:N.languages.typescript.JsxEmit.React,moduleResolution:N.languages.typescript.ModuleResolutionKind.NodeJs,noEmit:!0,paths:c?.paths,reactNamespace:"React",target:N.languages.typescript.ScriptTarget[c?.target??"ESNext"],typeRoots:c?.typeRoots??["node_modules/@types"]}),N.languages.typescript.typescriptDefaults.setDiagnosticsOptions({noSemanticValidation:!c?.enableSemanticValidation,noSyntaxValidation:!1}),(async()=>c?.fetchTypes&&Array.isArray(c.fetchTypes)&&c.fetchTypes.length>0&&await Promise.all(c.fetchTypes.map(async T=>{let x=await(await fetch(T.url)).text();N.languages.typescript.typescriptDefaults.addExtraLib(x,T.filePath)})))()},path:r,permissions:l,readOnly:s,renderedBlocks:i,schemaPath:d,validate:u},g)};import{jsx as oe,jsxs as hc}from"react/jsx-runtime";import{useLexicalEditable as nx}from"@lexical/react/useLexicalEditable";import{ChevronIcon as rx,Combobox as lx,CopyToClipboard as ix,PopupList as sx,RenderFields as ax,useForm as cx,useFormFields as gc,useTranslation as ux}from"@payloadcms/ui";import dx from"react";import{jsx as ac}from"react/jsx-runtime";import"react";var X2={16:"M6.646 6.146a.5.5 0 1 0 .708.708l1.5-1.5a.5.5 0 0 0 0-.708l-1.5-1.5a.5.5 0 1 0-.708.708L7.793 5zm-1.292-3a.5.5 0 0 1 0 .708L4.207 5l1.147 1.146a.5.5 0 1 1-.708.708l-1.5-1.5a.5.5 0 0 1 0-.708l1.5-1.5a.5.5 0 0 1 .708 0M10.5 3h1A1.5 1.5 0 0 1 13 4.5v7a1.5 1.5 0 0 1-1.5 1.5h-7A1.5 1.5 0 0 1 3 11.5v-3a.5.5 0 0 1 1 0v3a.5.5 0 0 0 .5.5h7a.5.5 0 0 0 .5-.5v-7a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 1 0-1",24:"M7.354 4.146a.5.5 0 0 1 0 .708L5.207 7l2.147 2.146a.5.5 0 1 1-.708.708l-2.5-2.5a.5.5 0 0 1 0-.708l2.5-2.5a.5.5 0 0 1 .708 0M14 4.5a.5.5 0 0 1 .5-.5H18a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-6.5a.5.5 0 0 1 1 0V18a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-3.5a.5.5 0 0 1-.5-.5m-4.354.354a.5.5 0 1 1 .708-.708l2.5 2.5a.5.5 0 0 1 0 .708l-2.5 2.5a.5.5 0 0 1-.708-.708L11.793 7z"},cc=({className:t,size:e=24})=>ac("svg",{className:t,fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:ac("path",{clipRule:"evenodd",d:X2[e],fill:"currentColor",fillRule:"evenodd"})});import{jsx as dc}from"react/jsx-runtime";import"react";import{useCollapsible as q2}from"@payloadcms/ui";import{jsx as uc}from"react/jsx-runtime";import"react";var Z2="M11.4999 13C11.6325 13 11.7597 13.0527 11.8535 13.1464L14.8535 16.1464C15.0487 16.3417 15.0487 16.6582 14.8535 16.8535C14.6582 17.0487 14.3417 17.0487 14.1464 16.8535L11.4999 14.207L8.85346 16.8535C8.6582 17.0487 8.34169 17.0487 8.14643 16.8535C7.95119 16.6582 7.95119 16.3417 8.14643 16.1464L11.1464 13.1464C11.2402 13.0527 11.3674 13 11.4999 13ZM14.1464 7.14644C14.3417 6.95119 14.6582 6.95118 14.8535 7.14644C15.0487 7.3417 15.0487 7.65821 14.8535 7.85347L11.8535 10.8535C11.7597 10.9472 11.6325 10.9999 11.4999 11C11.3674 10.9999 11.2402 10.9472 11.1464 10.8535L8.14643 7.85347C7.95119 7.65821 7.95119 7.3417 8.14643 7.14644C8.34169 6.9512 8.6582 6.9512 8.85346 7.14644L11.4999 9.79292L14.1464 7.14644Z",Mo=({className:t})=>uc("svg",{className:t,fill:"none",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:uc("path",{d:Z2,fill:"currentColor"})});var Y2="code-block-collapse-button",mc=()=>{let{toggle:t}=q2();return dc("button",{className:Y2,onClick:t,type:"button",children:dc(Mo,{})})};import{jsx as fc,jsxs as Q2}from"react/jsx-runtime";import"react";import{useCollapsible as tx,useTranslation as ox}from"@payloadcms/ui";var ex="code-block-floating-collapse-button",pc=()=>{let{isCollapsed:t,toggle:e}=tx(),{t:o}=ox();return t?Q2("button",{className:ex,onClick:e,type:"button",children:[fc("span",{children:o("general:collapse")}),fc(Mo,{})]}):null};var Ve="payload-richtext-code-block",mx=t=>{let{languages:e}=t,o=e||Io,{BlockCollapsible:n,formSchema:r,RemoveButton:l}=ie(),{setModified:s}=cx(),{t:i}=ux(),{codeField:d}=gc(([h])=>({codeField:h?.code})),{selectedLanguageField:c,setSelectedLanguage:u}=gc(([h,p])=>({selectedLanguageField:h?.language,setSelectedLanguage:g=>{p({type:"UPDATE",path:"language",value:g}),s(!0)}})),a=o[c?.value],m=nx(),f=dx.useMemo(()=>Object.entries(o).map(([h,p])=>({name:`${h} ${p}`,Component:oe(sx.Button,{active:!1,disabled:!1,onClick:()=>{u(h)},children:oe("span",{className:`${Ve}__language-code`,"data-language":h,children:p})})})),[o,u]);return oe(n,{Actions:hc("div",{className:`${Ve}__actions`,children:[oe(lx,{button:hc("div",{className:`${Ve}__language-selector-button`,"data-selected-language":c?.value,children:[oe("span",{children:a}),oe(rx,{className:`${Ve}__chevron`})]}),buttonType:"custom",className:`${Ve}__language-selector`,disabled:!m,entries:f,horizontalAlign:"right",minEntriesForSearch:8,searchPlaceholder:i("fields:searchForLanguage"),showScrollbar:!0,size:"large"}),oe(ix,{value:d?.value??""}),oe(mc,{}),m&&oe(l,{})]}),className:Ve,collapsibleProps:{AfterCollapsible:oe(pc,{}),disableHeaderToggle:!0,disableToggleIndicator:!0},Pill:oe("div",{className:`${Ve}__pill`,children:oe(cc,{})}),children:oe(ax,{fields:r,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!m})})};import{c as fx}from"react/compiler-runtime";import{jsx as dt}from"react/jsx-runtime";import{FieldContext as px,FieldPathContext as xc,ServerFunctionsContext as Cc,ShimmerEffect as hx,useServerFunctions as gx}from"@payloadcms/ui";import xx,{useEffect as Cx,useRef as bx}from"react";var kx=t=>{let e=fx(9),{field:o,initialValue:n,Loading:r,path:l,schemaPath:s,setValue:i,value:d}=t,[c,u]=xx.useState(null),a=gx(),{_internal_renderField:m}=a,[f,h]=s.split(".",2),p=l??(o&&"name"in o?o?.name:"")??"",g;e[0]!==m||e[1]!==o||e[2]!==n||e[3]!==l||e[4]!==s?(g=()=>{(async function(){let{Field:M}=await m({field:{...o||{},type:"richText",admin:{...o?.admin||{},hidden:!1}},initialValue:n??void 0,path:l,schemaPath:s});u(M)})()},e[0]=m,e[1]=o,e[2]=n,e[3]=l,e[4]=s,e[5]=g):g=e[5];let k=g,N=bx(!1),R,T;if(e[6]!==k?(R=()=>{N.current||(N.current=!0,k())},T=[k],e[6]=k,e[7]=R,e[8]=T):(R=e[7],T=e[8]),Cx(R,T),!c)return typeof r<"u"?r:dt(hx,{});let C={...a,getFormState:async b=>a.getFormState({...b,collectionSlug:f==="collection"?h:void 0,globalSlug:f==="global"?h:void 0})};if(typeof d>"u"&&!i)return dt(Cc,{value:{...C},children:dt(xc,{value:p,children:c},p)});let x={disabled:!1,formInitializing:!1,formProcessing:!1,formSubmitted:!1,initialValue:d,path:p,setValue:i??_x,showError:!1,value:d};return dt(Cc,{value:{...C},children:dt(xc,{value:p,children:dt(px,{value:x,children:c})},p)})};function _x(){}function bc({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.root.children.length===0&&o.root.children.push({type:"paragraph",children:[],direction:"ltr",format:"",indent:0,textFormat:0,textStyle:"",version:1}),o}var Tx=bc;export{Lt as $createAutoLinkNode,Fe as $createBlockNode,Qe as $createHorizontalRuleNode,ht as $createInlineBlockNode,Te as $createLinkNode,Ge as $createRelationshipNode,pe as $createUploadNode,Se as $isAutoLinkNode,Oe as $isBlockNode,Nt as $isHorizontalRuleNode,gt as $isInlineBlockNode,z as $isLinkNode,_n as $isRelationshipNode,ut as $isUploadNode,Hc as AlignFeatureClient,we as AutoLinkNode,A2 as BlockCollapsible,F2 as BlockEditButton,ae as BlockNode,j2 as BlockRemoveButton,Zc as BlockquoteFeatureClient,sd as BlocksFeatureClient,Id as BoldFeatureClient,le as CAN_USE_DOM,Zp as ChecklistFeatureClient,mx as CodeBlockBlockComponent,J2 as CodeComponent,y1 as DETAIL_TYPE_TO_DETAIL,S1 as DOUBLE_LINE_BREAK,H1 as DebugJsxConverterFeatureClient,v1 as ELEMENT_FORMAT_TO_TYPE,R1 as ELEMENT_TYPE_TO_FORMAT,Nc as ENABLE_SLASH_MENU_COMMAND,Tc as EditorConfigProvider,xt as FieldsDrawer,dh as FixedToolbarFeatureClient,Dm as HeadingFeatureClient,ef as HorizontalRuleFeatureClient,_e as HorizontalRuleNode,Ye as INSERT_BLOCK_COMMAND,qe as INSERT_INLINE_BLOCK_COMMAND,T1 as IS_ALL_FORMATTING,xf as IndentFeatureClient,M2 as InlineBlockContainer,w2 as InlineBlockEditButton,R2 as InlineBlockLabel,pt as InlineBlockNode,N2 as InlineBlockRemoveButton,Od as InlineCodeFeatureClient,Eh as InlineToolbarFeatureClient,Hd as ItalicFeatureClient,N1 as LTR_REGEX,Dp as LinkFeatureClient,te as LinkNode,w1 as NON_BREAKING_SPACE,O as NodeFormat,r1 as OrderedListFeatureClient,p1 as ParagraphFeatureClient,Sc as Point,E1 as RTL_REGEX,Lc as Rect,I0 as RelationshipFeatureClient,Ne as RelationshipNode,kx as RenderLexical,m2 as RichTextField,Do as RichTextViewProvider,zd as StrikethroughFeatureClient,Yd as SubscriptFeatureClient,om as SuperscriptFeatureClient,I1 as TEXT_MODE_TO_TYPE,L1 as TEXT_TYPE_TO_FORMAT,M1 as TEXT_TYPE_TO_MODE,de as TOGGLE_LINK_COMMAND,Cg as TableFeatureClient,_d as TestRecorderFeatureClient,Cm as TextStateFeatureClient,At as ToolbarButton,Dt as ToolbarDropdown,Nd as TreeViewFeatureClient,sm as UnderlineFeatureClient,m1 as UnorderedListFeatureClient,t2 as UploadFeatureClient,fe as UploadNode,k2 as addSwipeDownListener,x2 as addSwipeLeftListener,C2 as addSwipeRightListener,b2 as addSwipeUpListener,Tx as buildDefaultEditorState,bc as buildEditorState,sc as codeConverterClient,Yo as createBlockNode,$ as createClientFeature,U1 as defaultColors,Kn as defaultEditorLexicalConfig,yn as getDOMRangeRect,yc as getEnabledNodes,U2 as getRestPopulateFn,et as getSelectedNode,p2 as isHTMLElement,Ec as isPoint,h2 as joinClasses,Jn as sanitizeClientEditorConfig,lc as sanitizeClientFeatures,Co as setFloatingElemPosition,io as setFloatingElemPositionForLinkEditor,J as slashMenuBasicGroupWithItems,ke as toolbarAddDropdownGroupWithItems,en as toolbarFeatureButtonsGroupWithItems,X as toolbarFormatGroupWithItems,ee as toolbarTextDropdownGroupWithItems,ie as useBlockComponentContext,U as useEditorConfigContext,Ce as useInlineBlockComponentContext,wc as useLexicalDocumentDrawer,xe as useLexicalDrawer,$t as useLexicalListDrawer,Oo as useRichTextView};
66
66
  //# sourceMappingURL=index.js.map