@payloadcms/richtext-lexical 3.59.0-internal.56a1b3b → 3.59.0-internal.58ab390

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.
@@ -1,26 +1,26 @@
1
1
  "use client";import{a as he,c as at,d as ct,e as ut}from"./chunk-K47TNP5J.js";import{a as mt}from"./chunk-DBWINSQN.js";import{a as dt,b as Gt,c as Ke}from"./chunk-CYLMY5ZJ.js";import{a as fe}from"./chunk-INBEEENE.js";import{a as uc}from"./chunk-F26IQ5RE.js";import{b as Ut,c as Wt,d as le,e as Vt,f as dc,g as mc,i as pc,k as fc,l as hc}from"./chunk-TLQLXR6Q.js";import{a as cc,b as j}from"./chunk-BZZVLW4U.js";function z(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{$isElementNode as Le,$isRangeSelection as Jt,FORMAT_ELEMENT_COMMAND as Xt}from"lexical";import{jsx as Oo,jsxs as gc}from"react/jsx-runtime";import"react";var on=()=>gc("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:[Oo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Oo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Oo("path",{d:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Fo,jsxs as xc}from"react/jsx-runtime";import"react";var rn=()=>xc("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:[Fo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Fo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Fo("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Po,jsxs as Cc}from"react/jsx-runtime";import"react";var Kt=()=>Cc("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:[Po("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Po("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Po("path",{d:"M2.5 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Bo,jsxs as bc}from"react/jsx-runtime";import"react";var nn=()=>bc("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:[Bo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Bo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Bo("path",{d:"M7.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});var M=t=>o=>{let r={clientFeatureProps:o};if(typeof t=="function")r.feature=({config:n,featureClientImportMap:l,featureClientSchemaMap:i,featureProviderMap:s,field:u,resolvedFeatures:c,schemaPath:d,unSanitizedEditorConfig:a})=>{let m=t({config:n,featureClientImportMap:l,featureClientSchemaMap:i,featureProviderMap:s,field:u,props:o,resolvedFeatures:c,schemaPath:d,unSanitizedEditorConfig:a});return m.sanitizedClientFeatureProps===null&&(m.sanitizedClientFeatureProps=o),m};else{let n={...t};n.sanitizedClientFeatureProps=o,r.feature=n}return r};var ln=t=>({type:"dropdown",ChildComponent:Kt,items:t,key:"align",order:30});var sn=[ln([{ChildComponent:Kt,isActive:({selection:t})=>{if(!Jt(t))return!1;for(let e of t.getNodes()){if(Le(e)&&e.getFormatType()==="left")continue;let o=e.getParent();if(!(Le(o)&&o.getFormatType()==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Xt,"left")},order:1},{ChildComponent:on,isActive:({selection:t})=>{if(!Jt(t))return!1;for(let e of t.getNodes()){if(Le(e)&&e.getFormatType()==="center")continue;let o=e.getParent();if(!(Le(o)&&o.getFormatType()==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Xt,"center")},order:2},{ChildComponent:nn,isActive:({selection:t})=>{if(!Jt(t))return!1;for(let e of t.getNodes()){if(Le(e)&&e.getFormatType()==="right")continue;let o=e.getParent();if(!(Le(o)&&o.getFormatType()==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Xt,"right")},order:3},{ChildComponent:rn,isActive:({selection:t})=>{if(!Jt(t))return!1;for(let e of t.getNodes()){if(Le(e)&&e.getFormatType()==="justify")continue;let o=e.getParent();if(!(Le(o)&&o.getFormatType()==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Xt,"justify")},order:4}])],kc=M({toolbarFixed:{groups:sn},toolbarInline:{groups:sn}});import{$createQuoteNode as fn,$isQuoteNode as mn,QuoteNode as wc}from"@lexical/rich-text";import{$setBlocksType as hn}from"@lexical/selection";import{$getSelection as gn,$isRangeSelection as Ec}from"lexical";import{jsx as an}from"react/jsx-runtime";import"react";var jo=()=>an("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:an("path",{d:"M13.5353 10.5725C13.5353 9.47709 11.0456 9.99991 11.0456 7.85883C11.0456 6.46464 12.1162 5.61816 13.361 5.61816C14.805 5.61816 16 6.86298 16 8.92937C16 11.2945 14.4564 13.7841 11.1203 14.3816L10.8216 13.1368C12.888 12.4895 13.5353 11.4937 13.5353 10.5725ZM6.71369 10.5725C6.71369 9.47709 4.22407 9.99991 4.22407 7.85883C4.22407 6.46464 5.29461 5.61816 6.53942 5.61816C7.9834 5.61816 9.17842 6.86298 9.17842 8.92937C9.17842 11.2945 7.63485 13.7841 4.29876 14.3816L4 13.1368C6.06639 12.4895 6.71369 11.4937 6.71369 10.5725Z",fill:"currentColor"})});import{jsx as cn}from"react/jsx-runtime";import"react";var pt=()=>cn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:cn("path",{d:"M11.708 14.5H7.79785V13.9414H8.01367C9.00391 13.9414 9.15625 13.9033 9.15625 13.6113V6.70508H8.07715C6.82031 6.70508 6.73145 7.08594 6.28711 8.67285H5.80469L5.91895 6.12109H13.5869L13.7012 8.67285H13.2188C12.7744 7.08594 12.6855 6.70508 11.4287 6.70508H10.3496V13.6113C10.3496 13.9033 10.502 13.9414 11.4922 13.9414H11.708V14.5Z",fill:"currentColor"})});var ee=t=>({type:"dropdown",ChildComponent:pt,items:t,key:"text",order:25});import{$createQuoteNode as _c,$isQuoteNode as un,QuoteNode as Tc}from"@lexical/rich-text";var dn={type:"element",dependencies:[Tc],export:(t,e)=>{if(!un(t))return null;let o=e(t).split(`
2
2
  `),r=[];for(let n of o)r.push("> "+n);return r.join(`
3
- `)},regExp:/^>\s/,replace:(t,e,o,r)=>{if(r){let l=t.getPreviousSibling();if(un(l)){l.splice(l.getChildrenSize(),0,[...e]),l.select(0,0),t.remove();return}}let n=_c();n.append(...e),t.replace(n),n.select(0,0)}};var pn=[ee([{ChildComponent:jo,isActive:({selection:t})=>{if(!Ec(t))return!1;for(let e of t.getNodes())if(!mn(e)&&!mn(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=gn();hn(e,()=>fn())})},order:20}])],Sc=M({markdownTransformers:[dn],nodes:[wc],slashMenu:{groups:[z([{Icon:jo,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=gn();hn(e,()=>fn())})}}])]},toolbarFixed:{groups:pn},toolbarInline:{groups:pn}});import{getTranslation as no}from"@payloadcms/translations";import{jsx as Ho,jsxs as Nc}from"react/jsx-runtime";import"react";var zt=()=>Nc("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:[Ho("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),Ho("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),Ho("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as xn}from"react/jsx-runtime";import"react";var Zt=()=>xn("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:xn("path",{clipRule:"evenodd",d:"M5.33333 6.5C5.11232 6.5 4.90036 6.5878 4.74408 6.74408C4.5878 6.90036 4.5 7.11232 4.5 7.33333V12.1667C4.5 12.3877 4.5878 12.5996 4.74408 12.7559C4.90036 12.9122 5.11232 13 5.33333 13H14.6667C14.8877 13 15.0996 12.9122 15.2559 12.7559C15.4122 12.5996 15.5 12.3877 15.5 12.1667V11.6667C15.5 11.3905 15.7239 11.1667 16 11.1667C16.2761 11.1667 16.5 11.3905 16.5 11.6667V12.1667C16.5 12.6529 16.3068 13.1192 15.963 13.463C15.6192 13.8068 15.1529 14 14.6667 14H5.33333C4.8471 14 4.38079 13.8068 4.03697 13.463C3.69315 13.1192 3.5 12.6529 3.5 12.1667V7.33333C3.5 6.8471 3.69315 6.38079 4.03697 6.03697C4.38079 5.69315 4.8471 5.5 5.33333 5.5H10.3333C10.6095 5.5 10.8333 5.72386 10.8333 6C10.8333 6.27614 10.6095 6.5 10.3333 6.5H5.33333ZM13 6.5C12.7239 6.5 12.5 6.27614 12.5 6C12.5 5.72386 12.7239 5.5 13 5.5H16C16.2761 5.5 16.5 5.72386 16.5 6V9C16.5 9.27614 16.2761 9.5 16 9.5C15.7239 9.5 15.5 9.27614 15.5 9V7.20711L13.3536 9.35355C13.1583 9.54882 12.8417 9.54882 12.6464 9.35355C12.4512 9.15829 12.4512 8.84171 12.6464 8.64645L14.7929 6.5H13ZM6.16699 8.33325C6.16699 8.05711 6.39085 7.83325 6.66699 7.83325H11.0003C11.2765 7.83325 11.5003 8.05711 11.5003 8.33325C11.5003 8.60939 11.2765 8.83325 11.0003 8.83325H6.66699C6.39085 8.83325 6.16699 8.60939 6.16699 8.33325ZM6.16699 10.9999C6.16699 10.7238 6.39085 10.4999 6.66699 10.4999H13.3337C13.6098 10.4999 13.8337 10.7238 13.8337 10.9999C13.8337 11.2761 13.6098 11.4999 13.3337 11.4999H6.66699C6.39085 11.4999 6.16699 11.2761 6.16699 10.9999Z",fill:"currentColor",fillRule:"evenodd"})});import{jsx as Lc}from"react/jsx-runtime";import"react";function Yt(t,e){return t?()=>Lc("img",{alt:e??"Block Image",className:"lexical-block-custom-image",src:t,style:{maxHeight:20,maxWidth:20}}):zt}import{$parseSerializedNode as yn}from"lexical";import{JSOX as Uo}from"jsox";function qt({propsString:t}){let e={},o="",r=!0;for(let n=0;n<t.length;n++){let l=t[n];if(r)l==="="||l===" "?o&&(l===" "?(e[o]=!0,o=""):r=!1):o+=l;else{let i=yc(t,n);e[o]=i.value,n=i.newIndex,o="",r=!0}}return o&&(e[o]=!0),e}function yc(t,e){let o=t[e];return o==='"'?Cn(t,e):o==="'"?Cn(t,e,!0):o==="{"?Ic(t,e):o==="["?Rc(t,e):Mc(t,e)}function Rc(t,e){let o=1,r="",n=e+1;for(;n<t.length&&o>0;)t[n]==="["?o++:t[n]==="]"&&o--,o>0&&(r+=t[n]),n++;return{newIndex:n,value:Uo.parse(`[${r}]`)}}function Cn(t,e,o=!1){let r="",n=e+1;for(;n<t.length&&(t[n]!==(o?"'":'"')||t[n-1]==="\\");)r+=t[n],n++;return{newIndex:n,value:r}}function Ic(t,e){let o=1,r="",n=e+1;for(;n<t.length&&o>0;)t[n]==="{"?o++:t[n]==="}"&&o--,o>0&&(r+=t[n]),n++;return{newIndex:n,value:vc(r)}}function vc(t){return t[0]!=="{"?Uo.parse(t):Uo.parse(t.replace(/(\w+):/g,'"$1":'))}function Mc(t,e){let o="",r=e;for(;r<t.length&&t[r]!==" ";)o+=t[r],r++;return{newIndex:r-1,value:o}}function ft({props:t}){let e=[];for(let[o,r]of Object.entries(t))typeof r=="string"?e.push(`${o}="${Dc(r)}"`):typeof r=="number"?e.push(`${o}={${r}}`):typeof r=="boolean"?r&&e.push(`${o}`):r!==null&&typeof r=="object"&&(Array.isArray(r)?e.push(`${o}={[${r.map(n=>JSON.stringify(n,bn)).join(", ")}]}`):e.push(`${o}={${JSON.stringify(r,bn)}}`));return e.join(" ")}function Dc(t){return t.replace(/"/g,"&quot;")}function bn(t,e){return typeof e=="string"?e.replace(/'/g,"\\'"):e}function Qt({isEndOptional:t,lines:e,regexpEndRegex:o,startLineIndex:r,startMatch:n,trimChildren:l}){let i="",s="",u=e.slice(r),c=!1,d=0,a=0,m=null,p=!1,f=0,h=u[0].slice(0,n.index),x=0,C=r;e:for(let[S,b]of u.entries()){let k=l?b.trim():b,g=0;if(l)for(let _=0;_<b.length&&b[_]===" ";_++)g++;let w=0;for(S===0&&(w=(n.index??0)+n[0].length-g);w<k.length;){let _=k[w],y=k[w+1];if(c){if(_==="`"&&f++,f%2===0)if(_==="<"&&y==="/"){if(d--,d<0){s[s.length-1]===`
4
- `&&(s=s.slice(0,-1)),C=S;for(let O=w;O<k.length;O++)if(k[O]===">"){x=O+1;break}break e}}else if(_==="/"&&y===">"){if(d--,d<0){s[s.length-1]===`
5
- `&&(s=s.slice(0,-1)),C=S,x=w+2;break e}}else _==="<"&&y!=="/"&&d++;s+=_}else{if(_==="{"&&!m?a++:_==="}"&&!m?a--:(_==='"'||_==="'")&&!m?m=_:_===m&&(m=null),_==="/"&&y===">"&&a===0&&!m){p=!0,C=S,x=w+2;break e}else if(_===">"&&a===0&&!m){c=!0,w++;continue}i+=_}w++}if(c?s?.length>0&&S>0&&(s+=`
3
+ `)},regExp:/^>\s/,replace:(t,e,o,r)=>{if(r){let l=t.getPreviousSibling();if(un(l)){l.splice(l.getChildrenSize(),0,[...e]),l.select(0,0),t.remove();return}}let n=_c();n.append(...e),t.replace(n),n.select(0,0)}};var pn=[ee([{ChildComponent:jo,isActive:({selection:t})=>{if(!Ec(t))return!1;for(let e of t.getNodes())if(!mn(e)&&!mn(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=gn();hn(e,()=>fn())})},order:20}])],Sc=M({markdownTransformers:[dn],nodes:[wc],slashMenu:{groups:[z([{Icon:jo,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=gn();hn(e,()=>fn())})}}])]},toolbarFixed:{groups:pn},toolbarInline:{groups:pn}});import{getTranslation as no}from"@payloadcms/translations";import{jsx as Ho,jsxs as Nc}from"react/jsx-runtime";import"react";var zt=()=>Nc("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:[Ho("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),Ho("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),Ho("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as xn}from"react/jsx-runtime";import"react";var Zt=()=>xn("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:xn("path",{clipRule:"evenodd",d:"M5.33333 6.5C5.11232 6.5 4.90036 6.5878 4.74408 6.74408C4.5878 6.90036 4.5 7.11232 4.5 7.33333V12.1667C4.5 12.3877 4.5878 12.5996 4.74408 12.7559C4.90036 12.9122 5.11232 13 5.33333 13H14.6667C14.8877 13 15.0996 12.9122 15.2559 12.7559C15.4122 12.5996 15.5 12.3877 15.5 12.1667V11.6667C15.5 11.3905 15.7239 11.1667 16 11.1667C16.2761 11.1667 16.5 11.3905 16.5 11.6667V12.1667C16.5 12.6529 16.3068 13.1192 15.963 13.463C15.6192 13.8068 15.1529 14 14.6667 14H5.33333C4.8471 14 4.38079 13.8068 4.03697 13.463C3.69315 13.1192 3.5 12.6529 3.5 12.1667V7.33333C3.5 6.8471 3.69315 6.38079 4.03697 6.03697C4.38079 5.69315 4.8471 5.5 5.33333 5.5H10.3333C10.6095 5.5 10.8333 5.72386 10.8333 6C10.8333 6.27614 10.6095 6.5 10.3333 6.5H5.33333ZM13 6.5C12.7239 6.5 12.5 6.27614 12.5 6C12.5 5.72386 12.7239 5.5 13 5.5H16C16.2761 5.5 16.5 5.72386 16.5 6V9C16.5 9.27614 16.2761 9.5 16 9.5C15.7239 9.5 15.5 9.27614 15.5 9V7.20711L13.3536 9.35355C13.1583 9.54882 12.8417 9.54882 12.6464 9.35355C12.4512 9.15829 12.4512 8.84171 12.6464 8.64645L14.7929 6.5H13ZM6.16699 8.33325C6.16699 8.05711 6.39085 7.83325 6.66699 7.83325H11.0003C11.2765 7.83325 11.5003 8.05711 11.5003 8.33325C11.5003 8.60939 11.2765 8.83325 11.0003 8.83325H6.66699C6.39085 8.83325 6.16699 8.60939 6.16699 8.33325ZM6.16699 10.9999C6.16699 10.7238 6.39085 10.4999 6.66699 10.4999H13.3337C13.6098 10.4999 13.8337 10.7238 13.8337 10.9999C13.8337 11.2761 13.6098 11.4999 13.3337 11.4999H6.66699C6.39085 11.4999 6.16699 11.2761 6.16699 10.9999Z",fill:"currentColor",fillRule:"evenodd"})});import{jsx as Lc}from"react/jsx-runtime";import"react";function Yt(t,e){return t?()=>Lc("img",{alt:e??"Block Image",className:"lexical-block-custom-image",src:t,style:{maxHeight:20,maxWidth:20}}):zt}import{$parseSerializedNode as yn}from"lexical";import{JSOX as Uo}from"jsox";function qt({propsString:t}){let e={},o="",r=!0;for(let n=0;n<t.length;n++){let l=t[n];if(r)l==="="||l===" "?o&&(l===" "?(e[o]=!0,o=""):r=!1):o+=l;else{let i=yc(t,n);e[o]=i.value,n=i.newIndex,o="",r=!0}}return o&&(e[o]=!0),e}function yc(t,e){let o=t[e];return o==='"'?Cn(t,e):o==="'"?Cn(t,e,!0):o==="{"?Ic(t,e):o==="["?Rc(t,e):Mc(t,e)}function Rc(t,e){let o=1,r="",n=e+1;for(;n<t.length&&o>0;)t[n]==="["?o++:t[n]==="]"&&o--,o>0&&(r+=t[n]),n++;return{newIndex:n,value:Uo.parse(`[${r}]`)}}function Cn(t,e,o=!1){let r="",n=e+1;for(;n<t.length&&(t[n]!==(o?"'":'"')||t[n-1]==="\\");)r+=t[n],n++;return{newIndex:n,value:r}}function Ic(t,e){let o=1,r="",n=e+1;for(;n<t.length&&o>0;)t[n]==="{"?o++:t[n]==="}"&&o--,o>0&&(r+=t[n]),n++;return{newIndex:n,value:vc(r)}}function vc(t){return t[0]!=="{"?Uo.parse(t):Uo.parse(t.replace(/(\w+):/g,'"$1":'))}function Mc(t,e){let o="",r=e;for(;r<t.length&&t[r]!==" ";)o+=t[r],r++;return{newIndex:r-1,value:o}}function ft({props:t}){let e=[];for(let[o,r]of Object.entries(t))typeof r=="string"?e.push(`${o}="${Dc(r)}"`):typeof r=="number"?e.push(`${o}={${r}}`):typeof r=="boolean"?r&&e.push(`${o}`):r!==null&&typeof r=="object"&&(Array.isArray(r)?e.push(`${o}={[${r.map(n=>JSON.stringify(n,bn)).join(", ")}]}`):e.push(`${o}={${JSON.stringify(r,bn)}}`));return e.join(" ")}function Dc(t){return t.replace(/"/g,"&quot;")}function bn(t,e){return typeof e=="string"?e.replace(/'/g,"\\'"):e}function Qt({isEndOptional:t,lines:e,regexpEndRegex:o,startLineIndex:r,startMatch:n,trimChildren:l}){let i="",s="",u=e.slice(r),c=!1,d=0,a=0,m=null,p=!1,f=0,h=u[0].slice(0,n.index),C=0,g=r;e:for(let[S,b]of u.entries()){let k=l?b.trim():b,x=0;if(l)for(let _=0;_<b.length&&b[_]===" ";_++)x++;let w=0;for(S===0&&(w=(n.index??0)+n[0].length-x);w<k.length;){let _=k[w],y=k[w+1];if(c){if(_==="`"&&f++,f%2===0)if(_==="<"&&y==="/"){if(d--,d<0){s[s.length-1]===`
4
+ `&&(s=s.slice(0,-1)),g=S;for(let O=w;O<k.length;O++)if(k[O]===">"){C=O+1;break}break e}}else if(_==="/"&&y===">"){if(d--,d<0){s[s.length-1]===`
5
+ `&&(s=s.slice(0,-1)),g=S,C=w+2;break e}}else _==="<"&&y!=="/"&&d++;s+=_}else{if(_==="{"&&!m?a++:_==="}"&&!m?a--:(_==='"'||_==="'")&&!m?m=_:_===m&&(m=null),_==="/"&&y===">"&&a===0&&!m){p=!0,g=S,C=w+2;break e}else if(_===">"&&a===0&&!m){c=!0,w++;continue}i+=_}w++}if(c?s?.length>0&&S>0&&(s+=`
6
6
  `):i+=`
7
- `,o&&d<0){let _=k.match(o);if(_?.index!==void 0){C=S,x=_.index+_[0].length-1;break}}if(S===u.length-1&&!t&&!p)throw new Error("End match not found for lines "+e.join(`
7
+ `,o&&d<0){let _=k.match(o);if(_?.index!==void 0){g=S,C=_.index+_[0].length-1;break}}if(S===u.length-1&&!t&&!p)throw new Error("End match not found for lines "+e.join(`
8
8
  `)+`
9
9
 
10
- . Start match: `+JSON.stringify(n))}return{afterEndLine:u[C].trim().slice(x),beforeStartLine:h,content:s,endLineIndex:r+C,endlineLastCharIndex:x,propsString:i}}import{jsx as au}from"react/jsx-runtime";import cu from"bson-objectid";import"react";import{DecoratorBlockNode as Ac}from"@lexical/react/LexicalDecoratorBlockNode.js";import $c from"bson-objectid";var ht=class extends Ac{__cacheBuster;__fields;constructor({cacheBuster:e,fields:o,format:r,key:n}){super(r,n),this.__fields=o,this.__cacheBuster=e||0}static clone(e){return new this({cacheBuster:e.__cacheBuster,fields:e.__fields,format:e.__format,key:e.__key})}static getType(){return"block"}static importDOM(){return{}}static importJSON(e){e.version===1&&(e={...e,fields:{...e.fields.data},version:2});let o=Oc(e.fields);return o.setFormat(e.format),o}static isInline(){return!1}decorate(e,o){return null}exportDOM(){let e=document.createElement("div"),o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),type:"block",fields:this.getFields(),version:2}}getCacheBuster(){return this.getLatest().__cacheBuster}getFields(){return this.getLatest().__fields}getTextContent(){return"Block Field"}setFields(e,o){let r=this.getWritable();r.__fields=e,o||r.__cacheBuster++}};function Oc(t){return new ht({fields:{...t,id:t?.id||new $c.default().toHexString()}})}import{jsx as G,jsxs as gt,Fragment as wn}from"react/jsx-runtime";import{Button as En,Collapsible as Wc,Drawer as Gc,EditDepthProvider as Vc,ErrorPill as Kc,Form as Jc,formatDrawerSlug as Xc,FormSubmit as zc,Pill as Zc,RenderFields as Yc,SectionTitle as qc,useConfig as Qc,useDocumentForm as eu,useDocumentInfo as Sn,useEditDepth as tu,useFormSubmitted as ou,useServerFunctions as ru,useTranslation as nu}from"@payloadcms/ui";import{abortAndIgnore as Wo}from"@payloadcms/ui/shared";import{deepCopyObjectSimpleWithoutReactComponents as to,reduceFieldsToValues as Nn}from"payload/shared";import xt,{useCallback as Go,useEffect as Vo,useMemo as Ct,useRef as Ko}from"react";import{useLexicalComposerContext as lu}from"@lexical/react/LexicalComposerContext";import{getTranslation as iu}from"@payloadcms/translations";import{$getNodeByKey as oo}from"lexical";import{v4 as su}from"uuid";import{c as Fc}from"react/compiler-runtime";import{jsx as eo,jsxs as Pc}from"react/jsx-runtime";import{RenderFields as Bc,useFormSubmitted as jc}from"@payloadcms/ui";import Hc,{createContext as Uc}from"react";var kn=Uc({baseClass:"lexical-block",BlockCollapsible:()=>null,BlockDrawer:()=>null,CustomBlock:null,EditButton:()=>null,errorCount:0,formSchema:[],initialState:!1,nodeKey:"",RemoveButton:()=>null}),ge=()=>Hc.use(kn),_n=t=>{let e=Fc(4),{Collapsible:o,...r}=t,{BlockDrawer:n,CustomBlock:l,errorCount:i,formSchema:s}=r,c=jc()&&i>0,d;e[0]!==o||e[1]!==i||e[2]!==c?(d=m=>{let{children:p,...f}=m;return eo(o,{errorCount:i,fieldHasErrors:c,...f,children:p})},e[0]=o,e[1]=i,e[2]=c,e[3]=d):d=e[3];let a=d;return l?Pc(kn,{value:{...r,BlockCollapsible:a},children:[l,eo(n,{})]}):eo(a,{children:eo(Bc,{fields:s,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0})})};function Tn({fields:t}){for(let e in t){let o=t[e];Array.isArray(o?.rows)&&"value"in o&&(o.disableFormData=!0)}return t}var te="lexical-block",Ln=t=>{let{cacheBuster:e,formData:o,nodeKey:r}=t,n=ou(),{id:l,collectionSlug:i,globalSlug:s}=Sn(),{fieldProps:{featureClientSchemaMap:u,field:c,initialLexicalFormState:d,readOnly:a,schemaPath:m},uuid:p}=j(),{fields:f}=eu(),h=Ko(new AbortController),x=tu(),[C,T]=xt.useState(0),{config:S}=Qc(),b=Xc({slug:`lexical-blocks-create-${p}-${o.id}`,depth:x}),{toggleDrawer:k}=fe(b),{getDocPreferences:g,setDocFieldPreferences:w}=Sn(),[_]=lu(),y=o.blockType,{getFormState:O}=ru(),v=`${m}.lexical_internal_feature.blocks.lexical_blocks.${y}.fields`,[N,E]=xt.useState(()=>d?.[o.id]?.formState?{...d?.[o.id]?.formState,blockName:{initialValue:o.blockName,passesCondition:!0,valid:!0,value:o.blockName}}:!1),L=Ko(!1),D=Ko(e);Vo(()=>{L.current?(D.current!==e&&E(!1),D.current=e):L.current=!0},[e]);let[I,A]=xt.useState(N?._components?.customComponents?.BlockLabel??void 0),[R,F]=xt.useState(N?._components?.customComponents?.Block??void 0);Vo(()=>{let H=new AbortController;return o&&!N&&(async()=>{let{state:V}=await O({id:l,collectionSlug:i,data:o,docPermissions:{fields:!0},docPreferences:await g(),documentFormState:to(f),globalSlug:s,initialBlockData:o,operation:"update",renderAllFields:!0,schemaPath:v,signal:H.signal});if(V){V.blockName={initialValue:o.blockName,passesCondition:!0,valid:!0,value:o.blockName};let X=Nn(to(V),!0);_.update(()=>{let Y=oo(r);if(Y&&De(Y)){let ne=X;ne.blockType=y,Y.setFields(ne,!0)}}),E(V),A(V._components?.customComponents?.BlockLabel??void 0),F(V._components?.customComponents?.Block??void 0)}})(),()=>{Wo(H)}},[O,v,l,o,_,r,N,i,s,g,f,y]);let[W,Q]=xt.useState(d?.[o.id]?.collapsed??!1),re=`${m}.lexical_internal_feature.blocks.lexical_blocks.${y}`,J=u.blocks?.[re]?.[0],U=J.blockReferences?typeof J?.blockReferences?.[0]=="string"?S.blocksMap[J?.blockReferences?.[0]]:J?.blockReferences?.[0]:J?.blocks?.[0],{i18n:We,t:Se}=nu(),pe=Go(async({formState:H,submit:ue})=>{Wo(h.current);let V=new AbortController;h.current=V;let{state:X}=await O({id:l,collectionSlug:i,docPermissions:{fields:!0},docPreferences:await g(),documentFormState:to(f),formState:H,globalSlug:s,initialBlockFormState:H,operation:"update",renderAllFields:!!ue,schemaPath:v,signal:V.signal});if(!X)return H;H.blockName&&(X.blockName=H.blockName);let Y=Nn(Tn({fields:to(X)}),!0);if(setTimeout(()=>{_.update(()=>{let ne=oo(r);if(ne&&De(ne)){let Ve=Y;Ve.blockType=y,ne.setFields(Ve,!0)}})},0),ue){A(X._components?.customComponents?.BlockLabel??void 0),F(X._components?.customComponents?.Block??void 0);let ne=0;for(let Ve of Object.values(X))Ve?.valid===!1&&ne++;T(ne)}return X},[O,l,i,g,s,v,y,f,_,r]);Vo(()=>()=>{Wo(h.current)},[]);let Bt=Go(()=>{_.update(()=>{oo(r)?.remove()})},[_,r]),Ne=U?.labels?.singular?iu(U.labels.singular,We):U?.slug,jt=Go(H=>{g().then(ue=>{let X=ue?.fields?.[c.name]?.collapsed,Y=X&&X?.length?X:[];H?Y.includes(o.id)||Y.push(o.id):Y.includes(o.id)&&Y.splice(Y.indexOf(o.id),1),w(c.name,{collapsed:Y,hello:"hi"})})},[g,c.name,w,o.id]),Ge=Ct(()=>()=>G(En,{buttonStyle:"icon-label",className:`${te}__editButton`,disabled:a,el:"button",icon:"edit",onClick:H=>(H.preventDefault(),H.stopPropagation(),k(),!1),onMouseDown:H=>{H.preventDefault()},round:!0,size:"small",tooltip:Se("lexical:blocks:inlineBlocks:edit",{label:Ne})}),[Ne,a,Se,k]),Ht=Ct(()=>()=>G(En,{buttonStyle:"icon-label",className:`${te}__removeButton`,disabled:c?.admin?.readOnly||!1,icon:"x",onClick:H=>{H.preventDefault(),Bt()},round:!0,tooltip:"Remove Block"}),[c?.admin?.readOnly,Bt]),Ao=Ct(()=>({Actions:H,children:ue,className:V,collapsibleProps:X,disableBlockName:Y,editButton:ne,errorCount:Ve,fieldHasErrors:$o,Label:Qr,Pill:en,removeButton:ac})=>G("div",{className:te+" "+te+"-"+y,children:G(Wc,{className:[`${te}__row`,$o?`${te}__row--has-errors`:`${te}__row--no-errors`,V].filter(Boolean).join(" "),collapsibleStyle:$o?"error":"default",header:gt("div",{className:`${te}__block-header`,children:[typeof Qr<"u"?Qr:typeof I<"u"?I:gt("div",{className:`${te}__block-label`,children:[typeof en<"u"?en:G(Zc,{className:`${te}__block-pill ${te}__block-pill-${y}`,pillStyle:"white",size:"small",children:Ne??y}),!Y&&!U?.admin?.disableBlockName&&G(qc,{path:"blockName",readOnly:c?.admin?.readOnly||!1}),$o&&G(Kc,{count:Ve??0,i18n:We,withMessage:!0})]}),G("div",{className:`${te}__block-actions`,children:typeof H<"u"?H:gt(wn,{children:[R&&ne!==!1||!R&&ne?G(Ge,{}):null,ac!==!1&&_.isEditable()?G(Ht,{}):null]})})]}),isCollapsed:W,onToggle:tn=>{jt(tn),Q(tn)},...X||{},children:ue},0)}),[R,I,Ge,Ht,Ne,U?.admin?.disableBlockName,_,y,We,W,jt,c?.admin?.readOnly]),Yr=o?.id,qr=Ct(()=>()=>G(Vc,{children:G(Gc,{className:"",slug:b,title:Se(`lexical:blocks:inlineBlocks:${Yr?"edit":"create"}`,{label:Ne??Se("lexical:blocks:inlineBlocks:label")}),children:N?gt(wn,{children:[G(Yc,{fields:U?.fields??[],forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:v,permissions:!0,readOnly:!1}),G(zc,{programmaticSubmit:!0,children:Se("fields:saveChanges")})]}):null})}),[N,b,Yr,Ne,Se,U?.fields,v]),sc=Ct(()=>N?G(Jc,{beforeSubmit:[async({formState:H})=>await pe({formState:H,submit:!0})],el:"div",fields:U?.fields??[],initialState:N,onChange:[pe],onSubmit:(H,ue)=>{ue.blockType=y,_.update(()=>{let V=oo(r);V&&De(V)&&V.setFields(ue,!0)}),k()},submitted:n,uuid:su(),children:G(_n,{baseClass:te,BlockDrawer:qr,Collapsible:Ao,CustomBlock:R,EditButton:Ge,errorCount:C,formSchema:U?.fields??[],initialState:N,nodeKey:r,RemoveButton:Ht})}):null,[Ao,qr,R,y,Ht,Ge,_,C,k,U?.fields,N,r,pe,n]);return U?sc:G(Ao,{disableBlockName:!0,fieldHasErrors:!0,children:gt("div",{className:"lexical-block-not-found",children:["Error: Block '",y,"' not found in the config but exists in the lexical data"]})})};var se=class extends ht{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){e.version===1&&(e={...e,fields:{...e.fields.data},version:2});let o=Ae(e.fields);return o.setFormat(e.format),o}decorate(e,o){return au(Ln,{cacheBuster:this.getCacheBuster(),formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Ae(t){return new se({fields:{...t,id:t?.id||new cu.default().toHexString()}})}function De(t){return t instanceof se}import{createHeadlessEditor as uu}from"@lexical/headless";function Jo(t,e){return({editorState:r})=>{let n=uu({nodes:t});try{n.setEditorState(n.parseEditorState(r))}catch(i){console.error("getLexicalToMarkdown: ERROR parsing editor state",i)}let l="";return n.getEditorState().read(()=>{l=Wt(e)}),l}}import{createHeadlessEditor as du}from"@lexical/headless";function ro(t,e){return({markdown:r})=>{let n=du({nodes:t});return n.update(()=>{Ut(r,e)},{discrete:!0}),n.getEditorState().toJSON()}}function mu(t){let e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{regExpEnd:new RegExp(`</(${e})\\s*>|<${e}[^>]*?/>`,"i"),regExpStart:new RegExp(`<(${e})([^>]*?)\\s*(/?)>`,"i")}}var In=({blocks:t,inlineBlocks:e})=>{if(!t?.length&&!e?.length)return[];let o=[];if(t?.length)for(let r of t){let n=Rn(r,!1);n&&(o=o.concat(n))}if(e?.length)for(let r of e){let n=Rn(r,!0);n&&(o=o.concat(n))}return o};function Rn(t,e){if(!t.jsx)return null;let o=mu(t.slug),r=[];return e?(r.push(({allNodes:n,allTransformers:l})=>({type:"text-match",dependencies:[at],export:i=>{if(!ut(i)||i.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let s=i.getFields(),u=Jo(n,l),c=t.jsx.export({fields:s,lexicalToMarkdown:u});if(c===!1)return null;if(typeof c=="string")return c;let d=c.props&&Object.keys(c.props)?.length>0,a=c.props??{};return c?.children?.length?`<${s.blockType}${d?" "+ft({props:a}):""}>${c.children}</${s.blockType}>`:`<${s.blockType}${d?" "+ft({props:a}):""}/>`},getEndIndex:(i,s)=>{let{endlineLastCharIndex:u}=Qt({isEndOptional:!1,lines:[i.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:s,trimChildren:!1});return u},importRegExp:t.jsx?.customStartRegex??o.regExpStart,regExp:/___ignoreignoreignore___/g,replace(i,s){let{content:u,propsString:c}=Qt({isEndOptional:!1,lines:[i.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:{...s,index:0},trimChildren:!1});if(!t?.jsx?.import)return;let d=ro(n,l),a=t.jsx.import({children:u,closeMatch:null,htmlToLexical:null,markdownToLexical:d,openMatch:s,props:c?qt({propsString:c}):{}});if(a===!1)return;let m=ct({blockType:t.slug,...a});i.replace(m)}})),r):(r.push(({allNodes:n,allTransformers:l})=>({dependencies:[se],export:i=>{if(!De(i)||i.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let s=i.getFields(),u=Jo(n,l),c=t.jsx.export({fields:s,lexicalToMarkdown:u});if(c===!1)return null;if(typeof c=="string")return c;let d=c.props&&Object.keys(c.props)?.length>0,a=c.props??{};if(c?.children?.length){let m=c.children,p="";if(m.includes(`
10
+ . Start match: `+JSON.stringify(n))}return{afterEndLine:u[g].trim().slice(C),beforeStartLine:h,content:s,endLineIndex:r+g,endlineLastCharIndex:C,propsString:i}}import{jsx as au}from"react/jsx-runtime";import cu from"bson-objectid";import"react";import{DecoratorBlockNode as Ac}from"@lexical/react/LexicalDecoratorBlockNode.js";import $c from"bson-objectid";var ht=class extends Ac{__cacheBuster;__fields;constructor({cacheBuster:e,fields:o,format:r,key:n}){super(r,n),this.__fields=o,this.__cacheBuster=e||0}static clone(e){return new this({cacheBuster:e.__cacheBuster,fields:e.__fields,format:e.__format,key:e.__key})}static getType(){return"block"}static importDOM(){return{}}static importJSON(e){e.version===1&&(e={...e,fields:{...e.fields.data},version:2});let o=Oc(e.fields);return o.setFormat(e.format),o}static isInline(){return!1}decorate(e,o){return null}exportDOM(){let e=document.createElement("div"),o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),type:"block",fields:this.getFields(),version:2}}getCacheBuster(){return this.getLatest().__cacheBuster}getFields(){return this.getLatest().__fields}getTextContent(){return"Block Field"}setFields(e,o){let r=this.getWritable();r.__fields=e,o||r.__cacheBuster++}};function Oc(t){return new ht({fields:{...t,id:t?.id||new $c.default().toHexString()}})}import{jsx as G,jsxs as gt,Fragment as wn}from"react/jsx-runtime";import{Button as En,Collapsible as Wc,Drawer as Gc,EditDepthProvider as Vc,ErrorPill as Kc,Form as Jc,formatDrawerSlug as Xc,FormSubmit as zc,Pill as Zc,RenderFields as Yc,SectionTitle as qc,useConfig as Qc,useDocumentForm as eu,useDocumentInfo as Sn,useEditDepth as tu,useFormSubmitted as ou,useServerFunctions as ru,useTranslation as nu}from"@payloadcms/ui";import{abortAndIgnore as Wo}from"@payloadcms/ui/shared";import{deepCopyObjectSimpleWithoutReactComponents as to,reduceFieldsToValues as Nn}from"payload/shared";import xt,{useCallback as Go,useEffect as Vo,useMemo as Ct,useRef as Ko}from"react";import{useLexicalComposerContext as lu}from"@lexical/react/LexicalComposerContext";import{getTranslation as iu}from"@payloadcms/translations";import{$getNodeByKey as oo}from"lexical";import{v4 as su}from"uuid";import{c as Fc}from"react/compiler-runtime";import{jsx as eo,jsxs as Pc}from"react/jsx-runtime";import{RenderFields as Bc,useFormSubmitted as jc}from"@payloadcms/ui";import Hc,{createContext as Uc}from"react";var kn=Uc({baseClass:"lexical-block",BlockCollapsible:()=>null,BlockDrawer:()=>null,CustomBlock:null,EditButton:()=>null,errorCount:0,formSchema:[],initialState:!1,nodeKey:"",RemoveButton:()=>null}),ge=()=>Hc.use(kn),_n=t=>{let e=Fc(4),{Collapsible:o,...r}=t,{BlockDrawer:n,CustomBlock:l,errorCount:i,formSchema:s}=r,c=jc()&&i>0,d;e[0]!==o||e[1]!==i||e[2]!==c?(d=m=>{let{children:p,...f}=m;return eo(o,{errorCount:i,fieldHasErrors:c,...f,children:p})},e[0]=o,e[1]=i,e[2]=c,e[3]=d):d=e[3];let a=d;return l?Pc(kn,{value:{...r,BlockCollapsible:a},children:[l,eo(n,{})]}):eo(a,{children:eo(Bc,{fields:s,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0})})};function Tn({fields:t}){for(let e in t){let o=t[e];Array.isArray(o?.rows)&&"value"in o&&(o.disableFormData=!0)}return t}var te="lexical-block",Ln=t=>{let{cacheBuster:e,formData:o,nodeKey:r}=t,n=ou(),{id:l,collectionSlug:i,globalSlug:s}=Sn(),{fieldProps:{featureClientSchemaMap:u,field:c,initialLexicalFormState:d,readOnly:a,schemaPath:m},uuid:p}=j(),{fields:f}=eu(),h=Ko(new AbortController),C=tu(),[g,T]=xt.useState(0),{config:S}=Qc(),b=Xc({slug:`lexical-blocks-create-${p}-${o.id}`,depth:C}),{toggleDrawer:k}=fe(b),{getDocPreferences:x,setDocFieldPreferences:w}=Sn(),[_]=lu(),y=o.blockType,{getFormState:O}=ru(),v=`${m}.lexical_internal_feature.blocks.lexical_blocks.${y}.fields`,[N,E]=xt.useState(()=>d?.[o.id]?.formState?{...d?.[o.id]?.formState,blockName:{initialValue:o.blockName,passesCondition:!0,valid:!0,value:o.blockName}}:!1),L=Ko(!1),D=Ko(e);Vo(()=>{L.current?(D.current!==e&&E(!1),D.current=e):L.current=!0},[e]);let[I,A]=xt.useState(N?._components?.customComponents?.BlockLabel??void 0),[R,F]=xt.useState(N?._components?.customComponents?.Block??void 0);Vo(()=>{let H=new AbortController;return o&&!N&&(async()=>{let{state:V}=await O({id:l,collectionSlug:i,data:o,docPermissions:{fields:!0},docPreferences:await x(),documentFormState:to(f),globalSlug:s,initialBlockData:o,operation:"update",renderAllFields:!0,schemaPath:v,signal:H.signal});if(V){V.blockName={initialValue:o.blockName,passesCondition:!0,valid:!0,value:o.blockName};let X=Nn(to(V),!0);_.update(()=>{let q=oo(r);if(q&&De(q)){let ne=X;ne.blockType=y,q.setFields(ne,!0)}}),E(V),A(V._components?.customComponents?.BlockLabel??void 0),F(V._components?.customComponents?.Block??void 0)}})(),()=>{Wo(H)}},[O,v,l,o,_,r,N,i,s,x,f,y]);let[W,Q]=xt.useState(d?.[o.id]?.collapsed??!1),re=`${m}.lexical_internal_feature.blocks.lexical_blocks.${y}`,J=u.blocks?.[re]?.[0],U=J.blockReferences?typeof J?.blockReferences?.[0]=="string"?S.blocksMap[J?.blockReferences?.[0]]:J?.blockReferences?.[0]:J?.blocks?.[0],{i18n:We,t:Se}=nu(),pe=Go(async({formState:H,submit:ue})=>{Wo(h.current);let V=new AbortController;h.current=V;let{state:X}=await O({id:l,collectionSlug:i,docPermissions:{fields:!0},docPreferences:await x(),documentFormState:to(f),formState:H,globalSlug:s,initialBlockFormState:H,operation:"update",renderAllFields:!!ue,schemaPath:v,signal:V.signal});if(!X)return H;H.blockName&&(X.blockName=H.blockName);let q=Nn(Tn({fields:to(X)}),!0);if(setTimeout(()=>{_.update(()=>{let ne=oo(r);if(ne&&De(ne)){let Ve=q;Ve.blockType=y,ne.setFields(Ve,!0)}})},0),ue){A(X._components?.customComponents?.BlockLabel??void 0),F(X._components?.customComponents?.Block??void 0);let ne=0;for(let Ve of Object.values(X))Ve?.valid===!1&&ne++;T(ne)}return X},[O,l,i,x,s,v,y,f,_,r]);Vo(()=>()=>{Wo(h.current)},[]);let Bt=Go(()=>{_.update(()=>{oo(r)?.remove()})},[_,r]),Ne=U?.labels?.singular?iu(U.labels.singular,We):U?.slug,jt=Go(H=>{x().then(ue=>{let X=ue?.fields?.[c.name]?.collapsed,q=X&&X?.length?X:[];H?q.includes(o.id)||q.push(o.id):q.includes(o.id)&&q.splice(q.indexOf(o.id),1),w(c.name,{collapsed:q,hello:"hi"})})},[x,c.name,w,o.id]),Ge=Ct(()=>()=>G(En,{buttonStyle:"icon-label",className:`${te}__editButton`,disabled:a,el:"button",icon:"edit",onClick:H=>(H.preventDefault(),H.stopPropagation(),k(),!1),onMouseDown:H=>{H.preventDefault()},round:!0,size:"small",tooltip:Se("lexical:blocks:inlineBlocks:edit",{label:Ne})}),[Ne,a,Se,k]),Ht=Ct(()=>()=>G(En,{buttonStyle:"icon-label",className:`${te}__removeButton`,disabled:c?.admin?.readOnly||!1,icon:"x",onClick:H=>{H.preventDefault(),Bt()},round:!0,tooltip:"Remove Block"}),[c?.admin?.readOnly,Bt]),Ao=Ct(()=>({Actions:H,children:ue,className:V,collapsibleProps:X,disableBlockName:q,editButton:ne,errorCount:Ve,fieldHasErrors:$o,Label:Qr,Pill:en,removeButton:ac})=>G("div",{className:te+" "+te+"-"+y,children:G(Wc,{className:[`${te}__row`,$o?`${te}__row--has-errors`:`${te}__row--no-errors`,V].filter(Boolean).join(" "),collapsibleStyle:$o?"error":"default",header:gt("div",{className:`${te}__block-header`,children:[typeof Qr<"u"?Qr:typeof I<"u"?I:gt("div",{className:`${te}__block-label`,children:[typeof en<"u"?en:G(Zc,{className:`${te}__block-pill ${te}__block-pill-${y}`,pillStyle:"white",size:"small",children:Ne??y}),!q&&!U?.admin?.disableBlockName&&G(qc,{path:"blockName",readOnly:c?.admin?.readOnly||!1}),$o&&G(Kc,{count:Ve??0,i18n:We,withMessage:!0})]}),G("div",{className:`${te}__block-actions`,children:typeof H<"u"?H:gt(wn,{children:[R&&ne!==!1||!R&&ne?G(Ge,{}):null,ac!==!1&&_.isEditable()?G(Ht,{}):null]})})]}),isCollapsed:W,onToggle:tn=>{jt(tn),Q(tn)},...X||{},children:ue},0)}),[R,I,Ge,Ht,Ne,U?.admin?.disableBlockName,_,y,We,W,jt,c?.admin?.readOnly]),Yr=o?.id,qr=Ct(()=>()=>G(Vc,{children:G(Gc,{className:"",slug:b,title:Se(`lexical:blocks:inlineBlocks:${Yr?"edit":"create"}`,{label:Ne??Se("lexical:blocks:inlineBlocks:label")}),children:N?gt(wn,{children:[G(Yc,{fields:U?.fields??[],forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:v,permissions:!0,readOnly:!1}),G(zc,{programmaticSubmit:!0,children:Se("fields:saveChanges")})]}):null})}),[N,b,Yr,Ne,Se,U?.fields,v]),sc=Ct(()=>N?G(Jc,{beforeSubmit:[async({formState:H})=>await pe({formState:H,submit:!0})],el:"div",fields:U?.fields??[],initialState:N,onChange:[pe],onSubmit:(H,ue)=>{ue.blockType=y,_.update(()=>{let V=oo(r);V&&De(V)&&V.setFields(ue,!0)}),k()},submitted:n,uuid:su(),children:G(_n,{baseClass:te,BlockDrawer:qr,Collapsible:Ao,CustomBlock:R,EditButton:Ge,errorCount:g,formSchema:U?.fields??[],initialState:N,nodeKey:r,RemoveButton:Ht})}):null,[Ao,qr,R,y,Ht,Ge,_,g,k,U?.fields,N,r,pe,n]);return U?sc:G(Ao,{disableBlockName:!0,fieldHasErrors:!0,children:gt("div",{className:"lexical-block-not-found",children:["Error: Block '",y,"' not found in the config but exists in the lexical data"]})})};var se=class extends ht{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){e.version===1&&(e={...e,fields:{...e.fields.data},version:2});let o=Ae(e.fields);return o.setFormat(e.format),o}decorate(e,o){return au(Ln,{cacheBuster:this.getCacheBuster(),formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Ae(t){return new se({fields:{...t,id:t?.id||new cu.default().toHexString()}})}function De(t){return t instanceof se}import{createHeadlessEditor as uu}from"@lexical/headless";function Jo(t,e){return({editorState:r})=>{let n=uu({nodes:t});try{n.setEditorState(n.parseEditorState(r))}catch(i){console.error("getLexicalToMarkdown: ERROR parsing editor state",i)}let l="";return n.getEditorState().read(()=>{l=Wt(e)}),l}}import{createHeadlessEditor as du}from"@lexical/headless";function ro(t,e){return({markdown:r})=>{let n=du({nodes:t});return n.update(()=>{Ut(r,e)},{discrete:!0}),n.getEditorState().toJSON()}}function mu(t){let e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{regExpEnd:new RegExp(`</(${e})\\s*>|<${e}[^>]*?/>`,"i"),regExpStart:new RegExp(`<(${e})([^>]*?)\\s*(/?)>`,"i")}}var In=({blocks:t,inlineBlocks:e})=>{if(!t?.length&&!e?.length)return[];let o=[];if(t?.length)for(let r of t){let n=Rn(r,!1);n&&(o=o.concat(n))}if(e?.length)for(let r of e){let n=Rn(r,!0);n&&(o=o.concat(n))}return o};function Rn(t,e){if(!t.jsx)return null;let o=mu(t.slug),r=[];return e?(r.push(({allNodes:n,allTransformers:l})=>({type:"text-match",dependencies:[at],export:i=>{if(!ut(i)||i.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let s=i.getFields(),u=Jo(n,l),c=t.jsx.export({fields:s,lexicalToMarkdown:u});if(c===!1)return null;if(typeof c=="string")return c;let d=c.props&&Object.keys(c.props)?.length>0,a=c.props??{};return c?.children?.length?`<${s.blockType}${d?" "+ft({props:a}):""}>${c.children}</${s.blockType}>`:`<${s.blockType}${d?" "+ft({props:a}):""}/>`},getEndIndex:(i,s)=>{let{endlineLastCharIndex:u}=Qt({isEndOptional:!1,lines:[i.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:s,trimChildren:!1});return u},importRegExp:t.jsx?.customStartRegex??o.regExpStart,regExp:/___ignoreignoreignore___/g,replace(i,s){let{content:u,propsString:c}=Qt({isEndOptional:!1,lines:[i.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:{...s,index:0},trimChildren:!1});if(!t?.jsx?.import)return;let d=ro(n,l),a=t.jsx.import({children:u,closeMatch:null,htmlToLexical:null,markdownToLexical:d,openMatch:s,props:c?qt({propsString:c}):{}});if(a===!1)return;let m=ct({blockType:t.slug,...a});i.replace(m)}})),r):(r.push(({allNodes:n,allTransformers:l})=>({dependencies:[se],export:i=>{if(!De(i)||i.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let s=i.getFields(),u=Jo(n,l),c=t.jsx.export({fields:s,lexicalToMarkdown:u});if(c===!1)return null;if(typeof c=="string")return c;let d=c.props&&Object.keys(c.props)?.length>0,a=c.props??{};if(c?.children?.length){let m=c.children,p="";if(m.includes(`
11
11
  `))for(let f of m.split(`
12
12
  `)){let h="";!t?.jsx?.doNotTrimChildren&&f!==""&&(h=" "),h+=f+`
13
13
  `,p+=h}else p=(t?.jsx?.doNotTrimChildren?"":" ")+m+`
14
14
  `;return`<${s.blockType}${d?" "+ft({props:a}):""}>
15
- ${p}</${s.blockType}>`}return`<${s.blockType}${d?" "+ft({props:a}):""}/>`},handleImportAfterStartMatch:t.jsx?.customEndRegex?void 0:({lines:i,rootNode:s,startLineIndex:u,startMatch:c,transformer:d})=>{let a=typeof d.regExpEnd=="object"&&"regExp"in d.regExpEnd?d.regExpEnd.regExp:d.regExpEnd,m=d.regExpEnd&&typeof d.regExpEnd=="object"&&"optional"in d.regExpEnd?d.regExpEnd.optional:!d.regExpEnd,{afterEndLine:p,beforeStartLine:f,content:h,endLineIndex:x,propsString:C}=Qt({isEndOptional:m,lines:i,regexpEndRegex:a,startLineIndex:u,startMatch:c,trimChildren:!1}),T="";if(t?.jsx?.doNotTrimChildren)T=h.endsWith(`
15
+ ${p}</${s.blockType}>`}return`<${s.blockType}${d?" "+ft({props:a}):""}/>`},handleImportAfterStartMatch:t.jsx?.customEndRegex?void 0:({lines:i,rootNode:s,startLineIndex:u,startMatch:c,transformer:d})=>{let a=typeof d.regExpEnd=="object"&&"regExp"in d.regExpEnd?d.regExpEnd.regExp:d.regExpEnd,m=d.regExpEnd&&typeof d.regExpEnd=="object"&&"optional"in d.regExpEnd?d.regExpEnd.optional:!d.regExpEnd,{afterEndLine:p,beforeStartLine:f,content:h,endLineIndex:C,propsString:g}=Qt({isEndOptional:m,lines:i,regexpEndRegex:a,startLineIndex:u,startMatch:c,trimChildren:!1}),T="";if(t?.jsx?.doNotTrimChildren)T=h.endsWith(`
16
16
  `)?h.slice(0,-1):h;else if(h.includes(`
17
- `)){let g=h.split(`
18
- `),w=0;for(let _ of g){if(w++,_.startsWith(" "))T+=_.slice(2);else if(_==="")T+=_;else{T=h.endsWith(`
19
- `)?h.slice(0,-1):h;break}T+=w===g.length?"":`
17
+ `)){let x=h.split(`
18
+ `),w=0;for(let _ of x){if(w++,_.startsWith(" "))T+=_.slice(2);else if(_==="")T+=_;else{T=h.endsWith(`
19
+ `)?h.slice(0,-1):h;break}T+=w===x.length?"":`
20
20
  `}}else T=(h.startsWith(" ")?h.slice(2):h)+`
21
- `;if(!t?.jsx?.import)return[!1,u];let S=ro(n,l),b=t.jsx.import({children:T,closeMatch:null,htmlToLexical:null,markdownToLexical:S,openMatch:c,props:C?qt({propsString:C}):{}});if(b===!1)return[!1,u];let k=Ae({blockType:t.slug,...b});if(k){let g=null,w=null;if(f?.length){g=S({markdown:f})?.root?.children??[];let _=g?.[0];_&&s.append(yn(_))}if(s.append(k),p?.length){w=S({markdown:p})?.root?.children;let _=s.getChildren()[s.getChildren().length-1],y=yn(w[0])?.getChildren();if(y?.length)for(let O of y)_.append(O)}}return[!0,x]},regExpEnd:t.jsx?.customEndRegex??o.regExpEnd,regExpStart:t.jsx?.customStartRegex??o.regExpStart,type:"multiline-element",replace:(i,s,u,c,d)=>{if(t?.jsx?.import){if(!d){let x="";if(s)for(let C of s)x+=C.getTextContent();d=[x]}let a="";t?.jsx?.doNotTrimChildren?a=d.join(`
21
+ `;if(!t?.jsx?.import)return[!1,u];let S=ro(n,l),b=t.jsx.import({children:T,closeMatch:null,htmlToLexical:null,markdownToLexical:S,openMatch:c,props:g?qt({propsString:g}):{}});if(b===!1)return[!1,u];let k=Ae({blockType:t.slug,...b});if(k){let x=null,w=null;if(f?.length){x=S({markdown:f})?.root?.children??[];let _=x?.[0];_&&s.append(yn(_))}if(s.append(k),p?.length){w=S({markdown:p})?.root?.children;let _=s.getChildren()[s.getChildren().length-1],y=yn(w[0])?.getChildren();if(y?.length)for(let O of y)_.append(O)}}return[!0,C]},regExpEnd:t.jsx?.customEndRegex??o.regExpEnd,regExpStart:t.jsx?.customStartRegex??o.regExpStart,type:"multiline-element",replace:(i,s,u,c,d)=>{if(t?.jsx?.import){if(!d){let C="";if(s)for(let g of s)C+=g.getTextContent();d=[C]}let a="";t?.jsx?.doNotTrimChildren?a=d.join(`
22
22
  `):a=d.join(`
23
- `).trim();let m=u[1]?.trim(),p=ro(n,l),f=t.jsx.import({children:a,closeMatch:c,htmlToLexical:null,markdownToLexical:p,openMatch:u,props:m?qt({propsString:m}):{}});if(f===!1)return!1;let h=Ae({blockType:t.slug,...f});h&&i.append(h);return}return!1}})),r)}import{createCommand as vn}from"lexical";var Je=vn("INSERT_BLOCK_COMMAND"),Xe=vn("INSERT_INLINE_BLOCK_COMMAND");import{c as pu}from"react/compiler-runtime";import{useLexicalComposerContext as fu}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as hu,$wrapNodeInElement as gu,mergeRegister as xu}from"@lexical/utils";import{formatDrawerSlug as Cu,useEditDepth as bu}from"@payloadcms/ui";import{$createParagraphNode as ku,$getNodeByKey as _u,$getPreviousSelection as Tu,$getSelection as wu,$insertNodes as Eu,$isParagraphNode as Su,$isRangeSelection as Nu,$isRootOrShadowRoot as Lu,COMMAND_PRIORITY_EDITOR as Mn}from"lexical";import{useEffect as yu,useState as Ru}from"react";var Dn=()=>{let t=pu(12),[e]=fu(),[o,r]=Ru(null),{setCreatedInlineBlock:n,uuid:l}=j(),i=bu(),s="lexical-inlineBlocks-create-"+l,u;t[0]!==i||t[1]!==s?(u=Cu({slug:s,depth:i}),t[0]=i,t[1]=s,t[2]=u):u=t[2];let c=u,{toggleDrawer:d}=fe(c,!0),a;t[3]!==e||t[4]!==n||t[5]!==o?(a=()=>{if(!e.hasNodes([se]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return xu(e.registerCommand(Je,p=>(e.update(()=>{let f=wu()||Tu();if(Nu(f)){let h=Ae(p),{focus:x}=f,C=x.getNode();hu(h),Su(C)&&!C.__first&&C.remove()}}),!0),Mn),e.registerCommand(Xe,p=>{if(o){let h=_u(o);return!h||!ut(h)?!1:(h.setFields(p),r(null),!0)}let f=ct(p);return n?.(f),Eu([f]),Lu(f.getParentOrThrow())&&gu(f,ku).selectEnd(),!0},Mn))},t[3]=e,t[4]=n,t[5]=o,t[6]=a):a=t[6];let m;return t[7]!==e||t[8]!==n||t[9]!==o||t[10]!==d?(m=[e,n,o,d],t[7]=e,t[8]=n,t[9]=o,t[10]=d,t[11]=m):m=t[11],yu(a,m),null};var Iu=M(({config:t,featureClientSchemaMap:e,props:o,schemaPath:r})=>{let n=`${r}.lexical_internal_feature.blocks.lexical_blocks`,l=`${r}.lexical_internal_feature.blocks.lexical_inline_blocks`,i=e.blocks;if(!i)return{};let s=Object.entries(i).filter(([a])=>a.startsWith(n+".")&&!a.replace(n+".","").includes(".")).map(([,a])=>a[0]),u=Object.entries(i).filter(([a])=>a.startsWith(l+".")&&!a.replace(l+".","").includes(".")).map(([,a])=>a[0]),c=s.map(a=>a.blockReferences?typeof a.blockReferences[0]=="string"?t.blocksMap[a.blockReferences[0]]:a.blockReferences[0]:a.blocks[0]).filter(a=>a!==void 0),d=u.map(a=>a.blockReferences?typeof a.blockReferences[0]=="string"?t.blocksMap[a.blockReferences[0]]:a.blockReferences[0]:a.blocks[0]).filter(a=>a!==void 0);return{markdownTransformers:In({blocks:c,inlineBlocks:d}),nodes:[se,at],plugins:[{Component:Dn,position:"normal"}],sanitizedClientFeatureProps:o,slashMenu:{groups:[c?.length?{items:c.map(a=>({Icon:Yt(a.imageURL,a.imageAltText),key:"block-"+a.slug,keywords:["block","blocks",a.slug],label:({i18n:m})=>a?.labels?.singular?no(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(Je,{blockName:"",blockType:a.slug})}})),key:"blocks",label:({i18n:a})=>a.t("lexical:blocks:label")}:null,d?.length?{items:d.map(a=>({Icon:Zt,key:"inlineBlocks-"+a.slug,keywords:["inlineBlock","inline block",a.slug],label:({i18n:m})=>a?.labels?.singular?no(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(Xe,{blockName:"",blockType:a.slug})}})),key:"inlineBlocks",label:({i18n:a})=>a.t("lexical:blocks:inlineBlocks:label")}:null].filter(Boolean)},toolbarFixed:{groups:[c.length?{type:"dropdown",ChildComponent:zt,items:c.map((a,m)=>({ChildComponent:Yt(a.imageURL,a.imageAltText),isActive:void 0,key:"block-"+a.slug,label:({i18n:p})=>a?.labels?.singular?no(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(Je,{blockName:"",blockType:a.slug})},order:m})),key:"blocks",order:20}:null,d?.length?{type:"dropdown",ChildComponent:Zt,items:d.map((a,m)=>({ChildComponent:a.imageURL?Yt(a.imageURL,a.imageAltText):Zt,isActive:void 0,key:"inlineBlock-"+a.slug,label:({i18n:p})=>a?.labels?.singular?no(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(Xe,{blockName:"",blockType:a.slug})},order:m})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}});import{c as Du}from"react/compiler-runtime";import{jsx as Oe,jsxs as Yo}from"react/jsx-runtime";import{useLexicalComposerContext as Au}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as $u,$createTextNode as Ou,$getRoot as Fu,getDOMSelection as Xo}from"lexical";import*as Pn from"react";import{useCallback as $e,useEffect as zo,useLayoutEffect as $n,useRef as Zo,useState as lo}from"react";var vu=le&&"documentMode"in document?document.documentMode:null,An=le&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),s5=le&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),a5=le&&"InputEvent"in window&&!vu?"getTargetRanges"in new window.InputEvent("input"):!1,c5=le&&/Version\/[\d.].*Safari/.test(navigator.userAgent),u5=le&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,d5=le&&/Android/.test(navigator.userAgent),m5=le&&/Win/.test(navigator.platform),Mu=le&&/^(?=.*Chrome).*/i.test(navigator.userAgent),p5=le&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!Mu;var Pu=t=>{let e=document.createElement("textarea");e.value=t||"",e.style.position="absolute",e.style.opacity="0",document.body?.appendChild(e),e.focus(),e.select();try{let o=document.execCommand("copy");console.log(o)}catch(o){console.error(o)}document.body?.removeChild(e)},Bu=(t,e)=>{let o=document.createElement("a");o.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(e||"")),o.setAttribute("download",t),o.style.display="none",document.body?.appendChild(o),o.click(),document.body?.removeChild(o)},ju=t=>{let o=((r,n)=>{switch(r){case"click":return` await page.mouse.click(${n.x}, ${n.y});`;case"keydown":return` await page.keyboard.keydown('${n}');`;case"keyup":return` await page.keyboard.keyup('${n}');`;case"press":return` await page.keyboard.press('${n}');`;case"selectAll":return" await selectAll(page);";case"snapshot":return` await assertHTMLSnapshot(page);
23
+ `).trim();let m=u[1]?.trim(),p=ro(n,l),f=t.jsx.import({children:a,closeMatch:c,htmlToLexical:null,markdownToLexical:p,openMatch:u,props:m?qt({propsString:m}):{}});if(f===!1)return!1;let h=Ae({blockType:t.slug,...f});h&&i.append(h);return}return!1}})),r)}import{createCommand as vn}from"lexical";var Je=vn("INSERT_BLOCK_COMMAND"),Xe=vn("INSERT_INLINE_BLOCK_COMMAND");import{c as pu}from"react/compiler-runtime";import{useLexicalComposerContext as fu}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as hu,$wrapNodeInElement as gu,mergeRegister as xu}from"@lexical/utils";import{formatDrawerSlug as Cu,useEditDepth as bu}from"@payloadcms/ui";import{$createParagraphNode as ku,$getNodeByKey as _u,$getPreviousSelection as Tu,$getSelection as wu,$insertNodes as Eu,$isParagraphNode as Su,$isRangeSelection as Nu,$isRootOrShadowRoot as Lu,COMMAND_PRIORITY_EDITOR as Mn}from"lexical";import{useEffect as yu,useState as Ru}from"react";var Dn=()=>{let t=pu(12),[e]=fu(),[o,r]=Ru(null),{setCreatedInlineBlock:n,uuid:l}=j(),i=bu(),s="lexical-inlineBlocks-create-"+l,u;t[0]!==i||t[1]!==s?(u=Cu({slug:s,depth:i}),t[0]=i,t[1]=s,t[2]=u):u=t[2];let c=u,{toggleDrawer:d}=fe(c,!0),a;t[3]!==e||t[4]!==n||t[5]!==o?(a=()=>{if(!e.hasNodes([se]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return xu(e.registerCommand(Je,p=>(e.update(()=>{let f=wu()||Tu();if(Nu(f)){let h=Ae(p),{focus:C}=f,g=C.getNode();hu(h),Su(g)&&!g.__first&&g.remove()}}),!0),Mn),e.registerCommand(Xe,p=>{if(o){let h=_u(o);return!h||!ut(h)?!1:(h.setFields(p),r(null),!0)}let f=ct(p);return n?.(f),Eu([f]),Lu(f.getParentOrThrow())&&gu(f,ku).selectEnd(),!0},Mn))},t[3]=e,t[4]=n,t[5]=o,t[6]=a):a=t[6];let m;return t[7]!==e||t[8]!==n||t[9]!==o||t[10]!==d?(m=[e,n,o,d],t[7]=e,t[8]=n,t[9]=o,t[10]=d,t[11]=m):m=t[11],yu(a,m),null};var Iu=M(({config:t,featureClientSchemaMap:e,props:o,schemaPath:r})=>{let n=`${r}.lexical_internal_feature.blocks.lexical_blocks`,l=`${r}.lexical_internal_feature.blocks.lexical_inline_blocks`,i=e.blocks;if(!i)return{};let s=Object.entries(i).filter(([a])=>a.startsWith(n+".")&&!a.replace(n+".","").includes(".")).map(([,a])=>a[0]),u=Object.entries(i).filter(([a])=>a.startsWith(l+".")&&!a.replace(l+".","").includes(".")).map(([,a])=>a[0]),c=s.map(a=>a.blockReferences?typeof a.blockReferences[0]=="string"?t.blocksMap[a.blockReferences[0]]:a.blockReferences[0]:a.blocks[0]).filter(a=>a!==void 0),d=u.map(a=>a.blockReferences?typeof a.blockReferences[0]=="string"?t.blocksMap[a.blockReferences[0]]:a.blockReferences[0]:a.blocks[0]).filter(a=>a!==void 0);return{markdownTransformers:In({blocks:c,inlineBlocks:d}),nodes:[se,at],plugins:[{Component:Dn,position:"normal"}],sanitizedClientFeatureProps:o,slashMenu:{groups:[c?.length?{items:c.map(a=>({Icon:Yt(a.imageURL,a.imageAltText),key:"block-"+a.slug,keywords:["block","blocks",a.slug],label:({i18n:m})=>a?.labels?.singular?no(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(Je,{blockName:"",blockType:a.slug})}})),key:"blocks",label:({i18n:a})=>a.t("lexical:blocks:label")}:null,d?.length?{items:d.map(a=>({Icon:Zt,key:"inlineBlocks-"+a.slug,keywords:["inlineBlock","inline block",a.slug],label:({i18n:m})=>a?.labels?.singular?no(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(Xe,{blockName:"",blockType:a.slug})}})),key:"inlineBlocks",label:({i18n:a})=>a.t("lexical:blocks:inlineBlocks:label")}:null].filter(Boolean)},toolbarFixed:{groups:[c.length?{type:"dropdown",ChildComponent:zt,items:c.map((a,m)=>({ChildComponent:Yt(a.imageURL,a.imageAltText),isActive:void 0,key:"block-"+a.slug,label:({i18n:p})=>a?.labels?.singular?no(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(Je,{blockName:"",blockType:a.slug})},order:m})),key:"blocks",order:20}:null,d?.length?{type:"dropdown",ChildComponent:Zt,items:d.map((a,m)=>({ChildComponent:a.imageURL?Yt(a.imageURL,a.imageAltText):Zt,isActive:void 0,key:"inlineBlock-"+a.slug,label:({i18n:p})=>a?.labels?.singular?no(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(Xe,{blockName:"",blockType:a.slug})},order:m})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}});import{c as Du}from"react/compiler-runtime";import{jsx as Oe,jsxs as Yo}from"react/jsx-runtime";import{useLexicalComposerContext as Au}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as $u,$createTextNode as Ou,$getRoot as Fu,getDOMSelection as Xo}from"lexical";import*as Pn from"react";import{useCallback as $e,useEffect as zo,useLayoutEffect as $n,useRef as Zo,useState as lo}from"react";var vu=le&&"documentMode"in document?document.documentMode:null,An=le&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),s5=le&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),a5=le&&"InputEvent"in window&&!vu?"getTargetRanges"in new window.InputEvent("input"):!1,c5=le&&/Version\/[\d.].*Safari/.test(navigator.userAgent),u5=le&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,d5=le&&/Android/.test(navigator.userAgent),m5=le&&/Win/.test(navigator.platform),Mu=le&&/^(?=.*Chrome).*/i.test(navigator.userAgent),p5=le&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!Mu;var Pu=t=>{let e=document.createElement("textarea");e.value=t||"",e.style.position="absolute",e.style.opacity="0",document.body?.appendChild(e),e.focus(),e.select();try{let o=document.execCommand("copy");console.log(o)}catch(o){console.error(o)}document.body?.removeChild(e)},Bu=(t,e)=>{let o=document.createElement("a");o.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(e||"")),o.setAttribute("download",t),o.style.display="none",document.body?.appendChild(o),o.click(),document.body?.removeChild(o)},ju=t=>{let o=((r,n)=>{switch(r){case"click":return` await page.mouse.click(${n.x}, ${n.y});`;case"keydown":return` await page.keyboard.keydown('${n}');`;case"keyup":return` await page.keyboard.keyup('${n}');`;case"press":return` await page.keyboard.press('${n}');`;case"selectAll":return" await selectAll(page);";case"snapshot":return` await assertHTMLSnapshot(page);
24
24
  await assertSelection(page, {
25
25
  anchorPath: [${n.anchorPath.toString()}],
26
26
  anchorOffset: ${n.anchorOffset},
@@ -51,16 +51,16 @@ ${e.map(ju).join(`
51
51
  `)}
52
52
  });
53
53
  });
54
- `},[t,e]),p=$e((b,k)=>{o(g=>{let w=e.length-1,_=e[w];if(_&&_.name===b){if(b==="type")return[...e.slice(0,w),{..._,value:_.value+k}];if(_.value===k)return[...e.slice(0,w),{..._,count:_.count+1}]}return[...g,{name:b,count:1,value:k}]})},[e,o]);$n(()=>{let b=g=>{if(!r)return;let w=g.key;Hu(g)?p("selectAll",""):Fn.has(w)?p("press",g.key):[...w].length>1?p("keydown",g.key):p("type",g.key)},k=g=>{if(!r)return;let w=g.key;!Fn.has(w)&&[...w].length>1&&p("keyup",g.key)};return t.registerRootListener((g,w)=>{w!==null&&(w.removeEventListener("keydown",b),w.removeEventListener("keyup",k)),g!==null&&(g.addEventListener("keydown",b),g.addEventListener("keyup",k))})},[t,r,p]),$n(()=>{d.current&&d.current.scrollTo(0,d.current.scrollHeight)},[m]),zo(()=>{if(e){let b=m();b!==null&&s(b),d.current&&d.current.scrollTo(0,d.current.scrollHeight)}},[m,e]),zo(()=>t.registerUpdateListener(({dirtyElements:k,dirtyLeaves:g,editorState:w})=>{if(!r)return;let _=w._selection,y=u.current,O=c.current;if(y!==_){if(g.size===0&&k.size===0&&!O){let N=Xo(t._window);if(N&&(N.anchorNode==null||N.focusNode==null))return}u.current=_}c.current=!1;let v=m();v!==null&&s(v)}),[t,m,r,p]),zo(()=>r?t.registerUpdateListener(()=>{let k=t.getRootElement();k!==null&&l(k?.innerHTML)}):void 0,[t,r]);let f=$e(b=>{r||(b.update(()=>{let k=Fu();k.clear();let g=Ou();k.append($u().append(g)),g.select()}),o([])),n(k=>!k)},[r]),h=$e(()=>{if(!r)return;let b=Xo(t._window);if(b===null||b.anchorNode==null||b.focusNode==null)return;let{anchorNode:k,anchorOffset:g,focusNode:w,focusOffset:_}=Uu(b),y=a().getRootElement(),O;k!==null&&(O=On(k,y));let v;w!==null&&(v=On(w,y)),p("snapshot",{anchorNode:k,anchorOffset:g,anchorPath:O,focusNode:w,focusOffset:_,focusPath:v})},[p,r,a]),x=$e(()=>{Pu(m())},[m]),C=$e(()=>{Bu("test.js",m())},[m]);return[Oe("button",{className:`editor-dev-button ${r?"active":""}`,id:"test-recorder-button",onClick:b=>{f(a()),b.preventDefault()},title:r?"Disable test recorder":"Enable test recorder",type:"button",children:r?"Disable test recorder":"Enable test recorder"}),r?Yo("div",{className:"test-recorder-output",children:[Yo("div",{className:"test-recorder-toolbar",children:[Oe("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:b=>{h(),b.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),Oe("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:b=>{x(),b.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),Oe("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:b=>{C(),b.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),Oe("pre",{id:"test-recorder",ref:d,children:i})]}):null]}var Bn=()=>{let t=Du(3),[e]=Au(),[o,r]=Wu(e),n;return t[0]!==o||t[1]!==r?(n=Yo(Pn.Fragment,{children:[Oe("p",{children:"HI"}),o,r,Oe("p",{children:"DONE"})]}),t[0]=o,t[1]=r,t[2]=n):n=t[2],n};var Gu=M({plugins:[{Component:Bn,position:"bottom"}]});import{c as Vu}from"react/compiler-runtime";import{jsx as Ku}from"react/jsx-runtime";import{useLexicalComposerContext as Ju}from"@lexical/react/LexicalComposerContext.js";import{TreeView as Xu}from"@lexical/react/LexicalTreeView.js";import"react";var jn=()=>{let t=Vu(2),[e]=Ju(),o;return t[0]!==e?(o=Ku(Xu,{editor:e,timeTravelButtonClassName:"debug-timetravel-button",timeTravelPanelButtonClassName:"debug-timetravel-panel-button",timeTravelPanelClassName:"debug-timetravel-panel",timeTravelPanelSliderClassName:"debug-timetravel-panel-slider",treeTypeButtonClassName:"debug-treetype-button",viewClassName:"tree-view-output"}),t[0]=e,t[1]=o):o=t[1],o};var zu=M({plugins:[{Component:jn,position:"bottom"}]});import{$isTableSelection as Zu}from"@lexical/table";import{$isRangeSelection as Yu,FORMAT_TEXT_COMMAND as qu}from"lexical";import{jsx as Hn}from"react/jsx-runtime";import"react";var Un=()=>Hn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Hn("path",{d:"M10.6772 15H6.27017V5.718H10.4172C12.6792 5.718 13.8492 6.602 13.8492 8.292C13.8492 9.098 13.1992 9.982 12.4712 10.216C13.3812 10.476 14.1742 11.256 14.1742 12.322C14.1742 14.09 12.9002 15 10.6772 15ZM8.46717 9.501H10.3262C11.3012 9.501 11.7042 9.046 11.7042 8.409C11.7042 7.72 11.2362 7.317 10.3392 7.317H8.46717V9.501ZM8.46717 11.061V13.401H10.4822C11.4702 13.401 11.9642 12.959 11.9642 12.218C11.9642 11.49 11.4702 11.061 10.4822 11.061H8.46717Z",fill:"currentColor"})});var Z=t=>({type:"buttons",items:t,key:"format",order:40});var Wn={type:"text-format",format:["bold","italic"],tag:"***"},Gn={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},Vn={type:"text-format",format:["bold"],tag:"**"},Kn={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var Jn=[Z([{ChildComponent:Un,isActive:({selection:t})=>Yu(t)||Zu(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(qu,"bold")},order:1}])],Qu=M(({featureProviderMap:t})=>{let e=[Vn,Kn];return t.get("italic")&&e.push(Gn,Wn),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:Jn},toolbarInline:{groups:Jn}}});import{$isTableSelection as td}from"@lexical/table";import{$isRangeSelection as od,FORMAT_TEXT_COMMAND as rd}from"lexical";import{jsx as Xn,jsxs as ed}from"react/jsx-runtime";import"react";var zn=()=>ed("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:[Xn("path",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),Xn("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var Zn={type:"text-format",format:["code"],tag:"`"};var Yn=[Z([{ChildComponent:zn,isActive:({selection:t})=>od(t)||td(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(rd,"code")},order:7}])],nd=M({enableFormats:["code"],markdownTransformers:[Zn],toolbarFixed:{groups:Yn},toolbarInline:{groups:Yn}});import{$isTableSelection as ld}from"@lexical/table";import{$isRangeSelection as id,FORMAT_TEXT_COMMAND as sd}from"lexical";import{jsx as qn}from"react/jsx-runtime";import"react";var Qn=()=>qn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:qn("path",{d:"M11.311 14.2969L11.0327 15H6.18408L6.4624 14.2969C7.54639 14.2969 7.70752 14.209 7.83936 13.8721L10.8423 6.45996C10.8716 6.38672 10.8862 6.32812 10.8862 6.26953C10.8862 6.09375 10.6519 6.03516 9.80225 6.03516L10.0952 5.33203H14.9438L14.6509 6.03516C13.5669 6.03516 13.4204 6.12305 13.2886 6.45996L10.2856 13.8721C10.2563 13.9453 10.2271 14.0039 10.2271 14.0625C10.2271 14.2383 10.4614 14.2969 11.311 14.2969Z",fill:"currentColor"})});var el={type:"text-format",format:["italic"],tag:"*"},tl={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var ol=[Z([{ChildComponent:Qn,isActive:({selection:t})=>id(t)||ld(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(sd,"italic")},order:2}])],ad=M({enableFormats:["italic"],markdownTransformers:[el,tl],toolbarFixed:{groups:ol},toolbarInline:{groups:ol}});import{$isTableSelection as ud}from"@lexical/table";import{$isRangeSelection as dd,FORMAT_TEXT_COMMAND as md}from"lexical";import{jsx as rl,jsxs as cd}from"react/jsx-runtime";import"react";var nl=()=>cd("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[rl("path",{d:"M5.50756 12.76H7.42756C7.56256 14.215 8.82256 14.71 10.1576 14.71C11.4326 14.71 12.4226 14.14 12.4226 13.06C12.4226 12.28 11.9576 11.845 10.6676 11.605L8.70256 11.245C7.12756 10.96 5.85256 10.21 5.85256 8.335C5.85256 6.43 7.53256 5.11 9.87256 5.11C12.4226 5.11 13.9526 6.22 14.1626 8.23H12.2876C12.1526 7.18 11.2226 6.595 9.88756 6.595C8.59756 6.595 7.78756 7.27 7.78756 8.215C7.78756 9.1 8.34256 9.385 9.49756 9.61L11.5676 10.015C13.3226 10.345 14.3726 11.215 14.3726 12.94C14.3726 14.89 12.5876 16.18 10.2176 16.18C7.66756 16.18 5.70256 15.115 5.50756 12.76Z",fill:"currentColor"}),rl("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var ll={type:"text-format",format:["strikethrough"],tag:"~~"};var il=[Z([{ChildComponent:nl,isActive:({selection:t})=>dd(t)||ud(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(md,"strikethrough")},order:4}])],pd=M({enableFormats:["strikethrough"],markdownTransformers:[ll],toolbarFixed:{groups:il},toolbarInline:{groups:il}});import{$isTableSelection as fd}from"@lexical/table";import{$isRangeSelection as hd,FORMAT_TEXT_COMMAND as gd}from"lexical";import{jsx as sl}from"react/jsx-runtime";import"react";var al=()=>sl("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:sl("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 13.258C16.7768 14.155 16.1398 14.532 15.2038 15C14.5538 15.325 14.2808 15.546 14.2418 15.78H16.7898V16.82H12.7208V16.339C12.7208 15.286 13.5918 14.675 14.3588 14.233C15.0868 13.83 15.4378 13.635 15.4378 13.232C15.4378 12.894 15.2038 12.686 14.8268 12.686C14.3848 12.686 14.1248 13.024 14.1118 13.427H12.7468C12.8248 12.426 13.5528 11.633 14.8398 11.633C15.9448 11.633 16.7768 12.257 16.7768 13.258Z",fill:"currentColor"})});var cl=[Z([{ChildComponent:al,isActive:({selection:t})=>hd(t)||fd(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(gd,"subscript")},order:5}])],xd=M({enableFormats:["subscript"],toolbarFixed:{groups:cl},toolbarInline:{groups:cl}});import{$isTableSelection as Cd}from"@lexical/table";import{$isRangeSelection as bd,FORMAT_TEXT_COMMAND as kd}from"lexical";import{jsx as ul}from"react/jsx-runtime";import"react";var dl=()=>ul("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:ul("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 7.252C16.7768 8.149 16.1398 8.526 15.2038 8.994C14.5538 9.319 14.2808 9.54 14.2418 9.774H16.7898V10.814H12.7208V10.333C12.7208 9.28 13.5918 8.669 14.3588 8.227C15.0868 7.824 15.4378 7.629 15.4378 7.226C15.4378 6.888 15.2038 6.68 14.8268 6.68C14.3848 6.68 14.1248 7.018 14.1118 7.421H12.7468C12.8248 6.42 13.5528 5.627 14.8398 5.627C15.9448 5.627 16.7768 6.251 16.7768 7.252Z",fill:"currentColor"})});var ml=[Z([{ChildComponent:dl,isActive:({selection:t})=>bd(t)||Cd(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(kd,"superscript")},order:6}])],_d=M({enableFormats:["superscript"],toolbarFixed:{groups:ml},toolbarInline:{groups:ml}});import{$isTableSelection as wd}from"@lexical/table";import{$isRangeSelection as Ed,FORMAT_TEXT_COMMAND as Sd}from"lexical";import{jsx as pl,jsxs as Td}from"react/jsx-runtime";import"react";var fl=()=>Td("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[pl("path",{d:"M13.9656 11.256C13.9656 13.791 12.5096 15.156 10.0006 15.156C7.50461 15.156 6.03561 13.791 6.03561 11.23V5.718H7.76461V11.243C7.76461 12.868 8.50561 13.778 10.0006 13.778C11.4956 13.778 12.2496 12.868 12.2496 11.243V5.718H13.9656V11.256Z",fill:"currentColor"}),pl("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var hl=[Z([{ChildComponent:fl,isActive:({selection:t})=>Ed(t)||wd(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(Sd,"underline")},order:3}])],Nd=M({enableFormats:["underline"],toolbarFixed:{groups:hl},toolbarInline:{groups:hl}});import{jsx as er}from"react/jsx-runtime";import{jsx as Ld}from"react/jsx-runtime";function yd(t){return t.replace(/-([a-z])/g,(e,o)=>o.toUpperCase())}var io=({css:t})=>{let e=t?Object.fromEntries(Object.entries(t).map(([o,r])=>[yd(o),r])):{};return Ld("span",{style:{...e,alignItems:"center",borderRadius:"4px",display:"flex",fontSize:"16px",height:"20px",justifyContent:"center",width:"20px"},children:"A"})};import{useLexicalComposerContext as Rd}from"@lexical/react/LexicalComposerContext";import{$forEachSelectedTextNode as Id}from"@lexical/selection";import{$getNodeByKey as vd,$getState as Md,$setState as Dd,createState as Ad,TextNode as $d}from"lexical";import{useEffect as Od}from"react";var qo=new Map;function gl(t){for(let e in t){let o=t[e],r=Ad(e,{parse:n=>typeof n=="string"&&Object.keys(o).includes(n)?n:void 0});qo.set(e,{stateConfig:r,stateValues:o})}}function Qo(t,e,o){t.update(()=>{Id(r=>{let n=qo.get(e);if(!n)throw new Error(`State config for ${e} not found`);Dd(r,n.stateConfig,o)})})}function xl(){let[t]=Rd();return Od(()=>t.registerMutationListener($d,e=>{t.getEditorState().read(()=>{for(let[o,r]of e){if(r==="destroyed")continue;let n=vd(o),l=t.getElementByKey(o);if(!n||!l)continue;let i=Object.create(null);qo.forEach((s,u)=>{let c=Md(n,s.stateConfig);if(!c){delete l.dataset[u];return}l.dataset[u]=c;let d=s.stateValues[c]?.css;d&&Object.assign(i,d)}),l.style.cssText="",Object.assign(l.style,i)}})}),[t]),null}var Cl=t=>{let e=[];for(let r in t.state){let n=t.state[r];for(let l in n){let i=n[l];e.push({ChildComponent:()=>er(io,{css:i.css}),key:l,label:i.label,onSelect:({editor:s})=>{Qo(s,r,l)}})}}return[{type:"dropdown",ChildComponent:()=>er(io,{css:{color:"var(--theme-elevation-600)"}}),items:[...[{ChildComponent:()=>er(io,{}),key:"clear-style",label:({i18n:r})=>r.t("lexical:textState:defaultStyle"),onSelect:({editor:r})=>{for(let n in t.state)Qo(r,n,void 0)},order:1}],...e],key:"textState",order:30}]},Fd=M(({props:t})=>(gl(t.state),{plugins:[{Component:xl,position:"normal"}],toolbarFixed:{groups:Cl(t)},toolbarInline:{groups:Cl(t)}}));import{c as Hd}from"react/compiler-runtime";import{useLexicalComposerContext as Ud}from"@lexical/react/LexicalComposerContext";import{$createHeadingNode as Wd,$isHeadingNode as Ml,HeadingNode as $l}from"@lexical/rich-text";import{$setBlocksType as Gd}from"@lexical/selection";import{$getSelection as Vd,$isRangeSelection as Kd}from"lexical";import{useEffect as Jd}from"react";import{jsx as bl}from"react/jsx-runtime";import"react";var kl=()=>bl("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:bl("path",{d:"M4.639 13.5V7.074H6.196V9.648H9.076V7.074H10.642V13.5H9.076V10.836H6.196V13.5H4.639ZM11.5656 9.045V8.019C12.6636 8.019 13.1316 7.731 13.2846 7.065H14.4006V13.5H12.8436V9.045H11.5656Z",fill:"currentColor"})});import{jsx as _l}from"react/jsx-runtime";import"react";var Tl=()=>_l("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:_l("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM15.9796 8.973C15.9796 10.116 15.1696 10.656 14.0356 11.232C13.2256 11.646 12.8206 11.943 12.7846 12.294H15.9886V13.5H11.0566V12.951C11.0566 11.601 12.1636 10.845 13.1176 10.287C14.0356 9.756 14.5126 9.486 14.5126 8.946C14.5126 8.46 14.2156 8.145 13.6306 8.145C13.0186 8.145 12.6586 8.613 12.6226 9.198H11.1196C11.2186 7.947 12.1006 6.966 13.6396 6.966C15.0346 6.966 15.9796 7.785 15.9796 8.973Z",fill:"currentColor"})});import{jsx as wl}from"react/jsx-runtime";import"react";var El=()=>wl("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:wl("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM16.1146 11.745C16.1146 12.744 15.2236 13.608 13.6126 13.608C12.0736 13.608 11.0926 12.762 10.9846 11.547H12.4696C12.5146 12.114 13.0006 12.456 13.6126 12.456C14.2876 12.456 14.6746 12.132 14.6746 11.619C14.6746 11.061 14.2426 10.836 13.6216 10.836H12.9826V9.738H13.6036C14.1526 9.738 14.5486 9.486 14.5486 8.937C14.5486 8.46 14.2156 8.127 13.6486 8.127C13.0366 8.127 12.6586 8.514 12.6226 9.045H11.1916C11.2726 7.929 12.1276 6.966 13.6666 6.966C15.1876 6.966 15.9706 7.848 15.9706 8.865C15.9706 9.603 15.5026 10.143 14.8186 10.269C15.6196 10.404 16.1146 10.971 16.1146 11.745Z",fill:"currentColor"})});import{jsx as Sl}from"react/jsx-runtime";import"react";var Nl=()=>Sl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Sl("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM15.1736 7.074V10.854H16.3706V12.033H15.1736V13.5H13.6796V12.033H10.5116V10.845L13.4996 7.074H15.1736ZM13.6796 8.46L11.8256 10.854H13.6796V8.46Z",fill:"currentColor"})});import{jsx as Ll}from"react/jsx-runtime";import"react";var yl=()=>Ll("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:Ll("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.1576 10.269C12.6896 10.269 12.3746 10.494 12.2216 10.737H10.8176L11.1956 7.074H15.2546V8.28H12.3206L12.1856 9.549C12.4016 9.351 12.8516 9.126 13.4636 9.126C14.7866 9.126 15.6596 10.053 15.6596 11.358C15.6596 12.609 14.7326 13.608 13.1756 13.608C11.5826 13.608 10.6556 12.753 10.5566 11.511H12.1136C12.1586 12.06 12.5456 12.465 13.1576 12.465C13.8236 12.465 14.1746 11.97 14.1746 11.376C14.1746 10.764 13.8416 10.269 13.1576 10.269Z",fill:"currentColor"})});import{jsx as Rl}from"react/jsx-runtime";import"react";var Il=()=>Rl("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:Rl("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.3646 8.127C12.5456 8.127 12.0416 8.937 12.0416 9.999C12.3296 9.54 12.8246 9.207 13.5536 9.207C14.8586 9.207 15.8036 10.134 15.8036 11.376C15.8036 12.645 14.8226 13.608 13.3196 13.608C11.7266 13.608 10.6196 12.393 10.6196 10.395C10.6196 8.316 11.7716 6.966 13.4186 6.966C14.7056 6.966 15.5786 7.749 15.7316 8.829H14.3186C14.2016 8.415 13.9226 8.127 13.3646 8.127ZM13.3106 12.51C13.9586 12.51 14.3816 12.042 14.3816 11.385C14.3816 10.737 13.9586 10.278 13.3106 10.278C12.6536 10.278 12.2126 10.737 12.2126 11.385C12.2126 12.042 12.6536 12.51 13.3106 12.51Z",fill:"currentColor"})});import{$createHeadingNode as Pd,$isHeadingNode as Bd,HeadingNode as jd}from"@lexical/rich-text";var tr=t=>(e,o,r)=>{let n=t(r);n&&(n.append(...o),e.replace(n),n.select(0,0))};var vl=t=>{let o=`^(${t.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`,r=new RegExp(o);return{type:"element",dependencies:[jd],export:(n,l)=>{if(!Bd(n))return null;let i=Number(n.getTag().slice(1));return"#".repeat(i)+" "+l(n)},regExp:r,replace:tr(n=>{let l="h"+n[1]?.length;return Pd(l)})}};var Dl=t=>{let e=Vd();Gd(e,()=>Wd(t))},Al={h1:kl,h2:Tl,h3:El,h4:Nl,h5:yl,h6:Il},Xd=M(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[ee(e.map((r,n)=>({ChildComponent:Al[r],isActive:({selection:l})=>{if(!Kd(l))return!1;for(let i of l.getNodes()){if(Ml(i)&&i.getTag()===r)continue;let s=i.getParent();if(!(Ml(s)&&s.getTag()===r))return!1}return!0},key:r,label:({i18n:l})=>l.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:l})=>{l.update(()=>{Dl(r)})},order:n+2})))];return{markdownTransformers:[vl(e)],nodes:[$l],plugins:[{Component:zd,position:"normal"}],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[z(e.map(r=>({Icon:Al[r],key:`heading-${r.charAt(1)}`,keywords:["heading",r],label:({i18n:n})=>n.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:n})=>{n.update(()=>{Dl(r)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}}),zd=t=>{let e=Hd(9),{clientProps:o}=t,{enabledHeadingSizes:r}=o,n;e[0]!==r?(n=r===void 0?["h1","h2","h3","h4","h5","h6"]:r,e[0]=r,e[1]=n):n=e[1];let l=n,i;e[2]!==l?(i=l.at(-1),e[2]=l,e[3]=i):i=e[3];let s=i,[u]=Ud(),c,d;return e[4]!==u||e[5]!==l||e[6]!==s?(c=()=>{if(!(!s||l.length===6))return u.registerNodeTransform($l,a=>{l.includes(a.getTag())||a.setTag(s)})},d=[u,l,s],e[4]=u,e[5]=l,e[6]=s,e[7]=c,e[8]=d):(c=e[7],d=e[8]),Jd(c,d),null};import{$isNodeSelection as dm}from"lexical";import{jsx as Ol}from"react/jsx-runtime";import"react";var or=()=>Ol("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:Ol("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as Fl,jsxs as Zd}from"react/jsx-runtime";import"react";var Pl=()=>Zd("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Fl("path",{d:"M5 10h10",stroke:"currentColor"}),Fl("path",{d:"M10 15V5",stroke:"currentColor"})]});var xe=t=>({type:"dropdown",ChildComponent:Pl,items:t,key:"add",order:10});import{addClassNamesToElement as Yd}from"@lexical/utils";import{$applyNodeReplacement as qd,createCommand as Qd,DecoratorNode as em}from"lexical";var kt=Qd("INSERT_HORIZONTAL_RULE_COMMAND"),bt=class extends em{static clone(e){return new this(e.__key)}static getType(){return"horizontalrule"}static importDOM(){return{hr:()=>({conversion:tm,priority:0})}}static importJSON(e){return Bl()}createDOM(e){let o=document.createElement("hr");return Yd(o,e.theme.hr),o}decorate(){return null}exportDOM(){return{element:document.createElement("hr")}}exportJSON(){return{type:"horizontalrule",version:1}}getTextContent(){return`
55
- `}isInline(){return!1}updateDOM(){return!1}};function tm(){return{node:Bl()}}function Bl(){return qd(new bt)}import{$applyNodeReplacement as om}from"lexical";import"react";var ye=class extends bt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return _t()}decorate(){return null}exportJSON(){return super.exportJSON()}};function _t(){return om(new ye)}function so(t){return t instanceof ye}var jl={type:"element",dependencies:[ye],export:(t,e)=>so(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=_t();e&&t.replace(e)}};import{c as rm}from"react/compiler-runtime";import{useLexicalComposerContext as nm}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as lm}from"@lexical/utils";import{$getSelection as im,$isRangeSelection as sm,COMMAND_PRIORITY_EDITOR as am}from"lexical";import{useEffect as cm}from"react";var Hl=()=>{let t=rm(3),[e]=nm(),o,r;return t[0]!==e?(o=()=>e.registerCommand(kt,um,am),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),cm(o,r),null};function um(t){let e=im();if(!sm(e))return!1;if(e.focus.getNode()!==null){let r=_t();lm(r)}return!0}var mm=M({markdownTransformers:[jl],nodes:[ye],plugins:[{Component:Hl,position:"normal"}],slashMenu:{groups:[z([{Icon:or,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(kt,void 0)}}])]},toolbarFixed:{groups:[xe([{ChildComponent:or,isActive:({selection:t})=>{if(!dm(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return so(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(kt,void 0)}}])]}});import{$findMatchingParent as Yl}from"@lexical/utils";import{$isElementNode as Sm,INDENT_CONTENT_COMMAND as Nm,OUTDENT_CONTENT_COMMAND as Lm}from"lexical";import{jsx as ao,jsxs as pm}from"react/jsx-runtime";import"react";var Ul=()=>pm("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:[ao("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),ao("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),ao("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),ao("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as co,jsxs as fm}from"react/jsx-runtime";import"react";var Wl=()=>fm("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[co("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),co("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),co("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),co("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});import{jsx as hm}from"react/jsx-runtime";import{useLexicalComposerContext as gm}from"@lexical/react/LexicalComposerContext";import{TabIndentationPlugin as xm}from"@lexical/react/LexicalTabIndentationPlugin";import{$findMatchingParent as Cm,mergeRegister as Gl}from"@lexical/utils";import{$getSelection as bm,$isElementNode as Xl,$isRangeSelection as km,COMMAND_PRIORITY_LOW as Vl,INDENT_CONTENT_COMMAND as Kl,KEY_TAB_COMMAND as _m,OUTDENT_CONTENT_COMMAND as Tm,TabNode as wm}from"lexical";import{useEffect as Jl}from"react";var zl=({clientProps:t})=>{let[e]=gm(),{disabledNodes:o,disableTabNode:r}=t;return Jl(()=>{if(!(!e||!o?.length))return Gl(e.registerCommand(Kl,()=>Em(n=>{if(!o.includes(n.getType())){let l=n.getIndent();n.setIndent(l+1)}}),Vl),e.registerUpdateListener(({dirtyElements:n,editorState:l})=>{e.update(()=>{for(let[i]of n){let s=l._nodeMap.get(i);Xl(s)&&o.includes(s.getType())&&s.getIndent()>0&&s.setIndent(0)}})}))},[e,o]),Jl(()=>{if(!(!e||!r))return Gl(e.registerCommand(_m,n=>(n.preventDefault(),e.dispatchCommand(n.shiftKey?Tm:Kl,void 0)),Vl),e.registerNodeTransform(wm,n=>{n.remove()}))},[e,r]),hm(xm,{})};function Em(t){let e=bm();if(!km(e))return!1;let o=new Set,r=e.getNodes();for(let n=0;n<r.length;n++){let l=r[n],i=l.getKey();if(o.has(i))continue;let s=Cm(l,c=>Xl(c)&&!c.isInline());if(s===null)continue;let u=s.getKey();s.canIndent()&&!o.has(u)&&(o.add(u),t(s))}return o.size>0}var Zl=t=>({type:"buttons",items:t,key:"indent",order:35});var ql=({disabledNodes:t})=>[Zl([{ChildComponent:Ul,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>Ql(n)&&n.getIndent()>0;return o.some(n=>r(n)||!!Yl(n,r))},key:"indentDecrease",label:({i18n:e})=>e.t("lexical:indent:decreaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Lm,void 0)},order:1},{ChildComponent:Wl,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>Ql(n)&&!(t??[]).includes(n.getType());return o.some(n=>r(n)||!!Yl(n,r))},key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Nm,void 0)},order:2}])],ym=M(({props:t})=>{let e=t.disabledNodes??[];return{plugins:[{Component:zl,position:"normal"}],sanitizedClientFeatureProps:t,toolbarFixed:{groups:ql({disabledNodes:e})},toolbarInline:{groups:ql({disabledNodes:e})}}}),Ql=t=>Sm(t)&&t.canIndent();import{$findMatchingParent as jp}from"@lexical/utils";import{$getSelection as dr,$isRangeSelection as Ii}from"lexical";import{jsx as ei}from"react/jsx-runtime";import"react";var ti=()=>ei("svg",{"aria-hidden":"true",className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:ei("path",{d:"M8.5 11.5L11.5 8.5M8.5 7L9.625 5.875C10.868 4.633 12.882 4.633 14.125 5.875C15.368 7.118 15.368 9.133 14.125 10.375L13 11.5M7 8.5L5.746 9.754C4.56 10.94 4.519 12.85 5.652 14.087C6.814 15.354 8.78 15.449 10.058 14.298L11.5 13",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})});import{$isAtNodeEnd as oi}from"@lexical/selection";function ze(t){let{anchor:e}=t,{focus:o}=t,r=t.anchor.getNode(),n=t.focus.getNode();return r===n?r:t.isBackward()?oi(o)?r:n:oi(e)?r:n}var rr=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as Bm}from"lexical";import{addClassNamesToElement as Rm,isHTMLAnchorElement as Im}from"@lexical/utils";import ir from"bson-objectid";import{$applyNodeReplacement as vm,$createTextNode as ri,$getSelection as Mm,$isElementNode as ni,$isRangeSelection as lr,createCommand as Dm,ElementNode as Am}from"lexical";var $m=new Set(["http:","https:","mailto:","sms:","tel:"]),oe=class t extends Am{__fields;__id;constructor({id:e,fields:o={linkType:"custom",newTab:!1},key:r}){super(r),this.__fields=o,this.__id=e}static clone(e){return new t({id:e.__id,fields:e.__fields,key:e.__key})}static getType(){return"link"}static importDOM(){return{a:e=>({conversion:Om,priority:1})}}static importJSON(e){let o=Ce({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),e.version===2&&!e.id&&(e.id=new ir.default().toHexString(),e.version=3),o}canBeEmpty(){return!1}canInsertTextAfter(){return!1}canInsertTextBefore(){return!1}createDOM(e){let o=document.createElement("a");return this.__fields?.linkType==="custom"&&(o.href=this.sanitizeUrl(this.__fields.url??"")),(this.__fields?.newTab??!1)&&(o.target="_blank"),this.__fields?.newTab===!0&&this.__fields?.linkType==="custom"&&(o.rel=nr(o.rel,"add","noopener")),Rm(o,e.theme.link),o}exportJSON(){let e=this.getFields();e?.linkType==="internal"?delete e.url:e?.linkType==="custom"&&delete e.doc;let o={...super.exportJSON(),type:"link",fields:e,version:3},r=this.getID();return r&&(o.id=r),o}extractWithChild(e,o,r){if(!lr(o))return!1;let n=o.anchor.getNode(),l=o.focus.getNode();return this.isParentOf(n)&&this.isParentOf(l)&&o.getTextContent().length>0}getFields(){return this.getLatest().__fields}getID(){return this.getLatest().__id}insertNewAfter(e,o=!0){let r=this.getParentOrThrow().insertNewAfter(e,o);if(ni(r)){let n=Ce({fields:this.__fields});return r.append(n),n}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!$m.has(o.protocol))return"about:blank"}catch{return"https://"}return e}setFields(e){let o=this.getWritable();return o.__fields=e,o}setID(e){let o=this.getWritable();return o.__id=e,o}updateDOM(e,o,r){let n=this.__fields?.url,l=this.__fields?.newTab;return n!=null&&n!==e.__fields?.url&&this.__fields?.linkType==="custom"&&(o.href=n),this.__fields?.linkType==="internal"&&e.__fields?.linkType==="custom"&&o.removeAttribute("href"),o.rel==null&&(o.rel=""),l!==e.__fields?.newTab&&(l??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=nr(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=nr(o.rel,"remove","noopener"))),!1}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields).setID(e.id)}};function Om(t){let e=null;if(Im(t)){let o=t.textContent;o!==null&&o!==""&&(e=Ce({id:new ir.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function Ce({id:t,fields:e}){return vm(new oe({id:t??new ir.default().toHexString(),fields:e}))}function K(t){return t instanceof oe}var de=Dm("TOGGLE_LINK_COMMAND");function sr(t){let e=Mm();if(!lr(e)&&(t===null||!t.selectedNodes?.length))return;let o=lr(e)?e.extract():t===null?[]:t.selectedNodes;if(t===null){o?.forEach(l=>{let i=l.getParent();K(i)&&(i.getChildren().forEach(u=>{i.insertBefore(u)}),i.remove())});return}if(o?.length===1){let l=o[0],i=K(l)?l:Fm(l);if(i!==null){i.setFields(t.fields),t.text!=null&&t.text!==i.getTextContent()&&(i.append(ri(t.text)),i.getChildren().forEach(s=>{s!==i.getLastChild()&&s.remove()}));return}}let r=null,n=null;o?.forEach(l=>{let i=l.getParent();if(!(i===n||i===null||ni(l)&&!l.isInline())){if(K(i)){n=i,i.setFields(t.fields),t.text!=null&&t.text!==i.getTextContent()&&(i.append(ri(t.text)),i.getChildren().forEach(s=>{s!==i.getLastChild()&&s.remove()}));return}if(i.is(r)||(r=i,n=Ce({fields:t.fields}),K(i)?l.getPreviousSibling()===null?i.insertBefore(n):i.insertAfter(n):l.insertBefore(n)),K(l)){if(l.is(n))return;if(n!==null){let s=l.getChildren();n.append(...s)}l.remove();return}n!==null&&n.append(l)}})}function Fm(t){return Pm(t,e=>K(e))}function Pm(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function nr(t,e,o){let r,n=`${t}`;if(e==="add"){if(n.includes(o)){let l=new RegExp(o,"g");n=n.replace(l,"").trim()}n=n.trim(),r=n.length===0?`${o}`:`${n} ${o}`}else{let l=new RegExp(o,"g");r=n.replace(l,"").trim()}return r}var li={type:"text-match",dependencies:[oe],export:(t,e)=>{if(!K(t))return null;let o=t,{url:r}=o.getFields();return`[${e(o)}](${r})`},importRegExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:(t,e)=>{let[,o,r]=e,n=Ce({fields:{doc:null,linkType:"custom",newTab:!1,url:r}}),l=Bm(o);return l.setFormat(t.getFormat()),n.append(l),t.replace(n),l},trigger:")"};import{$applyNodeReplacement as jm,$isElementNode as Hm}from"lexical";var be=class t extends oe{static clone(e){return new t({id:"",fields:e.__fields,key:e.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(e){let o=Tt({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),o}exportJSON(){let e=super.exportJSON();return{type:"autolink",children:e.children,direction:e.direction,fields:e.fields,format:e.format,indent:e.indent,version:2}}insertNewAfter(e,o=!0){let r=this.getParentOrThrow().insertNewAfter(e,o);if(Hm(r)){let n=Tt({fields:this.__fields});return r.append(n),n}return null}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields)}};function Tt({fields:t}){return jm(new be({id:"",fields:t}))}function ke(t){return t instanceof be}import{c as Um}from"react/compiler-runtime";import{useLexicalComposerContext as Wm}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Gm}from"@lexical/utils";import{$createTextNode as ii,$getSelection as Vm,$isElementNode as ai,$isLineBreakNode as ci,$isNodeSelection as Km,$isRangeSelection as Jm,$isTextNode as wt,TextNode as Xm}from"lexical";import{useEffect as zm}from"react";function si(t,e=o=>o){return o=>{let r=t.exec(o);return r===null?null:{index:r.index,length:r[0].length,text:r[0],url:e(r[0])}}}function ui(t,e){for(let o of e){let r=o(t);if(r!=null)return r}return null}var Zm=/[.,;\s]/;function mo(t){return t!==void 0&&Zm.test(t)}function di(t){return mo(t[t.length-1])}function cr(t){return mo(t[0])}function Ym(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function mi(t){let e=t.getPreviousSibling();return ai(e)&&(e=e.getLastDescendant()),e===null||ci(e)||wt(e)&&di(e.getTextContent())}function pi(t){let e=t.getNextSibling();return ai(e)&&(e=e.getFirstDescendant()),e===null||ci(e)||wt(e)&&cr(e.getTextContent())}function qm(t,e,o,r){return(t>0?mo(o[t-1]):mi(r[0]))?e<o.length?mo(o[e]):pi(r[r.length-1]):!1}function Qm(t,e,o){let r=[],n=[],l=[],i=0,s=0,u=[...t];for(;u.length>0;){let c=u[0],a=c.getTextContent().length,m=s;s+a<=e?(r.push(c),i+=a):m>=o?l.push(c):n.push(c),s+=a,u.shift()}return[i,r,n,l]}function ep(t,e,o,r){let n={linkType:"custom",url:r.url,...r.fields},l=Tt({fields:n});if(t.length===1){let i=t[0],s;if(e===0?[s]=i.splitText(o):[,s]=i.splitText(e,o),s){let u=ii(r.text);u.setFormat(s.getFormat()),u.setDetail(s.getDetail()),u.setStyle(s.getStyle()),l.append(u),s.replace(l)}return i}else if(t.length>1){let i=t[0],s=i.getTextContent().length,u;e===0?u=i:[,u]=i.splitText(e);let c=[],d;if(t.forEach(a=>{let p=a.getTextContent().length,f=s,h=s+p;if(f<o)if(h<=o)c.push(a);else{let[x,C]=a.splitText(o-f);x&&c.push(x),d=C}s+=p}),u){let a=Vm(),m=a?a.getNodes().find(wt):void 0,p=ii(u.getTextContent());return p.setFormat(u.getFormat()),p.setDetail(u.getDetail()),p.setStyle(u.getStyle()),l.append(p,...c),m&&m===u&&(Jm(a)?p.select(a.anchor.offset,a.focus.offset):Km(a)&&p.select(0,p.getTextContent().length)),u.replace(l),d}}}function tp(t,e,o){let r=[...t],n=r.map(u=>u.getTextContent()).join(""),l=n,i,s=0;for(;(i=ui(l,e))!=null&&i!==null;){let u=i.index,c=i.length,d=u+c;if(qm(s+u,s+d,n,r)){let[m,,p,f]=Qm(r,s+u,s+d),h=s+u-m,x=s+d-m,C=ep(p,h,x,i);r=C?[C,...f]:f,o(i.url,null),s=0}else s+=d;l=l.substring(d)}}function ar(t,e,o){let r=t.getChildren(),n=r.length;for(let u=0;u<n;u++){let c=r[u];if(!wt(c)||!c.isSimpleText()){uo(t),o(null,t.getFields()?.url??null);return}}let l=t.getTextContent(),i=ui(l,e);if(i===null||i.text!==l){uo(t),o(null,t.getFields()?.url??null);return}if(!mi(t)||!pi(t)){uo(t),o(null,t.getFields()?.url??null);return}let s=t.getFields()?.url;if(s!==i?.url){let u=t.getFields();u.url=i?.url,t.setFields(u),o(i.url,s??null)}}function op(t,e,o){let r=t.getPreviousSibling(),n=t.getNextSibling(),l=t.getTextContent();if(ke(r)){let i=r.getFields()?.url?r.getFields()?.url?.startsWith("mailto:")??!1:!1;(!cr(l)||Ym(l,i))&&(r.append(t),ar(r,e,o),o(null,r.getFields()?.url??null))}ke(n)&&!di(l)&&(uo(n),ar(n,e,o),o(null,n.getFields()?.url??null))}function uo(t){let e=t.getChildren(),o=e.length;for(let r=o-1;r>=0;r--)t.insertAfter(e[r]);return t.remove(),e.map(r=>r.getLatest())}function rp(t){let e=[t],o=t.getNextSibling();for(;o!==null&&wt(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function np(t,e,o){let r=Um(5),n,l;r[0]!==t||r[1]!==e||r[2]!==o?(n=()=>{if(!t.hasNodes([be]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let i=(s,u)=>{o?.(s,u)};return Gm(t.registerNodeTransform(Xm,s=>{let u=s.getParentOrThrow(),c=s.getPreviousSibling();if(ke(u))ar(u,e,i);else if(!K(u)){if(s.isSimpleText()&&(cr(s.getTextContent())||!ke(c))){let d=rp(s);tp(d,e,i)}op(s,e,i)}}))},l=[t,e,o],r[0]=t,r[1]=e,r[2]=o,r[3]=n,r[4]=l):(n=r[3],l=r[4]),zm(n,l)}var lp=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,ip=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,sp=[si(lp,t=>t.startsWith("http")?t:`https://${t}`),si(ip,t=>`mailto:${t}`)],fi=()=>{let[t]=Wm();return np(t,sp),null};import{jsx as ap}from"react/jsx-runtime";import{ClickableLinkPlugin as cp}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var hi=()=>ap(cp,{});import{jsx as Lp}from"react/jsx-runtime";import"react";import{createPortal as yp}from"react-dom";import{jsx as _e,jsxs as Et,Fragment as dp}from"react/jsx-runtime";import{useLexicalComposerContext as mp}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as gi,mergeRegister as xi}from"@lexical/utils";import{getTranslation as ur}from"@payloadcms/translations";import{CloseMenuIcon as pp,EditIcon as fp,ExternalLinkIcon as Ci,formatDrawerSlug as hp,useConfig as gp,useEditDepth as xp,useLocale as Cp,useTranslation as bp}from"@payloadcms/ui";import{requests as kp}from"@payloadcms/ui/shared";import{$getSelection as bi,$isLineBreakNode as _p,$isRangeSelection as ki,COMMAND_PRIORITY_HIGH as Tp,COMMAND_PRIORITY_LOW as _i,getDOMSelection as wp,KEY_ESCAPE_COMMAND as Ep,SELECTION_CHANGE_COMMAND as Sp}from"lexical";import Ti,{useCallback as wi,useEffect as ho,useRef as Np,useState as Fe}from"react";function po(t,e,o,r=10,n=5){let l=o.parentElement;if(t===null||l==null){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let i=e.getBoundingClientRect(),s=o.getBoundingClientRect(),u=l.getBoundingClientRect(),c=t.top-r,d=t.left-n;c<u.top&&(c+=i.height+t.height+r*2),d+i.width>u.right&&(d=u.right-i.width-n),c-=s.top,d-=s.left,e.style.opacity="1",e.style.transform=`translate(${d}px, ${c}px)`}import{createCommand as up}from"lexical";var fo=up("TOGGLE_LINK_WITH_MODAL_COMMAND");function Ei(t){t.preventDefault()}function Si({anchorElem:t}){let[e]=mp(),[o,r]=Fe(),n=Np(null),[l,i]=Fe(null),[s,u]=Fe(null),{fieldProps:{schemaPath:c},uuid:d}=j(),{config:a,getEntityConfig:m}=gp(),{i18n:p,t:f}=bp(),[h,x]=Fe(),C=xp(),[T,S]=Fe(!1),[b,k]=Fe([]),g=Cp(),[w,_]=Fe(!1),y=hp({slug:"lexical-rich-text-link-"+d,depth:C}),{toggleDrawer:O}=fe(y),v=wi(()=>{S(!1),n&&n.current&&(n.current.style.opacity="0",n.current.style.transform="translate(-10000px, -10000px)"),_(!1),i(null),u(null),k([]),x(void 0)},[S,i,u,k]),N=wi(()=>{let E=bi(),L;if(!ki(E)||!E){v();return}let D=ze(E);L=e.getElementByKey(D.getKey())?.getBoundingClientRect();let I=gi(D,K),A=E.getNodes().filter(J=>!_p(J)).find(J=>{let U=gi(J,K);return I&&!I.is(U)||U&&!U.is(I)});if(I==null||A){v();return}r(I);let R=I.getFields(),F={...R,id:I.getID(),text:I.getTextContent()};if(R?.linkType==="custom")i(R?.url??null),u(null);else{i(`${a.routes.admin==="/"?"":a.routes.admin}/collections/${R?.doc?.relationTo}/${R?.doc?.value}`);let J=R?.doc?.relationTo?m({collectionSlug:R?.doc?.relationTo}):void 0;if(!J)u(R?.label?String(R?.label):null),i(R?.url?String(R?.url):null);else{let U=typeof R.doc?.value=="object"?R.doc.value.id:R.doc?.value,We=R.doc?.relationTo;if(!U||!We)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let Se=f("fields:linkedTo",{label:`${ur(J.labels.singular,p)} - ${f("lexical:link:loadingWithEllipsis",p)}`}).replace(/<[^>]*>?/g,"");u(Se),kp.get(`${a.serverURL}${a.routes.api}/${We}/${U}`,{headers:{"Accept-Language":p.language},params:{depth:0,locale:g?.code}}).then(async pe=>{if(!pe.ok)throw new Error(`HTTP error! Status: ${pe.status}`);let Bt=await pe.json(),Ne=J?.admin?.useAsTitle||"id",jt=Bt[Ne],Ge=f("fields:linkedTo",{label:`${ur(J.labels.singular,p)} - ${jt}`}).replace(/<[^>]*>?/g,"");u(Ge)}).catch(()=>{let pe=f("fields:linkedTo",{label:`${ur(J.labels.singular,p)} - ${f("general:untitled",p)} - ID: ${U}`}).replace(/<[^>]*>?/g,"");u(pe)})}}x(F),S(!0),k(E?E?.getNodes():[]),ke(I)?_(!0):_(!1);let W=n.current,Q=wp(e._window),{activeElement:re}=document;if(W===null)return;let Pt=e.getRootElement();return Q!==null&&Pt!==null&&Pt.contains(Q.anchorNode)?(L||(L=Q.getRangeAt(0).getBoundingClientRect()),L!=null&&(L.y+=40,po(L,W,t))):(re==null||re.className!=="link-input")&&(Pt!==null&&po(null,W,t),i(null),u(null)),!0},[e,v,a.routes.admin,a.routes.api,a.serverURL,m,f,p,g?.code,t]);return ho(()=>xi(e.registerCommand(fo,E=>(e.dispatchCommand(de,E),N(),O(),!0),_i)),[e,N,O,y]),ho(()=>{let E=t.parentElement,L=()=>{e.getEditorState().read(()=>{N()})};return window.addEventListener("resize",L),E?.addEventListener("scroll",L),()=>{window.removeEventListener("resize",L),E?.removeEventListener("scroll",L)}},[t.parentElement,e,N]),ho(()=>xi(e.registerUpdateListener(({editorState:E})=>{E.read(()=>{N()})}),e.registerCommand(Sp,()=>(N(),!0),_i),e.registerCommand(Ep,()=>T?(v(),!0):!1,Tp)),[e,N,T,v]),ho(()=>{e.getEditorState().read(()=>{N()})},[e,N]),Et(Ti.Fragment,{children:[_e("div",{className:"link-editor",ref:n,children:Et("div",{className:"link-input",children:[l&&l.length>0?Et("a",{href:l,rel:"noopener noreferrer",target:"_blank",children:[o?.__fields.newTab?_e(Ci,{}):null,s!=null&&s.length>0?s:l]}):s!=null&&s.length>0?Et(dp,{children:[o?.__fields.newTab?_e(Ci,{}):null,_e("span",{className:"link-input__label-pure",children:s})]}):null,e.isEditable()&&Et(Ti.Fragment,{children:[_e("button",{"aria-label":"Edit link",className:"link-edit",onClick:E=>{E.preventDefault(),O()},onMouseDown:Ei,tabIndex:0,type:"button",children:_e(fp,{})}),!w&&_e("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(de,null)},onMouseDown:Ei,tabIndex:0,type:"button",children:_e(pp,{})})]})]})}),_e(dt,{className:"lexical-link-edit-drawer",data:h,drawerSlug:y,drawerTitle:f("fields:editLink"),featureKey:"link",handleDrawerSubmit:(E,L)=>{let D=L,I={...D};delete I.text,e.update(()=>{let A=bi(),R=null;if(ki(A)?R=ze(A).getParent():b.length&&(R=b[0]?.getParent()??null),R&&ke(R)){let F=Ce({fields:I});R.replace(F,!0)}}),e.dispatchCommand(de,{fields:I,selectedNodes:b,text:D.text})},schemaPath:c,schemaPathSuffix:"fields"})]})}var Ni=t=>{let{anchorElem:e=document.body}=t;return yp(Lp(Si,{anchorElem:e}),e)};import{c as vp}from"react/compiler-runtime";import{useLexicalComposerContext as Mp}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Dp}from"@lexical/utils";import{$getSelection as Ap,$isElementNode as $p,$isRangeSelection as Op,COMMAND_PRIORITY_LOW as yi,PASTE_COMMAND as Fp}from"lexical";import{useEffect as Pp}from"react";var Rp=/^(?:[a-zA-Z][a-zA-Z\d+.-]*:(?:\/\/)?(?:[-;:&=+$,\w]+@)?[A-Za-z\d]+(?:\.[A-Za-z\d]+)+|www\.[A-Za-z\d]+(?:\.[A-Za-z\d]+)+|(?:tel|mailto):[\w+.-]+)(?:\/[+~%/\w-]*)?(?:\?[-;&=%\w]*)?(?:#\w+)?$/,Ip=/^(?:\/[\w\-./]*(?:#\w[\w-]*)?|#[\w\-]+)$/;function Li(t){if(!t)return!1;if(t==="https://"||Rp.test(t)||Ip.test(t))return!0;try{return new URL(t),!0}catch{}return!1}var Ri=t=>{let e=vp(5),{clientProps:o}=t,[r]=Mp(),n,l;return e[0]!==o.defaultLinkType||e[1]!==o.defaultLinkURL||e[2]!==r?(n=()=>{if(!r.hasNodes([oe]))throw new Error("LinkPlugin: LinkNode not registered on editor");return Dp(r.registerCommand(de,i=>i===null?(sr(null),!0):(i.fields?.linkType||(i.fields.linkType=o.defaultLinkType),i.fields?.url||(i.fields.url=o.defaultLinkURL),sr(i),!0),yi),r.registerCommand(Fp,i=>{let s=Ap();if(!Op(s)||s.isCollapsed()||!(i instanceof ClipboardEvent)||i.clipboardData==null)return!1;let u=i.clipboardData.getData("text");if(!Li(u))return!1;if(!s.getNodes().some(Bp)){let c={doc:null,linkType:"custom",newTab:!1,url:u};return r.dispatchCommand(de,{fields:c,text:null}),i.preventDefault(),!0}return!1},yi))},l=[o.defaultLinkType,o.defaultLinkURL,r],e[0]=o.defaultLinkType,e[1]=o.defaultLinkURL,e[2]=r,e[3]=n,e[4]=l):(n=e[3],l=e[4]),Pp(n,l),null};function Bp(t){return $p(t)}var vi=[rr([{ChildComponent:ti,isActive:({selection:t})=>{if(Ii(t)){let e=ze(t);return jp(e,K)!=null}return!1},isEnabled:({selection:t})=>!!(Ii(t)&&dr()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(de,null);else{let o,r=[];if(t.getEditorState().read(()=>{o=dr()?.getTextContent(),r=dr()?.getNodes()??[]}),!o?.length)return;let n={doc:null};t.dispatchCommand(fo,{fields:n,selectedNodes:r,text:o})}},order:1}])],Hp=M(({props:t})=>({markdownTransformers:[li],nodes:[oe,t?.disableAutoLinks===!0?null:be].filter(Boolean),plugins:[{Component:Ri,position:"normal"},t?.disableAutoLinks===!0||t?.disableAutoLinks==="creationOnly"?null:{Component:fi,position:"normal"},{Component:hi,position:"normal"},{Component:Ni,position:"floatingAnchorElem"}].filter(Boolean),sanitizedClientFeatureProps:t,toolbarFixed:{groups:vi},toolbarInline:{groups:vi}}));import{$isListNode as fr,INSERT_CHECK_LIST_COMMAND as Fi,ListItemNode as Qp,ListNode as ef}from"@lexical/list";import{$isRangeSelection as tf}from"lexical";import{jsx as Mi,jsxs as Up}from"react/jsx-runtime";import"react";var mr=()=>Up("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:[Mi("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),Mi("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Wp}from"react/jsx-runtime";import{ListPlugin as Gp}from"@lexical/react/LexicalListPlugin.js";import"react";var Ze=()=>Wp(Gp,{});function Ye(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as Xp,ListItemNode as zp,ListNode as Zp}from"@lexical/list";import{$createListItemNode as Vp,$createListNode as Kp,$isListItemNode as Jp,$isListNode as pr}from"@lexical/list";var Di=4,qe=t=>(e,o,r)=>{let n=e.getPreviousSibling(),l=e.getNextSibling(),i=Vp(t==="check"?r[3]==="x":void 0);if(pr(l)&&l.getListType()===t){let u=l.getFirstChild();u!==null?u.insertBefore(i):l.append(i),e.remove()}else if(pr(n)&&n.getListType()===t)n.append(i),e.remove();else{let u=Kp(t,t==="number"?Number(r[2]):void 0);u.append(i),e.replace(u)}i.append(...o),i.select(0,0);let s=Math.floor(r[1].length/Di);s&&i.setIndent(s)},Pe=(t,e,o)=>{let r=[],n=t.getChildren(),l=0;for(let i of n)if(Jp(i)){if(i.getChildrenSize()===1){let d=i.getFirstChild();if(pr(d)){r.push(Pe(d,e,o+1));continue}}let s=" ".repeat(o*Di),u=t.getListType(),c=u==="number"?`${t.getStart()+l}. `:u==="check"?`- [${i.getChecked()?"x":" "}] `:"- ";r.push(s+c+e(i)),l++}return r.join(`
54
+ `},[t,e]),p=$e((b,k)=>{o(x=>{let w=e.length-1,_=e[w];if(_&&_.name===b){if(b==="type")return[...e.slice(0,w),{..._,value:_.value+k}];if(_.value===k)return[...e.slice(0,w),{..._,count:_.count+1}]}return[...x,{name:b,count:1,value:k}]})},[e,o]);$n(()=>{let b=x=>{if(!r)return;let w=x.key;Hu(x)?p("selectAll",""):Fn.has(w)?p("press",x.key):[...w].length>1?p("keydown",x.key):p("type",x.key)},k=x=>{if(!r)return;let w=x.key;!Fn.has(w)&&[...w].length>1&&p("keyup",x.key)};return t.registerRootListener((x,w)=>{w!==null&&(w.removeEventListener("keydown",b),w.removeEventListener("keyup",k)),x!==null&&(x.addEventListener("keydown",b),x.addEventListener("keyup",k))})},[t,r,p]),$n(()=>{d.current&&d.current.scrollTo(0,d.current.scrollHeight)},[m]),zo(()=>{if(e){let b=m();b!==null&&s(b),d.current&&d.current.scrollTo(0,d.current.scrollHeight)}},[m,e]),zo(()=>t.registerUpdateListener(({dirtyElements:k,dirtyLeaves:x,editorState:w})=>{if(!r)return;let _=w._selection,y=u.current,O=c.current;if(y!==_){if(x.size===0&&k.size===0&&!O){let N=Xo(t._window);if(N&&(N.anchorNode==null||N.focusNode==null))return}u.current=_}c.current=!1;let v=m();v!==null&&s(v)}),[t,m,r,p]),zo(()=>r?t.registerUpdateListener(()=>{let k=t.getRootElement();k!==null&&l(k?.innerHTML)}):void 0,[t,r]);let f=$e(b=>{r||(b.update(()=>{let k=Fu();k.clear();let x=Ou();k.append($u().append(x)),x.select()}),o([])),n(k=>!k)},[r]),h=$e(()=>{if(!r)return;let b=Xo(t._window);if(b===null||b.anchorNode==null||b.focusNode==null)return;let{anchorNode:k,anchorOffset:x,focusNode:w,focusOffset:_}=Uu(b),y=a().getRootElement(),O;k!==null&&(O=On(k,y));let v;w!==null&&(v=On(w,y)),p("snapshot",{anchorNode:k,anchorOffset:x,anchorPath:O,focusNode:w,focusOffset:_,focusPath:v})},[p,r,a]),C=$e(()=>{Pu(m())},[m]),g=$e(()=>{Bu("test.js",m())},[m]);return[Oe("button",{className:`editor-dev-button ${r?"active":""}`,id:"test-recorder-button",onClick:b=>{f(a()),b.preventDefault()},title:r?"Disable test recorder":"Enable test recorder",type:"button",children:r?"Disable test recorder":"Enable test recorder"}),r?Yo("div",{className:"test-recorder-output",children:[Yo("div",{className:"test-recorder-toolbar",children:[Oe("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:b=>{h(),b.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),Oe("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:b=>{C(),b.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),Oe("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:b=>{g(),b.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),Oe("pre",{id:"test-recorder",ref:d,children:i})]}):null]}var Bn=()=>{let t=Du(3),[e]=Au(),[o,r]=Wu(e),n;return t[0]!==o||t[1]!==r?(n=Yo(Pn.Fragment,{children:[Oe("p",{children:"HI"}),o,r,Oe("p",{children:"DONE"})]}),t[0]=o,t[1]=r,t[2]=n):n=t[2],n};var Gu=M({plugins:[{Component:Bn,position:"bottom"}]});import{c as Vu}from"react/compiler-runtime";import{jsx as Ku}from"react/jsx-runtime";import{useLexicalComposerContext as Ju}from"@lexical/react/LexicalComposerContext.js";import{TreeView as Xu}from"@lexical/react/LexicalTreeView.js";import"react";var jn=()=>{let t=Vu(2),[e]=Ju(),o;return t[0]!==e?(o=Ku(Xu,{editor:e,timeTravelButtonClassName:"debug-timetravel-button",timeTravelPanelButtonClassName:"debug-timetravel-panel-button",timeTravelPanelClassName:"debug-timetravel-panel",timeTravelPanelSliderClassName:"debug-timetravel-panel-slider",treeTypeButtonClassName:"debug-treetype-button",viewClassName:"tree-view-output"}),t[0]=e,t[1]=o):o=t[1],o};var zu=M({plugins:[{Component:jn,position:"bottom"}]});import{$isTableSelection as Zu}from"@lexical/table";import{$isRangeSelection as Yu,FORMAT_TEXT_COMMAND as qu}from"lexical";import{jsx as Hn}from"react/jsx-runtime";import"react";var Un=()=>Hn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Hn("path",{d:"M10.6772 15H6.27017V5.718H10.4172C12.6792 5.718 13.8492 6.602 13.8492 8.292C13.8492 9.098 13.1992 9.982 12.4712 10.216C13.3812 10.476 14.1742 11.256 14.1742 12.322C14.1742 14.09 12.9002 15 10.6772 15ZM8.46717 9.501H10.3262C11.3012 9.501 11.7042 9.046 11.7042 8.409C11.7042 7.72 11.2362 7.317 10.3392 7.317H8.46717V9.501ZM8.46717 11.061V13.401H10.4822C11.4702 13.401 11.9642 12.959 11.9642 12.218C11.9642 11.49 11.4702 11.061 10.4822 11.061H8.46717Z",fill:"currentColor"})});var Z=t=>({type:"buttons",items:t,key:"format",order:40});var Wn={type:"text-format",format:["bold","italic"],tag:"***"},Gn={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},Vn={type:"text-format",format:["bold"],tag:"**"},Kn={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var Jn=[Z([{ChildComponent:Un,isActive:({selection:t})=>Yu(t)||Zu(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(qu,"bold")},order:1}])],Qu=M(({featureProviderMap:t})=>{let e=[Vn,Kn];return t.get("italic")&&e.push(Gn,Wn),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:Jn},toolbarInline:{groups:Jn}}});import{$isTableSelection as td}from"@lexical/table";import{$isRangeSelection as od,FORMAT_TEXT_COMMAND as rd}from"lexical";import{jsx as Xn,jsxs as ed}from"react/jsx-runtime";import"react";var zn=()=>ed("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:[Xn("path",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),Xn("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var Zn={type:"text-format",format:["code"],tag:"`"};var Yn=[Z([{ChildComponent:zn,isActive:({selection:t})=>od(t)||td(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(rd,"code")},order:7}])],nd=M({enableFormats:["code"],markdownTransformers:[Zn],toolbarFixed:{groups:Yn},toolbarInline:{groups:Yn}});import{$isTableSelection as ld}from"@lexical/table";import{$isRangeSelection as id,FORMAT_TEXT_COMMAND as sd}from"lexical";import{jsx as qn}from"react/jsx-runtime";import"react";var Qn=()=>qn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:qn("path",{d:"M11.311 14.2969L11.0327 15H6.18408L6.4624 14.2969C7.54639 14.2969 7.70752 14.209 7.83936 13.8721L10.8423 6.45996C10.8716 6.38672 10.8862 6.32812 10.8862 6.26953C10.8862 6.09375 10.6519 6.03516 9.80225 6.03516L10.0952 5.33203H14.9438L14.6509 6.03516C13.5669 6.03516 13.4204 6.12305 13.2886 6.45996L10.2856 13.8721C10.2563 13.9453 10.2271 14.0039 10.2271 14.0625C10.2271 14.2383 10.4614 14.2969 11.311 14.2969Z",fill:"currentColor"})});var el={type:"text-format",format:["italic"],tag:"*"},tl={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var ol=[Z([{ChildComponent:Qn,isActive:({selection:t})=>id(t)||ld(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(sd,"italic")},order:2}])],ad=M({enableFormats:["italic"],markdownTransformers:[el,tl],toolbarFixed:{groups:ol},toolbarInline:{groups:ol}});import{$isTableSelection as ud}from"@lexical/table";import{$isRangeSelection as dd,FORMAT_TEXT_COMMAND as md}from"lexical";import{jsx as rl,jsxs as cd}from"react/jsx-runtime";import"react";var nl=()=>cd("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[rl("path",{d:"M5.50756 12.76H7.42756C7.56256 14.215 8.82256 14.71 10.1576 14.71C11.4326 14.71 12.4226 14.14 12.4226 13.06C12.4226 12.28 11.9576 11.845 10.6676 11.605L8.70256 11.245C7.12756 10.96 5.85256 10.21 5.85256 8.335C5.85256 6.43 7.53256 5.11 9.87256 5.11C12.4226 5.11 13.9526 6.22 14.1626 8.23H12.2876C12.1526 7.18 11.2226 6.595 9.88756 6.595C8.59756 6.595 7.78756 7.27 7.78756 8.215C7.78756 9.1 8.34256 9.385 9.49756 9.61L11.5676 10.015C13.3226 10.345 14.3726 11.215 14.3726 12.94C14.3726 14.89 12.5876 16.18 10.2176 16.18C7.66756 16.18 5.70256 15.115 5.50756 12.76Z",fill:"currentColor"}),rl("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var ll={type:"text-format",format:["strikethrough"],tag:"~~"};var il=[Z([{ChildComponent:nl,isActive:({selection:t})=>dd(t)||ud(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(md,"strikethrough")},order:4}])],pd=M({enableFormats:["strikethrough"],markdownTransformers:[ll],toolbarFixed:{groups:il},toolbarInline:{groups:il}});import{$isTableSelection as fd}from"@lexical/table";import{$isRangeSelection as hd,FORMAT_TEXT_COMMAND as gd}from"lexical";import{jsx as sl}from"react/jsx-runtime";import"react";var al=()=>sl("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:sl("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 13.258C16.7768 14.155 16.1398 14.532 15.2038 15C14.5538 15.325 14.2808 15.546 14.2418 15.78H16.7898V16.82H12.7208V16.339C12.7208 15.286 13.5918 14.675 14.3588 14.233C15.0868 13.83 15.4378 13.635 15.4378 13.232C15.4378 12.894 15.2038 12.686 14.8268 12.686C14.3848 12.686 14.1248 13.024 14.1118 13.427H12.7468C12.8248 12.426 13.5528 11.633 14.8398 11.633C15.9448 11.633 16.7768 12.257 16.7768 13.258Z",fill:"currentColor"})});var cl=[Z([{ChildComponent:al,isActive:({selection:t})=>hd(t)||fd(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(gd,"subscript")},order:5}])],xd=M({enableFormats:["subscript"],toolbarFixed:{groups:cl},toolbarInline:{groups:cl}});import{$isTableSelection as Cd}from"@lexical/table";import{$isRangeSelection as bd,FORMAT_TEXT_COMMAND as kd}from"lexical";import{jsx as ul}from"react/jsx-runtime";import"react";var dl=()=>ul("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:ul("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 7.252C16.7768 8.149 16.1398 8.526 15.2038 8.994C14.5538 9.319 14.2808 9.54 14.2418 9.774H16.7898V10.814H12.7208V10.333C12.7208 9.28 13.5918 8.669 14.3588 8.227C15.0868 7.824 15.4378 7.629 15.4378 7.226C15.4378 6.888 15.2038 6.68 14.8268 6.68C14.3848 6.68 14.1248 7.018 14.1118 7.421H12.7468C12.8248 6.42 13.5528 5.627 14.8398 5.627C15.9448 5.627 16.7768 6.251 16.7768 7.252Z",fill:"currentColor"})});var ml=[Z([{ChildComponent:dl,isActive:({selection:t})=>bd(t)||Cd(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(kd,"superscript")},order:6}])],_d=M({enableFormats:["superscript"],toolbarFixed:{groups:ml},toolbarInline:{groups:ml}});import{$isTableSelection as wd}from"@lexical/table";import{$isRangeSelection as Ed,FORMAT_TEXT_COMMAND as Sd}from"lexical";import{jsx as pl,jsxs as Td}from"react/jsx-runtime";import"react";var fl=()=>Td("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[pl("path",{d:"M13.9656 11.256C13.9656 13.791 12.5096 15.156 10.0006 15.156C7.50461 15.156 6.03561 13.791 6.03561 11.23V5.718H7.76461V11.243C7.76461 12.868 8.50561 13.778 10.0006 13.778C11.4956 13.778 12.2496 12.868 12.2496 11.243V5.718H13.9656V11.256Z",fill:"currentColor"}),pl("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var hl=[Z([{ChildComponent:fl,isActive:({selection:t})=>Ed(t)||wd(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(Sd,"underline")},order:3}])],Nd=M({enableFormats:["underline"],toolbarFixed:{groups:hl},toolbarInline:{groups:hl}});import{jsx as er}from"react/jsx-runtime";import{jsx as Ld}from"react/jsx-runtime";function yd(t){return t.replace(/-([a-z])/g,(e,o)=>o.toUpperCase())}var io=({css:t})=>{let e=t?Object.fromEntries(Object.entries(t).map(([o,r])=>[yd(o),r])):{};return Ld("span",{style:{...e,alignItems:"center",borderRadius:"4px",display:"flex",fontSize:"16px",height:"20px",justifyContent:"center",width:"20px"},children:"A"})};import{useLexicalComposerContext as Rd}from"@lexical/react/LexicalComposerContext";import{$forEachSelectedTextNode as Id}from"@lexical/selection";import{$getNodeByKey as vd,$getState as Md,$setState as Dd,createState as Ad,TextNode as $d}from"lexical";import{useEffect as Od}from"react";var qo=new Map;function gl(t){for(let e in t){let o=t[e],r=Ad(e,{parse:n=>typeof n=="string"&&Object.keys(o).includes(n)?n:void 0});qo.set(e,{stateConfig:r,stateValues:o})}}function Qo(t,e,o){t.update(()=>{Id(r=>{let n=qo.get(e);if(!n)throw new Error(`State config for ${e} not found`);Dd(r,n.stateConfig,o)})})}function xl(){let[t]=Rd();return Od(()=>t.registerMutationListener($d,e=>{t.getEditorState().read(()=>{for(let[o,r]of e){if(r==="destroyed")continue;let n=vd(o),l=t.getElementByKey(o);if(!n||!l)continue;let i=Object.create(null);qo.forEach((s,u)=>{let c=Md(n,s.stateConfig);if(!c){delete l.dataset[u];return}l.dataset[u]=c;let d=s.stateValues[c]?.css;d&&Object.assign(i,d)}),l.style.cssText="",Object.assign(l.style,i)}})}),[t]),null}var Cl=t=>{let e=[];for(let r in t.state){let n=t.state[r];for(let l in n){let i=n[l];e.push({ChildComponent:()=>er(io,{css:i.css}),key:l,label:i.label,onSelect:({editor:s})=>{Qo(s,r,l)}})}}return[{type:"dropdown",ChildComponent:()=>er(io,{css:{color:"var(--theme-elevation-600)"}}),items:[...[{ChildComponent:()=>er(io,{}),key:"clear-style",label:({i18n:r})=>r.t("lexical:textState:defaultStyle"),onSelect:({editor:r})=>{for(let n in t.state)Qo(r,n,void 0)},order:1}],...e],key:"textState",order:30}]},Fd=M(({props:t})=>(gl(t.state),{plugins:[{Component:xl,position:"normal"}],toolbarFixed:{groups:Cl(t)},toolbarInline:{groups:Cl(t)}}));import{c as Hd}from"react/compiler-runtime";import{useLexicalComposerContext as Ud}from"@lexical/react/LexicalComposerContext";import{$createHeadingNode as Wd,$isHeadingNode as Ml,HeadingNode as $l}from"@lexical/rich-text";import{$setBlocksType as Gd}from"@lexical/selection";import{$getSelection as Vd,$isRangeSelection as Kd}from"lexical";import{useEffect as Jd}from"react";import{jsx as bl}from"react/jsx-runtime";import"react";var kl=()=>bl("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:bl("path",{d:"M4.639 13.5V7.074H6.196V9.648H9.076V7.074H10.642V13.5H9.076V10.836H6.196V13.5H4.639ZM11.5656 9.045V8.019C12.6636 8.019 13.1316 7.731 13.2846 7.065H14.4006V13.5H12.8436V9.045H11.5656Z",fill:"currentColor"})});import{jsx as _l}from"react/jsx-runtime";import"react";var Tl=()=>_l("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:_l("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM15.9796 8.973C15.9796 10.116 15.1696 10.656 14.0356 11.232C13.2256 11.646 12.8206 11.943 12.7846 12.294H15.9886V13.5H11.0566V12.951C11.0566 11.601 12.1636 10.845 13.1176 10.287C14.0356 9.756 14.5126 9.486 14.5126 8.946C14.5126 8.46 14.2156 8.145 13.6306 8.145C13.0186 8.145 12.6586 8.613 12.6226 9.198H11.1196C11.2186 7.947 12.1006 6.966 13.6396 6.966C15.0346 6.966 15.9796 7.785 15.9796 8.973Z",fill:"currentColor"})});import{jsx as wl}from"react/jsx-runtime";import"react";var El=()=>wl("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:wl("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM16.1146 11.745C16.1146 12.744 15.2236 13.608 13.6126 13.608C12.0736 13.608 11.0926 12.762 10.9846 11.547H12.4696C12.5146 12.114 13.0006 12.456 13.6126 12.456C14.2876 12.456 14.6746 12.132 14.6746 11.619C14.6746 11.061 14.2426 10.836 13.6216 10.836H12.9826V9.738H13.6036C14.1526 9.738 14.5486 9.486 14.5486 8.937C14.5486 8.46 14.2156 8.127 13.6486 8.127C13.0366 8.127 12.6586 8.514 12.6226 9.045H11.1916C11.2726 7.929 12.1276 6.966 13.6666 6.966C15.1876 6.966 15.9706 7.848 15.9706 8.865C15.9706 9.603 15.5026 10.143 14.8186 10.269C15.6196 10.404 16.1146 10.971 16.1146 11.745Z",fill:"currentColor"})});import{jsx as Sl}from"react/jsx-runtime";import"react";var Nl=()=>Sl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Sl("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM15.1736 7.074V10.854H16.3706V12.033H15.1736V13.5H13.6796V12.033H10.5116V10.845L13.4996 7.074H15.1736ZM13.6796 8.46L11.8256 10.854H13.6796V8.46Z",fill:"currentColor"})});import{jsx as Ll}from"react/jsx-runtime";import"react";var yl=()=>Ll("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:Ll("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.1576 10.269C12.6896 10.269 12.3746 10.494 12.2216 10.737H10.8176L11.1956 7.074H15.2546V8.28H12.3206L12.1856 9.549C12.4016 9.351 12.8516 9.126 13.4636 9.126C14.7866 9.126 15.6596 10.053 15.6596 11.358C15.6596 12.609 14.7326 13.608 13.1756 13.608C11.5826 13.608 10.6556 12.753 10.5566 11.511H12.1136C12.1586 12.06 12.5456 12.465 13.1576 12.465C13.8236 12.465 14.1746 11.97 14.1746 11.376C14.1746 10.764 13.8416 10.269 13.1576 10.269Z",fill:"currentColor"})});import{jsx as Rl}from"react/jsx-runtime";import"react";var Il=()=>Rl("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:Rl("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.3646 8.127C12.5456 8.127 12.0416 8.937 12.0416 9.999C12.3296 9.54 12.8246 9.207 13.5536 9.207C14.8586 9.207 15.8036 10.134 15.8036 11.376C15.8036 12.645 14.8226 13.608 13.3196 13.608C11.7266 13.608 10.6196 12.393 10.6196 10.395C10.6196 8.316 11.7716 6.966 13.4186 6.966C14.7056 6.966 15.5786 7.749 15.7316 8.829H14.3186C14.2016 8.415 13.9226 8.127 13.3646 8.127ZM13.3106 12.51C13.9586 12.51 14.3816 12.042 14.3816 11.385C14.3816 10.737 13.9586 10.278 13.3106 10.278C12.6536 10.278 12.2126 10.737 12.2126 11.385C12.2126 12.042 12.6536 12.51 13.3106 12.51Z",fill:"currentColor"})});import{$createHeadingNode as Pd,$isHeadingNode as Bd,HeadingNode as jd}from"@lexical/rich-text";var tr=t=>(e,o,r)=>{let n=t(r);n&&(n.append(...o),e.replace(n),n.select(0,0))};var vl=t=>{let o=`^(${t.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`,r=new RegExp(o);return{type:"element",dependencies:[jd],export:(n,l)=>{if(!Bd(n))return null;let i=Number(n.getTag().slice(1));return"#".repeat(i)+" "+l(n)},regExp:r,replace:tr(n=>{let l="h"+n[1]?.length;return Pd(l)})}};var Dl=t=>{let e=Vd();Gd(e,()=>Wd(t))},Al={h1:kl,h2:Tl,h3:El,h4:Nl,h5:yl,h6:Il},Xd=M(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[ee(e.map((r,n)=>({ChildComponent:Al[r],isActive:({selection:l})=>{if(!Kd(l))return!1;for(let i of l.getNodes()){if(Ml(i)&&i.getTag()===r)continue;let s=i.getParent();if(!(Ml(s)&&s.getTag()===r))return!1}return!0},key:r,label:({i18n:l})=>l.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:l})=>{l.update(()=>{Dl(r)})},order:n+2})))];return{markdownTransformers:[vl(e)],nodes:[$l],plugins:[{Component:zd,position:"normal"}],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[z(e.map(r=>({Icon:Al[r],key:`heading-${r.charAt(1)}`,keywords:["heading",r],label:({i18n:n})=>n.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:n})=>{n.update(()=>{Dl(r)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}}),zd=t=>{let e=Hd(9),{clientProps:o}=t,{enabledHeadingSizes:r}=o,n;e[0]!==r?(n=r===void 0?["h1","h2","h3","h4","h5","h6"]:r,e[0]=r,e[1]=n):n=e[1];let l=n,i;e[2]!==l?(i=l.at(-1),e[2]=l,e[3]=i):i=e[3];let s=i,[u]=Ud(),c,d;return e[4]!==u||e[5]!==l||e[6]!==s?(c=()=>{if(!(!s||l.length===6))return u.registerNodeTransform($l,a=>{l.includes(a.getTag())||a.setTag(s)})},d=[u,l,s],e[4]=u,e[5]=l,e[6]=s,e[7]=c,e[8]=d):(c=e[7],d=e[8]),Jd(c,d),null};import{$isNodeSelection as dm}from"lexical";import{jsx as Ol}from"react/jsx-runtime";import"react";var or=()=>Ol("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:Ol("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as Fl,jsxs as Zd}from"react/jsx-runtime";import"react";var Pl=()=>Zd("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Fl("path",{d:"M5 10h10",stroke:"currentColor"}),Fl("path",{d:"M10 15V5",stroke:"currentColor"})]});var xe=t=>({type:"dropdown",ChildComponent:Pl,items:t,key:"add",order:10});import{addClassNamesToElement as Yd}from"@lexical/utils";import{$applyNodeReplacement as qd,createCommand as Qd,DecoratorNode as em}from"lexical";var kt=Qd("INSERT_HORIZONTAL_RULE_COMMAND"),bt=class extends em{static clone(e){return new this(e.__key)}static getType(){return"horizontalrule"}static importDOM(){return{hr:()=>({conversion:tm,priority:0})}}static importJSON(e){return Bl()}createDOM(e){let o=document.createElement("hr");return Yd(o,e.theme.hr),o}decorate(){return null}exportDOM(){return{element:document.createElement("hr")}}exportJSON(){return{type:"horizontalrule",version:1}}getTextContent(){return`
55
+ `}isInline(){return!1}updateDOM(){return!1}};function tm(){return{node:Bl()}}function Bl(){return qd(new bt)}import{$applyNodeReplacement as om}from"lexical";import"react";var ye=class extends bt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return _t()}decorate(){return null}exportJSON(){return super.exportJSON()}};function _t(){return om(new ye)}function so(t){return t instanceof ye}var jl={type:"element",dependencies:[ye],export:(t,e)=>so(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=_t();e&&t.replace(e)}};import{c as rm}from"react/compiler-runtime";import{useLexicalComposerContext as nm}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as lm}from"@lexical/utils";import{$getSelection as im,$isRangeSelection as sm,COMMAND_PRIORITY_EDITOR as am}from"lexical";import{useEffect as cm}from"react";var Hl=()=>{let t=rm(3),[e]=nm(),o,r;return t[0]!==e?(o=()=>e.registerCommand(kt,um,am),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),cm(o,r),null};function um(t){let e=im();if(!sm(e))return!1;if(e.focus.getNode()!==null){let r=_t();lm(r)}return!0}var mm=M({markdownTransformers:[jl],nodes:[ye],plugins:[{Component:Hl,position:"normal"}],slashMenu:{groups:[z([{Icon:or,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(kt,void 0)}}])]},toolbarFixed:{groups:[xe([{ChildComponent:or,isActive:({selection:t})=>{if(!dm(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return so(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(kt,void 0)}}])]}});import{$findMatchingParent as Yl}from"@lexical/utils";import{$isElementNode as Sm,INDENT_CONTENT_COMMAND as Nm,OUTDENT_CONTENT_COMMAND as Lm}from"lexical";import{jsx as ao,jsxs as pm}from"react/jsx-runtime";import"react";var Ul=()=>pm("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:[ao("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),ao("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),ao("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),ao("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as co,jsxs as fm}from"react/jsx-runtime";import"react";var Wl=()=>fm("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[co("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),co("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),co("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),co("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});import{jsx as hm}from"react/jsx-runtime";import{useLexicalComposerContext as gm}from"@lexical/react/LexicalComposerContext";import{TabIndentationPlugin as xm}from"@lexical/react/LexicalTabIndentationPlugin";import{$findMatchingParent as Cm,mergeRegister as Gl}from"@lexical/utils";import{$getSelection as bm,$isElementNode as Xl,$isRangeSelection as km,COMMAND_PRIORITY_LOW as Vl,INDENT_CONTENT_COMMAND as Kl,KEY_TAB_COMMAND as _m,OUTDENT_CONTENT_COMMAND as Tm,TabNode as wm}from"lexical";import{useEffect as Jl}from"react";var zl=({clientProps:t})=>{let[e]=gm(),{disabledNodes:o,disableTabNode:r}=t;return Jl(()=>{if(!(!e||!o?.length))return Gl(e.registerCommand(Kl,()=>Em(n=>{if(!o.includes(n.getType())){let l=n.getIndent();n.setIndent(l+1)}}),Vl),e.registerUpdateListener(({dirtyElements:n,editorState:l})=>{e.update(()=>{for(let[i]of n){let s=l._nodeMap.get(i);Xl(s)&&o.includes(s.getType())&&s.getIndent()>0&&s.setIndent(0)}})}))},[e,o]),Jl(()=>{if(!(!e||!r))return Gl(e.registerCommand(_m,n=>(n.preventDefault(),e.dispatchCommand(n.shiftKey?Tm:Kl,void 0)),Vl),e.registerNodeTransform(wm,n=>{n.remove()}))},[e,r]),hm(xm,{})};function Em(t){let e=bm();if(!km(e))return!1;let o=new Set,r=e.getNodes();for(let n=0;n<r.length;n++){let l=r[n],i=l.getKey();if(o.has(i))continue;let s=Cm(l,c=>Xl(c)&&!c.isInline());if(s===null)continue;let u=s.getKey();s.canIndent()&&!o.has(u)&&(o.add(u),t(s))}return o.size>0}var Zl=t=>({type:"buttons",items:t,key:"indent",order:35});var ql=({disabledNodes:t})=>[Zl([{ChildComponent:Ul,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>Ql(n)&&n.getIndent()>0;return o.some(n=>r(n)||!!Yl(n,r))},key:"indentDecrease",label:({i18n:e})=>e.t("lexical:indent:decreaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Lm,void 0)},order:1},{ChildComponent:Wl,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>Ql(n)&&!(t??[]).includes(n.getType());return o.some(n=>r(n)||!!Yl(n,r))},key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Nm,void 0)},order:2}])],ym=M(({props:t})=>{let e=t.disabledNodes??[];return{plugins:[{Component:zl,position:"normal"}],sanitizedClientFeatureProps:t,toolbarFixed:{groups:ql({disabledNodes:e})},toolbarInline:{groups:ql({disabledNodes:e})}}}),Ql=t=>Sm(t)&&t.canIndent();import{$findMatchingParent as jp}from"@lexical/utils";import{$getSelection as dr,$isRangeSelection as Ii}from"lexical";import{jsx as ei}from"react/jsx-runtime";import"react";var ti=()=>ei("svg",{"aria-hidden":"true",className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:ei("path",{d:"M8.5 11.5L11.5 8.5M8.5 7L9.625 5.875C10.868 4.633 12.882 4.633 14.125 5.875C15.368 7.118 15.368 9.133 14.125 10.375L13 11.5M7 8.5L5.746 9.754C4.56 10.94 4.519 12.85 5.652 14.087C6.814 15.354 8.78 15.449 10.058 14.298L11.5 13",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})});import{$isAtNodeEnd as oi}from"@lexical/selection";function ze(t){let{anchor:e}=t,{focus:o}=t,r=t.anchor.getNode(),n=t.focus.getNode();return r===n?r:t.isBackward()?oi(o)?r:n:oi(e)?r:n}var rr=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as Bm}from"lexical";import{addClassNamesToElement as Rm,isHTMLAnchorElement as Im}from"@lexical/utils";import ir from"bson-objectid";import{$applyNodeReplacement as vm,$createTextNode as ri,$getSelection as Mm,$isElementNode as ni,$isRangeSelection as lr,createCommand as Dm,ElementNode as Am}from"lexical";var $m=new Set(["http:","https:","mailto:","sms:","tel:"]),oe=class t extends Am{__fields;__id;constructor({id:e,fields:o={linkType:"custom",newTab:!1},key:r}){super(r),this.__fields=o,this.__id=e}static clone(e){return new t({id:e.__id,fields:e.__fields,key:e.__key})}static getType(){return"link"}static importDOM(){return{a:e=>({conversion:Om,priority:1})}}static importJSON(e){let o=Ce({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),e.version===2&&!e.id&&(e.id=new ir.default().toHexString(),e.version=3),o}canBeEmpty(){return!1}canInsertTextAfter(){return!1}canInsertTextBefore(){return!1}createDOM(e){let o=document.createElement("a");return this.__fields?.linkType==="custom"&&(o.href=this.sanitizeUrl(this.__fields.url??"")),(this.__fields?.newTab??!1)&&(o.target="_blank"),this.__fields?.newTab===!0&&this.__fields?.linkType==="custom"&&(o.rel=nr(o.rel,"add","noopener")),Rm(o,e.theme.link),o}exportJSON(){let e=this.getFields();e?.linkType==="internal"?delete e.url:e?.linkType==="custom"&&delete e.doc;let o={...super.exportJSON(),type:"link",fields:e,version:3},r=this.getID();return r&&(o.id=r),o}extractWithChild(e,o,r){if(!lr(o))return!1;let n=o.anchor.getNode(),l=o.focus.getNode();return this.isParentOf(n)&&this.isParentOf(l)&&o.getTextContent().length>0}getFields(){return this.getLatest().__fields}getID(){return this.getLatest().__id}insertNewAfter(e,o=!0){let r=this.getParentOrThrow().insertNewAfter(e,o);if(ni(r)){let n=Ce({fields:this.__fields});return r.append(n),n}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!$m.has(o.protocol))return"about:blank"}catch{return"https://"}return e}setFields(e){let o=this.getWritable();return o.__fields=e,o}setID(e){let o=this.getWritable();return o.__id=e,o}updateDOM(e,o,r){let n=this.__fields?.url,l=this.__fields?.newTab;return n!=null&&n!==e.__fields?.url&&this.__fields?.linkType==="custom"&&(o.href=n),this.__fields?.linkType==="internal"&&e.__fields?.linkType==="custom"&&o.removeAttribute("href"),o.rel==null&&(o.rel=""),l!==e.__fields?.newTab&&(l??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=nr(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=nr(o.rel,"remove","noopener"))),!1}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields).setID(e.id)}};function Om(t){let e=null;if(Im(t)){let o=t.textContent;o!==null&&o!==""&&(e=Ce({id:new ir.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function Ce({id:t,fields:e}){return vm(new oe({id:t??new ir.default().toHexString(),fields:e}))}function K(t){return t instanceof oe}var de=Dm("TOGGLE_LINK_COMMAND");function sr(t){let e=Mm();if(!lr(e)&&(t===null||!t.selectedNodes?.length))return;let o=lr(e)?e.extract():t===null?[]:t.selectedNodes;if(t===null){o?.forEach(l=>{let i=l.getParent();K(i)&&(i.getChildren().forEach(u=>{i.insertBefore(u)}),i.remove())});return}if(o?.length===1){let l=o[0],i=K(l)?l:Fm(l);if(i!==null){i.setFields(t.fields),t.text!=null&&t.text!==i.getTextContent()&&(i.append(ri(t.text)),i.getChildren().forEach(s=>{s!==i.getLastChild()&&s.remove()}));return}}let r=null,n=null;o?.forEach(l=>{let i=l.getParent();if(!(i===n||i===null||ni(l)&&!l.isInline())){if(K(i)){n=i,i.setFields(t.fields),t.text!=null&&t.text!==i.getTextContent()&&(i.append(ri(t.text)),i.getChildren().forEach(s=>{s!==i.getLastChild()&&s.remove()}));return}if(i.is(r)||(r=i,n=Ce({fields:t.fields}),K(i)?l.getPreviousSibling()===null?i.insertBefore(n):i.insertAfter(n):l.insertBefore(n)),K(l)){if(l.is(n))return;if(n!==null){let s=l.getChildren();n.append(...s)}l.remove();return}n!==null&&n.append(l)}})}function Fm(t){return Pm(t,e=>K(e))}function Pm(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function nr(t,e,o){let r,n=`${t}`;if(e==="add"){if(n.includes(o)){let l=new RegExp(o,"g");n=n.replace(l,"").trim()}n=n.trim(),r=n.length===0?`${o}`:`${n} ${o}`}else{let l=new RegExp(o,"g");r=n.replace(l,"").trim()}return r}var li={type:"text-match",dependencies:[oe],export:(t,e)=>{if(!K(t))return null;let o=t,{url:r}=o.getFields();return`[${e(o)}](${r})`},importRegExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:(t,e)=>{let[,o,r]=e,n=Ce({fields:{doc:null,linkType:"custom",newTab:!1,url:r}}),l=Bm(o);return l.setFormat(t.getFormat()),n.append(l),t.replace(n),l},trigger:")"};import{$applyNodeReplacement as jm,$isElementNode as Hm}from"lexical";var be=class t extends oe{static clone(e){return new t({id:"",fields:e.__fields,key:e.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(e){let o=Tt({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),o}exportJSON(){let e=super.exportJSON();return{type:"autolink",children:e.children,direction:e.direction,fields:e.fields,format:e.format,indent:e.indent,version:2}}insertNewAfter(e,o=!0){let r=this.getParentOrThrow().insertNewAfter(e,o);if(Hm(r)){let n=Tt({fields:this.__fields});return r.append(n),n}return null}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields)}};function Tt({fields:t}){return jm(new be({id:"",fields:t}))}function ke(t){return t instanceof be}import{c as Um}from"react/compiler-runtime";import{useLexicalComposerContext as Wm}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Gm}from"@lexical/utils";import{$createTextNode as ii,$getSelection as Vm,$isElementNode as ai,$isLineBreakNode as ci,$isNodeSelection as Km,$isRangeSelection as Jm,$isTextNode as wt,TextNode as Xm}from"lexical";import{useEffect as zm}from"react";function si(t,e=o=>o){return o=>{let r=t.exec(o);return r===null?null:{index:r.index,length:r[0].length,text:r[0],url:e(r[0])}}}function ui(t,e){for(let o of e){let r=o(t);if(r!=null)return r}return null}var Zm=/[.,;\s]/;function mo(t){return t!==void 0&&Zm.test(t)}function di(t){return mo(t[t.length-1])}function cr(t){return mo(t[0])}function Ym(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function mi(t){let e=t.getPreviousSibling();return ai(e)&&(e=e.getLastDescendant()),e===null||ci(e)||wt(e)&&di(e.getTextContent())}function pi(t){let e=t.getNextSibling();return ai(e)&&(e=e.getFirstDescendant()),e===null||ci(e)||wt(e)&&cr(e.getTextContent())}function qm(t,e,o,r){return(t>0?mo(o[t-1]):mi(r[0]))?e<o.length?mo(o[e]):pi(r[r.length-1]):!1}function Qm(t,e,o){let r=[],n=[],l=[],i=0,s=0,u=[...t];for(;u.length>0;){let c=u[0],a=c.getTextContent().length,m=s;s+a<=e?(r.push(c),i+=a):m>=o?l.push(c):n.push(c),s+=a,u.shift()}return[i,r,n,l]}function ep(t,e,o,r){let n={linkType:"custom",url:r.url,...r.fields},l=Tt({fields:n});if(t.length===1){let i=t[0],s;if(e===0?[s]=i.splitText(o):[,s]=i.splitText(e,o),s){let u=ii(r.text);u.setFormat(s.getFormat()),u.setDetail(s.getDetail()),u.setStyle(s.getStyle()),l.append(u),s.replace(l)}return i}else if(t.length>1){let i=t[0],s=i.getTextContent().length,u;e===0?u=i:[,u]=i.splitText(e);let c=[],d;if(t.forEach(a=>{let p=a.getTextContent().length,f=s,h=s+p;if(f<o)if(h<=o)c.push(a);else{let[C,g]=a.splitText(o-f);C&&c.push(C),d=g}s+=p}),u){let a=Vm(),m=a?a.getNodes().find(wt):void 0,p=ii(u.getTextContent());return p.setFormat(u.getFormat()),p.setDetail(u.getDetail()),p.setStyle(u.getStyle()),l.append(p,...c),m&&m===u&&(Jm(a)?p.select(a.anchor.offset,a.focus.offset):Km(a)&&p.select(0,p.getTextContent().length)),u.replace(l),d}}}function tp(t,e,o){let r=[...t],n=r.map(u=>u.getTextContent()).join(""),l=n,i,s=0;for(;(i=ui(l,e))!=null&&i!==null;){let u=i.index,c=i.length,d=u+c;if(qm(s+u,s+d,n,r)){let[m,,p,f]=Qm(r,s+u,s+d),h=s+u-m,C=s+d-m,g=ep(p,h,C,i);r=g?[g,...f]:f,o(i.url,null),s=0}else s+=d;l=l.substring(d)}}function ar(t,e,o){let r=t.getChildren(),n=r.length;for(let u=0;u<n;u++){let c=r[u];if(!wt(c)||!c.isSimpleText()){uo(t),o(null,t.getFields()?.url??null);return}}let l=t.getTextContent(),i=ui(l,e);if(i===null||i.text!==l){uo(t),o(null,t.getFields()?.url??null);return}if(!mi(t)||!pi(t)){uo(t),o(null,t.getFields()?.url??null);return}let s=t.getFields()?.url;if(s!==i?.url){let u=t.getFields();u.url=i?.url,t.setFields(u),o(i.url,s??null)}}function op(t,e,o){let r=t.getPreviousSibling(),n=t.getNextSibling(),l=t.getTextContent();if(ke(r)){let i=r.getFields()?.url?r.getFields()?.url?.startsWith("mailto:")??!1:!1;(!cr(l)||Ym(l,i))&&(r.append(t),ar(r,e,o),o(null,r.getFields()?.url??null))}ke(n)&&!di(l)&&(uo(n),ar(n,e,o),o(null,n.getFields()?.url??null))}function uo(t){let e=t.getChildren(),o=e.length;for(let r=o-1;r>=0;r--)t.insertAfter(e[r]);return t.remove(),e.map(r=>r.getLatest())}function rp(t){let e=[t],o=t.getNextSibling();for(;o!==null&&wt(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function np(t,e,o){let r=Um(5),n,l;r[0]!==t||r[1]!==e||r[2]!==o?(n=()=>{if(!t.hasNodes([be]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let i=(s,u)=>{o?.(s,u)};return Gm(t.registerNodeTransform(Xm,s=>{let u=s.getParentOrThrow(),c=s.getPreviousSibling();if(ke(u))ar(u,e,i);else if(!K(u)){if(s.isSimpleText()&&(cr(s.getTextContent())||!ke(c))){let d=rp(s);tp(d,e,i)}op(s,e,i)}}))},l=[t,e,o],r[0]=t,r[1]=e,r[2]=o,r[3]=n,r[4]=l):(n=r[3],l=r[4]),zm(n,l)}var lp=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,ip=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,sp=[si(lp,t=>t.startsWith("http")?t:`https://${t}`),si(ip,t=>`mailto:${t}`)],fi=()=>{let[t]=Wm();return np(t,sp),null};import{jsx as ap}from"react/jsx-runtime";import{ClickableLinkPlugin as cp}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var hi=()=>ap(cp,{});import{jsx as Lp}from"react/jsx-runtime";import"react";import{createPortal as yp}from"react-dom";import{jsx as _e,jsxs as Et,Fragment as dp}from"react/jsx-runtime";import{useLexicalComposerContext as mp}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as gi,mergeRegister as xi}from"@lexical/utils";import{getTranslation as ur}from"@payloadcms/translations";import{CloseMenuIcon as pp,EditIcon as fp,ExternalLinkIcon as Ci,formatDrawerSlug as hp,useConfig as gp,useEditDepth as xp,useLocale as Cp,useTranslation as bp}from"@payloadcms/ui";import{requests as kp}from"@payloadcms/ui/shared";import{$getSelection as bi,$isLineBreakNode as _p,$isRangeSelection as ki,COMMAND_PRIORITY_HIGH as Tp,COMMAND_PRIORITY_LOW as _i,getDOMSelection as wp,KEY_ESCAPE_COMMAND as Ep,SELECTION_CHANGE_COMMAND as Sp}from"lexical";import Ti,{useCallback as wi,useEffect as ho,useRef as Np,useState as Fe}from"react";function po(t,e,o,r=10,n=5){let l=o.parentElement;if(t===null||l==null){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let i=e.getBoundingClientRect(),s=o.getBoundingClientRect(),u=l.getBoundingClientRect(),c=t.top-r,d=t.left-n;c<u.top&&(c+=i.height+t.height+r*2),d+i.width>u.right&&(d=u.right-i.width-n),c-=s.top,d-=s.left,e.style.opacity="1",e.style.transform=`translate(${d}px, ${c}px)`}import{createCommand as up}from"lexical";var fo=up("TOGGLE_LINK_WITH_MODAL_COMMAND");function Ei(t){t.preventDefault()}function Si({anchorElem:t}){let[e]=mp(),[o,r]=Fe(),n=Np(null),[l,i]=Fe(null),[s,u]=Fe(null),{fieldProps:{schemaPath:c},uuid:d}=j(),{config:a,getEntityConfig:m}=gp(),{i18n:p,t:f}=bp(),[h,C]=Fe(),g=xp(),[T,S]=Fe(!1),[b,k]=Fe([]),x=Cp(),[w,_]=Fe(!1),y=hp({slug:"lexical-rich-text-link-"+d,depth:g}),{toggleDrawer:O}=fe(y),v=wi(()=>{S(!1),n&&n.current&&(n.current.style.opacity="0",n.current.style.transform="translate(-10000px, -10000px)"),_(!1),i(null),u(null),k([]),C(void 0)},[S,i,u,k]),N=wi(()=>{let E=bi(),L;if(!ki(E)||!E){v();return}let D=ze(E);L=e.getElementByKey(D.getKey())?.getBoundingClientRect();let I=gi(D,K),A=E.getNodes().filter(J=>!_p(J)).find(J=>{let U=gi(J,K);return I&&!I.is(U)||U&&!U.is(I)});if(I==null||A){v();return}r(I);let R=I.getFields(),F={...R,id:I.getID(),text:I.getTextContent()};if(R?.linkType==="custom")i(R?.url??null),u(null);else{i(`${a.routes.admin==="/"?"":a.routes.admin}/collections/${R?.doc?.relationTo}/${R?.doc?.value}`);let J=R?.doc?.relationTo?m({collectionSlug:R?.doc?.relationTo}):void 0;if(!J)u(R?.label?String(R?.label):null),i(R?.url?String(R?.url):null);else{let U=typeof R.doc?.value=="object"?R.doc.value.id:R.doc?.value,We=R.doc?.relationTo;if(!U||!We)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let Se=f("fields:linkedTo",{label:`${ur(J.labels.singular,p)} - ${f("lexical:link:loadingWithEllipsis",p)}`}).replace(/<[^>]*>?/g,"");u(Se),kp.get(`${a.serverURL}${a.routes.api}/${We}/${U}`,{headers:{"Accept-Language":p.language},params:{depth:0,locale:x?.code}}).then(async pe=>{if(!pe.ok)throw new Error(`HTTP error! Status: ${pe.status}`);let Bt=await pe.json(),Ne=J?.admin?.useAsTitle||"id",jt=Bt[Ne],Ge=f("fields:linkedTo",{label:`${ur(J.labels.singular,p)} - ${jt}`}).replace(/<[^>]*>?/g,"");u(Ge)}).catch(()=>{let pe=f("fields:linkedTo",{label:`${ur(J.labels.singular,p)} - ${f("general:untitled",p)} - ID: ${U}`}).replace(/<[^>]*>?/g,"");u(pe)})}}C(F),S(!0),k(E?E?.getNodes():[]),ke(I)?_(!0):_(!1);let W=n.current,Q=wp(e._window),{activeElement:re}=document;if(W===null)return;let Pt=e.getRootElement();return Q!==null&&Pt!==null&&Pt.contains(Q.anchorNode)?(L||(L=Q.getRangeAt(0).getBoundingClientRect()),L!=null&&(L.y+=40,po(L,W,t))):(re==null||re.className!=="link-input")&&(Pt!==null&&po(null,W,t),i(null),u(null)),!0},[e,v,a.routes.admin,a.routes.api,a.serverURL,m,f,p,x?.code,t]);return ho(()=>xi(e.registerCommand(fo,E=>(e.dispatchCommand(de,E),N(),O(),!0),_i)),[e,N,O,y]),ho(()=>{let E=t.parentElement,L=()=>{e.getEditorState().read(()=>{N()})};return window.addEventListener("resize",L),E?.addEventListener("scroll",L),()=>{window.removeEventListener("resize",L),E?.removeEventListener("scroll",L)}},[t.parentElement,e,N]),ho(()=>xi(e.registerUpdateListener(({editorState:E})=>{E.read(()=>{N()})}),e.registerCommand(Sp,()=>(N(),!0),_i),e.registerCommand(Ep,()=>T?(v(),!0):!1,Tp)),[e,N,T,v]),ho(()=>{e.getEditorState().read(()=>{N()})},[e,N]),Et(Ti.Fragment,{children:[_e("div",{className:"link-editor",ref:n,children:Et("div",{className:"link-input",children:[l&&l.length>0?Et("a",{href:l,rel:"noopener noreferrer",target:"_blank",children:[o?.__fields.newTab?_e(Ci,{}):null,s!=null&&s.length>0?s:l]}):s!=null&&s.length>0?Et(dp,{children:[o?.__fields.newTab?_e(Ci,{}):null,_e("span",{className:"link-input__label-pure",children:s})]}):null,e.isEditable()&&Et(Ti.Fragment,{children:[_e("button",{"aria-label":"Edit link",className:"link-edit",onClick:E=>{E.preventDefault(),O()},onMouseDown:Ei,tabIndex:0,type:"button",children:_e(fp,{})}),!w&&_e("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(de,null)},onMouseDown:Ei,tabIndex:0,type:"button",children:_e(pp,{})})]})]})}),_e(dt,{className:"lexical-link-edit-drawer",data:h,drawerSlug:y,drawerTitle:f("fields:editLink"),featureKey:"link",handleDrawerSubmit:(E,L)=>{let D=L,I={...D};delete I.text,e.update(()=>{let A=bi(),R=null;if(ki(A)?R=ze(A).getParent():b.length&&(R=b[0]?.getParent()??null),R&&ke(R)){let F=Ce({fields:I});R.replace(F,!0)}}),e.dispatchCommand(de,{fields:I,selectedNodes:b,text:D.text})},schemaPath:c,schemaPathSuffix:"fields"})]})}var Ni=t=>{let{anchorElem:e=document.body}=t;return yp(Lp(Si,{anchorElem:e}),e)};import{c as vp}from"react/compiler-runtime";import{useLexicalComposerContext as Mp}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Dp}from"@lexical/utils";import{$getSelection as Ap,$isElementNode as $p,$isRangeSelection as Op,COMMAND_PRIORITY_LOW as yi,PASTE_COMMAND as Fp}from"lexical";import{useEffect as Pp}from"react";var Rp=/^(?:[a-zA-Z][a-zA-Z\d+.-]*:(?:\/\/)?(?:[-;:&=+$,\w]+@)?[A-Za-z\d]+(?:\.[A-Za-z\d]+)+|www\.[A-Za-z\d]+(?:\.[A-Za-z\d]+)+|(?:tel|mailto):[\w+.-]+)(?:\/[+~%/\w-]*)?(?:\?[-;&=%\w]*)?(?:#\w+)?$/,Ip=/^(?:\/[\w\-./]*(?:#\w[\w-]*)?|#[\w\-]+)$/;function Li(t){if(!t)return!1;if(t==="https://"||Rp.test(t)||Ip.test(t))return!0;try{return new URL(t),!0}catch{}return!1}var Ri=t=>{let e=vp(5),{clientProps:o}=t,[r]=Mp(),n,l;return e[0]!==o.defaultLinkType||e[1]!==o.defaultLinkURL||e[2]!==r?(n=()=>{if(!r.hasNodes([oe]))throw new Error("LinkPlugin: LinkNode not registered on editor");return Dp(r.registerCommand(de,i=>i===null?(sr(null),!0):(i.fields?.linkType||(i.fields.linkType=o.defaultLinkType),i.fields?.url||(i.fields.url=o.defaultLinkURL),sr(i),!0),yi),r.registerCommand(Fp,i=>{let s=Ap();if(!Op(s)||s.isCollapsed()||!(i instanceof ClipboardEvent)||i.clipboardData==null)return!1;let u=i.clipboardData.getData("text");if(!Li(u))return!1;if(!s.getNodes().some(Bp)){let c={doc:null,linkType:"custom",newTab:!1,url:u};return r.dispatchCommand(de,{fields:c,text:null}),i.preventDefault(),!0}return!1},yi))},l=[o.defaultLinkType,o.defaultLinkURL,r],e[0]=o.defaultLinkType,e[1]=o.defaultLinkURL,e[2]=r,e[3]=n,e[4]=l):(n=e[3],l=e[4]),Pp(n,l),null};function Bp(t){return $p(t)}var vi=[rr([{ChildComponent:ti,isActive:({selection:t})=>{if(Ii(t)){let e=ze(t);return jp(e,K)!=null}return!1},isEnabled:({selection:t})=>!!(Ii(t)&&dr()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(de,null);else{let o,r=[];if(t.getEditorState().read(()=>{o=dr()?.getTextContent(),r=dr()?.getNodes()??[]}),!o?.length)return;let n={doc:null};t.dispatchCommand(fo,{fields:n,selectedNodes:r,text:o})}},order:1}])],Hp=M(({props:t})=>({markdownTransformers:[li],nodes:[oe,t?.disableAutoLinks===!0?null:be].filter(Boolean),plugins:[{Component:Ri,position:"normal"},t?.disableAutoLinks===!0||t?.disableAutoLinks==="creationOnly"?null:{Component:fi,position:"normal"},{Component:hi,position:"normal"},{Component:Ni,position:"floatingAnchorElem"}].filter(Boolean),sanitizedClientFeatureProps:t,toolbarFixed:{groups:vi},toolbarInline:{groups:vi}}));import{$isListNode as fr,INSERT_CHECK_LIST_COMMAND as Fi,ListItemNode as Qp,ListNode as ef}from"@lexical/list";import{$isRangeSelection as tf}from"lexical";import{jsx as Mi,jsxs as Up}from"react/jsx-runtime";import"react";var mr=()=>Up("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:[Mi("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),Mi("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Wp}from"react/jsx-runtime";import{ListPlugin as Gp}from"@lexical/react/LexicalListPlugin.js";import"react";var Ze=()=>Wp(Gp,{});function Ye(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as Xp,ListItemNode as zp,ListNode as Zp}from"@lexical/list";import{$createListItemNode as Vp,$createListNode as Kp,$isListItemNode as Jp,$isListNode as pr}from"@lexical/list";var Di=4,qe=t=>(e,o,r)=>{let n=e.getPreviousSibling(),l=e.getNextSibling(),i=Vp(t==="check"?r[3]==="x":void 0);if(pr(l)&&l.getListType()===t){let u=l.getFirstChild();u!==null?u.insertBefore(i):l.append(i),e.remove()}else if(pr(n)&&n.getListType()===t)n.append(i),e.remove();else{let u=Kp(t,t==="number"?Number(r[2]):void 0);u.append(i),e.replace(u)}i.append(...o),i.select(0,0);let s=Math.floor(r[1].length/Di);s&&i.setIndent(s)},Pe=(t,e,o)=>{let r=[],n=t.getChildren(),l=0;for(let i of n)if(Jp(i)){if(i.getChildrenSize()===1){let d=i.getFirstChild();if(pr(d)){r.push(Pe(d,e,o+1));continue}}let s=" ".repeat(o*Di),u=t.getListType(),c=u==="number"?`${t.getStart()+l}. `:u==="check"?`- [${i.getChecked()?"x":" "}] `:"- ";r.push(s+c+e(i)),l++}return r.join(`
56
56
  `)};var Ai={type:"element",dependencies:[Zp,zp],export:(t,e)=>Xp(t)?Pe(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:qe("check")};import{jsx as Yp}from"react/jsx-runtime";import{CheckListPlugin as qp}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var $i=()=>Yp(qp,{});var Oi=[ee([{ChildComponent:mr,isActive:({selection:t})=>{if(!tf(t))return!1;for(let e of t.getNodes()){if(fr(e)&&e.getListType()==="check")continue;let o=e.getParent();if(fr(o)&&o.getListType()==="check")continue;let r=o?.getParent();if(!(fr(r)&&r.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(Fi,void 0)},order:12}])],of=M(({featureProviderMap:t})=>{let e=[{Component:$i,position:"normal"}];return!t.has("unorderedList")&&!t.has("orderedList")&&e.push({Component:Ze,position:"normal"}),{markdownTransformers:[Ai],nodes:t.has("unorderedList")||t.has("orderedList")?[]:[ef,Qp],plugins:e,slashMenu:{groups:[Ye([{Icon:mr,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:o})=>o.t("lexical:checklist:label"),onSelect:({editor:o})=>{o.dispatchCommand(Fi,void 0)}}])]},toolbarFixed:{groups:Oi},toolbarInline:{groups:Oi}}});import{$isListNode as gr,INSERT_ORDERED_LIST_COMMAND as ji,ListItemNode as af,ListNode as cf}from"@lexical/list";import{$isRangeSelection as uf}from"lexical";import{jsx as St,jsxs as rf}from"react/jsx-runtime";import"react";var hr=()=>rf("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[St("path",{d:"M5.89284 12.479C5.89284 13.368 5.26284 13.788 4.38084 14.236C3.75084 14.558 3.43584 14.789 3.40784 15.062H5.89984V16H2.06384V15.573C2.06384 14.523 2.92484 13.935 3.66684 13.501C4.38084 13.088 4.75184 12.878 4.75184 12.458C4.75184 12.08 4.52084 11.835 4.06584 11.835C3.58984 11.835 3.30984 12.199 3.28184 12.654H2.11284C2.18984 11.681 2.87584 10.918 4.07284 10.918C5.15784 10.918 5.89284 11.555 5.89284 12.479Z",fill:"currentColor"}),St("path",{d:"M2.68608 4.535V3.737C3.54008 3.737 3.90408 3.513 4.02308 2.995H4.89108V8H3.68008L3.68008 4.535H2.68608Z",fill:"currentColor"}),St("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),St("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),St("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as nf,ListItemNode as lf,ListNode as sf}from"@lexical/list";var Pi={type:"element",dependencies:[sf,lf],export:(t,e)=>nf(t)?Pe(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:qe("number")};var Bi=[ee([{ChildComponent:hr,isActive:({selection:t})=>{if(!uf(t))return!1;for(let e of t.getNodes()){if(gr(e)&&e.getListType()==="number")continue;let o=e.getParent();if(gr(o)&&o.getListType()==="number")continue;let r=o?.getParent();if(!(gr(r)&&r.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(ji,void 0)},order:10}])],df=M(({featureProviderMap:t})=>({markdownTransformers:[Pi],nodes:t.has("orderedList")?[]:[cf,af],plugins:t.has("orderedList")?[]:[{Component:Ze,position:"normal"}],slashMenu:{groups:[Ye([{Icon:hr,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:e})=>e.t("lexical:orderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(ji,void 0)}}])]},toolbarFixed:{groups:Bi},toolbarInline:{groups:Bi}}));import{$isListNode as Cr,INSERT_UNORDERED_LIST_COMMAND as Wi,ListItemNode as gf,ListNode as xf}from"@lexical/list";import{$isRangeSelection as Cf}from"lexical";import{jsx as Qe,jsxs as mf}from"react/jsx-runtime";import"react";var xr=()=>mf("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:[Qe("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Qe("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Qe("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Qe("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),Qe("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),Qe("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as pf,ListItemNode as ff,ListNode as hf}from"@lexical/list";var Hi={type:"element",dependencies:[hf,ff],export:(t,e)=>pf(t)?Pe(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:qe("bullet")};var Ui=[ee([{ChildComponent:xr,isActive:({selection:t})=>{if(!Cf(t))return!1;for(let e of t.getNodes()){if(Cr(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(Cr(o)&&o.getListType()==="bullet")continue;let r=o?.getParent();if(!(Cr(r)&&r.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Wi,void 0)},order:11}])],bf=M({markdownTransformers:[Hi],nodes:[xf,gf],plugins:[{Component:Ze,position:"normal"}],slashMenu:{groups:[Ye([{Icon:xr,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Wi,void 0)}}])]},toolbarFixed:{groups:Ui},toolbarInline:{groups:Ui}});import{jsx as kf}from"react/jsx-runtime";import{addClassNamesToElement as _f}from"@lexical/utils";import{DecoratorNode as Tf}from"lexical";import*as Gi from"react";var wf=Gi.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),Nt=class t extends Tf{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new t({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return Ef({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return _f(o,"unknownConverted"),o}decorate(){return kf(wf,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function Ef({data:t}){return new Nt({data:t})}var Sf=M(()=>({nodes:[Nt]}));import{jsx as Nf}from"react/jsx-runtime";import{addClassNamesToElement as Lf}from"@lexical/utils";import{DecoratorNode as yf}from"lexical";import*as Vi from"react";var Rf=Vi.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),Lt=class t extends yf{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new t({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return If({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return Lf(o,"unknownConverted"),o}decorate(){return Nf(Rf,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function If({data:t}){return new Lt({data:t})}var vf=M(()=>({nodes:[Lt]}));import{$setBlocksType as Xi}from"@lexical/selection";import{$createParagraphNode as zi,$getSelection as Zi,$isParagraphNode as Ki,$isRangeSelection as Mf}from"lexical";var Ji=[ee([{ChildComponent:pt,isActive:({selection:t})=>{if(!Mf(t))return!1;for(let e of t.getNodes())if(!Ki(e)&&!Ki(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=Zi();Xi(e,()=>zi())})},order:1}])],Df=M({slashMenu:{groups:[z([{Icon:pt,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Zi();Xi(e,()=>zi())})}}])]},toolbarFixed:{groups:Ji},toolbarInline:{groups:Ji}});import{c as e0}from"react/compiler-runtime";import{jsx as gs}from"react/jsx-runtime";import{useLexicalComposerContext as t0}from"@lexical/react/LexicalComposerContext";import{useEffect as o0,useState as r0}from"react";import{jsx as hs,Fragment as Qf}from"react/jsx-runtime";import"react";import{jsx as Af}from"react/jsx-runtime";var Yi={quote:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return Af("blockquote",{children:o})}};import{jsx as $f}from"react/jsx-runtime";var qi={heading:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.tag;return $f(r,{children:o})}};import{jsx as Of}from"react/jsx-runtime";var Qi={horizontalrule:Of("hr",{})};import{jsx as Ff}from"react/jsx-runtime";var es={linebreak:Ff("br",{})};import{jsx as ts}from"react/jsx-runtime";var os=({internalDocToHref:t})=>({autolink:({node:e,nodesToJSX:o})=>{let r=o({nodes:e.children}),n=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0;return ts("a",{href:e.fields.url,rel:n,target:l,children:r})},link:({node:e,nodesToJSX:o})=>{let r=o({nodes:e.children}),n=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0,i=e.fields.url??"";return e.fields.linkType==="internal"&&(t?i=t({linkNode:e}):(console.error("Lexical => JSX converter: Link converter: found internal link, but internalDocToHref is not provided"),i="#")),ts("a",{href:i,rel:n,target:l,children:r})}});import{jsx as et,jsxs as Pf,Fragment as Bf}from"react/jsx-runtime";import{v4 as jf}from"uuid";var rs={list:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.tag;return et(r,{className:`list-${t?.listType}`,children:o})},listitem:({node:t,nodesToJSX:e,parent:o})=>{let r=t.children.some(l=>l.type==="list"),n=e({nodes:t.children});if("listType"in o&&o?.listType==="check"){let l=jf();return et("li",{"aria-checked":t.checked?"true":"false",className:`list-item-checkbox${t.checked?" list-item-checkbox-checked":" list-item-checkbox-unchecked"}${r?" nestedListItem":""}`,role:"checkbox",style:{listStyleType:"none"},tabIndex:-1,value:t?.value,children:r?n:Pf(Bf,{children:[et("input",{checked:t.checked,id:l,readOnly:!0,type:"checkbox"}),et("label",{htmlFor:l,children:n}),et("br",{})]})})}else return et("li",{className:`${r?"nestedListItem":""}`,style:r?{listStyleType:"none"}:void 0,value:t?.value,children:n})}};import{jsx as br}from"react/jsx-runtime";var ns={paragraph:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return o?.length?br("p",{children:o}):br("p",{children:br("br",{})})}};var ls={tab:" "};import{jsx as yt}from"react/jsx-runtime";var is={table:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return yt("div",{className:"lexical-table-container",children:yt("table",{className:"lexical-table",style:{borderCollapse:"collapse"},children:yt("tbody",{children:o})})})},tablecell:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.headerState>0?"th":"td",n=`lexical-table-cell-header-${t.headerState}`,l={backgroundColor:t.backgroundColor||void 0,border:"1px solid #ccc",padding:"8px"},i=t.colSpan&&t.colSpan>1?t.colSpan:void 0,s=t.rowSpan&&t.rowSpan>1?t.rowSpan:void 0;return yt(r,{className:`lexical-table-cell ${n}`,colSpan:i,rowSpan:s,style:l,children:o})},tablerow:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return yt("tr",{className:"lexical-table-row",children:o})}};import{jsx as Be}from"react/jsx-runtime";import"react";var $={DOM_ELEMENT_TYPE:1,DOM_TEXT_TYPE:3,NO_DIRTY_NODES:0,HAS_DIRTY_NODES:1,FULL_RECONCILE:2,IS_NORMAL:0,IS_TOKEN:1,IS_SEGMENTED:2,IS_INERT:3,IS_BOLD:1,IS_ITALIC:2,IS_STRIKETHROUGH:4,IS_UNDERLINE:8,IS_CODE:16,IS_SUBSCRIPT:32,IS_SUPERSCRIPT:64,IS_HIGHLIGHT:128,IS_DIRECTIONLESS:1,IS_UNMERGEABLE:2,IS_ALIGN_LEFT:1,IS_ALIGN_CENTER:2,IS_ALIGN_RIGHT:3,IS_ALIGN_JUSTIFY:4,IS_ALIGN_START:5,IS_ALIGN_END:6},Hf=$.IS_BOLD|$.IS_ITALIC|$.IS_STRIKETHROUGH|$.IS_UNDERLINE|$.IS_CODE|$.IS_SUBSCRIPT|$.IS_SUPERSCRIPT|$.IS_HIGHLIGHT,Uf="\xA0",Wf=`
57
57
 
58
- `,ss="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",as="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",Gf=new RegExp("^[^"+as+"]*["+ss+"]"),Vf=new RegExp("^[^"+ss+"]*["+as+"]"),Kf={bold:$.IS_BOLD,code:$.IS_CODE,highlight:$.IS_HIGHLIGHT,italic:$.IS_ITALIC,strikethrough:$.IS_STRIKETHROUGH,subscript:$.IS_SUBSCRIPT,superscript:$.IS_SUPERSCRIPT,underline:$.IS_UNDERLINE},Jf={directionless:$.IS_DIRECTIONLESS,unmergeable:$.IS_UNMERGEABLE},Xf={center:$.IS_ALIGN_CENTER,end:$.IS_ALIGN_END,justify:$.IS_ALIGN_JUSTIFY,left:$.IS_ALIGN_LEFT,right:$.IS_ALIGN_RIGHT,start:$.IS_ALIGN_START},zf={[$.IS_ALIGN_CENTER]:"center",[$.IS_ALIGN_END]:"end",[$.IS_ALIGN_JUSTIFY]:"justify",[$.IS_ALIGN_LEFT]:"left",[$.IS_ALIGN_RIGHT]:"right",[$.IS_ALIGN_START]:"start"},Zf={normal:$.IS_NORMAL,segmented:$.IS_SEGMENTED,token:$.IS_TOKEN},Yf={[$.IS_NORMAL]:"normal",[$.IS_SEGMENTED]:"segmented",[$.IS_TOKEN]:"token"};var cs={text:({node:t})=>{let e=t.text;return t.format&$.IS_BOLD&&(e=Be("strong",{children:e})),t.format&$.IS_ITALIC&&(e=Be("em",{children:e})),t.format&$.IS_STRIKETHROUGH&&(e=Be("span",{style:{textDecoration:"line-through"},children:e})),t.format&$.IS_UNDERLINE&&(e=Be("span",{style:{textDecoration:"underline"},children:e})),t.format&$.IS_CODE&&(e=Be("code",{children:e})),t.format&$.IS_SUBSCRIPT&&(e=Be("sub",{children:e})),t.format&$.IS_SUPERSCRIPT&&(e=Be("sup",{children:e})),e}};import{jsx as Rt}from"react/jsx-runtime";var us={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 tt={...ns,...cs,...es,...Yi,...is,...qi,...Qi,...rs,...os({}),...us,...ls};import{jsx as ms,Fragment as qf}from"react/jsx-runtime";import kr from"react";function ds(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 ps({converters:t,data:e,disableIndent:o,disableTextAlign:r}){return ds(e)?fs({converters:t,disableIndent:o,disableTextAlign:r,nodes:e?.root?.children,parent:e?.root}):ms(qf,{})}function fs({converters:t,disableIndent:e,disableTextAlign:o,nodes:r,parent:n}){let l=t.unknown;return r.map((s,u)=>{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 d;c?d=typeof c=="function"?c({childIndex:u,converters:t,node:s,nodesToJSX:p=>fs({converters:p.converters??t,disableIndent:p.disableIndent??e,disableTextAlign:p.disableTextAlign??o,nodes:p.nodes,parent:p.parent??{...s,parent:n}}),parent:n}):c:d=ms("span",{children:"unknown node"},u);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`),kr.isValidElement(d)){if(a.textAlign||a.paddingInlineStart){let m={...a,...d?.props?.style??{}};return kr.cloneElement(d,{key:u,style:m})}return kr.cloneElement(d,{key:u})}return d}catch(d){return console.error("Error converting lexical node to JSX:",d,"node:",s),null}}).filter(Boolean)}var _r=({className:t,converters:e,data:o,disableContainer:r,disableIndent:n,disableTextAlign:l})=>{if(!o)return null;let i={};e?typeof e=="function"?i=e({defaultConverters:tt}):i=e:i=tt;let s=o&&!Array.isArray(o)&&typeof o=="object"&&"root"in o&&ps({converters:i,data:o,disableIndent:n,disableTextAlign:l});return r?hs(Qf,{children:s}):hs("div",{className:t??"payload-richtext",children:s})};function xs(){let t=e0(7),[e]=t0(),o;t[0]!==e?(o=e.getEditorState().toJSON(),t[0]=e,t[1]=o):o=t[1];let[r,n]=r0(o),l,i;t[2]!==e?(l=()=>e.registerUpdateListener(u=>{let{editorState:c}=u;n(c.toJSON())}),i=[e],t[2]=e,t[3]=l,t[4]=i):(l=t[3],i=t[4]),o0(l,i);let s;return t[5]!==r?(s=gs("div",{className:"debug-jsx-converter",children:gs(_r,{converters:tt,data:r})}),t[5]=r,t[6]=s):s=t[6],s}var n0=M({plugins:[{Component:xs,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)"}},l0={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 W0}from"lexical";import{jsx as It,jsxs as i0}from"react/jsx-runtime";import"react";var Tr=()=>i0("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 c0}from"react/jsx-runtime";import*as bs from"react";import{DecoratorBlockNode as s0}from"@lexical/react/LexicalDecoratorBlockNode.js";function a0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Cs({relationTo:o,value:e})}:null}var vt=class extends s0{__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:a0,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=Cs(o);return r.setFormat(e.format),r}static isInline(){return!1}decorate(e,o){return null}exportDOM(){let e=document.createElement("div");e.setAttribute("data-lexical-relationship-id",String(typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value)),e.setAttribute("data-lexical-relationship-relationTo",this.__data?.relationTo);let o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"relationship",version:2}}getData(){return this.getLatest().__data}getTextContent(){return`${this.__data?.relationTo} relation to ${typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value}`}setData(e){let o=this.getWritable();o.__data=e}};function Cs(t){return new vt({data:t})}var u0=bs.lazy(()=>import("./RelationshipComponent-APF3CN47.js").then(t=>({default:t.RelationshipComponent})));function d0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:je({relationTo:o,value:e})}:null}var Te=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:d0,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},r=je(o);return r.setFormat(e.format),r}decorate(e,o){return c0(u0,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function je(t){return new Te({data:t})}function wr(t){return t instanceof Te}import{c as R0}from"react/compiler-runtime";import{jsx as I0}from"react/jsx-runtime";import{useLexicalComposerContext as v0}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as M0}from"@lexical/utils";import{useConfig as D0}from"@payloadcms/ui";import{$getPreviousSelection as A0,$getSelection as $0,$isParagraphNode as O0,$isRangeSelection as F0,COMMAND_PRIORITY_EDITOR as P0,createCommand as B0}from"lexical";import{useEffect as j0}from"react";import{c as w0}from"react/compiler-runtime";import{jsx as go}from"react/jsx-runtime";import{useLexicalComposerContext as E0}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as S0,COMMAND_PRIORITY_EDITOR as N0}from"lexical";import{useEffect as L0,useState as Ts}from"react";import{c as m0}from"react/compiler-runtime";import{jsx as p0}from"react/jsx-runtime";import{useLexicalComposerContext as f0}from"@lexical/react/LexicalComposerContext";import{useListDrawer as h0,useModal as g0}from"@payloadcms/ui";import{$getNodeByKey as ks,$getPreviousSelection as x0,$getRoot as C0,$getSelection as b0,$isRangeSelection as k0,$setSelection as _0}from"lexical";import{useEffect as T0,useState as _s}from"react";var Mt=t=>{let e=m0(23),[o]=f0(),[r,n]=_s(null),[l,i]=_s(!1),[s,u,c]=h0(t),{closeDrawer:d,drawerSlug:a,isDrawerOpen:m,openDrawer:p}=c,{modalState:f}=g0(),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let O=b0()??x0();n(O)},e[0]=h):h=e[0];let x=h,C;e[1]!==o||e[2]!==r?(C=()=>{r&&o.update(()=>{if(k0(r)){let{anchor:O,focus:v}=r;ks(O.key)&&ks(v.key)&&_0(r.clone())}else C0().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=r,e[3]=C):C=e[3];let T=C,S;e[4]!==d?(S=()=>{d()},e[4]=d,e[5]=S):S=e[5];let b=S,k,g;e[6]!==a||e[7]!==f||e[8]!==T||e[9]!==l?(k=()=>{if(!l)return;let O=f[a];O&&!O?.isOpen&&(i(!1),setTimeout(()=>{T()},1))},g=[f,a,T,l],e[6]=a,e[7]=f,e[8]=T,e[9]=l,e[10]=k,e[11]=g):(k=e[10],g=e[11]),T0(k,g);let w;e[12]!==u?(w=O=>p0(u,{...O,onClick:()=>{x()}}),e[12]=u,e[13]=w):w=e[13];let _;e[14]!==p?(_=()=>{x(),p(),i(!0)},e[14]=p,e[15]=_):_=e[15];let y;return e[16]!==s||e[17]!==b||e[18]!==m||e[19]!==a||e[20]!==w||e[21]!==_?(y={closeListDrawer:b,isListDrawerOpen:m,ListDrawer:s,listDrawerSlug:a,ListDrawerToggler:w,openListDrawer:_},e[16]=s,e[17]=b,e[18]=m,e[19]=a,e[20]=w,e[21]=_,e[22]=y):y=e[22],y};var y0=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=S0(o);n&&n.replace(je({relationTo:e,value:r}))}):t.dispatchCommand(Er,{relationTo:e,value:r})},ws=t=>{let e=w0(16),{enabledCollectionSlugs:o}=t,[r]=E0(),n;e[0]!==o?.[0]?(n=()=>o?.[0],e[0]=o?.[0],e[1]=n):n=e[1];let[l]=Ts(n),[i,s]=Ts(null),u=o||void 0,c;e[2]!==l||e[3]!==u?(c={collectionSlugs:u,selectedCollection:l},e[2]=l,e[3]=u,e[4]=c):c=e[4];let{closeListDrawer:d,ListDrawer:a,openListDrawer:m}=Mt(c),p,f;e[5]!==r||e[6]!==m?(p=()=>r.registerCommand(mt,T=>(s(T?.replace?T?.replace.nodeKey:null),m(),!0),N0),f=[r,m],e[5]=r,e[6]=m,e[7]=p,e[8]=f):(p=e[7],f=e[8]),L0(p,f);let h;e[9]!==d||e[10]!==r||e[11]!==i?(h=T=>{let{collectionSlug:S,doc:b}=T;y0({editor:r,relationTo:S,replaceNodeKey:i,value:b.id}),d()},e[9]=d,e[10]=r,e[11]=i,e[12]=h):h=e[12];let x=h,C;return e[13]!==a||e[14]!==x?(C=go(a,{onSelect:x}),e[13]=a,e[14]=x,e[15]=C):C=e[15],C},Es=t=>(t?.enabledCollectionSlugs?.length??-1)>0?go(ws,{...t}):go(Gt,{...t,children:go(ws,{...t})});var Er=B0("INSERT_RELATIONSHIP_COMMAND"),Ss=t=>{let e=R0(5),{clientProps:o}=t,[r]=v0(),{config:n}=D0(),{collections:l}=n,i=null;if(o?.enabledCollections)i=o?.enabledCollections;else if(o?.disabledCollections){let c;e[0]!==o?.disabledCollections?(c=d=>{let{slug:a}=d;return!o?.disabledCollections?.includes(a)},e[0]=o?.disabledCollections,e[1]=c):c=e[1],i=l.filter(c).map(H0)}let s,u;return e[2]!==r?(s=()=>{if(!r.hasNodes([Te]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return r.registerCommand(Er,U0,P0)},u=[r],e[2]=r,e[3]=s,e[4]=u):(s=e[3],u=e[4]),j0(s,u),I0(Es,{enabledCollectionSlugs:i})};function H0(t){let{slug:e}=t;return e}function U0(t){let e=$0()||A0();if(F0(e)){let o=je(t),{focus:r}=e,n=r.getNode();M0(o),O0(n)&&!n.__first&&n.remove()}return!0}var G0=M({nodes:[Te],plugins:[{Component:Ss,position:"normal"}],slashMenu:{groups:[z([{Icon:Tr,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(mt,{replace:!1})}}])]},toolbarFixed:{groups:[xe([{ChildComponent:Tr,isActive:({selection:t})=>{if(!W0(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return wr(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(mt,{replace:!1})}}])]}});import{c as As}from"react/compiler-runtime";import{jsx as ae,jsxs as x1}from"react/jsx-runtime";import{useLexicalComposerContext as C1}from"@lexical/react/LexicalComposerContext.js";import{useScrollInfo as b1,useThrottledEffect as k1,useTranslation as _1}from"@payloadcms/ui";import*as we from"react";import{useMemo as T1}from"react";import{c as V0}from"react/compiler-runtime";import{jsx as K0}from"react/jsx-runtime";import{mergeRegister as J0}from"@lexical/utils";import{$addUpdateTag as X0,$getSelection as z0}from"lexical";import{useDeferredValue as Z0,useEffect as Y0,useState as q0}from"react";var Ns="toolbar-popup__button",Dt=t=>{let e=V0(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]=q0(l),u=Z0(i),c=j(),d=u.enabled?"":"disabled",a=u.active?"active":"",m=n.key?`${Ns}-${n.key}`:"",p;e[1]!==d||e[2]!==a||e[3]!==m?(p=[Ns,d,a,m].filter(Boolean),e[1]=d,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 _=z0();if(!_)return;let y=n.isActive?n.isActive({editor:r,editorConfigContext:c,selection:_}):!1,O=n.isEnabled?n.isEnabled({editor:r,editorConfigContext:c,selection:_}):!0;s(v=>v.active===y&&v.enabled===O?v:{active:y,enabled:O})})},e[5]=r,e[6]=c,e[7]=n,e[8]=h):h=e[8];let x=h,C=Vt(),T,S;e[9]!==r||e[10]!==C||e[11]!==x?(T=()=>{C(x);let _=()=>C(x),y=J0(r.registerUpdateListener(_));return document.addEventListener("mouseup",_),()=>{y(),document.removeEventListener("mouseup",_)}},S=[r,C,x],e[9]=r,e[10]=C,e[11]=x,e[12]=T,e[13]=S):(T=e[12],S=e[13]),Y0(T,S);let b;e[14]!==i||e[15]!==r||e[16]!==n?(b=()=>{i.enabled&&r.focus(()=>{r.update(Q0),n.onSelect?.({editor:r,isActive:i.active})})},e[14]=i,e[15]=r,e[16]=n,e[17]=b):b=e[17];let k=b,g=e1,w;return e[18]!==o||e[19]!==f||e[20]!==k||e[21]!==n.key?(w=K0("button",{className:f,"data-button-key":n.key,onClick:k,onMouseDown:g,type:"button",children:o}),e[18]=o,e[19]=f,e[20]=k,e[21]=n.key,e[22]=w):w=e[22],w};function Q0(){X0("toolbar")}function e1(t){t.preventDefault()}import{c as s1}from"react/compiler-runtime";import{jsx as ot}from"react/jsx-runtime";import Ds,{useCallback as a1,useDeferredValue as c1,useEffect as u1,useMemo as d1}from"react";import{mergeRegister as m1}from"@lexical/utils";import{useTranslation as p1}from"@payloadcms/ui";import{$getSelection as f1}from"lexical";import{jsx as Re,jsxs as Ls}from"react/jsx-runtime";import{Button as t1}from"@payloadcms/ui";import{$addUpdateTag as o1,isDOMNode as r1}from"lexical";import xo,{useCallback as n1,useEffect as Co,useMemo as Rs,useRef as Sr,useState as Nr}from"react";import{createPortal as l1}from"react-dom";var ys="toolbar-popup__dropdown-item",Is=xo.createContext(null);function vs({active:t,children:e,editor:o,enabled:r,Icon:n,item:l,itemKey:i,tooltip:s}){let u=Rs(()=>[ys,r===!1?"disabled":"",t?"active":"",l?.key?`${ys}-${l.key}`:""].filter(Boolean).join(" "),[r,t,l.key]),c=Sr(null),d=xo.use(Is);if(d===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=d;return Co(()=>{c?.current!=null&&a(c)},[c,a]),Re(t1,{"aria-label":s,buttonStyle:"none",className:u,disabled:r===!1,extraButtonProps:{"data-item-key":i},icon:n,iconPosition:"left",iconStyle:"none",onClick:()=>{r!==!1&&o.focus(()=>{o.update(()=>{o1("toolbar")}),l.onSelect?.({editor:o,isActive:t})})},onMouseDown:m=>{m.preventDefault()},ref:c,tooltip:s,type:"button",children:e})}function i1({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:r}){let[n,l]=Nr(),[i,s]=Nr(),u=n1(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])},d=Rs(()=>({registerItem:u}),[u]);return Co(()=>{n!=null&&i==null&&s(n[0]),i!=null&&i?.current!=null&&i.current.focus()},[n,i]),Re(Is,{value:d,children:Re("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:c,ref:e,children:t})})}function Ms({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:r=!1,dropdownKey:n,Icon:l,itemsContainerClassNames:i,label:s,stopCloseOnClickSelf:u}){let c=Sr(null),d=Sr(null),[a,m]=Nr(!1),p=()=>{m(!1),d?.current!=null&&d.current.focus()};Co(()=>{let h=d.current,x=c.current;if(a&&h!==null&&x!==null){let{left:C,top:T}=h.getBoundingClientRect(),S=window.scrollY||document.documentElement.scrollTop;x.style.top=`${T+S+h.offsetHeight+5}px`,x.style.left=`${Math.min(C-5,window.innerWidth-x.offsetWidth-20)}px`}},[c,d,a]),Co(()=>{let h=d.current;if(h!==null&&a){let x=C=>{let T=C.target;r1(T)&&(u&&c.current&&c.current.contains(T)||h.contains(T)||m(!1))};return document.addEventListener("click",x),()=>{document.removeEventListener("click",x)}}},[c,d,a,u]);let f=l1(Re(i1,{dropDownRef:c,itemsContainerClassNames:i,onClose:p,children:o}),document.body);return Ls(xo.Fragment,{children:[Ls("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:d,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",h1=t=>{let e=s1(14),{active:o,anchorElem:r,editor:n,enabled:l,item:i}=t,{i18n:s}=p1(),{fieldProps:u}=j(),{featureClientSchemaMap:c,schemaPath:d}=u;if(i.Component){let m;return e[0]!==o||e[1]!==r||e[2]!==n||e[3]!==l||e[4]!==i?(m=i?.Component&&ot(i.Component,{active:o,anchorElem:r,editor:n,enabled:l,item:i},i.key),e[0]=o,e[1]=r,e[2]=n,e[3]=l,e[4]=i,e[5]=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]!==d){let m=i.key,p;i.label&&(m=typeof i.label=="function"?i.label({featureClientSchemaMap:c,i18n:s,schemaPath:d}):i.label),m.length>25?p=m.substring(0,25)+"...":p=m,a=ot(vs,{active:o,editor:n,enabled:l,Icon:i?.ChildComponent?ot(i.ChildComponent,{}):void 0,item:i,itemKey:i.key,tooltip:m,children:ot("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]=d,e[13]=a}else a=e[13];return a},g1=Ds.memo(h1),He=({anchorElem:t,classNames:e,editor:o,group:r,Icon:n,itemsContainerClassNames:l,label:i,maxActiveItems:s,onActiveChange:u})=>{let[c,d]=Ds.useState({activeItemKeys:[],enabledGroup:!0,enabledItemKeys:[]}),a=c1(c),m=j(),{items:p,key:f}=r,h=Vt(),x=a1(()=>{o.getEditorState().read(()=>{let T=f1();if(!T)return;let S=[],b=[],k=[];for(let g of p)g.isActive&&(!s||S.length<s)&&g.isActive({editor:o,editorConfigContext:m,selection:T})&&(S.push(g.key),b.push(g)),g.isEnabled?g.isEnabled({editor:o,editorConfigContext:m,selection:T})&&k.push(g.key):k.push(g.key);d({activeItemKeys:S,enabledGroup:r.isEnabled?r.isEnabled({editor:o,editorConfigContext:m,selection:T}):!0,enabledItemKeys:k}),u&&u({activeItems:b})})},[o,m,r,p,s,u]);u1(()=>(h(x),m1(o.registerUpdateListener(async()=>{await h(x)}))),[o,h,x]);let C=d1(()=>p?.length?p.map(T=>ot(g1,{active:a.activeItemKeys.includes(T.key),anchorElem:t,editor:o,enabled:a.enabledItemKeys.includes(T.key),item:T},T.key)):null,[p,a,t,o]);return ot(Ms,{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:C},f)};function w1({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&ae(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?ae(Dt,{editor:e,item:o,children:ae(o.ChildComponent,{})},o.key):null}function E1(t){let e=As(23),{anchorElem:o,editor:r,editorConfig:n,group:l,index:i}=t,{i18n:s}=_1(),{fieldProps:u}=j(),{featureClientSchemaMap:c,schemaPath:d}=u,[a,m]=we.useState(void 0),[p,f]=we.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],we.useEffect(h,x);let C;e[6]!==c||e[7]!==l.ChildComponent||e[8]!==l.items||e[9]!==l.type||e[10]!==s||e[11]!==d?(C=k=>{let{activeItems:g}=k;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 w=g[0],_=w.key;w.label&&(_=typeof w.label=="function"?w.label({featureClientSchemaMap:c,i18n:s,schemaPath:d}):w.label),_.length>25&&(_=_.substring(0,25)+"..."),g.length===1?(m(_),f(()=>w.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]=d,e[12]=C):C=e[12];let T=C,S=`fixed-toolbar__group fixed-toolbar__group-${l.key}`,b;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]!==T||e[21]!==S?(b=x1("div",{className:S,"data-toolbar-group-key":l.key,children:[l.type==="dropdown"&&l.items.length?p?ae(He,{anchorElem:o,editor:r,group:l,Icon:p,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:l.maxActiveItems??1,onActiveChange:T}):ae(He,{anchorElem:o,editor:r,group:l,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:l.maxActiveItems??1,onActiveChange:T}):null,l.type==="buttons"&&l.items.length?l.items.map(k=>ae(w1,{anchorElem:o,editor:r,item:k},k.key)):null,i<n.features.toolbarFixed?.groups.length-1&&ae("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]=T,e[21]=S,e[22]=b):b=e[22],b}function S1({anchorElem:t,clientProps:e,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let l=we.useRef(null),{y:i}=b1(),s=T1(()=>{if(!n||e?.disableIfParentHasFixedToolbar)return null;let c=n.editorContainerRef.current.previousElementSibling;for(;c;){if(c.classList.contains("fixed-toolbar"))return c;c=c.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,n]);return k1(()=>{if(!s)return;let u=l.current;if(!u)return;let c=u.getBoundingClientRect(),d=s.getBoundingClientRect();if(!(c.bottom<d.top||c.top>d.bottom))u.classList.remove("fixed-toolbar"),u.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),s.classList.remove("fixed-toolbar"),s.classList.add("fixed-toolbar","fixed-toolbar--hide");else{if(!u.classList.contains("fixed-toolbar--overlapping"))return;u.classList.remove("fixed-toolbar--overlapping"),u.classList.add("fixed-toolbar"),s.classList.remove("fixed-toolbar--hide"),s.classList.add("fixed-toolbar")}},50,[l,s,i]),ae("div",{className:"fixed-toolbar",onFocus:u=>{u.stopPropagation()},ref:l,children:o.isEditable()&&ae(we.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((u,c)=>ae(E1,{anchorElem:t,editor:o,editorConfig:r,group:u,index:c},u.key))})})}var $s=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return $s(t.parentEditor)}return!1},Os=t=>{let e=As(6),{clientProps:o}=t,[r]=C1(),n=j(),{editorConfig:l}=n,i=o.applyToFocusedEditor&&n.focusedEditor?.editor||r,s=o.applyToFocusedEditor&&n.focusedEditor?.editorConfig||l,u,c;if(e[0]!==o.disableIfParentHasFixedToolbar||e[1]!==i||e[2]!==s||e[3]!==n){c=Symbol.for("react.early_return_sentinel");e:{let d=$s(n);if(o?.disableIfParentHasFixedToolbar&&d){c=null;break e}if(!s?.features?.toolbarFixed?.groups?.length){c=null;break e}u=ae(S1,{anchorElem:document.body,editor:i,editorConfig:s,parentWithFixedToolbar:d})}e[0]=o.disableIfParentHasFixedToolbar,e[1]=i,e[2]=s,e[3]=n,e[4]=u,e[5]=c}else u=e[4],c=e[5];return c!==Symbol.for("react.early_return_sentinel")?c:u};var N1=M({plugins:[{Component:Os,position:"aboveContainer"}]});import{c as Bs}from"react/compiler-runtime";import{jsx as me,jsxs as js}from"react/jsx-runtime";import{useLexicalComposerContext as L1}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Hs}from"@lexical/utils";import{$getSelection as Us,$isRangeSelection as Fs,$isTextNode as y1,COMMAND_PRIORITY_LOW as R1,getDOMSelection as Ws,SELECTION_CHANGE_COMMAND as I1}from"lexical";import{useCallback as ko,useEffect as At,useRef as Ps,useState as v1}from"react";import*as _o from"react";import{createPortal as M1}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:u,verticalGap:c=10}=t,d=o.parentElement;if(u===null||d==null){n.style.opacity="0",n.style.transform="translate(-10000px, -10000px)";return}let a=n.getBoundingClientRect(),m=o.getBoundingClientRect(),p=d.getBoundingClientRect(),f=u.top-a.height-c,h=u.left-l;i==="center"&&(h=u.left+u.width/2-a.width/2);let x=0;return!e&&f<p.top&&!s&&(x=a.height+u.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 D1({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&me(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?me(Dt,{editor:e,item:o,children:me(o.ChildComponent,{})},o.key):null}function A1(t){let e=Bs(19),{anchorElem:o,editor:r,group:n,index:l}=t,{editorConfig:i}=j(),[s,u]=_o.useState(),c;e[0]!==n.ChildComponent||e[1]!==n.items||e[2]!==n.type?(c=()=>{n?.type==="dropdown"&&n.items.length&&n.ChildComponent?u(()=>n.ChildComponent):u(void 0)},e[0]=n.ChildComponent,e[1]=n.items,e[2]=n.type,e[3]=c):c=e[3];let d;e[4]!==n?(d=[n],e[4]=n,e[5]=d):d=e[5],_o.useEffect(c,d);let a;e[6]!==n.ChildComponent||e[7]!==n.items||e[8]!==n.type?(a=h=>{let{activeItems:x}=h;if(!x.length){n?.type==="dropdown"&&n.items.length&&n.ChildComponent?u(()=>n.ChildComponent):u(void 0);return}let C=x[0];u(()=>C?.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=js("div",{className:p,"data-toolbar-group-key":n.key,children:[n.type==="dropdown"&&n.items.length?s?me(He,{anchorElem:o,editor:r,group:n,Icon:s,maxActiveItems:n.maxActiveItems??1,onActiveChange:m}):me(He,{anchorElem:o,editor:r,group:n,maxActiveItems:n.maxActiveItems??1,onActiveChange:m}):null,n.type==="buttons"&&n.items.length?n.items.map(h=>me(D1,{anchorElem:o,editor:r,item:h},h.key)):null,l<i.features.toolbarInline?.groups.length-1&&me("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 $1({anchorElem:t,editor:e}){let o=Ps(null),r=Ps(null),{editorConfig:n}=j(),l=ko(()=>{if(o?.current){let c=o.current.style.opacity==="0",d=o.current.style.pointerEvents==="none";c||(o.current.style.opacity="0"),d||(o.current.style.pointerEvents="none")}},[o]),i=ko(c=>{if(o?.current&&(c.buttons===1||c.buttons===3)){let d=o.current.style.opacity==="0",a=o.current.style.pointerEvents==="none";if(!d||!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"))},[]);At(()=>(document.addEventListener("mousemove",i),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",s)}),[o,i,s]);let u=ko(()=>{let c=Us(),d=Ws(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&&d!==null&&!d.isCollapsed&&p!==null&&p.contains(d.anchorNode)){let f=yr(d,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 At(()=>{let c=t.parentElement,d=()=>{e.getEditorState().read(()=>{u()})};return window.addEventListener("resize",d),c&&c.addEventListener("scroll",d),()=>{window.removeEventListener("resize",d),c&&c.removeEventListener("scroll",d)}},[e,u,t]),At(()=>(e.getEditorState().read(()=>{u()}),Hs(e.registerUpdateListener(({editorState:c})=>{c.read(()=>{u()})}),e.registerCommand(I1,()=>(u(),!1),R1))),[e,u]),js("div",{className:"inline-toolbar-popup",ref:o,children:[me("div",{className:"caret",ref:r}),n?.features&&n.features?.toolbarInline?.groups.map((c,d)=>me(A1,{anchorElem:t,editor:e,group:c,index:d},c.key))]})}function O1(t,e){let o=Bs(12),[r,n]=v1(!1),l;o[0]!==t?(l=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let m=Us(),p=Ws(t._window),f=t.getRootElement();if(p!==null&&(!Fs(m)||f===null||!f.contains(p.anchorNode))){n(!1);return}if(!Fs(m))return;if(m.getTextContent()!==""){let x=m.getNodes(),C=!1;for(let T of x)if(y1(T)){n(!0),C=!0;break}C||n(!1)}else n(!1);let h=m.getTextContent().replace(/\n/g,"");if(!m.isCollapsed()&&h===""){n(!1);return}})},o[0]=t,o[1]=l):l=o[1];let i=l,s,u;o[2]!==i?(s=()=>(document.addEventListener("selectionchange",i),document.addEventListener("mouseup",i),()=>{document.removeEventListener("selectionchange",i),document.removeEventListener("mouseup",i)}),u=[i],o[2]=i,o[3]=s,o[4]=u):(s=o[3],u=o[4]),At(s,u);let c,d;if(o[5]!==t||o[6]!==i?(c=()=>Hs(t.registerUpdateListener(()=>{i()}),t.registerRootListener(()=>{t.getRootElement()===null&&n(!1)})),d=[t,i],o[5]=t,o[6]=i,o[7]=c,o[8]=d):(c=o[7],d=o[8]),At(c,d),!r||!t.isEditable())return null;let a;return o[9]!==e||o[10]!==t?(a=M1(me($1,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=a):a=o[11],a}var Gs=t=>{let{anchorElem:e}=t,[o]=L1();return O1(o,e)};var F1=M({plugins:[{Component:Gs,position:"floatingAnchorElem"}]});import{TableCellNode as Sg,TableNode as Ng,TableRowNode as Lg}from"@lexical/table";import{jsx as Vs}from"react/jsx-runtime";import"react";var Rr=()=>Vs("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Vs("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 P1,$createTableNode as B1,$createTableRowNode as j1,$isTableCellNode as Ks,$isTableNode as Ir,$isTableRowNode as vr,TableCellHeaderStates as To,TableCellNode as H1,TableNode as U1,TableRowNode as W1}from"@lexical/table";import{$isParagraphNode as G1,$isTextNode as V1}from"lexical";var Xs=/^\|(.+)\|\s?$/,K1=/^(\| ?:?-*:? ?)+\|\s?$/,zs=({allTransformers:t})=>({type:"element",dependencies:[U1,W1,H1],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())Ks(i)&&(n.push(Wt(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(`
58
+ `,ss="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",as="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",Gf=new RegExp("^[^"+as+"]*["+ss+"]"),Vf=new RegExp("^[^"+ss+"]*["+as+"]"),Kf={bold:$.IS_BOLD,code:$.IS_CODE,highlight:$.IS_HIGHLIGHT,italic:$.IS_ITALIC,strikethrough:$.IS_STRIKETHROUGH,subscript:$.IS_SUBSCRIPT,superscript:$.IS_SUPERSCRIPT,underline:$.IS_UNDERLINE},Jf={directionless:$.IS_DIRECTIONLESS,unmergeable:$.IS_UNMERGEABLE},Xf={center:$.IS_ALIGN_CENTER,end:$.IS_ALIGN_END,justify:$.IS_ALIGN_JUSTIFY,left:$.IS_ALIGN_LEFT,right:$.IS_ALIGN_RIGHT,start:$.IS_ALIGN_START},zf={[$.IS_ALIGN_CENTER]:"center",[$.IS_ALIGN_END]:"end",[$.IS_ALIGN_JUSTIFY]:"justify",[$.IS_ALIGN_LEFT]:"left",[$.IS_ALIGN_RIGHT]:"right",[$.IS_ALIGN_START]:"start"},Zf={normal:$.IS_NORMAL,segmented:$.IS_SEGMENTED,token:$.IS_TOKEN},Yf={[$.IS_NORMAL]:"normal",[$.IS_SEGMENTED]:"segmented",[$.IS_TOKEN]:"token"};var cs={text:({node:t})=>{let e=t.text;return t.format&$.IS_BOLD&&(e=Be("strong",{children:e})),t.format&$.IS_ITALIC&&(e=Be("em",{children:e})),t.format&$.IS_STRIKETHROUGH&&(e=Be("span",{style:{textDecoration:"line-through"},children:e})),t.format&$.IS_UNDERLINE&&(e=Be("span",{style:{textDecoration:"underline"},children:e})),t.format&$.IS_CODE&&(e=Be("code",{children:e})),t.format&$.IS_SUBSCRIPT&&(e=Be("sub",{children:e})),t.format&$.IS_SUPERSCRIPT&&(e=Be("sup",{children:e})),e}};import{jsx as Rt}from"react/jsx-runtime";var us={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 tt={...ns,...cs,...es,...Yi,...is,...qi,...Qi,...rs,...os({}),...us,...ls};import{jsx as ms,Fragment as qf}from"react/jsx-runtime";import kr from"react";function ds(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 ps({converters:t,data:e,disableIndent:o,disableTextAlign:r}){return ds(e)?fs({converters:t,disableIndent:o,disableTextAlign:r,nodes:e?.root?.children,parent:e?.root}):ms(qf,{})}function fs({converters:t,disableIndent:e,disableTextAlign:o,nodes:r,parent:n}){let l=t.unknown;return r.map((s,u)=>{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 d;c?d=typeof c=="function"?c({childIndex:u,converters:t,node:s,nodesToJSX:p=>fs({converters:p.converters??t,disableIndent:p.disableIndent??e,disableTextAlign:p.disableTextAlign??o,nodes:p.nodes,parent:p.parent??{...s,parent:n}}),parent:n}):c:d=ms("span",{children:"unknown node"},u);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`),kr.isValidElement(d)){if(a.textAlign||a.paddingInlineStart){let m={...a,...d?.props?.style??{}};return kr.cloneElement(d,{key:u,style:m})}return kr.cloneElement(d,{key:u})}return d}catch(d){return console.error("Error converting lexical node to JSX:",d,"node:",s),null}}).filter(Boolean)}var _r=({className:t,converters:e,data:o,disableContainer:r,disableIndent:n,disableTextAlign:l})=>{if(!o)return null;let i={};e?typeof e=="function"?i=e({defaultConverters:tt}):i=e:i=tt;let s=o&&!Array.isArray(o)&&typeof o=="object"&&"root"in o&&ps({converters:i,data:o,disableIndent:n,disableTextAlign:l});return r?hs(Qf,{children:s}):hs("div",{className:t??"payload-richtext",children:s})};function xs(){let t=e0(7),[e]=t0(),o;t[0]!==e?(o=e.getEditorState().toJSON(),t[0]=e,t[1]=o):o=t[1];let[r,n]=r0(o),l,i;t[2]!==e?(l=()=>e.registerUpdateListener(u=>{let{editorState:c}=u;n(c.toJSON())}),i=[e],t[2]=e,t[3]=l,t[4]=i):(l=t[3],i=t[4]),o0(l,i);let s;return t[5]!==r?(s=gs("div",{className:"debug-jsx-converter",children:gs(_r,{converters:tt,data:r})}),t[5]=r,t[6]=s):s=t[6],s}var n0=M({plugins:[{Component:xs,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)"}},l0={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 W0}from"lexical";import{jsx as It,jsxs as i0}from"react/jsx-runtime";import"react";var Tr=()=>i0("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 c0}from"react/jsx-runtime";import*as bs from"react";import{DecoratorBlockNode as s0}from"@lexical/react/LexicalDecoratorBlockNode.js";function a0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Cs({relationTo:o,value:e})}:null}var vt=class extends s0{__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:a0,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=Cs(o);return r.setFormat(e.format),r}static isInline(){return!1}decorate(e,o){return null}exportDOM(){let e=document.createElement("div");e.setAttribute("data-lexical-relationship-id",String(typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value)),e.setAttribute("data-lexical-relationship-relationTo",this.__data?.relationTo);let o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"relationship",version:2}}getData(){return this.getLatest().__data}getTextContent(){return`${this.__data?.relationTo} relation to ${typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value}`}setData(e){let o=this.getWritable();o.__data=e}};function Cs(t){return new vt({data:t})}var u0=bs.lazy(()=>import("./RelationshipComponent-APF3CN47.js").then(t=>({default:t.RelationshipComponent})));function d0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:je({relationTo:o,value:e})}:null}var Te=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:d0,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},r=je(o);return r.setFormat(e.format),r}decorate(e,o){return c0(u0,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function je(t){return new Te({data:t})}function wr(t){return t instanceof Te}import{c as R0}from"react/compiler-runtime";import{jsx as I0}from"react/jsx-runtime";import{useLexicalComposerContext as v0}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as M0}from"@lexical/utils";import{useConfig as D0}from"@payloadcms/ui";import{$getPreviousSelection as A0,$getSelection as $0,$isParagraphNode as O0,$isRangeSelection as F0,COMMAND_PRIORITY_EDITOR as P0,createCommand as B0}from"lexical";import{useEffect as j0}from"react";import{c as w0}from"react/compiler-runtime";import{jsx as go}from"react/jsx-runtime";import{useLexicalComposerContext as E0}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as S0,COMMAND_PRIORITY_EDITOR as N0}from"lexical";import{useEffect as L0,useState as Ts}from"react";import{c as m0}from"react/compiler-runtime";import{jsx as p0}from"react/jsx-runtime";import{useLexicalComposerContext as f0}from"@lexical/react/LexicalComposerContext";import{useListDrawer as h0,useModal as g0}from"@payloadcms/ui";import{$getNodeByKey as ks,$getPreviousSelection as x0,$getRoot as C0,$getSelection as b0,$isRangeSelection as k0,$setSelection as _0}from"lexical";import{useEffect as T0,useState as _s}from"react";var Mt=t=>{let e=m0(23),[o]=f0(),[r,n]=_s(null),[l,i]=_s(!1),[s,u,c]=h0(t),{closeDrawer:d,drawerSlug:a,isDrawerOpen:m,openDrawer:p}=c,{modalState:f}=g0(),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let O=b0()??x0();n(O)},e[0]=h):h=e[0];let C=h,g;e[1]!==o||e[2]!==r?(g=()=>{r&&o.update(()=>{if(k0(r)){let{anchor:O,focus:v}=r;ks(O.key)&&ks(v.key)&&_0(r.clone())}else C0().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=r,e[3]=g):g=e[3];let T=g,S;e[4]!==d?(S=()=>{d()},e[4]=d,e[5]=S):S=e[5];let b=S,k,x;e[6]!==a||e[7]!==f||e[8]!==T||e[9]!==l?(k=()=>{if(!l)return;let O=f[a];O&&!O?.isOpen&&(i(!1),setTimeout(()=>{T()},1))},x=[f,a,T,l],e[6]=a,e[7]=f,e[8]=T,e[9]=l,e[10]=k,e[11]=x):(k=e[10],x=e[11]),T0(k,x);let w;e[12]!==u?(w=O=>p0(u,{...O,onClick:()=>{C()}}),e[12]=u,e[13]=w):w=e[13];let _;e[14]!==p?(_=()=>{C(),p(),i(!0)},e[14]=p,e[15]=_):_=e[15];let y;return e[16]!==s||e[17]!==b||e[18]!==m||e[19]!==a||e[20]!==w||e[21]!==_?(y={closeListDrawer:b,isListDrawerOpen:m,ListDrawer:s,listDrawerSlug:a,ListDrawerToggler:w,openListDrawer:_},e[16]=s,e[17]=b,e[18]=m,e[19]=a,e[20]=w,e[21]=_,e[22]=y):y=e[22],y};var y0=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=S0(o);n&&n.replace(je({relationTo:e,value:r}))}):t.dispatchCommand(Er,{relationTo:e,value:r})},ws=t=>{let e=w0(16),{enabledCollectionSlugs:o}=t,[r]=E0(),n;e[0]!==o?.[0]?(n=()=>o?.[0],e[0]=o?.[0],e[1]=n):n=e[1];let[l]=Ts(n),[i,s]=Ts(null),u=o||void 0,c;e[2]!==l||e[3]!==u?(c={collectionSlugs:u,selectedCollection:l},e[2]=l,e[3]=u,e[4]=c):c=e[4];let{closeListDrawer:d,ListDrawer:a,openListDrawer:m}=Mt(c),p,f;e[5]!==r||e[6]!==m?(p=()=>r.registerCommand(mt,T=>(s(T?.replace?T?.replace.nodeKey:null),m(),!0),N0),f=[r,m],e[5]=r,e[6]=m,e[7]=p,e[8]=f):(p=e[7],f=e[8]),L0(p,f);let h;e[9]!==d||e[10]!==r||e[11]!==i?(h=T=>{let{collectionSlug:S,doc:b}=T;y0({editor:r,relationTo:S,replaceNodeKey:i,value:b.id}),d()},e[9]=d,e[10]=r,e[11]=i,e[12]=h):h=e[12];let C=h,g;return e[13]!==a||e[14]!==C?(g=go(a,{onSelect:C}),e[13]=a,e[14]=C,e[15]=g):g=e[15],g},Es=t=>(t?.enabledCollectionSlugs?.length??-1)>0?go(ws,{...t}):go(Gt,{...t,children:go(ws,{...t})});var Er=B0("INSERT_RELATIONSHIP_COMMAND"),Ss=t=>{let e=R0(5),{clientProps:o}=t,[r]=v0(),{config:n}=D0(),{collections:l}=n,i=null;if(o?.enabledCollections)i=o?.enabledCollections;else if(o?.disabledCollections){let c;e[0]!==o?.disabledCollections?(c=d=>{let{slug:a}=d;return!o?.disabledCollections?.includes(a)},e[0]=o?.disabledCollections,e[1]=c):c=e[1],i=l.filter(c).map(H0)}let s,u;return e[2]!==r?(s=()=>{if(!r.hasNodes([Te]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return r.registerCommand(Er,U0,P0)},u=[r],e[2]=r,e[3]=s,e[4]=u):(s=e[3],u=e[4]),j0(s,u),I0(Es,{enabledCollectionSlugs:i})};function H0(t){let{slug:e}=t;return e}function U0(t){let e=$0()||A0();if(F0(e)){let o=je(t),{focus:r}=e,n=r.getNode();M0(o),O0(n)&&!n.__first&&n.remove()}return!0}var G0=M({nodes:[Te],plugins:[{Component:Ss,position:"normal"}],slashMenu:{groups:[z([{Icon:Tr,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(mt,{replace:!1})}}])]},toolbarFixed:{groups:[xe([{ChildComponent:Tr,isActive:({selection:t})=>{if(!W0(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return wr(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(mt,{replace:!1})}}])]}});import{c as As}from"react/compiler-runtime";import{jsx as ae,jsxs as x1}from"react/jsx-runtime";import{useLexicalComposerContext as C1}from"@lexical/react/LexicalComposerContext.js";import{useScrollInfo as b1,useThrottledEffect as k1,useTranslation as _1}from"@payloadcms/ui";import*as we from"react";import{useMemo as T1}from"react";import{c as V0}from"react/compiler-runtime";import{jsx as K0}from"react/jsx-runtime";import{mergeRegister as J0}from"@lexical/utils";import{$addUpdateTag as X0,$getSelection as z0}from"lexical";import{useDeferredValue as Z0,useEffect as Y0,useState as q0}from"react";var Ns="toolbar-popup__button",Dt=t=>{let e=V0(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]=q0(l),u=Z0(i),c=j(),d=u.enabled?"":"disabled",a=u.active?"active":"",m=n.key?`${Ns}-${n.key}`:"",p;e[1]!==d||e[2]!==a||e[3]!==m?(p=[Ns,d,a,m].filter(Boolean),e[1]=d,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 _=z0();if(!_)return;let y=n.isActive?n.isActive({editor:r,editorConfigContext:c,selection:_}):!1,O=n.isEnabled?n.isEnabled({editor:r,editorConfigContext:c,selection:_}):!0;s(v=>v.active===y&&v.enabled===O?v:{active:y,enabled:O})})},e[5]=r,e[6]=c,e[7]=n,e[8]=h):h=e[8];let C=h,g=Vt(),T,S;e[9]!==r||e[10]!==g||e[11]!==C?(T=()=>{g(C);let _=()=>g(C),y=J0(r.registerUpdateListener(_));return document.addEventListener("mouseup",_),()=>{y(),document.removeEventListener("mouseup",_)}},S=[r,g,C],e[9]=r,e[10]=g,e[11]=C,e[12]=T,e[13]=S):(T=e[12],S=e[13]),Y0(T,S);let b;e[14]!==i||e[15]!==r||e[16]!==n?(b=()=>{i.enabled&&r.focus(()=>{r.update(Q0),n.onSelect?.({editor:r,isActive:i.active})})},e[14]=i,e[15]=r,e[16]=n,e[17]=b):b=e[17];let k=b,x=e1,w;return e[18]!==o||e[19]!==f||e[20]!==k||e[21]!==n.key?(w=K0("button",{className:f,"data-button-key":n.key,onClick:k,onMouseDown:x,type:"button",children:o}),e[18]=o,e[19]=f,e[20]=k,e[21]=n.key,e[22]=w):w=e[22],w};function Q0(){X0("toolbar")}function e1(t){t.preventDefault()}import{c as s1}from"react/compiler-runtime";import{jsx as ot}from"react/jsx-runtime";import Ds,{useCallback as a1,useDeferredValue as c1,useEffect as u1,useMemo as d1}from"react";import{mergeRegister as m1}from"@lexical/utils";import{useTranslation as p1}from"@payloadcms/ui";import{$getSelection as f1}from"lexical";import{jsx as Re,jsxs as Ls}from"react/jsx-runtime";import{Button as t1}from"@payloadcms/ui";import{$addUpdateTag as o1,isDOMNode as r1}from"lexical";import xo,{useCallback as n1,useEffect as Co,useMemo as Rs,useRef as Sr,useState as Nr}from"react";import{createPortal as l1}from"react-dom";var ys="toolbar-popup__dropdown-item",Is=xo.createContext(null);function vs({active:t,children:e,editor:o,enabled:r,Icon:n,item:l,itemKey:i,tooltip:s}){let u=Rs(()=>[ys,r===!1?"disabled":"",t?"active":"",l?.key?`${ys}-${l.key}`:""].filter(Boolean).join(" "),[r,t,l.key]),c=Sr(null),d=xo.use(Is);if(d===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=d;return Co(()=>{c?.current!=null&&a(c)},[c,a]),Re(t1,{"aria-label":s,buttonStyle:"none",className:u,disabled:r===!1,extraButtonProps:{"data-item-key":i},icon:n,iconPosition:"left",iconStyle:"none",onClick:()=>{r!==!1&&o.focus(()=>{o.update(()=>{o1("toolbar")}),l.onSelect?.({editor:o,isActive:t})})},onMouseDown:m=>{m.preventDefault()},ref:c,tooltip:s,type:"button",children:e})}function i1({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:r}){let[n,l]=Nr(),[i,s]=Nr(),u=n1(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])},d=Rs(()=>({registerItem:u}),[u]);return Co(()=>{n!=null&&i==null&&s(n[0]),i!=null&&i?.current!=null&&i.current.focus()},[n,i]),Re(Is,{value:d,children:Re("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:c,ref:e,children:t})})}function Ms({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:r=!1,dropdownKey:n,Icon:l,itemsContainerClassNames:i,label:s,stopCloseOnClickSelf:u}){let c=Sr(null),d=Sr(null),[a,m]=Nr(!1),p=()=>{m(!1),d?.current!=null&&d.current.focus()};Co(()=>{let h=d.current,C=c.current;if(a&&h!==null&&C!==null){let{left:g,top:T}=h.getBoundingClientRect(),S=window.scrollY||document.documentElement.scrollTop;C.style.top=`${T+S+h.offsetHeight+5}px`,C.style.left=`${Math.min(g-5,window.innerWidth-C.offsetWidth-20)}px`}},[c,d,a]),Co(()=>{let h=d.current;if(h!==null&&a){let C=g=>{let T=g.target;r1(T)&&(u&&c.current&&c.current.contains(T)||h.contains(T)||m(!1))};return document.addEventListener("click",C),()=>{document.removeEventListener("click",C)}}},[c,d,a,u]);let f=l1(Re(i1,{dropDownRef:c,itemsContainerClassNames:i,onClose:p,children:o}),document.body);return Ls(xo.Fragment,{children:[Ls("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:d,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",h1=t=>{let e=s1(14),{active:o,anchorElem:r,editor:n,enabled:l,item:i}=t,{i18n:s}=p1(),{fieldProps:u}=j(),{featureClientSchemaMap:c,schemaPath:d}=u;if(i.Component){let m;return e[0]!==o||e[1]!==r||e[2]!==n||e[3]!==l||e[4]!==i?(m=i?.Component&&ot(i.Component,{active:o,anchorElem:r,editor:n,enabled:l,item:i},i.key),e[0]=o,e[1]=r,e[2]=n,e[3]=l,e[4]=i,e[5]=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]!==d){let m=i.key,p;i.label&&(m=typeof i.label=="function"?i.label({featureClientSchemaMap:c,i18n:s,schemaPath:d}):i.label),m.length>25?p=m.substring(0,25)+"...":p=m,a=ot(vs,{active:o,editor:n,enabled:l,Icon:i?.ChildComponent?ot(i.ChildComponent,{}):void 0,item:i,itemKey:i.key,tooltip:m,children:ot("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]=d,e[13]=a}else a=e[13];return a},g1=Ds.memo(h1),He=({anchorElem:t,classNames:e,editor:o,group:r,Icon:n,itemsContainerClassNames:l,label:i,maxActiveItems:s,onActiveChange:u})=>{let[c,d]=Ds.useState({activeItemKeys:[],enabledGroup:!0,enabledItemKeys:[]}),a=c1(c),m=j(),{items:p,key:f}=r,h=Vt(),C=a1(()=>{o.getEditorState().read(()=>{let T=f1();if(!T)return;let S=[],b=[],k=[];for(let x of p)x.isActive&&(!s||S.length<s)&&x.isActive({editor:o,editorConfigContext:m,selection:T})&&(S.push(x.key),b.push(x)),x.isEnabled?x.isEnabled({editor:o,editorConfigContext:m,selection:T})&&k.push(x.key):k.push(x.key);d({activeItemKeys:S,enabledGroup:r.isEnabled?r.isEnabled({editor:o,editorConfigContext:m,selection:T}):!0,enabledItemKeys:k}),u&&u({activeItems:b})})},[o,m,r,p,s,u]);u1(()=>(h(C),m1(o.registerUpdateListener(async()=>{await h(C)}))),[o,h,C]);let g=d1(()=>p?.length?p.map(T=>ot(g1,{active:a.activeItemKeys.includes(T.key),anchorElem:t,editor:o,enabled:a.enabledItemKeys.includes(T.key),item:T},T.key)):null,[p,a,t,o]);return ot(Ms,{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:g},f)};function w1({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&ae(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?ae(Dt,{editor:e,item:o,children:ae(o.ChildComponent,{})},o.key):null}function E1(t){let e=As(23),{anchorElem:o,editor:r,editorConfig:n,group:l,index:i}=t,{i18n:s}=_1(),{fieldProps:u}=j(),{featureClientSchemaMap:c,schemaPath:d}=u,[a,m]=we.useState(void 0),[p,f]=we.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 C;e[4]!==l?(C=[l],e[4]=l,e[5]=C):C=e[5],we.useEffect(h,C);let g;e[6]!==c||e[7]!==l.ChildComponent||e[8]!==l.items||e[9]!==l.type||e[10]!==s||e[11]!==d?(g=k=>{let{activeItems:x}=k;if(!x.length){l?.type==="dropdown"&&l.items.length&&l.ChildComponent?(f(()=>l.ChildComponent),m(void 0)):(f(void 0),m(void 0));return}let w=x[0],_=w.key;w.label&&(_=typeof w.label=="function"?w.label({featureClientSchemaMap:c,i18n:s,schemaPath:d}):w.label),_.length>25&&(_=_.substring(0,25)+"..."),x.length===1?(m(_),f(()=>w.ChildComponent)):(m(s.t("lexical:general:toolbarItemsActive",{count:x.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]=d,e[12]=g):g=e[12];let T=g,S=`fixed-toolbar__group fixed-toolbar__group-${l.key}`,b;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]!==T||e[21]!==S?(b=x1("div",{className:S,"data-toolbar-group-key":l.key,children:[l.type==="dropdown"&&l.items.length?p?ae(He,{anchorElem:o,editor:r,group:l,Icon:p,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:l.maxActiveItems??1,onActiveChange:T}):ae(He,{anchorElem:o,editor:r,group:l,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:l.maxActiveItems??1,onActiveChange:T}):null,l.type==="buttons"&&l.items.length?l.items.map(k=>ae(w1,{anchorElem:o,editor:r,item:k},k.key)):null,i<n.features.toolbarFixed?.groups.length-1&&ae("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]=T,e[21]=S,e[22]=b):b=e[22],b}function S1({anchorElem:t,clientProps:e,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let l=we.useRef(null),{y:i}=b1(),s=T1(()=>{if(!n||e?.disableIfParentHasFixedToolbar)return null;let c=n.editorContainerRef.current.previousElementSibling;for(;c;){if(c.classList.contains("fixed-toolbar"))return c;c=c.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,n]);return k1(()=>{if(!s)return;let u=l.current;if(!u)return;let c=u.getBoundingClientRect(),d=s.getBoundingClientRect();if(!(c.bottom<d.top||c.top>d.bottom))u.classList.remove("fixed-toolbar"),u.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),s.classList.remove("fixed-toolbar"),s.classList.add("fixed-toolbar","fixed-toolbar--hide");else{if(!u.classList.contains("fixed-toolbar--overlapping"))return;u.classList.remove("fixed-toolbar--overlapping"),u.classList.add("fixed-toolbar"),s.classList.remove("fixed-toolbar--hide"),s.classList.add("fixed-toolbar")}},50,[l,s,i]),ae("div",{className:"fixed-toolbar",onFocus:u=>{u.stopPropagation()},ref:l,children:o.isEditable()&&ae(we.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((u,c)=>ae(E1,{anchorElem:t,editor:o,editorConfig:r,group:u,index:c},u.key))})})}var $s=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return $s(t.parentEditor)}return!1},Os=t=>{let e=As(6),{clientProps:o}=t,[r]=C1(),n=j(),{editorConfig:l}=n,i=o.applyToFocusedEditor&&n.focusedEditor?.editor||r,s=o.applyToFocusedEditor&&n.focusedEditor?.editorConfig||l,u,c;if(e[0]!==o.disableIfParentHasFixedToolbar||e[1]!==i||e[2]!==s||e[3]!==n){c=Symbol.for("react.early_return_sentinel");e:{let d=$s(n);if(o?.disableIfParentHasFixedToolbar&&d){c=null;break e}if(!s?.features?.toolbarFixed?.groups?.length){c=null;break e}u=ae(S1,{anchorElem:document.body,editor:i,editorConfig:s,parentWithFixedToolbar:d})}e[0]=o.disableIfParentHasFixedToolbar,e[1]=i,e[2]=s,e[3]=n,e[4]=u,e[5]=c}else u=e[4],c=e[5];return c!==Symbol.for("react.early_return_sentinel")?c:u};var N1=M({plugins:[{Component:Os,position:"aboveContainer"}]});import{c as Bs}from"react/compiler-runtime";import{jsx as me,jsxs as js}from"react/jsx-runtime";import{useLexicalComposerContext as L1}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Hs}from"@lexical/utils";import{$getSelection as Us,$isRangeSelection as Fs,$isTextNode as y1,COMMAND_PRIORITY_LOW as R1,getDOMSelection as Ws,SELECTION_CHANGE_COMMAND as I1}from"lexical";import{useCallback as ko,useEffect as At,useRef as Ps,useState as v1}from"react";import*as _o from"react";import{createPortal as M1}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:u,verticalGap:c=10}=t,d=o.parentElement;if(u===null||d==null){n.style.opacity="0",n.style.transform="translate(-10000px, -10000px)";return}let a=n.getBoundingClientRect(),m=o.getBoundingClientRect(),p=d.getBoundingClientRect(),f=u.top-a.height-c,h=u.left-l;i==="center"&&(h=u.left+u.width/2-a.width/2);let C=0;return!e&&f<p.top&&!s&&(C=a.height+u.height+c*2,f+=C),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)`),C}function D1({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&me(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?me(Dt,{editor:e,item:o,children:me(o.ChildComponent,{})},o.key):null}function A1(t){let e=Bs(19),{anchorElem:o,editor:r,group:n,index:l}=t,{editorConfig:i}=j(),[s,u]=_o.useState(),c;e[0]!==n.ChildComponent||e[1]!==n.items||e[2]!==n.type?(c=()=>{n?.type==="dropdown"&&n.items.length&&n.ChildComponent?u(()=>n.ChildComponent):u(void 0)},e[0]=n.ChildComponent,e[1]=n.items,e[2]=n.type,e[3]=c):c=e[3];let d;e[4]!==n?(d=[n],e[4]=n,e[5]=d):d=e[5],_o.useEffect(c,d);let a;e[6]!==n.ChildComponent||e[7]!==n.items||e[8]!==n.type?(a=h=>{let{activeItems:C}=h;if(!C.length){n?.type==="dropdown"&&n.items.length&&n.ChildComponent?u(()=>n.ChildComponent):u(void 0);return}let g=C[0];u(()=>g?.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=js("div",{className:p,"data-toolbar-group-key":n.key,children:[n.type==="dropdown"&&n.items.length?s?me(He,{anchorElem:o,editor:r,group:n,Icon:s,maxActiveItems:n.maxActiveItems??1,onActiveChange:m}):me(He,{anchorElem:o,editor:r,group:n,maxActiveItems:n.maxActiveItems??1,onActiveChange:m}):null,n.type==="buttons"&&n.items.length?n.items.map(h=>me(D1,{anchorElem:o,editor:r,item:h},h.key)):null,l<i.features.toolbarInline?.groups.length-1&&me("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 $1({anchorElem:t,editor:e}){let o=Ps(null),r=Ps(null),{editorConfig:n}=j(),l=ko(()=>{if(o?.current){let c=o.current.style.opacity==="0",d=o.current.style.pointerEvents==="none";c||(o.current.style.opacity="0"),d||(o.current.style.pointerEvents="none")}},[o]),i=ko(c=>{if(o?.current&&(c.buttons===1||c.buttons===3)){let d=o.current.style.opacity==="0",a=o.current.style.pointerEvents==="none";if(!d||!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"))},[]);At(()=>(document.addEventListener("mousemove",i),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",s)}),[o,i,s]);let u=ko(()=>{let c=Us(),d=Ws(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&&d!==null&&!d.isCollapsed&&p!==null&&p.contains(d.anchorNode)){let f=yr(d,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 At(()=>{let c=t.parentElement,d=()=>{e.getEditorState().read(()=>{u()})};return window.addEventListener("resize",d),c&&c.addEventListener("scroll",d),()=>{window.removeEventListener("resize",d),c&&c.removeEventListener("scroll",d)}},[e,u,t]),At(()=>(e.getEditorState().read(()=>{u()}),Hs(e.registerUpdateListener(({editorState:c})=>{c.read(()=>{u()})}),e.registerCommand(I1,()=>(u(),!1),R1))),[e,u]),js("div",{className:"inline-toolbar-popup",ref:o,children:[me("div",{className:"caret",ref:r}),n?.features&&n.features?.toolbarInline?.groups.map((c,d)=>me(A1,{anchorElem:t,editor:e,group:c,index:d},c.key))]})}function O1(t,e){let o=Bs(12),[r,n]=v1(!1),l;o[0]!==t?(l=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let m=Us(),p=Ws(t._window),f=t.getRootElement();if(p!==null&&(!Fs(m)||f===null||!f.contains(p.anchorNode))){n(!1);return}if(!Fs(m))return;if(m.getTextContent()!==""){let C=m.getNodes(),g=!1;for(let T of C)if(y1(T)){n(!0),g=!0;break}g||n(!1)}else n(!1);let h=m.getTextContent().replace(/\n/g,"");if(!m.isCollapsed()&&h===""){n(!1);return}})},o[0]=t,o[1]=l):l=o[1];let i=l,s,u;o[2]!==i?(s=()=>(document.addEventListener("selectionchange",i),document.addEventListener("mouseup",i),()=>{document.removeEventListener("selectionchange",i),document.removeEventListener("mouseup",i)}),u=[i],o[2]=i,o[3]=s,o[4]=u):(s=o[3],u=o[4]),At(s,u);let c,d;if(o[5]!==t||o[6]!==i?(c=()=>Hs(t.registerUpdateListener(()=>{i()}),t.registerRootListener(()=>{t.getRootElement()===null&&n(!1)})),d=[t,i],o[5]=t,o[6]=i,o[7]=c,o[8]=d):(c=o[7],d=o[8]),At(c,d),!r||!t.isEditable())return null;let a;return o[9]!==e||o[10]!==t?(a=M1(me($1,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=a):a=o[11],a}var Gs=t=>{let{anchorElem:e}=t,[o]=L1();return O1(o,e)};var F1=M({plugins:[{Component:Gs,position:"floatingAnchorElem"}]});import{TableCellNode as Sg,TableNode as Ng,TableRowNode as Lg}from"@lexical/table";import{jsx as Vs}from"react/jsx-runtime";import"react";var Rr=()=>Vs("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Vs("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 P1,$createTableNode as B1,$createTableRowNode as j1,$isTableCellNode as Ks,$isTableNode as Ir,$isTableRowNode as vr,TableCellHeaderStates as To,TableCellNode as H1,TableNode as U1,TableRowNode as W1}from"@lexical/table";import{$isParagraphNode as G1,$isTextNode as V1}from"lexical";var Xs=/^\|(.+)\|\s?$/,K1=/^(\| ?:?-*:? ?)+\|\s?$/,zs=({allTransformers:t})=>({type:"element",dependencies:[U1,W1,H1],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())Ks(i)&&(n.push(Wt(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:Xs,replace:(e,o,r)=>{let n=r[0];if(!n)return;if(K1.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=>{Ks(f)&&f.setHeaderStyles(To.ROW,To.ROW)}),e.remove();return}let l=Js(n,t);if(l==null)return;let i=[l],s=e.getPreviousSibling(),u=l.length;for(;s&&!(!G1(s)||s.getChildrenSize()!==1);){let a=s.getFirstChild();if(!V1(a))break;let m=Js(a.getTextContent(),t);if(m==null)break;u=Math.max(u,m.length),i.unshift(m);let p=s.getPreviousSibling();s.remove(),s=p}let c=B1();for(let a of i){let m=j1();c.append(m);for(let p=0;p<u;p++)m.append(p<a.length?a[p]:Zs("",t))}let d=e.getPreviousSibling();Ir(d)&&J1(d)===u?(d.append(...c.getChildren()),e.remove()):e.replace(c),c.selectEnd()}});function J1(t){let e=t.getFirstChild();return vr(e)?e.getChildrenSize():0}var Zs=(t,e)=>{t=t.replace(/\\n/g,`
60
- `);let o=P1(To.NO_STATUS);return Ut(t,e,o),o},Js=(t,e)=>{let o=t.match(Xs);return!o||!o[1]?null:o[1].split("|").map(r=>Zs(r,e))};import{c as z1}from"react/compiler-runtime";import{jsx as P,jsxs as Ee}from"react/jsx-runtime";import{useLexicalComposerContext as ta}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Z1}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as qs,$deleteTableColumnAtSelection as Y1,$deleteTableRowAtSelection as q1,$getNodeTriplet as Q1,$getTableCellNodeFromLexicalNode as Qs,$getTableColumnIndexFromTableCellNode as eh,$getTableNodeFromLexicalNodeOrThrow as ve,$getTableRowIndexFromTableCellNode as th,$insertTableColumnAtSelection as oh,$insertTableRowAtSelection as rh,$isTableCellNode as oa,$isTableSelection as $t,$mergeCells as nh,$unmergeCell as lh,getTableElement as Dr,getTableObserverFromTableElement as Ar,TableCellHeaderStates as Ie,TableCellNode as ih}from"@lexical/table";import{mergeRegister as sh}from"@lexical/utils";import{useScrollInfo as ah}from"@payloadcms/ui";import{$getSelection as Eo,$isElementNode as ch,$isRangeSelection as $r,$isTextNode as uh,$setSelection as dh,COMMAND_PRIORITY_CRITICAL as mh,getDOMSelection as ph,isDOMNode as fh,SELECTION_CHANGE_COMMAND as hh}from"lexical";import*as Or from"react";import{useCallback as ce,useEffect as rt,useRef as wo,useState as nt}from"react";import{createPortal as ra}from"react-dom";import{jsx as Mr,jsxs as X1}from"react/jsx-runtime";import"react";var Ys=()=>X1("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 ea(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function gh(){let t=Eo();if($r(t)&&!t.isCollapsed()||$t(t)&&!t.anchor.is(t.focus)||!$r(t)&&!$t(t))return!1;let[e]=Q1(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function xh(t){let e=t.getLastDescendant();uh(e)?e.select():ch(e)?e.selectEnd():e!==null&&e.selectNext()}function Ch({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[l]=ta(),i=wo(null),[s,u]=nt(n),[c,d]=nt({columns:1,rows:1}),[a,m]=nt(!1),[p,f]=nt(!1),{y:h}=ah();rt(()=>l.registerMutationListener(ih,E=>{E.get(s.getKey())==="updated"&&l.getEditorState().read(()=>{u(s.getLatest())})},{skipInitialization:!0}),[l,s]),rt(()=>{l.getEditorState().read(()=>{let E=Eo();if($t(E)){let L=ea(E);d(ea(E)),m(L.columns>1||L.rows>1)}f(gh())})},[l]),rt(()=>{let E=e.current,L=i.current,D=l.getRootElement();if(E!=null&&L!=null&&D!=null){let I=D.getBoundingClientRect(),A=E.getBoundingClientRect();L.style.opacity="1";let R=L.getBoundingClientRect(),F=5,W=A.right+F;if(W+R.width>window.innerWidth||W+R.width>I.right){let re=A.left-R.width-F;W=(re<0?F:re)+window.pageXOffset}L.style.left=`${W+window.pageXOffset}px`;let Q=A.top;if(Q+R.height>window.innerHeight){let re=A.bottom-R.height;Q=re<0?F:re}L.style.top=`${Q}px`}},[e,i,l,h]),rt(()=>{function E(L){i.current!=null&&e.current!=null&&fh(L.target)&&!i.current.contains(L.target)&&!e.current.contains(L.target)&&r(!1)}return window.addEventListener("click",E),()=>window.removeEventListener("click",E)},[r,e]);let x=ce(()=>{l.update(()=>{if(s.isAttached()){let E=ve(s),L=Dr(E,l.getElementByKey(E.getKey()));if(L===null)throw new Error("Expected to find tableElement in DOM");let D=Ar(L);D!==null&&D.$clearHighlight(),E.markDirty(),u(s.getLatest())}dh(null)})},[l,s]),C=()=>{l.update(()=>{let E=Eo();if(!$t(E))return;let D=E.getNodes().filter(oa),I=nh(D);I&&(xh(I),o())})},T=()=>{l.update(()=>{lh()})},S=ce(E=>{l.update(()=>{for(let L=0;L<c.rows;L++)rh(E);o()})},[l,o,c.rows]),b=ce(E=>{l.update(()=>{for(let L=0;L<c.columns;L++)oh(E);o()})},[l,o,c.columns]),k=ce(()=>{l.update(()=>{q1(),o()})},[l,o]),g=ce(()=>{l.update(()=>{ve(s).remove(),x(),o()})},[l,s,x,o]),w=ce(()=>{l.update(()=>{Y1(),o()})},[l,o]),_=ce(()=>{l.update(()=>{let E=ve(s),L=th(s),[D]=qs(E,null,null),I=new Set,A=s.getHeaderStyles()^Ie.ROW;if(D[L])for(let R=0;R<D[L].length;R++){let F=D[L][R];F?.cell&&(I.has(F.cell)||(I.add(F.cell),F.cell.setHeaderStyles(A,Ie.ROW)))}x(),o()})},[l,s,x,o]),y=ce(()=>{l.update(()=>{let E=ve(s),L=eh(s),[D]=qs(E,null,null),I=new Set,A=s.getHeaderStyles()^Ie.COLUMN;if(D)for(let R=0;R<D.length;R++){let F=D?.[R]?.[L];F?.cell&&(I.has(F.cell)||(I.add(F.cell),F.cell.setHeaderStyles(A,Ie.COLUMN)))}x(),o()})},[l,s,x,o]),O=ce(()=>{l.update(()=>{if(s.isAttached()){let E=ve(s);E&&E.setRowStriping(!E.getRowStriping())}x(),o()})},[l,s,x,o]),v=ce(()=>{l.update(()=>{if(s.isAttached()){let E=ve(s);E&&E.setFrozenColumns(E.getFrozenColumns()===0?1:0)}x(),o()})},[l,s,x,o]),N=null;return t&&(a?N=P("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>C(),type:"button",children:P("span",{className:"text",children:"Merge cells"})}):p&&(N=P("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>T(),type:"button",children:P("span",{className:"text",children:"Unmerge cells"})}))),ra(Ee("div",{className:"table-action-menu-dropdown",onClick:E=>{E.stopPropagation()},ref:i,children:[N?Ee(Or.Fragment,{children:[N,P("hr",{})]}):null,P("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>O(),type:"button",children:P("span",{className:"text",children:"Toggle Row Striping"})}),P("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>v(),type:"button",children:P("span",{className:"text",children:"Toggle First Column Freeze"})}),P("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>S(!1),type:"button",children:Ee("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:()=>S(!0),type:"button",children:Ee("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:()=>b(!1),type:"button",children:Ee("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:()=>b(!0),type:"button",children:Ee("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:()=>w(),type:"button",children:P("span",{className:"text",children:"Delete column"})}),P("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>k(),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:()=>_(),type:"button",children:Ee("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:Ee("span",{className:"text",children:[(s.__headerState&Ie.COLUMN)===Ie.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function bh({anchorElem:t,cellMerge:e}){let[o]=ta(),r=wo(null),n=wo(null),[l,i]=nt(!1),[s,u]=nt(null),c=ce(()=>{let a=r.current,m=Eo(),p=ph(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")),u(null)}if(m==null||a==null)return h();let x=o.getRootElement(),C=null,T=null;if($r(m)&&x!==null&&p!==null&&x.contains(p.anchorNode)){let b=Qs(m.anchor.getNode());if(b==null||(T=o.getElementByKey(b.getKey()),T==null||!b.isAttached()))return h();let k=ve(b),g=Dr(k,o.getElementByKey(k.getKey()));if(g===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");C=Ar(g),u(b)}else if($t(m)){let b=Qs(m.anchor.getNode());if(!oa(b))throw new Error("TableSelection anchorNode must be a TableCellNode");let k=ve(b),g=Dr(k,o.getElementByKey(k.getKey()));if(g===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");C=Ar(g),T=o.getElementByKey(b.getKey())}else if(!f)return h();if(C===null||T===null)return h();let S=!C||!C.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",S),a.classList.toggle("table-cell-action-button-container--inactive",!S),S){let b=T.getBoundingClientRect(),k=t.getBoundingClientRect(),g=b.top-k.top,w=b.right-k.left;a.style.transform=`translate(${w}px, ${g}px)`}},[o,t]);rt(()=>{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(hh,p,mh),o.registerRootListener((f,h)=>{h&&h.removeEventListener("pointerup",p),f&&(f.addEventListener("pointerup",p),p())}),()=>clearTimeout(a))});let d=wo(s);return rt(()=>{d.current!==s&&i(!1),d.current=s},[d,s]),P("div",{className:"table-cell-action-button-container",ref:r,children:s!=null&&Ee(Or.Fragment,{children:[P("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),i(!l)},ref:n,type:"button",children:P(Ys,{})}),l&&P(Ch,{cellMerge:e,contextRef:n,onClose:()=>i(!1),setIsMenuOpen:i,tableCellNode:s})]})})}var na=t=>{let e=z1(3),{anchorElem:o}=t,r=Z1(),n;return e[0]!==o||e[1]!==r?(n=ra(r?P(bh,{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 kh}from"react/compiler-runtime";import{jsx as No,jsxs as _h}from"react/jsx-runtime";import{useLexicalComposerContext as Th}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as wh}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as Eh,$getTableNodeFromLexicalNodeOrThrow as Fr,$getTableRowIndexFromTableCellNode as Sh,$isTableCellNode as la,$isTableRowNode as Nh,getDOMCellFromTarget as Lh,getTableElement as yh,TableNode as ia}from"@lexical/table";import{calculateZoomLevel as sa,mergeRegister as Rh}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Pr,isHTMLElement as Ih,SKIP_SCROLL_INTO_VIEW_TAG as aa}from"lexical";import*as ua from"react";import{useCallback as Ot,useEffect as Br,useRef as So,useState as lt}from"react";import{createPortal as vh}from"react-dom";var Mh=33,ca=92;function Dh({editor:t}){let e=So(null),o=So(null),r=So(null),[n,l]=lt(!1),i=j(),s=So(null),[u,c]=lt(null),[d,a]=lt(null),[m,p]=lt(!1),[f,h]=lt(null),x=Ot(()=>{a(null),e.current=null,h(null),s.current=null,r.current=null},[]),C=v=>(v.buttons&1)===1;Br(()=>{let v=new Set;return Rh(t.registerMutationListener(ia,N=>{for(let[E,L]of N)L==="destroyed"?v.delete(E):v.add(E);l(v.size>0)}),t.registerNodeTransform(ia,N=>{if(N.getColWidths())return N;let E=N.getColumnCount(),L=ca;return N.setColWidths(Array(E).fill(L)),N}))},[t]),Br(()=>{if(!n)return;let v=D=>{let I=D.target;if(Ih(I)){if(f){c({x:D.clientX,y:D.clientY});return}if(p(C(D)),!(o.current&&o.current.contains(I))&&e.current!==I){e.current=I;let A=Lh(I);A&&d!==A?t.getEditorState().read(()=>{let R=Pr(A.elem);if(!R)throw new Error("TableCellResizer: Table cell node not found.");let F=Fr(R),W=yh(F,t.getElementByKey(F.getKey()));if(!W)throw new Error("TableCellResizer: Table element not found.");e.current=I,r.current=W.getBoundingClientRect(),a(A)},{editor:t}):A==null&&x()}}},N=D=>{p(!0)},E=D=>{p(!1)},L=t.registerRootListener((D,I)=>{I?.removeEventListener("mousemove",v),I?.removeEventListener("mousedown",N),I?.removeEventListener("mouseup",E),D?.addEventListener("mousemove",v),D?.addEventListener("mousedown",N),D?.addEventListener("mouseup",E)});return()=>{L()}},[d,f,t,n,x]);let T=v=>v==="bottom",S=Ot(v=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let N=Pr(d.elem);if(!la(N))throw new Error("TableCellResizer: Table cell node not found.");let E=Fr(N),L=Sh(N),D=E.getChildren(),A=N.getColSpan()===E.getColumnCount()?L:L+N.getRowSpan()-1;if(A>=D.length||A<0)throw new Error("Expected table cell to be inside of table row.");let R=D[A];if(!Nh(R))throw new Error("Expected table row");let F=R.getHeight();if(F===void 0){let Q=R.getChildren();F=Math.min(...Q.map(re=>b(re,t)??1/0))}let W=Math.max(F+v,Mh);R.setHeight(W)},{tag:aa})},[d,t]),b=(v,N)=>N.getElementByKey(v.getKey())?.clientHeight,k=(v,N)=>{let E;return N.forEach(L=>{L.forEach((D,I)=>{D.cell===v&&(E=I)})}),E},g=Ot(v=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let N=Pr(d.elem);if(!la(N))throw new Error("TableCellResizer: Table cell node not found.");let E=Fr(N),[L]=Eh(E,null,null),D=k(N,L);if(D===void 0)throw new Error("TableCellResizer: Table column not found.");let I=E.getColWidths();if(!I)return;let A=I[D];if(A===void 0)return;let R=[...I],F=Math.max(A+v,ca);R[D]=F,E.setColWidths(R)},{tag:aa})},[d,t]),w=Ot(v=>{let N=E=>{if(E.preventDefault(),E.stopPropagation(),!d)throw new Error("TableCellResizer: Expected active cell.");if(s.current){let{x:L,y:D}=s.current;if(d===null)return;let I=sa(E.target);if(T(v)){let A=(E.clientY-D)/I;S(A)}else{let A=(E.clientX-L)/I;g(A)}x(),document.removeEventListener("mouseup",N)}};return N},[d,x,g,S]),_=Ot(v=>N=>{if(N.preventDefault(),N.stopPropagation(),!d)throw new Error("TableCellResizer: Expected active cell.");s.current={x:N.clientX,y:N.clientY},c(s.current),h(v),document.addEventListener("mouseup",w(v))},[d,w]),[y,O]=lt({bottom:null,left:null,right:null,top:null});return Br(()=>{if(d){let{height:v,left:N,top:E,width:L}=d.elem.getBoundingClientRect(),D=sa(d.elem),I=10,A={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${I}px`,left:`${window.scrollX+N}px`,top:`${window.scrollY+E+v-I/2}px`,width:`${L}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${v}px`,left:`${window.scrollX+N+L-I/2}px`,top:`${window.scrollY+E}px`,width:`${I}px`}},R=r.current;f&&u&&R&&(T(f)?(A[f].left=`${window.scrollX+R.left}px`,A[f].top=`${window.scrollY+u.y/D}px`,A[f].height="3px",A[f].width=`${R.width}px`):(A[f].top=`${window.scrollY+R.top}px`,A[f].left=`${window.scrollX+u.x/D}px`,A[f].width="3px",A[f].height=`${R.height}px`),A[f].backgroundColor="#adf"),O(A)}else O({bottom:null,left:null,right:null,top:null})},[d,f,u]),No("div",{ref:o,children:d!=null&&!m&&_h(ua.Fragment,{children:[No("div",{className:`${i.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:_("right"),style:y.right||void 0}),No("div",{className:`${i.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:_("bottom"),style:y.bottom||void 0})]})})}var da=()=>{let t=kh(3),[e]=Th(),o=wh(),r;return t[0]!==e||t[1]!==o?(r=o?vh(No(Dh,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=r):r=t[2],r};import{c as Hh}from"react/compiler-runtime";import{jsx as jr,jsxs as Uh,Fragment as Wh}from"react/jsx-runtime";import{useLexicalComposerContext as ba}from"@lexical/react/LexicalComposerContext";import{$getTableAndElementByKey as Gh,$getTableColumnIndexFromTableCellNode as Vh,$getTableRowIndexFromTableCellNode as Kh,$insertTableColumnAtSelection as Jh,$insertTableRowAtSelection as Xh,$isTableCellNode as zh,$isTableNode as fa,getTableElement as Zh,TableNode as Yh}from"@lexical/table";import{$findMatchingParent as qh,mergeRegister as Qh}from"@lexical/utils";import{$getNearestNodeFromDOMNode as ha,isHTMLElement as eg}from"lexical";import{useEffect as ga,useMemo as tg,useRef as xa,useState as Lo}from"react";import"react";import{createPortal as og}from"react-dom";import{c as Ph}from"react/compiler-runtime";import{useEffect as Bh,useRef as jh}from"react";var Ah="Expected a function",$h=Math.max,Oh=Math.min;function Fh(t,e,o){let r,n,l=0,i,s=!1,u=!1,c,d,a,m=!0;if(typeof t!="function")throw new TypeError(Ah);e=e||0,typeof o=="object"&&(s=!!o.leading,u="maxWait"in o,c=u?$h(o.maxWait||0,e):c,m="trailing"in o?!!o.trailing:m);function p(g){let w=r,_=i;return r=i=void 0,l=g,d=t.apply(_,w),d}function f(g){return l=g,a=setTimeout(C,e),s?p(g):d}function h(g){let w=g-n,_=g-l,y=e-w;return u?Oh(y,c-_):y}function x(g){let w=g-n,_=g-l;return n===void 0||w>=e||w<0||u&&_>=c}function C(){let g=Date.now();if(x(g))return T(g);a=setTimeout(C,h(g))}function T(g){return a=void 0,m&&r?p(g):(r=i=void 0,d)}function S(){a!==void 0&&clearTimeout(a),l=0,r=n=i=a=void 0}function b(){return a===void 0?d:T(Date.now())}function k(){let g=Date.now(),w=x(g);if(r=arguments,i=this,n=g,w){if(a===void 0)return f(n);if(u)return clearTimeout(a),a=setTimeout(C,e),p(n)}return a===void 0&&(a=setTimeout(C,e)),d}return k.cancel=S,k.flush=b,k}var ma=Fh;function pa(t,e,o){let r=Ph(6),n=jh(null),l,i;r[0]!==t||r[1]!==o||r[2]!==e?(l=()=>(n.current=ma(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]),Bh(l,i);let s;return r[5]===Symbol.for("react.memo_cache_sentinel")?(s=(...c)=>{let d=c;n.current&&n.current(...d)},r[5]=s):s=r[5],s}var Ca=20;function rg({anchorElem:t}){let[e]=ba(),o=j(),[r,n]=Lo(!1),[l,i]=Lo(!1),[s,u]=Lo(!1),[c,d]=Lo({}),a=xa(new Set),m=xa(null),p=pa(x=>{let{isOutside:C,tableDOMNode:T}=ng(x,o.editorConfig?.lexical);if(C){n(!1),i(!1);return}if(!T)return;m.current=T;let S=null,b=null,k=null;if(e.getEditorState().read(()=>{let I=ha(T);if(zh(I)){let A=qh(I,R=>fa(R));if(!fa(A))return;if(k=Zh(A,e.getElementByKey(A.getKey())),k){let R=A.getChildrenSize(),F=A.getChildAtIndex(0)?.getChildrenSize(),W=Kh(I),Q=Vh(I);W===R-1?S=I:Q===F-1&&(b=I)}}},{editor:e}),!k)return;let g=k.parentElement;if(!g)return;let{bottom:w,height:_,left:y,right:O,width:v,y:N}=k.getBoundingClientRect(),E=!1;g&&g.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(E=g.scrollWidth>g.clientWidth);let{left:L,y:D}=t.getBoundingClientRect();S?(i(!1),n(!0),d({height:Ca,left:E&&g?g.offsetLeft:y-L,top:w-D+5,width:E&&g?g.offsetWidth:v})):b&&(i(!0),n(!1),d({height:_,left:O-L+5,top:N-D,width:Ca}))},50,250),f=tg(()=>new ResizeObserver(()=>{n(!1),i(!1)}),[]);ga(()=>{if(s)return document.addEventListener("mousemove",p),()=>{n(!1),i(!1),document.removeEventListener("mousemove",p)}},[s,p]),ga(()=>Qh(e.registerMutationListener(Yh,x=>{e.getEditorState().read(()=>{let C=!1;for(let[T,S]of x)switch(S){case"created":{a.current.add(T),C=!0;break}case"destroyed":{a.current.delete(T),C=!0;break}default:break}if(C){f.disconnect();for(let T of a.current){let{tableElement:S}=Gh(T);f.observe(S)}u(a.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,f]);let h=x=>{e.update(()=>{m.current&&(ha(m.current)?.selectEnd(),x?(Xh(),n(!1)):(Jh(),i(!1)))})};return e?.isEditable()?Uh(Wh,{children:[r&&jr("button",{"aria-label":"Add Row",className:o.editorConfig.lexical.theme.tableAddRows,onClick:()=>h(!0),style:{...c},type:"button"}),l&&jr("button",{"aria-label":"Add Column",className:o.editorConfig.lexical.theme.tableAddColumns,onClick:()=>h(!1),style:{...c},type:"button"})]}):null}function ng(t,e){let o=t.target;if(eg(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 ka(t){let e=Hh(2),{anchorElem:o}=t,r=o===void 0?document.body:o,[n]=ba();if(!n?.isEditable())return null;let l;return e[0]!==r?(l=og(jr(rg,{anchorElem:r}),r),e[0]=r,e[1]=l):l=e[1],l}import{c as lg}from"react/compiler-runtime";import{jsx as Hr,jsxs as ig}from"react/jsx-runtime";import{useLexicalComposerContext as sg}from"@lexical/react/LexicalComposerContext";import{TablePlugin as ag}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as cg,TableCellNode as ug,TableNode as dg,TableRowNode as mg}from"@lexical/table";import{mergeRegister as pg}from"@lexical/utils";import{formatDrawerSlug as fg,useEditDepth as hg}from"@payloadcms/ui";import{$getSelection as gg,$isRangeSelection as xg,COMMAND_PRIORITY_EDITOR as Cg,createCommand as bg}from"lexical";import{createContext as kg,use as _g,useEffect as Tg,useMemo as wg,useState as Eg}from"react";import*as _a from"react";var yo=bg("OPEN_EMBED_DRAWER_COMMAND"),Ta=kg({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function wa({children:t}){let[e,o]=Eg({cellEditorConfig:null,cellEditorPlugins:null});return Hr(Ta,{value:wg(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var Ea=()=>{let t=lg(16),[e]=sg(),o=_g(Ta),r=hg(),{fieldProps:n,uuid:l}=j(),{schemaPath:i}=n,s="lexical-table-create-"+l,u;t[0]!==r||t[1]!==s?(u=fg({slug:s,depth:r}),t[0]=r,t[1]=s,t[2]=u):u=t[2];let c=u,{toggleDrawer:d}=fe(c,!0),a;t[3]!==e||t[4]!==d?(a=()=>{if(!e.hasNodes([dg,mg,ug]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return pg(e.registerCommand(yo,()=>{let h=null;return e.getEditorState().read(()=>{let x=gg();xg(x)&&(h=x)}),h&&d(),!0},Cg))},t[3]=e,t[4]=d,t[5]=a):a=t[5];let m;t[6]!==o||t[7]!==e||t[8]!==d?(m=[o,e,d],t[6]=o,t[7]=e,t[8]=d,t[9]=m):m=t[9],Tg(a,m);let p;t[10]!==e?(p=(h,x)=>{!x.columns||!x.rows||e.dispatchCommand(cg,{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=ig(_a.Fragment,{children:[Hr(dt,{drawerSlug:c,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:p,schemaPath:i,schemaPathSuffix:"fields"}),Hr(ag,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]}),t[12]=c,t[13]=i,t[14]=p,t[15]=f):f=t[15],f};var yg=M({markdownTransformers:[zs],nodes:[Ng,Sg,Lg],plugins:[{Component:Ea,position:"normal"},{Component:da,position:"normal"},{Component:na,position:"floatingAnchorElem"},{Component:ka,position:"floatingAnchorElem"}],providers:[wa],slashMenu:{groups:[z([{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 px}from"lexical";import{jsx as Ur,jsxs as Rg}from"react/jsx-runtime";import"react";var Wr=()=>Rg("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 Ra}from"react/jsx-runtime";import Ia from"bson-objectid";import{$applyNodeReplacement as Ag}from"lexical";import*as va from"react";import Ig 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 Ig.default().toHexString(),src:t.getAttribute("src")||""}}})}}import{DecoratorBlockNode as vg}from"@lexical/react/LexicalDecoratorBlockNode.js";import Na from"bson-objectid";import{$applyNodeReplacement as Mg}from"lexical";var Ft=class extends vg{__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,Sa),priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new Na.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,pending:e.pending,relationTo:e.relationTo,value:e.value},r=Sa({data:o});return r.setFormat(e.format),r}static isInline(){return!1}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 Sa({data:t}){return t?.id||(t.id=new Na.default().toHexString()),Mg(new Ft({data:t}))}import{jsx as La}from"react/jsx-runtime";import{ShimmerEffect as Dg}from"@payloadcms/ui";var ya=()=>La("div",{className:"lexical-upload",children:La(Dg,{height:"95px",width:"203px"})});var $g=va.lazy(()=>import("./component-VDJI45F2.js").then(t=>({default:t.UploadComponent}))),ie=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 Ia.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(){return this.__data.pending?Ra(ya,{}):Ra($g,{data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Me({data:t}){return t?.id||(t.id=new Ia.default().toHexString()),Ag(new ie({data:t}))}function it(t){return t instanceof ie}import{c as Wg}from"react/compiler-runtime";import{jsx as Gg}from"react/jsx-runtime";import{useLexicalComposerContext as Vg}from"@lexical/react/LexicalComposerContext.js";import{$dfsIterator as Ua,$insertNodeToNearestRoot as Kr,mergeRegister as Kg}from"@lexical/utils";import{useBulkUpload as Jg,useConfig as Xg,useEffectEvent as zg,useModal as Zg}from"@payloadcms/ui";import Jr from"bson-objectid";import{$createRangeSelection as Yg,$getPreviousSelection as Fa,$getSelection as Pa,$isParagraphNode as Xr,$isRangeSelection as Ba,$setSelection as qg,COMMAND_PRIORITY_EDITOR as Qg,COMMAND_PRIORITY_LOW as ja,createCommand as ex,DROP_COMMAND as tx,getDOMSelectionFromTarget as ox,isHTMLElement as Ha,PASTE_COMMAND as rx}from"lexical";import{useEffect as nx}from"react";import{c as Ma}from"react/compiler-runtime";import{jsx as Gr}from"react/jsx-runtime";import{useLexicalComposerContext as Da}from"@lexical/react/LexicalComposerContext.js";import{toast as Og}from"@payloadcms/ui";import{$getNodeByKey as Fg,COMMAND_PRIORITY_EDITOR as Aa}from"lexical";import{useEffect as $a,useState as Pg}from"react";var Bg=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=Fg(o);n&&n.replace(Me({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(Vr,{fields:null,relationTo:e,value:r})},jg=t=>{let e=Ma(13),{enabledCollectionSlugs:o}=t,[r]=Da(),[n,l]=Pg(null),i;e[0]!==o?(i={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=i):i=e[1];let{closeListDrawer:s,ListDrawer:u,openListDrawer:c}=Mt(i),d,a;e[2]!==r||e[3]!==c?(d=()=>r.registerCommand(Ke,h=>(l(h?.replace?h?.replace.nodeKey:null),c(),!0),Aa),a=[r,c],e[2]=r,e[3]=c,e[4]=d,e[5]=a):(d=e[4],a=e[5]),$a(d,a);let m;e[6]!==s||e[7]!==r||e[8]!==n?(m=h=>{let{collectionSlug:x,doc:C}=h;s(),Bg({editor:r,relationTo:x,replaceNodeKey:n,value:C.id})},e[6]=s,e[7]=r,e[8]=n,e[9]=m):m=e[9];let p=m,f;return e[10]!==u||e[11]!==p?(f=Gr(u,{onSelect:p}),e[10]=u,e[11]=p,e[12]=f):f=e[12],f},Hg=()=>{let t=Ma(3),[e]=Da(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Ke,Ug,Aa),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),$a(o,r),null},Oa=t=>Gr(Gt,{...t,FallbackComponent:Hg,uploads:!0,children:Gr(jg,{...t})});function Ug(){return Og.error("No upload collections enabled"),!0}function lx(t){let e=t.target;return!!(Ha(e)&&!e.closest("code, span.editor-image")&&Ha(e.parentElement)&&e.parentElement.closest("div.ContentEditable__root"))}function ix(t){let e,o=ox(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=ex("INSERT_UPLOAD_COMMAND"),Wa=()=>{let t=Wg(18),[e]=Vg(),{config:o}=Xg(),{collections:r}=o,{drawerSlug:n,setCollectionSlug:l,setInitialForms:i,setOnCancel:s,setOnSuccess:u,setSelectableCollections:c}=Jg(),{isModalOpen:d,openModal:a}=Zg(),m;t[0]!==n||t[1]!==r||t[2]!==e||t[3]!==d||t[4]!==a||t[5]!==l||t[6]!==i||t[7]!==s||t[8]!==u||t[9]!==c?(m=C=>{let{files:T}=C;if(T?.length!==0&&(i(S=>[...S??[],...T.map(sx)]),!d(n))){let S=r.filter(ax).map(cx);if(!S.length||!S[0])return;l(S[0]),c(S),s(()=>{e.update(ux)}),u(b=>{let k=new Map(b.map(dx));e.update(()=>{for(let g of Ua()){let w=g.node;if(it(w)){let _=w.getData();if(_?.pending){let y=k.get(_.pending?.formID);y&&w.replace(Me({data:{id:new Jr.default().toHexString(),fields:{},relationTo:y.collectionSlug,value:y.doc.id}}))}}}})}),a(n)}},t[0]=n,t[1]=r,t[2]=e,t[3]=d,t[4]=a,t[5]=l,t[6]=i,t[7]=s,t[8]=u,t[9]=c,t[10]=m):m=t[10];let p=zg(m),f;t[11]!==e||t[12]!==p?(f=()=>{if(!e.hasNodes([ie]))throw new Error("UploadPlugin: UploadNode not registered on editor");return Kg(e.registerNodeTransform(ie,C=>{let T=C.getData();if(!T?.pending)return;(async function(){let k=null,g=T?.pending?.src,w=T?.pending?.formID;if(g?.startsWith("data:")){let _=g.match(/data:(image\/[a-zA-Z]+);base64,/),y=_?_[1]:"image/png",O=g.replace(/^data:image\/[a-zA-Z]+;base64,/,""),v=atob(O),N=new Array(v.length);for(let D=0;D<v.length;D++)N[D]=v.charCodeAt(D);let E=new Uint8Array(N);k={alt:void 0,file:new File([E],"pasted-image."+y?.split("/")[1],{type:y}),formID:w}}else if(g?.startsWith("http")||g?.startsWith("https")){let y=await(await fetch(g)).blob(),O=g.split("/").pop()||"pasted-image"+y.type.split("/")[1];k={alt:void 0,file:new File([y],O,{type:y.type}),formID:w}}k&&p({files:[k]})})()}),e.registerCommand(Vr,C=>(e.update(()=>{let T=Pa()||Fa();if(Ba(T)){let S=Me({data:{id:C.id,fields:C.fields,relationTo:C.relationTo,value:C.value}}),{focus:b}=T,k=b.getNode();Kr(S),Xr(k)&&!k.__first&&k.remove()}}),!0),Qg),e.registerCommand(rx,C=>{if(!(C instanceof ClipboardEvent))return!1;let T=C.clipboardData;if(!T?.types?.length||T?.types?.includes("text/html"))return!1;let S=[];return T?.files?.length&&Array.from(T.files).forEach(b=>{S.push({alt:"",file:b,formID:new Jr.default().toHexString()})}),S.length?(e.update(()=>{let b=Pa()||Fa();if(Ba(b))for(let k of S){let g=new ie({data:{pending:{formID:k.formID,src:URL.createObjectURL(k.file)}}}),{focus:w}=b,_=w.getNode();Kr(g),Xr(_)&&!_.__first&&_.remove()}}),p({files:S}),!0):!1},ja),e.registerCommand(tx,C=>{if(!(C instanceof DragEvent))return!1;let T=C.dataTransfer;if(!T?.types?.length)return!1;let S=[];return T?.files?.length&&Array.from(T.files).forEach(b=>{S.push({alt:"",file:b,formID:new Jr.default().toHexString()})}),S.length?(C.preventDefault(),C.stopPropagation(),e.update(()=>{if(lx(C)){let b=ix(C),k=Yg();b!=null&&k.applyDOMRange(b),qg(k);for(let g of S){let w=new ie({data:{pending:{formID:g.formID,src:URL.createObjectURL(g.file)}}}),{focus:_}=k,y=_.getNode();Kr(w),Xr(y)&&!y.__first&&y.remove()}}}),p({files:S}),!0):!1},ja))},t[11]=e,t[12]=p,t[13]=f):f=t[13];let h;t[14]!==e?(h=[e],t[14]=e,t[15]=h):h=t[15],nx(f,h);let x;return t[16]!==r?(x=Gg(Oa,{enabledCollectionSlugs:r.map(mx)}),t[16]=r,t[17]=x):x=t[17],x};function sx(t){return{file:t.file,formID:t.formID}}function ax(t){let{upload:e}=t;return!!e}function cx(t){let{slug:e}=t;return e}function ux(){for(let t of Ua()){let e=t.node;it(e)&&e.getData()?.pending&&e.remove()}}function dx(t){return[t.formID,t]}function mx(t){let{slug:e}=t;return e}var fx=M({nodes:[ie],plugins:[{Component:Wa,position:"normal"}],slashMenu:{groups:[z([{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(!px(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return it(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ke,{replace:!1})}}])]}});import{c as gx}from"react/compiler-runtime";import{jsx as Zr}from"react/jsx-runtime";import{ShimmerEffect as xx,useConfig as Cx}from"@payloadcms/ui";import{lazy as bx,Suspense as kx,useEffect as _x,useState as Tx}from"react";var Ga={block:"LexicalEditorTheme__block",blockCursor:"LexicalEditorTheme__blockCursor",characterLimit:"LexicalEditorTheme__characterLimit",code:"LexicalEditorTheme__code",codeHighlight:{atrule:"LexicalEditorTheme__tokenAttr",attr:"LexicalEditorTheme__tokenAttr",boolean:"LexicalEditorTheme__tokenProperty",builtin:"LexicalEditorTheme__tokenSelector",cdata:"LexicalEditorTheme__tokenComment",char:"LexicalEditorTheme__tokenSelector",class:"LexicalEditorTheme__tokenFunction","class-name":"LexicalEditorTheme__tokenFunction",comment:"LexicalEditorTheme__tokenComment",constant:"LexicalEditorTheme__tokenProperty",deleted:"LexicalEditorTheme__tokenProperty",doctype:"LexicalEditorTheme__tokenComment",entity:"LexicalEditorTheme__tokenOperator",function:"LexicalEditorTheme__tokenFunction",important:"LexicalEditorTheme__tokenVariable",inserted:"LexicalEditorTheme__tokenSelector",keyword:"LexicalEditorTheme__tokenAttr",namespace:"LexicalEditorTheme__tokenVariable",number:"LexicalEditorTheme__tokenProperty",operator:"LexicalEditorTheme__tokenOperator",prolog:"LexicalEditorTheme__tokenComment",property:"LexicalEditorTheme__tokenProperty",punctuation:"LexicalEditorTheme__tokenPunctuation",regex:"LexicalEditorTheme__tokenVariable",selector:"LexicalEditorTheme__tokenSelector",string:"LexicalEditorTheme__tokenSelector",symbol:"LexicalEditorTheme__tokenProperty",tag:"LexicalEditorTheme__tokenProperty",url:"LexicalEditorTheme__tokenOperator",variable:"LexicalEditorTheme__tokenVariable"},embedBlock:{base:"LexicalEditorTheme__embedBlock",focus:"LexicalEditorTheme__embedBlockFocus"},hashtag:"LexicalEditorTheme__hashtag",heading:{h1:"LexicalEditorTheme__h1",h2:"LexicalEditorTheme__h2",h3:"LexicalEditorTheme__h3",h4:"LexicalEditorTheme__h4",h5:"LexicalEditorTheme__h5",h6:"LexicalEditorTheme__h6"},hr:"LexicalEditorTheme__hr",hrSelected:"LexicalEditorTheme__hrSelected",indent:"LexicalEditorTheme__indent",inlineImage:"LexicalEditor__inline-image",link:"LexicalEditorTheme__link",list:{checklist:"LexicalEditorTheme__checklist",listitem:"LexicalEditorTheme__listItem",listitemChecked:"LexicalEditorTheme__listItemChecked",listitemUnchecked:"LexicalEditorTheme__listItemUnchecked",nested:{listitem:"LexicalEditorTheme__nestedListItem"},olDepth:["LexicalEditorTheme__ol1","LexicalEditorTheme__ol2","LexicalEditorTheme__ol3","LexicalEditorTheme__ol4","LexicalEditorTheme__ol5"],ul:"LexicalEditorTheme__ul"},ltr:"LexicalEditorTheme__ltr",mark:"LexicalEditorTheme__mark",markOverlap:"LexicalEditorTheme__markOverlap",paragraph:"LexicalEditorTheme__paragraph",quote:"LexicalEditorTheme__quote",relationship:"LexicalEditorTheme__relationship",rtl:"LexicalEditorTheme__rtl",tab:"LexicalEditorTheme__tabNode",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableAlignment:{center:"LexicalEditorTheme__tableAlignmentCenter",right:"LexicalEditorTheme__tableAlignmentRight"},tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableFrozenColumn:"LexicalEditorTheme__tableFrozenColumn",tableRowStriping:"LexicalEditorTheme__tableRowStriping",tableScrollableWrapper:"LexicalEditorTheme__tableScrollableWrapper",tableSelected:"LexicalEditorTheme__tableSelected",tableSelection:"LexicalEditorTheme__tableSelection",text:{bold:"LexicalEditorTheme__textBold",code:"LexicalEditorTheme__textCode",italic:"LexicalEditorTheme__textItalic",strikethrough:"LexicalEditorTheme__textStrikethrough",subscript:"LexicalEditorTheme__textSubscript",superscript:"LexicalEditorTheme__textSuperscript",underline:"LexicalEditorTheme__textUnderline",underlineStrikethrough:"LexicalEditorTheme__textUnderlineStrikethrough"},upload:"editor-upload"};var Io={namespace:"lexical",theme:Ga};function Va({config:t,featureClientImportMap:e,featureClientSchemaMap:o,field:r,schemaPath:n,unSanitizedEditorConfig:l}){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.");l.features=l.features.sort((c,d)=>c.clientFeatureProps.order-d.clientFeatureProps.order);let i=new Map;for(let c of l.features)i.set(c.clientFeatureProps.featureKey,c);let s=new Map,u=0;for(let c of l.features){let d=typeof c.feature=="function"?c.feature({config:t,featureClientImportMap:e,featureClientSchemaMap:o,featureProviderMap:i,field:r,resolvedFeatures:s,schemaPath:n,unSanitizedEditorConfig:l}):c.feature;d.key=c.clientFeatureProps.featureKey,d.order=u,s.set(c.clientFeatureProps.featureKey,d),u++}return s}import{deepMerge as hx}from"payload/shared";var Ka=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?hx(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:Ka(t),lexical:e,resolvedFeatureMap:t}}var wx=bx(()=>import("./Field-2MCIQXRP.js").then(t=>({default:t.RichText}))),Ex=t=>{let e=gx(16),{admin:o,clientFeatures:r,featureClientImportMap:n,featureClientSchemaMap:l,field:i,lexicalEditorConfig:s,schemaPath:u}=t,c;e[0]!==o?(c=o===void 0?{}:o,e[0]=o,e[1]=c):c=e[1];let d=c,a=s===void 0?Io:s,{config:m}=Cx(),[p,f]=Tx(null),h,x;e[2]!==d||e[3]!==r||e[4]!==m||e[5]!==n||e[6]!==l||e[7]!==i||e[8]!==p||e[9]!==a||e[10]!==u?(h=()=>{if(p)return;let T=[];for(let[k,g]of Object.entries(r))g.clientFeatureProvider&&T.push(g.clientFeatureProvider(g.clientFeatureProps));let S=a||Io,b=Va({config:m,featureClientImportMap:n,featureClientSchemaMap:l,field:i,schemaPath:u??i.name,unSanitizedEditorConfig:{features:T,lexical:S}});f(zr(b,S,d))},x=[a,d,p,r,n,l,i,m,u],e[2]=d,e[3]=r,e[4]=m,e[5]=n,e[6]=l,e[7]=i,e[8]=p,e[9]=a,e[10]=u,e[11]=h,e[12]=x):(h=e[11],x=e[12]),_x(h,x);let C;return e[13]!==p||e[14]!==t?(C=Zr(kx,{fallback:Zr(xx,{height:"35vh"}),children:p&&Zr(wx,{...t,editorConfig:p})}),e[13]=p,e[14]=t,e[15]=C):C=e[15],C};function Sx(t){return t instanceof HTMLElement}function Nx(...t){return t.filter(Boolean).join(" ")}var vo=new WeakMap;function Ja(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function Mo(t,e){let o=vo.get(t);if(o===void 0){let r=new Set,n=i=>{o!==void 0&&(o.start=Ja(i))},l=i=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let u=Ja(i);for(let c of r)u!==null&&c([u[0]-s[0],u[1]-s[1]],i)};t.addEventListener("touchstart",n),t.addEventListener("touchend",l),o={handleTouchend:l,handleTouchstart:n,listeners:r,start:null},vo.set(t,o)}return o.listeners.add(e),()=>{Lx(t,e)}}function Lx(t,e){let o=vo.get(t);if(o===void 0)return;let{listeners:r}=o;r.delete(e),r.size===0&&(vo.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function yx(t,e){return Mo(t,(o,r)=>{let[n,l]=o;n<0&&-n>Math.abs(l)&&e(n,r)})}function Rx(t,e){return Mo(t,(o,r)=>{let[n,l]=o;n>0&&n>Math.abs(l)&&e(n,r)})}function Ix(t,e){return Mo(t,(o,r)=>{let[n,l]=o;l<0&&-l>Math.abs(n)&&e(n,r)})}function vx(t,e){return Mo(t,(o,r)=>{let[n,l]=o;l>0&&l>Math.abs(n)&&e(n,r)})}import{c as Mx}from"react/compiler-runtime";import{jsx as Dx}from"react/jsx-runtime";import"react";var Ax=()=>{let t=Mx(2),{EditButton:e}=he(),o;return t[0]!==e?(o=e?Dx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as $x}from"react/compiler-runtime";import{jsx as Ox}from"react/jsx-runtime";import"react";var Fx=()=>{let t=$x(2),{RemoveButton:e}=he(),o;return t[0]!==e?(o=e?Ox(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Px}from"react/compiler-runtime";import{jsx as Bx}from"react/jsx-runtime";import"react";var jx=()=>{let t=Px(2),{Label:e}=he(),o;return t[0]!==e?(o=e?Bx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Hx}from"react/compiler-runtime";import{jsx as Ux}from"react/jsx-runtime";import"react";var Wx=t=>{let e=Hx(3),{children:o}=t,{InlineBlockContainer:r}=he(),n;return e[0]!==r||e[1]!==o?(n=r?Ux(r,{children:o}):null,e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{jsx as Gx}from"react/jsx-runtime";import"react";var Vx=t=>{let{children:e,...o}=t,{BlockCollapsible:r}=ge();return r?Gx(r,{...o,children:e}):null};import{c as Kx}from"react/compiler-runtime";import{jsx as Jx}from"react/jsx-runtime";import"react";var Xx=()=>{let t=Kx(2),{EditButton:e}=ge(),o;return t[0]!==e?(o=e?Jx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as zx}from"react/compiler-runtime";import{jsx as Zx}from"react/jsx-runtime";import"react";var Yx=()=>{let t=zx(2),{RemoveButton:e}=ge(),o;return t[0]!==e?(o=e?Zx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as qx}from"qs-esm";var Qx=({apiURL:t,depth:e,draft:o,locale:r})=>async({id:l,collectionSlug:i,select:s})=>{let u=qx({depth:e??0,draft:o??!1,locale:r,select:s},{addQueryPrefix:!0});return await fetch(`${t}/${i}/${l}${u}`,{credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json"},method:"GET"}).then(d=>d.json())};var Xa={customEndRegex:{optional:!0,regExp:/[ \t]*```$/},customStartRegex:/^[ \t]*```(\w+)?/,doNotTrimChildren:!0,export:({fields:t})=>!t.code.includes(`
60
+ `);let o=P1(To.NO_STATUS);return Ut(t,e,o),o},Js=(t,e)=>{let o=t.match(Xs);return!o||!o[1]?null:o[1].split("|").map(r=>Zs(r,e))};import{c as z1}from"react/compiler-runtime";import{jsx as P,jsxs as Ee}from"react/jsx-runtime";import{useLexicalComposerContext as ta}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Z1}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as qs,$deleteTableColumnAtSelection as Y1,$deleteTableRowAtSelection as q1,$getNodeTriplet as Q1,$getTableCellNodeFromLexicalNode as Qs,$getTableColumnIndexFromTableCellNode as eh,$getTableNodeFromLexicalNodeOrThrow as ve,$getTableRowIndexFromTableCellNode as th,$insertTableColumnAtSelection as oh,$insertTableRowAtSelection as rh,$isTableCellNode as oa,$isTableSelection as $t,$mergeCells as nh,$unmergeCell as lh,getTableElement as Dr,getTableObserverFromTableElement as Ar,TableCellHeaderStates as Ie,TableCellNode as ih}from"@lexical/table";import{mergeRegister as sh}from"@lexical/utils";import{useScrollInfo as ah}from"@payloadcms/ui";import{$getSelection as Eo,$isElementNode as ch,$isRangeSelection as $r,$isTextNode as uh,$setSelection as dh,COMMAND_PRIORITY_CRITICAL as mh,getDOMSelection as ph,isDOMNode as fh,SELECTION_CHANGE_COMMAND as hh}from"lexical";import*as Or from"react";import{useCallback as ce,useEffect as rt,useRef as wo,useState as nt}from"react";import{createPortal as ra}from"react-dom";import{jsx as Mr,jsxs as X1}from"react/jsx-runtime";import"react";var Ys=()=>X1("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 ea(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function gh(){let t=Eo();if($r(t)&&!t.isCollapsed()||$t(t)&&!t.anchor.is(t.focus)||!$r(t)&&!$t(t))return!1;let[e]=Q1(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function xh(t){let e=t.getLastDescendant();uh(e)?e.select():ch(e)?e.selectEnd():e!==null&&e.selectNext()}function Ch({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[l]=ta(),i=wo(null),[s,u]=nt(n),[c,d]=nt({columns:1,rows:1}),[a,m]=nt(!1),[p,f]=nt(!1),{y:h}=ah();rt(()=>l.registerMutationListener(ih,E=>{E.get(s.getKey())==="updated"&&l.getEditorState().read(()=>{u(s.getLatest())})},{skipInitialization:!0}),[l,s]),rt(()=>{l.getEditorState().read(()=>{let E=Eo();if($t(E)){let L=ea(E);d(ea(E)),m(L.columns>1||L.rows>1)}f(gh())})},[l]),rt(()=>{let E=e.current,L=i.current,D=l.getRootElement();if(E!=null&&L!=null&&D!=null){let I=D.getBoundingClientRect(),A=E.getBoundingClientRect();L.style.opacity="1";let R=L.getBoundingClientRect(),F=5,W=A.right+F;if(W+R.width>window.innerWidth||W+R.width>I.right){let re=A.left-R.width-F;W=(re<0?F:re)+window.pageXOffset}L.style.left=`${W+window.pageXOffset}px`;let Q=A.top;if(Q+R.height>window.innerHeight){let re=A.bottom-R.height;Q=re<0?F:re}L.style.top=`${Q}px`}},[e,i,l,h]),rt(()=>{function E(L){i.current!=null&&e.current!=null&&fh(L.target)&&!i.current.contains(L.target)&&!e.current.contains(L.target)&&r(!1)}return window.addEventListener("click",E),()=>window.removeEventListener("click",E)},[r,e]);let C=ce(()=>{l.update(()=>{if(s.isAttached()){let E=ve(s),L=Dr(E,l.getElementByKey(E.getKey()));if(L===null)throw new Error("Expected to find tableElement in DOM");let D=Ar(L);D!==null&&D.$clearHighlight(),E.markDirty(),u(s.getLatest())}dh(null)})},[l,s]),g=()=>{l.update(()=>{let E=Eo();if(!$t(E))return;let D=E.getNodes().filter(oa),I=nh(D);I&&(xh(I),o())})},T=()=>{l.update(()=>{lh()})},S=ce(E=>{l.update(()=>{for(let L=0;L<c.rows;L++)rh(E);o()})},[l,o,c.rows]),b=ce(E=>{l.update(()=>{for(let L=0;L<c.columns;L++)oh(E);o()})},[l,o,c.columns]),k=ce(()=>{l.update(()=>{q1(),o()})},[l,o]),x=ce(()=>{l.update(()=>{ve(s).remove(),C(),o()})},[l,s,C,o]),w=ce(()=>{l.update(()=>{Y1(),o()})},[l,o]),_=ce(()=>{l.update(()=>{let E=ve(s),L=th(s),[D]=qs(E,null,null),I=new Set,A=s.getHeaderStyles()^Ie.ROW;if(D[L])for(let R=0;R<D[L].length;R++){let F=D[L][R];F?.cell&&(I.has(F.cell)||(I.add(F.cell),F.cell.setHeaderStyles(A,Ie.ROW)))}C(),o()})},[l,s,C,o]),y=ce(()=>{l.update(()=>{let E=ve(s),L=eh(s),[D]=qs(E,null,null),I=new Set,A=s.getHeaderStyles()^Ie.COLUMN;if(D)for(let R=0;R<D.length;R++){let F=D?.[R]?.[L];F?.cell&&(I.has(F.cell)||(I.add(F.cell),F.cell.setHeaderStyles(A,Ie.COLUMN)))}C(),o()})},[l,s,C,o]),O=ce(()=>{l.update(()=>{if(s.isAttached()){let E=ve(s);E&&E.setRowStriping(!E.getRowStriping())}C(),o()})},[l,s,C,o]),v=ce(()=>{l.update(()=>{if(s.isAttached()){let E=ve(s);E&&E.setFrozenColumns(E.getFrozenColumns()===0?1:0)}C(),o()})},[l,s,C,o]),N=null;return t&&(a?N=P("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>g(),type:"button",children:P("span",{className:"text",children:"Merge cells"})}):p&&(N=P("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>T(),type:"button",children:P("span",{className:"text",children:"Unmerge cells"})}))),ra(Ee("div",{className:"table-action-menu-dropdown",onClick:E=>{E.stopPropagation()},ref:i,children:[N?Ee(Or.Fragment,{children:[N,P("hr",{})]}):null,P("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>O(),type:"button",children:P("span",{className:"text",children:"Toggle Row Striping"})}),P("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>v(),type:"button",children:P("span",{className:"text",children:"Toggle First Column Freeze"})}),P("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>S(!1),type:"button",children:Ee("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:()=>S(!0),type:"button",children:Ee("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:()=>b(!1),type:"button",children:Ee("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:()=>b(!0),type:"button",children:Ee("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:()=>w(),type:"button",children:P("span",{className:"text",children:"Delete column"})}),P("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>k(),type:"button",children:P("span",{className:"text",children:"Delete row"})}),P("button",{className:"item","data-test-id":"table-delete",onClick:()=>x(),type:"button",children:P("span",{className:"text",children:"Delete table"})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-row-header",onClick:()=>_(),type:"button",children:Ee("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:Ee("span",{className:"text",children:[(s.__headerState&Ie.COLUMN)===Ie.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function bh({anchorElem:t,cellMerge:e}){let[o]=ta(),r=wo(null),n=wo(null),[l,i]=nt(!1),[s,u]=nt(null),c=ce(()=>{let a=r.current,m=Eo(),p=ph(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")),u(null)}if(m==null||a==null)return h();let C=o.getRootElement(),g=null,T=null;if($r(m)&&C!==null&&p!==null&&C.contains(p.anchorNode)){let b=Qs(m.anchor.getNode());if(b==null||(T=o.getElementByKey(b.getKey()),T==null||!b.isAttached()))return h();let k=ve(b),x=Dr(k,o.getElementByKey(k.getKey()));if(x===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");g=Ar(x),u(b)}else if($t(m)){let b=Qs(m.anchor.getNode());if(!oa(b))throw new Error("TableSelection anchorNode must be a TableCellNode");let k=ve(b),x=Dr(k,o.getElementByKey(k.getKey()));if(x===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");g=Ar(x),T=o.getElementByKey(b.getKey())}else if(!f)return h();if(g===null||T===null)return h();let S=!g||!g.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",S),a.classList.toggle("table-cell-action-button-container--inactive",!S),S){let b=T.getBoundingClientRect(),k=t.getBoundingClientRect(),x=b.top-k.top,w=b.right-k.left;a.style.transform=`translate(${w}px, ${x}px)`}},[o,t]);rt(()=>{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(hh,p,mh),o.registerRootListener((f,h)=>{h&&h.removeEventListener("pointerup",p),f&&(f.addEventListener("pointerup",p),p())}),()=>clearTimeout(a))});let d=wo(s);return rt(()=>{d.current!==s&&i(!1),d.current=s},[d,s]),P("div",{className:"table-cell-action-button-container",ref:r,children:s!=null&&Ee(Or.Fragment,{children:[P("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),i(!l)},ref:n,type:"button",children:P(Ys,{})}),l&&P(Ch,{cellMerge:e,contextRef:n,onClose:()=>i(!1),setIsMenuOpen:i,tableCellNode:s})]})})}var na=t=>{let e=z1(3),{anchorElem:o}=t,r=Z1(),n;return e[0]!==o||e[1]!==r?(n=ra(r?P(bh,{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 kh}from"react/compiler-runtime";import{jsx as No,jsxs as _h}from"react/jsx-runtime";import{useLexicalComposerContext as Th}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as wh}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as Eh,$getTableNodeFromLexicalNodeOrThrow as Fr,$getTableRowIndexFromTableCellNode as Sh,$isTableCellNode as la,$isTableRowNode as Nh,getDOMCellFromTarget as Lh,getTableElement as yh,TableNode as ia}from"@lexical/table";import{calculateZoomLevel as sa,mergeRegister as Rh}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Pr,isHTMLElement as Ih,SKIP_SCROLL_INTO_VIEW_TAG as aa}from"lexical";import*as ua from"react";import{useCallback as Ot,useEffect as Br,useRef as So,useState as lt}from"react";import{createPortal as vh}from"react-dom";var Mh=33,ca=92;function Dh({editor:t}){let e=So(null),o=So(null),r=So(null),[n,l]=lt(!1),i=j(),s=So(null),[u,c]=lt(null),[d,a]=lt(null),[m,p]=lt(!1),[f,h]=lt(null),C=Ot(()=>{a(null),e.current=null,h(null),s.current=null,r.current=null},[]),g=v=>(v.buttons&1)===1;Br(()=>{let v=new Set;return Rh(t.registerMutationListener(ia,N=>{for(let[E,L]of N)L==="destroyed"?v.delete(E):v.add(E);l(v.size>0)}),t.registerNodeTransform(ia,N=>{if(N.getColWidths())return N;let E=N.getColumnCount(),L=ca;return N.setColWidths(Array(E).fill(L)),N}))},[t]),Br(()=>{if(!n)return;let v=D=>{let I=D.target;if(Ih(I)){if(f){c({x:D.clientX,y:D.clientY});return}if(p(g(D)),!(o.current&&o.current.contains(I))&&e.current!==I){e.current=I;let A=Lh(I);A&&d!==A?t.getEditorState().read(()=>{let R=Pr(A.elem);if(!R)throw new Error("TableCellResizer: Table cell node not found.");let F=Fr(R),W=yh(F,t.getElementByKey(F.getKey()));if(!W)throw new Error("TableCellResizer: Table element not found.");e.current=I,r.current=W.getBoundingClientRect(),a(A)},{editor:t}):A==null&&C()}}},N=D=>{p(!0)},E=D=>{p(!1)},L=t.registerRootListener((D,I)=>{I?.removeEventListener("mousemove",v),I?.removeEventListener("mousedown",N),I?.removeEventListener("mouseup",E),D?.addEventListener("mousemove",v),D?.addEventListener("mousedown",N),D?.addEventListener("mouseup",E)});return()=>{L()}},[d,f,t,n,C]);let T=v=>v==="bottom",S=Ot(v=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let N=Pr(d.elem);if(!la(N))throw new Error("TableCellResizer: Table cell node not found.");let E=Fr(N),L=Sh(N),D=E.getChildren(),A=N.getColSpan()===E.getColumnCount()?L:L+N.getRowSpan()-1;if(A>=D.length||A<0)throw new Error("Expected table cell to be inside of table row.");let R=D[A];if(!Nh(R))throw new Error("Expected table row");let F=R.getHeight();if(F===void 0){let Q=R.getChildren();F=Math.min(...Q.map(re=>b(re,t)??1/0))}let W=Math.max(F+v,Mh);R.setHeight(W)},{tag:aa})},[d,t]),b=(v,N)=>N.getElementByKey(v.getKey())?.clientHeight,k=(v,N)=>{let E;return N.forEach(L=>{L.forEach((D,I)=>{D.cell===v&&(E=I)})}),E},x=Ot(v=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let N=Pr(d.elem);if(!la(N))throw new Error("TableCellResizer: Table cell node not found.");let E=Fr(N),[L]=Eh(E,null,null),D=k(N,L);if(D===void 0)throw new Error("TableCellResizer: Table column not found.");let I=E.getColWidths();if(!I)return;let A=I[D];if(A===void 0)return;let R=[...I],F=Math.max(A+v,ca);R[D]=F,E.setColWidths(R)},{tag:aa})},[d,t]),w=Ot(v=>{let N=E=>{if(E.preventDefault(),E.stopPropagation(),!d)throw new Error("TableCellResizer: Expected active cell.");if(s.current){let{x:L,y:D}=s.current;if(d===null)return;let I=sa(E.target);if(T(v)){let A=(E.clientY-D)/I;S(A)}else{let A=(E.clientX-L)/I;x(A)}C(),document.removeEventListener("mouseup",N)}};return N},[d,C,x,S]),_=Ot(v=>N=>{if(N.preventDefault(),N.stopPropagation(),!d)throw new Error("TableCellResizer: Expected active cell.");s.current={x:N.clientX,y:N.clientY},c(s.current),h(v),document.addEventListener("mouseup",w(v))},[d,w]),[y,O]=lt({bottom:null,left:null,right:null,top:null});return Br(()=>{if(d){let{height:v,left:N,top:E,width:L}=d.elem.getBoundingClientRect(),D=sa(d.elem),I=10,A={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${I}px`,left:`${window.scrollX+N}px`,top:`${window.scrollY+E+v-I/2}px`,width:`${L}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${v}px`,left:`${window.scrollX+N+L-I/2}px`,top:`${window.scrollY+E}px`,width:`${I}px`}},R=r.current;f&&u&&R&&(T(f)?(A[f].left=`${window.scrollX+R.left}px`,A[f].top=`${window.scrollY+u.y/D}px`,A[f].height="3px",A[f].width=`${R.width}px`):(A[f].top=`${window.scrollY+R.top}px`,A[f].left=`${window.scrollX+u.x/D}px`,A[f].width="3px",A[f].height=`${R.height}px`),A[f].backgroundColor="#adf"),O(A)}else O({bottom:null,left:null,right:null,top:null})},[d,f,u]),No("div",{ref:o,children:d!=null&&!m&&_h(ua.Fragment,{children:[No("div",{className:`${i.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:_("right"),style:y.right||void 0}),No("div",{className:`${i.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:_("bottom"),style:y.bottom||void 0})]})})}var da=()=>{let t=kh(3),[e]=Th(),o=wh(),r;return t[0]!==e||t[1]!==o?(r=o?vh(No(Dh,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=r):r=t[2],r};import{c as Hh}from"react/compiler-runtime";import{jsx as jr,jsxs as Uh,Fragment as Wh}from"react/jsx-runtime";import{useLexicalComposerContext as ba}from"@lexical/react/LexicalComposerContext";import{$getTableAndElementByKey as Gh,$getTableColumnIndexFromTableCellNode as Vh,$getTableRowIndexFromTableCellNode as Kh,$insertTableColumnAtSelection as Jh,$insertTableRowAtSelection as Xh,$isTableCellNode as zh,$isTableNode as fa,getTableElement as Zh,TableNode as Yh}from"@lexical/table";import{$findMatchingParent as qh,mergeRegister as Qh}from"@lexical/utils";import{$getNearestNodeFromDOMNode as ha,isHTMLElement as eg}from"lexical";import{useEffect as ga,useMemo as tg,useRef as xa,useState as Lo}from"react";import"react";import{createPortal as og}from"react-dom";import{c as Ph}from"react/compiler-runtime";import{useEffect as Bh,useRef as jh}from"react";var Ah="Expected a function",$h=Math.max,Oh=Math.min;function Fh(t,e,o){let r,n,l=0,i,s=!1,u=!1,c,d,a,m=!0;if(typeof t!="function")throw new TypeError(Ah);e=e||0,typeof o=="object"&&(s=!!o.leading,u="maxWait"in o,c=u?$h(o.maxWait||0,e):c,m="trailing"in o?!!o.trailing:m);function p(x){let w=r,_=i;return r=i=void 0,l=x,d=t.apply(_,w),d}function f(x){return l=x,a=setTimeout(g,e),s?p(x):d}function h(x){let w=x-n,_=x-l,y=e-w;return u?Oh(y,c-_):y}function C(x){let w=x-n,_=x-l;return n===void 0||w>=e||w<0||u&&_>=c}function g(){let x=Date.now();if(C(x))return T(x);a=setTimeout(g,h(x))}function T(x){return a=void 0,m&&r?p(x):(r=i=void 0,d)}function S(){a!==void 0&&clearTimeout(a),l=0,r=n=i=a=void 0}function b(){return a===void 0?d:T(Date.now())}function k(){let x=Date.now(),w=C(x);if(r=arguments,i=this,n=x,w){if(a===void 0)return f(n);if(u)return clearTimeout(a),a=setTimeout(g,e),p(n)}return a===void 0&&(a=setTimeout(g,e)),d}return k.cancel=S,k.flush=b,k}var ma=Fh;function pa(t,e,o){let r=Ph(6),n=jh(null),l,i;r[0]!==t||r[1]!==o||r[2]!==e?(l=()=>(n.current=ma(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]),Bh(l,i);let s;return r[5]===Symbol.for("react.memo_cache_sentinel")?(s=(...c)=>{let d=c;n.current&&n.current(...d)},r[5]=s):s=r[5],s}var Ca=20;function rg({anchorElem:t}){let[e]=ba(),o=j(),[r,n]=Lo(!1),[l,i]=Lo(!1),[s,u]=Lo(!1),[c,d]=Lo({}),a=xa(new Set),m=xa(null),p=pa(C=>{let{isOutside:g,tableDOMNode:T}=ng(C,o.editorConfig?.lexical);if(g){n(!1),i(!1);return}if(!T)return;m.current=T;let S=null,b=null,k=null;if(e.getEditorState().read(()=>{let I=ha(T);if(zh(I)){let A=qh(I,R=>fa(R));if(!fa(A))return;if(k=Zh(A,e.getElementByKey(A.getKey())),k){let R=A.getChildrenSize(),F=A.getChildAtIndex(0)?.getChildrenSize(),W=Kh(I),Q=Vh(I);W===R-1?S=I:Q===F-1&&(b=I)}}},{editor:e}),!k)return;let x=k.parentElement;if(!x)return;let{bottom:w,height:_,left:y,right:O,width:v,y:N}=k.getBoundingClientRect(),E=!1;x&&x.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(E=x.scrollWidth>x.clientWidth);let{left:L,y:D}=t.getBoundingClientRect();S?(i(!1),n(!0),d({height:Ca,left:E&&x?x.offsetLeft:y-L,top:w-D+5,width:E&&x?x.offsetWidth:v})):b&&(i(!0),n(!1),d({height:_,left:O-L+5,top:N-D,width:Ca}))},50,250),f=tg(()=>new ResizeObserver(()=>{n(!1),i(!1)}),[]);ga(()=>{if(s)return document.addEventListener("mousemove",p),()=>{n(!1),i(!1),document.removeEventListener("mousemove",p)}},[s,p]),ga(()=>Qh(e.registerMutationListener(Yh,C=>{e.getEditorState().read(()=>{let g=!1;for(let[T,S]of C)switch(S){case"created":{a.current.add(T),g=!0;break}case"destroyed":{a.current.delete(T),g=!0;break}default:break}if(g){f.disconnect();for(let T of a.current){let{tableElement:S}=Gh(T);f.observe(S)}u(a.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,f]);let h=C=>{e.update(()=>{m.current&&(ha(m.current)?.selectEnd(),C?(Xh(),n(!1)):(Jh(),i(!1)))})};return e?.isEditable()?Uh(Wh,{children:[r&&jr("button",{"aria-label":"Add Row",className:o.editorConfig.lexical.theme.tableAddRows,onClick:()=>h(!0),style:{...c},type:"button"}),l&&jr("button",{"aria-label":"Add Column",className:o.editorConfig.lexical.theme.tableAddColumns,onClick:()=>h(!1),style:{...c},type:"button"})]}):null}function ng(t,e){let o=t.target;if(eg(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 ka(t){let e=Hh(2),{anchorElem:o}=t,r=o===void 0?document.body:o,[n]=ba();if(!n?.isEditable())return null;let l;return e[0]!==r?(l=og(jr(rg,{anchorElem:r}),r),e[0]=r,e[1]=l):l=e[1],l}import{c as lg}from"react/compiler-runtime";import{jsx as Hr,jsxs as ig}from"react/jsx-runtime";import{useLexicalComposerContext as sg}from"@lexical/react/LexicalComposerContext";import{TablePlugin as ag}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as cg,TableCellNode as ug,TableNode as dg,TableRowNode as mg}from"@lexical/table";import{mergeRegister as pg}from"@lexical/utils";import{formatDrawerSlug as fg,useEditDepth as hg}from"@payloadcms/ui";import{$getSelection as gg,$isRangeSelection as xg,COMMAND_PRIORITY_EDITOR as Cg,createCommand as bg}from"lexical";import{createContext as kg,use as _g,useEffect as Tg,useMemo as wg,useState as Eg}from"react";import*as _a from"react";var yo=bg("OPEN_EMBED_DRAWER_COMMAND"),Ta=kg({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function wa({children:t}){let[e,o]=Eg({cellEditorConfig:null,cellEditorPlugins:null});return Hr(Ta,{value:wg(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var Ea=()=>{let t=lg(16),[e]=sg(),o=_g(Ta),r=hg(),{fieldProps:n,uuid:l}=j(),{schemaPath:i}=n,s="lexical-table-create-"+l,u;t[0]!==r||t[1]!==s?(u=fg({slug:s,depth:r}),t[0]=r,t[1]=s,t[2]=u):u=t[2];let c=u,{toggleDrawer:d}=fe(c,!0),a;t[3]!==e||t[4]!==d?(a=()=>{if(!e.hasNodes([dg,mg,ug]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return pg(e.registerCommand(yo,()=>{let h=null;return e.getEditorState().read(()=>{let C=gg();xg(C)&&(h=C)}),h&&d(),!0},Cg))},t[3]=e,t[4]=d,t[5]=a):a=t[5];let m;t[6]!==o||t[7]!==e||t[8]!==d?(m=[o,e,d],t[6]=o,t[7]=e,t[8]=d,t[9]=m):m=t[9],Tg(a,m);let p;t[10]!==e?(p=(h,C)=>{!C.columns||!C.rows||e.dispatchCommand(cg,{columns:String(C.columns),rows:String(C.rows)})},t[10]=e,t[11]=p):p=t[11];let f;return t[12]!==c||t[13]!==i||t[14]!==p?(f=ig(_a.Fragment,{children:[Hr(dt,{drawerSlug:c,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:p,schemaPath:i,schemaPathSuffix:"fields"}),Hr(ag,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]}),t[12]=c,t[13]=i,t[14]=p,t[15]=f):f=t[15],f};var yg=M({markdownTransformers:[zs],nodes:[Ng,Sg,Lg],plugins:[{Component:Ea,position:"normal"},{Component:da,position:"normal"},{Component:na,position:"floatingAnchorElem"},{Component:ka,position:"floatingAnchorElem"}],providers:[wa],slashMenu:{groups:[z([{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 px}from"lexical";import{jsx as Ur,jsxs as Rg}from"react/jsx-runtime";import"react";var Wr=()=>Rg("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 Ra}from"react/jsx-runtime";import Ia from"bson-objectid";import{$applyNodeReplacement as Ag}from"lexical";import*as va from"react";import Ig 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 Ig.default().toHexString(),src:t.getAttribute("src")||""}}})}}import{DecoratorBlockNode as vg}from"@lexical/react/LexicalDecoratorBlockNode.js";import Na from"bson-objectid";import{$applyNodeReplacement as Mg}from"lexical";var Ft=class extends vg{__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,Sa),priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new Na.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,pending:e.pending,relationTo:e.relationTo,value:e.value},r=Sa({data:o});return r.setFormat(e.format),r}static isInline(){return!1}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 Sa({data:t}){return t?.id||(t.id=new Na.default().toHexString()),Mg(new Ft({data:t}))}import{jsx as La}from"react/jsx-runtime";import{ShimmerEffect as Dg}from"@payloadcms/ui";var ya=()=>La("div",{className:"lexical-upload",children:La(Dg,{height:"95px",width:"203px"})});var $g=va.lazy(()=>import("./component-VDJI45F2.js").then(t=>({default:t.UploadComponent}))),ie=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 Ia.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(){return this.__data.pending?Ra(ya,{}):Ra($g,{data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Me({data:t}){return t?.id||(t.id=new Ia.default().toHexString()),Ag(new ie({data:t}))}function it(t){return t instanceof ie}import{c as Wg}from"react/compiler-runtime";import{jsx as Gg}from"react/jsx-runtime";import{useLexicalComposerContext as Vg}from"@lexical/react/LexicalComposerContext.js";import{$dfsIterator as Ua,$insertNodeToNearestRoot as Kr,mergeRegister as Kg}from"@lexical/utils";import{useBulkUpload as Jg,useConfig as Xg,useEffectEvent as zg,useModal as Zg}from"@payloadcms/ui";import Jr from"bson-objectid";import{$createRangeSelection as Yg,$getPreviousSelection as Fa,$getSelection as Pa,$isParagraphNode as Xr,$isRangeSelection as Ba,$setSelection as qg,COMMAND_PRIORITY_EDITOR as Qg,COMMAND_PRIORITY_LOW as ja,createCommand as ex,DROP_COMMAND as tx,getDOMSelectionFromTarget as ox,isHTMLElement as Ha,PASTE_COMMAND as rx}from"lexical";import{useEffect as nx}from"react";import{c as Ma}from"react/compiler-runtime";import{jsx as Gr}from"react/jsx-runtime";import{useLexicalComposerContext as Da}from"@lexical/react/LexicalComposerContext.js";import{toast as Og}from"@payloadcms/ui";import{$getNodeByKey as Fg,COMMAND_PRIORITY_EDITOR as Aa}from"lexical";import{useEffect as $a,useState as Pg}from"react";var Bg=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=Fg(o);n&&n.replace(Me({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(Vr,{fields:null,relationTo:e,value:r})},jg=t=>{let e=Ma(13),{enabledCollectionSlugs:o}=t,[r]=Da(),[n,l]=Pg(null),i;e[0]!==o?(i={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=i):i=e[1];let{closeListDrawer:s,ListDrawer:u,openListDrawer:c}=Mt(i),d,a;e[2]!==r||e[3]!==c?(d=()=>r.registerCommand(Ke,h=>(l(h?.replace?h?.replace.nodeKey:null),c(),!0),Aa),a=[r,c],e[2]=r,e[3]=c,e[4]=d,e[5]=a):(d=e[4],a=e[5]),$a(d,a);let m;e[6]!==s||e[7]!==r||e[8]!==n?(m=h=>{let{collectionSlug:C,doc:g}=h;s(),Bg({editor:r,relationTo:C,replaceNodeKey:n,value:g.id})},e[6]=s,e[7]=r,e[8]=n,e[9]=m):m=e[9];let p=m,f;return e[10]!==u||e[11]!==p?(f=Gr(u,{onSelect:p}),e[10]=u,e[11]=p,e[12]=f):f=e[12],f},Hg=()=>{let t=Ma(3),[e]=Da(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Ke,Ug,Aa),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),$a(o,r),null},Oa=t=>Gr(Gt,{...t,FallbackComponent:Hg,uploads:!0,children:Gr(jg,{...t})});function Ug(){return Og.error("No upload collections enabled"),!0}function lx(t){let e=t.target;return!!(Ha(e)&&!e.closest("code, span.editor-image")&&Ha(e.parentElement)&&e.parentElement.closest("div.ContentEditable__root"))}function ix(t){let e,o=ox(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=ex("INSERT_UPLOAD_COMMAND"),Wa=()=>{let t=Wg(18),[e]=Vg(),{config:o}=Xg(),{collections:r}=o,{drawerSlug:n,setCollectionSlug:l,setInitialForms:i,setOnCancel:s,setOnSuccess:u,setSelectableCollections:c}=Jg(),{isModalOpen:d,openModal:a}=Zg(),m;t[0]!==n||t[1]!==r||t[2]!==e||t[3]!==d||t[4]!==a||t[5]!==l||t[6]!==i||t[7]!==s||t[8]!==u||t[9]!==c?(m=g=>{let{files:T}=g;if(T?.length!==0&&(i(S=>[...S??[],...T.map(sx)]),!d(n))){let S=r.filter(ax).map(cx);if(!S.length||!S[0])return;l(S[0]),c(S),s(()=>{e.update(ux)}),u(b=>{let k=new Map(b.map(dx));e.update(()=>{for(let x of Ua()){let w=x.node;if(it(w)){let _=w.getData();if(_?.pending){let y=k.get(_.pending?.formID);y&&w.replace(Me({data:{id:new Jr.default().toHexString(),fields:{},relationTo:y.collectionSlug,value:y.doc.id}}))}}}})}),a(n)}},t[0]=n,t[1]=r,t[2]=e,t[3]=d,t[4]=a,t[5]=l,t[6]=i,t[7]=s,t[8]=u,t[9]=c,t[10]=m):m=t[10];let p=zg(m),f;t[11]!==e||t[12]!==p?(f=()=>{if(!e.hasNodes([ie]))throw new Error("UploadPlugin: UploadNode not registered on editor");return Kg(e.registerNodeTransform(ie,g=>{let T=g.getData();if(!T?.pending)return;(async function(){let k=null,x=T?.pending?.src,w=T?.pending?.formID;if(x?.startsWith("data:")){let _=x.match(/data:(image\/[a-zA-Z]+);base64,/),y=_?_[1]:"image/png",O=x.replace(/^data:image\/[a-zA-Z]+;base64,/,""),v=atob(O),N=new Array(v.length);for(let D=0;D<v.length;D++)N[D]=v.charCodeAt(D);let E=new Uint8Array(N);k={alt:void 0,file:new File([E],"pasted-image."+y?.split("/")[1],{type:y}),formID:w}}else if(x?.startsWith("http")||x?.startsWith("https")){let y=await(await fetch(x)).blob(),O=x.split("/").pop()||"pasted-image"+y.type.split("/")[1];k={alt:void 0,file:new File([y],O,{type:y.type}),formID:w}}k&&p({files:[k]})})()}),e.registerCommand(Vr,g=>(e.update(()=>{let T=Pa()||Fa();if(Ba(T)){let S=Me({data:{id:g.id,fields:g.fields,relationTo:g.relationTo,value:g.value}}),{focus:b}=T,k=b.getNode();Kr(S),Xr(k)&&!k.__first&&k.remove()}}),!0),Qg),e.registerCommand(rx,g=>{if(!(g instanceof ClipboardEvent))return!1;let T=g.clipboardData;if(!T?.types?.length||T?.types?.includes("text/html"))return!1;let S=[];return T?.files?.length&&Array.from(T.files).forEach(b=>{S.push({alt:"",file:b,formID:new Jr.default().toHexString()})}),S.length?(e.update(()=>{let b=Pa()||Fa();if(Ba(b))for(let k of S){let x=new ie({data:{pending:{formID:k.formID,src:URL.createObjectURL(k.file)}}}),{focus:w}=b,_=w.getNode();Kr(x),Xr(_)&&!_.__first&&_.remove()}}),p({files:S}),!0):!1},ja),e.registerCommand(tx,g=>{if(!(g instanceof DragEvent))return!1;let T=g.dataTransfer;if(!T?.types?.length)return!1;let S=[];return T?.files?.length&&Array.from(T.files).forEach(b=>{S.push({alt:"",file:b,formID:new Jr.default().toHexString()})}),S.length?(g.preventDefault(),g.stopPropagation(),e.update(()=>{if(lx(g)){let b=ix(g),k=Yg();b!=null&&k.applyDOMRange(b),qg(k);for(let x of S){let w=new ie({data:{pending:{formID:x.formID,src:URL.createObjectURL(x.file)}}}),{focus:_}=k,y=_.getNode();Kr(w),Xr(y)&&!y.__first&&y.remove()}}}),p({files:S}),!0):!1},ja))},t[11]=e,t[12]=p,t[13]=f):f=t[13];let h;t[14]!==e?(h=[e],t[14]=e,t[15]=h):h=t[15],nx(f,h);let C;return t[16]!==r?(C=Gg(Oa,{enabledCollectionSlugs:r.map(mx)}),t[16]=r,t[17]=C):C=t[17],C};function sx(t){return{file:t.file,formID:t.formID}}function ax(t){let{upload:e}=t;return!!e}function cx(t){let{slug:e}=t;return e}function ux(){for(let t of Ua()){let e=t.node;it(e)&&e.getData()?.pending&&e.remove()}}function dx(t){return[t.formID,t]}function mx(t){let{slug:e}=t;return e}var fx=M({nodes:[ie],plugins:[{Component:Wa,position:"normal"}],slashMenu:{groups:[z([{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(!px(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return it(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ke,{replace:!1})}}])]}});import{c as gx}from"react/compiler-runtime";import{jsx as Zr}from"react/jsx-runtime";import{ShimmerEffect as xx,useConfig as Cx}from"@payloadcms/ui";import{lazy as bx,Suspense as kx,useEffect as _x,useState as Tx}from"react";var Ga={block:"LexicalEditorTheme__block",blockCursor:"LexicalEditorTheme__blockCursor",characterLimit:"LexicalEditorTheme__characterLimit",code:"LexicalEditorTheme__code",codeHighlight:{atrule:"LexicalEditorTheme__tokenAttr",attr:"LexicalEditorTheme__tokenAttr",boolean:"LexicalEditorTheme__tokenProperty",builtin:"LexicalEditorTheme__tokenSelector",cdata:"LexicalEditorTheme__tokenComment",char:"LexicalEditorTheme__tokenSelector",class:"LexicalEditorTheme__tokenFunction","class-name":"LexicalEditorTheme__tokenFunction",comment:"LexicalEditorTheme__tokenComment",constant:"LexicalEditorTheme__tokenProperty",deleted:"LexicalEditorTheme__tokenProperty",doctype:"LexicalEditorTheme__tokenComment",entity:"LexicalEditorTheme__tokenOperator",function:"LexicalEditorTheme__tokenFunction",important:"LexicalEditorTheme__tokenVariable",inserted:"LexicalEditorTheme__tokenSelector",keyword:"LexicalEditorTheme__tokenAttr",namespace:"LexicalEditorTheme__tokenVariable",number:"LexicalEditorTheme__tokenProperty",operator:"LexicalEditorTheme__tokenOperator",prolog:"LexicalEditorTheme__tokenComment",property:"LexicalEditorTheme__tokenProperty",punctuation:"LexicalEditorTheme__tokenPunctuation",regex:"LexicalEditorTheme__tokenVariable",selector:"LexicalEditorTheme__tokenSelector",string:"LexicalEditorTheme__tokenSelector",symbol:"LexicalEditorTheme__tokenProperty",tag:"LexicalEditorTheme__tokenProperty",url:"LexicalEditorTheme__tokenOperator",variable:"LexicalEditorTheme__tokenVariable"},embedBlock:{base:"LexicalEditorTheme__embedBlock",focus:"LexicalEditorTheme__embedBlockFocus"},hashtag:"LexicalEditorTheme__hashtag",heading:{h1:"LexicalEditorTheme__h1",h2:"LexicalEditorTheme__h2",h3:"LexicalEditorTheme__h3",h4:"LexicalEditorTheme__h4",h5:"LexicalEditorTheme__h5",h6:"LexicalEditorTheme__h6"},hr:"LexicalEditorTheme__hr",hrSelected:"LexicalEditorTheme__hrSelected",indent:"LexicalEditorTheme__indent",inlineImage:"LexicalEditor__inline-image",link:"LexicalEditorTheme__link",list:{checklist:"LexicalEditorTheme__checklist",listitem:"LexicalEditorTheme__listItem",listitemChecked:"LexicalEditorTheme__listItemChecked",listitemUnchecked:"LexicalEditorTheme__listItemUnchecked",nested:{listitem:"LexicalEditorTheme__nestedListItem"},olDepth:["LexicalEditorTheme__ol1","LexicalEditorTheme__ol2","LexicalEditorTheme__ol3","LexicalEditorTheme__ol4","LexicalEditorTheme__ol5"],ul:"LexicalEditorTheme__ul"},ltr:"LexicalEditorTheme__ltr",mark:"LexicalEditorTheme__mark",markOverlap:"LexicalEditorTheme__markOverlap",paragraph:"LexicalEditorTheme__paragraph",quote:"LexicalEditorTheme__quote",relationship:"LexicalEditorTheme__relationship",rtl:"LexicalEditorTheme__rtl",tab:"LexicalEditorTheme__tabNode",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableAlignment:{center:"LexicalEditorTheme__tableAlignmentCenter",right:"LexicalEditorTheme__tableAlignmentRight"},tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableFrozenColumn:"LexicalEditorTheme__tableFrozenColumn",tableRowStriping:"LexicalEditorTheme__tableRowStriping",tableScrollableWrapper:"LexicalEditorTheme__tableScrollableWrapper",tableSelected:"LexicalEditorTheme__tableSelected",tableSelection:"LexicalEditorTheme__tableSelection",text:{bold:"LexicalEditorTheme__textBold",code:"LexicalEditorTheme__textCode",italic:"LexicalEditorTheme__textItalic",strikethrough:"LexicalEditorTheme__textStrikethrough",subscript:"LexicalEditorTheme__textSubscript",superscript:"LexicalEditorTheme__textSuperscript",underline:"LexicalEditorTheme__textUnderline",underlineStrikethrough:"LexicalEditorTheme__textUnderlineStrikethrough"},upload:"editor-upload"};var Io={namespace:"lexical",theme:Ga};function Va({config:t,featureClientImportMap:e,featureClientSchemaMap:o,field:r,schemaPath:n,unSanitizedEditorConfig:l}){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.");l.features=l.features.sort((c,d)=>c.clientFeatureProps.order-d.clientFeatureProps.order);let i=new Map;for(let c of l.features)i.set(c.clientFeatureProps.featureKey,c);let s=new Map,u=0;for(let c of l.features){let d=typeof c.feature=="function"?c.feature({config:t,featureClientImportMap:e,featureClientSchemaMap:o,featureProviderMap:i,field:r,resolvedFeatures:s,schemaPath:n,unSanitizedEditorConfig:l}):c.feature;d.key=c.clientFeatureProps.featureKey,d.order=u,s.set(c.clientFeatureProps.featureKey,d),u++}return s}import{deepMerge as hx}from"payload/shared";var Ka=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?hx(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:Ka(t),lexical:e,resolvedFeatureMap:t}}var wx=bx(()=>import("./Field-2MCIQXRP.js").then(t=>({default:t.RichText}))),Ex=t=>{let e=gx(16),{admin:o,clientFeatures:r,featureClientImportMap:n,featureClientSchemaMap:l,field:i,lexicalEditorConfig:s,schemaPath:u}=t,c;e[0]!==o?(c=o===void 0?{}:o,e[0]=o,e[1]=c):c=e[1];let d=c,a=s===void 0?Io:s,{config:m}=Cx(),[p,f]=Tx(null),h,C;e[2]!==d||e[3]!==r||e[4]!==m||e[5]!==n||e[6]!==l||e[7]!==i||e[8]!==p||e[9]!==a||e[10]!==u?(h=()=>{if(p)return;let T=[];for(let[k,x]of Object.entries(r))x.clientFeatureProvider&&T.push(x.clientFeatureProvider(x.clientFeatureProps));let S=a||Io,b=Va({config:m,featureClientImportMap:n,featureClientSchemaMap:l,field:i,schemaPath:u??i.name,unSanitizedEditorConfig:{features:T,lexical:S}});f(zr(b,S,d))},C=[a,d,p,r,n,l,i,m,u],e[2]=d,e[3]=r,e[4]=m,e[5]=n,e[6]=l,e[7]=i,e[8]=p,e[9]=a,e[10]=u,e[11]=h,e[12]=C):(h=e[11],C=e[12]),_x(h,C);let g;return e[13]!==p||e[14]!==t?(g=Zr(kx,{fallback:Zr(xx,{height:"35vh"}),children:p&&Zr(wx,{...t,editorConfig:p})}),e[13]=p,e[14]=t,e[15]=g):g=e[15],g};function Sx(t){return t instanceof HTMLElement}function Nx(...t){return t.filter(Boolean).join(" ")}var vo=new WeakMap;function Ja(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function Mo(t,e){let o=vo.get(t);if(o===void 0){let r=new Set,n=i=>{o!==void 0&&(o.start=Ja(i))},l=i=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let u=Ja(i);for(let c of r)u!==null&&c([u[0]-s[0],u[1]-s[1]],i)};t.addEventListener("touchstart",n),t.addEventListener("touchend",l),o={handleTouchend:l,handleTouchstart:n,listeners:r,start:null},vo.set(t,o)}return o.listeners.add(e),()=>{Lx(t,e)}}function Lx(t,e){let o=vo.get(t);if(o===void 0)return;let{listeners:r}=o;r.delete(e),r.size===0&&(vo.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function yx(t,e){return Mo(t,(o,r)=>{let[n,l]=o;n<0&&-n>Math.abs(l)&&e(n,r)})}function Rx(t,e){return Mo(t,(o,r)=>{let[n,l]=o;n>0&&n>Math.abs(l)&&e(n,r)})}function Ix(t,e){return Mo(t,(o,r)=>{let[n,l]=o;l<0&&-l>Math.abs(n)&&e(n,r)})}function vx(t,e){return Mo(t,(o,r)=>{let[n,l]=o;l>0&&l>Math.abs(n)&&e(n,r)})}import{c as Mx}from"react/compiler-runtime";import{jsx as Dx}from"react/jsx-runtime";import"react";var Ax=()=>{let t=Mx(2),{EditButton:e}=he(),o;return t[0]!==e?(o=e?Dx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as $x}from"react/compiler-runtime";import{jsx as Ox}from"react/jsx-runtime";import"react";var Fx=()=>{let t=$x(2),{RemoveButton:e}=he(),o;return t[0]!==e?(o=e?Ox(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Px}from"react/compiler-runtime";import{jsx as Bx}from"react/jsx-runtime";import"react";var jx=()=>{let t=Px(2),{Label:e}=he(),o;return t[0]!==e?(o=e?Bx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Hx}from"react/compiler-runtime";import{jsx as Ux}from"react/jsx-runtime";import"react";var Wx=t=>{let e=Hx(3),{children:o}=t,{InlineBlockContainer:r}=he(),n;return e[0]!==r||e[1]!==o?(n=r?Ux(r,{children:o}):null,e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{jsx as Gx}from"react/jsx-runtime";import"react";var Vx=t=>{let{children:e,...o}=t,{BlockCollapsible:r}=ge();return r?Gx(r,{...o,children:e}):null};import{c as Kx}from"react/compiler-runtime";import{jsx as Jx}from"react/jsx-runtime";import"react";var Xx=()=>{let t=Kx(2),{EditButton:e}=ge(),o;return t[0]!==e?(o=e?Jx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as zx}from"react/compiler-runtime";import{jsx as Zx}from"react/jsx-runtime";import"react";var Yx=()=>{let t=zx(2),{RemoveButton:e}=ge(),o;return t[0]!==e?(o=e?Zx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as qx}from"qs-esm";var Qx=({apiURL:t,depth:e,draft:o,locale:r})=>async({id:l,collectionSlug:i,select:s})=>{let u=qx({depth:e??0,draft:o??!1,locale:r,select:s},{addQueryPrefix:!0});return await fetch(`${t}/${i}/${l}${u}`,{credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json"},method:"GET"}).then(d=>d.json())};var Xa={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(`
64
64
  `)&&(t=t.slice(0,-1)),!!e&&!t.includes(`
65
- `)&&o?.input?.trim()!=="```"+r?{code:r+(t?.length?t:""),language:""}:{code:t,language:r}}};import{jsx as eC}from"react/jsx-runtime";import{CodeField as tC,useFormFields as oC}from"@payloadcms/ui";import{useMemo as rC}from"react";var nC=({autoComplete:t,field:e,forceRender:o,languages:r={js:"JavaScript",plaintext:"Plain Text",ts:"TypeScript"},path:n,permissions:l,readOnly:i,renderedBlocks:s,schemaPath:u,typescript:c,validate:d})=>{let a=oC(([x])=>x.language),m=a?.value||a?.initialValue||"typescript",p=r[m],f=rC(()=>({...e,type:"code",admin:{...e.admin,editorOptions:{},language:m}}),[e,m]),h=`${e.name}-${m}-${p}`;return f&&eC(tC,{autoComplete:t,field:f,forceRender:o,onMount:(x,C)=>{C.editor.defineTheme("vs-dark",{base:"vs-dark",colors:{"editor.background":"#222222"},inherit:!0,rules:[]}),C.editor.defineTheme("vs",{base:"vs",colors:{"editor.background":"#f5f5f5"},inherit:!0,rules:[]}),C.languages.typescript.typescriptDefaults.setCompilerOptions({allowNonTsExtensions:!0,moduleResolution:C.languages.typescript.ModuleResolutionKind.NodeJs,paths:c?.paths,target:C.languages.typescript.ScriptTarget[c?.target??"ESNext"],typeRoots:c?.typeRoots??["node_modules/@types"]}),(async()=>{c?.fetchTypes&&Array.isArray(c.fetchTypes)&&c.fetchTypes.length>0&&await Promise.all(c.fetchTypes.map(async S=>{let k=await(await fetch(S.url)).text();C.languages.typescript.typescriptDefaults.addExtraLib(k,S.filePath)}))})()},path:n,permissions:l,readOnly:i,renderedBlocks:s,schemaPath:u,validate:d},h)};import{c as dC}from"react/compiler-runtime";import{jsx as q,jsxs as oc,Fragment as mC}from"react/jsx-runtime";import{ChevronIcon as pC,CopyToClipboard as fC,Popup as hC,PopupList as rc,RenderFields as gC,useForm as xC,useFormFields as nc}from"@payloadcms/ui";import"react";import{jsx as za}from"react/jsx-runtime";import"react";var Za=()=>za("svg",{fill:"none",height:"12",viewBox:"0 0 15 12",width:"15",xmlns:"http://www.w3.org/2000/svg",children:za("path",{d:"M11.3738 8.62598L14.0404 5.95931L11.3738 3.29264M3.37376 3.29264L0.707092 5.95931L3.37376 8.62598M9.04043 0.625977L5.70709 11.2926",stroke:"currentColor",strokeLinecap:"square"})});import{jsx as qa}from"react/jsx-runtime";import"react";import{useCollapsible as iC}from"@payloadcms/ui";import{jsx as Ya}from"react/jsx-runtime";import"react";var Do=()=>Ya("svg",{fill:"none",height:"15",viewBox:"0 0 15 15",width:"15",xmlns:"http://www.w3.org/2000/svg",children:Ya("path",{d:"M7.16667 13.8333V9.83333M7.16667 9.83333L9.16667 11.8333M7.16667 9.83333L5.16667 11.8333M7.16667 4.5V0.5M7.16667 4.5L9.16667 2.5M7.16667 4.5L5.16667 2.5M1.83333 7.16667H0.5M5.83333 7.16667H4.5M9.83333 7.16667H8.5M13.8333 7.16667H12.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})});var lC="code-block-collapse-button",Qa=()=>{let{toggle:t}=iC();return qa("button",{className:lC,onClick:t,type:"button",children:qa(Do,{})})};import{jsx as ec,jsxs as sC}from"react/jsx-runtime";import"react";import{useCollapsible as cC,useTranslation as uC}from"@payloadcms/ui";var aC="code-block-floating-collapse-button",tc=()=>{let{isCollapsed:t,toggle:e}=cC(),{t:o}=uC();return t?sC("button",{className:aC,onClick:e,type:"button",children:[ec("span",{children:o("general:collapse")}),ec(Do,{})]}):null};var Ue="payload-richtext-code-block",CC=t=>{let e=dC(13),{languages:o}=t,{BlockCollapsible:r,formSchema:n}=ge(),{setModified:l}=xC(),{codeField:i}=nc(bC),s;e[0]!==l?(s=p=>{let[f,h]=p;return{selectedLanguageField:f?.language,setSelectedLanguage:x=>{h({type:"UPDATE",path:"language",value:x}),l(!0)}}},e[0]=l,e[1]=s):s=e[1];let{selectedLanguageField:u,setSelectedLanguage:c}=nc(s),d=o[u?.value],a=u?.value,m;if(e[2]!==r||e[3]!==i?.value||e[4]!==n||e[5]!==o||e[6]!==d||e[7]!==c||e[8]!==a){let p;e[10]!==o||e[11]!==c?(p=f=>{let{close:h}=f;return q(rc.ButtonGroup,{children:Object.entries(o).map(x=>{let[C,T]=x;return q(rc.Button,{active:!1,disabled:!1,onClick:()=>{c(C),h()},children:q("span",{className:`${Ue}__language-code`,"data-language":C,children:T})},C)})})},e[10]=o,e[11]=c,e[12]=p):p=e[12],m=q(r,{Actions:oc("div",{className:`${Ue}__actions`,children:[q(hC,{button:oc("div",{className:`${Ue}__language-selector-button`,"data-selected-language":a,children:[q("span",{children:d}),q(pC,{className:`${Ue}__chevron`})]}),className:`${Ue}__language-selector`,horizontalAlign:"right",render:p,showScrollbar:!0,size:"large"}),q(fC,{value:i?.value??""}),q(Qa,{})]}),className:Ue,collapsibleProps:{AfterCollapsible:q(tc,{}),disableHeaderToggle:!0,disableToggleIndicator:!0},Pill:q("div",{className:`${Ue}__pill`,children:q(Za,{})}),children:q(mC,{children:q(gC,{fields:n,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0})})}),e[2]=r,e[3]=i?.value,e[4]=n,e[5]=o,e[6]=d,e[7]=c,e[8]=a,e[9]=m}else m=e[9];return m};function bC(t){let[e]=t;return{codeField:e?.code}}import{c as kC}from"react/compiler-runtime";import{jsx as st}from"react/jsx-runtime";import{FieldContext as _C,FieldPathContext as lc,ServerFunctionsContext as ic,ShimmerEffect as TC,useServerFunctions as wC}from"@payloadcms/ui";import EC,{useEffect as SC,useRef as NC}from"react";var LC=t=>{let e=kC(9),{field:o,initialValue:r,Loading:n,path:l,schemaPath:i,setValue:s,value:u}=t,[c,d]=EC.useState(null),a=wC(),{_internal_renderField:m}=a,[p,f]=i.split("."),h=l??(o&&"name"in o?o?.name:"")??"",x;e[0]!==m||e[1]!==o||e[2]!==r||e[3]!==l||e[4]!==i?(x=()=>{(async function(){let{Field:y}=await m({field:{...o||{},type:"richText",admin:{hidden:!1}},initialValue:r??void 0,path:l,schemaPath:i});d(y)})()},e[0]=m,e[1]=o,e[2]=r,e[3]=l,e[4]=i,e[5]=x):x=e[5];let C=x,T=NC(!1),S,b;if(e[6]!==C?(S=()=>{T.current||(T.current=!0,C())},b=[C],e[6]=C,e[7]=S,e[8]=b):(S=e[7],b=e[8]),SC(S,b),!c)return typeof n<"u"?n:st(TC,{});let k={...a,getFormState:async w=>a.getFormState({...w,collectionSlug:p==="collection"?f:void 0,globalSlug:p==="global"?f:void 0})};if(typeof u>"u"&&!s)return st(ic,{value:{...k},children:st(lc,{value:h,children:c},h)});let g={disabled:!1,formInitializing:!1,formProcessing:!1,formSubmitted:!1,initialValue:u,path:h,setValue:s??yC,showError:!1,value:u};return st(ic,{value:{...k},children:st(lc,{value:h,children:st(_C,{value:g,children:c})},h)})};function yC(){}function RC({nodes:t,text:e}){let o={root:{type:"root",children:[],direction:"ltr",format:"",indent:0,version:1}};return e&&o.root.children.push({type:"paragraph",children:[{type:"text",detail:0,format:0,mode:"normal",style:"",text:e,version:1}],direction:"ltr",format:"",indent:0,textFormat:0,textStyle:"",version:1}),t?.length&&o.root.children.push(...t),o}export{Tt as $createAutoLinkNode,Ae as $createBlockNode,ct as $createInlineBlockNode,Ce as $createLinkNode,je as $createRelationshipNode,Me as $createUploadNode,ke as $isAutoLinkNode,De as $isBlockNode,ut as $isInlineBlockNode,K as $isLinkNode,wr as $isRelationshipNode,it as $isUploadNode,kc as AlignFeatureClient,be as AutoLinkNode,Vx as BlockCollapsible,Xx as BlockEditButton,se as BlockNode,Yx as BlockRemoveButton,Sc as BlockquoteFeatureClient,Iu as BlocksFeatureClient,Qu as BoldFeatureClient,le as CAN_USE_DOM,of as ChecklistFeatureClient,CC as CodeBlockBlockComponent,nC as CodeComponent,Jf as DETAIL_TYPE_TO_DETAIL,Wf as DOUBLE_LINE_BREAK,n0 as DebugJsxConverterFeatureClient,zf as ELEMENT_FORMAT_TO_TYPE,Xf as ELEMENT_TYPE_TO_FORMAT,pc as ENABLE_SLASH_MENU_COMMAND,cc as EditorConfigProvider,dt as FieldsDrawer,N1 as FixedToolbarFeatureClient,Xd as HeadingFeatureClient,mm as HorizontalRuleFeatureClient,Je as INSERT_BLOCK_COMMAND,Xe as INSERT_INLINE_BLOCK_COMMAND,Hf as IS_ALL_FORMATTING,ym as IndentFeatureClient,Wx as InlineBlockContainer,Ax as InlineBlockEditButton,jx as InlineBlockLabel,at as InlineBlockNode,Fx as InlineBlockRemoveButton,nd as InlineCodeFeatureClient,F1 as InlineToolbarFeatureClient,ad as ItalicFeatureClient,Vf as LTR_REGEX,Sf as LexicalPluginToLexicalFeatureClient,Hp as LinkFeatureClient,oe as LinkNode,Uf as NON_BREAKING_SPACE,$ as NodeFormat,df as OrderedListFeatureClient,Df as ParagraphFeatureClient,dc as Point,Gf as RTL_REGEX,fc as Rect,G0 as RelationshipFeatureClient,Te as RelationshipNode,LC as RenderLexical,Ex as RichTextField,vf as SlateToLexicalFeatureClient,pd as StrikethroughFeatureClient,xd as SubscriptFeatureClient,_d as SuperscriptFeatureClient,Zf as TEXT_MODE_TO_TYPE,Kf as TEXT_TYPE_TO_FORMAT,Yf as TEXT_TYPE_TO_MODE,de as TOGGLE_LINK_COMMAND,yg as TableFeatureClient,Gu as TestRecorderFeatureClient,Fd as TextStateFeatureClient,Dt as ToolbarButton,He as ToolbarDropdown,zu as TreeViewFeatureClient,Nd as UnderlineFeatureClient,bf as UnorderedListFeatureClient,fx as UploadFeatureClient,ie as UploadNode,vx as addSwipeDownListener,yx as addSwipeLeftListener,Rx as addSwipeRightListener,Ix as addSwipeUpListener,RC as buildEditorState,Xa as codeConverterClient,tr as createBlockNode,M as createClientFeature,l0 as defaultColors,Io as defaultEditorLexicalConfig,yr as getDOMRangeRect,hc as getEnabledNodes,Qx as getRestPopulateFn,ze as getSelectedNode,Sx as isHTMLElement,mc as isPoint,Nx as joinClasses,zr as sanitizeClientEditorConfig,Ka as sanitizeClientFeatures,bo as setFloatingElemPosition,po as setFloatingElemPositionForLinkEditor,z as slashMenuBasicGroupWithItems,xe as toolbarAddDropdownGroupWithItems,rr as toolbarFeatureButtonsGroupWithItems,Z as toolbarFormatGroupWithItems,ee as toolbarTextDropdownGroupWithItems,ge as useBlockComponentContext,j as useEditorConfigContext,he as useInlineBlockComponentContext,uc as useLexicalDocumentDrawer,fe as useLexicalDrawer,Mt as useLexicalListDrawer};
65
+ `)&&o?.input?.trim()!=="```"+r?{code:r+(t?.length?t:""),language:""}:{code:t,language:r}}};import{jsx as eC}from"react/jsx-runtime";import{CodeField as tC,useFormFields as oC}from"@payloadcms/ui";import{useMemo as rC}from"react";var nC=({autoComplete:t,field:e,forceRender:o,languages:r={js:"JavaScript",plaintext:"Plain Text",ts:"TypeScript"},path:n,permissions:l,readOnly:i,renderedBlocks:s,schemaPath:u,typescript:c,validate:d})=>{let a=oC(([C])=>C.language),m=a?.value||a?.initialValue||"typescript",p=r[m],f=rC(()=>({...e,type:"code",admin:{...e.admin,editorOptions:{},editorProps:{defaultPath:m==="ts"?"file.tsx":void 0},language:m}}),[e,m]),h=`${e.name}-${m}-${p}`;return f&&eC(tC,{autoComplete:t,field:f,forceRender:o,onMount:(C,g)=>{g.editor.defineTheme("vs-dark",{base:"vs-dark",colors:{"editor.background":"#222222"},inherit:!0,rules:[]}),g.editor.defineTheme("vs",{base:"vs",colors:{"editor.background":"#f5f5f5"},inherit:!0,rules:[]}),g.languages.typescript.typescriptDefaults.setCompilerOptions({allowNonTsExtensions:!0,allowJs:!0,allowSyntheticDefaultImports:!0,esModuleInterop:!0,jsx:g.languages.typescript.JsxEmit.React,moduleResolution:g.languages.typescript.ModuleResolutionKind.NodeJs,noEmit:!0,paths:c?.paths,reactNamespace:"React",target:g.languages.typescript.ScriptTarget[c?.target??"ESNext"],typeRoots:c?.typeRoots??["node_modules/@types"]}),g.languages.typescript.typescriptDefaults.setDiagnosticsOptions({noSemanticValidation:!c?.enableSemanticValidation,noSyntaxValidation:!1}),(async()=>{c?.fetchTypes&&Array.isArray(c.fetchTypes)&&c.fetchTypes.length>0&&await Promise.all(c.fetchTypes.map(async S=>{let k=await(await fetch(S.url)).text();g.languages.typescript.typescriptDefaults.addExtraLib(k,S.filePath)}))})()},path:n,permissions:l,readOnly:i,renderedBlocks:s,schemaPath:u,validate:d},h)};import{c as dC}from"react/compiler-runtime";import{jsx as Y,jsxs as oc,Fragment as mC}from"react/jsx-runtime";import{ChevronIcon as pC,CopyToClipboard as fC,Popup as hC,PopupList as rc,RenderFields as gC,useForm as xC,useFormFields as nc}from"@payloadcms/ui";import"react";import{jsx as za}from"react/jsx-runtime";import"react";var Za=()=>za("svg",{fill:"none",height:"12",viewBox:"0 0 15 12",width:"15",xmlns:"http://www.w3.org/2000/svg",children:za("path",{d:"M11.3738 8.62598L14.0404 5.95931L11.3738 3.29264M3.37376 3.29264L0.707092 5.95931L3.37376 8.62598M9.04043 0.625977L5.70709 11.2926",stroke:"currentColor",strokeLinecap:"square"})});import{jsx as qa}from"react/jsx-runtime";import"react";import{useCollapsible as iC}from"@payloadcms/ui";import{jsx as Ya}from"react/jsx-runtime";import"react";var Do=()=>Ya("svg",{fill:"none",height:"15",viewBox:"0 0 15 15",width:"15",xmlns:"http://www.w3.org/2000/svg",children:Ya("path",{d:"M7.16667 13.8333V9.83333M7.16667 9.83333L9.16667 11.8333M7.16667 9.83333L5.16667 11.8333M7.16667 4.5V0.5M7.16667 4.5L9.16667 2.5M7.16667 4.5L5.16667 2.5M1.83333 7.16667H0.5M5.83333 7.16667H4.5M9.83333 7.16667H8.5M13.8333 7.16667H12.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})});var lC="code-block-collapse-button",Qa=()=>{let{toggle:t}=iC();return qa("button",{className:lC,onClick:t,type:"button",children:qa(Do,{})})};import{jsx as ec,jsxs as sC}from"react/jsx-runtime";import"react";import{useCollapsible as cC,useTranslation as uC}from"@payloadcms/ui";var aC="code-block-floating-collapse-button",tc=()=>{let{isCollapsed:t,toggle:e}=cC(),{t:o}=uC();return t?sC("button",{className:aC,onClick:e,type:"button",children:[ec("span",{children:o("general:collapse")}),ec(Do,{})]}):null};var Ue="payload-richtext-code-block",CC=t=>{let e=dC(14),{languages:o}=t,{BlockCollapsible:r,formSchema:n,RemoveButton:l}=ge(),{setModified:i}=xC(),{codeField:s}=nc(bC),u;e[0]!==i?(u=f=>{let[h,C]=f;return{selectedLanguageField:h?.language,setSelectedLanguage:g=>{C({type:"UPDATE",path:"language",value:g}),i(!0)}}},e[0]=i,e[1]=u):u=e[1];let{selectedLanguageField:c,setSelectedLanguage:d}=nc(u),a=o[c?.value],m=c?.value,p;if(e[2]!==r||e[3]!==l||e[4]!==s?.value||e[5]!==n||e[6]!==o||e[7]!==a||e[8]!==d||e[9]!==m){let f;e[11]!==o||e[12]!==d?(f=h=>{let{close:C}=h;return Y(rc.ButtonGroup,{children:Object.entries(o).map(g=>{let[T,S]=g;return Y(rc.Button,{active:!1,disabled:!1,onClick:()=>{d(T),C()},children:Y("span",{className:`${Ue}__language-code`,"data-language":T,children:S})},T)})})},e[11]=o,e[12]=d,e[13]=f):f=e[13],p=Y(r,{Actions:oc("div",{className:`${Ue}__actions`,children:[Y(hC,{button:oc("div",{className:`${Ue}__language-selector-button`,"data-selected-language":m,children:[Y("span",{children:a}),Y(pC,{className:`${Ue}__chevron`})]}),className:`${Ue}__language-selector`,horizontalAlign:"right",render:f,showScrollbar:!0,size:"large"}),Y(fC,{value:s?.value??""}),Y(Qa,{}),Y(l,{})]}),className:Ue,collapsibleProps:{AfterCollapsible:Y(tc,{}),disableHeaderToggle:!0,disableToggleIndicator:!0},Pill:Y("div",{className:`${Ue}__pill`,children:Y(Za,{})}),children:Y(mC,{children:Y(gC,{fields:n,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0})})}),e[2]=r,e[3]=l,e[4]=s?.value,e[5]=n,e[6]=o,e[7]=a,e[8]=d,e[9]=m,e[10]=p}else p=e[10];return p};function bC(t){let[e]=t;return{codeField:e?.code}}import{c as kC}from"react/compiler-runtime";import{jsx as st}from"react/jsx-runtime";import{FieldContext as _C,FieldPathContext as lc,ServerFunctionsContext as ic,ShimmerEffect as TC,useServerFunctions as wC}from"@payloadcms/ui";import EC,{useEffect as SC,useRef as NC}from"react";var LC=t=>{let e=kC(9),{field:o,initialValue:r,Loading:n,path:l,schemaPath:i,setValue:s,value:u}=t,[c,d]=EC.useState(null),a=wC(),{_internal_renderField:m}=a,[p,f]=i.split("."),h=l??(o&&"name"in o?o?.name:"")??"",C;e[0]!==m||e[1]!==o||e[2]!==r||e[3]!==l||e[4]!==i?(C=()=>{(async function(){let{Field:y}=await m({field:{...o||{},type:"richText",admin:{hidden:!1}},initialValue:r??void 0,path:l,schemaPath:i});d(y)})()},e[0]=m,e[1]=o,e[2]=r,e[3]=l,e[4]=i,e[5]=C):C=e[5];let g=C,T=NC(!1),S,b;if(e[6]!==g?(S=()=>{T.current||(T.current=!0,g())},b=[g],e[6]=g,e[7]=S,e[8]=b):(S=e[7],b=e[8]),SC(S,b),!c)return typeof n<"u"?n:st(TC,{});let k={...a,getFormState:async w=>a.getFormState({...w,collectionSlug:p==="collection"?f:void 0,globalSlug:p==="global"?f:void 0})};if(typeof u>"u"&&!s)return st(ic,{value:{...k},children:st(lc,{value:h,children:c},h)});let x={disabled:!1,formInitializing:!1,formProcessing:!1,formSubmitted:!1,initialValue:u,path:h,setValue:s??yC,showError:!1,value:u};return st(ic,{value:{...k},children:st(lc,{value:h,children:st(_C,{value:x,children:c})},h)})};function yC(){}function RC({nodes:t,text:e}){let o={root:{type:"root",children:[],direction:"ltr",format:"",indent:0,version:1}};return e&&o.root.children.push({type:"paragraph",children:[{type:"text",detail:0,format:0,mode:"normal",style:"",text:e,version:1}],direction:"ltr",format:"",indent:0,textFormat:0,textStyle:"",version:1}),t?.length&&o.root.children.push(...t),o}export{Tt as $createAutoLinkNode,Ae as $createBlockNode,ct as $createInlineBlockNode,Ce as $createLinkNode,je as $createRelationshipNode,Me as $createUploadNode,ke as $isAutoLinkNode,De as $isBlockNode,ut as $isInlineBlockNode,K as $isLinkNode,wr as $isRelationshipNode,it as $isUploadNode,kc as AlignFeatureClient,be as AutoLinkNode,Vx as BlockCollapsible,Xx as BlockEditButton,se as BlockNode,Yx as BlockRemoveButton,Sc as BlockquoteFeatureClient,Iu as BlocksFeatureClient,Qu as BoldFeatureClient,le as CAN_USE_DOM,of as ChecklistFeatureClient,CC as CodeBlockBlockComponent,nC as CodeComponent,Jf as DETAIL_TYPE_TO_DETAIL,Wf as DOUBLE_LINE_BREAK,n0 as DebugJsxConverterFeatureClient,zf as ELEMENT_FORMAT_TO_TYPE,Xf as ELEMENT_TYPE_TO_FORMAT,pc as ENABLE_SLASH_MENU_COMMAND,cc as EditorConfigProvider,dt as FieldsDrawer,N1 as FixedToolbarFeatureClient,Xd as HeadingFeatureClient,mm as HorizontalRuleFeatureClient,Je as INSERT_BLOCK_COMMAND,Xe as INSERT_INLINE_BLOCK_COMMAND,Hf as IS_ALL_FORMATTING,ym as IndentFeatureClient,Wx as InlineBlockContainer,Ax as InlineBlockEditButton,jx as InlineBlockLabel,at as InlineBlockNode,Fx as InlineBlockRemoveButton,nd as InlineCodeFeatureClient,F1 as InlineToolbarFeatureClient,ad as ItalicFeatureClient,Vf as LTR_REGEX,Sf as LexicalPluginToLexicalFeatureClient,Hp as LinkFeatureClient,oe as LinkNode,Uf as NON_BREAKING_SPACE,$ as NodeFormat,df as OrderedListFeatureClient,Df as ParagraphFeatureClient,dc as Point,Gf as RTL_REGEX,fc as Rect,G0 as RelationshipFeatureClient,Te as RelationshipNode,LC as RenderLexical,Ex as RichTextField,vf as SlateToLexicalFeatureClient,pd as StrikethroughFeatureClient,xd as SubscriptFeatureClient,_d as SuperscriptFeatureClient,Zf as TEXT_MODE_TO_TYPE,Kf as TEXT_TYPE_TO_FORMAT,Yf as TEXT_TYPE_TO_MODE,de as TOGGLE_LINK_COMMAND,yg as TableFeatureClient,Gu as TestRecorderFeatureClient,Fd as TextStateFeatureClient,Dt as ToolbarButton,He as ToolbarDropdown,zu as TreeViewFeatureClient,Nd as UnderlineFeatureClient,bf as UnorderedListFeatureClient,fx as UploadFeatureClient,ie as UploadNode,vx as addSwipeDownListener,yx as addSwipeLeftListener,Rx as addSwipeRightListener,Ix as addSwipeUpListener,RC as buildEditorState,Xa as codeConverterClient,tr as createBlockNode,M as createClientFeature,l0 as defaultColors,Io as defaultEditorLexicalConfig,yr as getDOMRangeRect,hc as getEnabledNodes,Qx as getRestPopulateFn,ze as getSelectedNode,Sx as isHTMLElement,mc as isPoint,Nx as joinClasses,zr as sanitizeClientEditorConfig,Ka as sanitizeClientFeatures,bo as setFloatingElemPosition,po as setFloatingElemPositionForLinkEditor,z as slashMenuBasicGroupWithItems,xe as toolbarAddDropdownGroupWithItems,rr as toolbarFeatureButtonsGroupWithItems,Z as toolbarFormatGroupWithItems,ee as toolbarTextDropdownGroupWithItems,ge as useBlockComponentContext,j as useEditorConfigContext,he as useInlineBlockComponentContext,uc as useLexicalDocumentDrawer,fe as useLexicalDrawer,Mt as useLexicalListDrawer};
66
66
  //# sourceMappingURL=index.js.map