@payloadcms/richtext-lexical 3.0.0-beta.73 → 3.0.0-beta.74
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-5GGTGCKC.js +2 -0
- package/dist/exports/client/Field-5GGTGCKC.js.map +7 -0
- package/dist/exports/client/bundled.css +1 -1
- package/dist/exports/client/index.js +7 -7
- package/dist/exports/client/index.js.map +4 -4
- package/dist/features/blocks/validate.d.ts.map +1 -1
- package/dist/features/blocks/validate.js +2 -1
- package/dist/features/blocks/validate.js.map +1 -1
- package/dist/features/experimental_table/feature.client.d.ts.map +1 -1
- package/dist/features/experimental_table/feature.client.js +5 -0
- package/dist/features/experimental_table/feature.client.js.map +1 -1
- package/dist/features/experimental_table/feature.server.d.ts.map +1 -1
- package/dist/features/experimental_table/feature.server.js +70 -6
- package/dist/features/experimental_table/feature.server.js.map +1 -1
- package/dist/features/experimental_table/plugins/TableActionMenuPlugin/index.d.ts.map +1 -1
- package/dist/features/experimental_table/plugins/TableActionMenuPlugin/index.js +2 -0
- package/dist/features/experimental_table/plugins/TableActionMenuPlugin/index.js.map +1 -1
- package/dist/features/experimental_table/plugins/TableCellResizerPlugin/index.d.ts +0 -1
- package/dist/features/experimental_table/plugins/TableCellResizerPlugin/index.d.ts.map +1 -1
- package/dist/features/experimental_table/plugins/TableCellResizerPlugin/index.js +13 -8
- package/dist/features/experimental_table/plugins/TableCellResizerPlugin/index.js.map +1 -1
- package/dist/features/experimental_table/plugins/TableHoverActionsPlugin/index.d.ts +12 -0
- package/dist/features/experimental_table/plugins/TableHoverActionsPlugin/index.d.ts.map +1 -0
- package/dist/features/experimental_table/plugins/TableHoverActionsPlugin/index.js +181 -0
- package/dist/features/experimental_table/plugins/TableHoverActionsPlugin/index.js.map +1 -0
- package/dist/features/experimental_table/utils/debounce.d.ts +61 -0
- package/dist/features/experimental_table/utils/debounce.d.ts.map +1 -0
- package/dist/features/experimental_table/utils/debounce.js +202 -0
- package/dist/features/experimental_table/utils/debounce.js.map +1 -0
- package/dist/features/experimental_table/utils/useDebounce.d.ts +6 -0
- package/dist/features/experimental_table/utils/useDebounce.d.ts.map +1 -0
- package/dist/features/experimental_table/utils/useDebounce.js +18 -0
- package/dist/features/experimental_table/utils/useDebounce.js.map +1 -0
- package/dist/features/link/plugins/autoLink/index.d.ts.map +1 -1
- package/dist/features/link/plugins/autoLink/index.js +19 -6
- package/dist/features/link/plugins/autoLink/index.js.map +1 -1
- package/dist/features/link/validate.d.ts.map +1 -1
- package/dist/features/link/validate.js +2 -1
- package/dist/features/link/validate.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/index.d.ts.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/index.js +1 -0
- package/dist/features/migrations/slateToLexical/converter/index.js.map +1 -1
- package/dist/features/typesServer.d.ts +2 -1
- package/dist/features/typesServer.d.ts.map +1 -1
- package/dist/features/typesServer.js.map +1 -1
- package/dist/features/upload/validate.d.ts.map +1 -1
- package/dist/features/upload/validate.js +1 -0
- package/dist/features/upload/validate.js.map +1 -1
- package/dist/field/Field.d.ts.map +1 -1
- package/dist/field/Field.js +8 -7
- package/dist/field/Field.js.map +1 -1
- package/dist/field/index.js +8 -8
- package/dist/lexical/LexicalEditor.d.ts.map +1 -1
- package/dist/lexical/LexicalEditor.js +0 -6
- package/dist/lexical/LexicalEditor.js.map +1 -1
- package/dist/lexical/ui/ContentEditable.d.ts.map +1 -1
- package/dist/lexical/ui/ContentEditable.js +8 -1
- package/dist/lexical/ui/ContentEditable.js.map +1 -1
- package/dist/lexical/ui/icons/Table/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/Table/index.js +1 -0
- package/dist/lexical/ui/icons/Table/index.js.map +1 -1
- package/dist/lexical/ui/icons/Upload/index.js +1 -1
- package/dist/lexical/ui/icons/Upload/index.js.map +1 -1
- package/dist/populateGraphQL/defaultValue.d.ts.map +1 -1
- package/dist/populateGraphQL/defaultValue.js +1 -0
- package/dist/populateGraphQL/defaultValue.js.map +1 -1
- package/dist/utilities/generateComponentMap.d.ts.map +1 -1
- package/dist/utilities/generateComponentMap.js +3 -1
- package/dist/utilities/generateComponentMap.js.map +1 -1
- package/package.json +31 -31
- package/dist/exports/client/Field-YNHIDK3D.js +0 -2
- package/dist/exports/client/Field-YNHIDK3D.js.map +0 -7
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use client";import{a as It,c as ll,e as sl,f as al,g as cl,h as dl}from"./chunk-EBB2CEB6.js";import{a as Ne,b as Ft,c as ke,d as Ho,e as Bo}from"./chunk-VUVXZJJR.js";import{a as we,b as Ze,c as Xe,d as Je}from"./chunk-Q5DYR7MH.js";import{a as _e,b as Re,c as Se,d as Mt}from"./chunk-6QXGZYUK.js";import{a as le,b as Ye,c as ve,d as Ie,e as Fe,f as Pt}from"./chunk-IPCJ5EVK.js";import{a as il,b as G}from"./chunk-IWZVO3AI.js";function B(e){return{items:e,key:"basic",label:({i18n:t})=>t.t("lexical:general:slashMenuBasicGroupLabel")}}import{createHeadlessEditor as ul}from"@lexical/headless";import{useClientFunctions as pl,useTableCell as ml}from"@payloadcms/ui";import{$getRoot as fl}from"lexical";import At,{useEffect as Uo,useState as Dt}from"react";var $o={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",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",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellEditing:"LexicalEditorTheme__tableCellEditing",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellPrimarySelected:"LexicalEditorTheme__tableCellPrimarySelected",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableCellSortedIndicator:"LexicalEditorTheme__tableCellSortedIndicator",tableResizeRuler:"LexicalEditorTheme__tableCellResizeRuler",tableSelected:"LexicalEditorTheme__tableSelected",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 Me={namespace:"lexical",theme:$o};function qe({clientFunctions:e,schemaPath:t,unSanitizedEditorConfig:o}){for(let l of o.features)if(!l?.clientFeatureProps?.featureKey||l?.clientFeatureProps?.order===void 0||l?.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.");o.features=o.features.sort((l,s)=>l.clientFeatureProps.order-s.clientFeatureProps.order);let r=new Map(o.features.map(l=>[l.clientFeatureProps.featureKey,l])),n=new Map,i=0;for(let l of o.features){let s={};Object.entries(e).forEach(([c,d])=>{if(c.startsWith(`lexicalFeature.${t}.${l.clientFeatureProps.featureKey}.components.`)){let u=c.split(`${t}.${l.clientFeatureProps.featureKey}.components.`)[1];s[u]=d}});let a=typeof l.feature=="function"?l.feature({clientFunctions:s,featureProviderMap:r,resolvedFeatures:n,unSanitizedEditorConfig:o}):l.feature;n.set(l.clientFeatureProps.featureKey,{...a,key:l.clientFeatureProps.featureKey,order:i}),i++}return n}var Go=e=>{let t={enabledFeatures:[],hooks:{load:[],save:[]},markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}};if(!e?.size)return t;e.forEach(o=>{if(o.hooks&&(o.hooks?.load?.length&&(t.hooks.load=t.hooks.load.concat(o.hooks.load)),o.hooks?.save?.length&&(t.hooks.save=t.hooks.save.concat(o.hooks.save))),o.providers?.length&&(t.providers=t.providers.concat(o.providers)),o.nodes?.length&&(t.nodes=t.nodes.concat(o.nodes)),o.plugins?.length&&o.plugins.forEach((r,n)=>{t.plugins.push({Component:r.Component,clientProps:o.sanitizedClientFeatureProps,key:o.key+n,position:r.position})}),o.toolbarInline?.groups?.length)for(let r of o.toolbarInline.groups){let n=t.toolbarInline.groups.find(i=>i.key===r.key);n?t.toolbarInline.groups=t.toolbarInline.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),t.toolbarInline?.groups.push(n)}if(o.toolbarFixed?.groups?.length)for(let r of o.toolbarFixed.groups){let n=t.toolbarFixed.groups.find(i=>i.key===r.key);n?t.toolbarFixed.groups=t.toolbarFixed.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),t.toolbarFixed?.groups.push(n)}if(o.slashMenu?.groups){o.slashMenu.dynamicGroups?.length&&(t.slashMenu.dynamicGroups=t.slashMenu.dynamicGroups.concat(o.slashMenu.dynamicGroups));for(let r of o.slashMenu.groups){let n=t.slashMenu.groups.find(i=>i.key===r.key);n?t.slashMenu.groups=t.slashMenu.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),t.slashMenu.groups.push(n)}}o.markdownTransformers?.length&&(t.markdownTransformers=t.markdownTransformers.concat(o.markdownTransformers)),t.enabledFeatures.push(o.key)}),t.toolbarInline.groups.sort((o,r)=>o.order&&r.order?o.order-r.order:o.order?-1:r.order?1:0),t.toolbarFixed.groups.sort((o,r)=>o.order&&r.order?o.order-r.order:o.order?-1:r.order?1:0);for(let o of t.toolbarInline.groups)o.items.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);for(let o of t.toolbarFixed.groups)o.items.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);return t};function Pe(e,t,o){return{admin:o,features:Go(t),lexical:e,resolvedFeatureMap:t}}import{jsx as Wo,jsxs as Cl}from"react/jsx-runtime";var gl=e=>{let{admin:t,lexicalEditorConfig:o,richTextComponentMap:r}=e,[n,i]=At.useState("Loading..."),{cellData:l,cellProps:{schemaPath:s}}=ml(),a=pl(),[c,d]=Dt(!1),[u,m]=Dt([]),[f,C]=Dt(null),g=r.get("features").sort((b,S)=>b.order-S.order),x=0;for(let b of g){let S=Array.from(r.keys()).filter(I=>I.startsWith(`feature.${b.key}.components.`));x+=1,x+=S.length}return Uo(()=>{if(!c){let b=[],S=0;if(Object.entries(a).forEach(([I,T])=>{I.startsWith(`lexicalFeature.${s}.`)&&(I.includes(".lexical_internal_components.")||b.push(T),S++)}),S===x){m(b),d(!0);let I=qe({clientFunctions:a,schemaPath:s,unSanitizedEditorConfig:{features:b,lexical:o}});C(Pe(o||Me,I,t))}}},[t,g,c,a,s,g.length,u,f,o,r,x]),Uo(()=>{if(!c)return;let b=l;if(b==null||!c||!f){i("");return}if(f?.features?.hooks?.load?.length&&f.features.hooks.load.forEach(T=>{b=T({incomingEditorState:b})}),!b||typeof b!="object"){i("");return}if(Array.isArray(b)&&!("root"in b)){i("");return}if("jsonContent"in b){i("");return}let S=ul({namespace:f.lexical.namespace,nodes:It({editorConfig:f}),theme:f.lexical.theme});S.setEditorState(S.parseEditorState(b));let I=S.getEditorState().read(()=>fl().getTextContent())||"";i(I)},[l,o,c,f]),c?Wo("span",{children:n}):Wo(At.Fragment,{children:Array.isArray(g)&&g.map(b=>{let I=Array.from(r.keys()).filter(T=>T.startsWith(`lexical_internal_feature.${b.key}.lexical_internal_components.`)).map(T=>r.get(T));return Cl(At.Fragment,{children:[I?.length?I.map(T=>T):null,b.ClientFeature]},b.key)})})};import{$isElementNode as ne,$isRangeSelection as et,FORMAT_ELEMENT_COMMAND as tt}from"lexical";import{jsx as Ot,jsxs as hl}from"react/jsx-runtime";var zo=()=>hl("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:[Ot("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ot("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ot("path",{d:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Ht,jsxs as xl}from"react/jsx-runtime";var Vo=()=>xl("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:[Ht("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ht("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ht("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Bt,jsxs as bl}from"react/jsx-runtime";var Qe=()=>bl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Bt("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Bt("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Bt("path",{d:"M2.5 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as $t,jsxs as Tl}from"react/jsx-runtime";var Ko=()=>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:[$t("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),$t("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),$t("path",{d:"M7.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{useAddClientFunction as El,useFieldProps as yl,useTableCell as Ll}from"@payloadcms/ui";var jo=(e,t)=>{let{schemaPath:o}=yl(),i=Ll()?.cellProps?.schemaPath||o;El(`lexicalFeature.${i}.${e}`,t)};var Gt=e=>t=>(jo(t.featureKey,e(t)),null);var E=e=>Gt(o=>{let r={clientFeatureProps:o};return typeof e=="function"?r.feature=({clientFunctions:n,featureProviderMap:i,resolvedFeatures:l,unSanitizedEditorConfig:s})=>{let a=e({clientFunctions:n,featureProviderMap:i,props:o,resolvedFeatures:l,unSanitizedEditorConfig:s});return a.sanitizedClientFeatureProps===null&&(a.sanitizedClientFeatureProps=o),a}:(e.sanitizedClientFeatureProps=o,r.feature=e),r});var Zo=e=>({type:"dropdown",ChildComponent:Qe,items:e,key:"align",order:30});var Xo=[Zo([{ChildComponent:Qe,isActive:({selection:e})=>{if(!et(e))return!1;for(let t of e.getNodes()){if(ne(t)&&t.getFormatType()==="left")continue;let o=t.getParent();if(!(ne(o)&&o.getFormatType()==="left"))return!1}return!0},key:"alignLeft",label:({i18n:e})=>e.t("lexical:align:alignLeftLabel"),onSelect:({editor:e})=>{e.dispatchCommand(tt,"left")},order:1},{ChildComponent:zo,isActive:({selection:e})=>{if(!et(e))return!1;for(let t of e.getNodes()){if(ne(t)&&t.getFormatType()==="center")continue;let o=t.getParent();if(!(ne(o)&&o.getFormatType()==="center"))return!1}return!0},key:"alignCenter",label:({i18n:e})=>e.t("lexical:align:alignCenterLabel"),onSelect:({editor:e})=>{e.dispatchCommand(tt,"center")},order:2},{ChildComponent:Ko,isActive:({selection:e})=>{if(!et(e))return!1;for(let t of e.getNodes()){if(ne(t)&&t.getFormatType()==="right")continue;let o=t.getParent();if(!(ne(o)&&o.getFormatType()==="right"))return!1}return!0},key:"alignRight",label:({i18n:e})=>e.t("lexical:align:alignRightLabel"),onSelect:({editor:e})=>{e.dispatchCommand(tt,"right")},order:3},{ChildComponent:Vo,isActive:({selection:e})=>{if(!et(e))return!1;for(let t of e.getNodes()){if(ne(t)&&t.getFormatType()==="justify")continue;let o=t.getParent();if(!(ne(o)&&o.getFormatType()==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:e})=>e.t("lexical:align:alignJustifyLabel"),onSelect:({editor:e})=>{e.dispatchCommand(tt,"justify")},order:4}])],Nl=E({toolbarFixed:{groups:Xo},toolbarInline:{groups:Xo}});import{$createQuoteNode as or,$isQuoteNode as er,QuoteNode as Rl}from"@lexical/rich-text";import{$setBlocksType as rr}from"@lexical/selection";import{$getSelection as nr,$isRangeSelection as Sl}from"lexical";import{jsx as Jo}from"react/jsx-runtime";var Ut=()=>Jo("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:Jo("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 Yo}from"react/jsx-runtime";var Ae=()=>Yo("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:Yo("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 z=e=>({type:"dropdown",ChildComponent:Ae,items:e,key:"text",order:25});import{$createQuoteNode as kl,$isQuoteNode as qo,QuoteNode as wl}from"@lexical/rich-text";import{$createLineBreakNode as _l}from"lexical";var Qo={type:"element",dependencies:[wl],export:(e,t)=>{if(!qo(e))return null;let o=t(e).split(`
|
|
1
|
+
"use client";import{a as Ft,c as Cl,e as hl,f as bl,g as xl,h as Tl}from"./chunk-EBB2CEB6.js";import{a as Ne,b as Mt,c as ke,d as Bo,e as Go}from"./chunk-VUVXZJJR.js";import{a as we,b as Xe,c as Ze,d as Je}from"./chunk-Q5DYR7MH.js";import{a as Re,b as _e,c as Se,d as Pt}from"./chunk-6QXGZYUK.js";import{a as le,b as Ye,c as ve,d as Ie,e as Fe,f as At}from"./chunk-IPCJ5EVK.js";import{a as gl,b as $}from"./chunk-IWZVO3AI.js";function G(e){return{items:e,key:"basic",label:({i18n:t})=>t.t("lexical:general:slashMenuBasicGroupLabel")}}import{createHeadlessEditor as El}from"@lexical/headless";import{useClientFunctions as yl,useTableCell as Ll}from"@payloadcms/ui";import{$getRoot as Nl}from"lexical";import Dt,{useEffect as zo,useState as Ot}from"react";var Uo={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",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",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellEditing:"LexicalEditorTheme__tableCellEditing",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellPrimarySelected:"LexicalEditorTheme__tableCellPrimarySelected",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableCellSortedIndicator:"LexicalEditorTheme__tableCellSortedIndicator",tableResizeRuler:"LexicalEditorTheme__tableCellResizeRuler",tableSelected:"LexicalEditorTheme__tableSelected",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 Me={namespace:"lexical",theme:Uo};function qe({clientFunctions:e,schemaPath:t,unSanitizedEditorConfig:o}){for(let l of o.features)if(!l?.clientFeatureProps?.featureKey||l?.clientFeatureProps?.order===void 0||l?.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.");o.features=o.features.sort((l,a)=>l.clientFeatureProps.order-a.clientFeatureProps.order);let r=new Map(o.features.map(l=>[l.clientFeatureProps.featureKey,l])),n=new Map,i=0;for(let l of o.features){let a={};Object.entries(e).forEach(([c,d])=>{if(c.startsWith(`lexicalFeature.${t}.${l.clientFeatureProps.featureKey}.components.`)){let p=c.split(`${t}.${l.clientFeatureProps.featureKey}.components.`)[1];a[p]=d}});let s=typeof l.feature=="function"?l.feature({clientFunctions:a,featureProviderMap:r,resolvedFeatures:n,unSanitizedEditorConfig:o}):l.feature;n.set(l.clientFeatureProps.featureKey,{...s,key:l.clientFeatureProps.featureKey,order:i}),i++}return n}var Wo=e=>{let t={enabledFeatures:[],hooks:{load:[],save:[]},markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}};if(!e?.size)return t;e.forEach(o=>{if(o.hooks&&(o.hooks?.load?.length&&(t.hooks.load=t.hooks.load.concat(o.hooks.load)),o.hooks?.save?.length&&(t.hooks.save=t.hooks.save.concat(o.hooks.save))),o.providers?.length&&(t.providers=t.providers.concat(o.providers)),o.nodes?.length&&(t.nodes=t.nodes.concat(o.nodes)),o.plugins?.length&&o.plugins.forEach((r,n)=>{t.plugins.push({Component:r.Component,clientProps:o.sanitizedClientFeatureProps,key:o.key+n,position:r.position})}),o.toolbarInline?.groups?.length)for(let r of o.toolbarInline.groups){let n=t.toolbarInline.groups.find(i=>i.key===r.key);n?t.toolbarInline.groups=t.toolbarInline.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),t.toolbarInline?.groups.push(n)}if(o.toolbarFixed?.groups?.length)for(let r of o.toolbarFixed.groups){let n=t.toolbarFixed.groups.find(i=>i.key===r.key);n?t.toolbarFixed.groups=t.toolbarFixed.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),t.toolbarFixed?.groups.push(n)}if(o.slashMenu?.groups){o.slashMenu.dynamicGroups?.length&&(t.slashMenu.dynamicGroups=t.slashMenu.dynamicGroups.concat(o.slashMenu.dynamicGroups));for(let r of o.slashMenu.groups){let n=t.slashMenu.groups.find(i=>i.key===r.key);n?t.slashMenu.groups=t.slashMenu.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),t.slashMenu.groups.push(n)}}o.markdownTransformers?.length&&(t.markdownTransformers=t.markdownTransformers.concat(o.markdownTransformers)),t.enabledFeatures.push(o.key)}),t.toolbarInline.groups.sort((o,r)=>o.order&&r.order?o.order-r.order:o.order?-1:r.order?1:0),t.toolbarFixed.groups.sort((o,r)=>o.order&&r.order?o.order-r.order:o.order?-1:r.order?1:0);for(let o of t.toolbarInline.groups)o.items.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);for(let o of t.toolbarFixed.groups)o.items.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);return t};function Pe(e,t,o){return{admin:o,features:Wo(t),lexical:e,resolvedFeatureMap:t}}import{jsx as Vo,jsxs as wl}from"react/jsx-runtime";var kl=e=>{let{admin:t,lexicalEditorConfig:o,richTextComponentMap:r}=e,[n,i]=Dt.useState("Loading..."),{cellData:l,cellProps:{schemaPath:a}}=Ll(),s=yl(),[c,d]=Ot(!1),[p,u]=Ot([]),[m,g]=Ot(null),f=r.get("features").sort((h,I)=>h.order-I.order),x=0;for(let h of f){let I=Array.from(r.keys()).filter(P=>P.startsWith(`feature.${h.key}.components.`));x+=1,x+=I.length}return zo(()=>{if(!c){let h=[],I=0;if(Object.entries(s).forEach(([P,T])=>{P.startsWith(`lexicalFeature.${a}.`)&&(P.includes(".lexical_internal_components.")||h.push(T),I++)}),I===x){u(h),d(!0);let P=qe({clientFunctions:s,schemaPath:a,unSanitizedEditorConfig:{features:h,lexical:o}});g(Pe(o||Me,P,t))}}},[t,f,c,s,a,f.length,p,m,o,r,x]),zo(()=>{if(!c)return;let h=l;if(h==null||!c||!m){i("");return}if(m?.features?.hooks?.load?.length&&m.features.hooks.load.forEach(T=>{h=T({incomingEditorState:h})}),!h||typeof h!="object"){i("");return}if(Array.isArray(h)&&!("root"in h)){i("");return}if("jsonContent"in h){i("");return}let I=El({namespace:m.lexical.namespace,nodes:Ft({editorConfig:m}),theme:m.lexical.theme});I.setEditorState(I.parseEditorState(h));let P=I.getEditorState().read(()=>Nl().getTextContent())||"";i(P)},[l,o,c,m]),c?Vo("span",{children:n}):Vo(Dt.Fragment,{children:Array.isArray(f)&&f.map(h=>{let P=Array.from(r.keys()).filter(T=>T.startsWith(`lexical_internal_feature.${h.key}.lexical_internal_components.`)).map(T=>r.get(T));return wl(Dt.Fragment,{children:[P?.length?P.map(T=>T):null,h.ClientFeature]},h.key)})})};import{$isElementNode as ne,$isRangeSelection as et,FORMAT_ELEMENT_COMMAND as tt}from"lexical";import{jsx as Ht,jsxs as Rl}from"react/jsx-runtime";var Ko=()=>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:[Ht("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ht("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ht("path",{d:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as $t,jsxs as _l}from"react/jsx-runtime";var jo=()=>_l("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[$t("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),$t("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),$t("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Bt,jsxs as Sl}from"react/jsx-runtime";var Qe=()=>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:[Bt("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Bt("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Bt("path",{d:"M2.5 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Gt,jsxs as vl}from"react/jsx-runtime";var Xo=()=>vl("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:[Gt("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Gt("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Gt("path",{d:"M7.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{useAddClientFunction as Il,useFieldProps as Fl,useTableCell as Ml}from"@payloadcms/ui";var Zo=(e,t)=>{let{schemaPath:o}=Fl(),i=Ml()?.cellProps?.schemaPath||o;Il(`lexicalFeature.${i}.${e}`,t)};var Ut=e=>t=>(Zo(t.featureKey,e(t)),null);var L=e=>Ut(o=>{let r={clientFeatureProps:o};return typeof e=="function"?r.feature=({clientFunctions:n,featureProviderMap:i,resolvedFeatures:l,unSanitizedEditorConfig:a})=>{let s=e({clientFunctions:n,featureProviderMap:i,props:o,resolvedFeatures:l,unSanitizedEditorConfig:a});return s.sanitizedClientFeatureProps===null&&(s.sanitizedClientFeatureProps=o),s}:(e.sanitizedClientFeatureProps=o,r.feature=e),r});var Jo=e=>({type:"dropdown",ChildComponent:Qe,items:e,key:"align",order:30});var Yo=[Jo([{ChildComponent:Qe,isActive:({selection:e})=>{if(!et(e))return!1;for(let t of e.getNodes()){if(ne(t)&&t.getFormatType()==="left")continue;let o=t.getParent();if(!(ne(o)&&o.getFormatType()==="left"))return!1}return!0},key:"alignLeft",label:({i18n:e})=>e.t("lexical:align:alignLeftLabel"),onSelect:({editor:e})=>{e.dispatchCommand(tt,"left")},order:1},{ChildComponent:Ko,isActive:({selection:e})=>{if(!et(e))return!1;for(let t of e.getNodes()){if(ne(t)&&t.getFormatType()==="center")continue;let o=t.getParent();if(!(ne(o)&&o.getFormatType()==="center"))return!1}return!0},key:"alignCenter",label:({i18n:e})=>e.t("lexical:align:alignCenterLabel"),onSelect:({editor:e})=>{e.dispatchCommand(tt,"center")},order:2},{ChildComponent:Xo,isActive:({selection:e})=>{if(!et(e))return!1;for(let t of e.getNodes()){if(ne(t)&&t.getFormatType()==="right")continue;let o=t.getParent();if(!(ne(o)&&o.getFormatType()==="right"))return!1}return!0},key:"alignRight",label:({i18n:e})=>e.t("lexical:align:alignRightLabel"),onSelect:({editor:e})=>{e.dispatchCommand(tt,"right")},order:3},{ChildComponent:jo,isActive:({selection:e})=>{if(!et(e))return!1;for(let t of e.getNodes()){if(ne(t)&&t.getFormatType()==="justify")continue;let o=t.getParent();if(!(ne(o)&&o.getFormatType()==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:e})=>e.t("lexical:align:alignJustifyLabel"),onSelect:({editor:e})=>{e.dispatchCommand(tt,"justify")},order:4}])],Pl=L({toolbarFixed:{groups:Yo},toolbarInline:{groups:Yo}});import{$createQuoteNode as nr,$isQuoteNode as or,QuoteNode as Hl}from"@lexical/rich-text";import{$setBlocksType as ir}from"@lexical/selection";import{$getSelection as lr,$isRangeSelection as $l}from"lexical";import{jsx as qo}from"react/jsx-runtime";var Wt=()=>qo("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:qo("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 Qo}from"react/jsx-runtime";var Ae=()=>Qo("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:Qo("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 z=e=>({type:"dropdown",ChildComponent:Ae,items:e,key:"text",order:25});import{$createQuoteNode as Al,$isQuoteNode as er,QuoteNode as Dl}from"@lexical/rich-text";import{$createLineBreakNode as Ol}from"lexical";var tr={type:"element",dependencies:[Dl],export:(e,t)=>{if(!er(e))return null;let o=t(e).split(`
|
|
2
2
|
`),r=[];for(let n of o)r.push("> "+n);return r.join(`
|
|
3
|
-
`)},regExp:/^>\s/,replace:(e,t,o,r)=>{if(r){let i=e.getPreviousSibling();if(qo(i)){i.splice(i.getChildrenSize(),0,[_l(),...t]),i.select(0,0),e.remove();return}}let n=kl();n.append(...t),e.replace(n),n.select(0,0)}};var tr=[z([{ChildComponent:Ut,isActive:({selection:e})=>{if(!Sl(e))return!1;for(let t of e.getNodes())if(!er(t)&&!er(t.getParent()))return!1;return!0},key:"blockquote",label:({i18n:e})=>e.t("lexical:blockquote:label"),onSelect:({editor:e})=>{e.update(()=>{let t=nr();rr(t,()=>or())})},order:20}])],vl=E({markdownTransformers:[Qo],nodes:[Rl],slashMenu:{groups:[B([{Icon:Ut,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:e})=>e.t("lexical:blockquote:label"),onSelect:({editor:e})=>{e.update(()=>{let t=nr();rr(t,()=>or())})}}])]},toolbarFixed:{groups:tr},toolbarInline:{groups:tr}});import{getTranslation as lt}from"@payloadcms/translations";import{jsx as Wt,jsxs as Il}from"react/jsx-runtime";var ot=()=>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:[Wt("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),Wt("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),Wt("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as ir}from"react/jsx-runtime";var rt=()=>ir("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",{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{DecoratorBlockNode as Fl}from"@lexical/react/LexicalDecoratorBlockNode.js";import Ml from"bson-objectid";import{deepCopyObjectSimple as Pl}from"payload/shared";import Al from"react";import{jsx as Hl}from"react/jsx-runtime";var Dl=Al.lazy(()=>import("./component-KA7FDRMA.js").then(e=>({default:e.BlockComponent}))),J=class e extends Fl{__fields;constructor({fields:t,format:o,key:r}){super(o,r),this.__fields=t}static clone(t){return new e({fields:t.__fields,format:t.__format,key:t.__key})}static getType(){return"block"}static importDOM(){return{}}static importJSON(t){t.version===1&&(t={...t,fields:{...t.fields.data},version:2});let o=nt(t.fields);return o.setFormat(t.format),o}static isInline(){return!1}decorate(t,o){return Hl(Dl,{formData:this.getFields(),nodeKey:this.getKey()})}exportDOM(){let t=document.createElement("div"),o=document.createTextNode(this.getTextContent());return t.append(o),{element:t}}exportJSON(){return{...super.exportJSON(),type:"block",fields:this.getFields(),version:2}}getFields(){return this.getLatest().__fields}getTextContent(){return"Block Field"}setFields(t){let o=Pl(t),r=this.getWritable();r.__fields=o}};function nt(e){return new J({fields:{...e,id:e?.id||new Ml.default().toHexString()}})}function Ol(e){return e instanceof J}import{useLexicalComposerContext as Bl}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as $l,$wrapNodeInElement as Gl,mergeRegister as Ul}from"@lexical/utils";import{getTranslation as Wl}from"@payloadcms/translations";import{useModal as zl,useTranslation as Vl}from"@payloadcms/ui";import{$createParagraphNode as Kl,$getNodeByKey as jl,$getPreviousSelection as Zl,$getSelection as lr,$insertNodes as Xl,$isParagraphNode as sr,$isRangeSelection as ar,$isRootOrShadowRoot as Jl,COMMAND_PRIORITY_EDITOR as zt}from"lexical";import{useEffect as Yl,useState as Vt}from"react";import{jsx as ql}from"react/jsx-runtime";var it="lexical-inlineBlocks-create",cr=()=>{let[e]=Bl(),{closeModal:t,toggleModal:o}=zl(),[r,n]=Vt(null),[i,l]=Vt(""),[s,a]=Vt(null),{i18n:c,t:d}=Vl(),{editorConfig:u}=G(),m=u?.resolvedFeatureMap?.get("blocks")?.sanitizedClientFeatureProps?.reducedInlineBlocks?.find(C=>C.slug===r?.blockType);Yl(()=>{if(!e.hasNodes([J]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return Ul(e.registerCommand(Ne,C=>(e.update(()=>{let g=lr()||Zl();if(ar(g)){let x=nt(C);$l(x);let{focus:b}=g,S=b.getNode();sr(S)&&S.getTextContentSize()===0&&S.getParent().getChildren().filter(I=>sr(I)).length>1&&S.remove()}}),!0),zt),e.registerCommand(Ft,C=>{if(s){let x=jl(s);return x?(x.setFields(C),a(null),!0):!1}let g=Bo(C);return Xl([g]),Jl(g.getParentOrThrow())&&Gl(g,Kl).selectEnd(),!0},zt),e.registerCommand(ke,({fields:C,nodeKey:g})=>{if(n(C??null),a(g??null),l(C?.blockType??""),g)return o(it),!0;let x=null;return e.getEditorState().read(()=>{let b=lr();ar(b)&&(x=b)}),x&&o(it),!0},zt))},[e,s,o]);let f=m?.labels?.singular?Wl(m?.labels?.singular,c):m?.slug;return ql(le,{data:r,drawerSlug:it,drawerTitle:d(`lexical:blocks:inlineBlocks:${r?.id?"edit":"create"}`,{label:f??d("lexical:blocks:inlineBlocks:label")}),featureKey:"blocks",handleDrawerSubmit:(C,g)=>{t(it),g&&(g.blockType=i,e.dispatchCommand(Ft,g))},schemaPathSuffix:r?.blockType})};var Ql=E(({props:e})=>({nodes:[J,Ho],plugins:[{Component:cr,position:"normal"}],sanitizedClientFeatureProps:e,slashMenu:{groups:[e.reducedBlocks?.length?{items:e.reducedBlocks.map(t=>({Icon:ot,key:"block-"+t.slug,keywords:["block","blocks",t.slug],label:({i18n:o})=>t.labels.singular?lt(t.labels.singular,o):t.slug,onSelect:({editor:o})=>{o.dispatchCommand(Ne,{id:null,blockName:"",blockType:t.slug})}})),key:"blocks",label:({i18n:t})=>t.t("lexical:blocks:label")}:null,e.reducedInlineBlocks?.length?{items:e.reducedInlineBlocks.map(t=>({Icon:rt,key:"inlineBlocks-"+t.slug,keywords:["inlineBlock","inline block",t.slug],label:({i18n:o})=>t.labels.singular?lt(t.labels.singular,o):t.slug,onSelect:({editor:o})=>{o.dispatchCommand(ke,{fields:{id:null,blockName:"",blockType:t.slug}})}})),key:"inlineBlocks",label:({i18n:t})=>t.t("lexical:blocks:inlineBlocks:label")}:null].filter(Boolean)},toolbarFixed:{groups:[e.reducedBlocks?.length?{type:"dropdown",ChildComponent:ot,items:e.reducedBlocks.map((t,o)=>({ChildComponent:ot,isActive:void 0,key:"block-"+t.slug,label:({i18n:r})=>t.labels.singular?lt(t.labels.singular,r):t.slug,onSelect:({editor:r})=>{r.dispatchCommand(Ne,{id:null,blockName:"",blockType:t.slug})},order:o})),key:"blocks",order:20}:null,e.reducedInlineBlocks?.length?{type:"dropdown",ChildComponent:rt,items:e.reducedInlineBlocks.map((t,o)=>({ChildComponent:rt,isActive:void 0,key:"inlineBlock-"+t.slug,label:({i18n:r})=>t.labels.singular?lt(t.labels.singular,r):t.slug,onSelect:({editor:r})=>{r.dispatchCommand(ke,{fields:{blockType:t.slug}})},order:o})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}));import{useLexicalComposerContext as os}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as rs,$createTextNode as ns,$getRoot as is}from"lexical";import*as fr from"react";import{useCallback as se,useEffect as Kt,useLayoutEffect as ur,useRef as jt,useState as st}from"react";var K=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";var es=K&&"documentMode"in document?document.documentMode:null,dr=K&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Zf=K&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Xf=K&&"InputEvent"in window&&!es?"getTargetRanges"in new window.InputEvent("input"):!1,Jf=K&&/Version\/[\d.].*Safari/.test(navigator.userAgent),Yf=K&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,qf=K&&/Android/.test(navigator.userAgent),Qf=K&&/Win/.test(navigator.platform),ts=K&&/^(?=.*Chrome).*/i.test(navigator.userAgent),e1=K&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!ts;import{jsx as ae,jsxs as Zt}from"react/jsx-runtime";var ls=e=>{let t=document.createElement("textarea");t.value=e||"",t.style.position="absolute",t.style.opacity="0",document.body?.appendChild(t),t.focus(),t.select();try{let o=document.execCommand("copy");console.log(o)}catch(o){console.error(o)}document.body?.removeChild(t)},ss=(e,t)=>{let o=document.createElement("a");o.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(t||"")),o.setAttribute("download",e),o.style.display="none",document.body?.appendChild(o),o.click(),document.body?.removeChild(o)},as=e=>{let o=((r,n)=>{switch(r){case"click":return` await page.mouse.click(${n.x}, ${n.y});`;case"press":return` await page.keyboard.press('${n}');`;case"keydown":return` await page.keyboard.keydown('${n}');`;case"keyup":return` await page.keyboard.keyup('${n}');`;case"type":return` await page.keyboard.type('${n}');`;case"selectAll":return" await selectAll(page);";case"snapshot":return` await assertHTMLSnapshot(page);
|
|
3
|
+
`)},regExp:/^>\s/,replace:(e,t,o,r)=>{if(r){let i=e.getPreviousSibling();if(er(i)){i.splice(i.getChildrenSize(),0,[Ol(),...t]),i.select(0,0),e.remove();return}}let n=Al();n.append(...t),e.replace(n),n.select(0,0)}};var rr=[z([{ChildComponent:Wt,isActive:({selection:e})=>{if(!$l(e))return!1;for(let t of e.getNodes())if(!or(t)&&!or(t.getParent()))return!1;return!0},key:"blockquote",label:({i18n:e})=>e.t("lexical:blockquote:label"),onSelect:({editor:e})=>{e.update(()=>{let t=lr();ir(t,()=>nr())})},order:20}])],Bl=L({markdownTransformers:[tr],nodes:[Hl],slashMenu:{groups:[G([{Icon:Wt,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:e})=>e.t("lexical:blockquote:label"),onSelect:({editor:e})=>{e.update(()=>{let t=lr();ir(t,()=>nr())})}}])]},toolbarFixed:{groups:rr},toolbarInline:{groups:rr}});import{getTranslation as lt}from"@payloadcms/translations";import{jsx as zt,jsxs as Gl}from"react/jsx-runtime";var ot=()=>Gl("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("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),zt("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),zt("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as sr}from"react/jsx-runtime";var rt=()=>sr("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:sr("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{DecoratorBlockNode as Ul}from"@lexical/react/LexicalDecoratorBlockNode.js";import Wl from"bson-objectid";import{deepCopyObjectSimple as zl}from"payload/shared";import Vl from"react";import{jsx as Xl}from"react/jsx-runtime";var Kl=Vl.lazy(()=>import("./component-KA7FDRMA.js").then(e=>({default:e.BlockComponent}))),J=class e extends Ul{__fields;constructor({fields:t,format:o,key:r}){super(o,r),this.__fields=t}static clone(t){return new e({fields:t.__fields,format:t.__format,key:t.__key})}static getType(){return"block"}static importDOM(){return{}}static importJSON(t){t.version===1&&(t={...t,fields:{...t.fields.data},version:2});let o=nt(t.fields);return o.setFormat(t.format),o}static isInline(){return!1}decorate(t,o){return Xl(Kl,{formData:this.getFields(),nodeKey:this.getKey()})}exportDOM(){let t=document.createElement("div"),o=document.createTextNode(this.getTextContent());return t.append(o),{element:t}}exportJSON(){return{...super.exportJSON(),type:"block",fields:this.getFields(),version:2}}getFields(){return this.getLatest().__fields}getTextContent(){return"Block Field"}setFields(t){let o=zl(t),r=this.getWritable();r.__fields=o}};function nt(e){return new J({fields:{...e,id:e?.id||new Wl.default().toHexString()}})}function jl(e){return e instanceof J}import{useLexicalComposerContext as Zl}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Jl,$wrapNodeInElement as Yl,mergeRegister as ql}from"@lexical/utils";import{getTranslation as Ql}from"@payloadcms/translations";import{useModal as es,useTranslation as ts}from"@payloadcms/ui";import{$createParagraphNode as os,$getNodeByKey as rs,$getPreviousSelection as ns,$getSelection as ar,$insertNodes as is,$isParagraphNode as cr,$isRangeSelection as dr,$isRootOrShadowRoot as ls,COMMAND_PRIORITY_EDITOR as Vt}from"lexical";import{useEffect as ss,useState as Kt}from"react";import{jsx as as}from"react/jsx-runtime";var it="lexical-inlineBlocks-create",ur=()=>{let[e]=Zl(),{closeModal:t,toggleModal:o}=es(),[r,n]=Kt(null),[i,l]=Kt(""),[a,s]=Kt(null),{i18n:c,t:d}=ts(),{editorConfig:p}=$(),u=p?.resolvedFeatureMap?.get("blocks")?.sanitizedClientFeatureProps?.reducedInlineBlocks?.find(g=>g.slug===r?.blockType);ss(()=>{if(!e.hasNodes([J]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return ql(e.registerCommand(Ne,g=>(e.update(()=>{let f=ar()||ns();if(dr(f)){let x=nt(g);Jl(x);let{focus:h}=f,I=h.getNode();cr(I)&&I.getTextContentSize()===0&&I.getParent().getChildren().filter(P=>cr(P)).length>1&&I.remove()}}),!0),Vt),e.registerCommand(Mt,g=>{if(a){let x=rs(a);return x?(x.setFields(g),s(null),!0):!1}let f=Go(g);return is([f]),ls(f.getParentOrThrow())&&Yl(f,os).selectEnd(),!0},Vt),e.registerCommand(ke,({fields:g,nodeKey:f})=>{if(n(g??null),s(f??null),l(g?.blockType??""),f)return o(it),!0;let x=null;return e.getEditorState().read(()=>{let h=ar();dr(h)&&(x=h)}),x&&o(it),!0},Vt))},[e,a,o]);let m=u?.labels?.singular?Ql(u?.labels?.singular,c):u?.slug;return as(le,{data:r,drawerSlug:it,drawerTitle:d(`lexical:blocks:inlineBlocks:${r?.id?"edit":"create"}`,{label:m??d("lexical:blocks:inlineBlocks:label")}),featureKey:"blocks",handleDrawerSubmit:(g,f)=>{t(it),f&&(f.blockType=i,e.dispatchCommand(Mt,f))},schemaPathSuffix:r?.blockType})};var cs=L(({props:e})=>({nodes:[J,Bo],plugins:[{Component:ur,position:"normal"}],sanitizedClientFeatureProps:e,slashMenu:{groups:[e.reducedBlocks?.length?{items:e.reducedBlocks.map(t=>({Icon:ot,key:"block-"+t.slug,keywords:["block","blocks",t.slug],label:({i18n:o})=>t.labels.singular?lt(t.labels.singular,o):t.slug,onSelect:({editor:o})=>{o.dispatchCommand(Ne,{id:null,blockName:"",blockType:t.slug})}})),key:"blocks",label:({i18n:t})=>t.t("lexical:blocks:label")}:null,e.reducedInlineBlocks?.length?{items:e.reducedInlineBlocks.map(t=>({Icon:rt,key:"inlineBlocks-"+t.slug,keywords:["inlineBlock","inline block",t.slug],label:({i18n:o})=>t.labels.singular?lt(t.labels.singular,o):t.slug,onSelect:({editor:o})=>{o.dispatchCommand(ke,{fields:{id:null,blockName:"",blockType:t.slug}})}})),key:"inlineBlocks",label:({i18n:t})=>t.t("lexical:blocks:inlineBlocks:label")}:null].filter(Boolean)},toolbarFixed:{groups:[e.reducedBlocks?.length?{type:"dropdown",ChildComponent:ot,items:e.reducedBlocks.map((t,o)=>({ChildComponent:ot,isActive:void 0,key:"block-"+t.slug,label:({i18n:r})=>t.labels.singular?lt(t.labels.singular,r):t.slug,onSelect:({editor:r})=>{r.dispatchCommand(Ne,{id:null,blockName:"",blockType:t.slug})},order:o})),key:"blocks",order:20}:null,e.reducedInlineBlocks?.length?{type:"dropdown",ChildComponent:rt,items:e.reducedInlineBlocks.map((t,o)=>({ChildComponent:rt,isActive:void 0,key:"inlineBlock-"+t.slug,label:({i18n:r})=>t.labels.singular?lt(t.labels.singular,r):t.slug,onSelect:({editor:r})=>{r.dispatchCommand(ke,{fields:{blockType:t.slug}})},order:o})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}));import{useLexicalComposerContext as ps}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as ms,$createTextNode as fs,$getRoot as gs}from"lexical";import*as Cr from"react";import{useCallback as se,useEffect as jt,useLayoutEffect as mr,useRef as Xt,useState as st}from"react";var K=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";var ds=K&&"documentMode"in document?document.documentMode:null,pr=K&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Ng=K&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),kg=K&&"InputEvent"in window&&!ds?"getTargetRanges"in new window.InputEvent("input"):!1,wg=K&&/Version\/[\d.].*Safari/.test(navigator.userAgent),Rg=K&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,_g=K&&/Android/.test(navigator.userAgent),Sg=K&&/Win/.test(navigator.platform),us=K&&/^(?=.*Chrome).*/i.test(navigator.userAgent),vg=K&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!us;import{jsx as ae,jsxs as Zt}from"react/jsx-runtime";var Cs=e=>{let t=document.createElement("textarea");t.value=e||"",t.style.position="absolute",t.style.opacity="0",document.body?.appendChild(t),t.focus(),t.select();try{let o=document.execCommand("copy");console.log(o)}catch(o){console.error(o)}document.body?.removeChild(t)},hs=(e,t)=>{let o=document.createElement("a");o.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(t||"")),o.setAttribute("download",e),o.style.display="none",document.body?.appendChild(o),o.click(),document.body?.removeChild(o)},bs=e=>{let o=((r,n)=>{switch(r){case"click":return` await page.mouse.click(${n.x}, ${n.y});`;case"press":return` await page.keyboard.press('${n}');`;case"keydown":return` await page.keyboard.keydown('${n}');`;case"keyup":return` await page.keyboard.keyup('${n}');`;case"type":return` await page.keyboard.type('${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
|
`;default:return""}})(e.name,e.value);switch(e.count){case 1:return o;case 2:return[o,o].join(`
|
|
11
11
|
`);default:return` await repeat(${e.count}, async () => {
|
|
12
12
|
${o}
|
|
13
|
-
);`}};function
|
|
13
|
+
);`}};function xs(e){return e.key.toLowerCase()==="a"&&(pr?e.metaKey:e.ctrlKey)}function Ts(e){let{anchorNode:t,focusNode:o}=e,{anchorOffset:r,focusOffset:n}=e;return r!==0&&r--,n!==0&&n--,{anchorNode:t,anchorOffset:r,focusNode:o,focusOffset:n}}function fr(e,t){let o=e,r=[];for(;o!==t;)o!=null&&r.unshift(Array.from(o?.parentNode?.childNodes??[]).indexOf(o)),o=o?.parentNode;return r}var gr=new Set(["Enter","Backspace","Delete","Escape","ArrowLeft","ArrowRight","ArrowUp","ArrowDown"]);function Es(e){let[t,o]=st([]),[r,n]=st(!1),[,i]=st(""),[l,a]=st(""),s=Xt(null),c=Xt(!1),d=Xt(null),p=se(()=>e,[e]),u=se(()=>{let T=e.getRootElement(),k=window.getSelection();return T==null||k==null||k.anchorNode==null||k.focusNode==null||!T.contains(k.anchorNode)||!T.contains(k.focusNode)?null:`
|
|
14
14
|
import {
|
|
15
15
|
initializeE2E,
|
|
16
16
|
assertHTMLSnapshot,
|
|
@@ -27,12 +27,12 @@ describe('Test case', () => {
|
|
|
27
27
|
const {page} = e2e;
|
|
28
28
|
|
|
29
29
|
await page.focus('div[contenteditable="true"]');
|
|
30
|
-
${t.map(
|
|
30
|
+
${t.map(bs).join(`
|
|
31
31
|
`)}
|
|
32
32
|
});
|
|
33
33
|
});
|
|
34
|
-
`},[e,t]),f=se((T,R)=>{o(v=>{let M=t.length-1,P=t[M];if(P&&P.name===T){if(T==="type")return[...t.slice(0,M),{...P,value:P.value+R}];if(P.value===R)return[...t.slice(0,M),{...P,count:P.count+1}]}return[...v,{name:T,count:1,value:R}]})},[t,o]);ur(()=>{let T=v=>{if(!r)return;let M=v.key;cs(v)?f("selectAll",""):mr.has(M)?f("press",v.key):[...M].length>1?f("keydown",v.key):f("type",v.key)},R=v=>{if(!r)return;let M=v.key;!mr.has(M)&&[...M].length>1&&f("keyup",v.key)};return e.registerRootListener((v,M)=>{M!==null&&(M.removeEventListener("keydown",T),M.removeEventListener("keyup",R)),v!==null&&(v.addEventListener("keydown",T),v.addEventListener("keyup",R))})},[e,r,f]),ur(()=>{d.current&&d.current.scrollTo(0,d.current.scrollHeight)},[m]),Kt(()=>{if(t){let T=m();T!==null&&s(T),d.current&&d.current.scrollTo(0,d.current.scrollHeight)}},[m,t]),Kt(()=>e.registerUpdateListener(({dirtyElements:R,dirtyLeaves:v,editorState:M})=>{if(!r)return;let P=M._selection,L=a.current,N=c.current;if(L!==P){if(v.size===0&&R.size===0&&!N){let p=window.getSelection();if(p&&(p.anchorNode==null||p.focusNode==null))return}a.current=P}c.current=!1;let h=m();h!==null&&s(h)}),[e,m,r,f]),Kt(()=>r?e.registerUpdateListener(()=>{let R=e.getRootElement();R!==null&&i(R?.innerHTML)}):void 0,[e,r]);let C=se(T=>{r||(T.update(()=>{let R=is();R.clear();let v=ns();R.append(rs().append(v)),v.select()}),o([])),n(R=>!R)},[r]),g=se(()=>{if(!r)return;let T=window.getSelection();if(T===null||T.anchorNode==null||T.focusNode==null)return;let{anchorNode:R,anchorOffset:v,focusNode:M,focusOffset:P}=ds(T),L=u().getRootElement(),N;R!==null&&(N=pr(R,L));let h;M!==null&&(h=pr(M,L)),f("snapshot",{anchorNode:R,anchorOffset:v,anchorPath:N,focusNode:M,focusOffset:P,focusPath:h})},[f,r,u]),x=se(()=>{ls(m())},[m]),b=se(()=>{ss("test.js",m())},[m]);return[ae("button",{className:`editor-dev-button ${r?"active":""}`,id:"test-recorder-button",onClick:T=>{C(u()),T.preventDefault()},title:r?"Disable test recorder":"Enable test recorder",type:"button",children:r?"Disable test recorder":"Enable test recorder"}),r?Zt("div",{className:"test-recorder-output",children:[Zt("div",{className:"test-recorder-toolbar",children:[ae("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:T=>{g(),T.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),ae("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:T=>{x(),T.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),ae("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:T=>{b(),T.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),ae("pre",{id:"test-recorder",ref:d,children:l})]}):null]}var gr=()=>{let[e]=os(),[t,o]=us(e);return Zt(fr.Fragment,{children:[ae("p",{children:"HI"}),t,o,ae("p",{children:"DONE"})]})};var ps=E({plugins:[{Component:gr,position:"bottom"}]});import{useLexicalComposerContext as ms}from"@lexical/react/LexicalComposerContext.js";import{TreeView as fs}from"@lexical/react/LexicalTreeView.js";import{jsx as gs}from"react/jsx-runtime";var Cr=()=>{let[e]=ms();return gs(fs,{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"})};var Cs=E({plugins:[{Component:Cr,position:"bottom"}]});import{$isRangeSelection as hs,FORMAT_TEXT_COMMAND as xs}from"lexical";import{jsx as hr}from"react/jsx-runtime";var xr=()=>hr("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:hr("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 $=e=>({type:"buttons",items:e,key:"format",order:40});var br={type:"text-format",format:["bold","italic"],tag:"***"},Tr={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},Er={type:"text-format",format:["bold"],tag:"**"},yr={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var Lr=[$([{ChildComponent:xr,isActive:({selection:e})=>hs(e)?e.hasFormat("bold"):!1,key:"bold",onSelect:({editor:e})=>{e.dispatchCommand(xs,"bold")},order:1}])],bs=E(({featureProviderMap:e})=>{let t=[Er,yr];return e.get("italic")&&t.push(Tr,br),{markdownTransformers:t,toolbarFixed:{groups:Lr},toolbarInline:{groups:Lr}}});import{$isRangeSelection as Es,FORMAT_TEXT_COMMAND as ys}from"lexical";import{jsx as Nr,jsxs as Ts}from"react/jsx-runtime";var kr=()=>Ts("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:[Nr("path",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),Nr("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var wr={type:"text-format",format:["code"],tag:"`"};var _r=[$([{ChildComponent:kr,isActive:({selection:e})=>Es(e)?e.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:e})=>{e.dispatchCommand(ys,"code")},order:7}])],Ls=E({markdownTransformers:[wr],toolbarFixed:{groups:_r},toolbarInline:{groups:_r}});import{$isRangeSelection as Ns,FORMAT_TEXT_COMMAND as ks}from"lexical";import{jsx as Rr}from"react/jsx-runtime";var Sr=()=>Rr("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:Rr("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 vr={type:"text-format",format:["italic"],tag:"*"},Ir={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var Fr=[$([{ChildComponent:Sr,isActive:({selection:e})=>Ns(e)?e.hasFormat("italic"):!1,key:"italic",onSelect:({editor:e})=>{e.dispatchCommand(ks,"italic")},order:2}])],ws=E({markdownTransformers:[vr,Ir],toolbarFixed:{groups:Fr},toolbarInline:{groups:Fr}});import{$isRangeSelection as Rs,FORMAT_TEXT_COMMAND as Ss}from"lexical";import{jsx as Mr,jsxs as _s}from"react/jsx-runtime";var Pr=()=>_s("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:[Mr("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"}),Mr("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var Ar={type:"text-format",format:["strikethrough"],tag:"~~"};var Dr=[$([{ChildComponent:Pr,isActive:({selection:e})=>Rs(e)?e.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:e})=>{e.dispatchCommand(Ss,"strikethrough")},order:4}])],vs=E({markdownTransformers:[Ar],toolbarFixed:{groups:Dr},toolbarInline:{groups:Dr}});import{$isRangeSelection as Is,FORMAT_TEXT_COMMAND as Fs}from"lexical";import{jsx as Or}from"react/jsx-runtime";var Hr=()=>Or("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:Or("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 Br=[$([{ChildComponent:Hr,isActive:({selection:e})=>Is(e)?e.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:e})=>{e.dispatchCommand(Fs,"subscript")},order:5}])],Ms=E({toolbarFixed:{groups:Br},toolbarInline:{groups:Br}});import{$isRangeSelection as Ps,FORMAT_TEXT_COMMAND as As}from"lexical";import{jsx as $r}from"react/jsx-runtime";var Gr=()=>$r("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:$r("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 Ur=[$([{ChildComponent:Gr,isActive:({selection:e})=>Ps(e)?e.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:e})=>{e.dispatchCommand(As,"superscript")},order:6}])],Ds=E({toolbarFixed:{groups:Ur},toolbarInline:{groups:Ur}});import{$isRangeSelection as Hs,FORMAT_TEXT_COMMAND as Bs}from"lexical";import{jsx as Wr,jsxs as Os}from"react/jsx-runtime";var zr=()=>Os("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:[Wr("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"}),Wr("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var Vr=[$([{ChildComponent:zr,isActive:({selection:e})=>Hs(e)?e.hasFormat("underline"):!1,key:"underline",onSelect:({editor:e})=>{e.dispatchCommand(Bs,"underline")},order:3}])],$s=E({toolbarFixed:{groups:Vr},toolbarInline:{groups:Vr}});import{$createHeadingNode as zs,$isHeadingNode as ln,HeadingNode as Vs}from"@lexical/rich-text";import{$setBlocksType as Ks}from"@lexical/selection";import{$getSelection as js,$isRangeSelection as Zs}from"lexical";import{jsx as Kr}from"react/jsx-runtime";var jr=()=>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:"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 Zr}from"react/jsx-runtime";var Xr=()=>Zr("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Zr("path",{d:"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 Jr}from"react/jsx-runtime";var Yr=()=>Jr("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:Jr("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 qr}from"react/jsx-runtime";var Qr=()=>qr("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:qr("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 en}from"react/jsx-runtime";var tn=()=>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",{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 on}from"react/jsx-runtime";var rn=()=>on("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:on("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 Gs,$isHeadingNode as Us,HeadingNode as Ws}from"@lexical/rich-text";var Xt=e=>(t,o,r)=>{let n=e(r);n&&(n.append(...o),t.replace(n),n.select(0,0))};var nn=e=>{let o=`^(${e.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`,r=new RegExp(o);return{type:"element",dependencies:[Ws],export:(n,i)=>{if(!Us(n))return null;let l=Number(n.getTag().slice(1));return"#".repeat(l)+" "+i(n)},regExp:r,replace:Xt(n=>{let i="h"+n[1].length;return Gs(i)})}};var sn=e=>{let t=js();Ks(t,()=>zs(e))},an={h1:jr,h2:Xr,h3:Yr,h4:Qr,h5:tn,h6:rn},Xs=E(({props:e})=>{let{enabledHeadingSizes:t=["h1","h2","h3","h4","h5","h6"]}=e,o=[z(t.map((r,n)=>({ChildComponent:an[r],isActive:({selection:i})=>{if(!Zs(i))return!1;for(let l of i.getNodes()){if(ln(l)&&l.getTag()===r)continue;let s=l.getParent();if(!(ln(s)&&s.getTag()===r))return!1}return!0},key:r,label:({i18n:i})=>i.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:i})=>{i.update(()=>{sn(r)})},order:n+2})))];return{markdownTransformers:[nn(t)],nodes:[Vs],sanitizedClientFeatureProps:e,slashMenu:{groups:t?.length?[B(t.map(r=>({Icon:an[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(()=>{sn(r)})}})))]:[]},toolbarFixed:{groups:t?.length?o:[]},toolbarInline:{groups:t?.length?o:[]}}});import{$isNodeSelection as ra}from"lexical";import{jsx as cn}from"react/jsx-runtime";var Jt=()=>cn("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:cn("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as dn,jsxs as Js}from"react/jsx-runtime";var un=()=>Js("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[dn("path",{d:"M5 10h10",stroke:"currentColor"}),dn("path",{d:"M10 15V5",stroke:"currentColor"})]});var Y=e=>({type:"dropdown",ChildComponent:un,items:e,key:"add",order:10});var pn={type:"element",dependencies:[Ze],export:(e,t)=>Je(e)?"---":null,regExp:/^---\s*$/,replace:e=>{let t=Xe();t&&e.replace(t)}};import{useLexicalComposerContext as Ys}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as qs}from"@lexical/utils";import{$getSelection as Qs,$isRangeSelection as ea,COMMAND_PRIORITY_EDITOR as ta}from"lexical";import{useEffect as oa}from"react";var mn=()=>{let[e]=Ys();return oa(()=>e.registerCommand(we,t=>{let o=Qs();if(!ea(o))return!1;if(o.focus.getNode()!==null){let n=Xe();qs(n)}return!0},ta),[e]),null};var na=E({markdownTransformers:[pn],nodes:[Ze],plugins:[{Component:mn,position:"normal"}],slashMenu:{groups:[B([{Icon:Jt,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:e})=>e.t("lexical:horizontalRule:label"),onSelect:({editor:e})=>{e.dispatchCommand(we,void 0)}}])]},toolbarFixed:{groups:[Y([{ChildComponent:Jt,isActive:({selection:e})=>{if(!ra(e)||!e.getNodes().length)return!1;let t=e.getNodes()[0];return Je(t)},key:"horizontalRule",label:({i18n:e})=>e.t("lexical:horizontalRule:label"),onSelect:({editor:e})=>{e.dispatchCommand(we,void 0)}}])]}});import{INDENT_CONTENT_COMMAND as sa,OUTDENT_CONTENT_COMMAND as aa}from"lexical";import{jsx as at,jsxs as ia}from"react/jsx-runtime";var fn=()=>ia("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:[at("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),at("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),at("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),at("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as ct,jsxs as la}from"react/jsx-runtime";var gn=()=>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:[ct("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),ct("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),ct("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),ct("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});var Cn=e=>({type:"buttons",items:e,key:"indent",order:35});var hn=[Cn([{ChildComponent:fn,isActive:()=>!1,isEnabled:({selection:e})=>{if(!e||!e?.getNodes()?.length)return!1;for(let t of e.getNodes())if("__indent"in t&&t.__indent>0||t.getParent()&&"__indent"in t.getParent()&&t.getParent().__indent>0)return!0;return!1},key:"indentDecrease",label:({i18n:e})=>e.t("lexical:indent:decreaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(aa,void 0)},order:1},{ChildComponent:gn,isActive:()=>!1,key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(sa,void 0)},order:2}])],ca=E({toolbarFixed:{groups:hn},toolbarInline:{groups:hn}});import{$findMatchingParent as gc}from"@lexical/utils";import{$getSelection as io,$isRangeSelection as Kn}from"lexical";import{jsx as xn}from"react/jsx-runtime";var bn=()=>xn("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:xn("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 Tn}from"@lexical/selection";function me(e){let{anchor:t}=e,{focus:o}=e,r=e.anchor.getNode(),n=e.focus.getNode();return r===n?r:e.isBackward()?Tn(o)?r:n:Tn(t)?r:n}var Yt=e=>({type:"buttons",items:e,key:"features",order:50});import{$createTextNode as Ta,$isTextNode as Ea}from"lexical";import{addClassNamesToElement as da,isHTMLAnchorElement as ua}from"@lexical/utils";import eo from"bson-objectid";import{$applyNodeReplacement as pa,$createTextNode as En,$getSelection as ma,$isElementNode as yn,$isRangeSelection as Qt,ElementNode as fa,createCommand as ga}from"lexical";var Ca=new Set(["http:","https:","mailto:","sms:","tel:"]),V=class e extends fa{__fields;__id;constructor({id:t,fields:o={doc:null,linkType:"custom",newTab:!1,url:void 0},key:r}){super(r),this.__fields=o,this.__id=t}static clone(t){return new e({id:t.__id,fields:t.__fields,key:t.__key})}static getType(){return"link"}static importDOM(){return{a:t=>({conversion:ha,priority:1})}}static importJSON(t){t.version===1&&typeof t.fields?.doc?.value=="object"&&t.fields?.doc?.value?.id&&(t.fields.doc.value=t.fields.doc.value.id,t.version=2),t.version===2&&!t.id&&(t.id=new eo.default().toHexString(),t.version=3);let o=q({id:t.id,fields:t.fields});return o.setFormat(t.format),o.setIndent(t.indent),o.setDirection(t.direction),o}canBeEmpty(){return!1}canInsertTextAfter(){return!1}canInsertTextBefore(){return!1}createDOM(t){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=qt(o.rel,"add","noopener")),da(o,t.theme.link),o}exportJSON(){let t={...super.exportJSON(),type:"link",fields:this.getFields(),version:3},o=this.getID();return o&&(t.id=o),t}extractWithChild(t,o,r){if(!Qt(o))return!1;let n=o.anchor.getNode(),i=o.focus.getNode();return this.isParentOf(n)&&this.isParentOf(i)&&o.getTextContent().length>0}getFields(){return this.getLatest().__fields}getID(){return this.getLatest().__id}insertNewAfter(t,o=!0){let r=this.getParentOrThrow().insertNewAfter(t,o);if(yn(r)){let n=q({fields:this.__fields});return r.append(n),n}return null}isInline(){return!0}sanitizeUrl(t){try{let o=new URL(t);if(!Ca.has(o.protocol))return"about:blank"}catch{return"https://"}return t}setFields(t){let o=this.getWritable();o.__fields=t}updateDOM(t,o,r){let n=this.__fields?.url,i=this.__fields?.newTab;return n!=null&&n!==t.__fields?.url&&this.__fields?.linkType==="custom"&&(o.href=n),this.__fields?.linkType==="internal"&&t.__fields?.linkType==="custom"&&o.removeAttribute("href"),o.rel==null&&(o.rel=""),i!==t.__fields?.newTab&&(i??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=qt(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=qt(o.rel,"remove","noopener"))),!1}};function ha(e){let t=null;if(ua(e)){let o=e.textContent;o!==null&&o!==""&&(t=q({id:new eo.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:e.getAttribute("target")==="_blank",url:e.getAttribute("href")??""}}))}return{node:t}}function q({id:e,fields:t}){return pa(new V({id:e??new eo.default().toHexString(),fields:t}))}function H(e){return e instanceof V}var X=ga("TOGGLE_LINK_COMMAND");function Ln(e){let t=ma();if(!Qt(t)&&!e.selectedNodes.length)return;let o=Qt(t)?t.extract():e.selectedNodes;if(e===null)o.forEach(r=>{let n=r.getParent();if(H(n)){let i=n.getChildren();for(let l=0;l<i.length;l+=1)n.insertBefore(i[l]);n.remove()}});else{if(o.length===1){let i=o[0],l=H(i)?i:xa(i);if(l!==null){l.setFields(e.fields),e.text!=null&&e.text!==l.getTextContent()&&(l.append(En(e.text)),l.getChildren().forEach(s=>{s!==l.getLastChild()&&s.remove()}));return}}let r=null,n=null;o.forEach(i=>{let l=i.getParent();if(!(l===n||l===null||yn(i)&&!i.isInline())){if(H(l)){n=l,l.setFields(e.fields),e.text!=null&&e.text!==l.getTextContent()&&(l.append(En(e.text)),l.getChildren().forEach(s=>{s!==l.getLastChild()&&s.remove()}));return}if(l.is(r)||(r=l,n=q({fields:e.fields}),H(l)?i.getPreviousSibling()===null?l.insertBefore(n):l.insertAfter(n):i.insertBefore(n)),H(i)){if(i.is(n))return;if(n!==null){let s=i.getChildren();for(let a=0;a<s.length;a+=1)n.append(s[a])}i.remove();return}n!==null&&n.append(i)}})}}function xa(e){return ba(e,t=>H(t))}function ba(e,t){let o=e;for(;o!==null&&(o=o.getParent())!==null&&!t(o););return o}function qt(e,t,o){let r,n=`${e}`;if(t==="add"){if(n.includes(o)){let i=new RegExp(o,"g");n=n.replace(i,"").trim()}n=n.trim(),r=n.length===0?`${o}`:`${n} ${o}`}else{let i=new RegExp(o,"g");r=n.replace(i,"").trim()}return r}var Nn={type:"text-match",dependencies:[V],export:(e,t,o)=>{if(!H(e))return null;let r=e,{url:n}=r.getFields(),i=`[${r.getTextContent()}](${n})`,l=r.getFirstChild();return r.getChildrenSize()===1&&Ea(l)?o(l,i):i},importRegExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:(e,t)=>{let[,o,r]=t,n=q({fields:{doc:null,linkType:"custom",newTab:!1,url:r}}),i=Ta(o);i.setFormat(e.getFormat()),n.append(i),e.replace(n)},trigger:")"};import{$applyNodeReplacement as ya,$isElementNode as La}from"lexical";var Q=class e extends V{static clone(t){return new e({id:void 0,fields:t.__fields,key:t.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(t){t.version===1&&typeof t.fields?.doc?.value=="object"&&t.fields?.doc?.value?.id&&(t.fields.doc.value=t.fields.doc.value.id,t.version=2);let o=De({fields:t.fields});return o.setFormat(t.format),o.setIndent(t.indent),o.setDirection(t.direction),o}exportJSON(){let t=super.exportJSON();return{type:"autolink",children:t.children,direction:t.direction,fields:t.fields,format:t.format,indent:t.indent,version:2}}insertNewAfter(t,o=!0){let r=this.getParentOrThrow().insertNewAfter(t,o);if(La(r)){let n=De({fields:this.__fields});return r.append(n),n}return null}};function De({fields:e}){return ya(new Q({id:void 0,fields:e}))}function ee(e){return e instanceof Q}import{useLexicalComposerContext as Na}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as ka}from"@lexical/utils";import{$createTextNode as kn,$getSelection as wa,$isElementNode as _n,$isLineBreakNode as Rn,$isNodeSelection as _a,$isRangeSelection as Ra,$isTextNode as Oe,TextNode as Sa}from"lexical";import{useEffect as va}from"react";function ce(e,t,...o){if(!e)throw new Error("Internal Lexical error: invariant() is meant to be replaced at compile time. There is no runtime version. Error: "+t)}function wn(e,t=o=>o){return o=>{let r=e.exec(o);return r===null?null:{index:r.index,length:r[0].length,text:r[0],url:t(r[0])}}}function Sn(e,t){for(let o=0;o<t.length;o++){let r=t[o](e);if(r!=null)return r}return null}var Ia=/[.,;\s]/;function ut(e){return Ia.test(e)}function vn(e){return ut(e[e.length-1])}function oo(e){return ut(e[0])}function Fa(e){return/^\.[a-z\d]+/i.test(e)}function In(e){let t=e.getPreviousSibling();return _n(t)&&(t=t.getLastDescendant()),t===null||Rn(t)||Oe(t)&&vn(t.getTextContent())}function Fn(e){let t=e.getNextSibling();return _n(t)&&(t=t.getFirstDescendant()),t===null||Rn(t)||Oe(t)&&oo(t.getTextContent())}function Ma(e,t,o,r){return(e>0?ut(o[e-1]):In(r[0]))?t<o.length?ut(o[t]):Fn(r[r.length-1]):!1}function Pa(e,t,o){let r=[],n=[],i=[],l=0,s=0,a=[...e];for(;a.length>0;){let c=a[0],u=c.getTextContent().length,m=s;s+u<=t?(r.push(c),l+=u):m>=o?i.push(c):n.push(c),s+=u,a.shift()}return[l,r,n,i]}function Aa(e,t,o,r){let n={linkType:"custom",url:r.url,...r.fields},i=De({fields:n});if(e.length===1){let l=e[0],s;t===0?[s,l]=l.splitText(o):[,s,l]=l.splitText(t,o);let a=kn(r.text);return a.setFormat(s.getFormat()),a.setDetail(s.getDetail()),a.setStyle(s.getStyle()),i.append(a),s.replace(i),l}else if(e.length>1){let l=e[0],s=l.getTextContent().length,a;t===0?a=l:[,a]=l.splitText(t);let c=[],d;for(let C=1;C<e.length;C++){let g=e[C],b=g.getTextContent().length,S=s,I=s+b;if(S<o)if(I<=o)c.push(g);else{let[T,R]=g.splitText(o-S);c.push(T),d=R}s+=b}let u=wa(),m=u?u.getNodes().find(Oe):void 0,f=kn(a.getTextContent());return f.setFormat(a.getFormat()),f.setDetail(a.getDetail()),f.setStyle(a.getStyle()),i.append(f,...c),m&&m===a&&(Ra(u)?f.select(u.anchor.offset,u.focus.offset):_a(u)&&f.select(0,f.getTextContent().length)),a.replace(i),d}}function Da(e,t,o){let r=[...e],n=r.map(a=>a.getTextContent()).join(""),i=n,l,s=0;for(;(l=Sn(i,t))!=null&&l!==null;){let a=l.index,c=l.length,d=a+c;if(Ma(s+a,s+d,n,r)){let[m,,f,C]=Pa(r,s+a,s+d),g=s+a-m,x=s+d-m,b=Aa(f,g,x,l);r=b?[b,...C]:C,o(l.url,null),s=0}else s+=d;i=i.substring(d)}}function to(e,t,o){let r=e.getChildren(),n=r.length;for(let a=0;a<n;a++){let c=r[a];if(!Oe(c)||!c.isSimpleText()){dt(e),o(null,e.getFields()?.url??null);return}}let i=e.getTextContent(),l=Sn(i,t);if(l===null||l.text!==i){dt(e),o(null,e.getFields()?.url??null);return}if(!In(e)||!Fn(e)){dt(e),o(null,e.getFields()?.url??null);return}let s=e.getFields()?.url;if(s!==l?.url){let a=e.getFields();a.url=l?.url,e.setFields(a),o(l.url,s??null)}}function Oa(e,t,o){let r=e.getPreviousSibling(),n=e.getNextSibling(),i=e.getTextContent();ee(r)&&(!oo(i)||Fa(i))&&(r.append(e),to(r,t,o),o(null,r.getFields()?.url??null)),ee(n)&&!vn(i)&&(dt(n),to(n,t,o),o(null,n.getFields()?.url??null))}function dt(e){let t=e.getChildren(),o=t.length;for(let r=o-1;r>=0;r--)e.insertAfter(t[r]);return e.remove(),t.map(r=>r.getLatest())}function Ha(e){let t=[e],o=e.getNextSibling();for(;o!==null&&Oe(o)&&o.isSimpleText()&&(t.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return t}function Ba(e,t,o){va(()=>{e.hasNodes([Q])||ce(!1,"LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let r=(n,i)=>{o?.(n,i)};return ka(e.registerNodeTransform(Sa,n=>{let i=n.getParentOrThrow(),l=n.getPreviousSibling();if(ee(i))to(i,t,r);else if(!H(i)){if(n.isSimpleText()&&(oo(n.getTextContent())||!ee(l))){let s=Ha(n);Da(s,t,r)}Oa(n,t,r)}}))},[e,t,o])}var $a=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,Ga=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,Ua=[wn($a,e=>e.startsWith("http")?e:`https://${e}`),wn(Ga,e=>`mailto:${e}`)],Mn=()=>{let[e]=Na();return Ba(e,Ua),null};import{ClickableLinkPlugin as Wa}from"@lexical/react/LexicalClickableLinkPlugin.js";import{jsx as za}from"react/jsx-runtime";var Pn=()=>za(Wa,{});import{createCommand as Va}from"lexical";var pt=Va("TOGGLE_LINK_WITH_MODAL_COMMAND");import{createPortal as nc}from"react-dom";import{useLexicalComposerContext as Ka}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as An,mergeRegister as Dn}from"@lexical/utils";import{getTranslation as ja}from"@payloadcms/translations";import{formatDrawerSlug as Za,useConfig as Xa,useEditDepth as Ja,useModal as Ya,useTranslation as qa}from"@payloadcms/ui";import{$getSelection as On,$isLineBreakNode as Qa,$isRangeSelection as Hn,COMMAND_PRIORITY_HIGH as ec,COMMAND_PRIORITY_LOW as Bn,KEY_ESCAPE_COMMAND as tc,SELECTION_CHANGE_COMMAND as oc}from"lexical";import $n,{useCallback as Gn,useEffect as ft,useRef as rc,useState as fe}from"react";function mt(e,t,o,r=10,n=5){let i=o.parentElement;if(e===null||i==null){t.style.opacity="0",t.style.transform="translate(-10000px, -10000px)";return}let l=t.getBoundingClientRect(),s=o.getBoundingClientRect(),a=i.getBoundingClientRect(),c=e.top-r,d=e.left-n;c<a.top&&(c+=l.height+e.height+r*2),d+l.width>a.right&&(d=a.right-l.width-n),c-=s.top,d-=s.left,t.style.opacity="1",t.style.transform=`translate(${d}px, ${c}px)`}import{jsx as ge,jsxs as ro}from"react/jsx-runtime";function Un({anchorElem:e}){let[t]=Ka(),o=rc(null),[r,n]=fe(null),[i,l]=fe(null),{uuid:s}=G(),a=Xa(),{i18n:c,t:d}=qa(),[u,m]=fe(null),{closeModal:f,toggleModal:C}=Ya(),g=Ja(),[x,b]=fe(!1),[S,I]=fe([]),[T,R]=fe(!1),v=Za({slug:"lexical-rich-text-link-"+s,depth:g}),M=Gn(()=>{b(!1),o&&o.current&&(o.current.style.opacity="0",o.current.style.transform="translate(-10000px, -10000px)"),R(!1),n(null),l(null),I([]),m(null)},[b,n,l,I]),P=Gn(()=>{let L=On(),N=null;if(!Hn(L)||!L){M();return}let h=me(L);N=t.getElementByKey(h.getKey())?.getBoundingClientRect();let p=An(h,H),_=L.getNodes().filter(U=>!Qa(U)).find(U=>{let W=An(U,H);return p&&!p.is(W)||W&&!W.is(p)});if(p==null||_){M();return}let k={doc:void 0,linkType:void 0,newTab:void 0,url:"",...p.getFields(),id:p.getID(),text:p.getTextContent()};if(p.getFields()?.linkType==="custom")n(p.getFields()?.url??null),l(null);else{n(`/admin/collections/${p.getFields()?.doc?.relationTo}/${p.getFields()?.doc?.value}`);let U=a.collections.find(W=>W.slug===p.getFields()?.doc?.relationTo);if(!U)l(p.getFields()?.label?String(p.getFields()?.label):null),n(p.getFields()?.url?String(p.getFields()?.url):null);else{let W=d("fields:linkedTo",{label:ja(U.labels.singular,c)}).replace(/<[^>]*>?/g,"");l(W)}}m(k),b(!0),I(L?L?.getNodes():[]),ee(p)?R(!0):R(!1);let y=o.current,F=window.getSelection(),{activeElement:A}=document;if(y===null)return;let O=t.getRootElement();return F!==null&&O!==null&&O.contains(F.anchorNode)?(N||(N=F.getRangeAt(0).getBoundingClientRect()),N!=null&&(N.y+=40,mt(N,y,e))):(A==null||A.className!=="link-input")&&(O!==null&&mt(null,y,e),n(null),l(null)),!0},[t,M,a.collections,d,c,e]);return ft(()=>Dn(t.registerCommand(pt,L=>(t.dispatchCommand(X,L),P(),C(v),!0),Bn)),[t,P,C,v]),ft(()=>{let L=e.parentElement,N=()=>{t.getEditorState().read(()=>{P()})};return window.addEventListener("resize",N),L?.addEventListener("scroll",N),()=>{window.removeEventListener("resize",N),L?.removeEventListener("scroll",N)}},[e.parentElement,t,P]),ft(()=>Dn(t.registerUpdateListener(({editorState:L})=>{L.read(()=>{P()})}),t.registerCommand(oc,()=>(P(),!0),Bn),t.registerCommand(tc,()=>x?(M(),!0):!1,ec)),[t,P,x,M]),ft(()=>{t.getEditorState().read(()=>{P()})},[t,P]),ro($n.Fragment,{children:[ge("div",{className:"link-editor",ref:o,children:ro("div",{className:"link-input",children:[r&&r.length>0?ge("a",{href:r,rel:"noopener noreferrer",target:"_blank",children:i!=null&&i.length>0?i:r}):i!=null&&i.length>0?ge("span",{className:"link-input__label-pure",children:i}):null,t.isEditable()&&ro($n.Fragment,{children:[ge("button",{"aria-label":"Edit link",className:"link-edit",onClick:()=>{C(v)},onMouseDown:L=>{L.preventDefault()},tabIndex:0,type:"button"}),!T&&ge("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{t.dispatchCommand(X,null)},onMouseDown:L=>{L.preventDefault()},tabIndex:0,type:"button"})]})]})}),ge(le,{className:"lexical-link-edit-drawer",data:u,drawerSlug:v,drawerTitle:d("fields:editLink"),featureKey:"link",handleDrawerSubmit:(L,N)=>{f(v);let h=N,p={...h};delete p.text,t.update(()=>{let _=On(),k=null;if(Hn(_)?k=me(_).getParent():S.length&&(k=S[0].getParent()),k&&ee(k)){let y=q({fields:p});k.replace(y,!0)}}),t.dispatchCommand(X,{fields:p,selectedNodes:S,text:h.text})},schemaPathSuffix:"fields"})]})}import{jsx as ic}from"react/jsx-runtime";var Wn=e=>{let{anchorElem:t=document.body}=e;return nc(ic(Un,{anchorElem:t}),t)};import{useLexicalComposerContext as ac}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as cc}from"@lexical/utils";import{$getSelection as dc,$isElementNode as uc,$isRangeSelection as pc,COMMAND_PRIORITY_LOW as zn,PASTE_COMMAND as mc}from"lexical";import{useEffect as fc}from"react";var lc=/(?:[A-Za-z]{3,9}:(?:\/\/)?(?:[-;:&=+$,\w]+@)?[A-Za-z\d.-]+|(?:www.|[-;:&=+$,\w]+@)[A-Za-z\d.-]+)(?:\/[+~%/.\w-]*)?\??[-+=&;%@.\w]*#?\w*/,sc=/^[\w\-./]*(?:#\w[\w-]*)?$/;function no(e){if(!e)return!1;if(e==="https://"||lc.test(e)||sc.test(e))return!0;try{return new URL(e),!0}catch{}return!1}var Vn=()=>{let[e]=ac();return fc(()=>{if(!e.hasNodes([V]))throw new Error("LinkPlugin: LinkNode not registered on editor");return cc(e.registerCommand(X,t=>(Ln(t),!0),zn),no!==void 0?e.registerCommand(mc,t=>{let o=dc();if(!pc(o)||o.isCollapsed()||!(t instanceof ClipboardEvent)||t.clipboardData==null)return!1;let r=t.clipboardData.getData("text");if(!no(r))return!1;if(!o.getNodes().some(n=>uc(n))){let n={doc:null,linkType:"custom",newTab:!1,url:r};return e.dispatchCommand(X,{fields:n,text:null}),t.preventDefault(),!0}return!1},zn):()=>{})},[e]),null};var jn=[Yt([{ChildComponent:bn,isActive:({selection:e})=>{if(Kn(e)){let t=me(e);return gc(t,H)!=null}return!1},isEnabled:({selection:e})=>!!(Kn(e)&&io()?.getTextContent()?.length),key:"link",label:({i18n:e})=>e.t("lexical:link:label"),onSelect:({editor:e,isActive:t})=>{if(t)e.dispatchCommand(X,null);else{let o=null,r=[];if(e.getEditorState().read(()=>{o=io()?.getTextContent(),r=io()?.getNodes()??[]}),!o?.length)return;let n={doc:null,linkType:"custom",newTab:!1,url:"https://"};e.dispatchCommand(pt,{fields:n,selectedNodes:r,text:o})}},order:1}])],Cc=E({markdownTransformers:[Nn],nodes:[V,Q],plugins:[{Component:Vn,position:"normal"},{Component:Mn,position:"normal"},{Component:Pn,position:"normal"},{Component:Wn,position:"floatingAnchorElem"}],toolbarFixed:{groups:jn},toolbarInline:{groups:jn}});import{$isListNode as ao,INSERT_CHECK_LIST_COMMAND as Qn,ListItemNode as Rc,ListNode as Sc}from"@lexical/list";import{$isRangeSelection as vc}from"lexical";import{jsx as Zn,jsxs as hc}from"react/jsx-runtime";var lo=()=>hc("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:[Zn("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),Zn("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{ListPlugin as xc}from"@lexical/react/LexicalListPlugin.js";import{jsx as bc}from"react/jsx-runtime";var Ce=()=>bc(xc,{});function he(e){return{items:e,key:"lists",label:({i18n:t})=>t.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as Lc,ListItemNode as Nc,ListNode as kc}from"@lexical/list";import{$createListItemNode as Tc,$createListNode as Ec,$isListItemNode as yc,$isListNode as so}from"@lexical/list";var Xn=4,xe=e=>(t,o,r)=>{let n=t.getPreviousSibling(),i=t.getNextSibling(),l=Tc(e==="check"?r[3]==="x":void 0);if(so(i)&&i.getListType()===e){let a=i.getFirstChild();a!==null?a.insertBefore(l):i.append(l),t.remove()}else if(so(n)&&n.getListType()===e)n.append(l),t.remove();else{let a=Ec(e,e==="number"?Number(r[2]):void 0);a.append(l),t.replace(a)}l.append(...o),l.select(0,0);let s=Math.floor(r[1].length/Xn);s&&l.setIndent(s)},de=(e,t,o)=>{let r=[],n=e.getChildren(),i=0;for(let l of n)if(yc(l)){if(l.getChildrenSize()===1){let d=l.getFirstChild();if(so(d)){r.push(de(d,t,o+1));continue}}let s=" ".repeat(o*Xn),a=e.getListType(),c=a==="number"?`${e.getStart()+i}. `:a==="check"?`- [${l.getChecked()?"x":" "}] `:"- ";r.push(s+c+t(l)),i++}return r.join(`
|
|
35
|
-
`)};var
|
|
34
|
+
`},[e,t]),m=se((T,k)=>{o(E=>{let _=t.length-1,M=t[_];if(M&&M.name===T){if(T==="type")return[...t.slice(0,_),{...M,value:M.value+k}];if(M.value===k)return[...t.slice(0,_),{...M,count:M.count+1}]}return[...E,{name:T,count:1,value:k}]})},[t,o]);mr(()=>{let T=E=>{if(!r)return;let _=E.key;xs(E)?m("selectAll",""):gr.has(_)?m("press",E.key):[..._].length>1?m("keydown",E.key):m("type",E.key)},k=E=>{if(!r)return;let _=E.key;!gr.has(_)&&[..._].length>1&&m("keyup",E.key)};return e.registerRootListener((E,_)=>{_!==null&&(_.removeEventListener("keydown",T),_.removeEventListener("keyup",k)),E!==null&&(E.addEventListener("keydown",T),E.addEventListener("keyup",k))})},[e,r,m]),mr(()=>{d.current&&d.current.scrollTo(0,d.current.scrollHeight)},[u]),jt(()=>{if(t){let T=u();T!==null&&a(T),d.current&&d.current.scrollTo(0,d.current.scrollHeight)}},[u,t]),jt(()=>e.registerUpdateListener(({dirtyElements:k,dirtyLeaves:E,editorState:_})=>{if(!r)return;let M=_._selection,F=s.current,N=c.current;if(F!==M){if(E.size===0&&k.size===0&&!N){let C=window.getSelection();if(C&&(C.anchorNode==null||C.focusNode==null))return}s.current=M}c.current=!1;let b=u();b!==null&&a(b)}),[e,u,r,m]),jt(()=>r?e.registerUpdateListener(()=>{let k=e.getRootElement();k!==null&&i(k?.innerHTML)}):void 0,[e,r]);let g=se(T=>{r||(T.update(()=>{let k=gs();k.clear();let E=fs();k.append(ms().append(E)),E.select()}),o([])),n(k=>!k)},[r]),f=se(()=>{if(!r)return;let T=window.getSelection();if(T===null||T.anchorNode==null||T.focusNode==null)return;let{anchorNode:k,anchorOffset:E,focusNode:_,focusOffset:M}=Ts(T),F=p().getRootElement(),N;k!==null&&(N=fr(k,F));let b;_!==null&&(b=fr(_,F)),m("snapshot",{anchorNode:k,anchorOffset:E,anchorPath:N,focusNode:_,focusOffset:M,focusPath:b})},[m,r,p]),x=se(()=>{Cs(u())},[u]),h=se(()=>{hs("test.js",u())},[u]);return[ae("button",{className:`editor-dev-button ${r?"active":""}`,id:"test-recorder-button",onClick:T=>{g(p()),T.preventDefault()},title:r?"Disable test recorder":"Enable test recorder",type:"button",children:r?"Disable test recorder":"Enable test recorder"}),r?Zt("div",{className:"test-recorder-output",children:[Zt("div",{className:"test-recorder-toolbar",children:[ae("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:T=>{f(),T.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),ae("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:T=>{x(),T.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),ae("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:T=>{h(),T.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),ae("pre",{id:"test-recorder",ref:d,children:l})]}):null]}var hr=()=>{let[e]=ps(),[t,o]=Es(e);return Zt(Cr.Fragment,{children:[ae("p",{children:"HI"}),t,o,ae("p",{children:"DONE"})]})};var ys=L({plugins:[{Component:hr,position:"bottom"}]});import{useLexicalComposerContext as Ls}from"@lexical/react/LexicalComposerContext.js";import{TreeView as Ns}from"@lexical/react/LexicalTreeView.js";import{jsx as ks}from"react/jsx-runtime";var br=()=>{let[e]=Ls();return ks(Ns,{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"})};var ws=L({plugins:[{Component:br,position:"bottom"}]});import{$isRangeSelection as Rs,FORMAT_TEXT_COMMAND as _s}from"lexical";import{jsx as xr}from"react/jsx-runtime";var Tr=()=>xr("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:xr("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 U=e=>({type:"buttons",items:e,key:"format",order:40});var Er={type:"text-format",format:["bold","italic"],tag:"***"},yr={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},Lr={type:"text-format",format:["bold"],tag:"**"},Nr={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var kr=[U([{ChildComponent:Tr,isActive:({selection:e})=>Rs(e)?e.hasFormat("bold"):!1,key:"bold",onSelect:({editor:e})=>{e.dispatchCommand(_s,"bold")},order:1}])],Ss=L(({featureProviderMap:e})=>{let t=[Lr,Nr];return e.get("italic")&&t.push(yr,Er),{markdownTransformers:t,toolbarFixed:{groups:kr},toolbarInline:{groups:kr}}});import{$isRangeSelection as Is,FORMAT_TEXT_COMMAND as Fs}from"lexical";import{jsx as wr,jsxs as vs}from"react/jsx-runtime";var Rr=()=>vs("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:[wr("path",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),wr("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var _r={type:"text-format",format:["code"],tag:"`"};var Sr=[U([{ChildComponent:Rr,isActive:({selection:e})=>Is(e)?e.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:e})=>{e.dispatchCommand(Fs,"code")},order:7}])],Ms=L({markdownTransformers:[_r],toolbarFixed:{groups:Sr},toolbarInline:{groups:Sr}});import{$isRangeSelection as Ps,FORMAT_TEXT_COMMAND as As}from"lexical";import{jsx as vr}from"react/jsx-runtime";var Ir=()=>vr("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:vr("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 Fr={type:"text-format",format:["italic"],tag:"*"},Mr={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var Pr=[U([{ChildComponent:Ir,isActive:({selection:e})=>Ps(e)?e.hasFormat("italic"):!1,key:"italic",onSelect:({editor:e})=>{e.dispatchCommand(As,"italic")},order:2}])],Ds=L({markdownTransformers:[Fr,Mr],toolbarFixed:{groups:Pr},toolbarInline:{groups:Pr}});import{$isRangeSelection as Hs,FORMAT_TEXT_COMMAND as $s}from"lexical";import{jsx as Ar,jsxs as Os}from"react/jsx-runtime";var Dr=()=>Os("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:[Ar("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"}),Ar("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var Or={type:"text-format",format:["strikethrough"],tag:"~~"};var Hr=[U([{ChildComponent:Dr,isActive:({selection:e})=>Hs(e)?e.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:e})=>{e.dispatchCommand($s,"strikethrough")},order:4}])],Bs=L({markdownTransformers:[Or],toolbarFixed:{groups:Hr},toolbarInline:{groups:Hr}});import{$isRangeSelection as Gs,FORMAT_TEXT_COMMAND as Us}from"lexical";import{jsx as $r}from"react/jsx-runtime";var Br=()=>$r("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:$r("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 Gr=[U([{ChildComponent:Br,isActive:({selection:e})=>Gs(e)?e.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:e})=>{e.dispatchCommand(Us,"subscript")},order:5}])],Ws=L({toolbarFixed:{groups:Gr},toolbarInline:{groups:Gr}});import{$isRangeSelection as zs,FORMAT_TEXT_COMMAND as Vs}from"lexical";import{jsx as Ur}from"react/jsx-runtime";var Wr=()=>Ur("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:Ur("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 zr=[U([{ChildComponent:Wr,isActive:({selection:e})=>zs(e)?e.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:e})=>{e.dispatchCommand(Vs,"superscript")},order:6}])],Ks=L({toolbarFixed:{groups:zr},toolbarInline:{groups:zr}});import{$isRangeSelection as Xs,FORMAT_TEXT_COMMAND as Zs}from"lexical";import{jsx as Vr,jsxs as js}from"react/jsx-runtime";var Kr=()=>js("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:[Vr("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"}),Vr("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var jr=[U([{ChildComponent:Kr,isActive:({selection:e})=>Xs(e)?e.hasFormat("underline"):!1,key:"underline",onSelect:({editor:e})=>{e.dispatchCommand(Zs,"underline")},order:3}])],Js=L({toolbarFixed:{groups:jr},toolbarInline:{groups:jr}});import{$createHeadingNode as ea,$isHeadingNode as an,HeadingNode as ta}from"@lexical/rich-text";import{$setBlocksType as oa}from"@lexical/selection";import{$getSelection as ra,$isRangeSelection as na}from"lexical";import{jsx as Xr}from"react/jsx-runtime";var Zr=()=>Xr("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:Xr("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 Jr}from"react/jsx-runtime";var Yr=()=>Jr("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:Jr("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 qr}from"react/jsx-runtime";var Qr=()=>qr("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:qr("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 en}from"react/jsx-runtime";var tn=()=>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",{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 on}from"react/jsx-runtime";var rn=()=>on("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:on("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 nn}from"react/jsx-runtime";var ln=()=>nn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:nn("path",{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 Ys,$isHeadingNode as qs,HeadingNode as Qs}from"@lexical/rich-text";var Jt=e=>(t,o,r)=>{let n=e(r);n&&(n.append(...o),t.replace(n),n.select(0,0))};var sn=e=>{let o=`^(${e.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`,r=new RegExp(o);return{type:"element",dependencies:[Qs],export:(n,i)=>{if(!qs(n))return null;let l=Number(n.getTag().slice(1));return"#".repeat(l)+" "+i(n)},regExp:r,replace:Jt(n=>{let i="h"+n[1].length;return Ys(i)})}};var cn=e=>{let t=ra();oa(t,()=>ea(e))},dn={h1:Zr,h2:Yr,h3:Qr,h4:tn,h5:rn,h6:ln},ia=L(({props:e})=>{let{enabledHeadingSizes:t=["h1","h2","h3","h4","h5","h6"]}=e,o=[z(t.map((r,n)=>({ChildComponent:dn[r],isActive:({selection:i})=>{if(!na(i))return!1;for(let l of i.getNodes()){if(an(l)&&l.getTag()===r)continue;let a=l.getParent();if(!(an(a)&&a.getTag()===r))return!1}return!0},key:r,label:({i18n:i})=>i.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:i})=>{i.update(()=>{cn(r)})},order:n+2})))];return{markdownTransformers:[sn(t)],nodes:[ta],sanitizedClientFeatureProps:e,slashMenu:{groups:t?.length?[G(t.map(r=>({Icon:dn[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(()=>{cn(r)})}})))]:[]},toolbarFixed:{groups:t?.length?o:[]},toolbarInline:{groups:t?.length?o:[]}}});import{$isNodeSelection as ma}from"lexical";import{jsx as un}from"react/jsx-runtime";var Yt=()=>un("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:un("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as pn,jsxs as la}from"react/jsx-runtime";var mn=()=>la("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[pn("path",{d:"M5 10h10",stroke:"currentColor"}),pn("path",{d:"M10 15V5",stroke:"currentColor"})]});var Y=e=>({type:"dropdown",ChildComponent:mn,items:e,key:"add",order:10});var fn={type:"element",dependencies:[Xe],export:(e,t)=>Je(e)?"---":null,regExp:/^---\s*$/,replace:e=>{let t=Ze();t&&e.replace(t)}};import{useLexicalComposerContext as sa}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as aa}from"@lexical/utils";import{$getSelection as ca,$isRangeSelection as da,COMMAND_PRIORITY_EDITOR as ua}from"lexical";import{useEffect as pa}from"react";var gn=()=>{let[e]=sa();return pa(()=>e.registerCommand(we,t=>{let o=ca();if(!da(o))return!1;if(o.focus.getNode()!==null){let n=Ze();aa(n)}return!0},ua),[e]),null};var fa=L({markdownTransformers:[fn],nodes:[Xe],plugins:[{Component:gn,position:"normal"}],slashMenu:{groups:[G([{Icon:Yt,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:e})=>e.t("lexical:horizontalRule:label"),onSelect:({editor:e})=>{e.dispatchCommand(we,void 0)}}])]},toolbarFixed:{groups:[Y([{ChildComponent:Yt,isActive:({selection:e})=>{if(!ma(e)||!e.getNodes().length)return!1;let t=e.getNodes()[0];return Je(t)},key:"horizontalRule",label:({i18n:e})=>e.t("lexical:horizontalRule:label"),onSelect:({editor:e})=>{e.dispatchCommand(we,void 0)}}])]}});import{INDENT_CONTENT_COMMAND as ha,OUTDENT_CONTENT_COMMAND as ba}from"lexical";import{jsx as at,jsxs as ga}from"react/jsx-runtime";var Cn=()=>ga("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:[at("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),at("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),at("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),at("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as ct,jsxs as Ca}from"react/jsx-runtime";var hn=()=>Ca("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:[ct("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),ct("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),ct("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),ct("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});var bn=e=>({type:"buttons",items:e,key:"indent",order:35});var xn=[bn([{ChildComponent:Cn,isActive:()=>!1,isEnabled:({selection:e})=>{if(!e||!e?.getNodes()?.length)return!1;for(let t of e.getNodes())if("__indent"in t&&t.__indent>0||t.getParent()&&"__indent"in t.getParent()&&t.getParent().__indent>0)return!0;return!1},key:"indentDecrease",label:({i18n:e})=>e.t("lexical:indent:decreaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(ba,void 0)},order:1},{ChildComponent:hn,isActive:()=>!1,key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(ha,void 0)},order:2}])],xa=L({toolbarFixed:{groups:xn},toolbarInline:{groups:xn}});import{$findMatchingParent as kc}from"@lexical/utils";import{$getSelection as lo,$isRangeSelection as Xn}from"lexical";import{jsx as Tn}from"react/jsx-runtime";var En=()=>Tn("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:Tn("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 yn}from"@lexical/selection";function me(e){let{anchor:t}=e,{focus:o}=e,r=e.anchor.getNode(),n=e.focus.getNode();return r===n?r:e.isBackward()?yn(o)?r:n:yn(t)?r:n}var qt=e=>({type:"buttons",items:e,key:"features",order:50});import{$createTextNode as va,$isTextNode as Ia}from"lexical";import{addClassNamesToElement as Ta,isHTMLAnchorElement as Ea}from"@lexical/utils";import to from"bson-objectid";import{$applyNodeReplacement as ya,$createTextNode as Ln,$getSelection as La,$isElementNode as Nn,$isRangeSelection as eo,ElementNode as Na,createCommand as ka}from"lexical";var wa=new Set(["http:","https:","mailto:","sms:","tel:"]),V=class e extends Na{__fields;__id;constructor({id:t,fields:o={doc:null,linkType:"custom",newTab:!1,url:void 0},key:r}){super(r),this.__fields=o,this.__id=t}static clone(t){return new e({id:t.__id,fields:t.__fields,key:t.__key})}static getType(){return"link"}static importDOM(){return{a:t=>({conversion:Ra,priority:1})}}static importJSON(t){t.version===1&&typeof t.fields?.doc?.value=="object"&&t.fields?.doc?.value?.id&&(t.fields.doc.value=t.fields.doc.value.id,t.version=2),t.version===2&&!t.id&&(t.id=new to.default().toHexString(),t.version=3);let o=q({id:t.id,fields:t.fields});return o.setFormat(t.format),o.setIndent(t.indent),o.setDirection(t.direction),o}canBeEmpty(){return!1}canInsertTextAfter(){return!1}canInsertTextBefore(){return!1}createDOM(t){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=Qt(o.rel,"add","noopener")),Ta(o,t.theme.link),o}exportJSON(){let t={...super.exportJSON(),type:"link",fields:this.getFields(),version:3},o=this.getID();return o&&(t.id=o),t}extractWithChild(t,o,r){if(!eo(o))return!1;let n=o.anchor.getNode(),i=o.focus.getNode();return this.isParentOf(n)&&this.isParentOf(i)&&o.getTextContent().length>0}getFields(){return this.getLatest().__fields}getID(){return this.getLatest().__id}insertNewAfter(t,o=!0){let r=this.getParentOrThrow().insertNewAfter(t,o);if(Nn(r)){let n=q({fields:this.__fields});return r.append(n),n}return null}isInline(){return!0}sanitizeUrl(t){try{let o=new URL(t);if(!wa.has(o.protocol))return"about:blank"}catch{return"https://"}return t}setFields(t){let o=this.getWritable();o.__fields=t}updateDOM(t,o,r){let n=this.__fields?.url,i=this.__fields?.newTab;return n!=null&&n!==t.__fields?.url&&this.__fields?.linkType==="custom"&&(o.href=n),this.__fields?.linkType==="internal"&&t.__fields?.linkType==="custom"&&o.removeAttribute("href"),o.rel==null&&(o.rel=""),i!==t.__fields?.newTab&&(i??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=Qt(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=Qt(o.rel,"remove","noopener"))),!1}};function Ra(e){let t=null;if(Ea(e)){let o=e.textContent;o!==null&&o!==""&&(t=q({id:new to.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:e.getAttribute("target")==="_blank",url:e.getAttribute("href")??""}}))}return{node:t}}function q({id:e,fields:t}){return ya(new V({id:e??new to.default().toHexString(),fields:t}))}function B(e){return e instanceof V}var Z=ka("TOGGLE_LINK_COMMAND");function kn(e){let t=La();if(!eo(t)&&!e.selectedNodes.length)return;let o=eo(t)?t.extract():e.selectedNodes;if(e===null)o.forEach(r=>{let n=r.getParent();if(B(n)){let i=n.getChildren();for(let l=0;l<i.length;l+=1)n.insertBefore(i[l]);n.remove()}});else{if(o.length===1){let i=o[0],l=B(i)?i:_a(i);if(l!==null){l.setFields(e.fields),e.text!=null&&e.text!==l.getTextContent()&&(l.append(Ln(e.text)),l.getChildren().forEach(a=>{a!==l.getLastChild()&&a.remove()}));return}}let r=null,n=null;o.forEach(i=>{let l=i.getParent();if(!(l===n||l===null||Nn(i)&&!i.isInline())){if(B(l)){n=l,l.setFields(e.fields),e.text!=null&&e.text!==l.getTextContent()&&(l.append(Ln(e.text)),l.getChildren().forEach(a=>{a!==l.getLastChild()&&a.remove()}));return}if(l.is(r)||(r=l,n=q({fields:e.fields}),B(l)?i.getPreviousSibling()===null?l.insertBefore(n):l.insertAfter(n):i.insertBefore(n)),B(i)){if(i.is(n))return;if(n!==null){let a=i.getChildren();for(let s=0;s<a.length;s+=1)n.append(a[s])}i.remove();return}n!==null&&n.append(i)}})}}function _a(e){return Sa(e,t=>B(t))}function Sa(e,t){let o=e;for(;o!==null&&(o=o.getParent())!==null&&!t(o););return o}function Qt(e,t,o){let r,n=`${e}`;if(t==="add"){if(n.includes(o)){let i=new RegExp(o,"g");n=n.replace(i,"").trim()}n=n.trim(),r=n.length===0?`${o}`:`${n} ${o}`}else{let i=new RegExp(o,"g");r=n.replace(i,"").trim()}return r}var wn={type:"text-match",dependencies:[V],export:(e,t,o)=>{if(!B(e))return null;let r=e,{url:n}=r.getFields(),i=`[${r.getTextContent()}](${n})`,l=r.getFirstChild();return r.getChildrenSize()===1&&Ia(l)?o(l,i):i},importRegExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:(e,t)=>{let[,o,r]=t,n=q({fields:{doc:null,linkType:"custom",newTab:!1,url:r}}),i=va(o);i.setFormat(e.getFormat()),n.append(i),e.replace(n)},trigger:")"};import{$applyNodeReplacement as Fa,$isElementNode as Ma}from"lexical";var Q=class e extends V{static clone(t){return new e({id:void 0,fields:t.__fields,key:t.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(t){t.version===1&&typeof t.fields?.doc?.value=="object"&&t.fields?.doc?.value?.id&&(t.fields.doc.value=t.fields.doc.value.id,t.version=2);let o=De({fields:t.fields});return o.setFormat(t.format),o.setIndent(t.indent),o.setDirection(t.direction),o}exportJSON(){let t=super.exportJSON();return{type:"autolink",children:t.children,direction:t.direction,fields:t.fields,format:t.format,indent:t.indent,version:2}}insertNewAfter(t,o=!0){let r=this.getParentOrThrow().insertNewAfter(t,o);if(Ma(r)){let n=De({fields:this.__fields});return r.append(n),n}return null}};function De({fields:e}){return Fa(new Q({id:void 0,fields:e}))}function ee(e){return e instanceof Q}import{useLexicalComposerContext as Pa}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Aa}from"@lexical/utils";import{$createTextNode as Rn,$getSelection as Da,$isElementNode as Sn,$isLineBreakNode as vn,$isNodeSelection as Oa,$isRangeSelection as Ha,$isTextNode as Oe,TextNode as $a}from"lexical";import{useEffect as Ba}from"react";function ce(e,t,...o){if(!e)throw new Error("Internal Lexical error: invariant() is meant to be replaced at compile time. There is no runtime version. Error: "+t)}function _n(e,t=o=>o){return o=>{let r=e.exec(o);return r===null?null:{index:r.index,length:r[0].length,text:r[0],url:t(r[0])}}}function In(e,t){for(let o=0;o<t.length;o++){let r=t[o](e);if(r!=null)return r}return null}var Ga=/[.,;\s]/;function ut(e){return Ga.test(e)}function Fn(e){return ut(e[e.length-1])}function ro(e){return ut(e[0])}function Ua(e,t){return t?/^\.[a-z]{2,}/i.test(e):/^\.[a-z0-9]+/i.test(e)}function Mn(e){let t=e.getPreviousSibling();return Sn(t)&&(t=t.getLastDescendant()),t===null||vn(t)||Oe(t)&&Fn(t.getTextContent())}function Pn(e){let t=e.getNextSibling();return Sn(t)&&(t=t.getFirstDescendant()),t===null||vn(t)||Oe(t)&&ro(t.getTextContent())}function Wa(e,t,o,r){return(e>0?ut(o[e-1]):Mn(r[0]))?t<o.length?ut(o[t]):Pn(r[r.length-1]):!1}function za(e,t,o){let r=[],n=[],i=[],l=0,a=0,s=[...e];for(;s.length>0;){let c=s[0],p=c.getTextContent().length,u=a;a+p<=t?(r.push(c),l+=p):u>=o?i.push(c):n.push(c),a+=p,s.shift()}return[l,r,n,i]}function Va(e,t,o,r){let n={linkType:"custom",url:r.url,...r.fields},i=De({fields:n});if(e.length===1){let l=e[0],a;t===0?[a,l]=l.splitText(o):[,a,l]=l.splitText(t,o);let s=Rn(r.text);return s.setFormat(a.getFormat()),s.setDetail(a.getDetail()),s.setStyle(a.getStyle()),i.append(s),a.replace(i),l}else if(e.length>1){let l=e[0],a=l.getTextContent().length,s;t===0?s=l:[,s]=l.splitText(t);let c=[],d;for(let g=1;g<e.length;g++){let f=e[g],h=f.getTextContent().length,I=a,P=a+h;if(I<o)if(P<=o)c.push(f);else{let[T,k]=f.splitText(o-I);c.push(T),d=k}a+=h}let p=Da(),u=p?p.getNodes().find(Oe):void 0,m=Rn(s.getTextContent());return m.setFormat(s.getFormat()),m.setDetail(s.getDetail()),m.setStyle(s.getStyle()),i.append(m,...c),u&&u===s&&(Ha(p)?m.select(p.anchor.offset,p.focus.offset):Oa(p)&&m.select(0,m.getTextContent().length)),s.replace(i),d}}function Ka(e,t,o){let r=[...e],n=r.map(s=>s.getTextContent()).join(""),i=n,l,a=0;for(;(l=In(i,t))!=null&&l!==null;){let s=l.index,c=l.length,d=s+c;if(Wa(a+s,a+d,n,r)){let[u,,m,g]=za(r,a+s,a+d),f=a+s-u,x=a+d-u,h=Va(m,f,x,l);r=h?[h,...g]:g,o(l.url,null),a=0}else a+=d;i=i.substring(d)}}function oo(e,t,o){let r=e.getChildren(),n=r.length;for(let s=0;s<n;s++){let c=r[s];if(!Oe(c)||!c.isSimpleText()){dt(e),o(null,e.getFields()?.url??null);return}}let i=e.getTextContent(),l=In(i,t);if(l===null||l.text!==i){dt(e),o(null,e.getFields()?.url??null);return}if(!Mn(e)||!Pn(e)){dt(e),o(null,e.getFields()?.url??null);return}let a=e.getFields()?.url;if(a!==l?.url){let s=e.getFields();s.url=l?.url,e.setFields(s),o(l.url,a??null)}}function ja(e,t,o){let r=e.getPreviousSibling(),n=e.getNextSibling(),i=e.getTextContent();if(ee(r)){let l=r.getFields()?.url?r.getFields()?.url?.startsWith("mailto:"):!1;(!ro(i)||Ua(i,l))&&(r.append(e),oo(r,t,o),o(null,r.getFields()?.url??null))}ee(n)&&!Fn(i)&&(dt(n),oo(n,t,o),o(null,n.getFields()?.url??null))}function dt(e){let t=e.getChildren(),o=t.length;for(let r=o-1;r>=0;r--)e.insertAfter(t[r]);return e.remove(),t.map(r=>r.getLatest())}function Xa(e){let t=[e],o=e.getNextSibling();for(;o!==null&&Oe(o)&&o.isSimpleText()&&(t.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return t}function Za(e,t,o){Ba(()=>{e.hasNodes([Q])||ce(!1,"LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let r=(n,i)=>{o?.(n,i)};return Aa(e.registerNodeTransform($a,n=>{let i=n.getParentOrThrow(),l=n.getPreviousSibling();if(ee(i))oo(i,t,r);else if(!B(i)){if(n.isSimpleText()&&(ro(n.getTextContent())||!ee(l))){let a=Xa(n);Ka(a,t,r)}ja(n,t,r)}}))},[e,t,o])}var Ja=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,Ya=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,qa=[_n(Ja,e=>e.startsWith("http")?e:`https://${e}`),_n(Ya,e=>`mailto:${e}`)],An=()=>{let[e]=Pa();return Za(e,qa),null};import{ClickableLinkPlugin as Qa}from"@lexical/react/LexicalClickableLinkPlugin.js";import{jsx as ec}from"react/jsx-runtime";var Dn=()=>ec(Qa,{});import{createCommand as tc}from"lexical";var pt=tc("TOGGLE_LINK_WITH_MODAL_COMMAND");import{createPortal as fc}from"react-dom";import{useLexicalComposerContext as oc}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as On,mergeRegister as Hn}from"@lexical/utils";import{getTranslation as rc}from"@payloadcms/translations";import{formatDrawerSlug as nc,useConfig as ic,useEditDepth as lc,useModal as sc,useTranslation as ac}from"@payloadcms/ui";import{$getSelection as $n,$isLineBreakNode as cc,$isRangeSelection as Bn,COMMAND_PRIORITY_HIGH as dc,COMMAND_PRIORITY_LOW as Gn,KEY_ESCAPE_COMMAND as uc,SELECTION_CHANGE_COMMAND as pc}from"lexical";import Un,{useCallback as Wn,useEffect as ft,useRef as mc,useState as fe}from"react";function mt(e,t,o,r=10,n=5){let i=o.parentElement;if(e===null||i==null){t.style.opacity="0",t.style.transform="translate(-10000px, -10000px)";return}let l=t.getBoundingClientRect(),a=o.getBoundingClientRect(),s=i.getBoundingClientRect(),c=e.top-r,d=e.left-n;c<s.top&&(c+=l.height+e.height+r*2),d+l.width>s.right&&(d=s.right-l.width-n),c-=a.top,d-=a.left,t.style.opacity="1",t.style.transform=`translate(${d}px, ${c}px)`}import{jsx as ge,jsxs as no}from"react/jsx-runtime";function zn({anchorElem:e}){let[t]=oc(),o=mc(null),[r,n]=fe(null),[i,l]=fe(null),{uuid:a}=$(),s=ic(),{i18n:c,t:d}=ac(),[p,u]=fe(null),{closeModal:m,toggleModal:g}=sc(),f=lc(),[x,h]=fe(!1),[I,P]=fe([]),[T,k]=fe(!1),E=nc({slug:"lexical-rich-text-link-"+a,depth:f}),_=Wn(()=>{h(!1),o&&o.current&&(o.current.style.opacity="0",o.current.style.transform="translate(-10000px, -10000px)"),k(!1),n(null),l(null),P([]),u(null)},[h,n,l,P]),M=Wn(()=>{let F=$n(),N=null;if(!Bn(F)||!F){_();return}let b=me(F);N=t.getElementByKey(b.getKey())?.getBoundingClientRect();let C=On(b,B),R=F.getNodes().filter(H=>!cc(H)).find(H=>{let W=On(H,B);return C&&!C.is(W)||W&&!W.is(C)});if(C==null||R){_();return}let w={doc:void 0,linkType:void 0,newTab:void 0,url:"",...C.getFields(),id:C.getID(),text:C.getTextContent()};if(C.getFields()?.linkType==="custom")n(C.getFields()?.url??null),l(null);else{n(`/admin/collections/${C.getFields()?.doc?.relationTo}/${C.getFields()?.doc?.value}`);let H=s.collections.find(W=>W.slug===C.getFields()?.doc?.relationTo);if(!H)l(C.getFields()?.label?String(C.getFields()?.label):null),n(C.getFields()?.url?String(C.getFields()?.url):null);else{let W=d("fields:linkedTo",{label:rc(H.labels.singular,c)}).replace(/<[^>]*>?/g,"");l(W)}}u(w),h(!0),P(F?F?.getNodes():[]),ee(C)?k(!0):k(!1);let y=o.current,S=window.getSelection(),{activeElement:A}=document;if(y===null)return;let O=t.getRootElement();return S!==null&&O!==null&&O.contains(S.anchorNode)?(N||(N=S.getRangeAt(0).getBoundingClientRect()),N!=null&&(N.y+=40,mt(N,y,e))):(A==null||A.className!=="link-input")&&(O!==null&&mt(null,y,e),n(null),l(null)),!0},[t,_,s.collections,d,c,e]);return ft(()=>Hn(t.registerCommand(pt,F=>(t.dispatchCommand(Z,F),M(),g(E),!0),Gn)),[t,M,g,E]),ft(()=>{let F=e.parentElement,N=()=>{t.getEditorState().read(()=>{M()})};return window.addEventListener("resize",N),F?.addEventListener("scroll",N),()=>{window.removeEventListener("resize",N),F?.removeEventListener("scroll",N)}},[e.parentElement,t,M]),ft(()=>Hn(t.registerUpdateListener(({editorState:F})=>{F.read(()=>{M()})}),t.registerCommand(pc,()=>(M(),!0),Gn),t.registerCommand(uc,()=>x?(_(),!0):!1,dc)),[t,M,x,_]),ft(()=>{t.getEditorState().read(()=>{M()})},[t,M]),no(Un.Fragment,{children:[ge("div",{className:"link-editor",ref:o,children:no("div",{className:"link-input",children:[r&&r.length>0?ge("a",{href:r,rel:"noopener noreferrer",target:"_blank",children:i!=null&&i.length>0?i:r}):i!=null&&i.length>0?ge("span",{className:"link-input__label-pure",children:i}):null,t.isEditable()&&no(Un.Fragment,{children:[ge("button",{"aria-label":"Edit link",className:"link-edit",onClick:()=>{g(E)},onMouseDown:F=>{F.preventDefault()},tabIndex:0,type:"button"}),!T&&ge("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{t.dispatchCommand(Z,null)},onMouseDown:F=>{F.preventDefault()},tabIndex:0,type:"button"})]})]})}),ge(le,{className:"lexical-link-edit-drawer",data:p,drawerSlug:E,drawerTitle:d("fields:editLink"),featureKey:"link",handleDrawerSubmit:(F,N)=>{m(E);let b=N,C={...b};delete C.text,t.update(()=>{let R=$n(),w=null;if(Bn(R)?w=me(R).getParent():I.length&&(w=I[0].getParent()),w&&ee(w)){let y=q({fields:C});w.replace(y,!0)}}),t.dispatchCommand(Z,{fields:C,selectedNodes:I,text:b.text})},schemaPathSuffix:"fields"})]})}import{jsx as gc}from"react/jsx-runtime";var Vn=e=>{let{anchorElem:t=document.body}=e;return fc(gc(zn,{anchorElem:t}),t)};import{useLexicalComposerContext as bc}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as xc}from"@lexical/utils";import{$getSelection as Tc,$isElementNode as Ec,$isRangeSelection as yc,COMMAND_PRIORITY_LOW as Kn,PASTE_COMMAND as Lc}from"lexical";import{useEffect as Nc}from"react";var Cc=/(?:[A-Za-z]{3,9}:(?:\/\/)?(?:[-;:&=+$,\w]+@)?[A-Za-z\d.-]+|(?:www.|[-;:&=+$,\w]+@)[A-Za-z\d.-]+)(?:\/[+~%/.\w-]*)?\??[-+=&;%@.\w]*#?\w*/,hc=/^[\w\-./]*(?:#\w[\w-]*)?$/;function io(e){if(!e)return!1;if(e==="https://"||Cc.test(e)||hc.test(e))return!0;try{return new URL(e),!0}catch{}return!1}var jn=()=>{let[e]=bc();return Nc(()=>{if(!e.hasNodes([V]))throw new Error("LinkPlugin: LinkNode not registered on editor");return xc(e.registerCommand(Z,t=>(kn(t),!0),Kn),io!==void 0?e.registerCommand(Lc,t=>{let o=Tc();if(!yc(o)||o.isCollapsed()||!(t instanceof ClipboardEvent)||t.clipboardData==null)return!1;let r=t.clipboardData.getData("text");if(!io(r))return!1;if(!o.getNodes().some(n=>Ec(n))){let n={doc:null,linkType:"custom",newTab:!1,url:r};return e.dispatchCommand(Z,{fields:n,text:null}),t.preventDefault(),!0}return!1},Kn):()=>{})},[e]),null};var Zn=[qt([{ChildComponent:En,isActive:({selection:e})=>{if(Xn(e)){let t=me(e);return kc(t,B)!=null}return!1},isEnabled:({selection:e})=>!!(Xn(e)&&lo()?.getTextContent()?.length),key:"link",label:({i18n:e})=>e.t("lexical:link:label"),onSelect:({editor:e,isActive:t})=>{if(t)e.dispatchCommand(Z,null);else{let o=null,r=[];if(e.getEditorState().read(()=>{o=lo()?.getTextContent(),r=lo()?.getNodes()??[]}),!o?.length)return;let n={doc:null,linkType:"custom",newTab:!1,url:"https://"};e.dispatchCommand(pt,{fields:n,selectedNodes:r,text:o})}},order:1}])],wc=L({markdownTransformers:[wn],nodes:[V,Q],plugins:[{Component:jn,position:"normal"},{Component:An,position:"normal"},{Component:Dn,position:"normal"},{Component:Vn,position:"floatingAnchorElem"}],toolbarFixed:{groups:Zn},toolbarInline:{groups:Zn}});import{$isListNode as co,INSERT_CHECK_LIST_COMMAND as ti,ListItemNode as Hc,ListNode as $c}from"@lexical/list";import{$isRangeSelection as Bc}from"lexical";import{jsx as Jn,jsxs as Rc}from"react/jsx-runtime";var so=()=>Rc("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:[Jn("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),Jn("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{ListPlugin as _c}from"@lexical/react/LexicalListPlugin.js";import{jsx as Sc}from"react/jsx-runtime";var Ce=()=>Sc(_c,{});function he(e){return{items:e,key:"lists",label:({i18n:t})=>t.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as Mc,ListItemNode as Pc,ListNode as Ac}from"@lexical/list";import{$createListItemNode as vc,$createListNode as Ic,$isListItemNode as Fc,$isListNode as ao}from"@lexical/list";var Yn=4,be=e=>(t,o,r)=>{let n=t.getPreviousSibling(),i=t.getNextSibling(),l=vc(e==="check"?r[3]==="x":void 0);if(ao(i)&&i.getListType()===e){let s=i.getFirstChild();s!==null?s.insertBefore(l):i.append(l),t.remove()}else if(ao(n)&&n.getListType()===e)n.append(l),t.remove();else{let s=Ic(e,e==="number"?Number(r[2]):void 0);s.append(l),t.replace(s)}l.append(...o),l.select(0,0);let a=Math.floor(r[1].length/Yn);a&&l.setIndent(a)},de=(e,t,o)=>{let r=[],n=e.getChildren(),i=0;for(let l of n)if(Fc(l)){if(l.getChildrenSize()===1){let d=l.getFirstChild();if(ao(d)){r.push(de(d,t,o+1));continue}}let a=" ".repeat(o*Yn),s=e.getListType(),c=s==="number"?`${e.getStart()+i}. `:s==="check"?`- [${l.getChecked()?"x":" "}] `:"- ";r.push(a+c+t(l)),i++}return r.join(`
|
|
35
|
+
`)};var qn={type:"element",dependencies:[Ac,Pc],export:(e,t)=>Mc(e)?de(e,t,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:be("check")};import{CheckListPlugin as Dc}from"@lexical/react/LexicalCheckListPlugin.js";import{jsx as Oc}from"react/jsx-runtime";var Qn=()=>Oc(Dc,{});var ei=[z([{ChildComponent:so,isActive:({selection:e})=>{if(!Bc(e))return!1;for(let t of e.getNodes()){if(co(t)&&t.getListType()==="check")continue;let o=t.getParent();if(co(o)&&o.getListType()==="check")continue;let r=o?.getParent();if(!(co(r)&&r.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:e})=>e.t("lexical:checklist:label"),onSelect:({editor:e})=>{e.dispatchCommand(ti,void 0)},order:12}])],Gc=L(({featureProviderMap:e})=>{let t=[{Component:Qn,position:"normal"}];return!e.has("unorderedList")&&!e.has("orderedList")&&t.push({Component:Ce,position:"normal"}),{markdownTransformers:[qn],nodes:e.has("unorderedList")||e.has("orderedList")?[]:[$c,Hc],plugins:t,slashMenu:{groups:[he([{Icon:so,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:o})=>o.t("lexical:checklist:label"),onSelect:({editor:o})=>{o.dispatchCommand(ti,void 0)}}])]},toolbarFixed:{groups:ei},toolbarInline:{groups:ei}}});import{$isListNode as po,INSERT_ORDERED_LIST_COMMAND as ni,ListItemNode as Kc,ListNode as jc}from"@lexical/list";import{$isRangeSelection as Xc}from"lexical";import{jsx as He,jsxs as Uc}from"react/jsx-runtime";var uo=()=>Uc("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:[He("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"}),He("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"}),He("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),He("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),He("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Wc,ListItemNode as zc,ListNode as Vc}from"@lexical/list";var oi={type:"element",dependencies:[Vc,zc],export:(e,t)=>Wc(e)?de(e,t,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:be("number")};var ri=[z([{ChildComponent:uo,isActive:({selection:e})=>{if(!Xc(e))return!1;for(let t of e.getNodes()){if(po(t)&&t.getListType()==="number")continue;let o=t.getParent();if(po(o)&&o.getListType()==="number")continue;let r=o?.getParent();if(!(po(r)&&r.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:e})=>e.t("lexical:orderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(ni,void 0)},order:10}])],Zc=L(({featureProviderMap:e})=>({markdownTransformers:[oi],nodes:e.has("orderedList")?[]:[jc,Kc],plugins:e.has("orderedList")?[]:[{Component:Ce,position:"normal"}],slashMenu:{groups:[he([{Icon:uo,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(ni,void 0)}}])]},toolbarFixed:{groups:ri},toolbarInline:{groups:ri}}));import{$isListNode as fo,INSERT_UNORDERED_LIST_COMMAND as si,ListItemNode as ed,ListNode as td}from"@lexical/list";import{$isRangeSelection as od}from"lexical";import{jsx as xe,jsxs as Jc}from"react/jsx-runtime";var mo=()=>Jc("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:[xe("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),xe("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),xe("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),xe("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),xe("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),xe("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Yc,ListItemNode as qc,ListNode as Qc}from"@lexical/list";var ii={type:"element",dependencies:[Qc,qc],export:(e,t)=>Yc(e)?de(e,t,0):null,regExp:/^(\s*)[-*+]\s/,replace:be("bullet")};var li=[z([{ChildComponent:mo,isActive:({selection:e})=>{if(!od(e))return!1;for(let t of e.getNodes()){if(fo(t)&&t.getListType()==="bullet")continue;let o=t.getParent();if(fo(o)&&o.getListType()==="bullet")continue;let r=o?.getParent();if(!(fo(r)&&r.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:e})=>e.t("lexical:unorderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(si,void 0)},order:11}])],rd=L({markdownTransformers:[ii],nodes:[td,ed],plugins:[{Component:Ce,position:"normal"}],slashMenu:{groups:[he([{Icon:mo,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:e})=>e.t("lexical:unorderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(si,void 0)}}])]},toolbarFixed:{groups:li},toolbarInline:{groups:li}});function ai({converters:e,lexicalPluginData:t}){return{root:{type:"root",children:ci({converters:e,lexicalPluginNodes:t?.jsonContent?.root?.children||[],parentNodeType:"root"}),direction:t?.jsonContent?.root?.direction||"ltr",format:t?.jsonContent?.root?.format||"",indent:t?.jsonContent?.root?.indent||0,version:1}}}function ci({converters:e,lexicalPluginNodes:t,parentNodeType:o}){if(!t?.length)return[];let r=e.find(n=>n.nodeTypes.includes("unknown"));return t.map((n,i)=>{if(n.type==="paragraph")return nd(e,n);if(n.type==="text"||!n.type)return n;let l=e.find(a=>a.nodeTypes.includes(n.type));return l?l.converter({childIndex:i,converters:e,lexicalPluginNode:n,parentNodeType:o}):(console.warn("lexicalPluginToLexical > No converter found for node type: "+n.type),r?.converter({childIndex:i,converters:e,lexicalPluginNode:n,parentNodeType:o}))})||[]}function nd(e,t){return{...t,type:"paragraph",children:ci({converters:e,lexicalPluginNodes:t.children||[],parentNodeType:"paragraph"}),version:1}}import{addClassNamesToElement as id}from"@lexical/utils";import{DecoratorNode as ld}from"lexical";import*as di from"react";import{jsx as cd}from"react/jsx-runtime";var sd=di.lazy(()=>import("./Component-7HS6FEJS.js").then(e=>({default:e.UnknownConvertedNodeComponent}))),$e=class e extends ld{__data;constructor({data:t,key:o}){super(o),this.__data=t}static clone(t){return new e({data:t.__data,key:t.__key})}static getType(){return"unknownConverted"}static importJSON(t){return ad({data:t.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(t){let o=document.createElement("span");return id(o,"unknownConverted"),o}decorate(){return cd(sd,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(t,o){return!1}};function ad({data:e}){return new $e({data:e})}var dd=L(({clientFunctions:e})=>{let t=Object.values(e);return{hooks:{load({incomingEditorState:o}){return!o||!("jsonContent"in o)?o:ai({converters:t,lexicalPluginData:o})}},nodes:[$e]}});var v={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},ud=v.IS_BOLD|v.IS_ITALIC|v.IS_STRIKETHROUGH|v.IS_UNDERLINE|v.IS_CODE|v.IS_SUBSCRIPT|v.IS_SUPERSCRIPT|v.IS_HIGHLIGHT,pd="\xA0",md=`
|
|
36
36
|
|
|
37
|
-
`,ci="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",di="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",nd=new RegExp("^[^"+di+"]*["+ci+"]"),id=new RegExp("^[^"+ci+"]*["+di+"]"),ld={bold:w.IS_BOLD,code:w.IS_CODE,highlight:w.IS_HIGHLIGHT,italic:w.IS_ITALIC,strikethrough:w.IS_STRIKETHROUGH,subscript:w.IS_SUBSCRIPT,superscript:w.IS_SUPERSCRIPT,underline:w.IS_UNDERLINE},sd={directionless:w.IS_DIRECTIONLESS,unmergeable:w.IS_UNMERGEABLE},ad={center:w.IS_ALIGN_CENTER,end:w.IS_ALIGN_END,justify:w.IS_ALIGN_JUSTIFY,left:w.IS_ALIGN_LEFT,right:w.IS_ALIGN_RIGHT,start:w.IS_ALIGN_START},cd={[w.IS_ALIGN_CENTER]:"center",[w.IS_ALIGN_END]:"end",[w.IS_ALIGN_JUSTIFY]:"justify",[w.IS_ALIGN_LEFT]:"left",[w.IS_ALIGN_RIGHT]:"right",[w.IS_ALIGN_START]:"start"},dd={normal:w.IS_NORMAL,segmented:w.IS_SEGMENTED,token:w.IS_TOKEN},ud={[w.IS_NORMAL]:"normal",[w.IS_SEGMENTED]:"segmented",[w.IS_TOKEN]:"token"};function pi({converters:e,slateData:t}){return{root:{type:"root",children:mi({canContainParagraphs:!0,converters:e,parentNodeType:"root",slateNodes:t}),direction:"ltr",format:"",indent:0,version:1}}}function mi({canContainParagraphs:e,converters:t,parentNodeType:o,slateNodes:r}){if(!t?.length)return[];let n=t.find(i=>i.nodeTypes.includes("unknown"));return r.map((i,l)=>{if(!("type"in i))return e?ui(t,i):pd(i);if(i.type==="p")return ui(t,i);let s=t.find(a=>a.nodeTypes.includes(i.type));return s?s.converter({childIndex:l,converters:t,parentNodeType:o,slateNode:i}):(console.warn("slateToLexical > No converter found for node type: "+i.type),n?.converter({childIndex:l,converters:t,parentNodeType:o,slateNode:i}))})||[]}function ui(e,t){return{type:"paragraph",children:mi({canContainParagraphs:!1,converters:e,parentNodeType:"paragraph",slateNodes:t.children||[]}),direction:"ltr",format:"",indent:0,textFormat:0,version:1}}function pd(e){return{type:"text",detail:0,format:md(e),mode:"normal",style:"",text:e.text,version:1}}function md(e){let t=0;return e.bold&&(t=t|w.IS_BOLD),e.italic&&(t=t|w.IS_ITALIC),e.strikethrough&&(t=t|w.IS_STRIKETHROUGH),e.underline&&(t=t|w.IS_UNDERLINE),e.subscript&&(t=t|w.IS_SUBSCRIPT),e.superscript&&(t=t|w.IS_SUPERSCRIPT),e.code&&(t=t|w.IS_CODE),t}import{addClassNamesToElement as fd}from"@lexical/utils";import{DecoratorNode as gd}from"lexical";import*as fi from"react";import{jsx as xd}from"react/jsx-runtime";var Cd=fi.lazy(()=>import("./Component-LAKSCIDX.js").then(e=>({default:e.UnknownConvertedNodeComponent}))),$e=class e extends gd{__data;constructor({data:t,key:o}){super(o),this.__data=t}static clone(t){return new e({data:t.__data,key:t.__key})}static getType(){return"unknownConverted"}static importJSON(t){return hd({data:t.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(t){let o=document.createElement("span");return fd(o,"unknownConverted"),o}decorate(){return xd(Cd,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(t,o){return!1}};function hd({data:e}){return new $e({data:e})}var bd=E(({clientFunctions:e})=>{let t=Object.values(e);return{hooks:{load({incomingEditorState:o}){return!o||!Array.isArray(o)||"root"in o?o:pi({converters:t,slateData:o})}},nodes:[$e]}});import{$setBlocksType as hi}from"@lexical/selection";import{$createParagraphNode as xi,$getSelection as bi,$isParagraphNode as gi,$isRangeSelection as Td}from"lexical";var Ci=[z([{ChildComponent:Ae,isActive:({selection:e})=>{if(!Td(e))return!1;for(let t of e.getNodes())if(!gi(t)&&!gi(t.getParent()))return!1;return!0},key:"paragraph",label:({i18n:e})=>e.t("lexical:paragraph:label2"),onSelect:({editor:e})=>{e.update(()=>{let t=bi();hi(t,()=>xi())})},order:1}])],Ed=E({slashMenu:{groups:[B([{Icon:Ae,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:e})=>e.t("lexical:paragraph:label"),onSelect:({editor:e})=>{e.update(()=>{let t=bi();hi(t,()=>xi())})}}])]},toolbarFixed:{groups:Ci},toolbarInline:{groups:Ci}});import{$isNodeSelection as Bd}from"lexical";import{jsx as Ge,jsxs as yd}from"react/jsx-runtime";var fo=()=>yd("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:[Ge("g",{clipPath:"url(#clip0_4397_10817)",children:Ge("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"})}),Ge("defs",{children:Ge("clipPath",{id:"clip0_4397_10817",children:Ge("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{useLexicalComposerContext as Sd}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as vd}from"@lexical/utils";import{useConfig as Id}from"@payloadcms/ui";import{$getPreviousSelection as Fd,$getSelection as Md,$isParagraphNode as Ni,$isRangeSelection as Pd,COMMAND_PRIORITY_EDITOR as Ad,createCommand as Dd}from"lexical";import{useEffect as Od}from"react";import{useLexicalComposerContext as Ld}from"@lexical/react/LexicalComposerContext.js";import{useListDrawer as Nd}from"@payloadcms/ui";import{$getNodeByKey as kd,COMMAND_PRIORITY_EDITOR as wd}from"lexical";import{useCallback as _d,useEffect as Ti,useState as Ei}from"react";import{jsx as gt}from"react/jsx-runtime";var Rd=({editor:e,relationTo:t,replaceNodeKey:o,value:r})=>{o?e.update(()=>{let n=kd(o);n&&n.replace(Se({relationTo:t,value:r}))}):e.dispatchCommand(go,{relationTo:t,value:r})},yi=({enabledCollectionSlugs:e})=>{let[t]=Ld(),[o,r]=Ei(()=>e[0]),[n,i]=Ei(null),[l,s,{closeDrawer:a,isDrawerOpen:c,openDrawer:d}]=Nd({collectionSlugs:e,selectedCollection:o});Ti(()=>t.registerCommand(_e,m=>(i(m?.replace?m?.replace.nodeKey:null),d(),!0),wd),[t,d]);let u=_d(({collectionSlug:m,docID:f})=>{Rd({editor:t,relationTo:m,replaceNodeKey:n,value:f}),a()},[t,a,n]);return Ti(()=>{r(e[0])},[c,e]),gt(l,{onSelect:u})},Li=e=>e?.enabledCollectionSlugs?.length>0?gt(yi,{...e}):gt(Ye,{...e,children:gt(yi,{...e})});import{jsx as Hd}from"react/jsx-runtime";var go=Dd("INSERT_RELATIONSHIP_COMMAND"),ki=({clientProps:e})=>{let[t]=Sd(),{collections:o}=Id(),r=null;return e?.enabledCollections?r=e?.enabledCollections:e?.disabledCollections&&(r=o.filter(({slug:n})=>!e?.disabledCollections?.includes(n)).map(({slug:n})=>n)),Od(()=>{if(!t.hasNodes([Re]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return t.registerCommand(go,n=>{let i=Md()||Fd();if(Pd(i)){let l=Se(n);vd(l);let{focus:s}=i,a=s.getNode();Ni(a)&&a.getTextContentSize()===0&&a.getParent().getChildren().filter(c=>Ni(c)).length>1&&a.remove()}return!0},Ad)},[t]),Hd(Li,{enabledCollectionSlugs:r})};var $d=E({nodes:[Re],plugins:[{Component:ki,position:"normal"}],slashMenu:{groups:[B([{Icon:fo,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:e})=>e.t("lexical:relationship:label"),onSelect:({editor:e})=>{e.dispatchCommand(_e,{replace:!1})}}])]},toolbarFixed:{groups:[Y([{ChildComponent:fo,isActive:({selection:e})=>{if(!Bd(e)||!e.getNodes().length)return!1;let t=e.getNodes()[0];return Mt(t)},key:"relationship",label:({i18n:e})=>e.t("lexical:relationship:label"),onSelect:({editor:e})=>{e.dispatchCommand(_e,{replace:!1})}}])]}});import{useLexicalComposerContext as tu}from"@lexical/react/LexicalComposerContext.js";import{useScrollInfo as ou,useThrottledEffect as ru,useTranslation as nu}from"@payloadcms/ui";import*as te from"react";import{useMemo as iu}from"react";import{mergeRegister as Gd}from"@lexical/utils";import{$getSelection as Ud}from"lexical";import{useCallback as Wd,useEffect as Ct,useState as Co}from"react";import{jsx as zd}from"react/jsx-runtime";var ho="toolbar-popup__button",Ue=({children:e,editor:t,item:o})=>{let[r,n]=Co(!0),[i,l]=Co(!1),[s,a]=Co(ho),c=G(),d=Wd(()=>{t.getEditorState().read(()=>{let u=Ud();if(o.isActive){let m=o.isActive({editor:t,editorConfigContext:c,selection:u});i!==m&&l(m)}if(o.isEnabled){let m=o.isEnabled({editor:t,editorConfigContext:c,selection:u});r!==m&&n(m)}})},[i,t,c,r,o]);return Ct(()=>{d()},[d]),Ct(()=>(document.addEventListener("mouseup",d),()=>{document.removeEventListener("mouseup",d)}),[d]),Ct(()=>Gd(t.registerUpdateListener(()=>{d()})),[t,d]),Ct(()=>{a([ho,r===!1?"disabled":"",i?"active":"",o?.key?`${ho}-`+o.key:""].filter(Boolean).join(" "))},[r,i,s,o.key]),zd("button",{className:s,onClick:()=>{if(r!==!1)return t._updateTags=new Set([...t._updateTags,"toolbar"]),t.focus(()=>{o.onSelect({editor:t,isActive:i})}),!0},onMouseDown:u=>{u.preventDefault()},type:"button",children:e})};import vi,{useCallback as Xd,useEffect as To}from"react";import{mergeRegister as Jd}from"@lexical/utils";import{useTranslation as Yd}from"@payloadcms/ui";import{$getSelection as qd}from"lexical";import ht,{useCallback as Vd,useEffect as We,useMemo as Kd,useRef as bo,useState as xt}from"react";import{createPortal as jd}from"react-dom";import{jsx as ie,jsxs as wi}from"react/jsx-runtime";var xo="toolbar-popup__dropdown-item",_i=ht.createContext(null);function Ri({active:e,children:t,editor:o,enabled:r,item:n,title:i}){let[l,s]=xt(xo);We(()=>{s([xo,r===!1?"disabled":"",e?"active":"",n?.key?`${xo}-${n.key}`:""].filter(Boolean).join(" "))},[r,e,l,n.key]);let a=bo(null),c=ht.useContext(_i);if(c===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:d}=c;return We(()=>{a?.current!=null&&d(a)},[a,d]),ie("button",{className:l,onClick:()=>{r!==!1&&(o._updateTags=new Set([...o._updateTags,"toolbar"]),o.focus(()=>{n.onSelect({editor:o,isActive:e})}))},onMouseDown:u=>{u.preventDefault()},ref:a,title:i,type:"button",children:t})}function Zd({children:e,dropDownRef:t,itemsContainerClassNames:o,onClose:r}){let[n,i]=xt(),[l,s]=xt(),a=Vd(u=>{i(m=>m!=null?[...m,u]:[u])},[i]),c=u=>{if(n==null)return;let{key:m}=u;["ArrowDown","ArrowUp","Escape","Tab"].includes(m)&&u.preventDefault(),m==="Escape"||m==="Tab"?r():m==="ArrowUp"?s(f=>{if(f==null)return n[0];let C=n.indexOf(f)-1;return n[C===-1?n.length-1:C]}):m==="ArrowDown"&&s(f=>f==null?n[0]:n[n.indexOf(f)+1])},d=Kd(()=>({registerItem:a}),[a]);return We(()=>{n!=null&&l==null&&s(n[0]),l!=null&&l?.current!=null&&l.current.focus()},[n,l]),ie(_i.Provider,{value:d,children:ie("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:c,ref:t,children:e})})}function Si({Icon:e,buttonAriaLabel:t,buttonClassName:o,children:r,disabled:n=!1,itemsContainerClassNames:i,label:l,stopCloseOnClickSelf:s}){let a=bo(null),c=bo(null),[d,u]=xt(!1),m=()=>{u(!1),c?.current!=null&&c.current.focus()};We(()=>{let C=c.current,g=a.current;if(d&&C!==null&&g!==null){let{left:x,top:b}=C.getBoundingClientRect(),S=window.scrollY||document.documentElement.scrollTop;g.style.top=`${b+S+C.offsetHeight+5}px`,g.style.left=`${Math.min(x-5,window.innerWidth-g.offsetWidth-20)}px`}},[a,c,d]),We(()=>{let C=c.current;if(C!==null&&d){let g=x=>{let{target:b}=x;s!=null&&a.current!=null&&a.current.contains(b)||C.contains(b)||u(!1)};return document.addEventListener("click",g),()=>{document.removeEventListener("click",g)}}},[a,c,d,s]);let f=jd(ie(Zd,{dropDownRef:a,itemsContainerClassNames:i,onClose:m,children:r}),document.body);return wi(ht.Fragment,{children:[wi("button",{"aria-label":t,className:o+(d?" active":""),disabled:n,onClick:C=>{C.preventDefault(),u(!d)},onMouseDown:C=>{C.preventDefault()},ref:c,type:"button",children:[e&&ie(e,{}),l&&ie("span",{className:"toolbar-popup__dropdown-label",children:l}),ie("i",{className:"toolbar-popup__dropdown-caret"})]}),d&&ie(ht.Fragment,{children:f})]})}import{jsx as ze,jsxs as eu}from"react/jsx-runtime";var Eo="toolbar-popup__dropdown",Qd=({active:e,anchorElem:t,editor:o,enabled:r,item:n})=>{let{i18n:i}=Yd();if(n.Component)return n?.Component&&ze(n.Component,{active:e,anchorElem:t,editor:o,enabled:r,item:n},n.key);let l=n.key;return n.label&&(l=typeof n.label=="function"?n.label({i18n:i}):n.label),l.length>25&&(l=l.substring(0,25)+"..."),eu(Ri,{active:e,editor:o,enabled:r,item:n,children:[n?.ChildComponent&&ze(n.ChildComponent,{}),ze("span",{className:"text",children:l})]},n.key)},ue=({Icon:e,anchorElem:t,classNames:o,editor:r,groupKey:n,items:i,itemsContainerClassNames:l,label:s,maxActiveItems:a,onActiveChange:c})=>{let[d,u]=vi.useState([]),[m,f]=vi.useState([]),C=G(),g=Xd(()=>{r.getEditorState().read(()=>{let x=qd(),b=[],S=[],I=[];for(let T of i)T.isActive&&(!a||b.length<a)&&T.isActive({editor:r,editorConfigContext:C,selection:x})&&(b.push(T.key),S.push(T)),T.isEnabled?T.isEnabled({editor:r,editorConfigContext:C,selection:x})&&I.push(T.key):I.push(T.key);u(b),f(I),c&&c({activeItems:S})})},[r,C,i,a,c]);return To(()=>{g()},[g]),To(()=>(document.addEventListener("mouseup",g),()=>{document.removeEventListener("mouseup",g)}),[g]),To(()=>Jd(r.registerUpdateListener(()=>{g()})),[r,g]),ze(Si,{Icon:e,buttonAriaLabel:`${n} dropdown`,buttonClassName:[Eo,`${Eo}-${n}`,...o||[]].filter(Boolean).join(" "),itemsContainerClassNames:[`${Eo}-items`,...l||[]],label:s,children:i.length&&i.map(x=>ze(Qd,{active:d.includes(x.key),anchorElem:t,editor:r,enabled:m.includes(x.key),item:x},x.key))},n)};import{jsx as j,jsxs as cu}from"react/jsx-runtime";function lu({anchorElem:e,editor:t,item:o}){return o.Component?o?.Component&&j(o.Component,{anchorElem:e,editor:t,item:o},o.key):j(Ue,{editor:t,item:o,children:o?.ChildComponent&&j(o.ChildComponent,{})},o.key)}function su({anchorElem:e,editor:t,editorConfig:o,group:r,index:n}){let{i18n:i}=nu(),[l,s]=te.useState(null),[a,c]=te.useState(null);te.useEffect(()=>{r?.type==="dropdown"&&r.items.length&&r.ChildComponent?c(()=>r.ChildComponent):c(null)},[r]);let d=({activeItems:u})=>{if(!u.length){r?.type==="dropdown"&&r.items.length&&r.ChildComponent?(c(()=>r.ChildComponent),s(null)):(c(null),s(null));return}let m=u[0],f=m.key;m.label&&(f=typeof m.label=="function"?m.label({i18n:i}):m.label),f.length>25&&(f=f.substring(0,25)+"..."),s(f),c(()=>m.ChildComponent)};return cu("div",{className:`fixed-toolbar__group fixed-toolbar__group-${r.key}`,children:[r.type==="dropdown"&&r.items.length&&(a?j(ue,{Icon:a,anchorElem:e,editor:t,groupKey:r.key,items:r.items,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:l,maxActiveItems:1,onActiveChange:d}):j(ue,{anchorElem:e,editor:t,groupKey:r.key,items:r.items,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:l,maxActiveItems:1,onActiveChange:d})),r.type==="buttons"&&r.items.length&&r.items.map(u=>j(lu,{anchorElem:e,editor:t,item:u},u.key)),n<o.features.toolbarFixed?.groups.length-1&&j("div",{className:"divider"})]},r.key)}function au({anchorElem:e,clientProps:t,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let i=te.useRef(null),{y:l}=ou(),s=iu(()=>{if(!n||t?.disableIfParentHasFixedToolbar)return null;let c=n.editorContainerRef.current.previousElementSibling;for(;c;){if(c.classList.contains("fixed-toolbar"))return c;c=c.previousElementSibling}return null},[t?.disableIfParentHasFixedToolbar,n]);return ru(()=>{if(!s)return;let a=i.current;if(!a)return;let c=a.getBoundingClientRect(),d=s.getBoundingClientRect();if(!(c.bottom<d.top||c.top>d.bottom))i.current.className="fixed-toolbar fixed-toolbar--overlapping",s.className="fixed-toolbar fixed-toolbar--hide";else{if(!i.current.classList.contains("fixed-toolbar--overlapping"))return;i.current.className="fixed-toolbar",s.className="fixed-toolbar"}},50,[i,s,l]),j("div",{className:"fixed-toolbar",onFocus:a=>{a.stopPropagation()},ref:i,children:o.isEditable()&&j(te.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((a,c)=>j(su,{anchorElem:e,editor:o,editorConfig:r,group:a,index:c},a.key))})})}var Ii=e=>{if(e.parentEditor?.editorConfig){if(e.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return e.parentEditor;if(e.parentEditor)return Ii(e.parentEditor)}return!1},Fi=({anchorElem:e,clientProps:t})=>{let[o]=tu(),r=G(),{editorConfig:n}=r,i=t.applyToFocusedEditor&&r.focusedEditor?.editor||o,l=t.applyToFocusedEditor&&r.focusedEditor?.editorConfig||n,s=Ii(r);return t?.disableIfParentHasFixedToolbar&&s||!l?.features?.toolbarFixed?.groups?.length?null:j(au,{anchorElem:e,editor:i,editorConfig:l,parentWithFixedToolbar:s})};var du=E({plugins:[{Component:Fi,position:"aboveContainer"}]});import{useLexicalComposerContext as uu}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Ai}from"@lexical/utils";import{$getSelection as Di,$isRangeSelection as Mi,$isTextNode as pu,COMMAND_PRIORITY_LOW as mu,SELECTION_CHANGE_COMMAND as fu}from"lexical";import{useCallback as Ve,useEffect as Ke,useRef as Pi,useState as gu}from"react";import*as Te from"react";import{createPortal as Cu}from"react-dom";function yo(e,t){let o=e.getRangeAt(0),r;if(e.anchorNode===t){let n=t;for(;n.firstElementChild!=null;)n=n.firstElementChild;r=n.getBoundingClientRect()}else r=o.getBoundingClientRect();return r}function bt(e){let{alwaysDisplayOnTop:t=!1,anchorElem:o,anchorFlippedOffset:r=0,floatingElem:n,horizontalOffset:i=5,horizontalPosition:l="left",specialHandlingForCaret:s=!1,targetRect:a,verticalGap:c=10}=e,d=o.parentElement;if(a===null||d==null){n.style.opacity="0",n.style.transform="translate(-10000px, -10000px)";return}let u=n.getBoundingClientRect(),m=o.getBoundingClientRect(),f=d.getBoundingClientRect(),C=a.top-u.height-c,g=a.left-i;l==="center"&&(g=a.left+a.width/2-u.width/2);let x=0;return!t&&C<f.top&&!s&&(x=u.height+a.height+c*2,C+=x),l==="center"?g+u.width>f.right?g=f.right-u.width-i:g<f.left&&(g=f.left+i):g+u.width>f.right&&(g=f.right-u.width-i),g-=m.left,n.style.opacity="1",s&&r!==0?(C-=m.bottom-r+u.height-3,n.style.transform=`translate(${g}px, ${C}px) rotate(180deg)`):(C-=m.top,n.style.transform=`translate(${g}px, ${C}px)`),x}import{jsx as Z,jsxs as Hi}from"react/jsx-runtime";function hu({anchorElem:e,editor:t,item:o}){return o.Component?o?.Component&&Z(o.Component,{anchorElem:e,editor:t,item:o},o.key):Z(Ue,{editor:t,item:o,children:o?.ChildComponent&&Z(o.ChildComponent,{})},o.key)}function xu({anchorElem:e,editor:t,group:o,index:r}){let{editorConfig:n}=G(),[i,l]=Te.useState(null);Te.useEffect(()=>{o?.type==="dropdown"&&o.items.length&&o.ChildComponent?l(()=>o.ChildComponent):l(null)},[o]);let s=({activeItems:a})=>{if(!a.length){o?.type==="dropdown"&&o.items.length&&o.ChildComponent?l(()=>o.ChildComponent):l(null);return}let c=a[0];l(()=>c.ChildComponent)};return Hi("div",{className:`inline-toolbar-popup__group inline-toolbar-popup__group-${o.key}`,children:[o.type==="dropdown"&&o.items.length&&(i?Z(ue,{Icon:i,anchorElem:e,editor:t,groupKey:o.key,items:o.items,maxActiveItems:1,onActiveChange:s}):Z(ue,{anchorElem:e,editor:t,groupKey:o.key,items:o.items,maxActiveItems:1,onActiveChange:s})),o.type==="buttons"&&o.items.length&&o.items.map(a=>Z(hu,{anchorElem:e,editor:t,item:a},a.key)),r<n.features.toolbarInline?.groups.length-1&&Z("div",{className:"divider"})]},o.key)}function bu({anchorElem:e,editor:t}){let o=Pi(null),r=Pi(null),{editorConfig:n}=G(),i=Ve(()=>{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]),l=Ve(c=>{if(o?.current&&(c.buttons===1||c.buttons===3)){let d=o.current.style.opacity==="0",u=o.current.style.pointerEvents==="none";if(!d||!u){let m=c.clientX,f=c.clientY,C=document.elementFromPoint(m,f);o.current.contains(C)||i()}}},[i]),s=Ve(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);Ke(()=>(document.addEventListener("mousemove",l),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",s)}),[o,l,s]);let a=Ve(()=>{let c=Di(),d=window.getSelection();if(o.current===null)return;let u=e.querySelector(":scope > .link-editor"),m=u!==null&&"style"in u&&u?.style?.opacity==="1",f=t.getRootElement();if(c!==null&&d!==null&&!d.isCollapsed&&f!==null&&f.contains(d.anchorNode)){let C=yo(d,f),g=bt({alwaysDisplayOnTop:m,anchorElem:e,floatingElem:o.current,horizontalPosition:"center",targetRect:C});r.current&&bt({anchorElem:o.current,anchorFlippedOffset:g,floatingElem:r.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:C,verticalGap:10})}else i()},[t,i,e]);return Ke(()=>{let c=e.parentElement,d=()=>{t.getEditorState().read(()=>{a()})};return window.addEventListener("resize",d),c&&c.addEventListener("scroll",d),()=>{window.removeEventListener("resize",d),c&&c.removeEventListener("scroll",d)}},[t,a,e]),Ke(()=>(t.getEditorState().read(()=>{a()}),Ai(t.registerUpdateListener(({editorState:c})=>{c.read(()=>{a()})}),t.registerCommand(fu,()=>(a(),!1),mu))),[t,a]),Hi("div",{className:"inline-toolbar-popup",ref:o,children:[Z("div",{className:"caret",ref:r}),t.isEditable()&&Z(Te.Fragment,{children:n?.features&&n.features?.toolbarInline?.groups.map((c,d)=>Z(xu,{anchorElem:e,editor:t,group:c,index:d},c.key))})]})}function Tu(e,t){let[o,r]=gu(!1),n=Ve(()=>{e.getEditorState().read(()=>{if(e.isComposing())return;let i=Di(),l=window.getSelection(),s=e.getRootElement();if(l!==null&&(!Mi(i)||s===null||!s.contains(l.anchorNode))){r(!1);return}if(!Mi(i))return;if(i.getTextContent()!==""){let c=i.getNodes(),d=!1;for(let u of c)if(pu(u)){r(!0),d=!0;break}d||r(!1)}else r(!1);let a=i.getTextContent().replace(/\n/g,"");if(!i.isCollapsed()&&a===""){r(!1);return}})},[e]);return Ke(()=>(document.addEventListener("selectionchange",n),document.addEventListener("mouseup",n),()=>{document.removeEventListener("selectionchange",n),document.removeEventListener("mouseup",n)}),[n]),Ke(()=>Ai(e.registerUpdateListener(()=>{n()}),e.registerRootListener(()=>{e.getRootElement()===null&&r(!1)})),[e,n]),o?Cu(Z(bu,{anchorElem:t,editor:e}),t):null}var Oi=({anchorElem:e})=>{let[t]=uu();return Tu(t,e)};var Eu=E({plugins:[{Component:Oi,position:"floatingAnchorElem"}]});import{TableCellNode as Tp,TableNode as Ep,TableRowNode as yp}from"@lexical/table";import{jsx as Bi}from"react/jsx-runtime";var Lo=()=>Bi("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Bi("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{useLexicalComposerContext as Ui}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Lu}from"@lexical/react/useLexicalEditable";import{$deleteTableColumn__EXPERIMENTAL as Nu,$deleteTableRow__EXPERIMENTAL as ku,$getNodeTriplet as wu,$getTableCellNodeFromLexicalNode as _u,$getTableColumnIndexFromTableCellNode as Ru,$getTableNodeFromLexicalNodeOrThrow as Tt,$getTableRowIndexFromTableCellNode as Su,$insertTableColumn__EXPERIMENTAL as vu,$insertTableRow__EXPERIMENTAL as Iu,$isTableCellNode as je,$isTableRowNode as wo,$isTableSelection as yt,$unmergeCell as Fu,TableCellHeaderStates as Ee,TableCellNode as Mu,getTableObserverFromTableElement as Pu}from"@lexical/table";import{useScrollInfo as Au}from"@payloadcms/ui";import{$createParagraphNode as Du,$getRoot as Ou,$getSelection as Lt,$isElementNode as Hu,$isParagraphNode as Wi,$isRangeSelection as _o,$isTextNode as Bu}from"lexical";import*as Ro from"react";import{useCallback as oe,useEffect as pe,useRef as Et,useState as ye}from"react";import{createPortal as zi}from"react-dom";import{jsx as No,jsxs as yu}from"react/jsx-runtime";var $i=()=>yu("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[No("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"}),No("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"}),No("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"})]});import{jsx as D,jsxs as re}from"react/jsx-runtime";function ko(e){let t=e.getShape();return{columns:t.toX-t.fromX+1,rows:t.toY-t.fromY+1}}function $u(e){let t=e.getNodes(),o=[],r=null,n=null,i=0;for(let l=0;l<t.length;l++){let s=t[l];if(je(s)){let a=s.getParentOrThrow();if(ce(wo(a),"Expected CellNode to have a RowNode parent"),r!==a){if(n!==null&&i!==n)return!1;r!==null&&(n=i),r=a,i=0}let c=s.__colSpan;for(let d=0;d<c;d++)o[i+d]===void 0&&(o[i+d]=0),o[i+d]+=s.__rowSpan;i+=c}}return(n===null||i===n)&&o.every(l=>l===o[0])}function Gu(){let e=Lt();if(_o(e)&&!e.isCollapsed()||yt(e)&&!e.anchor.is(e.focus)||!_o(e)&&!yt(e))return!1;let[t]=wu(e.anchor);return t.__colSpan>1||t.__rowSpan>1}function Gi(e){if(e.getChildrenSize()!==1)return!1;let t=e.getFirstChildOrThrow();return!(!Wi(t)||!t.isEmpty())}function Uu(e){let t=e.getLastDescendant();Bu(t)?t.select():Hu(t)?t.selectEnd():t!==null&&t.selectNext()}function Wu({cellMerge:e,contextRef:t,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[i]=Ui(),l=Et(null),[s,a]=ye(n),[c,d]=ye({columns:1,rows:1}),[u,m]=ye(!1),[f,C]=ye(!1),{y:g}=Au();pe(()=>i.registerMutationListener(Mu,h=>{h.get(s.getKey())==="updated"&&i.getEditorState().read(()=>{a(s.getLatest())})}),[i,s]),pe(()=>{i.getEditorState().read(()=>{let h=Lt();if(yt(h)){let p=ko(h);d(ko(h)),m($u(h)&&(p.columns>1||p.rows>1))}C(Gu())})},[i]),pe(()=>{let h=t.current,p=l.current,_=i.getRootElement();if(h!=null&&p!=null&&_!=null){let k=_.getBoundingClientRect(),y=h.getBoundingClientRect();p.style.opacity="1";let F=p.getBoundingClientRect(),A=5,O=y.right+A;if(O+F.width>window.innerWidth||O+F.width>k.right){let W=y.left-F.width-A;O=(W<0?A:W)+window.pageXOffset}p.style.left=`${O+window.pageXOffset}px`;let U=y.top;if(U+F.height>window.innerHeight){let W=y.bottom-F.height;U=(W<0?A:W)+window.pageYOffset}p.style.top=`${U}px`}},[t,l,i,g]),pe(()=>{function h(p){l.current!=null&&t.current!=null&&!l.current.contains(p.target)&&!t.current.contains(p.target)&&r(!1)}return window.addEventListener("click",h),()=>window.removeEventListener("click",h)},[r,t]);let x=oe(()=>{i.update(()=>{if(s.isAttached()){let p=Tt(s),_=i.getElementByKey(p.getKey());if(!_)throw new Error("Expected to find tableElement in DOM");let k=Pu(_);k!==null&&k.clearHighlight(),p.markDirty(),a(s.getLatest())}Ou().selectStart()})},[i,s]),b=()=>{i.update(()=>{let h=Lt();if(yt(h)){let{columns:p,rows:_}=ko(h),k=h.getNodes(),y=null;for(let F=0;F<k.length;F++){let A=k[F];if(je(A))if(y===null){A.setColSpan(p).setRowSpan(_),y=A;let O=Gi(A),U;O&&Wi(U=A.getFirstChild())&&U.remove()}else je(y)&&(Gi(A)||y.append(...A.getChildren()),A.remove())}y!==null&&(y.getChildrenSize()===0&&y.append(Du()),Uu(y)),o()}})},S=()=>{i.update(()=>{Fu()})},I=oe(h=>{i.update(()=>{Iu(h),o()})},[i,o]),T=oe(h=>{i.update(()=>{for(let p=0;p<c.columns;p++)vu(h);o()})},[i,o,c.columns]),R=oe(()=>{i.update(()=>{ku(),o()})},[i,o]),v=oe(()=>{i.update(()=>{Tt(s).remove(),x(),o()})},[i,s,x,o]),M=oe(()=>{i.update(()=>{Nu(),o()})},[i,o]),P=oe(()=>{i.update(()=>{let h=Tt(s),p=Su(s),_=h.getChildren();if(p>=_.length||p<0)throw new Error("Expected table cell to be inside of table row.");let k=_[p];if(!wo(k))throw new Error("Expected table row");k.getChildren().forEach(y=>{if(!je(y))throw new Error("Expected table cell");y.toggleHeaderStyle(Ee.ROW)}),x(),o()})},[i,s,x,o]),L=oe(()=>{i.update(()=>{let h=Tt(s),p=Ru(s),_=h.getChildren(),k=Math.max(..._.map(y=>y.getChildren().length));if(p>=k||p<0)throw new Error("Expected table cell to be inside of table row.");for(let y=0;y<_.length;y++){let F=_[y];if(!wo(F))throw new Error("Expected table row");let A=F.getChildren();if(p>=A.length)continue;let O=A[p];if(!je(O))throw new Error("Expected table cell");O.toggleHeaderStyle(Ee.COLUMN)}x(),o()})},[i,s,x,o]),N=null;return e&&(u?N=D("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>b(),type:"button",children:"Merge cells"}):f&&(N=D("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>S(),type:"button",children:"Unmerge cells"}))),zi(re("div",{className:"table-action-menu-dropdown",onClick:h=>{h.stopPropagation()},ref:l,children:[N?re(Ro.Fragment,{children:[N,D("hr",{})]}):null,D("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>I(!1),type:"button",children:re("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," above"]})}),D("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>I(!0),type:"button",children:re("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," below"]})}),D("hr",{}),D("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>T(!1),type:"button",children:re("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","left"]})}),D("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>T(!0),type:"button",children:re("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","right"]})}),D("hr",{}),D("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>M(),type:"button",children:D("span",{className:"text",children:"Delete column"})}),D("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>R(),type:"button",children:D("span",{className:"text",children:"Delete row"})}),D("button",{className:"item","data-test-id":"table-delete",onClick:()=>v(),type:"button",children:D("span",{className:"text",children:"Delete table"})}),D("hr",{}),D("button",{className:"item",onClick:()=>P(),type:"button",children:re("span",{className:"text",children:[(s.__headerState&Ee.ROW)===Ee.ROW?"Remove":"Add"," ","row header"]})}),D("button",{className:"item","data-test-id":"table-column-header",onClick:()=>L(),type:"button",children:re("span",{className:"text",children:[(s.__headerState&Ee.COLUMN)===Ee.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function zu({anchorElem:e,cellMerge:t}){let[o]=Ui(),r=Et(null),n=Et(null),[i,l]=ye(!1),[s,a]=ye(null),c=oe(()=>{let u=r.current,m=Lt(),f=window.getSelection(),C=document.activeElement;if(m==null||u==null){a(null);return}let g=o.getRootElement();if(_o(m)&&g!==null&&f!==null&&g.contains(f.anchorNode)){let x=_u(m.anchor.getNode());if(x==null){a(null);return}if(o.getElementByKey(x.getKey())==null){a(null);return}a(x)}else C||a(null)},[o]);pe(()=>o.registerUpdateListener(()=>{o.getEditorState().read(()=>{c()})})),pe(()=>{let u=r.current;if(u!=null&&s!=null){let m=o.getElementByKey(s.getKey());if(m!=null){let f=m.getBoundingClientRect(),C=u.getBoundingClientRect(),g=e.getBoundingClientRect(),x=f.top-g.top+4,b=f.right-C.width-10-g.left;u.style.opacity="1",u.style.transform=`translate(${b}px, ${x}px)`}else u.style.opacity="0",u.style.transform="translate(-10000px, -10000px)"}},[r,s,o,e]);let d=Et(s);return pe(()=>{d.current!==s&&l(!1),d.current=s},[d,s]),D("div",{className:"table-cell-action-button-container",ref:r,children:s!=null&&re(Ro.Fragment,{children:[D("button",{className:"table-cell-action-button",onClick:u=>{u.stopPropagation(),l(!i)},ref:n,type:"button",children:D($i,{})}),i&&D(Wu,{cellMerge:t,contextRef:n,onClose:()=>l(!1),setIsMenuOpen:l,tableCellNode:s})]})})}var Vi=({anchorElem:e})=>{let t=Lu();return zi(t?D(zu,{anchorElem:e??document.body,cellMerge:!0}):null,e??document.body)};import{useLexicalComposerContext as Vu}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Ku}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as ju,$getTableNodeFromLexicalNodeOrThrow as So,$getTableRowIndexFromTableCellNode as Zu,$isTableCellNode as Ki,$isTableRowNode as Xu,getDOMCellFromTarget as Ju}from"@lexical/table";import{calculateZoomLevel as ji}from"@lexical/utils";import{$getNearestNodeFromDOMNode as vo}from"lexical";import*as Zi from"react";import{useCallback as Le,useEffect as Yu,useMemo as qu,useRef as Nt,useState as kt}from"react";import{createPortal as Qu}from"react-dom";import{jsx as wt,jsxs as rp}from"react/jsx-runtime";var ep=33,tp=50;function op({editor:e}){let t=Nt(null),o=Nt(null),r=Nt(null),n=Nt(null),[i,l]=kt(null),[s,a]=kt(null),[c,d]=kt(!1),[u,m]=kt(null),f=Le(()=>{a(null),t.current=null,m(null),n.current=null,r.current=null},[]),C=L=>(L.buttons&1)===1;Yu(()=>{let L=p=>{setTimeout(()=>{let _=p.target;if(u){l({x:p.clientX,y:p.clientY});return}if(d(C(p)),!(o.current&&o.current.contains(_))&&t.current!==_){t.current=_;let k=Ju(_);k&&s!==k?e.update(()=>{let y=vo(k.elem);if(!y)throw new Error("TableCellResizer: Table cell node not found.");let F=So(y),A=e.getElementByKey(F.getKey());if(!A)throw new Error("TableCellResizer: Table element not found.");t.current=_,r.current=A.getBoundingClientRect(),a(k)}):k==null&&f()}},0)},N=p=>{setTimeout(()=>{d(!0)},0)},h=p=>{setTimeout(()=>{d(!1)},0)};return document.addEventListener("mousemove",L),document.addEventListener("mousedown",N),document.addEventListener("mouseup",h),()=>{document.removeEventListener("mousemove",L),document.removeEventListener("mousedown",N),document.removeEventListener("mouseup",h)}},[s,u,e,f]);let g=L=>L==="bottom",x=Le(L=>{if(!s)throw new Error("TableCellResizer: Expected active cell.");e.update(()=>{let N=vo(s.elem);if(!Ki(N))throw new Error("TableCellResizer: Table cell node not found.");let h=So(N),p=Zu(N),_=h.getChildren();if(p>=_.length||p<0)throw new Error("Expected table cell to be inside of table row.");let k=_[p];if(!Xu(k))throw new Error("Expected table row");let y=k.getHeight();if(y===void 0){let A=k.getChildren();y=Math.min(...A.map(O=>S(O,e)??1/0))}let F=Math.max(y+L,ep);k.setHeight(F)},{tag:"skip-scroll-into-view"})},[s,e]),b=(L,N)=>{let h=L.getWidth();if(h!==void 0)return h;let p=N.getElementByKey(L.getKey());if(p==null)return;let _=getComputedStyle(p);return p.clientWidth-parseFloat(_.paddingLeft)-parseFloat(_.paddingRight)},S=(L,N)=>N.getElementByKey(L.getKey())?.clientHeight,I=(L,N)=>{for(let h=0;h<N.length;h++)for(let p=0;p<N[h].length;p++)if(N[h][p].cell===L)return p},T=Le(L=>{if(!s)throw new Error("TableCellResizer: Expected active cell.");e.update(()=>{let N=vo(s.elem);if(!Ki(N))throw new Error("TableCellResizer: Table cell node not found.");let h=So(N),[p]=ju(h,null,null),_=I(N,p);if(_===void 0)throw new Error("TableCellResizer: Table column not found.");for(let k=0;k<p.length;k++){let y=p[k][_];if(y.startRow===k&&(_===p[k].length-1||p[k][_].cell!==p[k][_+1].cell)){let F=b(y.cell,e);if(F===void 0)continue;let A=Math.max(F+L,tp);y.cell.setWidth(A)}}},{tag:"skip-scroll-into-view"})},[s,e]),R=Le(L=>{let N=h=>{if(h.preventDefault(),h.stopPropagation(),!s)throw new Error("TableCellResizer: Expected active cell.");if(n.current){let{x:p,y:_}=n.current;if(s===null)return;let k=ji(h.target);if(g(L)){let y=(h.clientY-_)/k;x(y)}else{let y=(h.clientX-p)/k;T(y)}f(),document.removeEventListener("mouseup",N)}};return N},[s,f,T,x]),v=Le(L=>N=>{if(N.preventDefault(),N.stopPropagation(),!s)throw new Error("TableCellResizer: Expected active cell.");n.current={x:N.clientX,y:N.clientY},l(n.current),m(L),document.addEventListener("mouseup",R(L))},[s,R]),P=Le(()=>{if(s){let{height:L,left:N,top:h,width:p}=s.elem.getBoundingClientRect(),_=ji(s.elem),k=10,y={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${k}px`,left:`${window.pageXOffset+N}px`,top:`${window.pageYOffset+h+L-k/2}px`,width:`${p}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${L}px`,left:`${window.pageXOffset+N+p-k/2}px`,top:`${window.pageYOffset+h}px`,width:`${k}px`}},F=r.current;return u&&i&&F&&(g(u)?(y[u].left=`${window.pageXOffset+F.left}px`,y[u].top=`${window.pageYOffset+i.y/_}px`,y[u].height="3px",y[u].width=`${F.width}px`):(y[u].top=`${window.pageYOffset+F.top}px`,y[u].left=`${window.pageXOffset+i.x/_}px`,y[u].width="3px",y[u].height=`${F.height}px`),y[u].backgroundColor="#adf"),y}return{bottom:null,left:null,right:null,top:null}},[s,u,i])();return wt("div",{ref:o,children:s!=null&&!c&&rp(Zi.Fragment,{children:[wt("div",{className:"TableCellResizer__resizer TableCellResizer__ui",onMouseDown:v("right"),style:P.right||void 0}),wt("div",{className:"TableCellResizer__resizer TableCellResizer__ui",onMouseDown:v("bottom"),style:P.bottom||void 0})]})})}var Xi=()=>{let[e]=Vu(),t=Ku();return qu(()=>t?Qu(wt(op,{editor:e}),document.body):null,[e,t])};import{useLexicalComposerContext as np}from"@lexical/react/LexicalComposerContext";import{TablePlugin as ip}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as lp,TableNode as sp}from"@lexical/table";import{mergeRegister as ap}from"@lexical/utils";import{useModal as cp}from"@payloadcms/ui";import{$getSelection as dp,$isRangeSelection as up,COMMAND_PRIORITY_EDITOR as pp,createCommand as mp}from"lexical";import{createContext as fp,useContext as gp,useEffect as Cp,useMemo as hp,useState as xp}from"react";import*as Ji from"react";import{jsx as Fo,jsxs as bp}from"react/jsx-runtime";var _t=mp("OPEN_EMBED_DRAWER_COMMAND"),Yi=fp({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}}),Io="lexical-table-create";function qi({children:e}){let[t,o]=xp({cellEditorConfig:null,cellEditorPlugins:null});return Fo(Yi.Provider,{value:hp(()=>({cellEditorConfig:t.cellEditorConfig,cellEditorPlugins:t.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[t.cellEditorConfig,t.cellEditorPlugins]),children:e})}var Qi=()=>{let[e]=np(),t=gp(Yi),{closeModal:o,toggleModal:r}=cp();return Cp(()=>(e.hasNodes([sp])||ce(!1,"TablePlugin: TableNode is not registered on editor"),ap(e.registerCommand(_t,()=>{let n=null;return e.getEditorState().read(()=>{let i=dp();up(i)&&(n=i)}),n&&r(Io),!0},pp))),[t,e,r]),bp(Ji.Fragment,{children:[Fo(le,{drawerSlug:Io,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:(n,i)=>{o(Io),!(!i.columns||!i.rows)&&e.dispatchCommand(lp,{columns:String(i.columns),rows:String(i.rows)})},schemaPathSuffix:"fields"}),Fo(ip,{hasCellBackgroundColor:!1,hasCellMerge:!0})]})};var Lp=E({nodes:[Ep,Tp,yp],plugins:[{Component:Qi,position:"normal"},{Component:Xi,position:"normal"},{Component:Vi,position:"floatingAnchorElem"}],providers:[qi],slashMenu:{groups:[B([{Icon:Lo,key:"table",keywords:["table"],label:"Table",onSelect:({editor:e})=>{e.dispatchCommand(_t,{})}}])]},toolbarFixed:{groups:[Y([{ChildComponent:Lo,key:"table",label:"Table",onSelect:({editor:e})=>{e.dispatchCommand(_t,{})}}])]}});import{$isNodeSelection as Vp}from"lexical";import{jsx as Mo,jsxs as Np}from"react/jsx-runtime";var Po=()=>Np("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:[Mo("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"}),Mo("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"}),Mo("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{useLexicalComposerContext as Pp}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Ap,mergeRegister as Dp}from"@lexical/utils";import{useConfig as Op}from"@payloadcms/ui";import{$getPreviousSelection as Hp,$getSelection as Bp,$isParagraphNode as tl,$isRangeSelection as $p,COMMAND_PRIORITY_EDITOR as Gp,createCommand as Up}from"lexical";import{useEffect as Wp}from"react";import{useLexicalComposerContext as kp}from"@lexical/react/LexicalComposerContext.js";import{useListDrawer as wp}from"@payloadcms/ui";import{$getNodeByKey as _p,COMMAND_PRIORITY_EDITOR as Rp}from"lexical";import{useCallback as Sp,useEffect as vp,useState as Ip}from"react";import{jsx as Ao}from"react/jsx-runtime";var Fp=({editor:e,relationTo:t,replaceNodeKey:o,value:r})=>{o?e.update(()=>{let n=_p(o);n&&n.replace(Fe({data:{fields:null,relationTo:t,value:r}}))}):e.dispatchCommand(Do,{fields:null,relationTo:t,value:r})},Mp=({enabledCollectionSlugs:e})=>{let[t]=kp(),[o,r]=Ip(null),[n,i,{closeDrawer:l,openDrawer:s}]=wp({collectionSlugs:e,uploads:!0});vp(()=>t.registerCommand(ve,c=>(r(c?.replace?c?.replace.nodeKey:null),s(),!0),Rp),[t,s]);let a=Sp(({collectionSlug:c,docID:d})=>{Fp({editor:t,relationTo:c,replaceNodeKey:o,value:d}),l()},[t,l,o]);return Ao(n,{onSelect:a})},el=e=>Ao(Ye,{...e,uploads:!0,children:Ao(Mp,{...e})});import{jsx as zp}from"react/jsx-runtime";var Do=Up("INSERT_UPLOAD_COMMAND"),ol=({clientProps:e})=>{let[t]=Pp(),{collections:o}=Op();return Wp(()=>{if(!t.hasNodes([Ie]))throw new Error("UploadPlugin: UploadNode not registered on editor");return Dp(t.registerCommand(Do,r=>(t.update(()=>{let n=Bp()||Hp();if($p(n)){let i=Fe({data:{id:r.id,fields:r.fields,relationTo:r.relationTo,value:r.value}});Ap(i);let{focus:l}=n,s=l.getNode();tl(s)&&s.getTextContentSize()===0&&s.getParent().getChildren().filter(a=>tl(a)).length>1&&s.remove()}}),!0),Gp))},[t]),zp(el,{enabledCollectionSlugs:o.map(({slug:r})=>r)})};var Kp=E({nodes:[Ie],plugins:[{Component:ol,position:"normal"}],slashMenu:{groups:[B([{Icon:Po,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:e})=>e.t("lexical:upload:label"),onSelect:({editor:e})=>{e.dispatchCommand(ve,{replace:!1})}}])]},toolbarFixed:{groups:[Y([{ChildComponent:Po,isActive:({selection:e})=>{if(!Vp(e)||!e.getNodes().length)return!1;let t=e.getNodes()[0];return Pt(t)},key:"upload",label:({i18n:e})=>e.t("lexical:upload:label"),onSelect:({editor:e})=>{e.dispatchCommand(ve,{replace:!1})}}])]}});import{ShimmerEffect as jp,useClientFunctions as Zp,useFieldProps as Xp}from"@payloadcms/ui";import rl,{Suspense as Jp,lazy as Yp,useEffect as qp,useState as Oo}from"react";import{jsx as Rt,jsxs as tm}from"react/jsx-runtime";var Qp=Yp(()=>import("./Field-YNHIDK3D.js").then(e=>({default:e.RichText}))),em=e=>{let{admin:t,lexicalEditorConfig:o,richTextComponentMap:r}=e,{schemaPath:n}=Xp(),i=Zp(),[l,s]=Oo(!1),[a,c]=Oo([]),[d,u]=Oo(null),m=r.get("features");m=m.sort((C,g)=>C.order-g.order);let f=0;for(let C of m){let g=Array.from(r.keys()).filter(x=>x.startsWith(`lexical_internal_feature.${C.key}.lexical_internal_components.`));f+=1,f+=g.length}return qp(()=>{if(!l){let C=[],g=0;if(Object.entries(i).forEach(([x,b])=>{x.startsWith(`lexicalFeature.${n}.`)&&(x.includes(".lexical_internal_components.")||C.push(b),g++)}),g===f){c(C),s(!0);let x=qe({clientFunctions:i,schemaPath:n,unSanitizedEditorConfig:{features:C,lexical:o}});u(Pe(o||Me,x,t))}}},[t,l,i,n,m.length,a,d,o,f]),l?Rt(Jp,{fallback:Rt(jp,{height:"35vh"}),children:d&&Rt(Qp,{...e,editorConfig:d})}):Rt(rl.Fragment,{children:Array.isArray(m)&&m.map(C=>{let x=Array.from(r.keys()).filter(b=>b.startsWith(`lexical_internal_feature.${C.key}.lexical_internal_components.`)).map(b=>r.get(b));return tm(rl.Fragment,{children:[x?.length?x.map(b=>b):null,C.ClientFeature]},C.key)})})};function om(...e){return e.filter(Boolean).join(" ")}var St=new WeakMap;function nl(e){let t=e.changedTouches[0];return t===void 0?null:[t.clientX,t.clientY]}function vt(e,t){let o=St.get(e);if(o===void 0){let r=new Set,n=l=>{o!==void 0&&(o.start=nl(l))},i=l=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let a=nl(l);for(let c of r)a!==null&&c([a[0]-s[0],a[1]-s[1]],l)};e.addEventListener("touchstart",n),e.addEventListener("touchend",i),o={handleTouchend:i,handleTouchstart:n,listeners:r,start:null},St.set(e,o)}return o.listeners.add(t),()=>{rm(e,t)}}function rm(e,t){let o=St.get(e);if(o===void 0)return;let{listeners:r}=o;r.delete(t),r.size===0&&(St.delete(e),e.removeEventListener("touchstart",o.handleTouchstart),e.removeEventListener("touchend",o.handleTouchend))}function nm(e,t){return vt(e,(o,r)=>{let[n,i]=o;n<0&&-n>Math.abs(i)&&t(n,r)})}function im(e,t){return vt(e,(o,r)=>{let[n,i]=o;n>0&&n>Math.abs(i)&&t(n,r)})}function lm(e,t){return vt(e,(o,r)=>{let[n,i]=o;i<0&&-i>Math.abs(n)&&t(n,r)})}function sm(e,t){return vt(e,(o,r)=>{let[n,i]=o;i>0&&i>Math.abs(n)&&t(n,r)})}export{De as $createAutoLinkNode,nt as $createBlockNode,q as $createLinkNode,Se as $createRelationshipNode,Fe as $createUploadNode,ee as $isAutoLinkNode,Ol as $isBlockNode,H as $isLinkNode,Mt as $isRelationshipNode,Pt as $isUploadNode,Nl as AlignFeatureClient,Q as AutoLinkNode,J as BlockNode,vl as BlockquoteFeatureClient,Ql as BlocksFeatureClient,bs as BoldFeatureClient,K as CAN_USE_DOM,Ic as ChecklistFeatureClient,sd as DETAIL_TYPE_TO_DETAIL,rd as DOUBLE_LINE_BREAK,cd as ELEMENT_FORMAT_TO_TYPE,ad as ELEMENT_TYPE_TO_FORMAT,ll as ENABLE_SLASH_MENU_COMMAND,il as EditorConfigProvider,le as FieldsDrawer,du as FixedToolbarFeatureClient,Xs as HeadingFeatureClient,na as HorizontalRuleFeatureClient,td as IS_ALL_FORMATTING,ca as IndentFeatureClient,Ls as InlineCodeFeatureClient,Eu as InlineToolbarFeatureClient,ws as ItalicFeatureClient,id as LTR_REGEX,ed as LexicalPluginToLexicalFeatureClient,Cc as LinkFeatureClient,V as LinkNode,od as NON_BREAKING_SPACE,w as NodeFormat,Bc as OrderedListFeatureClient,Ed as ParagraphFeatureClient,al as Point,nd as RTL_REGEX,dl as Rect,$d as RelationshipFeatureClient,Re as RelationshipNode,gl as RichTextCell,em as RichTextField,bd as SlateToLexicalFeatureClient,vs as StrikethroughFeatureClient,Ms as SubscriptFeatureClient,Ds as SuperscriptFeatureClient,dd as TEXT_MODE_TO_TYPE,ld as TEXT_TYPE_TO_FORMAT,ud as TEXT_TYPE_TO_MODE,X as TOGGLE_LINK_COMMAND,Lp as TableFeatureClient,ps as TestRecorderFeatureClient,Ue as ToolbarButton,ue as ToolbarDropdown,Cs as TreeViewFeatureClient,$s as UnderlineFeatureClient,jc as UnorderedListFeatureClient,Kp as UploadFeatureClient,Ie as UploadNode,sm as addSwipeDownListener,nm as addSwipeLeftListener,im as addSwipeRightListener,lm as addSwipeUpListener,Xt as createBlockNode,Gt as createClientComponent,E as createClientFeature,Me as defaultEditorLexicalConfig,yo as getDOMRangeRect,It as getEnabledNodes,me as getSelectedNode,ce as invariant,sl as isHTMLElement,cl as isPoint,om as joinClasses,Pe as sanitizeClientEditorConfig,Go as sanitizeClientFeatures,bt as setFloatingElemPosition,mt as setFloatingElemPositionForLinkEditor,B as slashMenuBasicGroupWithItems,Y as toolbarAddDropdownGroupWithItems,Yt as toolbarFeatureButtonsGroupWithItems,$ as toolbarFormatGroupWithItems,z as toolbarTextDropdownGroupWithItems,G as useEditorConfigContext};
|
|
37
|
+
`,ui="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",pi="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",fd=new RegExp("^[^"+pi+"]*["+ui+"]"),gd=new RegExp("^[^"+ui+"]*["+pi+"]"),Cd={bold:v.IS_BOLD,code:v.IS_CODE,highlight:v.IS_HIGHLIGHT,italic:v.IS_ITALIC,strikethrough:v.IS_STRIKETHROUGH,subscript:v.IS_SUBSCRIPT,superscript:v.IS_SUPERSCRIPT,underline:v.IS_UNDERLINE},hd={directionless:v.IS_DIRECTIONLESS,unmergeable:v.IS_UNMERGEABLE},bd={center:v.IS_ALIGN_CENTER,end:v.IS_ALIGN_END,justify:v.IS_ALIGN_JUSTIFY,left:v.IS_ALIGN_LEFT,right:v.IS_ALIGN_RIGHT,start:v.IS_ALIGN_START},xd={[v.IS_ALIGN_CENTER]:"center",[v.IS_ALIGN_END]:"end",[v.IS_ALIGN_JUSTIFY]:"justify",[v.IS_ALIGN_LEFT]:"left",[v.IS_ALIGN_RIGHT]:"right",[v.IS_ALIGN_START]:"start"},Td={normal:v.IS_NORMAL,segmented:v.IS_SEGMENTED,token:v.IS_TOKEN},Ed={[v.IS_NORMAL]:"normal",[v.IS_SEGMENTED]:"segmented",[v.IS_TOKEN]:"token"};function fi({converters:e,slateData:t}){return{root:{type:"root",children:gi({canContainParagraphs:!0,converters:e,parentNodeType:"root",slateNodes:t}),direction:"ltr",format:"",indent:0,version:1}}}function gi({canContainParagraphs:e,converters:t,parentNodeType:o,slateNodes:r}){if(!t?.length)return[];let n=t.find(i=>i.nodeTypes.includes("unknown"));return r.map((i,l)=>{if(!("type"in i))return e?mi(t,i):yd(i);if(i.type==="p")return mi(t,i);let a=t.find(s=>s.nodeTypes.includes(i.type));return a?a.converter({childIndex:l,converters:t,parentNodeType:o,slateNode:i}):(console.warn("slateToLexical > No converter found for node type: "+i.type),n?.converter({childIndex:l,converters:t,parentNodeType:o,slateNode:i}))})||[]}function mi(e,t){return{type:"paragraph",children:gi({canContainParagraphs:!1,converters:e,parentNodeType:"paragraph",slateNodes:t.children||[]}),direction:"ltr",format:"",indent:0,textFormat:0,textStyle:"",version:1}}function yd(e){return{type:"text",detail:0,format:Ld(e),mode:"normal",style:"",text:e.text,version:1}}function Ld(e){let t=0;return e.bold&&(t=t|v.IS_BOLD),e.italic&&(t=t|v.IS_ITALIC),e.strikethrough&&(t=t|v.IS_STRIKETHROUGH),e.underline&&(t=t|v.IS_UNDERLINE),e.subscript&&(t=t|v.IS_SUBSCRIPT),e.superscript&&(t=t|v.IS_SUPERSCRIPT),e.code&&(t=t|v.IS_CODE),t}import{addClassNamesToElement as Nd}from"@lexical/utils";import{DecoratorNode as kd}from"lexical";import*as Ci from"react";import{jsx as _d}from"react/jsx-runtime";var wd=Ci.lazy(()=>import("./Component-LAKSCIDX.js").then(e=>({default:e.UnknownConvertedNodeComponent}))),Be=class e extends kd{__data;constructor({data:t,key:o}){super(o),this.__data=t}static clone(t){return new e({data:t.__data,key:t.__key})}static getType(){return"unknownConverted"}static importJSON(t){return Rd({data:t.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(t){let o=document.createElement("span");return Nd(o,"unknownConverted"),o}decorate(){return _d(wd,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(t,o){return!1}};function Rd({data:e}){return new Be({data:e})}var Sd=L(({clientFunctions:e})=>{let t=Object.values(e);return{hooks:{load({incomingEditorState:o}){return!o||!Array.isArray(o)||"root"in o?o:fi({converters:t,slateData:o})}},nodes:[Be]}});import{$setBlocksType as xi}from"@lexical/selection";import{$createParagraphNode as Ti,$getSelection as Ei,$isParagraphNode as hi,$isRangeSelection as vd}from"lexical";var bi=[z([{ChildComponent:Ae,isActive:({selection:e})=>{if(!vd(e))return!1;for(let t of e.getNodes())if(!hi(t)&&!hi(t.getParent()))return!1;return!0},key:"paragraph",label:({i18n:e})=>e.t("lexical:paragraph:label2"),onSelect:({editor:e})=>{e.update(()=>{let t=Ei();xi(t,()=>Ti())})},order:1}])],Id=L({slashMenu:{groups:[G([{Icon:Ae,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:e})=>e.t("lexical:paragraph:label"),onSelect:({editor:e})=>{e.update(()=>{let t=Ei();xi(t,()=>Ti())})}}])]},toolbarFixed:{groups:bi},toolbarInline:{groups:bi}});import{$isNodeSelection as Zd}from"lexical";import{jsx as Ge,jsxs as Fd}from"react/jsx-runtime";var go=()=>Fd("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:[Ge("g",{clipPath:"url(#clip0_4397_10817)",children:Ge("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"})}),Ge("defs",{children:Ge("clipPath",{id:"clip0_4397_10817",children:Ge("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{useLexicalComposerContext as $d}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Bd}from"@lexical/utils";import{useConfig as Gd}from"@payloadcms/ui";import{$getPreviousSelection as Ud,$getSelection as Wd,$isParagraphNode as wi,$isRangeSelection as zd,COMMAND_PRIORITY_EDITOR as Vd,createCommand as Kd}from"lexical";import{useEffect as jd}from"react";import{useLexicalComposerContext as Md}from"@lexical/react/LexicalComposerContext.js";import{useListDrawer as Pd}from"@payloadcms/ui";import{$getNodeByKey as Ad,COMMAND_PRIORITY_EDITOR as Dd}from"lexical";import{useCallback as Od,useEffect as yi,useState as Li}from"react";import{jsx as gt}from"react/jsx-runtime";var Hd=({editor:e,relationTo:t,replaceNodeKey:o,value:r})=>{o?e.update(()=>{let n=Ad(o);n&&n.replace(Se({relationTo:t,value:r}))}):e.dispatchCommand(Co,{relationTo:t,value:r})},Ni=({enabledCollectionSlugs:e})=>{let[t]=Md(),[o,r]=Li(()=>e[0]),[n,i]=Li(null),[l,a,{closeDrawer:s,isDrawerOpen:c,openDrawer:d}]=Pd({collectionSlugs:e,selectedCollection:o});yi(()=>t.registerCommand(Re,u=>(i(u?.replace?u?.replace.nodeKey:null),d(),!0),Dd),[t,d]);let p=Od(({collectionSlug:u,docID:m})=>{Hd({editor:t,relationTo:u,replaceNodeKey:n,value:m}),s()},[t,s,n]);return yi(()=>{r(e[0])},[c,e]),gt(l,{onSelect:p})},ki=e=>e?.enabledCollectionSlugs?.length>0?gt(Ni,{...e}):gt(Ye,{...e,children:gt(Ni,{...e})});import{jsx as Xd}from"react/jsx-runtime";var Co=Kd("INSERT_RELATIONSHIP_COMMAND"),Ri=({clientProps:e})=>{let[t]=$d(),{collections:o}=Gd(),r=null;return e?.enabledCollections?r=e?.enabledCollections:e?.disabledCollections&&(r=o.filter(({slug:n})=>!e?.disabledCollections?.includes(n)).map(({slug:n})=>n)),jd(()=>{if(!t.hasNodes([_e]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return t.registerCommand(Co,n=>{let i=Wd()||Ud();if(zd(i)){let l=Se(n);Bd(l);let{focus:a}=i,s=a.getNode();wi(s)&&s.getTextContentSize()===0&&s.getParent().getChildren().filter(c=>wi(c)).length>1&&s.remove()}return!0},Vd)},[t]),Xd(ki,{enabledCollectionSlugs:r})};var Jd=L({nodes:[_e],plugins:[{Component:Ri,position:"normal"}],slashMenu:{groups:[G([{Icon:go,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:e})=>e.t("lexical:relationship:label"),onSelect:({editor:e})=>{e.dispatchCommand(Re,{replace:!1})}}])]},toolbarFixed:{groups:[Y([{ChildComponent:go,isActive:({selection:e})=>{if(!Zd(e)||!e.getNodes().length)return!1;let t=e.getNodes()[0];return Pt(t)},key:"relationship",label:({i18n:e})=>e.t("lexical:relationship:label"),onSelect:({editor:e})=>{e.dispatchCommand(Re,{replace:!1})}}])]}});import{useLexicalComposerContext as uu}from"@lexical/react/LexicalComposerContext.js";import{useScrollInfo as pu,useThrottledEffect as mu,useTranslation as fu}from"@payloadcms/ui";import*as te from"react";import{useMemo as gu}from"react";import{mergeRegister as Yd}from"@lexical/utils";import{$getSelection as qd}from"lexical";import{useCallback as Qd,useEffect as Ct,useState as ho}from"react";import{jsx as eu}from"react/jsx-runtime";var bo="toolbar-popup__button",Ue=({children:e,editor:t,item:o})=>{let[r,n]=ho(!0),[i,l]=ho(!1),[a,s]=ho(bo),c=$(),d=Qd(()=>{t.getEditorState().read(()=>{let p=qd();if(o.isActive){let u=o.isActive({editor:t,editorConfigContext:c,selection:p});i!==u&&l(u)}if(o.isEnabled){let u=o.isEnabled({editor:t,editorConfigContext:c,selection:p});r!==u&&n(u)}})},[i,t,c,r,o]);return Ct(()=>{d()},[d]),Ct(()=>(document.addEventListener("mouseup",d),()=>{document.removeEventListener("mouseup",d)}),[d]),Ct(()=>Yd(t.registerUpdateListener(()=>{d()})),[t,d]),Ct(()=>{s([bo,r===!1?"disabled":"",i?"active":"",o?.key?`${bo}-`+o.key:""].filter(Boolean).join(" "))},[r,i,a,o.key]),eu("button",{className:a,onClick:()=>{if(r!==!1)return t._updateTags=new Set([...t._updateTags,"toolbar"]),t.focus(()=>{o.onSelect({editor:t,isActive:i})}),!0},onMouseDown:p=>{p.preventDefault()},type:"button",children:e})};import Fi,{useCallback as iu,useEffect as Eo}from"react";import{mergeRegister as lu}from"@lexical/utils";import{useTranslation as su}from"@payloadcms/ui";import{$getSelection as au}from"lexical";import ht,{useCallback as tu,useEffect as We,useMemo as ou,useRef as To,useState as bt}from"react";import{createPortal as ru}from"react-dom";import{jsx as ie,jsxs as _i}from"react/jsx-runtime";var xo="toolbar-popup__dropdown-item",Si=ht.createContext(null);function vi({active:e,children:t,editor:o,enabled:r,item:n,title:i}){let[l,a]=bt(xo);We(()=>{a([xo,r===!1?"disabled":"",e?"active":"",n?.key?`${xo}-${n.key}`:""].filter(Boolean).join(" "))},[r,e,l,n.key]);let s=To(null),c=ht.useContext(Si);if(c===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:d}=c;return We(()=>{s?.current!=null&&d(s)},[s,d]),ie("button",{className:l,onClick:()=>{r!==!1&&(o._updateTags=new Set([...o._updateTags,"toolbar"]),o.focus(()=>{n.onSelect({editor:o,isActive:e})}))},onMouseDown:p=>{p.preventDefault()},ref:s,title:i,type:"button",children:t})}function nu({children:e,dropDownRef:t,itemsContainerClassNames:o,onClose:r}){let[n,i]=bt(),[l,a]=bt(),s=tu(p=>{i(u=>u!=null?[...u,p]:[p])},[i]),c=p=>{if(n==null)return;let{key:u}=p;["ArrowDown","ArrowUp","Escape","Tab"].includes(u)&&p.preventDefault(),u==="Escape"||u==="Tab"?r():u==="ArrowUp"?a(m=>{if(m==null)return n[0];let g=n.indexOf(m)-1;return n[g===-1?n.length-1:g]}):u==="ArrowDown"&&a(m=>m==null?n[0]:n[n.indexOf(m)+1])},d=ou(()=>({registerItem:s}),[s]);return We(()=>{n!=null&&l==null&&a(n[0]),l!=null&&l?.current!=null&&l.current.focus()},[n,l]),ie(Si.Provider,{value:d,children:ie("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:c,ref:t,children:e})})}function Ii({Icon:e,buttonAriaLabel:t,buttonClassName:o,children:r,disabled:n=!1,itemsContainerClassNames:i,label:l,stopCloseOnClickSelf:a}){let s=To(null),c=To(null),[d,p]=bt(!1),u=()=>{p(!1),c?.current!=null&&c.current.focus()};We(()=>{let g=c.current,f=s.current;if(d&&g!==null&&f!==null){let{left:x,top:h}=g.getBoundingClientRect(),I=window.scrollY||document.documentElement.scrollTop;f.style.top=`${h+I+g.offsetHeight+5}px`,f.style.left=`${Math.min(x-5,window.innerWidth-f.offsetWidth-20)}px`}},[s,c,d]),We(()=>{let g=c.current;if(g!==null&&d){let f=x=>{let{target:h}=x;a!=null&&s.current!=null&&s.current.contains(h)||g.contains(h)||p(!1)};return document.addEventListener("click",f),()=>{document.removeEventListener("click",f)}}},[s,c,d,a]);let m=ru(ie(nu,{dropDownRef:s,itemsContainerClassNames:i,onClose:u,children:r}),document.body);return _i(ht.Fragment,{children:[_i("button",{"aria-label":t,className:o+(d?" active":""),disabled:n,onClick:g=>{g.preventDefault(),p(!d)},onMouseDown:g=>{g.preventDefault()},ref:c,type:"button",children:[e&&ie(e,{}),l&&ie("span",{className:"toolbar-popup__dropdown-label",children:l}),ie("i",{className:"toolbar-popup__dropdown-caret"})]}),d&&ie(ht.Fragment,{children:m})]})}import{jsx as ze,jsxs as du}from"react/jsx-runtime";var yo="toolbar-popup__dropdown",cu=({active:e,anchorElem:t,editor:o,enabled:r,item:n})=>{let{i18n:i}=su();if(n.Component)return n?.Component&&ze(n.Component,{active:e,anchorElem:t,editor:o,enabled:r,item:n},n.key);let l=n.key;return n.label&&(l=typeof n.label=="function"?n.label({i18n:i}):n.label),l.length>25&&(l=l.substring(0,25)+"..."),du(vi,{active:e,editor:o,enabled:r,item:n,children:[n?.ChildComponent&&ze(n.ChildComponent,{}),ze("span",{className:"text",children:l})]},n.key)},ue=({Icon:e,anchorElem:t,classNames:o,editor:r,groupKey:n,items:i,itemsContainerClassNames:l,label:a,maxActiveItems:s,onActiveChange:c})=>{let[d,p]=Fi.useState([]),[u,m]=Fi.useState([]),g=$(),f=iu(()=>{r.getEditorState().read(()=>{let x=au(),h=[],I=[],P=[];for(let T of i)T.isActive&&(!s||h.length<s)&&T.isActive({editor:r,editorConfigContext:g,selection:x})&&(h.push(T.key),I.push(T)),T.isEnabled?T.isEnabled({editor:r,editorConfigContext:g,selection:x})&&P.push(T.key):P.push(T.key);p(h),m(P),c&&c({activeItems:I})})},[r,g,i,s,c]);return Eo(()=>{f()},[f]),Eo(()=>(document.addEventListener("mouseup",f),()=>{document.removeEventListener("mouseup",f)}),[f]),Eo(()=>lu(r.registerUpdateListener(()=>{f()})),[r,f]),ze(Ii,{Icon:e,buttonAriaLabel:`${n} dropdown`,buttonClassName:[yo,`${yo}-${n}`,...o||[]].filter(Boolean).join(" "),itemsContainerClassNames:[`${yo}-items`,...l||[]],label:a,children:i.length&&i.map(x=>ze(cu,{active:d.includes(x.key),anchorElem:t,editor:r,enabled:u.includes(x.key),item:x},x.key))},n)};import{jsx as j,jsxs as xu}from"react/jsx-runtime";function Cu({anchorElem:e,editor:t,item:o}){return o.Component?o?.Component&&j(o.Component,{anchorElem:e,editor:t,item:o},o.key):j(Ue,{editor:t,item:o,children:o?.ChildComponent&&j(o.ChildComponent,{})},o.key)}function hu({anchorElem:e,editor:t,editorConfig:o,group:r,index:n}){let{i18n:i}=fu(),[l,a]=te.useState(null),[s,c]=te.useState(null);te.useEffect(()=>{r?.type==="dropdown"&&r.items.length&&r.ChildComponent?c(()=>r.ChildComponent):c(null)},[r]);let d=({activeItems:p})=>{if(!p.length){r?.type==="dropdown"&&r.items.length&&r.ChildComponent?(c(()=>r.ChildComponent),a(null)):(c(null),a(null));return}let u=p[0],m=u.key;u.label&&(m=typeof u.label=="function"?u.label({i18n:i}):u.label),m.length>25&&(m=m.substring(0,25)+"..."),a(m),c(()=>u.ChildComponent)};return xu("div",{className:`fixed-toolbar__group fixed-toolbar__group-${r.key}`,children:[r.type==="dropdown"&&r.items.length&&(s?j(ue,{Icon:s,anchorElem:e,editor:t,groupKey:r.key,items:r.items,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:l,maxActiveItems:1,onActiveChange:d}):j(ue,{anchorElem:e,editor:t,groupKey:r.key,items:r.items,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:l,maxActiveItems:1,onActiveChange:d})),r.type==="buttons"&&r.items.length&&r.items.map(p=>j(Cu,{anchorElem:e,editor:t,item:p},p.key)),n<o.features.toolbarFixed?.groups.length-1&&j("div",{className:"divider"})]},r.key)}function bu({anchorElem:e,clientProps:t,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let i=te.useRef(null),{y:l}=pu(),a=gu(()=>{if(!n||t?.disableIfParentHasFixedToolbar)return null;let c=n.editorContainerRef.current.previousElementSibling;for(;c;){if(c.classList.contains("fixed-toolbar"))return c;c=c.previousElementSibling}return null},[t?.disableIfParentHasFixedToolbar,n]);return mu(()=>{if(!a)return;let s=i.current;if(!s)return;let c=s.getBoundingClientRect(),d=a.getBoundingClientRect();if(!(c.bottom<d.top||c.top>d.bottom))i.current.className="fixed-toolbar fixed-toolbar--overlapping",a.className="fixed-toolbar fixed-toolbar--hide";else{if(!i.current.classList.contains("fixed-toolbar--overlapping"))return;i.current.className="fixed-toolbar",a.className="fixed-toolbar"}},50,[i,a,l]),j("div",{className:"fixed-toolbar",onFocus:s=>{s.stopPropagation()},ref:i,children:o.isEditable()&&j(te.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((s,c)=>j(hu,{anchorElem:e,editor:o,editorConfig:r,group:s,index:c},s.key))})})}var Mi=e=>{if(e.parentEditor?.editorConfig){if(e.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return e.parentEditor;if(e.parentEditor)return Mi(e.parentEditor)}return!1},Pi=({anchorElem:e,clientProps:t})=>{let[o]=uu(),r=$(),{editorConfig:n}=r,i=t.applyToFocusedEditor&&r.focusedEditor?.editor||o,l=t.applyToFocusedEditor&&r.focusedEditor?.editorConfig||n,a=Mi(r);return t?.disableIfParentHasFixedToolbar&&a||!l?.features?.toolbarFixed?.groups?.length?null:j(bu,{anchorElem:e,editor:i,editorConfig:l,parentWithFixedToolbar:a})};var Tu=L({plugins:[{Component:Pi,position:"aboveContainer"}]});import{useLexicalComposerContext as Eu}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Oi}from"@lexical/utils";import{$getSelection as Hi,$isRangeSelection as Ai,$isTextNode as yu,COMMAND_PRIORITY_LOW as Lu,SELECTION_CHANGE_COMMAND as Nu}from"lexical";import{useCallback as Ve,useEffect as Ke,useRef as Di,useState as ku}from"react";import*as Te from"react";import{createPortal as wu}from"react-dom";function Lo(e,t){let o=e.getRangeAt(0),r;if(e.anchorNode===t){let n=t;for(;n.firstElementChild!=null;)n=n.firstElementChild;r=n.getBoundingClientRect()}else r=o.getBoundingClientRect();return r}function xt(e){let{alwaysDisplayOnTop:t=!1,anchorElem:o,anchorFlippedOffset:r=0,floatingElem:n,horizontalOffset:i=5,horizontalPosition:l="left",specialHandlingForCaret:a=!1,targetRect:s,verticalGap:c=10}=e,d=o.parentElement;if(s===null||d==null){n.style.opacity="0",n.style.transform="translate(-10000px, -10000px)";return}let p=n.getBoundingClientRect(),u=o.getBoundingClientRect(),m=d.getBoundingClientRect(),g=s.top-p.height-c,f=s.left-i;l==="center"&&(f=s.left+s.width/2-p.width/2);let x=0;return!t&&g<m.top&&!a&&(x=p.height+s.height+c*2,g+=x),l==="center"?f+p.width>m.right?f=m.right-p.width-i:f<m.left&&(f=m.left+i):f+p.width>m.right&&(f=m.right-p.width-i),f-=u.left,n.style.opacity="1",a&&r!==0?(g-=u.bottom-r+p.height-3,n.style.transform=`translate(${f}px, ${g}px) rotate(180deg)`):(g-=u.top,n.style.transform=`translate(${f}px, ${g}px)`),x}import{jsx as X,jsxs as Bi}from"react/jsx-runtime";function Ru({anchorElem:e,editor:t,item:o}){return o.Component?o?.Component&&X(o.Component,{anchorElem:e,editor:t,item:o},o.key):X(Ue,{editor:t,item:o,children:o?.ChildComponent&&X(o.ChildComponent,{})},o.key)}function _u({anchorElem:e,editor:t,group:o,index:r}){let{editorConfig:n}=$(),[i,l]=Te.useState(null);Te.useEffect(()=>{o?.type==="dropdown"&&o.items.length&&o.ChildComponent?l(()=>o.ChildComponent):l(null)},[o]);let a=({activeItems:s})=>{if(!s.length){o?.type==="dropdown"&&o.items.length&&o.ChildComponent?l(()=>o.ChildComponent):l(null);return}let c=s[0];l(()=>c.ChildComponent)};return Bi("div",{className:`inline-toolbar-popup__group inline-toolbar-popup__group-${o.key}`,children:[o.type==="dropdown"&&o.items.length&&(i?X(ue,{Icon:i,anchorElem:e,editor:t,groupKey:o.key,items:o.items,maxActiveItems:1,onActiveChange:a}):X(ue,{anchorElem:e,editor:t,groupKey:o.key,items:o.items,maxActiveItems:1,onActiveChange:a})),o.type==="buttons"&&o.items.length&&o.items.map(s=>X(Ru,{anchorElem:e,editor:t,item:s},s.key)),r<n.features.toolbarInline?.groups.length-1&&X("div",{className:"divider"})]},o.key)}function Su({anchorElem:e,editor:t}){let o=Di(null),r=Di(null),{editorConfig:n}=$(),i=Ve(()=>{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]),l=Ve(c=>{if(o?.current&&(c.buttons===1||c.buttons===3)){let d=o.current.style.opacity==="0",p=o.current.style.pointerEvents==="none";if(!d||!p){let u=c.clientX,m=c.clientY,g=document.elementFromPoint(u,m);o.current.contains(g)||i()}}},[i]),a=Ve(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);Ke(()=>(document.addEventListener("mousemove",l),document.addEventListener("mouseup",a),()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",a)}),[o,l,a]);let s=Ve(()=>{let c=Hi(),d=window.getSelection();if(o.current===null)return;let p=e.querySelector(":scope > .link-editor"),u=p!==null&&"style"in p&&p?.style?.opacity==="1",m=t.getRootElement();if(c!==null&&d!==null&&!d.isCollapsed&&m!==null&&m.contains(d.anchorNode)){let g=Lo(d,m),f=xt({alwaysDisplayOnTop:u,anchorElem:e,floatingElem:o.current,horizontalPosition:"center",targetRect:g});r.current&&xt({anchorElem:o.current,anchorFlippedOffset:f,floatingElem:r.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:g,verticalGap:10})}else i()},[t,i,e]);return Ke(()=>{let c=e.parentElement,d=()=>{t.getEditorState().read(()=>{s()})};return window.addEventListener("resize",d),c&&c.addEventListener("scroll",d),()=>{window.removeEventListener("resize",d),c&&c.removeEventListener("scroll",d)}},[t,s,e]),Ke(()=>(t.getEditorState().read(()=>{s()}),Oi(t.registerUpdateListener(({editorState:c})=>{c.read(()=>{s()})}),t.registerCommand(Nu,()=>(s(),!1),Lu))),[t,s]),Bi("div",{className:"inline-toolbar-popup",ref:o,children:[X("div",{className:"caret",ref:r}),t.isEditable()&&X(Te.Fragment,{children:n?.features&&n.features?.toolbarInline?.groups.map((c,d)=>X(_u,{anchorElem:e,editor:t,group:c,index:d},c.key))})]})}function vu(e,t){let[o,r]=ku(!1),n=Ve(()=>{e.getEditorState().read(()=>{if(e.isComposing())return;let i=Hi(),l=window.getSelection(),a=e.getRootElement();if(l!==null&&(!Ai(i)||a===null||!a.contains(l.anchorNode))){r(!1);return}if(!Ai(i))return;if(i.getTextContent()!==""){let c=i.getNodes(),d=!1;for(let p of c)if(yu(p)){r(!0),d=!0;break}d||r(!1)}else r(!1);let s=i.getTextContent().replace(/\n/g,"");if(!i.isCollapsed()&&s===""){r(!1);return}})},[e]);return Ke(()=>(document.addEventListener("selectionchange",n),document.addEventListener("mouseup",n),()=>{document.removeEventListener("selectionchange",n),document.removeEventListener("mouseup",n)}),[n]),Ke(()=>Oi(e.registerUpdateListener(()=>{n()}),e.registerRootListener(()=>{e.getRootElement()===null&&r(!1)})),[e,n]),o?wu(X(Su,{anchorElem:t,editor:e}),t):null}var $i=({anchorElem:e})=>{let[t]=Eu();return vu(t,e)};var Iu=L({plugins:[{Component:$i,position:"floatingAnchorElem"}]});import{TableCellNode as Jp,TableNode as Yp,TableRowNode as qp}from"@lexical/table";import{jsx as Gi}from"react/jsx-runtime";var No=()=>Gi("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Gi("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{useLexicalComposerContext as zi}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Mu}from"@lexical/react/useLexicalEditable";import{$deleteTableColumn__EXPERIMENTAL as Pu,$deleteTableRow__EXPERIMENTAL as Au,$getNodeTriplet as Du,$getTableCellNodeFromLexicalNode as Ou,$getTableColumnIndexFromTableCellNode as Hu,$getTableNodeFromLexicalNodeOrThrow as Tt,$getTableRowIndexFromTableCellNode as $u,$insertTableColumn__EXPERIMENTAL as Bu,$insertTableRow__EXPERIMENTAL as Gu,$isTableCellNode as je,$isTableRowNode as Ro,$isTableSelection as yt,$unmergeCell as Uu,TableCellHeaderStates as Ee,TableCellNode as Wu,getTableObserverFromTableElement as zu}from"@lexical/table";import{useScrollInfo as Vu}from"@payloadcms/ui";import{$createParagraphNode as Ku,$getRoot as ju,$getSelection as Lt,$isElementNode as Xu,$isParagraphNode as Vi,$isRangeSelection as _o,$isTextNode as Zu}from"lexical";import*as So from"react";import{useCallback as oe,useEffect as pe,useRef as Et,useState as ye}from"react";import{createPortal as Ki}from"react-dom";import{jsx as ko,jsxs as Fu}from"react/jsx-runtime";var Ui=()=>Fu("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[ko("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"}),ko("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"}),ko("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"})]});import{jsx as D,jsxs as re}from"react/jsx-runtime";function wo(e){let t=e.getShape();return{columns:t.toX-t.fromX+1,rows:t.toY-t.fromY+1}}function Ju(e){let t=e.getNodes(),o=[],r=null,n=null,i=0;for(let l=0;l<t.length;l++){let a=t[l];if(je(a)){let s=a.getParentOrThrow();if(ce(Ro(s),"Expected CellNode to have a RowNode parent"),r!==s){if(n!==null&&i!==n)return!1;r!==null&&(n=i),r=s,i=0}let c=a.__colSpan;for(let d=0;d<c;d++)o[i+d]===void 0&&(o[i+d]=0),o[i+d]+=a.__rowSpan;i+=c}}return(n===null||i===n)&&o.every(l=>l===o[0])}function Yu(){let e=Lt();if(_o(e)&&!e.isCollapsed()||yt(e)&&!e.anchor.is(e.focus)||!_o(e)&&!yt(e))return!1;let[t]=Du(e.anchor);return t.__colSpan>1||t.__rowSpan>1}function Wi(e){if(e.getChildrenSize()!==1)return!1;let t=e.getFirstChildOrThrow();return!(!Vi(t)||!t.isEmpty())}function qu(e){let t=e.getLastDescendant();Zu(t)?t.select():Xu(t)?t.selectEnd():t!==null&&t.selectNext()}function Qu({cellMerge:e,contextRef:t,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[i]=zi(),l=Et(null),[a,s]=ye(n),[c,d]=ye({columns:1,rows:1}),[p,u]=ye(!1),[m,g]=ye(!1),{y:f}=Vu();pe(()=>i.registerMutationListener(Wu,b=>{b.get(a.getKey())==="updated"&&i.getEditorState().read(()=>{s(a.getLatest())})},{skipInitialization:!0}),[i,a]),pe(()=>{i.getEditorState().read(()=>{let b=Lt();if(yt(b)){let C=wo(b);d(wo(b)),u(Ju(b)&&(C.columns>1||C.rows>1))}g(Yu())})},[i]),pe(()=>{let b=t.current,C=l.current,R=i.getRootElement();if(b!=null&&C!=null&&R!=null){let w=R.getBoundingClientRect(),y=b.getBoundingClientRect();C.style.opacity="1";let S=C.getBoundingClientRect(),A=5,O=y.right+A;if(O+S.width>window.innerWidth||O+S.width>w.right){let W=y.left-S.width-A;O=(W<0?A:W)+window.pageXOffset}C.style.left=`${O+window.pageXOffset}px`;let H=y.top;if(H+S.height>window.innerHeight){let W=y.bottom-S.height;H=(W<0?A:W)+window.pageYOffset}C.style.top=`${H}px`}},[t,l,i,f]),pe(()=>{function b(C){l.current!=null&&t.current!=null&&!l.current.contains(C.target)&&!t.current.contains(C.target)&&r(!1)}return window.addEventListener("click",b),()=>window.removeEventListener("click",b)},[r,t]);let x=oe(()=>{i.update(()=>{if(a.isAttached()){let C=Tt(a),R=i.getElementByKey(C.getKey());if(!R)throw new Error("Expected to find tableElement in DOM");let w=zu(R);w!==null&&w.clearHighlight(),C.markDirty(),s(a.getLatest())}ju().selectStart()})},[i,a]),h=()=>{i.update(()=>{let b=Lt();if(yt(b)){let{columns:C,rows:R}=wo(b),w=b.getNodes(),y=null;for(let S=0;S<w.length;S++){let A=w[S];if(je(A))if(y===null){A.setColSpan(C).setRowSpan(R),y=A;let O=Wi(A),H;O&&Vi(H=A.getFirstChild())&&H.remove()}else je(y)&&(Wi(A)||y.append(...A.getChildren()),A.remove())}y!==null&&(y.getChildrenSize()===0&&y.append(Ku()),qu(y)),o()}})},I=()=>{i.update(()=>{Uu()})},P=oe(b=>{i.update(()=>{Gu(b),o()})},[i,o]),T=oe(b=>{i.update(()=>{for(let C=0;C<c.columns;C++)Bu(b);o()})},[i,o,c.columns]),k=oe(()=>{i.update(()=>{Au(),o()})},[i,o]),E=oe(()=>{i.update(()=>{Tt(a).remove(),x(),o()})},[i,a,x,o]),_=oe(()=>{i.update(()=>{Pu(),o()})},[i,o]),M=oe(()=>{i.update(()=>{let b=Tt(a),C=$u(a),R=b.getChildren();if(C>=R.length||C<0)throw new Error("Expected table cell to be inside of table row.");let w=R[C];if(!Ro(w))throw new Error("Expected table row");w.getChildren().forEach(y=>{if(!je(y))throw new Error("Expected table cell");y.toggleHeaderStyle(Ee.ROW)}),x(),o()})},[i,a,x,o]),F=oe(()=>{i.update(()=>{let b=Tt(a),C=Hu(a),R=b.getChildren(),w=Math.max(...R.map(y=>y.getChildren().length));if(C>=w||C<0)throw new Error("Expected table cell to be inside of table row.");for(let y=0;y<R.length;y++){let S=R[y];if(!Ro(S))throw new Error("Expected table row");let A=S.getChildren();if(C>=A.length)continue;let O=A[C];if(!je(O))throw new Error("Expected table cell");O.toggleHeaderStyle(Ee.COLUMN)}x(),o()})},[i,a,x,o]),N=null;return e&&(p?N=D("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>h(),type:"button",children:"Merge cells"}):m&&(N=D("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>I(),type:"button",children:"Unmerge cells"}))),Ki(re("div",{className:"table-action-menu-dropdown",onClick:b=>{b.stopPropagation()},ref:l,children:[N?re(So.Fragment,{children:[N,D("hr",{})]}):null,D("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>P(!1),type:"button",children:re("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," above"]})}),D("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>P(!0),type:"button",children:re("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," below"]})}),D("hr",{}),D("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>T(!1),type:"button",children:re("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","left"]})}),D("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>T(!0),type:"button",children:re("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","right"]})}),D("hr",{}),D("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>_(),type:"button",children:D("span",{className:"text",children:"Delete column"})}),D("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>k(),type:"button",children:D("span",{className:"text",children:"Delete row"})}),D("button",{className:"item","data-test-id":"table-delete",onClick:()=>E(),type:"button",children:D("span",{className:"text",children:"Delete table"})}),D("hr",{}),D("button",{className:"item",onClick:()=>M(),type:"button",children:re("span",{className:"text",children:[(a.__headerState&Ee.ROW)===Ee.ROW?"Remove":"Add"," ","row header"]})}),D("button",{className:"item","data-test-id":"table-column-header",onClick:()=>F(),type:"button",children:re("span",{className:"text",children:[(a.__headerState&Ee.COLUMN)===Ee.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function ep({anchorElem:e,cellMerge:t}){let[o]=zi(),r=Et(null),n=Et(null),[i,l]=ye(!1),[a,s]=ye(null),c=oe(()=>{let p=r.current,u=Lt(),m=window.getSelection(),g=document.activeElement;if(u==null||p==null){s(null);return}let f=o.getRootElement();if(_o(u)&&f!==null&&m!==null&&f.contains(m.anchorNode)){let x=Ou(u.anchor.getNode());if(x==null){s(null);return}if(o.getElementByKey(x.getKey())==null){s(null);return}s(x)}else g||s(null)},[o]);pe(()=>o.registerUpdateListener(()=>{o.getEditorState().read(()=>{c()})})),pe(()=>{let p=r.current;if(p!=null&&a!=null){let u=o.getElementByKey(a.getKey());if(u!=null){let m=u.getBoundingClientRect(),g=p.getBoundingClientRect(),f=e.getBoundingClientRect(),x=m.top-f.top+4,h=m.right-g.width-10-f.left;p.style.opacity="1",p.style.transform=`translate(${h}px, ${x}px)`}else p.style.opacity="0",p.style.transform="translate(-10000px, -10000px)"}},[r,a,o,e]);let d=Et(a);return pe(()=>{d.current!==a&&l(!1),d.current=a},[d,a]),D("div",{className:"table-cell-action-button-container",ref:r,children:a!=null&&re(So.Fragment,{children:[D("button",{className:"table-cell-action-button",onClick:p=>{p.stopPropagation(),l(!i)},ref:n,type:"button",children:D(Ui,{})}),i&&D(Qu,{cellMerge:t,contextRef:n,onClose:()=>l(!1),setIsMenuOpen:l,tableCellNode:a})]})})}var ji=({anchorElem:e})=>{let t=Mu();return Ki(t?D(ep,{anchorElem:e??document.body,cellMerge:!0}):null,e??document.body)};import{useLexicalComposerContext as tp}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as op}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as rp,$getTableNodeFromLexicalNodeOrThrow as vo,$getTableRowIndexFromTableCellNode as np,$isTableCellNode as Xi,$isTableRowNode as ip,getDOMCellFromTarget as lp}from"@lexical/table";import{calculateZoomLevel as Zi}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Io}from"lexical";import*as Ji from"react";import{useCallback as Le,useEffect as sp,useMemo as ap,useRef as Nt,useState as kt}from"react";import{createPortal as cp}from"react-dom";import{jsx as wt,jsxs as mp}from"react/jsx-runtime";var dp=33,up=50;function pp({editor:e}){let t=Nt(null),o=Nt(null),r=Nt(null),n=$(),i=Nt(null),[l,a]=kt(null),[s,c]=kt(null),[d,p]=kt(!1),[u,m]=kt(null),g=Le(()=>{c(null),t.current=null,m(null),i.current=null,r.current=null},[]),f=N=>(N.buttons&1)===1;sp(()=>{let N=w=>{setTimeout(()=>{let y=w.target;if(u){a({x:w.clientX,y:w.clientY});return}if(p(f(w)),!(o.current&&o.current.contains(y))&&t.current!==y){t.current=y;let S=lp(y);S&&s!==S?e.update(()=>{let A=Io(S.elem);if(!A)throw new Error("TableCellResizer: Table cell node not found.");let O=vo(A),H=e.getElementByKey(O.getKey());if(!H)throw new Error("TableCellResizer: Table element not found.");t.current=y,r.current=H.getBoundingClientRect(),c(S)}):S==null&&g()}},0)},b=w=>{setTimeout(()=>{p(!0)},0)},C=w=>{setTimeout(()=>{p(!1)},0)},R=e.registerRootListener((w,y)=>{w?.addEventListener("mousemove",N),w?.addEventListener("mousedown",b),w?.addEventListener("mouseup",C),y?.removeEventListener("mousemove",N),y?.removeEventListener("mousedown",b),y?.removeEventListener("mouseup",C)});return()=>{R()}},[s,u,e,g]);let x=N=>N==="bottom",h=Le(N=>{if(!s)throw new Error("TableCellResizer: Expected active cell.");e.update(()=>{let b=Io(s.elem);if(!Xi(b))throw new Error("TableCellResizer: Table cell node not found.");let C=vo(b),R=np(b),w=C.getChildren();if(R>=w.length||R<0)throw new Error("Expected table cell to be inside of table row.");let y=w[R];if(!ip(y))throw new Error("Expected table row");let S=y.getHeight();if(S===void 0){let O=y.getChildren();S=Math.min(...O.map(H=>P(H,e)??1/0))}let A=Math.max(S+N,dp);y.setHeight(A)},{tag:"skip-scroll-into-view"})},[s,e]),I=(N,b)=>{let C=N.getWidth();if(C!==void 0)return C;let R=b.getElementByKey(N.getKey());if(R==null)return;let w=getComputedStyle(R);return R.clientWidth-parseFloat(w.paddingLeft)-parseFloat(w.paddingRight)},P=(N,b)=>b.getElementByKey(N.getKey())?.clientHeight,T=(N,b)=>{for(let C=0;C<b.length;C++)for(let R=0;R<b[C].length;R++)if(b[C][R].cell===N)return R},k=Le(N=>{if(!s)throw new Error("TableCellResizer: Expected active cell.");e.update(()=>{let b=Io(s.elem);if(!Xi(b))throw new Error("TableCellResizer: Table cell node not found.");let C=vo(b),[R]=rp(C,null,null),w=T(b,R);if(w===void 0)throw new Error("TableCellResizer: Table column not found.");for(let y=0;y<R.length;y++){let S=R[y][w];if(S.startRow===y&&(w===R[y].length-1||R[y][w].cell!==R[y][w+1].cell)){let A=I(S.cell,e);if(A===void 0)continue;let O=Math.max(A+N,up);S.cell.setWidth(O)}}},{tag:"skip-scroll-into-view"})},[s,e]),E=Le(N=>{let b=C=>{if(C.preventDefault(),C.stopPropagation(),!s)throw new Error("TableCellResizer: Expected active cell.");if(i.current){let{x:R,y:w}=i.current;if(s===null)return;let y=Zi(C.target);if(x(N)){let S=(C.clientY-w)/y;h(S)}else{let S=(C.clientX-R)/y;k(S)}g(),document.removeEventListener("mouseup",b)}};return b},[s,g,k,h]),_=Le(N=>b=>{if(b.preventDefault(),b.stopPropagation(),!s)throw new Error("TableCellResizer: Expected active cell.");i.current={x:b.clientX,y:b.clientY},a(i.current),m(N),document.addEventListener("mouseup",E(N))},[s,E]),F=Le(()=>{if(s){let{height:N,left:b,top:C,width:R}=s.elem.getBoundingClientRect(),w=Zi(s.elem),y=10,S={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${y}px`,left:`${window.pageXOffset+b}px`,top:`${window.pageYOffset+C+N-y/2}px`,width:`${R}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${N}px`,left:`${window.pageXOffset+b+R-y/2}px`,top:`${window.pageYOffset+C}px`,width:`${y}px`}},A=r.current;return u&&l&&A&&(x(u)?(S[u].left=`${window.pageXOffset+A.left}px`,S[u].top=`${window.pageYOffset+l.y/w}px`,S[u].height="3px",S[u].width=`${A.width}px`):(S[u].top=`${window.pageYOffset+A.top}px`,S[u].left=`${window.pageXOffset+l.x/w}px`,S[u].width="3px",S[u].height=`${A.height}px`),S[u].backgroundColor="#adf"),S}return{bottom:null,left:null,right:null,top:null}},[s,u,l])();return wt("div",{ref:o,children:s!=null&&!d&&mp(Ji.Fragment,{children:[wt("div",{className:`${n.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:_("right"),style:F.right||void 0}),wt("div",{className:`${n.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:_("bottom"),style:F.bottom||void 0})]})})}var Yi=()=>{let[e]=tp(),t=op();return ap(()=>t?cp(wt(pp,{editor:e}),document.body):null,[e,t])};import{useLexicalComposerContext as Tp}from"@lexical/react/LexicalComposerContext";import{$getTableColumnIndexFromTableCellNode as Ep,$getTableRowIndexFromTableCellNode as yp,$insertTableColumn__EXPERIMENTAL as Lp,$insertTableRow__EXPERIMENTAL as Np,$isTableCellNode as kp,$isTableNode as el,TableNode as wp}from"@lexical/table";import{$findMatchingParent as Rp,mergeRegister as _p}from"@lexical/utils";import{$getNearestNodeFromDOMNode as tl}from"lexical";import{useEffect as ol,useRef as rl,useState as Rt}from"react";import{createPortal as Sp}from"react-dom";import{useMemo as bp,useRef as xp}from"react";var fp="Expected a function",gp=Math.max,Cp=Math.min;function hp(e,t,o){let r,n,i,l,a,s,c=0,d=!1,p=!1,u=!0;if(typeof e!="function")throw new TypeError(fp);t=t||0,typeof o=="object"&&(d=!!o.leading,p="maxWait"in o,i=p?gp(o.maxWait||0,t):i,u="trailing"in o?!!o.trailing:u);function m(E){let _=r,M=n;return r=n=void 0,c=E,l=e.apply(M,_),l}function g(E){return c=E,a=setTimeout(h,t),d?m(E):l}function f(E){let _=E-s,M=E-c,F=t-_;return p?Cp(F,i-M):F}function x(E){let _=E-s,M=E-c;return s===void 0||_>=t||_<0||p&&M>=i}function h(){let E=Date.now();if(x(E))return I(E);a=setTimeout(h,f(E))}function I(E){return a=void 0,u&&r?m(E):(r=n=void 0,l)}function P(){a!==void 0&&clearTimeout(a),c=0,r=s=n=a=void 0}function T(){return a===void 0?l:I(Date.now())}function k(){let E=Date.now(),_=x(E);if(r=arguments,n=this,s=E,_){if(a===void 0)return g(s);if(p)return clearTimeout(a),a=setTimeout(h,t),m(s)}return a===void 0&&(a=setTimeout(h,t)),l}return k.cancel=P,k.flush=T,k}var qi=hp;function Qi(e,t,o){let r=xp(null);return r.current=e,bp(()=>qi((...n)=>{r.current&&r.current(...n)},t,{maxWait:o}),[t,o])}import{Fragment as Fp,jsx as Fo,jsxs as Mp}from"react/jsx-runtime";var nl=20;function vp({anchorElem:e}){let[t]=Tp(),o=$(),[r,n]=Rt(!1),[i,l]=Rt(!1),[a,s]=Rt(!1),[c,d]=Rt({}),p=rl(new Set),u=rl(null),m=Qi(f=>{let{isOutside:x,tableDOMNode:h}=Ip(f,o.editorConfig?.lexical);if(x){n(!1),l(!1);return}if(!h)return;u.current=h;let I=null,P=null,T=null;if(t.update(()=>{let k=tl(h);if(kp(k)){let E=Rp(k,_=>el(_));if(!el(E))return;if(T=t.getElementByKey(E?.getKey()),T){let _=E.getChildrenSize(),M=E.getChildAtIndex(0)?.getChildrenSize(),F=yp(k),N=Ep(k);F===_-1?I=k:N===M-1&&(P=k)}}}),T){let{bottom:k,height:E,right:_,width:M,x:F,y:N}=T.getBoundingClientRect(),{left:b,y:C}=e.getBoundingClientRect();I?(l(!1),n(!0),d({height:nl,left:F-b,top:k-C+5,width:M})):P&&(l(!0),n(!1),d({height:E,left:_-b+5,top:N-C,width:nl}))}},50,250);ol(()=>{if(a)return document.addEventListener("mousemove",m),()=>{n(!1),l(!1),document.removeEventListener("mousemove",m)}},[a,m]),ol(()=>_p(t.registerMutationListener(wp,f=>{t.getEditorState().read(()=>{for(let[x,h]of f)switch(h){case"created":p.current.add(x),s(p.current.size>0);break;case"destroyed":p.current.delete(x),s(p.current.size>0);break;default:break}})},{skipInitialization:!1})),[t]);let g=f=>{t.update(()=>{u.current&&(tl(u.current)?.selectEnd(),f?(Np(),n(!1)):(Lp(),l(!1)))})};return Mp(Fp,{children:[r&&Fo("button",{className:o.editorConfig.lexical.theme.tableAddRows,onClick:()=>g(!0),style:{...c}}),i&&Fo("button",{className:o.editorConfig.lexical.theme.tableAddColumns,onClick:()=>g(!1),style:{...c}})]})}function Ip(e,t){let o=e.target;if(o&&o instanceof HTMLElement){let r=o.closest(`td.${t.theme.tableCell}, th.${t.theme.tableCell}`);return{isOutside:!(r||o.closest(`button.${t.theme.tableAddRows}`)||o.closest(`button.${t.theme.tableAddColumns}`)||o.closest(`div.${t.theme.tableCellResizer}`)),tableDOMNode:r}}else return{isOutside:!0,tableDOMNode:null}}function il({anchorElem:e=document.body}){return Sp(Fo(vp,{anchorElem:e}),e)}import{useLexicalComposerContext as Pp}from"@lexical/react/LexicalComposerContext";import{TablePlugin as Ap}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as Dp,TableNode as Op}from"@lexical/table";import{mergeRegister as Hp}from"@lexical/utils";import{useModal as $p}from"@payloadcms/ui";import{$getSelection as Bp,$isRangeSelection as Gp,COMMAND_PRIORITY_EDITOR as Up,createCommand as Wp}from"lexical";import{createContext as zp,useContext as Vp,useEffect as Kp,useMemo as jp,useState as Xp}from"react";import*as ll from"react";import{jsx as Po,jsxs as Zp}from"react/jsx-runtime";var _t=Wp("OPEN_EMBED_DRAWER_COMMAND"),sl=zp({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}}),Mo="lexical-table-create";function al({children:e}){let[t,o]=Xp({cellEditorConfig:null,cellEditorPlugins:null});return Po(sl.Provider,{value:jp(()=>({cellEditorConfig:t.cellEditorConfig,cellEditorPlugins:t.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[t.cellEditorConfig,t.cellEditorPlugins]),children:e})}var cl=()=>{let[e]=Pp(),t=Vp(sl),{closeModal:o,toggleModal:r}=$p();return Kp(()=>(e.hasNodes([Op])||ce(!1,"TablePlugin: TableNode is not registered on editor"),Hp(e.registerCommand(_t,()=>{let n=null;return e.getEditorState().read(()=>{let i=Bp();Gp(i)&&(n=i)}),n&&r(Mo),!0},Up))),[t,e,r]),Zp(ll.Fragment,{children:[Po(le,{drawerSlug:Mo,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:(n,i)=>{o(Mo),!(!i.columns||!i.rows)&&e.dispatchCommand(Dp,{columns:String(i.columns),rows:String(i.rows)})},schemaPathSuffix:"fields"}),Po(Ap,{hasCellBackgroundColor:!1,hasCellMerge:!0})]})};var Qp=L({nodes:[Yp,Jp,qp],plugins:[{Component:cl,position:"normal"},{Component:Yi,position:"normal"},{Component:ji,position:"floatingAnchorElem"},{Component:il,position:"floatingAnchorElem"}],providers:[al],slashMenu:{groups:[G([{Icon:No,key:"table",keywords:["table"],label:"Table",onSelect:({editor:e})=>{e.dispatchCommand(_t,{})}}])]},toolbarFixed:{groups:[Y([{ChildComponent:No,key:"table",label:"Table",onSelect:({editor:e})=>{e.dispatchCommand(_t,{})}}])]}});import{$isNodeSelection as Em}from"lexical";import{jsx as Ao,jsxs as em}from"react/jsx-runtime";var Do=()=>em("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Ao("path",{d:"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"}),Ao("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"}),Ao("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{useLexicalComposerContext as dm}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as um,mergeRegister as pm}from"@lexical/utils";import{useConfig as mm}from"@payloadcms/ui";import{$getPreviousSelection as fm,$getSelection as gm,$isParagraphNode as ul,$isRangeSelection as Cm,COMMAND_PRIORITY_EDITOR as hm,createCommand as bm}from"lexical";import{useEffect as xm}from"react";import{useLexicalComposerContext as tm}from"@lexical/react/LexicalComposerContext.js";import{useListDrawer as om}from"@payloadcms/ui";import{$getNodeByKey as rm,COMMAND_PRIORITY_EDITOR as nm}from"lexical";import{useCallback as im,useEffect as lm,useState as sm}from"react";import{jsx as Oo}from"react/jsx-runtime";var am=({editor:e,relationTo:t,replaceNodeKey:o,value:r})=>{o?e.update(()=>{let n=rm(o);n&&n.replace(Fe({data:{fields:null,relationTo:t,value:r}}))}):e.dispatchCommand(Ho,{fields:null,relationTo:t,value:r})},cm=({enabledCollectionSlugs:e})=>{let[t]=tm(),[o,r]=sm(null),[n,i,{closeDrawer:l,openDrawer:a}]=om({collectionSlugs:e,uploads:!0});lm(()=>t.registerCommand(ve,c=>(r(c?.replace?c?.replace.nodeKey:null),a(),!0),nm),[t,a]);let s=im(({collectionSlug:c,docID:d})=>{am({editor:t,relationTo:c,replaceNodeKey:o,value:d}),l()},[t,l,o]);return Oo(n,{onSelect:s})},dl=e=>Oo(Ye,{...e,uploads:!0,children:Oo(cm,{...e})});import{jsx as Tm}from"react/jsx-runtime";var Ho=bm("INSERT_UPLOAD_COMMAND"),pl=({clientProps:e})=>{let[t]=dm(),{collections:o}=mm();return xm(()=>{if(!t.hasNodes([Ie]))throw new Error("UploadPlugin: UploadNode not registered on editor");return pm(t.registerCommand(Ho,r=>(t.update(()=>{let n=gm()||fm();if(Cm(n)){let i=Fe({data:{id:r.id,fields:r.fields,relationTo:r.relationTo,value:r.value}});um(i);let{focus:l}=n,a=l.getNode();ul(a)&&a.getTextContentSize()===0&&a.getParent().getChildren().filter(s=>ul(s)).length>1&&a.remove()}}),!0),hm))},[t]),Tm(dl,{enabledCollectionSlugs:o.map(({slug:r})=>r)})};var ym=L({nodes:[Ie],plugins:[{Component:pl,position:"normal"}],slashMenu:{groups:[G([{Icon:Do,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:e})=>e.t("lexical:upload:label"),onSelect:({editor:e})=>{e.dispatchCommand(ve,{replace:!1})}}])]},toolbarFixed:{groups:[Y([{ChildComponent:Do,isActive:({selection:e})=>{if(!Em(e)||!e.getNodes().length)return!1;let t=e.getNodes()[0];return At(t)},key:"upload",label:({i18n:e})=>e.t("lexical:upload:label"),onSelect:({editor:e})=>{e.dispatchCommand(ve,{replace:!1})}}])]}});import{ShimmerEffect as Lm,useClientFunctions as Nm,useFieldProps as km}from"@payloadcms/ui";import ml,{Suspense as wm,lazy as Rm,useEffect as _m,useState as $o}from"react";import{jsx as St,jsxs as Im}from"react/jsx-runtime";var Sm=Rm(()=>import("./Field-5GGTGCKC.js").then(e=>({default:e.RichText}))),vm=e=>{let{admin:t,lexicalEditorConfig:o,richTextComponentMap:r}=e,{schemaPath:n}=km(),i=Nm(),[l,a]=$o(!1),[s,c]=$o([]),[d,p]=$o(null),u=r.get("features");u=u.sort((g,f)=>g.order-f.order);let m=0;for(let g of u){let f=Array.from(r.keys()).filter(x=>x.startsWith(`lexical_internal_feature.${g.key}.lexical_internal_components.`));m+=1,m+=f.length}return _m(()=>{if(!l){let g=[],f=0;if(Object.entries(i).forEach(([x,h])=>{x.startsWith(`lexicalFeature.${n}.`)&&(x.includes(".lexical_internal_components.")||g.push(h),f++)}),f===m){c(g),a(!0);let x=qe({clientFunctions:i,schemaPath:n,unSanitizedEditorConfig:{features:g,lexical:o}});p(Pe(o||Me,x,t))}}},[t,l,i,n,u.length,s,d,o,m]),l?St(wm,{fallback:St(Lm,{height:"35vh"}),children:d&&St(Sm,{...e,editorConfig:d})}):St(ml.Fragment,{children:Array.isArray(u)&&u.map(g=>{let x=Array.from(r.keys()).filter(h=>h.startsWith(`lexical_internal_feature.${g.key}.lexical_internal_components.`)).map(h=>r.get(h));return Im(ml.Fragment,{children:[x?.length?x.map(h=>h):null,g.ClientFeature]},g.key)})})};function Fm(...e){return e.filter(Boolean).join(" ")}var vt=new WeakMap;function fl(e){let t=e.changedTouches[0];return t===void 0?null:[t.clientX,t.clientY]}function It(e,t){let o=vt.get(e);if(o===void 0){let r=new Set,n=l=>{o!==void 0&&(o.start=fl(l))},i=l=>{if(o===void 0)return;let{start:a}=o;if(a===null)return;let s=fl(l);for(let c of r)s!==null&&c([s[0]-a[0],s[1]-a[1]],l)};e.addEventListener("touchstart",n),e.addEventListener("touchend",i),o={handleTouchend:i,handleTouchstart:n,listeners:r,start:null},vt.set(e,o)}return o.listeners.add(t),()=>{Mm(e,t)}}function Mm(e,t){let o=vt.get(e);if(o===void 0)return;let{listeners:r}=o;r.delete(t),r.size===0&&(vt.delete(e),e.removeEventListener("touchstart",o.handleTouchstart),e.removeEventListener("touchend",o.handleTouchend))}function Pm(e,t){return It(e,(o,r)=>{let[n,i]=o;n<0&&-n>Math.abs(i)&&t(n,r)})}function Am(e,t){return It(e,(o,r)=>{let[n,i]=o;n>0&&n>Math.abs(i)&&t(n,r)})}function Dm(e,t){return It(e,(o,r)=>{let[n,i]=o;i<0&&-i>Math.abs(n)&&t(n,r)})}function Om(e,t){return It(e,(o,r)=>{let[n,i]=o;i>0&&i>Math.abs(n)&&t(n,r)})}export{De as $createAutoLinkNode,nt as $createBlockNode,q as $createLinkNode,Se as $createRelationshipNode,Fe as $createUploadNode,ee as $isAutoLinkNode,jl as $isBlockNode,B as $isLinkNode,Pt as $isRelationshipNode,At as $isUploadNode,Pl as AlignFeatureClient,Q as AutoLinkNode,J as BlockNode,Bl as BlockquoteFeatureClient,cs as BlocksFeatureClient,Ss as BoldFeatureClient,K as CAN_USE_DOM,Gc as ChecklistFeatureClient,hd as DETAIL_TYPE_TO_DETAIL,md as DOUBLE_LINE_BREAK,xd as ELEMENT_FORMAT_TO_TYPE,bd as ELEMENT_TYPE_TO_FORMAT,Cl as ENABLE_SLASH_MENU_COMMAND,gl as EditorConfigProvider,le as FieldsDrawer,Tu as FixedToolbarFeatureClient,ia as HeadingFeatureClient,fa as HorizontalRuleFeatureClient,ud as IS_ALL_FORMATTING,xa as IndentFeatureClient,Ms as InlineCodeFeatureClient,Iu as InlineToolbarFeatureClient,Ds as ItalicFeatureClient,gd as LTR_REGEX,dd as LexicalPluginToLexicalFeatureClient,wc as LinkFeatureClient,V as LinkNode,pd as NON_BREAKING_SPACE,v as NodeFormat,Zc as OrderedListFeatureClient,Id as ParagraphFeatureClient,bl as Point,fd as RTL_REGEX,Tl as Rect,Jd as RelationshipFeatureClient,_e as RelationshipNode,kl as RichTextCell,vm as RichTextField,Sd as SlateToLexicalFeatureClient,Bs as StrikethroughFeatureClient,Ws as SubscriptFeatureClient,Ks as SuperscriptFeatureClient,Td as TEXT_MODE_TO_TYPE,Cd as TEXT_TYPE_TO_FORMAT,Ed as TEXT_TYPE_TO_MODE,Z as TOGGLE_LINK_COMMAND,Qp as TableFeatureClient,ys as TestRecorderFeatureClient,Ue as ToolbarButton,ue as ToolbarDropdown,ws as TreeViewFeatureClient,Js as UnderlineFeatureClient,rd as UnorderedListFeatureClient,ym as UploadFeatureClient,Ie as UploadNode,Om as addSwipeDownListener,Pm as addSwipeLeftListener,Am as addSwipeRightListener,Dm as addSwipeUpListener,Jt as createBlockNode,Ut as createClientComponent,L as createClientFeature,Me as defaultEditorLexicalConfig,Lo as getDOMRangeRect,Ft as getEnabledNodes,me as getSelectedNode,ce as invariant,hl as isHTMLElement,xl as isPoint,Fm as joinClasses,Pe as sanitizeClientEditorConfig,Wo as sanitizeClientFeatures,xt as setFloatingElemPosition,mt as setFloatingElemPositionForLinkEditor,G as slashMenuBasicGroupWithItems,Y as toolbarAddDropdownGroupWithItems,qt as toolbarFeatureButtonsGroupWithItems,U as toolbarFormatGroupWithItems,z as toolbarTextDropdownGroupWithItems,$ as useEditorConfigContext};
|
|
38
38
|
//# sourceMappingURL=index.js.map
|