@payloadcms/richtext-lexical 4.0.0-beta.1 → 4.0.0-beta.2

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.
@@ -56,7 +56,7 @@ ${e.map(Sm).join(`
56
56
 
57
57
  `,Js="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",Xs="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",z0=new RegExp("^[^"+Xs+"]*["+Js+"]"),G0=new RegExp("^[^"+Js+"]*["+Xs+"]"),U0={bold:O.IS_BOLD,code:O.IS_CODE,highlight:O.IS_HIGHLIGHT,italic:O.IS_ITALIC,strikethrough:O.IS_STRIKETHROUGH,subscript:O.IS_SUBSCRIPT,superscript:O.IS_SUPERSCRIPT,underline:O.IS_UNDERLINE},W0={directionless:O.IS_DIRECTIONLESS,unmergeable:O.IS_UNMERGEABLE},V0={center:O.IS_ALIGN_CENTER,end:O.IS_ALIGN_END,justify:O.IS_ALIGN_JUSTIFY,left:O.IS_ALIGN_LEFT,right:O.IS_ALIGN_RIGHT,start:O.IS_ALIGN_START},K0={[O.IS_ALIGN_CENTER]:"center",[O.IS_ALIGN_END]:"end",[O.IS_ALIGN_JUSTIFY]:"justify",[O.IS_ALIGN_LEFT]:"left",[O.IS_ALIGN_RIGHT]:"right",[O.IS_ALIGN_START]:"start"},J0={normal:O.IS_NORMAL,segmented:O.IS_SEGMENTED,token:O.IS_TOKEN},X0={[O.IS_NORMAL]:"normal",[O.IS_SEGMENTED]:"segmented",[O.IS_TOKEN]:"token"};var Ys={text:({node:t})=>{let e=t.text;return t.format&O.IS_BOLD&&(e=Ue("strong",{children:e})),t.format&O.IS_ITALIC&&(e=Ue("em",{children:e})),t.format&O.IS_STRIKETHROUGH&&(e=Ue("span",{style:{textDecoration:"line-through"},children:e})),t.format&O.IS_UNDERLINE&&(e=Ue("span",{style:{textDecoration:"underline"},children:e})),t.format&O.IS_CODE&&(e=Ue("code",{children:e})),t.format&O.IS_SUBSCRIPT&&(e=Ue("sub",{children:e})),t.format&O.IS_SUPERSCRIPT&&(e=Ue("sup",{children:e})),e}};import{jsx as Ot}from"react/jsx-runtime";var Zs={upload:({node:t})=>{let e=t;if(typeof e.value!="object")return null;let o=e.value,n=e.fields?.alt||o?.alt||"",r=o.url;if(!o.mimeType.startsWith("image"))return Ot("a",{href:r,rel:"noopener noreferrer",children:o.filename});if(!o.variants||!Object.keys(o.variants).length)return Ot("img",{alt:n,height:o.height,src:r,width:o.width});let l=[];for(let s in o.variants){let i=o.variants[s];if(!i||!i.width||!i.height||!i.mimeType||!i.filesize||!i.filename||!i.url)continue;let c=i?.url;l.push(Ot("source",{media:`(max-width: ${i.width}px)`,srcSet:c,type:i.mimeType},s))}return l.push(Ot("img",{alt:n,height:o?.height,src:r,width:o?.width},"image")),Ot("picture",{children:l})}};var ut={...Ws,...Ys,...js,...Os,...Ks,...Ps,...Bs,...Us,...zs({}),...Zs,...Vs};import{jsx as xo,Fragment as Y0}from"react/jsx-runtime";import go from"react";function qs(t){if(!!!t?.root?.children?.length)return!1;let o=!1;if(t?.root?.children?.length===1&&t?.root?.children[0]?.type==="paragraph"){let n=t?.root?.children[0];if(!n?.children||n?.children?.length===0)o=!0;else if(n?.children?.length===1){let r=n?.children[0];r?.type==="text"&&(r?.text?.length||(o=!0))}}return!o}function Z0(t){return e=>{let o={...e,isEditor:!1,isJSXConverter:!0};if(t.Component)return t.Component(o);if(t.html){let n=typeof t.html=="function"?t.html(o):t.html;return xo("span",{dangerouslySetInnerHTML:{__html:n}})}return null}}function Qs(t){return e=>{if(t.Component){let o={...e,isEditor:!1,isJSXConverter:!0};return t.Component(o)}if(t.Block){let o=e.node,n={childIndex:e.childIndex,converters:e.converters,formData:o.fields??{},isEditor:!1,isJSXConverter:!0,node:o,nodesToJSX:e.nodesToJSX,parent:e.parent};return go.createElement(t.Block,n)}if(t.html){let o={...e,isEditor:!1,isJSXConverter:!0},n=typeof t.html=="function"?t.html(o):t.html;return xo("span",{dangerouslySetInnerHTML:{__html:n}})}return null}}function q0(t){let e={};for(let[o,n]of Object.entries(t)){if(!n||typeof n!="object")continue;if(o==="blocks"){e.blocks={};for(let[l,s]of Object.entries(n)){let i=s;(i.Component||i.Block||i.html)&&(e.blocks[l]=Qs(i))}continue}if(o==="inlineBlocks"){e.inlineBlocks={};for(let[l,s]of Object.entries(n)){let i=s;(i.Component||i.Block||i.html)&&(e.inlineBlocks[l]=Qs(i))}continue}let r=n;(r.Component||r.html)&&(e[o]=Z0(r))}return e}function ea({converters:t,data:e,disableIndent:o,disableTextAlign:n,nodeMap:r}){if(qs(e)){let l=r?q0(r):void 0,s=l?{...t,...l,blocks:{...t.blocks,...l.blocks},inlineBlocks:{...t.inlineBlocks,...l.inlineBlocks}}:t;return ta({converters:s,disableIndent:o,disableTextAlign:n,nodes:e.root.children,parent:e.root})}return xo(Y0,{})}function ta({converters:t,disableIndent:e,disableTextAlign:o,nodes:n,parent:r}){let l=t.unknown;return n.map((i,c)=>{let u;i.type==="block"?(u=t?.blocks?.[i?.fields?.blockType],!u&&!l&&console.error(`Lexical => JSX converter: Blocks converter: found ${i?.fields?.blockType} block, but no converter is provided`)):i.type==="inlineBlock"?(u=t?.inlineBlocks?.[i?.fields?.blockType],!u&&!l&&console.error(`Lexical => JSX converter: Inline Blocks converter: found ${i?.fields?.blockType} inline block, but no converter is provided`)):u=t[i.type];try{!u&&l&&(u=l);let d;u?d=typeof u=="function"?u({childIndex:c,converters:t,node:i,nodesToJSX:m=>ta({converters:m.converters??t,disableIndent:m.disableIndent??e,disableTextAlign:m.disableTextAlign??o,nodes:m.nodes,parent:m.parent??{...i,parent:r}}),parent:r}):u:d=xo("span",{children:"unknown node"},c);let a={};if(!o&&(!Array.isArray(o)||!o?.includes(i.type))&&"format"in i&&i.format)switch(i.format){case"center":a.textAlign="center";break;case"end":a.textAlign="right";break;case"justify":a.textAlign="justify";break;case"left":break;case"right":a.textAlign="right";break;case"start":a.textAlign="left";break}if(!e&&(!Array.isArray(e)||!e?.includes(i.type))&&"indent"in i&&i.indent&&i.type!=="listitem"&&(a.paddingInlineStart=`${Number(i.indent)*40}px`),go.isValidElement(d)){if(a.textAlign||a.paddingInlineStart){let p={...a,...d?.props?.style??{}};return go.cloneElement(d,{key:c,style:p})}return go.cloneElement(d,{key:c})}return d}catch(d){return console.error("Error converting lexical node to JSX:",d,"node:",i),null}}).filter(Boolean)}function Pn({className:t,converters:e,data:o,disableContainer:n,disableIndent:r,disableTextAlign:l,nodeMap:s}){if(!o)return null;let i=e,c={};i?typeof i=="function"?c=i({defaultConverters:ut}):c=i:c=ut;let u=o&&!Array.isArray(o)&&typeof o=="object"&&"root"in o&&ea({converters:c,data:o,disableIndent:r,disableTextAlign:l,nodeMap:s});return n?oa(Q0,{children:u}):oa("div",{className:t??"payload-richtext",children:u})}function ra(){let t=eh(7),[e]=th(),o;t[0]!==e?(o=()=>e.getEditorState().toJSON(),t[0]=e,t[1]=o):o=t[1];let[n,r]=nh(o),l,s;t[2]!==e?(l=()=>e.registerUpdateListener(c=>{let{editorState:u}=c;r(u.toJSON())}),s=[e],t[2]=e,t[3]=l,t[4]=s):(l=t[3],s=t[4]),oh(l,s);let i;return t[5]!==n?(i=na("div",{className:"debug-jsx-converter",children:na(Pn,{converters:ut,data:n})}),t[5]=n,t[6]=i):i=t[6],i}var rh=A({plugins:[{Component:ra,position:"bottom"}]});var z={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)"}},lh={text:{"text-red":{css:{color:`light-dark(${z.red[600]}, ${z.red[400]})`},label:"Red"},"text-orange":{css:{color:`light-dark(${z.orange[600]}, ${z.orange[400]})`},label:"Orange"},"text-yellow":{css:{color:`light-dark(${z.yellow[700]}, ${z.yellow[300]})`},label:"Yellow"},"text-green":{css:{color:`light-dark(${z.green[700]}, ${z.green[400]})`},label:"Green"},"text-blue":{css:{color:`light-dark(${z.blue[600]}, ${z.blue[400]})`},label:"Blue"},"text-purple":{css:{color:`light-dark(${z.purple[600]}, ${z.purple[400]})`},label:"Purple"},"text-pink":{css:{color:`light-dark(${z.pink[600]}, ${z.pink[400]})`},label:"Pink"}},background:{"bg-red":{css:{"background-color":`light-dark(${z.red[400]}, ${z.red[600]})`},label:"Red"},"bg-orange":{css:{"background-color":`light-dark(${z.orange[400]}, ${z.orange[600]})`},label:"Orange"},"bg-yellow":{css:{"background-color":`light-dark(${z.yellow[300]}, ${z.yellow[700]})`},label:"Yellow"},"bg-green":{css:{"background-color":`light-dark(${z.green[400]}, ${z.green[700]})`},label:"Green"},"bg-blue":{css:{"background-color":`light-dark(${z.blue[400]}, ${z.blue[600]})`},label:"Blue"},"bg-purple":{css:{"background-color":`light-dark(${z.purple[400]}, ${z.purple[600]})`},label:"Purple"},"bg-pink":{css:{"background-color":`light-dark(${z.pink[400]}, ${z.pink[600]})`},label:"Pink"}}};import{$isNodeSelection as Xh}from"lexical";import{jsx as la}from"react/jsx-runtime";import"react";var ih="M9.5 6C9.77614 6 10 6.22386 10 6.5C10 6.77614 9.77614 7 9.5 7H7.5C7.22386 7 7 7.22386 7 7.5V16.5C7 16.7761 7.22386 17 7.5 17H16.5C16.7761 17 17 16.7761 17 16.5V14.5C17 14.2239 17.2239 14 17.5 14C17.7761 14 18 14.2239 18 14.5V16.5C18 17.3284 17.3284 18 16.5 18H7.5C6.67157 18 6 17.3284 6 16.5V7.5C6 6.67157 6.67157 6 7.5 6H9.5ZM17.5 6C17.7761 6 18 6.22386 18 6.5V11.5C18 11.7761 17.7761 12 17.5 12C17.2239 12 17 11.7761 17 11.5V7.70703L12.8535 11.8535C12.6583 12.0488 12.3417 12.0488 12.1465 11.8535C11.9512 11.6583 11.9512 11.3417 12.1465 11.1465L16.293 7H12.5C12.2239 7 12 6.77614 12 6.5C12 6.22386 12.2239 6 12.5 6H17.5Z",Bn=({className:t})=>la("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:la("path",{d:ih,fill:"currentColor"})});import{jsx as dh}from"react/jsx-runtime";import{$applyNodeReplacement as mh}from"lexical";import*as sa from"react";import{DecoratorBlockNode as sh}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as ah}from"@lexical/utils";import{$applyNodeReplacement as ch}from"lexical";function uh(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:ia({relationTo:o,value:e})}:null}var Ft=class extends sh{__data;constructor({data:e,format:o,key:n}){super(o,n),this.__data=e}static clone(e){return new this({data:e.__data,format:e.__format,key:e.__key})}static getType(){return"relationship"}static importDOM(){return{div:e=>!e.hasAttribute("data-lexical-relationship-relationTo")||!e.hasAttribute("data-lexical-relationship-id")?null:{conversion:uh,priority:2}}}static importJSON(e){let o={relationTo:e.relationTo,value:e.value},n=ia(o);return n.setFormat(e.format),n}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return ah(o,e?.theme?.relationship),o}decorate(e,o){return null}exportDOM(){let e=document.createElement("div");e.setAttribute("data-lexical-relationship-id",String(typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value)),e.setAttribute("data-lexical-relationship-relationTo",this.__data?.relationTo);let o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"relationship"}}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 ia(t){return ch(new Ft({data:t}))}var ph=sa.lazy(()=>import("./RelationshipComponent-YCPAKOL7.js").then(t=>({default:t.RelationshipComponent})));function fh(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:We({relationTo:o,value:e})}:null}var we=class extends Ft{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{div:e=>!e.hasAttribute("data-lexical-relationship-relationTo")||!e.hasAttribute("data-lexical-relationship-id")?null:{conversion:fh,priority:2}}}static importJSON(e){let o={relationTo:e.relationTo,value:e.value},n=We(o);return n.setFormat(e.format),n}decorate(e,o){return dh(ph,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function We(t){return mh(new we({data:t}))}function jn(t){return t instanceof we}import{c as Fh}from"react/compiler-runtime";import{jsx as Ph}from"react/jsx-runtime";import{useLexicalComposerContext as Bh}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as jh}from"@lexical/utils";import{$getPreviousSelection as Hh,$getSelection as zh,$isParagraphNode as Gh,$isRangeSelection as Uh,COMMAND_PRIORITY_EDITOR as Wh,createCommand as Vh}from"lexical";import{useEffect as Kh}from"react";import{c as ua}from"react/compiler-runtime";import{jsx as Hn}from"react/jsx-runtime";import{useLexicalComposerContext as da}from"@lexical/react/LexicalComposerContext.js";import{toast as Nh}from"@payloadcms/ui";import{$getNodeByKey as Lh,COMMAND_PRIORITY_EDITOR as ma}from"lexical";import{useEffect as pa,useState as yh}from"react";import{c as hh}from"react/compiler-runtime";import{jsx as gh}from"react/jsx-runtime";import{useLexicalComposerContext as xh}from"@lexical/react/LexicalComposerContext";import{useListDrawer as Ch,useModal as bh}from"@payloadcms/ui";import{$getNodeByKey as aa,$getPreviousSelection as kh,$getRoot as _h,$getSelection as Th,$isRangeSelection as Eh,$setSelection as wh}from"lexical";import{useEffect as Sh,useState as ca}from"react";var Pt=t=>{let e=hh(23),[o]=xh(),[n,r]=ca(null),[l,s]=ca(!1),[i,c,u]=Ch(t),{closeDrawer:d,drawerSlug:a,isDrawerOpen:p,openDrawer:m}=u,{modalState:f}=bh(),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let N=Th()??kh();r(N)},e[0]=h):h=e[0];let g=h,C;e[1]!==o||e[2]!==n?(C=()=>{n&&o.update(()=>{if(Eh(n)){let{anchor:N,focus:w}=n;aa(N.key)&&aa(w.key)&&wh(n.clone())}else _h().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=n,e[3]=C):C=e[3];let E=C,L;e[4]!==d?(L=()=>{d()},e[4]=d,e[5]=L):L=e[5];let x=L,b,k;e[6]!==a||e[7]!==f||e[8]!==E||e[9]!==l?(b=()=>{if(!l)return;let N=f[a];N&&!N?.isOpen&&(s(!1),setTimeout(()=>{E()},1))},k=[f,a,E,l],e[6]=a,e[7]=f,e[8]=E,e[9]=l,e[10]=b,e[11]=k):(b=e[10],k=e[11]),Sh(b,k);let _;e[12]!==c?(_=N=>gh(c,{...N,onClick:()=>{g()}}),e[12]=c,e[13]=_):_=e[13];let T;e[14]!==m?(T=()=>{g(),m(),s(!0)},e[14]=m,e[15]=T):T=e[15];let I;return e[16]!==i||e[17]!==x||e[18]!==p||e[19]!==a||e[20]!==_||e[21]!==T?(I={closeListDrawer:x,isListDrawerOpen:p,ListDrawer:i,listDrawerSlug:a,ListDrawerToggler:_,openListDrawer:T},e[16]=i,e[17]=x,e[18]=p,e[19]=a,e[20]=_,e[21]=T,e[22]=I):I=e[22],I};var Rh=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=Lh(o);r&&r.replace(We({relationTo:e,value:n}))}):t.dispatchCommand(zn,{relationTo:e,value:n})},vh=t=>{let e=ua(14),{enabledCollectionSlugs:o}=t,[n]=da(),[r,l]=yh(null),s=o?.[0],i;e[0]!==o||e[1]!==s?(i={collectionSlugs:o,selectedCollection:s},e[0]=o,e[1]=s,e[2]=i):i=e[2];let{closeListDrawer:c,ListDrawer:u,openListDrawer:d}=Pt(i),a,p;e[3]!==n||e[4]!==d?(a=()=>n.registerCommand(et,g=>(l(g?.replace?g?.replace.nodeKey:null),d(),!0),ma),p=[n,d],e[3]=n,e[4]=d,e[5]=a,e[6]=p):(a=e[5],p=e[6]),pa(a,p);let m;e[7]!==c||e[8]!==n||e[9]!==r?(m=g=>{let{collectionSlug:C,doc:E}=g;Rh({editor:n,relationTo:C,replaceNodeKey:r,value:E.id}),c()},e[7]=c,e[8]=n,e[9]=r,e[10]=m):m=e[10];let f=m,h;return e[11]!==u||e[12]!==f?(h=Hn(u,{onSelect:f}),e[11]=u,e[12]=f,e[13]=h):h=e[13],h},Ih=()=>{let t=ua(3),[e]=da(),o,n;return t[0]!==e?(o=()=>e.registerCommand(et,Mh,ma),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),pa(o,n),null},fa=({enabledCollectionSlugs:t})=>t?.length?Hn(vh,{enabledCollectionSlugs:t}):Hn(Ih,{});function Mh(){return Nh.error("No relationship collections enabled"),!0}import{c as Ah}from"react/compiler-runtime";import{useConfig as Dh,useEntityVisibility as $h}from"@payloadcms/ui";import"react";var Co=t=>{let e=Ah(11),{enabledCollectionSlugs:o}=t,{config:n}=Dh(),{collections:r}=n,{visibleEntities:l}=$h(),s,i;if(e[0]!==r||e[1]!==o||e[2]!==l){let u;e[5]!==o||e[6]!==l?(u=a=>{let{slug:p}=a;return o.includes(p)&&(!l?.collections||l.collections.includes(p))},e[5]=o,e[6]=l,e[7]=u):u=e[7];let d=r.filter(u);s=d,i=d.map(Oh),e[0]=r,e[1]=o,e[2]=l,e[3]=s,e[4]=i}else s=e[3],i=e[4];let c;return e[8]!==s||e[9]!==i?(c={enabledCollections:s,enabledCollectionSlugs:i},e[8]=s,e[9]=i,e[10]=c):c=e[10],c};function Oh(t){return t.slug}var zn=Vh("INSERT_RELATIONSHIP_COMMAND"),ha=t=>{let e=Fh(7),{clientProps:o}=t,[n]=Bh(),r;e[0]!==o.enabledCollectionSlugs?(r={enabledCollectionSlugs:o.enabledCollectionSlugs},e[0]=o.enabledCollectionSlugs,e[1]=r):r=e[1];let{enabledCollectionSlugs:l}=Co(r),s,i;e[2]!==n?(s=()=>{if(!n.hasNodes([we]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return n.registerCommand(zn,Jh,Wh)},i=[n],e[2]=n,e[3]=s,e[4]=i):(s=e[3],i=e[4]),Kh(s,i);let c;return e[5]!==l?(c=Ph(fa,{enabledCollectionSlugs:l}),e[5]=l,e[6]=c):c=e[6],c};function Jh(t){let e=zh()||Hh();if(Uh(e)){let o=We(t),{focus:n}=e,r=n.getNode();jh(o),Gh(r)&&!r.__first&&r.remove()}return!0}var Yh=A({nodes:[we],plugins:[{Component:ha,position:"normal"}],slashMenu:{groups:[q([{Icon:Bn,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(et,{replace:!1})}}])]},toolbarFixed:{groups:[be([{ChildComponent:Bn,isActive:({selection:t})=>{if(!Xh(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return jn(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(et,{replace:!1})}}])]}});import{c as M5}from"react/compiler-runtime";import{jsx as he,jsxs as A5}from"react/jsx-runtime";import{useLexicalComposerContext as D5}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as La}from"@lexical/react/useLexicalEditable";import{getTranslation as $5}from"@payloadcms/translations";import{useScrollInfo as O5,useThrottledEffect as F5,useTranslation as ya}from"@payloadcms/ui";import*as Ra from"react";import{useMemo as Eo}from"react";import{jsx as Zh,jsxs as qh}from"react/jsx-runtime";import{Tooltip as Qh,useTranslation as e5}from"@payloadcms/ui";import{$addUpdateTag as t5}from"lexical";import{useCallback as ga,useEffect as o5,useMemo as xa,useRef as n5,useState as r5}from"react";var Gn="toolbar-popup__button",Bt=({active:t=!1,children:e,editor:o,enabled:n=!0,item:r})=>{let{i18n:l}=e5(),{fieldProps:{featureClientSchemaMap:s,schemaPath:i}}=U(),[c,u]=r5(!1),d=n5(null);o5(()=>{d.current?.removeAttribute("data-pressing")},[t]);let a=xa(()=>r.label?typeof r.label=="function"?r.label({featureClientSchemaMap:s,i18n:l,schemaPath:i}):r.label:r.key.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^./,h=>h.toUpperCase()),[s,l,i,r]),p=xa(()=>[Gn,n?"":"disabled",t?"active":"",r.key?`${Gn}-${r.key}`:""].filter(Boolean).join(" "),[t,n,r.key]),m=ga(()=>{n&&o.focus(()=>{o.update(()=>{t5("toolbar")}),r.onSelect?.({editor:o,isActive:t})})},[o,r,t,n]),f=ga(h=>{h.preventDefault(),h.currentTarget.setAttribute("data-pressing","")},[]);return qh("button",{"aria-label":a,"aria-pressed":r.isActive?t:void 0,className:p,"data-button-key":r.key,disabled:!n,onClick:m,onMouseDown:f,onPointerEnter:()=>u(!0),onPointerLeave:()=>{u(!1),d.current?.removeAttribute("data-pressing")},ref:d,type:"button",children:[Zh(Qh,{className:`${Gn}__tooltip`,show:c,children:a}),e]})};import{c as d5}from"react/compiler-runtime";import{jsx as dt}from"react/jsx-runtime";import m5,{useMemo as p5}from"react";import{useTranslation as f5}from"@payloadcms/ui";import{jsx as Ve,jsxs as Ca}from"react/jsx-runtime";import{Button as l5}from"@payloadcms/ui";import{$addUpdateTag as i5,isDOMNode as s5}from"lexical";import Wn,{useCallback as a5,useEffect as ko,useId as c5,useMemo as ka,useRef as bo,useState as Un}from"react";var ba="toolbar-popup__dropdown-item",_a=Wn.createContext(null);function Ta({active:t,children:e,editor:o,enabled:n,Icon:r,item:l,itemKey:s,tooltip:i}){let c=ka(()=>[ba,n===!1?"disabled":"",t?"active":"",l?.key?`${ba}-${l.key}`:""].filter(Boolean).join(" "),[n,t,l.key]),u=bo(null),d=Wn.use(_a);if(d===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=d;return ko(()=>{u?.current!=null&&a(u)},[u,a]),Ve(l5,{"aria-label":i,buttonStyle:"ghost",className:c,disabled:n===!1,extraButtonProps:{"aria-checked":l.isActive?!!t:void 0,"data-item-key":s,role:l.isActive?"menuitemcheckbox":"menuitem",tabIndex:-1},icon:r,iconPosition:"left",onClick:()=>{n!==!1&&o.focus(()=>{o.update(()=>{i5("toolbar")}),l.onSelect?.({editor:o,isActive:t})})},onMouseDown:p=>{p.preventDefault()},ref:u,tooltip:i,type:"button",children:e})}function u5({id:t,children:e,dropdownKey:o,dropDownRef:n,itemsContainerClassNames:r,onClose:l,shouldAutoFocus:s}){let[i,c]=Un(),[u,d]=Un(),a=a5(f=>{c(h=>h!=null?[...h,f]:[f])},[c]),p=f=>{if(i==null)return;let{key:h}=f,g=i.filter(C=>!C.current?.disabled);["ArrowDown","ArrowUp","Escape"].includes(h)&&f.preventDefault(),h==="Escape"?l():h==="Tab"?setTimeout(()=>l({restoreFocus:!1})):h==="ArrowUp"?d(C=>{if(C==null)return g[0];let E=g.indexOf(C)-1;return g[E===-1?g.length-1:E]}):h==="ArrowDown"&&d(C=>{if(C==null)return g[0];let E=g.indexOf(C);return g[E===g.length-1?0:E+1]})},m=ka(()=>({registerItem:a}),[a]);return ko(()=>{s&&i!=null&&u==null&&d(i.find(f=>!f.current?.disabled)),u!=null&&u?.current!=null&&u.current.focus()},[i,u,s]),Ve(_a,{value:m,children:Ve("div",{className:(r??["toolbar-popup__dropdown-items"]).join(" "),"data-dropdown-key":o,"data-theme":"dark",id:t,onKeyDown:p,popover:"manual",ref:n,role:"menu",tabIndex:-1,children:e})})}function Ea({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:n=!1,dropdownKey:r,Icon:l,itemsContainerClassNames:s,label:i,stopCloseOnClickSelf:c}){let u=bo(null),d=bo(null),a=bo(!1),p=c5(),m=`toolbar-dropdown-${r}-${p}`,[f,h]=Un(!1),g=({restoreFocus:C=!0}={})=>{h(!1),C&&d?.current!=null&&d.current.focus()};return ko(()=>{let C=d.current,E=u.current;if(f&&C!==null&&E!==null){E.matches(":popover-open")||E.showPopover();let L=()=>{let{bottom:x,left:b,top:k}=C.getBoundingClientRect(),_=8,T=5,I=x+T,N=k-E.offsetHeight-T,w=Math.max(_,window.innerHeight-E.offsetHeight-_),y=I+E.offsetHeight+_<=window.innerHeight?I:N>=_?N:I;E.style.position="fixed",E.style.top=`${Math.max(_,Math.min(y,w))}px`,E.style.left=`${Math.max(8,Math.min(b-5,window.innerWidth-E.offsetWidth-20))}px`};return L(),window.addEventListener("resize",L),window.addEventListener("scroll",L,{capture:!0,passive:!0}),()=>{window.removeEventListener("resize",L),window.removeEventListener("scroll",L,{capture:!0})}}},[u,d,f]),ko(()=>{let C=d.current;if(C!==null&&f){let E=L=>{let x=L.target;s5(x)&&(c&&u.current&&u.current.contains(x)||C.contains(x)||h(!1))};return document.addEventListener("click",E),()=>{document.removeEventListener("click",E)}}},[u,d,f,c]),Ca(Wn.Fragment,{children:[Ca("button",{"aria-controls":m,"aria-expanded":f,"aria-haspopup":"menu","aria-label":t,className:e+(f?" active":""),"data-dropdown-key":r,disabled:n,onClick:C=>{C.preventDefault(),a.current=!1,h(!f)},onKeyDown:C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),a.current=!0,h(!f))},onMouseDown:C=>{C.preventDefault()},ref:d,type:"button",children:[l&&Ve(l,{}),i&&Ve("span",{className:"toolbar-popup__dropdown-label",children:i}),Ve("i",{className:"toolbar-popup__dropdown-caret"})]}),f&&Ve(u5,{dropdownKey:r,dropDownRef:u,id:m,itemsContainerClassNames:s,onClose:g,shouldAutoFocus:a.current,children:o})]})}var Vn="toolbar-popup__dropdown",h5=t=>{let e=d5(15),{active:o,anchorElem:n,editor:r,enabled:l,iconOnly:s,item:i}=t,{i18n:c}=f5(),{fieldProps:u}=U(),{featureClientSchemaMap:d,schemaPath:a}=u;if(i.Component){let m;return e[0]!==o||e[1]!==n||e[2]!==r||e[3]!==l||e[4]!==i?(m=i?.Component&&dt(i.Component,{active:o,anchorElem:n,editor:r,enabled:l,item:i},i.key),e[0]=o,e[1]=n,e[2]=r,e[3]=l,e[4]=i,e[5]=m):m=e[5],m}let p;if(e[6]!==o||e[7]!==r||e[8]!==l||e[9]!==d||e[10]!==c||e[11]!==s||e[12]!==i||e[13]!==a){let m=i.key,f;i.label&&(m=typeof i.label=="function"?i.label({featureClientSchemaMap:d,i18n:c,schemaPath:a}):i.label),m.length>25?f=m.substring(0,25)+"...":f=m,p=dt(Ta,{active:o,editor:r,enabled:l,Icon:i?.ChildComponent?dt(i.ChildComponent,{}):void 0,item:i,itemKey:i.key,tooltip:s?m:void 0,children:dt("span",{className:"text",children:f})},i.key),e[6]=o,e[7]=r,e[8]=l,e[9]=d,e[10]=c,e[11]=s,e[12]=i,e[13]=a,e[14]=p}else p=e[14];return p},g5=m5.memo(h5),jt=({anchorElem:t,classNames:e,editor:o,group:n,groupState:r,Icon:l,itemsContainerClassNames:s,label:i})=>{let{items:c,key:u}=n,d=p5(()=>c?.length?c.map(a=>dt(g5,{active:r.activeItemKeys.includes(a.key),anchorElem:t,editor:o,enabled:r.enabledItemKeys.includes(a.key),iconOnly:n.iconOnly,item:a},a.key)):null,[c,r.activeItemKeys,r.enabledItemKeys,t,o]);return dt(Ea,{buttonAriaLabel:`${u} dropdown`,buttonClassName:[Vn,`${Vn}-${u}`,...e||[]].filter(Boolean).join(" "),disabled:!r.enabledGroup,dropdownKey:u,Icon:l,itemsContainerClassNames:[`${Vn}-items`,...s||[]],label:i,children:d},u)};import{useEffect as x5}from"react";function _o({toolbarRef:t}){x5(()=>{let e=t.current;if(!e)return;let o,n=()=>Array.from(e.querySelectorAll("button")).filter(c=>!c.closest('[role="menu"]')&&c.closest('[role="toolbar"]')===e),r=()=>{let c=n(),u=c.filter(d=>!d.disabled);(!o||!u.includes(o))&&(o=u[0]);for(let d of c)d.tabIndex=d===o?0:-1},l=c=>{let u=n().find(d=>d===c.target);u&&(o=u,r())},s=c=>{if(c.altKey||c.ctrlKey||c.metaKey||c.shiftKey)return;let u=n().filter(m=>!m.disabled),d=u.findIndex(m=>m===c.target);if(d===-1)return;let a=getComputedStyle(e).direction==="rtl",p;switch(c.key){case"ArrowLeft":p=d+(a?1:-1);break;case"ArrowRight":p=d+(a?-1:1);break;case"End":p=u.length-1;break;case"Home":p=0;break;default:return}c.preventDefault(),c.stopPropagation(),u[(p+u.length)%u.length]?.focus()};r();let i=new MutationObserver(r);return i.observe(e,{attributeFilter:["disabled"],childList:!0,subtree:!0}),e.addEventListener("focusin",l),e.addEventListener("keydown",s),()=>{i.disconnect(),e.removeEventListener("focusin",l),e.removeEventListener("keydown",s)}},[t])}import{mergeRegister as C5}from"@lexical/utils";import{$getSelection as b5}from"lexical";import{useCallback as k5,useDeferredValue as _5,useEffect as T5,useRef as wa,useState as E5}from"react";function w5(t){let e=new Map,o=new Map;if(!t?.length)return{groupStates:o,itemStates:e};for(let n of t){let r=[];for(let l of n.items)e.set(l.key,{active:!1,enabled:!0}),r.push(l.key);o.set(n.key,{activeItemKeys:[],activeItems:[],enabledGroup:!0,enabledItemKeys:r})}return{groupStates:o,itemStates:e}}function To(t,e){let[o,n]=E5(()=>w5(e)),r=_5(o),l=U(),s=wa(l);s.current=l;let i=wa(e);i.current=e;let c=Ar(),u=k5(()=>{t.getEditorState().read(()=>{let d=b5();if(!d)return;let a=i.current;if(!a?.length)return;let p=s.current,m=new Map,f=new Map;for(let h of a){let g=[],C=[],E=[],L=h.type==="dropdown"?h.maxActiveItems??1:void 0;for(let b of h.items){let k=b.isActive?(!L||g.length<L)&&b.isActive({editor:t,editorConfigContext:p,selection:d}):!1,_=b.isEnabled?b.isEnabled({editor:t,editorConfigContext:p,selection:d}):!0;k&&(g.push(b.key),C.push(b)),_&&E.push(b.key),m.set(b.key,{active:k,enabled:_})}let x=h.type==="dropdown"&&h.isEnabled?h.isEnabled({editor:t,editorConfigContext:p,selection:d}):!0;f.set(h.key,{activeItemKeys:g,activeItems:C,enabledGroup:x,enabledItemKeys:E})}n({groupStates:f,itemStates:m})})},[t]);return T5(()=>{c(u);let d=()=>{c(u)},a=C5(t.registerUpdateListener(d));return document.addEventListener("mouseup",d),()=>{a(),document.removeEventListener("mouseup",d)}},[t,c,u]),r}import{c as S5}from"react/compiler-runtime";import{useEffect as N5}from"react";var L5=".fixed-toolbar__scroll",y5=40;function R5({clientWidth:t,deltaMode:e,deltaY:o,isRightToLeft:n}){let r=e===1?o*y5:e===2?o*t:o;return n?-r:r}function Sa(t){if(!(Math.abs(t.deltaY)>Math.abs(t.deltaX)))return;let o=t.target;if(!(o instanceof Element))return;let n=o.closest(L5);!n||!(n.scrollWidth>n.clientWidth)||(t.preventDefault(),n.scrollLeft+=R5({clientWidth:n.clientWidth,deltaMode:t.deltaMode,deltaY:t.deltaY,isRightToLeft:getComputedStyle(n).direction==="rtl"}))}var mt=0;function Na(){let t=S5(1),e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],t[0]=e):e=t[0],N5(v5,e)}function v5(){return mt===0&&document.addEventListener("wheel",Sa,{passive:!1}),mt=mt+1,I5}function I5(){mt=mt-1,mt===0&&document.removeEventListener("wheel",Sa)}function P5({active:t,anchorElem:e,editor:o,enabled:n,item:r}){return r.Component?r?.Component&&he(r.Component,{anchorElem:e,editor:o,item:r},r.key):r.ChildComponent?he(Bt,{active:t,editor:o,enabled:n,item:r,children:he(r.ChildComponent,{})},r.key):null}function B5({anchorElem:t,editor:e,editorConfig:o,group:n,index:r,toolbarStates:l}){let{i18n:s}=ya(),{fieldProps:{featureClientSchemaMap:i,schemaPath:c}}=U(),u=l.groupStates.get(n.key),d=Eo(()=>{if(n.type!=="dropdown")return;let p=u?.activeItems?.[0];return p?p.ChildComponent:n.ChildComponent},[n,u?.activeItems]),a=Eo(()=>{if(n.type!=="dropdown")return;let p=u?.activeItems;if(!p?.length)return;if(p.length>1)return s.t("lexical:general:toolbarItemsActive",{count:p.length});let m=p[0],f=m.key;return m.label&&(f=typeof m.label=="function"?m.label({featureClientSchemaMap:i,i18n:s,schemaPath:c}):m.label),f.length>25&&(f=f.substring(0,25)+"..."),f},[n,u?.activeItems,s,i,c]);return A5("div",{className:`fixed-toolbar__group fixed-toolbar__group-${n.key}`,"data-toolbar-group-key":n.key,children:[n.type==="dropdown"&&n.items.length&&u?he(jt,{anchorElem:t,editor:e,group:n,groupState:u,Icon:d,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a}):null,n.type==="buttons"&&n.items.length?n.items.map(p=>{let m=l.itemStates.get(p.key);return he(P5,{active:m?.active??!1,anchorElem:t,editor:e,enabled:m?.enabled??!0,item:p},p.key)}):null,r<o.features.toolbarFixed?.groups.length-1&&he("div",{className:"divider"})]},n.key)}function j5({anchorElem:t,clientProps:e,editor:o,editorConfig:n,parentWithFixedToolbar:r}){let l=Ra.useRef(null),s=Eo(()=>({toolbarRef:l}),[]),{fieldProps:i}=U(),{i18n:c}=ya();_o(s);let u=La(),{y:d}=O5();Na();let a=To(o,n?.features?.toolbarFixed?.groups),p=Eo(()=>{if(!r||e?.disableIfParentHasFixedToolbar)return null;let f=r.editorContainerRef.current.previousElementSibling;for(;f;){if(f.classList.contains("fixed-toolbar"))return f;f=f.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,r]);return F5(()=>{if(!p)return;let m=l.current;if(!m)return;let f=m.getBoundingClientRect(),h=p.getBoundingClientRect();if(!(f.bottom<h.top||f.top>h.bottom))m.classList.remove("fixed-toolbar"),m.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),p.classList.remove("fixed-toolbar"),p.classList.add("fixed-toolbar","fixed-toolbar--hide");else{if(!m.classList.contains("fixed-toolbar--overlapping"))return;m.classList.remove("fixed-toolbar--overlapping"),m.classList.add("fixed-toolbar"),p.classList.remove("fixed-toolbar--hide"),p.classList.add("fixed-toolbar")}},50,[l,p,d]),he("div",{"aria-label":$5(i.field.label||i.path,c)||i.path,className:"fixed-toolbar",onFocus:m=>{m.stopPropagation()},ref:l,role:"toolbar",children:u&&he("div",{className:"fixed-toolbar__scroll",tabIndex:-1,children:n?.features&&n.features?.toolbarFixed?.groups.map((m,f)=>he(B5,{anchorElem:t,editor:o,editorConfig:n,group:m,index:f,toolbarStates:a},m.key))})})}var va=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return va(t.parentEditor)}return!1},Ia=t=>{let e=M5(6),{clientProps:o}=t,[n]=D5(),r=U();if(!La())return null;let{editorConfig:s}=r,i=o.applyToFocusedEditor&&r.focusedEditor?.editor||n,c=o.applyToFocusedEditor&&r.focusedEditor?.editorConfig||s,u,d;if(e[0]!==o||e[1]!==i||e[2]!==c||e[3]!==r){d=Symbol.for("react.early_return_sentinel");e:{let a=va(r);if(o?.disableIfParentHasFixedToolbar&&a){d=null;break e}if(!c?.features?.toolbarFixed?.groups?.length){d=null;break e}u=he(j5,{anchorElem:document.body,clientProps:o,editor:i,editorConfig:c,parentWithFixedToolbar:a})}e[0]=o,e[1]=i,e[2]=c,e[3]=r,e[4]=u,e[5]=d}else u=e[4],d=e[5];return d!==Symbol.for("react.early_return_sentinel")?d:u};var H5=A({plugins:[{Component:Ia,position:"aboveContainer"}]});import{c as z5}from"react/compiler-runtime";import{jsx as Se,jsxs as Da}from"react/jsx-runtime";import{useLexicalComposerContext as G5}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as U5}from"@lexical/react/useLexicalEditable";import{mergeRegister as $a}from"@lexical/utils";import{getTranslation as W5}from"@payloadcms/translations";import{useTranslation as V5}from"@payloadcms/ui";import{$getSelection as Oa,$isRangeSelection as Ma,$isTextNode as K5,$onUpdate as J5,COMMAND_PRIORITY_LOW as X5,getDOMSelection as Fa,SELECTION_CHANGE_COMMAND as Y5}from"lexical";import{useCallback as So,useEffect as Ht,useMemo as Pa,useRef as Aa,useState as Z5}from"react";import"react";import{createPortal as q5}from"react-dom";function Kn(t,e){let o=t.getRangeAt(0),n;if(t.anchorNode===e){let r=e;for(;r.firstElementChild!=null;)r=r.firstElementChild;n=r.getBoundingClientRect()}else n=o.getBoundingClientRect();return n}function wo(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:n=0,floatingElem:r,horizontalOffset:l=32,horizontalPosition:s="left",specialHandlingForCaret:i=!1,targetRect:c,verticalGap:u=10}=t,d=o.parentElement;if(c===null||d==null){r.style.opacity="0",r.style.transform="translate(-10000px, -10000px)";return}let a=r.getBoundingClientRect(),p=o.getBoundingClientRect(),m=d.getBoundingClientRect(),f=c.top-a.height-u,h=c.left-l;s==="center"&&(h=c.left+c.width/2-a.width/2);let g=0;return!e&&f<m.top&&!i&&(g=a.height+c.height+u*2,f+=g),s==="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,r.style.opacity="1",i&&n!==0?(f-=p.bottom-n+a.height-3,r.style.transform=`translate(${h}px, ${f}px) rotate(180deg)`):(f-=p.top,r.style.transform=`translate(${h}px, ${f}px)`),g}function Q5({active:t,anchorElem:e,editor:o,enabled:n,item:r}){return r.Component?r?.Component&&Se(r.Component,{anchorElem:e,editor:o,item:r},r.key):r.ChildComponent?Se(Bt,{active:t,editor:o,enabled:n,item:r,children:Se(r.ChildComponent,{})},r.key):null}function eg({anchorElem:t,editor:e,group:o,index:n,toolbarStates:r}){let{editorConfig:l}=U(),s=r.groupStates.get(o.key),i=Pa(()=>o.type!=="dropdown"?void 0:s?.activeItems?.[0]?.ChildComponent??o.ChildComponent,[o,s?.activeItems]);return Da("div",{className:`inline-toolbar-popup__group inline-toolbar-popup__group-${o.key}`,"data-toolbar-group-key":o.key,children:[o.type==="dropdown"&&o.items.length&&s?Se(jt,{anchorElem:t,editor:e,group:o,groupState:s,Icon:i}):null,o.type==="buttons"&&o.items.length?o.items.map(c=>{let u=r.itemStates.get(c.key);return Se(Q5,{active:u?.active??!1,anchorElem:t,editor:e,enabled:u?.enabled??!0,item:c},c.key)}):null,n<l.features.toolbarInline?.groups.length-1&&Se("div",{className:"divider"})]},o.key)}function tg({anchorElem:t,editor:e}){let o=Aa(null),n=Pa(()=>({toolbarRef:o}),[]),{fieldProps:r}=U(),{i18n:l}=V5();_o(n);let s=Aa(null),{editorConfig:i}=U(),c=To(e,i?.features?.toolbarInline?.groups),u=So(()=>{if(o?.current){let m=o.current.style.opacity==="0",f=o.current.style.pointerEvents==="none";m||(o.current.style.opacity="0"),f||(o.current.style.pointerEvents="none")}},[o]),d=So(m=>{if(o?.current&&(m.buttons===1||m.buttons===3)){let f=o.current.style.opacity==="0",h=o.current.style.pointerEvents==="none";if(!f||!h){let g=m.clientX,C=m.clientY,E=document.elementFromPoint(g,C);o.current.contains(E)||u()}}},[u]),a=So(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);Ht(()=>(document.addEventListener("mousemove",d),document.addEventListener("mouseup",a),()=>{document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",a)}),[o,d,a]);let p=So(()=>{let m=Oa(),f=Fa(e._window);if(o.current===null)return;let h=t.querySelector(":scope > .link-editor"),g=h!==null&&"style"in h&&h?.style?.opacity==="1",C=e.getRootElement();if(m!==null&&f!==null&&!f.isCollapsed&&C!==null&&C.contains(f.anchorNode)){let E=Kn(f,C),L=wo({alwaysDisplayOnTop:g,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:E});s.current&&wo({anchorElem:o.current,anchorFlippedOffset:L,floatingElem:s.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:E,verticalGap:8})}else u()},[e,u,t]);return Ht(()=>{let m=t.parentElement,f=()=>{e.getEditorState().read(()=>{p()})};return window.addEventListener("resize",f),m&&m.addEventListener("scroll",f),()=>{window.removeEventListener("resize",f),m&&m.removeEventListener("scroll",f)}},[e,p,t]),Ht(()=>(e.getEditorState().read(()=>{p()}),$a(e.registerUpdateListener(({editorState:m})=>{m.read(()=>{p()})}),e.registerCommand(Y5,()=>(J5(()=>e.read("latest",p)),!1),X5))),[e,p]),Da("div",{"aria-label":W5(r.field.label||r.path,l)||r.path,className:"inline-toolbar-popup",ref:o,role:"toolbar",children:[Se("div",{className:"caret",ref:s}),i?.features&&i.features?.toolbarInline?.groups.map((m,f)=>Se(eg,{anchorElem:t,editor:e,group:m,index:f,toolbarStates:c},m.key))]})}function og(t,e){let o=z5(12),[n,r]=Z5(!1),l=U5(),s;o[0]!==t?(s=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let m=Oa(),f=Fa(t._window),h=t.getRootElement();if(f!==null&&(!Ma(m)||h===null||!h.contains(f.anchorNode))){r(!1);return}if(!Ma(m))return;if(m.getTextContent()!==""){let C=m.getNodes(),E=!1;for(let L of C)if(K5(L)){r(!0),E=!0;break}E||r(!1)}else r(!1);let g=m.getTextContent().replace(/\n/g,"");if(!m.isCollapsed()&&g===""){r(!1);return}})},o[0]=t,o[1]=s):s=o[1];let i=s,c,u;o[2]!==i?(c=()=>(document.addEventListener("selectionchange",i),document.addEventListener("mouseup",i),()=>{document.removeEventListener("selectionchange",i),document.removeEventListener("mouseup",i)}),u=[i],o[2]=i,o[3]=c,o[4]=u):(c=o[3],u=o[4]),Ht(c,u);let d,a;if(o[5]!==t||o[6]!==i?(d=()=>$a(t.registerUpdateListener(()=>{i()}),t.registerRootListener(()=>{t.getRootElement()===null&&r(!1)})),a=[t,i],o[5]=t,o[6]=i,o[7]=d,o[8]=a):(d=o[7],a=o[8]),Ht(d,a),!n||!l)return null;let p;return o[9]!==e||o[10]!==t?(p=q5(Se(tg,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=p):p=o[11],p}var Ba=t=>{let{anchorElem:e}=t,[o]=G5();return og(o,e)};var ng=A({plugins:[{Component:Ba,position:"floatingAnchorElem"}]});import{TableCellNode as q2,TableNode as Q2,TableRowNode as ex}from"@lexical/table";import{jsx as ja}from"react/jsx-runtime";import"react";var rg={16:"M7 4h4.5a.5.5 0 0 1 .5.5V6H7zM6 4H4.5a.5.5 0 0 0-.5.5V6h2zm0 3H4v2h2zm0 3H4v1.5a.5.5 0 0 0 .5.5H6zm1 2h4.5a.5.5 0 0 0 .5-.5V10H7zm0-3V7h5v2zM3 4.5A1.5 1.5 0 0 1 4.5 3h7A1.5 1.5 0 0 1 13 4.5v7a1.5 1.5 0 0 1-1.5 1.5h-7A1.5 1.5 0 0 1 3 11.5z",24:"M17.204 6.51A2 2 0 0 1 19 8.5V16l-.011.204a2 2 0 0 1-1.785 1.785L17 18H7l-.204-.01a2 2 0 0 1-1.786-1.786L5 16V8.5a2 2 0 0 1 1.796-1.99L7 6.5h10zM6 16a1 1 0 0 0 1 1h2v-2.5H6zm4-1.5V17h7a1 1 0 0 0 .995-.898L18 16v-1.5zm-4-1h3V11H6zm4-2.5v2.5h8V11zM7 7.5a1 1 0 0 0-.995.897L6 8.5V10h3V7.5zm3 2.5h8V8.5a1 1 0 0 0-1-1h-7z"},Jn=({className:t,size:e=24})=>ja("svg",{className:["icon",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:ja("path",{clipRule:"evenodd",d:rg[e],fill:"currentColor",fillRule:"evenodd"})});import{$convertToMarkdownString as lg}from"@lexical/markdown";import{$createTableCellNode as ig,$createTableNode as sg,$createTableRowNode as ag,$isTableCellNode as Ha,$isTableNode as Xn,$isTableRowNode as Yn,TableCellHeaderStates as No,TableCellNode as cg,TableNode as ug,TableRowNode as dg}from"@lexical/table";import{$isParagraphNode as mg,$isTextNode as pg}from"lexical";var Ga=/^\|(.+)\|\s?$/,fg=/^(\| ?:?-*:? ?)+\|\s?$/,Ua=({allTransformers:t})=>({type:"element",dependencies:[ug,dg,cg],export:e=>{if(!Xn(e))return null;let o=[];for(let n of e.getChildren()){let r=[];if(!Yn(n))continue;let l=!1;for(let s of n.getChildren())Ha(s)&&(r.push(lg(t,s).replace(/\n/g,"\\n").trim()),s.__headerState===No.ROW&&(l=!0));o.push(`| ${r.join(" | ")} |`),l&&o.push(`| ${r.map(s=>"---").join(" | ")} |`)}return o.join(`
58
58
  `)},regExp:Ga,replace:(e,o,n)=>{let r=n[0];if(!r)return;if(fg.test(r)){let a=e.getPreviousSibling();if(!a||!Xn(a))return;let p=a.getChildren(),m=p[p.length-1];if(!m||!Yn(m))return;m.getChildren().forEach(f=>{Ha(f)&&f.setHeaderStyles(No.ROW,No.ROW)}),e.remove();return}let l=za(r,t);if(l==null)return;let s=[l],i=e.getPreviousSibling(),c=l.length;for(;i&&!(!mg(i)||i.getChildrenSize()!==1);){let a=i.getFirstChild();if(!pg(a))break;let p=za(a.getTextContent(),t);if(p==null)break;c=Math.max(c,p.length),s.unshift(p);let m=i.getPreviousSibling();i.remove(),i=m}let u=sg();for(let a of s){let p=ag();u.append(p);for(let m=0;m<c;m++)p.append(m<a.length?a[m]:Wa("",t))}let d=e.getPreviousSibling();Xn(d)&&hg(d)===c?(d.append(...u.getChildren()),e.remove()):e.replace(u),u.selectEnd()}});function hg(t){let e=t.getFirstChild();return Yn(e)?e.getChildrenSize():0}var Wa=(t,e)=>{t=t.replace(/\\n/g,`
59
- `);let o=ig(No.NO_STATUS);return oo(t,e,o,!1,!0),o},za=(t,e)=>{let o=t.match(Ga);return!o||!o[1]?null:o[1].split("|").map(n=>Wa(n,e))};import{c as bg}from"react/compiler-runtime";import{jsx as j,jsxs as Ne}from"react/jsx-runtime";import{useLexicalComposerContext as Za}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as kg}from"@lexical/react/useLexicalEditable";import{$computeTableMap as _g,$deleteTableColumnAtSelection as Tg,$deleteTableRowAtSelection as Eg,$getNodeTriplet as wg,$getTableCellNodeFromLexicalNode as Ya,$getTableNodeFromLexicalNodeOrThrow as Me,$getTableRowIndexFromTableCellNode as Sg,$insertTableColumnAtSelection as Ng,$insertTableRowAtSelection as Lg,$isTableCellNode as qa,$isTableSelection as zt,$mergeCells as yg,$setTableColumnIsHeader as Rg,$setTableRowIsHeader as vg,$unmergeCell as Ig,getTableElement as Zn,getTableObserverFromTableElement as qn,TableCellHeaderStates as pt,TableCellNode as Mg}from"@lexical/table";import{mergeRegister as Ag}from"@lexical/utils";import{useScrollInfo as Dg}from"@payloadcms/ui";import{$getSelection as yo,$isElementNode as $g,$isRangeSelection as Qn,$isTextNode as Og,$setSelection as Fg,COMMAND_PRIORITY_CRITICAL as Pg,getDOMSelection as Bg,isDOMNode as jg,SELECTION_CHANGE_COMMAND as Hg}from"lexical";import*as er from"react";import{useCallback as de,useEffect as ft,useRef as Lo,useState as ht}from"react";import{createPortal as Qa}from"react-dom";import{jsx as Va}from"react/jsx-runtime";import"react";var gg={16:"M5 8a1 1 0 1 1-2 0 1 1 0 0 1 2 0m4 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0m3 1a1 1 0 1 0 0-2 1 1 0 0 0 0 2",24:"M7.5 12a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m6 0a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m4.5 1.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3"},Ka=({className:t,size:e=24})=>Va("svg",{className:t,fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:Va("path",{clipRule:"evenodd",d:gg[e],fill:"currentColor",fillRule:"evenodd"})});import{$computeTableCellRectBoundary as xg,$computeTableMap as Cg,$getNodeTriplet as Ja}from"@lexical/table";function Xa({selection:t}){let[e,,o]=Ja(t.anchor),[n]=Ja(t.focus),[r,l,s]=Cg(o,e,n),{maxColumn:i,maxRow:c,minColumn:u,minRow:d}=xg(r,l,s);return{columns:i-u+1,rows:c-d+1}}function zg(){let t=yo();if(Qn(t)&&!t.isCollapsed()||zt(t)&&!t.anchor.is(t.focus)||!Qn(t)&&!zt(t))return!1;let[e]=wg(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function Gg(t){let e=t.getLastDescendant();Og(e)?e.select():$g(e)?e.selectEnd():e!==null&&e.selectNext()}function Ug({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:n,tableCellNode:r}){let[l]=Za(),s=Lo(null),[i,c]=ht(r),[u,d]=ht({columns:1,rows:1}),[a,p]=ht(!1),[m,f]=ht(!1),{y:h}=Dg();ft(()=>l.registerMutationListener(Mg,S=>{S.get(i.getKey())==="updated"&&l.getEditorState().read(()=>{c(i.getLatest())})},{skipInitialization:!0}),[l,i]),ft(()=>{l.getEditorState().read(()=>{let S=yo();if(zt(S)){let R=Xa({selection:S});d(R);let v=S.anchor.is(S.focus);p(!v&&(R.columns>1||R.rows>1))}f(zg())})},[l]),ft(()=>{let S=e.current,R=s.current,v=l.getRootElement();if(S!=null&&R!=null&&v!=null){let D=v.getBoundingClientRect(),F=S.getBoundingClientRect();R.style.opacity="1";let M=R.getBoundingClientRect(),B=5,$=F.right+B;if($+M.width>window.innerWidth||$+M.width>D.right){let V=F.left-M.width-B;$=(V<0?B:V)+window.pageXOffset}R.style.left=`${$+window.pageXOffset}px`;let P=F.top;if(P+M.height>window.innerHeight){let V=F.bottom-M.height;P=V<0?B:V}R.style.top=`${P}px`}},[e,s,l,h]),ft(()=>{function S(R){s.current!=null&&e.current!=null&&jg(R.target)&&!s.current.contains(R.target)&&!e.current.contains(R.target)&&n(!1)}return window.addEventListener("click",S),()=>window.removeEventListener("click",S)},[n,e]);let g=de(()=>{l.update(()=>{if(i.isAttached()){let S=Me(i),R=Zn(S,l.getElementByKey(S.getKey()));if(R===null)throw new Error("Expected to find tableElement in DOM");let v=qn(R);v!==null&&v.$clearHighlight(),S.markDirty(),c(i.getLatest())}Fg(null)})},[l,i]),C=()=>{l.update(()=>{let S=yo();if(!zt(S))return;let v=S.getNodes().filter(qa),D=yg(v);D&&(Gg(D),o())})},E=()=>{l.update(()=>{Ig()}),g()},L=de(S=>{l.update(()=>{for(let R=0;R<u.rows;R++)Lg(S);o()})},[l,o,u.rows]),x=de(S=>{l.update(()=>{for(let R=0;R<u.columns;R++)Ng(S);o()})},[l,o,u.columns]),b=de(()=>{l.update(()=>{Eg(),o()})},[l,o]),k=de(()=>{l.update(()=>{Me(i).remove(),g(),o()})},[l,i,g,o]),_=de(()=>{l.update(()=>{Tg(),o()})},[l,o]),T=de(()=>{l.update(()=>{let S=Me(i),R=Sg(i),v=!i.hasHeaderState(pt.ROW);vg(S,R,v),g(),o()})},[l,i,g,o]),I=de(()=>{l.update(()=>{let S=Me(i),[,R]=_g(S,i,i),v=!i.hasHeaderState(pt.COLUMN);Rg(S,R.startColumn,v),g(),o()})},[l,i,g,o]),N=de(()=>{l.update(()=>{if(i.isAttached()){let S=Me(i);S&&S.setRowStriping(!S.getRowStriping())}g(),o()})},[l,i,g,o]),w=de(()=>{l.update(()=>{if(i.isAttached()){let S=Me(i);S&&S.setFrozenColumns(S.getFrozenColumns()===0?1:0)}g(),o()})},[l,i,g,o]),y=null;return t&&(a?y=j("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>C(),type:"button",children:j("span",{className:"text",children:"Merge cells"})}):m&&(y=j("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>E(),type:"button",children:j("span",{className:"text",children:"Unmerge cells"})}))),Qa(Ne("div",{className:"table-action-menu-dropdown",onClick:S=>{S.stopPropagation()},ref:s,children:[y?Ne(er.Fragment,{children:[y,j("hr",{})]}):null,j("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>N(),type:"button",children:j("span",{className:"text",children:"Toggle row striping"})}),j("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>w(),type:"button",children:j("span",{className:"text",children:"Toggle first column freeze"})}),j("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>L(!1),type:"button",children:Ne("span",{className:"text",children:["Insert ",u.rows===1?"row":`${u.rows} rows`," above"]})}),j("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>L(!0),type:"button",children:Ne("span",{className:"text",children:["Insert ",u.rows===1?"row":`${u.rows} rows`," below"]})}),j("hr",{}),j("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>x(!1),type:"button",children:Ne("span",{className:"text",children:["Insert ",u.columns===1?"column":`${u.columns} columns`," ","left"]})}),j("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>x(!0),type:"button",children:Ne("span",{className:"text",children:["Insert ",u.columns===1?"column":`${u.columns} columns`," ","right"]})}),j("hr",{}),j("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>_(),type:"button",children:j("span",{className:"text",children:"Delete column"})}),j("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>b(),type:"button",children:j("span",{className:"text",children:"Delete row"})}),j("button",{className:"item","data-test-id":"table-delete",onClick:()=>k(),type:"button",children:j("span",{className:"text",children:"Delete table"})}),j("hr",{}),j("button",{className:"item","data-test-id":"table-row-header",onClick:()=>T(),type:"button",children:Ne("span",{className:"text",children:[(i.__headerState&pt.ROW)===pt.ROW?"Remove":"Add"," ","row header"]})}),j("button",{className:"item","data-test-id":"table-column-header",onClick:()=>I(),type:"button",children:Ne("span",{className:"text",children:[(i.__headerState&pt.COLUMN)===pt.COLUMN?"Remove":"Add"," ","column header"]})})]}),l.getRootElement()?.closest('dialog, [role="dialog"]')??document.body)}function Wg({anchorElem:t,cellMerge:e}){let[o]=Za(),n=Lo(null),r=Lo(null),[l,s]=ht(!1),[i,c]=ht(null),u=de(()=>{let a=n.current,p=yo(),m=Bg(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 g=o.getRootElement(),C=null,E=null;if(Qn(p)&&g!==null&&m!==null&&g.contains(m.anchorNode)){let x=Ya(p.anchor.getNode());if(x==null||(E=o.getElementByKey(x.getKey()),E==null||!x.isAttached()))return h();let b=Me(x),k=Zn(b,o.getElementByKey(b.getKey()));if(k===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");C=qn(k),c(x)}else if(zt(p)){let x=Ya(p.anchor.getNode());if(!qa(x))throw new Error("TableSelection anchorNode must be a TableCellNode");let b=Me(x),k=Zn(b,o.getElementByKey(b.getKey()));if(k===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");C=qn(k),E=o.getElementByKey(x.getKey())}else if(!f)return h();if(C===null||E===null)return h();let L=!C||!C.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",L),a.classList.toggle("table-cell-action-button-container--inactive",!L),L){let x=E.getBoundingClientRect(),b=t.getBoundingClientRect(),k=x.top-b.top,_=x.right-b.left;a.style.transform=`translate(${_}px, ${k}px)`}},[o,t]);ft(()=>{let a,p=()=>{a=void 0,o.getEditorState().read(u)},m=()=>(a===void 0&&(a=setTimeout(p,0)),!1);return Ag(o.registerUpdateListener(m),o.registerCommand(Hg,m,Pg),o.registerRootListener((f,h)=>{h&&h.removeEventListener("pointerup",m),f&&(f.addEventListener("pointerup",m),m())}),()=>clearTimeout(a))});let d=Lo(i);return ft(()=>{d.current!==i&&s(!1),d.current=i},[d,i]),j("div",{className:"table-cell-action-button-container",ref:n,children:i!=null&&Ne(er.Fragment,{children:[j("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),s(!l)},ref:r,type:"button",children:j(Ka,{})}),l&&j(Ug,{cellMerge:e,contextRef:r,onClose:()=>s(!1),setIsMenuOpen:s,tableCellNode:i})]})})}var ec=t=>{let e=bg(3),{anchorElem:o}=t,n=kg(),r;return e[0]!==o||e[1]!==n?(r=Qa(n?j(Wg,{anchorElem:o??document.body,cellMerge:!0}):null,o??document.body),e[0]=o,e[1]=n,e[2]=r):r=e[2],r};import{c as Vg}from"react/compiler-runtime";import{jsx as vo,jsxs as Kg}from"react/jsx-runtime";import{useLexicalComposerContext as Jg}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Xg}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as Yg,$getTableNodeFromLexicalNodeOrThrow as tr,$getTableRowIndexFromTableCellNode as Zg,$isTableCellNode as tc,$isTableRowNode as qg,getDOMCellFromTarget as Qg,getTableElement as e2,TableNode as oc}from"@lexical/table";import{calculateZoomLevel as nc,mergeRegister as t2}from"@lexical/utils";import{$getNearestNodeFromDOMNode as or,isHTMLElement as o2,SKIP_SCROLL_INTO_VIEW_TAG as rc}from"lexical";import*as ic from"react";import{useCallback as Gt,useEffect as Io,useRef as Ro,useState as Ke}from"react";import{createPortal as n2}from"react-dom";var r2=33,lc=92;function l2({editor:t}){let e=Ro(null),o=Ro(null),n=Ro(null),[r,l]=Ke(!1),s=U(),i=Ro(null),[c,u]=Ke(null),[d,a]=Ke(null),[p,m]=Ke(!1),[f,h]=Ke(null),g=Gt(()=>{a(null),e.current=null,h(null),i.current=null,n.current=null},[]),C=w=>(w.buttons&1)===1;Io(()=>{let w=new Set;return t2(t.registerMutationListener(oc,y=>{for(let[S,R]of y)R==="destroyed"?w.delete(S):w.add(S);l(w.size>0)}),t.registerNodeTransform(oc,y=>{if(y.getColWidths())return y;let S=y.getColumnCount(),R=lc;return y.setColWidths(Array(S).fill(R)),y}))},[t]),Io(()=>{if(!r)return;let w=v=>{let D=v.target;if(o2(D)){if(f){u({x:v.clientX,y:v.clientY});return}if(m(C(v)),!(o.current&&o.current.contains(D))&&e.current!==D){e.current=D;let F=Qg(D);F&&d!==F?t.getEditorState().read(()=>{let M=or(F.elem);if(!M)throw new Error("TableCellResizer: Table cell node not found.");let B=tr(M),$=e2(B,t.getElementByKey(B.getKey()));if(!$)throw new Error("TableCellResizer: Table element not found.");e.current=D,n.current=$.getBoundingClientRect(),a(F)},{editor:t}):F==null&&g()}}},y=v=>{m(!0)},S=v=>{m(!1)},R=t.registerRootListener((v,D)=>{D?.removeEventListener("mousemove",w),D?.removeEventListener("mousedown",y),D?.removeEventListener("mouseup",S),v?.addEventListener("mousemove",w),v?.addEventListener("mousedown",y),v?.addEventListener("mouseup",S)});return()=>{R()}},[d,f,t,r,g]);let E=w=>w==="bottom",L=Gt(w=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let y=or(d.elem);if(!tc(y))throw new Error("TableCellResizer: Table cell node not found.");let S=tr(y),R=Zg(y),v=S.getChildren(),F=y.getColSpan()===S.getColumnCount()?R:R+y.getRowSpan()-1;if(F>=v.length||F<0)throw new Error("Expected table cell to be inside of table row.");let M=v[F];if(!qg(M))throw new Error("Expected table row");let B=M.getHeight();if(B===void 0){let P=M.getChildren();B=Math.min(...P.map(V=>x(V,t)??1/0))}let $=Math.max(B+w,r2);M.setHeight($)},{tag:rc})},[d,t]),x=(w,y)=>y.getElementByKey(w.getKey())?.clientHeight,b=(w,y)=>{let S;return y.forEach(R=>{R.forEach((v,D)=>{v.cell===w&&(S=D)})}),S},k=Gt(w=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let y=or(d.elem);if(!tc(y))throw new Error("TableCellResizer: Table cell node not found.");let S=tr(y),[R]=Yg(S,null,null),v=b(y,R);if(v===void 0)throw new Error("TableCellResizer: Table column not found.");let D=S.getColWidths();if(!D)return;let F=D[v];if(F===void 0)return;let M=[...D],B=Math.max(F+w,lc);M[v]=B,S.setColWidths(M)},{tag:rc})},[d,t]),_=Gt(w=>{let y=S=>{if(S.preventDefault(),S.stopPropagation(),!d)throw new Error("TableCellResizer: Expected active cell.");if(i.current){let{x:R,y:v}=i.current;if(d===null)return;let D=nc(S.target);if(E(w)){let F=(S.clientY-v)/D;L(F)}else{let F=(S.clientX-R)/D;k(F)}g(),document.removeEventListener("mouseup",y)}};return y},[d,g,k,L]),T=Gt(w=>y=>{if(y.preventDefault(),y.stopPropagation(),!d)throw new Error("TableCellResizer: Expected active cell.");i.current={x:y.clientX,y:y.clientY},u(i.current),h(w),document.addEventListener("mouseup",_(w))},[d,_]),[I,N]=Ke({bottom:null,left:null,right:null,top:null});return Io(()=>{if(d){let{height:w,left:y,top:S,width:R}=d.elem.getBoundingClientRect(),v=nc(d.elem),D=!!t.getRootElement()?.closest('dialog, [role="dialog"]'),F=D?0:window.scrollX,M=D?0:window.scrollY,B=D?"fixed":"absolute",$=10,P={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${$}px`,left:`${F+y}px`,position:B,top:`${M+S+w-$/2}px`,width:`${R}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${w}px`,left:`${F+y+R-$/2}px`,position:B,top:`${M+S}px`,width:`${$}px`}},V=n.current;f&&c&&V&&(E(f)?(P[f].left=`${F+V.left}px`,P[f].top=`${M+c.y/v}px`,P[f].height="3px",P[f].width=`${V.width}px`):(P[f].top=`${M+V.top}px`,P[f].left=`${F+c.x/v}px`,P[f].width="3px",P[f].height=`${V.height}px`),P[f].backgroundColor="#adf"),N(P)}else N({bottom:null,left:null,right:null,top:null})},[d,f,t,c]),vo("div",{ref:o,children:d!=null&&!p&&Kg(ic.Fragment,{children:[vo("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:T("right"),style:I.right||void 0}),vo("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:T("bottom"),style:I.bottom||void 0})]})})}var sc=()=>{let t=Vg(7),[e]=Jg(),o=Xg(),[n,r]=Ke(null),l,s;t[0]!==e?(l=()=>e.registerRootListener(c=>{r(c?.closest('dialog, [role="dialog"]')??document.body)}),s=[e],t[0]=e,t[1]=l,t[2]=s):(l=t[1],s=t[2]),Io(l,s);let i;return t[3]!==e||t[4]!==o||t[5]!==n?(i=o&&n?n2(vo(l2,{editor:e}),n):null,t[3]=e,t[4]=o,t[5]=n,t[6]=i):i=t[6],i};import{c as p2}from"react/compiler-runtime";import{jsx as nr,jsxs as f2,Fragment as h2}from"react/jsx-runtime";import{useLexicalComposerContext as g2}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as hc}from"@lexical/react/useLexicalEditable";import{$getTableAndElementByKey as x2,$getTableColumnIndexFromTableCellNode as C2,$getTableRowIndexFromTableCellNode as b2,$insertTableColumnAtSelection as k2,$insertTableRowAtSelection as _2,$isTableCellNode as T2,$isTableNode as uc,getTableElement as E2,TableNode as w2}from"@lexical/table";import{$findMatchingParent as S2,mergeRegister as N2}from"@lexical/utils";import{$getNearestNodeFromDOMNode as dc,isHTMLElement as L2}from"lexical";import{useEffect as mc,useMemo as y2,useRef as pc,useState as Mo}from"react";import"react";import{createPortal as R2}from"react-dom";import{c as u2}from"react/compiler-runtime";import{useEffect as d2,useRef as m2}from"react";var i2="Expected a function",s2=Math.max,a2=Math.min;function c2(t,e,o){let n,r,l=0,s,i=!1,c=!1,u,d,a,p=!0;if(typeof t!="function")throw new TypeError(i2);e=e||0,typeof o=="object"&&(i=!!o.leading,c="maxWait"in o,u=c?s2(o.maxWait||0,e):u,p="trailing"in o?!!o.trailing:p);function m(k){let _=n,T=s;return n=s=void 0,l=k,d=t.apply(T,_),d}function f(k){return l=k,a=setTimeout(C,e),i?m(k):d}function h(k){let _=k-r,T=k-l,I=e-_;return c?a2(I,u-T):I}function g(k){let _=k-r,T=k-l;return r===void 0||_>=e||_<0||c&&T>=u}function C(){let k=Date.now();if(g(k))return E(k);a=setTimeout(C,h(k))}function E(k){return a=void 0,p&&n?m(k):(n=s=void 0,d)}function L(){a!==void 0&&clearTimeout(a),l=0,n=r=s=a=void 0}function x(){return a===void 0?d:E(Date.now())}function b(){let k=Date.now(),_=g(k);if(n=arguments,s=this,r=k,_){if(a===void 0)return f(r);if(c)return clearTimeout(a),a=setTimeout(C,e),m(r)}return a===void 0&&(a=setTimeout(C,e)),d}return b.cancel=L,b.flush=x,b}var ac=c2;function cc(t,e,o){let n=u2(6),r=m2(null),l,s;n[0]!==t||n[1]!==o||n[2]!==e?(l=()=>(r.current=ac(t,e,{maxWait:o}),()=>{r.current?.cancel()}),s=[t,e,o],n[0]=t,n[1]=o,n[2]=e,n[3]=l,n[4]=s):(l=n[3],s=n[4]),d2(l,s);let i;return n[5]===Symbol.for("react.memo_cache_sentinel")?(i=(...u)=>{let d=u;r.current&&r.current(...d)},n[5]=i):i=n[5],i}var fc=16;function v2({anchorElem:t}){let[e]=g2(),o=hc(),n=U(),[r,l]=Mo(!1),[s,i]=Mo(!1),[c,u]=Mo(!1),[d,a]=Mo({}),p=pc(new Set),m=pc(null),f=cc(C=>{let{isOutside:E,tableDOMNode:L}=I2(C,n.editorConfig?.lexical);if(E){l(!1),i(!1);return}if(!L)return;m.current=L;let x=null,b=null,k=null;if(e.getEditorState().read(()=>{let F=dc(L);if(T2(F)){let M=S2(F,B=>uc(B));if(!uc(M))return;if(k=E2(M,e.getElementByKey(M.getKey())),k){let B=M.getChildrenSize(),$=M.getChildAtIndex(0)?.getChildrenSize(),P=b2(F),V=C2(F);P===B-1?x=F:V===$-1&&(b=F)}}},{editor:e}),!k)return;let _=k.parentElement;if(!_)return;let{bottom:T,height:I,left:N,right:w,width:y,y:S}=k.getBoundingClientRect(),R=!1;_&&_.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(R=_.scrollWidth>_.clientWidth);let{left:v,y:D}=t.getBoundingClientRect();x?(i(!1),l(!0),a({height:fc,left:R&&_?_.offsetLeft:N-v,top:T-D+5,width:R&&_?_.offsetWidth:y})):b&&(i(!0),l(!1),a({height:I,left:w-v+5,top:S-D,width:fc}))},50,250),h=y2(()=>new ResizeObserver(()=>{l(!1),i(!1)}),[]);mc(()=>{if(c)return document.addEventListener("mousemove",f),()=>{l(!1),i(!1),document.removeEventListener("mousemove",f)}},[c,f]),mc(()=>N2(e.registerMutationListener(w2,C=>{e.getEditorState().read(()=>{let E=!1;for(let[L,x]of C)switch(x){case"created":{p.current.add(L),E=!0;break}case"destroyed":{p.current.delete(L),E=!0;break}default:break}if(E){h.disconnect();for(let L of p.current){let{tableElement:x}=x2(L);h.observe(x)}u(p.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,h]);let g=C=>{e.update(()=>{m.current&&(dc(m.current)?.selectEnd(),C?(_2(),l(!1)):(k2(),i(!1)))})};return o?f2(h2,{children:[r&&nr("button",{"aria-label":"Add Row",className:n.editorConfig.lexical.theme.tableAddRows,onClick:()=>g(!0),style:{...d},type:"button"}),s&&nr("button",{"aria-label":"Add Column",className:n.editorConfig.lexical.theme.tableAddColumns,onClick:()=>g(!1),style:{...d},type:"button"})]}):null}function I2(t,e){let o=t.target;if(L2(o)){let n=o.closest(`td.${e.theme.tableCell}, th.${e.theme.tableCell}`);return{isOutside:!(n||o.closest(`button.${e.theme.tableAddRows}`)||o.closest(`button.${e.theme.tableAddColumns}`)||o.closest(`div.${e.theme.tableCellResizer}`)),tableDOMNode:n}}else return{isOutside:!0,tableDOMNode:null}}function gc(t){let e=p2(2),{anchorElem:o}=t,n=o===void 0?document.body:o;if(!hc())return null;let l;return e[0]!==n?(l=R2(nr(v2,{anchorElem:n}),n),e[0]=n,e[1]=l):l=e[1],l}import{jsx as ir,jsxs as $2}from"react/jsx-runtime";import{useLexicalComposerContext as O2}from"@lexical/react/LexicalComposerContext";import{TablePlugin as F2}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as P2,TableCellNode as B2,TableNode as j2,TableRowNode as H2}from"@lexical/table";import{mergeRegister as z2}from"@lexical/utils";import{$getSelection as G2,$isRangeSelection as U2,$setSelection as W2,COMMAND_PRIORITY_EDITOR as V2,createCommand as K2}from"lexical";import{createContext as J2,use as X2,useCallback as Tc,useEffect as Ec,useMemo as Y2,useRef as Z2,useState as Ao}from"react";import*as wc from"react";import{jsx as te,jsxs as Le}from"react/jsx-runtime";import{useCallback as rr,useEffect as xc,useRef as lr,useState as Ut}from"react";import*as kc from"react";import{createPortal as M2}from"react-dom";var Cc=10,bc=7;function A2(){return Le("svg",{fill:"none",height:"12",viewBox:"0 0 12 12",width:"12",xmlns:"http://www.w3.org/2000/svg",children:[te("rect",{height:"9",rx:"1",stroke:"currentColor",width:"3",x:"1.5",y:"1.5"}),te("rect",{height:"9",rx:"1",stroke:"currentColor",width:"3",x:"7.5",y:"1.5"})]})}function D2(){return Le("svg",{fill:"none",height:"12",viewBox:"0 0 12 12",width:"12",xmlns:"http://www.w3.org/2000/svg",children:[te("rect",{height:"3",rx:"1",stroke:"currentColor",width:"9",x:"1.5",y:"1.5"}),te("rect",{height:"3",rx:"1",stroke:"currentColor",width:"9",x:"1.5",y:"7.5"})]})}function _c({anchorElem:t,editor:e,isOpen:o,onClose:n,onInsert:r,position:l}){let[s,i]=Ut(0),[c,u]=Ut(0),[d,a]=Ut(""),[p,m]=Ut(""),[f,h]=Ut(null),g=lr(null),C=lr(null),E=lr(null),L=s>0?s:d?parseInt(d,10)||0:5,x=c>0?c:p?parseInt(p,10)||0:5;xc(()=>{o||(i(0),u(0),a(""),m(""),h(null))},[o]),xc(()=>{if(!o)return;let N=w=>{if(w.key==="Escape"&&(w.preventDefault(),w.stopPropagation(),n()),w.key==="Enter"&&f){w.preventDefault();let y=parseInt(d,10),S=parseInt(p,10);y>0&&S>0&&r(y,S)}};return document.addEventListener("keydown",N,!0),()=>document.removeEventListener("keydown",N,!0)},[o,n,r,f,d,p]);let b=rr((N,w)=>{N>0&&w>0&&r(N,w)},[r]),k=rr((N,w)=>{i(N),u(w)},[]),_=rr(()=>{i(0),u(0)},[]);if(!o||!l||!t)return null;let T=[];for(let N=1;N<=bc;N++)for(let w=1;w<=Cc;w++){let y=w<=L&&N<=x,S=w<=s&&N<=c,R="table-grid-popup__cell";y&&S?R+=" table-grid-popup__cell--hover":y&&(R+=" table-grid-popup__cell--selected"),T.push(te("div",{"aria-label":`${w} columns, ${N} rows`,className:R,onClick:()=>b(w,N),onKeyDown:v=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),b(w,N))},onMouseEnter:()=>k(w,N),role:"button",tabIndex:-1},`${N}-${w}`))}let I=s>0&&c>0;return M2(Le(kc.Fragment,{children:[te("div",{className:"table-grid-popup__backdrop",onClick:n}),te("div",{className:"table-grid-popup",ref:g,style:{transform:`translate(${l.left}px, ${l.top}px)`},children:Le("div",{className:"table-grid-popup__content",children:[Le("div",{className:"table-grid-popup__header",children:[Le("div",{className:`table-grid-popup__input-group${f==="cols"?" table-grid-popup__input-group--focused":""}`,children:[te("div",{className:"table-grid-popup__input-icon",children:te(A2,{})}),te("input",{"aria-label":"Columns",className:"table-grid-popup__input",min:1,onBlur:()=>h(null),onChange:N=>a(N.target.value),onFocus:()=>h("cols"),placeholder:s>0?String(s):"5",ref:C,type:"number",value:d})]}),te("span",{className:"table-grid-popup__separator",children:"\xD7"}),Le("div",{className:`table-grid-popup__input-group${f==="rows"?" table-grid-popup__input-group--focused":""}`,children:[te("div",{className:"table-grid-popup__input-icon",children:te(D2,{})}),te("input",{"aria-label":"Rows",className:"table-grid-popup__input",min:1,onBlur:()=>h(null),onChange:N=>m(N.target.value),onFocus:()=>h("rows"),placeholder:c>0?String(c):"5",ref:E,type:"number",value:p})]})]}),Le("div",{className:"table-grid-popup__grid",onMouseLeave:_,children:[T,I&&Le("div",{className:"table-grid-popup__tooltip",style:{left:`calc(${(s-.5)/Cc*100}%)`,top:`calc(${(c-1)/bc*100}%)`},children:[L," \xD7 ",x]})]})]})})]}),t)}var Do=K2("OPEN_EMBED_DRAWER_COMMAND"),Sc=J2({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function Nc({children:t}){let[e,o]=Ao({cellEditorConfig:null,cellEditorPlugins:null});return ir(Sc,{value:Y2(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(n,r)=>{o({cellEditorConfig:n,cellEditorPlugins:r})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var Lc=()=>{let[t]=O2(),e=X2(Sc),[o,n]=Ao(!1),[r,l]=Ao(null),s=Z2(null),[i,c]=Ao(null);Ec(()=>{let a=t.getRootElement();if(a){let p=a.closest(".editor")??null;c(p??a.parentElement)}},[t]),Ec(()=>{if(!t.hasNodes([j2,H2,B2]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return z2(t.registerCommand(Do,()=>{let a=i;if(!a)return!0;let p=a.getBoundingClientRect(),m=null;t.getEditorState().read(()=>{let h=G2();if(U2(h)){s.current=h.clone();let g=h.anchor.getNode(),C=t.getElementByKey(g.getKey());if(C){let E=C.getBoundingClientRect();E.height>0&&(m={left:E.left-p.left,top:E.bottom-p.top+8})}}});let f=window.getSelection();if(f&&f.rangeCount>0){let g=f.getRangeAt(0).getBoundingClientRect();g.height>0&&(m={left:g.left-p.left,top:g.bottom-p.top+8})}return m||(m={left:0,top:40}),l(m),n(!0),!0},V2))},[e,t,i]);let u=Tc(()=>{n(!1)},[]),d=Tc((a,p)=>{n(!1),t.focus(),t.update(()=>{s.current&&W2(s.current.clone())},{discrete:!0,skipTransforms:!0}),setTimeout(()=>{t.dispatchCommand(P2,{columns:String(a),rows:String(p)})},1)},[t]);return $2(wc.Fragment,{children:[ir(_c,{anchorElem:i,editor:t,isOpen:o,onClose:u,onInsert:d,position:r}),ir(F2,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]})};var tx=A({markdownTransformers:[Ua],nodes:[Q2,q2,ex],plugins:[{Component:Lc,position:"normal"},{Component:sc,position:"normal"},{Component:ec,position:"floatingAnchorElem"},{Component:gc,position:"floatingAnchorElem"}],providers:[Nc],slashMenu:{groups:[q([{Icon:Jn,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Do,{})}}])]},toolbarFixed:{groups:[be([{ChildComponent:Jn,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Do,{})}}])]}});import{$isNodeSelection as vx}from"lexical";import{jsx as yc}from"react/jsx-runtime";import"react";var ox="M16.2041 6.01074C17.2128 6.113 18 6.96435 18 8V16L17.9893 16.2041C17.8938 17.1457 17.1457 17.8938 16.2041 17.9893L16 18H8C6.96435 18 6.113 17.2128 6.01074 16.2041L6 16V8C6 6.89543 6.89543 6 8 6H16L16.2041 6.01074ZM8 7C7.44772 7 7 7.44772 7 8V16C7 16.5523 7.44772 17 8 17H16C16.5523 17 17 16.5523 17 16V8C17 7.44772 16.5523 7 16 7H8ZM9.72461 11.582C9.91869 11.4539 10.1827 11.4756 10.3535 11.6465L13.8535 15.1465C14.0488 15.3417 14.0488 15.6583 13.8535 15.8535C13.6583 16.0488 13.3417 16.0488 13.1465 15.8535L10 12.707L8.85352 13.8535C8.65825 14.0488 8.34175 14.0488 8.14648 13.8535C7.95122 13.6583 7.95122 13.3417 8.14648 13.1465L9.64648 11.6465L9.72461 11.582ZM14 8C15.1046 8 16 8.89543 16 10C16 11.1046 15.1046 12 14 12C12.8954 12 12 11.1046 12 10C12 8.89543 12.8954 8 14 8ZM14 9C13.4477 9 13 9.44772 13 10C13 10.5523 13.4477 11 14 11C14.5523 11 15 10.5523 15 10C15 9.44772 14.5523 9 14 9Z",sr=({className:t})=>yc("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:yc("path",{clipRule:"evenodd",d:ox,fill:"currentColor",fillRule:"evenodd"})});import{c as ux}from"react/compiler-runtime";import{jsx as dx}from"react/jsx-runtime";import{useLexicalComposerContext as mx}from"@lexical/react/LexicalComposerContext.js";import{$dfsIterator as Bc,$insertNodeToNearestRoot as ur,mergeRegister as px}from"@lexical/utils";import{useBulkUpload as fx,useEffectEvent as hx,useModal as gx}from"@payloadcms/ui";import dr from"bson-objectid";import{$createRangeSelection as xx,$getPreviousSelection as Dc,$getSelection as $c,$isParagraphNode as mr,$isRangeSelection as Oc,$setSelection as Cx,COMMAND_PRIORITY_EDITOR as bx,COMMAND_PRIORITY_LOW as Fc,createCommand as kx,DROP_COMMAND as _x,getDOMSelectionFromTarget as Tx,isHTMLElement as Pc,PASTE_COMMAND as Ex}from"lexical";import{useEffect as wx}from"react";import{c as Rc}from"react/compiler-runtime";import{jsx as ar}from"react/jsx-runtime";import{useLexicalComposerContext as vc}from"@lexical/react/LexicalComposerContext.js";import{toast as nx}from"@payloadcms/ui";import{$getNodeByKey as rx,COMMAND_PRIORITY_EDITOR as Ic}from"lexical";import{useEffect as Mc,useState as lx}from"react";var ix=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=rx(o);r&&r.replace(ye({data:{fields:null,relationTo:e,value:n}}))}):t.dispatchCommand(cr,{fields:null,relationTo:e,value:n})},sx=t=>{let e=Rc(13),{enabledCollectionSlugs:o}=t,[n]=vc(),[r,l]=lx(null),s;e[0]!==o?(s={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=s):s=e[1];let{closeListDrawer:i,ListDrawer:c,openListDrawer:u}=Pt(s),d,a;e[2]!==n||e[3]!==u?(d=()=>n.registerCommand(tt,h=>(l(h?.replace?h?.replace.nodeKey:null),u(),!0),Ic),a=[n,u],e[2]=n,e[3]=u,e[4]=d,e[5]=a):(d=e[4],a=e[5]),Mc(d,a);let p;e[6]!==i||e[7]!==n||e[8]!==r?(p=h=>{let{collectionSlug:g,doc:C}=h;i(),ix({editor:n,relationTo:g,replaceNodeKey:r,value:C.id})},e[6]=i,e[7]=n,e[8]=r,e[9]=p):p=e[9];let m=p,f;return e[10]!==c||e[11]!==m?(f=ar(c,{onSelect:m}),e[10]=c,e[11]=m,e[12]=f):f=e[12],f},ax=()=>{let t=Rc(3),[e]=vc(),o,n;return t[0]!==e?(o=()=>e.registerCommand(tt,cx,Ic),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),Mc(o,n),null},Ac=({enabledCollectionSlugs:t})=>t?.length?ar(sx,{enabledCollectionSlugs:t}):ar(ax,{});function cx(){return nx.error("No upload collections enabled"),!0}function Sx(t){let e=t.target;return!!(Pc(e)&&!e.closest("code, span.editor-image")&&Pc(e.parentElement)&&e.parentElement.closest("div.ContentEditable__root"))}function Nx(t){let e,o=Tx(t.target);if(document.caretRangeFromPoint)e=document.caretRangeFromPoint(t.clientX,t.clientY);else if(t.rangeParent&&o!==null)o.collapse(t.rangeParent,t.rangeOffset||0),e=o.getRangeAt(0);else throw Error("Cannot get the selection when dragging");return e}var cr=kx("INSERT_UPLOAD_COMMAND"),jc=t=>{let e=ux(20),{clientProps:o}=t,[n]=mx(),r;e[0]!==o.enabledCollectionSlugs?(r={enabledCollectionSlugs:o.enabledCollectionSlugs},e[0]=o.enabledCollectionSlugs,e[1]=r):r=e[1];let{enabledCollectionSlugs:l}=Co(r),{modalSlug:s,setCollectionSlug:i,setInitialForms:c,setOnCancel:u,setOnSuccess:d,setSelectableCollections:a}=fx(),{isModalOpen:p,openModal:m}=gx(),f;e[2]!==s||e[3]!==n||e[4]!==l||e[5]!==p||e[6]!==m||e[7]!==i||e[8]!==c||e[9]!==u||e[10]!==d||e[11]!==a?(f=L=>{let{files:x}=L;if(x?.length!==0&&(c(b=>[...b??[],...x.map(Lx)]),!p(s))){if(!l.length||!l[0])return;i(l[0]),a(l),u(()=>{n.update(yx)}),d(b=>{let k=new Map(b.map(Rx));n.update(()=>{for(let _ of Bc()){let T=_.node;if(nt(T)){let I=T.getData();if(I?.pending){let N=k.get(I.pending?.formID);N&&T.replace(ye({data:{id:new dr.default().toHexString(),fields:{},relationTo:N.collectionSlug,value:N.doc.id}}))}}}})}),m(s)}},e[2]=s,e[3]=n,e[4]=l,e[5]=p,e[6]=m,e[7]=i,e[8]=c,e[9]=u,e[10]=d,e[11]=a,e[12]=f):f=e[12];let h=hx(f),g;e[13]!==n||e[14]!==h?(g=()=>{if(!n.hasNodes([ot]))throw new Error("UploadPlugin: UploadNode not registered on editor");let L=new WeakSet;return px(n.registerNodeTransform(ot,x=>{let b=x.getData();if(!b?.pending||L.has(b.pending))return;L.add(b.pending),async function(){let T=null,I=b?.pending?.src,N=b?.pending?.formID;if(I?.startsWith("data:")){let w=I.match(/data:(image\/[a-zA-Z]+);base64,/),y=w?w[1]:"image/png",S=I.replace(/^data:image\/[a-zA-Z]+;base64,/,""),R=atob(S),v=new Array(R.length);for(let M=0;M<R.length;M++)v[M]=R.charCodeAt(M);let D=new Uint8Array(v);T={alt:void 0,file:new File([D],"pasted-image."+y?.split("/",2)[1],{type:y}),formID:N}}else if(I?.startsWith("http")||I?.startsWith("https")){let y=await(await fetch(I)).blob(),S=I.split("/").pop()||"pasted-image"+y.type.split("/",2)[1];T={alt:void 0,file:new File([y],S,{type:y.type}),formID:N}}T&&h({files:[T]})}()}),n.registerCommand(cr,x=>(n.update(()=>{let b=$c()||Dc();if(Oc(b)){let k=ye({data:{id:x.id,fields:x.fields,relationTo:x.relationTo,value:x.value}}),{focus:_}=b,T=_.getNode();ur(k),mr(T)&&!T.__first&&T.remove()}}),!0),bx),n.registerCommand(Ex,x=>{if(!(x instanceof ClipboardEvent))return!1;let b=x.clipboardData;if(!b?.types?.length||b?.types?.includes("text/html"))return!1;let k=[];return b?.files?.length&&Array.from(b.files).forEach(_=>{k.push({alt:"",file:_,formID:new dr.default().toHexString()})}),k.length?(n.update(()=>{let _=$c()||Dc();if(Oc(_))for(let T of k){let I=ye({data:{pending:{formID:T.formID,src:URL.createObjectURL(T.file)}}}),{focus:N}=_,w=N.getNode();ur(I),mr(w)&&!w.__first&&w.remove()}}),h({files:k}),!0):!1},Fc),n.registerCommand(_x,x=>{if(!(x instanceof DragEvent))return!1;let b=x.dataTransfer;if(!b?.types?.length)return!1;let k=[];return b?.files?.length&&Array.from(b.files).forEach(_=>{k.push({alt:"",file:_,formID:new dr.default().toHexString()})}),k.length?(x.preventDefault(),x.stopPropagation(),n.update(()=>{if(Sx(x)){let _=Nx(x),T=xx();_!=null&&T.applyDOMRange(_),Cx(T);for(let I of k){let N=ye({data:{pending:{formID:I.formID,src:URL.createObjectURL(I.file)}}}),{focus:w}=T,y=w.getNode();ur(N),mr(y)&&!y.__first&&y.remove()}}}),h({files:k}),!0):!1},Fc))},e[13]=n,e[14]=h,e[15]=g):g=e[15];let C;e[16]!==n?(C=[n],e[16]=n,e[17]=C):C=e[17],wx(g,C);let E;return e[18]!==l?(E=dx(Ac,{enabledCollectionSlugs:l}),e[18]=l,e[19]=E):E=e[19],E};function Lx(t){return{file:t.file,formID:t.formID}}function yx(){for(let t of Bc()){let e=t.node;nt(e)&&e.getData()?.pending&&e.remove()}}function Rx(t){return[t.formID,t]}var Ix=A({nodes:[ot],plugins:[{Component:jc,position:"normal"}],slashMenu:{groups:[q([{Icon:sr,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(tt,{replace:!1})}}])]},toolbarFixed:{groups:[be([{ChildComponent:sr,isActive:({selection:t})=>{if(!vx(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return nt(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(tt,{replace:!1})}}])]}});import{c as Ax}from"react/compiler-runtime";import{jsx as $o}from"react/jsx-runtime";import{createElement as Dx}from"react";import{ShimmerEffect as $x,useConfig as Ox}from"@payloadcms/ui";import{lazy as Fx,Suspense as Px,useEffect as Bx,useState as jx}from"react";var Hc={block:"LexicalEditorTheme__block",blockCursor:"LexicalEditorTheme__blockCursor",characterLimit:"LexicalEditorTheme__characterLimit",code:"LexicalEditorTheme__code",inlineBlock:"LexicalEditorTheme__inlineBlock",heading:{h1:"LexicalEditorTheme__h1",h2:"LexicalEditorTheme__h2",h3:"LexicalEditorTheme__h3",h4:"LexicalEditorTheme__h4",h5:"LexicalEditorTheme__h5",h6:"LexicalEditorTheme__h6"},hr:"LexicalEditorTheme__hr",hrSelected:"LexicalEditorTheme__hrSelected",indent:"LexicalEditorTheme__indent",link:"LexicalEditorTheme__link",list:{checklist:"LexicalEditorTheme__checklist",listitem:"LexicalEditorTheme__listItem",listitemChecked:"LexicalEditorTheme__listItemChecked",listitemUnchecked:"LexicalEditorTheme__listItemUnchecked",nested:{listitem:"LexicalEditorTheme__nestedListItem"},olDepth:["LexicalEditorTheme__ol1","LexicalEditorTheme__ol2","LexicalEditorTheme__ol3","LexicalEditorTheme__ol4","LexicalEditorTheme__ol5"],ul:"LexicalEditorTheme__ul"},ltr:"LexicalEditorTheme__ltr",mark:"LexicalEditorTheme__mark",markOverlap:"LexicalEditorTheme__markOverlap",paragraph:"LexicalEditorTheme__paragraph",placeholder:"LexicalEditorTheme__placeholder",quote:"LexicalEditorTheme__quote",relationship:"LexicalEditorTheme__relationship",root:"LexicalEditorTheme",rtl:"LexicalEditorTheme__rtl",tab:"LexicalEditorTheme__tabNode",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableAlignment:{center:"LexicalEditorTheme__tableAlignmentCenter",right:"LexicalEditorTheme__tableAlignmentRight"},tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableFrozenColumn:"LexicalEditorTheme__tableFrozenColumn",tableRowStriping:"LexicalEditorTheme__tableRowStriping",tableScrollableWrapper:"LexicalEditorTheme__tableScrollableWrapper",tableSelected:"LexicalEditorTheme__tableSelected",tableSelection:"LexicalEditorTheme__tableSelection",text:{bold:"LexicalEditorTheme__textBold",code:"LexicalEditorTheme__textCode",italic:"LexicalEditorTheme__textItalic",strikethrough:"LexicalEditorTheme__textStrikethrough",subscript:"LexicalEditorTheme__textSubscript",superscript:"LexicalEditorTheme__textSuperscript",underline:"LexicalEditorTheme__textUnderline",underlineStrikethrough:"LexicalEditorTheme__textUnderlineStrikethrough"},upload:"LexicalEditorTheme__upload"};var pr={namespace:"lexical",theme:Hc};function zc({config:t,featureClientImportMap:e,featureClientSchemaMap:o,field:n,schemaPath:r,unSanitizedEditorConfig:l}){let s=new Map,i=[];for(let d of l.features){if(!d?.clientFeatureProps?.featureKey||d?.clientFeatureProps?.order===void 0||d?.clientFeatureProps?.order===null){console.warn("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. Skipping feature.");continue}s.set(d.clientFeatureProps.featureKey,d),i.push(d)}l.features=i,l.features=l.features.sort((d,a)=>d.clientFeatureProps.order-a.clientFeatureProps.order);let c=new Map,u=0;for(let d of l.features){let a=typeof d.feature=="function"?d.feature({config:t,featureClientImportMap:e,featureClientSchemaMap:o,featureProviderMap:s,field:n,resolvedFeatures:c,schemaPath:r,unSanitizedEditorConfig:l}):d.feature;a.key=d.clientFeatureProps.featureKey,a.order=u,c.set(d.clientFeatureProps.featureKey,a),u++}return c}import{deepMerge as Mx}from"payload/shared";var Gc=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}},o={};if(t.forEach(n=>{n.key==="toolbarFixed"&&n.sanitizedClientFeatureProps?.customGroups&&(o={...o,...n.sanitizedClientFeatureProps.customGroups})}),!t?.size)return e;t.forEach(n=>{if(n.providers?.length&&(e.providers=e.providers.concat(n.providers)),n.enableFormats?.length&&e.enabledFormats.push(...n.enableFormats),n.nodes?.length)for(let r of n.nodes)e.nodes.push(r);if(n.plugins?.length&&n.plugins.forEach((r,l)=>{e.plugins?.push({clientProps:n.sanitizedClientFeatureProps,Component:r.Component,key:n.key+l,position:r.position})}),n.toolbarInline?.groups?.length)for(let r of n.toolbarInline.groups){let l=e.toolbarInline.groups.find(s=>s.key===r.key);l?e.toolbarInline.groups=e.toolbarInline.groups.filter(s=>s.key!==r.key):l={...r,items:[]},r?.items?.length&&(l.items=l.items.concat(r.items)),e.toolbarInline?.groups.push(l)}if(n.toolbarFixed?.groups?.length)for(let r of n.toolbarFixed.groups){let l=e.toolbarFixed.groups.find(s=>s.key===r.key);l?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(s=>s.key!==r.key):l={...r,items:[]},r?.items?.length&&(l.items=l.items.concat(r.items)),e.toolbarFixed?.groups.push(l)}if(n.slashMenu?.groups){n.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(n.slashMenu.dynamicGroups));for(let r of n.slashMenu.groups){let l=e.slashMenu.groups.find(s=>s.key===r.key);l?e.slashMenu.groups=e.slashMenu.groups.filter(s=>s.key!==r.key):l={...r,items:[]},r?.items?.length&&(l.items=l.items.concat(r.items)),e.slashMenu.groups.push(l)}}if(n.markdownTransformers?.length)for(let r of n.markdownTransformers)typeof r=="function"?e.markdownTransformers.push(r({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(r);e.enabledFeatures.push(n.key)}),Object.keys(o).length>0&&(e.toolbarFixed.groups=e.toolbarFixed.groups.map(n=>{let r=o[n.key];return r?Mx(n,r):n})),e.toolbarInline.groups.sort((n,r)=>n.order&&r.order?n.order-r.order:n.order?-1:r.order?1:0),e.toolbarFixed.groups.sort((n,r)=>n.order&&r.order?n.order-r.order:n.order?-1:r.order?1:0);for(let n of e.toolbarInline.groups)n.items.sort((r,l)=>r.order&&l.order?r.order-l.order:r.order?-1:l.order?1:0);for(let n of e.toolbarFixed.groups)n.items.sort((r,l)=>r.order&&l.order?r.order-l.order:r.order?-1:l.order?1:0);return e};function fr(t,e,o,n){return{admin:o,features:Gc(t),lexical:e,resolvedFeatureMap:t,view:n}}var Hx=Fx(()=>import("./Field-MT4FK3IP.js").then(t=>({default:t.RichText}))),zx=t=>$o(Jo,{inheritable:!0,views:t.views,children:$o(Gx,{...t})}),Gx=t=>{let e=Ax(23),{admin:o,clientFeatures:n,featureClientImportMap:r,featureClientSchemaMap:l,field:s,lexicalEditorConfig:i,schemaPath:c,views:u}=t,d;e[0]!==o?(d=o===void 0?{}:o,e[0]=o,e[1]=d):d=e[1];let a=d,p;e[2]!==r?(p=r===void 0?{}:r,e[2]=r,e[3]=p):p=e[3];let m=p,f=i===void 0?pr:i,{currentView:h}=Xo(),g=u?.[h]?.admin??a,C=u?.[h]?.lexical,E;e[4]!==f||e[5]!==C?(E=typeof C=="function"?C(f):C??f,e[4]=f,e[5]=C,e[6]=E):E=e[6];let L=E,{config:x}=Ox(),[b,k]=jx(null),_,T;e[7]!==n||e[8]!==x||e[9]!==h||e[10]!==g||e[11]!==L||e[12]!==m||e[13]!==l||e[14]!==s||e[15]!==b||e[16]!==c||e[17]!==u?(_=()=>{if(b&&b.view===h)return;let N=u?.[h],w=N?.filterFeatures?N.filterFeatures(n):n,y=[];for(let R of Object.values(w))!R.clientFeatureProvider||!R.clientFeatureProps||y.push(R.clientFeatureProvider(R.clientFeatureProps));let S=zc({config:x,featureClientImportMap:m,featureClientSchemaMap:l,field:s,schemaPath:c??s.name,unSanitizedEditorConfig:{features:y,lexical:L}});k(fr(S,L,g,h))},T=[g,n,x,m,l,s,b,L,c,h,u],e[7]=n,e[8]=x,e[9]=h,e[10]=g,e[11]=L,e[12]=m,e[13]=l,e[14]=s,e[15]=b,e[16]=c,e[17]=u,e[18]=_,e[19]=T):(_=e[18],T=e[19]),Bx(_,T);let I;return e[20]!==b||e[21]!==t?(I=$o(Px,{fallback:$o($x,{height:"35vh"}),children:b&&Dx(Hx,{...t,editorConfig:b,key:b.view})}),e[20]=b,e[21]=t,e[22]=I):I=e[22],I};function Ux(...t){return t.filter(Boolean).join(" ")}var Wx=t=>(e,o,n)=>{let r=t(n);r&&(r.append(...o),e.replace(r),r.select(0,0))};var Oo=new WeakMap;function Uc(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function Fo(t,e){let o=Oo.get(t);if(o===void 0){let n=new Set,r=s=>{o!==void 0&&(o.start=Uc(s))},l=s=>{if(o===void 0)return;let{start:i}=o;if(i===null)return;let c=Uc(s);for(let u of n)c!==null&&u([c[0]-i[0],c[1]-i[1]],s)};t.addEventListener("touchstart",r),t.addEventListener("touchend",l),o={handleTouchend:l,handleTouchstart:r,listeners:n,start:null},Oo.set(t,o)}return o.listeners.add(e),()=>{Vx(t,e)}}function Vx(t,e){let o=Oo.get(t);if(o===void 0)return;let{listeners:n}=o;n.delete(e),n.size===0&&(Oo.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function Kx(t,e){return Fo(t,(o,n)=>{let[r,l]=o;r<0&&-r>Math.abs(l)&&e(r,n)})}function Jx(t,e){return Fo(t,(o,n)=>{let[r,l]=o;r>0&&r>Math.abs(l)&&e(r,n)})}function Xx(t,e){return Fo(t,(o,n)=>{let[r,l]=o;l<0&&-l>Math.abs(r)&&e(r,n)})}function Yx(t,e){return Fo(t,(o,n)=>{let[r,l]=o;l>0&&l>Math.abs(r)&&e(r,n)})}import{c as Zx}from"react/compiler-runtime";import{jsx as qx}from"react/jsx-runtime";import"react";var Qx=()=>{let t=Zx(2),{EditButton:e}=xe(),o;return t[0]!==e?(o=e?qx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as eC}from"react/compiler-runtime";import{jsx as tC}from"react/jsx-runtime";import"react";var oC=()=>{let t=eC(2),{RemoveButton:e}=xe(),o;return t[0]!==e?(o=e?tC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as nC}from"react/compiler-runtime";import{jsx as rC}from"react/jsx-runtime";import"react";var lC=()=>{let t=nC(2),{Label:e}=xe(),o;return t[0]!==e?(o=e?rC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as iC}from"react/compiler-runtime";import{jsx as sC}from"react/jsx-runtime";import"react";var aC=t=>{let e=iC(3),{children:o}=t,{InlineBlockContainer:n}=xe(),r;return e[0]!==n||e[1]!==o?(r=n?sC(n,{children:o}):null,e[0]=n,e[1]=o,e[2]=r):r=e[2],r};import{jsx as cC}from"react/jsx-runtime";import"react";var uC=t=>{let{children:e,...o}=t,{BlockCollapsible:n}=ae();return n?cC(n,{...o,children:e}):null};import{c as dC}from"react/compiler-runtime";import{jsx as mC}from"react/jsx-runtime";import"react";var pC=()=>{let t=dC(2),{EditButton:e}=ae(),o;return t[0]!==e?(o=e?mC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as fC}from"react/compiler-runtime";import{jsx as hC}from"react/jsx-runtime";import"react";var gC=()=>{let t=fC(2),{RemoveButton:e}=ae(),o;return t[0]!==e?(o=e?hC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as xC}from"qs-esm";var CC=({apiURL:t,depth:e,draft:o,locale:n})=>async({id:l,collectionSlug:s,select:i})=>{let c=xC({depth:e??0,draft:o??!1,locale:n,select:i},{addQueryPrefix:!0});return await fetch(`${t}/${s}/${l}${c}`,{credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json"},method:"GET"}).then(d=>d.json())};var Wc={customEndRegex:{optional:!0,regExp:/[ \t]*```$/},customStartRegex:/^[ \t]*```(\w+)?/,doNotTrimChildren:!0,export:({fields:t})=>!t.code.includes(`
59
+ `);let o=ig(No.NO_STATUS);return oo(t,e,o,!1,!0),o},za=(t,e)=>{let o=t.match(Ga);return!o||!o[1]?null:o[1].split("|").map(n=>Wa(n,e))};import{c as bg}from"react/compiler-runtime";import{jsx as j,jsxs as Ne}from"react/jsx-runtime";import{useLexicalComposerContext as Za}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as kg}from"@lexical/react/useLexicalEditable";import{$computeTableMap as _g,$deleteTableColumnAtSelection as Tg,$deleteTableRowAtSelection as Eg,$getNodeTriplet as wg,$getTableCellNodeFromLexicalNode as Ya,$getTableNodeFromLexicalNodeOrThrow as Me,$getTableRowIndexFromTableCellNode as Sg,$insertTableColumnAtSelection as Ng,$insertTableRowAtSelection as Lg,$isTableCellNode as qa,$isTableSelection as zt,$mergeCells as yg,$setTableColumnIsHeader as Rg,$setTableRowIsHeader as vg,$unmergeCell as Ig,getTableElement as Zn,getTableObserverFromTableElement as qn,TableCellHeaderStates as pt,TableCellNode as Mg}from"@lexical/table";import{mergeRegister as Ag}from"@lexical/utils";import{useScrollInfo as Dg}from"@payloadcms/ui";import{$getSelection as yo,$isElementNode as $g,$isRangeSelection as Qn,$isTextNode as Og,$setSelection as Fg,COMMAND_PRIORITY_CRITICAL as Pg,getDOMSelection as Bg,isDOMNode as jg,SELECTION_CHANGE_COMMAND as Hg}from"lexical";import*as er from"react";import{useCallback as de,useEffect as ft,useRef as Lo,useState as ht}from"react";import{createPortal as Qa}from"react-dom";import{jsx as Va}from"react/jsx-runtime";import"react";var gg={16:"M5 8a1 1 0 1 1-2 0 1 1 0 0 1 2 0m4 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0m3 1a1 1 0 1 0 0-2 1 1 0 0 0 0 2",24:"M7.5 12a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m6 0a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m4.5 1.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3"},Ka=({className:t,size:e=24})=>Va("svg",{className:t,fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:Va("path",{clipRule:"evenodd",d:gg[e],fill:"currentColor",fillRule:"evenodd"})});import{$computeTableCellRectBoundary as xg,$computeTableMap as Cg,$getNodeTriplet as Ja}from"@lexical/table";function Xa({selection:t}){let[e,,o]=Ja(t.anchor),[n]=Ja(t.focus),[r,l,s]=Cg(o,e,n),{maxColumn:i,maxRow:c,minColumn:u,minRow:d}=xg(r,l,s);return{columns:i-u+1,rows:c-d+1}}function zg(){let t=yo();if(Qn(t)&&!t.isCollapsed()||zt(t)&&!t.anchor.is(t.focus)||!Qn(t)&&!zt(t))return!1;let[e]=wg(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function Gg(t){let e=t.getLastDescendant();Og(e)?e.select():$g(e)?e.selectEnd():e!==null&&e.selectNext()}function Ug({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:n,tableCellNode:r}){let[l]=Za(),s=Lo(null),[i,c]=ht(r),[u,d]=ht({columns:1,rows:1}),[a,p]=ht(!1),[m,f]=ht(!1),{y:h}=Dg();ft(()=>l.registerMutationListener(Mg,S=>{S.get(i.getKey())==="updated"&&l.getEditorState().read(()=>{c(i.getLatest())})},{skipInitialization:!0}),[l,i]),ft(()=>{l.getEditorState().read(()=>{let S=yo();if(zt(S)){let R=Xa({selection:S});d(R);let v=S.anchor.is(S.focus);p(!v&&(R.columns>1||R.rows>1))}f(zg())})},[l]),ft(()=>{let S=e.current,R=s.current,v=l.getRootElement();if(S!=null&&R!=null&&v!=null){let D=v.getBoundingClientRect(),F=S.getBoundingClientRect();R.style.opacity="1";let M=R.getBoundingClientRect(),B=5,$=F.right+B;if($+M.width>window.innerWidth||$+M.width>D.right){let V=F.left-M.width-B;$=(V<0?B:V)+window.pageXOffset}R.style.left=`${$+window.pageXOffset}px`;let P=F.top;if(P+M.height>window.innerHeight){let V=F.bottom-M.height;P=V<0?B:V}R.style.top=`${P}px`}},[e,s,l,h]),ft(()=>{function S(R){s.current!=null&&e.current!=null&&jg(R.target)&&!s.current.contains(R.target)&&!e.current.contains(R.target)&&n(!1)}return window.addEventListener("click",S),()=>window.removeEventListener("click",S)},[n,e]);let g=de(()=>{l.update(()=>{if(i.isAttached()){let S=Me(i),R=Zn(S,l.getElementByKey(S.getKey()));if(R===null)throw new Error("Expected to find tableElement in DOM");let v=qn(R);v!==null&&v.$clearHighlight(),S.markDirty(),c(i.getLatest())}Fg(null)})},[l,i]),C=()=>{l.update(()=>{let S=yo();if(!zt(S))return;let v=S.getNodes().filter(qa),D=yg(v);D&&(Gg(D),o())})},E=()=>{l.update(()=>{Ig()}),g()},L=de(S=>{l.update(()=>{for(let R=0;R<u.rows;R++)Lg(S);o()})},[l,o,u.rows]),x=de(S=>{l.update(()=>{for(let R=0;R<u.columns;R++)Ng(S);o()})},[l,o,u.columns]),b=de(()=>{l.update(()=>{Eg(),o()})},[l,o]),k=de(()=>{l.update(()=>{Me(i).remove(),g(),o()})},[l,i,g,o]),_=de(()=>{l.update(()=>{Tg(),o()})},[l,o]),T=de(()=>{l.update(()=>{let S=Me(i),R=Sg(i),v=!i.hasHeaderState(pt.ROW);vg(S,R,v),g(),o()})},[l,i,g,o]),I=de(()=>{l.update(()=>{let S=Me(i),[,R]=_g(S,i,i),v=!i.hasHeaderState(pt.COLUMN);Rg(S,R.startColumn,v),g(),o()})},[l,i,g,o]),N=de(()=>{l.update(()=>{if(i.isAttached()){let S=Me(i);S&&S.setRowStriping(!S.getRowStriping())}g(),o()})},[l,i,g,o]),w=de(()=>{l.update(()=>{if(i.isAttached()){let S=Me(i);S&&S.setFrozenColumns(S.getFrozenColumns()===0?1:0)}g(),o()})},[l,i,g,o]),y=null;return t&&(a?y=j("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>C(),type:"button",children:j("span",{className:"text",children:"Merge cells"})}):m&&(y=j("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>E(),type:"button",children:j("span",{className:"text",children:"Unmerge cells"})}))),Qa(Ne("div",{className:"table-action-menu-dropdown",onClick:S=>{S.stopPropagation()},ref:s,children:[y?Ne(er.Fragment,{children:[y,j("hr",{})]}):null,j("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>N(),type:"button",children:j("span",{className:"text",children:"Toggle row striping"})}),j("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>w(),type:"button",children:j("span",{className:"text",children:"Toggle first column freeze"})}),j("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>L(!1),type:"button",children:Ne("span",{className:"text",children:["Insert ",u.rows===1?"row":`${u.rows} rows`," above"]})}),j("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>L(!0),type:"button",children:Ne("span",{className:"text",children:["Insert ",u.rows===1?"row":`${u.rows} rows`," below"]})}),j("hr",{}),j("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>x(!1),type:"button",children:Ne("span",{className:"text",children:["Insert ",u.columns===1?"column":`${u.columns} columns`," ","left"]})}),j("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>x(!0),type:"button",children:Ne("span",{className:"text",children:["Insert ",u.columns===1?"column":`${u.columns} columns`," ","right"]})}),j("hr",{}),j("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>_(),type:"button",children:j("span",{className:"text",children:"Delete column"})}),j("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>b(),type:"button",children:j("span",{className:"text",children:"Delete row"})}),j("button",{className:"item","data-test-id":"table-delete",onClick:()=>k(),type:"button",children:j("span",{className:"text",children:"Delete table"})}),j("hr",{}),j("button",{className:"item","data-test-id":"table-row-header",onClick:()=>T(),type:"button",children:Ne("span",{className:"text",children:[(i.__headerState&pt.ROW)===pt.ROW?"Remove":"Add"," ","row header"]})}),j("button",{className:"item","data-test-id":"table-column-header",onClick:()=>I(),type:"button",children:Ne("span",{className:"text",children:[(i.__headerState&pt.COLUMN)===pt.COLUMN?"Remove":"Add"," ","column header"]})})]}),l.getRootElement()?.closest('dialog, [role="dialog"]')??document.body)}function Wg({anchorElem:t,cellMerge:e}){let[o]=Za(),n=Lo(null),r=Lo(null),[l,s]=ht(!1),[i,c]=ht(null),u=de(()=>{let a=n.current,p=yo(),m=Bg(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 g=o.getRootElement(),C=null,E=null;if(Qn(p)&&g!==null&&m!==null&&g.contains(m.anchorNode)){let x=Ya(p.anchor.getNode());if(x==null||(E=o.getElementByKey(x.getKey()),E==null||!x.isAttached()))return h();let b=Me(x),k=Zn(b,o.getElementByKey(b.getKey()));if(k===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");C=qn(k),c(x)}else if(zt(p)){let x=Ya(p.anchor.getNode());if(!qa(x))throw new Error("TableSelection anchorNode must be a TableCellNode");let b=Me(x),k=Zn(b,o.getElementByKey(b.getKey()));if(k===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");C=qn(k),E=o.getElementByKey(x.getKey())}else if(!f)return h();if(C===null||E===null)return h();let L=!C||!C.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",L),a.classList.toggle("table-cell-action-button-container--inactive",!L),L){let x=E.getBoundingClientRect(),b=t.getBoundingClientRect(),k=x.top-b.top,_=x.right-b.left;a.style.transform=`translate(${_}px, ${k}px)`}},[o,t]);ft(()=>{let a,p=()=>{a=void 0,o.getEditorState().read(u)},m=()=>(a===void 0&&(a=setTimeout(p,0)),!1);return Ag(o.registerUpdateListener(m),o.registerCommand(Hg,m,Pg),o.registerRootListener((f,h)=>{h&&h.removeEventListener("pointerup",m),f&&(f.addEventListener("pointerup",m),m())}),()=>clearTimeout(a))});let d=Lo(i);return ft(()=>{d.current!==i&&s(!1),d.current=i},[d,i]),j("div",{className:"table-cell-action-button-container",ref:n,children:i!=null&&Ne(er.Fragment,{children:[j("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),s(!l)},ref:r,type:"button",children:j(Ka,{})}),l&&j(Ug,{cellMerge:e,contextRef:r,onClose:()=>s(!1),setIsMenuOpen:s,tableCellNode:i})]})})}var ec=t=>{let e=bg(3),{anchorElem:o}=t,n=kg(),r;return e[0]!==o||e[1]!==n?(r=Qa(n?j(Wg,{anchorElem:o??document.body,cellMerge:!0}):null,o??document.body),e[0]=o,e[1]=n,e[2]=r):r=e[2],r};import{c as Vg}from"react/compiler-runtime";import{jsx as vo,jsxs as Kg}from"react/jsx-runtime";import{useLexicalComposerContext as Jg}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Xg}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as Yg,$getTableNodeFromLexicalNodeOrThrow as tr,$getTableRowIndexFromTableCellNode as Zg,$isTableCellNode as tc,$isTableRowNode as qg,getDOMCellFromTarget as Qg,getTableElement as e2,TableNode as oc}from"@lexical/table";import{calculateZoomLevel as nc,mergeRegister as t2}from"@lexical/utils";import{$getNearestNodeFromDOMNode as or,isHTMLElement as o2,SKIP_SCROLL_INTO_VIEW_TAG as rc}from"lexical";import*as ic from"react";import{useCallback as Gt,useEffect as Io,useRef as Ro,useState as Ke}from"react";import{createPortal as n2}from"react-dom";var r2=33,lc=92;function l2({editor:t}){let e=Ro(null),o=Ro(null),n=Ro(null),[r,l]=Ke(!1),s=U(),i=Ro(null),[c,u]=Ke(null),[d,a]=Ke(null),[p,m]=Ke(!1),[f,h]=Ke(null),g=Gt(()=>{a(null),e.current=null,h(null),i.current=null,n.current=null},[]),C=w=>(w.buttons&1)===1;Io(()=>{let w=new Set;return t2(t.registerMutationListener(oc,y=>{for(let[S,R]of y)R==="destroyed"?w.delete(S):w.add(S);l(w.size>0)}),t.registerNodeTransform(oc,y=>{if(y.getColWidths())return y;let S=y.getColumnCount(),R=lc;return y.setColWidths(Array(S).fill(R)),y}))},[t]),Io(()=>{if(!r)return;let w=v=>{let D=v.target;if(o2(D)){if(f){u({x:v.clientX,y:v.clientY});return}if(m(C(v)),!(o.current&&o.current.contains(D))&&e.current!==D){e.current=D;let F=Qg(D);F&&d!==F?t.getEditorState().read(()=>{let M=or(F.elem);if(!M)throw new Error("TableCellResizer: Table cell node not found.");let B=tr(M),$=e2(B,t.getElementByKey(B.getKey()));if(!$)throw new Error("TableCellResizer: Table element not found.");e.current=D,n.current=$.getBoundingClientRect(),a(F)},{editor:t}):F==null&&g()}}},y=v=>{m(!0)},S=v=>{m(!1)},R=t.registerRootListener((v,D)=>{D?.removeEventListener("mousemove",w),D?.removeEventListener("mousedown",y),D?.removeEventListener("mouseup",S),v?.addEventListener("mousemove",w),v?.addEventListener("mousedown",y),v?.addEventListener("mouseup",S)});return()=>{R()}},[d,f,t,r,g]);let E=w=>w==="bottom",L=Gt(w=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let y=or(d.elem);if(!tc(y))throw new Error("TableCellResizer: Table cell node not found.");let S=tr(y),R=Zg(y),v=S.getChildren(),F=y.getColSpan()===S.getColumnCount()?R:R+y.getRowSpan()-1;if(F>=v.length||F<0)throw new Error("Expected table cell to be inside of table row.");let M=v[F];if(!qg(M))throw new Error("Expected table row");let B=M.getHeight();if(B===void 0){let P=M.getChildren();B=Math.min(...P.map(V=>x(V,t)??1/0))}let $=Math.max(B+w,r2);M.setHeight($)},{tag:rc})},[d,t]),x=(w,y)=>y.getElementByKey(w.getKey())?.clientHeight,b=(w,y)=>{let S;return y.forEach(R=>{R.forEach((v,D)=>{v.cell===w&&(S=D)})}),S},k=Gt(w=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let y=or(d.elem);if(!tc(y))throw new Error("TableCellResizer: Table cell node not found.");let S=tr(y),[R]=Yg(S,null,null),v=b(y,R);if(v===void 0)throw new Error("TableCellResizer: Table column not found.");let D=S.getColWidths();if(!D)return;let F=D[v];if(F===void 0)return;let M=[...D],B=Math.max(F+w,lc);M[v]=B,S.setColWidths(M)},{tag:rc})},[d,t]),_=Gt(w=>{let y=S=>{if(S.preventDefault(),S.stopPropagation(),!d)throw new Error("TableCellResizer: Expected active cell.");if(i.current){let{x:R,y:v}=i.current;if(d===null)return;let D=nc(S.target);if(E(w)){let F=(S.clientY-v)/D;L(F)}else{let F=(S.clientX-R)/D;k(F)}g(),document.removeEventListener("mouseup",y)}};return y},[d,g,k,L]),T=Gt(w=>y=>{if(y.preventDefault(),y.stopPropagation(),!d)throw new Error("TableCellResizer: Expected active cell.");i.current={x:y.clientX,y:y.clientY},u(i.current),h(w),document.addEventListener("mouseup",_(w))},[d,_]),[I,N]=Ke({bottom:null,left:null,right:null,top:null});return Io(()=>{if(d){let{height:w,left:y,top:S,width:R}=d.elem.getBoundingClientRect(),v=nc(d.elem),D=!!t.getRootElement()?.closest('dialog, [role="dialog"]'),F=D?0:window.scrollX,M=D?0:window.scrollY,B=D?"fixed":"absolute",$=10,P={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${$}px`,left:`${F+y}px`,position:B,top:`${M+S+w-$/2}px`,width:`${R}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${w}px`,left:`${F+y+R-$/2}px`,position:B,top:`${M+S}px`,width:`${$}px`}},V=n.current;f&&c&&V&&(E(f)?(P[f].left=`${F+V.left}px`,P[f].top=`${M+c.y/v}px`,P[f].height="3px",P[f].width=`${V.width}px`):(P[f].top=`${M+V.top}px`,P[f].left=`${F+c.x/v}px`,P[f].width="3px",P[f].height=`${V.height}px`),P[f].backgroundColor="#adf"),N(P)}else N({bottom:null,left:null,right:null,top:null})},[d,f,t,c]),vo("div",{ref:o,children:d!=null&&!p&&Kg(ic.Fragment,{children:[vo("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:T("right"),style:I.right||void 0}),vo("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:T("bottom"),style:I.bottom||void 0})]})})}var sc=()=>{let t=Vg(7),[e]=Jg(),o=Xg(),[n,r]=Ke(null),l,s;t[0]!==e?(l=()=>e.registerRootListener(c=>{r(c?.closest('dialog, [role="dialog"]')??document.body)}),s=[e],t[0]=e,t[1]=l,t[2]=s):(l=t[1],s=t[2]),Io(l,s);let i;return t[3]!==e||t[4]!==o||t[5]!==n?(i=o&&n?n2(vo(l2,{editor:e}),n):null,t[3]=e,t[4]=o,t[5]=n,t[6]=i):i=t[6],i};import{c as p2}from"react/compiler-runtime";import{jsx as nr,jsxs as f2,Fragment as h2}from"react/jsx-runtime";import{useLexicalComposerContext as g2}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as hc}from"@lexical/react/useLexicalEditable";import{$getTableAndElementByKey as x2,$getTableColumnIndexFromTableCellNode as C2,$getTableRowIndexFromTableCellNode as b2,$insertTableColumnAtSelection as k2,$insertTableRowAtSelection as _2,$isTableCellNode as T2,$isTableNode as uc,getTableElement as E2,TableNode as w2}from"@lexical/table";import{$findMatchingParent as S2,mergeRegister as N2}from"@lexical/utils";import{$getNearestNodeFromDOMNode as dc,isHTMLElement as L2}from"lexical";import{useEffect as mc,useMemo as y2,useRef as pc,useState as Mo}from"react";import"react";import{createPortal as R2}from"react-dom";import{c as u2}from"react/compiler-runtime";import{useEffect as d2,useRef as m2}from"react";var i2="Expected a function",s2=Math.max,a2=Math.min;function c2(t,e,o){let n,r,l=0,s,i=!1,c=!1,u,d,a,p=!0;if(typeof t!="function")throw new TypeError(i2);e=e||0,typeof o=="object"&&(i=!!o.leading,c="maxWait"in o,u=c?s2(o.maxWait||0,e):u,p="trailing"in o?!!o.trailing:p);function m(k){let _=n,T=s;return n=s=void 0,l=k,d=t.apply(T,_),d}function f(k){return l=k,a=setTimeout(C,e),i?m(k):d}function h(k){let _=k-r,T=k-l,I=e-_;return c?a2(I,u-T):I}function g(k){let _=k-r,T=k-l;return r===void 0||_>=e||_<0||c&&T>=u}function C(){let k=Date.now();if(g(k))return E(k);a=setTimeout(C,h(k))}function E(k){return a=void 0,p&&n?m(k):(n=s=void 0,d)}function L(){a!==void 0&&clearTimeout(a),l=0,n=r=s=a=void 0}function x(){return a===void 0?d:E(Date.now())}function b(){let k=Date.now(),_=g(k);if(n=arguments,s=this,r=k,_){if(a===void 0)return f(r);if(c)return clearTimeout(a),a=setTimeout(C,e),m(r)}return a===void 0&&(a=setTimeout(C,e)),d}return b.cancel=L,b.flush=x,b}var ac=c2;function cc(t,e,o){let n=u2(6),r=m2(null),l,s;n[0]!==t||n[1]!==o||n[2]!==e?(l=()=>(r.current=ac(t,e,{maxWait:o}),()=>{r.current?.cancel()}),s=[t,e,o],n[0]=t,n[1]=o,n[2]=e,n[3]=l,n[4]=s):(l=n[3],s=n[4]),d2(l,s);let i;return n[5]===Symbol.for("react.memo_cache_sentinel")?(i=(...u)=>{let d=u;r.current&&r.current(...d)},n[5]=i):i=n[5],i}var fc=16;function v2({anchorElem:t}){let[e]=g2(),o=hc(),n=U(),[r,l]=Mo(!1),[s,i]=Mo(!1),[c,u]=Mo(!1),[d,a]=Mo({}),p=pc(new Set),m=pc(null),f=cc(C=>{let{isOutside:E,tableDOMNode:L}=I2(C,n.editorConfig?.lexical);if(E){l(!1),i(!1);return}if(!L)return;m.current=L;let x=null,b=null,k=null;if(e.getEditorState().read(()=>{let F=dc(L);if(T2(F)){let M=S2(F,B=>uc(B));if(!uc(M))return;if(k=E2(M,e.getElementByKey(M.getKey())),k){let B=M.getChildrenSize(),$=M.getChildAtIndex(0)?.getChildrenSize(),P=b2(F),V=C2(F);P===B-1?x=F:V===$-1&&(b=F)}}},{editor:e}),!k)return;let _=k.parentElement;if(!_)return;let{bottom:T,height:I,left:N,right:w,width:y,y:S}=k.getBoundingClientRect(),R=!1;_&&_.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(R=_.scrollWidth>_.clientWidth);let{left:v,y:D}=t.getBoundingClientRect();x?(i(!1),l(!0),a({height:fc,left:R&&_?_.offsetLeft:N-v,top:T-D+5,width:R&&_?_.offsetWidth:y})):b&&(i(!0),l(!1),a({height:I,left:w-v+5,top:S-D,width:fc}))},50,250),h=y2(()=>new ResizeObserver(()=>{l(!1),i(!1)}),[]);mc(()=>{if(c)return document.addEventListener("mousemove",f),()=>{l(!1),i(!1),document.removeEventListener("mousemove",f)}},[c,f]),mc(()=>N2(e.registerMutationListener(w2,C=>{e.getEditorState().read(()=>{let E=!1;for(let[L,x]of C)switch(x){case"created":{p.current.add(L),E=!0;break}case"destroyed":{p.current.delete(L),E=!0;break}default:break}if(E){h.disconnect();for(let L of p.current){let{tableElement:x}=x2(L);h.observe(x)}u(p.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,h]);let g=C=>{e.update(()=>{m.current&&(dc(m.current)?.selectEnd(),C?(_2(),l(!1)):(k2(),i(!1)))})};return o?f2(h2,{children:[r&&nr("button",{"aria-label":"Add Row",className:n.editorConfig.lexical.theme.tableAddRows,onClick:()=>g(!0),style:{...d},type:"button"}),s&&nr("button",{"aria-label":"Add Column",className:n.editorConfig.lexical.theme.tableAddColumns,onClick:()=>g(!1),style:{...d},type:"button"})]}):null}function I2(t,e){let o=t.target;if(L2(o)){let n=o.closest(`td.${e.theme.tableCell}, th.${e.theme.tableCell}`);return{isOutside:!(n||o.closest(`button.${e.theme.tableAddRows}`)||o.closest(`button.${e.theme.tableAddColumns}`)||o.closest(`div.${e.theme.tableCellResizer}`)),tableDOMNode:n}}else return{isOutside:!0,tableDOMNode:null}}function gc(t){let e=p2(2),{anchorElem:o}=t,n=o===void 0?document.body:o;if(!hc())return null;let l;return e[0]!==n?(l=R2(nr(v2,{anchorElem:n}),n),e[0]=n,e[1]=l):l=e[1],l}import{jsx as ir,jsxs as $2}from"react/jsx-runtime";import{useLexicalComposerContext as O2}from"@lexical/react/LexicalComposerContext";import{TablePlugin as F2}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as P2,TableCellNode as B2,TableNode as j2,TableRowNode as H2}from"@lexical/table";import{mergeRegister as z2}from"@lexical/utils";import{$getSelection as G2,$isRangeSelection as U2,$setSelection as W2,COMMAND_PRIORITY_EDITOR as V2,createCommand as K2}from"lexical";import{createContext as J2,use as X2,useCallback as Tc,useEffect as Ec,useMemo as Y2,useRef as Z2,useState as Ao}from"react";import*as wc from"react";import{jsx as te,jsxs as Le}from"react/jsx-runtime";import{useCallback as rr,useEffect as xc,useRef as lr,useState as Ut}from"react";import*as kc from"react";import{createPortal as M2}from"react-dom";var Cc=10,bc=7;function A2(){return Le("svg",{fill:"none",height:"12",viewBox:"0 0 12 12",width:"12",xmlns:"http://www.w3.org/2000/svg",children:[te("rect",{height:"9",rx:"1",stroke:"currentColor",width:"3",x:"1.5",y:"1.5"}),te("rect",{height:"9",rx:"1",stroke:"currentColor",width:"3",x:"7.5",y:"1.5"})]})}function D2(){return Le("svg",{fill:"none",height:"12",viewBox:"0 0 12 12",width:"12",xmlns:"http://www.w3.org/2000/svg",children:[te("rect",{height:"3",rx:"1",stroke:"currentColor",width:"9",x:"1.5",y:"1.5"}),te("rect",{height:"3",rx:"1",stroke:"currentColor",width:"9",x:"1.5",y:"7.5"})]})}function _c({anchorElem:t,editor:e,isOpen:o,onClose:n,onInsert:r,position:l}){let[s,i]=Ut(0),[c,u]=Ut(0),[d,a]=Ut(""),[p,m]=Ut(""),[f,h]=Ut(null),g=lr(null),C=lr(null),E=lr(null),L=s>0?s:d?parseInt(d,10)||0:5,x=c>0?c:p?parseInt(p,10)||0:5;xc(()=>{o||(i(0),u(0),a(""),m(""),h(null))},[o]),xc(()=>{if(!o)return;let N=w=>{if(w.key==="Escape"&&(w.preventDefault(),w.stopPropagation(),n()),w.key==="Enter"&&f){w.preventDefault();let y=parseInt(d,10),S=parseInt(p,10);y>0&&S>0&&r(y,S)}};return document.addEventListener("keydown",N,!0),()=>document.removeEventListener("keydown",N,!0)},[o,n,r,f,d,p]);let b=rr((N,w)=>{N>0&&w>0&&r(N,w)},[r]),k=rr((N,w)=>{i(N),u(w)},[]),_=rr(()=>{i(0),u(0)},[]);if(!o||!l||!t)return null;let T=[];for(let N=1;N<=bc;N++)for(let w=1;w<=Cc;w++){let y=w<=L&&N<=x,S=w<=s&&N<=c,R="table-grid-popup__cell";y&&S?R+=" table-grid-popup__cell--hover":y&&(R+=" table-grid-popup__cell--selected"),T.push(te("div",{"aria-label":`${w} columns, ${N} rows`,className:R,onClick:()=>b(w,N),onKeyDown:v=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),b(w,N))},onMouseEnter:()=>k(w,N),role:"button",tabIndex:-1},`${N}-${w}`))}let I=s>0&&c>0;return M2(Le(kc.Fragment,{children:[te("div",{className:"table-grid-popup__backdrop",onClick:n}),te("div",{className:"table-grid-popup",ref:g,style:{transform:`translate(${l.left}px, ${l.top}px)`},children:Le("div",{className:"table-grid-popup__content",children:[Le("div",{className:"table-grid-popup__header",children:[Le("div",{className:`table-grid-popup__input-group${f==="cols"?" table-grid-popup__input-group--focused":""}`,children:[te("div",{className:"table-grid-popup__input-icon",children:te(A2,{})}),te("input",{"aria-label":"Columns",className:"table-grid-popup__input",min:1,onBlur:()=>h(null),onChange:N=>a(N.target.value),onFocus:()=>h("cols"),placeholder:s>0?String(s):"5",ref:C,type:"number",value:d})]}),te("span",{className:"table-grid-popup__separator",children:"\xD7"}),Le("div",{className:`table-grid-popup__input-group${f==="rows"?" table-grid-popup__input-group--focused":""}`,children:[te("div",{className:"table-grid-popup__input-icon",children:te(D2,{})}),te("input",{"aria-label":"Rows",className:"table-grid-popup__input",min:1,onBlur:()=>h(null),onChange:N=>m(N.target.value),onFocus:()=>h("rows"),placeholder:c>0?String(c):"5",ref:E,type:"number",value:p})]})]}),Le("div",{className:"table-grid-popup__grid",onMouseLeave:_,children:[T,I&&Le("div",{className:"table-grid-popup__tooltip",style:{left:`calc(${(s-.5)/Cc*100}%)`,top:`calc(${(c-1)/bc*100}%)`},children:[L," \xD7 ",x]})]})]})})]}),t)}var Do=K2("OPEN_EMBED_DRAWER_COMMAND"),Sc=J2({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function Nc({children:t}){let[e,o]=Ao({cellEditorConfig:null,cellEditorPlugins:null});return ir(Sc,{value:Y2(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(n,r)=>{o({cellEditorConfig:n,cellEditorPlugins:r})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var Lc=()=>{let[t]=O2(),e=X2(Sc),[o,n]=Ao(!1),[r,l]=Ao(null),s=Z2(null),[i,c]=Ao(null);Ec(()=>{let a=t.getRootElement();if(a){let p=a.closest(".editor")??null;c(p??a.parentElement)}},[t]),Ec(()=>{if(!t.hasNodes([j2,H2,B2]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return z2(t.registerCommand(Do,()=>{let a=i;if(!a)return!0;let p=a.getBoundingClientRect(),m=null;t.getEditorState().read(()=>{let h=G2();if(U2(h)){s.current=h.clone();let g=h.anchor.getNode(),C=t.getElementByKey(g.getKey());if(C){let E=C.getBoundingClientRect();E.height>0&&(m={left:E.left-p.left,top:E.bottom-p.top+8})}}});let f=window.getSelection();if(f&&f.rangeCount>0){let g=f.getRangeAt(0).getBoundingClientRect();g.height>0&&(m={left:g.left-p.left,top:g.bottom-p.top+8})}return m||(m={left:0,top:40}),l(m),n(!0),!0},V2))},[e,t,i]);let u=Tc(()=>{n(!1)},[]),d=Tc((a,p)=>{n(!1),t.focus(),t.update(()=>{s.current&&W2(s.current.clone())},{discrete:!0,skipTransforms:!0}),setTimeout(()=>{t.dispatchCommand(P2,{columns:String(a),rows:String(p)})},1)},[t]);return $2(wc.Fragment,{children:[ir(_c,{anchorElem:i,editor:t,isOpen:o,onClose:u,onInsert:d,position:r}),ir(F2,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]})};var tx=A({markdownTransformers:[Ua],nodes:[Q2,q2,ex],plugins:[{Component:Lc,position:"normal"},{Component:sc,position:"normal"},{Component:ec,position:"floatingAnchorElem"},{Component:gc,position:"floatingAnchorElem"}],providers:[Nc],slashMenu:{groups:[q([{Icon:Jn,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Do,{})}}])]},toolbarFixed:{groups:[be([{ChildComponent:Jn,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Do,{})}}])]}});import{$isNodeSelection as vx}from"lexical";import{jsx as yc}from"react/jsx-runtime";import"react";var ox="M16.2041 6.01074C17.2128 6.113 18 6.96435 18 8V16L17.9893 16.2041C17.8938 17.1457 17.1457 17.8938 16.2041 17.9893L16 18H8C6.96435 18 6.113 17.2128 6.01074 16.2041L6 16V8C6 6.89543 6.89543 6 8 6H16L16.2041 6.01074ZM8 7C7.44772 7 7 7.44772 7 8V16C7 16.5523 7.44772 17 8 17H16C16.5523 17 17 16.5523 17 16V8C17 7.44772 16.5523 7 16 7H8ZM9.72461 11.582C9.91869 11.4539 10.1827 11.4756 10.3535 11.6465L13.8535 15.1465C14.0488 15.3417 14.0488 15.6583 13.8535 15.8535C13.6583 16.0488 13.3417 16.0488 13.1465 15.8535L10 12.707L8.85352 13.8535C8.65825 14.0488 8.34175 14.0488 8.14648 13.8535C7.95122 13.6583 7.95122 13.3417 8.14648 13.1465L9.64648 11.6465L9.72461 11.582ZM14 8C15.1046 8 16 8.89543 16 10C16 11.1046 15.1046 12 14 12C12.8954 12 12 11.1046 12 10C12 8.89543 12.8954 8 14 8ZM14 9C13.4477 9 13 9.44772 13 10C13 10.5523 13.4477 11 14 11C14.5523 11 15 10.5523 15 10C15 9.44772 14.5523 9 14 9Z",sr=({className:t})=>yc("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:yc("path",{clipRule:"evenodd",d:ox,fill:"currentColor",fillRule:"evenodd"})});import{c as ux}from"react/compiler-runtime";import{jsx as dx}from"react/jsx-runtime";import{useLexicalComposerContext as mx}from"@lexical/react/LexicalComposerContext.js";import{$dfsIterator as Bc,$insertNodeToNearestRoot as ur,mergeRegister as px}from"@lexical/utils";import{useBulkUpload as fx,useEffectEvent as hx,useModal as gx}from"@payloadcms/ui";import dr from"bson-objectid";import{$createRangeSelection as xx,$getPreviousSelection as Dc,$getSelection as $c,$isParagraphNode as mr,$isRangeSelection as Oc,$setSelection as Cx,COMMAND_PRIORITY_EDITOR as bx,COMMAND_PRIORITY_LOW as Fc,createCommand as kx,DROP_COMMAND as _x,getDOMSelectionFromTarget as Tx,isHTMLElement as Pc,PASTE_COMMAND as Ex}from"lexical";import{useEffect as wx}from"react";import{c as Rc}from"react/compiler-runtime";import{jsx as ar}from"react/jsx-runtime";import{useLexicalComposerContext as vc}from"@lexical/react/LexicalComposerContext.js";import{toast as nx}from"@payloadcms/ui";import{$getNodeByKey as rx,COMMAND_PRIORITY_EDITOR as Ic}from"lexical";import{useEffect as Mc,useState as lx}from"react";var ix=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=rx(o);r&&r.replace(ye({data:{fields:null,relationTo:e,value:n}}))}):t.dispatchCommand(cr,{fields:null,relationTo:e,value:n})},sx=t=>{let e=Rc(13),{enabledCollectionSlugs:o}=t,[n]=vc(),[r,l]=lx(null),s;e[0]!==o?(s={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=s):s=e[1];let{closeListDrawer:i,ListDrawer:c,openListDrawer:u}=Pt(s),d,a;e[2]!==n||e[3]!==u?(d=()=>n.registerCommand(tt,h=>(l(h?.replace?h?.replace.nodeKey:null),u(),!0),Ic),a=[n,u],e[2]=n,e[3]=u,e[4]=d,e[5]=a):(d=e[4],a=e[5]),Mc(d,a);let p;e[6]!==i||e[7]!==n||e[8]!==r?(p=h=>{let{collectionSlug:g,doc:C}=h;i(),ix({editor:n,relationTo:g,replaceNodeKey:r,value:C.id})},e[6]=i,e[7]=n,e[8]=r,e[9]=p):p=e[9];let m=p,f;return e[10]!==c||e[11]!==m?(f=ar(c,{onSelect:m}),e[10]=c,e[11]=m,e[12]=f):f=e[12],f},ax=()=>{let t=Rc(3),[e]=vc(),o,n;return t[0]!==e?(o=()=>e.registerCommand(tt,cx,Ic),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),Mc(o,n),null},Ac=({enabledCollectionSlugs:t})=>t?.length?ar(sx,{enabledCollectionSlugs:t}):ar(ax,{});function cx(){return nx.error("No upload collections enabled"),!0}function Sx(t){let e=t.target;return!!(Pc(e)&&!e.closest("code, span.editor-image")&&Pc(e.parentElement)&&e.parentElement.closest("div.ContentEditable__root"))}function Nx(t){let e,o=Tx(t.target);if(document.caretRangeFromPoint)e=document.caretRangeFromPoint(t.clientX,t.clientY);else if(t.rangeParent&&o!==null)o.collapse(t.rangeParent,t.rangeOffset||0),e=o.getRangeAt(0);else throw Error("Cannot get the selection when dragging");return e}var cr=kx("INSERT_UPLOAD_COMMAND"),jc=t=>{let e=ux(20),{clientProps:o}=t,[n]=mx(),r;e[0]!==o.enabledCollectionSlugs?(r={enabledCollectionSlugs:o.enabledCollectionSlugs},e[0]=o.enabledCollectionSlugs,e[1]=r):r=e[1];let{enabledCollectionSlugs:l}=Co(r),{modalSlug:s,setCollectionSlug:i,setInitialForms:c,setOnCancel:u,setOnSuccess:d,setSelectableCollections:a}=fx(),{isModalOpen:p,openModal:m}=gx(),f;e[2]!==s||e[3]!==n||e[4]!==l||e[5]!==p||e[6]!==m||e[7]!==i||e[8]!==c||e[9]!==u||e[10]!==d||e[11]!==a?(f=L=>{let{files:x}=L;if(x?.length!==0&&(c(b=>[...b??[],...x.map(Lx)]),!p(s))){if(!l.length||!l[0])return;i(l[0]),a(l),u(()=>{n.update(yx)}),d(b=>{let k=new Map(b.map(Rx));n.update(()=>{for(let _ of Bc()){let T=_.node;if(nt(T)){let I=T.getData();if(I?.pending){let N=k.get(I.pending?.formID);N&&T.replace(ye({data:{id:new dr.default().toHexString(),fields:{},relationTo:N.collectionSlug,value:N.doc.id}}))}}}})}),m(s)}},e[2]=s,e[3]=n,e[4]=l,e[5]=p,e[6]=m,e[7]=i,e[8]=c,e[9]=u,e[10]=d,e[11]=a,e[12]=f):f=e[12];let h=hx(f),g;e[13]!==n||e[14]!==h?(g=()=>{if(!n.hasNodes([ot]))throw new Error("UploadPlugin: UploadNode not registered on editor");let L=new WeakSet;return px(n.registerNodeTransform(ot,x=>{let b=x.getData();if(!b?.pending||L.has(b.pending))return;L.add(b.pending),async function(){let T=null,I=b?.pending?.src,N=b?.pending?.formID;if(I?.startsWith("data:")){let w=I.match(/data:(image\/[a-zA-Z]+);base64,/),y=w?w[1]:"image/png",S=I.replace(/^data:image\/[a-zA-Z]+;base64,/,""),R=atob(S),v=new Array(R.length);for(let M=0;M<R.length;M++)v[M]=R.charCodeAt(M);let D=new Uint8Array(v);T={alt:void 0,file:new File([D],"pasted-image."+y?.split("/",2)[1],{type:y}),formID:N}}else if(I?.startsWith("http")||I?.startsWith("https")){let y=await(await fetch(I)).blob(),S=I.split("/").pop()||"pasted-image"+y.type.split("/",2)[1];T={alt:void 0,file:new File([y],S,{type:y.type}),formID:N}}T&&h({files:[T]})}()}),n.registerCommand(cr,x=>(n.update(()=>{let b=$c()||Dc();if(Oc(b)){let k=ye({data:{id:x.id,fields:x.fields,relationTo:x.relationTo,value:x.value}}),{focus:_}=b,T=_.getNode();ur(k),mr(T)&&!T.__first&&T.remove()}}),!0),bx),n.registerCommand(Ex,x=>{if(!(x instanceof ClipboardEvent))return!1;let b=x.clipboardData;if(!b?.types?.length||b?.types?.includes("text/html"))return!1;let k=[];return b?.files?.length&&Array.from(b.files).forEach(_=>{k.push({alt:"",file:_,formID:new dr.default().toHexString()})}),k.length?(n.update(()=>{let _=$c()||Dc();if(Oc(_))for(let T of k){let I=ye({data:{pending:{formID:T.formID,src:URL.createObjectURL(T.file)}}}),{focus:N}=_,w=N.getNode();ur(I),mr(w)&&!w.__first&&w.remove()}}),h({files:k}),!0):!1},Fc),n.registerCommand(_x,x=>{if(!(x instanceof DragEvent))return!1;let b=x.dataTransfer;if(!b?.types?.length)return!1;let k=[];return b?.files?.length&&Array.from(b.files).forEach(_=>{k.push({alt:"",file:_,formID:new dr.default().toHexString()})}),k.length?(x.preventDefault(),x.stopPropagation(),n.update(()=>{if(Sx(x)){let _=Nx(x),T=xx();_!=null&&T.applyDOMRange(_),Cx(T);for(let I of k){let N=ye({data:{pending:{formID:I.formID,src:URL.createObjectURL(I.file)}}}),{focus:w}=T,y=w.getNode();ur(N),mr(y)&&!y.__first&&y.remove()}}}),h({files:k}),!0):!1},Fc))},e[13]=n,e[14]=h,e[15]=g):g=e[15];let C;e[16]!==n?(C=[n],e[16]=n,e[17]=C):C=e[17],wx(g,C);let E;return e[18]!==l?(E=dx(Ac,{enabledCollectionSlugs:l}),e[18]=l,e[19]=E):E=e[19],E};function Lx(t){return{file:t.file,formID:t.formID}}function yx(){for(let t of Bc()){let e=t.node;nt(e)&&e.getData()?.pending&&e.remove()}}function Rx(t){return[t.formID,t]}var Ix=A({nodes:[ot],plugins:[{Component:jc,position:"normal"}],slashMenu:{groups:[q([{Icon:sr,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(tt,{replace:!1})}}])]},toolbarFixed:{groups:[be([{ChildComponent:sr,isActive:({selection:t})=>{if(!vx(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return nt(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(tt,{replace:!1})}}])]}});import{c as Ax}from"react/compiler-runtime";import{jsx as $o}from"react/jsx-runtime";import{createElement as Dx}from"react";import{ShimmerEffect as $x,useConfig as Ox}from"@payloadcms/ui";import{lazy as Fx,Suspense as Px,useEffect as Bx,useState as jx}from"react";var Hc={block:"LexicalEditorTheme__block",blockCursor:"LexicalEditorTheme__blockCursor",characterLimit:"LexicalEditorTheme__characterLimit",code:"LexicalEditorTheme__code",inlineBlock:"LexicalEditorTheme__inlineBlock",heading:{h1:"LexicalEditorTheme__h1",h2:"LexicalEditorTheme__h2",h3:"LexicalEditorTheme__h3",h4:"LexicalEditorTheme__h4",h5:"LexicalEditorTheme__h5",h6:"LexicalEditorTheme__h6"},hr:"LexicalEditorTheme__hr",hrSelected:"LexicalEditorTheme__hrSelected",indent:"LexicalEditorTheme__indent",link:"LexicalEditorTheme__link",list:{checklist:"LexicalEditorTheme__checklist",listitem:"LexicalEditorTheme__listItem",listitemChecked:"LexicalEditorTheme__listItemChecked",listitemUnchecked:"LexicalEditorTheme__listItemUnchecked",nested:{listitem:"LexicalEditorTheme__nestedListItem"},olDepth:["LexicalEditorTheme__ol1","LexicalEditorTheme__ol2","LexicalEditorTheme__ol3","LexicalEditorTheme__ol4","LexicalEditorTheme__ol5"],ul:"LexicalEditorTheme__ul"},ltr:"LexicalEditorTheme__ltr",mark:"LexicalEditorTheme__mark",markOverlap:"LexicalEditorTheme__markOverlap",paragraph:"LexicalEditorTheme__paragraph",placeholder:"LexicalEditorTheme__placeholder",quote:"LexicalEditorTheme__quote",relationship:"LexicalEditorTheme__relationship",root:"LexicalEditorTheme",rtl:"LexicalEditorTheme__rtl",tab:"LexicalEditorTheme__tabNode",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableAlignment:{center:"LexicalEditorTheme__tableAlignmentCenter",right:"LexicalEditorTheme__tableAlignmentRight"},tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableFrozenColumn:"LexicalEditorTheme__tableFrozenColumn",tableRowStriping:"LexicalEditorTheme__tableRowStriping",tableScrollableWrapper:"LexicalEditorTheme__tableScrollableWrapper",tableSelected:"LexicalEditorTheme__tableSelected",tableSelection:"LexicalEditorTheme__tableSelection",text:{bold:"LexicalEditorTheme__textBold",code:"LexicalEditorTheme__textCode",italic:"LexicalEditorTheme__textItalic",strikethrough:"LexicalEditorTheme__textStrikethrough",subscript:"LexicalEditorTheme__textSubscript",superscript:"LexicalEditorTheme__textSuperscript",underline:"LexicalEditorTheme__textUnderline",underlineStrikethrough:"LexicalEditorTheme__textUnderlineStrikethrough"},upload:"LexicalEditorTheme__upload"};var pr={namespace:"lexical",theme:Hc};function zc({config:t,featureClientImportMap:e,featureClientSchemaMap:o,field:n,schemaPath:r,unSanitizedEditorConfig:l}){let s=new Map,i=[];for(let d of l.features){if(!d?.clientFeatureProps?.featureKey||d?.clientFeatureProps?.order===void 0||d?.clientFeatureProps?.order===null){console.warn("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. Skipping feature.");continue}s.set(d.clientFeatureProps.featureKey,d),i.push(d)}l.features=i,l.features=l.features.sort((d,a)=>d.clientFeatureProps.order-a.clientFeatureProps.order);let c=new Map,u=0;for(let d of l.features){let a=typeof d.feature=="function"?d.feature({config:t,featureClientImportMap:e,featureClientSchemaMap:o,featureProviderMap:s,field:n,resolvedFeatures:c,schemaPath:r,unSanitizedEditorConfig:l}):d.feature;a.key=d.clientFeatureProps.featureKey,a.order=u,c.set(d.clientFeatureProps.featureKey,a),u++}return c}import{deepMerge as Mx}from"payload/shared";var Gc=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}},o={};if(t.forEach(n=>{n.key==="toolbarFixed"&&n.sanitizedClientFeatureProps?.customGroups&&(o={...o,...n.sanitizedClientFeatureProps.customGroups})}),!t?.size)return e;t.forEach(n=>{if(n.providers?.length&&(e.providers=e.providers.concat(n.providers)),n.enableFormats?.length&&e.enabledFormats.push(...n.enableFormats),n.nodes?.length)for(let r of n.nodes)e.nodes.push(r);if(n.plugins?.length&&n.plugins.forEach((r,l)=>{e.plugins?.push({clientProps:n.sanitizedClientFeatureProps,Component:r.Component,key:n.key+l,position:r.position})}),n.toolbarInline?.groups?.length)for(let r of n.toolbarInline.groups){let l=e.toolbarInline.groups.find(s=>s.key===r.key);l?e.toolbarInline.groups=e.toolbarInline.groups.filter(s=>s.key!==r.key):l={...r,items:[]},r?.items?.length&&(l.items=l.items.concat(r.items)),e.toolbarInline?.groups.push(l)}if(n.toolbarFixed?.groups?.length)for(let r of n.toolbarFixed.groups){let l=e.toolbarFixed.groups.find(s=>s.key===r.key);l?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(s=>s.key!==r.key):l={...r,items:[]},r?.items?.length&&(l.items=l.items.concat(r.items)),e.toolbarFixed?.groups.push(l)}if(n.slashMenu?.groups){n.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(n.slashMenu.dynamicGroups));for(let r of n.slashMenu.groups){let l=e.slashMenu.groups.find(s=>s.key===r.key);l?e.slashMenu.groups=e.slashMenu.groups.filter(s=>s.key!==r.key):l={...r,items:[]},r?.items?.length&&(l.items=l.items.concat(r.items)),e.slashMenu.groups.push(l)}}if(n.markdownTransformers?.length)for(let r of n.markdownTransformers)typeof r=="function"?e.markdownTransformers.push(r({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(r);e.enabledFeatures.push(n.key)}),Object.keys(o).length>0&&(e.toolbarFixed.groups=e.toolbarFixed.groups.map(n=>{let r=o[n.key];return r?Mx(n,r):n})),e.toolbarInline.groups.sort((n,r)=>n.order&&r.order?n.order-r.order:n.order?-1:r.order?1:0),e.toolbarFixed.groups.sort((n,r)=>n.order&&r.order?n.order-r.order:n.order?-1:r.order?1:0);for(let n of e.toolbarInline.groups)n.items.sort((r,l)=>r.order&&l.order?r.order-l.order:r.order?-1:l.order?1:0);for(let n of e.toolbarFixed.groups)n.items.sort((r,l)=>r.order&&l.order?r.order-l.order:r.order?-1:l.order?1:0);return e};function fr(t,e,o,n){return{admin:o,features:Gc(t),lexical:e,resolvedFeatureMap:t,view:n}}var Hx=Fx(()=>import("./Field-W2ABOM7M.js").then(t=>({default:t.RichText}))),zx=t=>$o(Jo,{inheritable:!0,views:t.views,children:$o(Gx,{...t})}),Gx=t=>{let e=Ax(23),{admin:o,clientFeatures:n,featureClientImportMap:r,featureClientSchemaMap:l,field:s,lexicalEditorConfig:i,schemaPath:c,views:u}=t,d;e[0]!==o?(d=o===void 0?{}:o,e[0]=o,e[1]=d):d=e[1];let a=d,p;e[2]!==r?(p=r===void 0?{}:r,e[2]=r,e[3]=p):p=e[3];let m=p,f=i===void 0?pr:i,{currentView:h}=Xo(),g=u?.[h]?.admin??a,C=u?.[h]?.lexical,E;e[4]!==f||e[5]!==C?(E=typeof C=="function"?C(f):C??f,e[4]=f,e[5]=C,e[6]=E):E=e[6];let L=E,{config:x}=Ox(),[b,k]=jx(null),_,T;e[7]!==n||e[8]!==x||e[9]!==h||e[10]!==g||e[11]!==L||e[12]!==m||e[13]!==l||e[14]!==s||e[15]!==b||e[16]!==c||e[17]!==u?(_=()=>{if(b&&b.view===h)return;let N=u?.[h],w=N?.filterFeatures?N.filterFeatures(n):n,y=[];for(let R of Object.values(w))!R.clientFeatureProvider||!R.clientFeatureProps||y.push(R.clientFeatureProvider(R.clientFeatureProps));let S=zc({config:x,featureClientImportMap:m,featureClientSchemaMap:l,field:s,schemaPath:c??s.name,unSanitizedEditorConfig:{features:y,lexical:L}});k(fr(S,L,g,h))},T=[g,n,x,m,l,s,b,L,c,h,u],e[7]=n,e[8]=x,e[9]=h,e[10]=g,e[11]=L,e[12]=m,e[13]=l,e[14]=s,e[15]=b,e[16]=c,e[17]=u,e[18]=_,e[19]=T):(_=e[18],T=e[19]),Bx(_,T);let I;return e[20]!==b||e[21]!==t?(I=$o(Px,{fallback:$o($x,{height:"35vh"}),children:b&&Dx(Hx,{...t,editorConfig:b,key:b.view})}),e[20]=b,e[21]=t,e[22]=I):I=e[22],I};function Ux(...t){return t.filter(Boolean).join(" ")}var Wx=t=>(e,o,n)=>{let r=t(n);r&&(r.append(...o),e.replace(r),r.select(0,0))};var Oo=new WeakMap;function Uc(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function Fo(t,e){let o=Oo.get(t);if(o===void 0){let n=new Set,r=s=>{o!==void 0&&(o.start=Uc(s))},l=s=>{if(o===void 0)return;let{start:i}=o;if(i===null)return;let c=Uc(s);for(let u of n)c!==null&&u([c[0]-i[0],c[1]-i[1]],s)};t.addEventListener("touchstart",r),t.addEventListener("touchend",l),o={handleTouchend:l,handleTouchstart:r,listeners:n,start:null},Oo.set(t,o)}return o.listeners.add(e),()=>{Vx(t,e)}}function Vx(t,e){let o=Oo.get(t);if(o===void 0)return;let{listeners:n}=o;n.delete(e),n.size===0&&(Oo.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function Kx(t,e){return Fo(t,(o,n)=>{let[r,l]=o;r<0&&-r>Math.abs(l)&&e(r,n)})}function Jx(t,e){return Fo(t,(o,n)=>{let[r,l]=o;r>0&&r>Math.abs(l)&&e(r,n)})}function Xx(t,e){return Fo(t,(o,n)=>{let[r,l]=o;l<0&&-l>Math.abs(r)&&e(r,n)})}function Yx(t,e){return Fo(t,(o,n)=>{let[r,l]=o;l>0&&l>Math.abs(r)&&e(r,n)})}import{c as Zx}from"react/compiler-runtime";import{jsx as qx}from"react/jsx-runtime";import"react";var Qx=()=>{let t=Zx(2),{EditButton:e}=xe(),o;return t[0]!==e?(o=e?qx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as eC}from"react/compiler-runtime";import{jsx as tC}from"react/jsx-runtime";import"react";var oC=()=>{let t=eC(2),{RemoveButton:e}=xe(),o;return t[0]!==e?(o=e?tC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as nC}from"react/compiler-runtime";import{jsx as rC}from"react/jsx-runtime";import"react";var lC=()=>{let t=nC(2),{Label:e}=xe(),o;return t[0]!==e?(o=e?rC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as iC}from"react/compiler-runtime";import{jsx as sC}from"react/jsx-runtime";import"react";var aC=t=>{let e=iC(3),{children:o}=t,{InlineBlockContainer:n}=xe(),r;return e[0]!==n||e[1]!==o?(r=n?sC(n,{children:o}):null,e[0]=n,e[1]=o,e[2]=r):r=e[2],r};import{jsx as cC}from"react/jsx-runtime";import"react";var uC=t=>{let{children:e,...o}=t,{BlockCollapsible:n}=ae();return n?cC(n,{...o,children:e}):null};import{c as dC}from"react/compiler-runtime";import{jsx as mC}from"react/jsx-runtime";import"react";var pC=()=>{let t=dC(2),{EditButton:e}=ae(),o;return t[0]!==e?(o=e?mC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as fC}from"react/compiler-runtime";import{jsx as hC}from"react/jsx-runtime";import"react";var gC=()=>{let t=fC(2),{RemoveButton:e}=ae(),o;return t[0]!==e?(o=e?hC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as xC}from"qs-esm";var CC=({apiURL:t,depth:e,draft:o,locale:n})=>async({id:l,collectionSlug:s,select:i})=>{let c=xC({depth:e??0,draft:o??!1,locale:n,select:i},{addQueryPrefix:!0});return await fetch(`${t}/${s}/${l}${c}`,{credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json"},method:"GET"}).then(d=>d.json())};var Wc={customEndRegex:{optional:!0,regExp:/[ \t]*```$/},customStartRegex:/^[ \t]*```(\w+)?/,doNotTrimChildren:!0,export:({fields:t})=>!t.code.includes(`
60
60
  `)&&!t.language?.length?"```"+t.code+"```":"```"+(t.language||"")+(t.code?`
61
61
  `+t.code:"")+"\n```",import:({children:t,closeMatch:e,openMatch:o})=>{let n=o?.[1];return t.startsWith(`
62
62
  `)&&(t=t.slice(1)),t.endsWith(`
@@ -1 +1 @@
1
- {"version":3,"file":"ContentEditable.d.ts","sourceRoot":"","sources":["../../../src/lexical/ui/ContentEditable.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAOhC,OAAO,uBAAuB,CAAA;AAI9B,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAA;AAIrE,wBAAgB,sBAAsB,CAAC,EACrC,SAAS,EACT,YAAY,EACZ,cAAc,GACf,EAAE;IACD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,YAAY,EAAE,2BAA2B,CAAA;IACzC,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB,GAAG,GAAG,CAAC,OAAO,CAmBd"}
1
+ {"version":3,"file":"ContentEditable.d.ts","sourceRoot":"","sources":["../../../src/lexical/ui/ContentEditable.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,OAAO,CAAA;AAQhC,OAAO,uBAAuB,CAAA;AAI9B,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAA;AAIrE,wBAAgB,sBAAsB,CAAC,EACrC,SAAS,EACT,YAAY,EACZ,cAAc,GACf,EAAE;IACD,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,YAAY,EAAE,2BAA2B,CAAA;IACzC,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB,GAAG,GAAG,CAAC,OAAO,CAwBd"}
@@ -4,13 +4,14 @@ import { c as _c } from "react/compiler-runtime";
4
4
  import { jsx as _jsx } from "react/jsx-runtime";
5
5
  import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
6
6
  import { ContentEditable } from '@lexical/react/LexicalContentEditable.js';
7
+ import { useLexicalEditable } from '@lexical/react/useLexicalEditable';
7
8
  import { getTranslation } from '@payloadcms/translations';
8
9
  import { useTranslation } from '@payloadcms/ui';
9
10
  import './ContentEditable.css';
10
11
  import * as React from 'react';
11
12
  import { useEditorConfigContext } from '../config/client/EditorConfigProvider.js';
12
13
  export function LexicalContentEditable(t0) {
13
- const $ = _c(9);
14
+ const $ = _c(10);
14
15
  const {
15
16
  className,
16
17
  editorConfig,
@@ -27,18 +28,23 @@ export function LexicalContentEditable(t0) {
27
28
  const {
28
29
  getTheme
29
30
  } = t1;
31
+ const isEditable = useLexicalEditable();
30
32
  let t2;
31
- if ($[0] !== className || $[1] !== editorConfig?.admin?.placeholder || $[2] !== fieldProps.field.label || $[3] !== fieldProps.field.required || $[4] !== getTheme || $[5] !== i18n || $[6] !== instructionsID || $[7] !== t) {
33
+ if ($[0] !== className || $[1] !== editorConfig?.admin?.placeholder || $[2] !== fieldProps.field.label || $[3] !== fieldProps.field.required || $[4] !== getTheme || $[5] !== i18n || $[6] !== instructionsID || $[7] !== isEditable || $[8] !== t) {
32
34
  const theme = getTheme();
33
35
  t2 = _jsx(ContentEditable, {
34
36
  "aria-describedby": instructionsID,
35
37
  "aria-label": getTranslation(fieldProps.field.label || "", i18n),
36
- "aria-placeholder": t("lexical:general:placeholder"),
37
38
  "aria-required": fieldProps.field.required || undefined,
38
39
  className: className ?? "ContentEditable__root",
39
- placeholder: _jsx("p", {
40
- className: theme?.placeholder,
41
- children: editorConfig?.admin?.placeholder ?? t("lexical:general:placeholder")
40
+ ...(isEditable ? {
41
+ "aria-placeholder": t("lexical:general:placeholder"),
42
+ placeholder: _jsx("p", {
43
+ className: theme?.placeholder,
44
+ children: editorConfig?.admin?.placeholder ?? t("lexical:general:placeholder")
45
+ })
46
+ } : {
47
+ placeholder: null
42
48
  })
43
49
  });
44
50
  $[0] = className;
@@ -48,10 +54,11 @@ export function LexicalContentEditable(t0) {
48
54
  $[4] = getTheme;
49
55
  $[5] = i18n;
50
56
  $[6] = instructionsID;
51
- $[7] = t;
52
- $[8] = t2;
57
+ $[7] = isEditable;
58
+ $[8] = t;
59
+ $[9] = t2;
53
60
  } else {
54
- t2 = $[8];
61
+ t2 = $[9];
55
62
  }
56
63
  return t2;
57
64
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ContentEditable.js","names":["c","_c","useLexicalComposerContext","ContentEditable","getTranslation","useTranslation","React","useEditorConfigContext","LexicalContentEditable","t0","$","className","editorConfig","instructionsID","fieldProps","i18n","t","t1","getTheme","t2","admin","placeholder","field","label","required","theme","_jsx","undefined","children"],"sources":["../../../src/lexical/ui/ContentEditable.tsx"],"sourcesContent":["'use client'\nimport type { JSX } from 'react'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { ContentEditable } from '@lexical/react/LexicalContentEditable.js'\nimport { getTranslation } from '@payloadcms/translations'\nimport { useTranslation } from '@payloadcms/ui'\n\nimport './ContentEditable.css'\n\nimport * as React from 'react'\n\nimport type { SanitizedClientEditorConfig } from '../config/types.js'\n\nimport { useEditorConfigContext } from '../config/client/EditorConfigProvider.js'\n\nexport function LexicalContentEditable({\n className,\n editorConfig,\n instructionsID,\n}: {\n className?: string\n editorConfig: SanitizedClientEditorConfig\n instructionsID?: string\n}): JSX.Element {\n const { fieldProps } = useEditorConfigContext()\n const { i18n, t } = useTranslation<{}, string>()\n const [_, { getTheme }] = useLexicalComposerContext()\n const theme = getTheme()\n return (\n <ContentEditable\n aria-describedby={instructionsID}\n aria-label={getTranslation(fieldProps.field.label || '', i18n)}\n aria-placeholder={t('lexical:general:placeholder')}\n aria-required={fieldProps.field.required || undefined}\n className={className ?? 'ContentEditable__root'}\n placeholder={\n <p className={theme?.placeholder}>\n {editorConfig?.admin?.placeholder ?? t('lexical:general:placeholder')}\n </p>\n }\n />\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,eAAe,QAAQ;AAChC,SAASC,cAAc,QAAQ;AAC/B,SAASC,cAAc,QAAQ;AAE/B,OAAO;AAEP,YAAYC,KAAA,MAAW;AAIvB,SAASC,sBAAsB,QAAQ;AAEvC,OAAO,SAAAC,uBAAAC,EAAA;EAAA,MAAAC,CAAA,GAAAT,EAAA;EAAgC;IAAAU,SAAA;IAAAC,YAAA;IAAAC;EAAA,IAAAJ,EAQtC;EACC;IAAAK;EAAA,IAAuBP,sBAAA;EACvB;IAAAQ,IAAA;IAAAC;EAAA,IAAoBX,cAAA;EACpB,SAAAY,EAAA,IAA0Bf,yBAAA;EAAhB;IAAAgB;EAAA,IAAAD,EAAY;EAAA,IAAAE,EAAA;EAAA,IAAAT,CAAA,QAAAC,SAAA,IAAAD,CAAA,QAAAE,YAAA,EAAAQ,KAAA,EAAAC,WAAA,IAAAX,CAAA,QAAAI,UAAA,CAAAQ,KAAA,CAAAC,KAAA,IAAAb,CAAA,QAAAI,UAAA,CAAAQ,KAAA,CAAAE,QAAA,IAAAd,CAAA,QAAAQ,QAAA,IAAAR,CAAA,QAAAK,IAAA,IAAAL,CAAA,QAAAG,cAAA,IAAAH,CAAA,QAAAM,CAAA;IACtB,MAAAS,KAAA,GAAcP,QAAA;IAEZC,EAAA,GAAAO,IAAA,CAAAvB,eAAA;MAAA,oBACoBU,cAAA;MAAA,cACNT,cAAA,CAAeU,UAAA,CAAAQ,KAAA,CAAAC,KAAA,IAA0B,IAAIR,IAAA;MAAA,oBACvCC,CAAA,CAAE;MAAA,iBACLF,UAAA,CAAAQ,KAAA,CAAAE,QAAA,IAAAG,SAA6B;MAAAhB,SAAA,EACjCA,SAAA,IAAa;MAAAU,WAAA,EAEtBK,IAAA,CAAC;QAAAf,SAAA,EAAac,KAAA,EAAAJ,WAAA;QAAAO,QAAA,EACXhB,YAAA,EAAAQ,KAAA,EAAAC,WAAA,IAAoCL,CAAA,CAAE;MAAA,C;;;;;;;;;;;;;;SAR7CG,E","ignoreList":[]}
1
+ {"version":3,"file":"ContentEditable.js","names":["c","_c","useLexicalComposerContext","ContentEditable","useLexicalEditable","getTranslation","useTranslation","React","useEditorConfigContext","LexicalContentEditable","t0","$","className","editorConfig","instructionsID","fieldProps","i18n","t","t1","getTheme","isEditable","t2","admin","placeholder","field","label","required","theme","_jsx","undefined","children"],"sources":["../../../src/lexical/ui/ContentEditable.tsx"],"sourcesContent":["'use client'\nimport type { JSX } from 'react'\n\nimport { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'\nimport { ContentEditable } from '@lexical/react/LexicalContentEditable.js'\nimport { useLexicalEditable } from '@lexical/react/useLexicalEditable'\nimport { getTranslation } from '@payloadcms/translations'\nimport { useTranslation } from '@payloadcms/ui'\n\nimport './ContentEditable.css'\n\nimport * as React from 'react'\n\nimport type { SanitizedClientEditorConfig } from '../config/types.js'\n\nimport { useEditorConfigContext } from '../config/client/EditorConfigProvider.js'\n\nexport function LexicalContentEditable({\n className,\n editorConfig,\n instructionsID,\n}: {\n className?: string\n editorConfig: SanitizedClientEditorConfig\n instructionsID?: string\n}): JSX.Element {\n const { fieldProps } = useEditorConfigContext()\n const { i18n, t } = useTranslation<{}, string>()\n const [_, { getTheme }] = useLexicalComposerContext()\n const isEditable = useLexicalEditable()\n const theme = getTheme()\n return (\n <ContentEditable\n aria-describedby={instructionsID}\n aria-label={getTranslation(fieldProps.field.label || '', i18n)}\n aria-required={fieldProps.field.required || undefined}\n className={className ?? 'ContentEditable__root'}\n {...(isEditable\n ? {\n 'aria-placeholder': t('lexical:general:placeholder'),\n placeholder: (\n <p className={theme?.placeholder}>\n {editorConfig?.admin?.placeholder ?? t('lexical:general:placeholder')}\n </p>\n ),\n }\n : { placeholder: null })}\n />\n )\n}\n"],"mappings":"AAAA;;AAAA,SAAAA,CAAA,IAAAC,EAAA;;AAGA,SAASC,yBAAyB,QAAQ;AAC1C,SAASC,eAAe,QAAQ;AAChC,SAASC,kBAAkB,QAAQ;AACnC,SAASC,cAAc,QAAQ;AAC/B,SAASC,cAAc,QAAQ;AAE/B,OAAO;AAEP,YAAYC,KAAA,MAAW;AAIvB,SAASC,sBAAsB,QAAQ;AAEvC,OAAO,SAAAC,uBAAAC,EAAA;EAAA,MAAAC,CAAA,GAAAV,EAAA;EAAgC;IAAAW,SAAA;IAAAC,YAAA;IAAAC;EAAA,IAAAJ,EAQtC;EACC;IAAAK;EAAA,IAAuBP,sBAAA;EACvB;IAAAQ,IAAA;IAAAC;EAAA,IAAoBX,cAAA;EACpB,SAAAY,EAAA,IAA0BhB,yBAAA;EAAhB;IAAAiB;EAAA,IAAAD,EAAY;EACtB,MAAAE,UAAA,GAAmBhB,kBAAA;EAAA,IAAAiB,EAAA;EAAA,IAAAV,CAAA,QAAAC,SAAA,IAAAD,CAAA,QAAAE,YAAA,EAAAS,KAAA,EAAAC,WAAA,IAAAZ,CAAA,QAAAI,UAAA,CAAAS,KAAA,CAAAC,KAAA,IAAAd,CAAA,QAAAI,UAAA,CAAAS,KAAA,CAAAE,QAAA,IAAAf,CAAA,QAAAQ,QAAA,IAAAR,CAAA,QAAAK,IAAA,IAAAL,CAAA,QAAAG,cAAA,IAAAH,CAAA,QAAAS,UAAA,IAAAT,CAAA,QAAAM,CAAA;IACnB,MAAAU,KAAA,GAAcR,QAAA;IAEZE,EAAA,GAAAO,IAAA,CAAAzB,eAAA;MAAA,oBACoBW,cAAA;MAAA,cACNT,cAAA,CAAeU,UAAA,CAAAS,KAAA,CAAAC,KAAA,IAA0B,IAAIT,IAAA;MAAA,iBAC1CD,UAAA,CAAAS,KAAA,CAAAE,QAAA,IAAAG,SAA6B;MAAAjB,SAAA,EACjCA,SAAA,IAAa;MAAA,IACnBQ,UAAA;QAAA,oBAEqBH,CAAA,CAAE;QAAAM,WAAA,EAEpBK,IAAA,CAAC;UAAAhB,SAAA,EAAae,KAAA,EAAAJ,WAAA;UAAAO,QAAA,EACXjB,YAAA,EAAAS,KAAA,EAAAC,WAAA,IAAoCN,CAAA,CAAE;QAAA,C;;;OAIxB;IAAA,C;;;;;;;;;;;;;;SAd3BI,E","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/richtext-lexical",
3
- "version": "4.0.0-beta.1",
3
+ "version": "4.0.0-beta.2",
4
4
  "description": "The officially supported Lexical richtext adapter for Payload",
5
5
  "homepage": "https://payloadcms.com",
6
6
  "repository": {
@@ -443,8 +443,8 @@
443
443
  "react-error-boundary": "6.1.1",
444
444
  "ts-essentials": "10.0.3",
445
445
  "uuid": "14.0.0",
446
- "@payloadcms/translations": "4.0.0-beta.1",
447
- "@payloadcms/ui": "4.0.0-beta.1"
446
+ "@payloadcms/translations": "4.0.0-beta.2",
447
+ "@payloadcms/ui": "4.0.0-beta.2"
448
448
  },
449
449
  "devDependencies": {
450
450
  "@babel/cli": "7.27.2",
@@ -463,15 +463,15 @@
463
463
  "esbuild": "0.27.1",
464
464
  "esbuild-sass-plugin": "3.3.1",
465
465
  "swc-plugin-transform-remove-imports": "8.3.0",
466
- "@payloadcms/eslint-config": "3.28.0",
467
- "payload": "4.0.0-beta.1"
466
+ "payload": "4.0.0-beta.2",
467
+ "@payloadcms/eslint-config": "3.28.0"
468
468
  },
469
469
  "peerDependencies": {
470
470
  "@faceless-ui/modal": "3.0.2",
471
471
  "@faceless-ui/scroll-info": "2.0.0",
472
472
  "react": "^19.0.1 || ^19.1.2 || ^19.2.1",
473
473
  "react-dom": "^19.0.1 || ^19.1.2 || ^19.2.1",
474
- "payload": "4.0.0-beta.1"
474
+ "payload": "4.0.0-beta.2"
475
475
  },
476
476
  "engines": {
477
477
  "node": ">=24.15.0"