@payloadcms/richtext-lexical 3.59.0-internal.8435f3c → 3.59.0-internal.cb85185

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 (163) hide show
  1. package/dist/exports/client/Field-RQHCQRLV.js +2 -0
  2. package/dist/exports/client/Field-RQHCQRLV.js.map +7 -0
  3. package/dist/exports/client/RelationshipComponent-TSIENULZ.js +2 -0
  4. package/dist/exports/client/RelationshipComponent-TSIENULZ.js.map +7 -0
  5. package/dist/exports/client/bundled.css +1 -1
  6. package/dist/exports/client/chunk-BQCXN3B4.js +2 -0
  7. package/dist/exports/client/chunk-BQCXN3B4.js.map +7 -0
  8. package/dist/exports/client/{chunk-2Y72RT72.js → chunk-TLQLXR6Q.js} +2 -2
  9. package/dist/exports/client/chunk-XNERFY6G.js +2 -0
  10. package/dist/exports/client/chunk-XNERFY6G.js.map +7 -0
  11. package/dist/exports/client/component-CYFKY3IL.js +2 -0
  12. package/dist/exports/client/component-CYFKY3IL.js.map +7 -0
  13. package/dist/exports/client/componentInline-NGTRUSGB.js +2 -0
  14. package/dist/exports/client/index.d.ts +3 -0
  15. package/dist/exports/client/index.d.ts.map +1 -1
  16. package/dist/exports/client/index.js +35 -10
  17. package/dist/exports/client/index.js.map +4 -4
  18. package/dist/features/blocks/client/component/BlockContent.d.ts +52 -27
  19. package/dist/features/blocks/client/component/BlockContent.d.ts.map +1 -1
  20. package/dist/features/blocks/client/component/BlockContent.js +48 -51
  21. package/dist/features/blocks/client/component/BlockContent.js.map +1 -1
  22. package/dist/features/blocks/client/component/components/BlockCollapsible.d.ts +2 -9
  23. package/dist/features/blocks/client/component/components/BlockCollapsible.d.ts.map +1 -1
  24. package/dist/features/blocks/client/component/components/BlockCollapsible.js +7 -25
  25. package/dist/features/blocks/client/component/components/BlockCollapsible.js.map +1 -1
  26. package/dist/features/blocks/client/component/index.d.ts.map +1 -1
  27. package/dist/features/blocks/client/component/index.js +71 -56
  28. package/dist/features/blocks/client/component/index.js.map +1 -1
  29. package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
  30. package/dist/features/blocks/client/componentInline/index.js +13 -11
  31. package/dist/features/blocks/client/componentInline/index.js.map +1 -1
  32. package/dist/features/blocks/client/index.d.ts.map +1 -1
  33. package/dist/features/blocks/client/index.js +5 -0
  34. package/dist/features/blocks/client/index.js.map +1 -1
  35. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.d.ts +6 -0
  36. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.d.ts.map +1 -0
  37. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.js +24 -0
  38. package/dist/features/blocks/client/markdown/getLexicalToMarkdown.js.map +1 -0
  39. package/dist/features/blocks/client/markdown/getMarkdownToLexical.d.ts +6 -0
  40. package/dist/features/blocks/client/markdown/getMarkdownToLexical.d.ts.map +1 -0
  41. package/dist/features/blocks/client/markdown/getMarkdownToLexical.js +20 -0
  42. package/dist/features/blocks/client/markdown/getMarkdownToLexical.js.map +1 -0
  43. package/dist/features/blocks/client/markdown/markdownTransformer.d.ts +12 -0
  44. package/dist/features/blocks/client/markdown/markdownTransformer.d.ts.map +1 -0
  45. package/dist/features/blocks/client/markdown/markdownTransformer.js +348 -0
  46. package/dist/features/blocks/client/markdown/markdownTransformer.js.map +1 -0
  47. package/dist/features/blocks/premade/CodeBlock/Component/Block.d.ts +5 -0
  48. package/dist/features/blocks/premade/CodeBlock/Component/Block.d.ts.map +1 -0
  49. package/dist/features/blocks/premade/CodeBlock/Component/Block.js +156 -0
  50. package/dist/features/blocks/premade/CodeBlock/Component/Block.js.map +1 -0
  51. package/dist/features/blocks/premade/CodeBlock/Component/Code.d.ts +61 -0
  52. package/dist/features/blocks/premade/CodeBlock/Component/Code.d.ts.map +1 -0
  53. package/dist/features/blocks/premade/CodeBlock/Component/Code.js +99 -0
  54. package/dist/features/blocks/premade/CodeBlock/Component/Code.js.map +1 -0
  55. package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.d.ts +4 -0
  56. package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.d.ts.map +1 -0
  57. package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.js +17 -0
  58. package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.js.map +1 -0
  59. package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.d.ts +4 -0
  60. package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.d.ts.map +1 -0
  61. package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.js +26 -0
  62. package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.js.map +1 -0
  63. package/dist/features/blocks/premade/CodeBlock/converter.d.ts +7 -0
  64. package/dist/features/blocks/premade/CodeBlock/converter.d.ts.map +1 -0
  65. package/dist/features/blocks/premade/CodeBlock/converter.js +46 -0
  66. package/dist/features/blocks/premade/CodeBlock/converter.js.map +1 -0
  67. package/dist/features/blocks/premade/CodeBlock/converterClient.d.ts +2 -0
  68. package/dist/features/blocks/premade/CodeBlock/converterClient.d.ts.map +1 -0
  69. package/dist/features/blocks/premade/CodeBlock/converterClient.js +4 -0
  70. package/dist/features/blocks/premade/CodeBlock/converterClient.js.map +1 -0
  71. package/dist/features/blocks/premade/CodeBlock/index.d.ts +7 -0
  72. package/dist/features/blocks/premade/CodeBlock/index.d.ts.map +1 -0
  73. package/dist/features/blocks/premade/CodeBlock/index.js +52 -0
  74. package/dist/features/blocks/premade/CodeBlock/index.js.map +1 -0
  75. package/dist/features/blocks/server/index.js +1 -1
  76. package/dist/features/blocks/server/index.js.map +1 -1
  77. package/dist/features/blocks/server/markdown/getLexicalToMarkdown.d.ts +6 -0
  78. package/dist/features/blocks/server/markdown/getLexicalToMarkdown.d.ts.map +1 -0
  79. package/dist/features/blocks/server/markdown/getLexicalToMarkdown.js +27 -0
  80. package/dist/features/blocks/server/markdown/getLexicalToMarkdown.js.map +1 -0
  81. package/dist/features/blocks/server/markdown/getMarkdownToLexical.d.ts +7 -0
  82. package/dist/features/blocks/server/markdown/getMarkdownToLexical.d.ts.map +1 -0
  83. package/dist/features/blocks/server/markdown/getMarkdownToLexical.js +22 -0
  84. package/dist/features/blocks/server/markdown/getMarkdownToLexical.js.map +1 -0
  85. package/dist/features/blocks/server/markdown/linesFromMatchToContentAndPropsString.d.ts.map +1 -0
  86. package/dist/features/blocks/server/markdown/linesFromMatchToContentAndPropsString.js.map +1 -0
  87. package/dist/features/blocks/server/markdown/markdownTransformer.d.ts +15 -0
  88. package/dist/features/blocks/server/markdown/markdownTransformer.d.ts.map +1 -0
  89. package/dist/features/blocks/server/{markdownTransformer.js → markdown/markdownTransformer.js} +6 -48
  90. package/dist/features/blocks/server/markdown/markdownTransformer.js.map +1 -0
  91. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.d.ts.map +1 -1
  92. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js +5 -3
  93. package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js.map +1 -1
  94. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.d.ts.map +1 -1
  95. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +3 -1
  96. package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
  97. package/dist/features/relationship/client/components/RelationshipComponent.d.ts.map +1 -1
  98. package/dist/features/relationship/client/components/RelationshipComponent.js +5 -9
  99. package/dist/features/relationship/client/components/RelationshipComponent.js.map +1 -1
  100. package/dist/features/toolbars/fixed/client/Toolbar/index.d.ts.map +1 -1
  101. package/dist/features/toolbars/fixed/client/Toolbar/index.js +7 -1
  102. package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
  103. package/dist/features/toolbars/inline/client/Toolbar/index.d.ts.map +1 -1
  104. package/dist/features/toolbars/inline/client/Toolbar/index.js +3 -1
  105. package/dist/features/toolbars/inline/client/Toolbar/index.js.map +1 -1
  106. package/dist/features/upload/client/component/index.d.ts.map +1 -1
  107. package/dist/features/upload/client/component/index.js +6 -5
  108. package/dist/features/upload/client/component/index.js.map +1 -1
  109. package/dist/field/RenderLexical/index.d.ts.map +1 -1
  110. package/dist/field/RenderLexical/index.js +1 -0
  111. package/dist/field/RenderLexical/index.js.map +1 -1
  112. package/dist/field/bundled.css +1 -1
  113. package/dist/field/rscEntry.d.ts.map +1 -1
  114. package/dist/field/rscEntry.js +2 -0
  115. package/dist/field/rscEntry.js.map +1 -1
  116. package/dist/index.d.ts +1 -0
  117. package/dist/index.d.ts.map +1 -1
  118. package/dist/index.js +1 -0
  119. package/dist/index.js.map +1 -1
  120. package/dist/lexical/LexicalEditor.d.ts.map +1 -1
  121. package/dist/lexical/LexicalEditor.js +10 -8
  122. package/dist/lexical/LexicalEditor.js.map +1 -1
  123. package/dist/lexical/ui/icons/CodeBlock/index.d.ts.map +1 -1
  124. package/dist/lexical/ui/icons/CodeBlock/index.js +10 -15
  125. package/dist/lexical/ui/icons/CodeBlock/index.js.map +1 -1
  126. package/dist/lexical/ui/icons/Collapse/index.d.ts +3 -0
  127. package/dist/lexical/ui/icons/Collapse/index.d.ts.map +1 -0
  128. package/dist/lexical/ui/icons/Collapse/index.js +18 -0
  129. package/dist/lexical/ui/icons/Collapse/index.js.map +1 -0
  130. package/dist/utilities/buildInitialState.d.ts +1 -0
  131. package/dist/utilities/buildInitialState.d.ts.map +1 -1
  132. package/dist/utilities/buildInitialState.js +1 -0
  133. package/dist/utilities/buildInitialState.js.map +1 -1
  134. package/dist/utilities/fieldsDrawer/DrawerContent.d.ts.map +1 -1
  135. package/dist/utilities/fieldsDrawer/DrawerContent.js +7 -3
  136. package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
  137. package/dist/utilities/jsx/collectTopLevelJSXInLines.js +2 -2
  138. package/dist/utilities/jsx/collectTopLevelJSXInLines.js.map +1 -1
  139. package/package.json +6 -6
  140. package/dist/exports/client/Field-EHRBYNHO.js +0 -2
  141. package/dist/exports/client/Field-EHRBYNHO.js.map +0 -7
  142. package/dist/exports/client/RelationshipComponent-APF3CN47.js +0 -2
  143. package/dist/exports/client/RelationshipComponent-APF3CN47.js.map +0 -7
  144. package/dist/exports/client/chunk-3BY5IZJD.js +0 -2
  145. package/dist/exports/client/chunk-3BY5IZJD.js.map +0 -7
  146. package/dist/exports/client/chunk-CYLMY5ZJ.js +0 -2
  147. package/dist/exports/client/chunk-CYLMY5ZJ.js.map +0 -7
  148. package/dist/exports/client/component-VDJI45F2.js +0 -2
  149. package/dist/exports/client/component-VDJI45F2.js.map +0 -7
  150. package/dist/exports/client/componentInline-7TPI7ZBC.js +0 -2
  151. package/dist/features/blocks/client/markdownTransformer.d.ts +0 -17
  152. package/dist/features/blocks/client/markdownTransformer.d.ts.map +0 -1
  153. package/dist/features/blocks/client/markdownTransformer.js +0 -144
  154. package/dist/features/blocks/client/markdownTransformer.js.map +0 -1
  155. package/dist/features/blocks/server/linesFromMatchToContentAndPropsString.d.ts.map +0 -1
  156. package/dist/features/blocks/server/linesFromMatchToContentAndPropsString.js.map +0 -1
  157. package/dist/features/blocks/server/markdownTransformer.d.ts +0 -22
  158. package/dist/features/blocks/server/markdownTransformer.d.ts.map +0 -1
  159. package/dist/features/blocks/server/markdownTransformer.js.map +0 -1
  160. /package/dist/exports/client/{chunk-2Y72RT72.js.map → chunk-TLQLXR6Q.js.map} +0 -0
  161. /package/dist/exports/client/{componentInline-7TPI7ZBC.js.map → componentInline-NGTRUSGB.js.map} +0 -0
  162. /package/dist/features/blocks/server/{linesFromMatchToContentAndPropsString.d.ts → markdown/linesFromMatchToContentAndPropsString.d.ts} +0 -0
  163. /package/dist/features/blocks/server/{linesFromMatchToContentAndPropsString.js → markdown/linesFromMatchToContentAndPropsString.js} +0 -0
