@payloadcms/richtext-lexical 3.55.0-canary.3 → 3.55.0-internal.b47bfce
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-Q3PTZQ75.js +2 -0
- package/dist/exports/client/{Field-YTBICBYV.js.map → Field-Q3PTZQ75.js.map} +2 -2
- package/dist/exports/client/bundled.css +1 -1
- package/dist/exports/client/chunk-CYLMY5ZJ.js +2 -0
- package/dist/exports/client/{chunk-FSKAVN4P.js.map → chunk-CYLMY5ZJ.js.map} +2 -2
- package/dist/exports/client/chunk-YCH4JNUH.js +12 -0
- package/dist/exports/client/{chunk-KZKGNMS3.js.map → chunk-YCH4JNUH.js.map} +2 -2
- package/dist/exports/client/{component-M3U253XK.js → component-3PENNOM3.js} +2 -2
- package/dist/exports/client/index.d.ts +2 -0
- package/dist/exports/client/index.d.ts.map +1 -1
- package/dist/exports/client/index.js +10 -10
- package/dist/exports/client/index.js.map +4 -4
- package/dist/features/blocks/client/component/BlockContent.js +8 -10
- package/dist/features/blocks/client/component/BlockContent.js.map +1 -1
- package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js +3 -5
- package/dist/features/experimental_table/client/plugins/TableCellResizerPlugin/index.js.map +1 -1
- package/dist/features/relationship/client/plugins/index.js +20 -37
- package/dist/features/relationship/client/plugins/index.js.map +1 -1
- package/dist/features/relationship/client/utils/EnabledRelationshipsCondition.js +28 -53
- package/dist/features/relationship/client/utils/EnabledRelationshipsCondition.js.map +1 -1
- package/dist/features/toolbars/shared/ToolbarButton/index.js +35 -37
- package/dist/features/toolbars/shared/ToolbarButton/index.js.map +1 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/index.js +20 -30
- package/dist/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -1
- package/dist/field/RenderLexical/index.d.ts +19 -0
- package/dist/field/RenderLexical/index.d.ts.map +1 -0
- package/dist/field/RenderLexical/index.js +123 -0
- package/dist/field/RenderLexical/index.js.map +1 -0
- package/dist/field/bundled.css +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/lexical/LexicalEditor.js +22 -35
- package/dist/lexical/LexicalEditor.js.map +1 -1
- package/dist/lexical/plugins/InsertParagraphAtEnd/index.js +7 -15
- package/dist/lexical/plugins/InsertParagraphAtEnd/index.js.map +1 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +7 -15
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js +75 -141
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js.map +1 -1
- package/dist/lexical/ui/ContentEditable.js +2 -11
- package/dist/lexical/ui/ContentEditable.js.map +1 -1
- package/dist/nodeTypes.d.ts +13 -1
- package/dist/nodeTypes.d.ts.map +1 -1
- package/dist/nodeTypes.js +4 -1
- package/dist/nodeTypes.js.map +1 -1
- package/dist/utilities/buildEditorState.d.ts +11 -0
- package/dist/utilities/buildEditorState.d.ts.map +1 -0
- package/dist/utilities/buildEditorState.js +76 -0
- package/dist/utilities/buildEditorState.js.map +1 -0
- package/package.json +9 -9
- package/dist/exports/client/Field-YTBICBYV.js +0 -2
- package/dist/exports/client/chunk-FSKAVN4P.js +0 -2
- package/dist/exports/client/chunk-KZKGNMS3.js +0 -12
- /package/dist/exports/client/{component-M3U253XK.js.map → component-3PENNOM3.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use client";import{a as Ce,c as
|
|
1
|
+
"use client";import{a as Ce,c as _o,d as To,e as wo}from"./chunk-3BY5IZJD.js";import{a as ct}from"./chunk-DBWINSQN.js";import{a as at,b as Ot,c as Ke}from"./chunk-CYLMY5ZJ.js";import{a as xe}from"./chunk-INBEEENE.js";import{a as ba}from"./chunk-F26IQ5RE.js";import{a as ce,b as Ft,d as Br,e as Hr,f as ka,g as _a,i as Ta,k as wa,l as Ea}from"./chunk-YCH4JNUH.js";import{a as Ca,b as j}from"./chunk-BZZVLW4U.js";function ee(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{$isElementNode as Re,$isRangeSelection as Pt,FORMAT_ELEMENT_COMMAND as Bt}from"lexical";import{jsx as Eo,jsxs as Sa}from"react/jsx-runtime";import"react";var jr=()=>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:[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 So,jsxs as Na}from"react/jsx-runtime";import"react";var Ur=()=>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 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as No,jsxs as La}from"react/jsx-runtime";import"react";var $t=()=>La("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 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Lo,jsxs as ya}from"react/jsx-runtime";import"react";var Gr=()=>ya("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 Wr=t=>({type:"dropdown",ChildComponent:$t,items:t,key:"align",order:30});var Vr=[Wr([{ChildComponent:$t,isActive:({selection:t})=>{if(!Pt(t))return!1;for(let e of t.getNodes()){if(Re(e)&&e.getFormatType()==="left")continue;let o=e.getParent();if(!(Re(o)&&o.getFormatType()==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Bt,"left")},order:1},{ChildComponent:jr,isActive:({selection:t})=>{if(!Pt(t))return!1;for(let e of t.getNodes()){if(Re(e)&&e.getFormatType()==="center")continue;let o=e.getParent();if(!(Re(o)&&o.getFormatType()==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Bt,"center")},order:2},{ChildComponent:Gr,isActive:({selection:t})=>{if(!Pt(t))return!1;for(let e of t.getNodes()){if(Re(e)&&e.getFormatType()==="right")continue;let o=e.getParent();if(!(Re(o)&&o.getFormatType()==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Bt,"right")},order:3},{ChildComponent:Ur,isActive:({selection:t})=>{if(!Pt(t))return!1;for(let e of t.getNodes()){if(Re(e)&&e.getFormatType()==="justify")continue;let o=e.getParent();if(!(Re(o)&&o.getFormatType()==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Bt,"justify")},order:4}])],Ia=y({toolbarFixed:{groups:Vr},toolbarInline:{groups:Vr}});import{$createQuoteNode as qr,$isQuoteNode as Zr,QuoteNode as Ma}from"@lexical/rich-text";import{$setBlocksType as Qr}from"@lexical/selection";import{$getSelection as en,$isRangeSelection as Da}from"lexical";import{jsx as Kr}from"react/jsx-runtime";import"react";var yo=()=>Kr("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:Kr("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 Jr}from"react/jsx-runtime";import"react";var ut=()=>Jr("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:Jr("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:ut,items:t,key:"text",order:25});import{$createQuoteNode as Ra,$isQuoteNode as Xr,QuoteNode as va}from"@lexical/rich-text";var zr={type:"element",dependencies:[va],export:(t,e)=>{if(!Xr(t))return null;let o=e(t).split(`
|
|
2
2
|
`),r=[];for(let n of o)r.push("> "+n);return r.join(`
|
|
3
|
-
`)},regExp:/^>\s/,replace:(t,e,o,r)=>{if(r){let l=t.getPreviousSibling();if(Jr(l)){l.splice(l.getChildrenSize(),0,[...e]),l.select(0,0),t.remove();return}}let n=La();n.append(...e),t.replace(n),n.select(0,0)}};var Zr=[le([{ChildComponent:Lo,isActive:({selection:t})=>{if(!Ra(t))return!1;for(let e of t.getNodes())if(!zr(e)&&!zr(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Qr();qr(e,()=>Yr())})},order:20}])],va=y({markdownTransformers:[Xr],nodes:[Ia],slashMenu:{groups:[ee([{Icon:Lo,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Qr();qr(e,()=>Yr())})}}])]},toolbarFixed:{groups:Zr},toolbarInline:{groups:Zr}});import{getTranslation as Kt}from"@payloadcms/translations";import{jsx as yo,jsxs as Ma}from"react/jsx-runtime";import"react";var Bt=()=>Ma("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:[yo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),yo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),yo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as en}from"react/jsx-runtime";import"react";var Ht=()=>en("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:en("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 cc}from"react/jsx-runtime";import uc from"bson-objectid";import"react";import{DecoratorBlockNode as Aa}from"@lexical/react/LexicalDecoratorBlockNode.js";import Oa from"bson-objectid";var ut=class extends Aa{__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=$a(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 $a(t){return new ut({fields:{...t,id:t?.id||new Oa.default().toHexString()}})}import{jsx as z,jsxs as dt,Fragment as Ga}from"react/jsx-runtime";import{Button as nn,Collapsible as Wa,Drawer as Va,EditDepthProvider as Ka,ErrorPill as Ja,Form as Xa,formatDrawerSlug as za,FormSubmit as Za,Pill as Ya,RenderFields as qa,SectionTitle as Qa,useConfig as ec,useDocumentForm as tc,useDocumentInfo as ln,useEditDepth as oc,useFormSubmitted as rc,useServerFunctions as nc,useTranslation as lc}from"@payloadcms/ui";import{abortAndIgnore as Io}from"@payloadcms/ui/shared";import{deepCopyObjectSimpleWithoutReactComponents as Gt,reduceFieldsToValues as sn}from"payload/shared";import mt,{useCallback as Ro,useEffect as vo,useMemo as pt,useRef as Mo}from"react";import{useLexicalComposerContext as ic}from"@lexical/react/LexicalComposerContext";import{getTranslation as sc}from"@payloadcms/translations";import{$getNodeByKey as Wt}from"lexical";import{v4 as ac}from"uuid";import{c as Fa}from"react/compiler-runtime";import{jsx as Ut,jsxs as Pa}from"react/jsx-runtime";import{RenderFields as Ba,useFormSubmitted as Ha}from"@payloadcms/ui";import ja,{createContext as Ua}from"react";var tn=Ua({initialState:!1}),Oe=()=>ja.use(tn),on=t=>{let e=Fa(13),{BlockDrawer:o,Collapsible:r,CustomBlock:n,EditButton:l,errorCount:i,formSchema:s,initialState:u,nodeKey:c,RemoveButton:d}=t,p=Ha()&&i>0,m,f;e[0]!==r||e[1]!==i||e[2]!==p?(f=b=>Ut(r,{editButton:b.editButton,errorCount:i,fieldHasErrors:p,Label:b.Label,removeButton:b.removeButton,children:b.children}),e[0]=r,e[1]=i,e[2]=p,e[3]=f):f=e[3],m=f;let h=m,g;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?(g=n?Pa(tn,{value:{BlockCollapsible:h,EditButton:l,initialState:u,nodeKey:c,RemoveButton:d},children:[n,Ut(o,{})]}):Ut(h,{children:Ut(Ba,{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]=g):g=e[12],g};function rn({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",an=t=>{let{cacheBuster:e,formData:o,nodeKey:r}=t,n=rc(),{id:l,collectionSlug:i,globalSlug:s}=ln(),{fieldProps:{featureClientSchemaMap:u,field:c,initialLexicalFormState:d,permissions:a,readOnly:p,schemaPath:m},uuid:f}=j(),{fields:h}=tc(),g=Mo(new AbortController),b=oc(),[T,M]=mt.useState(0),{config:k}=ec(),_=za({slug:`lexical-blocks-create-${f}-${o.id}`,depth:b}),{toggleDrawer:x}=xe(_),{getDocPreferences:S,setDocFieldPreferences:D}=ln(),[O]=ic(),{getFormState:F}=nc(),I=`${m}.lexical_internal_feature.blocks.lexical_blocks.${o.blockType}.fields`,[w,C]=mt.useState(()=>d?.[o.id]?.formState?{...d?.[o.id]?.formState,blockName:{initialValue:o.blockName,passesCondition:!0,valid:!0,value:o.blockName}}:!1),N=Mo(!1),R=Mo(e);vo(()=>{N.current?(R.current!==e&&C(!1),R.current=e):N.current=!0},[e]);let[L,v]=mt.useState(w?._components?.customComponents?.BlockLabel),[E,$]=mt.useState(w?._components?.customComponents?.Block);vo(()=>{let G=new AbortController;return o&&!w&&(async()=>{let{state:J}=await F({id:l,collectionSlug:i,data:o,docPermissions:{fields:!0},docPreferences:await S(),documentFormState:Gt(h),globalSlug:s,initialBlockData:o,operation:"update",renderAllFields:!0,schemaPath:I,signal:G.signal});if(J){J.blockName={initialValue:o.blockName,passesCondition:!0,valid:!0,value:o.blockName};let Q=sn(Gt(J),!0);O.update(()=>{let X=Wt(r);if(X&&ft(X)){let ae=Q;ae.blockType=o.blockType,X.setFields(ae,!0)}}),C(J),v(J._components?.customComponents?.BlockLabel),$(J._components?.customComponents?.Block)}})(),()=>{Io(G)}},[F,I,l,o,O,r,w,i,s,S,h]);let[H,W]=mt.useState(d?.[o.id]?.collapsed??!1),Y=`${m}.lexical_internal_feature.blocks.lexical_blocks.${o.blockType}`,V=u.blocks?.[Y]?.[0],U=V.blockReferences?typeof V?.blockReferences?.[0]=="string"?k.blocksMap[V?.blockReferences?.[0]]:V?.blockReferences?.[0]:V?.blocks?.[0],{i18n:oe,t:ue}=lc(),q=Ro(async({formState:G,submit:fe})=>{Io(g.current);let J=new AbortController;g.current=J;let{state:Q}=await F({id:l,collectionSlug:i,docPermissions:{fields:!0},docPreferences:await S(),documentFormState:Gt(h),formState:G,globalSlug:s,initialBlockFormState:G,operation:"update",renderAllFields:!!fe,schemaPath:I,signal:J.signal});if(!Q)return G;G.blockName&&(Q.blockName=G.blockName);let X=sn(rn({fields:Gt(Q)}),!0);if(setTimeout(()=>{O.update(()=>{let ae=Wt(r);if(ae&&ft(ae)){let Ve=X;Ve.blockType=o.blockType,ae.setFields(Ve,!0)}})},0),fe){v(Q._components?.customComponents?.BlockLabel),$(Q._components?.customComponents?.Block);let ae=0;for(let Ve of Object.values(Q))Ve?.valid===!1&&ae++;M(ae)}return Q},[F,l,i,S,s,I,o.blockType,h,O,r]);vo(()=>()=>{Io(g.current)},[]);let K=Ro(()=>{O.update(()=>{Wt(r)?.remove()})},[O,r]),re=U?.labels?.singular?sc(U.labels.singular,oe):U?.slug,ne=Ro(G=>{S().then(fe=>{let Q=fe?.fields?.[c.name]?.collapsed,X=Q&&Q?.length?Q:[];G?X.includes(o.id)||X.push(o.id):X.includes(o.id)&&X.splice(X.indexOf(o.id),1),D(c.name,{collapsed:X,hello:"hi"})})},[S,c.name,D,o.id]),se=pt(()=>()=>z(nn,{buttonStyle:"icon-label",className:`${de}__editButton`,disabled:p,el:"button",icon:"edit",onClick:G=>(G.preventDefault(),G.stopPropagation(),x(),!1),onMouseDown:G=>{G.preventDefault()},round:!0,size:"small",tooltip:ue("lexical:blocks:inlineBlocks:edit",{label:re})}),[re,p,ue,x]),Ae=pt(()=>()=>z(nn,{buttonStyle:"icon-label",className:`${de}__removeButton`,disabled:c?.admin?.readOnly||!1,icon:"x",onClick:G=>{G.preventDefault(),K()},round:!0,tooltip:"Remove Block"}),[c?.admin?.readOnly,K]),it=pt(()=>({children:G,disableBlockName:fe,editButton:J,errorCount:Q,fieldHasErrors:X,Label:ae,removeButton:Ve})=>z("div",{className:de+" "+de+"-"+o.blockType,children:z(Wa,{className:[`${de}__row`,X?`${de}__row--has-errors`:`${de}__row--no-errors`].join(" "),collapsibleStyle:X?"error":"default",header:dt("div",{className:`${de}__block-header`,children:[ae??L?ae??L:dt("div",{children:[z(Ya,{className:`${de}__block-pill ${de}__block-pill-${o?.blockType}`,pillStyle:"white",size:"small",children:re??o?.blockType}),!fe&&!U?.admin?.disableBlockName&&z(Qa,{path:"blockName",readOnly:c?.admin?.readOnly||!1}),X&&z(Ja,{count:Q??0,i18n:oe,withMessage:!0})]}),dt("div",{children:[E&&J!==!1||!E&&J?z(se,{}):null,Ve!==!1&&O.isEditable()?z(Ae,{}):null]})]}),isCollapsed:H,onToggle:Fr=>{ne(Fr),W(Fr)},children:G},0)}),[E,L,se,Ae,re,U?.admin?.disableBlockName,O,o.blockType,oe,H,ne,c?.admin?.readOnly]),$r=pt(()=>()=>z(Ka,{children:z(Va,{className:"",slug:_,title:ue(`lexical:blocks:inlineBlocks:${o?.id?"edit":"create"}`,{label:re??ue("lexical:blocks:inlineBlocks:label")}),children:w?dt(Ga,{children:[z(qa,{fields:U?.fields??[],forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:I,permissions:!0,readOnly:!1}),z(Za,{programmaticSubmit:!0,children:ue("fields:saveChanges")})]}):null})}),[w,_,re,ue,U?.fields,I,a]),fa=pt(()=>w?z(Xa,{beforeSubmit:[async({formState:G})=>await q({formState:G,submit:!0})],el:"div",fields:U?.fields??[],initialState:w,onChange:[q],onSubmit:(G,fe)=>{fe.blockType=o.blockType,O.update(()=>{let J=Wt(r);J&&ft(J)&&J.setFields(fe,!0)}),x()},submitted:n,uuid:ac(),children:z(on,{baseClass:de,BlockDrawer:$r,Collapsible:it,CustomBlock:E,EditButton:se,errorCount:T,formSchema:U?.fields??[],initialState:w,nodeKey:r,RemoveButton:Ae})}):null,[it,$r,E,U?.fields,Ae,se,O,T,x,U?.fields,w,r,q,n]);return U?fa: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 be=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 cc(an,{cacheBuster:this.getCacheBuster(),formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Vt(t){return new be({fields:{...t,id:t?.id||new uc.default().toHexString()}})}function ft(t){return t instanceof be}import{createCommand as cn}from"lexical";var Je=cn("INSERT_BLOCK_COMMAND"),Xe=cn("INSERT_INLINE_BLOCK_COMMAND");import{c as dc}from"react/compiler-runtime";import{useLexicalComposerContext as mc}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as pc,$wrapNodeInElement as fc,mergeRegister as hc}from"@lexical/utils";import{formatDrawerSlug as gc,useEditDepth as xc}from"@payloadcms/ui";import{$createParagraphNode as Cc,$getNodeByKey as bc,$getPreviousSelection as kc,$getSelection as _c,$insertNodes as Tc,$isParagraphNode as wc,$isRangeSelection as Ec,$isRootOrShadowRoot as Nc,COMMAND_PRIORITY_EDITOR as un}from"lexical";import{useEffect as Sc,useState as Lc}from"react";var dn=()=>{let t=dc(12),[e]=mc(),[o,r]=Lc(null),{setCreatedInlineBlock:n,uuid:l}=j(),i=xc(),s="lexical-inlineBlocks-create-"+l,u;t[0]!==i||t[1]!==s?(u=gc({slug:s,depth:i}),t[0]=i,t[1]=s,t[2]=u):u=t[2];let c=u,{toggleDrawer:d}=xe(c,!0),a;t[3]!==e||t[4]!==n||t[5]!==o?(a=()=>{if(!e.hasNodes([be]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return hc(e.registerCommand(Je,m=>(e.update(()=>{let f=_c()||kc();if(Ec(f)){let h=Vt(m),{focus:g}=f,b=g.getNode();pc(h),wc(b)&&!b.__first&&b.remove()}}),!0),un),e.registerCommand(Xe,m=>{if(o){let h=bc(o);return!h||!To(h)?!1:(h.setFields(m),r(null),!0)}let f=_o(m);return n?.(f),Tc([f]),Nc(f.getParentOrThrow())&&fc(f,Cc).selectEnd(),!0},un))},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],Sc(a,p),null};var yc=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:[be,ko],plugins:[{Component:dn,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 vc}from"react/compiler-runtime";import{jsx as Fe,jsxs as $o}from"react/jsx-runtime";import{useLexicalComposerContext as Mc}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as Dc,$createTextNode as Ac,$getRoot as Oc,getDOMSelection as Do}from"lexical";import*as gn from"react";import{useCallback as $e,useEffect as Ao,useLayoutEffect as pn,useRef as Oo,useState as Jt}from"react";var Ic=ce&&"documentMode"in document?document.documentMode:null,mn=ce&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),t2=ce&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),o2=ce&&"InputEvent"in window&&!Ic?"getTargetRanges"in new window.InputEvent("input"):!1,r2=ce&&/Version\/[\d.].*Safari/.test(navigator.userAgent),n2=ce&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,l2=ce&&/Android/.test(navigator.userAgent),i2=ce&&/Win/.test(navigator.platform),Rc=ce&&/^(?=.*Chrome).*/i.test(navigator.userAgent),s2=ce&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!Rc;var $c=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)},Fc=(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)},Pc=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);
|
|
3
|
+
`)},regExp:/^>\s/,replace:(t,e,o,r)=>{if(r){let l=t.getPreviousSibling();if(Xr(l)){l.splice(l.getChildrenSize(),0,[...e]),l.select(0,0),t.remove();return}}let n=Ra();n.append(...e),t.replace(n),n.select(0,0)}};var Yr=[le([{ChildComponent:yo,isActive:({selection:t})=>{if(!Da(t))return!1;for(let e of t.getNodes())if(!Zr(e)&&!Zr(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=en();Qr(e,()=>qr())})},order:20}])],Aa=y({markdownTransformers:[zr],nodes:[Ma],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=en();Qr(e,()=>qr())})}}])]},toolbarFixed:{groups:Yr},toolbarInline:{groups:Yr}});import{getTranslation as Jt}from"@payloadcms/translations";import{jsx as Io,jsxs as Oa}from"react/jsx-runtime";import"react";var Ht=()=>Oa("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 tn}from"react/jsx-runtime";import"react";var jt=()=>tn("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:tn("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 Fa}from"react/jsx-runtime";import"react";function Ut(t,e){return t?()=>Fa("img",{alt:e??"Block Image",className:"lexical-block-custom-image",src:t,style:{maxHeight:20,maxWidth:20}}):Ht}import{jsx as mc}from"react/jsx-runtime";import pc from"bson-objectid";import"react";import{DecoratorBlockNode as $a}from"@lexical/react/LexicalDecoratorBlockNode.js";import Pa from"bson-objectid";var dt=class extends $a{__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=Ba(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 Ba(t){return new dt({fields:{...t,id:t?.id||new Pa.default().toHexString()}})}import{jsx as z,jsxs as mt,Fragment as Ka}from"react/jsx-runtime";import{Button as ln,Collapsible as Ja,Drawer as Xa,EditDepthProvider as za,ErrorPill as Za,Form as Ya,formatDrawerSlug as qa,FormSubmit as Qa,Pill as ec,RenderFields as tc,SectionTitle as oc,useConfig as rc,useDocumentForm as nc,useDocumentInfo as sn,useEditDepth as lc,useFormSubmitted as ic,useServerFunctions as sc,useTranslation as ac}from"@payloadcms/ui";import{abortAndIgnore as Ro}from"@payloadcms/ui/shared";import{deepCopyObjectSimpleWithoutReactComponents as Wt,reduceFieldsToValues as an}from"payload/shared";import pt,{useCallback as vo,useEffect as Mo,useMemo as ft,useRef as Do}from"react";import{useLexicalComposerContext as cc}from"@lexical/react/LexicalComposerContext";import{getTranslation as uc}from"@payloadcms/translations";import{$getNodeByKey as Vt}from"lexical";import{v4 as dc}from"uuid";import{c as Ha}from"react/compiler-runtime";import{jsx as Gt,jsxs as ja}from"react/jsx-runtime";import{RenderFields as Ua,useFormSubmitted as Ga}from"@payloadcms/ui";import Wa,{createContext as Va}from"react";var on=Va({initialState:!1}),Oe=()=>Wa.use(on),rn=t=>{let e=Ha(13),{BlockDrawer:o,Collapsible:r,CustomBlock:n,EditButton:l,errorCount:i,formSchema:s,initialState:u,nodeKey:c,RemoveButton:d}=t,p=Ga()&&i>0,m;e[0]!==r||e[1]!==i||e[2]!==p?(m=g=>Gt(r,{editButton:g.editButton,errorCount:i,fieldHasErrors:p,Label:g.Label,removeButton:g.removeButton,children:g.children}),e[0]=r,e[1]=i,e[2]=p,e[3]=m):m=e[3];let f=m,h;return e[4]!==o||e[5]!==f||e[6]!==n||e[7]!==l||e[8]!==d||e[9]!==s||e[10]!==u||e[11]!==c?(h=n?ja(on,{value:{BlockCollapsible:f,EditButton:l,initialState:u,nodeKey:c,RemoveButton:d},children:[n,Gt(o,{})]}):Gt(f,{children:Gt(Ua,{fields:s,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0})}),e[4]=o,e[5]=f,e[6]=n,e[7]=l,e[8]=d,e[9]=s,e[10]=u,e[11]=c,e[12]=h):h=e[12],h};function nn({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",cn=t=>{let{cacheBuster:e,formData:o,nodeKey:r}=t,n=ic(),{id:l,collectionSlug:i,globalSlug:s}=sn(),{fieldProps:{featureClientSchemaMap:u,field:c,initialLexicalFormState:d,permissions:a,readOnly:p,schemaPath:m},uuid:f}=j(),{fields:h}=nc(),g=Do(new AbortController),k=lc(),[T,I]=pt.useState(0),{config:b}=rc(),_=qa({slug:`lexical-blocks-create-${f}-${o.id}`,depth:k}),{toggleDrawer:x}=xe(_),{getDocPreferences:E,setDocFieldPreferences:R}=sn(),[O]=cc(),{getFormState:$}=sc(),v=`${m}.lexical_internal_feature.blocks.lexical_blocks.${o.blockType}.fields`,[S,C]=pt.useState(()=>d?.[o.id]?.formState?{...d?.[o.id]?.formState,blockName:{initialValue:o.blockName,passesCondition:!0,valid:!0,value:o.blockName}}:!1),N=Do(!1),M=Do(e);Mo(()=>{N.current?(M.current!==e&&C(!1),M.current=e):N.current=!0},[e]);let[L,D]=pt.useState(S?._components?.customComponents?.BlockLabel),[w,F]=pt.useState(S?._components?.customComponents?.Block);Mo(()=>{let G=new AbortController;return o&&!S&&(async()=>{let{state:J}=await $({id:l,collectionSlug:i,data:o,docPermissions:{fields:!0},docPreferences:await E(),documentFormState:Wt(h),globalSlug:s,initialBlockData:o,operation:"update",renderAllFields:!0,schemaPath:v,signal:G.signal});if(J){J.blockName={initialValue:o.blockName,passesCondition:!0,valid:!0,value:o.blockName};let Q=an(Wt(J),!0);O.update(()=>{let X=Vt(r);if(X&&ht(X)){let ae=Q;ae.blockType=o.blockType,X.setFields(ae,!0)}}),C(J),D(J._components?.customComponents?.BlockLabel),F(J._components?.customComponents?.Block)}})(),()=>{Ro(G)}},[$,v,l,o,O,r,S,i,s,E,h]);let[H,W]=pt.useState(d?.[o.id]?.collapsed??!1),Y=`${m}.lexical_internal_feature.blocks.lexical_blocks.${o.blockType}`,V=u.blocks?.[Y]?.[0],U=V.blockReferences?typeof V?.blockReferences?.[0]=="string"?b.blocksMap[V?.blockReferences?.[0]]:V?.blockReferences?.[0]:V?.blocks?.[0],{i18n:oe,t:ue}=ac(),q=vo(async({formState:G,submit:fe})=>{Ro(g.current);let J=new AbortController;g.current=J;let{state:Q}=await $({id:l,collectionSlug:i,docPermissions:{fields:!0},docPreferences:await E(),documentFormState:Wt(h),formState:G,globalSlug:s,initialBlockFormState:G,operation:"update",renderAllFields:!!fe,schemaPath:v,signal:J.signal});if(!Q)return G;G.blockName&&(Q.blockName=G.blockName);let X=an(nn({fields:Wt(Q)}),!0);if(setTimeout(()=>{O.update(()=>{let ae=Vt(r);if(ae&&ht(ae)){let Ve=X;Ve.blockType=o.blockType,ae.setFields(Ve,!0)}})},0),fe){D(Q._components?.customComponents?.BlockLabel),F(Q._components?.customComponents?.Block);let ae=0;for(let Ve of Object.values(Q))Ve?.valid===!1&&ae++;I(ae)}return Q},[$,l,i,E,s,v,o.blockType,h,O,r]);Mo(()=>()=>{Ro(g.current)},[]);let K=vo(()=>{O.update(()=>{Vt(r)?.remove()})},[O,r]),re=U?.labels?.singular?uc(U.labels.singular,oe):U?.slug,ne=vo(G=>{E().then(fe=>{let Q=fe?.fields?.[c.name]?.collapsed,X=Q&&Q?.length?Q:[];G?X.includes(o.id)||X.push(o.id):X.includes(o.id)&&X.splice(X.indexOf(o.id),1),R(c.name,{collapsed:X,hello:"hi"})})},[E,c.name,R,o.id]),se=ft(()=>()=>z(ln,{buttonStyle:"icon-label",className:`${de}__editButton`,disabled:p,el:"button",icon:"edit",onClick:G=>(G.preventDefault(),G.stopPropagation(),x(),!1),onMouseDown:G=>{G.preventDefault()},round:!0,size:"small",tooltip:ue("lexical:blocks:inlineBlocks:edit",{label:re})}),[re,p,ue,x]),Ae=ft(()=>()=>z(ln,{buttonStyle:"icon-label",className:`${de}__removeButton`,disabled:c?.admin?.readOnly||!1,icon:"x",onClick:G=>{G.preventDefault(),K()},round:!0,tooltip:"Remove Block"}),[c?.admin?.readOnly,K]),st=ft(()=>({children:G,disableBlockName:fe,editButton:J,errorCount:Q,fieldHasErrors:X,Label:ae,removeButton:Ve})=>z("div",{className:de+" "+de+"-"+o.blockType,children:z(Ja,{className:[`${de}__row`,X?`${de}__row--has-errors`:`${de}__row--no-errors`].join(" "),collapsibleStyle:X?"error":"default",header:mt("div",{className:`${de}__block-header`,children:[ae??L?ae??L:mt("div",{children:[z(ec,{className:`${de}__block-pill ${de}__block-pill-${o?.blockType}`,pillStyle:"white",size:"small",children:re??o?.blockType}),!fe&&!U?.admin?.disableBlockName&&z(oc,{path:"blockName",readOnly:c?.admin?.readOnly||!1}),X&&z(Za,{count:Q??0,i18n:oe,withMessage:!0})]}),mt("div",{children:[w&&J!==!1||!w&&J?z(se,{}):null,Ve!==!1&&O.isEditable()?z(Ae,{}):null]})]}),isCollapsed:H,onToggle:Pr=>{ne(Pr),W(Pr)},children:G},0)}),[w,L,se,Ae,re,U?.admin?.disableBlockName,O,o.blockType,oe,H,ne,c?.admin?.readOnly]),$r=ft(()=>()=>z(za,{children:z(Xa,{className:"",slug:_,title:ue(`lexical:blocks:inlineBlocks:${o?.id?"edit":"create"}`,{label:re??ue("lexical:blocks:inlineBlocks:label")}),children:S?mt(Ka,{children:[z(tc,{fields:U?.fields??[],forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:v,permissions:!0,readOnly:!1}),z(Qa,{programmaticSubmit:!0,children:ue("fields:saveChanges")})]}):null})}),[S,_,re,ue,U?.fields,v,a]),xa=ft(()=>S?z(Ya,{beforeSubmit:[async({formState:G})=>await q({formState:G,submit:!0})],el:"div",fields:U?.fields??[],initialState:S,onChange:[q],onSubmit:(G,fe)=>{fe.blockType=o.blockType,O.update(()=>{let J=Vt(r);J&&ht(J)&&J.setFields(fe,!0)}),x()},submitted:n,uuid:dc(),children:z(rn,{baseClass:de,BlockDrawer:$r,Collapsible:st,CustomBlock:w,EditButton:se,errorCount:T,formSchema:U?.fields??[],initialState:S,nodeKey:r,RemoveButton:Ae})}):null,[st,$r,w,U?.fields,Ae,se,O,T,x,U?.fields,S,r,q,n]);return U?xa:z(st,{disableBlockName:!0,fieldHasErrors:!0,children:mt("div",{className:"lexical-block-not-found",children:["Error: Block '",o.blockType,"' not found in the config but exists in the lexical data"]})})};var be=class extends dt{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=Kt(e.fields);return o.setFormat(e.format),o}decorate(e,o){return mc(cn,{cacheBuster:this.getCacheBuster(),formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Kt(t){return new be({fields:{...t,id:t?.id||new pc.default().toHexString()}})}function ht(t){return t instanceof be}import{createCommand as un}from"lexical";var Je=un("INSERT_BLOCK_COMMAND"),Xe=un("INSERT_INLINE_BLOCK_COMMAND");import{c as fc}from"react/compiler-runtime";import{useLexicalComposerContext as hc}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as gc,$wrapNodeInElement as xc,mergeRegister as Cc}from"@lexical/utils";import{formatDrawerSlug as bc,useEditDepth as kc}from"@payloadcms/ui";import{$createParagraphNode as _c,$getNodeByKey as Tc,$getPreviousSelection as wc,$getSelection as Ec,$insertNodes as Sc,$isParagraphNode as Nc,$isRangeSelection as Lc,$isRootOrShadowRoot as yc,COMMAND_PRIORITY_EDITOR as dn}from"lexical";import{useEffect as Ic,useState as Rc}from"react";var mn=()=>{let t=fc(12),[e]=hc(),[o,r]=Rc(null),{setCreatedInlineBlock:n,uuid:l}=j(),i=kc(),s="lexical-inlineBlocks-create-"+l,u;t[0]!==i||t[1]!==s?(u=bc({slug:s,depth:i}),t[0]=i,t[1]=s,t[2]=u):u=t[2];let c=u,{toggleDrawer:d}=xe(c,!0),a;t[3]!==e||t[4]!==n||t[5]!==o?(a=()=>{if(!e.hasNodes([be]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return Cc(e.registerCommand(Je,m=>(e.update(()=>{let f=Ec()||wc();if(Lc(f)){let h=Kt(m),{focus:g}=f,k=g.getNode();gc(h),Nc(k)&&!k.__first&&k.remove()}}),!0),dn),e.registerCommand(Xe,m=>{if(o){let h=Tc(o);return!h||!wo(h)?!1:(h.setFields(m),r(null),!0)}let f=To(m);return n?.(f),Sc([f]),yc(f.getParentOrThrow())&&xc(f,_c).selectEnd(),!0},dn))},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],Ic(a,p),null};var vc=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:[be,_o],plugins:[{Component:mn,position:"normal"}],sanitizedClientFeatureProps:o,slashMenu:{groups:[c?.length?{items:c.map(a=>({Icon:Ut(a.imageURL,a.imageAltText),key:"block-"+a.slug,keywords:["block","blocks",a.slug],label:({i18n:p})=>a?.labels?.singular?Jt(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:jt,key:"inlineBlocks-"+a.slug,keywords:["inlineBlock","inline block",a.slug],label:({i18n:p})=>a?.labels?.singular?Jt(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:Ht,items:c.map((a,p)=>({ChildComponent:Ut(a.imageURL,a.imageAltText),isActive:void 0,key:"block-"+a.slug,label:({i18n:m})=>a?.labels?.singular?Jt(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:jt,items:d.map((a,p)=>({ChildComponent:a.imageURL?Ut(a.imageURL,a.imageAltText):jt,isActive:void 0,key:"inlineBlock-"+a.slug,label:({i18n:m})=>a?.labels?.singular?Jt(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 Ac}from"react/compiler-runtime";import{jsx as $e,jsxs as $o}from"react/jsx-runtime";import{useLexicalComposerContext as Oc}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as Fc,$createTextNode as $c,$getRoot as Pc,getDOMSelection as Ao}from"lexical";import*as xn from"react";import{useCallback as Fe,useEffect as Oo,useLayoutEffect as fn,useRef as Fo,useState as Xt}from"react";var Mc=ce&&"documentMode"in document?document.documentMode:null,pn=ce&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),f2=ce&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),h2=ce&&"InputEvent"in window&&!Mc?"getTargetRanges"in new window.InputEvent("input"):!1,g2=ce&&/Version\/[\d.].*Safari/.test(navigator.userAgent),x2=ce&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,C2=ce&&/Android/.test(navigator.userAgent),b2=ce&&/Win/.test(navigator.platform),Dc=ce&&/^(?=.*Chrome).*/i.test(navigator.userAgent),k2=ce&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!Dc;var Bc=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)},Hc=(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)},jc=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, {
|
|
5
5
|
anchorPath: [${n.anchorPath.toString()}],
|
|
6
6
|
anchorOffset: ${n.anchorOffset},
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
`;case"type":return` await page.keyboard.type('${n}');`;default:return""}})(t.name,t.value);switch(t.count){case 1:return o;case 2:return[o,o].join(`
|
|
11
11
|
`);default:return` await repeat(${t.count}, async () => {
|
|
12
12
|
${o}
|
|
13
|
-
);`}};function
|
|
13
|
+
);`}};function Uc(t){return t.key.toLowerCase()==="a"&&(pn?t.metaKey:t.ctrlKey)}function Gc(t){let{anchorNode:e,focusNode:o}=t,{anchorOffset:r,focusOffset:n}=t;return r!==0&&r--,n!==0&&n--,{anchorNode:e,anchorOffset:r,focusNode:o,focusOffset:n}}function hn(t,e){let o=t,r=[];for(;o!==e;)o!=null&&r.unshift(Array.from(o?.parentNode?.childNodes??[]).indexOf(o)),o=o?.parentNode;return r}var gn=new Set(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Backspace","Delete","Enter","Escape"]);function Wc(t){let[e,o]=Xt([]),[r,n]=Xt(!1),[,l]=Xt(""),[i,s]=Xt(""),u=Fo(null),c=Fo(!1),d=Fo(null),a=Fe(()=>t,[t]),p=Fe(()=>{let b=t.getRootElement(),_=Ao(t._window);return b==null||_==null||_.anchorNode==null||_.focusNode==null||!b.contains(_.anchorNode)||!b.contains(_.focusNode)?null:`
|
|
14
14
|
import {
|
|
15
15
|
initializeE2E,
|
|
16
16
|
assertHTMLSnapshot,
|
|
@@ -27,15 +27,15 @@ describe('Test case', () => {
|
|
|
27
27
|
const {page} = e2e;
|
|
28
28
|
|
|
29
29
|
await page.focus('div[contenteditable="true"]');
|
|
30
|
-
${e.map(
|
|
30
|
+
${e.map(jc).join(`
|
|
31
31
|
`)}
|
|
32
32
|
});
|
|
33
33
|
});
|
|
34
|
-
`},[t,e]),m=$e((k,_)=>{o(x=>{let S=e.length-1,D=e[S];if(D&&D.name===k){if(k==="type")return[...e.slice(0,S),{...D,value:D.value+_}];if(D.value===_)return[...e.slice(0,S),{...D,count:D.count+1}]}return[...x,{name:k,count:1,value:_}]})},[e,o]);pn(()=>{let k=x=>{if(!r)return;let S=x.key;Bc(x)?m("selectAll",""):hn.has(S)?m("press",x.key):[...S].length>1?m("keydown",x.key):m("type",x.key)},_=x=>{if(!r)return;let S=x.key;!hn.has(S)&&[...S].length>1&&m("keyup",x.key)};return t.registerRootListener((x,S)=>{S!==null&&(S.removeEventListener("keydown",k),S.removeEventListener("keyup",_)),x!==null&&(x.addEventListener("keydown",k),x.addEventListener("keyup",_))})},[t,r,m]),pn(()=>{d.current&&d.current.scrollTo(0,d.current.scrollHeight)},[p]),Ao(()=>{if(e){let k=p();k!==null&&s(k),d.current&&d.current.scrollTo(0,d.current.scrollHeight)}},[p,e]),Ao(()=>t.registerUpdateListener(({dirtyElements:_,dirtyLeaves:x,editorState:S})=>{if(!r)return;let D=S._selection,O=u.current,F=c.current;if(O!==D){if(x.size===0&&_.size===0&&!F){let w=Do(t._window);if(w&&(w.anchorNode==null||w.focusNode==null))return}u.current=D}c.current=!1;let I=p();I!==null&&s(I)}),[t,p,r,m]),Ao(()=>r?t.registerUpdateListener(()=>{let _=t.getRootElement();_!==null&&l(_?.innerHTML)}):void 0,[t,r]);let f=$e(k=>{r||(k.update(()=>{let _=Oc();_.clear();let x=Ac();_.append(Dc().append(x)),x.select()}),o([])),n(_=>!_)},[r]),h=$e(()=>{if(!r)return;let k=Do(t._window);if(k===null||k.anchorNode==null||k.focusNode==null)return;let{anchorNode:_,anchorOffset:x,focusNode:S,focusOffset:D}=Hc(k),O=a().getRootElement(),F;_!==null&&(F=fn(_,O));let I;S!==null&&(I=fn(S,O)),m("snapshot",{anchorNode:_,anchorOffset:x,anchorPath:F,focusNode:S,focusOffset:D,focusPath:I})},[m,r,a]),g=$e(()=>{$c(p())},[p]),b=$e(()=>{Fc("test.js",p())},[p]);return[Fe("button",{className:`editor-dev-button ${r?"active":""}`,id:"test-recorder-button",onClick:k=>{f(a()),k.preventDefault()},title:r?"Disable test recorder":"Enable test recorder",type:"button",children:r?"Disable test recorder":"Enable test recorder"}),r?$o("div",{className:"test-recorder-output",children:[$o("div",{className:"test-recorder-toolbar",children:[Fe("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:k=>{h(),k.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),Fe("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:k=>{g(),k.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),Fe("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:k=>{b(),k.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),Fe("pre",{id:"test-recorder",ref:d,children:i})]}):null]}var xn=()=>{let t=vc(3),[e]=Mc(),[o,r]=jc(e),n;return t[0]!==o||t[1]!==r?(n=$o(gn.Fragment,{children:[Fe("p",{children:"HI"}),o,r,Fe("p",{children:"DONE"})]}),t[0]=o,t[1]=r,t[2]=n):n=t[2],n};var Uc=y({plugins:[{Component:xn,position:"bottom"}]});import{c as Gc}from"react/compiler-runtime";import{jsx as Wc}from"react/jsx-runtime";import{useLexicalComposerContext as Vc}from"@lexical/react/LexicalComposerContext.js";import{TreeView as Kc}from"@lexical/react/LexicalTreeView.js";import"react";var Cn=()=>{let t=Gc(2),[e]=Vc(),o;return t[0]!==e?(o=Wc(Kc,{editor:e,timeTravelButtonClassName:"debug-timetravel-button",timeTravelPanelButtonClassName:"debug-timetravel-panel-button",timeTravelPanelClassName:"debug-timetravel-panel",timeTravelPanelSliderClassName:"debug-timetravel-panel-slider",treeTypeButtonClassName:"debug-treetype-button",viewClassName:"tree-view-output"}),t[0]=e,t[1]=o):o=t[1],o};var Jc=y({plugins:[{Component:Cn,position:"bottom"}]});import{$isTableSelection as Xc}from"@lexical/table";import{$isRangeSelection as zc,FORMAT_TEXT_COMMAND as Zc}from"lexical";import{jsx as bn}from"react/jsx-runtime";import"react";var kn=()=>bn("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:bn("path",{d:"M10.6772 15H6.27017V5.718H10.4172C12.6792 5.718 13.8492 6.602 13.8492 8.292C13.8492 9.098 13.1992 9.982 12.4712 10.216C13.3812 10.476 14.1742 11.256 14.1742 12.322C14.1742 14.09 12.9002 15 10.6772 15ZM8.46717 9.501H10.3262C11.3012 9.501 11.7042 9.046 11.7042 8.409C11.7042 7.72 11.2362 7.317 10.3392 7.317H8.46717V9.501ZM8.46717 11.061V13.401H10.4822C11.4702 13.401 11.9642 12.959 11.9642 12.218C11.9642 11.49 11.4702 11.061 10.4822 11.061H8.46717Z",fill:"currentColor"})});var te=t=>({type:"buttons",items:t,key:"format",order:40});var _n={type:"text-format",format:["bold","italic"],tag:"***"},Tn={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},wn={type:"text-format",format:["bold"],tag:"**"},En={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var Nn=[te([{ChildComponent:kn,isActive:({selection:t})=>zc(t)||Xc(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(Zc,"bold")},order:1}])],Yc=y(({featureProviderMap:t})=>{let e=[wn,En];return t.get("italic")&&e.push(Tn,_n),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:Nn},toolbarInline:{groups:Nn}}});import{$isTableSelection as Qc}from"@lexical/table";import{$isRangeSelection as eu,FORMAT_TEXT_COMMAND as tu}from"lexical";import{jsx as Sn,jsxs as qc}from"react/jsx-runtime";import"react";var Ln=()=>qc("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:[Sn("path",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),Sn("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var yn={type:"text-format",format:["code"],tag:"`"};var In=[te([{ChildComponent:Ln,isActive:({selection:t})=>eu(t)||Qc(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(tu,"code")},order:7}])],ou=y({enableFormats:["code"],markdownTransformers:[yn],toolbarFixed:{groups:In},toolbarInline:{groups:In}});import{$isTableSelection as ru}from"@lexical/table";import{$isRangeSelection as nu,FORMAT_TEXT_COMMAND as lu}from"lexical";import{jsx as Rn}from"react/jsx-runtime";import"react";var vn=()=>Rn("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:Rn("path",{d:"M11.311 14.2969L11.0327 15H6.18408L6.4624 14.2969C7.54639 14.2969 7.70752 14.209 7.83936 13.8721L10.8423 6.45996C10.8716 6.38672 10.8862 6.32812 10.8862 6.26953C10.8862 6.09375 10.6519 6.03516 9.80225 6.03516L10.0952 5.33203H14.9438L14.6509 6.03516C13.5669 6.03516 13.4204 6.12305 13.2886 6.45996L10.2856 13.8721C10.2563 13.9453 10.2271 14.0039 10.2271 14.0625C10.2271 14.2383 10.4614 14.2969 11.311 14.2969Z",fill:"currentColor"})});var Mn={type:"text-format",format:["italic"],tag:"*"},Dn={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var An=[te([{ChildComponent:vn,isActive:({selection:t})=>nu(t)||ru(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(lu,"italic")},order:2}])],iu=y({enableFormats:["italic"],markdownTransformers:[Mn,Dn],toolbarFixed:{groups:An},toolbarInline:{groups:An}});import{$isTableSelection as au}from"@lexical/table";import{$isRangeSelection as cu,FORMAT_TEXT_COMMAND as uu}from"lexical";import{jsx as On,jsxs as su}from"react/jsx-runtime";import"react";var $n=()=>su("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:[On("path",{d:"M5.50756 12.76H7.42756C7.56256 14.215 8.82256 14.71 10.1576 14.71C11.4326 14.71 12.4226 14.14 12.4226 13.06C12.4226 12.28 11.9576 11.845 10.6676 11.605L8.70256 11.245C7.12756 10.96 5.85256 10.21 5.85256 8.335C5.85256 6.43 7.53256 5.11 9.87256 5.11C12.4226 5.11 13.9526 6.22 14.1626 8.23H12.2876C12.1526 7.18 11.2226 6.595 9.88756 6.595C8.59756 6.595 7.78756 7.27 7.78756 8.215C7.78756 9.1 8.34256 9.385 9.49756 9.61L11.5676 10.015C13.3226 10.345 14.3726 11.215 14.3726 12.94C14.3726 14.89 12.5876 16.18 10.2176 16.18C7.66756 16.18 5.70256 15.115 5.50756 12.76Z",fill:"currentColor"}),On("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var Fn={type:"text-format",format:["strikethrough"],tag:"~~"};var Pn=[te([{ChildComponent:$n,isActive:({selection:t})=>cu(t)||au(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(uu,"strikethrough")},order:4}])],du=y({enableFormats:["strikethrough"],markdownTransformers:[Fn],toolbarFixed:{groups:Pn},toolbarInline:{groups:Pn}});import{$isTableSelection as mu}from"@lexical/table";import{$isRangeSelection as pu,FORMAT_TEXT_COMMAND as fu}from"lexical";import{jsx as Bn}from"react/jsx-runtime";import"react";var Hn=()=>Bn("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:Bn("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 13.258C16.7768 14.155 16.1398 14.532 15.2038 15C14.5538 15.325 14.2808 15.546 14.2418 15.78H16.7898V16.82H12.7208V16.339C12.7208 15.286 13.5918 14.675 14.3588 14.233C15.0868 13.83 15.4378 13.635 15.4378 13.232C15.4378 12.894 15.2038 12.686 14.8268 12.686C14.3848 12.686 14.1248 13.024 14.1118 13.427H12.7468C12.8248 12.426 13.5528 11.633 14.8398 11.633C15.9448 11.633 16.7768 12.257 16.7768 13.258Z",fill:"currentColor"})});var jn=[te([{ChildComponent:Hn,isActive:({selection:t})=>pu(t)||mu(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(fu,"subscript")},order:5}])],hu=y({enableFormats:["subscript"],toolbarFixed:{groups:jn},toolbarInline:{groups:jn}});import{$isTableSelection as gu}from"@lexical/table";import{$isRangeSelection as xu,FORMAT_TEXT_COMMAND as Cu}from"lexical";import{jsx as Un}from"react/jsx-runtime";import"react";var Gn=()=>Un("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:Un("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 7.252C16.7768 8.149 16.1398 8.526 15.2038 8.994C14.5538 9.319 14.2808 9.54 14.2418 9.774H16.7898V10.814H12.7208V10.333C12.7208 9.28 13.5918 8.669 14.3588 8.227C15.0868 7.824 15.4378 7.629 15.4378 7.226C15.4378 6.888 15.2038 6.68 14.8268 6.68C14.3848 6.68 14.1248 7.018 14.1118 7.421H12.7468C12.8248 6.42 13.5528 5.627 14.8398 5.627C15.9448 5.627 16.7768 6.251 16.7768 7.252Z",fill:"currentColor"})});var Wn=[te([{ChildComponent:Gn,isActive:({selection:t})=>xu(t)||gu(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(Cu,"superscript")},order:6}])],bu=y({enableFormats:["superscript"],toolbarFixed:{groups:Wn},toolbarInline:{groups:Wn}});import{$isTableSelection as _u}from"@lexical/table";import{$isRangeSelection as Tu,FORMAT_TEXT_COMMAND as wu}from"lexical";import{jsx as Vn,jsxs as ku}from"react/jsx-runtime";import"react";var Kn=()=>ku("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:[Vn("path",{d:"M13.9656 11.256C13.9656 13.791 12.5096 15.156 10.0006 15.156C7.50461 15.156 6.03561 13.791 6.03561 11.23V5.718H7.76461V11.243C7.76461 12.868 8.50561 13.778 10.0006 13.778C11.4956 13.778 12.2496 12.868 12.2496 11.243V5.718H13.9656V11.256Z",fill:"currentColor"}),Vn("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var Jn=[te([{ChildComponent:Kn,isActive:({selection:t})=>Tu(t)||_u(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(wu,"underline")},order:3}])],Eu=y({enableFormats:["underline"],toolbarFixed:{groups:Jn},toolbarInline:{groups:Jn}});import{jsx as Bo}from"react/jsx-runtime";import{jsx as Nu}from"react/jsx-runtime";function Su(t){return t.replace(/-([a-z])/g,(e,o)=>o.toUpperCase())}var Xt=({css:t})=>{let e=t?Object.fromEntries(Object.entries(t).map(([o,r])=>[Su(o),r])):{};return Nu("span",{style:{...e,alignItems:"center",borderRadius:"4px",display:"flex",fontSize:"16px",height:"20px",justifyContent:"center",width:"20px"},children:"A"})};import{useLexicalComposerContext as Lu}from"@lexical/react/LexicalComposerContext";import{$forEachSelectedTextNode as yu}from"@lexical/selection";import{$getNodeByKey as Iu,$getState as Ru,$setState as vu,createState as Mu,TextNode as Du}from"lexical";import{useEffect as Au}from"react";var Fo=new Map;function Xn(t){for(let e in t){let o=t[e],r=Mu(e,{parse:n=>typeof n=="string"&&Object.keys(o).includes(n)?n:void 0});Fo.set(e,{stateConfig:r,stateValues:o})}}function Po(t,e,o){t.update(()=>{yu(r=>{let n=Fo.get(e);if(!n)throw new Error(`State config for ${e} not found`);vu(r,n.stateConfig,o)})})}function zn(){let[t]=Lu();return Au(()=>t.registerMutationListener(Du,e=>{t.getEditorState().read(()=>{for(let[o,r]of e){if(r==="destroyed")continue;let n=Iu(o),l=t.getElementByKey(o);if(!n||!l)continue;let i=Object.create(null);Fo.forEach((s,u)=>{let c=Ru(n,s.stateConfig);if(!c){delete l.dataset[u];return}l.dataset[u]=c;let d=s.stateValues[c]?.css;d&&Object.assign(i,d)}),l.style.cssText="",Object.assign(l.style,i)}})}),[t]),null}var Zn=t=>{let e=[];for(let r in t.state){let n=t.state[r];for(let l in n){let i=n[l];e.push({ChildComponent:()=>Bo(Xt,{css:i.css}),key:l,label:i.label,onSelect:({editor:s})=>{Po(s,r,l)}})}}return[{type:"dropdown",ChildComponent:()=>Bo(Xt,{css:{color:"var(--theme-elevation-600)"}}),items:[...[{ChildComponent:()=>Bo(Xt,{}),key:"clear-style",label:"Default style",onSelect:({editor:r})=>{for(let n in t.state)Po(r,n,void 0)},order:1}],...e],key:"textState",order:30}]},Ou=y(({props:t})=>(Xn(t.state),{plugins:[{Component:zn,position:"normal"}],toolbarFixed:{groups:Zn(t)},toolbarInline:{groups:Zn(t)}}));import{$createHeadingNode as Bu,$isHeadingNode as ul,HeadingNode as Hu}from"@lexical/rich-text";import{$setBlocksType as ju}from"@lexical/selection";import{$getSelection as Uu,$isRangeSelection as Gu}from"lexical";import{jsx as Yn}from"react/jsx-runtime";import"react";var qn=()=>Yn("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:Yn("path",{d:"M4.639 13.5V7.074H6.196V9.648H9.076V7.074H10.642V13.5H9.076V10.836H6.196V13.5H4.639ZM11.5656 9.045V8.019C12.6636 8.019 13.1316 7.731 13.2846 7.065H14.4006V13.5H12.8436V9.045H11.5656Z",fill:"currentColor"})});import{jsx as Qn}from"react/jsx-runtime";import"react";var el=()=>Qn("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:Qn("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM15.9796 8.973C15.9796 10.116 15.1696 10.656 14.0356 11.232C13.2256 11.646 12.8206 11.943 12.7846 12.294H15.9886V13.5H11.0566V12.951C11.0566 11.601 12.1636 10.845 13.1176 10.287C14.0356 9.756 14.5126 9.486 14.5126 8.946C14.5126 8.46 14.2156 8.145 13.6306 8.145C13.0186 8.145 12.6586 8.613 12.6226 9.198H11.1196C11.2186 7.947 12.1006 6.966 13.6396 6.966C15.0346 6.966 15.9796 7.785 15.9796 8.973Z",fill:"currentColor"})});import{jsx as tl}from"react/jsx-runtime";import"react";var ol=()=>tl("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:tl("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM16.1146 11.745C16.1146 12.744 15.2236 13.608 13.6126 13.608C12.0736 13.608 11.0926 12.762 10.9846 11.547H12.4696C12.5146 12.114 13.0006 12.456 13.6126 12.456C14.2876 12.456 14.6746 12.132 14.6746 11.619C14.6746 11.061 14.2426 10.836 13.6216 10.836H12.9826V9.738H13.6036C14.1526 9.738 14.5486 9.486 14.5486 8.937C14.5486 8.46 14.2156 8.127 13.6486 8.127C13.0366 8.127 12.6586 8.514 12.6226 9.045H11.1916C11.2726 7.929 12.1276 6.966 13.6666 6.966C15.1876 6.966 15.9706 7.848 15.9706 8.865C15.9706 9.603 15.5026 10.143 14.8186 10.269C15.6196 10.404 16.1146 10.971 16.1146 11.745Z",fill:"currentColor"})});import{jsx as rl}from"react/jsx-runtime";import"react";var nl=()=>rl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:rl("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM15.1736 7.074V10.854H16.3706V12.033H15.1736V13.5H13.6796V12.033H10.5116V10.845L13.4996 7.074H15.1736ZM13.6796 8.46L11.8256 10.854H13.6796V8.46Z",fill:"currentColor"})});import{jsx as ll}from"react/jsx-runtime";import"react";var il=()=>ll("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:ll("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.1576 10.269C12.6896 10.269 12.3746 10.494 12.2216 10.737H10.8176L11.1956 7.074H15.2546V8.28H12.3206L12.1856 9.549C12.4016 9.351 12.8516 9.126 13.4636 9.126C14.7866 9.126 15.6596 10.053 15.6596 11.358C15.6596 12.609 14.7326 13.608 13.1756 13.608C11.5826 13.608 10.6556 12.753 10.5566 11.511H12.1136C12.1586 12.06 12.5456 12.465 13.1576 12.465C13.8236 12.465 14.1746 11.97 14.1746 11.376C14.1746 10.764 13.8416 10.269 13.1576 10.269Z",fill:"currentColor"})});import{jsx as sl}from"react/jsx-runtime";import"react";var al=()=>sl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:sl("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.3646 8.127C12.5456 8.127 12.0416 8.937 12.0416 9.999C12.3296 9.54 12.8246 9.207 13.5536 9.207C14.8586 9.207 15.8036 10.134 15.8036 11.376C15.8036 12.645 14.8226 13.608 13.3196 13.608C11.7266 13.608 10.6196 12.393 10.6196 10.395C10.6196 8.316 11.7716 6.966 13.4186 6.966C14.7056 6.966 15.5786 7.749 15.7316 8.829H14.3186C14.2016 8.415 13.9226 8.127 13.3646 8.127ZM13.3106 12.51C13.9586 12.51 14.3816 12.042 14.3816 11.385C14.3816 10.737 13.9586 10.278 13.3106 10.278C12.6536 10.278 12.2126 10.737 12.2126 11.385C12.2126 12.042 12.6536 12.51 13.3106 12.51Z",fill:"currentColor"})});import{$createHeadingNode as $u,$isHeadingNode as Fu,HeadingNode as Pu}from"@lexical/rich-text";var Ho=t=>(e,o,r)=>{let n=t(r);n&&(n.append(...o),e.replace(n),n.select(0,0))};var cl=t=>{let o=`^(${t.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`,r=new RegExp(o);return{type:"element",dependencies:[Pu],export:(n,l)=>{if(!Fu(n))return null;let i=Number(n.getTag().slice(1));return"#".repeat(i)+" "+l(n)},regExp:r,replace:Ho(n=>{let l="h"+n[1]?.length;return $u(l)})}};var dl=t=>{let e=Uu();ju(e,()=>Bu(t))},ml={h1:qn,h2:el,h3:ol,h4:nl,h5:il,h6:al},Wu=y(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[le(e.map((r,n)=>({ChildComponent:ml[r],isActive:({selection:l})=>{if(!Gu(l))return!1;for(let i of l.getNodes()){if(ul(i)&&i.getTag()===r)continue;let s=i.getParent();if(!(ul(s)&&s.getTag()===r))return!1}return!0},key:r,label:({i18n:l})=>l.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:l})=>{l.update(()=>{dl(r)})},order:n+2})))];return{markdownTransformers:[cl(e)],nodes:[Hu],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[ee(e.map(r=>({Icon:ml[r],key:`heading-${r.charAt(1)}`,keywords:["heading",r],label:({i18n:n})=>n.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:n})=>{n.update(()=>{dl(r)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}});import{$isNodeSelection as id}from"lexical";import{jsx as pl}from"react/jsx-runtime";import"react";var jo=()=>pl("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:pl("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as fl,jsxs as Vu}from"react/jsx-runtime";import"react";var hl=()=>Vu("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[fl("path",{d:"M5 10h10",stroke:"currentColor"}),fl("path",{d:"M10 15V5",stroke:"currentColor"})]});var ke=t=>({type:"dropdown",ChildComponent:hl,items:t,key:"add",order:10});import{addClassNamesToElement as Ku}from"@lexical/utils";import{$applyNodeReplacement as Ju,createCommand as Xu,DecoratorNode as zu}from"lexical";var gt=Xu("INSERT_HORIZONTAL_RULE_COMMAND"),ht=class extends zu{static clone(e){return new this(e.__key)}static getType(){return"horizontalrule"}static importDOM(){return{hr:()=>({conversion:Zu,priority:0})}}static importJSON(e){return gl()}createDOM(e){let o=document.createElement("hr");return Ku(o,e.theme.hr),o}decorate(){return null}exportDOM(){return{element:document.createElement("hr")}}exportJSON(){return{type:"horizontalrule",version:1}}getTextContent(){return`
|
|
35
|
-
`}isInline(){return!1}updateDOM(){return!1}};function Zu(){return{node:gl()}}function gl(){return Ju(new ht)}import{$applyNodeReplacement as Yu}from"lexical";import"react";var ve=class extends ht{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return xt()}decorate(){return null}exportJSON(){return super.exportJSON()}};function xt(){return Yu(new ve)}function zt(t){return t instanceof ve}var xl={type:"element",dependencies:[ve],export:(t,e)=>zt(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=xt();e&&t.replace(e)}};import{c as qu}from"react/compiler-runtime";import{useLexicalComposerContext as Qu}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as ed}from"@lexical/utils";import{$getSelection as td,$isRangeSelection as od,COMMAND_PRIORITY_EDITOR as rd}from"lexical";import{useEffect as nd}from"react";var Cl=()=>{let t=qu(3),[e]=Qu(),o,r;return t[0]!==e?(o=()=>e.registerCommand(gt,ld,rd),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),nd(o,r),null};function ld(t){let e=td();if(!od(e))return!1;if(e.focus.getNode()!==null){let r=xt();ed(r)}return!0}var sd=y({markdownTransformers:[xl],nodes:[ve],plugins:[{Component:Cl,position:"normal"}],slashMenu:{groups:[ee([{Icon:jo,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(gt,void 0)}}])]},toolbarFixed:{groups:[ke([{ChildComponent:jo,isActive:({selection:t})=>{if(!id(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return zt(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(gt,void 0)}}])]}});import{$findMatchingParent as yl}from"@lexical/utils";import{$isElementNode as kd,INDENT_CONTENT_COMMAND as _d,OUTDENT_CONTENT_COMMAND as Td}from"lexical";import{jsx as Zt,jsxs as ad}from"react/jsx-runtime";import"react";var bl=()=>ad("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:[Zt("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),Zt("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),Zt("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Zt("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as Yt,jsxs as cd}from"react/jsx-runtime";import"react";var kl=()=>cd("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:[Yt("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),Yt("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),Yt("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),Yt("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});import{jsx as ud}from"react/jsx-runtime";import{useLexicalComposerContext as dd}from"@lexical/react/LexicalComposerContext";import{TabIndentationPlugin as md}from"@lexical/react/LexicalTabIndentationPlugin";import{$findMatchingParent as pd,mergeRegister as _l}from"@lexical/utils";import{$getSelection as fd,$isElementNode as Nl,$isRangeSelection as hd,COMMAND_PRIORITY_LOW as Tl,INDENT_CONTENT_COMMAND as wl,KEY_TAB_COMMAND as gd,OUTDENT_CONTENT_COMMAND as xd,TabNode as Cd}from"lexical";import{useEffect as El}from"react";var Sl=({clientProps:t})=>{let[e]=dd(),{disabledNodes:o,disableTabNode:r}=t;return El(()=>{if(!(!e||!o?.length))return _l(e.registerCommand(wl,()=>bd(n=>{if(!o.includes(n.getType())){let l=n.getIndent();n.setIndent(l+1)}}),Tl),e.registerUpdateListener(({dirtyElements:n,editorState:l})=>{e.update(()=>{for(let[i]of n){let s=l._nodeMap.get(i);Nl(s)&&o.includes(s.getType())&&s.getIndent()>0&&s.setIndent(0)}})}))},[e,o]),El(()=>{if(!(!e||!r))return _l(e.registerCommand(gd,n=>(n.preventDefault(),e.dispatchCommand(n.shiftKey?xd:wl,void 0)),Tl),e.registerNodeTransform(Cd,n=>{n.remove()}))},[e,r]),ud(md,{})};function bd(t){let e=fd();if(!hd(e))return!1;let o=new Set,r=e.getNodes();for(let n=0;n<r.length;n++){let l=r[n],i=l.getKey();if(o.has(i))continue;let s=pd(l,c=>Nl(c)&&!c.isInline());if(s===null)continue;let u=s.getKey();s.canIndent()&&!o.has(u)&&(o.add(u),t(s))}return o.size>0}var Ll=t=>({type:"buttons",items:t,key:"indent",order:35});var Il=({disabledNodes:t})=>[Ll([{ChildComponent:bl,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>Rl(n)&&n.getIndent()>0;return o.some(n=>r(n)||!!yl(n,r))},key:"indentDecrease",label:({i18n:e})=>e.t("lexical:indent:decreaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Td,void 0)},order:1},{ChildComponent:kl,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>Rl(n)&&!(t??[]).includes(n.getType());return o.some(n=>r(n)||!!yl(n,r))},key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(_d,void 0)},order:2}])],wd=y(({props:t})=>{let e=t.disabledNodes??[];return{plugins:[{Component:Sl,position:"normal"}],sanitizedClientFeatureProps:t,toolbarFixed:{groups:Il({disabledNodes:e})},toolbarInline:{groups:Il({disabledNodes:e})}}}),Rl=t=>kd(t)&&t.canIndent();import{$findMatchingParent as Om}from"@lexical/utils";import{$getSelection as Zo,$isRangeSelection as si}from"lexical";import{jsx as vl}from"react/jsx-runtime";import"react";var Ml=()=>vl("svg",{"aria-hidden":"true",className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:vl("path",{d:"M8.5 11.5L11.5 8.5M8.5 7L9.625 5.875C10.868 4.633 12.882 4.633 14.125 5.875C15.368 7.118 15.368 9.133 14.125 10.375L13 11.5M7 8.5L5.746 9.754C4.56 10.94 4.519 12.85 5.652 14.087C6.814 15.354 8.78 15.449 10.058 14.298L11.5 13",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})});import{$isAtNodeEnd as Dl}from"@lexical/selection";function ze(t){let{anchor:e}=t,{focus:o}=t,r=t.anchor.getNode(),n=t.focus.getNode();return r===n?r:t.isBackward()?Dl(o)?r:n:Dl(e)?r:n}var Uo=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as Ad}from"lexical";import{addClassNamesToElement as Ed,isHTMLAnchorElement as Nd}from"@lexical/utils";import Vo from"bson-objectid";import{$applyNodeReplacement as Sd,$createTextNode as Al,$getSelection as Ld,$isElementNode as Ol,$isRangeSelection as Wo,createCommand as yd,ElementNode as Id}from"lexical";var Rd=new Set(["http:","https:","mailto:","sms:","tel:"]),ie=class t extends Id{__fields;__id;constructor({id:e,fields:o={linkType:"custom",newTab:!1},key:r}){super(r),this.__fields=o,this.__id=e}static clone(e){return new t({id:e.__id,fields:e.__fields,key:e.__key})}static getType(){return"link"}static importDOM(){return{a:e=>({conversion:vd,priority:1})}}static importJSON(e){let o=_e({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),e.version===2&&!e.id&&(e.id=new Vo.default().toHexString(),e.version=3),o}canBeEmpty(){return!1}canInsertTextAfter(){return!1}canInsertTextBefore(){return!1}createDOM(e){let o=document.createElement("a");return this.__fields?.linkType==="custom"&&(o.href=this.sanitizeUrl(this.__fields.url??"")),(this.__fields?.newTab??!1)&&(o.target="_blank"),this.__fields?.newTab===!0&&this.__fields?.linkType==="custom"&&(o.rel=Go(o.rel,"add","noopener")),Ed(o,e.theme.link),o}exportJSON(){let e=this.getFields();e?.linkType==="internal"?delete e.url:e?.linkType==="custom"&&delete e.doc;let o={...super.exportJSON(),type:"link",fields:e,version:3},r=this.getID();return r&&(o.id=r),o}extractWithChild(e,o,r){if(!Wo(o))return!1;let n=o.anchor.getNode(),l=o.focus.getNode();return this.isParentOf(n)&&this.isParentOf(l)&&o.getTextContent().length>0}getFields(){return this.getLatest().__fields}getID(){return this.getLatest().__id}insertNewAfter(e,o=!0){let r=this.getParentOrThrow().insertNewAfter(e,o);if(Ol(r)){let n=_e({fields:this.__fields});return r.append(n),n}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!Rd.has(o.protocol))return"about:blank"}catch{return"https://"}return e}setFields(e){let o=this.getWritable();return o.__fields=e,o}setID(e){let o=this.getWritable();return o.__id=e,o}updateDOM(e,o,r){let n=this.__fields?.url,l=this.__fields?.newTab;return n!=null&&n!==e.__fields?.url&&this.__fields?.linkType==="custom"&&(o.href=n),this.__fields?.linkType==="internal"&&e.__fields?.linkType==="custom"&&o.removeAttribute("href"),o.rel==null&&(o.rel=""),l!==e.__fields?.newTab&&(l??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=Go(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=Go(o.rel,"remove","noopener"))),!1}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields).setID(e.id)}};function vd(t){let e=null;if(Nd(t)){let o=t.textContent;o!==null&&o!==""&&(e=_e({id:new Vo.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function _e({id:t,fields:e}){return Sd(new ie({id:t??new Vo.default().toHexString(),fields:e}))}function Z(t){return t instanceof ie}var he=yd("TOGGLE_LINK_COMMAND");function Ko(t){let e=Ld();if(!Wo(e)&&(t===null||!t.selectedNodes?.length))return;let o=Wo(e)?e.extract():t===null?[]:t.selectedNodes;if(t===null){o?.forEach(l=>{let i=l.getParent();Z(i)&&(i.getChildren().forEach(u=>{i.insertBefore(u)}),i.remove())});return}if(o?.length===1){let l=o[0],i=Z(l)?l:Md(l);if(i!==null){i.setFields(t.fields),t.text!=null&&t.text!==i.getTextContent()&&(i.append(Al(t.text)),i.getChildren().forEach(s=>{s!==i.getLastChild()&&s.remove()}));return}}let r=null,n=null;o?.forEach(l=>{let i=l.getParent();if(!(i===n||i===null||Ol(l)&&!l.isInline())){if(Z(i)){n=i,i.setFields(t.fields),t.text!=null&&t.text!==i.getTextContent()&&(i.append(Al(t.text)),i.getChildren().forEach(s=>{s!==i.getLastChild()&&s.remove()}));return}if(i.is(r)||(r=i,n=_e({fields:t.fields}),Z(i)?l.getPreviousSibling()===null?i.insertBefore(n):i.insertAfter(n):l.insertBefore(n)),Z(l)){if(l.is(n))return;if(n!==null){let s=l.getChildren();n.append(...s)}l.remove();return}n!==null&&n.append(l)}})}function Md(t){return Dd(t,e=>Z(e))}function Dd(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function Go(t,e,o){let r,n=`${t}`;if(e==="add"){if(n.includes(o)){let l=new RegExp(o,"g");n=n.replace(l,"").trim()}n=n.trim(),r=n.length===0?`${o}`:`${n} ${o}`}else{let l=new RegExp(o,"g");r=n.replace(l,"").trim()}return r}var $l={type:"text-match",dependencies:[ie],export:(t,e)=>{if(!Z(t))return null;let o=t,{url:r}=o.getFields();return`[${e(o)}](${r})`},importRegExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:(t,e)=>{let[,o,r]=e,n=_e({fields:{doc:null,linkType:"custom",newTab:!1,url:r}}),l=Ad(o);return l.setFormat(t.getFormat()),n.append(l),t.replace(n),l},trigger:")"};import{$applyNodeReplacement as Od,$isElementNode as $d}from"lexical";var Te=class t extends ie{static clone(e){return new t({id:"",fields:e.__fields,key:e.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(e){let o=Ct({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),o}exportJSON(){let e=super.exportJSON();return{type:"autolink",children:e.children,direction:e.direction,fields:e.fields,format:e.format,indent:e.indent,version:2}}insertNewAfter(e,o=!0){let r=this.getParentOrThrow().insertNewAfter(e,o);if($d(r)){let n=Ct({fields:this.__fields});return r.append(n),n}return null}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields)}};function Ct({fields:t}){return Od(new Te({id:"",fields:t}))}function we(t){return t instanceof Te}import{c as Fd}from"react/compiler-runtime";import{useLexicalComposerContext as Pd}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Bd}from"@lexical/utils";import{$createTextNode as Fl,$getSelection as Hd,$isElementNode as Bl,$isLineBreakNode as Hl,$isNodeSelection as jd,$isRangeSelection as Ud,$isTextNode as bt,TextNode as Gd}from"lexical";import{useEffect as Wd}from"react";function Pl(t,e=o=>o){return o=>{let r=t.exec(o);return r===null?null:{index:r.index,length:r[0].length,text:r[0],url:e(r[0])}}}function jl(t,e){for(let o of e){let r=o(t);if(r!=null)return r}return null}var Vd=/[.,;\s]/;function Qt(t){return t!==void 0&&Vd.test(t)}function Ul(t){return Qt(t[t.length-1])}function Xo(t){return Qt(t[0])}function Kd(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function Gl(t){let e=t.getPreviousSibling();return Bl(e)&&(e=e.getLastDescendant()),e===null||Hl(e)||bt(e)&&Ul(e.getTextContent())}function Wl(t){let e=t.getNextSibling();return Bl(e)&&(e=e.getFirstDescendant()),e===null||Hl(e)||bt(e)&&Xo(e.getTextContent())}function Jd(t,e,o,r){return(t>0?Qt(o[t-1]):Gl(r[0]))?e<o.length?Qt(o[e]):Wl(r[r.length-1]):!1}function Xd(t,e,o){let r=[],n=[],l=[],i=0,s=0,u=[...t];for(;u.length>0;){let c=u[0],a=c.getTextContent().length,p=s;s+a<=e?(r.push(c),i+=a):p>=o?l.push(c):n.push(c),s+=a,u.shift()}return[i,r,n,l]}function zd(t,e,o,r){let n={linkType:"custom",url:r.url,...r.fields},l=Ct({fields:n});if(t.length===1){let i=t[0],s;if(e===0?[s]=i.splitText(o):[,s]=i.splitText(e,o),s){let u=Fl(r.text);u.setFormat(s.getFormat()),u.setDetail(s.getDetail()),u.setStyle(s.getStyle()),l.append(u),s.replace(l)}return i}else if(t.length>1){let i=t[0],s=i.getTextContent().length,u;e===0?u=i:[,u]=i.splitText(e);let c=[],d;if(t.forEach(a=>{let m=a.getTextContent().length,f=s,h=s+m;if(f<o)if(h<=o)c.push(a);else{let[g,b]=a.splitText(o-f);g&&c.push(g),d=b}s+=m}),u){let a=Hd(),p=a?a.getNodes().find(bt):void 0,m=Fl(u.getTextContent());return m.setFormat(u.getFormat()),m.setDetail(u.getDetail()),m.setStyle(u.getStyle()),l.append(m,...c),p&&p===u&&(Ud(a)?m.select(a.anchor.offset,a.focus.offset):jd(a)&&m.select(0,m.getTextContent().length)),u.replace(l),d}}}function Zd(t,e,o){let r=[...t],n=r.map(u=>u.getTextContent()).join(""),l=n,i,s=0;for(;(i=jl(l,e))!=null&&i!==null;){let u=i.index,c=i.length,d=u+c;if(Jd(s+u,s+d,n,r)){let[p,,m,f]=Xd(r,s+u,s+d),h=s+u-p,g=s+d-p,b=zd(m,h,g,i);r=b?[b,...f]:f,o(i.url,null),s=0}else s+=d;l=l.substring(d)}}function Jo(t,e,o){let r=t.getChildren(),n=r.length;for(let u=0;u<n;u++){let c=r[u];if(!bt(c)||!c.isSimpleText()){qt(t),o(null,t.getFields()?.url??null);return}}let l=t.getTextContent(),i=jl(l,e);if(i===null||i.text!==l){qt(t),o(null,t.getFields()?.url??null);return}if(!Gl(t)||!Wl(t)){qt(t),o(null,t.getFields()?.url??null);return}let s=t.getFields()?.url;if(s!==i?.url){let u=t.getFields();u.url=i?.url,t.setFields(u),o(i.url,s??null)}}function Yd(t,e,o){let r=t.getPreviousSibling(),n=t.getNextSibling(),l=t.getTextContent();if(we(r)){let i=r.getFields()?.url?r.getFields()?.url?.startsWith("mailto:")??!1:!1;(!Xo(l)||Kd(l,i))&&(r.append(t),Jo(r,e,o),o(null,r.getFields()?.url??null))}we(n)&&!Ul(l)&&(qt(n),Jo(n,e,o),o(null,n.getFields()?.url??null))}function qt(t){let e=t.getChildren(),o=e.length;for(let r=o-1;r>=0;r--)t.insertAfter(e[r]);return t.remove(),e.map(r=>r.getLatest())}function qd(t){let e=[t],o=t.getNextSibling();for(;o!==null&&bt(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function Qd(t,e,o){let r=Fd(5),n,l;r[0]!==t||r[1]!==e||r[2]!==o?(n=()=>{if(!t.hasNodes([Te]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let i=(s,u)=>{o?.(s,u)};return Bd(t.registerNodeTransform(Gd,s=>{let u=s.getParentOrThrow(),c=s.getPreviousSibling();if(we(u))Jo(u,e,i);else if(!Z(u)){if(s.isSimpleText()&&(Xo(s.getTextContent())||!we(c))){let d=qd(s);Zd(d,e,i)}Yd(s,e,i)}}))},l=[t,e,o],r[0]=t,r[1]=e,r[2]=o,r[3]=n,r[4]=l):(n=r[3],l=r[4]),Wd(n,l)}var em=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,tm=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,om=[Pl(em,t=>t.startsWith("http")?t:`https://${t}`),Pl(tm,t=>`mailto:${t}`)],Vl=()=>{let[t]=Pd();return Qd(t,om),null};import{jsx as rm}from"react/jsx-runtime";import{ClickableLinkPlugin as nm}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var Kl=()=>rm(nm,{});import{jsx as Tm}from"react/jsx-runtime";import"react";import{createPortal as wm}from"react-dom";import{jsx as Ee,jsxs as kt,Fragment as im}from"react/jsx-runtime";import{useLexicalComposerContext as sm}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as Jl,mergeRegister as Xl}from"@lexical/utils";import{getTranslation as zo}from"@payloadcms/translations";import{CloseMenuIcon as am,EditIcon as cm,ExternalLinkIcon as zl,formatDrawerSlug as um,useConfig as dm,useEditDepth as mm,useLocale as pm,useTranslation as fm}from"@payloadcms/ui";import{requests as hm}from"@payloadcms/ui/shared";import{$getSelection as Zl,$isLineBreakNode as gm,$isRangeSelection as Yl,COMMAND_PRIORITY_HIGH as xm,COMMAND_PRIORITY_LOW as ql,getDOMSelection as Cm,KEY_ESCAPE_COMMAND as bm,SELECTION_CHANGE_COMMAND as km}from"lexical";import Ql,{useCallback as ei,useEffect as oo,useRef as _m,useState as Pe}from"react";function eo(t,e,o,r=10,n=5){let l=o.parentElement;if(t===null||l==null){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let i=e.getBoundingClientRect(),s=o.getBoundingClientRect(),u=l.getBoundingClientRect(),c=t.top-r,d=t.left-n;c<u.top&&(c+=i.height+t.height+r*2),d+i.width>u.right&&(d=u.right-i.width-n),c-=s.top,d-=s.left,e.style.opacity="1",e.style.transform=`translate(${d}px, ${c}px)`}import{createCommand as lm}from"lexical";var to=lm("TOGGLE_LINK_WITH_MODAL_COMMAND");function ti(t){t.preventDefault()}function oi({anchorElem:t}){let[e]=sm(),[o,r]=Pe(),n=_m(null),[l,i]=Pe(null),[s,u]=Pe(null),{fieldProps:{schemaPath:c},uuid:d}=j(),{config:a,getEntityConfig:p}=dm(),{i18n:m,t:f}=fm(),[h,g]=Pe(),b=mm(),[T,M]=Pe(!1),[k,_]=Pe([]),x=pm(),[S,D]=Pe(!1),O=um({slug:"lexical-rich-text-link-"+d,depth:b}),{toggleDrawer:F}=xe(O),I=ei(()=>{M(!1),n&&n.current&&(n.current.style.opacity="0",n.current.style.transform="translate(-10000px, -10000px)"),D(!1),i(null),u(null),_([]),g(void 0)},[M,i,u,_]),w=ei(()=>{let C=Zl(),N;if(!Yl(C)||!C){I();return}let R=ze(C);N=e.getElementByKey(R.getKey())?.getBoundingClientRect();let L=Jl(R,Z),v=C.getNodes().filter(V=>!gm(V)).find(V=>{let U=Jl(V,Z);return L&&!L.is(U)||U&&!U.is(L)});if(L==null||v){I();return}r(L);let E=L.getFields(),$={...E,id:L.getID(),text:L.getTextContent()};if(E?.linkType==="custom")i(E?.url??null),u(null);else{i(`${a.routes.admin==="/"?"":a.routes.admin}/collections/${E?.doc?.relationTo}/${E?.doc?.value}`);let V=E?.doc?.relationTo?p({collectionSlug:E?.doc?.relationTo}):void 0;if(!V)u(E?.label?String(E?.label):null),i(E?.url?String(E?.url):null);else{let U=typeof E.doc?.value=="object"?E.doc.value.id:E.doc?.value,oe=E.doc?.relationTo;if(!U||!oe)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let ue=f("fields:linkedTo",{label:`${zo(V.labels.singular,m)} - ${f("lexical:link:loadingWithEllipsis",m)}`}).replace(/<[^>]*>?/g,"");u(ue),hm.get(`${a.serverURL}${a.routes.api}/${oe}/${U}`,{headers:{"Accept-Language":m.language},params:{depth:0,locale:x?.code}}).then(async q=>{if(!q.ok)throw new Error(`HTTP error! Status: ${q.status}`);let K=await q.json(),re=V?.admin?.useAsTitle||"id",ne=K[re],se=f("fields:linkedTo",{label:`${zo(V.labels.singular,m)} - ${ne}`}).replace(/<[^>]*>?/g,"");u(se)}).catch(()=>{let q=f("fields:linkedTo",{label:`${zo(V.labels.singular,m)} - ${f("general:untitled",m)} - ID: ${U}`}).replace(/<[^>]*>?/g,"");u(q)})}}g($),M(!0),_(C?C?.getNodes():[]),we(L)?D(!0):D(!1);let H=n.current,W=Cm(e._window),{activeElement:Y}=document;if(H===null)return;let We=e.getRootElement();return W!==null&&We!==null&&We.contains(W.anchorNode)?(N||(N=W.getRangeAt(0).getBoundingClientRect()),N!=null&&(N.y+=40,eo(N,H,t))):(Y==null||Y.className!=="link-input")&&(We!==null&&eo(null,H,t),i(null),u(null)),!0},[e,I,a.routes.admin,a.routes.api,a.serverURL,p,f,m,x?.code,t]);return oo(()=>Xl(e.registerCommand(to,C=>(e.dispatchCommand(he,C),w(),F(),!0),ql)),[e,w,F,O]),oo(()=>{let C=t.parentElement,N=()=>{e.getEditorState().read(()=>{w()})};return window.addEventListener("resize",N),C?.addEventListener("scroll",N),()=>{window.removeEventListener("resize",N),C?.removeEventListener("scroll",N)}},[t.parentElement,e,w]),oo(()=>Xl(e.registerUpdateListener(({editorState:C})=>{C.read(()=>{w()})}),e.registerCommand(km,()=>(w(),!0),ql),e.registerCommand(bm,()=>T?(I(),!0):!1,xm)),[e,w,T,I]),oo(()=>{e.getEditorState().read(()=>{w()})},[e,w]),kt(Ql.Fragment,{children:[Ee("div",{className:"link-editor",ref:n,children:kt("div",{className:"link-input",children:[l&&l.length>0?kt("a",{href:l,rel:"noopener noreferrer",target:"_blank",children:[o?.__fields.newTab?Ee(zl,{}):null,s!=null&&s.length>0?s:l]}):s!=null&&s.length>0?kt(im,{children:[o?.__fields.newTab?Ee(zl,{}):null,Ee("span",{className:"link-input__label-pure",children:s})]}):null,e.isEditable()&&kt(Ql.Fragment,{children:[Ee("button",{"aria-label":"Edit link",className:"link-edit",onClick:C=>{C.preventDefault(),F()},onMouseDown:ti,tabIndex:0,type:"button",children:Ee(cm,{})}),!S&&Ee("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(he,null)},onMouseDown:ti,tabIndex:0,type:"button",children:Ee(am,{})})]})]})}),Ee(st,{className:"lexical-link-edit-drawer",data:h,drawerSlug:O,drawerTitle:f("fields:editLink"),featureKey:"link",handleDrawerSubmit:(C,N)=>{let R=N,L={...R};delete L.text,e.update(()=>{let v=Zl(),E=null;if(Yl(v)?E=ze(v).getParent():k.length&&(E=k[0]?.getParent()??null),E&&we(E)){let $=_e({fields:L});E.replace($,!0)}}),e.dispatchCommand(he,{fields:L,selectedNodes:k,text:R.text})},schemaPath:c,schemaPathSuffix:"fields"})]})}var ri=t=>{let{anchorElem:e=document.body}=t;return wm(Tm(oi,{anchorElem:e}),e)};import{c as Sm}from"react/compiler-runtime";import{useLexicalComposerContext as Lm}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as ym}from"@lexical/utils";import{$getSelection as Im,$isElementNode as Rm,$isRangeSelection as vm,COMMAND_PRIORITY_LOW as li,PASTE_COMMAND as Mm}from"lexical";import{useEffect as Dm}from"react";var Em=/^(?:[a-zA-Z][a-zA-Z\d+.-]*:(?:\/\/)?(?:[-;:&=+$,\w]+@)?[A-Za-z\d]+(?:\.[A-Za-z\d]+)+|www\.[A-Za-z\d]+(?:\.[A-Za-z\d]+)+|(?:tel|mailto):[\w+.-]+)(?:\/[+~%/\w-]*)?(?:\?[-;&=%\w]*)?(?:#\w+)?$/,Nm=/^(?:\/[\w\-./]*(?:#\w[\w-]*)?|#[\w\-]+)$/;function ni(t){if(!t)return!1;if(t==="https://"||Em.test(t)||Nm.test(t))return!0;try{return new URL(t),!0}catch{}return!1}var ii=t=>{let e=Sm(5),{clientProps:o}=t,[r]=Lm(),n,l;return e[0]!==o.defaultLinkType||e[1]!==o.defaultLinkURL||e[2]!==r?(n=()=>{if(!r.hasNodes([ie]))throw new Error("LinkPlugin: LinkNode not registered on editor");return ym(r.registerCommand(he,i=>i===null?(Ko(null),!0):(i.fields?.linkType||(i.fields.linkType=o.defaultLinkType),i.fields?.url||(i.fields.url=o.defaultLinkURL),Ko(i),!0),li),r.registerCommand(Mm,i=>{let s=Im();if(!vm(s)||s.isCollapsed()||!(i instanceof ClipboardEvent)||i.clipboardData==null)return!1;let u=i.clipboardData.getData("text");if(!ni(u))return!1;if(!s.getNodes().some(Am)){let c={doc:null,linkType:"custom",newTab:!1,url:u};return r.dispatchCommand(he,{fields:c,text:null}),i.preventDefault(),!0}return!1},li))},l=[o.defaultLinkType,o.defaultLinkURL,r],e[0]=o.defaultLinkType,e[1]=o.defaultLinkURL,e[2]=r,e[3]=n,e[4]=l):(n=e[3],l=e[4]),Dm(n,l),null};function Am(t){return Rm(t)}var ai=[Uo([{ChildComponent:Ml,isActive:({selection:t})=>{if(si(t)){let e=ze(t);return Om(e,Z)!=null}return!1},isEnabled:({selection:t})=>!!(si(t)&&Zo()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(he,null);else{let o,r=[];if(t.getEditorState().read(()=>{o=Zo()?.getTextContent(),r=Zo()?.getNodes()??[]}),!o?.length)return;let n={doc:null};t.dispatchCommand(to,{fields:n,selectedNodes:r,text:o})}},order:1}])],$m=y(({props:t})=>({markdownTransformers:[$l],nodes:[ie,t?.disableAutoLinks===!0?null:Te].filter(Boolean),plugins:[{Component:ii,position:"normal"},t?.disableAutoLinks===!0||t?.disableAutoLinks==="creationOnly"?null:{Component:Vl,position:"normal"},{Component:Kl,position:"normal"},{Component:ri,position:"floatingAnchorElem"}].filter(Boolean),sanitizedClientFeatureProps:t,toolbarFixed:{groups:ai},toolbarInline:{groups:ai}}));import{$isListNode as Qo,INSERT_CHECK_LIST_COMMAND as fi,ListItemNode as Xm,ListNode as zm}from"@lexical/list";import{$isRangeSelection as Zm}from"lexical";import{jsx as ci,jsxs as Fm}from"react/jsx-runtime";import"react";var Yo=()=>Fm("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[ci("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),ci("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Pm}from"react/jsx-runtime";import{ListPlugin as Bm}from"@lexical/react/LexicalListPlugin.js";import"react";var Ze=()=>Pm(Bm,{});function Ye(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as Gm,ListItemNode as Wm,ListNode as Vm}from"@lexical/list";import{$createListItemNode as Hm,$createListNode as jm,$isListItemNode as Um,$isListNode as qo}from"@lexical/list";var ui=4,qe=t=>(e,o,r)=>{let n=e.getPreviousSibling(),l=e.getNextSibling(),i=Hm(t==="check"?r[3]==="x":void 0);if(qo(l)&&l.getListType()===t){let u=l.getFirstChild();u!==null?u.insertBefore(i):l.append(i),e.remove()}else if(qo(n)&&n.getListType()===t)n.append(i),e.remove();else{let u=jm(t,t==="number"?Number(r[2]):void 0);u.append(i),e.replace(u)}i.append(...o),i.select(0,0);let s=Math.floor(r[1].length/ui);s&&i.setIndent(s)},Be=(t,e,o)=>{let r=[],n=t.getChildren(),l=0;for(let i of n)if(Um(i)){if(i.getChildrenSize()===1){let d=i.getFirstChild();if(qo(d)){r.push(Be(d,e,o+1));continue}}let s=" ".repeat(o*ui),u=t.getListType(),c=u==="number"?`${t.getStart()+l}. `:u==="check"?`- [${i.getChecked()?"x":" "}] `:"- ";r.push(s+c+e(i)),l++}return r.join(`
|
|
36
|
-
`)};var di={type:"element",dependencies:[Vm,Wm],export:(t,e)=>Gm(t)?Be(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:qe("check")};import{jsx as Km}from"react/jsx-runtime";import{CheckListPlugin as Jm}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var mi=()=>Km(Jm,{});var pi=[le([{ChildComponent:Yo,isActive:({selection:t})=>{if(!Zm(t))return!1;for(let e of t.getNodes()){if(Qo(e)&&e.getListType()==="check")continue;let o=e.getParent();if(Qo(o)&&o.getListType()==="check")continue;let r=o?.getParent();if(!(Qo(r)&&r.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(fi,void 0)},order:12}])],Ym=y(({featureProviderMap:t})=>{let e=[{Component:mi,position:"normal"}];return!t.has("unorderedList")&&!t.has("orderedList")&&e.push({Component:Ze,position:"normal"}),{markdownTransformers:[di],nodes:t.has("unorderedList")||t.has("orderedList")?[]:[zm,Xm],plugins:e,slashMenu:{groups:[Ye([{Icon:Yo,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:o})=>o.t("lexical:checklist:label"),onSelect:({editor:o})=>{o.dispatchCommand(fi,void 0)}}])]},toolbarFixed:{groups:pi},toolbarInline:{groups:pi}}});import{$isListNode as tr,INSERT_ORDERED_LIST_COMMAND as xi,ListItemNode as op,ListNode as rp}from"@lexical/list";import{$isRangeSelection as np}from"lexical";import{jsx as _t,jsxs as qm}from"react/jsx-runtime";import"react";var er=()=>qm("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:[_t("path",{d:"M5.89284 12.479C5.89284 13.368 5.26284 13.788 4.38084 14.236C3.75084 14.558 3.43584 14.789 3.40784 15.062H5.89984V16H2.06384V15.573C2.06384 14.523 2.92484 13.935 3.66684 13.501C4.38084 13.088 4.75184 12.878 4.75184 12.458C4.75184 12.08 4.52084 11.835 4.06584 11.835C3.58984 11.835 3.30984 12.199 3.28184 12.654H2.11284C2.18984 11.681 2.87584 10.918 4.07284 10.918C5.15784 10.918 5.89284 11.555 5.89284 12.479Z",fill:"currentColor"}),_t("path",{d:"M2.68608 4.535V3.737C3.54008 3.737 3.90408 3.513 4.02308 2.995H4.89108V8H3.68008L3.68008 4.535H2.68608Z",fill:"currentColor"}),_t("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),_t("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),_t("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Qm,ListItemNode as ep,ListNode as tp}from"@lexical/list";var hi={type:"element",dependencies:[tp,ep],export:(t,e)=>Qm(t)?Be(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:qe("number")};var gi=[le([{ChildComponent:er,isActive:({selection:t})=>{if(!np(t))return!1;for(let e of t.getNodes()){if(tr(e)&&e.getListType()==="number")continue;let o=e.getParent();if(tr(o)&&o.getListType()==="number")continue;let r=o?.getParent();if(!(tr(r)&&r.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(xi,void 0)},order:10}])],lp=y(({featureProviderMap:t})=>({markdownTransformers:[hi],nodes:t.has("orderedList")?[]:[rp,op],plugins:t.has("orderedList")?[]:[{Component:Ze,position:"normal"}],slashMenu:{groups:[Ye([{Icon:er,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:e})=>e.t("lexical:orderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(xi,void 0)}}])]},toolbarFixed:{groups:gi},toolbarInline:{groups:gi}}));import{$isListNode as rr,INSERT_UNORDERED_LIST_COMMAND as ki,ListItemNode as up,ListNode as dp}from"@lexical/list";import{$isRangeSelection as mp}from"lexical";import{jsx as Qe,jsxs as ip}from"react/jsx-runtime";import"react";var or=()=>ip("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Qe("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Qe("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Qe("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Qe("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),Qe("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),Qe("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as sp,ListItemNode as ap,ListNode as cp}from"@lexical/list";var Ci={type:"element",dependencies:[cp,ap],export:(t,e)=>sp(t)?Be(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:qe("bullet")};var bi=[le([{ChildComponent:or,isActive:({selection:t})=>{if(!mp(t))return!1;for(let e of t.getNodes()){if(rr(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(rr(o)&&o.getListType()==="bullet")continue;let r=o?.getParent();if(!(rr(r)&&r.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(ki,void 0)},order:11}])],pp=y({markdownTransformers:[Ci],nodes:[dp,up],plugins:[{Component:Ze,position:"normal"}],slashMenu:{groups:[Ye([{Icon:or,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(ki,void 0)}}])]},toolbarFixed:{groups:bi},toolbarInline:{groups:bi}});import{jsx as fp}from"react/jsx-runtime";import{addClassNamesToElement as hp}from"@lexical/utils";import{DecoratorNode as gp}from"lexical";import*as _i from"react";var xp=_i.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),Tt=class t extends gp{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new t({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return Cp({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return hp(o,"unknownConverted"),o}decorate(){return fp(xp,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function Cp({data:t}){return new Tt({data:t})}var bp=y(()=>({nodes:[Tt]}));import{jsx as kp}from"react/jsx-runtime";import{addClassNamesToElement as _p}from"@lexical/utils";import{DecoratorNode as Tp}from"lexical";import*as Ti from"react";var wp=Ti.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),wt=class t extends Tp{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new t({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return Ep({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return _p(o,"unknownConverted"),o}decorate(){return kp(wp,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function Ep({data:t}){return new wt({data:t})}var Np=y(()=>({nodes:[wt]}));import{$setBlocksType as Ni}from"@lexical/selection";import{$createParagraphNode as Si,$getSelection as Li,$isParagraphNode as wi,$isRangeSelection as Sp}from"lexical";var Ei=[le([{ChildComponent:ct,isActive:({selection:t})=>{if(!Sp(t))return!1;for(let e of t.getNodes())if(!wi(e)&&!wi(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=Li();Ni(e,()=>Si())})},order:1}])],Lp=y({slashMenu:{groups:[ee([{Icon:ct,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Li();Ni(e,()=>Si())})}}])]},toolbarFixed:{groups:Ei},toolbarInline:{groups:Ei}});import{c as Xp}from"react/compiler-runtime";import{jsx as Ji}from"react/jsx-runtime";import{useLexicalComposerContext as zp}from"@lexical/react/LexicalComposerContext";import{useEffect as Zp,useState as Yp}from"react";import{jsx as Ki,Fragment as Jp}from"react/jsx-runtime";import"react";import{jsx as yp}from"react/jsx-runtime";var yi={quote:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return yp("blockquote",{children:o})}};import{jsx as Ip}from"react/jsx-runtime";var Ii={heading:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.tag;return Ip(r,{children:o})}};import{jsx as Rp}from"react/jsx-runtime";var Ri={horizontalrule:Rp("hr",{})};import{jsx as vp}from"react/jsx-runtime";var vi={linebreak:vp("br",{})};import{jsx as Mi}from"react/jsx-runtime";var Di=({internalDocToHref:t})=>({autolink:({node:e,nodesToJSX:o})=>{let r=o({nodes:e.children}),n=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0;return Mi("a",{href:e.fields.url,rel:n,target:l,children:r})},link:({node:e,nodesToJSX:o})=>{let r=o({nodes:e.children}),n=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0,i=e.fields.url??"";return e.fields.linkType==="internal"&&(t?i=t({linkNode:e}):(console.error("Lexical => JSX converter: Link converter: found internal link, but internalDocToHref is not provided"),i="#")),Mi("a",{href:i,rel:n,target:l,children:r})}});import{jsx as et,jsxs as Mp,Fragment as Dp}from"react/jsx-runtime";import{v4 as Ap}from"uuid";var Ai={list:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.tag;return et(r,{className:`list-${t?.listType}`,children:o})},listitem:({node:t,nodesToJSX:e,parent:o})=>{let r=t.children.some(l=>l.type==="list"),n=e({nodes:t.children});if("listType"in o&&o?.listType==="check"){let l=Ap();return et("li",{"aria-checked":t.checked?"true":"false",className:`list-item-checkbox${t.checked?" list-item-checkbox-checked":" list-item-checkbox-unchecked"}${r?" nestedListItem":""}`,role:"checkbox",style:{listStyleType:"none"},tabIndex:-1,value:t?.value,children:r?n:Mp(Dp,{children:[et("input",{checked:t.checked,id:l,readOnly:!0,type:"checkbox"}),et("label",{htmlFor:l,children:n}),et("br",{})]})})}else return et("li",{className:`${r?"nestedListItem":""}`,style:r?{listStyleType:"none"}:void 0,value:t?.value,children:n})}};import{jsx as nr}from"react/jsx-runtime";var Oi={paragraph:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return o?.length?nr("p",{children:o}):nr("p",{children:nr("br",{})})}};var $i={tab:" "};import{jsx as Et}from"react/jsx-runtime";var Fi={table:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return Et("div",{className:"lexical-table-container",children:Et("table",{className:"lexical-table",style:{borderCollapse:"collapse"},children:Et("tbody",{children:o})})})},tablecell:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.headerState>0?"th":"td",n=`lexical-table-cell-header-${t.headerState}`,l={backgroundColor:t.backgroundColor||void 0,border:"1px solid #ccc",padding:"8px"},i=t.colSpan&&t.colSpan>1?t.colSpan:void 0,s=t.rowSpan&&t.rowSpan>1?t.rowSpan:void 0;return Et(r,{className:`lexical-table-cell ${n}`,colSpan:i,rowSpan:s,style:l,children:o})},tablerow:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return Et("tr",{className:"lexical-table-row",children:o})}};import{jsx as He}from"react/jsx-runtime";import"react";var A={DOM_ELEMENT_TYPE:1,DOM_TEXT_TYPE:3,NO_DIRTY_NODES:0,HAS_DIRTY_NODES:1,FULL_RECONCILE:2,IS_NORMAL:0,IS_TOKEN:1,IS_SEGMENTED:2,IS_INERT:3,IS_BOLD:1,IS_ITALIC:2,IS_STRIKETHROUGH:4,IS_UNDERLINE:8,IS_CODE:16,IS_SUBSCRIPT:32,IS_SUPERSCRIPT:64,IS_HIGHLIGHT:128,IS_DIRECTIONLESS:1,IS_UNMERGEABLE:2,IS_ALIGN_LEFT:1,IS_ALIGN_CENTER:2,IS_ALIGN_RIGHT:3,IS_ALIGN_JUSTIFY:4,IS_ALIGN_START:5,IS_ALIGN_END:6},Op=A.IS_BOLD|A.IS_ITALIC|A.IS_STRIKETHROUGH|A.IS_UNDERLINE|A.IS_CODE|A.IS_SUBSCRIPT|A.IS_SUPERSCRIPT|A.IS_HIGHLIGHT,$p="\xA0",Fp=`
|
|
34
|
+
`},[t,e]),m=Fe((b,_)=>{o(x=>{let E=e.length-1,R=e[E];if(R&&R.name===b){if(b==="type")return[...e.slice(0,E),{...R,value:R.value+_}];if(R.value===_)return[...e.slice(0,E),{...R,count:R.count+1}]}return[...x,{name:b,count:1,value:_}]})},[e,o]);fn(()=>{let b=x=>{if(!r)return;let E=x.key;Uc(x)?m("selectAll",""):gn.has(E)?m("press",x.key):[...E].length>1?m("keydown",x.key):m("type",x.key)},_=x=>{if(!r)return;let E=x.key;!gn.has(E)&&[...E].length>1&&m("keyup",x.key)};return t.registerRootListener((x,E)=>{E!==null&&(E.removeEventListener("keydown",b),E.removeEventListener("keyup",_)),x!==null&&(x.addEventListener("keydown",b),x.addEventListener("keyup",_))})},[t,r,m]),fn(()=>{d.current&&d.current.scrollTo(0,d.current.scrollHeight)},[p]),Oo(()=>{if(e){let b=p();b!==null&&s(b),d.current&&d.current.scrollTo(0,d.current.scrollHeight)}},[p,e]),Oo(()=>t.registerUpdateListener(({dirtyElements:_,dirtyLeaves:x,editorState:E})=>{if(!r)return;let R=E._selection,O=u.current,$=c.current;if(O!==R){if(x.size===0&&_.size===0&&!$){let S=Ao(t._window);if(S&&(S.anchorNode==null||S.focusNode==null))return}u.current=R}c.current=!1;let v=p();v!==null&&s(v)}),[t,p,r,m]),Oo(()=>r?t.registerUpdateListener(()=>{let _=t.getRootElement();_!==null&&l(_?.innerHTML)}):void 0,[t,r]);let f=Fe(b=>{r||(b.update(()=>{let _=Pc();_.clear();let x=$c();_.append(Fc().append(x)),x.select()}),o([])),n(_=>!_)},[r]),h=Fe(()=>{if(!r)return;let b=Ao(t._window);if(b===null||b.anchorNode==null||b.focusNode==null)return;let{anchorNode:_,anchorOffset:x,focusNode:E,focusOffset:R}=Gc(b),O=a().getRootElement(),$;_!==null&&($=hn(_,O));let v;E!==null&&(v=hn(E,O)),m("snapshot",{anchorNode:_,anchorOffset:x,anchorPath:$,focusNode:E,focusOffset:R,focusPath:v})},[m,r,a]),g=Fe(()=>{Bc(p())},[p]),k=Fe(()=>{Hc("test.js",p())},[p]);return[$e("button",{className:`editor-dev-button ${r?"active":""}`,id:"test-recorder-button",onClick:b=>{f(a()),b.preventDefault()},title:r?"Disable test recorder":"Enable test recorder",type:"button",children:r?"Disable test recorder":"Enable test recorder"}),r?$o("div",{className:"test-recorder-output",children:[$o("div",{className:"test-recorder-toolbar",children:[$e("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:b=>{h(),b.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),$e("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:b=>{g(),b.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),$e("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:b=>{k(),b.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),$e("pre",{id:"test-recorder",ref:d,children:i})]}):null]}var Cn=()=>{let t=Ac(3),[e]=Oc(),[o,r]=Wc(e),n;return t[0]!==o||t[1]!==r?(n=$o(xn.Fragment,{children:[$e("p",{children:"HI"}),o,r,$e("p",{children:"DONE"})]}),t[0]=o,t[1]=r,t[2]=n):n=t[2],n};var Vc=y({plugins:[{Component:Cn,position:"bottom"}]});import{c as Kc}from"react/compiler-runtime";import{jsx as Jc}from"react/jsx-runtime";import{useLexicalComposerContext as Xc}from"@lexical/react/LexicalComposerContext.js";import{TreeView as zc}from"@lexical/react/LexicalTreeView.js";import"react";var bn=()=>{let t=Kc(2),[e]=Xc(),o;return t[0]!==e?(o=Jc(zc,{editor:e,timeTravelButtonClassName:"debug-timetravel-button",timeTravelPanelButtonClassName:"debug-timetravel-panel-button",timeTravelPanelClassName:"debug-timetravel-panel",timeTravelPanelSliderClassName:"debug-timetravel-panel-slider",treeTypeButtonClassName:"debug-treetype-button",viewClassName:"tree-view-output"}),t[0]=e,t[1]=o):o=t[1],o};var Zc=y({plugins:[{Component:bn,position:"bottom"}]});import{$isTableSelection as Yc}from"@lexical/table";import{$isRangeSelection as qc,FORMAT_TEXT_COMMAND as Qc}from"lexical";import{jsx as kn}from"react/jsx-runtime";import"react";var _n=()=>kn("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:kn("path",{d:"M10.6772 15H6.27017V5.718H10.4172C12.6792 5.718 13.8492 6.602 13.8492 8.292C13.8492 9.098 13.1992 9.982 12.4712 10.216C13.3812 10.476 14.1742 11.256 14.1742 12.322C14.1742 14.09 12.9002 15 10.6772 15ZM8.46717 9.501H10.3262C11.3012 9.501 11.7042 9.046 11.7042 8.409C11.7042 7.72 11.2362 7.317 10.3392 7.317H8.46717V9.501ZM8.46717 11.061V13.401H10.4822C11.4702 13.401 11.9642 12.959 11.9642 12.218C11.9642 11.49 11.4702 11.061 10.4822 11.061H8.46717Z",fill:"currentColor"})});var te=t=>({type:"buttons",items:t,key:"format",order:40});var Tn={type:"text-format",format:["bold","italic"],tag:"***"},wn={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},En={type:"text-format",format:["bold"],tag:"**"},Sn={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var Nn=[te([{ChildComponent:_n,isActive:({selection:t})=>qc(t)||Yc(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(Qc,"bold")},order:1}])],eu=y(({featureProviderMap:t})=>{let e=[En,Sn];return t.get("italic")&&e.push(wn,Tn),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:Nn},toolbarInline:{groups:Nn}}});import{$isTableSelection as ou}from"@lexical/table";import{$isRangeSelection as ru,FORMAT_TEXT_COMMAND as nu}from"lexical";import{jsx as Ln,jsxs as tu}from"react/jsx-runtime";import"react";var yn=()=>tu("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:[Ln("path",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),Ln("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var In={type:"text-format",format:["code"],tag:"`"};var Rn=[te([{ChildComponent:yn,isActive:({selection:t})=>ru(t)||ou(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(nu,"code")},order:7}])],lu=y({enableFormats:["code"],markdownTransformers:[In],toolbarFixed:{groups:Rn},toolbarInline:{groups:Rn}});import{$isTableSelection as iu}from"@lexical/table";import{$isRangeSelection as su,FORMAT_TEXT_COMMAND as au}from"lexical";import{jsx as vn}from"react/jsx-runtime";import"react";var Mn=()=>vn("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:vn("path",{d:"M11.311 14.2969L11.0327 15H6.18408L6.4624 14.2969C7.54639 14.2969 7.70752 14.209 7.83936 13.8721L10.8423 6.45996C10.8716 6.38672 10.8862 6.32812 10.8862 6.26953C10.8862 6.09375 10.6519 6.03516 9.80225 6.03516L10.0952 5.33203H14.9438L14.6509 6.03516C13.5669 6.03516 13.4204 6.12305 13.2886 6.45996L10.2856 13.8721C10.2563 13.9453 10.2271 14.0039 10.2271 14.0625C10.2271 14.2383 10.4614 14.2969 11.311 14.2969Z",fill:"currentColor"})});var Dn={type:"text-format",format:["italic"],tag:"*"},An={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var On=[te([{ChildComponent:Mn,isActive:({selection:t})=>su(t)||iu(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(au,"italic")},order:2}])],cu=y({enableFormats:["italic"],markdownTransformers:[Dn,An],toolbarFixed:{groups:On},toolbarInline:{groups:On}});import{$isTableSelection as du}from"@lexical/table";import{$isRangeSelection as mu,FORMAT_TEXT_COMMAND as pu}from"lexical";import{jsx as Fn,jsxs as uu}from"react/jsx-runtime";import"react";var $n=()=>uu("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:[Fn("path",{d:"M5.50756 12.76H7.42756C7.56256 14.215 8.82256 14.71 10.1576 14.71C11.4326 14.71 12.4226 14.14 12.4226 13.06C12.4226 12.28 11.9576 11.845 10.6676 11.605L8.70256 11.245C7.12756 10.96 5.85256 10.21 5.85256 8.335C5.85256 6.43 7.53256 5.11 9.87256 5.11C12.4226 5.11 13.9526 6.22 14.1626 8.23H12.2876C12.1526 7.18 11.2226 6.595 9.88756 6.595C8.59756 6.595 7.78756 7.27 7.78756 8.215C7.78756 9.1 8.34256 9.385 9.49756 9.61L11.5676 10.015C13.3226 10.345 14.3726 11.215 14.3726 12.94C14.3726 14.89 12.5876 16.18 10.2176 16.18C7.66756 16.18 5.70256 15.115 5.50756 12.76Z",fill:"currentColor"}),Fn("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var Pn={type:"text-format",format:["strikethrough"],tag:"~~"};var Bn=[te([{ChildComponent:$n,isActive:({selection:t})=>mu(t)||du(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(pu,"strikethrough")},order:4}])],fu=y({enableFormats:["strikethrough"],markdownTransformers:[Pn],toolbarFixed:{groups:Bn},toolbarInline:{groups:Bn}});import{$isTableSelection as hu}from"@lexical/table";import{$isRangeSelection as gu,FORMAT_TEXT_COMMAND as xu}from"lexical";import{jsx as Hn}from"react/jsx-runtime";import"react";var jn=()=>Hn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Hn("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 13.258C16.7768 14.155 16.1398 14.532 15.2038 15C14.5538 15.325 14.2808 15.546 14.2418 15.78H16.7898V16.82H12.7208V16.339C12.7208 15.286 13.5918 14.675 14.3588 14.233C15.0868 13.83 15.4378 13.635 15.4378 13.232C15.4378 12.894 15.2038 12.686 14.8268 12.686C14.3848 12.686 14.1248 13.024 14.1118 13.427H12.7468C12.8248 12.426 13.5528 11.633 14.8398 11.633C15.9448 11.633 16.7768 12.257 16.7768 13.258Z",fill:"currentColor"})});var Un=[te([{ChildComponent:jn,isActive:({selection:t})=>gu(t)||hu(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(xu,"subscript")},order:5}])],Cu=y({enableFormats:["subscript"],toolbarFixed:{groups:Un},toolbarInline:{groups:Un}});import{$isTableSelection as bu}from"@lexical/table";import{$isRangeSelection as ku,FORMAT_TEXT_COMMAND as _u}from"lexical";import{jsx as Gn}from"react/jsx-runtime";import"react";var Wn=()=>Gn("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:Gn("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 7.252C16.7768 8.149 16.1398 8.526 15.2038 8.994C14.5538 9.319 14.2808 9.54 14.2418 9.774H16.7898V10.814H12.7208V10.333C12.7208 9.28 13.5918 8.669 14.3588 8.227C15.0868 7.824 15.4378 7.629 15.4378 7.226C15.4378 6.888 15.2038 6.68 14.8268 6.68C14.3848 6.68 14.1248 7.018 14.1118 7.421H12.7468C12.8248 6.42 13.5528 5.627 14.8398 5.627C15.9448 5.627 16.7768 6.251 16.7768 7.252Z",fill:"currentColor"})});var Vn=[te([{ChildComponent:Wn,isActive:({selection:t})=>ku(t)||bu(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(_u,"superscript")},order:6}])],Tu=y({enableFormats:["superscript"],toolbarFixed:{groups:Vn},toolbarInline:{groups:Vn}});import{$isTableSelection as Eu}from"@lexical/table";import{$isRangeSelection as Su,FORMAT_TEXT_COMMAND as Nu}from"lexical";import{jsx as Kn,jsxs as wu}from"react/jsx-runtime";import"react";var Jn=()=>wu("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:[Kn("path",{d:"M13.9656 11.256C13.9656 13.791 12.5096 15.156 10.0006 15.156C7.50461 15.156 6.03561 13.791 6.03561 11.23V5.718H7.76461V11.243C7.76461 12.868 8.50561 13.778 10.0006 13.778C11.4956 13.778 12.2496 12.868 12.2496 11.243V5.718H13.9656V11.256Z",fill:"currentColor"}),Kn("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var Xn=[te([{ChildComponent:Jn,isActive:({selection:t})=>Su(t)||Eu(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(Nu,"underline")},order:3}])],Lu=y({enableFormats:["underline"],toolbarFixed:{groups:Xn},toolbarInline:{groups:Xn}});import{jsx as Ho}from"react/jsx-runtime";import{jsx as yu}from"react/jsx-runtime";function Iu(t){return t.replace(/-([a-z])/g,(e,o)=>o.toUpperCase())}var zt=({css:t})=>{let e=t?Object.fromEntries(Object.entries(t).map(([o,r])=>[Iu(o),r])):{};return yu("span",{style:{...e,alignItems:"center",borderRadius:"4px",display:"flex",fontSize:"16px",height:"20px",justifyContent:"center",width:"20px"},children:"A"})};import{useLexicalComposerContext as Ru}from"@lexical/react/LexicalComposerContext";import{$forEachSelectedTextNode as vu}from"@lexical/selection";import{$getNodeByKey as Mu,$getState as Du,$setState as Au,createState as Ou,TextNode as Fu}from"lexical";import{useEffect as $u}from"react";var Po=new Map;function zn(t){for(let e in t){let o=t[e],r=Ou(e,{parse:n=>typeof n=="string"&&Object.keys(o).includes(n)?n:void 0});Po.set(e,{stateConfig:r,stateValues:o})}}function Bo(t,e,o){t.update(()=>{vu(r=>{let n=Po.get(e);if(!n)throw new Error(`State config for ${e} not found`);Au(r,n.stateConfig,o)})})}function Zn(){let[t]=Ru();return $u(()=>t.registerMutationListener(Fu,e=>{t.getEditorState().read(()=>{for(let[o,r]of e){if(r==="destroyed")continue;let n=Mu(o),l=t.getElementByKey(o);if(!n||!l)continue;let i=Object.create(null);Po.forEach((s,u)=>{let c=Du(n,s.stateConfig);if(!c){delete l.dataset[u];return}l.dataset[u]=c;let d=s.stateValues[c]?.css;d&&Object.assign(i,d)}),l.style.cssText="",Object.assign(l.style,i)}})}),[t]),null}var Yn=t=>{let e=[];for(let r in t.state){let n=t.state[r];for(let l in n){let i=n[l];e.push({ChildComponent:()=>Ho(zt,{css:i.css}),key:l,label:i.label,onSelect:({editor:s})=>{Bo(s,r,l)}})}}return[{type:"dropdown",ChildComponent:()=>Ho(zt,{css:{color:"var(--theme-elevation-600)"}}),items:[...[{ChildComponent:()=>Ho(zt,{}),key:"clear-style",label:"Default style",onSelect:({editor:r})=>{for(let n in t.state)Bo(r,n,void 0)},order:1}],...e],key:"textState",order:30}]},Pu=y(({props:t})=>(zn(t.state),{plugins:[{Component:Zn,position:"normal"}],toolbarFixed:{groups:Yn(t)},toolbarInline:{groups:Yn(t)}}));import{$createHeadingNode as Uu,$isHeadingNode as dl,HeadingNode as Gu}from"@lexical/rich-text";import{$setBlocksType as Wu}from"@lexical/selection";import{$getSelection as Vu,$isRangeSelection as Ku}from"lexical";import{jsx as qn}from"react/jsx-runtime";import"react";var Qn=()=>qn("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:qn("path",{d:"M4.639 13.5V7.074H6.196V9.648H9.076V7.074H10.642V13.5H9.076V10.836H6.196V13.5H4.639ZM11.5656 9.045V8.019C12.6636 8.019 13.1316 7.731 13.2846 7.065H14.4006V13.5H12.8436V9.045H11.5656Z",fill:"currentColor"})});import{jsx as el}from"react/jsx-runtime";import"react";var tl=()=>el("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:el("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM15.9796 8.973C15.9796 10.116 15.1696 10.656 14.0356 11.232C13.2256 11.646 12.8206 11.943 12.7846 12.294H15.9886V13.5H11.0566V12.951C11.0566 11.601 12.1636 10.845 13.1176 10.287C14.0356 9.756 14.5126 9.486 14.5126 8.946C14.5126 8.46 14.2156 8.145 13.6306 8.145C13.0186 8.145 12.6586 8.613 12.6226 9.198H11.1196C11.2186 7.947 12.1006 6.966 13.6396 6.966C15.0346 6.966 15.9796 7.785 15.9796 8.973Z",fill:"currentColor"})});import{jsx as ol}from"react/jsx-runtime";import"react";var rl=()=>ol("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:ol("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM16.1146 11.745C16.1146 12.744 15.2236 13.608 13.6126 13.608C12.0736 13.608 11.0926 12.762 10.9846 11.547H12.4696C12.5146 12.114 13.0006 12.456 13.6126 12.456C14.2876 12.456 14.6746 12.132 14.6746 11.619C14.6746 11.061 14.2426 10.836 13.6216 10.836H12.9826V9.738H13.6036C14.1526 9.738 14.5486 9.486 14.5486 8.937C14.5486 8.46 14.2156 8.127 13.6486 8.127C13.0366 8.127 12.6586 8.514 12.6226 9.045H11.1916C11.2726 7.929 12.1276 6.966 13.6666 6.966C15.1876 6.966 15.9706 7.848 15.9706 8.865C15.9706 9.603 15.5026 10.143 14.8186 10.269C15.6196 10.404 16.1146 10.971 16.1146 11.745Z",fill:"currentColor"})});import{jsx as nl}from"react/jsx-runtime";import"react";var ll=()=>nl("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:nl("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM15.1736 7.074V10.854H16.3706V12.033H15.1736V13.5H13.6796V12.033H10.5116V10.845L13.4996 7.074H15.1736ZM13.6796 8.46L11.8256 10.854H13.6796V8.46Z",fill:"currentColor"})});import{jsx as il}from"react/jsx-runtime";import"react";var sl=()=>il("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:il("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.1576 10.269C12.6896 10.269 12.3746 10.494 12.2216 10.737H10.8176L11.1956 7.074H15.2546V8.28H12.3206L12.1856 9.549C12.4016 9.351 12.8516 9.126 13.4636 9.126C14.7866 9.126 15.6596 10.053 15.6596 11.358C15.6596 12.609 14.7326 13.608 13.1756 13.608C11.5826 13.608 10.6556 12.753 10.5566 11.511H12.1136C12.1586 12.06 12.5456 12.465 13.1576 12.465C13.8236 12.465 14.1746 11.97 14.1746 11.376C14.1746 10.764 13.8416 10.269 13.1576 10.269Z",fill:"currentColor"})});import{jsx as al}from"react/jsx-runtime";import"react";var cl=()=>al("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:al("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.3646 8.127C12.5456 8.127 12.0416 8.937 12.0416 9.999C12.3296 9.54 12.8246 9.207 13.5536 9.207C14.8586 9.207 15.8036 10.134 15.8036 11.376C15.8036 12.645 14.8226 13.608 13.3196 13.608C11.7266 13.608 10.6196 12.393 10.6196 10.395C10.6196 8.316 11.7716 6.966 13.4186 6.966C14.7056 6.966 15.5786 7.749 15.7316 8.829H14.3186C14.2016 8.415 13.9226 8.127 13.3646 8.127ZM13.3106 12.51C13.9586 12.51 14.3816 12.042 14.3816 11.385C14.3816 10.737 13.9586 10.278 13.3106 10.278C12.6536 10.278 12.2126 10.737 12.2126 11.385C12.2126 12.042 12.6536 12.51 13.3106 12.51Z",fill:"currentColor"})});import{$createHeadingNode as Bu,$isHeadingNode as Hu,HeadingNode as ju}from"@lexical/rich-text";var jo=t=>(e,o,r)=>{let n=t(r);n&&(n.append(...o),e.replace(n),n.select(0,0))};var ul=t=>{let o=`^(${t.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`,r=new RegExp(o);return{type:"element",dependencies:[ju],export:(n,l)=>{if(!Hu(n))return null;let i=Number(n.getTag().slice(1));return"#".repeat(i)+" "+l(n)},regExp:r,replace:jo(n=>{let l="h"+n[1]?.length;return Bu(l)})}};var ml=t=>{let e=Vu();Wu(e,()=>Uu(t))},pl={h1:Qn,h2:tl,h3:rl,h4:ll,h5:sl,h6:cl},Ju=y(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[le(e.map((r,n)=>({ChildComponent:pl[r],isActive:({selection:l})=>{if(!Ku(l))return!1;for(let i of l.getNodes()){if(dl(i)&&i.getTag()===r)continue;let s=i.getParent();if(!(dl(s)&&s.getTag()===r))return!1}return!0},key:r,label:({i18n:l})=>l.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:l})=>{l.update(()=>{ml(r)})},order:n+2})))];return{markdownTransformers:[ul(e)],nodes:[Gu],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[ee(e.map(r=>({Icon:pl[r],key:`heading-${r.charAt(1)}`,keywords:["heading",r],label:({i18n:n})=>n.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:n})=>{n.update(()=>{ml(r)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}});import{$isNodeSelection as cd}from"lexical";import{jsx as fl}from"react/jsx-runtime";import"react";var Uo=()=>fl("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:fl("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as hl,jsxs as Xu}from"react/jsx-runtime";import"react";var gl=()=>Xu("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[hl("path",{d:"M5 10h10",stroke:"currentColor"}),hl("path",{d:"M10 15V5",stroke:"currentColor"})]});var ke=t=>({type:"dropdown",ChildComponent:gl,items:t,key:"add",order:10});import{addClassNamesToElement as zu}from"@lexical/utils";import{$applyNodeReplacement as Zu,createCommand as Yu,DecoratorNode as qu}from"lexical";var xt=Yu("INSERT_HORIZONTAL_RULE_COMMAND"),gt=class extends qu{static clone(e){return new this(e.__key)}static getType(){return"horizontalrule"}static importDOM(){return{hr:()=>({conversion:Qu,priority:0})}}static importJSON(e){return xl()}createDOM(e){let o=document.createElement("hr");return zu(o,e.theme.hr),o}decorate(){return null}exportDOM(){return{element:document.createElement("hr")}}exportJSON(){return{type:"horizontalrule",version:1}}getTextContent(){return`
|
|
35
|
+
`}isInline(){return!1}updateDOM(){return!1}};function Qu(){return{node:xl()}}function xl(){return Zu(new gt)}import{$applyNodeReplacement as ed}from"lexical";import"react";var ve=class extends gt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return Ct()}decorate(){return null}exportJSON(){return super.exportJSON()}};function Ct(){return ed(new ve)}function Zt(t){return t instanceof ve}var Cl={type:"element",dependencies:[ve],export:(t,e)=>Zt(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=Ct();e&&t.replace(e)}};import{c as td}from"react/compiler-runtime";import{useLexicalComposerContext as od}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as rd}from"@lexical/utils";import{$getSelection as nd,$isRangeSelection as ld,COMMAND_PRIORITY_EDITOR as id}from"lexical";import{useEffect as sd}from"react";var bl=()=>{let t=td(3),[e]=od(),o,r;return t[0]!==e?(o=()=>e.registerCommand(xt,ad,id),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),sd(o,r),null};function ad(t){let e=nd();if(!ld(e))return!1;if(e.focus.getNode()!==null){let r=Ct();rd(r)}return!0}var ud=y({markdownTransformers:[Cl],nodes:[ve],plugins:[{Component:bl,position:"normal"}],slashMenu:{groups:[ee([{Icon:Uo,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(xt,void 0)}}])]},toolbarFixed:{groups:[ke([{ChildComponent:Uo,isActive:({selection:t})=>{if(!cd(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Zt(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(xt,void 0)}}])]}});import{$findMatchingParent as Il}from"@lexical/utils";import{$isElementNode as wd,INDENT_CONTENT_COMMAND as Ed,OUTDENT_CONTENT_COMMAND as Sd}from"lexical";import{jsx as Yt,jsxs as dd}from"react/jsx-runtime";import"react";var kl=()=>dd("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:[Yt("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),Yt("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),Yt("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Yt("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as qt,jsxs as md}from"react/jsx-runtime";import"react";var _l=()=>md("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:[qt("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),qt("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),qt("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),qt("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});import{jsx as pd}from"react/jsx-runtime";import{useLexicalComposerContext as fd}from"@lexical/react/LexicalComposerContext";import{TabIndentationPlugin as hd}from"@lexical/react/LexicalTabIndentationPlugin";import{$findMatchingParent as gd,mergeRegister as Tl}from"@lexical/utils";import{$getSelection as xd,$isElementNode as Nl,$isRangeSelection as Cd,COMMAND_PRIORITY_LOW as wl,INDENT_CONTENT_COMMAND as El,KEY_TAB_COMMAND as bd,OUTDENT_CONTENT_COMMAND as kd,TabNode as _d}from"lexical";import{useEffect as Sl}from"react";var Ll=({clientProps:t})=>{let[e]=fd(),{disabledNodes:o,disableTabNode:r}=t;return Sl(()=>{if(!(!e||!o?.length))return Tl(e.registerCommand(El,()=>Td(n=>{if(!o.includes(n.getType())){let l=n.getIndent();n.setIndent(l+1)}}),wl),e.registerUpdateListener(({dirtyElements:n,editorState:l})=>{e.update(()=>{for(let[i]of n){let s=l._nodeMap.get(i);Nl(s)&&o.includes(s.getType())&&s.getIndent()>0&&s.setIndent(0)}})}))},[e,o]),Sl(()=>{if(!(!e||!r))return Tl(e.registerCommand(bd,n=>(n.preventDefault(),e.dispatchCommand(n.shiftKey?kd:El,void 0)),wl),e.registerNodeTransform(_d,n=>{n.remove()}))},[e,r]),pd(hd,{})};function Td(t){let e=xd();if(!Cd(e))return!1;let o=new Set,r=e.getNodes();for(let n=0;n<r.length;n++){let l=r[n],i=l.getKey();if(o.has(i))continue;let s=gd(l,c=>Nl(c)&&!c.isInline());if(s===null)continue;let u=s.getKey();s.canIndent()&&!o.has(u)&&(o.add(u),t(s))}return o.size>0}var yl=t=>({type:"buttons",items:t,key:"indent",order:35});var Rl=({disabledNodes:t})=>[yl([{ChildComponent:kl,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>vl(n)&&n.getIndent()>0;return o.some(n=>r(n)||!!Il(n,r))},key:"indentDecrease",label:({i18n:e})=>e.t("lexical:indent:decreaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Sd,void 0)},order:1},{ChildComponent:_l,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>vl(n)&&!(t??[]).includes(n.getType());return o.some(n=>r(n)||!!Il(n,r))},key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Ed,void 0)},order:2}])],Nd=y(({props:t})=>{let e=t.disabledNodes??[];return{plugins:[{Component:Ll,position:"normal"}],sanitizedClientFeatureProps:t,toolbarFixed:{groups:Rl({disabledNodes:e})},toolbarInline:{groups:Rl({disabledNodes:e})}}}),vl=t=>wd(t)&&t.canIndent();import{$findMatchingParent as Pm}from"@lexical/utils";import{$getSelection as Yo,$isRangeSelection as ai}from"lexical";import{jsx as Ml}from"react/jsx-runtime";import"react";var Dl=()=>Ml("svg",{"aria-hidden":"true",className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Ml("path",{d:"M8.5 11.5L11.5 8.5M8.5 7L9.625 5.875C10.868 4.633 12.882 4.633 14.125 5.875C15.368 7.118 15.368 9.133 14.125 10.375L13 11.5M7 8.5L5.746 9.754C4.56 10.94 4.519 12.85 5.652 14.087C6.814 15.354 8.78 15.449 10.058 14.298L11.5 13",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})});import{$isAtNodeEnd as Al}from"@lexical/selection";function ze(t){let{anchor:e}=t,{focus:o}=t,r=t.anchor.getNode(),n=t.focus.getNode();return r===n?r:t.isBackward()?Al(o)?r:n:Al(e)?r:n}var Go=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as $d}from"lexical";import{addClassNamesToElement as Ld,isHTMLAnchorElement as yd}from"@lexical/utils";import Ko from"bson-objectid";import{$applyNodeReplacement as Id,$createTextNode as Ol,$getSelection as Rd,$isElementNode as Fl,$isRangeSelection as Vo,createCommand as vd,ElementNode as Md}from"lexical";var Dd=new Set(["http:","https:","mailto:","sms:","tel:"]),ie=class t extends Md{__fields;__id;constructor({id:e,fields:o={linkType:"custom",newTab:!1},key:r}){super(r),this.__fields=o,this.__id=e}static clone(e){return new t({id:e.__id,fields:e.__fields,key:e.__key})}static getType(){return"link"}static importDOM(){return{a:e=>({conversion:Ad,priority:1})}}static importJSON(e){let o=_e({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),e.version===2&&!e.id&&(e.id=new Ko.default().toHexString(),e.version=3),o}canBeEmpty(){return!1}canInsertTextAfter(){return!1}canInsertTextBefore(){return!1}createDOM(e){let o=document.createElement("a");return this.__fields?.linkType==="custom"&&(o.href=this.sanitizeUrl(this.__fields.url??"")),(this.__fields?.newTab??!1)&&(o.target="_blank"),this.__fields?.newTab===!0&&this.__fields?.linkType==="custom"&&(o.rel=Wo(o.rel,"add","noopener")),Ld(o,e.theme.link),o}exportJSON(){let e=this.getFields();e?.linkType==="internal"?delete e.url:e?.linkType==="custom"&&delete e.doc;let o={...super.exportJSON(),type:"link",fields:e,version:3},r=this.getID();return r&&(o.id=r),o}extractWithChild(e,o,r){if(!Vo(o))return!1;let n=o.anchor.getNode(),l=o.focus.getNode();return this.isParentOf(n)&&this.isParentOf(l)&&o.getTextContent().length>0}getFields(){return this.getLatest().__fields}getID(){return this.getLatest().__id}insertNewAfter(e,o=!0){let r=this.getParentOrThrow().insertNewAfter(e,o);if(Fl(r)){let n=_e({fields:this.__fields});return r.append(n),n}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!Dd.has(o.protocol))return"about:blank"}catch{return"https://"}return e}setFields(e){let o=this.getWritable();return o.__fields=e,o}setID(e){let o=this.getWritable();return o.__id=e,o}updateDOM(e,o,r){let n=this.__fields?.url,l=this.__fields?.newTab;return n!=null&&n!==e.__fields?.url&&this.__fields?.linkType==="custom"&&(o.href=n),this.__fields?.linkType==="internal"&&e.__fields?.linkType==="custom"&&o.removeAttribute("href"),o.rel==null&&(o.rel=""),l!==e.__fields?.newTab&&(l??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=Wo(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=Wo(o.rel,"remove","noopener"))),!1}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields).setID(e.id)}};function Ad(t){let e=null;if(yd(t)){let o=t.textContent;o!==null&&o!==""&&(e=_e({id:new Ko.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function _e({id:t,fields:e}){return Id(new ie({id:t??new Ko.default().toHexString(),fields:e}))}function Z(t){return t instanceof ie}var he=vd("TOGGLE_LINK_COMMAND");function Jo(t){let e=Rd();if(!Vo(e)&&(t===null||!t.selectedNodes?.length))return;let o=Vo(e)?e.extract():t===null?[]:t.selectedNodes;if(t===null){o?.forEach(l=>{let i=l.getParent();Z(i)&&(i.getChildren().forEach(u=>{i.insertBefore(u)}),i.remove())});return}if(o?.length===1){let l=o[0],i=Z(l)?l:Od(l);if(i!==null){i.setFields(t.fields),t.text!=null&&t.text!==i.getTextContent()&&(i.append(Ol(t.text)),i.getChildren().forEach(s=>{s!==i.getLastChild()&&s.remove()}));return}}let r=null,n=null;o?.forEach(l=>{let i=l.getParent();if(!(i===n||i===null||Fl(l)&&!l.isInline())){if(Z(i)){n=i,i.setFields(t.fields),t.text!=null&&t.text!==i.getTextContent()&&(i.append(Ol(t.text)),i.getChildren().forEach(s=>{s!==i.getLastChild()&&s.remove()}));return}if(i.is(r)||(r=i,n=_e({fields:t.fields}),Z(i)?l.getPreviousSibling()===null?i.insertBefore(n):i.insertAfter(n):l.insertBefore(n)),Z(l)){if(l.is(n))return;if(n!==null){let s=l.getChildren();n.append(...s)}l.remove();return}n!==null&&n.append(l)}})}function Od(t){return Fd(t,e=>Z(e))}function Fd(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function Wo(t,e,o){let r,n=`${t}`;if(e==="add"){if(n.includes(o)){let l=new RegExp(o,"g");n=n.replace(l,"").trim()}n=n.trim(),r=n.length===0?`${o}`:`${n} ${o}`}else{let l=new RegExp(o,"g");r=n.replace(l,"").trim()}return r}var $l={type:"text-match",dependencies:[ie],export:(t,e)=>{if(!Z(t))return null;let o=t,{url:r}=o.getFields();return`[${e(o)}](${r})`},importRegExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:(t,e)=>{let[,o,r]=e,n=_e({fields:{doc:null,linkType:"custom",newTab:!1,url:r}}),l=$d(o);return l.setFormat(t.getFormat()),n.append(l),t.replace(n),l},trigger:")"};import{$applyNodeReplacement as Pd,$isElementNode as Bd}from"lexical";var Te=class t extends ie{static clone(e){return new t({id:"",fields:e.__fields,key:e.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(e){let o=bt({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),o}exportJSON(){let e=super.exportJSON();return{type:"autolink",children:e.children,direction:e.direction,fields:e.fields,format:e.format,indent:e.indent,version:2}}insertNewAfter(e,o=!0){let r=this.getParentOrThrow().insertNewAfter(e,o);if(Bd(r)){let n=bt({fields:this.__fields});return r.append(n),n}return null}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields)}};function bt({fields:t}){return Pd(new Te({id:"",fields:t}))}function we(t){return t instanceof Te}import{c as Hd}from"react/compiler-runtime";import{useLexicalComposerContext as jd}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Ud}from"@lexical/utils";import{$createTextNode as Pl,$getSelection as Gd,$isElementNode as Hl,$isLineBreakNode as jl,$isNodeSelection as Wd,$isRangeSelection as Vd,$isTextNode as kt,TextNode as Kd}from"lexical";import{useEffect as Jd}from"react";function Bl(t,e=o=>o){return o=>{let r=t.exec(o);return r===null?null:{index:r.index,length:r[0].length,text:r[0],url:e(r[0])}}}function Ul(t,e){for(let o of e){let r=o(t);if(r!=null)return r}return null}var Xd=/[.,;\s]/;function eo(t){return t!==void 0&&Xd.test(t)}function Gl(t){return eo(t[t.length-1])}function zo(t){return eo(t[0])}function zd(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function Wl(t){let e=t.getPreviousSibling();return Hl(e)&&(e=e.getLastDescendant()),e===null||jl(e)||kt(e)&&Gl(e.getTextContent())}function Vl(t){let e=t.getNextSibling();return Hl(e)&&(e=e.getFirstDescendant()),e===null||jl(e)||kt(e)&&zo(e.getTextContent())}function Zd(t,e,o,r){return(t>0?eo(o[t-1]):Wl(r[0]))?e<o.length?eo(o[e]):Vl(r[r.length-1]):!1}function Yd(t,e,o){let r=[],n=[],l=[],i=0,s=0,u=[...t];for(;u.length>0;){let c=u[0],a=c.getTextContent().length,p=s;s+a<=e?(r.push(c),i+=a):p>=o?l.push(c):n.push(c),s+=a,u.shift()}return[i,r,n,l]}function qd(t,e,o,r){let n={linkType:"custom",url:r.url,...r.fields},l=bt({fields:n});if(t.length===1){let i=t[0],s;if(e===0?[s]=i.splitText(o):[,s]=i.splitText(e,o),s){let u=Pl(r.text);u.setFormat(s.getFormat()),u.setDetail(s.getDetail()),u.setStyle(s.getStyle()),l.append(u),s.replace(l)}return i}else if(t.length>1){let i=t[0],s=i.getTextContent().length,u;e===0?u=i:[,u]=i.splitText(e);let c=[],d;if(t.forEach(a=>{let m=a.getTextContent().length,f=s,h=s+m;if(f<o)if(h<=o)c.push(a);else{let[g,k]=a.splitText(o-f);g&&c.push(g),d=k}s+=m}),u){let a=Gd(),p=a?a.getNodes().find(kt):void 0,m=Pl(u.getTextContent());return m.setFormat(u.getFormat()),m.setDetail(u.getDetail()),m.setStyle(u.getStyle()),l.append(m,...c),p&&p===u&&(Vd(a)?m.select(a.anchor.offset,a.focus.offset):Wd(a)&&m.select(0,m.getTextContent().length)),u.replace(l),d}}}function Qd(t,e,o){let r=[...t],n=r.map(u=>u.getTextContent()).join(""),l=n,i,s=0;for(;(i=Ul(l,e))!=null&&i!==null;){let u=i.index,c=i.length,d=u+c;if(Zd(s+u,s+d,n,r)){let[p,,m,f]=Yd(r,s+u,s+d),h=s+u-p,g=s+d-p,k=qd(m,h,g,i);r=k?[k,...f]:f,o(i.url,null),s=0}else s+=d;l=l.substring(d)}}function Xo(t,e,o){let r=t.getChildren(),n=r.length;for(let u=0;u<n;u++){let c=r[u];if(!kt(c)||!c.isSimpleText()){Qt(t),o(null,t.getFields()?.url??null);return}}let l=t.getTextContent(),i=Ul(l,e);if(i===null||i.text!==l){Qt(t),o(null,t.getFields()?.url??null);return}if(!Wl(t)||!Vl(t)){Qt(t),o(null,t.getFields()?.url??null);return}let s=t.getFields()?.url;if(s!==i?.url){let u=t.getFields();u.url=i?.url,t.setFields(u),o(i.url,s??null)}}function em(t,e,o){let r=t.getPreviousSibling(),n=t.getNextSibling(),l=t.getTextContent();if(we(r)){let i=r.getFields()?.url?r.getFields()?.url?.startsWith("mailto:")??!1:!1;(!zo(l)||zd(l,i))&&(r.append(t),Xo(r,e,o),o(null,r.getFields()?.url??null))}we(n)&&!Gl(l)&&(Qt(n),Xo(n,e,o),o(null,n.getFields()?.url??null))}function Qt(t){let e=t.getChildren(),o=e.length;for(let r=o-1;r>=0;r--)t.insertAfter(e[r]);return t.remove(),e.map(r=>r.getLatest())}function tm(t){let e=[t],o=t.getNextSibling();for(;o!==null&&kt(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function om(t,e,o){let r=Hd(5),n,l;r[0]!==t||r[1]!==e||r[2]!==o?(n=()=>{if(!t.hasNodes([Te]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let i=(s,u)=>{o?.(s,u)};return Ud(t.registerNodeTransform(Kd,s=>{let u=s.getParentOrThrow(),c=s.getPreviousSibling();if(we(u))Xo(u,e,i);else if(!Z(u)){if(s.isSimpleText()&&(zo(s.getTextContent())||!we(c))){let d=tm(s);Qd(d,e,i)}em(s,e,i)}}))},l=[t,e,o],r[0]=t,r[1]=e,r[2]=o,r[3]=n,r[4]=l):(n=r[3],l=r[4]),Jd(n,l)}var rm=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,nm=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,lm=[Bl(rm,t=>t.startsWith("http")?t:`https://${t}`),Bl(nm,t=>`mailto:${t}`)],Kl=()=>{let[t]=jd();return om(t,lm),null};import{jsx as im}from"react/jsx-runtime";import{ClickableLinkPlugin as sm}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var Jl=()=>im(sm,{});import{jsx as Sm}from"react/jsx-runtime";import"react";import{createPortal as Nm}from"react-dom";import{jsx as Ee,jsxs as _t,Fragment as cm}from"react/jsx-runtime";import{useLexicalComposerContext as um}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as Xl,mergeRegister as zl}from"@lexical/utils";import{getTranslation as Zo}from"@payloadcms/translations";import{CloseMenuIcon as dm,EditIcon as mm,ExternalLinkIcon as Zl,formatDrawerSlug as pm,useConfig as fm,useEditDepth as hm,useLocale as gm,useTranslation as xm}from"@payloadcms/ui";import{requests as Cm}from"@payloadcms/ui/shared";import{$getSelection as Yl,$isLineBreakNode as bm,$isRangeSelection as ql,COMMAND_PRIORITY_HIGH as km,COMMAND_PRIORITY_LOW as Ql,getDOMSelection as _m,KEY_ESCAPE_COMMAND as Tm,SELECTION_CHANGE_COMMAND as wm}from"lexical";import ei,{useCallback as ti,useEffect as ro,useRef as Em,useState as Pe}from"react";function to(t,e,o,r=10,n=5){let l=o.parentElement;if(t===null||l==null){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let i=e.getBoundingClientRect(),s=o.getBoundingClientRect(),u=l.getBoundingClientRect(),c=t.top-r,d=t.left-n;c<u.top&&(c+=i.height+t.height+r*2),d+i.width>u.right&&(d=u.right-i.width-n),c-=s.top,d-=s.left,e.style.opacity="1",e.style.transform=`translate(${d}px, ${c}px)`}import{createCommand as am}from"lexical";var oo=am("TOGGLE_LINK_WITH_MODAL_COMMAND");function oi(t){t.preventDefault()}function ri({anchorElem:t}){let[e]=um(),[o,r]=Pe(),n=Em(null),[l,i]=Pe(null),[s,u]=Pe(null),{fieldProps:{schemaPath:c},uuid:d}=j(),{config:a,getEntityConfig:p}=fm(),{i18n:m,t:f}=xm(),[h,g]=Pe(),k=hm(),[T,I]=Pe(!1),[b,_]=Pe([]),x=gm(),[E,R]=Pe(!1),O=pm({slug:"lexical-rich-text-link-"+d,depth:k}),{toggleDrawer:$}=xe(O),v=ti(()=>{I(!1),n&&n.current&&(n.current.style.opacity="0",n.current.style.transform="translate(-10000px, -10000px)"),R(!1),i(null),u(null),_([]),g(void 0)},[I,i,u,_]),S=ti(()=>{let C=Yl(),N;if(!ql(C)||!C){v();return}let M=ze(C);N=e.getElementByKey(M.getKey())?.getBoundingClientRect();let L=Xl(M,Z),D=C.getNodes().filter(V=>!bm(V)).find(V=>{let U=Xl(V,Z);return L&&!L.is(U)||U&&!U.is(L)});if(L==null||D){v();return}r(L);let w=L.getFields(),F={...w,id:L.getID(),text:L.getTextContent()};if(w?.linkType==="custom")i(w?.url??null),u(null);else{i(`${a.routes.admin==="/"?"":a.routes.admin}/collections/${w?.doc?.relationTo}/${w?.doc?.value}`);let V=w?.doc?.relationTo?p({collectionSlug:w?.doc?.relationTo}):void 0;if(!V)u(w?.label?String(w?.label):null),i(w?.url?String(w?.url):null);else{let U=typeof w.doc?.value=="object"?w.doc.value.id:w.doc?.value,oe=w.doc?.relationTo;if(!U||!oe)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let ue=f("fields:linkedTo",{label:`${Zo(V.labels.singular,m)} - ${f("lexical:link:loadingWithEllipsis",m)}`}).replace(/<[^>]*>?/g,"");u(ue),Cm.get(`${a.serverURL}${a.routes.api}/${oe}/${U}`,{headers:{"Accept-Language":m.language},params:{depth:0,locale:x?.code}}).then(async q=>{if(!q.ok)throw new Error(`HTTP error! Status: ${q.status}`);let K=await q.json(),re=V?.admin?.useAsTitle||"id",ne=K[re],se=f("fields:linkedTo",{label:`${Zo(V.labels.singular,m)} - ${ne}`}).replace(/<[^>]*>?/g,"");u(se)}).catch(()=>{let q=f("fields:linkedTo",{label:`${Zo(V.labels.singular,m)} - ${f("general:untitled",m)} - ID: ${U}`}).replace(/<[^>]*>?/g,"");u(q)})}}g(F),I(!0),_(C?C?.getNodes():[]),we(L)?R(!0):R(!1);let H=n.current,W=_m(e._window),{activeElement:Y}=document;if(H===null)return;let We=e.getRootElement();return W!==null&&We!==null&&We.contains(W.anchorNode)?(N||(N=W.getRangeAt(0).getBoundingClientRect()),N!=null&&(N.y+=40,to(N,H,t))):(Y==null||Y.className!=="link-input")&&(We!==null&&to(null,H,t),i(null),u(null)),!0},[e,v,a.routes.admin,a.routes.api,a.serverURL,p,f,m,x?.code,t]);return ro(()=>zl(e.registerCommand(oo,C=>(e.dispatchCommand(he,C),S(),$(),!0),Ql)),[e,S,$,O]),ro(()=>{let C=t.parentElement,N=()=>{e.getEditorState().read(()=>{S()})};return window.addEventListener("resize",N),C?.addEventListener("scroll",N),()=>{window.removeEventListener("resize",N),C?.removeEventListener("scroll",N)}},[t.parentElement,e,S]),ro(()=>zl(e.registerUpdateListener(({editorState:C})=>{C.read(()=>{S()})}),e.registerCommand(wm,()=>(S(),!0),Ql),e.registerCommand(Tm,()=>T?(v(),!0):!1,km)),[e,S,T,v]),ro(()=>{e.getEditorState().read(()=>{S()})},[e,S]),_t(ei.Fragment,{children:[Ee("div",{className:"link-editor",ref:n,children:_t("div",{className:"link-input",children:[l&&l.length>0?_t("a",{href:l,rel:"noopener noreferrer",target:"_blank",children:[o?.__fields.newTab?Ee(Zl,{}):null,s!=null&&s.length>0?s:l]}):s!=null&&s.length>0?_t(cm,{children:[o?.__fields.newTab?Ee(Zl,{}):null,Ee("span",{className:"link-input__label-pure",children:s})]}):null,e.isEditable()&&_t(ei.Fragment,{children:[Ee("button",{"aria-label":"Edit link",className:"link-edit",onClick:C=>{C.preventDefault(),$()},onMouseDown:oi,tabIndex:0,type:"button",children:Ee(mm,{})}),!E&&Ee("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(he,null)},onMouseDown:oi,tabIndex:0,type:"button",children:Ee(dm,{})})]})]})}),Ee(at,{className:"lexical-link-edit-drawer",data:h,drawerSlug:O,drawerTitle:f("fields:editLink"),featureKey:"link",handleDrawerSubmit:(C,N)=>{let M=N,L={...M};delete L.text,e.update(()=>{let D=Yl(),w=null;if(ql(D)?w=ze(D).getParent():b.length&&(w=b[0]?.getParent()??null),w&&we(w)){let F=_e({fields:L});w.replace(F,!0)}}),e.dispatchCommand(he,{fields:L,selectedNodes:b,text:M.text})},schemaPath:c,schemaPathSuffix:"fields"})]})}var ni=t=>{let{anchorElem:e=document.body}=t;return Nm(Sm(ri,{anchorElem:e}),e)};import{c as Im}from"react/compiler-runtime";import{useLexicalComposerContext as Rm}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as vm}from"@lexical/utils";import{$getSelection as Mm,$isElementNode as Dm,$isRangeSelection as Am,COMMAND_PRIORITY_LOW as ii,PASTE_COMMAND as Om}from"lexical";import{useEffect as Fm}from"react";var Lm=/^(?:[a-zA-Z][a-zA-Z\d+.-]*:(?:\/\/)?(?:[-;:&=+$,\w]+@)?[A-Za-z\d]+(?:\.[A-Za-z\d]+)+|www\.[A-Za-z\d]+(?:\.[A-Za-z\d]+)+|(?:tel|mailto):[\w+.-]+)(?:\/[+~%/\w-]*)?(?:\?[-;&=%\w]*)?(?:#\w+)?$/,ym=/^(?:\/[\w\-./]*(?:#\w[\w-]*)?|#[\w\-]+)$/;function li(t){if(!t)return!1;if(t==="https://"||Lm.test(t)||ym.test(t))return!0;try{return new URL(t),!0}catch{}return!1}var si=t=>{let e=Im(5),{clientProps:o}=t,[r]=Rm(),n,l;return e[0]!==o.defaultLinkType||e[1]!==o.defaultLinkURL||e[2]!==r?(n=()=>{if(!r.hasNodes([ie]))throw new Error("LinkPlugin: LinkNode not registered on editor");return vm(r.registerCommand(he,i=>i===null?(Jo(null),!0):(i.fields?.linkType||(i.fields.linkType=o.defaultLinkType),i.fields?.url||(i.fields.url=o.defaultLinkURL),Jo(i),!0),ii),r.registerCommand(Om,i=>{let s=Mm();if(!Am(s)||s.isCollapsed()||!(i instanceof ClipboardEvent)||i.clipboardData==null)return!1;let u=i.clipboardData.getData("text");if(!li(u))return!1;if(!s.getNodes().some($m)){let c={doc:null,linkType:"custom",newTab:!1,url:u};return r.dispatchCommand(he,{fields:c,text:null}),i.preventDefault(),!0}return!1},ii))},l=[o.defaultLinkType,o.defaultLinkURL,r],e[0]=o.defaultLinkType,e[1]=o.defaultLinkURL,e[2]=r,e[3]=n,e[4]=l):(n=e[3],l=e[4]),Fm(n,l),null};function $m(t){return Dm(t)}var ci=[Go([{ChildComponent:Dl,isActive:({selection:t})=>{if(ai(t)){let e=ze(t);return Pm(e,Z)!=null}return!1},isEnabled:({selection:t})=>!!(ai(t)&&Yo()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(he,null);else{let o,r=[];if(t.getEditorState().read(()=>{o=Yo()?.getTextContent(),r=Yo()?.getNodes()??[]}),!o?.length)return;let n={doc:null};t.dispatchCommand(oo,{fields:n,selectedNodes:r,text:o})}},order:1}])],Bm=y(({props:t})=>({markdownTransformers:[$l],nodes:[ie,t?.disableAutoLinks===!0?null:Te].filter(Boolean),plugins:[{Component:si,position:"normal"},t?.disableAutoLinks===!0||t?.disableAutoLinks==="creationOnly"?null:{Component:Kl,position:"normal"},{Component:Jl,position:"normal"},{Component:ni,position:"floatingAnchorElem"}].filter(Boolean),sanitizedClientFeatureProps:t,toolbarFixed:{groups:ci},toolbarInline:{groups:ci}}));import{$isListNode as er,INSERT_CHECK_LIST_COMMAND as hi,ListItemNode as Ym,ListNode as qm}from"@lexical/list";import{$isRangeSelection as Qm}from"lexical";import{jsx as ui,jsxs as Hm}from"react/jsx-runtime";import"react";var qo=()=>Hm("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:[ui("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),ui("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as jm}from"react/jsx-runtime";import{ListPlugin as Um}from"@lexical/react/LexicalListPlugin.js";import"react";var Ze=()=>jm(Um,{});function Ye(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as Km,ListItemNode as Jm,ListNode as Xm}from"@lexical/list";import{$createListItemNode as Gm,$createListNode as Wm,$isListItemNode as Vm,$isListNode as Qo}from"@lexical/list";var di=4,qe=t=>(e,o,r)=>{let n=e.getPreviousSibling(),l=e.getNextSibling(),i=Gm(t==="check"?r[3]==="x":void 0);if(Qo(l)&&l.getListType()===t){let u=l.getFirstChild();u!==null?u.insertBefore(i):l.append(i),e.remove()}else if(Qo(n)&&n.getListType()===t)n.append(i),e.remove();else{let u=Wm(t,t==="number"?Number(r[2]):void 0);u.append(i),e.replace(u)}i.append(...o),i.select(0,0);let s=Math.floor(r[1].length/di);s&&i.setIndent(s)},Be=(t,e,o)=>{let r=[],n=t.getChildren(),l=0;for(let i of n)if(Vm(i)){if(i.getChildrenSize()===1){let d=i.getFirstChild();if(Qo(d)){r.push(Be(d,e,o+1));continue}}let s=" ".repeat(o*di),u=t.getListType(),c=u==="number"?`${t.getStart()+l}. `:u==="check"?`- [${i.getChecked()?"x":" "}] `:"- ";r.push(s+c+e(i)),l++}return r.join(`
|
|
36
|
+
`)};var mi={type:"element",dependencies:[Xm,Jm],export:(t,e)=>Km(t)?Be(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:qe("check")};import{jsx as zm}from"react/jsx-runtime";import{CheckListPlugin as Zm}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var pi=()=>zm(Zm,{});var fi=[le([{ChildComponent:qo,isActive:({selection:t})=>{if(!Qm(t))return!1;for(let e of t.getNodes()){if(er(e)&&e.getListType()==="check")continue;let o=e.getParent();if(er(o)&&o.getListType()==="check")continue;let r=o?.getParent();if(!(er(r)&&r.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(hi,void 0)},order:12}])],ep=y(({featureProviderMap:t})=>{let e=[{Component:pi,position:"normal"}];return!t.has("unorderedList")&&!t.has("orderedList")&&e.push({Component:Ze,position:"normal"}),{markdownTransformers:[mi],nodes:t.has("unorderedList")||t.has("orderedList")?[]:[qm,Ym],plugins:e,slashMenu:{groups:[Ye([{Icon:qo,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:o})=>o.t("lexical:checklist:label"),onSelect:({editor:o})=>{o.dispatchCommand(hi,void 0)}}])]},toolbarFixed:{groups:fi},toolbarInline:{groups:fi}}});import{$isListNode as or,INSERT_ORDERED_LIST_COMMAND as Ci,ListItemNode as lp,ListNode as ip}from"@lexical/list";import{$isRangeSelection as sp}from"lexical";import{jsx as Tt,jsxs as tp}from"react/jsx-runtime";import"react";var tr=()=>tp("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:[Tt("path",{d:"M5.89284 12.479C5.89284 13.368 5.26284 13.788 4.38084 14.236C3.75084 14.558 3.43584 14.789 3.40784 15.062H5.89984V16H2.06384V15.573C2.06384 14.523 2.92484 13.935 3.66684 13.501C4.38084 13.088 4.75184 12.878 4.75184 12.458C4.75184 12.08 4.52084 11.835 4.06584 11.835C3.58984 11.835 3.30984 12.199 3.28184 12.654H2.11284C2.18984 11.681 2.87584 10.918 4.07284 10.918C5.15784 10.918 5.89284 11.555 5.89284 12.479Z",fill:"currentColor"}),Tt("path",{d:"M2.68608 4.535V3.737C3.54008 3.737 3.90408 3.513 4.02308 2.995H4.89108V8H3.68008L3.68008 4.535H2.68608Z",fill:"currentColor"}),Tt("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),Tt("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),Tt("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as op,ListItemNode as rp,ListNode as np}from"@lexical/list";var gi={type:"element",dependencies:[np,rp],export:(t,e)=>op(t)?Be(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:qe("number")};var xi=[le([{ChildComponent:tr,isActive:({selection:t})=>{if(!sp(t))return!1;for(let e of t.getNodes()){if(or(e)&&e.getListType()==="number")continue;let o=e.getParent();if(or(o)&&o.getListType()==="number")continue;let r=o?.getParent();if(!(or(r)&&r.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ci,void 0)},order:10}])],ap=y(({featureProviderMap:t})=>({markdownTransformers:[gi],nodes:t.has("orderedList")?[]:[ip,lp],plugins:t.has("orderedList")?[]:[{Component:Ze,position:"normal"}],slashMenu:{groups:[Ye([{Icon:tr,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:e})=>e.t("lexical:orderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(Ci,void 0)}}])]},toolbarFixed:{groups:xi},toolbarInline:{groups:xi}}));import{$isListNode as nr,INSERT_UNORDERED_LIST_COMMAND as _i,ListItemNode as pp,ListNode as fp}from"@lexical/list";import{$isRangeSelection as hp}from"lexical";import{jsx as Qe,jsxs as cp}from"react/jsx-runtime";import"react";var rr=()=>cp("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Qe("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Qe("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Qe("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Qe("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),Qe("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),Qe("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as up,ListItemNode as dp,ListNode as mp}from"@lexical/list";var bi={type:"element",dependencies:[mp,dp],export:(t,e)=>up(t)?Be(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:qe("bullet")};var ki=[le([{ChildComponent:rr,isActive:({selection:t})=>{if(!hp(t))return!1;for(let e of t.getNodes()){if(nr(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(nr(o)&&o.getListType()==="bullet")continue;let r=o?.getParent();if(!(nr(r)&&r.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(_i,void 0)},order:11}])],gp=y({markdownTransformers:[bi],nodes:[fp,pp],plugins:[{Component:Ze,position:"normal"}],slashMenu:{groups:[Ye([{Icon:rr,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(_i,void 0)}}])]},toolbarFixed:{groups:ki},toolbarInline:{groups:ki}});import{jsx as xp}from"react/jsx-runtime";import{addClassNamesToElement as Cp}from"@lexical/utils";import{DecoratorNode as bp}from"lexical";import*as Ti from"react";var kp=Ti.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),wt=class t extends bp{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new t({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return _p({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return Cp(o,"unknownConverted"),o}decorate(){return xp(kp,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function _p({data:t}){return new wt({data:t})}var Tp=y(()=>({nodes:[wt]}));import{jsx as wp}from"react/jsx-runtime";import{addClassNamesToElement as Ep}from"@lexical/utils";import{DecoratorNode as Sp}from"lexical";import*as wi from"react";var Np=wi.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),Et=class t extends Sp{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new t({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return Lp({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return Ep(o,"unknownConverted"),o}decorate(){return wp(Np,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function Lp({data:t}){return new Et({data:t})}var yp=y(()=>({nodes:[Et]}));import{$setBlocksType as Ni}from"@lexical/selection";import{$createParagraphNode as Li,$getSelection as yi,$isParagraphNode as Ei,$isRangeSelection as Ip}from"lexical";var Si=[le([{ChildComponent:ut,isActive:({selection:t})=>{if(!Ip(t))return!1;for(let e of t.getNodes())if(!Ei(e)&&!Ei(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=yi();Ni(e,()=>Li())})},order:1}])],Rp=y({slashMenu:{groups:[ee([{Icon:ut,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=yi();Ni(e,()=>Li())})}}])]},toolbarFixed:{groups:Si},toolbarInline:{groups:Si}});import{c as Yp}from"react/compiler-runtime";import{jsx as Xi}from"react/jsx-runtime";import{useLexicalComposerContext as qp}from"@lexical/react/LexicalComposerContext";import{useEffect as Qp,useState as ef}from"react";import{jsx as Ji,Fragment as Zp}from"react/jsx-runtime";import"react";import{jsx as vp}from"react/jsx-runtime";var Ii={quote:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return vp("blockquote",{children:o})}};import{jsx as Mp}from"react/jsx-runtime";var Ri={heading:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.tag;return Mp(r,{children:o})}};import{jsx as Dp}from"react/jsx-runtime";var vi={horizontalrule:Dp("hr",{})};import{jsx as Ap}from"react/jsx-runtime";var Mi={linebreak:Ap("br",{})};import{jsx as Di}from"react/jsx-runtime";var Ai=({internalDocToHref:t})=>({autolink:({node:e,nodesToJSX:o})=>{let r=o({nodes:e.children}),n=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0;return Di("a",{href:e.fields.url,rel:n,target:l,children:r})},link:({node:e,nodesToJSX:o})=>{let r=o({nodes:e.children}),n=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0,i=e.fields.url??"";return e.fields.linkType==="internal"&&(t?i=t({linkNode:e}):(console.error("Lexical => JSX converter: Link converter: found internal link, but internalDocToHref is not provided"),i="#")),Di("a",{href:i,rel:n,target:l,children:r})}});import{jsx as et,jsxs as Op,Fragment as Fp}from"react/jsx-runtime";import{v4 as $p}from"uuid";var Oi={list:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.tag;return et(r,{className:`list-${t?.listType}`,children:o})},listitem:({node:t,nodesToJSX:e,parent:o})=>{let r=t.children.some(l=>l.type==="list"),n=e({nodes:t.children});if("listType"in o&&o?.listType==="check"){let l=$p();return et("li",{"aria-checked":t.checked?"true":"false",className:`list-item-checkbox${t.checked?" list-item-checkbox-checked":" list-item-checkbox-unchecked"}${r?" nestedListItem":""}`,role:"checkbox",style:{listStyleType:"none"},tabIndex:-1,value:t?.value,children:r?n:Op(Fp,{children:[et("input",{checked:t.checked,id:l,readOnly:!0,type:"checkbox"}),et("label",{htmlFor:l,children:n}),et("br",{})]})})}else return et("li",{className:`${r?"nestedListItem":""}`,style:r?{listStyleType:"none"}:void 0,value:t?.value,children:n})}};import{jsx as lr}from"react/jsx-runtime";var Fi={paragraph:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return o?.length?lr("p",{children:o}):lr("p",{children:lr("br",{})})}};var $i={tab:" "};import{jsx as St}from"react/jsx-runtime";var Pi={table:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return St("div",{className:"lexical-table-container",children:St("table",{className:"lexical-table",style:{borderCollapse:"collapse"},children:St("tbody",{children:o})})})},tablecell:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.headerState>0?"th":"td",n=`lexical-table-cell-header-${t.headerState}`,l={backgroundColor:t.backgroundColor||void 0,border:"1px solid #ccc",padding:"8px"},i=t.colSpan&&t.colSpan>1?t.colSpan:void 0,s=t.rowSpan&&t.rowSpan>1?t.rowSpan:void 0;return St(r,{className:`lexical-table-cell ${n}`,colSpan:i,rowSpan:s,style:l,children:o})},tablerow:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return St("tr",{className:"lexical-table-row",children:o})}};import{jsx as He}from"react/jsx-runtime";import"react";var A={DOM_ELEMENT_TYPE:1,DOM_TEXT_TYPE:3,NO_DIRTY_NODES:0,HAS_DIRTY_NODES:1,FULL_RECONCILE:2,IS_NORMAL:0,IS_TOKEN:1,IS_SEGMENTED:2,IS_INERT:3,IS_BOLD:1,IS_ITALIC:2,IS_STRIKETHROUGH:4,IS_UNDERLINE:8,IS_CODE:16,IS_SUBSCRIPT:32,IS_SUPERSCRIPT:64,IS_HIGHLIGHT:128,IS_DIRECTIONLESS:1,IS_UNMERGEABLE:2,IS_ALIGN_LEFT:1,IS_ALIGN_CENTER:2,IS_ALIGN_RIGHT:3,IS_ALIGN_JUSTIFY:4,IS_ALIGN_START:5,IS_ALIGN_END:6},Pp=A.IS_BOLD|A.IS_ITALIC|A.IS_STRIKETHROUGH|A.IS_UNDERLINE|A.IS_CODE|A.IS_SUBSCRIPT|A.IS_SUPERSCRIPT|A.IS_HIGHLIGHT,Bp="\xA0",Hp=`
|
|
37
37
|
|
|
38
|
-
`,Pi="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",Bi="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",Pp=new RegExp("^[^"+Bi+"]*["+Pi+"]"),Bp=new RegExp("^[^"+Pi+"]*["+Bi+"]"),Hp={bold:A.IS_BOLD,code:A.IS_CODE,highlight:A.IS_HIGHLIGHT,italic:A.IS_ITALIC,strikethrough:A.IS_STRIKETHROUGH,subscript:A.IS_SUBSCRIPT,superscript:A.IS_SUPERSCRIPT,underline:A.IS_UNDERLINE},jp={directionless:A.IS_DIRECTIONLESS,unmergeable:A.IS_UNMERGEABLE},Up={center:A.IS_ALIGN_CENTER,end:A.IS_ALIGN_END,justify:A.IS_ALIGN_JUSTIFY,left:A.IS_ALIGN_LEFT,right:A.IS_ALIGN_RIGHT,start:A.IS_ALIGN_START},Gp={[A.IS_ALIGN_CENTER]:"center",[A.IS_ALIGN_END]:"end",[A.IS_ALIGN_JUSTIFY]:"justify",[A.IS_ALIGN_LEFT]:"left",[A.IS_ALIGN_RIGHT]:"right",[A.IS_ALIGN_START]:"start"},Wp={normal:A.IS_NORMAL,segmented:A.IS_SEGMENTED,token:A.IS_TOKEN},Vp={[A.IS_NORMAL]:"normal",[A.IS_SEGMENTED]:"segmented",[A.IS_TOKEN]:"token"};var Hi={text:({node:t})=>{let e=t.text;return t.format&A.IS_BOLD&&(e=He("strong",{children:e})),t.format&A.IS_ITALIC&&(e=He("em",{children:e})),t.format&A.IS_STRIKETHROUGH&&(e=He("span",{style:{textDecoration:"line-through"},children:e})),t.format&A.IS_UNDERLINE&&(e=He("span",{style:{textDecoration:"underline"},children:e})),t.format&A.IS_CODE&&(e=He("code",{children:e})),t.format&A.IS_SUBSCRIPT&&(e=He("sub",{children:e})),t.format&A.IS_SUPERSCRIPT&&(e=He("sup",{children:e})),e}};import{jsx as Nt}from"react/jsx-runtime";var ji={upload:({node:t})=>{let e=t;if(typeof e.value!="object")return null;let o=e.value,r=o.url;if(!o.mimeType.startsWith("image"))return Nt("a",{href:r,rel:"noopener noreferrer",children:o.filename});if(!o.sizes||!Object.keys(o.sizes).length)return Nt("img",{alt:o.filename,height:o.height,src:r,width:o.width});let n=[];for(let l in o.sizes){let i=o.sizes[l];if(!i||!i.width||!i.height||!i.mimeType||!i.filesize||!i.filename||!i.url)continue;let s=i?.url;n.push(Nt("source",{media:`(max-width: ${i.width}px)`,srcSet:s,type:i.mimeType},l))}return n.push(Nt("img",{alt:o?.filename,height:o?.height,src:r,width:o?.width},"image")),Nt("picture",{children:n})}};var tt={...Oi,...Hi,...vi,...yi,...Fi,...Ii,...Ri,...Ai,...Di({}),...ji,...$i};import{jsx as Gi,Fragment as Kp}from"react/jsx-runtime";import lr from"react";function Ui(t){let e=!!t?.root?.children?.length,o=!1;if(t?.root?.children?.length===1&&t?.root?.children[0]?.type==="paragraph"){let r=t?.root?.children[0];if(!r?.children||r?.children?.length===0)o=!0;else if(r?.children?.length===1){let n=r?.children[0];n?.type==="text"&&(n?.text?.length||(o=!0))}}return!(!e||o)}function Wi({converters:t,data:e,disableIndent:o,disableTextAlign:r}){return Ui(e)?Vi({converters:t,disableIndent:o,disableTextAlign:r,nodes:e?.root?.children,parent:e?.root}):Gi(Kp,{})}function Vi({converters:t,disableIndent:e,disableTextAlign:o,nodes:r,parent:n}){let l=t.unknown;return r.map((s,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=>Vi({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=Gi("span",{children:"unknown node"},u);let a={};if(!o&&(!Array.isArray(o)||!o?.includes(s.type))&&"format"in s&&s.format)switch(s.format){case"center":a.textAlign="center";break;case"end":a.textAlign="right";break;case"justify":a.textAlign="justify";break;case"left":break;case"right":a.textAlign="right";break;case"start":a.textAlign="left";break}if(!e&&(!Array.isArray(e)||!e?.includes(s.type))&&"indent"in s&&s.indent&&s.type!=="listitem"&&(a.paddingInlineStart=`${Number(s.indent)*40}px`),lr.isValidElement(d)){if(a.textAlign||a.paddingInlineStart){let p={...a,...d?.props?.style??{}};return lr.cloneElement(d,{key:u,style:p})}return lr.cloneElement(d,{key:u})}return d}catch(d){return console.error("Error converting lexical node to JSX:",d,"node:",s),null}}).filter(Boolean)}var ir=({className:t,converters:e,data:o,disableContainer:r,disableIndent:n,disableTextAlign:l})=>{if(!o)return null;let i={};e?typeof e=="function"?i=e({defaultConverters:tt}):i=e:i=tt;let s=o&&!Array.isArray(o)&&typeof o=="object"&&"root"in o&&Wi({converters:i,data:o,disableIndent:n,disableTextAlign:l});return r?Ki(Jp,{children:s}):Ki("div",{className:t??"payload-richtext",children:s})};function Xi(){let t=Xp(7),[e]=zp(),o;t[0]!==e?(o=e.getEditorState().toJSON(),t[0]=e,t[1]=o):o=t[1];let[r,n]=Yp(o),l,i;t[2]!==e?(l=()=>e.registerUpdateListener(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]),Zp(l,i);let s;return t[5]!==r?(s=Ji("div",{className:"debug-jsx-converter",children:Ji(ir,{converters:tt,data:r})}),t[5]=r,t[6]=s):s=t[6],s}var qp=y({plugins:[{Component:Xi,position:"bottom"}]});var B={amber:{50:"oklch(0.987 0.022 95.277)",100:"oklch(0.962 0.059 95.617)",200:"oklch(0.924 0.12 95.746)",300:"oklch(0.879 0.169 91.605)",400:"oklch(0.828 0.189 84.429)",500:"oklch(0.769 0.188 70.08)",600:"oklch(0.666 0.179 58.318)",700:"oklch(0.555 0.163 48.998)",800:"oklch(0.473 0.137 46.201)",900:"oklch(0.414 0.112 45.904)",950:"oklch(0.279 0.077 45.635)"},black:"#000",blue:{50:"oklch(0.97 0.014 254.604)",100:"oklch(0.932 0.032 255.585)",200:"oklch(0.882 0.059 254.128)",300:"oklch(0.809 0.105 251.813)",400:"oklch(0.707 0.165 254.624)",500:"oklch(0.623 0.214 259.815)",600:"oklch(0.546 0.245 262.881)",700:"oklch(0.488 0.243 264.376)",800:"oklch(0.424 0.199 265.638)",900:"oklch(0.379 0.146 265.522)",950:"oklch(0.282 0.091 267.935)"},current:"currentColor",cyan:{50:"oklch(0.984 0.019 200.873)",100:"oklch(0.956 0.045 203.388)",200:"oklch(0.917 0.08 205.041)",300:"oklch(0.865 0.127 207.078)",400:"oklch(0.789 0.154 211.53)",500:"oklch(0.715 0.143 215.221)",600:"oklch(0.609 0.126 221.723)",700:"oklch(0.52 0.105 223.128)",800:"oklch(0.45 0.085 224.283)",900:"oklch(0.398 0.07 227.392)",950:"oklch(0.302 0.056 229.695)"},emerald:{50:"oklch(0.979 0.021 166.113)",100:"oklch(0.95 0.052 163.051)",200:"oklch(0.905 0.093 164.15)",300:"oklch(0.845 0.143 164.978)",400:"oklch(0.765 0.177 163.223)",500:"oklch(0.696 0.17 162.48)",600:"oklch(0.596 0.145 163.225)",700:"oklch(0.508 0.118 165.612)",800:"oklch(0.432 0.095 166.913)",900:"oklch(0.378 0.077 168.94)",950:"oklch(0.262 0.051 172.552)"},fuchsia:{50:"oklch(0.977 0.017 320.058)",100:"oklch(0.952 0.037 318.852)",200:"oklch(0.903 0.076 319.62)",300:"oklch(0.833 0.145 321.434)",400:"oklch(0.74 0.238 322.16)",500:"oklch(0.667 0.295 322.15)",600:"oklch(0.591 0.293 322.896)",700:"oklch(0.518 0.253 323.949)",800:"oklch(0.452 0.211 324.591)",900:"oklch(0.401 0.17 325.612)",950:"oklch(0.293 0.136 325.661)"},gray:{50:"oklch(0.985 0.002 247.839)",100:"oklch(0.967 0.003 264.542)",200:"oklch(0.928 0.006 264.531)",300:"oklch(0.872 0.01 258.338)",400:"oklch(0.707 0.022 261.325)",500:"oklch(0.551 0.027 264.364)",600:"oklch(0.446 0.03 256.802)",700:"oklch(0.373 0.034 259.733)",800:"oklch(0.278 0.033 256.848)",900:"oklch(0.21 0.034 264.665)",950:"oklch(0.13 0.028 261.692)"},green:{50:"oklch(0.982 0.018 155.826)",100:"oklch(0.962 0.044 156.743)",200:"oklch(0.925 0.084 155.995)",300:"oklch(0.871 0.15 154.449)",400:"oklch(0.792 0.209 151.711)",500:"oklch(0.723 0.219 149.579)",600:"oklch(0.627 0.194 149.214)",700:"oklch(0.527 0.154 150.069)",800:"oklch(0.448 0.119 151.328)",900:"oklch(0.393 0.095 152.535)",950:"oklch(0.266 0.065 152.934)"},indigo:{50:"oklch(0.962 0.018 272.314)",100:"oklch(0.93 0.034 272.788)",200:"oklch(0.87 0.065 274.039)",300:"oklch(0.785 0.115 274.713)",400:"oklch(0.673 0.182 276.935)",500:"oklch(0.585 0.233 277.117)",600:"oklch(0.511 0.262 276.966)",700:"oklch(0.457 0.24 277.023)",800:"oklch(0.398 0.195 277.366)",900:"oklch(0.359 0.144 278.697)",950:"oklch(0.257 0.09 281.288)"},inherit:"inherit",lime:{50:"oklch(0.986 0.031 120.757)",100:"oklch(0.967 0.067 122.328)",200:"oklch(0.938 0.127 124.321)",300:"oklch(0.897 0.196 126.665)",400:"oklch(0.841 0.238 128.85)",500:"oklch(0.768 0.233 130.85)",600:"oklch(0.648 0.2 131.684)",700:"oklch(0.532 0.157 131.589)",800:"oklch(0.453 0.124 130.933)",900:"oklch(0.405 0.101 131.063)",950:"oklch(0.274 0.072 132.109)"},neutral:{50:"oklch(0.985 0 0)",100:"oklch(0.97 0 0)",200:"oklch(0.922 0 0)",300:"oklch(0.87 0 0)",400:"oklch(0.708 0 0)",500:"oklch(0.556 0 0)",600:"oklch(0.439 0 0)",700:"oklch(0.371 0 0)",800:"oklch(0.269 0 0)",900:"oklch(0.205 0 0)",950:"oklch(0.145 0 0)"},orange:{50:"oklch(0.98 0.016 73.684)",100:"oklch(0.954 0.038 75.164)",200:"oklch(0.901 0.076 70.697)",300:"oklch(0.837 0.128 66.29)",400:"oklch(0.75 0.183 55.934)",500:"oklch(0.705 0.213 47.604)",600:"oklch(0.646 0.222 41.116)",700:"oklch(0.553 0.195 38.402)",800:"oklch(0.47 0.157 37.304)",900:"oklch(0.408 0.123 38.172)",950:"oklch(0.266 0.079 36.259)"},pink:{50:"oklch(0.971 0.014 343.198)",100:"oklch(0.948 0.028 342.258)",200:"oklch(0.899 0.061 343.231)",300:"oklch(0.823 0.12 346.018)",400:"oklch(0.718 0.202 349.761)",500:"oklch(0.656 0.241 354.308)",600:"oklch(0.592 0.249 0.584)",700:"oklch(0.525 0.223 3.958)",800:"oklch(0.459 0.187 3.815)",900:"oklch(0.408 0.153 2.432)",950:"oklch(0.284 0.109 3.907)"},purple:{50:"oklch(0.977 0.014 308.299)",100:"oklch(0.946 0.033 307.174)",200:"oklch(0.902 0.063 306.703)",300:"oklch(0.827 0.119 306.383)",400:"oklch(0.714 0.203 305.504)",500:"oklch(0.627 0.265 303.9)",600:"oklch(0.558 0.288 302.321)",700:"oklch(0.496 0.265 301.924)",800:"oklch(0.438 0.218 303.724)",900:"oklch(0.381 0.176 304.987)",950:"oklch(0.291 0.149 302.717)"},red:{50:"oklch(0.971 0.013 17.38)",100:"oklch(0.936 0.032 17.717)",200:"oklch(0.885 0.062 18.334)",300:"oklch(0.808 0.114 19.571)",400:"oklch(0.704 0.191 22.216)",500:"oklch(0.637 0.237 25.331)",600:"oklch(0.577 0.245 27.325)",700:"oklch(0.505 0.213 27.518)",800:"oklch(0.444 0.177 26.899)",900:"oklch(0.396 0.141 25.723)",950:"oklch(0.258 0.092 26.042)"},rose:{50:"oklch(0.969 0.015 12.422)",100:"oklch(0.941 0.03 12.58)",200:"oklch(0.892 0.058 10.001)",300:"oklch(0.81 0.117 11.638)",400:"oklch(0.712 0.194 13.428)",500:"oklch(0.645 0.246 16.439)",600:"oklch(0.586 0.253 17.585)",700:"oklch(0.514 0.222 16.935)",800:"oklch(0.455 0.188 13.697)",900:"oklch(0.41 0.159 10.272)",950:"oklch(0.271 0.105 12.094)"},sky:{50:"oklch(0.977 0.013 236.62)",100:"oklch(0.951 0.026 236.824)",200:"oklch(0.901 0.058 230.902)",300:"oklch(0.828 0.111 230.318)",400:"oklch(0.746 0.16 232.661)",500:"oklch(0.685 0.169 237.323)",600:"oklch(0.588 0.158 241.966)",700:"oklch(0.5 0.134 242.749)",800:"oklch(0.443 0.11 240.79)",900:"oklch(0.391 0.09 240.876)",950:"oklch(0.293 0.066 243.157)"},slate:{50:"oklch(0.984 0.003 247.858)",100:"oklch(0.968 0.007 247.896)",200:"oklch(0.929 0.013 255.508)",300:"oklch(0.869 0.022 252.894)",400:"oklch(0.704 0.04 256.788)",500:"oklch(0.554 0.046 257.417)",600:"oklch(0.446 0.043 257.281)",700:"oklch(0.372 0.044 257.287)",800:"oklch(0.279 0.041 260.031)",900:"oklch(0.208 0.042 265.755)",950:"oklch(0.129 0.042 264.695)"},stone:{50:"oklch(0.985 0.001 106.423)",100:"oklch(0.97 0.001 106.424)",200:"oklch(0.923 0.003 48.717)",300:"oklch(0.869 0.005 56.366)",400:"oklch(0.709 0.01 56.259)",500:"oklch(0.553 0.013 58.071)",600:"oklch(0.444 0.011 73.639)",700:"oklch(0.374 0.01 67.558)",800:"oklch(0.268 0.007 34.298)",900:"oklch(0.216 0.006 56.043)",950:"oklch(0.147 0.004 49.25)"},teal:{50:"oklch(0.984 0.014 180.72)",100:"oklch(0.953 0.051 180.801)",200:"oklch(0.91 0.096 180.426)",300:"oklch(0.855 0.138 181.071)",400:"oklch(0.777 0.152 181.912)",500:"oklch(0.704 0.14 182.503)",600:"oklch(0.6 0.118 184.704)",700:"oklch(0.511 0.096 186.391)",800:"oklch(0.437 0.078 188.216)",900:"oklch(0.386 0.063 188.416)",950:"oklch(0.277 0.046 192.524)"},transparent:"transparent",violet:{50:"oklch(0.969 0.016 293.756)",100:"oklch(0.943 0.029 294.588)",200:"oklch(0.894 0.057 293.283)",300:"oklch(0.811 0.111 293.571)",400:"oklch(0.702 0.183 293.541)",500:"oklch(0.606 0.25 292.717)",600:"oklch(0.541 0.281 293.009)",700:"oklch(0.491 0.27 292.581)",800:"oklch(0.432 0.232 292.759)",900:"oklch(0.38 0.189 293.745)",950:"oklch(0.283 0.141 291.089)"},white:"#fff",yellow:{50:"oklch(0.987 0.026 102.212)",100:"oklch(0.973 0.071 103.193)",200:"oklch(0.945 0.129 101.54)",300:"oklch(0.905 0.182 98.111)",400:"oklch(0.852 0.199 91.936)",500:"oklch(0.795 0.184 86.047)",600:"oklch(0.681 0.162 75.834)",700:"oklch(0.554 0.135 66.442)",800:"oklch(0.476 0.114 61.907)",900:"oklch(0.421 0.095 57.708)",950:"oklch(0.286 0.066 53.813)"},zinc:{50:"oklch(0.985 0 0)",100:"oklch(0.967 0.001 286.375)",200:"oklch(0.92 0.004 286.32)",300:"oklch(0.871 0.006 286.286)",400:"oklch(0.705 0.015 286.067)",500:"oklch(0.552 0.016 285.938)",600:"oklch(0.442 0.017 285.786)",700:"oklch(0.37 0.013 285.805)",800:"oklch(0.274 0.006 286.033)",900:"oklch(0.21 0.006 285.885)",950:"oklch(0.141 0.005 285.823)"}},Qp={text:{"text-red":{css:{color:`light-dark(${B.red[600]}, ${B.red[400]})`},label:"Red"},"text-orange":{css:{color:`light-dark(${B.orange[600]}, ${B.orange[400]})`},label:"Orange"},"text-yellow":{css:{color:`light-dark(${B.yellow[700]}, ${B.yellow[300]})`},label:"Yellow"},"text-green":{css:{color:`light-dark(${B.green[700]}, ${B.green[400]})`},label:"Green"},"text-blue":{css:{color:`light-dark(${B.blue[600]}, ${B.blue[400]})`},label:"Blue"},"text-purple":{css:{color:`light-dark(${B.purple[600]}, ${B.purple[400]})`},label:"Purple"},"text-pink":{css:{color:`light-dark(${B.pink[600]}, ${B.pink[400]})`},label:"Pink"}},background:{"bg-red":{css:{"background-color":`light-dark(${B.red[400]}, ${B.red[600]})`},label:"Red"},"bg-orange":{css:{"background-color":`light-dark(${B.orange[400]}, ${B.orange[600]})`},label:"Orange"},"bg-yellow":{css:{"background-color":`light-dark(${B.yellow[300]}, ${B.yellow[700]})`},label:"Yellow"},"bg-green":{css:{"background-color":`light-dark(${B.green[400]}, ${B.green[700]})`},label:"Green"},"bg-blue":{css:{"background-color":`light-dark(${B.blue[400]}, ${B.blue[600]})`},label:"Blue"},"bg-purple":{css:{"background-color":`light-dark(${B.purple[400]}, ${B.purple[600]})`},label:"Purple"},"bg-pink":{css:{"background-color":`light-dark(${B.pink[400]}, ${B.pink[600]})`},label:"Pink"}}};import{$isNodeSelection as Pf}from"lexical";import{jsx as St,jsxs as ef}from"react/jsx-runtime";import"react";var sr=()=>ef("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[St("g",{clipPath:"url(#clip0_4397_10817)",children:St("path",{d:"M7.75 12.25L15.25 4.75M15.25 4.75H11.5M15.25 4.75V8.5M13 11.5V13.75C13 14.5784 12.3284 15.25 11.5 15.25H6.25C5.42157 15.25 4.75 14.5784 4.75 13.75V8.5C4.75 7.67157 5.42157 7 6.25 7H8.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})}),St("defs",{children:St("clipPath",{id:"clip0_4397_10817",children:St("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{jsx as rf}from"react/jsx-runtime";import*as Zi from"react";import{DecoratorBlockNode as tf}from"@lexical/react/LexicalDecoratorBlockNode.js";function of(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:zi({relationTo:o,value:e})}:null}var Lt=class extends tf{__data;constructor({data:e,format:o,key:r}){super(o,r),this.__data=e}static clone(e){return new this({data:e.__data,format:e.__format,key:e.__key})}static getType(){return"relationship"}static importDOM(){return{div:e=>!e.hasAttribute("data-lexical-relationship-relationTo")||!e.hasAttribute("data-lexical-relationship-id")?null:{conversion:of,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},r=zi(o);return r.setFormat(e.format),r}static isInline(){return!1}decorate(e,o){return null}exportDOM(){let e=document.createElement("div");e.setAttribute("data-lexical-relationship-id",String(typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value)),e.setAttribute("data-lexical-relationship-relationTo",this.__data?.relationTo);let o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"relationship",version:2}}getData(){return this.getLatest().__data}getTextContent(){return`${this.__data?.relationTo} relation to ${typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value}`}setData(e){let o=this.getWritable();o.__data=e}};function zi(t){return new Lt({data:t})}var nf=Zi.lazy(()=>import("./RelationshipComponent-APF3CN47.js").then(t=>({default:t.RelationshipComponent})));function lf(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:je({relationTo:o,value:e})}:null}var Ne=class extends Lt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{div:e=>!e.hasAttribute("data-lexical-relationship-relationTo")||!e.hasAttribute("data-lexical-relationship-id")?null:{conversion:lf,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},r=je(o);return r.setFormat(e.format),r}decorate(e,o){return rf(nf,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function je(t){return new Ne({data:t})}function ar(t){return t instanceof Ne}import{c as Ef}from"react/compiler-runtime";import{jsx as Nf}from"react/jsx-runtime";import{useLexicalComposerContext as Sf}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Lf}from"@lexical/utils";import{useConfig as yf}from"@payloadcms/ui";import{$getPreviousSelection as If,$getSelection as Rf,$isParagraphNode as vf,$isRangeSelection as Mf,COMMAND_PRIORITY_EDITOR as Df,createCommand as Af}from"lexical";import{useEffect as Of}from"react";import{c as Cf}from"react/compiler-runtime";import{jsx as ro}from"react/jsx-runtime";import{useLexicalComposerContext as bf}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as kf,COMMAND_PRIORITY_EDITOR as _f}from"lexical";import{useEffect as Tf,useState as Qi}from"react";import{c as sf}from"react/compiler-runtime";import{jsx as af}from"react/jsx-runtime";import{useLexicalComposerContext as cf}from"@lexical/react/LexicalComposerContext";import{useListDrawer as uf,useModal as df}from"@payloadcms/ui";import{$getNodeByKey as Yi,$getPreviousSelection as mf,$getRoot as pf,$getSelection as ff,$isRangeSelection as hf,$setSelection as gf}from"lexical";import{useEffect as xf,useState as qi}from"react";var yt=t=>{let e=sf(23),[o]=cf(),[r,n]=qi(null),[l,i]=qi(!1),[s,u,c]=uf(t),{closeDrawer:d,drawerSlug:a,isDrawerOpen:p,openDrawer:m}=c,{modalState:f}=df(),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let F=ff()??mf();n(F)},e[0]=h):h=e[0];let g=h,b;e[1]!==o||e[2]!==r?(b=()=>{r&&o.update(()=>{if(hf(r)){let{anchor:F,focus:I}=r;Yi(F.key)&&Yi(I.key)&&gf(r.clone())}else pf().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=r,e[3]=b):b=e[3];let T=b,M;e[4]!==d?(M=()=>{d()},e[4]=d,e[5]=M):M=e[5];let k=M,_,x;e[6]!==a||e[7]!==f||e[8]!==T||e[9]!==l?(_=()=>{if(!l)return;let F=f[a];F&&!F?.isOpen&&(i(!1),setTimeout(()=>{T()},1))},x=[f,a,T,l],e[6]=a,e[7]=f,e[8]=T,e[9]=l,e[10]=_,e[11]=x):(_=e[10],x=e[11]),xf(_,x);let S;e[12]!==u?(S=F=>af(u,{...F,onClick:()=>{g()}}),e[12]=u,e[13]=S):S=e[13];let D;e[14]!==m?(D=()=>{g(),m(),i(!0)},e[14]=m,e[15]=D):D=e[15];let O;return e[16]!==s||e[17]!==k||e[18]!==p||e[19]!==a||e[20]!==S||e[21]!==D?(O={closeListDrawer:k,isListDrawerOpen:p,ListDrawer:s,listDrawerSlug:a,ListDrawerToggler:S,openListDrawer:D},e[16]=s,e[17]=k,e[18]=p,e[19]=a,e[20]=S,e[21]=D,e[22]=O):O=e[22],O};var wf=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=kf(o);n&&n.replace(je({relationTo:e,value:r}))}):t.dispatchCommand(cr,{relationTo:e,value:r})},es=t=>{let e=Cf(16),{enabledCollectionSlugs:o}=t,[r]=bf(),n;e[0]!==o?.[0]?(n=()=>o?.[0],e[0]=o?.[0],e[1]=n):n=e[1];let[l]=Qi(n),[i,s]=Qi(null),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,T=>(s(T?.replace?T?.replace.nodeKey:null),p(),!0),_f),f=[r,p],e[5]=r,e[6]=p,e[7]=m,e[8]=f):(m=e[7],f=e[8]),Tf(m,f);let h;e[9]!==d||e[10]!==r||e[11]!==i?(h=T=>{let{collectionSlug:M,doc:k}=T;wf({editor:r,relationTo:M,replaceNodeKey:i,value:k.id}),d()},e[9]=d,e[10]=r,e[11]=i,e[12]=h):h=e[12];let g=h,b;return e[13]!==a||e[14]!==g?(b=ro(a,{onSelect:g}),e[13]=a,e[14]=g,e[15]=b):b=e[15],b},ts=t=>(t?.enabledCollectionSlugs?.length??-1)>0?ro(es,{...t}):ro(At,{...t,children:ro(es,{...t})});var cr=Af("INSERT_RELATIONSHIP_COMMAND"),os=t=>{let e=Ef(10),{clientProps:o}=t,[r]=Sf(),{config:n}=yf(),{collections:l}=n,i=null;if(o?.enabledCollections)i=o?.enabledCollections;else if(o?.disabledCollections){let d;if(e[0]!==o?.disabledCollections||e[1]!==l){let a;e[3]!==o?.disabledCollections?(a=p=>{let{slug:m}=p;return!o?.disabledCollections?.includes(m)},e[3]=o?.disabledCollections,e[4]=a):a=e[4],d=l.filter(a).map($f),e[0]=o?.disabledCollections,e[1]=l,e[2]=d}else d=e[2];i=d}let s,u;e[5]!==r?(s=()=>{if(!r.hasNodes([Ne]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return r.registerCommand(cr,Ff,Df)},u=[r],e[5]=r,e[6]=s,e[7]=u):(s=e[6],u=e[7]),Of(s,u);let c;return e[8]!==i?(c=Nf(ts,{enabledCollectionSlugs:i}),e[8]=i,e[9]=c):c=e[9],c};function $f(t){let{slug:e}=t;return e}function Ff(t){let e=Rf()||If();if(Mf(e)){let o=je(t),{focus:r}=e,n=r.getNode();Lf(o),vf(n)&&!n.__first&&n.remove()}return!0}var Bf=y({nodes:[Ne],plugins:[{Component:os,position:"normal"}],slashMenu:{groups:[ee([{Icon:sr,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(at,{replace:!1})}}])]},toolbarFixed:{groups:[ke([{ChildComponent:sr,isActive:({selection:t})=>{if(!Pf(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return ar(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(at,{replace:!1})}}])]}});import{c as ds}from"react/compiler-runtime";import{jsx as me,jsxs as m0}from"react/jsx-runtime";import{useLexicalComposerContext as p0}from"@lexical/react/LexicalComposerContext.js";import{useScrollInfo as f0,useThrottledEffect as h0,useTranslation as g0}from"@payloadcms/ui";import*as Se from"react";import{useMemo as x0}from"react";import{c as Hf}from"react/compiler-runtime";import{jsx as jf}from"react/jsx-runtime";import{mergeRegister as Uf}from"@lexical/utils";import{$addUpdateTag as Gf,$getSelection as Wf}from"lexical";import{useDeferredValue as Vf,useEffect as Kf,useState as Jf}from"react";var rs="toolbar-popup__button",It=t=>{let e=Hf(23),{children:o,editor:r,item:n}=t,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={active:!1,enabled:!0},e[0]=l):l=e[0];let[i,s]=Jf(l),u=Vf(i),c=j(),d,a=u.enabled?"":"disabled",p=u.active?"active":"",m=n.key?`${rs}-${n.key}`:"",f;e[1]!==a||e[2]!==p||e[3]!==m?(f=[rs,a,p,m].filter(Boolean),e[1]=a,e[2]=p,e[3]=m,e[4]=f):f=e[4],d=f.join(" ");let h=d,g;e[5]!==r||e[6]!==c||e[7]!==n?(g=()=>{r.getEditorState().read(()=>{let O=Wf();if(!O)return;let F=n.isActive?n.isActive({editor:r,editorConfigContext:c,selection:O}):!1,I=n.isEnabled?n.isEnabled({editor:r,editorConfigContext:c,selection:O}):!0;s(w=>w.active===F&&w.enabled===I?w:{active:F,enabled:I})})},e[5]=r,e[6]=c,e[7]=n,e[8]=g):g=e[8];let b=g,T=Ot(),M,k;e[9]!==r||e[10]!==T||e[11]!==b?(M=()=>{T(b);let O=()=>T(b),F=Uf(r.registerUpdateListener(O));return document.addEventListener("mouseup",O),()=>{F(),document.removeEventListener("mouseup",O)}},k=[r,T,b],e[9]=r,e[10]=T,e[11]=b,e[12]=M,e[13]=k):(M=e[12],k=e[13]),Kf(M,k);let _;e[14]!==i||e[15]!==r||e[16]!==n?(_=()=>{i.enabled&&r.focus(()=>{r.update(Xf),n.onSelect?.({editor:r,isActive:i.active})})},e[14]=i,e[15]=r,e[16]=n,e[17]=_):_=e[17];let x=_,S=zf,D;return e[18]!==o||e[19]!==h||e[20]!==x||e[21]!==n.key?(D=jf("button",{className:h,"data-button-key":n.key,onClick:x,onMouseDown:S,type:"button",children:o}),e[18]=o,e[19]=h,e[20]=x,e[21]=n.key,e[22]=D):D=e[22],D};function Xf(){Gf("toolbar")}function zf(t){t.preventDefault()}import{c as o0}from"react/compiler-runtime";import{jsx as ot}from"react/jsx-runtime";import us,{useCallback as r0,useDeferredValue as n0,useEffect as l0,useMemo as i0}from"react";import{mergeRegister as s0}from"@lexical/utils";import{useTranslation as a0}from"@payloadcms/ui";import{$getSelection as c0}from"lexical";import{jsx as Me,jsxs as ns}from"react/jsx-runtime";import{Button as Zf}from"@payloadcms/ui";import{$addUpdateTag as Yf,isDOMNode as qf}from"lexical";import no,{useCallback as Qf,useEffect as lo,useMemo as is,useRef as ur,useState as dr}from"react";import{createPortal as e0}from"react-dom";var ls="toolbar-popup__dropdown-item",ss=no.createContext(null);function as({active:t,children:e,editor:o,enabled:r,Icon:n,item:l,itemKey:i,tooltip:s}){let u=is(()=>[ls,r===!1?"disabled":"",t?"active":"",l?.key?`${ls}-${l.key}`:""].filter(Boolean).join(" "),[r,t,l.key]),c=ur(null),d=no.use(ss);if(d===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=d;return lo(()=>{c?.current!=null&&a(c)},[c,a]),Me(Zf,{"aria-label":s,buttonStyle:"none",className:u,disabled:r===!1,extraButtonProps:{"data-item-key":i},icon:n,iconPosition:"left",iconStyle:"none",onClick:()=>{r!==!1&&o.focus(()=>{o.update(()=>{Yf("toolbar")}),l.onSelect?.({editor:o,isActive:t})})},onMouseDown:p=>{p.preventDefault()},ref:c,tooltip:s,type:"button",children:e})}function t0({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:r}){let[n,l]=dr(),[i,s]=dr(),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=is(()=>({registerItem:u}),[u]);return lo(()=>{n!=null&&i==null&&s(n[0]),i!=null&&i?.current!=null&&i.current.focus()},[n,i]),Me(ss,{value:d,children:Me("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:c,ref:e,children:t})})}function cs({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:r=!1,dropdownKey:n,Icon:l,itemsContainerClassNames:i,label:s,stopCloseOnClickSelf:u}){let c=ur(null),d=ur(null),[a,p]=dr(!1),m=()=>{p(!1),d?.current!=null&&d.current.focus()};lo(()=>{let h=d.current,g=c.current;if(a&&h!==null&&g!==null){let{left:b,top:T}=h.getBoundingClientRect(),M=window.scrollY||document.documentElement.scrollTop;g.style.top=`${T+M+h.offsetHeight+5}px`,g.style.left=`${Math.min(b-5,window.innerWidth-g.offsetWidth-20)}px`}},[c,d,a]),lo(()=>{let h=d.current;if(h!==null&&a){let g=b=>{let T=b.target;qf(T)&&(u&&c.current&&c.current.contains(T)||h.contains(T)||p(!1))};return document.addEventListener("click",g),()=>{document.removeEventListener("click",g)}}},[c,d,a,u]);let f=e0(Me(t0,{dropDownRef:c,itemsContainerClassNames:i,onClose:m,children:o}),document.body);return ns(no.Fragment,{children:[ns("button",{"aria-label":t,className:e+(a?" active":""),"data-dropdown-key":n,disabled:r,onClick:h=>{h.preventDefault(),p(!a)},onMouseDown:h=>{h.preventDefault()},ref:d,type:"button",children:[l&&Me(l,{}),s&&Me("span",{className:"toolbar-popup__dropdown-label",children:s}),Me("i",{className:"toolbar-popup__dropdown-caret"})]}),a&&Me(no.Fragment,{children:f})]})}var mr="toolbar-popup__dropdown",u0=t=>{let e=o0(18),{active:o,anchorElem:r,editor:n,enabled:l,item:i}=t,{i18n:s}=a0(),{fieldProps:u}=j(),{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,itemKey:i.key,tooltip:a,children:ot("span",{className:"text",children:p})},i.key),e[11]=o,e[12]=p,e[13]=n,e[14]=l,e[15]=i,e[16]=a,e[17]=m):m=e[17],m},d0=us.memo(u0),Ue=({anchorElem:t,classNames:e,editor:o,group:r,Icon:n,itemsContainerClassNames:l,label:i,maxActiveItems:s,onActiveChange:u})=>{let[c,d]=us.useState({activeItemKeys:[],enabledGroup:!0,enabledItemKeys:[]}),a=n0(c),p=j(),{items:m,key:f}=r,h=Ot(),g=r0(()=>{o.getEditorState().read(()=>{let T=c0();if(!T)return;let M=[],k=[],_=[];for(let x of m)x.isActive&&(!s||M.length<s)&&x.isActive({editor:o,editorConfigContext:p,selection:T})&&(M.push(x.key),k.push(x)),x.isEnabled?x.isEnabled({editor:o,editorConfigContext:p,selection:T})&&_.push(x.key):_.push(x.key);d({activeItemKeys:M,enabledGroup:r.isEnabled?r.isEnabled({editor:o,editorConfigContext:p,selection:T}):!0,enabledItemKeys:_}),u&&u({activeItems:k})})},[o,p,r,m,s,u]);l0(()=>(h(g),s0(o.registerUpdateListener(async()=>{await h(g)}))),[o,h,g]);let b=i0(()=>m?.length?m.map(T=>ot(d0,{active:a.activeItemKeys.includes(T.key),anchorElem:t,editor:o,enabled:a.enabledItemKeys.includes(T.key),item:T},T.key)):null,[m,a,t,o]);return ot(cs,{buttonAriaLabel:`${f} dropdown`,buttonClassName:[mr,`${mr}-${f}`,...e||[]].filter(Boolean).join(" "),disabled:!a.enabledGroup,dropdownKey:f,Icon:n,itemsContainerClassNames:[`${mr}-items`,...l||[]],label:i,children:b},f)};function C0({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&me(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?me(It,{editor:e,item:o,children:me(o.ChildComponent,{})},o.key):null}function b0(t){let e=ds(23),{anchorElem:o,editor:r,editorConfig:n,group:l,index:i}=t,{i18n:s}=g0(),{fieldProps:u}=j(),{featureClientSchemaMap:c,schemaPath:d}=u,[a,p]=Se.useState(void 0),[m,f]=Se.useState(void 0),h;e[0]!==l.ChildComponent||e[1]!==l.items||e[2]!==l.type?(h=()=>{l?.type==="dropdown"&&l.items.length&&l.ChildComponent?f(()=>l.ChildComponent):f(void 0)},e[0]=l.ChildComponent,e[1]=l.items,e[2]=l.type,e[3]=h):h=e[3];let g;e[4]!==l?(g=[l],e[4]=l,e[5]=g):g=e[5],Se.useEffect(h,g);let b;e[6]!==c||e[7]!==l.ChildComponent||e[8]!==l.items||e[9]!==l.type||e[10]!==s||e[11]!==d?(b=_=>{let{activeItems:x}=_;if(!x.length){l?.type==="dropdown"&&l.items.length&&l.ChildComponent?(f(()=>l.ChildComponent),p(void 0)):(f(void 0),p(void 0));return}let S=x[0],D=S.key;S.label&&(D=typeof S.label=="function"?S.label({featureClientSchemaMap:c,i18n:s,schemaPath:d}):S.label),D.length>25&&(D=D.substring(0,25)+"..."),x.length===1?(p(D),f(()=>S.ChildComponent)):(p(s.t("lexical:general:toolbarItemsActive",{count:x.length})),l?.type==="dropdown"&&l.items.length&&l.ChildComponent?f(()=>l.ChildComponent):f(void 0))},e[6]=c,e[7]=l.ChildComponent,e[8]=l.items,e[9]=l.type,e[10]=s,e[11]=d,e[12]=b):b=e[12];let T=b,M=`fixed-toolbar__group fixed-toolbar__group-${l.key}`,k;return e[13]!==m||e[14]!==o||e[15]!==a||e[16]!==r||e[17]!==n.features.toolbarFixed?.groups.length||e[18]!==l||e[19]!==i||e[20]!==T||e[21]!==M?(k=m0("div",{className:M,"data-toolbar-group-key":l.key,children:[l.type==="dropdown"&&l.items.length?m?me(Ue,{anchorElem:o,editor:r,group:l,Icon:m,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:l.maxActiveItems??1,onActiveChange:T}):me(Ue,{anchorElem:o,editor:r,group:l,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:l.maxActiveItems??1,onActiveChange:T}):null,l.type==="buttons"&&l.items.length?l.items.map(_=>me(C0,{anchorElem:o,editor:r,item:_},_.key)):null,i<n.features.toolbarFixed?.groups.length-1&&me("div",{className:"divider"})]},l.key),e[13]=m,e[14]=o,e[15]=a,e[16]=r,e[17]=n.features.toolbarFixed?.groups.length,e[18]=l,e[19]=i,e[20]=T,e[21]=M,e[22]=k):k=e[22],k}function k0({anchorElem:t,clientProps:e,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let l=Se.useRef(null),{y:i}=f0(),s=x0(()=>{if(!n||e?.disableIfParentHasFixedToolbar)return null;let c=n.editorContainerRef.current.previousElementSibling;for(;c;){if(c.classList.contains("fixed-toolbar"))return c;c=c.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,n]);return h0(()=>{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(Se.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((u,c)=>me(b0,{anchorElem:t,editor:o,editorConfig:r,group:u,index:c},u.key))})})}var ms=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return ms(t.parentEditor)}return!1},ps=t=>{let e=ds(6),{clientProps:o}=t,[r]=p0(),n=j(),{editorConfig:l}=n,i=o.applyToFocusedEditor&&n.focusedEditor?.editor||r,s=o.applyToFocusedEditor&&n.focusedEditor?.editorConfig||l,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=ms(n);if(o?.disableIfParentHasFixedToolbar&&d){c=null;break e}if(!s?.features?.toolbarFixed?.groups?.length){c=null;break e}u=me(k0,{anchorElem:document.body,editor:i,editorConfig:s,parentWithFixedToolbar:d})}e[0]=o.disableIfParentHasFixedToolbar,e[1]=i,e[2]=s,e[3]=n,e[4]=u,e[5]=c}else u=e[4],c=e[5];return c!==Symbol.for("react.early_return_sentinel")?c:u};var _0=y({plugins:[{Component:ps,position:"aboveContainer"}]});import{c as gs}from"react/compiler-runtime";import{jsx as ge,jsxs as xs}from"react/jsx-runtime";import{useLexicalComposerContext as T0}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Cs}from"@lexical/utils";import{$getSelection as bs,$isRangeSelection as fs,$isTextNode as w0,COMMAND_PRIORITY_LOW as E0,getDOMSelection as ks,SELECTION_CHANGE_COMMAND as N0}from"lexical";import{useCallback as so,useEffect as Rt,useRef as hs,useState as S0}from"react";import*as ao from"react";import{createPortal as L0}from"react-dom";function pr(t,e){let o=t.getRangeAt(0),r;if(t.anchorNode===e){let n=e;for(;n.firstElementChild!=null;)n=n.firstElementChild;r=n.getBoundingClientRect()}else r=o.getBoundingClientRect();return r}function io(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:r=0,floatingElem:n,horizontalOffset:l=32,horizontalPosition:i="left",specialHandlingForCaret:s=!1,targetRect: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 g=0;return!e&&f<m.top&&!s&&(g=a.height+u.height+c*2,f+=g),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)`),g}function y0({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&ge(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?ge(It,{editor:e,item:o,children:ge(o.ChildComponent,{})},o.key):null}function I0(t){let e=gs(19),{anchorElem:o,editor:r,group:n,index:l}=t,{editorConfig:i}=j(),[s,u]=ao.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],ao.useEffect(c,d);let a;e[6]!==n.ChildComponent||e[7]!==n.items||e[8]!==n.type?(a=h=>{let{activeItems:g}=h;if(!g.length){n?.type==="dropdown"&&n.items.length&&n.ChildComponent?u(()=>n.ChildComponent):u(void 0);return}let b=g[0];u(()=>b?.ChildComponent)},e[6]=n.ChildComponent,e[7]=n.items,e[8]=n.type,e[9]=a):a=e[9];let p=a,m=`inline-toolbar-popup__group inline-toolbar-popup__group-${n.key}`,f;return e[10]!==s||e[11]!==o||e[12]!==r||e[13]!==i.features.toolbarInline?.groups.length||e[14]!==n||e[15]!==l||e[16]!==p||e[17]!==m?(f=xs("div",{className:m,"data-toolbar-group-key":n.key,children:[n.type==="dropdown"&&n.items.length?s?ge(Ue,{anchorElem:o,editor:r,group:n,Icon:s,maxActiveItems:n.maxActiveItems??1,onActiveChange:p}):ge(Ue,{anchorElem:o,editor:r,group:n,maxActiveItems:n.maxActiveItems??1,onActiveChange:p}):null,n.type==="buttons"&&n.items.length?n.items.map(h=>ge(y0,{anchorElem:o,editor:r,item:h},h.key)):null,l<i.features.toolbarInline?.groups.length-1&&ge("div",{className:"divider"})]},n.key),e[10]=s,e[11]=o,e[12]=r,e[13]=i.features.toolbarInline?.groups.length,e[14]=n,e[15]=l,e[16]=p,e[17]=m,e[18]=f):f=e[18],f}function R0({anchorElem:t,editor:e}){let o=hs(null),r=hs(null),{editorConfig:n}=j(),l=so(()=>{if(o?.current){let 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=so(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=so(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);Rt(()=>(document.addEventListener("mousemove",i),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",s)}),[o,i,s]);let u=so(()=>{let c=bs(),d=ks(e._window);if(o.current===null)return;let a=t.querySelector(":scope > .link-editor"),p=a!==null&&"style"in a&&a?.style?.opacity==="1",m=e.getRootElement();if(c!==null&&d!==null&&!d.isCollapsed&&m!==null&&m.contains(d.anchorNode)){let f=pr(d,m),h=io({alwaysDisplayOnTop:p,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});r.current&&io({anchorElem:o.current,anchorFlippedOffset:h,floatingElem:r.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else l()},[e,l,t]);return Rt(()=>{let 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]),Rt(()=>(e.getEditorState().read(()=>{u()}),Cs(e.registerUpdateListener(({editorState:c})=>{c.read(()=>{u()})}),e.registerCommand(N0,()=>(u(),!1),E0))),[e,u]),xs("div",{className:"inline-toolbar-popup",ref:o,children:[ge("div",{className:"caret",ref:r}),n?.features&&n.features?.toolbarInline?.groups.map((c,d)=>ge(I0,{anchorElem:t,editor:e,group:c,index:d},c.key))]})}function v0(t,e){let o=gs(12),[r,n]=S0(!1),l;o[0]!==t?(l=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let p=bs(),m=ks(t._window),f=t.getRootElement();if(m!==null&&(!fs(p)||f===null||!f.contains(m.anchorNode))){n(!1);return}if(!fs(p))return;if(p.getTextContent()!==""){let g=p.getNodes(),b=!1;for(let T of g)if(w0(T)){n(!0),b=!0;break}b||n(!1)}else n(!1);let h=p.getTextContent().replace(/\n/g,"");if(!p.isCollapsed()&&h===""){n(!1);return}})},o[0]=t,o[1]=l):l=o[1];let i=l,s,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]),Rt(s,u);let c,d;if(o[5]!==t||o[6]!==i?(c=()=>Cs(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]),Rt(c,d),!r||!t.isEditable())return null;let a;return o[9]!==e||o[10]!==t?(a=L0(ge(R0,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=a):a=o[11],a}var _s=t=>{let{anchorElem:e}=t,[o]=T0();return v0(o,e)};var M0=y({plugins:[{Component:_s,position:"floatingAnchorElem"}]});import{TableCellNode as Th,TableNode as wh,TableRowNode as Eh}from"@lexical/table";import{jsx as Ts}from"react/jsx-runtime";import"react";var fr=()=>Ts("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Ts("path",{clipRule:"evenodd",d:"M5.33333 4.5C4.8731 4.5 4.5 4.8731 4.5 5.33333V7.5H9.5V4.5H5.33333ZM5.33333 3.5C4.32081 3.5 3.5 4.32081 3.5 5.33333V14.6667C3.5 15.6792 4.32081 16.5 5.33333 16.5H14.6667C15.6792 16.5 16.5 15.6792 16.5 14.6667V5.33333C16.5 4.32081 15.6792 3.5 14.6667 3.5H5.33333ZM10.5 4.5V7.5H15.5V5.33333C15.5 4.8731 15.1269 4.5 14.6667 4.5H10.5ZM15.5 8.5H10.5V11.5H15.5V8.5ZM15.5 12.5H10.5V15.5H14.6667C15.1269 15.5 15.5 15.1269 15.5 14.6667V12.5ZM9.5 15.5V12.5H4.5V14.6667C4.5 15.1269 4.8731 15.5 5.33333 15.5H9.5ZM4.5 11.5H9.5V8.5H4.5V11.5Z",fill:"currentColor",fillRule:"evenodd"})});import{$createTableCellNode as D0,$createTableNode as A0,$createTableRowNode as O0,$isTableCellNode as ws,$isTableNode as hr,$isTableRowNode as gr,TableCellHeaderStates as co,TableCellNode as $0,TableNode as F0,TableRowNode as P0}from"@lexical/table";import{$isParagraphNode as B0,$isTextNode as H0}from"lexical";var Ns=/^\|(.+)\|\s?$/,j0=/^(\| ?:?-*:? ?)+\|\s?$/,Ss=({allTransformers:t})=>({type:"element",dependencies:[F0,P0,$0],export:e=>{if(!hr(e))return null;let o=[];for(let r of e.getChildren()){let n=[];if(!gr(r))continue;let l=!1;for(let i of r.getChildren())ws(i)&&(n.push(Br(t,i).replace(/\n/g,"\\n").trim()),i.__headerState===co.ROW&&(l=!0));o.push(`| ${n.join(" | ")} |`),l&&o.push(`| ${n.map(i=>"---").join(" | ")} |`)}return o.join(`
|
|
39
|
-
`)},regExp:Ns,replace:(e,o,r)=>{let n=r[0];if(!n)return;if(
|
|
40
|
-
`);let o=D0(co.NO_STATUS);return Pr(t,e,o),o},Es=(t,e)=>{let o=t.match(Ns);return!o||!o[1]?null:o[1].split("|").map(r=>Ls(r,e))};import{c as W0}from"react/compiler-runtime";import{jsx as P,jsxs as Le}from"react/jsx-runtime";import{useLexicalComposerContext as vs}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as V0}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as Cr,$deleteTableColumn__EXPERIMENTAL as K0,$deleteTableRow__EXPERIMENTAL as J0,$getNodeTriplet as X0,$getTableCellNodeFromLexicalNode as Is,$getTableColumnIndexFromTableCellNode as z0,$getTableNodeFromLexicalNodeOrThrow as ye,$getTableRowIndexFromTableCellNode as Z0,$insertTableColumn__EXPERIMENTAL as Y0,$insertTableRow__EXPERIMENTAL as q0,$isTableCellNode as Ms,$isTableSelection as vt,$unmergeCell as Q0,getTableElement as br,getTableObserverFromTableElement as kr,TableCellHeaderStates as De,TableCellNode as e1}from"@lexical/table";import{mergeRegister as t1}from"@lexical/utils";import{useScrollInfo as o1}from"@payloadcms/ui";import{$createParagraphNode as r1,$getSelection as mo,$isElementNode as n1,$isParagraphNode as l1,$isRangeSelection as _r,$isTextNode as i1,$setSelection as s1,COMMAND_PRIORITY_CRITICAL as a1,getDOMSelection as c1,isDOMNode as u1,SELECTION_CHANGE_COMMAND as d1}from"lexical";import*as Tr from"react";import{useCallback as pe,useEffect as rt,useRef as uo,useState as nt}from"react";import{createPortal as Ds}from"react-dom";import{jsx as xr,jsxs as G0}from"react/jsx-runtime";import"react";var ys=()=>G0("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[xr("path",{d:"M5 11C5.55228 11 6 10.5523 6 10C6 9.44772 5.55228 9 5 9C4.44772 9 4 9.44772 4 10C4 10.5523 4.44772 11 5 11Z",fill:"currentColor"}),xr("path",{d:"M10 11C10.5523 11 11 10.5523 11 10C11 9.44772 10.5523 9 10 9C9.44772 9 9 9.44772 9 10C9 10.5523 9.44772 11 10 11Z",fill:"currentColor"}),xr("path",{d:"M15 11C15.5523 11 16 10.5523 16 10C16 9.44772 15.5523 9 15 9C14.4477 9 14 9.44772 14 10C14 10.5523 14.4477 11 15 11Z",fill:"currentColor"})]});function Rs(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function m1(){let t=mo();if(_r(t)&&!t.isCollapsed()||vt(t)&&!t.anchor.is(t.focus)||!_r(t)&&!vt(t))return!1;let[e]=X0(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function p1(t){if(t.getChildrenSize()!==1)return!1;let e=t.getFirstChildOrThrow();return!(!l1(e)||!e.isEmpty())}function f1(t){let e=t.getLastDescendant();i1(e)?e.select():n1(e)?e.selectEnd():e!==null&&e.selectNext()}function h1({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[l]=vs(),i=uo(null),[s,u]=nt(n),[c,d]=nt({columns:1,rows:1}),[a,p]=nt(!1),[m,f]=nt(!1),{y:h}=o1();rt(()=>l.registerMutationListener(e1,C=>{C.get(s.getKey())==="updated"&&l.getEditorState().read(()=>{u(s.getLatest())})},{skipInitialization:!0}),[l,s]),rt(()=>{l.getEditorState().read(()=>{let C=mo();if(vt(C)){let N=Rs(C);d(Rs(C)),p(N.columns>1||N.rows>1)}f(m1())})},[l]),rt(()=>{let C=e.current,N=i.current,R=l.getRootElement();if(C!=null&&N!=null&&R!=null){let L=R.getBoundingClientRect(),v=C.getBoundingClientRect();N.style.opacity="1";let E=N.getBoundingClientRect(),$=5,H=v.right+$;if(H+E.width>window.innerWidth||H+E.width>L.right){let Y=v.left-E.width-$;H=(Y<0?$:Y)+window.pageXOffset}N.style.left=`${H+window.pageXOffset}px`;let W=v.top;if(W+E.height>window.innerHeight){let Y=v.bottom-E.height;W=Y<0?$:Y}N.style.top=`${W}px`}},[e,i,l,h]),rt(()=>{function C(N){i.current!=null&&e.current!=null&&u1(N.target)&&!i.current.contains(N.target)&&!e.current.contains(N.target)&&r(!1)}return window.addEventListener("click",C),()=>window.removeEventListener("click",C)},[r,e]);let g=pe(()=>{l.update(()=>{if(s.isAttached()){let C=ye(s),N=br(C,l.getElementByKey(C.getKey()));if(N===null)throw new Error("Expected to find tableElement in DOM");let R=kr(N);R!==null&&R.$clearHighlight(),C.markDirty(),u(s.getLatest())}s1(null)})},[l,s]),b=()=>{l.update(()=>{let C=mo();if(vt(C)){let R=C.getNodes().filter(Ms);if(R.length===0)return;let L=ye(R[0]),[v]=Cr(L,null,null),E=1/0,$=-1/0,H=1/0,W=-1/0,Y=new Set;for(let q of v)for(let K of q){if(!K||!K.cell)continue;let re=K.cell.getKey();if(!Y.has(re)&&R.some(ne=>ne.is(K.cell))){Y.add(re);let ne=K.startRow,se=K.startColumn,Ae=K.cell.__rowSpan||1,it=K.cell.__colSpan||1;E=Math.min(E,ne),$=Math.max($,ne+Ae-1),H=Math.min(H,se),W=Math.max(W,se+it-1)}}if(E===1/0||H===1/0)return;let We=$-E+1,V=W-H+1,U=v?.[E]?.[H];if(!U?.cell)return;let oe=U.cell;oe.setColSpan(V),oe.setRowSpan(We);let ue=new Set([oe.getKey()]);for(let q=E;q<=$;q++)for(let K=H;K<=W;K++){let re=v?.[q]?.[K];if(!re?.cell)continue;let ne=re.cell,se=ne.getKey();ue.has(se)||(ue.add(se),p1(ne)||oe.append(...ne.getChildren()),ne.remove())}oe.getChildrenSize()===0&&oe.append(r1()),f1(oe),o()}})},T=()=>{l.update(()=>{Q0()})},M=pe(C=>{l.update(()=>{for(let N=0;N<c.rows;N++)q0(C);o()})},[l,o,c.rows]),k=pe(C=>{l.update(()=>{for(let N=0;N<c.columns;N++)Y0(C);o()})},[l,o,c.columns]),_=pe(()=>{l.update(()=>{J0(),o()})},[l,o]),x=pe(()=>{l.update(()=>{ye(s).remove(),g(),o()})},[l,s,g,o]),S=pe(()=>{l.update(()=>{K0(),o()})},[l,o]),D=pe(()=>{l.update(()=>{let C=ye(s),N=Z0(s),[R]=Cr(C,null,null),L=new Set,v=s.getHeaderStyles()^De.ROW;if(R[N])for(let E=0;E<R[N].length;E++){let $=R[N][E];$?.cell&&(L.has($.cell)||(L.add($.cell),$.cell.setHeaderStyles(v,De.ROW)))}g(),o()})},[l,s,g,o]),O=pe(()=>{l.update(()=>{let C=ye(s),N=z0(s),[R]=Cr(C,null,null),L=new Set,v=s.getHeaderStyles()^De.COLUMN;if(R)for(let E=0;E<R.length;E++){let $=R?.[E]?.[N];$?.cell&&(L.has($.cell)||(L.add($.cell),$.cell.setHeaderStyles(v,De.COLUMN)))}g(),o()})},[l,s,g,o]),F=pe(()=>{l.update(()=>{if(s.isAttached()){let C=ye(s);C&&C.setRowStriping(!C.getRowStriping())}g(),o()})},[l,s,g,o]),I=pe(()=>{l.update(()=>{if(s.isAttached()){let C=ye(s);C&&C.setFrozenColumns(C.getFrozenColumns()===0?1:0)}g(),o()})},[l,s,g,o]),w=null;return t&&(a?w=P("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>b(),type:"button",children:P("span",{className:"text",children:"Merge cells"})}):m&&(w=P("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>T(),type:"button",children:P("span",{className:"text",children:"Unmerge cells"})}))),Ds(Le("div",{className:"table-action-menu-dropdown",onClick:C=>{C.stopPropagation()},ref:i,children:[w?Le(Tr.Fragment,{children:[w,P("hr",{})]}):null,P("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>F(),type:"button",children:P("span",{className:"text",children:"Toggle Row Striping"})}),P("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>I(),type:"button",children:P("span",{className:"text",children:"Toggle First Column Freeze"})}),P("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>M(!1),type:"button",children:Le("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," above"]})}),P("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>M(!0),type:"button",children:Le("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," below"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>k(!1),type:"button",children:Le("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","left"]})}),P("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>k(!0),type:"button",children:Le("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","right"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>S(),type:"button",children:P("span",{className:"text",children:"Delete column"})}),P("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>_(),type:"button",children:P("span",{className:"text",children:"Delete row"})}),P("button",{className:"item","data-test-id":"table-delete",onClick:()=>x(),type:"button",children:P("span",{className:"text",children:"Delete table"})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-row-header",onClick:()=>D(),type:"button",children:Le("span",{className:"text",children:[(s.__headerState&De.ROW)===De.ROW?"Remove":"Add"," ","row header"]})}),P("button",{className:"item","data-test-id":"table-column-header",onClick:()=>O(),type:"button",children:Le("span",{className:"text",children:[(s.__headerState&De.COLUMN)===De.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function g1({anchorElem:t,cellMerge:e}){let[o]=vs(),r=uo(null),n=uo(null),[l,i]=nt(!1),[s,u]=nt(null),c=pe(()=>{let a=r.current,p=mo(),m=c1(o._window),f=document.activeElement;function h(){a&&(a.classList.remove("table-cell-action-button-container--active"),a.classList.add("table-cell-action-button-container--inactive")),u(null)}if(p==null||a==null)return h();let g=o.getRootElement(),b=null,T=null;if(_r(p)&&g!==null&&m!==null&&g.contains(m.anchorNode)){let k=Is(p.anchor.getNode());if(k==null||(T=o.getElementByKey(k.getKey()),T==null||!k.isAttached()))return h();let _=ye(k),x=br(_,o.getElementByKey(_.getKey()));if(x===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");b=kr(x),u(k)}else if(vt(p)){let k=Is(p.anchor.getNode());if(!Ms(k))throw new Error("TableSelection anchorNode must be a TableCellNode");let _=ye(k),x=br(_,o.getElementByKey(_.getKey()));if(x===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");b=kr(x),T=o.getElementByKey(k.getKey())}else if(!f)return h();if(b===null||T===null)return h();let M=!b||!b.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",M),a.classList.toggle("table-cell-action-button-container--inactive",!M),M){let k=T.getBoundingClientRect(),_=t.getBoundingClientRect(),x=k.top-_.top,S=k.right-_.left;a.style.transform=`translate(${S}px, ${x}px)`}},[o,t]);rt(()=>{let a,p=()=>{a=void 0,o.getEditorState().read(c)},m=()=>(a===void 0&&(a=setTimeout(p,0)),!1);return t1(o.registerUpdateListener(m),o.registerCommand(d1,m,a1),o.registerRootListener((f,h)=>{h&&h.removeEventListener("pointerup",m),f&&(f.addEventListener("pointerup",m),m())}),()=>clearTimeout(a))});let d=uo(s);return rt(()=>{d.current!==s&&i(!1),d.current=s},[d,s]),P("div",{className:"table-cell-action-button-container",ref:r,children:s!=null&&Le(Tr.Fragment,{children:[P("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),i(!l)},ref:n,type:"button",children:P(ys,{})}),l&&P(h1,{cellMerge:e,contextRef:n,onClose:()=>i(!1),setIsMenuOpen:i,tableCellNode:s})]})})}var As=t=>{let e=W0(3),{anchorElem:o}=t,r=V0(),n;return e[0]!==o||e[1]!==r?(n=Ds(r?P(g1,{anchorElem:o??document.body,cellMerge:!0}):null,o??document.body),e[0]=o,e[1]=r,e[2]=n):n=e[2],n};import{c as x1}from"react/compiler-runtime";import{jsx as fo,jsxs as C1}from"react/jsx-runtime";import{useLexicalComposerContext as b1}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as k1}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as _1,$getTableNodeFromLexicalNodeOrThrow as wr,$getTableRowIndexFromTableCellNode as T1,$isTableCellNode as Os,$isTableRowNode as w1,getDOMCellFromTarget as E1,getTableElement as N1,TableNode as $s}from"@lexical/table";import{calculateZoomLevel as Fs,mergeRegister as S1}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Er,isHTMLElement as L1}from"lexical";import*as Bs from"react";import{useCallback as Mt,useEffect as Nr,useRef as po,useState as lt}from"react";import{createPortal as y1}from"react-dom";var I1=33,Ps=92;function R1({editor:t}){let e=po(null),o=po(null),r=po(null),[n,l]=lt(!1),i=j(),s=po(null),[u,c]=lt(null),[d,a]=lt(null),[p,m]=lt(!1),[f,h]=lt(null),g=Mt(()=>{a(null),e.current=null,h(null),s.current=null,r.current=null},[]),b=I=>(I.buttons&1)===1;Nr(()=>{let I=new Set;return S1(t.registerMutationListener($s,w=>{for(let[C,N]of w)N==="destroyed"?I.delete(C):I.add(C);l(I.size>0)}),t.registerNodeTransform($s,w=>{if(w.getColWidths())return w;let C=w.getColumnCount(),N=Ps;return w.setColWidths(Array(C).fill(N)),w}))},[t]),Nr(()=>{if(!n)return;let I=R=>{let L=R.target;if(L1(L)){if(f){c({x:R.clientX,y:R.clientY});return}if(m(b(R)),!(o.current&&o.current.contains(L))&&e.current!==L){e.current=L;let v=E1(L);v&&d!==v?t.getEditorState().read(()=>{let E=Er(v.elem);if(!E)throw new Error("TableCellResizer: Table cell node not found.");let $=wr(E),H=N1($,t.getElementByKey($.getKey()));if(!H)throw new Error("TableCellResizer: Table element not found.");e.current=L,r.current=H.getBoundingClientRect(),a(v)},{editor:t}):v==null&&g()}}},w=R=>{m(!0)},C=R=>{m(!1)},N=t.registerRootListener((R,L)=>{L?.removeEventListener("mousemove",I),L?.removeEventListener("mousedown",w),L?.removeEventListener("mouseup",C),R?.addEventListener("mousemove",I),R?.addEventListener("mousedown",w),R?.addEventListener("mouseup",C)});return()=>{N()}},[d,f,t,n,g]);let T=I=>I==="bottom",M=Mt(I=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let w=Er(d.elem);if(!Os(w))throw new Error("TableCellResizer: Table cell node not found.");let C=wr(w),N=T1(w),R=C.getChildren(),v=w.getColSpan()===C.getColumnCount()?N:N+w.getRowSpan()-1;if(v>=R.length||v<0)throw new Error("Expected table cell to be inside of table row.");let E=R[v];if(!w1(E))throw new Error("Expected table row");let $=E.getHeight();if($===void 0){let W=E.getChildren();$=Math.min(...W.map(Y=>k(Y,t)??1/0))}let H=Math.max($+I,I1);E.setHeight(H)},{tag:"skip-scroll-into-view"})},[d,t]),k=(I,w)=>w.getElementByKey(I.getKey())?.clientHeight,_=(I,w)=>{let C;return w.forEach(N=>{N.forEach((R,L)=>{R.cell===I&&(C=L)})}),C},x=Mt(I=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let w=Er(d.elem);if(!Os(w))throw new Error("TableCellResizer: Table cell node not found.");let C=wr(w),[N]=_1(C,null,null),R=_(w,N);if(R===void 0)throw new Error("TableCellResizer: Table column not found.");let L=C.getColWidths();if(!L)return;let v=L[R];if(v===void 0)return;let E=[...L],$=Math.max(v+I,Ps);E[R]=$,C.setColWidths(E)},{tag:"skip-scroll-into-view"})},[d,t]),S=Mt(I=>{let w=C=>{if(C.preventDefault(),C.stopPropagation(),!d)throw new Error("TableCellResizer: Expected active cell.");if(s.current){let{x:N,y:R}=s.current;if(d===null)return;let L=Fs(C.target);if(T(I)){let v=(C.clientY-R)/L;M(v)}else{let v=(C.clientX-N)/L;x(v)}g(),document.removeEventListener("mouseup",w)}};return w},[d,g,x,M]),D=Mt(I=>w=>{if(w.preventDefault(),w.stopPropagation(),!d)throw new Error("TableCellResizer: Expected active cell.");s.current={x:w.clientX,y:w.clientY},c(s.current),h(I),document.addEventListener("mouseup",S(I))},[d,S]),[O,F]=lt({bottom:null,left:null,right:null,top:null});return Nr(()=>{if(d){let{height:I,left:w,top:C,width:N}=d.elem.getBoundingClientRect(),R=Fs(d.elem),L=10,v={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${L}px`,left:`${window.scrollX+w}px`,top:`${window.scrollY+C+I-L/2}px`,width:`${N}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${I}px`,left:`${window.scrollX+w+N-L/2}px`,top:`${window.scrollY+C}px`,width:`${L}px`}},E=r.current;f&&u&&E&&(T(f)?(v[f].left=`${window.scrollX+E.left}px`,v[f].top=`${window.scrollY+u.y/R}px`,v[f].height="3px",v[f].width=`${E.width}px`):(v[f].top=`${window.scrollY+E.top}px`,v[f].left=`${window.scrollX+u.x/R}px`,v[f].width="3px",v[f].height=`${E.height}px`),v[f].backgroundColor="#adf"),F(v)}else F({bottom:null,left:null,right:null,top:null})},[d,f,u]),fo("div",{ref:o,children:d!=null&&!p&&C1(Bs.Fragment,{children:[fo("div",{className:`${i.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:D("right"),style:O.right||void 0}),fo("div",{className:`${i.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:D("bottom"),style:O.bottom||void 0})]})})}var Hs=()=>{let t=x1(3),[e]=b1(),o=k1(),r,n;return t[0]!==e||t[1]!==o?(n=o?y1(fo(R1,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=n):n=t[2],r=n,r};import{c as P1}from"react/compiler-runtime";import{jsx as Sr,jsxs as B1,Fragment as H1}from"react/jsx-runtime";import{useLexicalComposerContext as Xs}from"@lexical/react/LexicalComposerContext";import{$getTableAndElementByKey as j1,$getTableColumnIndexFromTableCellNode as U1,$getTableRowIndexFromTableCellNode as G1,$insertTableColumn__EXPERIMENTAL as W1,$insertTableRow__EXPERIMENTAL as V1,$isTableCellNode as K1,$isTableNode as Gs,getTableElement as J1,TableNode as X1}from"@lexical/table";import{$findMatchingParent as z1,mergeRegister as Z1}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Ws,isHTMLElement as Y1}from"lexical";import{useEffect as Vs,useMemo as q1,useRef as Ks,useState as ho}from"react";import"react";import{createPortal as Q1}from"react-dom";import{c as O1}from"react/compiler-runtime";import{useEffect as $1,useRef as F1}from"react";var v1="Expected a function",M1=Math.max,D1=Math.min;function A1(t,e,o){let r,n,l=0,i,s=!1,u=!1,c,d,a,p=!0;if(typeof t!="function")throw new TypeError(v1);e=e||0,typeof o=="object"&&(s=!!o.leading,u="maxWait"in o,c=u?M1(o.maxWait||0,e):c,p="trailing"in o?!!o.trailing:p);function m(x){let S=r,D=i;return r=i=void 0,l=x,d=t.apply(D,S),d}function f(x){return l=x,a=setTimeout(b,e),s?m(x):d}function h(x){let S=x-n,D=x-l,O=e-S;return u?D1(O,c-D):O}function g(x){let S=x-n,D=x-l;return n===void 0||S>=e||S<0||u&&D>=c}function b(){let x=Date.now();if(g(x))return T(x);a=setTimeout(b,h(x))}function T(x){return a=void 0,p&&r?m(x):(r=i=void 0,d)}function M(){a!==void 0&&clearTimeout(a),l=0,r=n=i=a=void 0}function k(){return a===void 0?d:T(Date.now())}function _(){let x=Date.now(),S=g(x);if(r=arguments,i=this,n=x,S){if(a===void 0)return f(n);if(u)return clearTimeout(a),a=setTimeout(b,e),m(n)}return a===void 0&&(a=setTimeout(b,e)),d}return _.cancel=M,_.flush=k,_}var js=A1;function Us(t,e,o){let r=O1(6),n=F1(null),l,i;r[0]!==t||r[1]!==o||r[2]!==e?(l=()=>(n.current=js(t,e,{maxWait:o}),()=>{n.current?.cancel()}),i=[t,e,o],r[0]=t,r[1]=o,r[2]=e,r[3]=l,r[4]=i):(l=r[3],i=r[4]),$1(l,i);let s;return r[5]===Symbol.for("react.memo_cache_sentinel")?(s=(...c)=>{let d=c;n.current&&n.current(...d)},r[5]=s):s=r[5],s}var Js=20;function eh({anchorElem:t}){let[e]=Xs(),o=j(),[r,n]=ho(!1),[l,i]=ho(!1),[s,u]=ho(!1),[c,d]=ho({}),a=Ks(new Set),p=Ks(null),m=Us(g=>{let{isOutside:b,tableDOMNode:T}=th(g,o.editorConfig?.lexical);if(b){n(!1),i(!1);return}if(!T)return;p.current=T;let M=null,k=null,_=null;if(e.getEditorState().read(()=>{let L=Ws(T);if(K1(L)){let v=z1(L,E=>Gs(E));if(!Gs(v))return;if(_=J1(v,e.getElementByKey(v.getKey())),_){let E=v.getChildrenSize(),$=v.getChildAtIndex(0)?.getChildrenSize(),H=G1(L),W=U1(L);H===E-1?M=L:W===$-1&&(k=L)}}},{editor:e}),!_)return;let x=_.parentElement;if(!x)return;let{bottom:S,height:D,left:O,right:F,width:I,y:w}=_.getBoundingClientRect(),C=!1;x&&x.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(C=x.scrollWidth>x.clientWidth);let{left:N,y:R}=t.getBoundingClientRect();M?(i(!1),n(!0),d({height:Js,left:C&&x?x.offsetLeft:O-N,top:S-R+5,width:C&&x?x.offsetWidth:I})):k&&(i(!0),n(!1),d({height:D,left:F-N+5,top:w-R,width:Js}))},50,250),f=q1(()=>new ResizeObserver(()=>{n(!1),i(!1)}),[]);Vs(()=>{if(s)return document.addEventListener("mousemove",m),()=>{n(!1),i(!1),document.removeEventListener("mousemove",m)}},[s,m]),Vs(()=>Z1(e.registerMutationListener(X1,g=>{e.getEditorState().read(()=>{let b=!1;for(let[T,M]of g)switch(M){case"created":{a.current.add(T),b=!0;break}case"destroyed":{a.current.delete(T),b=!0;break}default:break}if(b){f.disconnect();for(let T of a.current){let{tableElement:M}=j1(T);f.observe(M)}u(a.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,f]);let h=g=>{e.update(()=>{p.current&&(Ws(p.current)?.selectEnd(),g?(V1(),n(!1)):(W1(),i(!1)))})};return e?.isEditable()?B1(H1,{children:[r&&Sr("button",{"aria-label":"Add Row",className:o.editorConfig.lexical.theme.tableAddRows,onClick:()=>h(!0),style:{...c},type:"button"}),l&&Sr("button",{"aria-label":"Add Column",className:o.editorConfig.lexical.theme.tableAddColumns,onClick:()=>h(!1),style:{...c},type:"button"})]}):null}function th(t,e){let o=t.target;if(Y1(o)){let r=o.closest(`td.${e.theme.tableCell}, th.${e.theme.tableCell}`);return{isOutside:!(r||o.closest(`button.${e.theme.tableAddRows}`)||o.closest(`button.${e.theme.tableAddColumns}`)||o.closest(`div.${e.theme.tableCellResizer}`)),tableDOMNode:r}}else return{isOutside:!0,tableDOMNode:null}}function zs(t){let e=P1(2),{anchorElem:o}=t,r=o===void 0?document.body:o,[n]=Xs();if(!n?.isEditable())return null;let l;return e[0]!==r?(l=Q1(Sr(eh,{anchorElem:r}),r),e[0]=r,e[1]=l):l=e[1],l}import{c as oh}from"react/compiler-runtime";import{jsx as Lr,jsxs as rh}from"react/jsx-runtime";import{useLexicalComposerContext as nh}from"@lexical/react/LexicalComposerContext";import{TablePlugin as lh}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as ih,TableCellNode as sh,TableNode as ah,TableRowNode as ch}from"@lexical/table";import{mergeRegister as uh}from"@lexical/utils";import{formatDrawerSlug as dh,useEditDepth as mh}from"@payloadcms/ui";import{$getSelection as ph,$isRangeSelection as fh,COMMAND_PRIORITY_EDITOR as hh,createCommand as gh}from"lexical";import{createContext as xh,use as Ch,useEffect as bh,useMemo as kh,useState as _h}from"react";import*as Zs from"react";var go=gh("OPEN_EMBED_DRAWER_COMMAND"),Ys=xh({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function qs({children:t}){let[e,o]=_h({cellEditorConfig:null,cellEditorPlugins:null});return Lr(Ys,{value:kh(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var Qs=()=>{let t=oh(16),[e]=nh(),o=Ch(Ys),r=mh(),{fieldProps:n,uuid:l}=j(),{schemaPath:i}=n,s="lexical-table-create-"+l,u;t[0]!==r||t[1]!==s?(u=dh({slug:s,depth:r}),t[0]=r,t[1]=s,t[2]=u):u=t[2];let c=u,{toggleDrawer:d}=xe(c,!0),a;t[3]!==e||t[4]!==d?(a=()=>{if(!e.hasNodes([ah,ch,sh]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return uh(e.registerCommand(go,()=>{let h=null;return e.getEditorState().read(()=>{let g=ph();fh(g)&&(h=g)}),h&&d(),!0},hh))},t[3]=e,t[4]=d,t[5]=a):a=t[5];let p;t[6]!==o||t[7]!==e||t[8]!==d?(p=[o,e,d],t[6]=o,t[7]=e,t[8]=d,t[9]=p):p=t[9],bh(a,p);let m;t[10]!==e?(m=(h,g)=>{!g.columns||!g.rows||e.dispatchCommand(ih,{columns:String(g.columns),rows:String(g.rows)})},t[10]=e,t[11]=m):m=t[11];let f;return t[12]!==c||t[13]!==i||t[14]!==m?(f=rh(Zs.Fragment,{children:[Lr(st,{drawerSlug:c,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:m,schemaPath:i,schemaPathSuffix:"fields"}),Lr(lh,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]}),t[12]=c,t[13]=i,t[14]=m,t[15]=f):f=t[15],f};var Nh=y({markdownTransformers:[Ss],nodes:[wh,Th,Eh],plugins:[{Component:Qs,position:"normal"},{Component:Hs,position:"normal"},{Component:As,position:"floatingAnchorElem"},{Component:zs,position:"floatingAnchorElem"}],providers:[qs],slashMenu:{groups:[ee([{Icon:fr,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(go,{})}}])]},toolbarFixed:{groups:[ke([{ChildComponent:fr,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(go,{})}}])]}});import{$isNodeSelection as og}from"lexical";import{jsx as yr,jsxs as Sh}from"react/jsx-runtime";import"react";var Ir=()=>Sh("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[yr("path",{d:"M14.6667 4H5.33333C4.59695 4 4 4.59695 4 5.33333V14.6667C4 15.403 4.59695 16 5.33333 16H14.6667C15.403 16 16 15.403 16 14.6667V5.33333C16 4.59695 15.403 4 14.6667 4Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),yr("path",{d:"M7.99984 9.33366C8.73622 9.33366 9.33317 8.73671 9.33317 8.00033C9.33317 7.26395 8.73622 6.66699 7.99984 6.66699C7.26346 6.66699 6.6665 7.26395 6.6665 8.00033C6.6665 8.73671 7.26346 9.33366 7.99984 9.33366Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),yr("path",{d:"M16 11.9995L13.9427 9.94214C13.6926 9.69218 13.3536 9.55176 13 9.55176C12.6464 9.55176 12.3074 9.69218 12.0573 9.94214L6 15.9995",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as vh}from"react/jsx-runtime";import oa from"bson-objectid";import{$applyNodeReplacement as Mh}from"lexical";import*as ra from"react";import{jsx as Lh}from"react/jsx-runtime";import{DecoratorBlockNode as yh}from"@lexical/react/LexicalDecoratorBlockNode.js";import ea from"bson-objectid";import{$applyNodeReplacement as Ih}from"lexical";import"react";function Rr(t){return t.parentElement!=null&&t.parentElement.tagName==="LI"&&t.previousSibling===null&&t.getAttribute("aria-roledescription")==="checkbox"}function Rh(t){if(t.hasAttribute("data-lexical-upload-relation-to")&&t.hasAttribute("data-lexical-upload-id")){let o=t.getAttribute("data-lexical-upload-id"),r=t.getAttribute("data-lexical-upload-relation-to");if(o!=null&&r!=null)return{node:ta({data:{fields:{},relationTo:r,value:o}})}}let e=t;return e.src.startsWith("file:///")||Rr(e),null}var Dt=class extends yh{__data;constructor({data:e,format:o,key:r}){super(o,r),this.__data=e}static clone(e){return new this({data:e.__data,format:e.__format,key:e.__key})}static getType(){return"upload"}static importDOM(){return{img:e=>({conversion:Rh,priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new ea.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,relationTo:e.relationTo,value:e.value},r=ta({data:o});return r.setFormat(e.format),r}static isInline(){return!1}decorate(){return Lh(RawUploadComponent,{data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportDOM(){let e=document.createElement("img");return e.setAttribute("data-lexical-upload-id",String(this.__data?.value)),e.setAttribute("data-lexical-upload-relation-to",this.__data?.relationTo),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"upload",version:3}}getData(){return this.getLatest().__data}setData(e){let o=this.getWritable();o.__data=e}updateDOM(){return!1}};function ta({data:t}){return t?.id||(t.id=new ea.default().toHexString()),Ih(new Dt({data:t}))}var Dh=ra.lazy(()=>import("./component-M3U253XK.js").then(t=>({default:t.UploadComponent})));function Ah(t){if(t.hasAttribute("data-lexical-upload-relation-to")&&t.hasAttribute("data-lexical-upload-id")){let o=t.getAttribute("data-lexical-upload-id"),r=t.getAttribute("data-lexical-upload-relation-to");if(o!=null&&r!=null)return{node:Ge({data:{fields:{},relationTo:r,value:o}})}}let e=t;return e.src.startsWith("file:///")||Rr(e),null}var Ie=class extends Dt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{img:e=>({conversion:Ah,priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new oa.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,relationTo:e.relationTo,value:e.value},r=Ge({data:o});return r.setFormat(e.format),r}decorate(){return vh(Dh,{data:this.__data,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Ge({data:t}){return t?.id||(t.id=new oa.default().toHexString()),Mh(new Ie({data:t}))}function vr(t){return t instanceof Ie}import{c as Uh}from"react/compiler-runtime";import{jsx as Gh}from"react/jsx-runtime";import{useLexicalComposerContext as Wh}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Vh,mergeRegister as Kh}from"@lexical/utils";import{useConfig as Jh}from"@payloadcms/ui";import{$getPreviousSelection as Xh,$getSelection as zh,$isParagraphNode as Zh,$isRangeSelection as Yh,COMMAND_PRIORITY_EDITOR as qh,createCommand as Qh}from"lexical";import{useEffect as eg}from"react";import{c as na}from"react/compiler-runtime";import{jsx as Mr}from"react/jsx-runtime";import{useLexicalComposerContext as la}from"@lexical/react/LexicalComposerContext.js";import{toast as Oh}from"@payloadcms/ui";import{$getNodeByKey as $h,COMMAND_PRIORITY_EDITOR as ia}from"lexical";import{useEffect as sa,useState as Fh}from"react";var Ph=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=$h(o);n&&n.replace(Ge({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(Dr,{fields:null,relationTo:e,value:r})},Bh=t=>{let e=na(13),{enabledCollectionSlugs:o}=t,[r]=la(),[n,l]=Fh(null),i;e[0]!==o?(i={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=i):i=e[1];let{closeListDrawer:s,ListDrawer: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),ia),a=[r,c],e[2]=r,e[3]=c,e[4]=d,e[5]=a):(d=e[4],a=e[5]),sa(d,a);let p;e[6]!==s||e[7]!==r||e[8]!==n?(p=h=>{let{collectionSlug:g,doc:b}=h;s(),Ph({editor:r,relationTo:g,replaceNodeKey:n,value:b.id})},e[6]=s,e[7]=r,e[8]=n,e[9]=p):p=e[9];let m=p,f;return e[10]!==u||e[11]!==m?(f=Mr(u,{onSelect:m}),e[10]=u,e[11]=m,e[12]=f):f=e[12],f},Hh=()=>{let t=na(3),[e]=la(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Ke,jh,ia),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),sa(o,r),null},aa=t=>Mr(At,{...t,FallbackComponent:Hh,uploads:!0,children:Mr(Bh,{...t})});function jh(){return Oh.error("No upload collections enabled"),!0}var Dr=Qh("INSERT_UPLOAD_COMMAND"),ca=t=>{let e=Uh(5),[o]=Wh(),{config:r}=Jh(),{collections:n}=r,l,i;e[0]!==o?(l=()=>{if(!o.hasNodes([Ie]))throw new Error("UploadPlugin: UploadNode not registered on editor");return Kh(o.registerCommand(Dr,u=>(o.update(()=>{let c=zh()||Xh();if(Yh(c)){let d=Ge({data:{id:u.id,fields:u.fields,relationTo:u.relationTo,value:u.value}}),{focus:a}=c,p=a.getNode();Vh(d),Zh(p)&&!p.__first&&p.remove()}}),!0),qh))},i=[o],e[0]=o,e[1]=l,e[2]=i):(l=e[1],i=e[2]),eg(l,i);let s;return e[3]!==n?(s=Gh(aa,{enabledCollectionSlugs:n.map(tg)}),e[3]=n,e[4]=s):s=e[4],s};function tg(t){let{slug:e}=t;return e}var rg=y({nodes:[Ie],plugins:[{Component:ca,position:"normal"}],slashMenu:{groups:[ee([{Icon:Ir,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ke,{replace:!1})}}])]},toolbarFixed:{groups:[ke([{ChildComponent:Ir,isActive:({selection:t})=>{if(!og(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return vr(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ke,{replace:!1})}}])]}});import{c as lg}from"react/compiler-runtime";import{jsx as Or}from"react/jsx-runtime";import{ShimmerEffect as ig,useConfig as sg}from"@payloadcms/ui";import{lazy as ag,Suspense as cg,useEffect as ug,useState as dg}from"react";var ua={block:"LexicalEditorTheme__block",blockCursor:"LexicalEditorTheme__blockCursor",characterLimit:"LexicalEditorTheme__characterLimit",code:"LexicalEditorTheme__code",codeHighlight:{atrule:"LexicalEditorTheme__tokenAttr",attr:"LexicalEditorTheme__tokenAttr",boolean:"LexicalEditorTheme__tokenProperty",builtin:"LexicalEditorTheme__tokenSelector",cdata:"LexicalEditorTheme__tokenComment",char:"LexicalEditorTheme__tokenSelector",class:"LexicalEditorTheme__tokenFunction","class-name":"LexicalEditorTheme__tokenFunction",comment:"LexicalEditorTheme__tokenComment",constant:"LexicalEditorTheme__tokenProperty",deleted:"LexicalEditorTheme__tokenProperty",doctype:"LexicalEditorTheme__tokenComment",entity:"LexicalEditorTheme__tokenOperator",function:"LexicalEditorTheme__tokenFunction",important:"LexicalEditorTheme__tokenVariable",inserted:"LexicalEditorTheme__tokenSelector",keyword:"LexicalEditorTheme__tokenAttr",namespace:"LexicalEditorTheme__tokenVariable",number:"LexicalEditorTheme__tokenProperty",operator:"LexicalEditorTheme__tokenOperator",prolog:"LexicalEditorTheme__tokenComment",property:"LexicalEditorTheme__tokenProperty",punctuation:"LexicalEditorTheme__tokenPunctuation",regex:"LexicalEditorTheme__tokenVariable",selector:"LexicalEditorTheme__tokenSelector",string:"LexicalEditorTheme__tokenSelector",symbol:"LexicalEditorTheme__tokenProperty",tag:"LexicalEditorTheme__tokenProperty",url:"LexicalEditorTheme__tokenOperator",variable:"LexicalEditorTheme__tokenVariable"},embedBlock:{base:"LexicalEditorTheme__embedBlock",focus:"LexicalEditorTheme__embedBlockFocus"},hashtag:"LexicalEditorTheme__hashtag",heading:{h1:"LexicalEditorTheme__h1",h2:"LexicalEditorTheme__h2",h3:"LexicalEditorTheme__h3",h4:"LexicalEditorTheme__h4",h5:"LexicalEditorTheme__h5",h6:"LexicalEditorTheme__h6"},hr:"LexicalEditorTheme__hr",hrSelected:"LexicalEditorTheme__hrSelected",indent:"LexicalEditorTheme__indent",inlineImage:"LexicalEditor__inline-image",link:"LexicalEditorTheme__link",list:{checklist:"LexicalEditorTheme__checklist",listitem:"LexicalEditorTheme__listItem",listitemChecked:"LexicalEditorTheme__listItemChecked",listitemUnchecked:"LexicalEditorTheme__listItemUnchecked",nested:{listitem:"LexicalEditorTheme__nestedListItem"},olDepth:["LexicalEditorTheme__ol1","LexicalEditorTheme__ol2","LexicalEditorTheme__ol3","LexicalEditorTheme__ol4","LexicalEditorTheme__ol5"],ul:"LexicalEditorTheme__ul"},ltr:"LexicalEditorTheme__ltr",mark:"LexicalEditorTheme__mark",markOverlap:"LexicalEditorTheme__markOverlap",paragraph:"LexicalEditorTheme__paragraph",quote:"LexicalEditorTheme__quote",relationship:"LexicalEditorTheme__relationship",rtl:"LexicalEditorTheme__rtl",tab:"LexicalEditorTheme__tabNode",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableAlignment:{center:"LexicalEditorTheme__tableAlignmentCenter",right:"LexicalEditorTheme__tableAlignmentRight"},tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableFrozenColumn:"LexicalEditorTheme__tableFrozenColumn",tableRowStriping:"LexicalEditorTheme__tableRowStriping",tableScrollableWrapper:"LexicalEditorTheme__tableScrollableWrapper",tableSelected:"LexicalEditorTheme__tableSelected",tableSelection:"LexicalEditorTheme__tableSelection",text:{bold:"LexicalEditorTheme__textBold",code:"LexicalEditorTheme__textCode",italic:"LexicalEditorTheme__textItalic",strikethrough:"LexicalEditorTheme__textStrikethrough",subscript:"LexicalEditorTheme__textSubscript",superscript:"LexicalEditorTheme__textSuperscript",underline:"LexicalEditorTheme__textUnderline",underlineStrikethrough:"LexicalEditorTheme__textUnderlineStrikethrough"},upload:"editor-upload"};var xo={namespace:"lexical",theme:ua};function da({config:t,featureClientImportMap:e,featureClientSchemaMap:o,field:r,schemaPath:n,unSanitizedEditorConfig:l}){for(let 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 ng}from"payload/shared";var ma=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}},o={};if(t.forEach(r=>{r.key==="toolbarFixed"&&r.sanitizedClientFeatureProps?.customGroups&&(o={...o,...r.sanitizedClientFeatureProps.customGroups})}),!t?.size)return e;t.forEach(r=>{if(r.providers?.length&&(e.providers=e.providers.concat(r.providers)),r.enableFormats?.length&&e.enabledFormats.push(...r.enableFormats),r.nodes?.length)for(let n of r.nodes)e.nodes.push(n);if(r.plugins?.length&&r.plugins.forEach((n,l)=>{e.plugins?.push({clientProps:r.sanitizedClientFeatureProps,Component:n.Component,key:r.key+l,position:n.position})}),r.toolbarInline?.groups?.length)for(let n of r.toolbarInline.groups){let l=e.toolbarInline.groups.find(i=>i.key===n.key);l?e.toolbarInline.groups=e.toolbarInline.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.toolbarInline?.groups.push(l)}if(r.toolbarFixed?.groups?.length)for(let n of r.toolbarFixed.groups){let l=e.toolbarFixed.groups.find(i=>i.key===n.key);l?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.toolbarFixed?.groups.push(l)}if(r.slashMenu?.groups){r.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(r.slashMenu.dynamicGroups));for(let n of r.slashMenu.groups){let l=e.slashMenu.groups.find(i=>i.key===n.key);l?e.slashMenu.groups=e.slashMenu.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.slashMenu.groups.push(l)}}if(r.markdownTransformers?.length)for(let n of r.markdownTransformers)typeof n=="function"?e.markdownTransformers.push(n({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(n);e.enabledFeatures.push(r.key)}),Object.keys(o).length>0&&(e.toolbarFixed.groups=e.toolbarFixed.groups.map(r=>{let n=o[r.key];return n?ng(r,n):r})),e.toolbarInline.groups.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0),e.toolbarFixed.groups.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);for(let r of e.toolbarInline.groups)r.items.sort((n,l)=>n.order&&l.order?n.order-l.order:n.order?-1:l.order?1:0);for(let r of e.toolbarFixed.groups)r.items.sort((n,l)=>n.order&&l.order?n.order-l.order:n.order?-1:l.order?1:0);return e};function Ar(t,e,o){return{admin:o,features:ma(t),lexical:e,resolvedFeatureMap:t}}var mg=ag(()=>import("./Field-YTBICBYV.js").then(t=>({default:t.RichText}))),pg=t=>{let e=lg(16),{admin:o,clientFeatures:r,featureClientImportMap:n,featureClientSchemaMap:l,field:i,lexicalEditorConfig:s,schemaPath: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?xo:s,{config:p}=sg(),[m,f]=dg(null),h,g;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 T=[];for(let[_,x]of Object.entries(r))x.clientFeatureProvider&&T.push(x.clientFeatureProvider(x.clientFeatureProps));let M=a||xo,k=da({config:p,featureClientImportMap:n,featureClientSchemaMap:l,field:i,schemaPath:u??i.name,unSanitizedEditorConfig:{features:T,lexical:M}});f(Ar(k,M,d))},g=[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]=g):(h=e[11],g=e[12]),ug(h,g);let b;return e[13]!==m||e[14]!==t?(b=Or(cg,{fallback:Or(ig,{height:"35vh"}),children:m&&Or(mg,{...t,editorConfig:m})}),e[13]=m,e[14]=t,e[15]=b):b=e[15],b};function fg(t){return t instanceof HTMLElement}function hg(...t){return t.filter(Boolean).join(" ")}var Co=new WeakMap;function pa(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function bo(t,e){let o=Co.get(t);if(o===void 0){let r=new Set,n=i=>{o!==void 0&&(o.start=pa(i))},l=i=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let u=pa(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},Co.set(t,o)}return o.listeners.add(e),()=>{gg(t,e)}}function gg(t,e){let o=Co.get(t);if(o===void 0)return;let{listeners:r}=o;r.delete(e),r.size===0&&(Co.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function xg(t,e){return bo(t,(o,r)=>{let[n,l]=o;n<0&&-n>Math.abs(l)&&e(n,r)})}function Cg(t,e){return bo(t,(o,r)=>{let[n,l]=o;n>0&&n>Math.abs(l)&&e(n,r)})}function bg(t,e){return bo(t,(o,r)=>{let[n,l]=o;l<0&&-l>Math.abs(n)&&e(n,r)})}function kg(t,e){return bo(t,(o,r)=>{let[n,l]=o;l>0&&l>Math.abs(n)&&e(n,r)})}import{c as _g}from"react/compiler-runtime";import{jsx as Tg}from"react/jsx-runtime";import"react";var wg=()=>{let t=_g(2),{EditButton:e}=Ce(),o;return t[0]!==e?(o=e?Tg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Eg}from"react/compiler-runtime";import{jsx as Ng}from"react/jsx-runtime";import"react";var Sg=()=>{let t=Eg(2),{RemoveButton:e}=Ce(),o;return t[0]!==e?(o=e?Ng(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Lg}from"react/compiler-runtime";import{jsx as yg}from"react/jsx-runtime";import"react";var Ig=()=>{let t=Lg(2),{Label:e}=Ce(),o;return t[0]!==e?(o=e?yg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Rg}from"react/compiler-runtime";import{jsx as vg}from"react/jsx-runtime";import"react";var Mg=t=>{let e=Rg(3),{children:o}=t,{InlineBlockContainer:r}=Ce(),n;return e[0]!==r||e[1]!==o?(n=r?vg(r,{children:o}):null,e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{c as Dg}from"react/compiler-runtime";import{jsx as Ag}from"react/jsx-runtime";import"react";var Og=t=>{let e=Dg(6),{children:o,editButton:r,Label:n,removeButton:l}=t,{BlockCollapsible:i}=Oe(),s;return e[0]!==i||e[1]!==n||e[2]!==o||e[3]!==r||e[4]!==l?(s=i?Ag(i,{editButton:r,Label:n,removeButton:l,children:o}):null,e[0]=i,e[1]=n,e[2]=o,e[3]=r,e[4]=l,e[5]=s):s=e[5],s};import{c as $g}from"react/compiler-runtime";import{jsx as Fg}from"react/jsx-runtime";import"react";var Pg=()=>{let t=$g(2),{EditButton:e}=Oe(),o;return t[0]!==e?(o=e?Fg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Bg}from"react/compiler-runtime";import{jsx as Hg}from"react/jsx-runtime";import"react";var jg=()=>{let t=Bg(2),{RemoveButton:e}=Oe(),o;return t[0]!==e?(o=e?Hg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as Ug}from"qs-esm";var Gg=({apiURL:t,depth:e,draft:o,locale:r})=>async({id:l,collectionSlug:i,select:s})=>{let u=Ug({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,_o as $createInlineBlockNode,_e as $createLinkNode,je as $createRelationshipNode,Ge as $createUploadNode,we as $isAutoLinkNode,ft as $isBlockNode,To as $isInlineBlockNode,Z as $isLinkNode,ar as $isRelationshipNode,vr as $isUploadNode,Sa as AlignFeatureClient,Te as AutoLinkNode,Og as BlockCollapsible,Pg as BlockEditButton,be as BlockNode,jg as BlockRemoveButton,va as BlockquoteFeatureClient,yc as BlocksFeatureClient,Yc as BoldFeatureClient,ce as CAN_USE_DOM,Ym as ChecklistFeatureClient,jp as DETAIL_TYPE_TO_DETAIL,Fp as DOUBLE_LINE_BREAK,qp as DebugJsxConverterFeatureClient,Gp as ELEMENT_FORMAT_TO_TYPE,Up as ELEMENT_TYPE_TO_FORMAT,ba as ENABLE_SLASH_MENU_COMMAND,ha as EditorConfigProvider,st as FieldsDrawer,_0 as FixedToolbarFeatureClient,Wu as HeadingFeatureClient,sd as HorizontalRuleFeatureClient,Je as INSERT_BLOCK_COMMAND,Xe as INSERT_INLINE_BLOCK_COMMAND,Op as IS_ALL_FORMATTING,wd as IndentFeatureClient,Mg as InlineBlockContainer,wg as InlineBlockEditButton,Ig as InlineBlockLabel,ko as InlineBlockNode,Sg as InlineBlockRemoveButton,ou as InlineCodeFeatureClient,M0 as InlineToolbarFeatureClient,iu as ItalicFeatureClient,Bp as LTR_REGEX,bp as LexicalPluginToLexicalFeatureClient,$m as LinkFeatureClient,ie as LinkNode,$p as NON_BREAKING_SPACE,A as NodeFormat,lp as OrderedListFeatureClient,Lp as ParagraphFeatureClient,xa as Point,Pp as RTL_REGEX,ka as Rect,Bf as RelationshipFeatureClient,Ne as RelationshipNode,pg as RichTextField,Np as SlateToLexicalFeatureClient,du as StrikethroughFeatureClient,hu as SubscriptFeatureClient,bu as SuperscriptFeatureClient,Wp as TEXT_MODE_TO_TYPE,Hp as TEXT_TYPE_TO_FORMAT,Vp as TEXT_TYPE_TO_MODE,he as TOGGLE_LINK_COMMAND,Nh as TableFeatureClient,Uc as TestRecorderFeatureClient,Ou as TextStateFeatureClient,It as ToolbarButton,Ue as ToolbarDropdown,Jc as TreeViewFeatureClient,Eu as UnderlineFeatureClient,pp as UnorderedListFeatureClient,rg as UploadFeatureClient,Ie as UploadNode,kg as addSwipeDownListener,xg as addSwipeLeftListener,Cg as addSwipeRightListener,bg as addSwipeUpListener,Ho as createBlockNode,y as createClientFeature,Qp as defaultColors,xo as defaultEditorLexicalConfig,pr as getDOMRangeRect,_a as getEnabledNodes,Gg as getRestPopulateFn,ze as getSelectedNode,fg as isHTMLElement,Ca as isPoint,hg as joinClasses,Ar as sanitizeClientEditorConfig,ma as sanitizeClientFeatures,io as setFloatingElemPosition,eo as setFloatingElemPositionForLinkEditor,ee as slashMenuBasicGroupWithItems,ke as toolbarAddDropdownGroupWithItems,Uo as toolbarFeatureButtonsGroupWithItems,te as toolbarFormatGroupWithItems,le as toolbarTextDropdownGroupWithItems,Oe as useBlockComponentContext,j as useEditorConfigContext,Ce as useInlineBlockComponentContext,ga as useLexicalDocumentDrawer,xe as useLexicalDrawer,yt as useLexicalListDrawer};
|
|
38
|
+
`,Bi="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",Hi="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",jp=new RegExp("^[^"+Hi+"]*["+Bi+"]"),Up=new RegExp("^[^"+Bi+"]*["+Hi+"]"),Gp={bold:A.IS_BOLD,code:A.IS_CODE,highlight:A.IS_HIGHLIGHT,italic:A.IS_ITALIC,strikethrough:A.IS_STRIKETHROUGH,subscript:A.IS_SUBSCRIPT,superscript:A.IS_SUPERSCRIPT,underline:A.IS_UNDERLINE},Wp={directionless:A.IS_DIRECTIONLESS,unmergeable:A.IS_UNMERGEABLE},Vp={center:A.IS_ALIGN_CENTER,end:A.IS_ALIGN_END,justify:A.IS_ALIGN_JUSTIFY,left:A.IS_ALIGN_LEFT,right:A.IS_ALIGN_RIGHT,start:A.IS_ALIGN_START},Kp={[A.IS_ALIGN_CENTER]:"center",[A.IS_ALIGN_END]:"end",[A.IS_ALIGN_JUSTIFY]:"justify",[A.IS_ALIGN_LEFT]:"left",[A.IS_ALIGN_RIGHT]:"right",[A.IS_ALIGN_START]:"start"},Jp={normal:A.IS_NORMAL,segmented:A.IS_SEGMENTED,token:A.IS_TOKEN},Xp={[A.IS_NORMAL]:"normal",[A.IS_SEGMENTED]:"segmented",[A.IS_TOKEN]:"token"};var ji={text:({node:t})=>{let e=t.text;return t.format&A.IS_BOLD&&(e=He("strong",{children:e})),t.format&A.IS_ITALIC&&(e=He("em",{children:e})),t.format&A.IS_STRIKETHROUGH&&(e=He("span",{style:{textDecoration:"line-through"},children:e})),t.format&A.IS_UNDERLINE&&(e=He("span",{style:{textDecoration:"underline"},children:e})),t.format&A.IS_CODE&&(e=He("code",{children:e})),t.format&A.IS_SUBSCRIPT&&(e=He("sub",{children:e})),t.format&A.IS_SUPERSCRIPT&&(e=He("sup",{children:e})),e}};import{jsx as Nt}from"react/jsx-runtime";var Ui={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={...Fi,...ji,...Mi,...Ii,...Pi,...Ri,...vi,...Oi,...Ai({}),...Ui,...$i};import{jsx as Wi,Fragment as zp}from"react/jsx-runtime";import ir from"react";function Gi(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 Vi({converters:t,data:e,disableIndent:o,disableTextAlign:r}){return Gi(e)?Ki({converters:t,disableIndent:o,disableTextAlign:r,nodes:e?.root?.children,parent:e?.root}):Wi(zp,{})}function Ki({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=>Ki({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=Wi("span",{children:"unknown node"},u);let a={};if(!o&&(!Array.isArray(o)||!o?.includes(s.type))&&"format"in s&&s.format)switch(s.format){case"center":a.textAlign="center";break;case"end":a.textAlign="right";break;case"justify":a.textAlign="justify";break;case"left":break;case"right":a.textAlign="right";break;case"start":a.textAlign="left";break}if(!e&&(!Array.isArray(e)||!e?.includes(s.type))&&"indent"in s&&s.indent&&s.type!=="listitem"&&(a.paddingInlineStart=`${Number(s.indent)*40}px`),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&&Vi({converters:i,data:o,disableIndent:n,disableTextAlign:l});return r?Ji(Zp,{children:s}):Ji("div",{className:t??"payload-richtext",children:s})};function zi(){let t=Yp(7),[e]=qp(),o;t[0]!==e?(o=e.getEditorState().toJSON(),t[0]=e,t[1]=o):o=t[1];let[r,n]=ef(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=Xi("div",{className:"debug-jsx-converter",children:Xi(sr,{converters:tt,data:r})}),t[5]=r,t[6]=s):s=t[6],s}var tf=y({plugins:[{Component:zi,position:"bottom"}]});var B={amber:{50:"oklch(0.987 0.022 95.277)",100:"oklch(0.962 0.059 95.617)",200:"oklch(0.924 0.12 95.746)",300:"oklch(0.879 0.169 91.605)",400:"oklch(0.828 0.189 84.429)",500:"oklch(0.769 0.188 70.08)",600:"oklch(0.666 0.179 58.318)",700:"oklch(0.555 0.163 48.998)",800:"oklch(0.473 0.137 46.201)",900:"oklch(0.414 0.112 45.904)",950:"oklch(0.279 0.077 45.635)"},black:"#000",blue:{50:"oklch(0.97 0.014 254.604)",100:"oklch(0.932 0.032 255.585)",200:"oklch(0.882 0.059 254.128)",300:"oklch(0.809 0.105 251.813)",400:"oklch(0.707 0.165 254.624)",500:"oklch(0.623 0.214 259.815)",600:"oklch(0.546 0.245 262.881)",700:"oklch(0.488 0.243 264.376)",800:"oklch(0.424 0.199 265.638)",900:"oklch(0.379 0.146 265.522)",950:"oklch(0.282 0.091 267.935)"},current:"currentColor",cyan:{50:"oklch(0.984 0.019 200.873)",100:"oklch(0.956 0.045 203.388)",200:"oklch(0.917 0.08 205.041)",300:"oklch(0.865 0.127 207.078)",400:"oklch(0.789 0.154 211.53)",500:"oklch(0.715 0.143 215.221)",600:"oklch(0.609 0.126 221.723)",700:"oklch(0.52 0.105 223.128)",800:"oklch(0.45 0.085 224.283)",900:"oklch(0.398 0.07 227.392)",950:"oklch(0.302 0.056 229.695)"},emerald:{50:"oklch(0.979 0.021 166.113)",100:"oklch(0.95 0.052 163.051)",200:"oklch(0.905 0.093 164.15)",300:"oklch(0.845 0.143 164.978)",400:"oklch(0.765 0.177 163.223)",500:"oklch(0.696 0.17 162.48)",600:"oklch(0.596 0.145 163.225)",700:"oklch(0.508 0.118 165.612)",800:"oklch(0.432 0.095 166.913)",900:"oklch(0.378 0.077 168.94)",950:"oklch(0.262 0.051 172.552)"},fuchsia:{50:"oklch(0.977 0.017 320.058)",100:"oklch(0.952 0.037 318.852)",200:"oklch(0.903 0.076 319.62)",300:"oklch(0.833 0.145 321.434)",400:"oklch(0.74 0.238 322.16)",500:"oklch(0.667 0.295 322.15)",600:"oklch(0.591 0.293 322.896)",700:"oklch(0.518 0.253 323.949)",800:"oklch(0.452 0.211 324.591)",900:"oklch(0.401 0.17 325.612)",950:"oklch(0.293 0.136 325.661)"},gray:{50:"oklch(0.985 0.002 247.839)",100:"oklch(0.967 0.003 264.542)",200:"oklch(0.928 0.006 264.531)",300:"oklch(0.872 0.01 258.338)",400:"oklch(0.707 0.022 261.325)",500:"oklch(0.551 0.027 264.364)",600:"oklch(0.446 0.03 256.802)",700:"oklch(0.373 0.034 259.733)",800:"oklch(0.278 0.033 256.848)",900:"oklch(0.21 0.034 264.665)",950:"oklch(0.13 0.028 261.692)"},green:{50:"oklch(0.982 0.018 155.826)",100:"oklch(0.962 0.044 156.743)",200:"oklch(0.925 0.084 155.995)",300:"oklch(0.871 0.15 154.449)",400:"oklch(0.792 0.209 151.711)",500:"oklch(0.723 0.219 149.579)",600:"oklch(0.627 0.194 149.214)",700:"oklch(0.527 0.154 150.069)",800:"oklch(0.448 0.119 151.328)",900:"oklch(0.393 0.095 152.535)",950:"oklch(0.266 0.065 152.934)"},indigo:{50:"oklch(0.962 0.018 272.314)",100:"oklch(0.93 0.034 272.788)",200:"oklch(0.87 0.065 274.039)",300:"oklch(0.785 0.115 274.713)",400:"oklch(0.673 0.182 276.935)",500:"oklch(0.585 0.233 277.117)",600:"oklch(0.511 0.262 276.966)",700:"oklch(0.457 0.24 277.023)",800:"oklch(0.398 0.195 277.366)",900:"oklch(0.359 0.144 278.697)",950:"oklch(0.257 0.09 281.288)"},inherit:"inherit",lime:{50:"oklch(0.986 0.031 120.757)",100:"oklch(0.967 0.067 122.328)",200:"oklch(0.938 0.127 124.321)",300:"oklch(0.897 0.196 126.665)",400:"oklch(0.841 0.238 128.85)",500:"oklch(0.768 0.233 130.85)",600:"oklch(0.648 0.2 131.684)",700:"oklch(0.532 0.157 131.589)",800:"oklch(0.453 0.124 130.933)",900:"oklch(0.405 0.101 131.063)",950:"oklch(0.274 0.072 132.109)"},neutral:{50:"oklch(0.985 0 0)",100:"oklch(0.97 0 0)",200:"oklch(0.922 0 0)",300:"oklch(0.87 0 0)",400:"oklch(0.708 0 0)",500:"oklch(0.556 0 0)",600:"oklch(0.439 0 0)",700:"oklch(0.371 0 0)",800:"oklch(0.269 0 0)",900:"oklch(0.205 0 0)",950:"oklch(0.145 0 0)"},orange:{50:"oklch(0.98 0.016 73.684)",100:"oklch(0.954 0.038 75.164)",200:"oklch(0.901 0.076 70.697)",300:"oklch(0.837 0.128 66.29)",400:"oklch(0.75 0.183 55.934)",500:"oklch(0.705 0.213 47.604)",600:"oklch(0.646 0.222 41.116)",700:"oklch(0.553 0.195 38.402)",800:"oklch(0.47 0.157 37.304)",900:"oklch(0.408 0.123 38.172)",950:"oklch(0.266 0.079 36.259)"},pink:{50:"oklch(0.971 0.014 343.198)",100:"oklch(0.948 0.028 342.258)",200:"oklch(0.899 0.061 343.231)",300:"oklch(0.823 0.12 346.018)",400:"oklch(0.718 0.202 349.761)",500:"oklch(0.656 0.241 354.308)",600:"oklch(0.592 0.249 0.584)",700:"oklch(0.525 0.223 3.958)",800:"oklch(0.459 0.187 3.815)",900:"oklch(0.408 0.153 2.432)",950:"oklch(0.284 0.109 3.907)"},purple:{50:"oklch(0.977 0.014 308.299)",100:"oklch(0.946 0.033 307.174)",200:"oklch(0.902 0.063 306.703)",300:"oklch(0.827 0.119 306.383)",400:"oklch(0.714 0.203 305.504)",500:"oklch(0.627 0.265 303.9)",600:"oklch(0.558 0.288 302.321)",700:"oklch(0.496 0.265 301.924)",800:"oklch(0.438 0.218 303.724)",900:"oklch(0.381 0.176 304.987)",950:"oklch(0.291 0.149 302.717)"},red:{50:"oklch(0.971 0.013 17.38)",100:"oklch(0.936 0.032 17.717)",200:"oklch(0.885 0.062 18.334)",300:"oklch(0.808 0.114 19.571)",400:"oklch(0.704 0.191 22.216)",500:"oklch(0.637 0.237 25.331)",600:"oklch(0.577 0.245 27.325)",700:"oklch(0.505 0.213 27.518)",800:"oklch(0.444 0.177 26.899)",900:"oklch(0.396 0.141 25.723)",950:"oklch(0.258 0.092 26.042)"},rose:{50:"oklch(0.969 0.015 12.422)",100:"oklch(0.941 0.03 12.58)",200:"oklch(0.892 0.058 10.001)",300:"oklch(0.81 0.117 11.638)",400:"oklch(0.712 0.194 13.428)",500:"oklch(0.645 0.246 16.439)",600:"oklch(0.586 0.253 17.585)",700:"oklch(0.514 0.222 16.935)",800:"oklch(0.455 0.188 13.697)",900:"oklch(0.41 0.159 10.272)",950:"oklch(0.271 0.105 12.094)"},sky:{50:"oklch(0.977 0.013 236.62)",100:"oklch(0.951 0.026 236.824)",200:"oklch(0.901 0.058 230.902)",300:"oklch(0.828 0.111 230.318)",400:"oklch(0.746 0.16 232.661)",500:"oklch(0.685 0.169 237.323)",600:"oklch(0.588 0.158 241.966)",700:"oklch(0.5 0.134 242.749)",800:"oklch(0.443 0.11 240.79)",900:"oklch(0.391 0.09 240.876)",950:"oklch(0.293 0.066 243.157)"},slate:{50:"oklch(0.984 0.003 247.858)",100:"oklch(0.968 0.007 247.896)",200:"oklch(0.929 0.013 255.508)",300:"oklch(0.869 0.022 252.894)",400:"oklch(0.704 0.04 256.788)",500:"oklch(0.554 0.046 257.417)",600:"oklch(0.446 0.043 257.281)",700:"oklch(0.372 0.044 257.287)",800:"oklch(0.279 0.041 260.031)",900:"oklch(0.208 0.042 265.755)",950:"oklch(0.129 0.042 264.695)"},stone:{50:"oklch(0.985 0.001 106.423)",100:"oklch(0.97 0.001 106.424)",200:"oklch(0.923 0.003 48.717)",300:"oklch(0.869 0.005 56.366)",400:"oklch(0.709 0.01 56.259)",500:"oklch(0.553 0.013 58.071)",600:"oklch(0.444 0.011 73.639)",700:"oklch(0.374 0.01 67.558)",800:"oklch(0.268 0.007 34.298)",900:"oklch(0.216 0.006 56.043)",950:"oklch(0.147 0.004 49.25)"},teal:{50:"oklch(0.984 0.014 180.72)",100:"oklch(0.953 0.051 180.801)",200:"oklch(0.91 0.096 180.426)",300:"oklch(0.855 0.138 181.071)",400:"oklch(0.777 0.152 181.912)",500:"oklch(0.704 0.14 182.503)",600:"oklch(0.6 0.118 184.704)",700:"oklch(0.511 0.096 186.391)",800:"oklch(0.437 0.078 188.216)",900:"oklch(0.386 0.063 188.416)",950:"oklch(0.277 0.046 192.524)"},transparent:"transparent",violet:{50:"oklch(0.969 0.016 293.756)",100:"oklch(0.943 0.029 294.588)",200:"oklch(0.894 0.057 293.283)",300:"oklch(0.811 0.111 293.571)",400:"oklch(0.702 0.183 293.541)",500:"oklch(0.606 0.25 292.717)",600:"oklch(0.541 0.281 293.009)",700:"oklch(0.491 0.27 292.581)",800:"oklch(0.432 0.232 292.759)",900:"oklch(0.38 0.189 293.745)",950:"oklch(0.283 0.141 291.089)"},white:"#fff",yellow:{50:"oklch(0.987 0.026 102.212)",100:"oklch(0.973 0.071 103.193)",200:"oklch(0.945 0.129 101.54)",300:"oklch(0.905 0.182 98.111)",400:"oklch(0.852 0.199 91.936)",500:"oklch(0.795 0.184 86.047)",600:"oklch(0.681 0.162 75.834)",700:"oklch(0.554 0.135 66.442)",800:"oklch(0.476 0.114 61.907)",900:"oklch(0.421 0.095 57.708)",950:"oklch(0.286 0.066 53.813)"},zinc:{50:"oklch(0.985 0 0)",100:"oklch(0.967 0.001 286.375)",200:"oklch(0.92 0.004 286.32)",300:"oklch(0.871 0.006 286.286)",400:"oklch(0.705 0.015 286.067)",500:"oklch(0.552 0.016 285.938)",600:"oklch(0.442 0.017 285.786)",700:"oklch(0.37 0.013 285.805)",800:"oklch(0.274 0.006 286.033)",900:"oklch(0.21 0.006 285.885)",950:"oklch(0.141 0.005 285.823)"}},of={text:{"text-red":{css:{color:`light-dark(${B.red[600]}, ${B.red[400]})`},label:"Red"},"text-orange":{css:{color:`light-dark(${B.orange[600]}, ${B.orange[400]})`},label:"Orange"},"text-yellow":{css:{color:`light-dark(${B.yellow[700]}, ${B.yellow[300]})`},label:"Yellow"},"text-green":{css:{color:`light-dark(${B.green[700]}, ${B.green[400]})`},label:"Green"},"text-blue":{css:{color:`light-dark(${B.blue[600]}, ${B.blue[400]})`},label:"Blue"},"text-purple":{css:{color:`light-dark(${B.purple[600]}, ${B.purple[400]})`},label:"Purple"},"text-pink":{css:{color:`light-dark(${B.pink[600]}, ${B.pink[400]})`},label:"Pink"}},background:{"bg-red":{css:{"background-color":`light-dark(${B.red[400]}, ${B.red[600]})`},label:"Red"},"bg-orange":{css:{"background-color":`light-dark(${B.orange[400]}, ${B.orange[600]})`},label:"Orange"},"bg-yellow":{css:{"background-color":`light-dark(${B.yellow[300]}, ${B.yellow[700]})`},label:"Yellow"},"bg-green":{css:{"background-color":`light-dark(${B.green[400]}, ${B.green[700]})`},label:"Green"},"bg-blue":{css:{"background-color":`light-dark(${B.blue[400]}, ${B.blue[600]})`},label:"Blue"},"bg-purple":{css:{"background-color":`light-dark(${B.purple[400]}, ${B.purple[600]})`},label:"Purple"},"bg-pink":{css:{"background-color":`light-dark(${B.pink[400]}, ${B.pink[600]})`},label:"Pink"}}};import{$isNodeSelection as jf}from"lexical";import{jsx as Lt,jsxs as rf}from"react/jsx-runtime";import"react";var ar=()=>rf("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Lt("g",{clipPath:"url(#clip0_4397_10817)",children:Lt("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"})}),Lt("defs",{children:Lt("clipPath",{id:"clip0_4397_10817",children:Lt("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{jsx as sf}from"react/jsx-runtime";import*as Yi from"react";import{DecoratorBlockNode as nf}from"@lexical/react/LexicalDecoratorBlockNode.js";function lf(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Zi({relationTo:o,value:e})}:null}var yt=class extends nf{__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:lf,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},r=Zi(o);return r.setFormat(e.format),r}static isInline(){return!1}decorate(e,o){return null}exportDOM(){let e=document.createElement("div");e.setAttribute("data-lexical-relationship-id",String(typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value)),e.setAttribute("data-lexical-relationship-relationTo",this.__data?.relationTo);let o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"relationship",version:2}}getData(){return this.getLatest().__data}getTextContent(){return`${this.__data?.relationTo} relation to ${typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value}`}setData(e){let o=this.getWritable();o.__data=e}};function Zi(t){return new yt({data:t})}var af=Yi.lazy(()=>import("./RelationshipComponent-APF3CN47.js").then(t=>({default:t.RelationshipComponent})));function cf(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:je({relationTo:o,value:e})}:null}var Se=class extends yt{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:cf,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},r=je(o);return r.setFormat(e.format),r}decorate(e,o){return sf(af,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function je(t){return new Se({data:t})}function cr(t){return t instanceof Se}import{c as Lf}from"react/compiler-runtime";import{jsx as yf}from"react/jsx-runtime";import{useLexicalComposerContext as If}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Rf}from"@lexical/utils";import{useConfig as vf}from"@payloadcms/ui";import{$getPreviousSelection as Mf,$getSelection as Df,$isParagraphNode as Af,$isRangeSelection as Of,COMMAND_PRIORITY_EDITOR as Ff,createCommand as $f}from"lexical";import{useEffect as Pf}from"react";import{c as _f}from"react/compiler-runtime";import{jsx as no}from"react/jsx-runtime";import{useLexicalComposerContext as Tf}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as wf,COMMAND_PRIORITY_EDITOR as Ef}from"lexical";import{useEffect as Sf,useState as es}from"react";import{c as uf}from"react/compiler-runtime";import{jsx as df}from"react/jsx-runtime";import{useLexicalComposerContext as mf}from"@lexical/react/LexicalComposerContext";import{useListDrawer as pf,useModal as ff}from"@payloadcms/ui";import{$getNodeByKey as qi,$getPreviousSelection as hf,$getRoot as gf,$getSelection as xf,$isRangeSelection as Cf,$setSelection as bf}from"lexical";import{useEffect as kf,useState as Qi}from"react";var It=t=>{let e=uf(23),[o]=mf(),[r,n]=Qi(null),[l,i]=Qi(!1),[s,u,c]=pf(t),{closeDrawer:d,drawerSlug:a,isDrawerOpen:p,openDrawer:m}=c,{modalState:f}=ff(),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let $=xf()??hf();n($)},e[0]=h):h=e[0];let g=h,k;e[1]!==o||e[2]!==r?(k=()=>{r&&o.update(()=>{if(Cf(r)){let{anchor:$,focus:v}=r;qi($.key)&&qi(v.key)&&bf(r.clone())}else gf().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=r,e[3]=k):k=e[3];let T=k,I;e[4]!==d?(I=()=>{d()},e[4]=d,e[5]=I):I=e[5];let b=I,_,x;e[6]!==a||e[7]!==f||e[8]!==T||e[9]!==l?(_=()=>{if(!l)return;let $=f[a];$&&!$?.isOpen&&(i(!1),setTimeout(()=>{T()},1))},x=[f,a,T,l],e[6]=a,e[7]=f,e[8]=T,e[9]=l,e[10]=_,e[11]=x):(_=e[10],x=e[11]),kf(_,x);let E;e[12]!==u?(E=$=>df(u,{...$,onClick:()=>{g()}}),e[12]=u,e[13]=E):E=e[13];let R;e[14]!==m?(R=()=>{g(),m(),i(!0)},e[14]=m,e[15]=R):R=e[15];let O;return e[16]!==s||e[17]!==b||e[18]!==p||e[19]!==a||e[20]!==E||e[21]!==R?(O={closeListDrawer:b,isListDrawerOpen:p,ListDrawer:s,listDrawerSlug:a,ListDrawerToggler:E,openListDrawer:R},e[16]=s,e[17]=b,e[18]=p,e[19]=a,e[20]=E,e[21]=R,e[22]=O):O=e[22],O};var Nf=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=wf(o);n&&n.replace(je({relationTo:e,value:r}))}):t.dispatchCommand(ur,{relationTo:e,value:r})},ts=t=>{let e=_f(16),{enabledCollectionSlugs:o}=t,[r]=Tf(),n;e[0]!==o?.[0]?(n=()=>o?.[0],e[0]=o?.[0],e[1]=n):n=e[1];let[l]=es(n),[i,s]=es(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}=It(c),m,f;e[5]!==r||e[6]!==p?(m=()=>r.registerCommand(ct,T=>(s(T?.replace?T?.replace.nodeKey:null),p(),!0),Ef),f=[r,p],e[5]=r,e[6]=p,e[7]=m,e[8]=f):(m=e[7],f=e[8]),Sf(m,f);let h;e[9]!==d||e[10]!==r||e[11]!==i?(h=T=>{let{collectionSlug:I,doc:b}=T;Nf({editor:r,relationTo:I,replaceNodeKey:i,value:b.id}),d()},e[9]=d,e[10]=r,e[11]=i,e[12]=h):h=e[12];let g=h,k;return e[13]!==a||e[14]!==g?(k=no(a,{onSelect:g}),e[13]=a,e[14]=g,e[15]=k):k=e[15],k},os=t=>(t?.enabledCollectionSlugs?.length??-1)>0?no(ts,{...t}):no(Ot,{...t,children:no(ts,{...t})});var ur=$f("INSERT_RELATIONSHIP_COMMAND"),rs=t=>{let e=Lf(5),{clientProps:o}=t,[r]=If(),{config:n}=vf(),{collections:l}=n,i=null;if(o?.enabledCollections)i=o?.enabledCollections;else if(o?.disabledCollections){let c;e[0]!==o?.disabledCollections?(c=d=>{let{slug:a}=d;return!o?.disabledCollections?.includes(a)},e[0]=o?.disabledCollections,e[1]=c):c=e[1],i=l.filter(c).map(Bf)}let s,u;return e[2]!==r?(s=()=>{if(!r.hasNodes([Se]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return r.registerCommand(ur,Hf,Ff)},u=[r],e[2]=r,e[3]=s,e[4]=u):(s=e[3],u=e[4]),Pf(s,u),yf(os,{enabledCollectionSlugs:i})};function Bf(t){let{slug:e}=t;return e}function Hf(t){let e=Df()||Mf();if(Of(e)){let o=je(t),{focus:r}=e,n=r.getNode();Rf(o),Af(n)&&!n.__first&&n.remove()}return!0}var Uf=y({nodes:[Se],plugins:[{Component:rs,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(ct,{replace:!1})}}])]},toolbarFixed:{groups:[ke([{ChildComponent:ar,isActive:({selection:t})=>{if(!jf(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(ct,{replace:!1})}}])]}});import{c as ms}from"react/compiler-runtime";import{jsx as me,jsxs as h0}from"react/jsx-runtime";import{useLexicalComposerContext as g0}from"@lexical/react/LexicalComposerContext.js";import{useScrollInfo as x0,useThrottledEffect as C0,useTranslation as b0}from"@payloadcms/ui";import*as Ne from"react";import{useMemo as k0}from"react";import{c as Gf}from"react/compiler-runtime";import{jsx as Wf}from"react/jsx-runtime";import{mergeRegister as Vf}from"@lexical/utils";import{$addUpdateTag as Kf,$getSelection as Jf}from"lexical";import{useDeferredValue as Xf,useEffect as zf,useState as Zf}from"react";var ns="toolbar-popup__button",Rt=t=>{let e=Gf(23),{children:o,editor:r,item:n}=t,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={active:!1,enabled:!0},e[0]=l):l=e[0];let[i,s]=Zf(l),u=Xf(i),c=j(),d=u.enabled?"":"disabled",a=u.active?"active":"",p=n.key?`${ns}-${n.key}`:"",m;e[1]!==d||e[2]!==a||e[3]!==p?(m=[ns,d,a,p].filter(Boolean),e[1]=d,e[2]=a,e[3]=p,e[4]=m):m=e[4];let f=m.join(" "),h;e[5]!==r||e[6]!==c||e[7]!==n?(h=()=>{r.getEditorState().read(()=>{let R=Jf();if(!R)return;let O=n.isActive?n.isActive({editor:r,editorConfigContext:c,selection:R}):!1,$=n.isEnabled?n.isEnabled({editor:r,editorConfigContext:c,selection:R}):!0;s(v=>v.active===O&&v.enabled===$?v:{active:O,enabled:$})})},e[5]=r,e[6]=c,e[7]=n,e[8]=h):h=e[8];let g=h,k=Ft(),T,I;e[9]!==r||e[10]!==k||e[11]!==g?(T=()=>{k(g);let R=()=>k(g),O=Vf(r.registerUpdateListener(R));return document.addEventListener("mouseup",R),()=>{O(),document.removeEventListener("mouseup",R)}},I=[r,k,g],e[9]=r,e[10]=k,e[11]=g,e[12]=T,e[13]=I):(T=e[12],I=e[13]),zf(T,I);let b;e[14]!==i||e[15]!==r||e[16]!==n?(b=()=>{i.enabled&&r.focus(()=>{r.update(Yf),n.onSelect?.({editor:r,isActive:i.active})})},e[14]=i,e[15]=r,e[16]=n,e[17]=b):b=e[17];let _=b,x=qf,E;return e[18]!==o||e[19]!==f||e[20]!==_||e[21]!==n.key?(E=Wf("button",{className:f,"data-button-key":n.key,onClick:_,onMouseDown:x,type:"button",children:o}),e[18]=o,e[19]=f,e[20]=_,e[21]=n.key,e[22]=E):E=e[22],E};function Yf(){Kf("toolbar")}function qf(t){t.preventDefault()}import{c as l0}from"react/compiler-runtime";import{jsx as ot}from"react/jsx-runtime";import ds,{useCallback as i0,useDeferredValue as s0,useEffect as a0,useMemo as c0}from"react";import{mergeRegister as u0}from"@lexical/utils";import{useTranslation as d0}from"@payloadcms/ui";import{$getSelection as m0}from"lexical";import{jsx as Me,jsxs as ls}from"react/jsx-runtime";import{Button as Qf}from"@payloadcms/ui";import{$addUpdateTag as e0,isDOMNode as t0}from"lexical";import lo,{useCallback as o0,useEffect as io,useMemo as ss,useRef as dr,useState as mr}from"react";import{createPortal as r0}from"react-dom";var is="toolbar-popup__dropdown-item",as=lo.createContext(null);function cs({active:t,children:e,editor:o,enabled:r,Icon:n,item:l,itemKey:i,tooltip:s}){let u=ss(()=>[is,r===!1?"disabled":"",t?"active":"",l?.key?`${is}-${l.key}`:""].filter(Boolean).join(" "),[r,t,l.key]),c=dr(null),d=lo.use(as);if(d===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=d;return io(()=>{c?.current!=null&&a(c)},[c,a]),Me(Qf,{"aria-label":s,buttonStyle:"none",className:u,disabled:r===!1,extraButtonProps:{"data-item-key":i},icon:n,iconPosition:"left",iconStyle:"none",onClick:()=>{r!==!1&&o.focus(()=>{o.update(()=>{e0("toolbar")}),l.onSelect?.({editor:o,isActive:t})})},onMouseDown:p=>{p.preventDefault()},ref:c,tooltip:s,type:"button",children:e})}function n0({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:r}){let[n,l]=mr(),[i,s]=mr(),u=o0(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=ss(()=>({registerItem:u}),[u]);return io(()=>{n!=null&&i==null&&s(n[0]),i!=null&&i?.current!=null&&i.current.focus()},[n,i]),Me(as,{value:d,children:Me("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:c,ref:e,children:t})})}function us({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:r=!1,dropdownKey:n,Icon:l,itemsContainerClassNames:i,label:s,stopCloseOnClickSelf:u}){let c=dr(null),d=dr(null),[a,p]=mr(!1),m=()=>{p(!1),d?.current!=null&&d.current.focus()};io(()=>{let h=d.current,g=c.current;if(a&&h!==null&&g!==null){let{left:k,top:T}=h.getBoundingClientRect(),I=window.scrollY||document.documentElement.scrollTop;g.style.top=`${T+I+h.offsetHeight+5}px`,g.style.left=`${Math.min(k-5,window.innerWidth-g.offsetWidth-20)}px`}},[c,d,a]),io(()=>{let h=d.current;if(h!==null&&a){let g=k=>{let T=k.target;t0(T)&&(u&&c.current&&c.current.contains(T)||h.contains(T)||p(!1))};return document.addEventListener("click",g),()=>{document.removeEventListener("click",g)}}},[c,d,a,u]);let f=r0(Me(n0,{dropDownRef:c,itemsContainerClassNames:i,onClose:m,children:o}),document.body);return ls(lo.Fragment,{children:[ls("button",{"aria-label":t,className:e+(a?" active":""),"data-dropdown-key":n,disabled:r,onClick:h=>{h.preventDefault(),p(!a)},onMouseDown:h=>{h.preventDefault()},ref:d,type:"button",children:[l&&Me(l,{}),s&&Me("span",{className:"toolbar-popup__dropdown-label",children:s}),Me("i",{className:"toolbar-popup__dropdown-caret"})]}),a&&Me(lo.Fragment,{children:f})]})}var pr="toolbar-popup__dropdown",p0=t=>{let e=l0(14),{active:o,anchorElem:r,editor:n,enabled:l,item:i}=t,{i18n:s}=d0(),{fieldProps:u}=j(),{featureClientSchemaMap:c,schemaPath:d}=u;if(i.Component){let p;return e[0]!==o||e[1]!==r||e[2]!==n||e[3]!==l||e[4]!==i?(p=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]=p):p=e[5],p}let a;if(e[6]!==o||e[7]!==n||e[8]!==l||e[9]!==c||e[10]!==s||e[11]!==i||e[12]!==d){let p=i.key,m;i.label&&(p=typeof i.label=="function"?i.label({featureClientSchemaMap:c,i18n:s,schemaPath:d}):i.label),p.length>25?m=p.substring(0,25)+"...":m=p,a=ot(cs,{active:o,editor:n,enabled:l,Icon:i?.ChildComponent?ot(i.ChildComponent,{}):void 0,item:i,itemKey:i.key,tooltip:p,children:ot("span",{className:"text",children:m})},i.key),e[6]=o,e[7]=n,e[8]=l,e[9]=c,e[10]=s,e[11]=i,e[12]=d,e[13]=a}else a=e[13];return a},f0=ds.memo(p0),Ue=({anchorElem:t,classNames:e,editor:o,group:r,Icon:n,itemsContainerClassNames:l,label:i,maxActiveItems:s,onActiveChange:u})=>{let[c,d]=ds.useState({activeItemKeys:[],enabledGroup:!0,enabledItemKeys:[]}),a=s0(c),p=j(),{items:m,key:f}=r,h=Ft(),g=i0(()=>{o.getEditorState().read(()=>{let T=m0();if(!T)return;let I=[],b=[],_=[];for(let x of m)x.isActive&&(!s||I.length<s)&&x.isActive({editor:o,editorConfigContext:p,selection:T})&&(I.push(x.key),b.push(x)),x.isEnabled?x.isEnabled({editor:o,editorConfigContext:p,selection:T})&&_.push(x.key):_.push(x.key);d({activeItemKeys:I,enabledGroup:r.isEnabled?r.isEnabled({editor:o,editorConfigContext:p,selection:T}):!0,enabledItemKeys:_}),u&&u({activeItems:b})})},[o,p,r,m,s,u]);a0(()=>(h(g),u0(o.registerUpdateListener(async()=>{await h(g)}))),[o,h,g]);let k=c0(()=>m?.length?m.map(T=>ot(f0,{active:a.activeItemKeys.includes(T.key),anchorElem:t,editor:o,enabled:a.enabledItemKeys.includes(T.key),item:T},T.key)):null,[m,a,t,o]);return ot(us,{buttonAriaLabel:`${f} dropdown`,buttonClassName:[pr,`${pr}-${f}`,...e||[]].filter(Boolean).join(" "),disabled:!a.enabledGroup,dropdownKey:f,Icon:n,itemsContainerClassNames:[`${pr}-items`,...l||[]],label:i,children:k},f)};function _0({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(Rt,{editor:e,item:o,children:me(o.ChildComponent,{})},o.key):null}function T0(t){let e=ms(23),{anchorElem:o,editor:r,editorConfig:n,group:l,index:i}=t,{i18n:s}=b0(),{fieldProps:u}=j(),{featureClientSchemaMap:c,schemaPath:d}=u,[a,p]=Ne.useState(void 0),[m,f]=Ne.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 g;e[4]!==l?(g=[l],e[4]=l,e[5]=g):g=e[5],Ne.useEffect(h,g);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:x}=_;if(!x.length){l?.type==="dropdown"&&l.items.length&&l.ChildComponent?(f(()=>l.ChildComponent),p(void 0)):(f(void 0),p(void 0));return}let E=x[0],R=E.key;E.label&&(R=typeof E.label=="function"?E.label({featureClientSchemaMap:c,i18n:s,schemaPath:d}):E.label),R.length>25&&(R=R.substring(0,25)+"..."),x.length===1?(p(R),f(()=>E.ChildComponent)):(p(s.t("lexical:general:toolbarItemsActive",{count:x.length})),l?.type==="dropdown"&&l.items.length&&l.ChildComponent?f(()=>l.ChildComponent):f(void 0))},e[6]=c,e[7]=l.ChildComponent,e[8]=l.items,e[9]=l.type,e[10]=s,e[11]=d,e[12]=k):k=e[12];let T=k,I=`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]!==T||e[21]!==I?(b=h0("div",{className:I,"data-toolbar-group-key":l.key,children:[l.type==="dropdown"&&l.items.length?m?me(Ue,{anchorElem:o,editor:r,group:l,Icon:m,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:l.maxActiveItems??1,onActiveChange:T}):me(Ue,{anchorElem:o,editor:r,group:l,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:l.maxActiveItems??1,onActiveChange:T}):null,l.type==="buttons"&&l.items.length?l.items.map(_=>me(_0,{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]=T,e[21]=I,e[22]=b):b=e[22],b}function w0({anchorElem:t,clientProps:e,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let l=Ne.useRef(null),{y:i}=x0(),s=k0(()=>{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(Ne.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((u,c)=>me(T0,{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]=g0(),n=j(),{editorConfig:l}=n,i=o.applyToFocusedEditor&&n.focusedEditor?.editor||r,s=o.applyToFocusedEditor&&n.focusedEditor?.editorConfig||l,u,c;if(e[0]!==o.disableIfParentHasFixedToolbar||e[1]!==i||e[2]!==s||e[3]!==n){c=Symbol.for("react.early_return_sentinel");e:{let d=ps(n);if(o?.disableIfParentHasFixedToolbar&&d){c=null;break e}if(!s?.features?.toolbarFixed?.groups?.length){c=null;break e}u=me(w0,{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 E0=y({plugins:[{Component:fs,position:"aboveContainer"}]});import{c as xs}from"react/compiler-runtime";import{jsx as ge,jsxs as Cs}from"react/jsx-runtime";import{useLexicalComposerContext as S0}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as bs}from"@lexical/utils";import{$getSelection as ks,$isRangeSelection as hs,$isTextNode as N0,COMMAND_PRIORITY_LOW as L0,getDOMSelection as _s,SELECTION_CHANGE_COMMAND as y0}from"lexical";import{useCallback as ao,useEffect as vt,useRef as gs,useState as I0}from"react";import*as co from"react";import{createPortal as R0}from"react-dom";function fr(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 g=0;return!e&&f<m.top&&!s&&(g=a.height+u.height+c*2,f+=g),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)`),g}function v0({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&ge(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?ge(Rt,{editor:e,item:o,children:ge(o.ChildComponent,{})},o.key):null}function M0(t){let e=xs(19),{anchorElem:o,editor:r,group:n,index:l}=t,{editorConfig:i}=j(),[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:g}=h;if(!g.length){n?.type==="dropdown"&&n.items.length&&n.ChildComponent?u(()=>n.ChildComponent):u(void 0);return}let k=g[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,"data-toolbar-group-key":n.key,children:[n.type==="dropdown"&&n.items.length?s?ge(Ue,{anchorElem:o,editor:r,group:n,Icon:s,maxActiveItems:n.maxActiveItems??1,onActiveChange:p}):ge(Ue,{anchorElem:o,editor:r,group:n,maxActiveItems:n.maxActiveItems??1,onActiveChange:p}):null,n.type==="buttons"&&n.items.length?n.items.map(h=>ge(v0,{anchorElem:o,editor:r,item:h},h.key)):null,l<i.features.toolbarInline?.groups.length-1&&ge("div",{className:"divider"})]},n.key),e[10]=s,e[11]=o,e[12]=r,e[13]=i.features.toolbarInline?.groups.length,e[14]=n,e[15]=l,e[16]=p,e[17]=m,e[18]=f):f=e[18],f}function D0({anchorElem:t,editor:e}){let o=gs(null),r=gs(null),{editorConfig:n}=j(),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=fr(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(y0,()=>(u(),!1),L0))),[e,u]),Cs("div",{className:"inline-toolbar-popup",ref:o,children:[ge("div",{className:"caret",ref:r}),n?.features&&n.features?.toolbarInline?.groups.map((c,d)=>ge(M0,{anchorElem:t,editor:e,group:c,index:d},c.key))]})}function A0(t,e){let o=xs(12),[r,n]=I0(!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 g=p.getNodes(),k=!1;for(let T of g)if(N0(T)){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=R0(ge(D0,{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]=S0();return A0(o,e)};var O0=y({plugins:[{Component:Ts,position:"floatingAnchorElem"}]});import{TableCellNode as Sh,TableNode as Nh,TableRowNode as Lh}from"@lexical/table";import{jsx as ws}from"react/jsx-runtime";import"react";var hr=()=>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 F0,$createTableNode as $0,$createTableRowNode as P0,$isTableCellNode as Es,$isTableNode as gr,$isTableRowNode as xr,TableCellHeaderStates as uo,TableCellNode as B0,TableNode as H0,TableRowNode as j0}from"@lexical/table";import{$isParagraphNode as U0,$isTextNode as G0}from"lexical";var Ns=/^\|(.+)\|\s?$/,W0=/^(\| ?:?-*:? ?)+\|\s?$/,Ls=({allTransformers:t})=>({type:"element",dependencies:[H0,j0,B0],export:e=>{if(!gr(e))return null;let o=[];for(let r of e.getChildren()){let n=[];if(!xr(r))continue;let l=!1;for(let i of r.getChildren())Es(i)&&(n.push(Hr(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
|
+
`)},regExp:Ns,replace:(e,o,r)=>{let n=r[0];if(!n)return;if(W0.test(n)){let a=e.getPreviousSibling();if(!a||!gr(a))return;let p=a.getChildren(),m=p[p.length-1];if(!m||!xr(m))return;m.getChildren().forEach(f=>{Es(f)&&f.setHeaderStyles(uo.ROW,uo.ROW)}),e.remove();return}let l=Ss(n,t);if(l==null)return;let i=[l],s=e.getPreviousSibling(),u=l.length;for(;s&&!(!U0(s)||s.getChildrenSize()!==1);){let a=s.getFirstChild();if(!G0(a))break;let p=Ss(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=$0();for(let a of i){let p=P0();c.append(p);for(let m=0;m<u;m++)p.append(m<a.length?a[m]:ys("",t))}let d=e.getPreviousSibling();gr(d)&&V0(d)===u?(d.append(...c.getChildren()),e.remove()):e.replace(c),c.selectEnd()}});function V0(t){let e=t.getFirstChild();return xr(e)?e.getChildrenSize():0}var ys=(t,e)=>{t=t.replace(/\\n/g,`
|
|
40
|
+
`);let o=F0(uo.NO_STATUS);return Br(t,e,o),o},Ss=(t,e)=>{let o=t.match(Ns);return!o||!o[1]?null:o[1].split("|").map(r=>ys(r,e))};import{c as J0}from"react/compiler-runtime";import{jsx as P,jsxs as Le}from"react/jsx-runtime";import{useLexicalComposerContext as Ms}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as X0}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as br,$deleteTableColumn__EXPERIMENTAL as z0,$deleteTableRow__EXPERIMENTAL as Z0,$getNodeTriplet as Y0,$getTableCellNodeFromLexicalNode as Rs,$getTableColumnIndexFromTableCellNode as q0,$getTableNodeFromLexicalNodeOrThrow as ye,$getTableRowIndexFromTableCellNode as Q0,$insertTableColumn__EXPERIMENTAL as e1,$insertTableRow__EXPERIMENTAL as t1,$isTableCellNode as Ds,$isTableSelection as Mt,$unmergeCell as o1,getTableElement as kr,getTableObserverFromTableElement as _r,TableCellHeaderStates as De,TableCellNode as r1}from"@lexical/table";import{mergeRegister as n1}from"@lexical/utils";import{useScrollInfo as l1}from"@payloadcms/ui";import{$createParagraphNode as i1,$getSelection as po,$isElementNode as s1,$isParagraphNode as a1,$isRangeSelection as Tr,$isTextNode as c1,$setSelection as u1,COMMAND_PRIORITY_CRITICAL as d1,getDOMSelection as m1,isDOMNode as p1,SELECTION_CHANGE_COMMAND as f1}from"lexical";import*as wr from"react";import{useCallback as pe,useEffect as rt,useRef as mo,useState as nt}from"react";import{createPortal as As}from"react-dom";import{jsx as Cr,jsxs as K0}from"react/jsx-runtime";import"react";var Is=()=>K0("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[Cr("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"}),Cr("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"}),Cr("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 h1(){let t=po();if(Tr(t)&&!t.isCollapsed()||Mt(t)&&!t.anchor.is(t.focus)||!Tr(t)&&!Mt(t))return!1;let[e]=Y0(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function g1(t){if(t.getChildrenSize()!==1)return!1;let e=t.getFirstChildOrThrow();return!(!a1(e)||!e.isEmpty())}function x1(t){let e=t.getLastDescendant();c1(e)?e.select():s1(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}=l1();rt(()=>l.registerMutationListener(r1,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 N=vs(C);d(vs(C)),p(N.columns>1||N.rows>1)}f(h1())})},[l]),rt(()=>{let C=e.current,N=i.current,M=l.getRootElement();if(C!=null&&N!=null&&M!=null){let L=M.getBoundingClientRect(),D=C.getBoundingClientRect();N.style.opacity="1";let w=N.getBoundingClientRect(),F=5,H=D.right+F;if(H+w.width>window.innerWidth||H+w.width>L.right){let Y=D.left-w.width-F;H=(Y<0?F:Y)+window.pageXOffset}N.style.left=`${H+window.pageXOffset}px`;let W=D.top;if(W+w.height>window.innerHeight){let Y=D.bottom-w.height;W=Y<0?F:Y}N.style.top=`${W}px`}},[e,i,l,h]),rt(()=>{function C(N){i.current!=null&&e.current!=null&&p1(N.target)&&!i.current.contains(N.target)&&!e.current.contains(N.target)&&r(!1)}return window.addEventListener("click",C),()=>window.removeEventListener("click",C)},[r,e]);let g=pe(()=>{l.update(()=>{if(s.isAttached()){let C=ye(s),N=kr(C,l.getElementByKey(C.getKey()));if(N===null)throw new Error("Expected to find tableElement in DOM");let M=_r(N);M!==null&&M.$clearHighlight(),C.markDirty(),u(s.getLatest())}u1(null)})},[l,s]),k=()=>{l.update(()=>{let C=po();if(Mt(C)){let M=C.getNodes().filter(Ds);if(M.length===0)return;let L=ye(M[0]),[D]=br(L,null,null),w=1/0,F=-1/0,H=1/0,W=-1/0,Y=new Set;for(let q of D)for(let K of q){if(!K||!K.cell)continue;let re=K.cell.getKey();if(!Y.has(re)&&M.some(ne=>ne.is(K.cell))){Y.add(re);let ne=K.startRow,se=K.startColumn,Ae=K.cell.__rowSpan||1,st=K.cell.__colSpan||1;w=Math.min(w,ne),F=Math.max(F,ne+Ae-1),H=Math.min(H,se),W=Math.max(W,se+st-1)}}if(w===1/0||H===1/0)return;let We=F-w+1,V=W-H+1,U=D?.[w]?.[H];if(!U?.cell)return;let oe=U.cell;oe.setColSpan(V),oe.setRowSpan(We);let ue=new Set([oe.getKey()]);for(let q=w;q<=F;q++)for(let K=H;K<=W;K++){let re=D?.[q]?.[K];if(!re?.cell)continue;let ne=re.cell,se=ne.getKey();ue.has(se)||(ue.add(se),g1(ne)||oe.append(...ne.getChildren()),ne.remove())}oe.getChildrenSize()===0&&oe.append(i1()),x1(oe),o()}})},T=()=>{l.update(()=>{o1()})},I=pe(C=>{l.update(()=>{for(let N=0;N<c.rows;N++)t1(C);o()})},[l,o,c.rows]),b=pe(C=>{l.update(()=>{for(let N=0;N<c.columns;N++)e1(C);o()})},[l,o,c.columns]),_=pe(()=>{l.update(()=>{Z0(),o()})},[l,o]),x=pe(()=>{l.update(()=>{ye(s).remove(),g(),o()})},[l,s,g,o]),E=pe(()=>{l.update(()=>{z0(),o()})},[l,o]),R=pe(()=>{l.update(()=>{let C=ye(s),N=Q0(s),[M]=br(C,null,null),L=new Set,D=s.getHeaderStyles()^De.ROW;if(M[N])for(let w=0;w<M[N].length;w++){let F=M[N][w];F?.cell&&(L.has(F.cell)||(L.add(F.cell),F.cell.setHeaderStyles(D,De.ROW)))}g(),o()})},[l,s,g,o]),O=pe(()=>{l.update(()=>{let C=ye(s),N=q0(s),[M]=br(C,null,null),L=new Set,D=s.getHeaderStyles()^De.COLUMN;if(M)for(let w=0;w<M.length;w++){let F=M?.[w]?.[N];F?.cell&&(L.has(F.cell)||(L.add(F.cell),F.cell.setHeaderStyles(D,De.COLUMN)))}g(),o()})},[l,s,g,o]),$=pe(()=>{l.update(()=>{if(s.isAttached()){let C=ye(s);C&&C.setRowStriping(!C.getRowStriping())}g(),o()})},[l,s,g,o]),v=pe(()=>{l.update(()=>{if(s.isAttached()){let C=ye(s);C&&C.setFrozenColumns(C.getFrozenColumns()===0?1:0)}g(),o()})},[l,s,g,o]),S=null;return t&&(a?S=P("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>k(),type:"button",children:P("span",{className:"text",children:"Merge cells"})}):m&&(S=P("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>T(),type:"button",children:P("span",{className:"text",children:"Unmerge cells"})}))),As(Le("div",{className:"table-action-menu-dropdown",onClick:C=>{C.stopPropagation()},ref:i,children:[S?Le(wr.Fragment,{children:[S,P("hr",{})]}):null,P("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>$(),type:"button",children:P("span",{className:"text",children:"Toggle Row Striping"})}),P("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>v(),type:"button",children:P("span",{className:"text",children:"Toggle First Column Freeze"})}),P("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>I(!1),type:"button",children:Le("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," above"]})}),P("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>I(!0),type:"button",children:Le("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," below"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>b(!1),type:"button",children:Le("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","left"]})}),P("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>b(!0),type:"button",children:Le("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","right"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>E(),type:"button",children:P("span",{className:"text",children:"Delete column"})}),P("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>_(),type:"button",children:P("span",{className:"text",children:"Delete row"})}),P("button",{className:"item","data-test-id":"table-delete",onClick:()=>x(),type:"button",children:P("span",{className:"text",children:"Delete table"})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-row-header",onClick:()=>R(),type:"button",children:Le("span",{className:"text",children:[(s.__headerState&De.ROW)===De.ROW?"Remove":"Add"," ","row header"]})}),P("button",{className:"item","data-test-id":"table-column-header",onClick:()=>O(),type:"button",children:Le("span",{className:"text",children:[(s.__headerState&De.COLUMN)===De.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function b1({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=m1(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 g=o.getRootElement(),k=null,T=null;if(Tr(p)&&g!==null&&m!==null&&g.contains(m.anchorNode)){let b=Rs(p.anchor.getNode());if(b==null||(T=o.getElementByKey(b.getKey()),T==null||!b.isAttached()))return h();let _=ye(b),x=kr(_,o.getElementByKey(_.getKey()));if(x===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");k=_r(x),u(b)}else if(Mt(p)){let b=Rs(p.anchor.getNode());if(!Ds(b))throw new Error("TableSelection anchorNode must be a TableCellNode");let _=ye(b),x=kr(_,o.getElementByKey(_.getKey()));if(x===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");k=_r(x),T=o.getElementByKey(b.getKey())}else if(!f)return h();if(k===null||T===null)return h();let I=!k||!k.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",I),a.classList.toggle("table-cell-action-button-container--inactive",!I),I){let b=T.getBoundingClientRect(),_=t.getBoundingClientRect(),x=b.top-_.top,E=b.right-_.left;a.style.transform=`translate(${E}px, ${x}px)`}},[o,t]);rt(()=>{let a,p=()=>{a=void 0,o.getEditorState().read(c)},m=()=>(a===void 0&&(a=setTimeout(p,0)),!1);return n1(o.registerUpdateListener(m),o.registerCommand(f1,m,d1),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]),P("div",{className:"table-cell-action-button-container",ref:r,children:s!=null&&Le(wr.Fragment,{children:[P("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),i(!l)},ref:n,type:"button",children:P(Is,{})}),l&&P(C1,{cellMerge:e,contextRef:n,onClose:()=>i(!1),setIsMenuOpen:i,tableCellNode:s})]})})}var Os=t=>{let e=J0(3),{anchorElem:o}=t,r=X0(),n;return e[0]!==o||e[1]!==r?(n=As(r?P(b1,{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 k1}from"react/compiler-runtime";import{jsx as ho,jsxs as _1}from"react/jsx-runtime";import{useLexicalComposerContext as T1}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as w1}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as E1,$getTableNodeFromLexicalNodeOrThrow as Er,$getTableRowIndexFromTableCellNode as S1,$isTableCellNode as Fs,$isTableRowNode as N1,getDOMCellFromTarget as L1,getTableElement as y1,TableNode as $s}from"@lexical/table";import{calculateZoomLevel as Ps,mergeRegister as I1}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Sr,isHTMLElement as R1}from"lexical";import*as Hs from"react";import{useCallback as Dt,useEffect as Nr,useRef as fo,useState as lt}from"react";import{createPortal as v1}from"react-dom";var M1=33,Bs=92;function D1({editor:t}){let e=fo(null),o=fo(null),r=fo(null),[n,l]=lt(!1),i=j(),s=fo(null),[u,c]=lt(null),[d,a]=lt(null),[p,m]=lt(!1),[f,h]=lt(null),g=Dt(()=>{a(null),e.current=null,h(null),s.current=null,r.current=null},[]),k=v=>(v.buttons&1)===1;Nr(()=>{let v=new Set;return I1(t.registerMutationListener($s,S=>{for(let[C,N]of S)N==="destroyed"?v.delete(C):v.add(C);l(v.size>0)}),t.registerNodeTransform($s,S=>{if(S.getColWidths())return S;let C=S.getColumnCount(),N=Bs;return S.setColWidths(Array(C).fill(N)),S}))},[t]),Nr(()=>{if(!n)return;let v=M=>{let L=M.target;if(R1(L)){if(f){c({x:M.clientX,y:M.clientY});return}if(m(k(M)),!(o.current&&o.current.contains(L))&&e.current!==L){e.current=L;let D=L1(L);D&&d!==D?t.getEditorState().read(()=>{let w=Sr(D.elem);if(!w)throw new Error("TableCellResizer: Table cell node not found.");let F=Er(w),H=y1(F,t.getElementByKey(F.getKey()));if(!H)throw new Error("TableCellResizer: Table element not found.");e.current=L,r.current=H.getBoundingClientRect(),a(D)},{editor:t}):D==null&&g()}}},S=M=>{m(!0)},C=M=>{m(!1)},N=t.registerRootListener((M,L)=>{L?.removeEventListener("mousemove",v),L?.removeEventListener("mousedown",S),L?.removeEventListener("mouseup",C),M?.addEventListener("mousemove",v),M?.addEventListener("mousedown",S),M?.addEventListener("mouseup",C)});return()=>{N()}},[d,f,t,n,g]);let T=v=>v==="bottom",I=Dt(v=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let S=Sr(d.elem);if(!Fs(S))throw new Error("TableCellResizer: Table cell node not found.");let C=Er(S),N=S1(S),M=C.getChildren(),D=S.getColSpan()===C.getColumnCount()?N:N+S.getRowSpan()-1;if(D>=M.length||D<0)throw new Error("Expected table cell to be inside of table row.");let w=M[D];if(!N1(w))throw new Error("Expected table row");let F=w.getHeight();if(F===void 0){let W=w.getChildren();F=Math.min(...W.map(Y=>b(Y,t)??1/0))}let H=Math.max(F+v,M1);w.setHeight(H)},{tag:"skip-scroll-into-view"})},[d,t]),b=(v,S)=>S.getElementByKey(v.getKey())?.clientHeight,_=(v,S)=>{let C;return S.forEach(N=>{N.forEach((M,L)=>{M.cell===v&&(C=L)})}),C},x=Dt(v=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let S=Sr(d.elem);if(!Fs(S))throw new Error("TableCellResizer: Table cell node not found.");let C=Er(S),[N]=E1(C,null,null),M=_(S,N);if(M===void 0)throw new Error("TableCellResizer: Table column not found.");let L=C.getColWidths();if(!L)return;let D=L[M];if(D===void 0)return;let w=[...L],F=Math.max(D+v,Bs);w[M]=F,C.setColWidths(w)},{tag:"skip-scroll-into-view"})},[d,t]),E=Dt(v=>{let S=C=>{if(C.preventDefault(),C.stopPropagation(),!d)throw new Error("TableCellResizer: Expected active cell.");if(s.current){let{x:N,y:M}=s.current;if(d===null)return;let L=Ps(C.target);if(T(v)){let D=(C.clientY-M)/L;I(D)}else{let D=(C.clientX-N)/L;x(D)}g(),document.removeEventListener("mouseup",S)}};return S},[d,g,x,I]),R=Dt(v=>S=>{if(S.preventDefault(),S.stopPropagation(),!d)throw new Error("TableCellResizer: Expected active cell.");s.current={x:S.clientX,y:S.clientY},c(s.current),h(v),document.addEventListener("mouseup",E(v))},[d,E]),[O,$]=lt({bottom:null,left:null,right:null,top:null});return Nr(()=>{if(d){let{height:v,left:S,top:C,width:N}=d.elem.getBoundingClientRect(),M=Ps(d.elem),L=10,D={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${L}px`,left:`${window.scrollX+S}px`,top:`${window.scrollY+C+v-L/2}px`,width:`${N}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${v}px`,left:`${window.scrollX+S+N-L/2}px`,top:`${window.scrollY+C}px`,width:`${L}px`}},w=r.current;f&&u&&w&&(T(f)?(D[f].left=`${window.scrollX+w.left}px`,D[f].top=`${window.scrollY+u.y/M}px`,D[f].height="3px",D[f].width=`${w.width}px`):(D[f].top=`${window.scrollY+w.top}px`,D[f].left=`${window.scrollX+u.x/M}px`,D[f].width="3px",D[f].height=`${w.height}px`),D[f].backgroundColor="#adf"),$(D)}else $({bottom:null,left:null,right:null,top:null})},[d,f,u]),ho("div",{ref:o,children:d!=null&&!p&&_1(Hs.Fragment,{children:[ho("div",{className:`${i.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:R("right"),style:O.right||void 0}),ho("div",{className:`${i.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:R("bottom"),style:O.bottom||void 0})]})})}var js=()=>{let t=k1(3),[e]=T1(),o=w1(),r;return t[0]!==e||t[1]!==o?(r=o?v1(ho(D1,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=r):r=t[2],r};import{c as j1}from"react/compiler-runtime";import{jsx as Lr,jsxs as U1,Fragment as G1}from"react/jsx-runtime";import{useLexicalComposerContext as zs}from"@lexical/react/LexicalComposerContext";import{$getTableAndElementByKey as W1,$getTableColumnIndexFromTableCellNode as V1,$getTableRowIndexFromTableCellNode as K1,$insertTableColumn__EXPERIMENTAL as J1,$insertTableRow__EXPERIMENTAL as X1,$isTableCellNode as z1,$isTableNode as Ws,getTableElement as Z1,TableNode as Y1}from"@lexical/table";import{$findMatchingParent as q1,mergeRegister as Q1}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Vs,isHTMLElement as eh}from"lexical";import{useEffect as Ks,useMemo as th,useRef as Js,useState as go}from"react";import"react";import{createPortal as oh}from"react-dom";import{c as P1}from"react/compiler-runtime";import{useEffect as B1,useRef as H1}from"react";var A1="Expected a function",O1=Math.max,F1=Math.min;function $1(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(A1);e=e||0,typeof o=="object"&&(s=!!o.leading,u="maxWait"in o,c=u?O1(o.maxWait||0,e):c,p="trailing"in o?!!o.trailing:p);function m(x){let E=r,R=i;return r=i=void 0,l=x,d=t.apply(R,E),d}function f(x){return l=x,a=setTimeout(k,e),s?m(x):d}function h(x){let E=x-n,R=x-l,O=e-E;return u?F1(O,c-R):O}function g(x){let E=x-n,R=x-l;return n===void 0||E>=e||E<0||u&&R>=c}function k(){let x=Date.now();if(g(x))return T(x);a=setTimeout(k,h(x))}function T(x){return a=void 0,p&&r?m(x):(r=i=void 0,d)}function I(){a!==void 0&&clearTimeout(a),l=0,r=n=i=a=void 0}function b(){return a===void 0?d:T(Date.now())}function _(){let x=Date.now(),E=g(x);if(r=arguments,i=this,n=x,E){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=I,_.flush=b,_}var Us=$1;function Gs(t,e,o){let r=P1(6),n=H1(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]),B1(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 rh({anchorElem:t}){let[e]=zs(),o=j(),[r,n]=go(!1),[l,i]=go(!1),[s,u]=go(!1),[c,d]=go({}),a=Js(new Set),p=Js(null),m=Gs(g=>{let{isOutside:k,tableDOMNode:T}=nh(g,o.editorConfig?.lexical);if(k){n(!1),i(!1);return}if(!T)return;p.current=T;let I=null,b=null,_=null;if(e.getEditorState().read(()=>{let L=Vs(T);if(z1(L)){let D=q1(L,w=>Ws(w));if(!Ws(D))return;if(_=Z1(D,e.getElementByKey(D.getKey())),_){let w=D.getChildrenSize(),F=D.getChildAtIndex(0)?.getChildrenSize(),H=K1(L),W=V1(L);H===w-1?I=L:W===F-1&&(b=L)}}},{editor:e}),!_)return;let x=_.parentElement;if(!x)return;let{bottom:E,height:R,left:O,right:$,width:v,y:S}=_.getBoundingClientRect(),C=!1;x&&x.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(C=x.scrollWidth>x.clientWidth);let{left:N,y:M}=t.getBoundingClientRect();I?(i(!1),n(!0),d({height:Xs,left:C&&x?x.offsetLeft:O-N,top:E-M+5,width:C&&x?x.offsetWidth:v})):b&&(i(!0),n(!1),d({height:R,left:$-N+5,top:S-M,width:Xs}))},50,250),f=th(()=>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(()=>Q1(e.registerMutationListener(Y1,g=>{e.getEditorState().read(()=>{let k=!1;for(let[T,I]of g)switch(I){case"created":{a.current.add(T),k=!0;break}case"destroyed":{a.current.delete(T),k=!0;break}default:break}if(k){f.disconnect();for(let T of a.current){let{tableElement:I}=W1(T);f.observe(I)}u(a.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,f]);let h=g=>{e.update(()=>{p.current&&(Vs(p.current)?.selectEnd(),g?(X1(),n(!1)):(J1(),i(!1)))})};return e?.isEditable()?U1(G1,{children:[r&&Lr("button",{"aria-label":"Add Row",className:o.editorConfig.lexical.theme.tableAddRows,onClick:()=>h(!0),style:{...c},type:"button"}),l&&Lr("button",{"aria-label":"Add Column",className:o.editorConfig.lexical.theme.tableAddColumns,onClick:()=>h(!1),style:{...c},type:"button"})]}):null}function nh(t,e){let o=t.target;if(eh(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=j1(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=oh(Lr(rh,{anchorElem:r}),r),e[0]=r,e[1]=l):l=e[1],l}import{c as lh}from"react/compiler-runtime";import{jsx as yr,jsxs as ih}from"react/jsx-runtime";import{useLexicalComposerContext as sh}from"@lexical/react/LexicalComposerContext";import{TablePlugin as ah}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as ch,TableCellNode as uh,TableNode as dh,TableRowNode as mh}from"@lexical/table";import{mergeRegister as ph}from"@lexical/utils";import{formatDrawerSlug as fh,useEditDepth as hh}from"@payloadcms/ui";import{$getSelection as gh,$isRangeSelection as xh,COMMAND_PRIORITY_EDITOR as Ch,createCommand as bh}from"lexical";import{createContext as kh,use as _h,useEffect as Th,useMemo as wh,useState as Eh}from"react";import*as Ys from"react";var xo=bh("OPEN_EMBED_DRAWER_COMMAND"),qs=kh({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function Qs({children:t}){let[e,o]=Eh({cellEditorConfig:null,cellEditorPlugins:null});return yr(qs,{value:wh(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var ea=()=>{let t=lh(16),[e]=sh(),o=_h(qs),r=hh(),{fieldProps:n,uuid:l}=j(),{schemaPath:i}=n,s="lexical-table-create-"+l,u;t[0]!==r||t[1]!==s?(u=fh({slug:s,depth:r}),t[0]=r,t[1]=s,t[2]=u):u=t[2];let c=u,{toggleDrawer:d}=xe(c,!0),a;t[3]!==e||t[4]!==d?(a=()=>{if(!e.hasNodes([dh,mh,uh]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return ph(e.registerCommand(xo,()=>{let h=null;return e.getEditorState().read(()=>{let g=gh();xh(g)&&(h=g)}),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],Th(a,p);let m;t[10]!==e?(m=(h,g)=>{!g.columns||!g.rows||e.dispatchCommand(ch,{columns:String(g.columns),rows:String(g.rows)})},t[10]=e,t[11]=m):m=t[11];let f;return t[12]!==c||t[13]!==i||t[14]!==m?(f=ih(Ys.Fragment,{children:[yr(at,{drawerSlug:c,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:m,schemaPath:i,schemaPathSuffix:"fields"}),yr(ah,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]}),t[12]=c,t[13]=i,t[14]=m,t[15]=f):f=t[15],f};var yh=y({markdownTransformers:[Ls],nodes:[Nh,Sh,Lh],plugins:[{Component:ea,position:"normal"},{Component:js,position:"normal"},{Component:Os,position:"floatingAnchorElem"},{Component:Zs,position:"floatingAnchorElem"}],providers:[Qs],slashMenu:{groups:[ee([{Icon:hr,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(xo,{})}}])]},toolbarFixed:{groups:[ke([{ChildComponent:hr,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(xo,{})}}])]}});import{$isNodeSelection as lg}from"lexical";import{jsx as Ir,jsxs as Ih}from"react/jsx-runtime";import"react";var Rr=()=>Ih("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:[Ir("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"}),Ir("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"}),Ir("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 Ah}from"react/jsx-runtime";import ra from"bson-objectid";import{$applyNodeReplacement as Oh}from"lexical";import*as na from"react";import{jsx as Rh}from"react/jsx-runtime";import{DecoratorBlockNode as vh}from"@lexical/react/LexicalDecoratorBlockNode.js";import ta from"bson-objectid";import{$applyNodeReplacement as Mh}from"lexical";import"react";function vr(t){return t.parentElement!=null&&t.parentElement.tagName==="LI"&&t.previousSibling===null&&t.getAttribute("aria-roledescription")==="checkbox"}function Dh(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:///")||vr(e),null}var At=class extends vh{__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:Dh,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 Rh(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()),Mh(new At({data:t}))}var Fh=na.lazy(()=>import("./component-3PENNOM3.js").then(t=>({default:t.UploadComponent})));function $h(t){if(t.hasAttribute("data-lexical-upload-relation-to")&&t.hasAttribute("data-lexical-upload-id")){let o=t.getAttribute("data-lexical-upload-id"),r=t.getAttribute("data-lexical-upload-relation-to");if(o!=null&&r!=null)return{node:Ge({data:{fields:{},relationTo:r,value:o}})}}let e=t;return e.src.startsWith("file:///")||vr(e),null}var Ie=class extends At{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{img:e=>({conversion:$h,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=Ge({data:o});return r.setFormat(e.format),r}decorate(){return Ah(Fh,{data:this.__data,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Ge({data:t}){return t?.id||(t.id=new ra.default().toHexString()),Oh(new Ie({data:t}))}function Mr(t){return t instanceof Ie}import{c as Vh}from"react/compiler-runtime";import{jsx as Kh}from"react/jsx-runtime";import{useLexicalComposerContext as Jh}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Xh,mergeRegister as zh}from"@lexical/utils";import{useConfig as Zh}from"@payloadcms/ui";import{$getPreviousSelection as Yh,$getSelection as qh,$isParagraphNode as Qh,$isRangeSelection as eg,COMMAND_PRIORITY_EDITOR as tg,createCommand as og}from"lexical";import{useEffect as rg}from"react";import{c as la}from"react/compiler-runtime";import{jsx as Dr}from"react/jsx-runtime";import{useLexicalComposerContext as ia}from"@lexical/react/LexicalComposerContext.js";import{toast as Ph}from"@payloadcms/ui";import{$getNodeByKey as Bh,COMMAND_PRIORITY_EDITOR as sa}from"lexical";import{useEffect as aa,useState as Hh}from"react";var jh=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=Bh(o);n&&n.replace(Ge({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(Ar,{fields:null,relationTo:e,value:r})},Uh=t=>{let e=la(13),{enabledCollectionSlugs:o}=t,[r]=ia(),[n,l]=Hh(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}=It(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:g,doc:k}=h;s(),jh({editor:r,relationTo:g,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=Dr(u,{onSelect:m}),e[10]=u,e[11]=m,e[12]=f):f=e[12],f},Gh=()=>{let t=la(3),[e]=ia(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Ke,Wh,sa),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),aa(o,r),null},ca=t=>Dr(Ot,{...t,FallbackComponent:Gh,uploads:!0,children:Dr(Uh,{...t})});function Wh(){return Ph.error("No upload collections enabled"),!0}var Ar=og("INSERT_UPLOAD_COMMAND"),ua=t=>{let e=Vh(5),[o]=Jh(),{config:r}=Zh(),{collections:n}=r,l,i;e[0]!==o?(l=()=>{if(!o.hasNodes([Ie]))throw new Error("UploadPlugin: UploadNode not registered on editor");return zh(o.registerCommand(Ar,u=>(o.update(()=>{let c=qh()||Yh();if(eg(c)){let d=Ge({data:{id:u.id,fields:u.fields,relationTo:u.relationTo,value:u.value}}),{focus:a}=c,p=a.getNode();Xh(d),Qh(p)&&!p.__first&&p.remove()}}),!0),tg))},i=[o],e[0]=o,e[1]=l,e[2]=i):(l=e[1],i=e[2]),rg(l,i);let s;return e[3]!==n?(s=Kh(ca,{enabledCollectionSlugs:n.map(ng)}),e[3]=n,e[4]=s):s=e[4],s};function ng(t){let{slug:e}=t;return e}var ig=y({nodes:[Ie],plugins:[{Component:ua,position:"normal"}],slashMenu:{groups:[ee([{Icon:Rr,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ke,{replace:!1})}}])]},toolbarFixed:{groups:[ke([{ChildComponent:Rr,isActive:({selection:t})=>{if(!lg(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Mr(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ke,{replace:!1})}}])]}});import{c as ag}from"react/compiler-runtime";import{jsx as Fr}from"react/jsx-runtime";import{ShimmerEffect as cg,useConfig as ug}from"@payloadcms/ui";import{lazy as dg,Suspense as mg,useEffect as pg,useState as fg}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 sg}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?sg(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 Or(t,e,o){return{admin:o,features:pa(t),lexical:e,resolvedFeatureMap:t}}var hg=dg(()=>import("./Field-Q3PTZQ75.js").then(t=>({default:t.RichText}))),gg=t=>{let e=ag(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}=ug(),[m,f]=fg(null),h,g;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 T=[];for(let[_,x]of Object.entries(r))x.clientFeatureProvider&&T.push(x.clientFeatureProvider(x.clientFeatureProps));let I=a||Co,b=ma({config:p,featureClientImportMap:n,featureClientSchemaMap:l,field:i,schemaPath:u??i.name,unSanitizedEditorConfig:{features:T,lexical:I}});f(Or(b,I,d))},g=[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]=g):(h=e[11],g=e[12]),pg(h,g);let k;return e[13]!==m||e[14]!==t?(k=Fr(mg,{fallback:Fr(cg,{height:"35vh"}),children:m&&Fr(hg,{...t,editorConfig:m})}),e[13]=m,e[14]=t,e[15]=k):k=e[15],k};function xg(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),()=>{bg(t,e)}}function bg(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 kg(t,e){return ko(t,(o,r)=>{let[n,l]=o;n<0&&-n>Math.abs(l)&&e(n,r)})}function _g(t,e){return ko(t,(o,r)=>{let[n,l]=o;n>0&&n>Math.abs(l)&&e(n,r)})}function Tg(t,e){return ko(t,(o,r)=>{let[n,l]=o;l<0&&-l>Math.abs(n)&&e(n,r)})}function wg(t,e){return ko(t,(o,r)=>{let[n,l]=o;l>0&&l>Math.abs(n)&&e(n,r)})}import{c as Eg}from"react/compiler-runtime";import{jsx as Sg}from"react/jsx-runtime";import"react";var Ng=()=>{let t=Eg(2),{EditButton:e}=Ce(),o;return t[0]!==e?(o=e?Sg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Lg}from"react/compiler-runtime";import{jsx as yg}from"react/jsx-runtime";import"react";var Ig=()=>{let t=Lg(2),{RemoveButton:e}=Ce(),o;return t[0]!==e?(o=e?yg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Rg}from"react/compiler-runtime";import{jsx as vg}from"react/jsx-runtime";import"react";var Mg=()=>{let t=Rg(2),{Label:e}=Ce(),o;return t[0]!==e?(o=e?vg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Dg}from"react/compiler-runtime";import{jsx as Ag}from"react/jsx-runtime";import"react";var Og=t=>{let e=Dg(3),{children:o}=t,{InlineBlockContainer:r}=Ce(),n;return e[0]!==r||e[1]!==o?(n=r?Ag(r,{children:o}):null,e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{c as Fg}from"react/compiler-runtime";import{jsx as $g}from"react/jsx-runtime";import"react";var Pg=t=>{let e=Fg(6),{children:o,editButton:r,Label:n,removeButton:l}=t,{BlockCollapsible:i}=Oe(),s;return e[0]!==i||e[1]!==n||e[2]!==o||e[3]!==r||e[4]!==l?(s=i?$g(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 Bg}from"react/compiler-runtime";import{jsx as Hg}from"react/jsx-runtime";import"react";var jg=()=>{let t=Bg(2),{EditButton:e}=Oe(),o;return t[0]!==e?(o=e?Hg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Ug}from"react/compiler-runtime";import{jsx as Gg}from"react/jsx-runtime";import"react";var Wg=()=>{let t=Ug(2),{RemoveButton:e}=Oe(),o;return t[0]!==e?(o=e?Gg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as Vg}from"qs-esm";var Kg=({apiURL:t,depth:e,draft:o,locale:r})=>async({id:l,collectionSlug:i,select:s})=>{let u=Vg({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())};import{c as Jg}from"react/compiler-runtime";import{jsx as it}from"react/jsx-runtime";import{FieldContext as Xg,FieldPathContext as ha,ServerFunctionsContext as ga,ShimmerEffect as zg,useServerFunctions as Zg}from"@payloadcms/ui";import Yg,{useEffect as qg,useRef as Qg}from"react";var ex=t=>{let e=Jg(9),{field:o,initialValue:r,path:n,schemaPath:l,setValue:i,value:s}=t,[u,c]=Yg.useState(null),d=Zg(),{_internal_renderField:a}=d,[p,m]=l.split("."),f=n??(o&&"name"in o?o?.name:"")??"",h;e[0]!==a||e[1]!==o||e[2]!==r||e[3]!==n||e[4]!==l?(h=()=>{(async function(){let{Field:R}=await a({field:o,initialValue:r??void 0,path:n,schemaPath:l});c(R)})()},e[0]=a,e[1]=o,e[2]=r,e[3]=n,e[4]=l,e[5]=h):h=e[5];let g=h,k=Qg(!1),T,I;if(e[6]!==g?(T=()=>{k.current||(k.current=!0,g())},I=[g],e[6]=g,e[7]=T,e[8]=I):(T=e[7],I=e[8]),qg(T,I),!u)return it(zg,{});let b={...d,getFormState:async x=>d.getFormState({...x,collectionSlug:p==="collection"?m:void 0,globalSlug:p==="global"?m:void 0})};if(typeof s>"u"&&!i)return it(ga,{value:{...b},children:it(ha,{value:f,children:u},f)});let _={disabled:!1,formInitializing:!1,formProcessing:!1,formSubmitted:!1,initialValue:s,path:f,setValue:i??tx,showError:!1,value:s};return it(ga,{value:{...b},children:it(ha,{value:f,children:it(Xg,{value:_,children:u})},f)})};function tx(){}function ox({nodes:t,text:e}){let o={root:{type:"root",children:[],direction:"ltr",format:"",indent:0,version:1}};return e&&o.root.children.push({type:"paragraph",children:[{type:"text",detail:0,format:0,mode:"normal",style:"",text:e,version:1}],direction:"ltr",format:"",indent:0,textFormat:0,textStyle:"",version:1}),t?.length&&o.root.children.push(...t),o}export{bt as $createAutoLinkNode,Kt as $createBlockNode,To as $createInlineBlockNode,_e as $createLinkNode,je as $createRelationshipNode,Ge as $createUploadNode,we as $isAutoLinkNode,ht as $isBlockNode,wo as $isInlineBlockNode,Z as $isLinkNode,cr as $isRelationshipNode,Mr as $isUploadNode,Ia as AlignFeatureClient,Te as AutoLinkNode,Pg as BlockCollapsible,jg as BlockEditButton,be as BlockNode,Wg as BlockRemoveButton,Aa as BlockquoteFeatureClient,vc as BlocksFeatureClient,eu as BoldFeatureClient,ce as CAN_USE_DOM,ep as ChecklistFeatureClient,Wp as DETAIL_TYPE_TO_DETAIL,Hp as DOUBLE_LINE_BREAK,tf as DebugJsxConverterFeatureClient,Kp as ELEMENT_FORMAT_TO_TYPE,Vp as ELEMENT_TYPE_TO_FORMAT,Ta as ENABLE_SLASH_MENU_COMMAND,Ca as EditorConfigProvider,at as FieldsDrawer,E0 as FixedToolbarFeatureClient,Ju as HeadingFeatureClient,ud as HorizontalRuleFeatureClient,Je as INSERT_BLOCK_COMMAND,Xe as INSERT_INLINE_BLOCK_COMMAND,Pp as IS_ALL_FORMATTING,Nd as IndentFeatureClient,Og as InlineBlockContainer,Ng as InlineBlockEditButton,Mg as InlineBlockLabel,_o as InlineBlockNode,Ig as InlineBlockRemoveButton,lu as InlineCodeFeatureClient,O0 as InlineToolbarFeatureClient,cu as ItalicFeatureClient,Up as LTR_REGEX,Tp as LexicalPluginToLexicalFeatureClient,Bm as LinkFeatureClient,ie as LinkNode,Bp as NON_BREAKING_SPACE,A as NodeFormat,ap as OrderedListFeatureClient,Rp as ParagraphFeatureClient,ka as Point,jp as RTL_REGEX,wa as Rect,Uf as RelationshipFeatureClient,Se as RelationshipNode,ex as RenderLexical,gg as RichTextField,yp as SlateToLexicalFeatureClient,fu as StrikethroughFeatureClient,Cu as SubscriptFeatureClient,Tu as SuperscriptFeatureClient,Jp as TEXT_MODE_TO_TYPE,Gp as TEXT_TYPE_TO_FORMAT,Xp as TEXT_TYPE_TO_MODE,he as TOGGLE_LINK_COMMAND,yh as TableFeatureClient,Vc as TestRecorderFeatureClient,Pu as TextStateFeatureClient,Rt as ToolbarButton,Ue as ToolbarDropdown,Zc as TreeViewFeatureClient,Lu as UnderlineFeatureClient,gp as UnorderedListFeatureClient,ig as UploadFeatureClient,Ie as UploadNode,wg as addSwipeDownListener,kg as addSwipeLeftListener,_g as addSwipeRightListener,Tg as addSwipeUpListener,ox as buildEditorState,jo as createBlockNode,y as createClientFeature,of as defaultColors,Co as defaultEditorLexicalConfig,fr as getDOMRangeRect,Ea as getEnabledNodes,Kg as getRestPopulateFn,ze as getSelectedNode,xg as isHTMLElement,_a as isPoint,Cg as joinClasses,Or as sanitizeClientEditorConfig,pa as sanitizeClientFeatures,so as setFloatingElemPosition,to as setFloatingElemPositionForLinkEditor,ee as slashMenuBasicGroupWithItems,ke as toolbarAddDropdownGroupWithItems,Go as toolbarFeatureButtonsGroupWithItems,te as toolbarFormatGroupWithItems,le as toolbarTextDropdownGroupWithItems,Oe as useBlockComponentContext,j as useEditorConfigContext,Ce as useInlineBlockComponentContext,ba as useLexicalDocumentDrawer,xe as useLexicalDrawer,It as useLexicalListDrawer};
|
|
41
41
|
//# sourceMappingURL=index.js.map
|