@payloadcms/richtext-lexical 3.62.0-canary.5 → 3.62.0-internal.7fb5145

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.
@@ -57,7 +57,7 @@ ${e.map(Zu).join(`
57
57
 
58
58
  `,as="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",cs="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",r0=new RegExp("^[^"+cs+"]*["+as+"]"),n0=new RegExp("^[^"+as+"]*["+cs+"]"),l0={bold:F.IS_BOLD,code:F.IS_CODE,highlight:F.IS_HIGHLIGHT,italic:F.IS_ITALIC,strikethrough:F.IS_STRIKETHROUGH,subscript:F.IS_SUBSCRIPT,superscript:F.IS_SUPERSCRIPT,underline:F.IS_UNDERLINE},i0={directionless:F.IS_DIRECTIONLESS,unmergeable:F.IS_UNMERGEABLE},s0={center:F.IS_ALIGN_CENTER,end:F.IS_ALIGN_END,justify:F.IS_ALIGN_JUSTIFY,left:F.IS_ALIGN_LEFT,right:F.IS_ALIGN_RIGHT,start:F.IS_ALIGN_START},a0={[F.IS_ALIGN_CENTER]:"center",[F.IS_ALIGN_END]:"end",[F.IS_ALIGN_JUSTIFY]:"justify",[F.IS_ALIGN_LEFT]:"left",[F.IS_ALIGN_RIGHT]:"right",[F.IS_ALIGN_START]:"start"},c0={normal:F.IS_NORMAL,segmented:F.IS_SEGMENTED,token:F.IS_TOKEN},u0={[F.IS_NORMAL]:"normal",[F.IS_SEGMENTED]:"segmented",[F.IS_TOKEN]:"token"};var us={text:({node:t})=>{let e=t.text;return t.format&F.IS_BOLD&&(e=Pe("strong",{children:e})),t.format&F.IS_ITALIC&&(e=Pe("em",{children:e})),t.format&F.IS_STRIKETHROUGH&&(e=Pe("span",{style:{textDecoration:"line-through"},children:e})),t.format&F.IS_UNDERLINE&&(e=Pe("span",{style:{textDecoration:"underline"},children:e})),t.format&F.IS_CODE&&(e=Pe("code",{children:e})),t.format&F.IS_SUBSCRIPT&&(e=Pe("sub",{children:e})),t.format&F.IS_SUPERSCRIPT&&(e=Pe("sup",{children:e})),e}};import{jsx as Rt}from"react/jsx-runtime";var ds={upload:({node:t})=>{let e=t;if(typeof e.value!="object")return null;let o=e.value,r=o.url;if(!o.mimeType.startsWith("image"))return Rt("a",{href:r,rel:"noopener noreferrer",children:o.filename});if(!o.sizes||!Object.keys(o.sizes).length)return Rt("img",{alt:o.filename,height:o.height,src:r,width:o.width});let n=[];for(let l in o.sizes){let i=o.sizes[l];if(!i||!i.width||!i.height||!i.mimeType||!i.filesize||!i.filename||!i.url)continue;let s=i?.url;n.push(Rt("source",{media:`(max-width: ${i.width}px)`,srcSet:s,type:i.mimeType},l))}return n.push(Rt("img",{alt:o?.filename,height:o?.height,src:r,width:o?.width},"image")),Rt("picture",{children:n})}};var ot={...ls,...us,...ts,...qi,...ss,...Qi,...es,...ns,...rs({}),...ds,...is};import{jsx as ps,Fragment as d0}from"react/jsx-runtime";import br from"react";function ms(t){let e=!!t?.root?.children?.length,o=!1;if(t?.root?.children?.length===1&&t?.root?.children[0]?.type==="paragraph"){let r=t?.root?.children[0];if(!r?.children||r?.children?.length===0)o=!0;else if(r?.children?.length===1){let n=r?.children[0];n?.type==="text"&&(n?.text?.length||(o=!0))}}return!(!e||o)}function fs({converters:t,data:e,disableIndent:o,disableTextAlign:r}){return ms(e)?hs({converters:t,disableIndent:o,disableTextAlign:r,nodes:e?.root?.children,parent:e?.root}):ps(d0,{})}function hs({converters:t,disableIndent:e,disableTextAlign:o,nodes:r,parent:n}){let l=t.unknown;return r.map((s,d)=>{let c;s.type==="block"?(c=t?.blocks?.[s?.fields?.blockType],!c&&!l&&console.error(`Lexical => JSX converter: Blocks converter: found ${s?.fields?.blockType} block, but no converter is provided`)):s.type==="inlineBlock"?(c=t?.inlineBlocks?.[s?.fields?.blockType],!c&&!l&&console.error(`Lexical => JSX converter: Inline Blocks converter: found ${s?.fields?.blockType} inline block, but no converter is provided`)):c=t[s.type];try{!c&&l&&(c=l);let u;c?u=typeof c=="function"?c({childIndex:d,converters:t,node:s,nodesToJSX:p=>hs({converters:p.converters??t,disableIndent:p.disableIndent??e,disableTextAlign:p.disableTextAlign??o,nodes:p.nodes,parent:p.parent??{...s,parent:n}}),parent:n}):c:u=ps("span",{children:"unknown node"},d);let a={};if(!o&&(!Array.isArray(o)||!o?.includes(s.type))&&"format"in s&&s.format)switch(s.format){case"center":a.textAlign="center";break;case"end":a.textAlign="right";break;case"justify":a.textAlign="justify";break;case"left":break;case"right":a.textAlign="right";break;case"start":a.textAlign="left";break}if(!e&&(!Array.isArray(e)||!e?.includes(s.type))&&"indent"in s&&s.indent&&s.type!=="listitem"&&(a.paddingInlineStart=`${Number(s.indent)*40}px`),br.isValidElement(u)){if(a.textAlign||a.paddingInlineStart){let m={...a,...u?.props?.style??{}};return br.cloneElement(u,{key:d,style:m})}return br.cloneElement(u,{key:d})}return u}catch(u){return console.error("Error converting lexical node to JSX:",u,"node:",s),null}}).filter(Boolean)}var kr=({className:t,converters:e,data:o,disableContainer:r,disableIndent:n,disableTextAlign:l})=>{if(!o)return null;let i={};e?typeof e=="function"?i=e({defaultConverters:ot}):i=e:i=ot;let s=o&&!Array.isArray(o)&&typeof o=="object"&&"root"in o&&fs({converters:i,data:o,disableIndent:n,disableTextAlign:l});return r?gs(m0,{children:s}):gs("div",{className:t??"payload-richtext",children:s})};function Cs(){let t=p0(7),[e]=f0(),o;t[0]!==e?(o=e.getEditorState().toJSON(),t[0]=e,t[1]=o):o=t[1];let[r,n]=g0(o),l,i;t[2]!==e?(l=()=>e.registerUpdateListener(d=>{let{editorState:c}=d;n(c.toJSON())}),i=[e],t[2]=e,t[3]=l,t[4]=i):(l=t[3],i=t[4]),h0(l,i);let s;return t[5]!==r?(s=xs("div",{className:"debug-jsx-converter",children:xs(kr,{converters:ot,data:r})}),t[5]=r,t[6]=s):s=t[6],s}var x0=$({plugins:[{Component:Cs,position:"bottom"}]});var B={amber:{50:"oklch(0.987 0.022 95.277)",100:"oklch(0.962 0.059 95.617)",200:"oklch(0.924 0.12 95.746)",300:"oklch(0.879 0.169 91.605)",400:"oklch(0.828 0.189 84.429)",500:"oklch(0.769 0.188 70.08)",600:"oklch(0.666 0.179 58.318)",700:"oklch(0.555 0.163 48.998)",800:"oklch(0.473 0.137 46.201)",900:"oklch(0.414 0.112 45.904)",950:"oklch(0.279 0.077 45.635)"},black:"#000",blue:{50:"oklch(0.97 0.014 254.604)",100:"oklch(0.932 0.032 255.585)",200:"oklch(0.882 0.059 254.128)",300:"oklch(0.809 0.105 251.813)",400:"oklch(0.707 0.165 254.624)",500:"oklch(0.623 0.214 259.815)",600:"oklch(0.546 0.245 262.881)",700:"oklch(0.488 0.243 264.376)",800:"oklch(0.424 0.199 265.638)",900:"oklch(0.379 0.146 265.522)",950:"oklch(0.282 0.091 267.935)"},current:"currentColor",cyan:{50:"oklch(0.984 0.019 200.873)",100:"oklch(0.956 0.045 203.388)",200:"oklch(0.917 0.08 205.041)",300:"oklch(0.865 0.127 207.078)",400:"oklch(0.789 0.154 211.53)",500:"oklch(0.715 0.143 215.221)",600:"oklch(0.609 0.126 221.723)",700:"oklch(0.52 0.105 223.128)",800:"oklch(0.45 0.085 224.283)",900:"oklch(0.398 0.07 227.392)",950:"oklch(0.302 0.056 229.695)"},emerald:{50:"oklch(0.979 0.021 166.113)",100:"oklch(0.95 0.052 163.051)",200:"oklch(0.905 0.093 164.15)",300:"oklch(0.845 0.143 164.978)",400:"oklch(0.765 0.177 163.223)",500:"oklch(0.696 0.17 162.48)",600:"oklch(0.596 0.145 163.225)",700:"oklch(0.508 0.118 165.612)",800:"oklch(0.432 0.095 166.913)",900:"oklch(0.378 0.077 168.94)",950:"oklch(0.262 0.051 172.552)"},fuchsia:{50:"oklch(0.977 0.017 320.058)",100:"oklch(0.952 0.037 318.852)",200:"oklch(0.903 0.076 319.62)",300:"oklch(0.833 0.145 321.434)",400:"oklch(0.74 0.238 322.16)",500:"oklch(0.667 0.295 322.15)",600:"oklch(0.591 0.293 322.896)",700:"oklch(0.518 0.253 323.949)",800:"oklch(0.452 0.211 324.591)",900:"oklch(0.401 0.17 325.612)",950:"oklch(0.293 0.136 325.661)"},gray:{50:"oklch(0.985 0.002 247.839)",100:"oklch(0.967 0.003 264.542)",200:"oklch(0.928 0.006 264.531)",300:"oklch(0.872 0.01 258.338)",400:"oklch(0.707 0.022 261.325)",500:"oklch(0.551 0.027 264.364)",600:"oklch(0.446 0.03 256.802)",700:"oklch(0.373 0.034 259.733)",800:"oklch(0.278 0.033 256.848)",900:"oklch(0.21 0.034 264.665)",950:"oklch(0.13 0.028 261.692)"},green:{50:"oklch(0.982 0.018 155.826)",100:"oklch(0.962 0.044 156.743)",200:"oklch(0.925 0.084 155.995)",300:"oklch(0.871 0.15 154.449)",400:"oklch(0.792 0.209 151.711)",500:"oklch(0.723 0.219 149.579)",600:"oklch(0.627 0.194 149.214)",700:"oklch(0.527 0.154 150.069)",800:"oklch(0.448 0.119 151.328)",900:"oklch(0.393 0.095 152.535)",950:"oklch(0.266 0.065 152.934)"},indigo:{50:"oklch(0.962 0.018 272.314)",100:"oklch(0.93 0.034 272.788)",200:"oklch(0.87 0.065 274.039)",300:"oklch(0.785 0.115 274.713)",400:"oklch(0.673 0.182 276.935)",500:"oklch(0.585 0.233 277.117)",600:"oklch(0.511 0.262 276.966)",700:"oklch(0.457 0.24 277.023)",800:"oklch(0.398 0.195 277.366)",900:"oklch(0.359 0.144 278.697)",950:"oklch(0.257 0.09 281.288)"},inherit:"inherit",lime:{50:"oklch(0.986 0.031 120.757)",100:"oklch(0.967 0.067 122.328)",200:"oklch(0.938 0.127 124.321)",300:"oklch(0.897 0.196 126.665)",400:"oklch(0.841 0.238 128.85)",500:"oklch(0.768 0.233 130.85)",600:"oklch(0.648 0.2 131.684)",700:"oklch(0.532 0.157 131.589)",800:"oklch(0.453 0.124 130.933)",900:"oklch(0.405 0.101 131.063)",950:"oklch(0.274 0.072 132.109)"},neutral:{50:"oklch(0.985 0 0)",100:"oklch(0.97 0 0)",200:"oklch(0.922 0 0)",300:"oklch(0.87 0 0)",400:"oklch(0.708 0 0)",500:"oklch(0.556 0 0)",600:"oklch(0.439 0 0)",700:"oklch(0.371 0 0)",800:"oklch(0.269 0 0)",900:"oklch(0.205 0 0)",950:"oklch(0.145 0 0)"},orange:{50:"oklch(0.98 0.016 73.684)",100:"oklch(0.954 0.038 75.164)",200:"oklch(0.901 0.076 70.697)",300:"oklch(0.837 0.128 66.29)",400:"oklch(0.75 0.183 55.934)",500:"oklch(0.705 0.213 47.604)",600:"oklch(0.646 0.222 41.116)",700:"oklch(0.553 0.195 38.402)",800:"oklch(0.47 0.157 37.304)",900:"oklch(0.408 0.123 38.172)",950:"oklch(0.266 0.079 36.259)"},pink:{50:"oklch(0.971 0.014 343.198)",100:"oklch(0.948 0.028 342.258)",200:"oklch(0.899 0.061 343.231)",300:"oklch(0.823 0.12 346.018)",400:"oklch(0.718 0.202 349.761)",500:"oklch(0.656 0.241 354.308)",600:"oklch(0.592 0.249 0.584)",700:"oklch(0.525 0.223 3.958)",800:"oklch(0.459 0.187 3.815)",900:"oklch(0.408 0.153 2.432)",950:"oklch(0.284 0.109 3.907)"},purple:{50:"oklch(0.977 0.014 308.299)",100:"oklch(0.946 0.033 307.174)",200:"oklch(0.902 0.063 306.703)",300:"oklch(0.827 0.119 306.383)",400:"oklch(0.714 0.203 305.504)",500:"oklch(0.627 0.265 303.9)",600:"oklch(0.558 0.288 302.321)",700:"oklch(0.496 0.265 301.924)",800:"oklch(0.438 0.218 303.724)",900:"oklch(0.381 0.176 304.987)",950:"oklch(0.291 0.149 302.717)"},red:{50:"oklch(0.971 0.013 17.38)",100:"oklch(0.936 0.032 17.717)",200:"oklch(0.885 0.062 18.334)",300:"oklch(0.808 0.114 19.571)",400:"oklch(0.704 0.191 22.216)",500:"oklch(0.637 0.237 25.331)",600:"oklch(0.577 0.245 27.325)",700:"oklch(0.505 0.213 27.518)",800:"oklch(0.444 0.177 26.899)",900:"oklch(0.396 0.141 25.723)",950:"oklch(0.258 0.092 26.042)"},rose:{50:"oklch(0.969 0.015 12.422)",100:"oklch(0.941 0.03 12.58)",200:"oklch(0.892 0.058 10.001)",300:"oklch(0.81 0.117 11.638)",400:"oklch(0.712 0.194 13.428)",500:"oklch(0.645 0.246 16.439)",600:"oklch(0.586 0.253 17.585)",700:"oklch(0.514 0.222 16.935)",800:"oklch(0.455 0.188 13.697)",900:"oklch(0.41 0.159 10.272)",950:"oklch(0.271 0.105 12.094)"},sky:{50:"oklch(0.977 0.013 236.62)",100:"oklch(0.951 0.026 236.824)",200:"oklch(0.901 0.058 230.902)",300:"oklch(0.828 0.111 230.318)",400:"oklch(0.746 0.16 232.661)",500:"oklch(0.685 0.169 237.323)",600:"oklch(0.588 0.158 241.966)",700:"oklch(0.5 0.134 242.749)",800:"oklch(0.443 0.11 240.79)",900:"oklch(0.391 0.09 240.876)",950:"oklch(0.293 0.066 243.157)"},slate:{50:"oklch(0.984 0.003 247.858)",100:"oklch(0.968 0.007 247.896)",200:"oklch(0.929 0.013 255.508)",300:"oklch(0.869 0.022 252.894)",400:"oklch(0.704 0.04 256.788)",500:"oklch(0.554 0.046 257.417)",600:"oklch(0.446 0.043 257.281)",700:"oklch(0.372 0.044 257.287)",800:"oklch(0.279 0.041 260.031)",900:"oklch(0.208 0.042 265.755)",950:"oklch(0.129 0.042 264.695)"},stone:{50:"oklch(0.985 0.001 106.423)",100:"oklch(0.97 0.001 106.424)",200:"oklch(0.923 0.003 48.717)",300:"oklch(0.869 0.005 56.366)",400:"oklch(0.709 0.01 56.259)",500:"oklch(0.553 0.013 58.071)",600:"oklch(0.444 0.011 73.639)",700:"oklch(0.374 0.01 67.558)",800:"oklch(0.268 0.007 34.298)",900:"oklch(0.216 0.006 56.043)",950:"oklch(0.147 0.004 49.25)"},teal:{50:"oklch(0.984 0.014 180.72)",100:"oklch(0.953 0.051 180.801)",200:"oklch(0.91 0.096 180.426)",300:"oklch(0.855 0.138 181.071)",400:"oklch(0.777 0.152 181.912)",500:"oklch(0.704 0.14 182.503)",600:"oklch(0.6 0.118 184.704)",700:"oklch(0.511 0.096 186.391)",800:"oklch(0.437 0.078 188.216)",900:"oklch(0.386 0.063 188.416)",950:"oklch(0.277 0.046 192.524)"},transparent:"transparent",violet:{50:"oklch(0.969 0.016 293.756)",100:"oklch(0.943 0.029 294.588)",200:"oklch(0.894 0.057 293.283)",300:"oklch(0.811 0.111 293.571)",400:"oklch(0.702 0.183 293.541)",500:"oklch(0.606 0.25 292.717)",600:"oklch(0.541 0.281 293.009)",700:"oklch(0.491 0.27 292.581)",800:"oklch(0.432 0.232 292.759)",900:"oklch(0.38 0.189 293.745)",950:"oklch(0.283 0.141 291.089)"},white:"#fff",yellow:{50:"oklch(0.987 0.026 102.212)",100:"oklch(0.973 0.071 103.193)",200:"oklch(0.945 0.129 101.54)",300:"oklch(0.905 0.182 98.111)",400:"oklch(0.852 0.199 91.936)",500:"oklch(0.795 0.184 86.047)",600:"oklch(0.681 0.162 75.834)",700:"oklch(0.554 0.135 66.442)",800:"oklch(0.476 0.114 61.907)",900:"oklch(0.421 0.095 57.708)",950:"oklch(0.286 0.066 53.813)"},zinc:{50:"oklch(0.985 0 0)",100:"oklch(0.967 0.001 286.375)",200:"oklch(0.92 0.004 286.32)",300:"oklch(0.871 0.006 286.286)",400:"oklch(0.705 0.015 286.067)",500:"oklch(0.552 0.016 285.938)",600:"oklch(0.442 0.017 285.786)",700:"oklch(0.37 0.013 285.805)",800:"oklch(0.274 0.006 286.033)",900:"oklch(0.21 0.006 285.885)",950:"oklch(0.141 0.005 285.823)"}},C0={text:{"text-red":{css:{color:`light-dark(${B.red[600]}, ${B.red[400]})`},label:"Red"},"text-orange":{css:{color:`light-dark(${B.orange[600]}, ${B.orange[400]})`},label:"Orange"},"text-yellow":{css:{color:`light-dark(${B.yellow[700]}, ${B.yellow[300]})`},label:"Yellow"},"text-green":{css:{color:`light-dark(${B.green[700]}, ${B.green[400]})`},label:"Green"},"text-blue":{css:{color:`light-dark(${B.blue[600]}, ${B.blue[400]})`},label:"Blue"},"text-purple":{css:{color:`light-dark(${B.purple[600]}, ${B.purple[400]})`},label:"Purple"},"text-pink":{css:{color:`light-dark(${B.pink[600]}, ${B.pink[400]})`},label:"Pink"}},background:{"bg-red":{css:{"background-color":`light-dark(${B.red[400]}, ${B.red[600]})`},label:"Red"},"bg-orange":{css:{"background-color":`light-dark(${B.orange[400]}, ${B.orange[600]})`},label:"Orange"},"bg-yellow":{css:{"background-color":`light-dark(${B.yellow[300]}, ${B.yellow[700]})`},label:"Yellow"},"bg-green":{css:{"background-color":`light-dark(${B.green[400]}, ${B.green[700]})`},label:"Green"},"bg-blue":{css:{"background-color":`light-dark(${B.blue[400]}, ${B.blue[600]})`},label:"Blue"},"bg-purple":{css:{"background-color":`light-dark(${B.purple[400]}, ${B.purple[600]})`},label:"Purple"},"bg-pink":{css:{"background-color":`light-dark(${B.pink[400]}, ${B.pink[600]})`},label:"Pink"}}};import{$isNodeSelection as i1}from"lexical";import{jsx as It,jsxs as b0}from"react/jsx-runtime";import"react";var _r=()=>b0("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[It("g",{clipPath:"url(#clip0_4397_10817)",children:It("path",{d:"M7.75 12.25L15.25 4.75M15.25 4.75H11.5M15.25 4.75V8.5M13 11.5V13.75C13 14.5784 12.3284 15.25 11.5 15.25H6.25C5.42157 15.25 4.75 14.5784 4.75 13.75V8.5C4.75 7.67157 5.42157 7 6.25 7H8.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})}),It("defs",{children:It("clipPath",{id:"clip0_4397_10817",children:It("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{jsx as E0}from"react/jsx-runtime";import{$applyNodeReplacement as S0}from"lexical";import*as ks from"react";import{DecoratorBlockNode as k0}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as _0}from"@lexical/utils";import{$applyNodeReplacement as T0}from"lexical";function w0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:bs({relationTo:o,value:e})}:null}var vt=class extends k0{__data;constructor({data:e,format:o,key:r}){super(o,r),this.__data=e}static clone(e){return new this({data:e.__data,format:e.__format,key:e.__key})}static getType(){return"relationship"}static importDOM(){return{div:e=>!e.hasAttribute("data-lexical-relationship-relationTo")||!e.hasAttribute("data-lexical-relationship-id")?null:{conversion:w0,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},r=bs(o);return r.setFormat(e.format),r}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return _0(o,e?.theme?.relationship),o}decorate(e,o){return null}exportDOM(){let e=document.createElement("div");e.setAttribute("data-lexical-relationship-id",String(typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value)),e.setAttribute("data-lexical-relationship-relationTo",this.__data?.relationTo);let o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"relationship",version:2}}getData(){return this.getLatest().__data}getTextContent(){return`${this.__data?.relationTo} relation to ${typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value}`}setData(e){let o=this.getWritable();o.__data=e}};function bs(t){return T0(new vt({data:t}))}var N0=ks.lazy(()=>import("./RelationshipComponent-UCIWIEVD.js").then(t=>({default:t.RelationshipComponent})));function L0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Be({relationTo:o,value:e})}:null}var we=class extends vt{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:L0,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},r=Be(o);return r.setFormat(e.format),r}decorate(e,o){return E0(N0,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Be(t){return S0(new we({data:t}))}function Tr(t){return t instanceof we}import{c as z0}from"react/compiler-runtime";import{jsx as X0}from"react/jsx-runtime";import{useLexicalComposerContext as Z0}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Y0}from"@lexical/utils";import{$getPreviousSelection as q0,$getSelection as Q0,$isParagraphNode as e1,$isRangeSelection as t1,COMMAND_PRIORITY_EDITOR as o1,createCommand as r1}from"lexical";import{useEffect as n1}from"react";import{c as ws}from"react/compiler-runtime";import{jsx as wr}from"react/jsx-runtime";import{useLexicalComposerContext as Es}from"@lexical/react/LexicalComposerContext.js";import{toast as B0}from"@payloadcms/ui";import{$getNodeByKey as j0,COMMAND_PRIORITY_EDITOR as Ss}from"lexical";import{useEffect as Ns,useState as H0}from"react";import{c as y0}from"react/compiler-runtime";import{jsx as R0}from"react/jsx-runtime";import{useLexicalComposerContext as I0}from"@lexical/react/LexicalComposerContext";import{useListDrawer as v0,useModal as M0}from"@payloadcms/ui";import{$getNodeByKey as _s,$getPreviousSelection as D0,$getRoot as $0,$getSelection as A0,$isRangeSelection as O0,$setSelection as F0}from"lexical";import{useEffect as P0,useState as Ts}from"react";var Mt=t=>{let e=y0(23),[o]=I0(),[r,n]=Ts(null),[l,i]=Ts(!1),[s,d,c]=v0(t),{closeDrawer:u,drawerSlug:a,isDrawerOpen:m,openDrawer:p}=c,{modalState:f}=M0(),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let R=A0()??D0();n(R)},e[0]=h):h=e[0];let x=h,w;e[1]!==o||e[2]!==r?(w=()=>{r&&o.update(()=>{if(O0(r)){let{anchor:R,focus:M}=r;_s(R.key)&&_s(M.key)&&F0(r.clone())}else $0().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=r,e[3]=w):w=e[3];let E=w,N;e[4]!==u?(N=()=>{u()},e[4]=u,e[5]=N):N=e[5];let _=N,C,g;e[6]!==a||e[7]!==f||e[8]!==E||e[9]!==l?(C=()=>{if(!l)return;let R=f[a];R&&!R?.isOpen&&(i(!1),setTimeout(()=>{E()},1))},g=[f,a,E,l],e[6]=a,e[7]=f,e[8]=E,e[9]=l,e[10]=C,e[11]=g):(C=e[10],g=e[11]),P0(C,g);let b;e[12]!==d?(b=R=>R0(d,{...R,onClick:()=>{x()}}),e[12]=d,e[13]=b):b=e[13];let k;e[14]!==p?(k=()=>{x(),p(),i(!0)},e[14]=p,e[15]=k):k=e[15];let y;return e[16]!==s||e[17]!==_||e[18]!==m||e[19]!==a||e[20]!==b||e[21]!==k?(y={closeListDrawer:_,isListDrawerOpen:m,ListDrawer:s,listDrawerSlug:a,ListDrawerToggler:b,openListDrawer:k},e[16]=s,e[17]=_,e[18]=m,e[19]=a,e[20]=b,e[21]=k,e[22]=y):y=e[22],y};var U0=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=j0(o);n&&n.replace(Be({relationTo:e,value:r}))}):t.dispatchCommand(Er,{relationTo:e,value:r})},W0=t=>{let e=ws(14),{enabledCollectionSlugs:o}=t,[r]=Es(),[n,l]=H0(null),i=o?.[0],s;e[0]!==o||e[1]!==i?(s={collectionSlugs:o,selectedCollection:i},e[0]=o,e[1]=i,e[2]=s):s=e[2];let{closeListDrawer:d,ListDrawer:c,openListDrawer:u}=Mt(s),a,m;e[3]!==r||e[4]!==u?(a=()=>r.registerCommand(Ve,x=>(l(x?.replace?x?.replace.nodeKey:null),u(),!0),Ss),m=[r,u],e[3]=r,e[4]=u,e[5]=a,e[6]=m):(a=e[5],m=e[6]),Ns(a,m);let p;e[7]!==d||e[8]!==r||e[9]!==n?(p=x=>{let{collectionSlug:w,doc:E}=x;U0({editor:r,relationTo:w,replaceNodeKey:n,value:E.id}),d()},e[7]=d,e[8]=r,e[9]=n,e[10]=p):p=e[10];let f=p,h;return e[11]!==c||e[12]!==f?(h=wr(c,{onSelect:f}),e[11]=c,e[12]=f,e[13]=h):h=e[13],h},G0=()=>{let t=ws(3),[e]=Es(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Ve,V0,Ss),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Ns(o,r),null},Ls=({enabledCollectionSlugs:t})=>t?.length?wr(W0,{enabledCollectionSlugs:t}):wr(G0,{});function V0(){return B0.error("No relationship collections enabled"),!0}import{useConfig as K0,useEntityVisibility as J0}from"@payloadcms/ui";import*as ys from"react";var go=t=>{let{collectionSlugsBlacklist:e,collectionSlugsWhitelist:o,uploads:r=!1}=t||{},{config:{collections:n}}=K0(),{visibleEntities:l}=J0();return ys.useMemo(()=>{let s=[],d=[],c=o?new Set(o):null,u=e?new Set(e):null;for(let a of n){let{slug:m,admin:{enableRichTextRelationship:p},upload:f}=a;if(l?.collections.includes(m)){if(r){if(!p||!f)continue}else if(f||!p)continue;c&&!c.has(m)||u&&u.has(m)||(s.push(m),d.push(a))}}return{enabledCollections:d,enabledCollectionSlugs:s}},[n,l,r,o,e])};var Er=r1("INSERT_RELATIONSHIP_COMMAND"),Rs=t=>{let e=z0(8),{clientProps:o}=t,[r]=Z0(),n=o?.disabledCollections,l=o?.enabledCollections,i;e[0]!==n||e[1]!==l?(i={collectionSlugsBlacklist:n,collectionSlugsWhitelist:l},e[0]=n,e[1]=l,e[2]=i):i=e[2];let{enabledCollectionSlugs:s}=go(i),d,c;e[3]!==r?(d=()=>{if(!r.hasNodes([we]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return r.registerCommand(Er,l1,o1)},c=[r],e[3]=r,e[4]=d,e[5]=c):(d=e[4],c=e[5]),n1(d,c);let u;return e[6]!==s?(u=X0(Ls,{enabledCollectionSlugs:s}),e[6]=s,e[7]=u):u=e[7],u};function l1(t){let e=Q0()||q0();if(t1(e)){let o=Be(t),{focus:r}=e,n=r.getNode();Y0(o),e1(n)&&!n.__first&&n.remove()}return!0}var s1=$({nodes:[we],plugins:[{Component:Rs,position:"normal"}],slashMenu:{groups:[Y([{Icon:_r,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ve,{replace:!1})}}])]},toolbarFixed:{groups:[xe([{ChildComponent:_r,isActive:({selection:t})=>{if(!i1(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Tr(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ve,{replace:!1})}}])]}});import{c as Ps}from"react/compiler-runtime";import{jsx as se,jsxs as $1}from"react/jsx-runtime";import{useLexicalComposerContext as A1}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as Bs}from"@lexical/react/useLexicalEditable";import{useScrollInfo as O1,useThrottledEffect as F1,useTranslation as P1}from"@payloadcms/ui";import*as Ee from"react";import{useMemo as B1}from"react";import{c as a1}from"react/compiler-runtime";import{jsx as c1}from"react/jsx-runtime";import{mergeRegister as u1}from"@lexical/utils";import{$addUpdateTag as d1,$getSelection as m1}from"lexical";import{useDeferredValue as p1,useEffect as f1,useState as h1}from"react";var Is="toolbar-popup__button",Dt=t=>{let e=a1(23),{children:o,editor:r,item:n}=t,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={active:!1,enabled:!0},e[0]=l):l=e[0];let[i,s]=h1(l),d=p1(i),c=H(),u=d.enabled?"":"disabled",a=d.active?"active":"",m=n.key?`${Is}-${n.key}`:"",p;e[1]!==u||e[2]!==a||e[3]!==m?(p=[Is,u,a,m].filter(Boolean),e[1]=u,e[2]=a,e[3]=m,e[4]=p):p=e[4];let f=p.join(" "),h;e[5]!==r||e[6]!==c||e[7]!==n?(h=()=>{r.getEditorState().read(()=>{let k=m1();if(!k)return;let y=n.isActive?n.isActive({editor:r,editorConfigContext:c,selection:k}):!1,R=n.isEnabled?n.isEnabled({editor:r,editorConfigContext:c,selection:k}):!0;s(M=>M.active===y&&M.enabled===R?M:{active:y,enabled:R})})},e[5]=r,e[6]=c,e[7]=n,e[8]=h):h=e[8];let x=h,w=Vt(),E,N;e[9]!==r||e[10]!==w||e[11]!==x?(E=()=>{w(x);let k=()=>w(x),y=u1(r.registerUpdateListener(k));return document.addEventListener("mouseup",k),()=>{y(),document.removeEventListener("mouseup",k)}},N=[r,w,x],e[9]=r,e[10]=w,e[11]=x,e[12]=E,e[13]=N):(E=e[12],N=e[13]),f1(E,N);let _;e[14]!==i||e[15]!==r||e[16]!==n?(_=()=>{i.enabled&&r.focus(()=>{r.update(g1),n.onSelect?.({editor:r,isActive:i.active})})},e[14]=i,e[15]=r,e[16]=n,e[17]=_):_=e[17];let C=_,g=x1,b;return e[18]!==o||e[19]!==f||e[20]!==C||e[21]!==n.key?(b=c1("button",{className:f,"data-button-key":n.key,onClick:C,onMouseDown:g,type:"button",children:o}),e[18]=o,e[19]=f,e[20]=C,e[21]=n.key,e[22]=b):b=e[22],b};function g1(){d1("toolbar")}function x1(t){t.preventDefault()}import{c as E1}from"react/compiler-runtime";import{jsx as rt}from"react/jsx-runtime";import Fs,{useCallback as S1,useDeferredValue as N1,useEffect as L1,useMemo as y1}from"react";import{mergeRegister as R1}from"@lexical/utils";import{useTranslation as I1}from"@payloadcms/ui";import{$getSelection as v1}from"lexical";import{jsx as Re,jsxs as vs}from"react/jsx-runtime";import{Button as C1}from"@payloadcms/ui";import{$addUpdateTag as b1,isDOMNode as k1}from"lexical";import xo,{useCallback as _1,useEffect as Co,useMemo as Ds,useRef as Sr,useState as Nr}from"react";import{createPortal as T1}from"react-dom";var Ms="toolbar-popup__dropdown-item",$s=xo.createContext(null);function As({active:t,children:e,editor:o,enabled:r,Icon:n,item:l,itemKey:i,tooltip:s}){let d=Ds(()=>[Ms,r===!1?"disabled":"",t?"active":"",l?.key?`${Ms}-${l.key}`:""].filter(Boolean).join(" "),[r,t,l.key]),c=Sr(null),u=xo.use($s);if(u===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=u;return Co(()=>{c?.current!=null&&a(c)},[c,a]),Re(C1,{"aria-label":s,buttonStyle:"none",className:d,disabled:r===!1,extraButtonProps:{"data-item-key":i},icon:n,iconPosition:"left",iconStyle:"none",onClick:()=>{r!==!1&&o.focus(()=>{o.update(()=>{b1("toolbar")}),l.onSelect?.({editor:o,isActive:t})})},onMouseDown:m=>{m.preventDefault()},ref:c,tooltip:s,type:"button",children:e})}function w1({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:r}){let[n,l]=Nr(),[i,s]=Nr(),d=_1(a=>{l(m=>m!=null?[...m,a]:[a])},[l]),c=a=>{if(n==null)return;let{key:m}=a;["ArrowDown","ArrowUp","Escape","Tab"].includes(m)&&a.preventDefault(),m==="Escape"||m==="Tab"?r():m==="ArrowUp"?s(p=>{if(p==null)return n[0];let f=n.indexOf(p)-1;return n[f===-1?n.length-1:f]}):m==="ArrowDown"&&s(p=>p==null?n[0]:n[n.indexOf(p)+1])},u=Ds(()=>({registerItem:d}),[d]);return Co(()=>{n!=null&&i==null&&s(n[0]),i!=null&&i?.current!=null&&i.current.focus()},[n,i]),Re($s,{value:u,children:Re("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:c,ref:e,children:t})})}function Os({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:r=!1,dropdownKey:n,Icon:l,itemsContainerClassNames:i,label:s,stopCloseOnClickSelf:d}){let c=Sr(null),u=Sr(null),[a,m]=Nr(!1),p=()=>{m(!1),u?.current!=null&&u.current.focus()};Co(()=>{let h=u.current,x=c.current;if(a&&h!==null&&x!==null){let{left:w,top:E}=h.getBoundingClientRect(),N=window.scrollY||document.documentElement.scrollTop;x.style.top=`${E+N+h.offsetHeight+5}px`,x.style.left=`${Math.min(w-5,window.innerWidth-x.offsetWidth-20)}px`}},[c,u,a]),Co(()=>{let h=u.current;if(h!==null&&a){let x=w=>{let E=w.target;k1(E)&&(d&&c.current&&c.current.contains(E)||h.contains(E)||m(!1))};return document.addEventListener("click",x),()=>{document.removeEventListener("click",x)}}},[c,u,a,d]);let f=T1(Re(w1,{dropDownRef:c,itemsContainerClassNames:i,onClose:p,children:o}),document.body);return vs(xo.Fragment,{children:[vs("button",{"aria-label":t,className:e+(a?" active":""),"data-dropdown-key":n,disabled:r,onClick:h=>{h.preventDefault(),m(!a)},onMouseDown:h=>{h.preventDefault()},ref:u,type:"button",children:[l&&Re(l,{}),s&&Re("span",{className:"toolbar-popup__dropdown-label",children:s}),Re("i",{className:"toolbar-popup__dropdown-caret"})]}),a&&Re(xo.Fragment,{children:f})]})}var Lr="toolbar-popup__dropdown",M1=t=>{let e=E1(14),{active:o,anchorElem:r,editor:n,enabled:l,item:i}=t,{i18n:s}=I1(),{fieldProps:d}=H(),{featureClientSchemaMap:c,schemaPath:u}=d;if(i.Component){let m;return e[0]!==o||e[1]!==r||e[2]!==n||e[3]!==l||e[4]!==i?(m=i?.Component&&rt(i.Component,{active:o,anchorElem:r,editor:n,enabled:l,item:i},i.key),e[0]=o,e[1]=r,e[2]=n,e[3]=l,e[4]=i,e[5]=m):m=e[5],m}let a;if(e[6]!==o||e[7]!==n||e[8]!==l||e[9]!==c||e[10]!==s||e[11]!==i||e[12]!==u){let m=i.key,p;i.label&&(m=typeof i.label=="function"?i.label({featureClientSchemaMap:c,i18n:s,schemaPath:u}):i.label),m.length>25?p=m.substring(0,25)+"...":p=m,a=rt(As,{active:o,editor:n,enabled:l,Icon:i?.ChildComponent?rt(i.ChildComponent,{}):void 0,item:i,itemKey:i.key,tooltip:m,children:rt("span",{className:"text",children:p})},i.key),e[6]=o,e[7]=n,e[8]=l,e[9]=c,e[10]=s,e[11]=i,e[12]=u,e[13]=a}else a=e[13];return a},D1=Fs.memo(M1),je=({anchorElem:t,classNames:e,editor:o,group:r,Icon:n,itemsContainerClassNames:l,label:i,maxActiveItems:s,onActiveChange:d})=>{let[c,u]=Fs.useState({activeItemKeys:[],enabledGroup:!0,enabledItemKeys:[]}),a=N1(c),m=H(),{items:p,key:f}=r,h=Vt(),x=S1(()=>{o.getEditorState().read(()=>{let E=v1();if(!E)return;let N=[],_=[],C=[];for(let g of p)g.isActive&&(!s||N.length<s)&&g.isActive({editor:o,editorConfigContext:m,selection:E})&&(N.push(g.key),_.push(g)),g.isEnabled?g.isEnabled({editor:o,editorConfigContext:m,selection:E})&&C.push(g.key):C.push(g.key);u({activeItemKeys:N,enabledGroup:r.isEnabled?r.isEnabled({editor:o,editorConfigContext:m,selection:E}):!0,enabledItemKeys:C}),d&&d({activeItems:_})})},[o,m,r,p,s,d]);L1(()=>(h(x),R1(o.registerUpdateListener(async()=>{await h(x)}))),[o,h,x]);let w=y1(()=>p?.length?p.map(E=>rt(D1,{active:a.activeItemKeys.includes(E.key),anchorElem:t,editor:o,enabled:a.enabledItemKeys.includes(E.key),item:E},E.key)):null,[p,a,t,o]);return rt(Os,{buttonAriaLabel:`${f} dropdown`,buttonClassName:[Lr,`${Lr}-${f}`,...e||[]].filter(Boolean).join(" "),disabled:!a.enabledGroup,dropdownKey:f,Icon:n,itemsContainerClassNames:[`${Lr}-items`,...l||[]],label:i,children:w},f)};function j1({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&se(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?se(Dt,{editor:e,item:o,children:se(o.ChildComponent,{})},o.key):null}function H1(t){let e=Ps(23),{anchorElem:o,editor:r,editorConfig:n,group:l,index:i}=t,{i18n:s}=P1(),{fieldProps:d}=H(),{featureClientSchemaMap:c,schemaPath:u}=d,[a,m]=Ee.useState(void 0),[p,f]=Ee.useState(void 0),h;e[0]!==l.ChildComponent||e[1]!==l.items||e[2]!==l.type?(h=()=>{l?.type==="dropdown"&&l.items.length&&l.ChildComponent?f(()=>l.ChildComponent):f(void 0)},e[0]=l.ChildComponent,e[1]=l.items,e[2]=l.type,e[3]=h):h=e[3];let x;e[4]!==l?(x=[l],e[4]=l,e[5]=x):x=e[5],Ee.useEffect(h,x);let w;e[6]!==c||e[7]!==l.ChildComponent||e[8]!==l.items||e[9]!==l.type||e[10]!==s||e[11]!==u?(w=C=>{let{activeItems:g}=C;if(!g.length){l?.type==="dropdown"&&l.items.length&&l.ChildComponent?(f(()=>l.ChildComponent),m(void 0)):(f(void 0),m(void 0));return}let b=g[0],k=b.key;b.label&&(k=typeof b.label=="function"?b.label({featureClientSchemaMap:c,i18n:s,schemaPath:u}):b.label),k.length>25&&(k=k.substring(0,25)+"..."),g.length===1?(m(k),f(()=>b.ChildComponent)):(m(s.t("lexical:general:toolbarItemsActive",{count:g.length})),l?.type==="dropdown"&&l.items.length&&l.ChildComponent?f(()=>l.ChildComponent):f(void 0))},e[6]=c,e[7]=l.ChildComponent,e[8]=l.items,e[9]=l.type,e[10]=s,e[11]=u,e[12]=w):w=e[12];let E=w,N=`fixed-toolbar__group fixed-toolbar__group-${l.key}`,_;return e[13]!==p||e[14]!==o||e[15]!==a||e[16]!==r||e[17]!==n.features.toolbarFixed?.groups.length||e[18]!==l||e[19]!==i||e[20]!==E||e[21]!==N?(_=$1("div",{className:N,"data-toolbar-group-key":l.key,children:[l.type==="dropdown"&&l.items.length?p?se(je,{anchorElem:o,editor:r,group:l,Icon:p,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:l.maxActiveItems??1,onActiveChange:E}):se(je,{anchorElem:o,editor:r,group:l,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:l.maxActiveItems??1,onActiveChange:E}):null,l.type==="buttons"&&l.items.length?l.items.map(C=>se(j1,{anchorElem:o,editor:r,item:C},C.key)):null,i<n.features.toolbarFixed?.groups.length-1&&se("div",{className:"divider"})]},l.key),e[13]=p,e[14]=o,e[15]=a,e[16]=r,e[17]=n.features.toolbarFixed?.groups.length,e[18]=l,e[19]=i,e[20]=E,e[21]=N,e[22]=_):_=e[22],_}function U1({anchorElem:t,clientProps:e,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let l=Ee.useRef(null),i=Bs(),{y:s}=O1(),d=B1(()=>{if(!n||e?.disableIfParentHasFixedToolbar)return null;let u=n.editorContainerRef.current.previousElementSibling;for(;u;){if(u.classList.contains("fixed-toolbar"))return u;u=u.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,n]);return F1(()=>{if(!d)return;let c=l.current;if(!c)return;let u=c.getBoundingClientRect(),a=d.getBoundingClientRect();if(!(u.bottom<a.top||u.top>a.bottom))c.classList.remove("fixed-toolbar"),c.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),d.classList.remove("fixed-toolbar"),d.classList.add("fixed-toolbar","fixed-toolbar--hide");else{if(!c.classList.contains("fixed-toolbar--overlapping"))return;c.classList.remove("fixed-toolbar--overlapping"),c.classList.add("fixed-toolbar"),d.classList.remove("fixed-toolbar--hide"),d.classList.add("fixed-toolbar")}},50,[l,d,s]),se("div",{className:"fixed-toolbar",onFocus:c=>{c.stopPropagation()},ref:l,children:i&&se(Ee.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((c,u)=>se(H1,{anchorElem:t,editor:o,editorConfig:r,group:c,index:u},c.key))})})}var js=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return js(t.parentEditor)}return!1},Hs=t=>{let e=Ps(6),{clientProps:o}=t,[r]=A1(),n=H();if(!Bs())return null;let{editorConfig:i}=n,s=o.applyToFocusedEditor&&n.focusedEditor?.editor||r,d=o.applyToFocusedEditor&&n.focusedEditor?.editorConfig||i,c,u;if(e[0]!==o.disableIfParentHasFixedToolbar||e[1]!==s||e[2]!==d||e[3]!==n){u=Symbol.for("react.early_return_sentinel");e:{let a=js(n);if(o?.disableIfParentHasFixedToolbar&&a){u=null;break e}if(!d?.features?.toolbarFixed?.groups?.length){u=null;break e}c=se(U1,{anchorElem:document.body,editor:s,editorConfig:d,parentWithFixedToolbar:a})}e[0]=o.disableIfParentHasFixedToolbar,e[1]=s,e[2]=d,e[3]=n,e[4]=c,e[5]=u}else c=e[4],u=e[5];return u!==Symbol.for("react.early_return_sentinel")?u:c};var W1=$({plugins:[{Component:Hs,position:"aboveContainer"}]});import{c as Gs}from"react/compiler-runtime";import{jsx as ue,jsxs as Vs}from"react/jsx-runtime";import{useLexicalComposerContext as G1}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as V1}from"@lexical/react/useLexicalEditable";import{mergeRegister as Ks}from"@lexical/utils";import{$getSelection as Js,$isRangeSelection as Us,$isTextNode as K1,COMMAND_PRIORITY_LOW as J1,getDOMSelection as zs,SELECTION_CHANGE_COMMAND as z1}from"lexical";import{useCallback as ko,useEffect as $t,useRef as Ws,useState as X1}from"react";import*as _o from"react";import{createPortal as Z1}from"react-dom";function yr(t,e){let o=t.getRangeAt(0),r;if(t.anchorNode===e){let n=e;for(;n.firstElementChild!=null;)n=n.firstElementChild;r=n.getBoundingClientRect()}else r=o.getBoundingClientRect();return r}function bo(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:r=0,floatingElem:n,horizontalOffset:l=32,horizontalPosition:i="left",specialHandlingForCaret:s=!1,targetRect:d,verticalGap:c=10}=t,u=o.parentElement;if(d===null||u==null){n.style.opacity="0",n.style.transform="translate(-10000px, -10000px)";return}let a=n.getBoundingClientRect(),m=o.getBoundingClientRect(),p=u.getBoundingClientRect(),f=d.top-a.height-c,h=d.left-l;i==="center"&&(h=d.left+d.width/2-a.width/2);let x=0;return!e&&f<p.top&&!s&&(x=a.height+d.height+c*2,f+=x),i==="center"?h+a.width>p.right?h=p.right-a.width-l:h<p.left&&(h=p.left+l):h+a.width>p.right&&(h=p.right-a.width-l),h-=m.left,n.style.opacity="1",s&&r!==0?(f-=m.bottom-r+a.height-3,n.style.transform=`translate(${h}px, ${f}px) rotate(180deg)`):(f-=m.top,n.style.transform=`translate(${h}px, ${f}px)`),x}function Y1({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&ue(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?ue(Dt,{editor:e,item:o,children:ue(o.ChildComponent,{})},o.key):null}function q1(t){let e=Gs(19),{anchorElem:o,editor:r,group:n,index:l}=t,{editorConfig:i}=H(),[s,d]=_o.useState(),c;e[0]!==n.ChildComponent||e[1]!==n.items||e[2]!==n.type?(c=()=>{n?.type==="dropdown"&&n.items.length&&n.ChildComponent?d(()=>n.ChildComponent):d(void 0)},e[0]=n.ChildComponent,e[1]=n.items,e[2]=n.type,e[3]=c):c=e[3];let u;e[4]!==n?(u=[n],e[4]=n,e[5]=u):u=e[5],_o.useEffect(c,u);let a;e[6]!==n.ChildComponent||e[7]!==n.items||e[8]!==n.type?(a=h=>{let{activeItems:x}=h;if(!x.length){n?.type==="dropdown"&&n.items.length&&n.ChildComponent?d(()=>n.ChildComponent):d(void 0);return}let w=x[0];d(()=>w?.ChildComponent)},e[6]=n.ChildComponent,e[7]=n.items,e[8]=n.type,e[9]=a):a=e[9];let m=a,p=`inline-toolbar-popup__group inline-toolbar-popup__group-${n.key}`,f;return e[10]!==s||e[11]!==o||e[12]!==r||e[13]!==i.features.toolbarInline?.groups.length||e[14]!==n||e[15]!==l||e[16]!==m||e[17]!==p?(f=Vs("div",{className:p,"data-toolbar-group-key":n.key,children:[n.type==="dropdown"&&n.items.length?s?ue(je,{anchorElem:o,editor:r,group:n,Icon:s,maxActiveItems:n.maxActiveItems??1,onActiveChange:m}):ue(je,{anchorElem:o,editor:r,group:n,maxActiveItems:n.maxActiveItems??1,onActiveChange:m}):null,n.type==="buttons"&&n.items.length?n.items.map(h=>ue(Y1,{anchorElem:o,editor:r,item:h},h.key)):null,l<i.features.toolbarInline?.groups.length-1&&ue("div",{className:"divider"})]},n.key),e[10]=s,e[11]=o,e[12]=r,e[13]=i.features.toolbarInline?.groups.length,e[14]=n,e[15]=l,e[16]=m,e[17]=p,e[18]=f):f=e[18],f}function Q1({anchorElem:t,editor:e}){let o=Ws(null),r=Ws(null),{editorConfig:n}=H(),l=ko(()=>{if(o?.current){let c=o.current.style.opacity==="0",u=o.current.style.pointerEvents==="none";c||(o.current.style.opacity="0"),u||(o.current.style.pointerEvents="none")}},[o]),i=ko(c=>{if(o?.current&&(c.buttons===1||c.buttons===3)){let u=o.current.style.opacity==="0",a=o.current.style.pointerEvents==="none";if(!u||!a){let m=c.clientX,p=c.clientY,f=document.elementFromPoint(m,p);o.current.contains(f)||l()}}},[l]),s=ko(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);$t(()=>(document.addEventListener("mousemove",i),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",s)}),[o,i,s]);let d=ko(()=>{let c=Js(),u=zs(e._window);if(o.current===null)return;let a=t.querySelector(":scope > .link-editor"),m=a!==null&&"style"in a&&a?.style?.opacity==="1",p=e.getRootElement();if(c!==null&&u!==null&&!u.isCollapsed&&p!==null&&p.contains(u.anchorNode)){let f=yr(u,p),h=bo({alwaysDisplayOnTop:m,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});r.current&&bo({anchorElem:o.current,anchorFlippedOffset:h,floatingElem:r.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else l()},[e,l,t]);return $t(()=>{let c=t.parentElement,u=()=>{e.getEditorState().read(()=>{d()})};return window.addEventListener("resize",u),c&&c.addEventListener("scroll",u),()=>{window.removeEventListener("resize",u),c&&c.removeEventListener("scroll",u)}},[e,d,t]),$t(()=>(e.getEditorState().read(()=>{d()}),Ks(e.registerUpdateListener(({editorState:c})=>{c.read(()=>{d()})}),e.registerCommand(z1,()=>(d(),!1),J1))),[e,d]),Vs("div",{className:"inline-toolbar-popup",ref:o,children:[ue("div",{className:"caret",ref:r}),n?.features&&n.features?.toolbarInline?.groups.map((c,u)=>ue(q1,{anchorElem:t,editor:e,group:c,index:u},c.key))]})}function eh(t,e){let o=Gs(12),[r,n]=X1(!1),l=V1(),i;o[0]!==t?(i=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let p=Js(),f=zs(t._window),h=t.getRootElement();if(f!==null&&(!Us(p)||h===null||!h.contains(f.anchorNode))){n(!1);return}if(!Us(p))return;if(p.getTextContent()!==""){let w=p.getNodes(),E=!1;for(let N of w)if(K1(N)){n(!0),E=!0;break}E||n(!1)}else n(!1);let x=p.getTextContent().replace(/\n/g,"");if(!p.isCollapsed()&&x===""){n(!1);return}})},o[0]=t,o[1]=i):i=o[1];let s=i,d,c;o[2]!==s?(d=()=>(document.addEventListener("selectionchange",s),document.addEventListener("mouseup",s),()=>{document.removeEventListener("selectionchange",s),document.removeEventListener("mouseup",s)}),c=[s],o[2]=s,o[3]=d,o[4]=c):(d=o[3],c=o[4]),$t(d,c);let u,a;if(o[5]!==t||o[6]!==s?(u=()=>Ks(t.registerUpdateListener(()=>{s()}),t.registerRootListener(()=>{t.getRootElement()===null&&n(!1)})),a=[t,s],o[5]=t,o[6]=s,o[7]=u,o[8]=a):(u=o[7],a=o[8]),$t(u,a),!r||!l)return null;let m;return o[9]!==e||o[10]!==t?(m=Z1(ue(Q1,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=m):m=o[11],m}var Xs=t=>{let{anchorElem:e}=t,[o]=G1();return eh(o,e)};var th=$({plugins:[{Component:Xs,position:"floatingAnchorElem"}]});import{TableCellNode as Gg,TableNode as Vg,TableRowNode as Kg}from"@lexical/table";import{jsx as Zs}from"react/jsx-runtime";import"react";var Rr=()=>Zs("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Zs("path",{clipRule:"evenodd",d:"M5.33333 4.5C4.8731 4.5 4.5 4.8731 4.5 5.33333V7.5H9.5V4.5H5.33333ZM5.33333 3.5C4.32081 3.5 3.5 4.32081 3.5 5.33333V14.6667C3.5 15.6792 4.32081 16.5 5.33333 16.5H14.6667C15.6792 16.5 16.5 15.6792 16.5 14.6667V5.33333C16.5 4.32081 15.6792 3.5 14.6667 3.5H5.33333ZM10.5 4.5V7.5H15.5V5.33333C15.5 4.8731 15.1269 4.5 14.6667 4.5H10.5ZM15.5 8.5H10.5V11.5H15.5V8.5ZM15.5 12.5H10.5V15.5H14.6667C15.1269 15.5 15.5 15.1269 15.5 14.6667V12.5ZM9.5 15.5V12.5H4.5V14.6667C4.5 15.1269 4.8731 15.5 5.33333 15.5H9.5ZM4.5 11.5H9.5V8.5H4.5V11.5Z",fill:"currentColor",fillRule:"evenodd"})});import{$createTableCellNode as oh,$createTableNode as rh,$createTableRowNode as nh,$isTableCellNode as Ys,$isTableNode as Ir,$isTableRowNode as vr,TableCellHeaderStates as To,TableCellNode as lh,TableNode as ih,TableRowNode as sh}from"@lexical/table";import{$isParagraphNode as ah,$isTextNode as ch}from"lexical";var Qs=/^\|(.+)\|\s?$/,uh=/^(\| ?:?-*:? ?)+\|\s?$/,ea=({allTransformers:t})=>({type:"element",dependencies:[ih,sh,lh],export:e=>{if(!Ir(e))return null;let o=[];for(let r of e.getChildren()){let n=[];if(!vr(r))continue;let l=!1;for(let i of r.getChildren())Ys(i)&&(n.push(Gt(t,i).replace(/\n/g,"\\n").trim()),i.__headerState===To.ROW&&(l=!0));o.push(`| ${n.join(" | ")} |`),l&&o.push(`| ${n.map(i=>"---").join(" | ")} |`)}return o.join(`
59
59
  `)},regExp:Qs,replace:(e,o,r)=>{let n=r[0];if(!n)return;if(uh.test(n)){let a=e.getPreviousSibling();if(!a||!Ir(a))return;let m=a.getChildren(),p=m[m.length-1];if(!p||!vr(p))return;p.getChildren().forEach(f=>{Ys(f)&&f.setHeaderStyles(To.ROW,To.ROW)}),e.remove();return}let l=qs(n,t);if(l==null)return;let i=[l],s=e.getPreviousSibling(),d=l.length;for(;s&&!(!ah(s)||s.getChildrenSize()!==1);){let a=s.getFirstChild();if(!ch(a))break;let m=qs(a.getTextContent(),t);if(m==null)break;d=Math.max(d,m.length),i.unshift(m);let p=s.getPreviousSibling();s.remove(),s=p}let c=rh();for(let a of i){let m=nh();c.append(m);for(let p=0;p<d;p++)m.append(p<a.length?a[p]:ta("",t))}let u=e.getPreviousSibling();Ir(u)&&dh(u)===d?(u.append(...c.getChildren()),e.remove()):e.replace(c),c.selectEnd()}});function dh(t){let e=t.getFirstChild();return vr(e)?e.getChildrenSize():0}var ta=(t,e)=>{t=t.replace(/\\n/g,`
60
- `);let o=oh(To.NO_STATUS);return Wt(t,e,o),o},qs=(t,e)=>{let o=t.match(Qs);return!o||!o[1]?null:o[1].split("|").map(r=>ta(r,e))};import{c as ph}from"react/compiler-runtime";import{jsx as P,jsxs as Se}from"react/jsx-runtime";import{useLexicalComposerContext as ia}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as fh}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as ra,$deleteTableColumnAtSelection as hh,$deleteTableRowAtSelection as gh,$getNodeTriplet as xh,$getTableCellNodeFromLexicalNode as na,$getTableColumnIndexFromTableCellNode as Ch,$getTableNodeFromLexicalNodeOrThrow as ve,$getTableRowIndexFromTableCellNode as bh,$insertTableColumnAtSelection as kh,$insertTableRowAtSelection as _h,$isTableCellNode as sa,$isTableSelection as At,$mergeCells as Th,$unmergeCell as wh,getTableElement as Dr,getTableObserverFromTableElement as $r,TableCellHeaderStates as Ie,TableCellNode as Eh}from"@lexical/table";import{mergeRegister as Sh}from"@lexical/utils";import{useScrollInfo as Nh}from"@payloadcms/ui";import{$getSelection as Eo,$isElementNode as Lh,$isRangeSelection as Ar,$isTextNode as yh,$setSelection as Rh,COMMAND_PRIORITY_CRITICAL as Ih,getDOMSelection as vh,isDOMNode as Mh,SELECTION_CHANGE_COMMAND as Dh}from"lexical";import*as Or from"react";import{useCallback as ae,useEffect as nt,useRef as wo,useState as lt}from"react";import{createPortal as aa}from"react-dom";import{jsx as Mr,jsxs as mh}from"react/jsx-runtime";import"react";var oa=()=>mh("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[Mr("path",{d:"M5 11C5.55228 11 6 10.5523 6 10C6 9.44772 5.55228 9 5 9C4.44772 9 4 9.44772 4 10C4 10.5523 4.44772 11 5 11Z",fill:"currentColor"}),Mr("path",{d:"M10 11C10.5523 11 11 10.5523 11 10C11 9.44772 10.5523 9 10 9C9.44772 9 9 9.44772 9 10C9 10.5523 9.44772 11 10 11Z",fill:"currentColor"}),Mr("path",{d:"M15 11C15.5523 11 16 10.5523 16 10C16 9.44772 15.5523 9 15 9C14.4477 9 14 9.44772 14 10C14 10.5523 14.4477 11 15 11Z",fill:"currentColor"})]});function la(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function $h(){let t=Eo();if(Ar(t)&&!t.isCollapsed()||At(t)&&!t.anchor.is(t.focus)||!Ar(t)&&!At(t))return!1;let[e]=xh(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function Ah(t){let e=t.getLastDescendant();yh(e)?e.select():Lh(e)?e.selectEnd():e!==null&&e.selectNext()}function Oh({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[l]=ia(),i=wo(null),[s,d]=lt(n),[c,u]=lt({columns:1,rows:1}),[a,m]=lt(!1),[p,f]=lt(!1),{y:h}=Nh();nt(()=>l.registerMutationListener(Eh,T=>{T.get(s.getKey())==="updated"&&l.getEditorState().read(()=>{d(s.getLatest())})},{skipInitialization:!0}),[l,s]),nt(()=>{l.getEditorState().read(()=>{let T=Eo();if(At(T)){let S=la(T);u(la(T)),m(S.columns>1||S.rows>1)}f($h())})},[l]),nt(()=>{let T=e.current,S=i.current,I=l.getRootElement();if(T!=null&&S!=null&&I!=null){let A=I.getBoundingClientRect(),v=T.getBoundingClientRect();S.style.opacity="1";let O=S.getBoundingClientRect(),D=5,G=v.right+D;if(G+O.width>window.innerWidth||G+O.width>A.right){let J=v.left-O.width-D;G=(J<0?D:J)+window.pageXOffset}S.style.left=`${G+window.pageXOffset}px`;let Q=v.top;if(Q+O.height>window.innerHeight){let J=v.bottom-O.height;Q=J<0?D:J}S.style.top=`${Q}px`}},[e,i,l,h]),nt(()=>{function T(S){i.current!=null&&e.current!=null&&Mh(S.target)&&!i.current.contains(S.target)&&!e.current.contains(S.target)&&r(!1)}return window.addEventListener("click",T),()=>window.removeEventListener("click",T)},[r,e]);let x=ae(()=>{l.update(()=>{if(s.isAttached()){let T=ve(s),S=Dr(T,l.getElementByKey(T.getKey()));if(S===null)throw new Error("Expected to find tableElement in DOM");let I=$r(S);I!==null&&I.$clearHighlight(),T.markDirty(),d(s.getLatest())}Rh(null)})},[l,s]),w=()=>{l.update(()=>{let T=Eo();if(!At(T))return;let I=T.getNodes().filter(sa),A=Th(I);A&&(Ah(A),o())})},E=()=>{l.update(()=>{wh()})},N=ae(T=>{l.update(()=>{for(let S=0;S<c.rows;S++)_h(T);o()})},[l,o,c.rows]),_=ae(T=>{l.update(()=>{for(let S=0;S<c.columns;S++)kh(T);o()})},[l,o,c.columns]),C=ae(()=>{l.update(()=>{gh(),o()})},[l,o]),g=ae(()=>{l.update(()=>{ve(s).remove(),x(),o()})},[l,s,x,o]),b=ae(()=>{l.update(()=>{hh(),o()})},[l,o]),k=ae(()=>{l.update(()=>{let T=ve(s),S=bh(s),[I]=ra(T,null,null),A=new Set,v=s.getHeaderStyles()^Ie.ROW;if(I[S])for(let O=0;O<I[S].length;O++){let D=I[S][O];D?.cell&&(A.has(D.cell)||(A.add(D.cell),D.cell.setHeaderStyles(v,Ie.ROW)))}x(),o()})},[l,s,x,o]),y=ae(()=>{l.update(()=>{let T=ve(s),S=Ch(s),[I]=ra(T,null,null),A=new Set,v=s.getHeaderStyles()^Ie.COLUMN;if(I)for(let O=0;O<I.length;O++){let D=I?.[O]?.[S];D?.cell&&(A.has(D.cell)||(A.add(D.cell),D.cell.setHeaderStyles(v,Ie.COLUMN)))}x(),o()})},[l,s,x,o]),R=ae(()=>{l.update(()=>{if(s.isAttached()){let T=ve(s);T&&T.setRowStriping(!T.getRowStriping())}x(),o()})},[l,s,x,o]),M=ae(()=>{l.update(()=>{if(s.isAttached()){let T=ve(s);T&&T.setFrozenColumns(T.getFrozenColumns()===0?1:0)}x(),o()})},[l,s,x,o]),L=null;return t&&(a?L=P("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>w(),type:"button",children:P("span",{className:"text",children:"Merge cells"})}):p&&(L=P("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>E(),type:"button",children:P("span",{className:"text",children:"Unmerge cells"})}))),aa(Se("div",{className:"table-action-menu-dropdown",onClick:T=>{T.stopPropagation()},ref:i,children:[L?Se(Or.Fragment,{children:[L,P("hr",{})]}):null,P("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>R(),type:"button",children:P("span",{className:"text",children:"Toggle Row Striping"})}),P("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>M(),type:"button",children:P("span",{className:"text",children:"Toggle First Column Freeze"})}),P("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>N(!1),type:"button",children:Se("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," above"]})}),P("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>N(!0),type:"button",children:Se("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," below"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>_(!1),type:"button",children:Se("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","left"]})}),P("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>_(!0),type:"button",children:Se("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","right"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>b(),type:"button",children:P("span",{className:"text",children:"Delete column"})}),P("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>C(),type:"button",children:P("span",{className:"text",children:"Delete row"})}),P("button",{className:"item","data-test-id":"table-delete",onClick:()=>g(),type:"button",children:P("span",{className:"text",children:"Delete table"})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-row-header",onClick:()=>k(),type:"button",children:Se("span",{className:"text",children:[(s.__headerState&Ie.ROW)===Ie.ROW?"Remove":"Add"," ","row header"]})}),P("button",{className:"item","data-test-id":"table-column-header",onClick:()=>y(),type:"button",children:Se("span",{className:"text",children:[(s.__headerState&Ie.COLUMN)===Ie.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function Fh({anchorElem:t,cellMerge:e}){let[o]=ia(),r=wo(null),n=wo(null),[l,i]=lt(!1),[s,d]=lt(null),c=ae(()=>{let a=r.current,m=Eo(),p=vh(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")),d(null)}if(m==null||a==null)return h();let x=o.getRootElement(),w=null,E=null;if(Ar(m)&&x!==null&&p!==null&&x.contains(p.anchorNode)){let _=na(m.anchor.getNode());if(_==null||(E=o.getElementByKey(_.getKey()),E==null||!_.isAttached()))return h();let C=ve(_),g=Dr(C,o.getElementByKey(C.getKey()));if(g===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");w=$r(g),d(_)}else if(At(m)){let _=na(m.anchor.getNode());if(!sa(_))throw new Error("TableSelection anchorNode must be a TableCellNode");let C=ve(_),g=Dr(C,o.getElementByKey(C.getKey()));if(g===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");w=$r(g),E=o.getElementByKey(_.getKey())}else if(!f)return h();if(w===null||E===null)return h();let N=!w||!w.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",N),a.classList.toggle("table-cell-action-button-container--inactive",!N),N){let _=E.getBoundingClientRect(),C=t.getBoundingClientRect(),g=_.top-C.top,b=_.right-C.left;a.style.transform=`translate(${b}px, ${g}px)`}},[o,t]);nt(()=>{let a,m=()=>{a=void 0,o.getEditorState().read(c)},p=()=>(a===void 0&&(a=setTimeout(m,0)),!1);return Sh(o.registerUpdateListener(p),o.registerCommand(Dh,p,Ih),o.registerRootListener((f,h)=>{h&&h.removeEventListener("pointerup",p),f&&(f.addEventListener("pointerup",p),p())}),()=>clearTimeout(a))});let u=wo(s);return nt(()=>{u.current!==s&&i(!1),u.current=s},[u,s]),P("div",{className:"table-cell-action-button-container",ref:r,children:s!=null&&Se(Or.Fragment,{children:[P("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),i(!l)},ref:n,type:"button",children:P(oa,{})}),l&&P(Oh,{cellMerge:e,contextRef:n,onClose:()=>i(!1),setIsMenuOpen:i,tableCellNode:s})]})})}var ca=t=>{let e=ph(3),{anchorElem:o}=t,r=fh(),n;return e[0]!==o||e[1]!==r?(n=aa(r?P(Fh,{anchorElem:o??document.body,cellMerge:!0}):null,o??document.body),e[0]=o,e[1]=r,e[2]=n):n=e[2],n};import{c as Ph}from"react/compiler-runtime";import{jsx as No,jsxs as Bh}from"react/jsx-runtime";import{useLexicalComposerContext as jh}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Hh}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as Uh,$getTableNodeFromLexicalNodeOrThrow as Fr,$getTableRowIndexFromTableCellNode as Wh,$isTableCellNode as ua,$isTableRowNode as Gh,getDOMCellFromTarget as Vh,getTableElement as Kh,TableNode as da}from"@lexical/table";import{calculateZoomLevel as ma,mergeRegister as Jh}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Pr,isHTMLElement as zh,SKIP_SCROLL_INTO_VIEW_TAG as pa}from"lexical";import*as ha from"react";import{useCallback as Ot,useEffect as Br,useRef as So,useState as it}from"react";import{createPortal as Xh}from"react-dom";var Zh=33,fa=92;function Yh({editor:t}){let e=So(null),o=So(null),r=So(null),[n,l]=it(!1),i=H(),s=So(null),[d,c]=it(null),[u,a]=it(null),[m,p]=it(!1),[f,h]=it(null),x=Ot(()=>{a(null),e.current=null,h(null),s.current=null,r.current=null},[]),w=M=>(M.buttons&1)===1;Br(()=>{let M=new Set;return Jh(t.registerMutationListener(da,L=>{for(let[T,S]of L)S==="destroyed"?M.delete(T):M.add(T);l(M.size>0)}),t.registerNodeTransform(da,L=>{if(L.getColWidths())return L;let T=L.getColumnCount(),S=fa;return L.setColWidths(Array(T).fill(S)),L}))},[t]),Br(()=>{if(!n)return;let M=I=>{let A=I.target;if(zh(A)){if(f){c({x:I.clientX,y:I.clientY});return}if(p(w(I)),!(o.current&&o.current.contains(A))&&e.current!==A){e.current=A;let v=Vh(A);v&&u!==v?t.getEditorState().read(()=>{let O=Pr(v.elem);if(!O)throw new Error("TableCellResizer: Table cell node not found.");let D=Fr(O),G=Kh(D,t.getElementByKey(D.getKey()));if(!G)throw new Error("TableCellResizer: Table element not found.");e.current=A,r.current=G.getBoundingClientRect(),a(v)},{editor:t}):v==null&&x()}}},L=I=>{p(!0)},T=I=>{p(!1)},S=t.registerRootListener((I,A)=>{A?.removeEventListener("mousemove",M),A?.removeEventListener("mousedown",L),A?.removeEventListener("mouseup",T),I?.addEventListener("mousemove",M),I?.addEventListener("mousedown",L),I?.addEventListener("mouseup",T)});return()=>{S()}},[u,f,t,n,x]);let E=M=>M==="bottom",N=Ot(M=>{if(!u)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let L=Pr(u.elem);if(!ua(L))throw new Error("TableCellResizer: Table cell node not found.");let T=Fr(L),S=Wh(L),I=T.getChildren(),v=L.getColSpan()===T.getColumnCount()?S:S+L.getRowSpan()-1;if(v>=I.length||v<0)throw new Error("Expected table cell to be inside of table row.");let O=I[v];if(!Gh(O))throw new Error("Expected table row");let D=O.getHeight();if(D===void 0){let Q=O.getChildren();D=Math.min(...Q.map(J=>_(J,t)??1/0))}let G=Math.max(D+M,Zh);O.setHeight(G)},{tag:pa})},[u,t]),_=(M,L)=>L.getElementByKey(M.getKey())?.clientHeight,C=(M,L)=>{let T;return L.forEach(S=>{S.forEach((I,A)=>{I.cell===M&&(T=A)})}),T},g=Ot(M=>{if(!u)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let L=Pr(u.elem);if(!ua(L))throw new Error("TableCellResizer: Table cell node not found.");let T=Fr(L),[S]=Uh(T,null,null),I=C(L,S);if(I===void 0)throw new Error("TableCellResizer: Table column not found.");let A=T.getColWidths();if(!A)return;let v=A[I];if(v===void 0)return;let O=[...A],D=Math.max(v+M,fa);O[I]=D,T.setColWidths(O)},{tag:pa})},[u,t]),b=Ot(M=>{let L=T=>{if(T.preventDefault(),T.stopPropagation(),!u)throw new Error("TableCellResizer: Expected active cell.");if(s.current){let{x:S,y:I}=s.current;if(u===null)return;let A=ma(T.target);if(E(M)){let v=(T.clientY-I)/A;N(v)}else{let v=(T.clientX-S)/A;g(v)}x(),document.removeEventListener("mouseup",L)}};return L},[u,x,g,N]),k=Ot(M=>L=>{if(L.preventDefault(),L.stopPropagation(),!u)throw new Error("TableCellResizer: Expected active cell.");s.current={x:L.clientX,y:L.clientY},c(s.current),h(M),document.addEventListener("mouseup",b(M))},[u,b]),[y,R]=it({bottom:null,left:null,right:null,top:null});return Br(()=>{if(u){let{height:M,left:L,top:T,width:S}=u.elem.getBoundingClientRect(),I=ma(u.elem),A=10,v={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${A}px`,left:`${window.scrollX+L}px`,top:`${window.scrollY+T+M-A/2}px`,width:`${S}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${M}px`,left:`${window.scrollX+L+S-A/2}px`,top:`${window.scrollY+T}px`,width:`${A}px`}},O=r.current;f&&d&&O&&(E(f)?(v[f].left=`${window.scrollX+O.left}px`,v[f].top=`${window.scrollY+d.y/I}px`,v[f].height="3px",v[f].width=`${O.width}px`):(v[f].top=`${window.scrollY+O.top}px`,v[f].left=`${window.scrollX+d.x/I}px`,v[f].width="3px",v[f].height=`${O.height}px`),v[f].backgroundColor="#adf"),R(v)}else R({bottom:null,left:null,right:null,top:null})},[u,f,d]),No("div",{ref:o,children:u!=null&&!m&&Bh(ha.Fragment,{children:[No("div",{className:`${i.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:k("right"),style:y.right||void 0}),No("div",{className:`${i.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:k("bottom"),style:y.bottom||void 0})]})})}var ga=()=>{let t=Ph(3),[e]=jh(),o=Hh(),r;return t[0]!==e||t[1]!==o?(r=o?Xh(No(Yh,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=r):r=t[2],r};import{c as lg}from"react/compiler-runtime";import{jsx as jr,jsxs as ig,Fragment as sg}from"react/jsx-runtime";import{useLexicalComposerContext as ag}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Ea}from"@lexical/react/useLexicalEditable";import{$getTableAndElementByKey as cg,$getTableColumnIndexFromTableCellNode as ug,$getTableRowIndexFromTableCellNode as dg,$insertTableColumnAtSelection as mg,$insertTableRowAtSelection as pg,$isTableCellNode as fg,$isTableNode as ba,getTableElement as hg,TableNode as gg}from"@lexical/table";import{$findMatchingParent as xg,mergeRegister as Cg}from"@lexical/utils";import{$getNearestNodeFromDOMNode as ka,isHTMLElement as bg}from"lexical";import{useEffect as _a,useMemo as kg,useRef as Ta,useState as Lo}from"react";import"react";import{createPortal as _g}from"react-dom";import{c as og}from"react/compiler-runtime";import{useEffect as rg,useRef as ng}from"react";var qh="Expected a function",Qh=Math.max,eg=Math.min;function tg(t,e,o){let r,n,l=0,i,s=!1,d=!1,c,u,a,m=!0;if(typeof t!="function")throw new TypeError(qh);e=e||0,typeof o=="object"&&(s=!!o.leading,d="maxWait"in o,c=d?Qh(o.maxWait||0,e):c,m="trailing"in o?!!o.trailing:m);function p(g){let b=r,k=i;return r=i=void 0,l=g,u=t.apply(k,b),u}function f(g){return l=g,a=setTimeout(w,e),s?p(g):u}function h(g){let b=g-n,k=g-l,y=e-b;return d?eg(y,c-k):y}function x(g){let b=g-n,k=g-l;return n===void 0||b>=e||b<0||d&&k>=c}function w(){let g=Date.now();if(x(g))return E(g);a=setTimeout(w,h(g))}function E(g){return a=void 0,m&&r?p(g):(r=i=void 0,u)}function N(){a!==void 0&&clearTimeout(a),l=0,r=n=i=a=void 0}function _(){return a===void 0?u:E(Date.now())}function C(){let g=Date.now(),b=x(g);if(r=arguments,i=this,n=g,b){if(a===void 0)return f(n);if(d)return clearTimeout(a),a=setTimeout(w,e),p(n)}return a===void 0&&(a=setTimeout(w,e)),u}return C.cancel=N,C.flush=_,C}var xa=tg;function Ca(t,e,o){let r=og(6),n=ng(null),l,i;r[0]!==t||r[1]!==o||r[2]!==e?(l=()=>(n.current=xa(t,e,{maxWait:o}),()=>{n.current?.cancel()}),i=[t,e,o],r[0]=t,r[1]=o,r[2]=e,r[3]=l,r[4]=i):(l=r[3],i=r[4]),rg(l,i);let s;return r[5]===Symbol.for("react.memo_cache_sentinel")?(s=(...c)=>{let u=c;n.current&&n.current(...u)},r[5]=s):s=r[5],s}var wa=20;function Tg({anchorElem:t}){let[e]=ag(),o=Ea(),r=H(),[n,l]=Lo(!1),[i,s]=Lo(!1),[d,c]=Lo(!1),[u,a]=Lo({}),m=Ta(new Set),p=Ta(null),f=Ca(w=>{let{isOutside:E,tableDOMNode:N}=wg(w,r.editorConfig?.lexical);if(E){l(!1),s(!1);return}if(!N)return;p.current=N;let _=null,C=null,g=null;if(e.getEditorState().read(()=>{let v=ka(N);if(fg(v)){let O=xg(v,D=>ba(D));if(!ba(O))return;if(g=hg(O,e.getElementByKey(O.getKey())),g){let D=O.getChildrenSize(),G=O.getChildAtIndex(0)?.getChildrenSize(),Q=dg(v),J=ug(v);Q===D-1?_=v:J===G-1&&(C=v)}}},{editor:e}),!g)return;let b=g.parentElement;if(!b)return;let{bottom:k,height:y,left:R,right:M,width:L,y:T}=g.getBoundingClientRect(),S=!1;b&&b.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(S=b.scrollWidth>b.clientWidth);let{left:I,y:A}=t.getBoundingClientRect();_?(s(!1),l(!0),a({height:wa,left:S&&b?b.offsetLeft:R-I,top:k-A+5,width:S&&b?b.offsetWidth:L})):C&&(s(!0),l(!1),a({height:y,left:M-I+5,top:T-A,width:wa}))},50,250),h=kg(()=>new ResizeObserver(()=>{l(!1),s(!1)}),[]);_a(()=>{if(d)return document.addEventListener("mousemove",f),()=>{l(!1),s(!1),document.removeEventListener("mousemove",f)}},[d,f]),_a(()=>Cg(e.registerMutationListener(gg,w=>{e.getEditorState().read(()=>{let E=!1;for(let[N,_]of w)switch(_){case"created":{m.current.add(N),E=!0;break}case"destroyed":{m.current.delete(N),E=!0;break}default:break}if(E){h.disconnect();for(let N of m.current){let{tableElement:_}=cg(N);h.observe(_)}c(m.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,h]);let x=w=>{e.update(()=>{p.current&&(ka(p.current)?.selectEnd(),w?(pg(),l(!1)):(mg(),s(!1)))})};return o?ig(sg,{children:[n&&jr("button",{"aria-label":"Add Row",className:r.editorConfig.lexical.theme.tableAddRows,onClick:()=>x(!0),style:{...u},type:"button"}),i&&jr("button",{"aria-label":"Add Column",className:r.editorConfig.lexical.theme.tableAddColumns,onClick:()=>x(!1),style:{...u},type:"button"})]}):null}function wg(t,e){let o=t.target;if(bg(o)){let r=o.closest(`td.${e.theme.tableCell}, th.${e.theme.tableCell}`);return{isOutside:!(r||o.closest(`button.${e.theme.tableAddRows}`)||o.closest(`button.${e.theme.tableAddColumns}`)||o.closest(`div.${e.theme.tableCellResizer}`)),tableDOMNode:r}}else return{isOutside:!0,tableDOMNode:null}}function Sa(t){let e=lg(2),{anchorElem:o}=t,r=o===void 0?document.body:o;if(!Ea())return null;let l;return e[0]!==r?(l=_g(jr(Tg,{anchorElem:r}),r),e[0]=r,e[1]=l):l=e[1],l}import{c as Eg}from"react/compiler-runtime";import{jsx as Hr,jsxs as Sg}from"react/jsx-runtime";import{useLexicalComposerContext as Ng}from"@lexical/react/LexicalComposerContext";import{TablePlugin as Lg}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as yg,TableCellNode as Rg,TableNode as Ig,TableRowNode as vg}from"@lexical/table";import{mergeRegister as Mg}from"@lexical/utils";import{formatDrawerSlug as Dg,useEditDepth as $g}from"@payloadcms/ui";import{$getSelection as Ag,$isRangeSelection as Og,COMMAND_PRIORITY_EDITOR as Fg,createCommand as Pg}from"lexical";import{createContext as Bg,use as jg,useEffect as Hg,useMemo as Ug,useState as Wg}from"react";import*as Na from"react";var yo=Pg("OPEN_EMBED_DRAWER_COMMAND"),La=Bg({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function ya({children:t}){let[e,o]=Wg({cellEditorConfig:null,cellEditorPlugins:null});return Hr(La,{value:Ug(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var Ra=()=>{let t=Eg(16),[e]=Ng(),o=jg(La),r=$g(),{fieldProps:n,uuid:l}=H(),{schemaPath:i}=n,s="lexical-table-create-"+l,d;t[0]!==r||t[1]!==s?(d=Dg({slug:s,depth:r}),t[0]=r,t[1]=s,t[2]=d):d=t[2];let c=d,{toggleDrawer:u}=fe(c,!0),a;t[3]!==e||t[4]!==u?(a=()=>{if(!e.hasNodes([Ig,vg,Rg]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return Mg(e.registerCommand(yo,()=>{let h=null;return e.getEditorState().read(()=>{let x=Ag();Og(x)&&(h=x)}),h&&u(),!0},Fg))},t[3]=e,t[4]=u,t[5]=a):a=t[5];let m;t[6]!==o||t[7]!==e||t[8]!==u?(m=[o,e,u],t[6]=o,t[7]=e,t[8]=u,t[9]=m):m=t[9],Hg(a,m);let p;t[10]!==e?(p=(h,x)=>{!x.columns||!x.rows||e.dispatchCommand(yg,{columns:String(x.columns),rows:String(x.rows)})},t[10]=e,t[11]=p):p=t[11];let f;return t[12]!==c||t[13]!==i||t[14]!==p?(f=Sg(Na.Fragment,{children:[Hr(mt,{drawerSlug:c,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:p,schemaPath:i,schemaPathSuffix:"fields"}),Hr(Lg,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]}),t[12]=c,t[13]=i,t[14]=p,t[15]=f):f=t[15],f};var Jg=$({markdownTransformers:[ea],nodes:[Vg,Gg,Kg],plugins:[{Component:Ra,position:"normal"},{Component:ga,position:"normal"},{Component:ca,position:"floatingAnchorElem"},{Component:Sa,position:"floatingAnchorElem"}],providers:[ya],slashMenu:{groups:[Y([{Icon:Rr,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(yo,{})}}])]},toolbarFixed:{groups:[xe([{ChildComponent:Rr,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(yo,{})}}])]}});import{$isNodeSelection as Rx}from"lexical";import{jsx as Ur,jsxs as zg}from"react/jsx-runtime";import"react";var Wr=()=>zg("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Ur("path",{d:"M14.6667 4H5.33333C4.59695 4 4 4.59695 4 5.33333V14.6667C4 15.403 4.59695 16 5.33333 16H14.6667C15.403 16 16 15.403 16 14.6667V5.33333C16 4.59695 15.403 4 14.6667 4Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),Ur("path",{d:"M7.99984 9.33366C8.73622 9.33366 9.33317 8.73671 9.33317 8.00033C9.33317 7.26395 8.73622 6.66699 7.99984 6.66699C7.26346 6.66699 6.6665 7.26395 6.6665 8.00033C6.6665 8.73671 7.26346 9.33366 7.99984 9.33366Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),Ur("path",{d:"M16 11.9995L13.9427 9.94214C13.6926 9.69218 13.3536 9.55176 13 9.55176C12.6464 9.55176 12.3074 9.69218 12.0573 9.94214L6 15.9995",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as $a}from"react/jsx-runtime";import Aa from"bson-objectid";import{$applyNodeReplacement as ex}from"lexical";import*as Oa from"react";import Xg from"bson-objectid";function Ro(t,e){if(t.hasAttribute("data-lexical-pending-upload-form-id")){let r=t.getAttribute("data-lexical-pending-upload-form-id");if(r!=null)return{node:e({data:{pending:{formID:r,src:t.getAttribute("src")||""}}})}}if(t.hasAttribute("data-lexical-upload-relation-to")&&t.hasAttribute("data-lexical-upload-id")){let r=t.getAttribute("data-lexical-upload-id"),n=t.getAttribute("data-lexical-upload-relation-to");if(r!=null&&n!=null)return{node:e({data:{fields:{},relationTo:n,value:r}})}}return{node:e({data:{pending:{formID:new Xg.default().toHexString(),src:t.getAttribute("src")||""}}})}}import{DecoratorBlockNode as Zg}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as Yg}from"@lexical/utils";import va from"bson-objectid";import{$applyNodeReplacement as qg}from"lexical";var Ft=class extends Zg{__data;constructor({data:e,format:o,key:r}){super(o,r),this.__data=e}static clone(e){return new this({data:e.__data,format:e.__format,key:e.__key})}static getType(){return"upload"}static importDOM(){return{img:e=>({conversion:o=>Ro(o,Ia),priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new va.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,pending:e.pending,relationTo:e.relationTo,value:e.value},r=Ia({data:o});return r.setFormat(e.format),r}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return Yg(o,e?.theme?.upload),o}decorate(){return null}exportDOM(){let e=document.createElement("img"),o=this.__data;return o.pending?(e.setAttribute("data-lexical-pending-upload-form-id",String(o?.pending?.formID)),e.setAttribute("src",o?.pending?.src||"")):(e.setAttribute("data-lexical-upload-id",String(o?.value)),e.setAttribute("data-lexical-upload-relation-to",o?.relationTo)),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"upload",version:3}}getData(){return this.getLatest().__data}setData(e){let o=this.getWritable();o.__data=e}updateDOM(){return!1}};function Ia({data:t}){return t?.id||(t.id=new va.default().toHexString()),qg(new Ft({data:t}))}import{jsx as Ma}from"react/jsx-runtime";import{ShimmerEffect as Qg}from"@payloadcms/ui";var Da=()=>Ma("div",{className:"lexical-upload",children:Ma(Qg,{height:"95px",width:"203px"})});var tx=Oa.lazy(()=>import("./component-5YLBQB5B.js").then(t=>({default:t.UploadComponent}))),de=class extends Ft{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{img:e=>({conversion:o=>Ro(o,me),priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new Aa.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,pending:e.pending,relationTo:e.relationTo,value:e.value},r=me({data:o});return r.setFormat(e.format),r}decorate(e,o){return this.__data.pending?$a(Da,{}):$a(tx,{className:o?.theme?.upload??"LexicalEditorTheme__upload",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function me({data:t}){return t?.id||(t.id=new Aa.default().toHexString()),ex(new de({data:t}))}function st(t){return t instanceof de}import{c as cx}from"react/compiler-runtime";import{jsx as ux}from"react/jsx-runtime";import{useLexicalComposerContext as dx}from"@lexical/react/LexicalComposerContext.js";import{$dfsIterator as Ja,$insertNodeToNearestRoot as Kr,mergeRegister as mx}from"@lexical/utils";import{useBulkUpload as px,useEffectEvent as fx,useModal as hx}from"@payloadcms/ui";import Jr from"bson-objectid";import{$createRangeSelection as gx,$getPreviousSelection as Ua,$getSelection as Wa,$isParagraphNode as zr,$isRangeSelection as Ga,$setSelection as xx,COMMAND_PRIORITY_EDITOR as Cx,COMMAND_PRIORITY_LOW as Va,createCommand as bx,DROP_COMMAND as kx,getDOMSelectionFromTarget as _x,isHTMLElement as Ka,PASTE_COMMAND as Tx}from"lexical";import{useEffect as wx}from"react";import{c as Fa}from"react/compiler-runtime";import{jsx as Gr}from"react/jsx-runtime";import{useLexicalComposerContext as Pa}from"@lexical/react/LexicalComposerContext.js";import{toast as ox}from"@payloadcms/ui";import{$getNodeByKey as rx,COMMAND_PRIORITY_EDITOR as Ba}from"lexical";import{useEffect as ja,useState as nx}from"react";var lx=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=rx(o);n&&n.replace(me({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(Vr,{fields:null,relationTo:e,value:r})},ix=t=>{let e=Fa(13),{enabledCollectionSlugs:o}=t,[r]=Pa(),[n,l]=nx(null),i;e[0]!==o?(i={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=i):i=e[1];let{closeListDrawer:s,ListDrawer:d,openListDrawer:c}=Mt(i),u,a;e[2]!==r||e[3]!==c?(u=()=>r.registerCommand(Ke,h=>(l(h?.replace?h?.replace.nodeKey:null),c(),!0),Ba),a=[r,c],e[2]=r,e[3]=c,e[4]=u,e[5]=a):(u=e[4],a=e[5]),ja(u,a);let m;e[6]!==s||e[7]!==r||e[8]!==n?(m=h=>{let{collectionSlug:x,doc:w}=h;s(),lx({editor:r,relationTo:x,replaceNodeKey:n,value:w.id})},e[6]=s,e[7]=r,e[8]=n,e[9]=m):m=e[9];let p=m,f;return e[10]!==d||e[11]!==p?(f=Gr(d,{onSelect:p}),e[10]=d,e[11]=p,e[12]=f):f=e[12],f},sx=()=>{let t=Fa(3),[e]=Pa(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Ke,ax,Ba),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),ja(o,r),null},Ha=({enabledCollectionSlugs:t})=>t?.length?Gr(ix,{enabledCollectionSlugs:t}):Gr(sx,{});function ax(){return ox.error("No upload collections enabled"),!0}function Ex(t){let e=t.target;return!!(Ka(e)&&!e.closest("code, span.editor-image")&&Ka(e.parentElement)&&e.parentElement.closest("div.ContentEditable__root"))}function Sx(t){let e,o=_x(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 Vr=bx("INSERT_UPLOAD_COMMAND"),za=t=>{let e=cx(21),{clientProps:o}=t,[r]=dx(),n=o?.disabledCollections,l=o?.enabledCollections,i;e[0]!==n||e[1]!==l?(i={collectionSlugsBlacklist:n,collectionSlugsWhitelist:l,uploads:!0},e[0]=n,e[1]=l,e[2]=i):i=e[2];let{enabledCollectionSlugs:s}=go(i),{drawerSlug:d,setCollectionSlug:c,setInitialForms:u,setOnCancel:a,setOnSuccess:m,setSelectableCollections:p}=px(),{isModalOpen:f,openModal:h}=hx(),x;e[3]!==d||e[4]!==r||e[5]!==s||e[6]!==f||e[7]!==h||e[8]!==c||e[9]!==u||e[10]!==a||e[11]!==m||e[12]!==p?(x=C=>{let{files:g}=C;if(g?.length!==0&&(u(b=>[...b??[],...g.map(Nx)]),!f(d))){if(!s.length||!s[0])return;c(s[0]),p(s),a(()=>{r.update(Lx)}),m(b=>{let k=new Map(b.map(yx));r.update(()=>{for(let y of Ja()){let R=y.node;if(st(R)){let M=R.getData();if(M?.pending){let L=k.get(M.pending?.formID);L&&R.replace(me({data:{id:new Jr.default().toHexString(),fields:{},relationTo:L.collectionSlug,value:L.doc.id}}))}}}})}),h(d)}},e[3]=d,e[4]=r,e[5]=s,e[6]=f,e[7]=h,e[8]=c,e[9]=u,e[10]=a,e[11]=m,e[12]=p,e[13]=x):x=e[13];let w=fx(x),E;e[14]!==r||e[15]!==w?(E=()=>{if(!r.hasNodes([de]))throw new Error("UploadPlugin: UploadNode not registered on editor");return mx(r.registerNodeTransform(de,C=>{let g=C.getData();if(!g?.pending)return;(async function(){let y=null,R=g?.pending?.src,M=g?.pending?.formID;if(R?.startsWith("data:")){let L=R.match(/data:(image\/[a-zA-Z]+);base64,/),T=L?L[1]:"image/png",S=R.replace(/^data:image\/[a-zA-Z]+;base64,/,""),I=atob(S),A=new Array(I.length);for(let D=0;D<I.length;D++)A[D]=I.charCodeAt(D);let v=new Uint8Array(A);y={alt:void 0,file:new File([v],"pasted-image."+T?.split("/",2)[1],{type:T}),formID:M}}else if(R?.startsWith("http")||R?.startsWith("https")){let T=await(await fetch(R)).blob(),S=R.split("/").pop()||"pasted-image"+T.type.split("/",2)[1];y={alt:void 0,file:new File([T],S,{type:T.type}),formID:M}}y&&w({files:[y]})})()}),r.registerCommand(Vr,C=>(r.update(()=>{let g=Wa()||Ua();if(Ga(g)){let b=me({data:{id:C.id,fields:C.fields,relationTo:C.relationTo,value:C.value}}),{focus:k}=g,y=k.getNode();Kr(b),zr(y)&&!y.__first&&y.remove()}}),!0),Cx),r.registerCommand(Tx,C=>{if(!(C instanceof ClipboardEvent))return!1;let g=C.clipboardData;if(!g?.types?.length||g?.types?.includes("text/html"))return!1;let b=[];return g?.files?.length&&Array.from(g.files).forEach(k=>{b.push({alt:"",file:k,formID:new Jr.default().toHexString()})}),b.length?(r.update(()=>{let k=Wa()||Ua();if(Ga(k))for(let y of b){let R=me({data:{pending:{formID:y.formID,src:URL.createObjectURL(y.file)}}}),{focus:M}=k,L=M.getNode();Kr(R),zr(L)&&!L.__first&&L.remove()}}),w({files:b}),!0):!1},Va),r.registerCommand(kx,C=>{if(!(C instanceof DragEvent))return!1;let g=C.dataTransfer;if(!g?.types?.length)return!1;let b=[];return g?.files?.length&&Array.from(g.files).forEach(k=>{b.push({alt:"",file:k,formID:new Jr.default().toHexString()})}),b.length?(C.preventDefault(),C.stopPropagation(),r.update(()=>{if(Ex(C)){let k=Sx(C),y=gx();k!=null&&y.applyDOMRange(k),xx(y);for(let R of b){let M=me({data:{pending:{formID:R.formID,src:URL.createObjectURL(R.file)}}}),{focus:L}=y,T=L.getNode();Kr(M),zr(T)&&!T.__first&&T.remove()}}}),w({files:b}),!0):!1},Va))},e[14]=r,e[15]=w,e[16]=E):E=e[16];let N;e[17]!==r?(N=[r],e[17]=r,e[18]=N):N=e[18],wx(E,N);let _;return e[19]!==s?(_=ux(Ha,{enabledCollectionSlugs:s}),e[19]=s,e[20]=_):_=e[20],_};function Nx(t){return{file:t.file,formID:t.formID}}function Lx(){for(let t of Ja()){let e=t.node;st(e)&&e.getData()?.pending&&e.remove()}}function yx(t){return[t.formID,t]}var Ix=$({nodes:[de],plugins:[{Component:za,position:"normal"}],slashMenu:{groups:[Y([{Icon:Wr,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ke,{replace:!1})}}])]},toolbarFixed:{groups:[xe([{ChildComponent:Wr,isActive:({selection:t})=>{if(!Rx(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return st(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ke,{replace:!1})}}])]}});import{c as Mx}from"react/compiler-runtime";import{jsx as Yr}from"react/jsx-runtime";import{ShimmerEffect as Dx,useConfig as $x}from"@payloadcms/ui";import{lazy as Ax,Suspense as Ox,useEffect as Fx,useState as Px}from"react";var Xa={block:"LexicalEditorTheme__block",blockCursor:"LexicalEditorTheme__blockCursor",characterLimit:"LexicalEditorTheme__characterLimit",code:"LexicalEditorTheme__code",inlineBlock:"LexicalEditorTheme__inlineBlock",heading:{h1:"LexicalEditorTheme__h1",h2:"LexicalEditorTheme__h2",h3:"LexicalEditorTheme__h3",h4:"LexicalEditorTheme__h4",h5:"LexicalEditorTheme__h5",h6:"LexicalEditorTheme__h6"},hr:"LexicalEditorTheme__hr",hrSelected:"LexicalEditorTheme__hrSelected",indent:"LexicalEditorTheme__indent",link:"LexicalEditorTheme__link",list:{checklist:"LexicalEditorTheme__checklist",listitem:"LexicalEditorTheme__listItem",listitemChecked:"LexicalEditorTheme__listItemChecked",listitemUnchecked:"LexicalEditorTheme__listItemUnchecked",nested:{listitem:"LexicalEditorTheme__nestedListItem"},olDepth:["LexicalEditorTheme__ol1","LexicalEditorTheme__ol2","LexicalEditorTheme__ol3","LexicalEditorTheme__ol4","LexicalEditorTheme__ol5"],ul:"LexicalEditorTheme__ul"},ltr:"LexicalEditorTheme__ltr",mark:"LexicalEditorTheme__mark",markOverlap:"LexicalEditorTheme__markOverlap",paragraph:"LexicalEditorTheme__paragraph",placeholder:"LexicalEditorTheme__placeholder",quote:"LexicalEditorTheme__quote",relationship:"LexicalEditorTheme__relationship",rtl:"LexicalEditorTheme__rtl",tab:"LexicalEditorTheme__tabNode",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableAlignment:{center:"LexicalEditorTheme__tableAlignmentCenter",right:"LexicalEditorTheme__tableAlignmentRight"},tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableFrozenColumn:"LexicalEditorTheme__tableFrozenColumn",tableRowStriping:"LexicalEditorTheme__tableRowStriping",tableScrollableWrapper:"LexicalEditorTheme__tableScrollableWrapper",tableSelected:"LexicalEditorTheme__tableSelected",tableSelection:"LexicalEditorTheme__tableSelection",text:{bold:"LexicalEditorTheme__textBold",code:"LexicalEditorTheme__textCode",italic:"LexicalEditorTheme__textItalic",strikethrough:"LexicalEditorTheme__textStrikethrough",subscript:"LexicalEditorTheme__textSubscript",superscript:"LexicalEditorTheme__textSuperscript",underline:"LexicalEditorTheme__textUnderline",underlineStrikethrough:"LexicalEditorTheme__textUnderlineStrikethrough"},upload:"LexicalEditorTheme__upload"};var Xr={namespace:"lexical",theme:Xa};function Za({config:t,featureClientImportMap:e,featureClientSchemaMap:o,field:r,schemaPath:n,unSanitizedEditorConfig:l}){let i=new Map;for(let c of l.features){if(!c?.clientFeatureProps?.featureKey||c?.clientFeatureProps?.order===void 0||c?.clientFeatureProps?.order===null)throw new Error("A Feature you have installed does not return the client props as clientFeatureProps. Please make sure to always return those props, even if they are null, as other important props like order and featureKey are later on injected.");i.set(c.clientFeatureProps.featureKey,c)}l.features=l.features.sort((c,u)=>c.clientFeatureProps.order-u.clientFeatureProps.order);let s=new Map,d=0;for(let c of l.features){let u=typeof c.feature=="function"?c.feature({config:t,featureClientImportMap:e,featureClientSchemaMap:o,featureProviderMap:i,field:r,resolvedFeatures:s,schemaPath:n,unSanitizedEditorConfig:l}):c.feature;u.key=c.clientFeatureProps.featureKey,u.order=d,s.set(c.clientFeatureProps.featureKey,u),d++}return s}import{deepMerge as vx}from"payload/shared";var Ya=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}},o={};if(t.forEach(r=>{r.key==="toolbarFixed"&&r.sanitizedClientFeatureProps?.customGroups&&(o={...o,...r.sanitizedClientFeatureProps.customGroups})}),!t?.size)return e;t.forEach(r=>{if(r.providers?.length&&(e.providers=e.providers.concat(r.providers)),r.enableFormats?.length&&e.enabledFormats.push(...r.enableFormats),r.nodes?.length)for(let n of r.nodes)e.nodes.push(n);if(r.plugins?.length&&r.plugins.forEach((n,l)=>{e.plugins?.push({clientProps:r.sanitizedClientFeatureProps,Component:n.Component,key:r.key+l,position:n.position})}),r.toolbarInline?.groups?.length)for(let n of r.toolbarInline.groups){let l=e.toolbarInline.groups.find(i=>i.key===n.key);l?e.toolbarInline.groups=e.toolbarInline.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.toolbarInline?.groups.push(l)}if(r.toolbarFixed?.groups?.length)for(let n of r.toolbarFixed.groups){let l=e.toolbarFixed.groups.find(i=>i.key===n.key);l?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.toolbarFixed?.groups.push(l)}if(r.slashMenu?.groups){r.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(r.slashMenu.dynamicGroups));for(let n of r.slashMenu.groups){let l=e.slashMenu.groups.find(i=>i.key===n.key);l?e.slashMenu.groups=e.slashMenu.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.slashMenu.groups.push(l)}}if(r.markdownTransformers?.length)for(let n of r.markdownTransformers)typeof n=="function"?e.markdownTransformers.push(n({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(n);e.enabledFeatures.push(r.key)}),Object.keys(o).length>0&&(e.toolbarFixed.groups=e.toolbarFixed.groups.map(r=>{let n=o[r.key];return n?vx(r,n):r})),e.toolbarInline.groups.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0),e.toolbarFixed.groups.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);for(let r of e.toolbarInline.groups)r.items.sort((n,l)=>n.order&&l.order?n.order-l.order:n.order?-1:l.order?1:0);for(let r of e.toolbarFixed.groups)r.items.sort((n,l)=>n.order&&l.order?n.order-l.order:n.order?-1:l.order?1:0);return e};function Zr(t,e,o){return{admin:o,features:Ya(t),lexical:e,resolvedFeatureMap:t}}var Bx=Ax(()=>import("./Field-F2KOJLMQ.js").then(t=>({default:t.RichText}))),jx=t=>{let e=Mx(18),{admin:o,clientFeatures:r,featureClientImportMap:n,featureClientSchemaMap:l,field:i,lexicalEditorConfig:s,schemaPath:d}=t,c;e[0]!==o?(c=o===void 0?{}:o,e[0]=o,e[1]=c):c=e[1];let u=c,a;e[2]!==n?(a=n===void 0?{}:n,e[2]=n,e[3]=a):a=e[3];let m=a,p=s===void 0?Xr:s,{config:f}=$x(),[h,x]=Px(null),w,E;e[4]!==u||e[5]!==r||e[6]!==f||e[7]!==m||e[8]!==l||e[9]!==i||e[10]!==h||e[11]!==p||e[12]!==d?(w=()=>{if(h)return;let _=[];for(let g of Object.values(r))g.clientFeatureProvider&&_.push(g.clientFeatureProvider(g.clientFeatureProps));let C=Za({config:f,featureClientImportMap:m,featureClientSchemaMap:l,field:i,schemaPath:d??i.name,unSanitizedEditorConfig:{features:_,lexical:p}});x(Zr(C,p,u))},E=[u,r,f,m,l,i,h,p,d],e[4]=u,e[5]=r,e[6]=f,e[7]=m,e[8]=l,e[9]=i,e[10]=h,e[11]=p,e[12]=d,e[13]=w,e[14]=E):(w=e[13],E=e[14]),Fx(w,E);let N;return e[15]!==h||e[16]!==t?(N=Yr(Ox,{fallback:Yr(Dx,{height:"35vh"}),children:h&&Yr(Bx,{...t,editorConfig:h})}),e[15]=h,e[16]=t,e[17]=N):N=e[17],N};function Hx(t){return t instanceof HTMLElement}function Ux(...t){return t.filter(Boolean).join(" ")}var Io=new WeakMap;function qa(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function vo(t,e){let o=Io.get(t);if(o===void 0){let r=new Set,n=i=>{o!==void 0&&(o.start=qa(i))},l=i=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let d=qa(i);for(let c of r)d!==null&&c([d[0]-s[0],d[1]-s[1]],i)};t.addEventListener("touchstart",n),t.addEventListener("touchend",l),o={handleTouchend:l,handleTouchstart:n,listeners:r,start:null},Io.set(t,o)}return o.listeners.add(e),()=>{Wx(t,e)}}function Wx(t,e){let o=Io.get(t);if(o===void 0)return;let{listeners:r}=o;r.delete(e),r.size===0&&(Io.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function Gx(t,e){return vo(t,(o,r)=>{let[n,l]=o;n<0&&-n>Math.abs(l)&&e(n,r)})}function Vx(t,e){return vo(t,(o,r)=>{let[n,l]=o;n>0&&n>Math.abs(l)&&e(n,r)})}function Kx(t,e){return vo(t,(o,r)=>{let[n,l]=o;l<0&&-l>Math.abs(n)&&e(n,r)})}function Jx(t,e){return vo(t,(o,r)=>{let[n,l]=o;l>0&&l>Math.abs(n)&&e(n,r)})}import{c as zx}from"react/compiler-runtime";import{jsx as Xx}from"react/jsx-runtime";import"react";var Zx=()=>{let t=zx(2),{EditButton:e}=he(),o;return t[0]!==e?(o=e?Xx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Yx}from"react/compiler-runtime";import{jsx as qx}from"react/jsx-runtime";import"react";var Qx=()=>{let t=Yx(2),{RemoveButton:e}=he(),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),{Label:e}=he(),o;return t[0]!==e?(o=e?tC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as rC}from"react/compiler-runtime";import{jsx as nC}from"react/jsx-runtime";import"react";var lC=t=>{let e=rC(3),{children:o}=t,{InlineBlockContainer:r}=he(),n;return e[0]!==r||e[1]!==o?(n=r?nC(r,{children:o}):null,e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{jsx as iC}from"react/jsx-runtime";import"react";var sC=t=>{let{children:e,...o}=t,{BlockCollapsible:r}=ge();return r?iC(r,{...o,children:e}):null};import{c as aC}from"react/compiler-runtime";import{jsx as cC}from"react/jsx-runtime";import"react";var uC=()=>{let t=aC(2),{EditButton:e}=ge(),o;return t[0]!==e?(o=e?cC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as dC}from"react/compiler-runtime";import{jsx as mC}from"react/jsx-runtime";import"react";var pC=()=>{let t=dC(2),{RemoveButton:e}=ge(),o;return t[0]!==e?(o=e?mC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as fC}from"qs-esm";var hC=({apiURL:t,depth:e,draft:o,locale:r})=>async({id:l,collectionSlug:i,select:s})=>{let d=fC({depth:e??0,draft:o??!1,locale:r,select:s},{addQueryPrefix:!0});return await fetch(`${t}/${i}/${l}${d}`,{credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json"},method:"GET"}).then(u=>u.json())};var Qa={customEndRegex:{optional:!0,regExp:/[ \t]*```$/},customStartRegex:/^[ \t]*```(\w+)?/,doNotTrimChildren:!0,export:({fields:t})=>!t.code.includes(`
60
+ `);let o=oh(To.NO_STATUS);return Wt(t,e,o),o},qs=(t,e)=>{let o=t.match(Qs);return!o||!o[1]?null:o[1].split("|").map(r=>ta(r,e))};import{c as ph}from"react/compiler-runtime";import{jsx as P,jsxs as Se}from"react/jsx-runtime";import{useLexicalComposerContext as ia}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as fh}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as ra,$deleteTableColumnAtSelection as hh,$deleteTableRowAtSelection as gh,$getNodeTriplet as xh,$getTableCellNodeFromLexicalNode as na,$getTableColumnIndexFromTableCellNode as Ch,$getTableNodeFromLexicalNodeOrThrow as ve,$getTableRowIndexFromTableCellNode as bh,$insertTableColumnAtSelection as kh,$insertTableRowAtSelection as _h,$isTableCellNode as sa,$isTableSelection as At,$mergeCells as Th,$unmergeCell as wh,getTableElement as Dr,getTableObserverFromTableElement as $r,TableCellHeaderStates as Ie,TableCellNode as Eh}from"@lexical/table";import{mergeRegister as Sh}from"@lexical/utils";import{useScrollInfo as Nh}from"@payloadcms/ui";import{$getSelection as Eo,$isElementNode as Lh,$isRangeSelection as Ar,$isTextNode as yh,$setSelection as Rh,COMMAND_PRIORITY_CRITICAL as Ih,getDOMSelection as vh,isDOMNode as Mh,SELECTION_CHANGE_COMMAND as Dh}from"lexical";import*as Or from"react";import{useCallback as ae,useEffect as nt,useRef as wo,useState as lt}from"react";import{createPortal as aa}from"react-dom";import{jsx as Mr,jsxs as mh}from"react/jsx-runtime";import"react";var oa=()=>mh("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[Mr("path",{d:"M5 11C5.55228 11 6 10.5523 6 10C6 9.44772 5.55228 9 5 9C4.44772 9 4 9.44772 4 10C4 10.5523 4.44772 11 5 11Z",fill:"currentColor"}),Mr("path",{d:"M10 11C10.5523 11 11 10.5523 11 10C11 9.44772 10.5523 9 10 9C9.44772 9 9 9.44772 9 10C9 10.5523 9.44772 11 10 11Z",fill:"currentColor"}),Mr("path",{d:"M15 11C15.5523 11 16 10.5523 16 10C16 9.44772 15.5523 9 15 9C14.4477 9 14 9.44772 14 10C14 10.5523 14.4477 11 15 11Z",fill:"currentColor"})]});function la(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function $h(){let t=Eo();if(Ar(t)&&!t.isCollapsed()||At(t)&&!t.anchor.is(t.focus)||!Ar(t)&&!At(t))return!1;let[e]=xh(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function Ah(t){let e=t.getLastDescendant();yh(e)?e.select():Lh(e)?e.selectEnd():e!==null&&e.selectNext()}function Oh({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[l]=ia(),i=wo(null),[s,d]=lt(n),[c,u]=lt({columns:1,rows:1}),[a,m]=lt(!1),[p,f]=lt(!1),{y:h}=Nh();nt(()=>l.registerMutationListener(Eh,T=>{T.get(s.getKey())==="updated"&&l.getEditorState().read(()=>{d(s.getLatest())})},{skipInitialization:!0}),[l,s]),nt(()=>{l.getEditorState().read(()=>{let T=Eo();if(At(T)){let S=la(T);u(la(T)),m(S.columns>1||S.rows>1)}f($h())})},[l]),nt(()=>{let T=e.current,S=i.current,I=l.getRootElement();if(T!=null&&S!=null&&I!=null){let A=I.getBoundingClientRect(),v=T.getBoundingClientRect();S.style.opacity="1";let O=S.getBoundingClientRect(),D=5,G=v.right+D;if(G+O.width>window.innerWidth||G+O.width>A.right){let J=v.left-O.width-D;G=(J<0?D:J)+window.pageXOffset}S.style.left=`${G+window.pageXOffset}px`;let Q=v.top;if(Q+O.height>window.innerHeight){let J=v.bottom-O.height;Q=J<0?D:J}S.style.top=`${Q}px`}},[e,i,l,h]),nt(()=>{function T(S){i.current!=null&&e.current!=null&&Mh(S.target)&&!i.current.contains(S.target)&&!e.current.contains(S.target)&&r(!1)}return window.addEventListener("click",T),()=>window.removeEventListener("click",T)},[r,e]);let x=ae(()=>{l.update(()=>{if(s.isAttached()){let T=ve(s),S=Dr(T,l.getElementByKey(T.getKey()));if(S===null)throw new Error("Expected to find tableElement in DOM");let I=$r(S);I!==null&&I.$clearHighlight(),T.markDirty(),d(s.getLatest())}Rh(null)})},[l,s]),w=()=>{l.update(()=>{let T=Eo();if(!At(T))return;let I=T.getNodes().filter(sa),A=Th(I);A&&(Ah(A),o())})},E=()=>{l.update(()=>{wh()})},N=ae(T=>{l.update(()=>{for(let S=0;S<c.rows;S++)_h(T);o()})},[l,o,c.rows]),_=ae(T=>{l.update(()=>{for(let S=0;S<c.columns;S++)kh(T);o()})},[l,o,c.columns]),C=ae(()=>{l.update(()=>{gh(),o()})},[l,o]),g=ae(()=>{l.update(()=>{ve(s).remove(),x(),o()})},[l,s,x,o]),b=ae(()=>{l.update(()=>{hh(),o()})},[l,o]),k=ae(()=>{l.update(()=>{let T=ve(s),S=bh(s),[I]=ra(T,null,null),A=new Set,v=s.getHeaderStyles()^Ie.ROW;if(I[S])for(let O=0;O<I[S].length;O++){let D=I[S][O];D?.cell&&(A.has(D.cell)||(A.add(D.cell),D.cell.setHeaderStyles(v,Ie.ROW)))}x(),o()})},[l,s,x,o]),y=ae(()=>{l.update(()=>{let T=ve(s),S=Ch(s),[I]=ra(T,null,null),A=new Set,v=s.getHeaderStyles()^Ie.COLUMN;if(I)for(let O=0;O<I.length;O++){let D=I?.[O]?.[S];D?.cell&&(A.has(D.cell)||(A.add(D.cell),D.cell.setHeaderStyles(v,Ie.COLUMN)))}x(),o()})},[l,s,x,o]),R=ae(()=>{l.update(()=>{if(s.isAttached()){let T=ve(s);T&&T.setRowStriping(!T.getRowStriping())}x(),o()})},[l,s,x,o]),M=ae(()=>{l.update(()=>{if(s.isAttached()){let T=ve(s);T&&T.setFrozenColumns(T.getFrozenColumns()===0?1:0)}x(),o()})},[l,s,x,o]),L=null;return t&&(a?L=P("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>w(),type:"button",children:P("span",{className:"text",children:"Merge cells"})}):p&&(L=P("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>E(),type:"button",children:P("span",{className:"text",children:"Unmerge cells"})}))),aa(Se("div",{className:"table-action-menu-dropdown",onClick:T=>{T.stopPropagation()},ref:i,children:[L?Se(Or.Fragment,{children:[L,P("hr",{})]}):null,P("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>R(),type:"button",children:P("span",{className:"text",children:"Toggle Row Striping"})}),P("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>M(),type:"button",children:P("span",{className:"text",children:"Toggle First Column Freeze"})}),P("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>N(!1),type:"button",children:Se("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," above"]})}),P("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>N(!0),type:"button",children:Se("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," below"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>_(!1),type:"button",children:Se("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","left"]})}),P("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>_(!0),type:"button",children:Se("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","right"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>b(),type:"button",children:P("span",{className:"text",children:"Delete column"})}),P("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>C(),type:"button",children:P("span",{className:"text",children:"Delete row"})}),P("button",{className:"item","data-test-id":"table-delete",onClick:()=>g(),type:"button",children:P("span",{className:"text",children:"Delete table"})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-row-header",onClick:()=>k(),type:"button",children:Se("span",{className:"text",children:[(s.__headerState&Ie.ROW)===Ie.ROW?"Remove":"Add"," ","row header"]})}),P("button",{className:"item","data-test-id":"table-column-header",onClick:()=>y(),type:"button",children:Se("span",{className:"text",children:[(s.__headerState&Ie.COLUMN)===Ie.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function Fh({anchorElem:t,cellMerge:e}){let[o]=ia(),r=wo(null),n=wo(null),[l,i]=lt(!1),[s,d]=lt(null),c=ae(()=>{let a=r.current,m=Eo(),p=vh(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")),d(null)}if(m==null||a==null)return h();let x=o.getRootElement(),w=null,E=null;if(Ar(m)&&x!==null&&p!==null&&x.contains(p.anchorNode)){let _=na(m.anchor.getNode());if(_==null||(E=o.getElementByKey(_.getKey()),E==null||!_.isAttached()))return h();let C=ve(_),g=Dr(C,o.getElementByKey(C.getKey()));if(g===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");w=$r(g),d(_)}else if(At(m)){let _=na(m.anchor.getNode());if(!sa(_))throw new Error("TableSelection anchorNode must be a TableCellNode");let C=ve(_),g=Dr(C,o.getElementByKey(C.getKey()));if(g===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");w=$r(g),E=o.getElementByKey(_.getKey())}else if(!f)return h();if(w===null||E===null)return h();let N=!w||!w.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",N),a.classList.toggle("table-cell-action-button-container--inactive",!N),N){let _=E.getBoundingClientRect(),C=t.getBoundingClientRect(),g=_.top-C.top,b=_.right-C.left;a.style.transform=`translate(${b}px, ${g}px)`}},[o,t]);nt(()=>{let a,m=()=>{a=void 0,o.getEditorState().read(c)},p=()=>(a===void 0&&(a=setTimeout(m,0)),!1);return Sh(o.registerUpdateListener(p),o.registerCommand(Dh,p,Ih),o.registerRootListener((f,h)=>{h&&h.removeEventListener("pointerup",p),f&&(f.addEventListener("pointerup",p),p())}),()=>clearTimeout(a))});let u=wo(s);return nt(()=>{u.current!==s&&i(!1),u.current=s},[u,s]),P("div",{className:"table-cell-action-button-container",ref:r,children:s!=null&&Se(Or.Fragment,{children:[P("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),i(!l)},ref:n,type:"button",children:P(oa,{})}),l&&P(Oh,{cellMerge:e,contextRef:n,onClose:()=>i(!1),setIsMenuOpen:i,tableCellNode:s})]})})}var ca=t=>{let e=ph(3),{anchorElem:o}=t,r=fh(),n;return e[0]!==o||e[1]!==r?(n=aa(r?P(Fh,{anchorElem:o??document.body,cellMerge:!0}):null,o??document.body),e[0]=o,e[1]=r,e[2]=n):n=e[2],n};import{c as Ph}from"react/compiler-runtime";import{jsx as No,jsxs as Bh}from"react/jsx-runtime";import{useLexicalComposerContext as jh}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Hh}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as Uh,$getTableNodeFromLexicalNodeOrThrow as Fr,$getTableRowIndexFromTableCellNode as Wh,$isTableCellNode as ua,$isTableRowNode as Gh,getDOMCellFromTarget as Vh,getTableElement as Kh,TableNode as da}from"@lexical/table";import{calculateZoomLevel as ma,mergeRegister as Jh}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Pr,isHTMLElement as zh,SKIP_SCROLL_INTO_VIEW_TAG as pa}from"lexical";import*as ha from"react";import{useCallback as Ot,useEffect as Br,useRef as So,useState as it}from"react";import{createPortal as Xh}from"react-dom";var Zh=33,fa=92;function Yh({editor:t}){let e=So(null),o=So(null),r=So(null),[n,l]=it(!1),i=H(),s=So(null),[d,c]=it(null),[u,a]=it(null),[m,p]=it(!1),[f,h]=it(null),x=Ot(()=>{a(null),e.current=null,h(null),s.current=null,r.current=null},[]),w=M=>(M.buttons&1)===1;Br(()=>{let M=new Set;return Jh(t.registerMutationListener(da,L=>{for(let[T,S]of L)S==="destroyed"?M.delete(T):M.add(T);l(M.size>0)}),t.registerNodeTransform(da,L=>{if(L.getColWidths())return L;let T=L.getColumnCount(),S=fa;return L.setColWidths(Array(T).fill(S)),L}))},[t]),Br(()=>{if(!n)return;let M=I=>{let A=I.target;if(zh(A)){if(f){c({x:I.clientX,y:I.clientY});return}if(p(w(I)),!(o.current&&o.current.contains(A))&&e.current!==A){e.current=A;let v=Vh(A);v&&u!==v?t.getEditorState().read(()=>{let O=Pr(v.elem);if(!O)throw new Error("TableCellResizer: Table cell node not found.");let D=Fr(O),G=Kh(D,t.getElementByKey(D.getKey()));if(!G)throw new Error("TableCellResizer: Table element not found.");e.current=A,r.current=G.getBoundingClientRect(),a(v)},{editor:t}):v==null&&x()}}},L=I=>{p(!0)},T=I=>{p(!1)},S=t.registerRootListener((I,A)=>{A?.removeEventListener("mousemove",M),A?.removeEventListener("mousedown",L),A?.removeEventListener("mouseup",T),I?.addEventListener("mousemove",M),I?.addEventListener("mousedown",L),I?.addEventListener("mouseup",T)});return()=>{S()}},[u,f,t,n,x]);let E=M=>M==="bottom",N=Ot(M=>{if(!u)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let L=Pr(u.elem);if(!ua(L))throw new Error("TableCellResizer: Table cell node not found.");let T=Fr(L),S=Wh(L),I=T.getChildren(),v=L.getColSpan()===T.getColumnCount()?S:S+L.getRowSpan()-1;if(v>=I.length||v<0)throw new Error("Expected table cell to be inside of table row.");let O=I[v];if(!Gh(O))throw new Error("Expected table row");let D=O.getHeight();if(D===void 0){let Q=O.getChildren();D=Math.min(...Q.map(J=>_(J,t)??1/0))}let G=Math.max(D+M,Zh);O.setHeight(G)},{tag:pa})},[u,t]),_=(M,L)=>L.getElementByKey(M.getKey())?.clientHeight,C=(M,L)=>{let T;return L.forEach(S=>{S.forEach((I,A)=>{I.cell===M&&(T=A)})}),T},g=Ot(M=>{if(!u)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let L=Pr(u.elem);if(!ua(L))throw new Error("TableCellResizer: Table cell node not found.");let T=Fr(L),[S]=Uh(T,null,null),I=C(L,S);if(I===void 0)throw new Error("TableCellResizer: Table column not found.");let A=T.getColWidths();if(!A)return;let v=A[I];if(v===void 0)return;let O=[...A],D=Math.max(v+M,fa);O[I]=D,T.setColWidths(O)},{tag:pa})},[u,t]),b=Ot(M=>{let L=T=>{if(T.preventDefault(),T.stopPropagation(),!u)throw new Error("TableCellResizer: Expected active cell.");if(s.current){let{x:S,y:I}=s.current;if(u===null)return;let A=ma(T.target);if(E(M)){let v=(T.clientY-I)/A;N(v)}else{let v=(T.clientX-S)/A;g(v)}x(),document.removeEventListener("mouseup",L)}};return L},[u,x,g,N]),k=Ot(M=>L=>{if(L.preventDefault(),L.stopPropagation(),!u)throw new Error("TableCellResizer: Expected active cell.");s.current={x:L.clientX,y:L.clientY},c(s.current),h(M),document.addEventListener("mouseup",b(M))},[u,b]),[y,R]=it({bottom:null,left:null,right:null,top:null});return Br(()=>{if(u){let{height:M,left:L,top:T,width:S}=u.elem.getBoundingClientRect(),I=ma(u.elem),A=10,v={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${A}px`,left:`${window.scrollX+L}px`,top:`${window.scrollY+T+M-A/2}px`,width:`${S}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${M}px`,left:`${window.scrollX+L+S-A/2}px`,top:`${window.scrollY+T}px`,width:`${A}px`}},O=r.current;f&&d&&O&&(E(f)?(v[f].left=`${window.scrollX+O.left}px`,v[f].top=`${window.scrollY+d.y/I}px`,v[f].height="3px",v[f].width=`${O.width}px`):(v[f].top=`${window.scrollY+O.top}px`,v[f].left=`${window.scrollX+d.x/I}px`,v[f].width="3px",v[f].height=`${O.height}px`),v[f].backgroundColor="#adf"),R(v)}else R({bottom:null,left:null,right:null,top:null})},[u,f,d]),No("div",{ref:o,children:u!=null&&!m&&Bh(ha.Fragment,{children:[No("div",{className:`${i.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:k("right"),style:y.right||void 0}),No("div",{className:`${i.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:k("bottom"),style:y.bottom||void 0})]})})}var ga=()=>{let t=Ph(3),[e]=jh(),o=Hh(),r;return t[0]!==e||t[1]!==o?(r=o?Xh(No(Yh,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=r):r=t[2],r};import{c as lg}from"react/compiler-runtime";import{jsx as jr,jsxs as ig,Fragment as sg}from"react/jsx-runtime";import{useLexicalComposerContext as ag}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Ea}from"@lexical/react/useLexicalEditable";import{$getTableAndElementByKey as cg,$getTableColumnIndexFromTableCellNode as ug,$getTableRowIndexFromTableCellNode as dg,$insertTableColumnAtSelection as mg,$insertTableRowAtSelection as pg,$isTableCellNode as fg,$isTableNode as ba,getTableElement as hg,TableNode as gg}from"@lexical/table";import{$findMatchingParent as xg,mergeRegister as Cg}from"@lexical/utils";import{$getNearestNodeFromDOMNode as ka,isHTMLElement as bg}from"lexical";import{useEffect as _a,useMemo as kg,useRef as Ta,useState as Lo}from"react";import"react";import{createPortal as _g}from"react-dom";import{c as og}from"react/compiler-runtime";import{useEffect as rg,useRef as ng}from"react";var qh="Expected a function",Qh=Math.max,eg=Math.min;function tg(t,e,o){let r,n,l=0,i,s=!1,d=!1,c,u,a,m=!0;if(typeof t!="function")throw new TypeError(qh);e=e||0,typeof o=="object"&&(s=!!o.leading,d="maxWait"in o,c=d?Qh(o.maxWait||0,e):c,m="trailing"in o?!!o.trailing:m);function p(g){let b=r,k=i;return r=i=void 0,l=g,u=t.apply(k,b),u}function f(g){return l=g,a=setTimeout(w,e),s?p(g):u}function h(g){let b=g-n,k=g-l,y=e-b;return d?eg(y,c-k):y}function x(g){let b=g-n,k=g-l;return n===void 0||b>=e||b<0||d&&k>=c}function w(){let g=Date.now();if(x(g))return E(g);a=setTimeout(w,h(g))}function E(g){return a=void 0,m&&r?p(g):(r=i=void 0,u)}function N(){a!==void 0&&clearTimeout(a),l=0,r=n=i=a=void 0}function _(){return a===void 0?u:E(Date.now())}function C(){let g=Date.now(),b=x(g);if(r=arguments,i=this,n=g,b){if(a===void 0)return f(n);if(d)return clearTimeout(a),a=setTimeout(w,e),p(n)}return a===void 0&&(a=setTimeout(w,e)),u}return C.cancel=N,C.flush=_,C}var xa=tg;function Ca(t,e,o){let r=og(6),n=ng(null),l,i;r[0]!==t||r[1]!==o||r[2]!==e?(l=()=>(n.current=xa(t,e,{maxWait:o}),()=>{n.current?.cancel()}),i=[t,e,o],r[0]=t,r[1]=o,r[2]=e,r[3]=l,r[4]=i):(l=r[3],i=r[4]),rg(l,i);let s;return r[5]===Symbol.for("react.memo_cache_sentinel")?(s=(...c)=>{let u=c;n.current&&n.current(...u)},r[5]=s):s=r[5],s}var wa=20;function Tg({anchorElem:t}){let[e]=ag(),o=Ea(),r=H(),[n,l]=Lo(!1),[i,s]=Lo(!1),[d,c]=Lo(!1),[u,a]=Lo({}),m=Ta(new Set),p=Ta(null),f=Ca(w=>{let{isOutside:E,tableDOMNode:N}=wg(w,r.editorConfig?.lexical);if(E){l(!1),s(!1);return}if(!N)return;p.current=N;let _=null,C=null,g=null;if(e.getEditorState().read(()=>{let v=ka(N);if(fg(v)){let O=xg(v,D=>ba(D));if(!ba(O))return;if(g=hg(O,e.getElementByKey(O.getKey())),g){let D=O.getChildrenSize(),G=O.getChildAtIndex(0)?.getChildrenSize(),Q=dg(v),J=ug(v);Q===D-1?_=v:J===G-1&&(C=v)}}},{editor:e}),!g)return;let b=g.parentElement;if(!b)return;let{bottom:k,height:y,left:R,right:M,width:L,y:T}=g.getBoundingClientRect(),S=!1;b&&b.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(S=b.scrollWidth>b.clientWidth);let{left:I,y:A}=t.getBoundingClientRect();_?(s(!1),l(!0),a({height:wa,left:S&&b?b.offsetLeft:R-I,top:k-A+5,width:S&&b?b.offsetWidth:L})):C&&(s(!0),l(!1),a({height:y,left:M-I+5,top:T-A,width:wa}))},50,250),h=kg(()=>new ResizeObserver(()=>{l(!1),s(!1)}),[]);_a(()=>{if(d)return document.addEventListener("mousemove",f),()=>{l(!1),s(!1),document.removeEventListener("mousemove",f)}},[d,f]),_a(()=>Cg(e.registerMutationListener(gg,w=>{e.getEditorState().read(()=>{let E=!1;for(let[N,_]of w)switch(_){case"created":{m.current.add(N),E=!0;break}case"destroyed":{m.current.delete(N),E=!0;break}default:break}if(E){h.disconnect();for(let N of m.current){let{tableElement:_}=cg(N);h.observe(_)}c(m.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,h]);let x=w=>{e.update(()=>{p.current&&(ka(p.current)?.selectEnd(),w?(pg(),l(!1)):(mg(),s(!1)))})};return o?ig(sg,{children:[n&&jr("button",{"aria-label":"Add Row",className:r.editorConfig.lexical.theme.tableAddRows,onClick:()=>x(!0),style:{...u},type:"button"}),i&&jr("button",{"aria-label":"Add Column",className:r.editorConfig.lexical.theme.tableAddColumns,onClick:()=>x(!1),style:{...u},type:"button"})]}):null}function wg(t,e){let o=t.target;if(bg(o)){let r=o.closest(`td.${e.theme.tableCell}, th.${e.theme.tableCell}`);return{isOutside:!(r||o.closest(`button.${e.theme.tableAddRows}`)||o.closest(`button.${e.theme.tableAddColumns}`)||o.closest(`div.${e.theme.tableCellResizer}`)),tableDOMNode:r}}else return{isOutside:!0,tableDOMNode:null}}function Sa(t){let e=lg(2),{anchorElem:o}=t,r=o===void 0?document.body:o;if(!Ea())return null;let l;return e[0]!==r?(l=_g(jr(Tg,{anchorElem:r}),r),e[0]=r,e[1]=l):l=e[1],l}import{c as Eg}from"react/compiler-runtime";import{jsx as Hr,jsxs as Sg}from"react/jsx-runtime";import{useLexicalComposerContext as Ng}from"@lexical/react/LexicalComposerContext";import{TablePlugin as Lg}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as yg,TableCellNode as Rg,TableNode as Ig,TableRowNode as vg}from"@lexical/table";import{mergeRegister as Mg}from"@lexical/utils";import{formatDrawerSlug as Dg,useEditDepth as $g}from"@payloadcms/ui";import{$getSelection as Ag,$isRangeSelection as Og,COMMAND_PRIORITY_EDITOR as Fg,createCommand as Pg}from"lexical";import{createContext as Bg,use as jg,useEffect as Hg,useMemo as Ug,useState as Wg}from"react";import*as Na from"react";var yo=Pg("OPEN_EMBED_DRAWER_COMMAND"),La=Bg({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function ya({children:t}){let[e,o]=Wg({cellEditorConfig:null,cellEditorPlugins:null});return Hr(La,{value:Ug(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var Ra=()=>{let t=Eg(16),[e]=Ng(),o=jg(La),r=$g(),{fieldProps:n,uuid:l}=H(),{schemaPath:i}=n,s="lexical-table-create-"+l,d;t[0]!==r||t[1]!==s?(d=Dg({slug:s,depth:r}),t[0]=r,t[1]=s,t[2]=d):d=t[2];let c=d,{toggleDrawer:u}=fe(c,!0),a;t[3]!==e||t[4]!==u?(a=()=>{if(!e.hasNodes([Ig,vg,Rg]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return Mg(e.registerCommand(yo,()=>{let h=null;return e.getEditorState().read(()=>{let x=Ag();Og(x)&&(h=x)}),h&&u(),!0},Fg))},t[3]=e,t[4]=u,t[5]=a):a=t[5];let m;t[6]!==o||t[7]!==e||t[8]!==u?(m=[o,e,u],t[6]=o,t[7]=e,t[8]=u,t[9]=m):m=t[9],Hg(a,m);let p;t[10]!==e?(p=(h,x)=>{!x.columns||!x.rows||e.dispatchCommand(yg,{columns:String(x.columns),rows:String(x.rows)})},t[10]=e,t[11]=p):p=t[11];let f;return t[12]!==c||t[13]!==i||t[14]!==p?(f=Sg(Na.Fragment,{children:[Hr(mt,{drawerSlug:c,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:p,schemaPath:i,schemaPathSuffix:"fields"}),Hr(Lg,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]}),t[12]=c,t[13]=i,t[14]=p,t[15]=f):f=t[15],f};var Jg=$({markdownTransformers:[ea],nodes:[Vg,Gg,Kg],plugins:[{Component:Ra,position:"normal"},{Component:ga,position:"normal"},{Component:ca,position:"floatingAnchorElem"},{Component:Sa,position:"floatingAnchorElem"}],providers:[ya],slashMenu:{groups:[Y([{Icon:Rr,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(yo,{})}}])]},toolbarFixed:{groups:[xe([{ChildComponent:Rr,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(yo,{})}}])]}});import{$isNodeSelection as Rx}from"lexical";import{jsx as Ur,jsxs as zg}from"react/jsx-runtime";import"react";var Wr=()=>zg("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Ur("path",{d:"M14.6667 4H5.33333C4.59695 4 4 4.59695 4 5.33333V14.6667C4 15.403 4.59695 16 5.33333 16H14.6667C15.403 16 16 15.403 16 14.6667V5.33333C16 4.59695 15.403 4 14.6667 4Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),Ur("path",{d:"M7.99984 9.33366C8.73622 9.33366 9.33317 8.73671 9.33317 8.00033C9.33317 7.26395 8.73622 6.66699 7.99984 6.66699C7.26346 6.66699 6.6665 7.26395 6.6665 8.00033C6.6665 8.73671 7.26346 9.33366 7.99984 9.33366Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),Ur("path",{d:"M16 11.9995L13.9427 9.94214C13.6926 9.69218 13.3536 9.55176 13 9.55176C12.6464 9.55176 12.3074 9.69218 12.0573 9.94214L6 15.9995",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as $a}from"react/jsx-runtime";import Aa from"bson-objectid";import{$applyNodeReplacement as ex}from"lexical";import*as Oa from"react";import Xg from"bson-objectid";function Ro(t,e){if(t.hasAttribute("data-lexical-pending-upload-form-id")){let r=t.getAttribute("data-lexical-pending-upload-form-id");if(r!=null)return{node:e({data:{pending:{formID:r,src:t.getAttribute("src")||""}}})}}if(t.hasAttribute("data-lexical-upload-relation-to")&&t.hasAttribute("data-lexical-upload-id")){let r=t.getAttribute("data-lexical-upload-id"),n=t.getAttribute("data-lexical-upload-relation-to");if(r!=null&&n!=null)return{node:e({data:{fields:{},relationTo:n,value:r}})}}return{node:e({data:{pending:{formID:new Xg.default().toHexString(),src:t.getAttribute("src")||""}}})}}import{DecoratorBlockNode as Zg}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as Yg}from"@lexical/utils";import va from"bson-objectid";import{$applyNodeReplacement as qg}from"lexical";var Ft=class extends Zg{__data;constructor({data:e,format:o,key:r}){super(o,r),this.__data=e}static clone(e){return new this({data:e.__data,format:e.__format,key:e.__key})}static getType(){return"upload"}static importDOM(){return{img:e=>({conversion:o=>Ro(o,Ia),priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new va.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,pending:e.pending,relationTo:e.relationTo,value:e.value},r=Ia({data:o});return r.setFormat(e.format),r}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return Yg(o,e?.theme?.upload),o}decorate(){return null}exportDOM(){let e=document.createElement("img"),o=this.__data;return o.pending?(e.setAttribute("data-lexical-pending-upload-form-id",String(o?.pending?.formID)),e.setAttribute("src",o?.pending?.src||"")):(e.setAttribute("data-lexical-upload-id",String(o?.value)),e.setAttribute("data-lexical-upload-relation-to",o?.relationTo)),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"upload",version:3}}getData(){return this.getLatest().__data}setData(e){let o=this.getWritable();o.__data=e}updateDOM(){return!1}};function Ia({data:t}){return t?.id||(t.id=new va.default().toHexString()),qg(new Ft({data:t}))}import{jsx as Ma}from"react/jsx-runtime";import{ShimmerEffect as Qg}from"@payloadcms/ui";var Da=()=>Ma("div",{className:"lexical-upload",children:Ma(Qg,{height:"95px",width:"203px"})});var tx=Oa.lazy(()=>import("./component-5YLBQB5B.js").then(t=>({default:t.UploadComponent}))),de=class extends Ft{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{img:e=>({conversion:o=>Ro(o,me),priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new Aa.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,pending:e.pending,relationTo:e.relationTo,value:e.value},r=me({data:o});return r.setFormat(e.format),r}decorate(e,o){return this.__data.pending?$a(Da,{}):$a(tx,{className:o?.theme?.upload??"LexicalEditorTheme__upload",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function me({data:t}){return t?.id||(t.id=new Aa.default().toHexString()),ex(new de({data:t}))}function st(t){return t instanceof de}import{c as cx}from"react/compiler-runtime";import{jsx as ux}from"react/jsx-runtime";import{useLexicalComposerContext as dx}from"@lexical/react/LexicalComposerContext.js";import{$dfsIterator as Ja,$insertNodeToNearestRoot as Kr,mergeRegister as mx}from"@lexical/utils";import{useBulkUpload as px,useEffectEvent as fx,useModal as hx}from"@payloadcms/ui";import Jr from"bson-objectid";import{$createRangeSelection as gx,$getPreviousSelection as Ua,$getSelection as Wa,$isParagraphNode as zr,$isRangeSelection as Ga,$setSelection as xx,COMMAND_PRIORITY_EDITOR as Cx,COMMAND_PRIORITY_LOW as Va,createCommand as bx,DROP_COMMAND as kx,getDOMSelectionFromTarget as _x,isHTMLElement as Ka,PASTE_COMMAND as Tx}from"lexical";import{useEffect as wx}from"react";import{c as Fa}from"react/compiler-runtime";import{jsx as Gr}from"react/jsx-runtime";import{useLexicalComposerContext as Pa}from"@lexical/react/LexicalComposerContext.js";import{toast as ox}from"@payloadcms/ui";import{$getNodeByKey as rx,COMMAND_PRIORITY_EDITOR as Ba}from"lexical";import{useEffect as ja,useState as nx}from"react";var lx=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=rx(o);n&&n.replace(me({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(Vr,{fields:null,relationTo:e,value:r})},ix=t=>{let e=Fa(13),{enabledCollectionSlugs:o}=t,[r]=Pa(),[n,l]=nx(null),i;e[0]!==o?(i={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=i):i=e[1];let{closeListDrawer:s,ListDrawer:d,openListDrawer:c}=Mt(i),u,a;e[2]!==r||e[3]!==c?(u=()=>r.registerCommand(Ke,h=>(l(h?.replace?h?.replace.nodeKey:null),c(),!0),Ba),a=[r,c],e[2]=r,e[3]=c,e[4]=u,e[5]=a):(u=e[4],a=e[5]),ja(u,a);let m;e[6]!==s||e[7]!==r||e[8]!==n?(m=h=>{let{collectionSlug:x,doc:w}=h;s(),lx({editor:r,relationTo:x,replaceNodeKey:n,value:w.id})},e[6]=s,e[7]=r,e[8]=n,e[9]=m):m=e[9];let p=m,f;return e[10]!==d||e[11]!==p?(f=Gr(d,{onSelect:p}),e[10]=d,e[11]=p,e[12]=f):f=e[12],f},sx=()=>{let t=Fa(3),[e]=Pa(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Ke,ax,Ba),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),ja(o,r),null},Ha=({enabledCollectionSlugs:t})=>t?.length?Gr(ix,{enabledCollectionSlugs:t}):Gr(sx,{});function ax(){return ox.error("No upload collections enabled"),!0}function Ex(t){let e=t.target;return!!(Ka(e)&&!e.closest("code, span.editor-image")&&Ka(e.parentElement)&&e.parentElement.closest("div.ContentEditable__root"))}function Sx(t){let e,o=_x(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 Vr=bx("INSERT_UPLOAD_COMMAND"),za=t=>{let e=cx(21),{clientProps:o}=t,[r]=dx(),n=o?.disabledCollections,l=o?.enabledCollections,i;e[0]!==n||e[1]!==l?(i={collectionSlugsBlacklist:n,collectionSlugsWhitelist:l,uploads:!0},e[0]=n,e[1]=l,e[2]=i):i=e[2];let{enabledCollectionSlugs:s}=go(i),{drawerSlug:d,setCollectionSlug:c,setInitialForms:u,setOnCancel:a,setOnSuccess:m,setSelectableCollections:p}=px(),{isModalOpen:f,openModal:h}=hx(),x;e[3]!==d||e[4]!==r||e[5]!==s||e[6]!==f||e[7]!==h||e[8]!==c||e[9]!==u||e[10]!==a||e[11]!==m||e[12]!==p?(x=C=>{let{files:g}=C;if(g?.length!==0&&(u(b=>[...b??[],...g.map(Nx)]),!f(d))){if(!s.length||!s[0])return;c(s[0]),p(s),a(()=>{r.update(Lx)}),m(b=>{let k=new Map(b.map(yx));r.update(()=>{for(let y of Ja()){let R=y.node;if(st(R)){let M=R.getData();if(M?.pending){let L=k.get(M.pending?.formID);L&&R.replace(me({data:{id:new Jr.default().toHexString(),fields:{},relationTo:L.collectionSlug,value:L.doc.id}}))}}}})}),h(d)}},e[3]=d,e[4]=r,e[5]=s,e[6]=f,e[7]=h,e[8]=c,e[9]=u,e[10]=a,e[11]=m,e[12]=p,e[13]=x):x=e[13];let w=fx(x),E;e[14]!==r||e[15]!==w?(E=()=>{if(!r.hasNodes([de]))throw new Error("UploadPlugin: UploadNode not registered on editor");return mx(r.registerNodeTransform(de,C=>{let g=C.getData();if(!g?.pending)return;(async function(){let y=null,R=g?.pending?.src,M=g?.pending?.formID;if(R?.startsWith("data:")){let L=R.match(/data:(image\/[a-zA-Z]+);base64,/),T=L?L[1]:"image/png",S=R.replace(/^data:image\/[a-zA-Z]+;base64,/,""),I=atob(S),A=new Array(I.length);for(let D=0;D<I.length;D++)A[D]=I.charCodeAt(D);let v=new Uint8Array(A);y={alt:void 0,file:new File([v],"pasted-image."+T?.split("/",2)[1],{type:T}),formID:M}}else if(R?.startsWith("http")||R?.startsWith("https")){let T=await(await fetch(R)).blob(),S=R.split("/").pop()||"pasted-image"+T.type.split("/",2)[1];y={alt:void 0,file:new File([T],S,{type:T.type}),formID:M}}y&&w({files:[y]})})()}),r.registerCommand(Vr,C=>(r.update(()=>{let g=Wa()||Ua();if(Ga(g)){let b=me({data:{id:C.id,fields:C.fields,relationTo:C.relationTo,value:C.value}}),{focus:k}=g,y=k.getNode();Kr(b),zr(y)&&!y.__first&&y.remove()}}),!0),Cx),r.registerCommand(Tx,C=>{if(!(C instanceof ClipboardEvent))return!1;let g=C.clipboardData;if(!g?.types?.length||g?.types?.includes("text/html"))return!1;let b=[];return g?.files?.length&&Array.from(g.files).forEach(k=>{b.push({alt:"",file:k,formID:new Jr.default().toHexString()})}),b.length?(r.update(()=>{let k=Wa()||Ua();if(Ga(k))for(let y of b){let R=me({data:{pending:{formID:y.formID,src:URL.createObjectURL(y.file)}}}),{focus:M}=k,L=M.getNode();Kr(R),zr(L)&&!L.__first&&L.remove()}}),w({files:b}),!0):!1},Va),r.registerCommand(kx,C=>{if(!(C instanceof DragEvent))return!1;let g=C.dataTransfer;if(!g?.types?.length)return!1;let b=[];return g?.files?.length&&Array.from(g.files).forEach(k=>{b.push({alt:"",file:k,formID:new Jr.default().toHexString()})}),b.length?(C.preventDefault(),C.stopPropagation(),r.update(()=>{if(Ex(C)){let k=Sx(C),y=gx();k!=null&&y.applyDOMRange(k),xx(y);for(let R of b){let M=me({data:{pending:{formID:R.formID,src:URL.createObjectURL(R.file)}}}),{focus:L}=y,T=L.getNode();Kr(M),zr(T)&&!T.__first&&T.remove()}}}),w({files:b}),!0):!1},Va))},e[14]=r,e[15]=w,e[16]=E):E=e[16];let N;e[17]!==r?(N=[r],e[17]=r,e[18]=N):N=e[18],wx(E,N);let _;return e[19]!==s?(_=ux(Ha,{enabledCollectionSlugs:s}),e[19]=s,e[20]=_):_=e[20],_};function Nx(t){return{file:t.file,formID:t.formID}}function Lx(){for(let t of Ja()){let e=t.node;st(e)&&e.getData()?.pending&&e.remove()}}function yx(t){return[t.formID,t]}var Ix=$({nodes:[de],plugins:[{Component:za,position:"normal"}],slashMenu:{groups:[Y([{Icon:Wr,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ke,{replace:!1})}}])]},toolbarFixed:{groups:[xe([{ChildComponent:Wr,isActive:({selection:t})=>{if(!Rx(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return st(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ke,{replace:!1})}}])]}});import{c as Mx}from"react/compiler-runtime";import{jsx as Yr}from"react/jsx-runtime";import{ShimmerEffect as Dx,useConfig as $x}from"@payloadcms/ui";import{lazy as Ax,Suspense as Ox,useEffect as Fx,useState as Px}from"react";var Xa={block:"LexicalEditorTheme__block",blockCursor:"LexicalEditorTheme__blockCursor",characterLimit:"LexicalEditorTheme__characterLimit",code:"LexicalEditorTheme__code",inlineBlock:"LexicalEditorTheme__inlineBlock",heading:{h1:"LexicalEditorTheme__h1",h2:"LexicalEditorTheme__h2",h3:"LexicalEditorTheme__h3",h4:"LexicalEditorTheme__h4",h5:"LexicalEditorTheme__h5",h6:"LexicalEditorTheme__h6"},hr:"LexicalEditorTheme__hr",hrSelected:"LexicalEditorTheme__hrSelected",indent:"LexicalEditorTheme__indent",link:"LexicalEditorTheme__link",list:{checklist:"LexicalEditorTheme__checklist",listitem:"LexicalEditorTheme__listItem",listitemChecked:"LexicalEditorTheme__listItemChecked",listitemUnchecked:"LexicalEditorTheme__listItemUnchecked",nested:{listitem:"LexicalEditorTheme__nestedListItem"},olDepth:["LexicalEditorTheme__ol1","LexicalEditorTheme__ol2","LexicalEditorTheme__ol3","LexicalEditorTheme__ol4","LexicalEditorTheme__ol5"],ul:"LexicalEditorTheme__ul"},ltr:"LexicalEditorTheme__ltr",mark:"LexicalEditorTheme__mark",markOverlap:"LexicalEditorTheme__markOverlap",paragraph:"LexicalEditorTheme__paragraph",placeholder:"LexicalEditorTheme__placeholder",quote:"LexicalEditorTheme__quote",relationship:"LexicalEditorTheme__relationship",rtl:"LexicalEditorTheme__rtl",tab:"LexicalEditorTheme__tabNode",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableAlignment:{center:"LexicalEditorTheme__tableAlignmentCenter",right:"LexicalEditorTheme__tableAlignmentRight"},tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableFrozenColumn:"LexicalEditorTheme__tableFrozenColumn",tableRowStriping:"LexicalEditorTheme__tableRowStriping",tableScrollableWrapper:"LexicalEditorTheme__tableScrollableWrapper",tableSelected:"LexicalEditorTheme__tableSelected",tableSelection:"LexicalEditorTheme__tableSelection",text:{bold:"LexicalEditorTheme__textBold",code:"LexicalEditorTheme__textCode",italic:"LexicalEditorTheme__textItalic",strikethrough:"LexicalEditorTheme__textStrikethrough",subscript:"LexicalEditorTheme__textSubscript",superscript:"LexicalEditorTheme__textSuperscript",underline:"LexicalEditorTheme__textUnderline",underlineStrikethrough:"LexicalEditorTheme__textUnderlineStrikethrough"},upload:"LexicalEditorTheme__upload"};var Xr={namespace:"lexical",theme:Xa};function Za({config:t,featureClientImportMap:e,featureClientSchemaMap:o,field:r,schemaPath:n,unSanitizedEditorConfig:l}){let i=new Map;for(let c of l.features){if(!c?.clientFeatureProps?.featureKey||c?.clientFeatureProps?.order===void 0||c?.clientFeatureProps?.order===null)throw new Error("A Feature you have installed does not return the client props as clientFeatureProps. Please make sure to always return those props, even if they are null, as other important props like order and featureKey are later on injected.");i.set(c.clientFeatureProps.featureKey,c)}l.features=l.features.sort((c,u)=>c.clientFeatureProps.order-u.clientFeatureProps.order);let s=new Map,d=0;for(let c of l.features){let u=typeof c.feature=="function"?c.feature({config:t,featureClientImportMap:e,featureClientSchemaMap:o,featureProviderMap:i,field:r,resolvedFeatures:s,schemaPath:n,unSanitizedEditorConfig:l}):c.feature;u.key=c.clientFeatureProps.featureKey,u.order=d,s.set(c.clientFeatureProps.featureKey,u),d++}return s}import{deepMerge as vx}from"payload/shared";var Ya=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}},o={};if(t.forEach(r=>{r.key==="toolbarFixed"&&r.sanitizedClientFeatureProps?.customGroups&&(o={...o,...r.sanitizedClientFeatureProps.customGroups})}),!t?.size)return e;t.forEach(r=>{if(r.providers?.length&&(e.providers=e.providers.concat(r.providers)),r.enableFormats?.length&&e.enabledFormats.push(...r.enableFormats),r.nodes?.length)for(let n of r.nodes)e.nodes.push(n);if(r.plugins?.length&&r.plugins.forEach((n,l)=>{e.plugins?.push({clientProps:r.sanitizedClientFeatureProps,Component:n.Component,key:r.key+l,position:n.position})}),r.toolbarInline?.groups?.length)for(let n of r.toolbarInline.groups){let l=e.toolbarInline.groups.find(i=>i.key===n.key);l?e.toolbarInline.groups=e.toolbarInline.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.toolbarInline?.groups.push(l)}if(r.toolbarFixed?.groups?.length)for(let n of r.toolbarFixed.groups){let l=e.toolbarFixed.groups.find(i=>i.key===n.key);l?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.toolbarFixed?.groups.push(l)}if(r.slashMenu?.groups){r.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(r.slashMenu.dynamicGroups));for(let n of r.slashMenu.groups){let l=e.slashMenu.groups.find(i=>i.key===n.key);l?e.slashMenu.groups=e.slashMenu.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.slashMenu.groups.push(l)}}if(r.markdownTransformers?.length)for(let n of r.markdownTransformers)typeof n=="function"?e.markdownTransformers.push(n({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(n);e.enabledFeatures.push(r.key)}),Object.keys(o).length>0&&(e.toolbarFixed.groups=e.toolbarFixed.groups.map(r=>{let n=o[r.key];return n?vx(r,n):r})),e.toolbarInline.groups.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0),e.toolbarFixed.groups.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);for(let r of e.toolbarInline.groups)r.items.sort((n,l)=>n.order&&l.order?n.order-l.order:n.order?-1:l.order?1:0);for(let r of e.toolbarFixed.groups)r.items.sort((n,l)=>n.order&&l.order?n.order-l.order:n.order?-1:l.order?1:0);return e};function Zr(t,e,o){return{admin:o,features:Ya(t),lexical:e,resolvedFeatureMap:t}}var Bx=Ax(()=>import("./Field-43GHEACW.js").then(t=>({default:t.RichText}))),jx=t=>{let e=Mx(18),{admin:o,clientFeatures:r,featureClientImportMap:n,featureClientSchemaMap:l,field:i,lexicalEditorConfig:s,schemaPath:d}=t,c;e[0]!==o?(c=o===void 0?{}:o,e[0]=o,e[1]=c):c=e[1];let u=c,a;e[2]!==n?(a=n===void 0?{}:n,e[2]=n,e[3]=a):a=e[3];let m=a,p=s===void 0?Xr:s,{config:f}=$x(),[h,x]=Px(null),w,E;e[4]!==u||e[5]!==r||e[6]!==f||e[7]!==m||e[8]!==l||e[9]!==i||e[10]!==h||e[11]!==p||e[12]!==d?(w=()=>{if(h)return;let _=[];for(let g of Object.values(r))g.clientFeatureProvider&&_.push(g.clientFeatureProvider(g.clientFeatureProps));let C=Za({config:f,featureClientImportMap:m,featureClientSchemaMap:l,field:i,schemaPath:d??i.name,unSanitizedEditorConfig:{features:_,lexical:p}});x(Zr(C,p,u))},E=[u,r,f,m,l,i,h,p,d],e[4]=u,e[5]=r,e[6]=f,e[7]=m,e[8]=l,e[9]=i,e[10]=h,e[11]=p,e[12]=d,e[13]=w,e[14]=E):(w=e[13],E=e[14]),Fx(w,E);let N;return e[15]!==h||e[16]!==t?(N=Yr(Ox,{fallback:Yr(Dx,{height:"35vh"}),children:h&&Yr(Bx,{...t,editorConfig:h})}),e[15]=h,e[16]=t,e[17]=N):N=e[17],N};function Hx(t){return t instanceof HTMLElement}function Ux(...t){return t.filter(Boolean).join(" ")}var Io=new WeakMap;function qa(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function vo(t,e){let o=Io.get(t);if(o===void 0){let r=new Set,n=i=>{o!==void 0&&(o.start=qa(i))},l=i=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let d=qa(i);for(let c of r)d!==null&&c([d[0]-s[0],d[1]-s[1]],i)};t.addEventListener("touchstart",n),t.addEventListener("touchend",l),o={handleTouchend:l,handleTouchstart:n,listeners:r,start:null},Io.set(t,o)}return o.listeners.add(e),()=>{Wx(t,e)}}function Wx(t,e){let o=Io.get(t);if(o===void 0)return;let{listeners:r}=o;r.delete(e),r.size===0&&(Io.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function Gx(t,e){return vo(t,(o,r)=>{let[n,l]=o;n<0&&-n>Math.abs(l)&&e(n,r)})}function Vx(t,e){return vo(t,(o,r)=>{let[n,l]=o;n>0&&n>Math.abs(l)&&e(n,r)})}function Kx(t,e){return vo(t,(o,r)=>{let[n,l]=o;l<0&&-l>Math.abs(n)&&e(n,r)})}function Jx(t,e){return vo(t,(o,r)=>{let[n,l]=o;l>0&&l>Math.abs(n)&&e(n,r)})}import{c as zx}from"react/compiler-runtime";import{jsx as Xx}from"react/jsx-runtime";import"react";var Zx=()=>{let t=zx(2),{EditButton:e}=he(),o;return t[0]!==e?(o=e?Xx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Yx}from"react/compiler-runtime";import{jsx as qx}from"react/jsx-runtime";import"react";var Qx=()=>{let t=Yx(2),{RemoveButton:e}=he(),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),{Label:e}=he(),o;return t[0]!==e?(o=e?tC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as rC}from"react/compiler-runtime";import{jsx as nC}from"react/jsx-runtime";import"react";var lC=t=>{let e=rC(3),{children:o}=t,{InlineBlockContainer:r}=he(),n;return e[0]!==r||e[1]!==o?(n=r?nC(r,{children:o}):null,e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{jsx as iC}from"react/jsx-runtime";import"react";var sC=t=>{let{children:e,...o}=t,{BlockCollapsible:r}=ge();return r?iC(r,{...o,children:e}):null};import{c as aC}from"react/compiler-runtime";import{jsx as cC}from"react/jsx-runtime";import"react";var uC=()=>{let t=aC(2),{EditButton:e}=ge(),o;return t[0]!==e?(o=e?cC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as dC}from"react/compiler-runtime";import{jsx as mC}from"react/jsx-runtime";import"react";var pC=()=>{let t=dC(2),{RemoveButton:e}=ge(),o;return t[0]!==e?(o=e?mC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as fC}from"qs-esm";var hC=({apiURL:t,depth:e,draft:o,locale:r})=>async({id:l,collectionSlug:i,select:s})=>{let d=fC({depth:e??0,draft:o??!1,locale:r,select:s},{addQueryPrefix:!0});return await fetch(`${t}/${i}/${l}${d}`,{credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json"},method:"GET"}).then(u=>u.json())};var Qa={customEndRegex:{optional:!0,regExp:/[ \t]*```$/},customStartRegex:/^[ \t]*```(\w+)?/,doNotTrimChildren:!0,export:({fields:t})=>!t.code.includes(`
61
61
  `)&&!t.language?.length?"```"+t.code+"```":"```"+(t.language||"")+(t.code?`
62
62
  `+t.code:"")+"\n```",import:({children:t,closeMatch:e,openMatch:o})=>{let r=o?.[1];return t.startsWith(`
63
63
  `)&&(t=t.slice(1)),t.endsWith(`
@@ -1 +1 @@
1
- {"version":3,"file":"Field.d.ts","sourceRoot":"","sources":["../../src/field/Field.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAoD,MAAM,OAAO,CAAA;AAGxE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAA;AAE7E,OAAO,mCAAmC,CAAA;AAC1C,OAAO,eAAe,CAAA;AACtB,OAAO,cAAc,CAAA;AAErB,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAA;AAO5D,QAAA,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAC/B;IACE,QAAQ,CAAC,YAAY,EAAE,2BAA2B,CAAA;CACnD,GAAG,yBAAyB,CAmK9B,CAAA;AAaD,eAAO,MAAM,QAAQ,EAAE,OAAO,iBAAqC,CAAA"}
1
+ {"version":3,"file":"Field.d.ts","sourceRoot":"","sources":["../../src/field/Field.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAoD,MAAM,OAAO,CAAA;AAGxE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAA;AAE7E,OAAO,mCAAmC,CAAA;AAC1C,OAAO,eAAe,CAAA;AACtB,OAAO,cAAc,CAAA;AAErB,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAA;AAO5D,QAAA,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAC/B;IACE,QAAQ,CAAC,YAAY,EAAE,2BAA2B,CAAA;CACnD,GAAG,yBAAyB,CAwK9B,CAAA;AAaD,eAAO,MAAM,QAAQ,EAAE,OAAO,iBAAqC,CAAA"}
@@ -102,7 +102,7 @@ const RichTextComponent = props => {
102
102
  // In postgres, the order of keys in JSON objects is not guaranteed to be preserved,
103
103
  // so we need to do a deep equality check here that does not care about key order => we use dequal.
104
104
  // If we used JSON.stringify, the editor would re-mount every time you save the document, as the order of keys changes => change detected => re-mount.
105
- if (prevValueRef.current !== value_0 && !dequal(JSON.parse(JSON.stringify(prevValueRef.current)), value_0)) {
105
+ if (prevValueRef.current !== value_0 && !dequal(prevValueRef.current != null ? JSON.parse(JSON.stringify(prevValueRef.current)) : prevValueRef.current, value_0)) {
106
106
  prevInitialValueRef.current = initialValue_0;
107
107
  prevValueRef.current = value_0;
108
108
  setRerenderProviderKey(new Date());
@@ -1 +1 @@
1
- {"version":3,"file":"Field.js","names":["FieldDescription","FieldError","FieldLabel","RenderCustomComponent","useEditDepth","useEffectEvent","useField","mergeFieldStyles","dequal","React","useCallback","useEffect","useMemo","useState","ErrorBoundary","LexicalProvider","useRunDeprioritized","baseClass","RichTextComponent","props","editorConfig","field","admin","className","description","readOnly","readOnlyFromAdmin","label","localized","required","path","pathFromProps","readOnlyFromTopLevelProps","validate","readOnlyFromProps","editDepth","memoizedValidate","value","validationOptions","customComponents","AfterInput","BeforeInput","Description","Error","Label","disabled","disabledFromField","initialValue","setValue","showError","potentiallyStalePath","isSmallWidthViewport","setIsSmallWidthViewport","rerenderProviderKey","setRerenderProviderKey","prevInitialValueRef","useRef","prevValueRef","updateViewPortWidth","isNextSmallWidthViewport","window","matchMedia","matches","addEventListener","removeEventListener","classes","hideGutter","filter","Boolean","join","pathWithEditDepth","runDeprioritized","handleChange","editorState","updateFieldValue","newState","toJSON","current","styles","handleInitialValueChange","JSON","parse","stringify","Date","Object","is","_jsxs","style","_jsx","CustomComponent","Fallback","fallbackRender","onReset","composerKey","fieldProps","onChange","error","role","color","message","RichText"],"sources":["../../src/field/Field.tsx"],"sourcesContent":["'use client'\nimport type { EditorState, SerializedEditorState } from 'lexical'\n\nimport {\n FieldDescription,\n FieldError,\n FieldLabel,\n RenderCustomComponent,\n useEditDepth,\n useEffectEvent,\n useField,\n} from '@payloadcms/ui'\nimport { mergeFieldStyles } from '@payloadcms/ui/shared'\nimport { dequal } from 'dequal/lite'\nimport { type Validate } from 'payload'\nimport React, { useCallback, useEffect, useMemo, useState } from 'react'\nimport { ErrorBoundary } from 'react-error-boundary'\n\nimport type { SanitizedClientEditorConfig } from '../lexical/config/types.js'\n\nimport '../lexical/theme/EditorTheme.scss'\nimport './bundled.css'\nimport './index.scss'\n\nimport type { LexicalRichTextFieldProps } from '../types.js'\n\nimport { LexicalProvider } from '../lexical/LexicalProvider.js'\nimport { useRunDeprioritized } from '../utilities/useRunDeprioritized.js'\n\nconst baseClass = 'rich-text-lexical'\n\nconst RichTextComponent: React.FC<\n {\n readonly editorConfig: SanitizedClientEditorConfig // With rendered features n stuff\n } & LexicalRichTextFieldProps\n> = (props) => {\n const {\n editorConfig,\n field,\n field: {\n admin: { className, description, readOnly: readOnlyFromAdmin } = {},\n label,\n localized,\n required,\n },\n path: pathFromProps,\n readOnly: readOnlyFromTopLevelProps,\n validate, // Users can pass in client side validation if they WANT to, but it's not required anymore\n } = props\n\n const readOnlyFromProps = readOnlyFromTopLevelProps || readOnlyFromAdmin\n\n const editDepth = useEditDepth()\n\n const memoizedValidate = useCallback<Validate>(\n (value, validationOptions) => {\n if (typeof validate === 'function') {\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return validate(value, { ...validationOptions, required })\n }\n return true\n },\n // Important: do not add props to the dependencies array.\n // This would cause an infinite loop and endless re-rendering.\n // Removing props from the dependencies array fixed this issue: https://github.com/payloadcms/payload/issues/3709\n [validate, required],\n )\n\n const {\n customComponents: { AfterInput, BeforeInput, Description, Error, Label } = {},\n disabled: disabledFromField,\n initialValue,\n path,\n setValue,\n showError,\n value,\n } = useField<SerializedEditorState>({\n potentiallyStalePath: pathFromProps,\n validate: memoizedValidate,\n })\n\n const disabled = readOnlyFromProps || disabledFromField\n\n const [isSmallWidthViewport, setIsSmallWidthViewport] = useState<boolean>(false)\n const [rerenderProviderKey, setRerenderProviderKey] = useState<Date>()\n\n const prevInitialValueRef = React.useRef<SerializedEditorState | undefined>(initialValue)\n const prevValueRef = React.useRef<SerializedEditorState | undefined>(value)\n\n useEffect(() => {\n const updateViewPortWidth = () => {\n const isNextSmallWidthViewport = window.matchMedia('(max-width: 768px)').matches\n\n if (isNextSmallWidthViewport !== isSmallWidthViewport) {\n setIsSmallWidthViewport(isNextSmallWidthViewport)\n }\n }\n updateViewPortWidth()\n window.addEventListener('resize', updateViewPortWidth)\n\n return () => {\n window.removeEventListener('resize', updateViewPortWidth)\n }\n }, [isSmallWidthViewport])\n\n const classes = [\n baseClass,\n 'field-type',\n className,\n showError && 'error',\n disabled && `${baseClass}--read-only`,\n editorConfig?.admin?.hideGutter !== true && !isSmallWidthViewport\n ? `${baseClass}--show-gutter`\n : null,\n ]\n .filter(Boolean)\n .join(' ')\n\n const pathWithEditDepth = `${path}.${editDepth}`\n\n const runDeprioritized = useRunDeprioritized() // defaults to 500 ms timeout\n\n const handleChange = useCallback(\n (editorState: EditorState) => {\n // Capture `editorState` in the closure so we can safely run later.\n const updateFieldValue = () => {\n const newState = editorState.toJSON()\n prevValueRef.current = newState\n setValue(newState)\n }\n\n // Queue the update for the browser’s idle time (or Safari shim)\n // and let the hook handle debouncing/cancellation.\n void runDeprioritized(updateFieldValue)\n },\n [setValue, runDeprioritized], // `runDeprioritized` is stable (useCallback inside hook)\n )\n\n const styles = useMemo(() => mergeFieldStyles(field), [field])\n\n const handleInitialValueChange = useEffectEvent(\n (initialValue: SerializedEditorState | undefined) => {\n // Object deep equality check here, as re-mounting the editor if\n // the new value is the same as the old one is not necessary.\n // In postgres, the order of keys in JSON objects is not guaranteed to be preserved,\n // so we need to do a deep equality check here that does not care about key order => we use dequal.\n // If we used JSON.stringify, the editor would re-mount every time you save the document, as the order of keys changes => change detected => re-mount.\n if (\n prevValueRef.current !== value &&\n !dequal(JSON.parse(JSON.stringify(prevValueRef.current)), value)\n ) {\n prevInitialValueRef.current = initialValue\n prevValueRef.current = value\n setRerenderProviderKey(new Date())\n }\n },\n )\n\n useEffect(() => {\n // Needs to trigger for object reference changes - otherwise,\n // reacting to the same initial value change twice will cause\n // the second change to be ignored, even though the value has changed.\n // That's because initialValue is not kept up-to-date\n if (!Object.is(initialValue, prevInitialValueRef.current)) {\n handleInitialValueChange(initialValue)\n }\n }, [initialValue])\n\n return (\n <div className={classes} key={pathWithEditDepth} style={styles}>\n <RenderCustomComponent\n CustomComponent={Error}\n Fallback={<FieldError path={path} showError={showError} />}\n />\n {Label || <FieldLabel label={label} localized={localized} path={path} required={required} />}\n <div className={`${baseClass}__wrap`}>\n <ErrorBoundary fallbackRender={fallbackRender} onReset={() => {}}>\n {BeforeInput}\n <LexicalProvider\n composerKey={pathWithEditDepth}\n editorConfig={editorConfig}\n fieldProps={props}\n isSmallWidthViewport={isSmallWidthViewport}\n key={JSON.stringify({ path, rerenderProviderKey })} // makes sure lexical is completely re-rendered when initialValue changes, bypassing the lexical-internal value memoization. That way, external changes to the form will update the editor. More infos in PR description (https://github.com/payloadcms/payload/pull/5010)\n onChange={handleChange}\n readOnly={disabled}\n value={value}\n />\n {AfterInput}\n </ErrorBoundary>\n <RenderCustomComponent\n CustomComponent={Description}\n Fallback={<FieldDescription description={description} path={path} />}\n />\n </div>\n </div>\n )\n}\n\nfunction fallbackRender({ error }: { error: Error }) {\n // Call resetErrorBoundary() to reset the error boundary and retry the render.\n\n return (\n <div className=\"errorBoundary\" role=\"alert\">\n <p>Something went wrong:</p>\n <pre style={{ color: 'red' }}>{error.message}</pre>\n </div>\n )\n}\n\nexport const RichText: typeof RichTextComponent = RichTextComponent\n"],"mappings":"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","ignoreList":[]}
1
+ {"version":3,"file":"Field.js","names":["FieldDescription","FieldError","FieldLabel","RenderCustomComponent","useEditDepth","useEffectEvent","useField","mergeFieldStyles","dequal","React","useCallback","useEffect","useMemo","useState","ErrorBoundary","LexicalProvider","useRunDeprioritized","baseClass","RichTextComponent","props","editorConfig","field","admin","className","description","readOnly","readOnlyFromAdmin","label","localized","required","path","pathFromProps","readOnlyFromTopLevelProps","validate","readOnlyFromProps","editDepth","memoizedValidate","value","validationOptions","customComponents","AfterInput","BeforeInput","Description","Error","Label","disabled","disabledFromField","initialValue","setValue","showError","potentiallyStalePath","isSmallWidthViewport","setIsSmallWidthViewport","rerenderProviderKey","setRerenderProviderKey","prevInitialValueRef","useRef","prevValueRef","updateViewPortWidth","isNextSmallWidthViewport","window","matchMedia","matches","addEventListener","removeEventListener","classes","hideGutter","filter","Boolean","join","pathWithEditDepth","runDeprioritized","handleChange","editorState","updateFieldValue","newState","toJSON","current","styles","handleInitialValueChange","JSON","parse","stringify","Date","Object","is","_jsxs","style","_jsx","CustomComponent","Fallback","fallbackRender","onReset","composerKey","fieldProps","onChange","error","role","color","message","RichText"],"sources":["../../src/field/Field.tsx"],"sourcesContent":["'use client'\nimport type { EditorState, SerializedEditorState } from 'lexical'\n\nimport {\n FieldDescription,\n FieldError,\n FieldLabel,\n RenderCustomComponent,\n useEditDepth,\n useEffectEvent,\n useField,\n} from '@payloadcms/ui'\nimport { mergeFieldStyles } from '@payloadcms/ui/shared'\nimport { dequal } from 'dequal/lite'\nimport { type Validate } from 'payload'\nimport React, { useCallback, useEffect, useMemo, useState } from 'react'\nimport { ErrorBoundary } from 'react-error-boundary'\n\nimport type { SanitizedClientEditorConfig } from '../lexical/config/types.js'\n\nimport '../lexical/theme/EditorTheme.scss'\nimport './bundled.css'\nimport './index.scss'\n\nimport type { LexicalRichTextFieldProps } from '../types.js'\n\nimport { LexicalProvider } from '../lexical/LexicalProvider.js'\nimport { useRunDeprioritized } from '../utilities/useRunDeprioritized.js'\n\nconst baseClass = 'rich-text-lexical'\n\nconst RichTextComponent: React.FC<\n {\n readonly editorConfig: SanitizedClientEditorConfig // With rendered features n stuff\n } & LexicalRichTextFieldProps\n> = (props) => {\n const {\n editorConfig,\n field,\n field: {\n admin: { className, description, readOnly: readOnlyFromAdmin } = {},\n label,\n localized,\n required,\n },\n path: pathFromProps,\n readOnly: readOnlyFromTopLevelProps,\n validate, // Users can pass in client side validation if they WANT to, but it's not required anymore\n } = props\n\n const readOnlyFromProps = readOnlyFromTopLevelProps || readOnlyFromAdmin\n\n const editDepth = useEditDepth()\n\n const memoizedValidate = useCallback<Validate>(\n (value, validationOptions) => {\n if (typeof validate === 'function') {\n // @ts-expect-error - vestiges of when tsconfig was not strict. Feel free to improve\n return validate(value, { ...validationOptions, required })\n }\n return true\n },\n // Important: do not add props to the dependencies array.\n // This would cause an infinite loop and endless re-rendering.\n // Removing props from the dependencies array fixed this issue: https://github.com/payloadcms/payload/issues/3709\n [validate, required],\n )\n\n const {\n customComponents: { AfterInput, BeforeInput, Description, Error, Label } = {},\n disabled: disabledFromField,\n initialValue,\n path,\n setValue,\n showError,\n value,\n } = useField<SerializedEditorState>({\n potentiallyStalePath: pathFromProps,\n validate: memoizedValidate,\n })\n\n const disabled = readOnlyFromProps || disabledFromField\n\n const [isSmallWidthViewport, setIsSmallWidthViewport] = useState<boolean>(false)\n const [rerenderProviderKey, setRerenderProviderKey] = useState<Date>()\n\n const prevInitialValueRef = React.useRef<SerializedEditorState | undefined>(initialValue)\n const prevValueRef = React.useRef<SerializedEditorState | undefined>(value)\n\n useEffect(() => {\n const updateViewPortWidth = () => {\n const isNextSmallWidthViewport = window.matchMedia('(max-width: 768px)').matches\n\n if (isNextSmallWidthViewport !== isSmallWidthViewport) {\n setIsSmallWidthViewport(isNextSmallWidthViewport)\n }\n }\n updateViewPortWidth()\n window.addEventListener('resize', updateViewPortWidth)\n\n return () => {\n window.removeEventListener('resize', updateViewPortWidth)\n }\n }, [isSmallWidthViewport])\n\n const classes = [\n baseClass,\n 'field-type',\n className,\n showError && 'error',\n disabled && `${baseClass}--read-only`,\n editorConfig?.admin?.hideGutter !== true && !isSmallWidthViewport\n ? `${baseClass}--show-gutter`\n : null,\n ]\n .filter(Boolean)\n .join(' ')\n\n const pathWithEditDepth = `${path}.${editDepth}`\n\n const runDeprioritized = useRunDeprioritized() // defaults to 500 ms timeout\n\n const handleChange = useCallback(\n (editorState: EditorState) => {\n // Capture `editorState` in the closure so we can safely run later.\n const updateFieldValue = () => {\n const newState = editorState.toJSON()\n prevValueRef.current = newState\n setValue(newState)\n }\n\n // Queue the update for the browser’s idle time (or Safari shim)\n // and let the hook handle debouncing/cancellation.\n void runDeprioritized(updateFieldValue)\n },\n [setValue, runDeprioritized], // `runDeprioritized` is stable (useCallback inside hook)\n )\n\n const styles = useMemo(() => mergeFieldStyles(field), [field])\n\n const handleInitialValueChange = useEffectEvent(\n (initialValue: SerializedEditorState | undefined) => {\n // Object deep equality check here, as re-mounting the editor if\n // the new value is the same as the old one is not necessary.\n // In postgres, the order of keys in JSON objects is not guaranteed to be preserved,\n // so we need to do a deep equality check here that does not care about key order => we use dequal.\n // If we used JSON.stringify, the editor would re-mount every time you save the document, as the order of keys changes => change detected => re-mount.\n if (\n prevValueRef.current !== value &&\n !dequal(\n prevValueRef.current != null\n ? JSON.parse(JSON.stringify(prevValueRef.current))\n : prevValueRef.current,\n value,\n )\n ) {\n prevInitialValueRef.current = initialValue\n prevValueRef.current = value\n setRerenderProviderKey(new Date())\n }\n },\n )\n\n useEffect(() => {\n // Needs to trigger for object reference changes - otherwise,\n // reacting to the same initial value change twice will cause\n // the second change to be ignored, even though the value has changed.\n // That's because initialValue is not kept up-to-date\n if (!Object.is(initialValue, prevInitialValueRef.current)) {\n handleInitialValueChange(initialValue)\n }\n }, [initialValue])\n\n return (\n <div className={classes} key={pathWithEditDepth} style={styles}>\n <RenderCustomComponent\n CustomComponent={Error}\n Fallback={<FieldError path={path} showError={showError} />}\n />\n {Label || <FieldLabel label={label} localized={localized} path={path} required={required} />}\n <div className={`${baseClass}__wrap`}>\n <ErrorBoundary fallbackRender={fallbackRender} onReset={() => {}}>\n {BeforeInput}\n <LexicalProvider\n composerKey={pathWithEditDepth}\n editorConfig={editorConfig}\n fieldProps={props}\n isSmallWidthViewport={isSmallWidthViewport}\n key={JSON.stringify({ path, rerenderProviderKey })} // makes sure lexical is completely re-rendered when initialValue changes, bypassing the lexical-internal value memoization. That way, external changes to the form will update the editor. More infos in PR description (https://github.com/payloadcms/payload/pull/5010)\n onChange={handleChange}\n readOnly={disabled}\n value={value}\n />\n {AfterInput}\n </ErrorBoundary>\n <RenderCustomComponent\n CustomComponent={Description}\n Fallback={<FieldDescription description={description} path={path} />}\n />\n </div>\n </div>\n )\n}\n\nfunction fallbackRender({ error }: { error: Error }) {\n // Call resetErrorBoundary() to reset the error boundary and retry the render.\n\n return (\n <div className=\"errorBoundary\" role=\"alert\">\n <p>Something went wrong:</p>\n <pre style={{ color: 'red' }}>{error.message}</pre>\n </div>\n )\n}\n\nexport const RichText: typeof RichTextComponent = RichTextComponent\n"],"mappings":"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","ignoreList":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@payloadcms/richtext-lexical",
3
- "version": "3.62.0-canary.5",
3
+ "version": "3.62.0-internal.7fb5145",
4
4
  "description": "The officially supported Lexical richtext adapter for Payload",
5
5
  "homepage": "https://payloadcms.com",
6
6
  "repository": {
@@ -374,8 +374,8 @@
374
374
  "react-error-boundary": "4.1.2",
375
375
  "ts-essentials": "10.0.3",
376
376
  "uuid": "10.0.0",
377
- "@payloadcms/ui": "3.62.0-canary.5",
378
- "@payloadcms/translations": "3.62.0-canary.5"
377
+ "@payloadcms/translations": "3.62.0-internal.7fb5145",
378
+ "@payloadcms/ui": "3.62.0-internal.7fb5145"
379
379
  },
380
380
  "devDependencies": {
381
381
  "@babel/cli": "7.27.2",
@@ -395,15 +395,15 @@
395
395
  "esbuild-sass-plugin": "3.3.1",
396
396
  "swc-plugin-transform-remove-imports": "4.0.4",
397
397
  "@payloadcms/eslint-config": "3.28.0",
398
- "payload": "3.62.0-canary.5"
398
+ "payload": "3.62.0-internal.7fb5145"
399
399
  },
400
400
  "peerDependencies": {
401
401
  "@faceless-ui/modal": "3.0.0",
402
402
  "@faceless-ui/scroll-info": "2.0.0",
403
403
  "react": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
404
404
  "react-dom": "^19.0.0 || ^19.0.0-rc-65a56d0e-20241020",
405
- "@payloadcms/next": "3.62.0-canary.5",
406
- "payload": "3.62.0-canary.5"
405
+ "@payloadcms/next": "3.62.0-internal.7fb5145",
406
+ "payload": "3.62.0-internal.7fb5145"
407
407
  },
408
408
  "engines": {
409
409
  "node": "^18.20.2 || >=20.9.0"