@@ -0,0 +1,2 @@
1
+ import{b as F}from"./chunk-BZZVLW4U.js";import{c as z}from"react/compiler-runtime";import{jsx as R}from"react/jsx-runtime";import{Drawer as G,EditDepthProvider as J,useModal as K}from"@payloadcms/ui";import"react";import{jsx as y,jsxs as M}from"react/jsx-runtime";import{useLexicalEditable as v}from"@lexical/react/useLexicalEditable";import{Form as T,FormSubmit as $,RenderFields as N,useDocumentForm as W,useDocumentInfo as k,useServerFunctions as B,useTranslation as L}from"@payloadcms/ui";import{abortAndIgnore as x}from"@payloadcms/ui/shared";import{deepCopyObjectSimpleWithoutReactComponents as O}from"payload/shared";import{useCallback as H,useEffect as I,useRef as U,useState as V}from"react";import{v4 as q}from"uuid";var j=({data:c,featureKey:e,fieldMapOverride:u,handleDrawerSubmit:m,schemaFieldsPathOverride:o,schemaPath:d,schemaPathSuffix:f})=>{let{t:p}=L(),{id:i,collectionSlug:a,getDocPreferences:l,globalSlug:s}=k(),{fields:t}=W(),n=v(),r=U(new AbortController),[h,w]=V(!1),{fieldProps:{featureClientSchemaMap:A}}=F(),{getFormState:b}=B(),S=o??`${d}.lexical_internal_feature.${e}${f?`.${f}`:""}`,g=u??A[e]?.[S];I(()=>{let C=new AbortController;return(async()=>{let{state:_}=await b({id:i,collectionSlug:a,data:c??{},docPermissions:{fields:!0},docPreferences:await l(),documentFormState:O(t),globalSlug:s,initialBlockData:c,operation:"update",readOnly:!n,renderAllFields:!0,schemaPath:S,signal:C.signal});w(_)})(),()=>{x(C)}},[S,i,c,b,a,n,s,l,t]);let E=H(async({formState:C})=>{x(r.current);let P=new AbortController;r.current=P;let{state:_}=await b({id:i,collectionSlug:a,docPermissions:{fields:!0},docPreferences:await l(),documentFormState:O(t),formState:C,globalSlug:s,initialBlockFormState:C,operation:"update",readOnly:!n,schemaPath:S,signal:P.signal});return _||C},[b,i,n,a,l,t,s,S]);return I(()=>()=>{x(r.current)},[]),h===!1?null:M(T,{beforeSubmit:[E],disableValidationOnSubmit:!0,fields:Array.isArray(g)?g:[],initialState:h,onChange:[E],onSubmit:m,uuid:q(),children:[y(N,{fields:Array.isArray(g)?g:[],forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:S,permissions:!0,readOnly:!n}),y($,{children:p("fields:saveChanges")})]})};var _e=c=>{let e=z(15),{className:u,data:m,drawerSlug:o,drawerTitle:d,featureKey:f,fieldMapOverride:p,handleDrawerSubmit:i,schemaFieldsPathOverride:a,schemaPath:l,schemaPathSuffix:s}=c,{closeModal:t}=K(),n=d??"",r;e[0]!==t||e[1]!==o||e[2]!==i?(r=(w,A)=>{t(o),setTimeout(()=>{i(w,A)},1)},e[0]=t,e[1]=o,e[2]=i,e[3]=r):r=e[3];let h;return e[4]!==u||e[5]!==m||e[6]!==o||e[7]!==f||e[8]!==p||e[9]!==a||e[10]!==l||e[11]!==s||e[12]!==n||e[13]!==r?(h=R(J,{children:R(G,{className:u,slug:o,title:n,children:R(j,{data:m,featureKey:f,fieldMapOverride:p,handleDrawerSubmit:r,schemaFieldsPathOverride:a,schemaPath:l,schemaPathSuffix:s})})}),e[4]=u,e[5]=m,e[6]=o,e[7]=f,e[8]=p,e[9]=a,e[10]=l,e[11]=s,e[12]=n,e[13]=r,e[14]=h):h=e[14],h};import{c as Q}from"react/compiler-runtime";import{jsx as X}from"react/jsx-runtime";import{useAuth as Y,useConfig as Z,useEntityVisibility as ee}from"@payloadcms/ui";import*as D from"react";var te=(c,e)=>c.filter(({slug:u,admin:{enableRichTextRelationship:m},upload:o})=>e?.visibleEntities?.collections.includes(u)?e?.uploads?m&&!!o:o?!1:m:!1),xe=c=>{let e=Q(12),{children:u,FallbackComponent:m,uploads:o,...d}=c,f=o===void 0?!1:o,{config:p}=Z(),{collections:i}=p,{user:a}=Y(),{visibleEntities:l}=ee(),s;e[0]!==i||e[1]!==f||e[2]!==a||e[3]!==l?(s=()=>te(i,{uploads:f,user:a,visibleEntities:l}).map(re),e[0]=i,e[1]=f,e[2]=a,e[3]=l,e[4]=s):s=e[4];let[t]=D.useState(s);if(!t.length)return m?X(m,{...d}):null;let n;if(e[5]!==u||e[6]!==t||e[7]!==d){let r;e[9]!==t||e[10]!==d?(r={...d,enabledCollectionSlugs:t},e[9]=t,e[10]=d,e[11]=r):r=e[11],n=D.cloneElement(u,r),e[5]=u,e[6]=t,e[7]=d,e[8]=n}else n=e[8];return n};function re(c){let{slug:e}=c;return e}import{createCommand as oe}from"lexical";var Fe=oe("INSERT_UPLOAD_WITH_DRAWER_COMMAND");export{_e as a,xe as b,Fe as c};
2
+ //# sourceMappingURL=chunk-BQCXN3B4.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/utilities/fieldsDrawer/Drawer.tsx", "../../../src/utilities/fieldsDrawer/DrawerContent.tsx", "../../../src/features/relationship/client/utils/EnabledRelationshipsCondition.tsx", "../../../src/features/upload/client/drawer/commands.ts"],
4
+ "sourcesContent": ["'use client'\nimport type { ClientField, Data, FormState, JsonObject } from 'payload'\n\nimport { Drawer, EditDepthProvider, useModal } from '@payloadcms/ui'\nimport React from 'react'\n\nimport { DrawerContent } from './DrawerContent.js'\n\nexport type FieldsDrawerProps = {\n readonly className?: string\n readonly data?: Data\n readonly drawerSlug: string\n readonly drawerTitle?: string\n readonly featureKey: string\n readonly fieldMapOverride?: ClientField[]\n readonly handleDrawerSubmit: (fields: FormState, data: JsonObject) => void\n readonly schemaFieldsPathOverride?: string\n readonly schemaPath: string\n readonly schemaPathSuffix?: string\n}\n\n/**\n * This FieldsDrawer component can be used to easily create a Drawer that contains a form with fields within your feature.\n * The fields are taken directly from the schema map based on your `featureKey` and `schemaPathSuffix`. Thus, this can only\n * be used if you provide your field schema inside the `generateSchemaMap` prop of your feature.server.ts.\n */\nexport const FieldsDrawer: React.FC<FieldsDrawerProps> = ({\n className,\n data,\n drawerSlug,\n drawerTitle,\n featureKey,\n fieldMapOverride,\n handleDrawerSubmit,\n schemaFieldsPathOverride,\n schemaPath,\n schemaPathSuffix,\n}) => {\n const { closeModal } = useModal()\n // The Drawer only renders its children (and itself) if it's open. Thus, by extracting the main content\n // to DrawerContent, this should be faster\n return (\n <EditDepthProvider>\n <Drawer className={className} slug={drawerSlug} title={drawerTitle ?? ''}>\n <DrawerContent\n data={data}\n featureKey={featureKey}\n fieldMapOverride={fieldMapOverride}\n handleDrawerSubmit={(args, args2) => {\n // Simply close drawer - no need for useLexicalDrawer here as at this point,\n // we don't need to restore the cursor position. This is handled by the useEffect in useLexicalDrawer.\n closeModal(drawerSlug)\n\n // Actual drawer submit logic needs to be triggered after the drawer is closed.\n // That's because the lexical selection / cursor restore logic that is striggerer by\n // `useLexicalDrawer` neeeds to be triggered before any editor.update calls that may happen\n // in the `handleDrawerSubmit` function.\n setTimeout(() => {\n handleDrawerSubmit(args, args2)\n }, 1)\n }}\n schemaFieldsPathOverride={schemaFieldsPathOverride}\n schemaPath={schemaPath}\n schemaPathSuffix={schemaPathSuffix}\n />\n </Drawer>\n </EditDepthProvider>\n )\n}\n", "'use client'\nimport type { FormState } from 'payload'\n\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport {\n Form,\n FormSubmit,\n RenderFields,\n useDocumentForm,\n useDocumentInfo,\n useServerFunctions,\n useTranslation,\n} from '@payloadcms/ui'\nimport { abortAndIgnore } from '@payloadcms/ui/shared'\nimport { deepCopyObjectSimpleWithoutReactComponents } from 'payload/shared'\nimport React, { useCallback, useEffect, useRef, useState } from 'react'\nimport { v4 as uuid } from 'uuid'\n\nimport type { FieldsDrawerProps } from './Drawer.js'\n\nimport { useEditorConfigContext } from '../../lexical/config/client/EditorConfigProvider.js'\n\nexport const DrawerContent: React.FC<Omit<FieldsDrawerProps, 'drawerSlug' | 'drawerTitle'>> = ({\n data,\n featureKey,\n fieldMapOverride,\n handleDrawerSubmit,\n schemaFieldsPathOverride,\n schemaPath,\n schemaPathSuffix,\n}) => {\n const { t } = useTranslation()\n const { id, collectionSlug, getDocPreferences, globalSlug } = useDocumentInfo()\n const { fields: parentDocumentFields } = useDocumentForm()\n const isEditable = useLexicalEditable()\n\n const onChangeAbortControllerRef = useRef(new AbortController())\n\n const [initialState, setInitialState] = useState<false | FormState | undefined>(false)\n\n const {\n fieldProps: { featureClientSchemaMap },\n } = useEditorConfigContext()\n\n const { getFormState } = useServerFunctions()\n\n const schemaFieldsPath =\n schemaFieldsPathOverride ??\n `${schemaPath}.lexical_internal_feature.${featureKey}${schemaPathSuffix ? `.${schemaPathSuffix}` : ''}`\n\n const fields: any = fieldMapOverride ?? featureClientSchemaMap[featureKey]?.[schemaFieldsPath] // Field Schema\n\n useEffect(() => {\n const controller = new AbortController()\n\n const awaitInitialState = async () => {\n const { state } = await getFormState({\n id,\n collectionSlug,\n data: data ?? {},\n docPermissions: {\n fields: true,\n },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields),\n globalSlug,\n initialBlockData: data,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: true,\n schemaPath: schemaFieldsPath,\n signal: controller.signal,\n })\n\n setInitialState(state)\n }\n\n void awaitInitialState()\n\n return () => {\n abortAndIgnore(controller)\n }\n }, [\n schemaFieldsPath,\n id,\n data,\n getFormState,\n collectionSlug,\n isEditable,\n globalSlug,\n getDocPreferences,\n parentDocumentFields,\n ])\n\n const onChange = useCallback(\n async ({ formState: prevFormState }: { formState: FormState }) => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n\n const controller = new AbortController()\n onChangeAbortControllerRef.current = controller\n\n const { state } = await getFormState({\n id,\n collectionSlug,\n docPermissions: {\n fields: true,\n },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields),\n formState: prevFormState,\n globalSlug,\n initialBlockFormState: prevFormState,\n operation: 'update',\n readOnly: !isEditable,\n schemaPath: schemaFieldsPath,\n signal: controller.signal,\n })\n\n if (!state) {\n return prevFormState\n }\n\n return state\n },\n [\n getFormState,\n id,\n isEditable,\n collectionSlug,\n getDocPreferences,\n parentDocumentFields,\n globalSlug,\n schemaFieldsPath,\n ],\n )\n\n // cleanup effect\n useEffect(() => {\n return () => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n }\n }, [])\n\n if (initialState === false) {\n return null\n }\n\n return (\n <Form\n beforeSubmit={[onChange]}\n disableValidationOnSubmit\n fields={Array.isArray(fields) ? fields : []}\n initialState={initialState}\n onChange={[onChange]}\n onSubmit={handleDrawerSubmit}\n uuid={uuid()}\n >\n <RenderFields\n fields={Array.isArray(fields) ? fields : []}\n forceRender\n parentIndexPath=\"\"\n parentPath=\"\" // See Blocks feature path for details as for why this is empty\n parentSchemaPath={schemaFieldsPath}\n permissions={true}\n readOnly={!isEditable}\n />\n <FormSubmit>{t('fields:saveChanges')}</FormSubmit>\n </Form>\n )\n}\n", "'use client'\nimport type { ClientCollectionConfig, ClientUser, VisibleEntities } from 'payload'\n\nimport { useAuth, useConfig, useEntityVisibility } from '@payloadcms/ui'\nimport * as React from 'react'\n\ntype Options = {\n uploads: boolean\n user: ClientUser\n visibleEntities?: VisibleEntities\n}\n\ntype FilteredCollectionsT = (\n collections: ClientCollectionConfig[],\n options?: Options,\n) => ClientCollectionConfig[]\n\nconst filterRichTextCollections: FilteredCollectionsT = (collections, options) => {\n return collections.filter(({ slug, admin: { enableRichTextRelationship }, upload }) => {\n if (!options?.visibleEntities?.collections.includes(slug)) {\n return false\n }\n\n if (options?.uploads) {\n return enableRichTextRelationship && Boolean(upload) === true\n }\n\n return upload ? false : enableRichTextRelationship\n })\n}\n\nexport const EnabledRelationshipsCondition: React.FC<{\n children: any\n FallbackComponent?: React.FC\n uploads?: boolean\n}> = (props) => {\n const { children, FallbackComponent, uploads = false, ...rest } = props\n const {\n config: { collections },\n } = useConfig()\n const { user } = useAuth()\n const { visibleEntities } = useEntityVisibility()\n\n const [enabledCollectionSlugs] = React.useState(() =>\n filterRichTextCollections(collections, { uploads, user: user!, visibleEntities }).map(\n ({ slug }) => slug,\n ),\n )\n\n if (!enabledCollectionSlugs.length) {\n return FallbackComponent ? <FallbackComponent {...rest} /> : null\n }\n\n return React.cloneElement(children, { ...rest, enabledCollectionSlugs })\n}\n", "'use client'\nimport type { LexicalCommand } from 'lexical'\n\nimport { createCommand } from 'lexical'\n\nexport const INSERT_UPLOAD_WITH_DRAWER_COMMAND: LexicalCommand<{\n replace: { nodeKey: string } | false\n}> = createCommand('INSERT_UPLOAD_WITH_DRAWER_COMMAND')\n"],
5
+ "mappings": "wCAAA,OAAAA,KAAAC,MAAA,iEAGA,OAASC,UAAAA,EAAQC,qBAAAA,EAAmBC,YAAAA,MAAgB,iBACpD,MAAkB,0DCDlB,OAASC,sBAAAA,MAA0B,oCACnC,OACEC,QAAAA,EACAC,cAAAA,EACAC,gBAAAA,EACAC,mBAAAA,EACAC,mBAAAA,EACAC,sBAAAA,EACAC,kBAAAA,MACK,iBACP,OAASC,kBAAAA,MAAsB,wBAC/B,OAASC,8CAAAA,MAAkD,iBAC3D,OAAgBC,eAAAA,EAAaC,aAAAA,EAAWC,UAAAA,EAAQC,YAAAA,MAAgB,QAChE,OAASC,MAAMC,MAAY,OAMpB,IAAMC,EAAiFA,CAAC,CAC7FC,KAAAA,EACAC,WAAAA,EACAC,iBAAAA,EACAC,mBAAAA,EACAC,yBAAAA,EACAC,WAAAA,EACAC,iBAAAA,CAAgB,IACjB,CACC,GAAM,CAAEC,EAAAA,CAAC,EAAKC,EAAA,EACR,CAAEC,GAAAA,EAAIC,eAAAA,EAAgBC,kBAAAA,EAAmBC,WAAAA,CAAU,EAAKC,EAAA,EACxD,CAAEC,OAAQC,CAAoB,EAAKC,EAAA,EACnCC,EAAaC,EAAA,EAEbC,EAA6BC,EAAO,IAAIC,eAAA,EAExC,CAACC,EAAcC,CAAA,EAAmBC,EAAwC,EAAA,EAE1E,CACJC,WAAY,CAAEC,uBAAAA,CAAsB,CAAE,EACpCC,EAAA,EAEE,CAAEC,aAAAA,CAAY,EAAKC,EAAA,EAEnBC,EACJ1B,GACA,GAAGC,CAAA,6BAAuCJ,CAAA,GAAaK,EAAmB,IAAIA,CAAA,GAAqB,EAAA,GAE/FQ,EAAcZ,GAAoBwB,EAAuBzB,CAAA,IAAc6B,CAAA,EAE7EC,EAAU,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D,EAAAgB,IAAAC,EAC/D,EAAAX,EAAA,CAAA,EAAAb,EAAAa,EAAA,CAAA,EAAAJ,EAAAI,EAAA,CAAA,EAAAQ,EAAAR,EAAA,CAAA,EAAAN,EAAAM,EAAA,CAAA,EAAAS,GAAAA,EAAAT,EAAA,CAAA,EAFlB,GAAA,CAAAY,CAAA,EAAiCC,WAAeJ,CAE9B,EAAA,GAAA,CAIbG,EAAAE,OAAA,OACIZ,EAAoBa,EAACb,EAAA,CAAA,GAAsBE,CAAI,CAAA,EAAA,KAAO,IAAAY,EAAA,GAAAhB,EAAA,CAAA,IAAAC,GAAAD,EAAA,CAAA,IAAAY,GAAAZ,EAAA,CAAA,IAAAI,EAAA,CAAA,IAAAa,EAAAjB,EAAA,CAAA,IAAAY,GAAAZ,EAAA,EAAA,IAAAI,GAG3Ba,EAAA,CAAA,GAAKb,EAAIQ,uBAAAA,CAAA,EAAyBZ,EAAA,CAAA,EAAAY,EAAAZ,EAAA,EAAA,EAAAI,EAAAJ,EAAA,EAAA,EAAAiB,GAAAA,EAAAjB,EAAA,EAAA,EAA/DgB,EAAAE,eAAmBjB,EAAUgB,CAAkC,EAAAjB,EAAA,CAAA,EAAAC,EAAAD,EAAA,CAAA,EAAAY,EAAAZ,EAAA,CAAA,EAAAI,EAAAJ,EAAA,CAAA,EAAAgB,CAAA,MAAAA,EAAAhB,EAAA,CAAA,EAAA,OAA/DgB,CAA+D,EAlBnE,SAAAL,GAAAR,EAAA,CAUE,GAAA,CAAAb,KAAAA,CAAA,EAAAa,EAAQ,OAAKb,CAAA,CC1CpB,OAAS6B,iBAAAA,OAAqB,UAEvB,IAAMC,GAERD,GAAc,mCAAA",
6
+ "names": ["c", "_c", "Drawer", "EditDepthProvider", "useModal", "useLexicalEditable", "Form", "FormSubmit", "RenderFields", "useDocumentForm", "useDocumentInfo", "useServerFunctions", "useTranslation", "abortAndIgnore", "deepCopyObjectSimpleWithoutReactComponents", "useCallback", "useEffect", "useRef", "useState", "v4", "uuid", "DrawerContent", "data", "featureKey", "fieldMapOverride", "handleDrawerSubmit", "schemaFieldsPathOverride", "schemaPath", "schemaPathSuffix", "t", "useTranslation", "id", "collectionSlug", "getDocPreferences", "globalSlug", "useDocumentInfo", "fields", "parentDocumentFields", "useDocumentForm", "isEditable", "useLexicalEditable", "onChangeAbortControllerRef", "useRef", "AbortController", "initialState", "setInitialState", "useState", "fieldProps", "featureClientSchemaMap", "useEditorConfigContext", "getFormState", "useServerFunctions", "schemaFieldsPath", "useEffect", "controller", "state", "docPermissions", "docPreferences", "documentFormState", "deepCopyObjectSimpleWithoutReactComponents", "initialBlockData", "operation", "readOnly", "renderAllFields", "signal", "abortAndIgnore", "onChange", "useCallback", "formState", "prevFormState", "current", "initialBlockFormState", "_jsxs", "Form", "beforeSubmit", "disableValidationOnSubmit", "Array", "isArray", "onSubmit", "uuid", "_jsx", "RenderFields", "forceRender", "parentIndexPath", "parentPath", "parentSchemaPath", "permissions", "FormSubmit", "FieldsDrawer", "t0", "$", "_c", "className", "data", "drawerSlug", "drawerTitle", "featureKey", "fieldMapOverride", "handleDrawerSubmit", "schemaFieldsPathOverride", "schemaPath", "schemaPathSuffix", "closeModal", "useModal", "t1", "t2", "args", "args2", "setTimeout", "t3", "_jsx", "EditDepthProvider", "children", "Drawer", "slug", "title", "DrawerContent", "c", "_c", "useAuth", "useConfig", "useEntityVisibility", "React", "filterRichTextCollections", "collections", "options", "filter", "slug", "admin", "enableRichTextRelationship", "upload", "visibleEntities", "includes", "uploads", "Boolean", "EnabledRelationshipsCondition", "props", "$", "children", "FallbackComponent", "t0", "rest", "undefined", "config", "t1", "user", "t2", "map", "_temp", "enabledCollectionSlugs", "useState", "length", "_jsx", "t3", "t4", "cloneElement", "createCommand", "INSERT_UPLOAD_WITH_DRAWER_COMMAND"]
7
+ }
@@ -8,5 +8,5 @@ var nt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.cre
8
8
  `),o=[];for(let r of e)o.push("> "+r);return o.join(`
