@payloadcms/richtext-lexical 3.41.0-canary.1 → 3.41.0-canary.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/exports/client/{Field-EY5V65PS.js → Field-6GAC5Y2D.js} +2 -2
- package/dist/exports/client/bundled.css +1 -1
- package/dist/exports/client/{chunk-DOZWITPU.js → chunk-LUNX5J6B.js} +2 -2
- package/dist/exports/client/{chunk-DOZWITPU.js.map → chunk-LUNX5J6B.js.map} +1 -1
- package/dist/exports/client/index.js +2 -2
- package/dist/exports/client/index.js.map +3 -3
- package/dist/features/blocks/client/plugin/index.js +1 -1
- package/dist/features/experimental_table/client/plugins/TablePlugin/index.js +1 -2
- package/dist/features/experimental_table/client/plugins/TablePlugin/index.js.map +1 -1
- package/dist/field/bundled.css +1 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +2 -4
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
- package/package.json +19 -16
- package/dist/scss/custom.css +0 -1
- /package/dist/exports/client/{Field-EY5V65PS.js.map → Field-6GAC5Y2D.js.map} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use client";import{a as be,c as _o,d as To,e as wo}from"./chunk-3BY5IZJD.js";import{a as at}from"./chunk-DBWINSQN.js";import{a as st,b as Ot,c as Ke}from"./chunk-FSKAVN4P.js";import{a as Ce}from"./chunk-INBEEENE.js";import{a as xa}from"./chunk-F26IQ5RE.js";import{a as ce,c as Ur,d as Gr,e as Ca,f as ba,h as ka,j as _a,k as Ta}from"./chunk-
|
|
1
|
+
"use client";import{a as be,c as _o,d as To,e as wo}from"./chunk-3BY5IZJD.js";import{a as at}from"./chunk-DBWINSQN.js";import{a as st,b as Ot,c as Ke}from"./chunk-FSKAVN4P.js";import{a as Ce}from"./chunk-INBEEENE.js";import{a as xa}from"./chunk-F26IQ5RE.js";import{a as ce,c as Ur,d as Gr,e as Ca,f as ba,h as ka,j as _a,k as Ta}from"./chunk-LUNX5J6B.js";import{a as ga,b as G}from"./chunk-BZZVLW4U.js";function ee(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{$isElementNode as ve,$isRangeSelection as Ft,FORMAT_ELEMENT_COMMAND as Pt}from"lexical";import{jsx as Eo,jsxs as wa}from"react/jsx-runtime";import"react";var Wr=()=>wa("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:[Eo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Eo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Eo("path",{d:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as No,jsxs as Ea}from"react/jsx-runtime";import"react";var Vr=()=>Ea("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:[No("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),No("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),No("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as So,jsxs as Na}from"react/jsx-runtime";import"react";var $t=()=>Na("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:[So("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),So("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),So("path",{d:"M2.5 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Lo,jsxs as Sa}from"react/jsx-runtime";import"react";var Kr=()=>Sa("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:[Lo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Lo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Lo("path",{d:"M7.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});var y=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 p=t({config:n,featureClientImportMap:l,featureClientSchemaMap:i,featureProviderMap:s,field:u,props:o,resolvedFeatures:c,schemaPath:d,unSanitizedEditorConfig:a});return p.sanitizedClientFeatureProps===null&&(p.sanitizedClientFeatureProps=o),p};else{let n={...t};n.sanitizedClientFeatureProps=o,r.feature=n}return r};var Jr=t=>({type:"dropdown",ChildComponent:$t,items:t,key:"align",order:30});var Xr=[Jr([{ChildComponent:$t,isActive:({selection:t})=>{if(!Ft(t))return!1;for(let e of t.getNodes()){if(ve(e)&&e.getFormatType()==="left")continue;let o=e.getParent();if(!(ve(o)&&o.getFormatType()==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Pt,"left")},order:1},{ChildComponent:Wr,isActive:({selection:t})=>{if(!Ft(t))return!1;for(let e of t.getNodes()){if(ve(e)&&e.getFormatType()==="center")continue;let o=e.getParent();if(!(ve(o)&&o.getFormatType()==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Pt,"center")},order:2},{ChildComponent:Kr,isActive:({selection:t})=>{if(!Ft(t))return!1;for(let e of t.getNodes()){if(ve(e)&&e.getFormatType()==="right")continue;let o=e.getParent();if(!(ve(o)&&o.getFormatType()==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Pt,"right")},order:3},{ChildComponent:Vr,isActive:({selection:t})=>{if(!Ft(t))return!1;for(let e of t.getNodes()){if(ve(e)&&e.getFormatType()==="justify")continue;let o=e.getParent();if(!(ve(o)&&o.getFormatType()==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Pt,"justify")},order:4}])],La=y({toolbarFixed:{groups:Xr},toolbarInline:{groups:Xr}});import{$createQuoteNode as tn,$isQuoteNode as Qr,QuoteNode as Ra}from"@lexical/rich-text";import{$setBlocksType as on}from"@lexical/selection";import{$getSelection as rn,$isRangeSelection as va}from"lexical";import{jsx as zr}from"react/jsx-runtime";import"react";var yo=()=>zr("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:zr("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 Zr}from"react/jsx-runtime";import"react";var ct=()=>Zr("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:Zr("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 le=t=>({type:"dropdown",ChildComponent:ct,items:t,key:"text",order:25});import{$createQuoteNode as ya,$isQuoteNode as Yr,QuoteNode as Ia}from"@lexical/rich-text";var qr={type:"element",dependencies:[Ia],export:(t,e)=>{if(!Yr(t))return null;let o=e(t).split(`
|
|
2
2
|
`),r=[];for(let n of o)r.push("> "+n);return r.join(`
|
|
3
3
|
`)},regExp:/^>\s/,replace:(t,e,o,r)=>{if(r){let l=t.getPreviousSibling();if(Yr(l)){l.splice(l.getChildrenSize(),0,[...e]),l.select(0,0),t.remove();return}}let n=ya();n.append(...e),t.replace(n),n.select(0,0)}};var en=[le([{ChildComponent:yo,isActive:({selection:t})=>{if(!va(t))return!1;for(let e of t.getNodes())if(!Qr(e)&&!Qr(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=rn();on(e,()=>tn())})},order:20}])],Ma=y({markdownTransformers:[qr],nodes:[Ra],slashMenu:{groups:[ee([{Icon:yo,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=rn();on(e,()=>tn())})}}])]},toolbarFixed:{groups:en},toolbarInline:{groups:en}});import{getTranslation as Kt}from"@payloadcms/translations";import{jsx as Io,jsxs as Aa}from"react/jsx-runtime";import"react";var Bt=()=>Aa("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:[Io("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),Io("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),Io("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as nn}from"react/jsx-runtime";import"react";var Ht=()=>nn("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:nn("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 Da}from"react/jsx-runtime";import"react";function jt(t,e){return t?()=>Da("img",{alt:e??"Block Image",className:"lexical-block-custom-image",src:t,style:{maxHeight:20,maxWidth:20}}):Bt}import{jsx as uc}from"react/jsx-runtime";import dc from"bson-objectid";import"react";import{DecoratorBlockNode as Oa}from"@lexical/react/LexicalDecoratorBlockNode.js";import $a from"bson-objectid";var ut=class extends Oa{__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=Fa(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 Fa(t){return new ut({fields:{...t,id:t?.id||new $a.default().toHexString()}})}import{jsx as Z,jsxs as dt,Fragment as Wa}from"react/jsx-runtime";import{Button as cn,Collapsible as Va,Drawer as Ka,EditDepthProvider as Ja,ErrorPill as Xa,Form as za,formatDrawerSlug as Za,FormSubmit as Ya,Pill as qa,RenderFields as Qa,SectionTitle as ec,useConfig as tc,useDocumentForm as oc,useDocumentInfo as un,useEditDepth as rc,useFormSubmitted as nc,useServerFunctions as lc,useTranslation as ic}from"@payloadcms/ui";import{abortAndIgnore as Ro}from"@payloadcms/ui/shared";import{deepCopyObjectSimpleWithoutReactComponents as Gt,reduceFieldsToValues as dn}from"payload/shared";import mt,{useCallback as vo,useEffect as Mo,useMemo as pt,useRef as Ao}from"react";import{useLexicalComposerContext as sc}from"@lexical/react/LexicalComposerContext";import{getTranslation as ac}from"@payloadcms/translations";import{$getNodeByKey as Wt}from"lexical";import{v4 as cc}from"uuid";import{c as Pa}from"react/compiler-runtime";import{jsx as Ut,jsxs as Ba}from"react/jsx-runtime";import{RenderFields as Ha,useFormSubmitted as ja}from"@payloadcms/ui";import Ua,{createContext as Ga}from"react";var ln=Ga({initialState:!1}),$e=()=>Ua.use(ln),sn=t=>{let e=Pa(13),{BlockDrawer:o,Collapsible:r,CustomBlock:n,EditButton:l,errorCount:i,formSchema:s,initialState:u,nodeKey:c,RemoveButton:d}=t,p=ja()&&i>0,m,f;e[0]!==r||e[1]!==i||e[2]!==p?(f=k=>Ut(r,{editButton:k.editButton,errorCount:i,fieldHasErrors:p,Label:k.Label,removeButton:k.removeButton,children:k.children}),e[0]=r,e[1]=i,e[2]=p,e[3]=f):f=e[3],m=f;let h=m,x;return e[4]!==o||e[5]!==h||e[6]!==n||e[7]!==l||e[8]!==d||e[9]!==s||e[10]!==u||e[11]!==c?(x=n?Ba(ln,{value:{BlockCollapsible:h,EditButton:l,initialState:u,nodeKey:c,RemoveButton:d},children:[n,Ut(o,{})]}):Ut(h,{children:Ut(Ha,{fields:s,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0})}),e[4]=o,e[5]=h,e[6]=n,e[7]=l,e[8]=d,e[9]=s,e[10]=u,e[11]=c,e[12]=x):x=e[12],x};function an({fields:t}){for(let e in t){let o=t[e];Array.isArray(o?.rows)&&"value"in o&&(o.disableFormData=!0)}return t}var de="lexical-block",mn=t=>{let{cacheBuster:e,formData:o,nodeKey:r}=t,n=nc(),{id:l,collectionSlug:i,globalSlug:s}=un(),{fieldProps:{featureClientSchemaMap:u,field:c,initialLexicalFormState:d,permissions:a,readOnly:p,schemaPath:m},uuid:f}=G(),{fields:h}=oc(),x=Ao(new AbortController),k=rc(),[I,A]=mt.useState(0),{config:b}=tc(),_=Za({slug:`lexical-blocks-create-${f}-${o.id}`,depth:k}),{toggleDrawer:g}=Ce(_),{getDocPreferences:w,setDocFieldPreferences:M}=un(),[D]=sc(),{getFormState:P}=lc(),v=`${m}.lexical_internal_feature.blocks.lexical_blocks.${o.blockType}.fields`,[N,C]=mt.useState(()=>d?.[o.id]?.formState?{...d?.[o.id]?.formState,blockName:{initialValue:o.blockName,passesCondition:!0,valid:!0,value:o.blockName}}:!1),E=Ao(!1),L=Ao(e);Mo(()=>{E.current?(L.current!==e&&C(!1),L.current=e):E.current=!0},[e]);let[S,R]=mt.useState(N?._components?.customComponents?.BlockLabel),[T,$]=mt.useState(N?._components?.customComponents?.Block);Mo(()=>{let V=new AbortController;return o&&!N&&(async()=>{let{state:X}=await P({id:l,collectionSlug:i,data:o,docPermissions:{fields:!0},docPreferences:await w(),documentFormState:Gt(h),globalSlug:s,initialBlockData:o,operation:"update",renderAllFields:!0,schemaPath:v,signal:V.signal});if(X){X.blockName={initialValue:o.blockName,passesCondition:!0,valid:!0,value:o.blockName};let Q=dn(Gt(X),!0);D.update(()=>{let z=Wt(r);if(z&&ft(z)){let ae=Q;ae.blockType=o.blockType,z.setFields(ae,!0)}}),C(X),R(X._components?.customComponents?.BlockLabel),$(X._components?.customComponents?.Block)}})(),()=>{Ro(V)}},[P,v,l,o,D,r,N,i,s,w,h]);let[F,W]=mt.useState(d?.[o.id]?.collapsed??!1),K=`${m}.lexical_internal_feature.blocks.lexical_blocks.${o.blockType}`,j=u.blocks?.[K]?.[0],U=j.blockReferences?typeof j?.blockReferences?.[0]=="string"?b.blocksMap[j?.blockReferences?.[0]]:j?.blockReferences?.[0]:j?.blocks?.[0],{i18n:oe,t:ue}=ic(),q=vo(async({formState:V,submit:he})=>{Ro(x.current);let X=new AbortController;x.current=X;let{state:Q}=await P({id:l,collectionSlug:i,docPermissions:{fields:!0},docPreferences:await w(),documentFormState:Gt(h),formState:V,globalSlug:s,initialBlockFormState:V,operation:"update",renderAllFields:!!he,schemaPath:v,signal:X.signal});if(!Q)return V;V.blockName&&(Q.blockName=V.blockName);let z=dn(an({fields:Gt(Q)}),!0);if(setTimeout(()=>{D.update(()=>{let ae=Wt(r);if(ae&&ft(ae)){let Ve=z;Ve.blockType=o.blockType,ae.setFields(Ve,!0)}})},0),he){R(Q._components?.customComponents?.BlockLabel),$(Q._components?.customComponents?.Block);let ae=0;for(let Ve of Object.values(Q))Ve?.valid===!1&&ae++;A(ae)}return Q},[P,l,i,w,s,v,o.blockType,h,D,r]);Mo(()=>()=>{Ro(x.current)},[]);let J=vo(()=>{D.update(()=>{Wt(r)?.remove()})},[D,r]),re=U?.labels?.singular?ac(U.labels.singular,oe):U?.slug,ne=vo(V=>{w().then(he=>{let Q=he?.fields?.[c.name]?.collapsed,z=Q&&Q?.length?Q:[];V?z.includes(o.id)||z.push(o.id):z.includes(o.id)&&z.splice(z.indexOf(o.id),1),M(c.name,{collapsed:z,hello:"hi"})})},[w,c.name,M,o.id]),se=pt(()=>()=>Z(cn,{buttonStyle:"icon-label",className:`${de}__editButton`,disabled:p,el:"button",icon:"edit",onClick:V=>(V.preventDefault(),V.stopPropagation(),g(),!1),onMouseDown:V=>{V.preventDefault()},round:!0,size:"small",tooltip:ue("lexical:blocks:inlineBlocks:edit",{label:re})}),[re,p,ue,g]),Oe=pt(()=>()=>Z(cn,{buttonStyle:"icon-label",className:`${de}__removeButton`,disabled:c?.admin?.readOnly||!1,icon:"x",onClick:V=>{V.preventDefault(),J()},round:!0,tooltip:"Remove Block"}),[c?.admin?.readOnly,J]),it=pt(()=>({children:V,disableBlockName:he,editButton:X,errorCount:Q,fieldHasErrors:z,Label:ae,removeButton:Ve})=>Z("div",{className:de+" "+de+"-"+o.blockType,children:Z(Va,{className:[`${de}__row`,z?`${de}__row--has-errors`:`${de}__row--no-errors`].join(" "),collapsibleStyle:z?"error":"default",header:dt("div",{className:`${de}__block-header`,children:[ae??S?ae??S:dt("div",{children:[Z(qa,{className:`${de}__block-pill ${de}__block-pill-${o?.blockType}`,pillStyle:"white",size:"small",children:re??o?.blockType}),!he&&!U?.admin?.disableBlockName&&Z(ec,{path:"blockName",readOnly:c?.admin?.readOnly||!1}),z&&Z(Xa,{count:Q??0,i18n:oe,withMessage:!0})]}),dt("div",{children:[T&&X!==!1||!T&&X?Z(se,{}):null,Ve!==!1&&D.isEditable()?Z(Oe,{}):null]})]}),isCollapsed:F,onToggle:jr=>{ne(jr),W(jr)},children:V},0)}),[T,S,se,Oe,re,U?.admin?.disableBlockName,D,o.blockType,oe,F,ne,c?.admin?.readOnly]),Hr=pt(()=>()=>Z(Ja,{children:Z(Ka,{className:"",slug:_,title:ue(`lexical:blocks:inlineBlocks:${o?.id?"edit":"create"}`,{label:re??ue("lexical:blocks:inlineBlocks:label")}),children:N?dt(Wa,{children:[Z(Qa,{fields:U?.fields??[],forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:v,permissions:!0,readOnly:!1}),Z(Ya,{programmaticSubmit:!0,children:ue("fields:saveChanges")})]}):null})}),[N,_,re,ue,U?.fields,v,a]),ha=pt(()=>N?Z(za,{beforeSubmit:[async({formState:V})=>await q({formState:V,submit:!0})],el:"div",fields:U?.fields??[],initialState:N,onChange:[q],onSubmit:(V,he)=>{he.blockType=o.blockType,D.update(()=>{let X=Wt(r);X&&ft(X)&&X.setFields(he,!0)}),g()},submitted:n,uuid:cc(),children:Z(sn,{baseClass:de,BlockDrawer:Hr,Collapsible:it,CustomBlock:T,EditButton:se,errorCount:I,formSchema:U?.fields??[],initialState:N,nodeKey:r,RemoveButton:Oe})}):null,[it,Hr,T,U?.fields,Oe,se,D,I,g,U?.fields,N,r,q,n]);return U?ha:Z(it,{disableBlockName:!0,fieldHasErrors:!0,children:dt("div",{className:"lexical-block-not-found",children:["Error: Block '",o.blockType,"' not found in the config but exists in the lexical data"]})})};var ke=class extends ut{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=Vt(e.fields);return o.setFormat(e.format),o}decorate(e,o){return uc(mn,{cacheBuster:this.getCacheBuster(),formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Vt(t){return new ke({fields:{...t,id:t?.id||new dc.default().toHexString()}})}function ft(t){return t instanceof ke}import{createCommand as pn}from"lexical";var Je=pn("INSERT_BLOCK_COMMAND"),Xe=pn("INSERT_INLINE_BLOCK_COMMAND");import{c as mc}from"react/compiler-runtime";import{useLexicalComposerContext as pc}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as fc,$wrapNodeInElement as hc,mergeRegister as gc}from"@lexical/utils";import{formatDrawerSlug as xc,useEditDepth as Cc}from"@payloadcms/ui";import{$createParagraphNode as bc,$getNodeByKey as kc,$getPreviousSelection as _c,$getSelection as Tc,$insertNodes as wc,$isParagraphNode as Ec,$isRangeSelection as Nc,$isRootOrShadowRoot as Sc,COMMAND_PRIORITY_EDITOR as fn}from"lexical";import{useEffect as Lc,useState as yc}from"react";var hn=()=>{let t=mc(12),[e]=pc(),[o,r]=yc(null),{setCreatedInlineBlock:n,uuid:l}=G(),i=Cc(),s="lexical-inlineBlocks-create-"+l,u;t[0]!==i||t[1]!==s?(u=xc({slug:s,depth:i}),t[0]=i,t[1]=s,t[2]=u):u=t[2];let c=u,{toggleDrawer:d}=Ce(c,!0),a;t[3]!==e||t[4]!==n||t[5]!==o?(a=()=>{if(!e.hasNodes([ke]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return gc(e.registerCommand(Je,m=>(e.update(()=>{let f=Tc()||_c();if(Nc(f)){let h=Vt(m),{focus:x}=f,k=x.getNode();fc(h),Ec(k)&&!k.__first&&k.remove()}}),!0),fn),e.registerCommand(Xe,m=>{if(o){let h=kc(o);return!h||!wo(h)?!1:(h.setFields(m),r(null),!0)}let f=To(m);return n?.(f),wc([f]),Sc(f.getParentOrThrow())&&hc(f,bc).selectEnd(),!0},fn))},t[3]=e,t[4]=n,t[5]=o,t[6]=a):a=t[6];let p;return t[7]!==e||t[8]!==n||t[9]!==o||t[10]!==d?(p=[e,n,o,d],t[7]=e,t[8]=n,t[9]=o,t[10]=d,t[11]=p):p=t[11],Lc(a,p),null};var Ic=y(({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{nodes:[ke,_o],plugins:[{Component:hn,position:"normal"}],sanitizedClientFeatureProps:o,slashMenu:{groups:[c?.length?{items:c.map(a=>({Icon:jt(a.imageURL,a.imageAltText),key:"block-"+a.slug,keywords:["block","blocks",a.slug],label:({i18n:p})=>a?.labels?.singular?Kt(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(Je,{blockName:"",blockType:a.slug})}})),key:"blocks",label:({i18n:a})=>a.t("lexical:blocks:label")}:null,d?.length?{items:d.map(a=>({Icon:Ht,key:"inlineBlocks-"+a.slug,keywords:["inlineBlock","inline block",a.slug],label:({i18n:p})=>a?.labels?.singular?Kt(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.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:Bt,items:c.map((a,p)=>({ChildComponent:jt(a.imageURL,a.imageAltText),isActive:void 0,key:"block-"+a.slug,label:({i18n:m})=>a?.labels?.singular?Kt(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(Je,{blockName:"",blockType:a.slug})},order:p})),key:"blocks",order:20}:null,d?.length?{type:"dropdown",ChildComponent:Ht,items:d.map((a,p)=>({ChildComponent:a.imageURL?jt(a.imageURL,a.imageAltText):Ht,isActive:void 0,key:"inlineBlock-"+a.slug,label:({i18n:m})=>a?.labels?.singular?Kt(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(Xe,{blockName:"",blockType:a.slug})},order:p})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}});import{c as Mc}from"react/compiler-runtime";import{jsx as Pe,jsxs as Fo}from"react/jsx-runtime";import{useLexicalComposerContext as Ac}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as Dc,$createTextNode as Oc,$getRoot as $c,getDOMSelection as Do}from"lexical";import*as kn from"react";import{useCallback as Fe,useEffect as Oo,useLayoutEffect as xn,useRef as $o,useState as Jt}from"react";var Rc=ce&&"documentMode"in document?document.documentMode:null,gn=ce&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),zx=ce&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Zx=ce&&"InputEvent"in window&&!Rc?"getTargetRanges"in new window.InputEvent("input"):!1,Yx=ce&&/Version\/[\d.].*Safari/.test(navigator.userAgent),qx=ce&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Qx=ce&&/Android/.test(navigator.userAgent),eC=ce&&/Win/.test(navigator.platform),vc=ce&&/^(?=.*Chrome).*/i.test(navigator.userAgent),tC=ce&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!vc;var Fc=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)},Pc=(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)},Bc=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);
|
|
4
4
|
await assertSelection(page, {
|
|
@@ -37,5 +37,5 @@ ${e.map(Bc).join(`
|
|
|
37
37
|
|
|
38
38
|
`,Ui="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",Gi="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",Bp=new RegExp("^[^"+Gi+"]*["+Ui+"]"),Hp=new RegExp("^[^"+Ui+"]*["+Gi+"]"),jp={bold:O.IS_BOLD,code:O.IS_CODE,highlight:O.IS_HIGHLIGHT,italic:O.IS_ITALIC,strikethrough:O.IS_STRIKETHROUGH,subscript:O.IS_SUBSCRIPT,superscript:O.IS_SUPERSCRIPT,underline:O.IS_UNDERLINE},Up={directionless:O.IS_DIRECTIONLESS,unmergeable:O.IS_UNMERGEABLE},Gp={center:O.IS_ALIGN_CENTER,end:O.IS_ALIGN_END,justify:O.IS_ALIGN_JUSTIFY,left:O.IS_ALIGN_LEFT,right:O.IS_ALIGN_RIGHT,start:O.IS_ALIGN_START},Wp={[O.IS_ALIGN_CENTER]:"center",[O.IS_ALIGN_END]:"end",[O.IS_ALIGN_JUSTIFY]:"justify",[O.IS_ALIGN_LEFT]:"left",[O.IS_ALIGN_RIGHT]:"right",[O.IS_ALIGN_START]:"start"},Vp={normal:O.IS_NORMAL,segmented:O.IS_SEGMENTED,token:O.IS_TOKEN},Kp={[O.IS_NORMAL]:"normal",[O.IS_SEGMENTED]:"segmented",[O.IS_TOKEN]:"token"};var Wi={text:({node:t})=>{let e=t.text;return t.format&O.IS_BOLD&&(e=je("strong",{children:e})),t.format&O.IS_ITALIC&&(e=je("em",{children:e})),t.format&O.IS_STRIKETHROUGH&&(e=je("span",{style:{textDecoration:"line-through"},children:e})),t.format&O.IS_UNDERLINE&&(e=je("span",{style:{textDecoration:"underline"},children:e})),t.format&O.IS_CODE&&(e=je("code",{children:e})),t.format&O.IS_SUBSCRIPT&&(e=je("sub",{children:e})),t.format&O.IS_SUPERSCRIPT&&(e=je("sup",{children:e})),e}};import{jsx as Nt}from"react/jsx-runtime";var Vi={upload:({node:t})=>{let e=t;if(typeof e.value!="object")return null;let o=e.value,r=o.url;if(!o.mimeType.startsWith("image"))return Nt("a",{href:r,rel:"noopener noreferrer",children:o.filename});if(!o.sizes||!Object.keys(o.sizes).length)return Nt("img",{alt:o.filename,height:o.height,src:r,width:o.width});let n=[];for(let l in o.sizes){let i=o.sizes[l];if(!i||!i.width||!i.height||!i.mimeType||!i.filesize||!i.filename||!i.url)continue;let s=i?.url;n.push(Nt("source",{media:`(max-width: ${i.width}px)`,srcSet:s,type:i.mimeType},l))}return n.push(Nt("img",{alt:o?.filename,height:o?.height,src:r,width:o?.width},"image")),Nt("picture",{children:n})}};var tt={...Bi,...Wi,...Oi,...Mi,...ji,...Ai,...Di,...Pi,...Fi({}),...Vi,...Hi};import{jsx as Ji,Fragment as Jp}from"react/jsx-runtime";import ir from"react";function Ki(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 Xi({converters:t,data:e,disableIndent:o,disableTextAlign:r}){return Ki(e)?zi({converters:t,disableIndent:o,disableTextAlign:r,nodes:e?.root?.children,parent:e?.root}):Ji(Jp,{})}function zi({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:m=>zi({converters:m.converters??t,disableIndent:m.disableIndent??e,disableTextAlign:m.disableTextAlign??o,nodes:m.nodes,parent:m.parent??{...s,parent:n}}),parent:n}):c:d=Ji("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)*2}em`),ir.isValidElement(d)){if(a.textAlign||a.paddingInlineStart){let p={...a,...d?.props?.style??{}};return ir.cloneElement(d,{key:u,style:p})}return ir.cloneElement(d,{key:u})}return d}catch(d){return console.error("Error converting lexical node to JSX:",d,"node:",s),null}}).filter(Boolean)}var sr=({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&&Xi({converters:i,data:o,disableIndent:n,disableTextAlign:l});return r?Zi(Xp,{children:s}):Zi("div",{className:t??"payload-richtext",children:s})};function Yi(){let t=zp(7),[e]=Yp(),o;t[0]!==e?(o=e.getEditorState().toJSON(),t[0]=e,t[1]=o):o=t[1];let[r,n]=Qp(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]),qp(l,i);let s;return t[5]!==r?(s=Zp(sr,{converters:tt,data:r}),t[5]=r,t[6]=s):s=t[6],s}var ef=y({plugins:[{Component:Yi,position:"bottom"}]});var H={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)"}},tf={text:{"text-red":{css:{color:`light-dark(${H.red[600]}, ${H.red[400]})`},label:"Red"},"text-orange":{css:{color:`light-dark(${H.orange[600]}, ${H.orange[400]})`},label:"Orange"},"text-yellow":{css:{color:`light-dark(${H.yellow[700]}, ${H.yellow[300]})`},label:"Yellow"},"text-green":{css:{color:`light-dark(${H.green[700]}, ${H.green[400]})`},label:"Green"},"text-blue":{css:{color:`light-dark(${H.blue[600]}, ${H.blue[400]})`},label:"Blue"},"text-purple":{css:{color:`light-dark(${H.purple[600]}, ${H.purple[400]})`},label:"Purple"},"text-pink":{css:{color:`light-dark(${H.pink[600]}, ${H.pink[400]})`},label:"Pink"}},background:{"bg-red":{css:{"background-color":`light-dark(${H.red[400]}, ${H.red[600]})`},label:"Red"},"bg-orange":{css:{"background-color":`light-dark(${H.orange[400]}, ${H.orange[600]})`},label:"Orange"},"bg-yellow":{css:{"background-color":`light-dark(${H.yellow[300]}, ${H.yellow[700]})`},label:"Yellow"},"bg-green":{css:{"background-color":`light-dark(${H.green[400]}, ${H.green[700]})`},label:"Green"},"bg-blue":{css:{"background-color":`light-dark(${H.blue[400]}, ${H.blue[600]})`},label:"Blue"},"bg-purple":{css:{"background-color":`light-dark(${H.purple[400]}, ${H.purple[600]})`},label:"Purple"},"bg-pink":{css:{"background-color":`light-dark(${H.pink[400]}, ${H.pink[600]})`},label:"Pink"}}};import{$isNodeSelection as Hf}from"lexical";import{jsx as St,jsxs as of}from"react/jsx-runtime";import"react";var ar=()=>of("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[St("g",{clipPath:"url(#clip0_4397_10817)",children:St("path",{d:"M7.75 12.25L15.25 4.75M15.25 4.75H11.5M15.25 4.75V8.5M13 11.5V13.75C13 14.5784 12.3284 15.25 11.5 15.25H6.25C5.42157 15.25 4.75 14.5784 4.75 13.75V8.5C4.75 7.67157 5.42157 7 6.25 7H8.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})}),St("defs",{children:St("clipPath",{id:"clip0_4397_10817",children:St("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{jsx as lf}from"react/jsx-runtime";import*as Qi from"react";import{DecoratorBlockNode as rf}from"@lexical/react/LexicalDecoratorBlockNode.js";function nf(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:qi({relationTo:o,value:e})}:null}var Lt=class extends rf{__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:nf,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=qi(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 qi(t){return new Lt({data:t})}var sf=Qi.lazy(()=>import("./RelationshipComponent-APF3CN47.js").then(t=>({default:t.RelationshipComponent})));function af(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Ue({relationTo:o,value:e})}:null}var Se=class extends Lt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{div:e=>!e.hasAttribute("data-lexical-relationship-relationTo")||!e.hasAttribute("data-lexical-relationship-id")?null:{conversion:af,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=Ue(o);return r.setFormat(e.format),r}decorate(e,o){return lf(sf,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Ue(t){return new Se({data:t})}function cr(t){return t instanceof Se}import{c as Sf}from"react/compiler-runtime";import{jsx as Lf}from"react/jsx-runtime";import{useLexicalComposerContext as yf}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as If}from"@lexical/utils";import{useConfig as Rf}from"@payloadcms/ui";import{$getPreviousSelection as vf,$getSelection as Mf,$isParagraphNode as Af,$isRangeSelection as Df,COMMAND_PRIORITY_EDITOR as Of,createCommand as $f}from"lexical";import{useEffect as Ff}from"react";import{c as kf}from"react/compiler-runtime";import{jsx as ro}from"react/jsx-runtime";import{useLexicalComposerContext as _f}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as Tf,COMMAND_PRIORITY_EDITOR as wf}from"lexical";import{useEffect as Ef,useState as os}from"react";import{c as cf}from"react/compiler-runtime";import{jsx as uf}from"react/jsx-runtime";import{useLexicalComposerContext as df}from"@lexical/react/LexicalComposerContext";import{useListDrawer as mf,useModal as pf}from"@payloadcms/ui";import{$getNodeByKey as es,$getPreviousSelection as ff,$getRoot as hf,$getSelection as gf,$isRangeSelection as xf,$setSelection as Cf}from"lexical";import{useEffect as bf,useState as ts}from"react";var yt=t=>{let e=cf(23),[o]=df(),[r,n]=ts(null),[l,i]=ts(!1),[s,u,c]=mf(t),{closeDrawer:d,drawerSlug:a,isDrawerOpen:p,openDrawer:m}=c,{modalState:f}=pf(),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let P=gf()??ff();n(P)},e[0]=h):h=e[0];let x=h,k;e[1]!==o||e[2]!==r?(k=()=>{r&&o.update(()=>{if(xf(r)){let{anchor:P,focus:v}=r;es(P.key)&&es(v.key)&&Cf(r.clone())}else hf().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=r,e[3]=k):k=e[3];let I=k,A;e[4]!==d?(A=()=>{d()},e[4]=d,e[5]=A):A=e[5];let b=A,_,g;e[6]!==a||e[7]!==f||e[8]!==I||e[9]!==l?(_=()=>{if(!l)return;let P=f[a];P&&!P?.isOpen&&(i(!1),setTimeout(()=>{I()},1))},g=[f,a,I,l],e[6]=a,e[7]=f,e[8]=I,e[9]=l,e[10]=_,e[11]=g):(_=e[10],g=e[11]),bf(_,g);let w;e[12]!==u?(w=P=>uf(u,{...P,onClick:()=>{x()}}),e[12]=u,e[13]=w):w=e[13];let M;e[14]!==m?(M=()=>{x(),m(),i(!0)},e[14]=m,e[15]=M):M=e[15];let D;return e[16]!==s||e[17]!==b||e[18]!==p||e[19]!==a||e[20]!==w||e[21]!==M?(D={closeListDrawer:b,isListDrawerOpen:p,ListDrawer:s,listDrawerSlug:a,ListDrawerToggler:w,openListDrawer:M},e[16]=s,e[17]=b,e[18]=p,e[19]=a,e[20]=w,e[21]=M,e[22]=D):D=e[22],D};var Nf=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=Tf(o);n&&n.replace(Ue({relationTo:e,value:r}))}):t.dispatchCommand(ur,{relationTo:e,value:r})},rs=t=>{let e=kf(16),{enabledCollectionSlugs:o}=t,[r]=_f(),n;e[0]!==o?.[0]?(n=()=>o?.[0],e[0]=o?.[0],e[1]=n):n=e[1];let[l]=os(n),[i,s]=os(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:p}=yt(c),m,f;e[5]!==r||e[6]!==p?(m=()=>r.registerCommand(at,I=>(s(I?.replace?I?.replace.nodeKey:null),p(),!0),wf),f=[r,p],e[5]=r,e[6]=p,e[7]=m,e[8]=f):(m=e[7],f=e[8]),Ef(m,f);let h;e[9]!==d||e[10]!==r||e[11]!==i?(h=I=>{let{collectionSlug:A,doc:b}=I;Nf({editor:r,relationTo:A,replaceNodeKey:i,value:b.id}),d()},e[9]=d,e[10]=r,e[11]=i,e[12]=h):h=e[12];let x=h,k;return e[13]!==a||e[14]!==x?(k=ro(a,{onSelect:x}),e[13]=a,e[14]=x,e[15]=k):k=e[15],k},ns=t=>(t?.enabledCollectionSlugs?.length??-1)>0?ro(rs,{...t}):ro(Ot,{...t,children:ro(rs,{...t})});var ur=$f("INSERT_RELATIONSHIP_COMMAND"),ls=t=>{let e=Sf(10),{clientProps:o}=t,[r]=yf(),{config:n}=Rf(),{collections:l}=n,i=null;if(o?.enabledCollections)i=o?.enabledCollections;else if(o?.disabledCollections){let d;if(e[0]!==o?.disabledCollections||e[1]!==l){let a;e[3]!==o?.disabledCollections?(a=p=>{let{slug:m}=p;return!o?.disabledCollections?.includes(m)},e[3]=o?.disabledCollections,e[4]=a):a=e[4],d=l.filter(a).map(Pf),e[0]=o?.disabledCollections,e[1]=l,e[2]=d}else d=e[2];i=d}let s,u;e[5]!==r?(s=()=>{if(!r.hasNodes([Se]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return r.registerCommand(ur,Bf,Of)},u=[r],e[5]=r,e[6]=s,e[7]=u):(s=e[6],u=e[7]),Ff(s,u);let c;return e[8]!==i?(c=Lf(ns,{enabledCollectionSlugs:i}),e[8]=i,e[9]=c):c=e[9],c};function Pf(t){let{slug:e}=t;return e}function Bf(t){let e=Mf()||vf();if(Df(e)){let o=Ue(t),{focus:r}=e,n=r.getNode();If(o),Af(n)&&!n.__first&&n.remove()}return!0}var jf=y({nodes:[Se],plugins:[{Component:ls,position:"normal"}],slashMenu:{groups:[ee([{Icon:ar,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(at,{replace:!1})}}])]},toolbarFixed:{groups:[_e([{ChildComponent:ar,isActive:({selection:t})=>{if(!Hf(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return cr(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(at,{replace:!1})}}])]}});import{c as ms}from"react/compiler-runtime";import{jsx as me,jsxs as i0}from"react/jsx-runtime";import{useLexicalComposerContext as s0}from"@lexical/react/LexicalComposerContext.js";import{useScrollInfo as a0,useThrottledEffect as c0,useTranslation as u0}from"@payloadcms/ui";import*as Le from"react";import{useMemo as d0}from"react";import{c as Uf}from"react/compiler-runtime";import{jsx as Gf}from"react/jsx-runtime";import{mergeRegister as Wf}from"@lexical/utils";import{$addUpdateTag as Vf,$getSelection as Kf}from"lexical";import{useEffect as no,useState as dr}from"react";var mr="toolbar-popup__button",It=t=>{let e=Uf(34),{children:o,editor:r,item:n}=t,[l,i]=dr(!0),[s,u]=dr(!1),[c,d]=dr(mr),a=G(),p;e[0]!==s||e[1]!==r||e[2]!==a||e[3]!==l||e[4]!==n?(p=()=>{r.getEditorState().read(()=>{let M=Kf();if(M){if(n.isActive){let D=n.isActive({editor:r,editorConfigContext:a,selection:M});s!==D&&u(D)}if(n.isEnabled){let D=n.isEnabled({editor:r,editorConfigContext:a,selection:M});l!==D&&i(D)}}})},e[0]=s,e[1]=r,e[2]=a,e[3]=l,e[4]=n,e[5]=p):p=e[5];let m=p,f,h;e[6]!==m?(f=()=>{m()},h=[m],e[6]=m,e[7]=f,e[8]=h):(f=e[7],h=e[8]),no(f,h);let x,k;e[9]!==m?(x=()=>(document.addEventListener("mouseup",m),()=>{document.removeEventListener("mouseup",m)}),k=[m],e[9]=m,e[10]=x,e[11]=k):(x=e[10],k=e[11]),no(x,k);let I,A;e[12]!==r||e[13]!==m?(I=()=>Wf(r.registerUpdateListener(()=>{m()})),A=[r,m],e[12]=r,e[13]=m,e[14]=I,e[15]=A):(I=e[14],A=e[15]),no(I,A);let b;e[16]!==s||e[17]!==l||e[18]!==n.key?(b=()=>{d([mr,l===!1?"disabled":"",s?"active":"",n?.key?`${mr}-`+n.key:""].filter(Boolean).join(" "))},e[16]=s,e[17]=l,e[18]=n.key,e[19]=b):b=e[19];let _;e[20]!==s||e[21]!==c||e[22]!==l||e[23]!==n.key?(_=[l,s,c,n.key],e[20]=s,e[21]=c,e[22]=l,e[23]=n.key,e[24]=_):_=e[24],no(b,_);let g;e[25]!==s||e[26]!==r||e[27]!==l||e[28]!==n?(g=()=>{if(l!==!1)return r.focus(()=>{r.update(Jf),n.onSelect?.({editor:r,isActive:s})}),!0},e[25]=s,e[26]=r,e[27]=l,e[28]=n,e[29]=g):g=e[29];let w;return e[30]!==o||e[31]!==c||e[32]!==g?(w=Gf("button",{className:c,onClick:g,onMouseDown:Xf,type:"button",children:o}),e[30]=o,e[31]=c,e[32]=g,e[33]=w):w=e[33],w};function Jf(){Vf("toolbar")}function Xf(t){t.preventDefault()}import{c as ds}from"react/compiler-runtime";import{jsx as ot}from"react/jsx-runtime";import hr,{useEffect as us}from"react";import{mergeRegister as o0}from"@lexical/utils";import{useTranslation as r0}from"@payloadcms/ui";import{$getSelection as n0}from"lexical";import{jsx as Ae,jsxs as is}from"react/jsx-runtime";import{Button as zf}from"@payloadcms/ui";import{$addUpdateTag as Zf,isDOMNode as Yf}from"lexical";import lo,{useCallback as qf,useEffect as Rt,useMemo as Qf,useRef as fr,useState as io}from"react";import{createPortal as e0}from"react-dom";var pr="toolbar-popup__dropdown-item",ss=lo.createContext(null);function as({active:t,children:e,editor:o,enabled:r,Icon:n,item:l,tooltip:i}){let[s,u]=io(pr);Rt(()=>{u([pr,r===!1?"disabled":"",t?"active":"",l?.key?`${pr}-${l.key}`:""].filter(Boolean).join(" "))},[r,t,s,l.key]);let c=fr(null),d=lo.use(ss);if(d===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=d;return Rt(()=>{c?.current!=null&&a(c)},[c,a]),Ae(zf,{"aria-label":i,buttonStyle:"none",className:s,disabled:r===!1,icon:n,iconPosition:"left",iconStyle:"none",onClick:()=>{r!==!1&&o.focus(()=>{o.update(()=>{Zf("toolbar")}),l.onSelect?.({editor:o,isActive:t})})},onMouseDown:p=>{p.preventDefault()},ref:c,tooltip:i,type:"button",children:e})}function t0({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:r}){let[n,l]=io(),[i,s]=io(),u=qf(a=>{l(p=>p!=null?[...p,a]:[a])},[l]),c=a=>{if(n==null)return;let{key:p}=a;["ArrowDown","ArrowUp","Escape","Tab"].includes(p)&&a.preventDefault(),p==="Escape"||p==="Tab"?r():p==="ArrowUp"?s(m=>{if(m==null)return n[0];let f=n.indexOf(m)-1;return n[f===-1?n.length-1:f]}):p==="ArrowDown"&&s(m=>m==null?n[0]:n[n.indexOf(m)+1])},d=Qf(()=>({registerItem:u}),[u]);return Rt(()=>{n!=null&&i==null&&s(n[0]),i!=null&&i?.current!=null&&i.current.focus()},[n,i]),Ae(ss,{value:d,children:Ae("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:c,ref:e,children:t})})}function cs({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:r=!1,Icon:n,itemsContainerClassNames:l,label:i,stopCloseOnClickSelf:s}){let u=fr(null),c=fr(null),[d,a]=io(!1),p=()=>{a(!1),c?.current!=null&&c.current.focus()};Rt(()=>{let f=c.current,h=u.current;if(d&&f!==null&&h!==null){let{left:x,top:k}=f.getBoundingClientRect(),I=window.scrollY||document.documentElement.scrollTop;h.style.top=`${k+I+f.offsetHeight+5}px`,h.style.left=`${Math.min(x-5,window.innerWidth-h.offsetWidth-20)}px`}},[u,c,d]),Rt(()=>{let f=c.current;if(f!==null&&d){let h=x=>{let k=x.target;Yf(k)&&(s&&u.current&&u.current.contains(k)||f.contains(k)||a(!1))};return document.addEventListener("click",h),()=>{document.removeEventListener("click",h)}}},[u,c,d,s]);let m=e0(Ae(t0,{dropDownRef:u,itemsContainerClassNames:l,onClose:p,children:o}),document.body);return is(lo.Fragment,{children:[is("button",{"aria-label":t,className:e+(d?" active":""),disabled:r,onClick:f=>{f.preventDefault(),a(!d)},onMouseDown:f=>{f.preventDefault()},ref:c,type:"button",children:[n&&Ae(n,{}),i&&Ae("span",{className:"toolbar-popup__dropdown-label",children:i}),Ae("i",{className:"toolbar-popup__dropdown-caret"})]}),d&&Ae(lo.Fragment,{children:m})]})}var gr="toolbar-popup__dropdown",l0=t=>{let e=ds(18),{active:o,anchorElem:r,editor:n,enabled:l,item:i}=t,{i18n:s}=r0(),{fieldProps:u}=G(),{featureClientSchemaMap:c,schemaPath:d}=u;if(i.Component){let f;return e[0]!==o||e[1]!==r||e[2]!==n||e[3]!==l||e[4]!==i?(f=i?.Component&&ot(i.Component,{active:o,anchorElem:r,editor:n,enabled:l,item:i},i.key),e[0]=o,e[1]=r,e[2]=n,e[3]=l,e[4]=i,e[5]=f):f=e[5],f}let a=i.key,p;if(i.label){let f;e[6]!==c||e[7]!==s||e[8]!==i||e[9]!==d?(f=typeof i.label=="function"?i.label({featureClientSchemaMap:c,i18n:s,schemaPath:d}):i.label,e[6]=c,e[7]=s,e[8]=i,e[9]=d,e[10]=f):f=e[10],a=f}a.length>25?p=a.substring(0,25)+"...":p=a;let m;return e[11]!==o||e[12]!==p||e[13]!==n||e[14]!==l||e[15]!==i||e[16]!==a?(m=ot(as,{active:o,editor:n,enabled:l,Icon:i?.ChildComponent?ot(i.ChildComponent,{}):void 0,item:i,tooltip:a,children:ot("span",{className:"text",children:p})},i.key),e[11]=o,e[12]=p,e[13]=n,e[14]=l,e[15]=i,e[16]=a,e[17]=m):m=e[17],m},Ge=t=>{let e=ds(36),{anchorElem:o,classNames:r,editor:n,group:l,Icon:i,itemsContainerClassNames:s,label:u,maxActiveItems:c,onActiveChange:d}=t,a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=[],e[0]=a):a=e[0];let[p,m]=hr.useState(a),f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f=[],e[1]=f):f=e[1];let[h,x]=hr.useState(f),[k,I]=hr.useState(!0),A=G(),{items:b,key:_}=l,g;e[2]!==n||e[3]!==A||e[4]!==l||e[5]!==b||e[6]!==c||e[7]!==d?(g=()=>{n.getEditorState().read(()=>{let F=n0();if(!F)return;let W=[],K=[],fe=[];for(let j of b)j.isActive&&(!c||W.length<c)&&j.isActive({editor:n,editorConfigContext:A,selection:F})&&(W.push(j.key),K.push(j)),j.isEnabled?j.isEnabled({editor:n,editorConfigContext:A,selection:F})&&fe.push(j.key):fe.push(j.key);l.isEnabled&&I(l.isEnabled({editor:n,editorConfigContext:A,selection:F})),m(W),x(fe),d&&d({activeItems:K})})},e[2]=n,e[3]=A,e[4]=l,e[5]=b,e[6]=c,e[7]=d,e[8]=g):g=e[8];let w=g,M,D;e[9]!==w?(M=()=>{w()},D=[w],e[9]=w,e[10]=M,e[11]=D):(M=e[10],D=e[11]),us(M,D);let P,v;e[12]!==n||e[13]!==w?(P=()=>o0(n.registerUpdateListener(()=>{w()})),v=[n,w],e[12]=n,e[13]=w,e[14]=P,e[15]=v):(P=e[14],v=e[15]),us(P,v);let N=`${_} dropdown`,C=`${gr}-${_}`,E;e[16]!==r?(E=r||[],e[16]=r,e[17]=E):E=e[17];let L;e[18]!==E||e[19]!==C?(L=[gr,C,...E].filter(Boolean),e[18]=E,e[19]=C,e[20]=L):L=e[20];let S=L.join(" "),R=!k,T;e[21]!==s?(T=s||[],e[21]=s,e[22]=T):T=e[22];let $;return e[23]!==i||e[24]!==p||e[25]!==o||e[26]!==n||e[27]!==h||e[28]!==_||e[29]!==b||e[30]!==u||e[31]!==S||e[32]!==R||e[33]!==T||e[34]!==N?($=ot(cs,{buttonAriaLabel:N,buttonClassName:S,disabled:R,Icon:i,itemsContainerClassNames:[`${gr}-items`,...T],label:u,children:b.length?b.map(F=>ot(l0,{active:p.includes(F.key),anchorElem:o,editor:n,enabled:h.includes(F.key),item:F},F.key)):null},_),e[23]=i,e[24]=p,e[25]=o,e[26]=n,e[27]=h,e[28]=_,e[29]=b,e[30]=u,e[31]=S,e[32]=R,e[33]=T,e[34]=N,e[35]=$):$=e[35],$};function m0({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&me(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?me(It,{editor:e,item:o,children:me(o.ChildComponent,{})},o.key):null}function p0(t){let e=ms(23),{anchorElem:o,editor:r,editorConfig:n,group:l,index:i}=t,{i18n:s}=u0(),{fieldProps:u}=G(),{featureClientSchemaMap:c,schemaPath:d}=u,[a,p]=Le.useState(void 0),[m,f]=Le.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],Le.useEffect(h,x);let k;e[6]!==c||e[7]!==l.ChildComponent||e[8]!==l.items||e[9]!==l.type||e[10]!==s||e[11]!==d?(k=_=>{let{activeItems:g}=_;if(!g.length){l?.type==="dropdown"&&l.items.length&&l.ChildComponent?(f(()=>l.ChildComponent),p(void 0)):(f(void 0),p(void 0));return}let w=g[0],M=w.key;w.label&&(M=typeof w.label=="function"?w.label({featureClientSchemaMap:c,i18n:s,schemaPath:d}):w.label),M.length>25&&(M=M.substring(0,25)+"..."),g.length===1?(p(M),f(()=>w.ChildComponent)):(p(s.t("lexical:general:toolbarItemsActive",{count:g.length})),l?.type==="dropdown"&&l.items.length&&l.ChildComponent?f(()=>l.ChildComponent):f(void 0))},e[6]=c,e[7]=l.ChildComponent,e[8]=l.items,e[9]=l.type,e[10]=s,e[11]=d,e[12]=k):k=e[12];let I=k,A=`fixed-toolbar__group fixed-toolbar__group-${l.key}`,b;return e[13]!==m||e[14]!==o||e[15]!==a||e[16]!==r||e[17]!==n.features.toolbarFixed?.groups.length||e[18]!==l||e[19]!==i||e[20]!==I||e[21]!==A?(b=i0("div",{className:A,children:[l.type==="dropdown"&&l.items.length?m?me(Ge,{anchorElem:o,editor:r,group:l,Icon:m,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:l.maxActiveItems??1,onActiveChange:I}):me(Ge,{anchorElem:o,editor:r,group:l,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:l.maxActiveItems??1,onActiveChange:I}):null,l.type==="buttons"&&l.items.length?l.items.map(_=>me(m0,{anchorElem:o,editor:r,item:_},_.key)):null,i<n.features.toolbarFixed?.groups.length-1&&me("div",{className:"divider"})]},l.key),e[13]=m,e[14]=o,e[15]=a,e[16]=r,e[17]=n.features.toolbarFixed?.groups.length,e[18]=l,e[19]=i,e[20]=I,e[21]=A,e[22]=b):b=e[22],b}function f0({anchorElem:t,clientProps:e,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let l=Le.useRef(null),{y:i}=a0(),s=d0(()=>{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 c0(()=>{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]),me("div",{className:"fixed-toolbar",onFocus:u=>{u.stopPropagation()},ref:l,children:o.isEditable()&&me(Le.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((u,c)=>me(p0,{anchorElem:t,editor:o,editorConfig:r,group:u,index:c},u.key))})})}var ps=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return ps(t.parentEditor)}return!1},fs=t=>{let e=ms(6),{clientProps:o}=t,[r]=s0(),n=G(),{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=ps(n);if(o?.disableIfParentHasFixedToolbar&&d){c=null;break e}if(!s?.features?.toolbarFixed?.groups?.length){c=null;break e}u=me(f0,{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 h0=y({plugins:[{Component:fs,position:"aboveContainer"}]});import{c as xs}from"react/compiler-runtime";import{jsx as xe,jsxs as Cs}from"react/jsx-runtime";import{useLexicalComposerContext as g0}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as bs}from"@lexical/utils";import{$getSelection as ks,$isRangeSelection as hs,$isTextNode as x0,COMMAND_PRIORITY_LOW as C0,getDOMSelection as _s,SELECTION_CHANGE_COMMAND as b0}from"lexical";import{useCallback as ao,useEffect as vt,useRef as gs,useState as k0}from"react";import*as co from"react";import{createPortal as _0}from"react-dom";function xr(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 so(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(),p=o.getBoundingClientRect(),m=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<m.top&&!s&&(x=a.height+u.height+c*2,f+=x),i==="center"?h+a.width>m.right?h=m.right-a.width-l:h<m.left&&(h=m.left+l):h+a.width>m.right&&(h=m.right-a.width-l),h-=p.left,n.style.opacity="1",s&&r!==0?(f-=p.bottom-r+a.height-3,n.style.transform=`translate(${h}px, ${f}px) rotate(180deg)`):(f-=p.top,n.style.transform=`translate(${h}px, ${f}px)`),x}function T0({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&xe(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?xe(It,{editor:e,item:o,children:xe(o.ChildComponent,{})},o.key):null}function w0(t){let e=xs(19),{anchorElem:o,editor:r,group:n,index:l}=t,{editorConfig:i}=G(),[s,u]=co.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],co.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 k=x[0];u(()=>k?.ChildComponent)},e[6]=n.ChildComponent,e[7]=n.items,e[8]=n.type,e[9]=a):a=e[9];let p=a,m=`inline-toolbar-popup__group inline-toolbar-popup__group-${n.key}`,f;return e[10]!==s||e[11]!==o||e[12]!==r||e[13]!==i.features.toolbarInline?.groups.length||e[14]!==n||e[15]!==l||e[16]!==p||e[17]!==m?(f=Cs("div",{className:m,children:[n.type==="dropdown"&&n.items.length?s?xe(Ge,{anchorElem:o,editor:r,group:n,Icon:s,maxActiveItems:n.maxActiveItems??1,onActiveChange:p}):xe(Ge,{anchorElem:o,editor:r,group:n,maxActiveItems:n.maxActiveItems??1,onActiveChange:p}):null,n.type==="buttons"&&n.items.length?n.items.map(h=>xe(T0,{anchorElem:o,editor:r,item:h},h.key)):null,l<i.features.toolbarInline?.groups.length-1&&xe("div",{className:"divider"})]},n.key),e[10]=s,e[11]=o,e[12]=r,e[13]=i.features.toolbarInline?.groups.length,e[14]=n,e[15]=l,e[16]=p,e[17]=m,e[18]=f):f=e[18],f}function E0({anchorElem:t,editor:e}){let o=gs(null),r=gs(null),{editorConfig:n}=G(),l=ao(()=>{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=ao(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 p=c.clientX,m=c.clientY,f=document.elementFromPoint(p,m);o.current.contains(f)||l()}}},[l]),s=ao(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);vt(()=>(document.addEventListener("mousemove",i),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",s)}),[o,i,s]);let u=ao(()=>{let c=ks(),d=_s(e._window);if(o.current===null)return;let a=t.querySelector(":scope > .link-editor"),p=a!==null&&"style"in a&&a?.style?.opacity==="1",m=e.getRootElement();if(c!==null&&d!==null&&!d.isCollapsed&&m!==null&&m.contains(d.anchorNode)){let f=xr(d,m),h=so({alwaysDisplayOnTop:p,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});r.current&&so({anchorElem:o.current,anchorFlippedOffset:h,floatingElem:r.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else l()},[e,l,t]);return vt(()=>{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]),vt(()=>(e.getEditorState().read(()=>{u()}),bs(e.registerUpdateListener(({editorState:c})=>{c.read(()=>{u()})}),e.registerCommand(b0,()=>(u(),!1),C0))),[e,u]),Cs("div",{className:"inline-toolbar-popup",ref:o,children:[xe("div",{className:"caret",ref:r}),n?.features&&n.features?.toolbarInline?.groups.map((c,d)=>xe(w0,{anchorElem:t,editor:e,group:c,index:d},c.key))]})}function N0(t,e){let o=xs(12),[r,n]=k0(!1),l;o[0]!==t?(l=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let p=ks(),m=_s(t._window),f=t.getRootElement();if(m!==null&&(!hs(p)||f===null||!f.contains(m.anchorNode))){n(!1);return}if(!hs(p))return;if(p.getTextContent()!==""){let x=p.getNodes(),k=!1;for(let I of x)if(x0(I)){n(!0),k=!0;break}k||n(!1)}else n(!1);let h=p.getTextContent().replace(/\n/g,"");if(!p.isCollapsed()&&h===""){n(!1);return}})},o[0]=t,o[1]=l):l=o[1];let i=l,s,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]),vt(s,u);let c,d;if(o[5]!==t||o[6]!==i?(c=()=>bs(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]),vt(c,d),!r||!t.isEditable())return null;let a;return o[9]!==e||o[10]!==t?(a=_0(xe(E0,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=a):a=o[11],a}var Ts=t=>{let{anchorElem:e}=t,[o]=g0();return N0(o,e)};var S0=y({plugins:[{Component:Ts,position:"floatingAnchorElem"}]});import{TableCellNode as gh,TableNode as xh,TableRowNode as Ch}from"@lexical/table";import{jsx as ws}from"react/jsx-runtime";import"react";var Cr=()=>ws("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:ws("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 L0,$createTableNode as y0,$createTableRowNode as I0,$isTableCellNode as Es,$isTableNode as br,$isTableRowNode as kr,TableCellHeaderStates as uo,TableCellNode as R0,TableNode as v0,TableRowNode as M0}from"@lexical/table";import{$isParagraphNode as A0,$isTextNode as D0}from"lexical";var Ss=/^\|(.+)\|\s?$/,O0=/^(\| ?:?-*:? ?)+\|\s?$/,Ls=({allTransformers:t})=>({type:"element",dependencies:[v0,M0,R0],export:e=>{if(!br(e))return null;let o=[];for(let r of e.getChildren()){let n=[];if(!kr(r))continue;let l=!1;for(let i of r.getChildren())Es(i)&&(n.push(Gr(t,i).replace(/\n/g,"\\n").trim()),i.__headerState===uo.ROW&&(l=!0));o.push(`| ${n.join(" | ")} |`),l&&o.push(`| ${n.map(i=>"---").join(" | ")} |`)}return o.join(`
|
|
39
39
|
`)},regExp:Ss,replace:(e,o,r)=>{let n=r[0];if(!n)return;if(O0.test(n)){let a=e.getPreviousSibling();if(!a||!br(a))return;let p=a.getChildren(),m=p[p.length-1];if(!m||!kr(m))return;m.getChildren().forEach(f=>{Es(f)&&f.setHeaderStyles(uo.ROW,uo.ROW)}),e.remove();return}let l=Ns(n,t);if(l==null)return;let i=[l],s=e.getPreviousSibling(),u=l.length;for(;s&&!(!A0(s)||s.getChildrenSize()!==1);){let a=s.getFirstChild();if(!D0(a))break;let p=Ns(a.getTextContent(),t);if(p==null)break;u=Math.max(u,p.length),i.unshift(p);let m=s.getPreviousSibling();s.remove(),s=m}let c=y0();for(let a of i){let p=I0();c.append(p);for(let m=0;m<u;m++)p.append(m<a.length?a[m]:ys("",t))}let d=e.getPreviousSibling();br(d)&&$0(d)===u?(d.append(...c.getChildren()),e.remove()):e.replace(c),c.selectEnd()}});function $0(t){let e=t.getFirstChild();return kr(e)?e.getChildrenSize():0}var ys=(t,e)=>{t=t.replace(/\\n/g,`
|
|
40
|
-
`);let o=L0(uo.NO_STATUS);return Ur(t,e,o),o},Ns=(t,e)=>{let o=t.match(Ss);return!o||!o[1]?null:o[1].split("|").map(r=>ys(r,e))};import{c as P0}from"react/compiler-runtime";import{jsx as B,jsxs as ye}from"react/jsx-runtime";import{useLexicalComposerContext as Ms}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as B0}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as Tr,$deleteTableColumn__EXPERIMENTAL as H0,$deleteTableRow__EXPERIMENTAL as j0,$getNodeTriplet as U0,$getTableCellNodeFromLexicalNode as Rs,$getTableColumnIndexFromTableCellNode as G0,$getTableNodeFromLexicalNodeOrThrow as Ie,$getTableRowIndexFromTableCellNode as W0,$insertTableColumn__EXPERIMENTAL as V0,$insertTableRow__EXPERIMENTAL as K0,$isTableCellNode as As,$isTableSelection as Mt,$unmergeCell as J0,getTableElement as wr,getTableObserverFromTableElement as Er,TableCellHeaderStates as De,TableCellNode as X0}from"@lexical/table";import{mergeRegister as z0}from"@lexical/utils";import{useScrollInfo as Z0}from"@payloadcms/ui";import{$createParagraphNode as Y0,$getSelection as po,$isElementNode as q0,$isParagraphNode as Q0,$isRangeSelection as Nr,$isTextNode as e1,$setSelection as t1,COMMAND_PRIORITY_CRITICAL as o1,getDOMSelection as r1,isDOMNode as n1,SELECTION_CHANGE_COMMAND as l1}from"lexical";import*as Sr from"react";import{useCallback as pe,useEffect as rt,useRef as mo,useState as nt}from"react";import{createPortal as Ds}from"react-dom";import{jsx as _r,jsxs as F0}from"react/jsx-runtime";import"react";var Is=()=>F0("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[_r("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"}),_r("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"}),_r("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 vs(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function i1(){let t=po();if(Nr(t)&&!t.isCollapsed()||Mt(t)&&!t.anchor.is(t.focus)||!Nr(t)&&!Mt(t))return!1;let[e]=U0(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function s1(t){if(t.getChildrenSize()!==1)return!1;let e=t.getFirstChildOrThrow();return!(!Q0(e)||!e.isEmpty())}function a1(t){let e=t.getLastDescendant();e1(e)?e.select():q0(e)?e.selectEnd():e!==null&&e.selectNext()}function c1({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[l]=Ms(),i=mo(null),[s,u]=nt(n),[c,d]=nt({columns:1,rows:1}),[a,p]=nt(!1),[m,f]=nt(!1),{y:h}=Z0();rt(()=>l.registerMutationListener(X0,C=>{C.get(s.getKey())==="updated"&&l.getEditorState().read(()=>{u(s.getLatest())})},{skipInitialization:!0}),[l,s]),rt(()=>{l.getEditorState().read(()=>{let C=po();if(Mt(C)){let E=vs(C);d(vs(C)),p(E.columns>1||E.rows>1)}f(i1())})},[l]),rt(()=>{let C=e.current,E=i.current,L=l.getRootElement();if(C!=null&&E!=null&&L!=null){let S=L.getBoundingClientRect(),R=C.getBoundingClientRect();E.style.opacity="1";let T=E.getBoundingClientRect(),$=5,F=R.right+$;if(F+T.width>window.innerWidth||F+T.width>S.right){let K=R.left-T.width-$;F=(K<0?$:K)+window.pageXOffset}E.style.left=`${F+window.pageXOffset}px`;let W=R.top;if(W+T.height>window.innerHeight){let K=R.bottom-T.height;W=K<0?$:K}E.style.top=`${W}px`}},[e,i,l,h]),rt(()=>{function C(E){i.current!=null&&e.current!=null&&n1(E.target)&&!i.current.contains(E.target)&&!e.current.contains(E.target)&&r(!1)}return window.addEventListener("click",C),()=>window.removeEventListener("click",C)},[r,e]);let x=pe(()=>{l.update(()=>{if(s.isAttached()){let C=Ie(s),E=wr(C,l.getElementByKey(C.getKey()));if(E===null)throw new Error("Expected to find tableElement in DOM");let L=Er(E);L!==null&&L.$clearHighlight(),C.markDirty(),u(s.getLatest())}t1(null)})},[l,s]),k=()=>{l.update(()=>{let C=po();if(Mt(C)){let L=C.getNodes().filter(As);if(L.length===0)return;let S=Ie(L[0]),[R]=Tr(S,null,null),T=1/0,$=-1/0,F=1/0,W=-1/0,K=new Set;for(let q of R)for(let J of q){if(!J||!J.cell)continue;let re=J.cell.getKey();if(!K.has(re)&&L.some(ne=>ne.is(J.cell))){K.add(re);let ne=J.startRow,se=J.startColumn,Oe=J.cell.__rowSpan||1,it=J.cell.__colSpan||1;T=Math.min(T,ne),$=Math.max($,ne+Oe-1),F=Math.min(F,se),W=Math.max(W,se+it-1)}}if(T===1/0||F===1/0)return;let fe=$-T+1,j=W-F+1,U=R?.[T]?.[F];if(!U?.cell)return;let oe=U.cell;oe.setColSpan(j),oe.setRowSpan(fe);let ue=new Set([oe.getKey()]);for(let q=T;q<=$;q++)for(let J=F;J<=W;J++){let re=R?.[q]?.[J];if(!re?.cell)continue;let ne=re.cell,se=ne.getKey();ue.has(se)||(ue.add(se),s1(ne)||oe.append(...ne.getChildren()),ne.remove())}oe.getChildrenSize()===0&&oe.append(Y0()),a1(oe),o()}})},I=()=>{l.update(()=>{J0()})},A=pe(C=>{l.update(()=>{for(let E=0;E<c.rows;E++)K0(C);o()})},[l,o,c.rows]),b=pe(C=>{l.update(()=>{for(let E=0;E<c.columns;E++)V0(C);o()})},[l,o,c.columns]),_=pe(()=>{l.update(()=>{j0(),o()})},[l,o]),g=pe(()=>{l.update(()=>{Ie(s).remove(),x(),o()})},[l,s,x,o]),w=pe(()=>{l.update(()=>{H0(),o()})},[l,o]),M=pe(()=>{l.update(()=>{let C=Ie(s),E=W0(s),[L]=Tr(C,null,null),S=new Set,R=s.getHeaderStyles()^De.ROW;if(L[E])for(let T=0;T<L[E].length;T++){let $=L[E][T];$?.cell&&(S.has($.cell)||(S.add($.cell),$.cell.setHeaderStyles(R,De.ROW)))}x(),o()})},[l,s,x,o]),D=pe(()=>{l.update(()=>{let C=Ie(s),E=G0(s),[L]=Tr(C,null,null),S=new Set,R=s.getHeaderStyles()^De.COLUMN;if(L)for(let T=0;T<L.length;T++){let $=L?.[T]?.[E];$?.cell&&(S.has($.cell)||(S.add($.cell),$.cell.setHeaderStyles(R,De.COLUMN)))}x(),o()})},[l,s,x,o]),P=pe(()=>{l.update(()=>{if(s.isAttached()){let C=Ie(s);C&&C.setRowStriping(!C.getRowStriping())}x(),o()})},[l,s,x,o]),v=pe(()=>{l.update(()=>{if(s.isAttached()){let C=Ie(s);C&&C.setFrozenColumns(C.getFrozenColumns()===0?1:0)}x(),o()})},[l,s,x,o]),N=null;return t&&(a?N=B("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>k(),type:"button",children:B("span",{className:"text",children:"Merge cells"})}):m&&(N=B("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>I(),type:"button",children:B("span",{className:"text",children:"Unmerge cells"})}))),Ds(ye("div",{className:"table-action-menu-dropdown",onClick:C=>{C.stopPropagation()},ref:i,children:[N?ye(Sr.Fragment,{children:[N,B("hr",{})]}):null,B("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>P(),type:"button",children:B("span",{className:"text",children:"Toggle Row Striping"})}),B("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>v(),type:"button",children:B("span",{className:"text",children:"Toggle First Column Freeze"})}),B("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>A(!1),type:"button",children:ye("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," above"]})}),B("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>A(!0),type:"button",children:ye("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," below"]})}),B("hr",{}),B("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>b(!1),type:"button",children:ye("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","left"]})}),B("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>b(!0),type:"button",children:ye("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","right"]})}),B("hr",{}),B("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>w(),type:"button",children:B("span",{className:"text",children:"Delete column"})}),B("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>_(),type:"button",children:B("span",{className:"text",children:"Delete row"})}),B("button",{className:"item","data-test-id":"table-delete",onClick:()=>g(),type:"button",children:B("span",{className:"text",children:"Delete table"})}),B("hr",{}),B("button",{className:"item","data-test-id":"table-row-header",onClick:()=>M(),type:"button",children:ye("span",{className:"text",children:[(s.__headerState&De.ROW)===De.ROW?"Remove":"Add"," ","row header"]})}),B("button",{className:"item","data-test-id":"table-column-header",onClick:()=>D(),type:"button",children:ye("span",{className:"text",children:[(s.__headerState&De.COLUMN)===De.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function u1({anchorElem:t,cellMerge:e}){let[o]=Ms(),r=mo(null),n=mo(null),[l,i]=nt(!1),[s,u]=nt(null),c=pe(()=>{let a=r.current,p=po(),m=r1(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(p==null||a==null)return h();let x=o.getRootElement(),k=null,I=null;if(Nr(p)&&x!==null&&m!==null&&x.contains(m.anchorNode)){let b=Rs(p.anchor.getNode());if(b==null||(I=o.getElementByKey(b.getKey()),I==null||!b.isAttached()))return h();let _=Ie(b),g=wr(_,o.getElementByKey(_.getKey()));if(g===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");k=Er(g),u(b)}else if(Mt(p)){let b=Rs(p.anchor.getNode());if(!As(b))throw new Error("TableSelection anchorNode must be a TableCellNode");let _=Ie(b),g=wr(_,o.getElementByKey(_.getKey()));if(g===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");k=Er(g),I=o.getElementByKey(b.getKey())}else if(!f)return h();if(k===null||I===null)return h();let A=!k||!k.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",A),a.classList.toggle("table-cell-action-button-container--inactive",!A),A){let b=I.getBoundingClientRect(),_=t.getBoundingClientRect(),g=b.top-_.top,w=b.right-_.left;a.style.transform=`translate(${w}px, ${g}px)`}},[o,t]);rt(()=>{let a,p=()=>{a=void 0,o.getEditorState().read(c)},m=()=>(a===void 0&&(a=setTimeout(p,0)),!1);return z0(o.registerUpdateListener(m),o.registerCommand(l1,m,o1),o.registerRootListener((f,h)=>{h&&h.removeEventListener("pointerup",m),f&&(f.addEventListener("pointerup",m),m())}),()=>clearTimeout(a))});let d=mo(s);return rt(()=>{d.current!==s&&i(!1),d.current=s},[d,s]),B("div",{className:"table-cell-action-button-container",ref:r,children:s!=null&&ye(Sr.Fragment,{children:[B("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),i(!l)},ref:n,type:"button",children:B(Is,{})}),l&&B(c1,{cellMerge:e,contextRef:n,onClose:()=>i(!1),setIsMenuOpen:i,tableCellNode:s})]})})}var Os=t=>{let e=P0(3),{anchorElem:o}=t,r=B0(),n;return e[0]!==o||e[1]!==r?(n=Ds(r?B(u1,{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 d1}from"react/compiler-runtime";import{jsx as ho,jsxs as m1}from"react/jsx-runtime";import{useLexicalComposerContext as p1}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as f1}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as h1,$getTableNodeFromLexicalNodeOrThrow as Lr,$getTableRowIndexFromTableCellNode as g1,$isTableCellNode as $s,$isTableRowNode as x1,getDOMCellFromTarget as C1,getTableElement as b1,TableNode as Fs}from"@lexical/table";import{calculateZoomLevel as Ps,mergeRegister as k1}from"@lexical/utils";import{$getNearestNodeFromDOMNode as yr,isHTMLElement as _1}from"lexical";import*as Hs from"react";import{useCallback as At,useEffect as Ir,useRef as fo,useState as lt}from"react";import{createPortal as T1}from"react-dom";var w1=33,Bs=92;function E1({editor:t}){let e=fo(null),o=fo(null),r=fo(null),[n,l]=lt(!1),i=G(),s=fo(null),[u,c]=lt(null),[d,a]=lt(null),[p,m]=lt(!1),[f,h]=lt(null),x=At(()=>{a(null),e.current=null,h(null),s.current=null,r.current=null},[]),k=v=>(v.buttons&1)===1;Ir(()=>{let v=new Set;return k1(t.registerMutationListener(Fs,N=>{for(let[C,E]of N)E==="destroyed"?v.delete(C):v.add(C);l(v.size>0)}),t.registerNodeTransform(Fs,N=>{if(N.getColWidths())return N;let C=N.getColumnCount(),E=Bs;return N.setColWidths(Array(C).fill(E)),N}))},[t]),Ir(()=>{if(!n)return;let v=L=>{let S=L.target;if(_1(S)){if(f){c({x:L.clientX,y:L.clientY});return}if(m(k(L)),!(o.current&&o.current.contains(S))&&e.current!==S){e.current=S;let R=C1(S);R&&d!==R?t.getEditorState().read(()=>{let T=yr(R.elem);if(!T)throw new Error("TableCellResizer: Table cell node not found.");let $=Lr(T),F=b1($,t.getElementByKey($.getKey()));if(!F)throw new Error("TableCellResizer: Table element not found.");e.current=S,r.current=F.getBoundingClientRect(),a(R)},{editor:t}):R==null&&x()}}},N=L=>{m(!0)},C=L=>{m(!1)},E=t.registerRootListener((L,S)=>{S?.removeEventListener("mousemove",v),S?.removeEventListener("mousedown",N),S?.removeEventListener("mouseup",C),L?.addEventListener("mousemove",v),L?.addEventListener("mousedown",N),L?.addEventListener("mouseup",C)});return()=>{E()}},[d,f,t,n,x]);let I=v=>v==="bottom",A=At(v=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let N=yr(d.elem);if(!$s(N))throw new Error("TableCellResizer: Table cell node not found.");let C=Lr(N),E=g1(N),L=C.getChildren(),R=N.getColSpan()===C.getColumnCount()?E:E+N.getRowSpan()-1;if(R>=L.length||R<0)throw new Error("Expected table cell to be inside of table row.");let T=L[R];if(!x1(T))throw new Error("Expected table row");let $=T.getHeight();if($===void 0){let W=T.getChildren();$=Math.min(...W.map(K=>b(K,t)??1/0))}let F=Math.max($+v,w1);T.setHeight(F)},{tag:"skip-scroll-into-view"})},[d,t]),b=(v,N)=>N.getElementByKey(v.getKey())?.clientHeight,_=(v,N)=>{let C;return N.forEach(E=>{E.forEach((L,S)=>{L.cell===v&&(C=S)})}),C},g=At(v=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let N=yr(d.elem);if(!$s(N))throw new Error("TableCellResizer: Table cell node not found.");let C=Lr(N),[E]=h1(C,null,null),L=_(N,E);if(L===void 0)throw new Error("TableCellResizer: Table column not found.");let S=C.getColWidths();if(!S)return;let R=S[L];if(R===void 0)return;let T=[...S],$=Math.max(R+v,Bs);T[L]=$,C.setColWidths(T)},{tag:"skip-scroll-into-view"})},[d,t]),w=At(v=>{let N=C=>{if(C.preventDefault(),C.stopPropagation(),!d)throw new Error("TableCellResizer: Expected active cell.");if(s.current){let{x:E,y:L}=s.current;if(d===null)return;let S=Ps(C.target);if(I(v)){let R=(C.clientY-L)/S;A(R)}else{let R=(C.clientX-E)/S;g(R)}x(),document.removeEventListener("mouseup",N)}};return N},[d,x,g,A]),M=At(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]),[D,P]=lt({bottom:null,left:null,right:null,top:null});return Ir(()=>{if(d){let{height:v,left:N,top:C,width:E}=d.elem.getBoundingClientRect(),L=Ps(d.elem),S=10,R={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${S}px`,left:`${window.scrollX+N}px`,top:`${window.scrollY+C+v-S/2}px`,width:`${E}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${v}px`,left:`${window.scrollX+N+E-S/2}px`,top:`${window.scrollY+C}px`,width:`${S}px`}},T=r.current;f&&u&&T&&(I(f)?(R[f].left=`${window.scrollX+T.left}px`,R[f].top=`${window.scrollY+u.y/L}px`,R[f].height="3px",R[f].width=`${T.width}px`):(R[f].top=`${window.scrollY+T.top}px`,R[f].left=`${window.scrollX+u.x/L}px`,R[f].width="3px",R[f].height=`${T.height}px`),R[f].backgroundColor="#adf"),P(R)}else P({bottom:null,left:null,right:null,top:null})},[d,f,u]),ho("div",{ref:o,children:d!=null&&!p&&m1(Hs.Fragment,{children:[ho("div",{className:`${i.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:M("right"),style:D.right||void 0}),ho("div",{className:`${i.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:M("bottom"),style:D.bottom||void 0})]})})}var js=()=>{let t=d1(3),[e]=p1(),o=f1(),r,n;return t[0]!==e||t[1]!==o?(n=o?T1(ho(E1,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=n):n=t[2],r=n,r};import{c as M1}from"react/compiler-runtime";import{jsx as Rr,jsxs as A1,Fragment as D1}from"react/jsx-runtime";import{useLexicalComposerContext as zs}from"@lexical/react/LexicalComposerContext";import{$getTableAndElementByKey as O1,$getTableColumnIndexFromTableCellNode as $1,$getTableRowIndexFromTableCellNode as F1,$insertTableColumn__EXPERIMENTAL as P1,$insertTableRow__EXPERIMENTAL as B1,$isTableCellNode as H1,$isTableNode as Ws,getTableElement as j1,TableNode as U1}from"@lexical/table";import{$findMatchingParent as G1,mergeRegister as W1}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Vs,isHTMLElement as V1}from"lexical";import{useEffect as Ks,useMemo as K1,useRef as Js,useState as go}from"react";import"react";import{createPortal as J1}from"react-dom";import{c as I1}from"react/compiler-runtime";import{useEffect as R1,useRef as v1}from"react";var N1="Expected a function",S1=Math.max,L1=Math.min;function y1(t,e,o){let r,n,l=0,i,s=!1,u=!1,c,d,a,p=!0;if(typeof t!="function")throw new TypeError(N1);e=e||0,typeof o=="object"&&(s=!!o.leading,u="maxWait"in o,c=u?S1(o.maxWait||0,e):c,p="trailing"in o?!!o.trailing:p);function m(g){let w=r,M=i;return r=i=void 0,l=g,d=t.apply(M,w),d}function f(g){return l=g,a=setTimeout(k,e),s?m(g):d}function h(g){let w=g-n,M=g-l,D=e-w;return u?L1(D,c-M):D}function x(g){let w=g-n,M=g-l;return n===void 0||w>=e||w<0||u&&M>=c}function k(){let g=Date.now();if(x(g))return I(g);a=setTimeout(k,h(g))}function I(g){return a=void 0,p&&r?m(g):(r=i=void 0,d)}function A(){a!==void 0&&clearTimeout(a),l=0,r=n=i=a=void 0}function b(){return a===void 0?d:I(Date.now())}function _(){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(k,e),m(n)}return a===void 0&&(a=setTimeout(k,e)),d}return _.cancel=A,_.flush=b,_}var Us=y1;function Gs(t,e,o){let r=I1(6),n=v1(null),l,i;r[0]!==t||r[1]!==o||r[2]!==e?(l=()=>(n.current=Us(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]),R1(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 Xs=20;function X1({anchorElem:t}){let[e]=zs(),o=G(),[r,n]=go(!1),[l,i]=go(!1),[s,u]=go(!1),[c,d]=go({}),a=Js(new Set),p=Js(null),m=Gs(x=>{let{isOutside:k,tableDOMNode:I}=z1(x,o.editorConfig?.lexical);if(k){n(!1),i(!1);return}if(!I)return;p.current=I;let A=null,b=null,_=null;if(e.getEditorState().read(()=>{let S=Vs(I);if(H1(S)){let R=G1(S,T=>Ws(T));if(!Ws(R))return;if(_=j1(R,e.getElementByKey(R.getKey())),_){let T=R.getChildrenSize(),$=R.getChildAtIndex(0)?.getChildrenSize(),F=F1(S),W=$1(S);F===T-1?A=S:W===$-1&&(b=S)}}},{editor:e}),!_)return;let g=_.parentElement;if(!g)return;let{bottom:w,height:M,left:D,right:P,width:v,y:N}=_.getBoundingClientRect(),C=!1;g&&g.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(C=g.scrollWidth>g.clientWidth);let{left:E,y:L}=t.getBoundingClientRect();A?(i(!1),n(!0),d({height:Xs,left:C&&g?g.offsetLeft:D-E,top:w-L+5,width:C&&g?g.offsetWidth:v})):b&&(i(!0),n(!1),d({height:M,left:P-E+5,top:N-L,width:Xs}))},50,250),f=K1(()=>new ResizeObserver(()=>{n(!1),i(!1)}),[]);Ks(()=>{if(s)return document.addEventListener("mousemove",m),()=>{n(!1),i(!1),document.removeEventListener("mousemove",m)}},[s,m]),Ks(()=>W1(e.registerMutationListener(U1,x=>{e.getEditorState().read(()=>{let k=!1;for(let[I,A]of x)switch(A){case"created":{a.current.add(I),k=!0;break}case"destroyed":{a.current.delete(I),k=!0;break}default:break}if(k){f.disconnect();for(let I of a.current){let{tableElement:A}=O1(I);f.observe(A)}u(a.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,f]);let h=x=>{e.update(()=>{p.current&&(Vs(p.current)?.selectEnd(),x?(B1(),n(!1)):(P1(),i(!1)))})};return e?.isEditable()?A1(D1,{children:[r&&Rr("button",{"aria-label":"Add Row",className:o.editorConfig.lexical.theme.tableAddRows,onClick:()=>h(!0),style:{...c},type:"button"}),l&&Rr("button",{"aria-label":"Add Column",className:o.editorConfig.lexical.theme.tableAddColumns,onClick:()=>h(!1),style:{...c},type:"button"})]}):null}function z1(t,e){let o=t.target;if(V1(o)){let r=o.closest(`td.${e.theme.tableCell}, th.${e.theme.tableCell}`);return{isOutside:!(r||o.closest(`button.${e.theme.tableAddRows}`)||o.closest(`button.${e.theme.tableAddColumns}`)||o.closest(`div.${e.theme.tableCellResizer}`)),tableDOMNode:r}}else return{isOutside:!0,tableDOMNode:null}}function Zs(t){let e=M1(2),{anchorElem:o}=t,r=o===void 0?document.body:o,[n]=zs();if(!n?.isEditable())return null;let l;return e[0]!==r?(l=J1(Rr(X1,{anchorElem:r}),r),e[0]=r,e[1]=l):l=e[1],l}import{c as Z1}from"react/compiler-runtime";import{jsx as vr,jsxs as Y1}from"react/jsx-runtime";import{useLexicalComposerContext as q1}from"@lexical/react/LexicalComposerContext";import{TablePlugin as Q1}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as eh,TableCellNode as th,TableNode as oh,TableRowNode as rh}from"@lexical/table";import{mergeRegister as nh}from"@lexical/utils";import{formatDrawerSlug as lh,useEditDepth as ih}from"@payloadcms/ui";import{$getSelection as sh,$isRangeSelection as ah,COMMAND_PRIORITY_EDITOR as ch,createCommand as uh}from"lexical";import{createContext as dh,use as mh,useEffect as ph,useMemo as fh,useState as hh}from"react";import*as Ys from"react";var xo=uh("OPEN_EMBED_DRAWER_COMMAND"),qs=dh({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function Qs({children:t}){let[e,o]=hh({cellEditorConfig:null,cellEditorPlugins:null});return vr(qs,{value:fh(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var ea=()=>{let t=Z1(16),[e]=q1(),o=mh(qs),r=ih(),{fieldProps:n,uuid:l}=G(),{schemaPath:i}=n,s="lexical-table-create-"+l,u;t[0]!==r||t[1]!==s?(u=lh({slug:s,depth:r}),t[0]=r,t[1]=s,t[2]=u):u=t[2];let c=u,{toggleDrawer:d}=Ce(c,!0),a;t[3]!==e||t[4]!==d?(a=()=>{if(!e.hasNodes([oh,rh,th]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return nh(e.registerCommand(xo,()=>{let h;return h=null,e.getEditorState().read(()=>{let x=sh();ah(x)&&(h=x)}),h&&d(),!0},ch))},t[3]=e,t[4]=d,t[5]=a):a=t[5];let p;t[6]!==o||t[7]!==e||t[8]!==d?(p=[o,e,d],t[6]=o,t[7]=e,t[8]=d,t[9]=p):p=t[9],ph(a,p);let m;t[10]!==e?(m=(h,x)=>{!x.columns||!x.rows||e.dispatchCommand(eh,{columns:String(x.columns),rows:String(x.rows)})},t[10]=e,t[11]=m):m=t[11];let f;return t[12]!==c||t[13]!==i||t[14]!==m?(f=Y1(Ys.Fragment,{children:[vr(st,{drawerSlug:c,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:m,schemaPath:i,schemaPathSuffix:"fields"}),vr(Q1,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]}),t[12]=c,t[13]=i,t[14]=m,t[15]=f):f=t[15],f};var bh=y({markdownTransformers:[Ls],nodes:[xh,gh,Ch],plugins:[{Component:ea,position:"normal"},{Component:js,position:"normal"},{Component:Os,position:"floatingAnchorElem"},{Component:Zs,position:"floatingAnchorElem"}],providers:[Qs],slashMenu:{groups:[ee([{Icon:Cr,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(xo,{})}}])]},toolbarFixed:{groups:[_e([{ChildComponent:Cr,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(xo,{})}}])]}});import{$isNodeSelection as Zh}from"lexical";import{jsx as Mr,jsxs as kh}from"react/jsx-runtime";import"react";var Ar=()=>kh("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:[Mr("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"}),Mr("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"}),Mr("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 Nh}from"react/jsx-runtime";import ra from"bson-objectid";import{$applyNodeReplacement as Sh}from"lexical";import*as na from"react";import{jsx as _h}from"react/jsx-runtime";import{DecoratorBlockNode as Th}from"@lexical/react/LexicalDecoratorBlockNode.js";import ta from"bson-objectid";import{$applyNodeReplacement as wh}from"lexical";import"react";function Dr(t){return t.parentElement!=null&&t.parentElement.tagName==="LI"&&t.previousSibling===null&&t.getAttribute("aria-roledescription")==="checkbox"}function Eh(t){if(t.hasAttribute("data-lexical-upload-relation-to")&&t.hasAttribute("data-lexical-upload-id")){let o=t.getAttribute("data-lexical-upload-id"),r=t.getAttribute("data-lexical-upload-relation-to");if(o!=null&&r!=null)return{node:oa({data:{fields:{},relationTo:r,value:o}})}}let e=t;return e.src.startsWith("file:///")||Dr(e),null}var Dt=class extends Th{__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:Eh,priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new ta.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,relationTo:e.relationTo,value:e.value},r=oa({data:o});return r.setFormat(e.format),r}static isInline(){return!1}decorate(){return _h(RawUploadComponent,{data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportDOM(){let e=document.createElement("img");return e.setAttribute("data-lexical-upload-id",String(this.__data?.value)),e.setAttribute("data-lexical-upload-relation-to",this.__data?.relationTo),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"upload",version:3}}getData(){return this.getLatest().__data}setData(e){let o=this.getWritable();o.__data=e}updateDOM(){return!1}};function oa({data:t}){return t?.id||(t.id=new ta.default().toHexString()),wh(new Dt({data:t}))}var Lh=na.lazy(()=>import("./component-NNKG7K3O.js").then(t=>({default:t.UploadComponent})));function yh(t){if(t.hasAttribute("data-lexical-upload-relation-to")&&t.hasAttribute("data-lexical-upload-id")){let o=t.getAttribute("data-lexical-upload-id"),r=t.getAttribute("data-lexical-upload-relation-to");if(o!=null&&r!=null)return{node:We({data:{fields:{},relationTo:r,value:o}})}}let e=t;return e.src.startsWith("file:///")||Dr(e),null}var Re=class extends Dt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{img:e=>({conversion:yh,priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new ra.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,relationTo:e.relationTo,value:e.value},r=We({data:o});return r.setFormat(e.format),r}decorate(){return Nh(Lh,{data:this.__data,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function We({data:t}){return t?.id||(t.id=new ra.default().toHexString()),Sh(new Re({data:t}))}function Or(t){return t instanceof Re}import{c as $h}from"react/compiler-runtime";import{jsx as Fh}from"react/jsx-runtime";import{useLexicalComposerContext as Ph}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Bh,mergeRegister as Hh}from"@lexical/utils";import{useConfig as jh}from"@payloadcms/ui";import{$getPreviousSelection as Uh,$getSelection as Gh,$isParagraphNode as Wh,$isRangeSelection as Vh,COMMAND_PRIORITY_EDITOR as Kh,createCommand as Jh}from"lexical";import{useEffect as Xh}from"react";import{c as la}from"react/compiler-runtime";import{jsx as $r}from"react/jsx-runtime";import{useLexicalComposerContext as ia}from"@lexical/react/LexicalComposerContext.js";import{toast as Ih}from"@payloadcms/ui";import{$getNodeByKey as Rh,COMMAND_PRIORITY_EDITOR as sa}from"lexical";import{useEffect as aa,useState as vh}from"react";var Mh=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=Rh(o);n&&n.replace(We({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(Fr,{fields:null,relationTo:e,value:r})},Ah=t=>{let e=la(13),{enabledCollectionSlugs:o}=t,[r]=ia(),[n,l]=vh(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}=yt(i),d,a;e[2]!==r||e[3]!==c?(d=()=>r.registerCommand(Ke,h=>(l(h?.replace?h?.replace.nodeKey:null),c(),!0),sa),a=[r,c],e[2]=r,e[3]=c,e[4]=d,e[5]=a):(d=e[4],a=e[5]),aa(d,a);let p;e[6]!==s||e[7]!==r||e[8]!==n?(p=h=>{let{collectionSlug:x,doc:k}=h;s(),Mh({editor:r,relationTo:x,replaceNodeKey:n,value:k.id})},e[6]=s,e[7]=r,e[8]=n,e[9]=p):p=e[9];let m=p,f;return e[10]!==u||e[11]!==m?(f=$r(u,{onSelect:m}),e[10]=u,e[11]=m,e[12]=f):f=e[12],f},Dh=()=>{let t=la(3),[e]=ia(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Ke,Oh,sa),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),aa(o,r),null},ca=t=>$r(Ot,{...t,FallbackComponent:Dh,uploads:!0,children:$r(Ah,{...t})});function Oh(){return Ih.error("No upload collections enabled"),!0}var Fr=Jh("INSERT_UPLOAD_COMMAND"),ua=t=>{let e=$h(5),[o]=Ph(),{config:r}=jh(),{collections:n}=r,l,i;e[0]!==o?(l=()=>{if(!o.hasNodes([Re]))throw new Error("UploadPlugin: UploadNode not registered on editor");return Hh(o.registerCommand(Fr,u=>(o.update(()=>{let c=Gh()||Uh();if(Vh(c)){let d=We({data:{id:u.id,fields:u.fields,relationTo:u.relationTo,value:u.value}}),{focus:a}=c,p=a.getNode();Bh(d),Wh(p)&&!p.__first&&p.remove()}}),!0),Kh))},i=[o],e[0]=o,e[1]=l,e[2]=i):(l=e[1],i=e[2]),Xh(l,i);let s;return e[3]!==n?(s=Fh(ca,{enabledCollectionSlugs:n.map(zh)}),e[3]=n,e[4]=s):s=e[4],s};function zh(t){let{slug:e}=t;return e}var Yh=y({nodes:[Re],plugins:[{Component:ua,position:"normal"}],slashMenu:{groups:[ee([{Icon:Ar,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:[_e([{ChildComponent:Ar,isActive:({selection:t})=>{if(!Zh(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Or(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ke,{replace:!1})}}])]}});import{c as Qh}from"react/compiler-runtime";import{jsx as Br}from"react/jsx-runtime";import{ShimmerEffect as eg,useConfig as tg}from"@payloadcms/ui";import{lazy as og,Suspense as rg,useEffect as ng,useState as lg}from"react";var da={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 Co={namespace:"lexical",theme:da};function ma({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 qh}from"payload/shared";var pa=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?qh(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 Pr(t,e,o){return{admin:o,features:pa(t),lexical:e,resolvedFeatureMap:t}}var ig=og(()=>import("./Field-EY5V65PS.js").then(t=>({default:t.RichText}))),sg=t=>{let e=Qh(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?Co:s,{config:p}=tg(),[m,f]=lg(null),h,x;e[2]!==d||e[3]!==r||e[4]!==p||e[5]!==n||e[6]!==l||e[7]!==i||e[8]!==m||e[9]!==a||e[10]!==u?(h=()=>{if(m)return;let I=[];for(let[_,g]of Object.entries(r))g.clientFeatureProvider&&I.push(g.clientFeatureProvider(g.clientFeatureProps));let A=a||Co,b=ma({config:p,featureClientImportMap:n,featureClientSchemaMap:l,field:i,schemaPath:u??i.name,unSanitizedEditorConfig:{features:I,lexical:A}});f(Pr(b,A,d))},x=[a,d,m,r,n,l,i,p,u],e[2]=d,e[3]=r,e[4]=p,e[5]=n,e[6]=l,e[7]=i,e[8]=m,e[9]=a,e[10]=u,e[11]=h,e[12]=x):(h=e[11],x=e[12]),ng(h,x);let k;return e[13]!==m||e[14]!==t?(k=Br(rg,{fallback:Br(eg,{height:"35vh"}),children:m&&Br(ig,{...t,editorConfig:m})}),e[13]=m,e[14]=t,e[15]=k):k=e[15],k};function ag(t){return t instanceof HTMLElement}function cg(...t){return t.filter(Boolean).join(" ")}var bo=new WeakMap;function fa(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function ko(t,e){let o=bo.get(t);if(o===void 0){let r=new Set,n=i=>{o!==void 0&&(o.start=fa(i))},l=i=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let u=fa(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},bo.set(t,o)}return o.listeners.add(e),()=>{ug(t,e)}}function ug(t,e){let o=bo.get(t);if(o===void 0)return;let{listeners:r}=o;r.delete(e),r.size===0&&(bo.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function dg(t,e){return ko(t,(o,r)=>{let[n,l]=o;n<0&&-n>Math.abs(l)&&e(n,r)})}function mg(t,e){return ko(t,(o,r)=>{let[n,l]=o;n>0&&n>Math.abs(l)&&e(n,r)})}function pg(t,e){return ko(t,(o,r)=>{let[n,l]=o;l<0&&-l>Math.abs(n)&&e(n,r)})}function fg(t,e){return ko(t,(o,r)=>{let[n,l]=o;l>0&&l>Math.abs(n)&&e(n,r)})}import{c as hg}from"react/compiler-runtime";import{jsx as gg}from"react/jsx-runtime";import"react";var xg=()=>{let t=hg(2),{EditButton:e}=be(),o;return t[0]!==e?(o=e?gg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Cg}from"react/compiler-runtime";import{jsx as bg}from"react/jsx-runtime";import"react";var kg=()=>{let t=Cg(2),{RemoveButton:e}=be(),o;return t[0]!==e?(o=e?bg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as _g}from"react/compiler-runtime";import{jsx as Tg}from"react/jsx-runtime";import"react";var wg=()=>{let t=_g(2),{Label:e}=be(),o;return t[0]!==e?(o=e?Tg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Eg}from"react/compiler-runtime";import{jsx as Ng}from"react/jsx-runtime";import"react";var Sg=t=>{let e=Eg(3),{children:o}=t,{InlineBlockContainer:r}=be(),n;return e[0]!==r||e[1]!==o?(n=r?Ng(r,{children:o}):null,e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{c as Lg}from"react/compiler-runtime";import{jsx as yg}from"react/jsx-runtime";import"react";var Ig=t=>{let e=Lg(6),{children:o,editButton:r,Label:n,removeButton:l}=t,{BlockCollapsible:i}=$e(),s;return e[0]!==i||e[1]!==n||e[2]!==o||e[3]!==r||e[4]!==l?(s=i?yg(i,{editButton:r,Label:n,removeButton:l,children:o}):null,e[0]=i,e[1]=n,e[2]=o,e[3]=r,e[4]=l,e[5]=s):s=e[5],s};import{c as Rg}from"react/compiler-runtime";import{jsx as vg}from"react/jsx-runtime";import"react";var Mg=()=>{let t=Rg(2),{EditButton:e}=$e(),o;return t[0]!==e?(o=e?vg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Ag}from"react/compiler-runtime";import{jsx as Dg}from"react/jsx-runtime";import"react";var Og=()=>{let t=Ag(2),{RemoveButton:e}=$e(),o;return t[0]!==e?(o=e?Dg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as $g}from"qs-esm";var Fg=({apiURL:t,depth:e,draft:o,locale:r})=>async({id:l,collectionSlug:i,select:s})=>{let u=$g({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())};export{Ct as $createAutoLinkNode,Vt as $createBlockNode,To as $createInlineBlockNode,Te as $createLinkNode,Ue as $createRelationshipNode,We as $createUploadNode,Ee as $isAutoLinkNode,ft as $isBlockNode,wo as $isInlineBlockNode,Y as $isLinkNode,cr as $isRelationshipNode,Or as $isUploadNode,La as AlignFeatureClient,we as AutoLinkNode,Ig as BlockCollapsible,Mg as BlockEditButton,ke as BlockNode,Og as BlockRemoveButton,Ma as BlockquoteFeatureClient,Ic as BlocksFeatureClient,qc as BoldFeatureClient,ce as CAN_USE_DOM,qm as ChecklistFeatureClient,Up as DETAIL_TYPE_TO_DETAIL,Pp as DOUBLE_LINE_BREAK,ef as DebugJsxConverterFeatureClient,Wp as ELEMENT_FORMAT_TO_TYPE,Gp as ELEMENT_TYPE_TO_FORMAT,ka as ENABLE_SLASH_MENU_COMMAND,ga as EditorConfigProvider,st as FieldsDrawer,h0 as FixedToolbarFeatureClient,Vu as HeadingFeatureClient,ad as HorizontalRuleFeatureClient,Je as INSERT_BLOCK_COMMAND,Xe as INSERT_INLINE_BLOCK_COMMAND,$p as IS_ALL_FORMATTING,Ed as IndentFeatureClient,Sg as InlineBlockContainer,xg as InlineBlockEditButton,wg as InlineBlockLabel,_o as InlineBlockNode,kg as InlineBlockRemoveButton,ru as InlineCodeFeatureClient,S0 as InlineToolbarFeatureClient,su as ItalicFeatureClient,Hp as LTR_REGEX,kp as LexicalPluginToLexicalFeatureClient,Fm as LinkFeatureClient,ie as LinkNode,Fp as NON_BREAKING_SPACE,O as NodeFormat,ip as OrderedListFeatureClient,yp as ParagraphFeatureClient,Ca as Point,Bp as RTL_REGEX,_a as Rect,jf as RelationshipFeatureClient,Se as RelationshipNode,sg as RichTextField,Sp as SlateToLexicalFeatureClient,mu as StrikethroughFeatureClient,gu as SubscriptFeatureClient,ku as SuperscriptFeatureClient,Vp as TEXT_MODE_TO_TYPE,jp as TEXT_TYPE_TO_FORMAT,Kp as TEXT_TYPE_TO_MODE,ge as TOGGLE_LINK_COMMAND,bh as TableFeatureClient,Gc as TestRecorderFeatureClient,$u as TextStateFeatureClient,It as ToolbarButton,Ge as ToolbarDropdown,Xc as TreeViewFeatureClient,Nu as UnderlineFeatureClient,fp as UnorderedListFeatureClient,Yh as UploadFeatureClient,Re as UploadNode,fg as addSwipeDownListener,dg as addSwipeLeftListener,mg as addSwipeRightListener,pg as addSwipeUpListener,jo as createBlockNode,y as createClientFeature,tf as defaultColors,Co as defaultEditorLexicalConfig,xr as getDOMRangeRect,Ta as getEnabledNodes,Fg as getRestPopulateFn,ze as getSelectedNode,ag as isHTMLElement,ba as isPoint,cg as joinClasses,Pr as sanitizeClientEditorConfig,pa as sanitizeClientFeatures,so as setFloatingElemPosition,eo as setFloatingElemPositionForLinkEditor,ee as slashMenuBasicGroupWithItems,_e as toolbarAddDropdownGroupWithItems,Go as toolbarFeatureButtonsGroupWithItems,te as toolbarFormatGroupWithItems,le as toolbarTextDropdownGroupWithItems,$e as useBlockComponentContext,G as useEditorConfigContext,be as useInlineBlockComponentContext,xa as useLexicalDocumentDrawer,Ce as useLexicalDrawer,yt as useLexicalListDrawer};
|
|
40
|
+
`);let o=L0(uo.NO_STATUS);return Ur(t,e,o),o},Ns=(t,e)=>{let o=t.match(Ss);return!o||!o[1]?null:o[1].split("|").map(r=>ys(r,e))};import{c as P0}from"react/compiler-runtime";import{jsx as B,jsxs as ye}from"react/jsx-runtime";import{useLexicalComposerContext as Ms}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as B0}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as Tr,$deleteTableColumn__EXPERIMENTAL as H0,$deleteTableRow__EXPERIMENTAL as j0,$getNodeTriplet as U0,$getTableCellNodeFromLexicalNode as Rs,$getTableColumnIndexFromTableCellNode as G0,$getTableNodeFromLexicalNodeOrThrow as Ie,$getTableRowIndexFromTableCellNode as W0,$insertTableColumn__EXPERIMENTAL as V0,$insertTableRow__EXPERIMENTAL as K0,$isTableCellNode as As,$isTableSelection as Mt,$unmergeCell as J0,getTableElement as wr,getTableObserverFromTableElement as Er,TableCellHeaderStates as De,TableCellNode as X0}from"@lexical/table";import{mergeRegister as z0}from"@lexical/utils";import{useScrollInfo as Z0}from"@payloadcms/ui";import{$createParagraphNode as Y0,$getSelection as po,$isElementNode as q0,$isParagraphNode as Q0,$isRangeSelection as Nr,$isTextNode as e1,$setSelection as t1,COMMAND_PRIORITY_CRITICAL as o1,getDOMSelection as r1,isDOMNode as n1,SELECTION_CHANGE_COMMAND as l1}from"lexical";import*as Sr from"react";import{useCallback as pe,useEffect as rt,useRef as mo,useState as nt}from"react";import{createPortal as Ds}from"react-dom";import{jsx as _r,jsxs as F0}from"react/jsx-runtime";import"react";var Is=()=>F0("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[_r("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"}),_r("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"}),_r("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 vs(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function i1(){let t=po();if(Nr(t)&&!t.isCollapsed()||Mt(t)&&!t.anchor.is(t.focus)||!Nr(t)&&!Mt(t))return!1;let[e]=U0(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function s1(t){if(t.getChildrenSize()!==1)return!1;let e=t.getFirstChildOrThrow();return!(!Q0(e)||!e.isEmpty())}function a1(t){let e=t.getLastDescendant();e1(e)?e.select():q0(e)?e.selectEnd():e!==null&&e.selectNext()}function c1({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[l]=Ms(),i=mo(null),[s,u]=nt(n),[c,d]=nt({columns:1,rows:1}),[a,p]=nt(!1),[m,f]=nt(!1),{y:h}=Z0();rt(()=>l.registerMutationListener(X0,C=>{C.get(s.getKey())==="updated"&&l.getEditorState().read(()=>{u(s.getLatest())})},{skipInitialization:!0}),[l,s]),rt(()=>{l.getEditorState().read(()=>{let C=po();if(Mt(C)){let E=vs(C);d(vs(C)),p(E.columns>1||E.rows>1)}f(i1())})},[l]),rt(()=>{let C=e.current,E=i.current,L=l.getRootElement();if(C!=null&&E!=null&&L!=null){let S=L.getBoundingClientRect(),R=C.getBoundingClientRect();E.style.opacity="1";let T=E.getBoundingClientRect(),$=5,F=R.right+$;if(F+T.width>window.innerWidth||F+T.width>S.right){let K=R.left-T.width-$;F=(K<0?$:K)+window.pageXOffset}E.style.left=`${F+window.pageXOffset}px`;let W=R.top;if(W+T.height>window.innerHeight){let K=R.bottom-T.height;W=K<0?$:K}E.style.top=`${W}px`}},[e,i,l,h]),rt(()=>{function C(E){i.current!=null&&e.current!=null&&n1(E.target)&&!i.current.contains(E.target)&&!e.current.contains(E.target)&&r(!1)}return window.addEventListener("click",C),()=>window.removeEventListener("click",C)},[r,e]);let x=pe(()=>{l.update(()=>{if(s.isAttached()){let C=Ie(s),E=wr(C,l.getElementByKey(C.getKey()));if(E===null)throw new Error("Expected to find tableElement in DOM");let L=Er(E);L!==null&&L.$clearHighlight(),C.markDirty(),u(s.getLatest())}t1(null)})},[l,s]),k=()=>{l.update(()=>{let C=po();if(Mt(C)){let L=C.getNodes().filter(As);if(L.length===0)return;let S=Ie(L[0]),[R]=Tr(S,null,null),T=1/0,$=-1/0,F=1/0,W=-1/0,K=new Set;for(let q of R)for(let J of q){if(!J||!J.cell)continue;let re=J.cell.getKey();if(!K.has(re)&&L.some(ne=>ne.is(J.cell))){K.add(re);let ne=J.startRow,se=J.startColumn,Oe=J.cell.__rowSpan||1,it=J.cell.__colSpan||1;T=Math.min(T,ne),$=Math.max($,ne+Oe-1),F=Math.min(F,se),W=Math.max(W,se+it-1)}}if(T===1/0||F===1/0)return;let fe=$-T+1,j=W-F+1,U=R?.[T]?.[F];if(!U?.cell)return;let oe=U.cell;oe.setColSpan(j),oe.setRowSpan(fe);let ue=new Set([oe.getKey()]);for(let q=T;q<=$;q++)for(let J=F;J<=W;J++){let re=R?.[q]?.[J];if(!re?.cell)continue;let ne=re.cell,se=ne.getKey();ue.has(se)||(ue.add(se),s1(ne)||oe.append(...ne.getChildren()),ne.remove())}oe.getChildrenSize()===0&&oe.append(Y0()),a1(oe),o()}})},I=()=>{l.update(()=>{J0()})},A=pe(C=>{l.update(()=>{for(let E=0;E<c.rows;E++)K0(C);o()})},[l,o,c.rows]),b=pe(C=>{l.update(()=>{for(let E=0;E<c.columns;E++)V0(C);o()})},[l,o,c.columns]),_=pe(()=>{l.update(()=>{j0(),o()})},[l,o]),g=pe(()=>{l.update(()=>{Ie(s).remove(),x(),o()})},[l,s,x,o]),w=pe(()=>{l.update(()=>{H0(),o()})},[l,o]),M=pe(()=>{l.update(()=>{let C=Ie(s),E=W0(s),[L]=Tr(C,null,null),S=new Set,R=s.getHeaderStyles()^De.ROW;if(L[E])for(let T=0;T<L[E].length;T++){let $=L[E][T];$?.cell&&(S.has($.cell)||(S.add($.cell),$.cell.setHeaderStyles(R,De.ROW)))}x(),o()})},[l,s,x,o]),D=pe(()=>{l.update(()=>{let C=Ie(s),E=G0(s),[L]=Tr(C,null,null),S=new Set,R=s.getHeaderStyles()^De.COLUMN;if(L)for(let T=0;T<L.length;T++){let $=L?.[T]?.[E];$?.cell&&(S.has($.cell)||(S.add($.cell),$.cell.setHeaderStyles(R,De.COLUMN)))}x(),o()})},[l,s,x,o]),P=pe(()=>{l.update(()=>{if(s.isAttached()){let C=Ie(s);C&&C.setRowStriping(!C.getRowStriping())}x(),o()})},[l,s,x,o]),v=pe(()=>{l.update(()=>{if(s.isAttached()){let C=Ie(s);C&&C.setFrozenColumns(C.getFrozenColumns()===0?1:0)}x(),o()})},[l,s,x,o]),N=null;return t&&(a?N=B("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>k(),type:"button",children:B("span",{className:"text",children:"Merge cells"})}):m&&(N=B("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>I(),type:"button",children:B("span",{className:"text",children:"Unmerge cells"})}))),Ds(ye("div",{className:"table-action-menu-dropdown",onClick:C=>{C.stopPropagation()},ref:i,children:[N?ye(Sr.Fragment,{children:[N,B("hr",{})]}):null,B("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>P(),type:"button",children:B("span",{className:"text",children:"Toggle Row Striping"})}),B("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>v(),type:"button",children:B("span",{className:"text",children:"Toggle First Column Freeze"})}),B("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>A(!1),type:"button",children:ye("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," above"]})}),B("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>A(!0),type:"button",children:ye("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," below"]})}),B("hr",{}),B("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>b(!1),type:"button",children:ye("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","left"]})}),B("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>b(!0),type:"button",children:ye("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","right"]})}),B("hr",{}),B("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>w(),type:"button",children:B("span",{className:"text",children:"Delete column"})}),B("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>_(),type:"button",children:B("span",{className:"text",children:"Delete row"})}),B("button",{className:"item","data-test-id":"table-delete",onClick:()=>g(),type:"button",children:B("span",{className:"text",children:"Delete table"})}),B("hr",{}),B("button",{className:"item","data-test-id":"table-row-header",onClick:()=>M(),type:"button",children:ye("span",{className:"text",children:[(s.__headerState&De.ROW)===De.ROW?"Remove":"Add"," ","row header"]})}),B("button",{className:"item","data-test-id":"table-column-header",onClick:()=>D(),type:"button",children:ye("span",{className:"text",children:[(s.__headerState&De.COLUMN)===De.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function u1({anchorElem:t,cellMerge:e}){let[o]=Ms(),r=mo(null),n=mo(null),[l,i]=nt(!1),[s,u]=nt(null),c=pe(()=>{let a=r.current,p=po(),m=r1(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(p==null||a==null)return h();let x=o.getRootElement(),k=null,I=null;if(Nr(p)&&x!==null&&m!==null&&x.contains(m.anchorNode)){let b=Rs(p.anchor.getNode());if(b==null||(I=o.getElementByKey(b.getKey()),I==null||!b.isAttached()))return h();let _=Ie(b),g=wr(_,o.getElementByKey(_.getKey()));if(g===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");k=Er(g),u(b)}else if(Mt(p)){let b=Rs(p.anchor.getNode());if(!As(b))throw new Error("TableSelection anchorNode must be a TableCellNode");let _=Ie(b),g=wr(_,o.getElementByKey(_.getKey()));if(g===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");k=Er(g),I=o.getElementByKey(b.getKey())}else if(!f)return h();if(k===null||I===null)return h();let A=!k||!k.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",A),a.classList.toggle("table-cell-action-button-container--inactive",!A),A){let b=I.getBoundingClientRect(),_=t.getBoundingClientRect(),g=b.top-_.top,w=b.right-_.left;a.style.transform=`translate(${w}px, ${g}px)`}},[o,t]);rt(()=>{let a,p=()=>{a=void 0,o.getEditorState().read(c)},m=()=>(a===void 0&&(a=setTimeout(p,0)),!1);return z0(o.registerUpdateListener(m),o.registerCommand(l1,m,o1),o.registerRootListener((f,h)=>{h&&h.removeEventListener("pointerup",m),f&&(f.addEventListener("pointerup",m),m())}),()=>clearTimeout(a))});let d=mo(s);return rt(()=>{d.current!==s&&i(!1),d.current=s},[d,s]),B("div",{className:"table-cell-action-button-container",ref:r,children:s!=null&&ye(Sr.Fragment,{children:[B("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),i(!l)},ref:n,type:"button",children:B(Is,{})}),l&&B(c1,{cellMerge:e,contextRef:n,onClose:()=>i(!1),setIsMenuOpen:i,tableCellNode:s})]})})}var Os=t=>{let e=P0(3),{anchorElem:o}=t,r=B0(),n;return e[0]!==o||e[1]!==r?(n=Ds(r?B(u1,{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 d1}from"react/compiler-runtime";import{jsx as ho,jsxs as m1}from"react/jsx-runtime";import{useLexicalComposerContext as p1}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as f1}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as h1,$getTableNodeFromLexicalNodeOrThrow as Lr,$getTableRowIndexFromTableCellNode as g1,$isTableCellNode as $s,$isTableRowNode as x1,getDOMCellFromTarget as C1,getTableElement as b1,TableNode as Fs}from"@lexical/table";import{calculateZoomLevel as Ps,mergeRegister as k1}from"@lexical/utils";import{$getNearestNodeFromDOMNode as yr,isHTMLElement as _1}from"lexical";import*as Hs from"react";import{useCallback as At,useEffect as Ir,useRef as fo,useState as lt}from"react";import{createPortal as T1}from"react-dom";var w1=33,Bs=92;function E1({editor:t}){let e=fo(null),o=fo(null),r=fo(null),[n,l]=lt(!1),i=G(),s=fo(null),[u,c]=lt(null),[d,a]=lt(null),[p,m]=lt(!1),[f,h]=lt(null),x=At(()=>{a(null),e.current=null,h(null),s.current=null,r.current=null},[]),k=v=>(v.buttons&1)===1;Ir(()=>{let v=new Set;return k1(t.registerMutationListener(Fs,N=>{for(let[C,E]of N)E==="destroyed"?v.delete(C):v.add(C);l(v.size>0)}),t.registerNodeTransform(Fs,N=>{if(N.getColWidths())return N;let C=N.getColumnCount(),E=Bs;return N.setColWidths(Array(C).fill(E)),N}))},[t]),Ir(()=>{if(!n)return;let v=L=>{let S=L.target;if(_1(S)){if(f){c({x:L.clientX,y:L.clientY});return}if(m(k(L)),!(o.current&&o.current.contains(S))&&e.current!==S){e.current=S;let R=C1(S);R&&d!==R?t.getEditorState().read(()=>{let T=yr(R.elem);if(!T)throw new Error("TableCellResizer: Table cell node not found.");let $=Lr(T),F=b1($,t.getElementByKey($.getKey()));if(!F)throw new Error("TableCellResizer: Table element not found.");e.current=S,r.current=F.getBoundingClientRect(),a(R)},{editor:t}):R==null&&x()}}},N=L=>{m(!0)},C=L=>{m(!1)},E=t.registerRootListener((L,S)=>{S?.removeEventListener("mousemove",v),S?.removeEventListener("mousedown",N),S?.removeEventListener("mouseup",C),L?.addEventListener("mousemove",v),L?.addEventListener("mousedown",N),L?.addEventListener("mouseup",C)});return()=>{E()}},[d,f,t,n,x]);let I=v=>v==="bottom",A=At(v=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let N=yr(d.elem);if(!$s(N))throw new Error("TableCellResizer: Table cell node not found.");let C=Lr(N),E=g1(N),L=C.getChildren(),R=N.getColSpan()===C.getColumnCount()?E:E+N.getRowSpan()-1;if(R>=L.length||R<0)throw new Error("Expected table cell to be inside of table row.");let T=L[R];if(!x1(T))throw new Error("Expected table row");let $=T.getHeight();if($===void 0){let W=T.getChildren();$=Math.min(...W.map(K=>b(K,t)??1/0))}let F=Math.max($+v,w1);T.setHeight(F)},{tag:"skip-scroll-into-view"})},[d,t]),b=(v,N)=>N.getElementByKey(v.getKey())?.clientHeight,_=(v,N)=>{let C;return N.forEach(E=>{E.forEach((L,S)=>{L.cell===v&&(C=S)})}),C},g=At(v=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let N=yr(d.elem);if(!$s(N))throw new Error("TableCellResizer: Table cell node not found.");let C=Lr(N),[E]=h1(C,null,null),L=_(N,E);if(L===void 0)throw new Error("TableCellResizer: Table column not found.");let S=C.getColWidths();if(!S)return;let R=S[L];if(R===void 0)return;let T=[...S],$=Math.max(R+v,Bs);T[L]=$,C.setColWidths(T)},{tag:"skip-scroll-into-view"})},[d,t]),w=At(v=>{let N=C=>{if(C.preventDefault(),C.stopPropagation(),!d)throw new Error("TableCellResizer: Expected active cell.");if(s.current){let{x:E,y:L}=s.current;if(d===null)return;let S=Ps(C.target);if(I(v)){let R=(C.clientY-L)/S;A(R)}else{let R=(C.clientX-E)/S;g(R)}x(),document.removeEventListener("mouseup",N)}};return N},[d,x,g,A]),M=At(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]),[D,P]=lt({bottom:null,left:null,right:null,top:null});return Ir(()=>{if(d){let{height:v,left:N,top:C,width:E}=d.elem.getBoundingClientRect(),L=Ps(d.elem),S=10,R={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${S}px`,left:`${window.scrollX+N}px`,top:`${window.scrollY+C+v-S/2}px`,width:`${E}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${v}px`,left:`${window.scrollX+N+E-S/2}px`,top:`${window.scrollY+C}px`,width:`${S}px`}},T=r.current;f&&u&&T&&(I(f)?(R[f].left=`${window.scrollX+T.left}px`,R[f].top=`${window.scrollY+u.y/L}px`,R[f].height="3px",R[f].width=`${T.width}px`):(R[f].top=`${window.scrollY+T.top}px`,R[f].left=`${window.scrollX+u.x/L}px`,R[f].width="3px",R[f].height=`${T.height}px`),R[f].backgroundColor="#adf"),P(R)}else P({bottom:null,left:null,right:null,top:null})},[d,f,u]),ho("div",{ref:o,children:d!=null&&!p&&m1(Hs.Fragment,{children:[ho("div",{className:`${i.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:M("right"),style:D.right||void 0}),ho("div",{className:`${i.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:M("bottom"),style:D.bottom||void 0})]})})}var js=()=>{let t=d1(3),[e]=p1(),o=f1(),r,n;return t[0]!==e||t[1]!==o?(n=o?T1(ho(E1,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=n):n=t[2],r=n,r};import{c as M1}from"react/compiler-runtime";import{jsx as Rr,jsxs as A1,Fragment as D1}from"react/jsx-runtime";import{useLexicalComposerContext as zs}from"@lexical/react/LexicalComposerContext";import{$getTableAndElementByKey as O1,$getTableColumnIndexFromTableCellNode as $1,$getTableRowIndexFromTableCellNode as F1,$insertTableColumn__EXPERIMENTAL as P1,$insertTableRow__EXPERIMENTAL as B1,$isTableCellNode as H1,$isTableNode as Ws,getTableElement as j1,TableNode as U1}from"@lexical/table";import{$findMatchingParent as G1,mergeRegister as W1}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Vs,isHTMLElement as V1}from"lexical";import{useEffect as Ks,useMemo as K1,useRef as Js,useState as go}from"react";import"react";import{createPortal as J1}from"react-dom";import{c as I1}from"react/compiler-runtime";import{useEffect as R1,useRef as v1}from"react";var N1="Expected a function",S1=Math.max,L1=Math.min;function y1(t,e,o){let r,n,l=0,i,s=!1,u=!1,c,d,a,p=!0;if(typeof t!="function")throw new TypeError(N1);e=e||0,typeof o=="object"&&(s=!!o.leading,u="maxWait"in o,c=u?S1(o.maxWait||0,e):c,p="trailing"in o?!!o.trailing:p);function m(g){let w=r,M=i;return r=i=void 0,l=g,d=t.apply(M,w),d}function f(g){return l=g,a=setTimeout(k,e),s?m(g):d}function h(g){let w=g-n,M=g-l,D=e-w;return u?L1(D,c-M):D}function x(g){let w=g-n,M=g-l;return n===void 0||w>=e||w<0||u&&M>=c}function k(){let g=Date.now();if(x(g))return I(g);a=setTimeout(k,h(g))}function I(g){return a=void 0,p&&r?m(g):(r=i=void 0,d)}function A(){a!==void 0&&clearTimeout(a),l=0,r=n=i=a=void 0}function b(){return a===void 0?d:I(Date.now())}function _(){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(k,e),m(n)}return a===void 0&&(a=setTimeout(k,e)),d}return _.cancel=A,_.flush=b,_}var Us=y1;function Gs(t,e,o){let r=I1(6),n=v1(null),l,i;r[0]!==t||r[1]!==o||r[2]!==e?(l=()=>(n.current=Us(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]),R1(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 Xs=20;function X1({anchorElem:t}){let[e]=zs(),o=G(),[r,n]=go(!1),[l,i]=go(!1),[s,u]=go(!1),[c,d]=go({}),a=Js(new Set),p=Js(null),m=Gs(x=>{let{isOutside:k,tableDOMNode:I}=z1(x,o.editorConfig?.lexical);if(k){n(!1),i(!1);return}if(!I)return;p.current=I;let A=null,b=null,_=null;if(e.getEditorState().read(()=>{let S=Vs(I);if(H1(S)){let R=G1(S,T=>Ws(T));if(!Ws(R))return;if(_=j1(R,e.getElementByKey(R.getKey())),_){let T=R.getChildrenSize(),$=R.getChildAtIndex(0)?.getChildrenSize(),F=F1(S),W=$1(S);F===T-1?A=S:W===$-1&&(b=S)}}},{editor:e}),!_)return;let g=_.parentElement;if(!g)return;let{bottom:w,height:M,left:D,right:P,width:v,y:N}=_.getBoundingClientRect(),C=!1;g&&g.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(C=g.scrollWidth>g.clientWidth);let{left:E,y:L}=t.getBoundingClientRect();A?(i(!1),n(!0),d({height:Xs,left:C&&g?g.offsetLeft:D-E,top:w-L+5,width:C&&g?g.offsetWidth:v})):b&&(i(!0),n(!1),d({height:M,left:P-E+5,top:N-L,width:Xs}))},50,250),f=K1(()=>new ResizeObserver(()=>{n(!1),i(!1)}),[]);Ks(()=>{if(s)return document.addEventListener("mousemove",m),()=>{n(!1),i(!1),document.removeEventListener("mousemove",m)}},[s,m]),Ks(()=>W1(e.registerMutationListener(U1,x=>{e.getEditorState().read(()=>{let k=!1;for(let[I,A]of x)switch(A){case"created":{a.current.add(I),k=!0;break}case"destroyed":{a.current.delete(I),k=!0;break}default:break}if(k){f.disconnect();for(let I of a.current){let{tableElement:A}=O1(I);f.observe(A)}u(a.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,f]);let h=x=>{e.update(()=>{p.current&&(Vs(p.current)?.selectEnd(),x?(B1(),n(!1)):(P1(),i(!1)))})};return e?.isEditable()?A1(D1,{children:[r&&Rr("button",{"aria-label":"Add Row",className:o.editorConfig.lexical.theme.tableAddRows,onClick:()=>h(!0),style:{...c},type:"button"}),l&&Rr("button",{"aria-label":"Add Column",className:o.editorConfig.lexical.theme.tableAddColumns,onClick:()=>h(!1),style:{...c},type:"button"})]}):null}function z1(t,e){let o=t.target;if(V1(o)){let r=o.closest(`td.${e.theme.tableCell}, th.${e.theme.tableCell}`);return{isOutside:!(r||o.closest(`button.${e.theme.tableAddRows}`)||o.closest(`button.${e.theme.tableAddColumns}`)||o.closest(`div.${e.theme.tableCellResizer}`)),tableDOMNode:r}}else return{isOutside:!0,tableDOMNode:null}}function Zs(t){let e=M1(2),{anchorElem:o}=t,r=o===void 0?document.body:o,[n]=zs();if(!n?.isEditable())return null;let l;return e[0]!==r?(l=J1(Rr(X1,{anchorElem:r}),r),e[0]=r,e[1]=l):l=e[1],l}import{c as Z1}from"react/compiler-runtime";import{jsx as vr,jsxs as Y1}from"react/jsx-runtime";import{useLexicalComposerContext as q1}from"@lexical/react/LexicalComposerContext";import{TablePlugin as Q1}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as eh,TableCellNode as th,TableNode as oh,TableRowNode as rh}from"@lexical/table";import{mergeRegister as nh}from"@lexical/utils";import{formatDrawerSlug as lh,useEditDepth as ih}from"@payloadcms/ui";import{$getSelection as sh,$isRangeSelection as ah,COMMAND_PRIORITY_EDITOR as ch,createCommand as uh}from"lexical";import{createContext as dh,use as mh,useEffect as ph,useMemo as fh,useState as hh}from"react";import*as Ys from"react";var xo=uh("OPEN_EMBED_DRAWER_COMMAND"),qs=dh({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function Qs({children:t}){let[e,o]=hh({cellEditorConfig:null,cellEditorPlugins:null});return vr(qs,{value:fh(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var ea=()=>{let t=Z1(16),[e]=q1(),o=mh(qs),r=ih(),{fieldProps:n,uuid:l}=G(),{schemaPath:i}=n,s="lexical-table-create-"+l,u;t[0]!==r||t[1]!==s?(u=lh({slug:s,depth:r}),t[0]=r,t[1]=s,t[2]=u):u=t[2];let c=u,{toggleDrawer:d}=Ce(c,!0),a;t[3]!==e||t[4]!==d?(a=()=>{if(!e.hasNodes([oh,rh,th]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return nh(e.registerCommand(xo,()=>{let h=null;return e.getEditorState().read(()=>{let x=sh();ah(x)&&(h=x)}),h&&d(),!0},ch))},t[3]=e,t[4]=d,t[5]=a):a=t[5];let p;t[6]!==o||t[7]!==e||t[8]!==d?(p=[o,e,d],t[6]=o,t[7]=e,t[8]=d,t[9]=p):p=t[9],ph(a,p);let m;t[10]!==e?(m=(h,x)=>{!x.columns||!x.rows||e.dispatchCommand(eh,{columns:String(x.columns),rows:String(x.rows)})},t[10]=e,t[11]=m):m=t[11];let f;return t[12]!==c||t[13]!==i||t[14]!==m?(f=Y1(Ys.Fragment,{children:[vr(st,{drawerSlug:c,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:m,schemaPath:i,schemaPathSuffix:"fields"}),vr(Q1,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]}),t[12]=c,t[13]=i,t[14]=m,t[15]=f):f=t[15],f};var bh=y({markdownTransformers:[Ls],nodes:[xh,gh,Ch],plugins:[{Component:ea,position:"normal"},{Component:js,position:"normal"},{Component:Os,position:"floatingAnchorElem"},{Component:Zs,position:"floatingAnchorElem"}],providers:[Qs],slashMenu:{groups:[ee([{Icon:Cr,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(xo,{})}}])]},toolbarFixed:{groups:[_e([{ChildComponent:Cr,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(xo,{})}}])]}});import{$isNodeSelection as Zh}from"lexical";import{jsx as Mr,jsxs as kh}from"react/jsx-runtime";import"react";var Ar=()=>kh("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:[Mr("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"}),Mr("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"}),Mr("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 Nh}from"react/jsx-runtime";import ra from"bson-objectid";import{$applyNodeReplacement as Sh}from"lexical";import*as na from"react";import{jsx as _h}from"react/jsx-runtime";import{DecoratorBlockNode as Th}from"@lexical/react/LexicalDecoratorBlockNode.js";import ta from"bson-objectid";import{$applyNodeReplacement as wh}from"lexical";import"react";function Dr(t){return t.parentElement!=null&&t.parentElement.tagName==="LI"&&t.previousSibling===null&&t.getAttribute("aria-roledescription")==="checkbox"}function Eh(t){if(t.hasAttribute("data-lexical-upload-relation-to")&&t.hasAttribute("data-lexical-upload-id")){let o=t.getAttribute("data-lexical-upload-id"),r=t.getAttribute("data-lexical-upload-relation-to");if(o!=null&&r!=null)return{node:oa({data:{fields:{},relationTo:r,value:o}})}}let e=t;return e.src.startsWith("file:///")||Dr(e),null}var Dt=class extends Th{__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:Eh,priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new ta.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,relationTo:e.relationTo,value:e.value},r=oa({data:o});return r.setFormat(e.format),r}static isInline(){return!1}decorate(){return _h(RawUploadComponent,{data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportDOM(){let e=document.createElement("img");return e.setAttribute("data-lexical-upload-id",String(this.__data?.value)),e.setAttribute("data-lexical-upload-relation-to",this.__data?.relationTo),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"upload",version:3}}getData(){return this.getLatest().__data}setData(e){let o=this.getWritable();o.__data=e}updateDOM(){return!1}};function oa({data:t}){return t?.id||(t.id=new ta.default().toHexString()),wh(new Dt({data:t}))}var Lh=na.lazy(()=>import("./component-NNKG7K3O.js").then(t=>({default:t.UploadComponent})));function yh(t){if(t.hasAttribute("data-lexical-upload-relation-to")&&t.hasAttribute("data-lexical-upload-id")){let o=t.getAttribute("data-lexical-upload-id"),r=t.getAttribute("data-lexical-upload-relation-to");if(o!=null&&r!=null)return{node:We({data:{fields:{},relationTo:r,value:o}})}}let e=t;return e.src.startsWith("file:///")||Dr(e),null}var Re=class extends Dt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{img:e=>({conversion:yh,priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new ra.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,relationTo:e.relationTo,value:e.value},r=We({data:o});return r.setFormat(e.format),r}decorate(){return Nh(Lh,{data:this.__data,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function We({data:t}){return t?.id||(t.id=new ra.default().toHexString()),Sh(new Re({data:t}))}function Or(t){return t instanceof Re}import{c as $h}from"react/compiler-runtime";import{jsx as Fh}from"react/jsx-runtime";import{useLexicalComposerContext as Ph}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Bh,mergeRegister as Hh}from"@lexical/utils";import{useConfig as jh}from"@payloadcms/ui";import{$getPreviousSelection as Uh,$getSelection as Gh,$isParagraphNode as Wh,$isRangeSelection as Vh,COMMAND_PRIORITY_EDITOR as Kh,createCommand as Jh}from"lexical";import{useEffect as Xh}from"react";import{c as la}from"react/compiler-runtime";import{jsx as $r}from"react/jsx-runtime";import{useLexicalComposerContext as ia}from"@lexical/react/LexicalComposerContext.js";import{toast as Ih}from"@payloadcms/ui";import{$getNodeByKey as Rh,COMMAND_PRIORITY_EDITOR as sa}from"lexical";import{useEffect as aa,useState as vh}from"react";var Mh=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=Rh(o);n&&n.replace(We({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(Fr,{fields:null,relationTo:e,value:r})},Ah=t=>{let e=la(13),{enabledCollectionSlugs:o}=t,[r]=ia(),[n,l]=vh(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}=yt(i),d,a;e[2]!==r||e[3]!==c?(d=()=>r.registerCommand(Ke,h=>(l(h?.replace?h?.replace.nodeKey:null),c(),!0),sa),a=[r,c],e[2]=r,e[3]=c,e[4]=d,e[5]=a):(d=e[4],a=e[5]),aa(d,a);let p;e[6]!==s||e[7]!==r||e[8]!==n?(p=h=>{let{collectionSlug:x,doc:k}=h;s(),Mh({editor:r,relationTo:x,replaceNodeKey:n,value:k.id})},e[6]=s,e[7]=r,e[8]=n,e[9]=p):p=e[9];let m=p,f;return e[10]!==u||e[11]!==m?(f=$r(u,{onSelect:m}),e[10]=u,e[11]=m,e[12]=f):f=e[12],f},Dh=()=>{let t=la(3),[e]=ia(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Ke,Oh,sa),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),aa(o,r),null},ca=t=>$r(Ot,{...t,FallbackComponent:Dh,uploads:!0,children:$r(Ah,{...t})});function Oh(){return Ih.error("No upload collections enabled"),!0}var Fr=Jh("INSERT_UPLOAD_COMMAND"),ua=t=>{let e=$h(5),[o]=Ph(),{config:r}=jh(),{collections:n}=r,l,i;e[0]!==o?(l=()=>{if(!o.hasNodes([Re]))throw new Error("UploadPlugin: UploadNode not registered on editor");return Hh(o.registerCommand(Fr,u=>(o.update(()=>{let c=Gh()||Uh();if(Vh(c)){let d=We({data:{id:u.id,fields:u.fields,relationTo:u.relationTo,value:u.value}}),{focus:a}=c,p=a.getNode();Bh(d),Wh(p)&&!p.__first&&p.remove()}}),!0),Kh))},i=[o],e[0]=o,e[1]=l,e[2]=i):(l=e[1],i=e[2]),Xh(l,i);let s;return e[3]!==n?(s=Fh(ca,{enabledCollectionSlugs:n.map(zh)}),e[3]=n,e[4]=s):s=e[4],s};function zh(t){let{slug:e}=t;return e}var Yh=y({nodes:[Re],plugins:[{Component:ua,position:"normal"}],slashMenu:{groups:[ee([{Icon:Ar,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:[_e([{ChildComponent:Ar,isActive:({selection:t})=>{if(!Zh(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Or(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ke,{replace:!1})}}])]}});import{c as Qh}from"react/compiler-runtime";import{jsx as Br}from"react/jsx-runtime";import{ShimmerEffect as eg,useConfig as tg}from"@payloadcms/ui";import{lazy as og,Suspense as rg,useEffect as ng,useState as lg}from"react";var da={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 Co={namespace:"lexical",theme:da};function ma({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 qh}from"payload/shared";var pa=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?qh(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 Pr(t,e,o){return{admin:o,features:pa(t),lexical:e,resolvedFeatureMap:t}}var ig=og(()=>import("./Field-6GAC5Y2D.js").then(t=>({default:t.RichText}))),sg=t=>{let e=Qh(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?Co:s,{config:p}=tg(),[m,f]=lg(null),h,x;e[2]!==d||e[3]!==r||e[4]!==p||e[5]!==n||e[6]!==l||e[7]!==i||e[8]!==m||e[9]!==a||e[10]!==u?(h=()=>{if(m)return;let I=[];for(let[_,g]of Object.entries(r))g.clientFeatureProvider&&I.push(g.clientFeatureProvider(g.clientFeatureProps));let A=a||Co,b=ma({config:p,featureClientImportMap:n,featureClientSchemaMap:l,field:i,schemaPath:u??i.name,unSanitizedEditorConfig:{features:I,lexical:A}});f(Pr(b,A,d))},x=[a,d,m,r,n,l,i,p,u],e[2]=d,e[3]=r,e[4]=p,e[5]=n,e[6]=l,e[7]=i,e[8]=m,e[9]=a,e[10]=u,e[11]=h,e[12]=x):(h=e[11],x=e[12]),ng(h,x);let k;return e[13]!==m||e[14]!==t?(k=Br(rg,{fallback:Br(eg,{height:"35vh"}),children:m&&Br(ig,{...t,editorConfig:m})}),e[13]=m,e[14]=t,e[15]=k):k=e[15],k};function ag(t){return t instanceof HTMLElement}function cg(...t){return t.filter(Boolean).join(" ")}var bo=new WeakMap;function fa(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function ko(t,e){let o=bo.get(t);if(o===void 0){let r=new Set,n=i=>{o!==void 0&&(o.start=fa(i))},l=i=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let u=fa(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},bo.set(t,o)}return o.listeners.add(e),()=>{ug(t,e)}}function ug(t,e){let o=bo.get(t);if(o===void 0)return;let{listeners:r}=o;r.delete(e),r.size===0&&(bo.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function dg(t,e){return ko(t,(o,r)=>{let[n,l]=o;n<0&&-n>Math.abs(l)&&e(n,r)})}function mg(t,e){return ko(t,(o,r)=>{let[n,l]=o;n>0&&n>Math.abs(l)&&e(n,r)})}function pg(t,e){return ko(t,(o,r)=>{let[n,l]=o;l<0&&-l>Math.abs(n)&&e(n,r)})}function fg(t,e){return ko(t,(o,r)=>{let[n,l]=o;l>0&&l>Math.abs(n)&&e(n,r)})}import{c as hg}from"react/compiler-runtime";import{jsx as gg}from"react/jsx-runtime";import"react";var xg=()=>{let t=hg(2),{EditButton:e}=be(),o;return t[0]!==e?(o=e?gg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Cg}from"react/compiler-runtime";import{jsx as bg}from"react/jsx-runtime";import"react";var kg=()=>{let t=Cg(2),{RemoveButton:e}=be(),o;return t[0]!==e?(o=e?bg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as _g}from"react/compiler-runtime";import{jsx as Tg}from"react/jsx-runtime";import"react";var wg=()=>{let t=_g(2),{Label:e}=be(),o;return t[0]!==e?(o=e?Tg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Eg}from"react/compiler-runtime";import{jsx as Ng}from"react/jsx-runtime";import"react";var Sg=t=>{let e=Eg(3),{children:o}=t,{InlineBlockContainer:r}=be(),n;return e[0]!==r||e[1]!==o?(n=r?Ng(r,{children:o}):null,e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{c as Lg}from"react/compiler-runtime";import{jsx as yg}from"react/jsx-runtime";import"react";var Ig=t=>{let e=Lg(6),{children:o,editButton:r,Label:n,removeButton:l}=t,{BlockCollapsible:i}=$e(),s;return e[0]!==i||e[1]!==n||e[2]!==o||e[3]!==r||e[4]!==l?(s=i?yg(i,{editButton:r,Label:n,removeButton:l,children:o}):null,e[0]=i,e[1]=n,e[2]=o,e[3]=r,e[4]=l,e[5]=s):s=e[5],s};import{c as Rg}from"react/compiler-runtime";import{jsx as vg}from"react/jsx-runtime";import"react";var Mg=()=>{let t=Rg(2),{EditButton:e}=$e(),o;return t[0]!==e?(o=e?vg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Ag}from"react/compiler-runtime";import{jsx as Dg}from"react/jsx-runtime";import"react";var Og=()=>{let t=Ag(2),{RemoveButton:e}=$e(),o;return t[0]!==e?(o=e?Dg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as $g}from"qs-esm";var Fg=({apiURL:t,depth:e,draft:o,locale:r})=>async({id:l,collectionSlug:i,select:s})=>{let u=$g({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())};export{Ct as $createAutoLinkNode,Vt as $createBlockNode,To as $createInlineBlockNode,Te as $createLinkNode,Ue as $createRelationshipNode,We as $createUploadNode,Ee as $isAutoLinkNode,ft as $isBlockNode,wo as $isInlineBlockNode,Y as $isLinkNode,cr as $isRelationshipNode,Or as $isUploadNode,La as AlignFeatureClient,we as AutoLinkNode,Ig as BlockCollapsible,Mg as BlockEditButton,ke as BlockNode,Og as BlockRemoveButton,Ma as BlockquoteFeatureClient,Ic as BlocksFeatureClient,qc as BoldFeatureClient,ce as CAN_USE_DOM,qm as ChecklistFeatureClient,Up as DETAIL_TYPE_TO_DETAIL,Pp as DOUBLE_LINE_BREAK,ef as DebugJsxConverterFeatureClient,Wp as ELEMENT_FORMAT_TO_TYPE,Gp as ELEMENT_TYPE_TO_FORMAT,ka as ENABLE_SLASH_MENU_COMMAND,ga as EditorConfigProvider,st as FieldsDrawer,h0 as FixedToolbarFeatureClient,Vu as HeadingFeatureClient,ad as HorizontalRuleFeatureClient,Je as INSERT_BLOCK_COMMAND,Xe as INSERT_INLINE_BLOCK_COMMAND,$p as IS_ALL_FORMATTING,Ed as IndentFeatureClient,Sg as InlineBlockContainer,xg as InlineBlockEditButton,wg as InlineBlockLabel,_o as InlineBlockNode,kg as InlineBlockRemoveButton,ru as InlineCodeFeatureClient,S0 as InlineToolbarFeatureClient,su as ItalicFeatureClient,Hp as LTR_REGEX,kp as LexicalPluginToLexicalFeatureClient,Fm as LinkFeatureClient,ie as LinkNode,Fp as NON_BREAKING_SPACE,O as NodeFormat,ip as OrderedListFeatureClient,yp as ParagraphFeatureClient,Ca as Point,Bp as RTL_REGEX,_a as Rect,jf as RelationshipFeatureClient,Se as RelationshipNode,sg as RichTextField,Sp as SlateToLexicalFeatureClient,mu as StrikethroughFeatureClient,gu as SubscriptFeatureClient,ku as SuperscriptFeatureClient,Vp as TEXT_MODE_TO_TYPE,jp as TEXT_TYPE_TO_FORMAT,Kp as TEXT_TYPE_TO_MODE,ge as TOGGLE_LINK_COMMAND,bh as TableFeatureClient,Gc as TestRecorderFeatureClient,$u as TextStateFeatureClient,It as ToolbarButton,Ge as ToolbarDropdown,Xc as TreeViewFeatureClient,Nu as UnderlineFeatureClient,fp as UnorderedListFeatureClient,Yh as UploadFeatureClient,Re as UploadNode,fg as addSwipeDownListener,dg as addSwipeLeftListener,mg as addSwipeRightListener,pg as addSwipeUpListener,jo as createBlockNode,y as createClientFeature,tf as defaultColors,Co as defaultEditorLexicalConfig,xr as getDOMRangeRect,Ta as getEnabledNodes,Fg as getRestPopulateFn,ze as getSelectedNode,ag as isHTMLElement,ba as isPoint,cg as joinClasses,Pr as sanitizeClientEditorConfig,pa as sanitizeClientFeatures,so as setFloatingElemPosition,eo as setFloatingElemPositionForLinkEditor,ee as slashMenuBasicGroupWithItems,_e as toolbarAddDropdownGroupWithItems,Go as toolbarFeatureButtonsGroupWithItems,te as toolbarFormatGroupWithItems,le as toolbarTextDropdownGroupWithItems,$e as useBlockComponentContext,G as useEditorConfigContext,be as useInlineBlockComponentContext,xa as useLexicalDocumentDrawer,Ce as useLexicalDrawer,yt as useLexicalListDrawer};
|
|
41
41
|
//# sourceMappingURL=index.js.map
|