@payloadcms/richtext-lexical 3.53.0-canary.2 → 3.53.0-canary.4

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.
@@ -0,0 +1,2 @@
1
+ "use client";import{a as S,b as R,c as $}from"./chunk-FSKAVN4P.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 e,jsxs as s}from"react/jsx-runtime";import{useLexicalComposerContext as X}from"@lexical/react/LexicalComposerContext.js";import{getTranslation as y}from"@payloadcms/translations";import{Button as h,formatDrawerSlug as Y,Thumbnail as Z,useConfig as ee,useEditDepth as te,usePayloadAPI as oe,useTranslation as ae}from"@payloadcms/ui";import{$getNodeByKey as E}from"lexical";import{isImage as le}from"payload/shared";import{useCallback as f,useId as re,useReducer as se,useRef as ie,useState as ne}from"react";var t="lexical-upload",P={depth:0},ce=i=>{let{data:{fields:T,relationTo:g,value:n},nodeKey:l}=i;if(typeof n=="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:L},getEntityConfig:F}=ee(),j=ie(null),{uuid:I}=p(),B=te(),[o]=X(),{editorConfig:k,fieldProps:{readOnly:u,schemaPath:A}}=p(),{i18n:b,t:c}=ae(),[_,K]=se(r=>r+1,0),[a]=ne(()=>F({collectionSlug:g})),M=re(),w=Y({slug:"lexical-upload-drawer-"+I+M,depth:B}),{toggleDrawer:O}=x(w,!0),{closeDocumentDrawer:D,DocumentDrawer:W,DocumentDrawerToggler:z}=N({id:n,collectionSlug:a.slug}),[{data:d},{setParams:C}]=oe(`${L}${U}/${a.slug}/${n}`,{initialParams:P}),H=d?.thumbnailURL||d?.url,q=f(()=>{o.update(()=>{E(l)?.remove()})},[o,l]),G=f(r=>{C({...P,cacheBust:_}),K(),D()},[C,_,D]),v=k?.resolvedFeatureMap?.get("upload")?.sanitizedClientFeatureProps.collections?.[a.slug]?.hasExtraFields,J=f((r,Q)=>{o.update(()=>{let m=E(l);if(m){let V={...m.getData(),fields:Q};m.setData(V)}})},[o,l]);return s("div",{className:t,contentEditable:!1,ref:j,children:[s("div",{className:`${t}__card`,children:[s("div",{className:`${t}__topRow`,children:[e("div",{className:`${t}__thumbnail`,children:e(Z,{collectionSlug:g,fileSrc:le(d?.mimeType)?H:null})}),s("div",{className:`${t}__topRowRightPanel`,children:[e("div",{className:`${t}__collectionLabel`,children:y(a.labels.singular,b)}),o.isEditable()&&s("div",{className:`${t}__actions`,children:[v?e(h,{buttonStyle:"icon-label",className:`${t}__upload-drawer-toggler`,disabled:u,el:"button",icon:"edit",onClick:()=>{O()},round:!0,tooltip:c("fields:editRelationship")}):null,e(h,{buttonStyle:"icon-label",className:`${t}__swap-drawer-toggler`,disabled:u,el:"button",icon:"swap",onClick:()=>{o.dispatchCommand($,{replace:{nodeKey:l}})},round:!0,tooltip:c("fields:swapUpload")}),e(h,{buttonStyle:"icon-label",className:`${t}__removeButton`,disabled:u,icon:"x",onClick:r=>{r.preventDefault(),q()},round:!0,tooltip:c("fields:removeUpload")})]})]})]}),e("div",{className:`${t}__bottomRow`,children:e(z,{className:`${t}__doc-drawer-toggler`,children:e("strong",{children:d?.filename})})})]}),n?e(W,{onSave:G}):null,v?e(S,{data:T,drawerSlug:w,drawerTitle:c("general:editLabel",{label:y(a.labels.singular,b)}),featureKey:"upload",handleDrawerSubmit:J,schemaPath:A,schemaPathSuffix:a.slug}):null]})},Se=i=>e(R,{...i,uploads:!0,children:e(ce,{...i})});export{Se as UploadComponent};
2
+ //# sourceMappingURL=component-M3U253XK.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 { 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 } 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 { INSERT_UPLOAD_WITH_DRAWER_COMMAND } from '../drawer/commands.js'\nimport './index.scss'\n\nconst baseClass = 'lexical-upload'\n\nconst initialParams = {\n depth: 0,\n}\n\nexport type ElementProps = {\n data: UploadData\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: { readOnly, schemaPath },\n } = useEditorConfigContext()\n\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 return (\n <div className={baseClass} contentEditable={false} ref={uploadRef}>\n <div className={`${baseClass}__card`}>\n <div className={`${baseClass}__topRow`}>\n <div className={`${baseClass}__thumbnail`}>\n <Thumbnail\n collectionSlug={relationTo}\n fileSrc={isImage(data?.mimeType) ? thumbnailSRC : null}\n />\n </div>\n <div className={`${baseClass}__topRowRightPanel`}>\n <div className={`${baseClass}__collectionLabel`}>\n {getTranslation(relatedCollection.labels.singular, i18n)}\n </div>\n {editor.isEditable() && (\n <div className={`${baseClass}__actions`}>\n {hasExtraFields ? (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__upload-drawer-toggler`}\n disabled={readOnly}\n el=\"button\"\n icon=\"edit\"\n onClick={() => {\n toggleDrawer()\n }}\n round\n tooltip={t('fields:editRelationship')}\n />\n ) : null}\n\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__swap-drawer-toggler`}\n disabled={readOnly}\n el=\"button\"\n icon=\"swap\"\n onClick={() => {\n editor.dispatchCommand(INSERT_UPLOAD_WITH_DRAWER_COMMAND, {\n replace: { nodeKey },\n })\n }}\n round\n tooltip={t('fields:swapUpload')}\n />\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__removeButton`}\n disabled={readOnly}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n removeUpload()\n }}\n round\n tooltip={t('fields:removeUpload')}\n />\n </div>\n )}\n </div>\n </div>\n <div className={`${baseClass}__bottomRow`}>\n <DocumentDrawerToggler className={`${baseClass}__doc-drawer-toggler`}>\n <strong>{data?.filename}</strong>\n </DocumentDrawerToggler>\n </div>\n </div>\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": "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",
6
+ "names": ["useLexicalComposerContext", "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", "readOnly", "schemaPath", "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", "_jsxs", "className", "contentEditable", "ref", "_jsx", "Thumbnail", "fileSrc", "isImage", "mimeType", "getTranslation", "labels", "singular", "isEditable", "Button", "buttonStyle", "disabled", "el", "icon", "onClick", "round", "tooltip", "dispatchCommand", "INSERT_UPLOAD_WITH_DRAWER_COMMAND", "replace", "e", "preventDefault", "filename", "onSave", "FieldsDrawer", "drawerSlug", "drawerTitle", "label", "featureKey", "handleDrawerSubmit", "schemaPathSuffix", "UploadComponent", "EnabledRelationshipsCondition", "uploads"]
7
+ }
@@ -37,5 +37,5 @@ ${e.map(Pc).join(`
37
37
 
38
38
  `,Pi="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",Bi="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",Pp=new RegExp("^[^"+Bi+"]*["+Pi+"]"),Bp=new RegExp("^[^"+Pi+"]*["+Bi+"]"),Hp={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},jp={directionless:A.IS_DIRECTIONLESS,unmergeable:A.IS_UNMERGEABLE},Up={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},Gp={[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"},Wp={normal:A.IS_NORMAL,segmented:A.IS_SEGMENTED,token:A.IS_TOKEN},Vp={[A.IS_NORMAL]:"normal",[A.IS_SEGMENTED]:"segmented",[A.IS_TOKEN]:"token"};var Hi={text:({node:t})=>{let e=t.text;return t.format&A.IS_BOLD&&(e=He("strong",{children:e})),t.format&A.IS_ITALIC&&(e=He("em",{children:e})),t.format&A.IS_STRIKETHROUGH&&(e=He("span",{style:{textDecoration:"line-through"},children:e})),t.format&A.IS_UNDERLINE&&(e=He("span",{style:{textDecoration:"underline"},children:e})),t.format&A.IS_CODE&&(e=He("code",{children:e})),t.format&A.IS_SUBSCRIPT&&(e=He("sub",{children:e})),t.format&A.IS_SUPERSCRIPT&&(e=He("sup",{children:e})),e}};import{jsx as Nt}from"react/jsx-runtime";var ji={upload:({node:t})=>{let e=t;if(typeof e.value!="object")return null;let o=e.value,r=o.url;if(!o.mimeType.startsWith("image"))return Nt("a",{href:r,rel:"noopener noreferrer",children:o.filename});if(!o.sizes||!Object.keys(o.sizes).length)return Nt("img",{alt:o.filename,height:o.height,src:r,width:o.width});let n=[];for(let l in o.sizes){let i=o.sizes[l];if(!i||!i.width||!i.height||!i.mimeType||!i.filesize||!i.filename||!i.url)continue;let s=i?.url;n.push(Nt("source",{media:`(max-width: ${i.width}px)`,srcSet:s,type:i.mimeType},l))}return n.push(Nt("img",{alt:o?.filename,height:o?.height,src:r,width:o?.width},"image")),Nt("picture",{children:n})}};var tt={...Oi,...Hi,...vi,...yi,...Fi,...Ii,...Ri,...Ai,...Di({}),...ji,...$i};import{jsx as Gi,Fragment as Kp}from"react/jsx-runtime";import lr from"react";function Ui(t){let e=!!t?.root?.children?.length,o=!1;if(t?.root?.children?.length===1&&t?.root?.children[0]?.type==="paragraph"){let r=t?.root?.children[0];if(!r?.children||r?.children?.length===0)o=!0;else if(r?.children?.length===1){let n=r?.children[0];n?.type==="text"&&(n?.text?.length||(o=!0))}}return!(!e||o)}function Wi({converters:t,data:e,disableIndent:o,disableTextAlign:r}){return Ui(e)?Vi({converters:t,disableIndent:o,disableTextAlign:r,nodes:e?.root?.children,parent:e?.root}):Gi(Kp,{})}function Vi({converters:t,disableIndent:e,disableTextAlign:o,nodes:r,parent:n}){let l=t.unknown;return r.map((s,c)=>{let u;s.type==="block"?(u=t?.blocks?.[s?.fields?.blockType],!u&&!l&&console.error(`Lexical => JSX converter: Blocks converter: found ${s?.fields?.blockType} block, but no converter is provided`)):s.type==="inlineBlock"?(u=t?.inlineBlocks?.[s?.fields?.blockType],!u&&!l&&console.error(`Lexical => JSX converter: Inline Blocks converter: found ${s?.fields?.blockType} inline block, but no converter is provided`)):u=t[s.type];try{!u&&l&&(u=l);let d;u?d=typeof u=="function"?u({childIndex:c,converters:t,node:s,nodesToJSX:m=>Vi({converters:m.converters??t,disableIndent:m.disableIndent??e,disableTextAlign:m.disableTextAlign??o,nodes:m.nodes,parent:m.parent??{...s,parent:n}}),parent:n}):u:d=Gi("span",{children:"unknown node"},c);let a={};if(!o&&(!Array.isArray(o)||!o?.includes(s.type))&&"format"in s&&s.format)switch(s.format){case"center":a.textAlign="center";break;case"end":a.textAlign="right";break;case"justify":a.textAlign="justify";break;case"left":break;case"right":a.textAlign="right";break;case"start":a.textAlign="left";break}if(!e&&(!Array.isArray(e)||!e?.includes(s.type))&&"indent"in s&&s.indent&&s.type!=="listitem"&&(a.paddingInlineStart=`${Number(s.indent)*40}px`),lr.isValidElement(d)){if(a.textAlign||a.paddingInlineStart){let p={...a,...d?.props?.style??{}};return lr.cloneElement(d,{key:c,style:p})}return lr.cloneElement(d,{key:c})}return d}catch(d){return console.error("Error converting lexical node to JSX:",d,"node:",s),null}}).filter(Boolean)}var ir=({className:t,converters:e,data:o,disableContainer:r,disableIndent:n,disableTextAlign:l})=>{if(!o)return null;let i={};e?typeof e=="function"?i=e({defaultConverters:tt}):i=e:i=tt;let s=o&&!Array.isArray(o)&&typeof o=="object"&&"root"in o&&Wi({converters:i,data:o,disableIndent:n,disableTextAlign:l});return r?Ki(Jp,{children:s}):Ki("div",{className:t??"payload-richtext",children:s})};function Xi(){let t=Xp(7),[e]=zp(),o;t[0]!==e?(o=e.getEditorState().toJSON(),t[0]=e,t[1]=o):o=t[1];let[r,n]=Yp(o),l,i;t[2]!==e?(l=()=>e.registerUpdateListener(c=>{let{editorState:u}=c;n(u.toJSON())}),i=[e],t[2]=e,t[3]=l,t[4]=i):(l=t[3],i=t[4]),Zp(l,i);let s;return t[5]!==r?(s=Ji("div",{className:"debug-jsx-converter",children:Ji(ir,{converters:tt,data:r})}),t[5]=r,t[6]=s):s=t[6],s}var qp=y({plugins:[{Component:Xi,position:"bottom"}]});var B={amber:{50:"oklch(0.987 0.022 95.277)",100:"oklch(0.962 0.059 95.617)",200:"oklch(0.924 0.12 95.746)",300:"oklch(0.879 0.169 91.605)",400:"oklch(0.828 0.189 84.429)",500:"oklch(0.769 0.188 70.08)",600:"oklch(0.666 0.179 58.318)",700:"oklch(0.555 0.163 48.998)",800:"oklch(0.473 0.137 46.201)",900:"oklch(0.414 0.112 45.904)",950:"oklch(0.279 0.077 45.635)"},black:"#000",blue:{50:"oklch(0.97 0.014 254.604)",100:"oklch(0.932 0.032 255.585)",200:"oklch(0.882 0.059 254.128)",300:"oklch(0.809 0.105 251.813)",400:"oklch(0.707 0.165 254.624)",500:"oklch(0.623 0.214 259.815)",600:"oklch(0.546 0.245 262.881)",700:"oklch(0.488 0.243 264.376)",800:"oklch(0.424 0.199 265.638)",900:"oklch(0.379 0.146 265.522)",950:"oklch(0.282 0.091 267.935)"},current:"currentColor",cyan:{50:"oklch(0.984 0.019 200.873)",100:"oklch(0.956 0.045 203.388)",200:"oklch(0.917 0.08 205.041)",300:"oklch(0.865 0.127 207.078)",400:"oklch(0.789 0.154 211.53)",500:"oklch(0.715 0.143 215.221)",600:"oklch(0.609 0.126 221.723)",700:"oklch(0.52 0.105 223.128)",800:"oklch(0.45 0.085 224.283)",900:"oklch(0.398 0.07 227.392)",950:"oklch(0.302 0.056 229.695)"},emerald:{50:"oklch(0.979 0.021 166.113)",100:"oklch(0.95 0.052 163.051)",200:"oklch(0.905 0.093 164.15)",300:"oklch(0.845 0.143 164.978)",400:"oklch(0.765 0.177 163.223)",500:"oklch(0.696 0.17 162.48)",600:"oklch(0.596 0.145 163.225)",700:"oklch(0.508 0.118 165.612)",800:"oklch(0.432 0.095 166.913)",900:"oklch(0.378 0.077 168.94)",950:"oklch(0.262 0.051 172.552)"},fuchsia:{50:"oklch(0.977 0.017 320.058)",100:"oklch(0.952 0.037 318.852)",200:"oklch(0.903 0.076 319.62)",300:"oklch(0.833 0.145 321.434)",400:"oklch(0.74 0.238 322.16)",500:"oklch(0.667 0.295 322.15)",600:"oklch(0.591 0.293 322.896)",700:"oklch(0.518 0.253 323.949)",800:"oklch(0.452 0.211 324.591)",900:"oklch(0.401 0.17 325.612)",950:"oklch(0.293 0.136 325.661)"},gray:{50:"oklch(0.985 0.002 247.839)",100:"oklch(0.967 0.003 264.542)",200:"oklch(0.928 0.006 264.531)",300:"oklch(0.872 0.01 258.338)",400:"oklch(0.707 0.022 261.325)",500:"oklch(0.551 0.027 264.364)",600:"oklch(0.446 0.03 256.802)",700:"oklch(0.373 0.034 259.733)",800:"oklch(0.278 0.033 256.848)",900:"oklch(0.21 0.034 264.665)",950:"oklch(0.13 0.028 261.692)"},green:{50:"oklch(0.982 0.018 155.826)",100:"oklch(0.962 0.044 156.743)",200:"oklch(0.925 0.084 155.995)",300:"oklch(0.871 0.15 154.449)",400:"oklch(0.792 0.209 151.711)",500:"oklch(0.723 0.219 149.579)",600:"oklch(0.627 0.194 149.214)",700:"oklch(0.527 0.154 150.069)",800:"oklch(0.448 0.119 151.328)",900:"oklch(0.393 0.095 152.535)",950:"oklch(0.266 0.065 152.934)"},indigo:{50:"oklch(0.962 0.018 272.314)",100:"oklch(0.93 0.034 272.788)",200:"oklch(0.87 0.065 274.039)",300:"oklch(0.785 0.115 274.713)",400:"oklch(0.673 0.182 276.935)",500:"oklch(0.585 0.233 277.117)",600:"oklch(0.511 0.262 276.966)",700:"oklch(0.457 0.24 277.023)",800:"oklch(0.398 0.195 277.366)",900:"oklch(0.359 0.144 278.697)",950:"oklch(0.257 0.09 281.288)"},inherit:"inherit",lime:{50:"oklch(0.986 0.031 120.757)",100:"oklch(0.967 0.067 122.328)",200:"oklch(0.938 0.127 124.321)",300:"oklch(0.897 0.196 126.665)",400:"oklch(0.841 0.238 128.85)",500:"oklch(0.768 0.233 130.85)",600:"oklch(0.648 0.2 131.684)",700:"oklch(0.532 0.157 131.589)",800:"oklch(0.453 0.124 130.933)",900:"oklch(0.405 0.101 131.063)",950:"oklch(0.274 0.072 132.109)"},neutral:{50:"oklch(0.985 0 0)",100:"oklch(0.97 0 0)",200:"oklch(0.922 0 0)",300:"oklch(0.87 0 0)",400:"oklch(0.708 0 0)",500:"oklch(0.556 0 0)",600:"oklch(0.439 0 0)",700:"oklch(0.371 0 0)",800:"oklch(0.269 0 0)",900:"oklch(0.205 0 0)",950:"oklch(0.145 0 0)"},orange:{50:"oklch(0.98 0.016 73.684)",100:"oklch(0.954 0.038 75.164)",200:"oklch(0.901 0.076 70.697)",300:"oklch(0.837 0.128 66.29)",400:"oklch(0.75 0.183 55.934)",500:"oklch(0.705 0.213 47.604)",600:"oklch(0.646 0.222 41.116)",700:"oklch(0.553 0.195 38.402)",800:"oklch(0.47 0.157 37.304)",900:"oklch(0.408 0.123 38.172)",950:"oklch(0.266 0.079 36.259)"},pink:{50:"oklch(0.971 0.014 343.198)",100:"oklch(0.948 0.028 342.258)",200:"oklch(0.899 0.061 343.231)",300:"oklch(0.823 0.12 346.018)",400:"oklch(0.718 0.202 349.761)",500:"oklch(0.656 0.241 354.308)",600:"oklch(0.592 0.249 0.584)",700:"oklch(0.525 0.223 3.958)",800:"oklch(0.459 0.187 3.815)",900:"oklch(0.408 0.153 2.432)",950:"oklch(0.284 0.109 3.907)"},purple:{50:"oklch(0.977 0.014 308.299)",100:"oklch(0.946 0.033 307.174)",200:"oklch(0.902 0.063 306.703)",300:"oklch(0.827 0.119 306.383)",400:"oklch(0.714 0.203 305.504)",500:"oklch(0.627 0.265 303.9)",600:"oklch(0.558 0.288 302.321)",700:"oklch(0.496 0.265 301.924)",800:"oklch(0.438 0.218 303.724)",900:"oklch(0.381 0.176 304.987)",950:"oklch(0.291 0.149 302.717)"},red:{50:"oklch(0.971 0.013 17.38)",100:"oklch(0.936 0.032 17.717)",200:"oklch(0.885 0.062 18.334)",300:"oklch(0.808 0.114 19.571)",400:"oklch(0.704 0.191 22.216)",500:"oklch(0.637 0.237 25.331)",600:"oklch(0.577 0.245 27.325)",700:"oklch(0.505 0.213 27.518)",800:"oklch(0.444 0.177 26.899)",900:"oklch(0.396 0.141 25.723)",950:"oklch(0.258 0.092 26.042)"},rose:{50:"oklch(0.969 0.015 12.422)",100:"oklch(0.941 0.03 12.58)",200:"oklch(0.892 0.058 10.001)",300:"oklch(0.81 0.117 11.638)",400:"oklch(0.712 0.194 13.428)",500:"oklch(0.645 0.246 16.439)",600:"oklch(0.586 0.253 17.585)",700:"oklch(0.514 0.222 16.935)",800:"oklch(0.455 0.188 13.697)",900:"oklch(0.41 0.159 10.272)",950:"oklch(0.271 0.105 12.094)"},sky:{50:"oklch(0.977 0.013 236.62)",100:"oklch(0.951 0.026 236.824)",200:"oklch(0.901 0.058 230.902)",300:"oklch(0.828 0.111 230.318)",400:"oklch(0.746 0.16 232.661)",500:"oklch(0.685 0.169 237.323)",600:"oklch(0.588 0.158 241.966)",700:"oklch(0.5 0.134 242.749)",800:"oklch(0.443 0.11 240.79)",900:"oklch(0.391 0.09 240.876)",950:"oklch(0.293 0.066 243.157)"},slate:{50:"oklch(0.984 0.003 247.858)",100:"oklch(0.968 0.007 247.896)",200:"oklch(0.929 0.013 255.508)",300:"oklch(0.869 0.022 252.894)",400:"oklch(0.704 0.04 256.788)",500:"oklch(0.554 0.046 257.417)",600:"oklch(0.446 0.043 257.281)",700:"oklch(0.372 0.044 257.287)",800:"oklch(0.279 0.041 260.031)",900:"oklch(0.208 0.042 265.755)",950:"oklch(0.129 0.042 264.695)"},stone:{50:"oklch(0.985 0.001 106.423)",100:"oklch(0.97 0.001 106.424)",200:"oklch(0.923 0.003 48.717)",300:"oklch(0.869 0.005 56.366)",400:"oklch(0.709 0.01 56.259)",500:"oklch(0.553 0.013 58.071)",600:"oklch(0.444 0.011 73.639)",700:"oklch(0.374 0.01 67.558)",800:"oklch(0.268 0.007 34.298)",900:"oklch(0.216 0.006 56.043)",950:"oklch(0.147 0.004 49.25)"},teal:{50:"oklch(0.984 0.014 180.72)",100:"oklch(0.953 0.051 180.801)",200:"oklch(0.91 0.096 180.426)",300:"oklch(0.855 0.138 181.071)",400:"oklch(0.777 0.152 181.912)",500:"oklch(0.704 0.14 182.503)",600:"oklch(0.6 0.118 184.704)",700:"oklch(0.511 0.096 186.391)",800:"oklch(0.437 0.078 188.216)",900:"oklch(0.386 0.063 188.416)",950:"oklch(0.277 0.046 192.524)"},transparent:"transparent",violet:{50:"oklch(0.969 0.016 293.756)",100:"oklch(0.943 0.029 294.588)",200:"oklch(0.894 0.057 293.283)",300:"oklch(0.811 0.111 293.571)",400:"oklch(0.702 0.183 293.541)",500:"oklch(0.606 0.25 292.717)",600:"oklch(0.541 0.281 293.009)",700:"oklch(0.491 0.27 292.581)",800:"oklch(0.432 0.232 292.759)",900:"oklch(0.38 0.189 293.745)",950:"oklch(0.283 0.141 291.089)"},white:"#fff",yellow:{50:"oklch(0.987 0.026 102.212)",100:"oklch(0.973 0.071 103.193)",200:"oklch(0.945 0.129 101.54)",300:"oklch(0.905 0.182 98.111)",400:"oklch(0.852 0.199 91.936)",500:"oklch(0.795 0.184 86.047)",600:"oklch(0.681 0.162 75.834)",700:"oklch(0.554 0.135 66.442)",800:"oklch(0.476 0.114 61.907)",900:"oklch(0.421 0.095 57.708)",950:"oklch(0.286 0.066 53.813)"},zinc:{50:"oklch(0.985 0 0)",100:"oklch(0.967 0.001 286.375)",200:"oklch(0.92 0.004 286.32)",300:"oklch(0.871 0.006 286.286)",400:"oklch(0.705 0.015 286.067)",500:"oklch(0.552 0.016 285.938)",600:"oklch(0.442 0.017 285.786)",700:"oklch(0.37 0.013 285.805)",800:"oklch(0.274 0.006 286.033)",900:"oklch(0.21 0.006 285.885)",950:"oklch(0.141 0.005 285.823)"}},Qp={text:{"text-red":{css:{color:`light-dark(${B.red[600]}, ${B.red[400]})`},label:"Red"},"text-orange":{css:{color:`light-dark(${B.orange[600]}, ${B.orange[400]})`},label:"Orange"},"text-yellow":{css:{color:`light-dark(${B.yellow[700]}, ${B.yellow[300]})`},label:"Yellow"},"text-green":{css:{color:`light-dark(${B.green[700]}, ${B.green[400]})`},label:"Green"},"text-blue":{css:{color:`light-dark(${B.blue[600]}, ${B.blue[400]})`},label:"Blue"},"text-purple":{css:{color:`light-dark(${B.purple[600]}, ${B.purple[400]})`},label:"Purple"},"text-pink":{css:{color:`light-dark(${B.pink[600]}, ${B.pink[400]})`},label:"Pink"}},background:{"bg-red":{css:{"background-color":`light-dark(${B.red[400]}, ${B.red[600]})`},label:"Red"},"bg-orange":{css:{"background-color":`light-dark(${B.orange[400]}, ${B.orange[600]})`},label:"Orange"},"bg-yellow":{css:{"background-color":`light-dark(${B.yellow[300]}, ${B.yellow[700]})`},label:"Yellow"},"bg-green":{css:{"background-color":`light-dark(${B.green[400]}, ${B.green[700]})`},label:"Green"},"bg-blue":{css:{"background-color":`light-dark(${B.blue[400]}, ${B.blue[600]})`},label:"Blue"},"bg-purple":{css:{"background-color":`light-dark(${B.purple[400]}, ${B.purple[600]})`},label:"Purple"},"bg-pink":{css:{"background-color":`light-dark(${B.pink[400]}, ${B.pink[600]})`},label:"Pink"}}};import{$isNodeSelection as Pf}from"lexical";import{jsx as St,jsxs as ef}from"react/jsx-runtime";import"react";var sr=()=>ef("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:[St("g",{clipPath:"url(#clip0_4397_10817)",children:St("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"})}),St("defs",{children:St("clipPath",{id:"clip0_4397_10817",children:St("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{jsx as rf}from"react/jsx-runtime";import*as Zi from"react";import{DecoratorBlockNode as tf}from"@lexical/react/LexicalDecoratorBlockNode.js";function of(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:zi({relationTo:o,value:e})}:null}var Lt=class extends tf{__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:of,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},r=zi(o);return r.setFormat(e.format),r}static isInline(){return!1}decorate(e,o){return null}exportDOM(){let e=document.createElement("div");e.setAttribute("data-lexical-relationship-id",String(typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value)),e.setAttribute("data-lexical-relationship-relationTo",this.__data?.relationTo);let o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"relationship",version:2}}getData(){return this.getLatest().__data}getTextContent(){return`${this.__data?.relationTo} relation to ${typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value}`}setData(e){let o=this.getWritable();o.__data=e}};function zi(t){return new Lt({data:t})}var nf=Zi.lazy(()=>import("./RelationshipComponent-APF3CN47.js").then(t=>({default:t.RelationshipComponent})));function lf(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:je({relationTo:o,value:e})}:null}var Ne=class extends Lt{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:lf,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},r=je(o);return r.setFormat(e.format),r}decorate(e,o){return rf(nf,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function je(t){return new Ne({data:t})}function ar(t){return t instanceof Ne}import{c as Ef}from"react/compiler-runtime";import{jsx as Nf}from"react/jsx-runtime";import{useLexicalComposerContext as Sf}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Lf}from"@lexical/utils";import{useConfig as yf}from"@payloadcms/ui";import{$getPreviousSelection as If,$getSelection as Rf,$isParagraphNode as vf,$isRangeSelection as Mf,COMMAND_PRIORITY_EDITOR as Df,createCommand as Af}from"lexical";import{useEffect as Of}from"react";import{c as Cf}from"react/compiler-runtime";import{jsx as ro}from"react/jsx-runtime";import{useLexicalComposerContext as bf}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as kf,COMMAND_PRIORITY_EDITOR as _f}from"lexical";import{useEffect as Tf,useState as Qi}from"react";import{c as sf}from"react/compiler-runtime";import{jsx as af}from"react/jsx-runtime";import{useLexicalComposerContext as cf}from"@lexical/react/LexicalComposerContext";import{useListDrawer as uf,useModal as df}from"@payloadcms/ui";import{$getNodeByKey as Yi,$getPreviousSelection as mf,$getRoot as pf,$getSelection as ff,$isRangeSelection as hf,$setSelection as gf}from"lexical";import{useEffect as xf,useState as qi}from"react";var yt=t=>{let e=sf(23),[o]=cf(),[r,n]=qi(null),[l,i]=qi(!1),[s,c,u]=uf(t),{closeDrawer:d,drawerSlug:a,isDrawerOpen:p,openDrawer:m}=u,{modalState:f}=df(),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let F=ff()??mf();n(F)},e[0]=h):h=e[0];let x=h,b;e[1]!==o||e[2]!==r?(b=()=>{r&&o.update(()=>{if(hf(r)){let{anchor:F,focus:I}=r;Yi(F.key)&&Yi(I.key)&&gf(r.clone())}else pf().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=r,e[3]=b):b=e[3];let N=b,D;e[4]!==d?(D=()=>{d()},e[4]=d,e[5]=D):D=e[5];let k=D,_,g;e[6]!==a||e[7]!==f||e[8]!==N||e[9]!==l?(_=()=>{if(!l)return;let F=f[a];F&&!F?.isOpen&&(i(!1),setTimeout(()=>{N()},1))},g=[f,a,N,l],e[6]=a,e[7]=f,e[8]=N,e[9]=l,e[10]=_,e[11]=g):(_=e[10],g=e[11]),xf(_,g);let S;e[12]!==c?(S=F=>af(c,{...F,onClick:()=>{x()}}),e[12]=c,e[13]=S):S=e[13];let M;e[14]!==m?(M=()=>{x(),m(),i(!0)},e[14]=m,e[15]=M):M=e[15];let O;return e[16]!==s||e[17]!==k||e[18]!==p||e[19]!==a||e[20]!==S||e[21]!==M?(O={closeListDrawer:k,isListDrawerOpen:p,ListDrawer:s,listDrawerSlug:a,ListDrawerToggler:S,openListDrawer:M},e[16]=s,e[17]=k,e[18]=p,e[19]=a,e[20]=S,e[21]=M,e[22]=O):O=e[22],O};var wf=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=kf(o);n&&n.replace(je({relationTo:e,value:r}))}):t.dispatchCommand(cr,{relationTo:e,value:r})},es=t=>{let e=Cf(16),{enabledCollectionSlugs:o}=t,[r]=bf(),n;e[0]!==o?.[0]?(n=()=>o?.[0],e[0]=o?.[0],e[1]=n):n=e[1];let[l]=Qi(n),[i,s]=Qi(null),c=o||void 0,u;e[2]!==l||e[3]!==c?(u={collectionSlugs:c,selectedCollection:l},e[2]=l,e[3]=c,e[4]=u):u=e[4];let{closeListDrawer:d,ListDrawer:a,openListDrawer:p}=yt(u),m,f;e[5]!==r||e[6]!==p?(m=()=>r.registerCommand(at,N=>(s(N?.replace?N?.replace.nodeKey:null),p(),!0),_f),f=[r,p],e[5]=r,e[6]=p,e[7]=m,e[8]=f):(m=e[7],f=e[8]),Tf(m,f);let h;e[9]!==d||e[10]!==r||e[11]!==i?(h=N=>{let{collectionSlug:D,doc:k}=N;wf({editor:r,relationTo:D,replaceNodeKey:i,value:k.id}),d()},e[9]=d,e[10]=r,e[11]=i,e[12]=h):h=e[12];let x=h,b;return e[13]!==a||e[14]!==x?(b=ro(a,{onSelect:x}),e[13]=a,e[14]=x,e[15]=b):b=e[15],b},ts=t=>(t?.enabledCollectionSlugs?.length??-1)>0?ro(es,{...t}):ro(At,{...t,children:ro(es,{...t})});var cr=Af("INSERT_RELATIONSHIP_COMMAND"),os=t=>{let e=Ef(10),{clientProps:o}=t,[r]=Sf(),{config:n}=yf(),{collections:l}=n,i=null;if(o?.enabledCollections)i=o?.enabledCollections;else if(o?.disabledCollections){let d;if(e[0]!==o?.disabledCollections||e[1]!==l){let a;e[3]!==o?.disabledCollections?(a=p=>{let{slug:m}=p;return!o?.disabledCollections?.includes(m)},e[3]=o?.disabledCollections,e[4]=a):a=e[4],d=l.filter(a).map($f),e[0]=o?.disabledCollections,e[1]=l,e[2]=d}else d=e[2];i=d}let s,c;e[5]!==r?(s=()=>{if(!r.hasNodes([Ne]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return r.registerCommand(cr,Ff,Df)},c=[r],e[5]=r,e[6]=s,e[7]=c):(s=e[6],c=e[7]),Of(s,c);let u;return e[8]!==i?(u=Nf(ts,{enabledCollectionSlugs:i}),e[8]=i,e[9]=u):u=e[9],u};function $f(t){let{slug:e}=t;return e}function Ff(t){let e=Rf()||If();if(Mf(e)){let o=je(t),{focus:r}=e,n=r.getNode();Lf(o),vf(n)&&!n.__first&&n.remove()}return!0}var Bf=y({nodes:[Ne],plugins:[{Component:os,position:"normal"}],slashMenu:{groups:[ee([{Icon:sr,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(at,{replace:!1})}}])]},toolbarFixed:{groups:[ke([{ChildComponent:sr,isActive:({selection:t})=>{if(!Pf(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return ar(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(at,{replace:!1})}}])]}});import{c as ds}from"react/compiler-runtime";import{jsx as me,jsxs as m0}from"react/jsx-runtime";import{useLexicalComposerContext as p0}from"@lexical/react/LexicalComposerContext.js";import{useScrollInfo as f0,useThrottledEffect as h0,useTranslation as g0}from"@payloadcms/ui";import*as Se from"react";import{useMemo as x0}from"react";import{c as Hf}from"react/compiler-runtime";import{jsx as jf}from"react/jsx-runtime";import{mergeRegister as Uf}from"@lexical/utils";import{$addUpdateTag as Gf,$getSelection as Wf}from"lexical";import{useDeferredValue as Vf,useEffect as Kf,useState as Jf}from"react";var rs="toolbar-popup__button",It=t=>{let e=Hf(22),{children:o,editor:r,item:n}=t,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={active:!1,enabled:!0},e[0]=l):l=e[0];let[i,s]=Jf(l),c=Vf(i),u=j(),d,a=c.enabled?"":"disabled",p=c.active?"active":"",m=n.key?`${rs}-${n.key}`:"",f;e[1]!==a||e[2]!==p||e[3]!==m?(f=[rs,a,p,m].filter(Boolean),e[1]=a,e[2]=p,e[3]=m,e[4]=f):f=e[4],d=f.join(" ");let h=d,x;e[5]!==r||e[6]!==u||e[7]!==n?(x=()=>{r.getEditorState().read(()=>{let O=Wf();if(!O)return;let F=n.isActive?n.isActive({editor:r,editorConfigContext:u,selection:O}):!1,I=n.isEnabled?n.isEnabled({editor:r,editorConfigContext:u,selection:O}):!0;s(T=>T.active===F&&T.enabled===I?T:{active:F,enabled:I})})},e[5]=r,e[6]=u,e[7]=n,e[8]=x):x=e[8];let b=x,N=Ot(),D,k;e[9]!==r||e[10]!==N||e[11]!==b?(D=()=>{let O=()=>N(b),F=Uf(r.registerUpdateListener(O));return document.addEventListener("mouseup",O),()=>{F(),document.removeEventListener("mouseup",O)}},k=[r,N,b],e[9]=r,e[10]=N,e[11]=b,e[12]=D,e[13]=k):(D=e[12],k=e[13]),Kf(D,k);let _;e[14]!==i||e[15]!==r||e[16]!==n?(_=()=>{i.enabled&&r.focus(()=>{r.update(Xf),n.onSelect?.({editor:r,isActive:i.active})})},e[14]=i,e[15]=r,e[16]=n,e[17]=_):_=e[17];let g=_,S=zf,M;return e[18]!==o||e[19]!==h||e[20]!==g?(M=jf("button",{className:h,onClick:g,onMouseDown:S,type:"button",children:o}),e[18]=o,e[19]=h,e[20]=g,e[21]=M):M=e[21],M};function Xf(){Gf("toolbar")}function zf(t){t.preventDefault()}import{c as o0}from"react/compiler-runtime";import{jsx as ot}from"react/jsx-runtime";import us,{useCallback as r0,useDeferredValue as n0,useEffect as l0,useMemo as i0}from"react";import{mergeRegister as s0}from"@lexical/utils";import{useTranslation as a0}from"@payloadcms/ui";import{$getSelection as c0}from"lexical";import{jsx as Me,jsxs as ns}from"react/jsx-runtime";import{Button as Zf}from"@payloadcms/ui";import{$addUpdateTag as Yf,isDOMNode as qf}from"lexical";import no,{useCallback as Qf,useEffect as lo,useMemo as is,useRef as ur,useState as dr}from"react";import{createPortal as e0}from"react-dom";var ls="toolbar-popup__dropdown-item",ss=no.createContext(null);function as({active:t,children:e,editor:o,enabled:r,Icon:n,item:l,tooltip:i}){let s=is(()=>[ls,r===!1?"disabled":"",t?"active":"",l?.key?`${ls}-${l.key}`:""].filter(Boolean).join(" "),[r,t,l.key]),c=ur(null),u=no.use(ss);if(u===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:d}=u;return lo(()=>{c?.current!=null&&d(c)},[c,d]),Me(Zf,{"aria-label":i,buttonStyle:"none",className:s,disabled:r===!1,icon:n,iconPosition:"left",iconStyle:"none",onClick:()=>{r!==!1&&o.focus(()=>{o.update(()=>{Yf("toolbar")}),l.onSelect?.({editor:o,isActive:t})})},onMouseDown:a=>{a.preventDefault()},ref:c,tooltip:i,type:"button",children:e})}function t0({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:r}){let[n,l]=dr(),[i,s]=dr(),c=Qf(a=>{l(p=>p!=null?[...p,a]:[a])},[l]),u=a=>{if(n==null)return;let{key:p}=a;["ArrowDown","ArrowUp","Escape","Tab"].includes(p)&&a.preventDefault(),p==="Escape"||p==="Tab"?r():p==="ArrowUp"?s(m=>{if(m==null)return n[0];let f=n.indexOf(m)-1;return n[f===-1?n.length-1:f]}):p==="ArrowDown"&&s(m=>m==null?n[0]:n[n.indexOf(m)+1])},d=is(()=>({registerItem:c}),[c]);return lo(()=>{n!=null&&i==null&&s(n[0]),i!=null&&i?.current!=null&&i.current.focus()},[n,i]),Me(ss,{value:d,children:Me("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:u,ref:e,children:t})})}function cs({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:r=!1,Icon:n,itemsContainerClassNames:l,label:i,stopCloseOnClickSelf:s}){let c=ur(null),u=ur(null),[d,a]=dr(!1),p=()=>{a(!1),u?.current!=null&&u.current.focus()};lo(()=>{let f=u.current,h=c.current;if(d&&f!==null&&h!==null){let{left:x,top:b}=f.getBoundingClientRect(),N=window.scrollY||document.documentElement.scrollTop;h.style.top=`${b+N+f.offsetHeight+5}px`,h.style.left=`${Math.min(x-5,window.innerWidth-h.offsetWidth-20)}px`}},[c,u,d]),lo(()=>{let f=u.current;if(f!==null&&d){let h=x=>{let b=x.target;qf(b)&&(s&&c.current&&c.current.contains(b)||f.contains(b)||a(!1))};return document.addEventListener("click",h),()=>{document.removeEventListener("click",h)}}},[c,u,d,s]);let m=e0(Me(t0,{dropDownRef:c,itemsContainerClassNames:l,onClose:p,children:o}),document.body);return ns(no.Fragment,{children:[ns("button",{"aria-label":t,className:e+(d?" active":""),disabled:r,onClick:f=>{f.preventDefault(),a(!d)},onMouseDown:f=>{f.preventDefault()},ref:u,type:"button",children:[n&&Me(n,{}),i&&Me("span",{className:"toolbar-popup__dropdown-label",children:i}),Me("i",{className:"toolbar-popup__dropdown-caret"})]}),d&&Me(no.Fragment,{children:m})]})}var mr="toolbar-popup__dropdown",u0=t=>{let e=o0(18),{active:o,anchorElem:r,editor:n,enabled:l,item:i}=t,{i18n:s}=a0(),{fieldProps:c}=j(),{featureClientSchemaMap:u,schemaPath:d}=c;if(i.Component){let f;return e[0]!==o||e[1]!==r||e[2]!==n||e[3]!==l||e[4]!==i?(f=i?.Component&&ot(i.Component,{active:o,anchorElem:r,editor:n,enabled:l,item:i},i.key),e[0]=o,e[1]=r,e[2]=n,e[3]=l,e[4]=i,e[5]=f):f=e[5],f}let a=i.key,p;if(i.label){let f;e[6]!==u||e[7]!==s||e[8]!==i||e[9]!==d?(f=typeof i.label=="function"?i.label({featureClientSchemaMap:u,i18n:s,schemaPath:d}):i.label,e[6]=u,e[7]=s,e[8]=i,e[9]=d,e[10]=f):f=e[10],a=f}a.length>25?p=a.substring(0,25)+"...":p=a;let m;return e[11]!==o||e[12]!==p||e[13]!==n||e[14]!==l||e[15]!==i||e[16]!==a?(m=ot(as,{active:o,editor:n,enabled:l,Icon:i?.ChildComponent?ot(i.ChildComponent,{}):void 0,item:i,tooltip:a,children:ot("span",{className:"text",children:p})},i.key),e[11]=o,e[12]=p,e[13]=n,e[14]=l,e[15]=i,e[16]=a,e[17]=m):m=e[17],m},d0=us.memo(u0),Ue=({anchorElem:t,classNames:e,editor:o,group:r,Icon:n,itemsContainerClassNames:l,label:i,maxActiveItems:s,onActiveChange:c})=>{let[u,d]=us.useState({activeItemKeys:[],enabledGroup:!0,enabledItemKeys:[]}),a=n0(u),p=j(),{items:m,key:f}=r,h=Ot(),x=r0(()=>{o.getEditorState().read(()=>{let N=c0();if(!N)return;let D=[],k=[],_=[];for(let g of m)g.isActive&&(!s||D.length<s)&&g.isActive({editor:o,editorConfigContext:p,selection:N})&&(D.push(g.key),k.push(g)),g.isEnabled?g.isEnabled({editor:o,editorConfigContext:p,selection:N})&&_.push(g.key):_.push(g.key);d({activeItemKeys:D,enabledGroup:r.isEnabled?r.isEnabled({editor:o,editorConfigContext:p,selection:N}):!0,enabledItemKeys:_}),c&&c({activeItems:k})})},[o,p,r,m,s,c]);l0(()=>s0(o.registerUpdateListener(async()=>{await h(x)})),[o,h,x]);let b=i0(()=>m?.length?m.map(N=>ot(d0,{active:a.activeItemKeys.includes(N.key),anchorElem:t,editor:o,enabled:a.enabledItemKeys.includes(N.key),item:N},N.key)):null,[m,a,t,o]);return ot(cs,{buttonAriaLabel:`${f} dropdown`,buttonClassName:[mr,`${mr}-${f}`,...e||[]].filter(Boolean).join(" "),disabled:!a.enabledGroup,Icon:n,itemsContainerClassNames:[`${mr}-items`,...l||[]],label:i,children:b},f)};function C0({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&me(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?me(It,{editor:e,item:o,children:me(o.ChildComponent,{})},o.key):null}function b0(t){let e=ds(23),{anchorElem:o,editor:r,editorConfig:n,group:l,index:i}=t,{i18n:s}=g0(),{fieldProps:c}=j(),{featureClientSchemaMap:u,schemaPath:d}=c,[a,p]=Se.useState(void 0),[m,f]=Se.useState(void 0),h;e[0]!==l.ChildComponent||e[1]!==l.items||e[2]!==l.type?(h=()=>{l?.type==="dropdown"&&l.items.length&&l.ChildComponent?f(()=>l.ChildComponent):f(void 0)},e[0]=l.ChildComponent,e[1]=l.items,e[2]=l.type,e[3]=h):h=e[3];let x;e[4]!==l?(x=[l],e[4]=l,e[5]=x):x=e[5],Se.useEffect(h,x);let b;e[6]!==u||e[7]!==l.ChildComponent||e[8]!==l.items||e[9]!==l.type||e[10]!==s||e[11]!==d?(b=_=>{let{activeItems:g}=_;if(!g.length){l?.type==="dropdown"&&l.items.length&&l.ChildComponent?(f(()=>l.ChildComponent),p(void 0)):(f(void 0),p(void 0));return}let S=g[0],M=S.key;S.label&&(M=typeof S.label=="function"?S.label({featureClientSchemaMap:u,i18n:s,schemaPath:d}):S.label),M.length>25&&(M=M.substring(0,25)+"..."),g.length===1?(p(M),f(()=>S.ChildComponent)):(p(s.t("lexical:general:toolbarItemsActive",{count:g.length})),l?.type==="dropdown"&&l.items.length&&l.ChildComponent?f(()=>l.ChildComponent):f(void 0))},e[6]=u,e[7]=l.ChildComponent,e[8]=l.items,e[9]=l.type,e[10]=s,e[11]=d,e[12]=b):b=e[12];let N=b,D=`fixed-toolbar__group fixed-toolbar__group-${l.key}`,k;return e[13]!==m||e[14]!==o||e[15]!==a||e[16]!==r||e[17]!==n.features.toolbarFixed?.groups.length||e[18]!==l||e[19]!==i||e[20]!==N||e[21]!==D?(k=m0("div",{className:D,children:[l.type==="dropdown"&&l.items.length?m?me(Ue,{anchorElem:o,editor:r,group:l,Icon:m,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:l.maxActiveItems??1,onActiveChange:N}):me(Ue,{anchorElem:o,editor:r,group:l,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:l.maxActiveItems??1,onActiveChange:N}):null,l.type==="buttons"&&l.items.length?l.items.map(_=>me(C0,{anchorElem:o,editor:r,item:_},_.key)):null,i<n.features.toolbarFixed?.groups.length-1&&me("div",{className:"divider"})]},l.key),e[13]=m,e[14]=o,e[15]=a,e[16]=r,e[17]=n.features.toolbarFixed?.groups.length,e[18]=l,e[19]=i,e[20]=N,e[21]=D,e[22]=k):k=e[22],k}function k0({anchorElem:t,clientProps:e,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let l=Se.useRef(null),{y:i}=f0(),s=x0(()=>{if(!n||e?.disableIfParentHasFixedToolbar)return null;let u=n.editorContainerRef.current.previousElementSibling;for(;u;){if(u.classList.contains("fixed-toolbar"))return u;u=u.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,n]);return h0(()=>{if(!s)return;let c=l.current;if(!c)return;let u=c.getBoundingClientRect(),d=s.getBoundingClientRect();if(!(u.bottom<d.top||u.top>d.bottom))c.classList.remove("fixed-toolbar"),c.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),s.classList.remove("fixed-toolbar"),s.classList.add("fixed-toolbar","fixed-toolbar--hide");else{if(!c.classList.contains("fixed-toolbar--overlapping"))return;c.classList.remove("fixed-toolbar--overlapping"),c.classList.add("fixed-toolbar"),s.classList.remove("fixed-toolbar--hide"),s.classList.add("fixed-toolbar")}},50,[l,s,i]),me("div",{className:"fixed-toolbar",onFocus:c=>{c.stopPropagation()},ref:l,children:o.isEditable()&&me(Se.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((c,u)=>me(b0,{anchorElem:t,editor:o,editorConfig:r,group:c,index:u},c.key))})})}var ms=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return ms(t.parentEditor)}return!1},ps=t=>{let e=ds(6),{clientProps:o}=t,[r]=p0(),n=j(),{editorConfig:l}=n,i=o.applyToFocusedEditor&&n.focusedEditor?.editor||r,s=o.applyToFocusedEditor&&n.focusedEditor?.editorConfig||l,c,u;if(e[0]!==o.disableIfParentHasFixedToolbar||e[1]!==i||e[2]!==s||e[3]!==n){u=Symbol.for("react.early_return_sentinel");e:{let d=ms(n);if(o?.disableIfParentHasFixedToolbar&&d){u=null;break e}if(!s?.features?.toolbarFixed?.groups?.length){u=null;break e}c=me(k0,{anchorElem:document.body,editor:i,editorConfig:s,parentWithFixedToolbar:d})}e[0]=o.disableIfParentHasFixedToolbar,e[1]=i,e[2]=s,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 _0=y({plugins:[{Component:ps,position:"aboveContainer"}]});import{c as gs}from"react/compiler-runtime";import{jsx as ge,jsxs as xs}from"react/jsx-runtime";import{useLexicalComposerContext as T0}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Cs}from"@lexical/utils";import{$getSelection as bs,$isRangeSelection as fs,$isTextNode as w0,COMMAND_PRIORITY_LOW as E0,getDOMSelection as ks,SELECTION_CHANGE_COMMAND as N0}from"lexical";import{useCallback as so,useEffect as Rt,useRef as hs,useState as S0}from"react";import*as ao from"react";import{createPortal as L0}from"react-dom";function pr(t,e){let o=t.getRangeAt(0),r;if(t.anchorNode===e){let n=e;for(;n.firstElementChild!=null;)n=n.firstElementChild;r=n.getBoundingClientRect()}else r=o.getBoundingClientRect();return r}function io(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:r=0,floatingElem:n,horizontalOffset:l=32,horizontalPosition:i="left",specialHandlingForCaret:s=!1,targetRect:c,verticalGap:u=10}=t,d=o.parentElement;if(c===null||d==null){n.style.opacity="0",n.style.transform="translate(-10000px, -10000px)";return}let a=n.getBoundingClientRect(),p=o.getBoundingClientRect(),m=d.getBoundingClientRect(),f=c.top-a.height-u,h=c.left-l;i==="center"&&(h=c.left+c.width/2-a.width/2);let x=0;return!e&&f<m.top&&!s&&(x=a.height+c.height+u*2,f+=x),i==="center"?h+a.width>m.right?h=m.right-a.width-l:h<m.left&&(h=m.left+l):h+a.width>m.right&&(h=m.right-a.width-l),h-=p.left,n.style.opacity="1",s&&r!==0?(f-=p.bottom-r+a.height-3,n.style.transform=`translate(${h}px, ${f}px) rotate(180deg)`):(f-=p.top,n.style.transform=`translate(${h}px, ${f}px)`),x}function y0({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&ge(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?ge(It,{editor:e,item:o,children:ge(o.ChildComponent,{})},o.key):null}function I0(t){let e=gs(19),{anchorElem:o,editor:r,group:n,index:l}=t,{editorConfig:i}=j(),[s,c]=ao.useState(),u;e[0]!==n.ChildComponent||e[1]!==n.items||e[2]!==n.type?(u=()=>{n?.type==="dropdown"&&n.items.length&&n.ChildComponent?c(()=>n.ChildComponent):c(void 0)},e[0]=n.ChildComponent,e[1]=n.items,e[2]=n.type,e[3]=u):u=e[3];let d;e[4]!==n?(d=[n],e[4]=n,e[5]=d):d=e[5],ao.useEffect(u,d);let a;e[6]!==n.ChildComponent||e[7]!==n.items||e[8]!==n.type?(a=h=>{let{activeItems:x}=h;if(!x.length){n?.type==="dropdown"&&n.items.length&&n.ChildComponent?c(()=>n.ChildComponent):c(void 0);return}let b=x[0];c(()=>b?.ChildComponent)},e[6]=n.ChildComponent,e[7]=n.items,e[8]=n.type,e[9]=a):a=e[9];let p=a,m=`inline-toolbar-popup__group inline-toolbar-popup__group-${n.key}`,f;return e[10]!==s||e[11]!==o||e[12]!==r||e[13]!==i.features.toolbarInline?.groups.length||e[14]!==n||e[15]!==l||e[16]!==p||e[17]!==m?(f=xs("div",{className:m,children:[n.type==="dropdown"&&n.items.length?s?ge(Ue,{anchorElem:o,editor:r,group:n,Icon:s,maxActiveItems:n.maxActiveItems??1,onActiveChange:p}):ge(Ue,{anchorElem:o,editor:r,group:n,maxActiveItems:n.maxActiveItems??1,onActiveChange:p}):null,n.type==="buttons"&&n.items.length?n.items.map(h=>ge(y0,{anchorElem:o,editor:r,item:h},h.key)):null,l<i.features.toolbarInline?.groups.length-1&&ge("div",{className:"divider"})]},n.key),e[10]=s,e[11]=o,e[12]=r,e[13]=i.features.toolbarInline?.groups.length,e[14]=n,e[15]=l,e[16]=p,e[17]=m,e[18]=f):f=e[18],f}function R0({anchorElem:t,editor:e}){let o=hs(null),r=hs(null),{editorConfig:n}=j(),l=so(()=>{if(o?.current){let u=o.current.style.opacity==="0",d=o.current.style.pointerEvents==="none";u||(o.current.style.opacity="0"),d||(o.current.style.pointerEvents="none")}},[o]),i=so(u=>{if(o?.current&&(u.buttons===1||u.buttons===3)){let d=o.current.style.opacity==="0",a=o.current.style.pointerEvents==="none";if(!d||!a){let p=u.clientX,m=u.clientY,f=document.elementFromPoint(p,m);o.current.contains(f)||l()}}},[l]),s=so(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);Rt(()=>(document.addEventListener("mousemove",i),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",s)}),[o,i,s]);let c=so(()=>{let u=bs(),d=ks(e._window);if(o.current===null)return;let a=t.querySelector(":scope > .link-editor"),p=a!==null&&"style"in a&&a?.style?.opacity==="1",m=e.getRootElement();if(u!==null&&d!==null&&!d.isCollapsed&&m!==null&&m.contains(d.anchorNode)){let f=pr(d,m),h=io({alwaysDisplayOnTop:p,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});r.current&&io({anchorElem:o.current,anchorFlippedOffset:h,floatingElem:r.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else l()},[e,l,t]);return Rt(()=>{let u=t.parentElement,d=()=>{e.getEditorState().read(()=>{c()})};return window.addEventListener("resize",d),u&&u.addEventListener("scroll",d),()=>{window.removeEventListener("resize",d),u&&u.removeEventListener("scroll",d)}},[e,c,t]),Rt(()=>(e.getEditorState().read(()=>{c()}),Cs(e.registerUpdateListener(({editorState:u})=>{u.read(()=>{c()})}),e.registerCommand(N0,()=>(c(),!1),E0))),[e,c]),xs("div",{className:"inline-toolbar-popup",ref:o,children:[ge("div",{className:"caret",ref:r}),n?.features&&n.features?.toolbarInline?.groups.map((u,d)=>ge(I0,{anchorElem:t,editor:e,group:u,index:d},u.key))]})}function v0(t,e){let o=gs(12),[r,n]=S0(!1),l;o[0]!==t?(l=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let p=bs(),m=ks(t._window),f=t.getRootElement();if(m!==null&&(!fs(p)||f===null||!f.contains(m.anchorNode))){n(!1);return}if(!fs(p))return;if(p.getTextContent()!==""){let x=p.getNodes(),b=!1;for(let N of x)if(w0(N)){n(!0),b=!0;break}b||n(!1)}else n(!1);let h=p.getTextContent().replace(/\n/g,"");if(!p.isCollapsed()&&h===""){n(!1);return}})},o[0]=t,o[1]=l):l=o[1];let i=l,s,c;o[2]!==i?(s=()=>(document.addEventListener("selectionchange",i),document.addEventListener("mouseup",i),()=>{document.removeEventListener("selectionchange",i),document.removeEventListener("mouseup",i)}),c=[i],o[2]=i,o[3]=s,o[4]=c):(s=o[3],c=o[4]),Rt(s,c);let u,d;if(o[5]!==t||o[6]!==i?(u=()=>Cs(t.registerUpdateListener(()=>{i()}),t.registerRootListener(()=>{t.getRootElement()===null&&n(!1)})),d=[t,i],o[5]=t,o[6]=i,o[7]=u,o[8]=d):(u=o[7],d=o[8]),Rt(u,d),!r||!t.isEditable())return null;let a;return o[9]!==e||o[10]!==t?(a=L0(ge(R0,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=a):a=o[11],a}var _s=t=>{let{anchorElem:e}=t,[o]=T0();return v0(o,e)};var M0=y({plugins:[{Component:_s,position:"floatingAnchorElem"}]});import{TableCellNode as Th,TableNode as wh,TableRowNode as Eh}from"@lexical/table";import{jsx as Ts}from"react/jsx-runtime";import"react";var fr=()=>Ts("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Ts("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 D0,$createTableNode as A0,$createTableRowNode as O0,$isTableCellNode as ws,$isTableNode as hr,$isTableRowNode as gr,TableCellHeaderStates as co,TableCellNode as $0,TableNode as F0,TableRowNode as P0}from"@lexical/table";import{$isParagraphNode as B0,$isTextNode as H0}from"lexical";var Ns=/^\|(.+)\|\s?$/,j0=/^(\| ?:?-*:? ?)+\|\s?$/,Ss=({allTransformers:t})=>({type:"element",dependencies:[F0,P0,$0],export:e=>{if(!hr(e))return null;let o=[];for(let r of e.getChildren()){let n=[];if(!gr(r))continue;let l=!1;for(let i of r.getChildren())ws(i)&&(n.push(Br(t,i).replace(/\n/g,"\\n").trim()),i.__headerState===co.ROW&&(l=!0));o.push(`| ${n.join(" | ")} |`),l&&o.push(`| ${n.map(i=>"---").join(" | ")} |`)}return o.join(`
39
39
  `)},regExp:Ns,replace:(e,o,r)=>{let n=r[0];if(!n)return;if(j0.test(n)){let a=e.getPreviousSibling();if(!a||!hr(a))return;let p=a.getChildren(),m=p[p.length-1];if(!m||!gr(m))return;m.getChildren().forEach(f=>{ws(f)&&f.setHeaderStyles(co.ROW,co.ROW)}),e.remove();return}let l=Es(n,t);if(l==null)return;let i=[l],s=e.getPreviousSibling(),c=l.length;for(;s&&!(!B0(s)||s.getChildrenSize()!==1);){let a=s.getFirstChild();if(!H0(a))break;let p=Es(a.getTextContent(),t);if(p==null)break;c=Math.max(c,p.length),i.unshift(p);let m=s.getPreviousSibling();s.remove(),s=m}let u=A0();for(let a of i){let p=O0();u.append(p);for(let m=0;m<c;m++)p.append(m<a.length?a[m]:Ls("",t))}let d=e.getPreviousSibling();hr(d)&&U0(d)===c?(d.append(...u.getChildren()),e.remove()):e.replace(u),u.selectEnd()}});function U0(t){let e=t.getFirstChild();return gr(e)?e.getChildrenSize():0}var Ls=(t,e)=>{t=t.replace(/\\n/g,`
40
- `);let o=D0(co.NO_STATUS);return Pr(t,e,o),o},Es=(t,e)=>{let o=t.match(Ns);return!o||!o[1]?null:o[1].split("|").map(r=>Ls(r,e))};import{c as W0}from"react/compiler-runtime";import{jsx as P,jsxs as Le}from"react/jsx-runtime";import{useLexicalComposerContext as vs}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as V0}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as Cr,$deleteTableColumn__EXPERIMENTAL as K0,$deleteTableRow__EXPERIMENTAL as J0,$getNodeTriplet as X0,$getTableCellNodeFromLexicalNode as Is,$getTableColumnIndexFromTableCellNode as z0,$getTableNodeFromLexicalNodeOrThrow as ye,$getTableRowIndexFromTableCellNode as Z0,$insertTableColumn__EXPERIMENTAL as Y0,$insertTableRow__EXPERIMENTAL as q0,$isTableCellNode as Ms,$isTableSelection as vt,$unmergeCell as Q0,getTableElement as br,getTableObserverFromTableElement as kr,TableCellHeaderStates as De,TableCellNode as e1}from"@lexical/table";import{mergeRegister as t1}from"@lexical/utils";import{useScrollInfo as o1}from"@payloadcms/ui";import{$createParagraphNode as r1,$getSelection as mo,$isElementNode as n1,$isParagraphNode as l1,$isRangeSelection as _r,$isTextNode as i1,$setSelection as s1,COMMAND_PRIORITY_CRITICAL as a1,getDOMSelection as c1,isDOMNode as u1,SELECTION_CHANGE_COMMAND as d1}from"lexical";import*as Tr from"react";import{useCallback as pe,useEffect as rt,useRef as uo,useState as nt}from"react";import{createPortal as Ds}from"react-dom";import{jsx as xr,jsxs as G0}from"react/jsx-runtime";import"react";var ys=()=>G0("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[xr("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"}),xr("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"}),xr("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 Rs(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function m1(){let t=mo();if(_r(t)&&!t.isCollapsed()||vt(t)&&!t.anchor.is(t.focus)||!_r(t)&&!vt(t))return!1;let[e]=X0(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function p1(t){if(t.getChildrenSize()!==1)return!1;let e=t.getFirstChildOrThrow();return!(!l1(e)||!e.isEmpty())}function f1(t){let e=t.getLastDescendant();i1(e)?e.select():n1(e)?e.selectEnd():e!==null&&e.selectNext()}function h1({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[l]=vs(),i=uo(null),[s,c]=nt(n),[u,d]=nt({columns:1,rows:1}),[a,p]=nt(!1),[m,f]=nt(!1),{y:h}=o1();rt(()=>l.registerMutationListener(e1,C=>{C.get(s.getKey())==="updated"&&l.getEditorState().read(()=>{c(s.getLatest())})},{skipInitialization:!0}),[l,s]),rt(()=>{l.getEditorState().read(()=>{let C=mo();if(vt(C)){let E=Rs(C);d(Rs(C)),p(E.columns>1||E.rows>1)}f(m1())})},[l]),rt(()=>{let C=e.current,E=i.current,R=l.getRootElement();if(C!=null&&E!=null&&R!=null){let L=R.getBoundingClientRect(),v=C.getBoundingClientRect();E.style.opacity="1";let w=E.getBoundingClientRect(),$=5,H=v.right+$;if(H+w.width>window.innerWidth||H+w.width>L.right){let Y=v.left-w.width-$;H=(Y<0?$:Y)+window.pageXOffset}E.style.left=`${H+window.pageXOffset}px`;let W=v.top;if(W+w.height>window.innerHeight){let Y=v.bottom-w.height;W=Y<0?$:Y}E.style.top=`${W}px`}},[e,i,l,h]),rt(()=>{function C(E){i.current!=null&&e.current!=null&&u1(E.target)&&!i.current.contains(E.target)&&!e.current.contains(E.target)&&r(!1)}return window.addEventListener("click",C),()=>window.removeEventListener("click",C)},[r,e]);let x=pe(()=>{l.update(()=>{if(s.isAttached()){let C=ye(s),E=br(C,l.getElementByKey(C.getKey()));if(E===null)throw new Error("Expected to find tableElement in DOM");let R=kr(E);R!==null&&R.$clearHighlight(),C.markDirty(),c(s.getLatest())}s1(null)})},[l,s]),b=()=>{l.update(()=>{let C=mo();if(vt(C)){let R=C.getNodes().filter(Ms);if(R.length===0)return;let L=ye(R[0]),[v]=Cr(L,null,null),w=1/0,$=-1/0,H=1/0,W=-1/0,Y=new Set;for(let q of v)for(let K of q){if(!K||!K.cell)continue;let re=K.cell.getKey();if(!Y.has(re)&&R.some(ne=>ne.is(K.cell))){Y.add(re);let ne=K.startRow,se=K.startColumn,Ae=K.cell.__rowSpan||1,it=K.cell.__colSpan||1;w=Math.min(w,ne),$=Math.max($,ne+Ae-1),H=Math.min(H,se),W=Math.max(W,se+it-1)}}if(w===1/0||H===1/0)return;let We=$-w+1,V=W-H+1,U=v?.[w]?.[H];if(!U?.cell)return;let oe=U.cell;oe.setColSpan(V),oe.setRowSpan(We);let ue=new Set([oe.getKey()]);for(let q=w;q<=$;q++)for(let K=H;K<=W;K++){let re=v?.[q]?.[K];if(!re?.cell)continue;let ne=re.cell,se=ne.getKey();ue.has(se)||(ue.add(se),p1(ne)||oe.append(...ne.getChildren()),ne.remove())}oe.getChildrenSize()===0&&oe.append(r1()),f1(oe),o()}})},N=()=>{l.update(()=>{Q0()})},D=pe(C=>{l.update(()=>{for(let E=0;E<u.rows;E++)q0(C);o()})},[l,o,u.rows]),k=pe(C=>{l.update(()=>{for(let E=0;E<u.columns;E++)Y0(C);o()})},[l,o,u.columns]),_=pe(()=>{l.update(()=>{J0(),o()})},[l,o]),g=pe(()=>{l.update(()=>{ye(s).remove(),x(),o()})},[l,s,x,o]),S=pe(()=>{l.update(()=>{K0(),o()})},[l,o]),M=pe(()=>{l.update(()=>{let C=ye(s),E=Z0(s),[R]=Cr(C,null,null),L=new Set,v=s.getHeaderStyles()^De.ROW;if(R[E])for(let w=0;w<R[E].length;w++){let $=R[E][w];$?.cell&&(L.has($.cell)||(L.add($.cell),$.cell.setHeaderStyles(v,De.ROW)))}x(),o()})},[l,s,x,o]),O=pe(()=>{l.update(()=>{let C=ye(s),E=z0(s),[R]=Cr(C,null,null),L=new Set,v=s.getHeaderStyles()^De.COLUMN;if(R)for(let w=0;w<R.length;w++){let $=R?.[w]?.[E];$?.cell&&(L.has($.cell)||(L.add($.cell),$.cell.setHeaderStyles(v,De.COLUMN)))}x(),o()})},[l,s,x,o]),F=pe(()=>{l.update(()=>{if(s.isAttached()){let C=ye(s);C&&C.setRowStriping(!C.getRowStriping())}x(),o()})},[l,s,x,o]),I=pe(()=>{l.update(()=>{if(s.isAttached()){let C=ye(s);C&&C.setFrozenColumns(C.getFrozenColumns()===0?1:0)}x(),o()})},[l,s,x,o]),T=null;return t&&(a?T=P("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>b(),type:"button",children:P("span",{className:"text",children:"Merge cells"})}):m&&(T=P("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>N(),type:"button",children:P("span",{className:"text",children:"Unmerge cells"})}))),Ds(Le("div",{className:"table-action-menu-dropdown",onClick:C=>{C.stopPropagation()},ref:i,children:[T?Le(Tr.Fragment,{children:[T,P("hr",{})]}):null,P("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>F(),type:"button",children:P("span",{className:"text",children:"Toggle Row Striping"})}),P("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>I(),type:"button",children:P("span",{className:"text",children:"Toggle First Column Freeze"})}),P("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>D(!1),type:"button",children:Le("span",{className:"text",children:["Insert ",u.rows===1?"row":`${u.rows} rows`," above"]})}),P("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>D(!0),type:"button",children:Le("span",{className:"text",children:["Insert ",u.rows===1?"row":`${u.rows} rows`," below"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>k(!1),type:"button",children:Le("span",{className:"text",children:["Insert ",u.columns===1?"column":`${u.columns} columns`," ","left"]})}),P("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>k(!0),type:"button",children:Le("span",{className:"text",children:["Insert ",u.columns===1?"column":`${u.columns} columns`," ","right"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>S(),type:"button",children:P("span",{className:"text",children:"Delete column"})}),P("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>_(),type:"button",children:P("span",{className:"text",children:"Delete row"})}),P("button",{className:"item","data-test-id":"table-delete",onClick:()=>g(),type:"button",children:P("span",{className:"text",children:"Delete table"})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-row-header",onClick:()=>M(),type:"button",children:Le("span",{className:"text",children:[(s.__headerState&De.ROW)===De.ROW?"Remove":"Add"," ","row header"]})}),P("button",{className:"item","data-test-id":"table-column-header",onClick:()=>O(),type:"button",children:Le("span",{className:"text",children:[(s.__headerState&De.COLUMN)===De.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function g1({anchorElem:t,cellMerge:e}){let[o]=vs(),r=uo(null),n=uo(null),[l,i]=nt(!1),[s,c]=nt(null),u=pe(()=>{let a=r.current,p=mo(),m=c1(o._window),f=document.activeElement;function h(){a&&(a.classList.remove("table-cell-action-button-container--active"),a.classList.add("table-cell-action-button-container--inactive")),c(null)}if(p==null||a==null)return h();let x=o.getRootElement(),b=null,N=null;if(_r(p)&&x!==null&&m!==null&&x.contains(m.anchorNode)){let k=Is(p.anchor.getNode());if(k==null||(N=o.getElementByKey(k.getKey()),N==null||!k.isAttached()))return h();let _=ye(k),g=br(_,o.getElementByKey(_.getKey()));if(g===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");b=kr(g),c(k)}else if(vt(p)){let k=Is(p.anchor.getNode());if(!Ms(k))throw new Error("TableSelection anchorNode must be a TableCellNode");let _=ye(k),g=br(_,o.getElementByKey(_.getKey()));if(g===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");b=kr(g),N=o.getElementByKey(k.getKey())}else if(!f)return h();if(b===null||N===null)return h();let D=!b||!b.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",D),a.classList.toggle("table-cell-action-button-container--inactive",!D),D){let k=N.getBoundingClientRect(),_=t.getBoundingClientRect(),g=k.top-_.top,S=k.right-_.left;a.style.transform=`translate(${S}px, ${g}px)`}},[o,t]);rt(()=>{let a,p=()=>{a=void 0,o.getEditorState().read(u)},m=()=>(a===void 0&&(a=setTimeout(p,0)),!1);return t1(o.registerUpdateListener(m),o.registerCommand(d1,m,a1),o.registerRootListener((f,h)=>{h&&h.removeEventListener("pointerup",m),f&&(f.addEventListener("pointerup",m),m())}),()=>clearTimeout(a))});let d=uo(s);return rt(()=>{d.current!==s&&i(!1),d.current=s},[d,s]),P("div",{className:"table-cell-action-button-container",ref:r,children:s!=null&&Le(Tr.Fragment,{children:[P("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),i(!l)},ref:n,type:"button",children:P(ys,{})}),l&&P(h1,{cellMerge:e,contextRef:n,onClose:()=>i(!1),setIsMenuOpen:i,tableCellNode:s})]})})}var As=t=>{let e=W0(3),{anchorElem:o}=t,r=V0(),n;return e[0]!==o||e[1]!==r?(n=Ds(r?P(g1,{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 x1}from"react/compiler-runtime";import{jsx as fo,jsxs as C1}from"react/jsx-runtime";import{useLexicalComposerContext as b1}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as k1}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as _1,$getTableNodeFromLexicalNodeOrThrow as wr,$getTableRowIndexFromTableCellNode as T1,$isTableCellNode as Os,$isTableRowNode as w1,getDOMCellFromTarget as E1,getTableElement as N1,TableNode as $s}from"@lexical/table";import{calculateZoomLevel as Fs,mergeRegister as S1}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Er,isHTMLElement as L1}from"lexical";import*as Bs from"react";import{useCallback as Mt,useEffect as Nr,useRef as po,useState as lt}from"react";import{createPortal as y1}from"react-dom";var I1=33,Ps=92;function R1({editor:t}){let e=po(null),o=po(null),r=po(null),[n,l]=lt(!1),i=j(),s=po(null),[c,u]=lt(null),[d,a]=lt(null),[p,m]=lt(!1),[f,h]=lt(null),x=Mt(()=>{a(null),e.current=null,h(null),s.current=null,r.current=null},[]),b=I=>(I.buttons&1)===1;Nr(()=>{let I=new Set;return S1(t.registerMutationListener($s,T=>{for(let[C,E]of T)E==="destroyed"?I.delete(C):I.add(C);l(I.size>0)}),t.registerNodeTransform($s,T=>{if(T.getColWidths())return T;let C=T.getColumnCount(),E=Ps;return T.setColWidths(Array(C).fill(E)),T}))},[t]),Nr(()=>{if(!n)return;let I=R=>{let L=R.target;if(L1(L)){if(f){u({x:R.clientX,y:R.clientY});return}if(m(b(R)),!(o.current&&o.current.contains(L))&&e.current!==L){e.current=L;let v=E1(L);v&&d!==v?t.getEditorState().read(()=>{let w=Er(v.elem);if(!w)throw new Error("TableCellResizer: Table cell node not found.");let $=wr(w),H=N1($,t.getElementByKey($.getKey()));if(!H)throw new Error("TableCellResizer: Table element not found.");e.current=L,r.current=H.getBoundingClientRect(),a(v)},{editor:t}):v==null&&x()}}},T=R=>{m(!0)},C=R=>{m(!1)},E=t.registerRootListener((R,L)=>{L?.removeEventListener("mousemove",I),L?.removeEventListener("mousedown",T),L?.removeEventListener("mouseup",C),R?.addEventListener("mousemove",I),R?.addEventListener("mousedown",T),R?.addEventListener("mouseup",C)});return()=>{E()}},[d,f,t,n,x]);let N=I=>I==="bottom",D=Mt(I=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let T=Er(d.elem);if(!Os(T))throw new Error("TableCellResizer: Table cell node not found.");let C=wr(T),E=T1(T),R=C.getChildren(),v=T.getColSpan()===C.getColumnCount()?E:E+T.getRowSpan()-1;if(v>=R.length||v<0)throw new Error("Expected table cell to be inside of table row.");let w=R[v];if(!w1(w))throw new Error("Expected table row");let $=w.getHeight();if($===void 0){let W=w.getChildren();$=Math.min(...W.map(Y=>k(Y,t)??1/0))}let H=Math.max($+I,I1);w.setHeight(H)},{tag:"skip-scroll-into-view"})},[d,t]),k=(I,T)=>T.getElementByKey(I.getKey())?.clientHeight,_=(I,T)=>{let C;return T.forEach(E=>{E.forEach((R,L)=>{R.cell===I&&(C=L)})}),C},g=Mt(I=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let T=Er(d.elem);if(!Os(T))throw new Error("TableCellResizer: Table cell node not found.");let C=wr(T),[E]=_1(C,null,null),R=_(T,E);if(R===void 0)throw new Error("TableCellResizer: Table column not found.");let L=C.getColWidths();if(!L)return;let v=L[R];if(v===void 0)return;let w=[...L],$=Math.max(v+I,Ps);w[R]=$,C.setColWidths(w)},{tag:"skip-scroll-into-view"})},[d,t]),S=Mt(I=>{let T=C=>{if(C.preventDefault(),C.stopPropagation(),!d)throw new Error("TableCellResizer: Expected active cell.");if(s.current){let{x:E,y:R}=s.current;if(d===null)return;let L=Fs(C.target);if(N(I)){let v=(C.clientY-R)/L;D(v)}else{let v=(C.clientX-E)/L;g(v)}x(),document.removeEventListener("mouseup",T)}};return T},[d,x,g,D]),M=Mt(I=>T=>{if(T.preventDefault(),T.stopPropagation(),!d)throw new Error("TableCellResizer: Expected active cell.");s.current={x:T.clientX,y:T.clientY},u(s.current),h(I),document.addEventListener("mouseup",S(I))},[d,S]),[O,F]=lt({bottom:null,left:null,right:null,top:null});return Nr(()=>{if(d){let{height:I,left:T,top:C,width:E}=d.elem.getBoundingClientRect(),R=Fs(d.elem),L=10,v={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${L}px`,left:`${window.scrollX+T}px`,top:`${window.scrollY+C+I-L/2}px`,width:`${E}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${I}px`,left:`${window.scrollX+T+E-L/2}px`,top:`${window.scrollY+C}px`,width:`${L}px`}},w=r.current;f&&c&&w&&(N(f)?(v[f].left=`${window.scrollX+w.left}px`,v[f].top=`${window.scrollY+c.y/R}px`,v[f].height="3px",v[f].width=`${w.width}px`):(v[f].top=`${window.scrollY+w.top}px`,v[f].left=`${window.scrollX+c.x/R}px`,v[f].width="3px",v[f].height=`${w.height}px`),v[f].backgroundColor="#adf"),F(v)}else F({bottom:null,left:null,right:null,top:null})},[d,f,c]),fo("div",{ref:o,children:d!=null&&!p&&C1(Bs.Fragment,{children:[fo("div",{className:`${i.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:M("right"),style:O.right||void 0}),fo("div",{className:`${i.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:M("bottom"),style:O.bottom||void 0})]})})}var Hs=()=>{let t=x1(3),[e]=b1(),o=k1(),r,n;return t[0]!==e||t[1]!==o?(n=o?y1(fo(R1,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=n):n=t[2],r=n,r};import{c as P1}from"react/compiler-runtime";import{jsx as Sr,jsxs as B1,Fragment as H1}from"react/jsx-runtime";import{useLexicalComposerContext as Xs}from"@lexical/react/LexicalComposerContext";import{$getTableAndElementByKey as j1,$getTableColumnIndexFromTableCellNode as U1,$getTableRowIndexFromTableCellNode as G1,$insertTableColumn__EXPERIMENTAL as W1,$insertTableRow__EXPERIMENTAL as V1,$isTableCellNode as K1,$isTableNode as Gs,getTableElement as J1,TableNode as X1}from"@lexical/table";import{$findMatchingParent as z1,mergeRegister as Z1}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Ws,isHTMLElement as Y1}from"lexical";import{useEffect as Vs,useMemo as q1,useRef as Ks,useState as ho}from"react";import"react";import{createPortal as Q1}from"react-dom";import{c as O1}from"react/compiler-runtime";import{useEffect as $1,useRef as F1}from"react";var v1="Expected a function",M1=Math.max,D1=Math.min;function A1(t,e,o){let r,n,l=0,i,s=!1,c=!1,u,d,a,p=!0;if(typeof t!="function")throw new TypeError(v1);e=e||0,typeof o=="object"&&(s=!!o.leading,c="maxWait"in o,u=c?M1(o.maxWait||0,e):u,p="trailing"in o?!!o.trailing:p);function m(g){let S=r,M=i;return r=i=void 0,l=g,d=t.apply(M,S),d}function f(g){return l=g,a=setTimeout(b,e),s?m(g):d}function h(g){let S=g-n,M=g-l,O=e-S;return c?D1(O,u-M):O}function x(g){let S=g-n,M=g-l;return n===void 0||S>=e||S<0||c&&M>=u}function b(){let g=Date.now();if(x(g))return N(g);a=setTimeout(b,h(g))}function N(g){return a=void 0,p&&r?m(g):(r=i=void 0,d)}function D(){a!==void 0&&clearTimeout(a),l=0,r=n=i=a=void 0}function k(){return a===void 0?d:N(Date.now())}function _(){let g=Date.now(),S=x(g);if(r=arguments,i=this,n=g,S){if(a===void 0)return f(n);if(c)return clearTimeout(a),a=setTimeout(b,e),m(n)}return a===void 0&&(a=setTimeout(b,e)),d}return _.cancel=D,_.flush=k,_}var js=A1;function Us(t,e,o){let r=O1(6),n=F1(null),l,i;r[0]!==t||r[1]!==o||r[2]!==e?(l=()=>(n.current=js(t,e,{maxWait:o}),()=>{n.current?.cancel()}),i=[t,e,o],r[0]=t,r[1]=o,r[2]=e,r[3]=l,r[4]=i):(l=r[3],i=r[4]),$1(l,i);let s;return r[5]===Symbol.for("react.memo_cache_sentinel")?(s=(...u)=>{let d=u;n.current&&n.current(...d)},r[5]=s):s=r[5],s}var Js=20;function eh({anchorElem:t}){let[e]=Xs(),o=j(),[r,n]=ho(!1),[l,i]=ho(!1),[s,c]=ho(!1),[u,d]=ho({}),a=Ks(new Set),p=Ks(null),m=Us(x=>{let{isOutside:b,tableDOMNode:N}=th(x,o.editorConfig?.lexical);if(b){n(!1),i(!1);return}if(!N)return;p.current=N;let D=null,k=null,_=null;if(e.getEditorState().read(()=>{let L=Ws(N);if(K1(L)){let v=z1(L,w=>Gs(w));if(!Gs(v))return;if(_=J1(v,e.getElementByKey(v.getKey())),_){let w=v.getChildrenSize(),$=v.getChildAtIndex(0)?.getChildrenSize(),H=G1(L),W=U1(L);H===w-1?D=L:W===$-1&&(k=L)}}},{editor:e}),!_)return;let g=_.parentElement;if(!g)return;let{bottom:S,height:M,left:O,right:F,width:I,y:T}=_.getBoundingClientRect(),C=!1;g&&g.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(C=g.scrollWidth>g.clientWidth);let{left:E,y:R}=t.getBoundingClientRect();D?(i(!1),n(!0),d({height:Js,left:C&&g?g.offsetLeft:O-E,top:S-R+5,width:C&&g?g.offsetWidth:I})):k&&(i(!0),n(!1),d({height:M,left:F-E+5,top:T-R,width:Js}))},50,250),f=q1(()=>new ResizeObserver(()=>{n(!1),i(!1)}),[]);Vs(()=>{if(s)return document.addEventListener("mousemove",m),()=>{n(!1),i(!1),document.removeEventListener("mousemove",m)}},[s,m]),Vs(()=>Z1(e.registerMutationListener(X1,x=>{e.getEditorState().read(()=>{let b=!1;for(let[N,D]of x)switch(D){case"created":{a.current.add(N),b=!0;break}case"destroyed":{a.current.delete(N),b=!0;break}default:break}if(b){f.disconnect();for(let N of a.current){let{tableElement:D}=j1(N);f.observe(D)}c(a.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,f]);let h=x=>{e.update(()=>{p.current&&(Ws(p.current)?.selectEnd(),x?(V1(),n(!1)):(W1(),i(!1)))})};return e?.isEditable()?B1(H1,{children:[r&&Sr("button",{"aria-label":"Add Row",className:o.editorConfig.lexical.theme.tableAddRows,onClick:()=>h(!0),style:{...u},type:"button"}),l&&Sr("button",{"aria-label":"Add Column",className:o.editorConfig.lexical.theme.tableAddColumns,onClick:()=>h(!1),style:{...u},type:"button"})]}):null}function th(t,e){let o=t.target;if(Y1(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 zs(t){let e=P1(2),{anchorElem:o}=t,r=o===void 0?document.body:o,[n]=Xs();if(!n?.isEditable())return null;let l;return e[0]!==r?(l=Q1(Sr(eh,{anchorElem:r}),r),e[0]=r,e[1]=l):l=e[1],l}import{c as oh}from"react/compiler-runtime";import{jsx as Lr,jsxs as rh}from"react/jsx-runtime";import{useLexicalComposerContext as nh}from"@lexical/react/LexicalComposerContext";import{TablePlugin as lh}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as ih,TableCellNode as sh,TableNode as ah,TableRowNode as ch}from"@lexical/table";import{mergeRegister as uh}from"@lexical/utils";import{formatDrawerSlug as dh,useEditDepth as mh}from"@payloadcms/ui";import{$getSelection as ph,$isRangeSelection as fh,COMMAND_PRIORITY_EDITOR as hh,createCommand as gh}from"lexical";import{createContext as xh,use as Ch,useEffect as bh,useMemo as kh,useState as _h}from"react";import*as Zs from"react";var go=gh("OPEN_EMBED_DRAWER_COMMAND"),Ys=xh({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function qs({children:t}){let[e,o]=_h({cellEditorConfig:null,cellEditorPlugins:null});return Lr(Ys,{value:kh(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var Qs=()=>{let t=oh(16),[e]=nh(),o=Ch(Ys),r=mh(),{fieldProps:n,uuid:l}=j(),{schemaPath:i}=n,s="lexical-table-create-"+l,c;t[0]!==r||t[1]!==s?(c=dh({slug:s,depth:r}),t[0]=r,t[1]=s,t[2]=c):c=t[2];let u=c,{toggleDrawer:d}=xe(u,!0),a;t[3]!==e||t[4]!==d?(a=()=>{if(!e.hasNodes([ah,ch,sh]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return uh(e.registerCommand(go,()=>{let h=null;return e.getEditorState().read(()=>{let x=ph();fh(x)&&(h=x)}),h&&d(),!0},hh))},t[3]=e,t[4]=d,t[5]=a):a=t[5];let p;t[6]!==o||t[7]!==e||t[8]!==d?(p=[o,e,d],t[6]=o,t[7]=e,t[8]=d,t[9]=p):p=t[9],bh(a,p);let m;t[10]!==e?(m=(h,x)=>{!x.columns||!x.rows||e.dispatchCommand(ih,{columns:String(x.columns),rows:String(x.rows)})},t[10]=e,t[11]=m):m=t[11];let f;return t[12]!==u||t[13]!==i||t[14]!==m?(f=rh(Zs.Fragment,{children:[Lr(st,{drawerSlug:u,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:m,schemaPath:i,schemaPathSuffix:"fields"}),Lr(lh,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]}),t[12]=u,t[13]=i,t[14]=m,t[15]=f):f=t[15],f};var Nh=y({markdownTransformers:[Ss],nodes:[wh,Th,Eh],plugins:[{Component:Qs,position:"normal"},{Component:Hs,position:"normal"},{Component:As,position:"floatingAnchorElem"},{Component:zs,position:"floatingAnchorElem"}],providers:[qs],slashMenu:{groups:[ee([{Icon:fr,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(go,{})}}])]},toolbarFixed:{groups:[ke([{ChildComponent:fr,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(go,{})}}])]}});import{$isNodeSelection as og}from"lexical";import{jsx as yr,jsxs as Sh}from"react/jsx-runtime";import"react";var Ir=()=>Sh("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 vh}from"react/jsx-runtime";import oa from"bson-objectid";import{$applyNodeReplacement as Mh}from"lexical";import*as ra from"react";import{jsx as Lh}from"react/jsx-runtime";import{DecoratorBlockNode as yh}from"@lexical/react/LexicalDecoratorBlockNode.js";import ea from"bson-objectid";import{$applyNodeReplacement as Ih}from"lexical";import"react";function Rr(t){return t.parentElement!=null&&t.parentElement.tagName==="LI"&&t.previousSibling===null&&t.getAttribute("aria-roledescription")==="checkbox"}function Rh(t){if(t.hasAttribute("data-lexical-upload-relation-to")&&t.hasAttribute("data-lexical-upload-id")){let o=t.getAttribute("data-lexical-upload-id"),r=t.getAttribute("data-lexical-upload-relation-to");if(o!=null&&r!=null)return{node:ta({data:{fields:{},relationTo:r,value:o}})}}let e=t;return e.src.startsWith("file:///")||Rr(e),null}var Dt=class extends yh{__data;constructor({data:e,format:o,key:r}){super(o,r),this.__data=e}static clone(e){return new this({data:e.__data,format:e.__format,key:e.__key})}static getType(){return"upload"}static importDOM(){return{img:e=>({conversion:Rh,priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new ea.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,relationTo:e.relationTo,value:e.value},r=ta({data:o});return r.setFormat(e.format),r}static isInline(){return!1}decorate(){return Lh(RawUploadComponent,{data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportDOM(){let e=document.createElement("img");return e.setAttribute("data-lexical-upload-id",String(this.__data?.value)),e.setAttribute("data-lexical-upload-relation-to",this.__data?.relationTo),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"upload",version:3}}getData(){return this.getLatest().__data}setData(e){let o=this.getWritable();o.__data=e}updateDOM(){return!1}};function ta({data:t}){return t?.id||(t.id=new ea.default().toHexString()),Ih(new Dt({data:t}))}var Dh=ra.lazy(()=>import("./component-NNKG7K3O.js").then(t=>({default:t.UploadComponent})));function Ah(t){if(t.hasAttribute("data-lexical-upload-relation-to")&&t.hasAttribute("data-lexical-upload-id")){let o=t.getAttribute("data-lexical-upload-id"),r=t.getAttribute("data-lexical-upload-relation-to");if(o!=null&&r!=null)return{node:Ge({data:{fields:{},relationTo:r,value:o}})}}let e=t;return e.src.startsWith("file:///")||Rr(e),null}var Ie=class extends Dt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{img:e=>({conversion:Ah,priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new oa.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,relationTo:e.relationTo,value:e.value},r=Ge({data:o});return r.setFormat(e.format),r}decorate(){return vh(Dh,{data:this.__data,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Ge({data:t}){return t?.id||(t.id=new oa.default().toHexString()),Mh(new Ie({data:t}))}function vr(t){return t instanceof Ie}import{c as Uh}from"react/compiler-runtime";import{jsx as Gh}from"react/jsx-runtime";import{useLexicalComposerContext as Wh}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Vh,mergeRegister as Kh}from"@lexical/utils";import{useConfig as Jh}from"@payloadcms/ui";import{$getPreviousSelection as Xh,$getSelection as zh,$isParagraphNode as Zh,$isRangeSelection as Yh,COMMAND_PRIORITY_EDITOR as qh,createCommand as Qh}from"lexical";import{useEffect as eg}from"react";import{c as na}from"react/compiler-runtime";import{jsx as Mr}from"react/jsx-runtime";import{useLexicalComposerContext as la}from"@lexical/react/LexicalComposerContext.js";import{toast as Oh}from"@payloadcms/ui";import{$getNodeByKey as $h,COMMAND_PRIORITY_EDITOR as ia}from"lexical";import{useEffect as sa,useState as Fh}from"react";var Ph=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=$h(o);n&&n.replace(Ge({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(Dr,{fields:null,relationTo:e,value:r})},Bh=t=>{let e=na(13),{enabledCollectionSlugs:o}=t,[r]=la(),[n,l]=Fh(null),i;e[0]!==o?(i={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=i):i=e[1];let{closeListDrawer:s,ListDrawer:c,openListDrawer:u}=yt(i),d,a;e[2]!==r||e[3]!==u?(d=()=>r.registerCommand(Ke,h=>(l(h?.replace?h?.replace.nodeKey:null),u(),!0),ia),a=[r,u],e[2]=r,e[3]=u,e[4]=d,e[5]=a):(d=e[4],a=e[5]),sa(d,a);let p;e[6]!==s||e[7]!==r||e[8]!==n?(p=h=>{let{collectionSlug:x,doc:b}=h;s(),Ph({editor:r,relationTo:x,replaceNodeKey:n,value:b.id})},e[6]=s,e[7]=r,e[8]=n,e[9]=p):p=e[9];let m=p,f;return e[10]!==c||e[11]!==m?(f=Mr(c,{onSelect:m}),e[10]=c,e[11]=m,e[12]=f):f=e[12],f},Hh=()=>{let t=na(3),[e]=la(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Ke,jh,ia),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),sa(o,r),null},aa=t=>Mr(At,{...t,FallbackComponent:Hh,uploads:!0,children:Mr(Bh,{...t})});function jh(){return Oh.error("No upload collections enabled"),!0}var Dr=Qh("INSERT_UPLOAD_COMMAND"),ca=t=>{let e=Uh(5),[o]=Wh(),{config:r}=Jh(),{collections:n}=r,l,i;e[0]!==o?(l=()=>{if(!o.hasNodes([Ie]))throw new Error("UploadPlugin: UploadNode not registered on editor");return Kh(o.registerCommand(Dr,c=>(o.update(()=>{let u=zh()||Xh();if(Yh(u)){let d=Ge({data:{id:c.id,fields:c.fields,relationTo:c.relationTo,value:c.value}}),{focus:a}=u,p=a.getNode();Vh(d),Zh(p)&&!p.__first&&p.remove()}}),!0),qh))},i=[o],e[0]=o,e[1]=l,e[2]=i):(l=e[1],i=e[2]),eg(l,i);let s;return e[3]!==n?(s=Gh(aa,{enabledCollectionSlugs:n.map(tg)}),e[3]=n,e[4]=s):s=e[4],s};function tg(t){let{slug:e}=t;return e}var rg=y({nodes:[Ie],plugins:[{Component:ca,position:"normal"}],slashMenu:{groups:[ee([{Icon:Ir,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ke,{replace:!1})}}])]},toolbarFixed:{groups:[ke([{ChildComponent:Ir,isActive:({selection:t})=>{if(!og(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return vr(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ke,{replace:!1})}}])]}});import{c as lg}from"react/compiler-runtime";import{jsx as Or}from"react/jsx-runtime";import{ShimmerEffect as ig,useConfig as sg}from"@payloadcms/ui";import{lazy as ag,Suspense as cg,useEffect as ug,useState as dg}from"react";var ua={block:"LexicalEditorTheme__block",blockCursor:"LexicalEditorTheme__blockCursor",characterLimit:"LexicalEditorTheme__characterLimit",code:"LexicalEditorTheme__code",codeHighlight:{atrule:"LexicalEditorTheme__tokenAttr",attr:"LexicalEditorTheme__tokenAttr",boolean:"LexicalEditorTheme__tokenProperty",builtin:"LexicalEditorTheme__tokenSelector",cdata:"LexicalEditorTheme__tokenComment",char:"LexicalEditorTheme__tokenSelector",class:"LexicalEditorTheme__tokenFunction","class-name":"LexicalEditorTheme__tokenFunction",comment:"LexicalEditorTheme__tokenComment",constant:"LexicalEditorTheme__tokenProperty",deleted:"LexicalEditorTheme__tokenProperty",doctype:"LexicalEditorTheme__tokenComment",entity:"LexicalEditorTheme__tokenOperator",function:"LexicalEditorTheme__tokenFunction",important:"LexicalEditorTheme__tokenVariable",inserted:"LexicalEditorTheme__tokenSelector",keyword:"LexicalEditorTheme__tokenAttr",namespace:"LexicalEditorTheme__tokenVariable",number:"LexicalEditorTheme__tokenProperty",operator:"LexicalEditorTheme__tokenOperator",prolog:"LexicalEditorTheme__tokenComment",property:"LexicalEditorTheme__tokenProperty",punctuation:"LexicalEditorTheme__tokenPunctuation",regex:"LexicalEditorTheme__tokenVariable",selector:"LexicalEditorTheme__tokenSelector",string:"LexicalEditorTheme__tokenSelector",symbol:"LexicalEditorTheme__tokenProperty",tag:"LexicalEditorTheme__tokenProperty",url:"LexicalEditorTheme__tokenOperator",variable:"LexicalEditorTheme__tokenVariable"},embedBlock:{base:"LexicalEditorTheme__embedBlock",focus:"LexicalEditorTheme__embedBlockFocus"},hashtag:"LexicalEditorTheme__hashtag",heading:{h1:"LexicalEditorTheme__h1",h2:"LexicalEditorTheme__h2",h3:"LexicalEditorTheme__h3",h4:"LexicalEditorTheme__h4",h5:"LexicalEditorTheme__h5",h6:"LexicalEditorTheme__h6"},hr:"LexicalEditorTheme__hr",hrSelected:"LexicalEditorTheme__hrSelected",indent:"LexicalEditorTheme__indent",inlineImage:"LexicalEditor__inline-image",link:"LexicalEditorTheme__link",list:{checklist:"LexicalEditorTheme__checklist",listitem:"LexicalEditorTheme__listItem",listitemChecked:"LexicalEditorTheme__listItemChecked",listitemUnchecked:"LexicalEditorTheme__listItemUnchecked",nested:{listitem:"LexicalEditorTheme__nestedListItem"},olDepth:["LexicalEditorTheme__ol1","LexicalEditorTheme__ol2","LexicalEditorTheme__ol3","LexicalEditorTheme__ol4","LexicalEditorTheme__ol5"],ul:"LexicalEditorTheme__ul"},ltr:"LexicalEditorTheme__ltr",mark:"LexicalEditorTheme__mark",markOverlap:"LexicalEditorTheme__markOverlap",paragraph:"LexicalEditorTheme__paragraph",quote:"LexicalEditorTheme__quote",relationship:"LexicalEditorTheme__relationship",rtl:"LexicalEditorTheme__rtl",tab:"LexicalEditorTheme__tabNode",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableAlignment:{center:"LexicalEditorTheme__tableAlignmentCenter",right:"LexicalEditorTheme__tableAlignmentRight"},tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableFrozenColumn:"LexicalEditorTheme__tableFrozenColumn",tableRowStriping:"LexicalEditorTheme__tableRowStriping",tableScrollableWrapper:"LexicalEditorTheme__tableScrollableWrapper",tableSelected:"LexicalEditorTheme__tableSelected",tableSelection:"LexicalEditorTheme__tableSelection",text:{bold:"LexicalEditorTheme__textBold",code:"LexicalEditorTheme__textCode",italic:"LexicalEditorTheme__textItalic",strikethrough:"LexicalEditorTheme__textStrikethrough",subscript:"LexicalEditorTheme__textSubscript",superscript:"LexicalEditorTheme__textSuperscript",underline:"LexicalEditorTheme__textUnderline",underlineStrikethrough:"LexicalEditorTheme__textUnderlineStrikethrough"},upload:"editor-upload"};var xo={namespace:"lexical",theme:ua};function da({config:t,featureClientImportMap:e,featureClientSchemaMap:o,field:r,schemaPath:n,unSanitizedEditorConfig:l}){for(let u of l.features)if(!u?.clientFeatureProps?.featureKey||u?.clientFeatureProps?.order===void 0||u?.clientFeatureProps?.order===null)throw new Error("A Feature you have installed does not return the client props as clientFeatureProps. Please make sure to always return those props, even if they are null, as other important props like order and featureKey are later on injected.");l.features=l.features.sort((u,d)=>u.clientFeatureProps.order-d.clientFeatureProps.order);let i=new Map;for(let u of l.features)i.set(u.clientFeatureProps.featureKey,u);let s=new Map,c=0;for(let u of l.features){let d=typeof u.feature=="function"?u.feature({config:t,featureClientImportMap:e,featureClientSchemaMap:o,featureProviderMap:i,field:r,resolvedFeatures:s,schemaPath:n,unSanitizedEditorConfig:l}):u.feature;d.key=u.clientFeatureProps.featureKey,d.order=c,s.set(u.clientFeatureProps.featureKey,d),c++}return s}import{deepMerge as ng}from"payload/shared";var ma=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}},o={};if(t.forEach(r=>{r.key==="toolbarFixed"&&r.sanitizedClientFeatureProps?.customGroups&&(o={...o,...r.sanitizedClientFeatureProps.customGroups})}),!t?.size)return e;t.forEach(r=>{if(r.providers?.length&&(e.providers=e.providers.concat(r.providers)),r.enableFormats?.length&&e.enabledFormats.push(...r.enableFormats),r.nodes?.length)for(let n of r.nodes)e.nodes.push(n);if(r.plugins?.length&&r.plugins.forEach((n,l)=>{e.plugins?.push({clientProps:r.sanitizedClientFeatureProps,Component:n.Component,key:r.key+l,position:n.position})}),r.toolbarInline?.groups?.length)for(let n of r.toolbarInline.groups){let l=e.toolbarInline.groups.find(i=>i.key===n.key);l?e.toolbarInline.groups=e.toolbarInline.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.toolbarInline?.groups.push(l)}if(r.toolbarFixed?.groups?.length)for(let n of r.toolbarFixed.groups){let l=e.toolbarFixed.groups.find(i=>i.key===n.key);l?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.toolbarFixed?.groups.push(l)}if(r.slashMenu?.groups){r.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(r.slashMenu.dynamicGroups));for(let n of r.slashMenu.groups){let l=e.slashMenu.groups.find(i=>i.key===n.key);l?e.slashMenu.groups=e.slashMenu.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.slashMenu.groups.push(l)}}if(r.markdownTransformers?.length)for(let n of r.markdownTransformers)typeof n=="function"?e.markdownTransformers.push(n({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(n);e.enabledFeatures.push(r.key)}),Object.keys(o).length>0&&(e.toolbarFixed.groups=e.toolbarFixed.groups.map(r=>{let n=o[r.key];return n?ng(r,n):r})),e.toolbarInline.groups.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0),e.toolbarFixed.groups.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);for(let r of e.toolbarInline.groups)r.items.sort((n,l)=>n.order&&l.order?n.order-l.order:n.order?-1:l.order?1:0);for(let r of e.toolbarFixed.groups)r.items.sort((n,l)=>n.order&&l.order?n.order-l.order:n.order?-1:l.order?1:0);return e};function Ar(t,e,o){return{admin:o,features:ma(t),lexical:e,resolvedFeatureMap:t}}var mg=ag(()=>import("./Field-6OZARKAL.js").then(t=>({default:t.RichText}))),pg=t=>{let e=lg(16),{admin:o,clientFeatures:r,featureClientImportMap:n,featureClientSchemaMap:l,field:i,lexicalEditorConfig:s,schemaPath:c}=t,u;e[0]!==o?(u=o===void 0?{}:o,e[0]=o,e[1]=u):u=e[1];let d=u,a=s===void 0?xo:s,{config:p}=sg(),[m,f]=dg(null),h,x;e[2]!==d||e[3]!==r||e[4]!==p||e[5]!==n||e[6]!==l||e[7]!==i||e[8]!==m||e[9]!==a||e[10]!==c?(h=()=>{if(m)return;let N=[];for(let[_,g]of Object.entries(r))g.clientFeatureProvider&&N.push(g.clientFeatureProvider(g.clientFeatureProps));let D=a||xo,k=da({config:p,featureClientImportMap:n,featureClientSchemaMap:l,field:i,schemaPath:c??i.name,unSanitizedEditorConfig:{features:N,lexical:D}});f(Ar(k,D,d))},x=[a,d,m,r,n,l,i,p,c],e[2]=d,e[3]=r,e[4]=p,e[5]=n,e[6]=l,e[7]=i,e[8]=m,e[9]=a,e[10]=c,e[11]=h,e[12]=x):(h=e[11],x=e[12]),ug(h,x);let b;return e[13]!==m||e[14]!==t?(b=Or(cg,{fallback:Or(ig,{height:"35vh"}),children:m&&Or(mg,{...t,editorConfig:m})}),e[13]=m,e[14]=t,e[15]=b):b=e[15],b};function fg(t){return t instanceof HTMLElement}function hg(...t){return t.filter(Boolean).join(" ")}var Co=new WeakMap;function pa(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function bo(t,e){let o=Co.get(t);if(o===void 0){let r=new Set,n=i=>{o!==void 0&&(o.start=pa(i))},l=i=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let c=pa(i);for(let u of r)c!==null&&u([c[0]-s[0],c[1]-s[1]],i)};t.addEventListener("touchstart",n),t.addEventListener("touchend",l),o={handleTouchend:l,handleTouchstart:n,listeners:r,start:null},Co.set(t,o)}return o.listeners.add(e),()=>{gg(t,e)}}function gg(t,e){let o=Co.get(t);if(o===void 0)return;let{listeners:r}=o;r.delete(e),r.size===0&&(Co.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function xg(t,e){return bo(t,(o,r)=>{let[n,l]=o;n<0&&-n>Math.abs(l)&&e(n,r)})}function Cg(t,e){return bo(t,(o,r)=>{let[n,l]=o;n>0&&n>Math.abs(l)&&e(n,r)})}function bg(t,e){return bo(t,(o,r)=>{let[n,l]=o;l<0&&-l>Math.abs(n)&&e(n,r)})}function kg(t,e){return bo(t,(o,r)=>{let[n,l]=o;l>0&&l>Math.abs(n)&&e(n,r)})}import{c as _g}from"react/compiler-runtime";import{jsx as Tg}from"react/jsx-runtime";import"react";var wg=()=>{let t=_g(2),{EditButton:e}=Ce(),o;return t[0]!==e?(o=e?Tg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Eg}from"react/compiler-runtime";import{jsx as Ng}from"react/jsx-runtime";import"react";var Sg=()=>{let t=Eg(2),{RemoveButton:e}=Ce(),o;return t[0]!==e?(o=e?Ng(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Lg}from"react/compiler-runtime";import{jsx as yg}from"react/jsx-runtime";import"react";var Ig=()=>{let t=Lg(2),{Label:e}=Ce(),o;return t[0]!==e?(o=e?yg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Rg}from"react/compiler-runtime";import{jsx as vg}from"react/jsx-runtime";import"react";var Mg=t=>{let e=Rg(3),{children:o}=t,{InlineBlockContainer:r}=Ce(),n;return e[0]!==r||e[1]!==o?(n=r?vg(r,{children:o}):null,e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{c as Dg}from"react/compiler-runtime";import{jsx as Ag}from"react/jsx-runtime";import"react";var Og=t=>{let e=Dg(6),{children:o,editButton:r,Label:n,removeButton:l}=t,{BlockCollapsible:i}=Oe(),s;return e[0]!==i||e[1]!==n||e[2]!==o||e[3]!==r||e[4]!==l?(s=i?Ag(i,{editButton:r,Label:n,removeButton:l,children:o}):null,e[0]=i,e[1]=n,e[2]=o,e[3]=r,e[4]=l,e[5]=s):s=e[5],s};import{c as $g}from"react/compiler-runtime";import{jsx as Fg}from"react/jsx-runtime";import"react";var Pg=()=>{let t=$g(2),{EditButton:e}=Oe(),o;return t[0]!==e?(o=e?Fg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Bg}from"react/compiler-runtime";import{jsx as Hg}from"react/jsx-runtime";import"react";var jg=()=>{let t=Bg(2),{RemoveButton:e}=Oe(),o;return t[0]!==e?(o=e?Hg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as Ug}from"qs-esm";var Gg=({apiURL:t,depth:e,draft:o,locale:r})=>async({id:l,collectionSlug:i,select:s})=>{let c=Ug({depth:e??0,draft:o??!1,locale:r,select:s},{addQueryPrefix:!0});return await fetch(`${t}/${i}/${l}${c}`,{credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json"},method:"GET"}).then(d=>d.json())};export{Ct as $createAutoLinkNode,Vt as $createBlockNode,_o as $createInlineBlockNode,_e as $createLinkNode,je as $createRelationshipNode,Ge as $createUploadNode,we as $isAutoLinkNode,ft as $isBlockNode,To as $isInlineBlockNode,Z as $isLinkNode,ar as $isRelationshipNode,vr as $isUploadNode,Sa as AlignFeatureClient,Te as AutoLinkNode,Og as BlockCollapsible,Pg as BlockEditButton,be as BlockNode,jg as BlockRemoveButton,va as BlockquoteFeatureClient,yc as BlocksFeatureClient,Yc as BoldFeatureClient,ce as CAN_USE_DOM,Ym as ChecklistFeatureClient,jp as DETAIL_TYPE_TO_DETAIL,Fp as DOUBLE_LINE_BREAK,qp as DebugJsxConverterFeatureClient,Gp as ELEMENT_FORMAT_TO_TYPE,Up as ELEMENT_TYPE_TO_FORMAT,ba as ENABLE_SLASH_MENU_COMMAND,ha as EditorConfigProvider,st as FieldsDrawer,_0 as FixedToolbarFeatureClient,Wu as HeadingFeatureClient,sd as HorizontalRuleFeatureClient,Je as INSERT_BLOCK_COMMAND,Xe as INSERT_INLINE_BLOCK_COMMAND,Op as IS_ALL_FORMATTING,wd as IndentFeatureClient,Mg as InlineBlockContainer,wg as InlineBlockEditButton,Ig as InlineBlockLabel,ko as InlineBlockNode,Sg as InlineBlockRemoveButton,ou as InlineCodeFeatureClient,M0 as InlineToolbarFeatureClient,iu as ItalicFeatureClient,Bp as LTR_REGEX,bp as LexicalPluginToLexicalFeatureClient,$m as LinkFeatureClient,ie as LinkNode,$p as NON_BREAKING_SPACE,A as NodeFormat,lp as OrderedListFeatureClient,Lp as ParagraphFeatureClient,xa as Point,Pp as RTL_REGEX,ka as Rect,Bf as RelationshipFeatureClient,Ne as RelationshipNode,pg as RichTextField,Np as SlateToLexicalFeatureClient,du as StrikethroughFeatureClient,hu as SubscriptFeatureClient,bu as SuperscriptFeatureClient,Wp as TEXT_MODE_TO_TYPE,Hp as TEXT_TYPE_TO_FORMAT,Vp as TEXT_TYPE_TO_MODE,he as TOGGLE_LINK_COMMAND,Nh as TableFeatureClient,Uc as TestRecorderFeatureClient,Ou as TextStateFeatureClient,It as ToolbarButton,Ue as ToolbarDropdown,Jc as TreeViewFeatureClient,Eu as UnderlineFeatureClient,pp as UnorderedListFeatureClient,rg as UploadFeatureClient,Ie as UploadNode,kg as addSwipeDownListener,xg as addSwipeLeftListener,Cg as addSwipeRightListener,bg as addSwipeUpListener,Ho as createBlockNode,y as createClientFeature,Qp as defaultColors,xo as defaultEditorLexicalConfig,pr as getDOMRangeRect,_a as getEnabledNodes,Gg as getRestPopulateFn,ze as getSelectedNode,fg as isHTMLElement,Ca as isPoint,hg as joinClasses,Ar as sanitizeClientEditorConfig,ma as sanitizeClientFeatures,io as setFloatingElemPosition,eo as setFloatingElemPositionForLinkEditor,ee as slashMenuBasicGroupWithItems,ke as toolbarAddDropdownGroupWithItems,Uo as toolbarFeatureButtonsGroupWithItems,te as toolbarFormatGroupWithItems,le as toolbarTextDropdownGroupWithItems,Oe as useBlockComponentContext,j as useEditorConfigContext,Ce as useInlineBlockComponentContext,ga as useLexicalDocumentDrawer,xe as useLexicalDrawer,yt as useLexicalListDrawer};
40
+ `);let o=D0(co.NO_STATUS);return Pr(t,e,o),o},Es=(t,e)=>{let o=t.match(Ns);return!o||!o[1]?null:o[1].split("|").map(r=>Ls(r,e))};import{c as W0}from"react/compiler-runtime";import{jsx as P,jsxs as Le}from"react/jsx-runtime";import{useLexicalComposerContext as vs}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as V0}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as Cr,$deleteTableColumn__EXPERIMENTAL as K0,$deleteTableRow__EXPERIMENTAL as J0,$getNodeTriplet as X0,$getTableCellNodeFromLexicalNode as Is,$getTableColumnIndexFromTableCellNode as z0,$getTableNodeFromLexicalNodeOrThrow as ye,$getTableRowIndexFromTableCellNode as Z0,$insertTableColumn__EXPERIMENTAL as Y0,$insertTableRow__EXPERIMENTAL as q0,$isTableCellNode as Ms,$isTableSelection as vt,$unmergeCell as Q0,getTableElement as br,getTableObserverFromTableElement as kr,TableCellHeaderStates as De,TableCellNode as e1}from"@lexical/table";import{mergeRegister as t1}from"@lexical/utils";import{useScrollInfo as o1}from"@payloadcms/ui";import{$createParagraphNode as r1,$getSelection as mo,$isElementNode as n1,$isParagraphNode as l1,$isRangeSelection as _r,$isTextNode as i1,$setSelection as s1,COMMAND_PRIORITY_CRITICAL as a1,getDOMSelection as c1,isDOMNode as u1,SELECTION_CHANGE_COMMAND as d1}from"lexical";import*as Tr from"react";import{useCallback as pe,useEffect as rt,useRef as uo,useState as nt}from"react";import{createPortal as Ds}from"react-dom";import{jsx as xr,jsxs as G0}from"react/jsx-runtime";import"react";var ys=()=>G0("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[xr("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"}),xr("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"}),xr("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 Rs(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function m1(){let t=mo();if(_r(t)&&!t.isCollapsed()||vt(t)&&!t.anchor.is(t.focus)||!_r(t)&&!vt(t))return!1;let[e]=X0(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function p1(t){if(t.getChildrenSize()!==1)return!1;let e=t.getFirstChildOrThrow();return!(!l1(e)||!e.isEmpty())}function f1(t){let e=t.getLastDescendant();i1(e)?e.select():n1(e)?e.selectEnd():e!==null&&e.selectNext()}function h1({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[l]=vs(),i=uo(null),[s,c]=nt(n),[u,d]=nt({columns:1,rows:1}),[a,p]=nt(!1),[m,f]=nt(!1),{y:h}=o1();rt(()=>l.registerMutationListener(e1,C=>{C.get(s.getKey())==="updated"&&l.getEditorState().read(()=>{c(s.getLatest())})},{skipInitialization:!0}),[l,s]),rt(()=>{l.getEditorState().read(()=>{let C=mo();if(vt(C)){let E=Rs(C);d(Rs(C)),p(E.columns>1||E.rows>1)}f(m1())})},[l]),rt(()=>{let C=e.current,E=i.current,R=l.getRootElement();if(C!=null&&E!=null&&R!=null){let L=R.getBoundingClientRect(),v=C.getBoundingClientRect();E.style.opacity="1";let w=E.getBoundingClientRect(),$=5,H=v.right+$;if(H+w.width>window.innerWidth||H+w.width>L.right){let Y=v.left-w.width-$;H=(Y<0?$:Y)+window.pageXOffset}E.style.left=`${H+window.pageXOffset}px`;let W=v.top;if(W+w.height>window.innerHeight){let Y=v.bottom-w.height;W=Y<0?$:Y}E.style.top=`${W}px`}},[e,i,l,h]),rt(()=>{function C(E){i.current!=null&&e.current!=null&&u1(E.target)&&!i.current.contains(E.target)&&!e.current.contains(E.target)&&r(!1)}return window.addEventListener("click",C),()=>window.removeEventListener("click",C)},[r,e]);let x=pe(()=>{l.update(()=>{if(s.isAttached()){let C=ye(s),E=br(C,l.getElementByKey(C.getKey()));if(E===null)throw new Error("Expected to find tableElement in DOM");let R=kr(E);R!==null&&R.$clearHighlight(),C.markDirty(),c(s.getLatest())}s1(null)})},[l,s]),b=()=>{l.update(()=>{let C=mo();if(vt(C)){let R=C.getNodes().filter(Ms);if(R.length===0)return;let L=ye(R[0]),[v]=Cr(L,null,null),w=1/0,$=-1/0,H=1/0,W=-1/0,Y=new Set;for(let q of v)for(let K of q){if(!K||!K.cell)continue;let re=K.cell.getKey();if(!Y.has(re)&&R.some(ne=>ne.is(K.cell))){Y.add(re);let ne=K.startRow,se=K.startColumn,Ae=K.cell.__rowSpan||1,it=K.cell.__colSpan||1;w=Math.min(w,ne),$=Math.max($,ne+Ae-1),H=Math.min(H,se),W=Math.max(W,se+it-1)}}if(w===1/0||H===1/0)return;let We=$-w+1,V=W-H+1,U=v?.[w]?.[H];if(!U?.cell)return;let oe=U.cell;oe.setColSpan(V),oe.setRowSpan(We);let ue=new Set([oe.getKey()]);for(let q=w;q<=$;q++)for(let K=H;K<=W;K++){let re=v?.[q]?.[K];if(!re?.cell)continue;let ne=re.cell,se=ne.getKey();ue.has(se)||(ue.add(se),p1(ne)||oe.append(...ne.getChildren()),ne.remove())}oe.getChildrenSize()===0&&oe.append(r1()),f1(oe),o()}})},N=()=>{l.update(()=>{Q0()})},D=pe(C=>{l.update(()=>{for(let E=0;E<u.rows;E++)q0(C);o()})},[l,o,u.rows]),k=pe(C=>{l.update(()=>{for(let E=0;E<u.columns;E++)Y0(C);o()})},[l,o,u.columns]),_=pe(()=>{l.update(()=>{J0(),o()})},[l,o]),g=pe(()=>{l.update(()=>{ye(s).remove(),x(),o()})},[l,s,x,o]),S=pe(()=>{l.update(()=>{K0(),o()})},[l,o]),M=pe(()=>{l.update(()=>{let C=ye(s),E=Z0(s),[R]=Cr(C,null,null),L=new Set,v=s.getHeaderStyles()^De.ROW;if(R[E])for(let w=0;w<R[E].length;w++){let $=R[E][w];$?.cell&&(L.has($.cell)||(L.add($.cell),$.cell.setHeaderStyles(v,De.ROW)))}x(),o()})},[l,s,x,o]),O=pe(()=>{l.update(()=>{let C=ye(s),E=z0(s),[R]=Cr(C,null,null),L=new Set,v=s.getHeaderStyles()^De.COLUMN;if(R)for(let w=0;w<R.length;w++){let $=R?.[w]?.[E];$?.cell&&(L.has($.cell)||(L.add($.cell),$.cell.setHeaderStyles(v,De.COLUMN)))}x(),o()})},[l,s,x,o]),F=pe(()=>{l.update(()=>{if(s.isAttached()){let C=ye(s);C&&C.setRowStriping(!C.getRowStriping())}x(),o()})},[l,s,x,o]),I=pe(()=>{l.update(()=>{if(s.isAttached()){let C=ye(s);C&&C.setFrozenColumns(C.getFrozenColumns()===0?1:0)}x(),o()})},[l,s,x,o]),T=null;return t&&(a?T=P("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>b(),type:"button",children:P("span",{className:"text",children:"Merge cells"})}):m&&(T=P("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>N(),type:"button",children:P("span",{className:"text",children:"Unmerge cells"})}))),Ds(Le("div",{className:"table-action-menu-dropdown",onClick:C=>{C.stopPropagation()},ref:i,children:[T?Le(Tr.Fragment,{children:[T,P("hr",{})]}):null,P("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>F(),type:"button",children:P("span",{className:"text",children:"Toggle Row Striping"})}),P("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>I(),type:"button",children:P("span",{className:"text",children:"Toggle First Column Freeze"})}),P("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>D(!1),type:"button",children:Le("span",{className:"text",children:["Insert ",u.rows===1?"row":`${u.rows} rows`," above"]})}),P("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>D(!0),type:"button",children:Le("span",{className:"text",children:["Insert ",u.rows===1?"row":`${u.rows} rows`," below"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>k(!1),type:"button",children:Le("span",{className:"text",children:["Insert ",u.columns===1?"column":`${u.columns} columns`," ","left"]})}),P("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>k(!0),type:"button",children:Le("span",{className:"text",children:["Insert ",u.columns===1?"column":`${u.columns} columns`," ","right"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>S(),type:"button",children:P("span",{className:"text",children:"Delete column"})}),P("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>_(),type:"button",children:P("span",{className:"text",children:"Delete row"})}),P("button",{className:"item","data-test-id":"table-delete",onClick:()=>g(),type:"button",children:P("span",{className:"text",children:"Delete table"})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-row-header",onClick:()=>M(),type:"button",children:Le("span",{className:"text",children:[(s.__headerState&De.ROW)===De.ROW?"Remove":"Add"," ","row header"]})}),P("button",{className:"item","data-test-id":"table-column-header",onClick:()=>O(),type:"button",children:Le("span",{className:"text",children:[(s.__headerState&De.COLUMN)===De.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function g1({anchorElem:t,cellMerge:e}){let[o]=vs(),r=uo(null),n=uo(null),[l,i]=nt(!1),[s,c]=nt(null),u=pe(()=>{let a=r.current,p=mo(),m=c1(o._window),f=document.activeElement;function h(){a&&(a.classList.remove("table-cell-action-button-container--active"),a.classList.add("table-cell-action-button-container--inactive")),c(null)}if(p==null||a==null)return h();let x=o.getRootElement(),b=null,N=null;if(_r(p)&&x!==null&&m!==null&&x.contains(m.anchorNode)){let k=Is(p.anchor.getNode());if(k==null||(N=o.getElementByKey(k.getKey()),N==null||!k.isAttached()))return h();let _=ye(k),g=br(_,o.getElementByKey(_.getKey()));if(g===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");b=kr(g),c(k)}else if(vt(p)){let k=Is(p.anchor.getNode());if(!Ms(k))throw new Error("TableSelection anchorNode must be a TableCellNode");let _=ye(k),g=br(_,o.getElementByKey(_.getKey()));if(g===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");b=kr(g),N=o.getElementByKey(k.getKey())}else if(!f)return h();if(b===null||N===null)return h();let D=!b||!b.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",D),a.classList.toggle("table-cell-action-button-container--inactive",!D),D){let k=N.getBoundingClientRect(),_=t.getBoundingClientRect(),g=k.top-_.top,S=k.right-_.left;a.style.transform=`translate(${S}px, ${g}px)`}},[o,t]);rt(()=>{let a,p=()=>{a=void 0,o.getEditorState().read(u)},m=()=>(a===void 0&&(a=setTimeout(p,0)),!1);return t1(o.registerUpdateListener(m),o.registerCommand(d1,m,a1),o.registerRootListener((f,h)=>{h&&h.removeEventListener("pointerup",m),f&&(f.addEventListener("pointerup",m),m())}),()=>clearTimeout(a))});let d=uo(s);return rt(()=>{d.current!==s&&i(!1),d.current=s},[d,s]),P("div",{className:"table-cell-action-button-container",ref:r,children:s!=null&&Le(Tr.Fragment,{children:[P("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),i(!l)},ref:n,type:"button",children:P(ys,{})}),l&&P(h1,{cellMerge:e,contextRef:n,onClose:()=>i(!1),setIsMenuOpen:i,tableCellNode:s})]})})}var As=t=>{let e=W0(3),{anchorElem:o}=t,r=V0(),n;return e[0]!==o||e[1]!==r?(n=Ds(r?P(g1,{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 x1}from"react/compiler-runtime";import{jsx as fo,jsxs as C1}from"react/jsx-runtime";import{useLexicalComposerContext as b1}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as k1}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as _1,$getTableNodeFromLexicalNodeOrThrow as wr,$getTableRowIndexFromTableCellNode as T1,$isTableCellNode as Os,$isTableRowNode as w1,getDOMCellFromTarget as E1,getTableElement as N1,TableNode as $s}from"@lexical/table";import{calculateZoomLevel as Fs,mergeRegister as S1}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Er,isHTMLElement as L1}from"lexical";import*as Bs from"react";import{useCallback as Mt,useEffect as Nr,useRef as po,useState as lt}from"react";import{createPortal as y1}from"react-dom";var I1=33,Ps=92;function R1({editor:t}){let e=po(null),o=po(null),r=po(null),[n,l]=lt(!1),i=j(),s=po(null),[c,u]=lt(null),[d,a]=lt(null),[p,m]=lt(!1),[f,h]=lt(null),x=Mt(()=>{a(null),e.current=null,h(null),s.current=null,r.current=null},[]),b=I=>(I.buttons&1)===1;Nr(()=>{let I=new Set;return S1(t.registerMutationListener($s,T=>{for(let[C,E]of T)E==="destroyed"?I.delete(C):I.add(C);l(I.size>0)}),t.registerNodeTransform($s,T=>{if(T.getColWidths())return T;let C=T.getColumnCount(),E=Ps;return T.setColWidths(Array(C).fill(E)),T}))},[t]),Nr(()=>{if(!n)return;let I=R=>{let L=R.target;if(L1(L)){if(f){u({x:R.clientX,y:R.clientY});return}if(m(b(R)),!(o.current&&o.current.contains(L))&&e.current!==L){e.current=L;let v=E1(L);v&&d!==v?t.getEditorState().read(()=>{let w=Er(v.elem);if(!w)throw new Error("TableCellResizer: Table cell node not found.");let $=wr(w),H=N1($,t.getElementByKey($.getKey()));if(!H)throw new Error("TableCellResizer: Table element not found.");e.current=L,r.current=H.getBoundingClientRect(),a(v)},{editor:t}):v==null&&x()}}},T=R=>{m(!0)},C=R=>{m(!1)},E=t.registerRootListener((R,L)=>{L?.removeEventListener("mousemove",I),L?.removeEventListener("mousedown",T),L?.removeEventListener("mouseup",C),R?.addEventListener("mousemove",I),R?.addEventListener("mousedown",T),R?.addEventListener("mouseup",C)});return()=>{E()}},[d,f,t,n,x]);let N=I=>I==="bottom",D=Mt(I=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let T=Er(d.elem);if(!Os(T))throw new Error("TableCellResizer: Table cell node not found.");let C=wr(T),E=T1(T),R=C.getChildren(),v=T.getColSpan()===C.getColumnCount()?E:E+T.getRowSpan()-1;if(v>=R.length||v<0)throw new Error("Expected table cell to be inside of table row.");let w=R[v];if(!w1(w))throw new Error("Expected table row");let $=w.getHeight();if($===void 0){let W=w.getChildren();$=Math.min(...W.map(Y=>k(Y,t)??1/0))}let H=Math.max($+I,I1);w.setHeight(H)},{tag:"skip-scroll-into-view"})},[d,t]),k=(I,T)=>T.getElementByKey(I.getKey())?.clientHeight,_=(I,T)=>{let C;return T.forEach(E=>{E.forEach((R,L)=>{R.cell===I&&(C=L)})}),C},g=Mt(I=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let T=Er(d.elem);if(!Os(T))throw new Error("TableCellResizer: Table cell node not found.");let C=wr(T),[E]=_1(C,null,null),R=_(T,E);if(R===void 0)throw new Error("TableCellResizer: Table column not found.");let L=C.getColWidths();if(!L)return;let v=L[R];if(v===void 0)return;let w=[...L],$=Math.max(v+I,Ps);w[R]=$,C.setColWidths(w)},{tag:"skip-scroll-into-view"})},[d,t]),S=Mt(I=>{let T=C=>{if(C.preventDefault(),C.stopPropagation(),!d)throw new Error("TableCellResizer: Expected active cell.");if(s.current){let{x:E,y:R}=s.current;if(d===null)return;let L=Fs(C.target);if(N(I)){let v=(C.clientY-R)/L;D(v)}else{let v=(C.clientX-E)/L;g(v)}x(),document.removeEventListener("mouseup",T)}};return T},[d,x,g,D]),M=Mt(I=>T=>{if(T.preventDefault(),T.stopPropagation(),!d)throw new Error("TableCellResizer: Expected active cell.");s.current={x:T.clientX,y:T.clientY},u(s.current),h(I),document.addEventListener("mouseup",S(I))},[d,S]),[O,F]=lt({bottom:null,left:null,right:null,top:null});return Nr(()=>{if(d){let{height:I,left:T,top:C,width:E}=d.elem.getBoundingClientRect(),R=Fs(d.elem),L=10,v={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${L}px`,left:`${window.scrollX+T}px`,top:`${window.scrollY+C+I-L/2}px`,width:`${E}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${I}px`,left:`${window.scrollX+T+E-L/2}px`,top:`${window.scrollY+C}px`,width:`${L}px`}},w=r.current;f&&c&&w&&(N(f)?(v[f].left=`${window.scrollX+w.left}px`,v[f].top=`${window.scrollY+c.y/R}px`,v[f].height="3px",v[f].width=`${w.width}px`):(v[f].top=`${window.scrollY+w.top}px`,v[f].left=`${window.scrollX+c.x/R}px`,v[f].width="3px",v[f].height=`${w.height}px`),v[f].backgroundColor="#adf"),F(v)}else F({bottom:null,left:null,right:null,top:null})},[d,f,c]),fo("div",{ref:o,children:d!=null&&!p&&C1(Bs.Fragment,{children:[fo("div",{className:`${i.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:M("right"),style:O.right||void 0}),fo("div",{className:`${i.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:M("bottom"),style:O.bottom||void 0})]})})}var Hs=()=>{let t=x1(3),[e]=b1(),o=k1(),r,n;return t[0]!==e||t[1]!==o?(n=o?y1(fo(R1,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=n):n=t[2],r=n,r};import{c as P1}from"react/compiler-runtime";import{jsx as Sr,jsxs as B1,Fragment as H1}from"react/jsx-runtime";import{useLexicalComposerContext as Xs}from"@lexical/react/LexicalComposerContext";import{$getTableAndElementByKey as j1,$getTableColumnIndexFromTableCellNode as U1,$getTableRowIndexFromTableCellNode as G1,$insertTableColumn__EXPERIMENTAL as W1,$insertTableRow__EXPERIMENTAL as V1,$isTableCellNode as K1,$isTableNode as Gs,getTableElement as J1,TableNode as X1}from"@lexical/table";import{$findMatchingParent as z1,mergeRegister as Z1}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Ws,isHTMLElement as Y1}from"lexical";import{useEffect as Vs,useMemo as q1,useRef as Ks,useState as ho}from"react";import"react";import{createPortal as Q1}from"react-dom";import{c as O1}from"react/compiler-runtime";import{useEffect as $1,useRef as F1}from"react";var v1="Expected a function",M1=Math.max,D1=Math.min;function A1(t,e,o){let r,n,l=0,i,s=!1,c=!1,u,d,a,p=!0;if(typeof t!="function")throw new TypeError(v1);e=e||0,typeof o=="object"&&(s=!!o.leading,c="maxWait"in o,u=c?M1(o.maxWait||0,e):u,p="trailing"in o?!!o.trailing:p);function m(g){let S=r,M=i;return r=i=void 0,l=g,d=t.apply(M,S),d}function f(g){return l=g,a=setTimeout(b,e),s?m(g):d}function h(g){let S=g-n,M=g-l,O=e-S;return c?D1(O,u-M):O}function x(g){let S=g-n,M=g-l;return n===void 0||S>=e||S<0||c&&M>=u}function b(){let g=Date.now();if(x(g))return N(g);a=setTimeout(b,h(g))}function N(g){return a=void 0,p&&r?m(g):(r=i=void 0,d)}function D(){a!==void 0&&clearTimeout(a),l=0,r=n=i=a=void 0}function k(){return a===void 0?d:N(Date.now())}function _(){let g=Date.now(),S=x(g);if(r=arguments,i=this,n=g,S){if(a===void 0)return f(n);if(c)return clearTimeout(a),a=setTimeout(b,e),m(n)}return a===void 0&&(a=setTimeout(b,e)),d}return _.cancel=D,_.flush=k,_}var js=A1;function Us(t,e,o){let r=O1(6),n=F1(null),l,i;r[0]!==t||r[1]!==o||r[2]!==e?(l=()=>(n.current=js(t,e,{maxWait:o}),()=>{n.current?.cancel()}),i=[t,e,o],r[0]=t,r[1]=o,r[2]=e,r[3]=l,r[4]=i):(l=r[3],i=r[4]),$1(l,i);let s;return r[5]===Symbol.for("react.memo_cache_sentinel")?(s=(...u)=>{let d=u;n.current&&n.current(...d)},r[5]=s):s=r[5],s}var Js=20;function eh({anchorElem:t}){let[e]=Xs(),o=j(),[r,n]=ho(!1),[l,i]=ho(!1),[s,c]=ho(!1),[u,d]=ho({}),a=Ks(new Set),p=Ks(null),m=Us(x=>{let{isOutside:b,tableDOMNode:N}=th(x,o.editorConfig?.lexical);if(b){n(!1),i(!1);return}if(!N)return;p.current=N;let D=null,k=null,_=null;if(e.getEditorState().read(()=>{let L=Ws(N);if(K1(L)){let v=z1(L,w=>Gs(w));if(!Gs(v))return;if(_=J1(v,e.getElementByKey(v.getKey())),_){let w=v.getChildrenSize(),$=v.getChildAtIndex(0)?.getChildrenSize(),H=G1(L),W=U1(L);H===w-1?D=L:W===$-1&&(k=L)}}},{editor:e}),!_)return;let g=_.parentElement;if(!g)return;let{bottom:S,height:M,left:O,right:F,width:I,y:T}=_.getBoundingClientRect(),C=!1;g&&g.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(C=g.scrollWidth>g.clientWidth);let{left:E,y:R}=t.getBoundingClientRect();D?(i(!1),n(!0),d({height:Js,left:C&&g?g.offsetLeft:O-E,top:S-R+5,width:C&&g?g.offsetWidth:I})):k&&(i(!0),n(!1),d({height:M,left:F-E+5,top:T-R,width:Js}))},50,250),f=q1(()=>new ResizeObserver(()=>{n(!1),i(!1)}),[]);Vs(()=>{if(s)return document.addEventListener("mousemove",m),()=>{n(!1),i(!1),document.removeEventListener("mousemove",m)}},[s,m]),Vs(()=>Z1(e.registerMutationListener(X1,x=>{e.getEditorState().read(()=>{let b=!1;for(let[N,D]of x)switch(D){case"created":{a.current.add(N),b=!0;break}case"destroyed":{a.current.delete(N),b=!0;break}default:break}if(b){f.disconnect();for(let N of a.current){let{tableElement:D}=j1(N);f.observe(D)}c(a.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,f]);let h=x=>{e.update(()=>{p.current&&(Ws(p.current)?.selectEnd(),x?(V1(),n(!1)):(W1(),i(!1)))})};return e?.isEditable()?B1(H1,{children:[r&&Sr("button",{"aria-label":"Add Row",className:o.editorConfig.lexical.theme.tableAddRows,onClick:()=>h(!0),style:{...u},type:"button"}),l&&Sr("button",{"aria-label":"Add Column",className:o.editorConfig.lexical.theme.tableAddColumns,onClick:()=>h(!1),style:{...u},type:"button"})]}):null}function th(t,e){let o=t.target;if(Y1(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 zs(t){let e=P1(2),{anchorElem:o}=t,r=o===void 0?document.body:o,[n]=Xs();if(!n?.isEditable())return null;let l;return e[0]!==r?(l=Q1(Sr(eh,{anchorElem:r}),r),e[0]=r,e[1]=l):l=e[1],l}import{c as oh}from"react/compiler-runtime";import{jsx as Lr,jsxs as rh}from"react/jsx-runtime";import{useLexicalComposerContext as nh}from"@lexical/react/LexicalComposerContext";import{TablePlugin as lh}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as ih,TableCellNode as sh,TableNode as ah,TableRowNode as ch}from"@lexical/table";import{mergeRegister as uh}from"@lexical/utils";import{formatDrawerSlug as dh,useEditDepth as mh}from"@payloadcms/ui";import{$getSelection as ph,$isRangeSelection as fh,COMMAND_PRIORITY_EDITOR as hh,createCommand as gh}from"lexical";import{createContext as xh,use as Ch,useEffect as bh,useMemo as kh,useState as _h}from"react";import*as Zs from"react";var go=gh("OPEN_EMBED_DRAWER_COMMAND"),Ys=xh({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function qs({children:t}){let[e,o]=_h({cellEditorConfig:null,cellEditorPlugins:null});return Lr(Ys,{value:kh(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var Qs=()=>{let t=oh(16),[e]=nh(),o=Ch(Ys),r=mh(),{fieldProps:n,uuid:l}=j(),{schemaPath:i}=n,s="lexical-table-create-"+l,c;t[0]!==r||t[1]!==s?(c=dh({slug:s,depth:r}),t[0]=r,t[1]=s,t[2]=c):c=t[2];let u=c,{toggleDrawer:d}=xe(u,!0),a;t[3]!==e||t[4]!==d?(a=()=>{if(!e.hasNodes([ah,ch,sh]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return uh(e.registerCommand(go,()=>{let h=null;return e.getEditorState().read(()=>{let x=ph();fh(x)&&(h=x)}),h&&d(),!0},hh))},t[3]=e,t[4]=d,t[5]=a):a=t[5];let p;t[6]!==o||t[7]!==e||t[8]!==d?(p=[o,e,d],t[6]=o,t[7]=e,t[8]=d,t[9]=p):p=t[9],bh(a,p);let m;t[10]!==e?(m=(h,x)=>{!x.columns||!x.rows||e.dispatchCommand(ih,{columns:String(x.columns),rows:String(x.rows)})},t[10]=e,t[11]=m):m=t[11];let f;return t[12]!==u||t[13]!==i||t[14]!==m?(f=rh(Zs.Fragment,{children:[Lr(st,{drawerSlug:u,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:m,schemaPath:i,schemaPathSuffix:"fields"}),Lr(lh,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]}),t[12]=u,t[13]=i,t[14]=m,t[15]=f):f=t[15],f};var Nh=y({markdownTransformers:[Ss],nodes:[wh,Th,Eh],plugins:[{Component:Qs,position:"normal"},{Component:Hs,position:"normal"},{Component:As,position:"floatingAnchorElem"},{Component:zs,position:"floatingAnchorElem"}],providers:[qs],slashMenu:{groups:[ee([{Icon:fr,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(go,{})}}])]},toolbarFixed:{groups:[ke([{ChildComponent:fr,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(go,{})}}])]}});import{$isNodeSelection as og}from"lexical";import{jsx as yr,jsxs as Sh}from"react/jsx-runtime";import"react";var Ir=()=>Sh("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 vh}from"react/jsx-runtime";import oa from"bson-objectid";import{$applyNodeReplacement as Mh}from"lexical";import*as ra from"react";import{jsx as Lh}from"react/jsx-runtime";import{DecoratorBlockNode as yh}from"@lexical/react/LexicalDecoratorBlockNode.js";import ea from"bson-objectid";import{$applyNodeReplacement as Ih}from"lexical";import"react";function Rr(t){return t.parentElement!=null&&t.parentElement.tagName==="LI"&&t.previousSibling===null&&t.getAttribute("aria-roledescription")==="checkbox"}function Rh(t){if(t.hasAttribute("data-lexical-upload-relation-to")&&t.hasAttribute("data-lexical-upload-id")){let o=t.getAttribute("data-lexical-upload-id"),r=t.getAttribute("data-lexical-upload-relation-to");if(o!=null&&r!=null)return{node:ta({data:{fields:{},relationTo:r,value:o}})}}let e=t;return e.src.startsWith("file:///")||Rr(e),null}var Dt=class extends yh{__data;constructor({data:e,format:o,key:r}){super(o,r),this.__data=e}static clone(e){return new this({data:e.__data,format:e.__format,key:e.__key})}static getType(){return"upload"}static importDOM(){return{img:e=>({conversion:Rh,priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new ea.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,relationTo:e.relationTo,value:e.value},r=ta({data:o});return r.setFormat(e.format),r}static isInline(){return!1}decorate(){return Lh(RawUploadComponent,{data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportDOM(){let e=document.createElement("img");return e.setAttribute("data-lexical-upload-id",String(this.__data?.value)),e.setAttribute("data-lexical-upload-relation-to",this.__data?.relationTo),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"upload",version:3}}getData(){return this.getLatest().__data}setData(e){let o=this.getWritable();o.__data=e}updateDOM(){return!1}};function ta({data:t}){return t?.id||(t.id=new ea.default().toHexString()),Ih(new Dt({data:t}))}var Dh=ra.lazy(()=>import("./component-M3U253XK.js").then(t=>({default:t.UploadComponent})));function Ah(t){if(t.hasAttribute("data-lexical-upload-relation-to")&&t.hasAttribute("data-lexical-upload-id")){let o=t.getAttribute("data-lexical-upload-id"),r=t.getAttribute("data-lexical-upload-relation-to");if(o!=null&&r!=null)return{node:Ge({data:{fields:{},relationTo:r,value:o}})}}let e=t;return e.src.startsWith("file:///")||Rr(e),null}var Ie=class extends Dt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{img:e=>({conversion:Ah,priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new oa.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,relationTo:e.relationTo,value:e.value},r=Ge({data:o});return r.setFormat(e.format),r}decorate(){return vh(Dh,{data:this.__data,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Ge({data:t}){return t?.id||(t.id=new oa.default().toHexString()),Mh(new Ie({data:t}))}function vr(t){return t instanceof Ie}import{c as Uh}from"react/compiler-runtime";import{jsx as Gh}from"react/jsx-runtime";import{useLexicalComposerContext as Wh}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Vh,mergeRegister as Kh}from"@lexical/utils";import{useConfig as Jh}from"@payloadcms/ui";import{$getPreviousSelection as Xh,$getSelection as zh,$isParagraphNode as Zh,$isRangeSelection as Yh,COMMAND_PRIORITY_EDITOR as qh,createCommand as Qh}from"lexical";import{useEffect as eg}from"react";import{c as na}from"react/compiler-runtime";import{jsx as Mr}from"react/jsx-runtime";import{useLexicalComposerContext as la}from"@lexical/react/LexicalComposerContext.js";import{toast as Oh}from"@payloadcms/ui";import{$getNodeByKey as $h,COMMAND_PRIORITY_EDITOR as ia}from"lexical";import{useEffect as sa,useState as Fh}from"react";var Ph=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=$h(o);n&&n.replace(Ge({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(Dr,{fields:null,relationTo:e,value:r})},Bh=t=>{let e=na(13),{enabledCollectionSlugs:o}=t,[r]=la(),[n,l]=Fh(null),i;e[0]!==o?(i={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=i):i=e[1];let{closeListDrawer:s,ListDrawer:c,openListDrawer:u}=yt(i),d,a;e[2]!==r||e[3]!==u?(d=()=>r.registerCommand(Ke,h=>(l(h?.replace?h?.replace.nodeKey:null),u(),!0),ia),a=[r,u],e[2]=r,e[3]=u,e[4]=d,e[5]=a):(d=e[4],a=e[5]),sa(d,a);let p;e[6]!==s||e[7]!==r||e[8]!==n?(p=h=>{let{collectionSlug:x,doc:b}=h;s(),Ph({editor:r,relationTo:x,replaceNodeKey:n,value:b.id})},e[6]=s,e[7]=r,e[8]=n,e[9]=p):p=e[9];let m=p,f;return e[10]!==c||e[11]!==m?(f=Mr(c,{onSelect:m}),e[10]=c,e[11]=m,e[12]=f):f=e[12],f},Hh=()=>{let t=na(3),[e]=la(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Ke,jh,ia),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),sa(o,r),null},aa=t=>Mr(At,{...t,FallbackComponent:Hh,uploads:!0,children:Mr(Bh,{...t})});function jh(){return Oh.error("No upload collections enabled"),!0}var Dr=Qh("INSERT_UPLOAD_COMMAND"),ca=t=>{let e=Uh(5),[o]=Wh(),{config:r}=Jh(),{collections:n}=r,l,i;e[0]!==o?(l=()=>{if(!o.hasNodes([Ie]))throw new Error("UploadPlugin: UploadNode not registered on editor");return Kh(o.registerCommand(Dr,c=>(o.update(()=>{let u=zh()||Xh();if(Yh(u)){let d=Ge({data:{id:c.id,fields:c.fields,relationTo:c.relationTo,value:c.value}}),{focus:a}=u,p=a.getNode();Vh(d),Zh(p)&&!p.__first&&p.remove()}}),!0),qh))},i=[o],e[0]=o,e[1]=l,e[2]=i):(l=e[1],i=e[2]),eg(l,i);let s;return e[3]!==n?(s=Gh(aa,{enabledCollectionSlugs:n.map(tg)}),e[3]=n,e[4]=s):s=e[4],s};function tg(t){let{slug:e}=t;return e}var rg=y({nodes:[Ie],plugins:[{Component:ca,position:"normal"}],slashMenu:{groups:[ee([{Icon:Ir,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ke,{replace:!1})}}])]},toolbarFixed:{groups:[ke([{ChildComponent:Ir,isActive:({selection:t})=>{if(!og(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return vr(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ke,{replace:!1})}}])]}});import{c as lg}from"react/compiler-runtime";import{jsx as Or}from"react/jsx-runtime";import{ShimmerEffect as ig,useConfig as sg}from"@payloadcms/ui";import{lazy as ag,Suspense as cg,useEffect as ug,useState as dg}from"react";var ua={block:"LexicalEditorTheme__block",blockCursor:"LexicalEditorTheme__blockCursor",characterLimit:"LexicalEditorTheme__characterLimit",code:"LexicalEditorTheme__code",codeHighlight:{atrule:"LexicalEditorTheme__tokenAttr",attr:"LexicalEditorTheme__tokenAttr",boolean:"LexicalEditorTheme__tokenProperty",builtin:"LexicalEditorTheme__tokenSelector",cdata:"LexicalEditorTheme__tokenComment",char:"LexicalEditorTheme__tokenSelector",class:"LexicalEditorTheme__tokenFunction","class-name":"LexicalEditorTheme__tokenFunction",comment:"LexicalEditorTheme__tokenComment",constant:"LexicalEditorTheme__tokenProperty",deleted:"LexicalEditorTheme__tokenProperty",doctype:"LexicalEditorTheme__tokenComment",entity:"LexicalEditorTheme__tokenOperator",function:"LexicalEditorTheme__tokenFunction",important:"LexicalEditorTheme__tokenVariable",inserted:"LexicalEditorTheme__tokenSelector",keyword:"LexicalEditorTheme__tokenAttr",namespace:"LexicalEditorTheme__tokenVariable",number:"LexicalEditorTheme__tokenProperty",operator:"LexicalEditorTheme__tokenOperator",prolog:"LexicalEditorTheme__tokenComment",property:"LexicalEditorTheme__tokenProperty",punctuation:"LexicalEditorTheme__tokenPunctuation",regex:"LexicalEditorTheme__tokenVariable",selector:"LexicalEditorTheme__tokenSelector",string:"LexicalEditorTheme__tokenSelector",symbol:"LexicalEditorTheme__tokenProperty",tag:"LexicalEditorTheme__tokenProperty",url:"LexicalEditorTheme__tokenOperator",variable:"LexicalEditorTheme__tokenVariable"},embedBlock:{base:"LexicalEditorTheme__embedBlock",focus:"LexicalEditorTheme__embedBlockFocus"},hashtag:"LexicalEditorTheme__hashtag",heading:{h1:"LexicalEditorTheme__h1",h2:"LexicalEditorTheme__h2",h3:"LexicalEditorTheme__h3",h4:"LexicalEditorTheme__h4",h5:"LexicalEditorTheme__h5",h6:"LexicalEditorTheme__h6"},hr:"LexicalEditorTheme__hr",hrSelected:"LexicalEditorTheme__hrSelected",indent:"LexicalEditorTheme__indent",inlineImage:"LexicalEditor__inline-image",link:"LexicalEditorTheme__link",list:{checklist:"LexicalEditorTheme__checklist",listitem:"LexicalEditorTheme__listItem",listitemChecked:"LexicalEditorTheme__listItemChecked",listitemUnchecked:"LexicalEditorTheme__listItemUnchecked",nested:{listitem:"LexicalEditorTheme__nestedListItem"},olDepth:["LexicalEditorTheme__ol1","LexicalEditorTheme__ol2","LexicalEditorTheme__ol3","LexicalEditorTheme__ol4","LexicalEditorTheme__ol5"],ul:"LexicalEditorTheme__ul"},ltr:"LexicalEditorTheme__ltr",mark:"LexicalEditorTheme__mark",markOverlap:"LexicalEditorTheme__markOverlap",paragraph:"LexicalEditorTheme__paragraph",quote:"LexicalEditorTheme__quote",relationship:"LexicalEditorTheme__relationship",rtl:"LexicalEditorTheme__rtl",tab:"LexicalEditorTheme__tabNode",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableAlignment:{center:"LexicalEditorTheme__tableAlignmentCenter",right:"LexicalEditorTheme__tableAlignmentRight"},tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableFrozenColumn:"LexicalEditorTheme__tableFrozenColumn",tableRowStriping:"LexicalEditorTheme__tableRowStriping",tableScrollableWrapper:"LexicalEditorTheme__tableScrollableWrapper",tableSelected:"LexicalEditorTheme__tableSelected",tableSelection:"LexicalEditorTheme__tableSelection",text:{bold:"LexicalEditorTheme__textBold",code:"LexicalEditorTheme__textCode",italic:"LexicalEditorTheme__textItalic",strikethrough:"LexicalEditorTheme__textStrikethrough",subscript:"LexicalEditorTheme__textSubscript",superscript:"LexicalEditorTheme__textSuperscript",underline:"LexicalEditorTheme__textUnderline",underlineStrikethrough:"LexicalEditorTheme__textUnderlineStrikethrough"},upload:"editor-upload"};var xo={namespace:"lexical",theme:ua};function da({config:t,featureClientImportMap:e,featureClientSchemaMap:o,field:r,schemaPath:n,unSanitizedEditorConfig:l}){for(let u of l.features)if(!u?.clientFeatureProps?.featureKey||u?.clientFeatureProps?.order===void 0||u?.clientFeatureProps?.order===null)throw new Error("A Feature you have installed does not return the client props as clientFeatureProps. Please make sure to always return those props, even if they are null, as other important props like order and featureKey are later on injected.");l.features=l.features.sort((u,d)=>u.clientFeatureProps.order-d.clientFeatureProps.order);let i=new Map;for(let u of l.features)i.set(u.clientFeatureProps.featureKey,u);let s=new Map,c=0;for(let u of l.features){let d=typeof u.feature=="function"?u.feature({config:t,featureClientImportMap:e,featureClientSchemaMap:o,featureProviderMap:i,field:r,resolvedFeatures:s,schemaPath:n,unSanitizedEditorConfig:l}):u.feature;d.key=u.clientFeatureProps.featureKey,d.order=c,s.set(u.clientFeatureProps.featureKey,d),c++}return s}import{deepMerge as ng}from"payload/shared";var ma=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}},o={};if(t.forEach(r=>{r.key==="toolbarFixed"&&r.sanitizedClientFeatureProps?.customGroups&&(o={...o,...r.sanitizedClientFeatureProps.customGroups})}),!t?.size)return e;t.forEach(r=>{if(r.providers?.length&&(e.providers=e.providers.concat(r.providers)),r.enableFormats?.length&&e.enabledFormats.push(...r.enableFormats),r.nodes?.length)for(let n of r.nodes)e.nodes.push(n);if(r.plugins?.length&&r.plugins.forEach((n,l)=>{e.plugins?.push({clientProps:r.sanitizedClientFeatureProps,Component:n.Component,key:r.key+l,position:n.position})}),r.toolbarInline?.groups?.length)for(let n of r.toolbarInline.groups){let l=e.toolbarInline.groups.find(i=>i.key===n.key);l?e.toolbarInline.groups=e.toolbarInline.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.toolbarInline?.groups.push(l)}if(r.toolbarFixed?.groups?.length)for(let n of r.toolbarFixed.groups){let l=e.toolbarFixed.groups.find(i=>i.key===n.key);l?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.toolbarFixed?.groups.push(l)}if(r.slashMenu?.groups){r.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(r.slashMenu.dynamicGroups));for(let n of r.slashMenu.groups){let l=e.slashMenu.groups.find(i=>i.key===n.key);l?e.slashMenu.groups=e.slashMenu.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.slashMenu.groups.push(l)}}if(r.markdownTransformers?.length)for(let n of r.markdownTransformers)typeof n=="function"?e.markdownTransformers.push(n({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(n);e.enabledFeatures.push(r.key)}),Object.keys(o).length>0&&(e.toolbarFixed.groups=e.toolbarFixed.groups.map(r=>{let n=o[r.key];return n?ng(r,n):r})),e.toolbarInline.groups.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0),e.toolbarFixed.groups.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);for(let r of e.toolbarInline.groups)r.items.sort((n,l)=>n.order&&l.order?n.order-l.order:n.order?-1:l.order?1:0);for(let r of e.toolbarFixed.groups)r.items.sort((n,l)=>n.order&&l.order?n.order-l.order:n.order?-1:l.order?1:0);return e};function Ar(t,e,o){return{admin:o,features:ma(t),lexical:e,resolvedFeatureMap:t}}var mg=ag(()=>import("./Field-6OZARKAL.js").then(t=>({default:t.RichText}))),pg=t=>{let e=lg(16),{admin:o,clientFeatures:r,featureClientImportMap:n,featureClientSchemaMap:l,field:i,lexicalEditorConfig:s,schemaPath:c}=t,u;e[0]!==o?(u=o===void 0?{}:o,e[0]=o,e[1]=u):u=e[1];let d=u,a=s===void 0?xo:s,{config:p}=sg(),[m,f]=dg(null),h,x;e[2]!==d||e[3]!==r||e[4]!==p||e[5]!==n||e[6]!==l||e[7]!==i||e[8]!==m||e[9]!==a||e[10]!==c?(h=()=>{if(m)return;let N=[];for(let[_,g]of Object.entries(r))g.clientFeatureProvider&&N.push(g.clientFeatureProvider(g.clientFeatureProps));let D=a||xo,k=da({config:p,featureClientImportMap:n,featureClientSchemaMap:l,field:i,schemaPath:c??i.name,unSanitizedEditorConfig:{features:N,lexical:D}});f(Ar(k,D,d))},x=[a,d,m,r,n,l,i,p,c],e[2]=d,e[3]=r,e[4]=p,e[5]=n,e[6]=l,e[7]=i,e[8]=m,e[9]=a,e[10]=c,e[11]=h,e[12]=x):(h=e[11],x=e[12]),ug(h,x);let b;return e[13]!==m||e[14]!==t?(b=Or(cg,{fallback:Or(ig,{height:"35vh"}),children:m&&Or(mg,{...t,editorConfig:m})}),e[13]=m,e[14]=t,e[15]=b):b=e[15],b};function fg(t){return t instanceof HTMLElement}function hg(...t){return t.filter(Boolean).join(" ")}var Co=new WeakMap;function pa(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function bo(t,e){let o=Co.get(t);if(o===void 0){let r=new Set,n=i=>{o!==void 0&&(o.start=pa(i))},l=i=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let c=pa(i);for(let u of r)c!==null&&u([c[0]-s[0],c[1]-s[1]],i)};t.addEventListener("touchstart",n),t.addEventListener("touchend",l),o={handleTouchend:l,handleTouchstart:n,listeners:r,start:null},Co.set(t,o)}return o.listeners.add(e),()=>{gg(t,e)}}function gg(t,e){let o=Co.get(t);if(o===void 0)return;let{listeners:r}=o;r.delete(e),r.size===0&&(Co.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function xg(t,e){return bo(t,(o,r)=>{let[n,l]=o;n<0&&-n>Math.abs(l)&&e(n,r)})}function Cg(t,e){return bo(t,(o,r)=>{let[n,l]=o;n>0&&n>Math.abs(l)&&e(n,r)})}function bg(t,e){return bo(t,(o,r)=>{let[n,l]=o;l<0&&-l>Math.abs(n)&&e(n,r)})}function kg(t,e){return bo(t,(o,r)=>{let[n,l]=o;l>0&&l>Math.abs(n)&&e(n,r)})}import{c as _g}from"react/compiler-runtime";import{jsx as Tg}from"react/jsx-runtime";import"react";var wg=()=>{let t=_g(2),{EditButton:e}=Ce(),o;return t[0]!==e?(o=e?Tg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Eg}from"react/compiler-runtime";import{jsx as Ng}from"react/jsx-runtime";import"react";var Sg=()=>{let t=Eg(2),{RemoveButton:e}=Ce(),o;return t[0]!==e?(o=e?Ng(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Lg}from"react/compiler-runtime";import{jsx as yg}from"react/jsx-runtime";import"react";var Ig=()=>{let t=Lg(2),{Label:e}=Ce(),o;return t[0]!==e?(o=e?yg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Rg}from"react/compiler-runtime";import{jsx as vg}from"react/jsx-runtime";import"react";var Mg=t=>{let e=Rg(3),{children:o}=t,{InlineBlockContainer:r}=Ce(),n;return e[0]!==r||e[1]!==o?(n=r?vg(r,{children:o}):null,e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{c as Dg}from"react/compiler-runtime";import{jsx as Ag}from"react/jsx-runtime";import"react";var Og=t=>{let e=Dg(6),{children:o,editButton:r,Label:n,removeButton:l}=t,{BlockCollapsible:i}=Oe(),s;return e[0]!==i||e[1]!==n||e[2]!==o||e[3]!==r||e[4]!==l?(s=i?Ag(i,{editButton:r,Label:n,removeButton:l,children:o}):null,e[0]=i,e[1]=n,e[2]=o,e[3]=r,e[4]=l,e[5]=s):s=e[5],s};import{c as $g}from"react/compiler-runtime";import{jsx as Fg}from"react/jsx-runtime";import"react";var Pg=()=>{let t=$g(2),{EditButton:e}=Oe(),o;return t[0]!==e?(o=e?Fg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Bg}from"react/compiler-runtime";import{jsx as Hg}from"react/jsx-runtime";import"react";var jg=()=>{let t=Bg(2),{RemoveButton:e}=Oe(),o;return t[0]!==e?(o=e?Hg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as Ug}from"qs-esm";var Gg=({apiURL:t,depth:e,draft:o,locale:r})=>async({id:l,collectionSlug:i,select:s})=>{let c=Ug({depth:e??0,draft:o??!1,locale:r,select:s},{addQueryPrefix:!0});return await fetch(`${t}/${i}/${l}${c}`,{credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json"},method:"GET"}).then(d=>d.json())};export{Ct as $createAutoLinkNode,Vt as $createBlockNode,_o as $createInlineBlockNode,_e as $createLinkNode,je as $createRelationshipNode,Ge as $createUploadNode,we as $isAutoLinkNode,ft as $isBlockNode,To as $isInlineBlockNode,Z as $isLinkNode,ar as $isRelationshipNode,vr as $isUploadNode,Sa as AlignFeatureClient,Te as AutoLinkNode,Og as BlockCollapsible,Pg as BlockEditButton,be as BlockNode,jg as BlockRemoveButton,va as BlockquoteFeatureClient,yc as BlocksFeatureClient,Yc as BoldFeatureClient,ce as CAN_USE_DOM,Ym as ChecklistFeatureClient,jp as DETAIL_TYPE_TO_DETAIL,Fp as DOUBLE_LINE_BREAK,qp as DebugJsxConverterFeatureClient,Gp as ELEMENT_FORMAT_TO_TYPE,Up as ELEMENT_TYPE_TO_FORMAT,ba as ENABLE_SLASH_MENU_COMMAND,ha as EditorConfigProvider,st as FieldsDrawer,_0 as FixedToolbarFeatureClient,Wu as HeadingFeatureClient,sd as HorizontalRuleFeatureClient,Je as INSERT_BLOCK_COMMAND,Xe as INSERT_INLINE_BLOCK_COMMAND,Op as IS_ALL_FORMATTING,wd as IndentFeatureClient,Mg as InlineBlockContainer,wg as InlineBlockEditButton,Ig as InlineBlockLabel,ko as InlineBlockNode,Sg as InlineBlockRemoveButton,ou as InlineCodeFeatureClient,M0 as InlineToolbarFeatureClient,iu as ItalicFeatureClient,Bp as LTR_REGEX,bp as LexicalPluginToLexicalFeatureClient,$m as LinkFeatureClient,ie as LinkNode,$p as NON_BREAKING_SPACE,A as NodeFormat,lp as OrderedListFeatureClient,Lp as ParagraphFeatureClient,xa as Point,Pp as RTL_REGEX,ka as Rect,Bf as RelationshipFeatureClient,Ne as RelationshipNode,pg as RichTextField,Np as SlateToLexicalFeatureClient,du as StrikethroughFeatureClient,hu as SubscriptFeatureClient,bu as SuperscriptFeatureClient,Wp as TEXT_MODE_TO_TYPE,Hp as TEXT_TYPE_TO_FORMAT,Vp as TEXT_TYPE_TO_MODE,he as TOGGLE_LINK_COMMAND,Nh as TableFeatureClient,Uc as TestRecorderFeatureClient,Ou as TextStateFeatureClient,It as ToolbarButton,Ue as ToolbarDropdown,Jc as TreeViewFeatureClient,Eu as UnderlineFeatureClient,pp as UnorderedListFeatureClient,rg as UploadFeatureClient,Ie as UploadNode,kg as addSwipeDownListener,xg as addSwipeLeftListener,Cg as addSwipeRightListener,bg as addSwipeUpListener,Ho as createBlockNode,y as createClientFeature,Qp as defaultColors,xo as defaultEditorLexicalConfig,pr as getDOMRangeRect,_a as getEnabledNodes,Gg as getRestPopulateFn,ze as getSelectedNode,fg as isHTMLElement,Ca as isPoint,hg as joinClasses,Ar as sanitizeClientEditorConfig,ma as sanitizeClientFeatures,io as setFloatingElemPosition,eo as setFloatingElemPositionForLinkEditor,ee as slashMenuBasicGroupWithItems,ke as toolbarAddDropdownGroupWithItems,Uo as toolbarFeatureButtonsGroupWithItems,te as toolbarFormatGroupWithItems,le as toolbarTextDropdownGroupWithItems,Oe as useBlockComponentContext,j as useEditorConfigContext,Ce as useInlineBlockComponentContext,ga as useLexicalDocumentDrawer,xe as useLexicalDrawer,yt as useLexicalListDrawer};
41
41
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/upload/client/component/index.tsx"],"names":[],"mappings":"AAeA,OAAO,KAA2D,MAAM,OAAO,CAAA;AAG/E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAA;AAUlE,OAAO,cAAc,CAAA;AAQrB,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,UAAU,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAiMD,eAAO,MAAM,eAAe,UAAW,YAAY,KAAG,KAAK,CAAC,SAM3D,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/upload/client/component/index.tsx"],"names":[],"mappings":"AAgBA,OAAO,KAA2D,MAAM,OAAO,CAAA;AAG/E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAA;AAUlE,OAAO,cAAc,CAAA;AAQrB,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,UAAU,CAAA;IAChB,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AA0LD,eAAO,MAAM,eAAe,UAAW,YAAY,KAAG,KAAK,CAAC,SAM3D,CAAA"}
@@ -3,8 +3,9 @@
3
3
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
4
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js';
5
5
  import { getTranslation } from '@payloadcms/translations';
6
- import { Button, File, formatDrawerSlug, useConfig, useEditDepth, usePayloadAPI, useTranslation } from '@payloadcms/ui';
6
+ import { Button, formatDrawerSlug, Thumbnail, useConfig, useEditDepth, usePayloadAPI, useTranslation } from '@payloadcms/ui';
7
7
  import { $getNodeByKey } from 'lexical';
8
+ import { isImage } from 'payload/shared';
8
9
  import React, { useCallback, useId, useReducer, useRef, useState } from 'react';
9
10
  import { useEditorConfigContext } from '../../../../lexical/config/client/EditorConfigProvider.js';
10
11
  import { FieldsDrawer } from '../../../../utilities/fieldsDrawer/Drawer.js';
@@ -121,12 +122,10 @@ const Component = props => {
121
122
  className: `${baseClass}__topRow`,
122
123
  children: [/*#__PURE__*/_jsx("div", {
123
124
  className: `${baseClass}__thumbnail`,
124
- children: thumbnailSRC ? /*#__PURE__*/_jsx("img", {
125
- alt: data?.filename,
126
- "data-lexical-upload-id": value,
127
- "data-lexical-upload-relation-to": relationTo,
128
- src: thumbnailSRC
129
- }) : /*#__PURE__*/_jsx(File, {})
125
+ children: /*#__PURE__*/_jsx(Thumbnail, {
126
+ collectionSlug: relationTo,
127
+ fileSrc: isImage(data?.mimeType) ? thumbnailSRC : null
128
+ })
130
129
  }), /*#__PURE__*/_jsxs("div", {
131
130
  className: `${baseClass}__topRowRightPanel`,
132
131
  children: [/*#__PURE__*/_jsx("div", {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["useLexicalComposerContext","getTranslation","Button","File","formatDrawerSlug","useConfig","useEditDepth","usePayloadAPI","useTranslation","$getNodeByKey","React","useCallback","useId","useReducer","useRef","useState","useEditorConfigContext","FieldsDrawer","useLexicalDocumentDrawer","useLexicalDrawer","EnabledRelationshipsCondition","INSERT_UPLOAD_WITH_DRAWER_COMMAND","baseClass","initialParams","depth","Component","props","data","fields","relationTo","value","nodeKey","Error","config","routes","api","serverURL","getEntityConfig","uploadRef","uuid","editDepth","editor","editorConfig","fieldProps","readOnly","schemaPath","i18n","t","cacheBust","dispatchCacheBust","state","relatedCollection","collectionSlug","componentID","extraFieldsDrawerSlug","slug","toggleDrawer","closeDocumentDrawer","DocumentDrawer","DocumentDrawerToggler","id","setParams","thumbnailSRC","thumbnailURL","url","removeUpload","update","remove","updateUpload","hasExtraFields","resolvedFeatureMap","get","sanitizedClientFeatureProps","collections","onExtraFieldsDrawerSubmit","_","uploadNode","newData","getData","setData","_jsxs","className","contentEditable","ref","_jsx","alt","filename","src","labels","singular","isEditable","buttonStyle","disabled","el","icon","onClick","round","tooltip","dispatchCommand","replace","e","preventDefault","onSave","drawerSlug","drawerTitle","label","featureKey","handleDrawerSubmit","schemaPathSuffix","UploadComponent","uploads"],"sources":["../../../../../src/features/upload/client/component/index.tsx"],"sourcesContent":["'use client'\nimport type { ClientCollectionConfig, Data, FormState, JsonObject } from 'payload'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\nimport { getTranslation } from '@payloadcms/translations'\nimport {\n Button,\n File,\n formatDrawerSlug,\n useConfig,\n useEditDepth,\n usePayloadAPI,\n useTranslation,\n} from '@payloadcms/ui'\nimport { $getNodeByKey } from 'lexical'\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 { INSERT_UPLOAD_WITH_DRAWER_COMMAND } from '../drawer/commands.js'\nimport './index.scss'\n\nconst baseClass = 'lexical-upload'\n\nconst initialParams = {\n depth: 0,\n}\n\nexport type ElementProps = {\n data: UploadData\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: { readOnly, schemaPath },\n } = useEditorConfigContext()\n\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 return (\n <div className={baseClass} contentEditable={false} ref={uploadRef}>\n <div className={`${baseClass}__card`}>\n <div className={`${baseClass}__topRow`}>\n {/* TODO: migrate to use @payloadcms/ui/elements/Thumbnail component */}\n <div className={`${baseClass}__thumbnail`}>\n {thumbnailSRC ? (\n <img\n alt={data?.filename}\n data-lexical-upload-id={value}\n data-lexical-upload-relation-to={relationTo}\n src={thumbnailSRC}\n />\n ) : (\n <File />\n )}\n </div>\n <div className={`${baseClass}__topRowRightPanel`}>\n <div className={`${baseClass}__collectionLabel`}>\n {getTranslation(relatedCollection.labels.singular, i18n)}\n </div>\n {editor.isEditable() && (\n <div className={`${baseClass}__actions`}>\n {hasExtraFields ? (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__upload-drawer-toggler`}\n disabled={readOnly}\n el=\"button\"\n icon=\"edit\"\n onClick={() => {\n toggleDrawer()\n }}\n round\n tooltip={t('fields:editRelationship')}\n />\n ) : null}\n\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__swap-drawer-toggler`}\n disabled={readOnly}\n el=\"button\"\n icon=\"swap\"\n onClick={() => {\n editor.dispatchCommand(INSERT_UPLOAD_WITH_DRAWER_COMMAND, {\n replace: { nodeKey },\n })\n }}\n round\n tooltip={t('fields:swapUpload')}\n />\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__removeButton`}\n disabled={readOnly}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n removeUpload()\n }}\n round\n tooltip={t('fields:removeUpload')}\n />\n </div>\n )}\n </div>\n </div>\n <div className={`${baseClass}__bottomRow`}>\n <DocumentDrawerToggler className={`${baseClass}__doc-drawer-toggler`}>\n <strong>{data?.filename}</strong>\n </DocumentDrawerToggler>\n </div>\n </div>\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"],"mappings":"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","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["useLexicalComposerContext","getTranslation","Button","formatDrawerSlug","Thumbnail","useConfig","useEditDepth","usePayloadAPI","useTranslation","$getNodeByKey","isImage","React","useCallback","useId","useReducer","useRef","useState","useEditorConfigContext","FieldsDrawer","useLexicalDocumentDrawer","useLexicalDrawer","EnabledRelationshipsCondition","INSERT_UPLOAD_WITH_DRAWER_COMMAND","baseClass","initialParams","depth","Component","props","data","fields","relationTo","value","nodeKey","Error","config","routes","api","serverURL","getEntityConfig","uploadRef","uuid","editDepth","editor","editorConfig","fieldProps","readOnly","schemaPath","i18n","t","cacheBust","dispatchCacheBust","state","relatedCollection","collectionSlug","componentID","extraFieldsDrawerSlug","slug","toggleDrawer","closeDocumentDrawer","DocumentDrawer","DocumentDrawerToggler","id","setParams","thumbnailSRC","thumbnailURL","url","removeUpload","update","remove","updateUpload","hasExtraFields","resolvedFeatureMap","get","sanitizedClientFeatureProps","collections","onExtraFieldsDrawerSubmit","_","uploadNode","newData","getData","setData","_jsxs","className","contentEditable","ref","_jsx","fileSrc","mimeType","labels","singular","isEditable","buttonStyle","disabled","el","icon","onClick","round","tooltip","dispatchCommand","replace","e","preventDefault","filename","onSave","drawerSlug","drawerTitle","label","featureKey","handleDrawerSubmit","schemaPathSuffix","UploadComponent","uploads"],"sources":["../../../../../src/features/upload/client/component/index.tsx"],"sourcesContent":["'use client'\nimport type { ClientCollectionConfig, Data, FormState, JsonObject } from 'payload'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext.js'\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 } 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 { INSERT_UPLOAD_WITH_DRAWER_COMMAND } from '../drawer/commands.js'\nimport './index.scss'\n\nconst baseClass = 'lexical-upload'\n\nconst initialParams = {\n depth: 0,\n}\n\nexport type ElementProps = {\n data: UploadData\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: { readOnly, schemaPath },\n } = useEditorConfigContext()\n\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 return (\n <div className={baseClass} contentEditable={false} ref={uploadRef}>\n <div className={`${baseClass}__card`}>\n <div className={`${baseClass}__topRow`}>\n <div className={`${baseClass}__thumbnail`}>\n <Thumbnail\n collectionSlug={relationTo}\n fileSrc={isImage(data?.mimeType) ? thumbnailSRC : null}\n />\n </div>\n <div className={`${baseClass}__topRowRightPanel`}>\n <div className={`${baseClass}__collectionLabel`}>\n {getTranslation(relatedCollection.labels.singular, i18n)}\n </div>\n {editor.isEditable() && (\n <div className={`${baseClass}__actions`}>\n {hasExtraFields ? (\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__upload-drawer-toggler`}\n disabled={readOnly}\n el=\"button\"\n icon=\"edit\"\n onClick={() => {\n toggleDrawer()\n }}\n round\n tooltip={t('fields:editRelationship')}\n />\n ) : null}\n\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__swap-drawer-toggler`}\n disabled={readOnly}\n el=\"button\"\n icon=\"swap\"\n onClick={() => {\n editor.dispatchCommand(INSERT_UPLOAD_WITH_DRAWER_COMMAND, {\n replace: { nodeKey },\n })\n }}\n round\n tooltip={t('fields:swapUpload')}\n />\n <Button\n buttonStyle=\"icon-label\"\n className={`${baseClass}__removeButton`}\n disabled={readOnly}\n icon=\"x\"\n onClick={(e) => {\n e.preventDefault()\n removeUpload()\n }}\n round\n tooltip={t('fields:removeUpload')}\n />\n </div>\n )}\n </div>\n </div>\n <div className={`${baseClass}__bottomRow`}>\n <DocumentDrawerToggler className={`${baseClass}__doc-drawer-toggler`}>\n <strong>{data?.filename}</strong>\n </DocumentDrawerToggler>\n </div>\n </div>\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"],"mappings":"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","ignoreList":[]}