9
9
  `)},regExp:zt,replace:(n,t,e,o)=>{if(o){let c=n.getPreviousSibling();if(Dt(c)){c.splice(c.getChildrenSize(),0,[Nn(),...t]),c.select(0,0),n.remove();return}}let r=Rn();r.append(...t),n.replace(r),r.select(0,0)}},qt={type:"element",dependencies:[J,Z],export:(n,t)=>k(n)?U(n,t,0):null,regExp:Ut,replace:tt("bullet")},Ln={type:"element",dependencies:[J,Z],export:(n,t)=>k(n)?U(n,t,0):null,regExp:Gt,replace:tt("check")},Qt={type:"element",dependencies:[J,Z],export:(n,t)=>k(n)?U(n,t,0):null,regExp:Kt,replace:tt("number")},jt={type:"text-format",format:["code"],tag:"`"},Vt={type:"text-format",format:["highlight"],tag:"=="},Zt={type:"text-format",format:["bold","italic"],tag:"***"},Jt={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},te={type:"text-format",format:["bold"],tag:"**"},ee={type:"text-format",format:["bold"],intraword:!1,tag:"__"},ne={type:"text-format",format:["strikethrough"],tag:"~~"},oe={type:"text-format",format:["italic"],tag:"*"},re={type:"text-format",format:["italic"],intraword:!1,tag:"_"};function ie(n,t){let e=n.split(`
10
10
  `),o=!1,r=[],c=0;for(let s=0;s<e.length;s++){let i=e[s],a=r[r.length-1];if(bn.test(i)){r.push(i);continue}if(Pt.test(i)){c===0&&(o=!0),c===1&&(o=!1),c>0&&c--,r.push(i);continue}if(yn.test(i)){o=!0,c++,r.push(i);continue}if(o){r.push(i);continue}Bt.test(i)||Bt.test(a)||!a||V.test(a)||V.test(i)||zt.test(i)||Kt.test(i)||Ut.test(i)||Gt.test(i)||An.test(i)||On.test(i)||!t||vt.test(i)||Ht.test(i)||vt.test(a)||Ht.test(a)||Pt.test(a)?r.push(i):r[r.length-1]=a+" "+i.trim()}return r.join(`
11
- `)}var $n=[Yt,Wt,qt,Qt],Dn=[],Bn=[jt,Zt,Jt,te,ee,Vt,oe,re,ne],Pn=[],K=[...$n,...Dn,...Bn,...Pn];function hr(n,t=K,e,o=!1,r=!0){let c=o?n:ie(n,r);return Ot(t,o)(c,e)}function xr(n=K,t,e=!1){return Ft(n,e)(t)}export{nt as a,Gn as b,cr as c,hr as d,xr as e,G as f,ot as g,io as h,ve as i,so as j,_t as k,fo as l};
12
- //# sourceMappingURL=chunk-2Y72RT72.js.map
11
+ `)}var $n=[Yt,Wt,qt,Qt],Dn=[],Bn=[jt,Zt,Jt,te,ee,Vt,oe,re,ne],Pn=[],K=[...$n,...Dn,...Bn,...Pn];function hr(n,t=K,e,o=!1,r=!0){let c=o?n:ie(n,r);return Ot(t,o)(c,e)}function xr(n=K,t,e=!1){return Ft(n,e)(t)}export{cr as a,hr as b,xr as c,nt as d,Gn as e,G as f,ot as g,io as h,ve as i,so as j,_t as k,fo as l};
12
+ //# sourceMappingURL=chunk-TLQLXR6Q.js.map
@@ -0,0 +1,2 @@
1
+ import{a as ie}from"./chunk-INBEEENE.js";import{b as se}from"./chunk-BZZVLW4U.js";import{jsx as r,jsxs as b,Fragment as we}from"react/jsx-runtime";import O,{createContext as Ie,useCallback as A,useEffect as v,useMemo as N,useRef as S}from"react";import{useLexicalComposerContext as ve}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Ne}from"@lexical/react/useLexicalEditable";import{getTranslation as ce}from"@payloadcms/translations";import{Button as ae,Drawer as Oe,EditDepthProvider as Te,Form as $e,formatDrawerSlug as Pe,FormSubmit as Le,RenderFields as Re,ShimmerEffect as Ee,useConfig as je,useDocumentForm as Me,useDocumentInfo as Ae,useEditDepth as Je,useServerFunctions as Ke,useTranslation as ze}from"@payloadcms/ui";import{abortAndIgnore as J}from"@payloadcms/ui/shared";import{$getNodeByKey as K}from"lexical";import{deepCopyObjectSimpleWithoutReactComponents as z,reduceFieldsToValues as He}from"payload/shared";import{v4 as Ve}from"uuid";import{jsx as Ce}from"react/jsx-runtime";import _e from"bson-objectid";import ye from"react";import Be from"bson-objectid";import{DecoratorNode as xe}from"lexical";var x=class extends xe{__cacheBuster;__fields;constructor({cacheBuster:e,fields:t,key:l}){super(l),this.__fields=t,this.__cacheBuster=e||0}static clone(e){return new this({cacheBuster:e.__cacheBuster,fields:e.__fields,key:e.__key})}static getType(){return"inlineBlock"}static importDOM(){return{}}static importJSON(e){return Se(e.fields)}static isInline(){return!1}canIndent(){return!0}createDOM(){let e=document.createElement("span");return e.classList.add("inline-block-container"),e}decorate(e,t){return null}exportDOM(){let e=document.createElement("span");e.classList.add("inline-block-container");let t=document.createTextNode(this.getTextContent());return e.append(t),{element:e}}exportJSON(){return{type:"inlineBlock",fields:this.getFields(),version:1}}getCacheBuster(){return this.getLatest().__cacheBuster}getFields(){return this.getLatest().__fields}getTextContent(){return"Block Field"}isInline(){return!0}setFields(e,t){let l=this.getWritable();l.__fields=e,t||l.__cacheBuster++}updateDOM(){return!1}};function Se(s){return new x({fields:{...s,id:s?.id||new Be.default().toHexString()}})}var Fe=ye.lazy(()=>import("./componentInline-NGTRUSGB.js").then(s=>({default:s.InlineBlockComponent}))),I=class extends x{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return De(e.fields)}decorate(e,t){return Ce(Fe,{cacheBuster:this.getCacheBuster(),formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function De(s){return new I({fields:{...s,id:s?.id||new _e.default().toHexString()}})}function M(s){return s instanceof I}var f="inline-block",ue=Ie({initialState:!1}),pt=()=>O.use(ue),bt=s=>{let{cacheBuster:e,formData:t,nodeKey:l}=s,[p]=ve(),c=Ne(),{i18n:T,t:m}=ze(),{createdInlineBlock:H,fieldProps:{featureClientSchemaMap:de,initialLexicalFormState:me,schemaPath:V},setCreatedInlineBlock:W,uuid:fe}=se(),{fields:C}=Me(),{getFormState:_}=Ke(),pe=Je(),q=S(!1),[a,$]=O.useState(()=>me?.[t.id]?.formState),G=S(!1),Q=S(e);v(()=>{G.current?(Q.current!==e&&$(!1),Q.current=e):G.current=!0},[e]);let[P,U]=O.useState(a?._components?.customComponents?.BlockLabel),[X,Y]=O.useState(a?._components?.customComponents?.Block),Z=Pe({slug:`lexical-inlineBlocks-create-${fe}-${t.id}`,depth:pe}),{toggleDrawer:k}=ie(Z,!0),be=S(null),{id:y,collectionSlug:F,getDocPreferences:D,globalSlug:w}=Ae(),{config:ke}=je(),he=`${V}.lexical_internal_feature.blocks.lexical_inline_blocks.${t.blockType}`,h=de.blocks?.[he]?.[0],u=h.blockReferences?typeof h?.blockReferences?.[0]=="string"?ke.blocksMap[h?.blockReferences?.[0]]:h?.blockReferences?.[0]:h?.blocks?.[0],ee=u?.fields??[];v(()=>{!q.current&&H?.getKey()===l&&(ee.length>2&&k(),W?.(void 0),q.current=!0)},[ee.length,H,l,W,k]);let te=A(()=>{p.update(()=>{K(l)?.remove()})},[p,l]),g=u?.labels?.singular?ce(u?.labels.singular,T):u?.slug,L=S(new AbortController),B=`${V}.lexical_internal_feature.blocks.lexical_inline_blocks.${u?.slug}.fields`;v(()=>{let n=new AbortController;return t&&!a&&(async()=>{let{state:o}=await _({id:y,collectionSlug:F,data:t,docPermissions:{fields:!0},docPreferences:await D(),documentFormState:z(C),globalSlug:w,initialBlockData:t,initialBlockFormState:t,operation:"update",readOnly:!c,renderAllFields:!0,schemaPath:B,signal:n.signal});if(o){let d=He(z(o),!0);p.update(()=>{let j=K(l);if(j&&M(j)){let le=d;le.blockType=t.blockType,j.setFields(le,!0)}}),$(o),U(o._components?.customComponents?.BlockLabel),Y(o._components?.customComponents?.Block)}})(),()=>{J(n)}},[_,p,l,c,B,y,t,a,F,w,D,C]);let ne=A(async({formState:n,submit:i})=>{J(L.current);let o=new AbortController;L.current=o;let{state:d}=await _({id:y,collectionSlug:F,docPermissions:{fields:!0},docPreferences:await D(),documentFormState:z(C),formState:n,globalSlug:w,initialBlockFormState:n,operation:"update",readOnly:!c,renderAllFields:!!i,schemaPath:B,signal:o.signal});return d?(i&&(U(d._components?.customComponents?.BlockLabel),Y(d._components?.customComponents?.Block)),d):n},[_,y,F,D,C,w,c,B]);v(()=>{let n=(i,o)=>Object.keys(o).some(d=>o[d]&&i[d]!==o[d].value);return()=>{a&&n(t,a)&&$(!1),J(L.current)}},[t,a]);let ge=A((n,i)=>{i.blockType=t.blockType,p.update(()=>{let o=K(l);o&&M(o)&&o.setFields(i,!0)})},[p,l,t]),R=N(()=>()=>r(ae,{buttonStyle:"icon-label",className:`${f}__removeButton`,disabled:!c,icon:"x",onClick:n=>{n.preventDefault(),te()},round:!0,size:"small",tooltip:m("lexical:blocks:inlineBlocks:remove",{label:g})}),[g,c,te,m]),oe=N(()=>()=>r(ae,{buttonStyle:"icon-label",className:`${f}__editButton`,disabled:!c,el:"button",icon:"edit",onClick:()=>{k()},round:!0,size:"small",tooltip:m("lexical:blocks:inlineBlocks:edit",{label:g})}),[g,c,m,k]),E=N(()=>({children:n,className:i})=>r("div",{className:[f,f+"-"+t.blockType,i].filter(Boolean).join(" "),ref:be,children:n}),[t.blockType]),re=N(()=>P?()=>P:()=>r("div",{children:u?.labels?ce(u?.labels.singular,T):""}),[P,u?.labels,T]);return u?b($e,{beforeSubmit:[async({formState:n})=>await ne({formState:n,submit:!0})],disableValidationOnSubmit:!0,el:"div",fields:u?.fields,initialState:a||{},onChange:[ne],onSubmit:(n,i)=>{ge(n,i),k()},uuid:Ve(),children:[r(Te,{children:r(Oe,{className:"",slug:Z,title:m(`lexical:blocks:inlineBlocks:${t?.id?"edit":"create"}`,{label:g??m("lexical:blocks:inlineBlocks:label")}),children:a?b(we,{children:[r(Re,{fields:u?.fields,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:B,permissions:!0,readOnly:!c}),r(Le,{programmaticSubmit:!0,children:m("fields:saveChanges")})]}):null})}),X?r(ue,{value:{EditButton:oe,initialState:a,InlineBlockContainer:E,Label:re,nodeKey:l,RemoveButton:R},children:X}):b(E,{children:[a?r(re,{}):r(Ee,{height:"15px",width:"40px"}),c?b("div",{className:`${f}__actions`,children:[r(oe,{}),r(R,{})]}):null]})]}):b(E,{className:`${f}-not-found`,children:[b("span",{children:["Error: Block '",t.blockType,"' not found"]}),c?r("div",{className:`${f}__actions`,children:r(R,{})}):null]})};export{pt as a,bt as b,I as c,De as d,M as e};
2
+ //# sourceMappingURL=chunk-XNERFY6G.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/features/blocks/client/componentInline/index.tsx", "../../../src/features/blocks/client/nodes/InlineBlocksNode.tsx", "../../../src/features/blocks/server/nodes/InlineBlocksNode.tsx"],
4
+ "sourcesContent": ["'use client'\n\nimport React, { createContext, useCallback, useEffect, useMemo, useRef } from 'react'\nconst baseClass = 'inline-block'\n\nimport type { BlocksFieldClient, ClientBlock, Data, FormState } from 'payload'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n Drawer,\n EditDepthProvider,\n Form,\n formatDrawerSlug,\n FormSubmit,\n RenderFields,\n ShimmerEffect,\n useConfig,\n useDocumentForm,\n useDocumentInfo,\n useEditDepth,\n useServerFunctions,\n useTranslation,\n} from '@payloadcms/ui'\nimport { abortAndIgnore } from '@payloadcms/ui/shared'\n\nimport './index.scss'\n\nimport { $getNodeByKey } from 'lexical'\nimport { deepCopyObjectSimpleWithoutReactComponents, reduceFieldsToValues } from 'payload/shared'\nimport { v4 as uuid } from 'uuid'\n\nimport type { InlineBlockFields } from '../../server/nodes/InlineBlocksNode.js'\n\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport { useLexicalDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDrawer.js'\nimport { $isInlineBlockNode } from '../nodes/InlineBlocksNode.js'\n\ntype Props = {\n /**\n * Can be modified by the node in order to trigger the re-fetch of the initial state based on the\n * formData. This is useful when node.setFields() is explicitly called from outside of the form - in\n * this case, the new field state is likely not reflected in the form state, so we need to re-fetch\n */\n readonly cacheBuster: number\n readonly formData: InlineBlockFields\n readonly nodeKey: string\n}\n\ntype InlineBlockComponentContextType = {\n EditButton?: React.FC\n initialState: false | FormState | undefined\n InlineBlockContainer?: React.FC<{ children: React.ReactNode }>\n Label?: React.FC\n nodeKey?: string\n RemoveButton?: React.FC\n}\n\nconst InlineBlockComponentContext = createContext<InlineBlockComponentContextType>({\n initialState: false,\n})\n\nexport const useInlineBlockComponentContext = () => React.use(InlineBlockComponentContext)\n\nexport const InlineBlockComponent: React.FC<Props> = (props) => {\n const { cacheBuster, formData, nodeKey } = props\n\n const [editor] = useLexicalComposerContext()\n const isEditable = useLexicalEditable()\n const { i18n, t } = useTranslation<object, string>()\n const {\n createdInlineBlock,\n fieldProps: { featureClientSchemaMap, initialLexicalFormState, schemaPath },\n setCreatedInlineBlock,\n uuid: uuidFromContext,\n } = useEditorConfigContext()\n const { fields: parentDocumentFields } = useDocumentForm()\n\n const { getFormState } = useServerFunctions()\n const editDepth = useEditDepth()\n const firstTimeDrawer = useRef(false)\n\n const [initialState, setInitialState] = React.useState<false | FormState | undefined>(\n () => initialLexicalFormState?.[formData.id]?.formState,\n )\n\n const hasMounted = useRef(false)\n const prevCacheBuster = useRef(cacheBuster)\n useEffect(() => {\n if (hasMounted.current) {\n if (prevCacheBuster.current !== cacheBuster) {\n setInitialState(false)\n }\n prevCacheBuster.current = cacheBuster\n } else {\n hasMounted.current = true\n }\n }, [cacheBuster])\n\n const [CustomLabel, setCustomLabel] = React.useState<React.ReactNode | undefined>(\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n initialState?.['_components']?.customComponents?.BlockLabel,\n )\n\n const [CustomBlock, setCustomBlock] = React.useState<React.ReactNode | undefined>(\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n initialState?.['_components']?.customComponents?.Block,\n )\n\n const drawerSlug = formatDrawerSlug({\n slug: `lexical-inlineBlocks-create-${uuidFromContext}-${formData.id}`,\n depth: editDepth,\n })\n const { toggleDrawer } = useLexicalDrawer(drawerSlug, true)\n\n const inlineBlockElemElemRef = useRef<HTMLDivElement | null>(null)\n const { id, collectionSlug, getDocPreferences, globalSlug } = useDocumentInfo()\n const { config } = useConfig()\n\n const componentMapRenderedBlockPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${formData.blockType}`\n\n const clientSchemaMap = featureClientSchemaMap['blocks']\n\n const blocksField: BlocksFieldClient = clientSchemaMap?.[\n componentMapRenderedBlockPath\n ]?.[0] as BlocksFieldClient\n\n const clientBlock: ClientBlock | undefined = blocksField.blockReferences\n ? typeof blocksField?.blockReferences?.[0] === 'string'\n ? config.blocksMap[blocksField?.blockReferences?.[0]]\n : blocksField?.blockReferences?.[0]\n : blocksField?.blocks?.[0]\n\n const clientBlockFields = clientBlock?.fields ?? []\n\n // Open drawer on \"mount\"\n useEffect(() => {\n if (!firstTimeDrawer.current && createdInlineBlock?.getKey() === nodeKey) {\n // > 2 because they always have \"id\" and \"blockName\" fields\n if (clientBlockFields.length > 2) {\n toggleDrawer()\n }\n setCreatedInlineBlock?.(undefined)\n firstTimeDrawer.current = true\n }\n }, [clientBlockFields.length, createdInlineBlock, nodeKey, setCreatedInlineBlock, toggleDrawer])\n\n const removeInlineBlock = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey)?.remove()\n })\n }, [editor, nodeKey])\n\n const blockDisplayName = clientBlock?.labels?.singular\n ? getTranslation(clientBlock?.labels.singular, i18n)\n : clientBlock?.slug\n\n const onChangeAbortControllerRef = useRef(new AbortController())\n const schemaFieldsPath = `${schemaPath}.lexical_internal_feature.blocks.lexical_inline_blocks.${clientBlock?.slug}.fields`\n\n // Initial state for newly created blocks\n useEffect(() => {\n const abortController = new AbortController()\n\n const awaitInitialState = async () => {\n /*\n * This will only run if a new block is created. For all existing blocks that are loaded when the document is loaded, or when the form is saved,\n * this is not run, as the lexical field RSC will fetch the state server-side and pass it to the client. That way, we avoid unnecessary client-side\n * requests. Though for newly created blocks, we need to fetch the state client-side, as the server doesn't know about the block yet.\n */\n const { state } = await getFormState({\n id,\n collectionSlug,\n data: formData,\n docPermissions: { fields: true },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields),\n globalSlug,\n initialBlockData: formData,\n initialBlockFormState: formData,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: true,\n schemaPath: schemaFieldsPath,\n signal: abortController.signal,\n })\n\n if (state) {\n const newFormStateData: InlineBlockFields = reduceFieldsToValues(\n deepCopyObjectSimpleWithoutReactComponents(state),\n true,\n ) as InlineBlockFields\n\n // Things like default values may come back from the server => update the node with the new data\n editor.update(() => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isInlineBlockNode(node)) {\n const newData = newFormStateData\n newData.blockType = formData.blockType\n\n node.setFields(newData, true)\n }\n })\n\n setInitialState(state)\n setCustomLabel(state['_components']?.customComponents?.BlockLabel)\n setCustomBlock(state['_components']?.customComponents?.Block)\n }\n }\n\n if (formData && !initialState) {\n void awaitInitialState()\n }\n\n return () => {\n abortAndIgnore(abortController)\n }\n }, [\n getFormState,\n editor,\n nodeKey,\n isEditable,\n schemaFieldsPath,\n id,\n formData,\n initialState,\n collectionSlug,\n globalSlug,\n getDocPreferences,\n parentDocumentFields,\n ])\n\n /**\n * HANDLE ONCHANGE\n */\n const onChange = useCallback(\n async ({ formState: prevFormState, submit }: { formState: FormState; submit?: boolean }) => {\n abortAndIgnore(onChangeAbortControllerRef.current)\n\n const controller = new AbortController()\n onChangeAbortControllerRef.current = controller\n\n const { state } = await getFormState({\n id,\n collectionSlug,\n docPermissions: {\n fields: true,\n },\n docPreferences: await getDocPreferences(),\n documentFormState: deepCopyObjectSimpleWithoutReactComponents(parentDocumentFields),\n formState: prevFormState,\n globalSlug,\n initialBlockFormState: prevFormState,\n operation: 'update',\n readOnly: !isEditable,\n renderAllFields: submit ? true : false,\n schemaPath: schemaFieldsPath,\n signal: controller.signal,\n })\n\n if (!state) {\n return prevFormState\n }\n\n if (submit) {\n setCustomLabel(state['_components']?.customComponents?.BlockLabel)\n setCustomBlock(state['_components']?.customComponents?.Block)\n }\n\n return state\n },\n [\n getFormState,\n id,\n collectionSlug,\n getDocPreferences,\n parentDocumentFields,\n globalSlug,\n isEditable,\n schemaFieldsPath,\n ],\n )\n // cleanup effect\n useEffect(() => {\n const isStateOutOfSync = (formData: InlineBlockFields, initialState: FormState) => {\n return Object.keys(initialState).some(\n (key) => initialState[key] && formData[key] !== initialState[key].value,\n )\n }\n\n return () => {\n // If the component is unmounted (either via removeInlineBlock or via lexical itself) and the form state got changed before,\n // we need to reset the initial state to force a re-fetch of the initial state when it gets mounted again (e.g. via lexical history undo).\n // Otherwise it would use an outdated initial state.\n if (initialState && isStateOutOfSync(formData, initialState)) {\n setInitialState(false)\n }\n abortAndIgnore(onChangeAbortControllerRef.current)\n }\n }, [formData, initialState])\n\n /**\n * HANDLE FORM SUBMIT\n */\n const onFormSubmit = useCallback(\n (formState: FormState, newData: Data) => {\n newData.blockType = formData.blockType\n\n editor.update(() => {\n const node = $getNodeByKey(nodeKey)\n if (node && $isInlineBlockNode(node)) {\n node.setFields(newData as InlineBlockFields, true)\n }\n })\n },\n [editor, nodeKey, formData],\n )\n\n const RemoveButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__removeButton`}\n disabled={!isEditable}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n removeInlineBlock()\n }}\n round\n size=\"small\"\n tooltip={t('lexical:blocks:inlineBlocks:remove', { label: blockDisplayName })}\n />\n ),\n [blockDisplayName, isEditable, removeInlineBlock, t],\n )\n\n const EditButton = useMemo(\n () => () => (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__editButton`}\n disabled={!isEditable}\n el=\"button\"\n icon=\"edit\"\n onClick={() => {\n toggleDrawer()\n }}\n round\n size=\"small\"\n tooltip={t('lexical:blocks:inlineBlocks:edit', { label: blockDisplayName })}\n />\n ),\n [blockDisplayName, isEditable, t, toggleDrawer],\n )\n\n const InlineBlockContainer = useMemo(\n () =>\n ({ children, className }: { children: React.ReactNode; className?: string }) => (\n <div\n className={[baseClass, baseClass + '-' + formData.blockType, className]\n .filter(Boolean)\n .join(' ')}\n ref={inlineBlockElemElemRef}\n >\n {children}\n </div>\n ),\n [formData.blockType],\n )\n\n const Label = useMemo(() => {\n if (CustomLabel) {\n return () => CustomLabel\n } else {\n return () => (\n <div>{clientBlock?.labels ? getTranslation(clientBlock?.labels.singular, i18n) : ''}</div>\n )\n }\n }, [CustomLabel, clientBlock?.labels, i18n])\n\n if (!clientBlock) {\n return (\n <InlineBlockContainer className={`${baseClass}-not-found`}>\n <span>Error: Block '{formData.blockType}' not found</span>\n {isEditable ? (\n <div className={`${baseClass}__actions`}>\n <RemoveButton />\n </div>\n ) : null}\n </InlineBlockContainer>\n )\n }\n\n return (\n <Form\n beforeSubmit={[\n async ({ formState }) => {\n // This is only called when form is submitted from drawer\n return await onChange({ formState, submit: true })\n },\n ]}\n disableValidationOnSubmit\n el=\"div\"\n fields={clientBlock?.fields}\n initialState={initialState || {}}\n onChange={[onChange]}\n onSubmit={(formState, data) => {\n onFormSubmit(formState, data)\n toggleDrawer()\n }}\n uuid={uuid()}\n >\n <EditDepthProvider>\n <Drawer\n className={''}\n slug={drawerSlug}\n title={t(`lexical:blocks:inlineBlocks:${formData?.id ? 'edit' : 'create'}`, {\n label: blockDisplayName ?? t('lexical:blocks:inlineBlocks:label'),\n })}\n >\n {initialState ? (\n <>\n <RenderFields\n fields={clientBlock?.fields}\n forceRender\n parentIndexPath=\"\"\n parentPath=\"\" // See Blocks feature path for details as for why this is empty\n parentSchemaPath={schemaFieldsPath}\n permissions={true}\n readOnly={!isEditable}\n />\n <FormSubmit programmaticSubmit={true}>{t('fields:saveChanges')}</FormSubmit>\n </>\n ) : null}\n </Drawer>\n </EditDepthProvider>\n {CustomBlock ? (\n <InlineBlockComponentContext\n value={{\n EditButton,\n initialState,\n InlineBlockContainer,\n Label,\n nodeKey,\n RemoveButton,\n }}\n >\n {CustomBlock}\n </InlineBlockComponentContext>\n ) : (\n <InlineBlockContainer>\n {initialState ? <Label /> : <ShimmerEffect height=\"15px\" width=\"40px\" />}\n {isEditable ? (\n <div className={`${baseClass}__actions`}>\n <EditButton />\n <RemoveButton />\n </div>\n ) : null}\n </InlineBlockContainer>\n )}\n </Form>\n )\n}\n", "'use client'\nimport type { EditorConfig, LexicalEditor, LexicalNode } from 'lexical'\n\nimport ObjectID from 'bson-objectid'\nimport React, { type JSX } from 'react'\n\nimport type {\n InlineBlockFields,\n SerializedInlineBlockNode,\n} from '../../server/nodes/InlineBlocksNode.js'\n\nimport { ServerInlineBlockNode } from '../../server/nodes/InlineBlocksNode.js'\n\nconst InlineBlockComponent = React.lazy(() =>\n import('../componentInline/index.js').then((module) => ({\n default: module.InlineBlockComponent,\n })),\n)\n\nexport class InlineBlockNode extends ServerInlineBlockNode {\n static override clone(node: ServerInlineBlockNode): ServerInlineBlockNode {\n return super.clone(node)\n }\n\n static override getType(): string {\n return super.getType()\n }\n\n static override importJSON(serializedNode: SerializedInlineBlockNode): InlineBlockNode {\n const node = $createInlineBlockNode(serializedNode.fields)\n return node\n }\n\n override decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element {\n return (\n <InlineBlockComponent\n cacheBuster={this.getCacheBuster()}\n formData={this.getFields()}\n nodeKey={this.getKey()}\n />\n )\n }\n\n override exportJSON(): SerializedInlineBlockNode {\n return super.exportJSON()\n }\n}\n\nexport function $createInlineBlockNode(fields: Exclude<InlineBlockFields, 'id'>): InlineBlockNode {\n return new InlineBlockNode({\n fields: {\n ...fields,\n id: fields?.id || new ObjectID.default().toHexString(),\n },\n })\n}\n\nexport function $isInlineBlockNode(\n node: InlineBlockNode | LexicalNode | null | undefined,\n): node is InlineBlockNode {\n return node instanceof InlineBlockNode\n}\n", "import type {\n DOMConversionMap,\n DOMExportOutput,\n EditorConfig,\n LexicalEditor,\n LexicalNode,\n NodeKey,\n SerializedLexicalNode,\n Spread,\n} from 'lexical'\nimport type { JsonObject } from 'payload'\nimport type React from 'react'\nimport type { JSX } from 'react'\n\nimport ObjectID from 'bson-objectid'\nimport { DecoratorNode } from 'lexical'\n\nexport type InlineBlockFields<TInlineBlockFields extends JsonObject = JsonObject> = {\n blockType: string\n id: string\n} & TInlineBlockFields\n\nexport type SerializedInlineBlockNode<TBlockFields extends JsonObject = JsonObject> = Spread<\n {\n children?: never // required so that our typed editor state doesn't automatically add children\n fields: InlineBlockFields<TBlockFields>\n type: 'inlineBlock'\n },\n SerializedLexicalNode\n>\n\nexport class ServerInlineBlockNode extends DecoratorNode<null | React.ReactElement> {\n __cacheBuster: number\n __fields: InlineBlockFields\n\n constructor({\n cacheBuster,\n fields,\n key,\n }: {\n cacheBuster?: number\n fields: InlineBlockFields\n key?: NodeKey\n }) {\n super(key)\n this.__fields = fields\n this.__cacheBuster = cacheBuster || 0\n }\n\n static override clone(node: ServerInlineBlockNode): ServerInlineBlockNode {\n return new this({\n cacheBuster: node.__cacheBuster,\n fields: node.__fields,\n key: node.__key,\n })\n }\n\n static override getType(): string {\n return 'inlineBlock'\n }\n\n static override importDOM(): DOMConversionMap<HTMLDivElement> | null {\n return {}\n }\n\n static override importJSON(serializedNode: SerializedInlineBlockNode): ServerInlineBlockNode {\n const node = $createServerInlineBlockNode(serializedNode.fields)\n return node\n }\n\n static isInline(): false {\n return false\n }\n\n canIndent() {\n return true\n }\n override createDOM() {\n const element = document.createElement('span')\n element.classList.add('inline-block-container')\n\n return element\n }\n\n override decorate(editor: LexicalEditor, config: EditorConfig): JSX.Element | null {\n return null\n }\n\n override exportDOM(): DOMExportOutput {\n const element = document.createElement('span')\n element.classList.add('inline-block-container')\n\n const text = document.createTextNode(this.getTextContent())\n element.append(text)\n return { element }\n }\n\n override exportJSON(): SerializedInlineBlockNode {\n return {\n type: 'inlineBlock',\n fields: this.getFields(),\n version: 1,\n }\n }\n\n getCacheBuster(): number {\n return this.getLatest().__cacheBuster\n }\n\n getFields(): InlineBlockFields {\n return this.getLatest().__fields\n }\n\n override getTextContent(): string {\n return `Block Field`\n }\n\n override isInline() {\n return true\n }\n\n setFields(fields: InlineBlockFields, preventFormStateUpdate?: boolean): void {\n const writable = this.getWritable()\n writable.__fields = fields\n if (!preventFormStateUpdate) {\n writable.__cacheBuster++\n }\n }\n\n override updateDOM(): boolean {\n return false\n }\n}\n\nexport function $createServerInlineBlockNode(\n fields: Exclude<InlineBlockFields, 'id'>,\n): ServerInlineBlockNode {\n return new ServerInlineBlockNode({\n fields: {\n ...fields,\n id: fields?.id || new ObjectID.default().toHexString(),\n },\n })\n}\n\nexport function $isServerInlineBlockNode(\n node: LexicalNode | null | ServerInlineBlockNode | undefined,\n): node is ServerInlineBlockNode {\n return node instanceof ServerInlineBlockNode\n}\n"],
5
+ "mappings": "mJAEA,OAAOA,GAASC,iBAAAA,GAAeC,eAAAA,EAAaC,aAAAA,EAAWC,WAAAA,EAASC,UAAAA,MAAc,QAK9E,OAASC,6BAAAA,OAAiC,wCAC1C,OAASC,sBAAAA,OAA0B,oCACnC,OAASC,kBAAAA,OAAsB,2BAC/B,OACEC,UAAAA,GACAC,UAAAA,GACAC,qBAAAA,GACAC,QAAAA,GACAC,oBAAAA,GACAC,cAAAA,GACAC,gBAAAA,GACAC,iBAAAA,GACAC,aAAAA,GACAC,mBAAAA,GACAC,mBAAAA,GACAC,gBAAAA,GACAC,sBAAAA,GACAC,kBAAAA,OACK,iBACP,OAASC,kBAAAA,MAAsB,wBAI/B,OAASC,iBAAAA,MAAqB,UAC9B,OAASC,8CAAAA,EAA4CC,wBAAAA,OAA4B,iBACjF,OAASC,MAAMC,OAAY,gDC7B3B,OAAOC,OAAc,gBACrB,OAAOC,OAAyB,QCUhC,OAAOC,OAAc,gBACrB,OAASC,iBAAAA,OAAqB,UAgBvB,IAAMC,EAAN,cAAoCD,EAAA,CACzCE,cACAC,SAEAC,YAAY,CACVC,YAAAA,EACAC,OAAAA,EACAC,IAAAA,CAAG,EAKF,CACD,MAAMA,CAAA,EACN,KAAKJ,SA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AM,MAAAA,GACAnI,QAAAA,EACA4G,aAAAA,CACF,WAECtE,IAGH8F,EAACP,EAAA,WACErI,EAAesH,EAACqB,GAAA,CAAA,CAAA,EAAWrB,EAACuC,GAAA,CAAcC,OAAO,OAAOC,MAAM,SAC9DpJ,EACCiI,EAAC,MAAA,CAAInB,UAAW,GAAG5H,CAAA,sBACjByH,EAACa,GAAA,CAAA,CAAA,EACDb,EAACF,EAAA,CAAA,CAAA,CAAA,IAED,IAAA,OA3ERwB,EAACP,EAAA,CAAqBZ,UAAW,GAAG5H,CAAA,uBAClC+I,EAAC,OAAA,WAAK,iBAAerI,EAASwD,UAAU,aAAA,IACvCpD,EACC2G,EAAC,MAAA,CAAIG,UAAW,GAAG5H,CAAA,qBACjByH,EAACF,EAAA,CAAA,CAAA,IAED,IAAA,GA0EZ",
6
+ "names": ["React", "createContext", "useCallback", "useEffect", "useMemo", "useRef", "useLexicalComposerContext", "useLexicalEditable", "getTranslation", "Button", "Drawer", "EditDepthProvider", "Form", "formatDrawerSlug", "FormSubmit", "RenderFields", "ShimmerEffect", "useConfig", "useDocumentForm", "useDocumentInfo", "useEditDepth", "useServerFunctions", "useTranslation", "abortAndIgnore", "$getNodeByKey", "deepCopyObjectSimpleWithoutReactComponents", "reduceFieldsToValues", "v4", "uuid", "ObjectID", "React", "ObjectID", "DecoratorNode", "ServerInlineBlockNode", "__cacheBuster", "__fields", "constructor", "cacheBuster", "fields", "key", "clone", "node", "__key", "getType", "importDOM", "importJSON", "serializedNode", "$createServerInlineBlockNode", "isInline", "canIndent", "createDOM", "element", "document", "createElement", "classList", "add", "decorate", "editor", "config", "exportDOM", "text", "createTextNode", "getTextContent", "append", "exportJSON", "type", "getFields", "version", "getCacheBuster", "getLatest", "setFields", "preventFormStateUpdate", "writable", "getWritable", "updateDOM", "id", "default", "toHexString", "InlineBlockComponent", "React", "lazy", "then", "module", "default", "InlineBlockNode", "ServerInlineBlockNode", "clone", "node", "getType", "importJSON", "serializedNode", "$createInlineBlockNode", "fields", "decorate", "editor", "config", "_jsx", "cacheBuster", "getCacheBuster", "formData", "getFields", "nodeKey", "getKey", "exportJSON", "id", "ObjectID", "toHexString", "$isInlineBlockNode", "baseClass", "InlineBlockComponentContext", "createContext", "initialState", "useInlineBlockComponentContext", "React", "use", "InlineBlockComponent", "props", "cacheBuster", "formData", "nodeKey", "editor", "useLexicalComposerContext", "isEditable", "useLexicalEditable", "i18n", "t", "useTranslation", "createdInlineBlock", "fieldProps", "featureClientSchemaMap", "initialLexicalFormState", "schemaPath", "setCreatedInlineBlock", "uuid", "uuidFromContext", "useEditorConfigContext", "fields", "parentDocumentFields", "useDocumentForm", "getFormState", "useServerFunctions", "editDepth", "useEditDepth", "firstTimeDrawer", "useRef", "setInitialState", "useState", "id", "formState", "hasMounted", "prevCacheBuster", "useEffect", "current", "CustomLabel", "setCustomLabel", "customComponents", "BlockLabel", "CustomBlock", "setCustomBlock", "Block", "drawerSlug", "formatDrawerSlug", "slug", "depth", "toggleDrawer", "useLexicalDrawer", "inlineBlockElemElemRef", "collectionSlug", "getDocPreferences", "globalSlug", "useDocumentInfo", "config", "useConfig", "componentMapRenderedBlockPath", "blockType", "blocksField", "clientBlock", "blockReferences", "blocksMap", "blocks", "clientBlockFields", "getKey", "length", "undefined", "removeInlineBlock", "useCallback", "update", "$getNodeByKey", "remove", "blockDisplayName", "labels", "singular", "getTranslation", "onChangeAbortControllerRef", "AbortController", "schemaFieldsPath", "abortController", "state", "data", "docPermissions", "docPreferences", "documentFormState", "deepCopyObjectSimpleWithoutReactComponents", "initialBlockData", "initialBlockFormState", "operation", "readOnly", "renderAllFields", "signal", "newFormStateData", "reduceFieldsToValues", "node", "$isInlineBlockNode", "newData", "setFields", "abortAndIgnore", "onChange", "prevFormState", "submit", "controller", "isStateOutOfSync", "Object", "keys", "some", "key", "value", "onFormSubmit", "RemoveButton", "useMemo", "_jsx", "Button", "buttonStyle", "className", "disabled", "icon", "onClick", "e", "preventDefault", "round", "size", "tooltip", "label", "EditButton", "el", "InlineBlockContainer", "children", "filter", "Boolean", "join", "ref", "Label", "_jsxs", "Form", "beforeSubmit", "disableValidationOnSubmit", "onSubmit", "EditDepthProvider", "Drawer", "title", "_Fragment", "RenderFields", "forceRender", "parentIndexPath", "parentPath", "parentSchemaPath", "permissions", "FormSubmit", "programmaticSubmit", "ShimmerEffect", "height", "width"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use client";import{a as S,b as y,c as R}from"./chunk-BQCXN3B4.js";import{a as x}from"./chunk-INBEEENE.js";import{a as N}from"./chunk-F26IQ5RE.js";import{b as p}from"./chunk-BZZVLW4U.js";import{jsx as t,jsxs as n}from"react/jsx-runtime";import{useLexicalComposerContext as Y}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as Z}from"@lexical/react/useLexicalEditable";import{getTranslation as E}from"@payloadcms/translations";import{Button as h,formatDrawerSlug as ee,Thumbnail as te,useConfig as oe,useEditDepth as ae,usePayloadAPI as le,useTranslation as ie}from"@payloadcms/ui";import{$getNodeByKey as L}from"lexical";import{isImage as re}from"payload/shared";import{useCallback as f,useId as se,useReducer as ne,useRef as de,useState as ce}from"react";var e="lexical-upload",P={depth:0},ue=d=>{let{data:{fields:T,relationTo:g,value:c},nodeKey:l}=d;if(typeof c=="object")throw new Error("Upload value should be a string or number. The Lexical Upload component should not receive the populated value object.");let{config:{routes:{api:U},serverURL:F},getEntityConfig:j}=oe(),I=de(null),{uuid:z}=p(),B=ae(),[i]=Y(),{editorConfig:k,fieldProps:{schemaPath:A}}=p(),u=Z(),{i18n:_,t:r}=ie(),[b,K]=ne(s=>s+1,0),[a]=ce(()=>j({collectionSlug:g})),M=se(),w=ee({slug:"lexical-upload-drawer-"+z+M,depth:B}),{toggleDrawer:O}=x(w,!0),{closeDocumentDrawer:D,DocumentDrawer:W,DocumentDrawerToggler:H}=N({id:c,collectionSlug:a.slug}),[{data:o},{setParams:v}]=le(`${F}${U}/${a.slug}/${c}`,{initialParams:P}),C=o?.thumbnailURL||o?.url,q=f(()=>{i.update(()=>{L(l)?.remove()})},[i,l]),G=f(s=>{v({...P,cacheBust:b}),K(),D()},[v,b,D]),$=k?.resolvedFeatureMap?.get("upload")?.sanitizedClientFeatureProps.collections?.[a.slug]?.hasExtraFields,J=f((s,V)=>{i.update(()=>{let m=L(l);if(m){let X={...m.getData(),fields:V};m.setData(X)}})},[i,l]),Q=C&&o?.width&&o?.height?o.width>o.height?"landscape":"portrait":"landscape";return n("div",{className:`${e} ${e}--${Q}`,"data-filename":o?.filename,ref:I,children:[n("div",{className:`${e}__card`,children:[n("div",{className:`${e}__media`,children:[t(te,{collectionSlug:g,fileSrc:re(o?.mimeType)?C:null,height:o?.height,size:"none",width:o?.width}),u&&t("div",{className:`${e}__overlay ${e}__floater`,children:n("div",{className:`${e}__actions`,role:"toolbar",children:[$?t(h,{buttonStyle:"icon-label",className:`${e}__upload-drawer-toggler`,disabled:!u,el:"button",icon:"edit",onClick:O,round:!0,size:"medium",tooltip:r("fields:editRelationship")}):null,t(h,{buttonStyle:"icon-label",className:`${e}__swap-drawer-toggler`,disabled:!u,el:"button",icon:"swap",onClick:()=>{i.dispatchCommand(R,{replace:{nodeKey:l}})},round:!0,size:"medium",tooltip:r("fields:swapUpload")}),t(h,{buttonStyle:"icon-label",className:`${e}__removeButton`,disabled:!u,icon:"x",onClick:s=>{s.preventDefault(),q()},round:!0,size:"medium",tooltip:r("fields:removeUpload")})]})})]}),n("div",{className:`${e}__metaOverlay ${e}__floater`,children:[t(H,{className:`${e}__doc-drawer-toggler`,children:t("strong",{className:`${e}__filename`,children:o?.filename||r("general:untitled")})}),t("div",{className:`${e}__collectionLabel`,children:E(a.labels.singular,_)})]})]}),c?t(W,{onSave:G}):null,$?t(S,{data:T,drawerSlug:w,drawerTitle:r("general:editLabel",{label:E(a.labels.singular,_)}),featureKey:"upload",handleDrawerSubmit:J,schemaPath:A,schemaPathSuffix:a.slug}):null]})},ye=d=>t(y,{...d,uploads:!0,children:t(ue,{...d})});export{ye as UploadComponent};
2
+ //# sourceMappingURL=component-CYFKY3IL.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/features/upload/client/component/index.tsx"],
4
+ "sourcesContent": ["'use client'\nimport type { ClientCollectionConfig, Data, FormState, JsonObject } from 'payload'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n formatDrawerSlug,\n Thumbnail,\n useConfig,\n useEditDepth,\n usePayloadAPI,\n useTranslation,\n} from '@payloadcms/ui'\nimport { $getNodeByKey, type ElementFormatType } from 'lexical'\nimport { isImage } from 'payload/shared'\nimport React, { useCallback, useId, useReducer, useRef, useState } from 'react'\n\nimport type { BaseClientFeatureProps } from '../../../typesClient.js'\nimport type { UploadData } from '../../server/nodes/UploadNode.js'\nimport type { UploadFeaturePropsClient } from '../index.js'\nimport type { UploadNode } from '../nodes/UploadNode.js'\n\nimport { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js'\nimport { FieldsDrawer } from '../../../../utilities/fieldsDrawer/Drawer.js'\nimport { useLexicalDocumentDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDocumentDrawer.js'\nimport { useLexicalDrawer } from '../../../../utilities/fieldsDrawer/useLexicalDrawer.js'\nimport { EnabledRelationshipsCondition } from '../../../relationship/client/utils/EnabledRelationshipsCondition.js'\nimport './index.scss'\nimport { INSERT_UPLOAD_WITH_DRAWER_COMMAND } from '../drawer/commands.js'\n\nconst baseClass = 'lexical-upload'\n\nconst initialParams = {\n depth: 0,\n}\n\nexport type ElementProps = {\n data: UploadData\n format?: ElementFormatType\n nodeKey: string\n}\n\nconst Component: React.FC<ElementProps> = (props) => {\n const {\n data: { fields, relationTo, value },\n nodeKey,\n } = props\n\n if (typeof value === 'object') {\n throw new Error(\n 'Upload value should be a string or number. The Lexical Upload component should not receive the populated value object.',\n )\n }\n\n const {\n config: {\n routes: { api },\n serverURL,\n },\n getEntityConfig,\n } = useConfig()\n const uploadRef = useRef<HTMLDivElement | null>(null)\n const { uuid } = useEditorConfigContext()\n const editDepth = useEditDepth()\n const [editor] = useLexicalComposerContext()\n\n const {\n editorConfig,\n fieldProps: { schemaPath },\n } = useEditorConfigContext()\n const isEditable = useLexicalEditable()\n const { i18n, t } = useTranslation()\n const [cacheBust, dispatchCacheBust] = useReducer((state) => state + 1, 0)\n const [relatedCollection] = useState<ClientCollectionConfig>(() =>\n getEntityConfig({ collectionSlug: relationTo }),\n )\n\n const componentID = useId()\n\n const extraFieldsDrawerSlug = formatDrawerSlug({\n slug: `lexical-upload-drawer-` + uuid + componentID, // There can be multiple upload components, each with their own drawer, in one single editor => separate them by componentID\n depth: editDepth,\n })\n\n // Need to use hook to initialize useEffect that restores cursor position\n const { toggleDrawer } = useLexicalDrawer(extraFieldsDrawerSlug, true)\n\n const { closeDocumentDrawer, DocumentDrawer, DocumentDrawerToggler } = useLexicalDocumentDrawer({\n id: value,\n collectionSlug: relatedCollection.slug,\n })\n\n // Get the referenced document\n const [{ data }, { setParams }] = usePayloadAPI(\n `${serverURL}${api}/${relatedCollection.slug}/${value}`,\n { initialParams },\n )\n\n const thumbnailSRC = data?.thumbnailURL || data?.url\n\n const removeUpload = useCallback(() => {\n editor.update(() => {\n $getNodeByKey(nodeKey)?.remove()\n })\n }, [editor, nodeKey])\n\n const updateUpload = useCallback(\n (data: Data) => {\n setParams({\n ...initialParams,\n cacheBust, // do this to get the usePayloadAPI to re-fetch the data even though the URL string hasn't changed\n })\n\n dispatchCacheBust()\n closeDocumentDrawer()\n },\n [setParams, cacheBust, closeDocumentDrawer],\n )\n\n const hasExtraFields = (\n editorConfig?.resolvedFeatureMap?.get('upload')\n ?.sanitizedClientFeatureProps as BaseClientFeatureProps<UploadFeaturePropsClient>\n ).collections?.[relatedCollection.slug]?.hasExtraFields\n\n const onExtraFieldsDrawerSubmit = useCallback(\n (_: FormState, data: JsonObject) => {\n // Update lexical node (with key nodeKey) with new data\n editor.update(() => {\n const uploadNode: null | UploadNode = $getNodeByKey(nodeKey)\n if (uploadNode) {\n const newData: UploadData = {\n ...uploadNode.getData(),\n fields: data,\n }\n uploadNode.setData(newData)\n }\n })\n },\n [editor, nodeKey],\n )\n\n const aspectRatio =\n thumbnailSRC && data?.width && data?.height\n ? data.width > data.height\n ? 'landscape'\n : 'portrait'\n : 'landscape'\n\n return (\n <div\n className={`${baseClass} ${baseClass}--${aspectRatio}`}\n data-filename={data?.filename}\n ref={uploadRef}\n >\n <div className={`${baseClass}__card`}>\n <div className={`${baseClass}__media`}>\n <Thumbnail\n collectionSlug={relationTo}\n fileSrc={isImage(data?.mimeType) ? thumbnailSRC : null}\n height={data?.height}\n size=\"none\"\n width={data?.width}\n />\n\n {isEditable && (\n <div className={`${baseClass}__overlay ${baseClass}__floater`}>\n <div className={`${baseClass}__actions`} role=\"toolbar\">\n {hasExtraFields ? (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__upload-drawer-toggler`}\n disabled={!isEditable}\n el=\"button\"\n icon=\"edit\"\n onClick={toggleDrawer}\n round\n size=\"medium\"\n tooltip={t('fields:editRelationship')}\n />\n ) : null}\n\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__swap-drawer-toggler`}\n disabled={!isEditable}\n el=\"button\"\n icon=\"swap\"\n onClick={() => {\n editor.dispatchCommand(INSERT_UPLOAD_WITH_DRAWER_COMMAND, {\n replace: { nodeKey },\n })\n }}\n round\n size=\"medium\"\n tooltip={t('fields:swapUpload')}\n />\n\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__removeButton`}\n disabled={!isEditable}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n removeUpload()\n }}\n round\n size=\"medium\"\n tooltip={t('fields:removeUpload')}\n />\n </div>\n </div>\n )}\n </div>\n\n <div className={`${baseClass}__metaOverlay ${baseClass}__floater`}>\n <DocumentDrawerToggler className={`${baseClass}__doc-drawer-toggler`}>\n <strong className={`${baseClass}__filename`}>\n {data?.filename || t('general:untitled')}\n </strong>\n </DocumentDrawerToggler>\n <div className={`${baseClass}__collectionLabel`}>\n {getTranslation(relatedCollection.labels.singular, i18n)}\n </div>\n </div>\n </div>\n\n {value ? <DocumentDrawer onSave={updateUpload} /> : null}\n {hasExtraFields ? (\n <FieldsDrawer\n data={fields}\n drawerSlug={extraFieldsDrawerSlug}\n drawerTitle={t('general:editLabel', {\n label: getTranslation(relatedCollection.labels.singular, i18n),\n })}\n featureKey=\"upload\"\n handleDrawerSubmit={onExtraFieldsDrawerSubmit}\n schemaPath={schemaPath}\n schemaPathSuffix={relatedCollection.slug}\n />\n ) : null}\n </div>\n )\n}\n\nexport const UploadComponent = (props: ElementProps): React.ReactNode => {\n return (\n <EnabledRelationshipsCondition {...props} uploads>\n <Component {...props} />\n </EnabledRelationshipsCondition>\n )\n}\n"],
5
+ "mappings": "6OAGA,OAASA,6BAAAA,MAAiC,2CAC1C,OAASC,sBAAAA,MAA0B,oCACnC,OAASC,kBAAAA,MAAsB,2BAC/B,OACEC,UAAAA,EACAC,oBAAAA,GACAC,aAAAA,GACAC,aAAAA,GACAC,gBAAAA,GACAC,iBAAAA,GACAC,kBAAAA,OACK,iBACP,OAASC,iBAAAA,MAA6C,UACtD,OAASC,WAAAA,OAAe,iBACxB,OAAgBC,eAAAA,EAAaC,SAAAA,GAAOC,cAAAA,GAAYC,UAAAA,GAAQC,YAAAA,OAAgB,QAexE,IAAMC,EAAY,iBAEZC,EAAgB,CACpBC,MAAO,CACT,EAQMC,GAAqCC,GAAA,CACzC,GAAM,CACJC,KAAM,CAAEC,OAAAA,EAAQC,WAAAA,EAAYC,MAAAA,CAAK,EACjCC,QAAAA,CAAO,EACLL,EAEJ,GAAI,OAAOI,GAAU,SACnB,MAAM,IAAIE,MACR,wHAAA,EAIJ,GAAM,CACJC,OAAQ,CACNC,OAAQ,CAAEC,IAAAA,CAAG,EACbC,UAAAA,CA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AW,GAAG9E,CAAA,wBACd0F,SAAU,CAAC9D,EACX+D,GAAG,SACHC,KAAK,OACLC,QAASA,IAAA,CACPtE,EAAOyE,gBAAgBC,EAAmC,CACxDC,QAAS,CAAEzF,QAAAA,CAAQ,CACrB,CAAA,CACF,EACAqF,MAAK,GACLR,KAAK,SACLS,QAAShE,EAAE,mBAAA,IAGbkD,EAACO,EAAA,CACCC,YAAY,aACZX,UAAW,GAAG9E,CAAA,iBACd0F,SAAU,CAAC9D,EACXgE,KAAK,IACLC,QAAUM,GAAA,CACRA,EAAEC,eAAc,EAChB3C,EAAA,CACF,EACAqC,MAAK,GACLR,KAAK,SACLS,QAAShE,EAAE,qBAAA,YAOrB8C,EAAC,MAAA,CAAIC,UAAW,GAAG9E,CAAA,iBAA0BA,CAAA,sBAC3CiF,EAAChC,EAAA,CAAsB6B,UAAW,GAAG9E,CAAA,gCACnCiF,EAAC,SAAA,CAAOH,UAAW,GAAG9E,CAAA,sBACnBK,GAAM0E,UAAYhD,EAAE,kBAAA,MAGzBkD,EAAC,MAAA,CAAIH,UAAW,GAAG9E,CAAA,6BAChBqG,EAAehE,EAAkBiE,OAAOC,SAAUzE,CAAA,UAKxDtB,EAAQyE,EAACjC,EAAA,CAAewD,OAAQ1C,IAAmB,KACnDC,EACCkB,EAACwB,EAAA,CACCpG,KAAMC,EACNoG,WAAYhE,EACZiE,YAAa5E,EAAE,oBAAqB,CAClC6E,MAAOP,EAAehE,EAAkBiE,OAAOC,SAAUzE,CAAA,CAC3D,CAAA,EACA+E,WAAW,SACXC,mBAAoB1C,EACpBzC,WAAYA,EACZoF,iBAAkB1E,EAAkBO,OAEpC,IAAA,GAGV,EAEaoE,GAAmB5G,GAE5B6E,EAACgC,EAAA,CAA+B,GAAG7G,EAAO8G,QAAO,YAC/CjC,EAAC9E,GAAA,CAAW,GAAGC",
6
+ "names": ["useLexicalComposerContext", "useLexicalEditable", "getTranslation", "Button", "formatDrawerSlug", "Thumbnail", "useConfig", "useEditDepth", "usePayloadAPI", "useTranslation", "$getNodeByKey", "isImage", "useCallback", "useId", "useReducer", "useRef", "useState", "baseClass", "initialParams", "depth", "Component", "props", "data", "fields", "relationTo", "value", "nodeKey", "Error", "config", "routes", "api", "serverURL", "getEntityConfig", "useConfig", "uploadRef", "useRef", "uuid", "useEditorConfigContext", "editDepth", "useEditDepth", "editor", "useLexicalComposerContext", "editorConfig", "fieldProps", "schemaPath", "isEditable", "useLexicalEditable", "i18n", "t", "useTranslation", "cacheBust", "dispatchCacheBust", "useReducer", "state", "relatedCollection", "useState", "collectionSlug", "componentID", "useId", "extraFieldsDrawerSlug", "formatDrawerSlug", "slug", "toggleDrawer", "useLexicalDrawer", "closeDocumentDrawer", "DocumentDrawer", "DocumentDrawerToggler", "useLexicalDocumentDrawer", "id", "setParams", "usePayloadAPI", "thumbnailSRC", "thumbnailURL", "url", "removeUpload", "useCallback", "update", "$getNodeByKey", "remove", "updateUpload", "hasExtraFields", "resolvedFeatureMap", "get", "sanitizedClientFeatureProps", "collections", "onExtraFieldsDrawerSubmit", "_", "uploadNode", "newData", "getData", "setData", "aspectRatio", "width", "height", "_jsxs", "className", "filename", "ref", "_jsx", "Thumbnail", "fileSrc", "isImage", "mimeType", "size", "role", "Button", "buttonStyle", "disabled", "el", "icon", "onClick", "round", "tooltip", "dispatchCommand", "INSERT_UPLOAD_WITH_DRAWER_COMMAND", "replace", "e", "preventDefault", "getTranslation", "labels", "singular", "onSave", "FieldsDrawer", "drawerSlug", "drawerTitle", "label", "featureKey", "handleDrawerSubmit", "schemaPathSuffix", "UploadComponent", "EnabledRelationshipsCondition", "uploads"]
7
+ }
@@ -0,0 +1,2 @@
1
+ "use client";import{a,b}from"./chunk-XNERFY6G.js";import"./chunk-INBEEENE.js";import"./chunk-BZZVLW4U.js";export{b as InlineBlockComponent,a as useInlineBlockComponentContext};
2
+ //# sourceMappingURL=componentInline-NGTRUSGB.js.map
@@ -75,6 +75,9 @@ export { BlockEditButton } from '../../features/blocks/client/component/componen
75
75
  export { BlockRemoveButton } from '../../features/blocks/client/component/components/BlockRemoveButton.js';
76
76
  export { useBlockComponentContext } from '../../features/blocks/client/component/BlockContent.js';
77
77
  export { getRestPopulateFn } from '../../features/converters/utilities/restPopulateFn.js';
78
+ export { codeConverterClient } from '../../features/blocks/premade/CodeBlock/converterClient.js';
79
+ export { CodeComponent } from '../../features/blocks/premade/CodeBlock/Component/Code.js';
80
+ export { CodeBlockBlockComponent } from '../../features/blocks/premade/CodeBlock/Component/Block.js';
78
81
  export { RenderLexical } from '../../field/RenderLexical/index.js';
79
82
  export { buildEditorState } from '../../utilities/buildEditorState.js';
80
83
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/exports/client/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,4BAA4B,EAAE,MAAM,+CAA+C,CAAA;AAE5F,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAA;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAA;AACnF,OAAO,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAA;AAC3E,OAAO,EACL,oBAAoB,EACpB,2BAA2B,GAC5B,MAAM,iDAAiD,CAAA;AAExD,OAAO,EAAE,yBAAyB,EAAE,MAAM,mDAAmD,CAAA;AAC7F,OAAO,EAAE,qBAAqB,EAAE,MAAM,+CAA+C,CAAA;AACrF,OAAO,EAAE,iBAAiB,EAAE,MAAM,8CAA8C,CAAA;AAChF,OAAO,EAAE,uBAAuB,EAAE,MAAM,oDAAoD,CAAA;AAC5F,OAAO,EAAE,mBAAmB,EAAE,MAAM,gDAAgD,CAAA;AACpF,OAAO,EAAE,0BAA0B,EAAE,MAAM,uDAAuD,CAAA;AAClG,OAAO,EAAE,sBAAsB,EAAE,MAAM,mDAAmD,CAAA;AAC1F,OAAO,EAAE,wBAAwB,EAAE,MAAM,qDAAqD,CAAA;AAC9F,OAAO,EAAE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