@payloadcms/richtext-lexical 3.0.0-beta.120 → 3.0.0-beta.121
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/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/client/plugin/index.d.ts.map +1 -1
- package/dist/features/blocks/client/plugin/index.js +1 -1
- package/dist/features/blocks/client/plugin/index.js.map +1 -1
- package/dist/features/experimental_table/client/plugins/TablePlugin/index.d.ts.map +1 -1
- package/dist/features/experimental_table/client/plugins/TablePlugin/index.js +1 -1
- package/dist/features/experimental_table/client/plugins/TablePlugin/index.js.map +1 -1
- package/dist/features/relationship/server/index.d.ts.map +1 -1
- package/dist/features/relationship/server/index.js +1 -0
- package/dist/features/relationship/server/index.js.map +1 -1
- package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
- package/dist/features/upload/server/feature.server.d.ts.map +1 -1
- package/dist/features/upload/server/feature.server.js +1 -0
- package/dist/features/upload/server/feature.server.js.map +1 -1
- package/dist/field/bundled.css +1 -1
- package/dist/populateGraphQL/populate.d.ts +3 -2
- package/dist/populateGraphQL/populate.d.ts.map +1 -1
- package/dist/populateGraphQL/populate.js +2 -0
- package/dist/populateGraphQL/populate.js.map +1 -1
- package/package.json +6 -6
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use client";import{a as At,b as xl,c as bl,d as _l,f as Tl,h as El}from"./chunk-IIWHHN4J.js";import{a as we,b as Dt,c as Cl}from"./chunk-NEO76RJK.js";import{a as Ne,b as Ft,c as ke,d as Ot,e as Pt,f as $t}from"./chunk-32KXGBIQ.js";import{a as Le,b as Ze,c as Ye,d as Xe}from"./chunk-XCEM47RI.js";import{a as Ie,b as Re,c as Se,d as Ht}from"./chunk-XY4TCSM7.js";import{a as ce,b as Bo,c as Je,d as ye,e as Me,f as ve,g as Bt}from"./chunk-7SR2HYD6.js";import{a as gl,b as H}from"./chunk-GD6LBQBJ.js";function G(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{jsx as Uo}from"react/jsx-runtime";import{createHeadlessEditor as wl}from"@lexical/headless";import{useConfig as Nl,useTableCell as kl}from"@payloadcms/ui";import{formatAdminURL as Ll}from"@payloadcms/ui/shared";import{$getRoot as Il}from"lexical";import Wo from"next/link.js";import Rl,{useEffect as Sl,useMemo as yl}from"react";var jo={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",tableRowStriping:"LexicalEditorTheme__tableRowStriping",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 Ae={namespace:"lexical",theme:jo};function qe({unSanitizedEditorConfig:t}){for(let r of t.features)if(!r?.clientFeatureProps?.featureKey||r?.clientFeatureProps?.order===void 0||r?.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.");t.features=t.features.sort((r,i)=>r.clientFeatureProps.order-i.clientFeatureProps.order);let e=new Map;for(let r of t.features)e.set(r.clientFeatureProps.featureKey,r);let o=new Map,n=0;for(let r of t.features){let i=typeof r.feature=="function"?r.feature({featureProviderMap:e,resolvedFeatures:o,unSanitizedEditorConfig:t}):r.feature;i.key=r.clientFeatureProps.featureKey,i.order=n,o.set(r.clientFeatureProps.featureKey,i),n++}return o}var Go=t=>{let e={enabledFeatures:[],hooks:{load:[],save:[]},markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}};if(!t?.size)return e;t.forEach(o=>{if(o.hooks&&(o.hooks?.load?.length&&(e.hooks.load=e.hooks.load.concat(o.hooks.load)),o.hooks?.save?.length&&(e.hooks.save=e.hooks.save.concat(o.hooks.save))),o.providers?.length&&(e.providers=e.providers.concat(o.providers)),o.nodes?.length&&(e.nodes=e.nodes.concat(o.nodes)),o.plugins?.length&&o.plugins.forEach((n,r)=>{e.plugins?.push({clientProps:o.sanitizedClientFeatureProps,Component:n.Component,key:o.key+r,position:n.position})}),o.toolbarInline?.groups?.length)for(let n of o.toolbarInline.groups){let r=e.toolbarInline.groups.find(i=>i.key===n.key);r?e.toolbarInline.groups=e.toolbarInline.groups.filter(i=>i.key!==n.key):r={...n,items:[]},n?.items?.length&&(r.items=r.items.concat(n.items)),e.toolbarInline?.groups.push(r)}if(o.toolbarFixed?.groups?.length)for(let n of o.toolbarFixed.groups){let r=e.toolbarFixed.groups.find(i=>i.key===n.key);r?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(i=>i.key!==n.key):r={...n,items:[]},n?.items?.length&&(r.items=r.items.concat(n.items)),e.toolbarFixed?.groups.push(r)}if(o.slashMenu?.groups){o.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(o.slashMenu.dynamicGroups));for(let n of o.slashMenu.groups){let r=e.slashMenu.groups.find(i=>i.key===n.key);r?e.slashMenu.groups=e.slashMenu.groups.filter(i=>i.key!==n.key):r={...n,items:[]},n?.items?.length&&(r.items=r.items.concat(n.items)),e.slashMenu.groups.push(r)}}o.markdownTransformers?.length&&(e.markdownTransformers=e.markdownTransformers.concat(o.markdownTransformers)),e.enabledFeatures.push(o.key)}),e.toolbarInline.groups.sort((o,n)=>o.order&&n.order?o.order-n.order:o.order?-1:n.order?1:0),e.toolbarFixed.groups.sort((o,n)=>o.order&&n.order?o.order-n.order:o.order?-1:n.order?1:0);for(let o of e.toolbarInline.groups)o.items.sort((n,r)=>n.order&&r.order?n.order-r.order:n.order?-1:r.order?1:0);for(let o of e.toolbarFixed.groups)o.items.sort((n,r)=>n.order&&r.order?n.order-r.order:n.order?-1:r.order?1:0);return e};function De(t,e,o){return{admin:o,features:Go(t),lexical:e,resolvedFeatureMap:t}}var Ml=Wo.default||Wo,vl=t=>{let{admin:e,field:{richTextComponentMap:o},lexicalEditorConfig:n}=t,[r,i]=Rl.useState("Loading..."),{cellData:l,cellProps:s,columnIndex:a,customCellContext:c,rowData:u}=kl(),{config:{routes:{admin:d}}}=Nl(),{link:m}=s||{},f="span",p={},h=m!==void 0?m:a===0;h&&(f=Ml,p.href=c?.collectionSlug?Ll({adminRoute:d,path:`/collections/${c?.collectionSlug}/${u.id}`}):"");let x=yl(()=>{let E=o?.get("features"),v=[];for(let _ of E)v.push(_.clientFeature(_.clientFeatureProps));let y=n||Ae,g=qe({unSanitizedEditorConfig:{features:v,lexical:y}});return De(g,y)},[o,n]);return x.admin=e,Sl(()=>{let E=l;if(E==null||!x){i("");return}if(x?.features?.hooks?.load?.length&&x.features.hooks.load.forEach(g=>{E=g({incomingEditorState:E})}),!E||typeof E!="object"){i("");return}if(Array.isArray(E)&&!("root"in E)){i("");return}if("jsonContent"in E){i("");return}let v=wl({namespace:x.lexical.namespace,nodes:At({editorConfig:x}),theme:x.lexical.theme});v.setEditorState(v.parseEditorState(E));let y=v.getEditorState().read(()=>Il().getTextContent())||"";i(y)},[l,x]),h?Uo(f,{...p,children:r}):Uo("span",{children:r})};import{$isElementNode as ie,$isRangeSelection as et,FORMAT_ELEMENT_COMMAND as tt}from"lexical";import{jsx as jt,jsxs as Al}from"react/jsx-runtime";import"react";var Vo=()=>Al("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[jt("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),jt("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),jt("path",{d:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Gt,jsxs as Dl}from"react/jsx-runtime";import"react";var zo=()=>Dl("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:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Ut,jsxs as Fl}from"react/jsx-runtime";import"react";var Qe=()=>Fl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Ut("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ut("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ut("path",{d:"M2.5 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Wt,jsxs as Ol}from"react/jsx-runtime";import"react";var Ko=()=>Ol("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Wt("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Wt("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Wt("path",{d:"M7.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});var S=t=>o=>{let n={clientFeatureProps:o};if(typeof t=="function")n.feature=({featureProviderMap:r,resolvedFeatures:i,unSanitizedEditorConfig:l})=>{let s=t({featureProviderMap:r,props:o,resolvedFeatures:i,unSanitizedEditorConfig:l});return s.sanitizedClientFeatureProps===null&&(s.sanitizedClientFeatureProps=o),s};else{let r={...t};r.sanitizedClientFeatureProps=o,n.feature=r}return n};var Zo=t=>({type:"dropdown",ChildComponent:Qe,items:t,key:"align",order:30});var Yo=[Zo([{ChildComponent:Qe,isActive:({selection:t})=>{if(!et(t))return!1;for(let e of t.getNodes()){if(ie(e)&&e.getFormatType()==="left")continue;let o=e.getParent();if(!(ie(o)&&o.getFormatType()==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(tt,"left")},order:1},{ChildComponent:Vo,isActive:({selection:t})=>{if(!et(t))return!1;for(let e of t.getNodes()){if(ie(e)&&e.getFormatType()==="center")continue;let o=e.getParent();if(!(ie(o)&&o.getFormatType()==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(tt,"center")},order:2},{ChildComponent:Ko,isActive:({selection:t})=>{if(!et(t))return!1;for(let e of t.getNodes()){if(ie(e)&&e.getFormatType()==="right")continue;let o=e.getParent();if(!(ie(o)&&o.getFormatType()==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(tt,"right")},order:3},{ChildComponent:zo,isActive:({selection:t})=>{if(!et(t))return!1;for(let e of t.getNodes()){if(ie(e)&&e.getFormatType()==="justify")continue;let o=e.getParent();if(!(ie(o)&&o.getFormatType()==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(tt,"justify")},order:4}])],Pl=S({toolbarFixed:{groups:Yo},toolbarInline:{groups:Yo}});import{$createQuoteNode as or,$isQuoteNode as er,QuoteNode as jl}from"@lexical/rich-text";import{$setBlocksType as rr}from"@lexical/selection";import{$getSelection as nr,$isRangeSelection as Gl}from"lexical";import{jsx as Xo}from"react/jsx-runtime";import"react";var Vt=()=>Xo("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:Xo("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 Jo}from"react/jsx-runtime";import"react";var Fe=()=>Jo("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:Jo("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 V=t=>({type:"dropdown",ChildComponent:Fe,items:t,key:"text",order:25});import{$createQuoteNode as $l,$isQuoteNode as qo,QuoteNode as Hl}from"@lexical/rich-text";import{$createLineBreakNode as Bl}from"lexical";var Qo={type:"element",dependencies:[Hl],export:(t,e)=>{if(!qo(t))return null;let o=e(t).split(`
|
|
1
|
+
"use client";import{a as At,b as hl,c as gl,d as Cl,f as xl,h as bl}from"./chunk-IIWHHN4J.js";import{a as Ne,b as Dt,c as pl}from"./chunk-NEO76RJK.js";import{a as ke,b as Ft,c as Le,d as Ot,e as Pt,f as $t}from"./chunk-32KXGBIQ.js";import{a as Ie,b as Ye,c as Xe,d as Je}from"./chunk-XCEM47RI.js";import{a as Re,b as Se,c as ye,d as Ht}from"./chunk-XY4TCSM7.js";import{a as ce,b as he,c as qe,d as Me,e as ve,f as Ae,g as Bt}from"./chunk-7SR2HYD6.js";import{a as fl,b as H}from"./chunk-GD6LBQBJ.js";function G(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{jsx as Go}from"react/jsx-runtime";import{createHeadlessEditor as _l}from"@lexical/headless";import{useConfig as Tl,useTableCell as El}from"@payloadcms/ui";import{formatAdminURL as wl}from"@payloadcms/ui/shared";import{$getRoot as Nl}from"lexical";import Uo from"next/link.js";import kl,{useEffect as Ll,useMemo as Il}from"react";var Bo={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",tableRowStriping:"LexicalEditorTheme__tableRowStriping",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 De={namespace:"lexical",theme:Bo};function Qe({unSanitizedEditorConfig:t}){for(let r of t.features)if(!r?.clientFeatureProps?.featureKey||r?.clientFeatureProps?.order===void 0||r?.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.");t.features=t.features.sort((r,i)=>r.clientFeatureProps.order-i.clientFeatureProps.order);let e=new Map;for(let r of t.features)e.set(r.clientFeatureProps.featureKey,r);let o=new Map,n=0;for(let r of t.features){let i=typeof r.feature=="function"?r.feature({featureProviderMap:e,resolvedFeatures:o,unSanitizedEditorConfig:t}):r.feature;i.key=r.clientFeatureProps.featureKey,i.order=n,o.set(r.clientFeatureProps.featureKey,i),n++}return o}var jo=t=>{let e={enabledFeatures:[],hooks:{load:[],save:[]},markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}};if(!t?.size)return e;t.forEach(o=>{if(o.hooks&&(o.hooks?.load?.length&&(e.hooks.load=e.hooks.load.concat(o.hooks.load)),o.hooks?.save?.length&&(e.hooks.save=e.hooks.save.concat(o.hooks.save))),o.providers?.length&&(e.providers=e.providers.concat(o.providers)),o.nodes?.length&&(e.nodes=e.nodes.concat(o.nodes)),o.plugins?.length&&o.plugins.forEach((n,r)=>{e.plugins?.push({clientProps:o.sanitizedClientFeatureProps,Component:n.Component,key:o.key+r,position:n.position})}),o.toolbarInline?.groups?.length)for(let n of o.toolbarInline.groups){let r=e.toolbarInline.groups.find(i=>i.key===n.key);r?e.toolbarInline.groups=e.toolbarInline.groups.filter(i=>i.key!==n.key):r={...n,items:[]},n?.items?.length&&(r.items=r.items.concat(n.items)),e.toolbarInline?.groups.push(r)}if(o.toolbarFixed?.groups?.length)for(let n of o.toolbarFixed.groups){let r=e.toolbarFixed.groups.find(i=>i.key===n.key);r?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(i=>i.key!==n.key):r={...n,items:[]},n?.items?.length&&(r.items=r.items.concat(n.items)),e.toolbarFixed?.groups.push(r)}if(o.slashMenu?.groups){o.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(o.slashMenu.dynamicGroups));for(let n of o.slashMenu.groups){let r=e.slashMenu.groups.find(i=>i.key===n.key);r?e.slashMenu.groups=e.slashMenu.groups.filter(i=>i.key!==n.key):r={...n,items:[]},n?.items?.length&&(r.items=r.items.concat(n.items)),e.slashMenu.groups.push(r)}}o.markdownTransformers?.length&&(e.markdownTransformers=e.markdownTransformers.concat(o.markdownTransformers)),e.enabledFeatures.push(o.key)}),e.toolbarInline.groups.sort((o,n)=>o.order&&n.order?o.order-n.order:o.order?-1:n.order?1:0),e.toolbarFixed.groups.sort((o,n)=>o.order&&n.order?o.order-n.order:o.order?-1:n.order?1:0);for(let o of e.toolbarInline.groups)o.items.sort((n,r)=>n.order&&r.order?n.order-r.order:n.order?-1:r.order?1:0);for(let o of e.toolbarFixed.groups)o.items.sort((n,r)=>n.order&&r.order?n.order-r.order:n.order?-1:r.order?1:0);return e};function Fe(t,e,o){return{admin:o,features:jo(t),lexical:e,resolvedFeatureMap:t}}var Rl=Uo.default||Uo,Sl=t=>{let{admin:e,field:{richTextComponentMap:o},lexicalEditorConfig:n}=t,[r,i]=kl.useState("Loading..."),{cellData:l,cellProps:s,columnIndex:a,customCellContext:c,rowData:u}=El(),{config:{routes:{admin:d}}}=Tl(),{link:m}=s||{},f="span",p={},h=m!==void 0?m:a===0;h&&(f=Rl,p.href=c?.collectionSlug?wl({adminRoute:d,path:`/collections/${c?.collectionSlug}/${u.id}`}):"");let x=Il(()=>{let E=o?.get("features"),v=[];for(let _ of E)v.push(_.clientFeature(_.clientFeatureProps));let y=n||De,g=Qe({unSanitizedEditorConfig:{features:v,lexical:y}});return Fe(g,y)},[o,n]);return x.admin=e,Ll(()=>{let E=l;if(E==null||!x){i("");return}if(x?.features?.hooks?.load?.length&&x.features.hooks.load.forEach(g=>{E=g({incomingEditorState:E})}),!E||typeof E!="object"){i("");return}if(Array.isArray(E)&&!("root"in E)){i("");return}if("jsonContent"in E){i("");return}let v=_l({namespace:x.lexical.namespace,nodes:At({editorConfig:x}),theme:x.lexical.theme});v.setEditorState(v.parseEditorState(E));let y=v.getEditorState().read(()=>Nl().getTextContent())||"";i(y)},[l,x]),h?Go(f,{...p,children:r}):Go("span",{children:r})};import{$isElementNode as ie,$isRangeSelection as tt,FORMAT_ELEMENT_COMMAND as ot}from"lexical";import{jsx as jt,jsxs as yl}from"react/jsx-runtime";import"react";var Wo=()=>yl("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:[jt("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),jt("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),jt("path",{d:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Gt,jsxs as Ml}from"react/jsx-runtime";import"react";var Vo=()=>Ml("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:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Ut,jsxs as vl}from"react/jsx-runtime";import"react";var et=()=>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:[Ut("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ut("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ut("path",{d:"M2.5 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Wt,jsxs as Al}from"react/jsx-runtime";import"react";var zo=()=>Al("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Wt("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Wt("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Wt("path",{d:"M7.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});var S=t=>o=>{let n={clientFeatureProps:o};if(typeof t=="function")n.feature=({featureProviderMap:r,resolvedFeatures:i,unSanitizedEditorConfig:l})=>{let s=t({featureProviderMap:r,props:o,resolvedFeatures:i,unSanitizedEditorConfig:l});return s.sanitizedClientFeatureProps===null&&(s.sanitizedClientFeatureProps=o),s};else{let r={...t};r.sanitizedClientFeatureProps=o,n.feature=r}return n};var Ko=t=>({type:"dropdown",ChildComponent:et,items:t,key:"align",order:30});var Zo=[Ko([{ChildComponent:et,isActive:({selection:t})=>{if(!tt(t))return!1;for(let e of t.getNodes()){if(ie(e)&&e.getFormatType()==="left")continue;let o=e.getParent();if(!(ie(o)&&o.getFormatType()==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(ot,"left")},order:1},{ChildComponent:Wo,isActive:({selection:t})=>{if(!tt(t))return!1;for(let e of t.getNodes()){if(ie(e)&&e.getFormatType()==="center")continue;let o=e.getParent();if(!(ie(o)&&o.getFormatType()==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(ot,"center")},order:2},{ChildComponent:zo,isActive:({selection:t})=>{if(!tt(t))return!1;for(let e of t.getNodes()){if(ie(e)&&e.getFormatType()==="right")continue;let o=e.getParent();if(!(ie(o)&&o.getFormatType()==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(ot,"right")},order:3},{ChildComponent:Vo,isActive:({selection:t})=>{if(!tt(t))return!1;for(let e of t.getNodes()){if(ie(e)&&e.getFormatType()==="justify")continue;let o=e.getParent();if(!(ie(o)&&o.getFormatType()==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(ot,"justify")},order:4}])],Dl=S({toolbarFixed:{groups:Zo},toolbarInline:{groups:Zo}});import{$createQuoteNode as tr,$isQuoteNode as Qo,QuoteNode as $l}from"@lexical/rich-text";import{$setBlocksType as or}from"@lexical/selection";import{$getSelection as rr,$isRangeSelection as Hl}from"lexical";import{jsx as Yo}from"react/jsx-runtime";import"react";var Vt=()=>Yo("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Yo("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 Xo}from"react/jsx-runtime";import"react";var Oe=()=>Xo("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:Xo("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 V=t=>({type:"dropdown",ChildComponent:Oe,items:t,key:"text",order:25});import{$createQuoteNode as Fl,$isQuoteNode as Jo,QuoteNode as Ol}from"@lexical/rich-text";import{$createLineBreakNode as Pl}from"lexical";var qo={type:"element",dependencies:[Ol],export:(t,e)=>{if(!Jo(t))return null;let o=e(t).split(`
|
|
2
2
|
`),n=[];for(let r of o)n.push("> "+r);return n.join(`
|
|
3
|
-
`)},regExp:/^>\s/,replace:(t,e,o,n)=>{if(n){let i=t.getPreviousSibling();if(qo(i)){i.splice(i.getChildrenSize(),0,[Bl(),...e]),i.select(0,0),t.remove();return}}let r=$l();r.append(...e),t.replace(r),r.select(0,0)}};var tr=[V([{ChildComponent:Vt,isActive:({selection:t})=>{if(!Gl(t))return!1;for(let e of t.getNodes())if(!er(e)&&!er(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=nr();rr(e,()=>or())})},order:20}])],Ul=S({markdownTransformers:[Qo],nodes:[jl],slashMenu:{groups:[G([{Icon:Vt,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=nr();rr(e,()=>or())})}}])]},toolbarFixed:{groups:tr},toolbarInline:{groups:tr}});import{getTranslation as it}from"@payloadcms/translations";import{jsx as zt,jsxs as Wl}from"react/jsx-runtime";import"react";var ot=()=>Wl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[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 ir}from"react/jsx-runtime";import"react";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{c as Jl}from"react/compiler-runtime";import{jsx as ql}from"react/jsx-runtime";import{useLexicalComposerContext as Ql}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as es,$wrapNodeInElement as ts,mergeRegister as os}from"@lexical/utils";import{getTranslation as rs}from"@payloadcms/translations";import{formatDrawerSlug as ns,useEditDepth as is,useFieldProps as ls,useTranslation as ss}from"@payloadcms/ui";import{$createParagraphNode as as,$getNodeByKey as cs,$getPreviousSelection as us,$getSelection as ar,$insertNodes as ds,$isParagraphNode as cr,$isRangeSelection as ur,$isRootOrShadowRoot as ms,COMMAND_PRIORITY_EDITOR as Kt}from"lexical";import{useLexicalComposerContext as Vl}from"@lexical/react/LexicalComposerContext";import{useModal as zl}from"@payloadcms/ui";import{$getPreviousSelection as Kl,$getSelection as Zl,$setSelection as Yl}from"lexical";import{useCallback as lr,useEffect as Xl,useState as sr}from"react";var nt=(t,e)=>{let[o]=Vl(),[n,r]=sr(null),[i,l]=sr(!1),{closeModal:s,isModalOpen:a,modalState:c,toggleModal:u}=zl(),d=lr(()=>{o.read(()=>{let h=Zl()??Kl();r(h)})},[o]),m=lr(()=>{n&&o.update(()=>{Yl(n.clone())},{discrete:!0,skipTransforms:!0})},[o,n]),f=()=>{s(t)},p=()=>{a(t)?m():d(),l(!0),u(t)};return Xl(()=>{if(!i)return;let h=c[t];h&&!h?.isOpen&&(l(!1),e?setTimeout(()=>{m()},1):m())},[c,t,m,i,e]),{closeDrawer:f,toggleDrawer:p}};import{useEffect as fs,useState as Zt}from"react";var dr=()=>{let t=Jl(21),[e]=Ql(),[o,n]=Zt(null),[r,i]=Zt(""),[l,s]=Zt(null),{i18n:a,t:c}=ss(),{schemaPath:u}=ls(),{uuid:d}=H(),m=is(),f="lexical-inlineBlocks-create-"+d,p;t[0]!==f||t[1]!==m?(p=ns({slug:f,depth:m}),t[0]=f,t[1]=m,t[2]=p):p=t[2];let h=p,{toggleDrawer:x}=nt(h),{field:E}=H(),{richTextComponentMap:v}=E,y,g;if(t[3]!==e||t[4]!==l||t[5]!==x?(y=()=>{if(!e.hasNodes([we]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return os(e.registerCommand(Ne,C=>(e.update(()=>{let L=ar()||us();if(ur(L)){let T=Dt(C);es(T);let{focus:N}=L,k=N.getNode();cr(k)&&k.getTextContentSize()===0&&k.getParentOrThrow().getChildren().filter(R=>cr(R)).length>1&&k.remove()}}),!0),Kt),e.registerCommand(Ft,C=>{if(l){let T=cs(l);return!T||!$t(T)?!1:(T.setFields(C),s(null),!0)}let L=Pt(C);return ds([L]),ms(L.getParentOrThrow())&&ts(L,as).selectEnd(),!0},Kt),e.registerCommand(ke,C=>{let{fields:L,nodeKey:T}=C;if(n(L??null),s(T??null),i(L?.blockType??""),T)return x(),!0;let N;return N=null,e.getEditorState().read(()=>{let k=ar();ur(k)&&(N=k)}),N&&x(),!0},Kt))},g=[e,l,x],t[3]=e,t[4]=l,t[5]=x,t[6]=y,t[7]=g):(y=t[6],g=t[7]),fs(y,g),!o)return null;let _=`${u}.lexical_internal_feature.blocks.lexical_inline_blocks.lexical_inline_blocks.${o?.blockType}`,b="lexical_internal_feature.blocks.fields.lexical_inline_blocks",I,w;if(t[8]!==v||t[9]!==o||t[10]!==a||t[11]!==c||t[12]!==r||t[13]!==e||t[14]!==h||t[15]!==_){w=Symbol.for("react.early_return_sentinel");e:{let C=v?.has(b)?v.get(b)[0]:null,L=C?C.blocks.find(k=>k.slug===o?.blockType):null;if(!C){w=null;break e}let T=L?.labels?.singular?rs(L?.labels?.singular,a):L?.slug,N;t[18]!==r||t[19]!==e?(N=(k,R)=>{R&&(R.blockType=r,e.dispatchCommand(Ft,R))},t[18]=r,t[19]=e,t[20]=N):N=t[20],I=ql(ce,{data:o,drawerSlug:h,drawerTitle:c(`lexical:blocks:inlineBlocks:${o?.id?"edit":"create"}`,{label:T??c("lexical:blocks:inlineBlocks:label")}),featureKey:"blocks",fieldMapOverride:L?.fields,handleDrawerSubmit:N,schemaFieldsPathOverride:_,schemaPathSuffix:o?.blockType})}t[8]=v,t[9]=o,t[10]=a,t[11]=c,t[12]=r,t[13]=e,t[14]=h,t[15]=_,t[16]=I,t[17]=w}else I=t[16],w=t[17];return w!==Symbol.for("react.early_return_sentinel")?w:I};var ps=S(({props:t})=>({nodes:[we,Ot],plugins:[{Component:dr,position:"normal"}],sanitizedClientFeatureProps:t,slashMenu:{groups:[t.clientBlockSlugs?.length?{items:t.clientBlockSlugs.map(e=>({Icon:ot,key:"block-"+e,keywords:["block","blocks",e],label:({i18n:o,richTextComponentMap:n})=>{if(!n)return e;let l=(n.get("lexical_internal_feature.blocks.fields.lexical_blocks")?.[0]).blocks.find(a=>a.slug===e);return l?.labels?.singular?it(l.labels.singular,o):l?.slug},onSelect:({editor:o})=>{o.dispatchCommand(Ne,{blockName:"",blockType:e})}})),key:"blocks",label:({i18n:e})=>e.t("lexical:blocks:label")}:null,t.clientInlineBlockSlugs?.length?{items:t.clientInlineBlockSlugs.map(e=>({Icon:rt,key:"inlineBlocks-"+e,keywords:["inlineBlock","inline block",e],label:({i18n:o,richTextComponentMap:n})=>{if(!n)return e;let l=(n.get("lexical_internal_feature.blocks.fields.lexical_inline_blocks")?.[0]).blocks.find(a=>a.slug===e);return l?.labels?.singular?it(l.labels.singular,o):l?.slug},onSelect:({editor:o})=>{o.dispatchCommand(ke,{fields:{blockName:"",blockType:e}})}})),key:"inlineBlocks",label:({i18n:e})=>e.t("lexical:blocks:inlineBlocks:label")}:null].filter(Boolean)},toolbarFixed:{groups:[t.clientBlockSlugs?.length?{type:"dropdown",ChildComponent:ot,items:t.clientBlockSlugs.map((e,o)=>({ChildComponent:ot,isActive:void 0,key:"block-"+e,label:({i18n:n,richTextComponentMap:r})=>{if(!r)return e;let s=(r.get("lexical_internal_feature.blocks.fields.lexical_blocks")?.[0]).blocks.find(c=>c.slug===e);return s?.labels?.singular?it(s.labels.singular,n):s?.slug},onSelect:({editor:n})=>{n.dispatchCommand(Ne,{blockName:"",blockType:e})},order:o})),key:"blocks",order:20}:null,t.clientInlineBlockSlugs?.length?{type:"dropdown",ChildComponent:rt,items:t.clientInlineBlockSlugs.map((e,o)=>({ChildComponent:rt,isActive:void 0,key:"inlineBlock-"+e,label:({i18n:n,richTextComponentMap:r})=>{if(!r)return e;let s=(r.get("lexical_internal_feature.blocks.fields.lexical_inline_blocks")?.[0]).blocks.find(c=>c.slug===e);return s?.labels?.singular?it(s.labels.singular,n):s?.slug},onSelect:({editor:n})=>{n.dispatchCommand(ke,{fields:{blockType:e}})},order:o})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}));import{jsx as de,jsxs as Jt}from"react/jsx-runtime";import{useLexicalComposerContext as Cs}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as xs,$createTextNode as bs,$getRoot as _s}from"lexical";import*as gr from"react";import{useCallback as ue,useEffect as Yt,useLayoutEffect as fr,useRef as Xt,useState as lt}from"react";var K=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";var hs=K&&"documentMode"in document?document.documentMode:null,mr=K&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),oh=K&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),rh=K&&"InputEvent"in window&&!hs?"getTargetRanges"in new window.InputEvent("input"):!1,nh=K&&/Version\/[\d.].*Safari/.test(navigator.userAgent),ih=K&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,lh=K&&/Android/.test(navigator.userAgent),sh=K&&/Win/.test(navigator.platform),gs=K&&/^(?=.*Chrome).*/i.test(navigator.userAgent),ah=K&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!gs;var Ts=t=>{let e=document.createElement("textarea");e.value=t||"",e.style.position="absolute",e.style.opacity="0",document.body?.appendChild(e),e.focus(),e.select();try{let o=document.execCommand("copy");console.log(o)}catch(o){console.error(o)}document.body?.removeChild(e)},Es=(t,e)=>{let o=document.createElement("a");o.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(e||"")),o.setAttribute("download",t),o.style.display="none",document.body?.appendChild(o),o.click(),document.body?.removeChild(o)},ws=t=>{let o=((n,r)=>{switch(n){case"click":return` await page.mouse.click(${r.x}, ${r.y});`;case"press":return` await page.keyboard.press('${r}');`;case"keydown":return` await page.keyboard.keydown('${r}');`;case"keyup":return` await page.keyboard.keyup('${r}');`;case"type":return` await page.keyboard.type('${r}');`;case"selectAll":return" await selectAll(page);";case"snapshot":return` await assertHTMLSnapshot(page);
|
|
3
|
+
`)},regExp:/^>\s/,replace:(t,e,o,n)=>{if(n){let i=t.getPreviousSibling();if(Jo(i)){i.splice(i.getChildrenSize(),0,[Pl(),...e]),i.select(0,0),t.remove();return}}let r=Fl();r.append(...e),t.replace(r),r.select(0,0)}};var er=[V([{ChildComponent:Vt,isActive:({selection:t})=>{if(!Hl(t))return!1;for(let e of t.getNodes())if(!Qo(e)&&!Qo(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=rr();or(e,()=>tr())})},order:20}])],Bl=S({markdownTransformers:[qo],nodes:[$l],slashMenu:{groups:[G([{Icon:Vt,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=rr();or(e,()=>tr())})}}])]},toolbarFixed:{groups:er},toolbarInline:{groups:er}});import{getTranslation as it}from"@payloadcms/translations";import{jsx as zt,jsxs as jl}from"react/jsx-runtime";import"react";var rt=()=>jl("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 nr}from"react/jsx-runtime";import"react";var nt=()=>nr("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",{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{c as Gl}from"react/compiler-runtime";import{jsx as Ul}from"react/jsx-runtime";import{useLexicalComposerContext as Wl}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Vl,$wrapNodeInElement as zl,mergeRegister as Kl}from"@lexical/utils";import{getTranslation as Zl}from"@payloadcms/translations";import{formatDrawerSlug as Yl,useEditDepth as Xl,useFieldProps as Jl,useTranslation as ql}from"@payloadcms/ui";import{$createParagraphNode as Ql,$getNodeByKey as es,$getPreviousSelection as ts,$getSelection as ir,$insertNodes as os,$isParagraphNode as lr,$isRangeSelection as sr,$isRootOrShadowRoot as rs,COMMAND_PRIORITY_EDITOR as Kt}from"lexical";import{useEffect as ns,useState as Zt}from"react";var ar=()=>{let t=Gl(21),[e]=Wl(),[o,n]=Zt(null),[r,i]=Zt(""),[l,s]=Zt(null),{i18n:a,t:c}=ql(),{schemaPath:u}=Jl(),{uuid:d}=H(),m=Xl(),f="lexical-inlineBlocks-create-"+d,p;t[0]!==f||t[1]!==m?(p=Yl({slug:f,depth:m}),t[0]=f,t[1]=m,t[2]=p):p=t[2];let h=p,{toggleDrawer:x}=he(h),{field:E}=H(),{richTextComponentMap:v}=E,y,g;if(t[3]!==e||t[4]!==l||t[5]!==x?(y=()=>{if(!e.hasNodes([Ne]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return Kl(e.registerCommand(ke,C=>(e.update(()=>{let L=ir()||ts();if(sr(L)){let T=Dt(C);Vl(T);let{focus:N}=L,k=N.getNode();lr(k)&&k.getTextContentSize()===0&&k.getParentOrThrow().getChildren().filter(R=>lr(R)).length>1&&k.remove()}}),!0),Kt),e.registerCommand(Ft,C=>{if(l){let T=es(l);return!T||!$t(T)?!1:(T.setFields(C),s(null),!0)}let L=Pt(C);return os([L]),rs(L.getParentOrThrow())&&zl(L,Ql).selectEnd(),!0},Kt),e.registerCommand(Le,C=>{let{fields:L,nodeKey:T}=C;if(n(L??null),s(T??null),i(L?.blockType??""),T)return x(),!0;let N;return N=null,e.getEditorState().read(()=>{let k=ir();sr(k)&&(N=k)}),N&&x(),!0},Kt))},g=[e,l,x],t[3]=e,t[4]=l,t[5]=x,t[6]=y,t[7]=g):(y=t[6],g=t[7]),ns(y,g),!o)return null;let _=`${u}.lexical_internal_feature.blocks.lexical_inline_blocks.lexical_inline_blocks.${o?.blockType}`,b="lexical_internal_feature.blocks.fields.lexical_inline_blocks",I,w;if(t[8]!==v||t[9]!==o||t[10]!==a||t[11]!==c||t[12]!==r||t[13]!==e||t[14]!==h||t[15]!==_){w=Symbol.for("react.early_return_sentinel");e:{let C=v?.has(b)?v.get(b)[0]:null,L=C?C.blocks.find(k=>k.slug===o?.blockType):null;if(!C){w=null;break e}let T=L?.labels?.singular?Zl(L?.labels?.singular,a):L?.slug,N;t[18]!==r||t[19]!==e?(N=(k,R)=>{R&&(R.blockType=r,e.dispatchCommand(Ft,R))},t[18]=r,t[19]=e,t[20]=N):N=t[20],I=Ul(ce,{data:o,drawerSlug:h,drawerTitle:c(`lexical:blocks:inlineBlocks:${o?.id?"edit":"create"}`,{label:T??c("lexical:blocks:inlineBlocks:label")}),featureKey:"blocks",fieldMapOverride:L?.fields,handleDrawerSubmit:N,schemaFieldsPathOverride:_,schemaPathSuffix:o?.blockType})}t[8]=v,t[9]=o,t[10]=a,t[11]=c,t[12]=r,t[13]=e,t[14]=h,t[15]=_,t[16]=I,t[17]=w}else I=t[16],w=t[17];return w!==Symbol.for("react.early_return_sentinel")?w:I};var is=S(({props:t})=>({nodes:[Ne,Ot],plugins:[{Component:ar,position:"normal"}],sanitizedClientFeatureProps:t,slashMenu:{groups:[t.clientBlockSlugs?.length?{items:t.clientBlockSlugs.map(e=>({Icon:rt,key:"block-"+e,keywords:["block","blocks",e],label:({i18n:o,richTextComponentMap:n})=>{if(!n)return e;let l=(n.get("lexical_internal_feature.blocks.fields.lexical_blocks")?.[0]).blocks.find(a=>a.slug===e);return l?.labels?.singular?it(l.labels.singular,o):l?.slug},onSelect:({editor:o})=>{o.dispatchCommand(ke,{blockName:"",blockType:e})}})),key:"blocks",label:({i18n:e})=>e.t("lexical:blocks:label")}:null,t.clientInlineBlockSlugs?.length?{items:t.clientInlineBlockSlugs.map(e=>({Icon:nt,key:"inlineBlocks-"+e,keywords:["inlineBlock","inline block",e],label:({i18n:o,richTextComponentMap:n})=>{if(!n)return e;let l=(n.get("lexical_internal_feature.blocks.fields.lexical_inline_blocks")?.[0]).blocks.find(a=>a.slug===e);return l?.labels?.singular?it(l.labels.singular,o):l?.slug},onSelect:({editor:o})=>{o.dispatchCommand(Le,{fields:{blockName:"",blockType:e}})}})),key:"inlineBlocks",label:({i18n:e})=>e.t("lexical:blocks:inlineBlocks:label")}:null].filter(Boolean)},toolbarFixed:{groups:[t.clientBlockSlugs?.length?{type:"dropdown",ChildComponent:rt,items:t.clientBlockSlugs.map((e,o)=>({ChildComponent:rt,isActive:void 0,key:"block-"+e,label:({i18n:n,richTextComponentMap:r})=>{if(!r)return e;let s=(r.get("lexical_internal_feature.blocks.fields.lexical_blocks")?.[0]).blocks.find(c=>c.slug===e);return s?.labels?.singular?it(s.labels.singular,n):s?.slug},onSelect:({editor:n})=>{n.dispatchCommand(ke,{blockName:"",blockType:e})},order:o})),key:"blocks",order:20}:null,t.clientInlineBlockSlugs?.length?{type:"dropdown",ChildComponent:nt,items:t.clientInlineBlockSlugs.map((e,o)=>({ChildComponent:nt,isActive:void 0,key:"inlineBlock-"+e,label:({i18n:n,richTextComponentMap:r})=>{if(!r)return e;let s=(r.get("lexical_internal_feature.blocks.fields.lexical_inline_blocks")?.[0]).blocks.find(c=>c.slug===e);return s?.labels?.singular?it(s.labels.singular,n):s?.slug},onSelect:({editor:n})=>{n.dispatchCommand(Le,{fields:{blockType:e}})},order:o})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}));import{jsx as de,jsxs as Jt}from"react/jsx-runtime";import{useLexicalComposerContext as as}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as cs,$createTextNode as us,$getRoot as ds}from"lexical";import*as fr from"react";import{useCallback as ue,useEffect as Yt,useLayoutEffect as ur,useRef as Xt,useState as lt}from"react";var K=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";var ls=K&&"documentMode"in document?document.documentMode:null,cr=K&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),G1=K&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),U1=K&&"InputEvent"in window&&!ls?"getTargetRanges"in new window.InputEvent("input"):!1,W1=K&&/Version\/[\d.].*Safari/.test(navigator.userAgent),V1=K&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,z1=K&&/Android/.test(navigator.userAgent),K1=K&&/Win/.test(navigator.platform),ss=K&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Z1=K&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!ss;var ms=t=>{let e=document.createElement("textarea");e.value=t||"",e.style.position="absolute",e.style.opacity="0",document.body?.appendChild(e),e.focus(),e.select();try{let o=document.execCommand("copy");console.log(o)}catch(o){console.error(o)}document.body?.removeChild(e)},fs=(t,e)=>{let o=document.createElement("a");o.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(e||"")),o.setAttribute("download",t),o.style.display="none",document.body?.appendChild(o),o.click(),document.body?.removeChild(o)},ps=t=>{let o=((n,r)=>{switch(n){case"click":return` await page.mouse.click(${r.x}, ${r.y});`;case"press":return` await page.keyboard.press('${r}');`;case"keydown":return` await page.keyboard.keydown('${r}');`;case"keyup":return` await page.keyboard.keyup('${r}');`;case"type":return` await page.keyboard.type('${r}');`;case"selectAll":return" await selectAll(page);";case"snapshot":return` await assertHTMLSnapshot(page);
|
|
4
4
|
await assertSelection(page, {
|
|
5
5
|
anchorPath: [${r.anchorPath.toString()}],
|
|
6
6
|
anchorOffset: ${r.anchorOffset},
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
`;default:return""}})(t.name,t.value);switch(t.count){case 1:return o;case 2:return[o,o].join(`
|
|
11
11
|
`);default:return` await repeat(${t.count}, async () => {
|
|
12
12
|
${o}
|
|
13
|
-
);`}};function
|
|
13
|
+
);`}};function hs(t){return t.key.toLowerCase()==="a"&&(cr?t.metaKey:t.ctrlKey)}function gs(t){let{anchorNode:e,focusNode:o}=t,{anchorOffset:n,focusOffset:r}=t;return n!==0&&n--,r!==0&&r--,{anchorNode:e,anchorOffset:n,focusNode:o,focusOffset:r}}function dr(t,e){let o=t,n=[];for(;o!==e;)o!=null&&n.unshift(Array.from(o?.parentNode?.childNodes??[]).indexOf(o)),o=o?.parentNode;return n}var mr=new Set(["Enter","Backspace","Delete","Escape","ArrowLeft","ArrowRight","ArrowUp","ArrowDown"]);function Cs(t){let[e,o]=lt([]),[n,r]=lt(!1),[,i]=lt(""),[l,s]=lt(""),a=Xt(null),c=Xt(!1),u=Xt(null),d=ue(()=>t,[t]),m=ue(()=>{let g=t.getRootElement(),_=window.getSelection();return g==null||_==null||_.anchorNode==null||_.focusNode==null||!g.contains(_.anchorNode)||!g.contains(_.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
|
-
${e.map(
|
|
30
|
+
${e.map(ps).join(`
|
|
31
31
|
`)}
|
|
32
32
|
});
|
|
33
33
|
});
|
|
34
|
-
`},[t,e]),f=ue((g,_)=>{o(b=>{let I=e.length-1,w=e[I];if(w&&w.name===g){if(g==="type")return[...e.slice(0,I),{...w,value:w.value+_}];if(w.value===_)return[...e.slice(0,I),{...w,count:w.count+1}]}return[...b,{name:g,count:1,value:_}]})},[e,o]);fr(()=>{let g=b=>{if(!n)return;let I=b.key;Ns(b)?f("selectAll",""):hr.has(I)?f("press",b.key):[...I].length>1?f("keydown",b.key):f("type",b.key)},_=b=>{if(!n)return;let I=b.key;!hr.has(I)&&[...I].length>1&&f("keyup",b.key)};return t.registerRootListener((b,I)=>{I!==null&&(I.removeEventListener("keydown",g),I.removeEventListener("keyup",_)),b!==null&&(b.addEventListener("keydown",g),b.addEventListener("keyup",_))})},[t,n,f]),fr(()=>{u.current&&u.current.scrollTo(0,u.current.scrollHeight)},[m]),Yt(()=>{if(e){let g=m();g!==null&&s(g),u.current&&u.current.scrollTo(0,u.current.scrollHeight)}},[m,e]),Yt(()=>t.registerUpdateListener(({dirtyElements:_,dirtyLeaves:b,editorState:I})=>{if(!n)return;let w=I._selection,C=a.current,L=c.current;if(C!==w){if(b.size===0&&_.size===0&&!L){let N=window.getSelection();if(N&&(N.anchorNode==null||N.focusNode==null))return}a.current=w}c.current=!1;let T=m();T!==null&&s(T)}),[t,m,n,f]),Yt(()=>n?t.registerUpdateListener(()=>{let _=t.getRootElement();_!==null&&i(_?.innerHTML)}):void 0,[t,n]);let p=ue(g=>{n||(g.update(()=>{let _=_s();_.clear();let b=bs();_.append(xs().append(b)),b.select()}),o([])),r(_=>!_)},[n]),h=ue(()=>{if(!n)return;let g=window.getSelection();if(g===null||g.anchorNode==null||g.focusNode==null)return;let{anchorNode:_,anchorOffset:b,focusNode:I,focusOffset:w}=ks(g),C=d().getRootElement(),L;_!==null&&(L=pr(_,C));let T;I!==null&&(T=pr(I,C)),f("snapshot",{anchorNode:_,anchorOffset:b,anchorPath:L,focusNode:I,focusOffset:w,focusPath:T})},[f,n,d]),x=ue(()=>{Ts(m())},[m]),E=ue(()=>{Es("test.js",m())},[m]);return[de("button",{className:`editor-dev-button ${n?"active":""}`,id:"test-recorder-button",onClick:g=>{p(d()),g.preventDefault()},title:n?"Disable test recorder":"Enable test recorder",type:"button",children:n?"Disable test recorder":"Enable test recorder"}),n?Jt("div",{className:"test-recorder-output",children:[Jt("div",{className:"test-recorder-toolbar",children:[de("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:g=>{h(),g.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),de("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:g=>{x(),g.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),de("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:g=>{E(),g.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),de("pre",{id:"test-recorder",ref:u,children:l})]}):null]}var Cr=()=>{let[t]=Cs(),[e,o]=Ls(t);return Jt(gr.Fragment,{children:[de("p",{children:"HI"}),e,o,de("p",{children:"DONE"})]})};var Is=S({plugins:[{Component:Cr,position:"bottom"}]});import{c as Rs}from"react/compiler-runtime";import{jsx as Ss}from"react/jsx-runtime";import{useLexicalComposerContext as ys}from"@lexical/react/LexicalComposerContext.js";import{TreeView as Ms}from"@lexical/react/LexicalTreeView.js";import"react";var xr=()=>{let t=Rs(2),[e]=ys(),o;return t[0]!==e?(o=Ss(Ms,{editor:e,timeTravelButtonClassName:"debug-timetravel-button",timeTravelPanelButtonClassName:"debug-timetravel-panel-button",timeTravelPanelClassName:"debug-timetravel-panel",timeTravelPanelSliderClassName:"debug-timetravel-panel-slider",treeTypeButtonClassName:"debug-treetype-button",viewClassName:"tree-view-output"}),t[0]=e,t[1]=o):o=t[1],o};var vs=S({plugins:[{Component:xr,position:"bottom"}]});import{$isRangeSelection as As,FORMAT_TEXT_COMMAND as Ds}from"lexical";import{jsx as br}from"react/jsx-runtime";import"react";var _r=()=>br("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:br("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=t=>({type:"buttons",items:t,key:"format",order:40});var Tr={type:"text-format",format:["bold","italic"],tag:"***"},Er={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},wr={type:"text-format",format:["bold"],tag:"**"},Nr={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var kr=[U([{ChildComponent:_r,isActive:({selection:t})=>As(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(Ds,"bold")},order:1}])],Fs=S(({featureProviderMap:t})=>{let e=[wr,Nr];return t.get("italic")&&e.push(Er,Tr),{markdownTransformers:e,toolbarFixed:{groups:kr},toolbarInline:{groups:kr}}});import{$isRangeSelection as Ps,FORMAT_TEXT_COMMAND as $s}from"lexical";import{jsx as Lr,jsxs as Os}from"react/jsx-runtime";import"react";var Ir=()=>Os("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:[Lr("path",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),Lr("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var Rr={type:"text-format",format:["code"],tag:"`"};var Sr=[U([{ChildComponent:Ir,isActive:({selection:t})=>Ps(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand($s,"code")},order:7}])],Hs=S({markdownTransformers:[Rr],toolbarFixed:{groups:Sr},toolbarInline:{groups:Sr}});import{$isRangeSelection as Bs,FORMAT_TEXT_COMMAND as js}from"lexical";import{jsx as yr}from"react/jsx-runtime";import"react";var Mr=()=>yr("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:yr("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:"*"},Ar={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var Dr=[U([{ChildComponent:Mr,isActive:({selection:t})=>Bs(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(js,"italic")},order:2}])],Gs=S({markdownTransformers:[vr,Ar],toolbarFixed:{groups:Dr},toolbarInline:{groups:Dr}});import{$isRangeSelection as Ws,FORMAT_TEXT_COMMAND as Vs}from"lexical";import{jsx as Fr,jsxs as Us}from"react/jsx-runtime";import"react";var Or=()=>Us("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:[Fr("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"}),Fr("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var Pr={type:"text-format",format:["strikethrough"],tag:"~~"};var $r=[U([{ChildComponent:Or,isActive:({selection:t})=>Ws(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(Vs,"strikethrough")},order:4}])],zs=S({markdownTransformers:[Pr],toolbarFixed:{groups:$r},toolbarInline:{groups:$r}});import{$isRangeSelection as Ks,FORMAT_TEXT_COMMAND as Zs}from"lexical";import{jsx as Hr}from"react/jsx-runtime";import"react";var Br=()=>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.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 jr=[U([{ChildComponent:Br,isActive:({selection:t})=>Ks(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(Zs,"subscript")},order:5}])],Ys=S({toolbarFixed:{groups:jr},toolbarInline:{groups:jr}});import{$isRangeSelection as Xs,FORMAT_TEXT_COMMAND as Js}from"lexical";import{jsx as Gr}from"react/jsx-runtime";import"react";var Ur=()=>Gr("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:Gr("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 Wr=[U([{ChildComponent:Ur,isActive:({selection:t})=>Xs(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(Js,"superscript")},order:6}])],qs=S({toolbarFixed:{groups:Wr},toolbarInline:{groups:Wr}});import{$isRangeSelection as ea,FORMAT_TEXT_COMMAND as ta}from"lexical";import{jsx as Vr,jsxs as Qs}from"react/jsx-runtime";import"react";var zr=()=>Qs("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 Kr=[U([{ChildComponent:zr,isActive:({selection:t})=>ea(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(ta,"underline")},order:3}])],oa=S({toolbarFixed:{groups:Kr},toolbarInline:{groups:Kr}});import{$createHeadingNode as la,$isHeadingNode as an,HeadingNode as sa}from"@lexical/rich-text";import{$setBlocksType as aa}from"@lexical/selection";import{$getSelection as ca,$isRangeSelection as ua}from"lexical";import{jsx as Zr}from"react/jsx-runtime";import"react";var Yr=()=>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.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 Xr}from"react/jsx-runtime";import"react";var Jr=()=>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.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";import"react";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";import"react";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";import"react";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";import"react";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 ra,$isHeadingNode as na,HeadingNode as ia}from"@lexical/rich-text";var qt=t=>(e,o,n)=>{let r=t(n);r&&(r.append(...o),e.replace(r),r.select(0,0))};var sn=t=>{let o=`^(${t.map(r=>Number(r.slice(1))).map(r=>`#{${r}}`).join("|")})\\s`,n=new RegExp(o);return{type:"element",dependencies:[ia],export:(r,i)=>{if(!na(r))return null;let l=Number(r.getTag().slice(1));return"#".repeat(l)+" "+i(r)},regExp:n,replace:qt(r=>{let i="h"+r[1].length;return ra(i)})}};var cn=t=>{let e=ca();aa(e,()=>la(t))},un={h1:Yr,h2:Jr,h3:Qr,h4:tn,h5:rn,h6:ln},da=S(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[V(e.map((n,r)=>({ChildComponent:un[n],isActive:({selection:i})=>{if(!ua(i))return!1;for(let l of i.getNodes()){if(an(l)&&l.getTag()===n)continue;let s=l.getParent();if(!(an(s)&&s.getTag()===n))return!1}return!0},key:n,label:({i18n:i})=>i.t("lexical:heading:label",{headingLevel:n.charAt(1)}),onSelect:({editor:i})=>{i.update(()=>{cn(n)})},order:r+2})))];return{markdownTransformers:[sn(e)],nodes:[sa],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[G(e.map(n=>({Icon:un[n],key:`heading-${n.charAt(1)}`,keywords:["heading",n],label:({i18n:r})=>r.t("lexical:heading:label",{headingLevel:n.charAt(1)}),onSelect:({editor:r})=>{r.update(()=>{cn(n)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}});import{$isNodeSelection as _a}from"lexical";import{jsx as dn}from"react/jsx-runtime";import"react";var Qt=()=>dn("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:dn("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as mn,jsxs as ma}from"react/jsx-runtime";import"react";var fn=()=>ma("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[mn("path",{d:"M5 10h10",stroke:"currentColor"}),mn("path",{d:"M10 15V5",stroke:"currentColor"})]});var q=t=>({type:"dropdown",ChildComponent:fn,items:t,key:"add",order:10});var pn={type:"element",dependencies:[Ze],export:(t,e)=>Xe(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=Ye();e&&t.replace(e)}};import{c as fa}from"react/compiler-runtime";import{useLexicalComposerContext as pa}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as ha}from"@lexical/utils";import{$getSelection as ga,$isRangeSelection as Ca,COMMAND_PRIORITY_EDITOR as xa}from"lexical";import{useEffect as ba}from"react";var hn=()=>{let t=fa(3),[e]=pa(),o,n;return t[0]!==e?(o=()=>e.registerCommand(Le,r=>{let i=ga();if(!Ca(i))return!1;if(i.focus.getNode()!==null){let s=Ye();ha(s)}return!0},xa),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),ba(o,n),null};var Ta=S({markdownTransformers:[pn],nodes:[Ze],plugins:[{Component:hn,position:"normal"}],slashMenu:{groups:[G([{Icon:Qt,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Le,void 0)}}])]},toolbarFixed:{groups:[q([{ChildComponent:Qt,isActive:({selection:t})=>{if(!_a(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Xe(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Le,void 0)}}])]}});import{INDENT_CONTENT_COMMAND as Na,OUTDENT_CONTENT_COMMAND as ka}from"lexical";import{jsx as st,jsxs as Ea}from"react/jsx-runtime";import"react";var gn=()=>Ea("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[st("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),st("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),st("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),st("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as at,jsxs as wa}from"react/jsx-runtime";import"react";var Cn=()=>wa("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[at("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),at("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),at("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),at("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});var xn=t=>({type:"buttons",items:t,key:"indent",order:35});var bn=[xn([{ChildComponent:gn,isActive:()=>!1,isEnabled:({selection:t})=>{if(!t||!t?.getNodes()?.length)return!1;for(let e of t.getNodes()){let o=e.getParentOrThrow();if("__indent"in e&&e.__indent>0||"__indent"in o&&o.__indent>0)return!0}return!1},key:"indentDecrease",label:({i18n:t})=>t.t("lexical:indent:decreaseLabel"),onSelect:({editor:t})=>{t.dispatchCommand(ka,void 0)},order:1},{ChildComponent:Cn,isActive:()=>!1,key:"indentIncrease",label:({i18n:t})=>t.t("lexical:indent:increaseLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Na,void 0)},order:2}])],La=S({toolbarFixed:{groups:bn},toolbarInline:{groups:bn}});import{$findMatchingParent as Fc}from"@lexical/utils";import{$getSelection as so,$isRangeSelection as Yn}from"lexical";import{jsx as _n}from"react/jsx-runtime";import"react";var Tn=()=>_n("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:_n("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 En}from"@lexical/selection";function he(t){let{anchor:e}=t,{focus:o}=t,n=t.anchor.getNode(),r=t.focus.getNode();return n===r?n:t.isBackward()?En(o)?n:r:En(e)?n:r}var eo=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as Pa,$isTextNode as $a}from"lexical";import{addClassNamesToElement as Ia,isHTMLAnchorElement as Ra}from"@lexical/utils";import ro from"bson-objectid";import{$applyNodeReplacement as Sa,$createTextNode as wn,$getSelection as ya,$isElementNode as Nn,$isRangeSelection as oo,createCommand as Ma,ElementNode as va}from"lexical";var Aa=new Set(["http:","https:","mailto:","sms:","tel:"]),z=class t extends va{__fields;__id;constructor({id:e,fields:o={doc:null,linkType:"custom",newTab:!1,url:""},key:n}){super(n),this.__fields=o,this.__id=e}static clone(e){return new t({id:e.__id,fields:e.__fields,key:e.__key})}static getType(){return"link"}static importDOM(){return{a:e=>({conversion:Da,priority:1})}}static importJSON(e){e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),e.version===2&&!e.id&&(e.id=new ro.default().toHexString(),e.version=3);let o=Q({id:e.id,fields:e.fields});return o.setFormat(e.format),o.setIndent(e.indent),o.setDirection(e.direction),o}canBeEmpty(){return!1}canInsertTextAfter(){return!1}canInsertTextBefore(){return!1}createDOM(e){let o=document.createElement("a");return this.__fields?.linkType==="custom"&&(o.href=this.sanitizeUrl(this.__fields.url??"")),(this.__fields?.newTab??!1)&&(o.target="_blank"),this.__fields?.newTab===!0&&this.__fields?.linkType==="custom"&&(o.rel=to(o.rel,"add","noopener")),Ia(o,e.theme.link),o}exportJSON(){let e={...super.exportJSON(),type:"link",fields:this.getFields(),version:3},o=this.getID();return o&&(e.id=o),e}extractWithChild(e,o,n){if(!oo(o))return!1;let r=o.anchor.getNode(),i=o.focus.getNode();return this.isParentOf(r)&&this.isParentOf(i)&&o.getTextContent().length>0}getFields(){return this.getLatest().__fields}getID(){return this.getLatest().__id}insertNewAfter(e,o=!0){let n=this.getParentOrThrow().insertNewAfter(e,o);if(Nn(n)){let r=Q({fields:this.__fields});return n.append(r),r}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!Aa.has(o.protocol))return"about:blank"}catch{return"https://"}return e}setFields(e){let o=this.getWritable();o.__fields=e}updateDOM(e,o,n){let r=this.__fields?.url,i=this.__fields?.newTab;return r!=null&&r!==e.__fields?.url&&this.__fields?.linkType==="custom"&&(o.href=r),this.__fields?.linkType==="internal"&&e.__fields?.linkType==="custom"&&o.removeAttribute("href"),o.rel==null&&(o.rel=""),i!==e.__fields?.newTab&&(i??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=to(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=to(o.rel,"remove","noopener"))),!1}};function Da(t){let e=null;if(Ra(t)){let o=t.textContent;o!==null&&o!==""&&(e=Q({id:new ro.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function Q({id:t,fields:e}){return Sa(new z({id:t??new ro.default().toHexString(),fields:e}))}function j(t){return t instanceof z}var Y=Ma("TOGGLE_LINK_COMMAND");function kn(t){let e=ya();if(!oo(e)&&!t.selectedNodes?.length)return;let o=oo(e)?e.extract():t.selectedNodes;if(t===null)o?.forEach(n=>{let r=n.getParent();if(j(r)){let i=r.getChildren();for(let l=0;l<i.length;l+=1)r.insertBefore(i[l]);r.remove()}});else{if(o?.length===1){let i=o[0],l=j(i)?i:Fa(i);if(l!==null){l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append(wn(t.text)),l.getChildren().forEach(s=>{s!==l.getLastChild()&&s.remove()}));return}}let n=null,r=null;o?.forEach(i=>{let l=i.getParent();if(!(l===r||l===null||Nn(i)&&!i.isInline())){if(j(l)){r=l,l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append(wn(t.text)),l.getChildren().forEach(s=>{s!==l.getLastChild()&&s.remove()}));return}if(l.is(n)||(n=l,r=Q({fields:t.fields}),j(l)?i.getPreviousSibling()===null?l.insertBefore(r):l.insertAfter(r):i.insertBefore(r)),j(i)){if(i.is(r))return;if(r!==null){let s=i.getChildren();for(let a=0;a<s.length;a+=1)r.append(s[a])}i.remove();return}r!==null&&r.append(i)}})}}function Fa(t){return Oa(t,e=>j(e))}function Oa(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function to(t,e,o){let n,r=`${t}`;if(e==="add"){if(r.includes(o)){let i=new RegExp(o,"g");r=r.replace(i,"").trim()}r=r.trim(),n=r.length===0?`${o}`:`${r} ${o}`}else{let i=new RegExp(o,"g");n=r.replace(i,"").trim()}return n}var Ln={type:"text-match",dependencies:[z],export:(t,e,o)=>{if(!j(t))return null;let n=t,{url:r}=n.getFields(),i=`[${n.getTextContent()}](${r})`,l=n.getFirstChild();return n.getChildrenSize()===1&&$a(l)?o(l,i):i},importRegExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:(t,e)=>{let[,o,n]=e,r=Q({fields:{doc:null,linkType:"custom",newTab:!1,url:n}}),i=Pa(o);i.setFormat(t.getFormat()),r.append(i),t.replace(r)},trigger:")"};import{$applyNodeReplacement as Ha,$isElementNode as Ba}from"lexical";var ee=class t extends z{static clone(e){return new t({id:"",fields:e.__fields,key:e.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(e){e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2);let o=Oe({fields:e.fields});return o.setFormat(e.format),o.setIndent(e.indent),o.setDirection(e.direction),o}exportJSON(){let e=super.exportJSON();return{type:"autolink",children:e.children,direction:e.direction,fields:e.fields,format:e.format,indent:e.indent,version:2}}insertNewAfter(e,o=!0){let n=this.getParentOrThrow().insertNewAfter(e,o);if(Ba(n)){let r=Oe({fields:this.__fields});return n.append(r),r}return null}};function Oe({fields:t}){return Ha(new ee({id:"",fields:t}))}function te(t){return t instanceof ee}import{c as ja}from"react/compiler-runtime";import{useLexicalComposerContext as Ga}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Ua}from"@lexical/utils";import{$createTextNode as In,$getSelection as Wa,$isElementNode as Sn,$isLineBreakNode as yn,$isNodeSelection as Va,$isRangeSelection as za,$isTextNode as Pe,TextNode as Ka}from"lexical";import{useEffect as Za}from"react";function Rn(t,e=o=>o){return o=>{let n=t.exec(o);return n===null?null:{index:n.index,length:n[0].length,text:n[0],url:e(n[0])}}}function Mn(t,e){for(let o=0;o<e.length;o++){let n=e[o](t);if(n!=null)return n}return null}var Ya=/[.,;\s]/;function ut(t){return Ya.test(t)}function vn(t){return ut(t[t.length-1])}function io(t){return ut(t[0])}function Xa(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function An(t){let e=t.getPreviousSibling();return Sn(e)&&(e=e.getLastDescendant()),e===null||yn(e)||Pe(e)&&vn(e.getTextContent())}function Dn(t){let e=t.getNextSibling();return Sn(e)&&(e=e.getFirstDescendant()),e===null||yn(e)||Pe(e)&&io(e.getTextContent())}function Ja(t,e,o,n){return(t>0?ut(o[t-1]):An(n[0]))?e<o.length?ut(o[e]):Dn(n[n.length-1]):!1}function qa(t,e,o){let n=[],r=[],i=[],l=0,s=0,a=[...t];for(;a.length>0;){let c=a[0],d=c.getTextContent().length,m=s;s+d<=e?(n.push(c),l+=d):m>=o?i.push(c):r.push(c),s+=d,a.shift()}return[l,n,r,i]}function Qa(t,e,o,n){let r={linkType:"custom",url:n.url,...n.fields},i=Oe({fields:r});if(t.length===1){let l=t[0],s;e===0?[s,l]=l.splitText(o):[,s,l]=l.splitText(e,o);let a=In(n.text);return a.setFormat(s.getFormat()),a.setDetail(s.getDetail()),a.setStyle(s.getStyle()),i.append(a),s.replace(i),l}else if(t.length>1){let l=t[0],s=l.getTextContent().length,a;e===0?a=l:[,a]=l.splitText(e);let c=[],u;for(let p=1;p<t.length;p++){let h=t[p],E=h.getTextContent().length,v=s,y=s+E;if(v<o)if(y<=o)c.push(h);else{let[g,_]=h.splitText(o-v);c.push(g),u=_}s+=E}let d=Wa(),m=d?d.getNodes().find(Pe):void 0,f=In(a.getTextContent());return f.setFormat(a.getFormat()),f.setDetail(a.getDetail()),f.setStyle(a.getStyle()),i.append(f,...c),m&&m===a&&(za(d)?f.select(d.anchor.offset,d.focus.offset):Va(d)&&f.select(0,f.getTextContent().length)),a.replace(i),u}}function ec(t,e,o){let n=[...t],r=n.map(a=>a.getTextContent()).join(""),i=r,l,s=0;for(;(l=Mn(i,e))!=null&&l!==null;){let a=l.index,c=l.length,u=a+c;if(Ja(s+a,s+u,r,n)){let[m,,f,p]=qa(n,s+a,s+u),h=s+a-m,x=s+u-m,E=Qa(f,h,x,l);n=E?[E,...p]:p,o(l.url,null),s=0}else s+=u;i=i.substring(u)}}function no(t,e,o){let n=t.getChildren(),r=n.length;for(let a=0;a<r;a++){let c=n[a];if(!Pe(c)||!c.isSimpleText()){ct(t),o(null,t.getFields()?.url??null);return}}let i=t.getTextContent(),l=Mn(i,e);if(l===null||l.text!==i){ct(t),o(null,t.getFields()?.url??null);return}if(!An(t)||!Dn(t)){ct(t),o(null,t.getFields()?.url??null);return}let s=t.getFields()?.url;if(s!==l?.url){let a=t.getFields();a.url=l?.url,t.setFields(a),o(l.url,s??null)}}function tc(t,e,o){let n=t.getPreviousSibling(),r=t.getNextSibling(),i=t.getTextContent();if(te(n)){let l=n.getFields()?.url?n.getFields()?.url?.startsWith("mailto:"):!1;(!io(i)||Xa(i,l))&&(n.append(t),no(n,e,o),o(null,n.getFields()?.url??null))}te(r)&&!vn(i)&&(ct(r),no(r,e,o),o(null,r.getFields()?.url??null))}function ct(t){let e=t.getChildren(),o=e.length;for(let n=o-1;n>=0;n--)t.insertAfter(e[n]);return t.remove(),e.map(n=>n.getLatest())}function oc(t){let e=[t],o=t.getNextSibling();for(;o!==null&&Pe(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function rc(t,e,o){let n=ja(5),r,i;n[0]!==t||n[1]!==o||n[2]!==e?(r=()=>{if(!t.hasNodes([ee]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let l=(s,a)=>{o?.(s,a)};return Ua(t.registerNodeTransform(Ka,s=>{let a=s.getParentOrThrow(),c=s.getPreviousSibling();if(te(a))no(a,e,l);else if(!j(a)){if(s.isSimpleText()&&(io(s.getTextContent())||!te(c))){let u=oc(s);ec(u,e,l)}tc(s,e,l)}}))},i=[t,e,o],n[0]=t,n[1]=o,n[2]=e,n[3]=r,n[4]=i):(r=n[3],i=n[4]),Za(r,i)}var nc=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,ic=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,lc=[Rn(nc,t=>t.startsWith("http")?t:`https://${t}`),Rn(ic,t=>`mailto:${t}`)],Fn=()=>{let[t]=Ga();return rc(t,lc),null};import{jsx as sc}from"react/jsx-runtime";import{ClickableLinkPlugin as ac}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var On=()=>sc(ac,{});import{jsx as wc}from"react/jsx-runtime";import"react";import{createPortal as Nc}from"react-dom";import{jsx as le,jsxs as lo}from"react/jsx-runtime";import{useLexicalComposerContext as uc}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as Pn,mergeRegister as $n}from"@lexical/utils";import{getTranslation as dc}from"@payloadcms/translations";import{CloseMenuIcon as mc,EditIcon as fc,formatDrawerSlug as pc,useConfig as hc,useEditDepth as gc,useTranslation as Cc}from"@payloadcms/ui";import{$getSelection as Hn,$isLineBreakNode as xc,$isRangeSelection as Bn,COMMAND_PRIORITY_HIGH as bc,COMMAND_PRIORITY_LOW as jn,KEY_ESCAPE_COMMAND as _c,SELECTION_CHANGE_COMMAND as Tc}from"lexical";import Gn,{useCallback as Un,useEffect as ft,useRef as Ec,useState as ge}from"react";function dt(t,e,o,n=10,r=5){let i=o.parentElement;if(t===null||i==null){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let l=e.getBoundingClientRect(),s=o.getBoundingClientRect(),a=i.getBoundingClientRect(),c=t.top-n,u=t.left-r;c<a.top&&(c+=l.height+t.height+n*2),u+l.width>a.right&&(u=a.right-l.width-r),c-=s.top,u-=s.left,e.style.opacity="1",e.style.transform=`translate(${u}px, ${c}px)`}import{createCommand as cc}from"lexical";var mt=cc("TOGGLE_LINK_WITH_MODAL_COMMAND");function Wn({anchorElem:t}){let[e]=uc(),o=Ec(null),[n,r]=ge(null),[i,l]=ge(null),{uuid:s}=H(),{config:a}=hc(),{i18n:c,t:u}=Cc(),[d,m]=ge(),f=gc(),[p,h]=ge(!1),[x,E]=ge([]),[v,y]=ge(!1),g=pc({slug:"lexical-rich-text-link-"+s,depth:f}),{toggleDrawer:_}=Bo(g),b=Un(()=>{h(!1),o&&o.current&&(o.current.style.opacity="0",o.current.style.transform="translate(-10000px, -10000px)"),y(!1),r(null),l(null),E([]),m(void 0)},[h,r,l,E]),I=Un(()=>{let w=Hn(),C;if(!Bn(w)||!w){b();return}let L=he(w);C=e.getElementByKey(L.getKey())?.getBoundingClientRect();let T=Pn(L,j),N=w.getNodes().filter(F=>!xc(F)).find(F=>{let $=Pn(F,j);return T&&!T.is($)||$&&!$.is(T)});if(T==null||N){b();return}let k={...T.getFields(),id:T.getID(),text:T.getTextContent()};if(T.getFields()?.linkType==="custom")r(T.getFields()?.url??null),l(null);else{r(`${a.routes.admin==="/"?"":a.routes.admin}/collections/${T.getFields()?.doc?.relationTo}/${T.getFields()?.doc?.value}`);let F=a.collections.find($=>$.slug===T.getFields()?.doc?.relationTo);if(!F)l(T.getFields()?.label?String(T.getFields()?.label):null),r(T.getFields()?.url?String(T.getFields()?.url):null);else{let $=u("fields:linkedTo",{label:dc(F.labels.singular,c)}).replace(/<[^>]*>?/g,"");l($)}}m(k),h(!0),E(w?w?.getNodes():[]),te(T)?y(!0):y(!1);let R=o.current,M=window.getSelection(),{activeElement:A}=document;if(R===null)return;let O=e.getRootElement();return M!==null&&O!==null&&O.contains(M.anchorNode)?(C||(C=M.getRangeAt(0).getBoundingClientRect()),C!=null&&(C.y+=40,dt(C,R,t))):(A==null||A.className!=="link-input")&&(O!==null&&dt(null,R,t),r(null),l(null)),!0},[e,b,a.collections,u,c,t]);return ft(()=>$n(e.registerCommand(mt,w=>(e.dispatchCommand(Y,w),I(),_(),!0),jn)),[e,I,_,g]),ft(()=>{let w=t.parentElement,C=()=>{e.getEditorState().read(()=>{I()})};return window.addEventListener("resize",C),w?.addEventListener("scroll",C),()=>{window.removeEventListener("resize",C),w?.removeEventListener("scroll",C)}},[t.parentElement,e,I]),ft(()=>$n(e.registerUpdateListener(({editorState:w})=>{w.read(()=>{I()})}),e.registerCommand(Tc,()=>(I(),!0),jn),e.registerCommand(_c,()=>p?(b(),!0):!1,bc)),[e,I,p,b]),ft(()=>{e.getEditorState().read(()=>{I()})},[e,I]),lo(Gn.Fragment,{children:[le("div",{className:"link-editor",ref:o,children:lo("div",{className:"link-input",children:[n&&n.length>0?le("a",{href:n,rel:"noopener noreferrer",target:"_blank",children:i!=null&&i.length>0?i:n}):i!=null&&i.length>0?le("span",{className:"link-input__label-pure",children:i}):null,e.isEditable()&&lo(Gn.Fragment,{children:[le("button",{"aria-label":"Edit link",className:"link-edit",onClick:()=>{_()},onMouseDown:w=>{w.preventDefault()},tabIndex:0,type:"button",children:le(fc,{})}),!v&&le("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(Y,null)},onMouseDown:w=>{w.preventDefault()},tabIndex:0,type:"button",children:le(mc,{})})]})]})}),le(ce,{className:"lexical-link-edit-drawer",data:d,drawerSlug:g,drawerTitle:u("fields:editLink"),featureKey:"link",handleDrawerSubmit:(w,C)=>{let L=C,T={...L};delete T.text,e.update(()=>{let N=Hn(),k=null;if(Bn(N)?k=he(N).getParent():x.length&&(k=x[0].getParent()),k&&te(k)){let R=Q({fields:T});k.replace(R,!0)}}),e.dispatchCommand(Y,{fields:T,selectedNodes:x,text:L.text})},schemaPathSuffix:"fields"})]})}var Vn=t=>{let{anchorElem:e=document.body}=t;return Nc(wc(Wn,{anchorElem:e}),e)};import{c as Ic}from"react/compiler-runtime";import{useLexicalComposerContext as Rc}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Sc}from"@lexical/utils";import{$getSelection as yc,$isElementNode as Mc,$isRangeSelection as vc,COMMAND_PRIORITY_LOW as Kn,PASTE_COMMAND as Ac}from"lexical";import{useEffect as Dc}from"react";var kc=/(?:[A-Za-z]{3,9}:(?:\/\/)?(?:[-;:&=+$,\w]+@)?[A-Za-z\d.-]+|(?:www.|[-;:&=+$,\w]+@)[A-Za-z\d.-]+)(?:\/[+~%/.\w-]*)?\??[-+=&;%@.\w]*#?\w*/,Lc=/^[\w\-./]*(?:#\w[\w-]*)?$/;function zn(t){if(!t)return!1;if(t==="https://"||kc.test(t)||Lc.test(t))return!0;try{return new URL(t),!0}catch{}return!1}var Zn=()=>{let t=Ic(3),[e]=Rc(),o,n;return t[0]!==e?(o=()=>{if(!e.hasNodes([z]))throw new Error("LinkPlugin: LinkNode not registered on editor");return Sc(e.registerCommand(Y,r=>(kn(r),!0),Kn),e.registerCommand(Ac,r=>{let i=yc();if(!vc(i)||i.isCollapsed()||!(r instanceof ClipboardEvent)||r.clipboardData==null)return!1;let l=r.clipboardData.getData("text");if(!zn(l))return!1;if(!i.getNodes().some(s=>Mc(s))){let s={doc:null,linkType:"custom",newTab:!1,url:l};return e.dispatchCommand(Y,{fields:s,text:null}),r.preventDefault(),!0}return!1},Kn))},n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),Dc(o,n),null};var Xn=[eo([{ChildComponent:Tn,isActive:({selection:t})=>{if(Yn(t)){let e=he(t);return Fc(e,j)!=null}return!1},isEnabled:({selection:t})=>!!(Yn(t)&&so()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(Y,null);else{let o,n=[];if(t.getEditorState().read(()=>{o=so()?.getTextContent(),n=so()?.getNodes()??[]}),!o?.length)return;let r={doc:null,linkType:"custom",newTab:!1,url:"https://"};t.dispatchCommand(mt,{fields:r,selectedNodes:n,text:o})}},order:1}])],Oc=S({markdownTransformers:[Ln],nodes:[z,ee],plugins:[{Component:Zn,position:"normal"},{Component:Fn,position:"normal"},{Component:On,position:"normal"},{Component:Vn,position:"floatingAnchorElem"}],toolbarFixed:{groups:Xn},toolbarInline:{groups:Xn}});import{$isListNode as uo,INSERT_CHECK_LIST_COMMAND as oi,ListItemNode as Zc,ListNode as Yc}from"@lexical/list";import{$isRangeSelection as Xc}from"lexical";import{jsx as Jn,jsxs as Pc}from"react/jsx-runtime";import"react";var ao=()=>Pc("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{jsx as $c}from"react/jsx-runtime";import{ListPlugin as Hc}from"@lexical/react/LexicalListPlugin.js";import"react";var Ce=()=>$c(Hc,{});function xe(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as Uc,ListItemNode as Wc,ListNode as Vc}from"@lexical/list";import{$createListItemNode as Bc,$createListNode as jc,$isListItemNode as Gc,$isListNode as co}from"@lexical/list";var qn=4,be=t=>(e,o,n)=>{let r=e.getPreviousSibling(),i=e.getNextSibling(),l=Bc(t==="check"?n[3]==="x":void 0);if(co(i)&&i.getListType()===t){let a=i.getFirstChild();a!==null?a.insertBefore(l):i.append(l),e.remove()}else if(co(r)&&r.getListType()===t)r.append(l),e.remove();else{let a=jc(t,t==="number"?Number(n[2]):void 0);a.append(l),e.replace(a)}l.append(...o),l.select(0,0);let s=Math.floor(n[1].length/qn);s&&l.setIndent(s)},me=(t,e,o)=>{let n=[],r=t.getChildren(),i=0;for(let l of r)if(Gc(l)){if(l.getChildrenSize()===1){let u=l.getFirstChild();if(co(u)){n.push(me(u,e,o+1));continue}}let s=" ".repeat(o*qn),a=t.getListType(),c=a==="number"?`${t.getStart()+i}. `:a==="check"?`- [${l.getChecked()?"x":" "}] `:"- ";n.push(s+c+e(l)),i++}return n.join(`
|
|
35
|
-
`)};var Qn={type:"element",dependencies:[Vc,Wc],export:(t,e)=>Uc(t)?me(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:be("check")};import{jsx as zc}from"react/jsx-runtime";import{CheckListPlugin as Kc}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var ei=()=>zc(Kc,{});var ti=[V([{ChildComponent:ao,isActive:({selection:t})=>{if(!Xc(t))return!1;for(let e of t.getNodes()){if(uo(e)&&e.getListType()==="check")continue;let o=e.getParent();if(uo(o)&&o.getListType()==="check")continue;let n=o?.getParent();if(!(uo(n)&&n.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(oi,void 0)},order:12}])],Jc=S(({featureProviderMap:t})=>{let e=[{Component:ei,position:"normal"}];return!t.has("unorderedList")&&!t.has("orderedList")&&e.push({Component:Ce,position:"normal"}),{markdownTransformers:[Qn],nodes:t.has("unorderedList")||t.has("orderedList")?[]:[Yc,Zc],plugins:e,slashMenu:{groups:[xe([{Icon:ao,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:o})=>o.t("lexical:checklist:label"),onSelect:({editor:o})=>{o.dispatchCommand(oi,void 0)}}])]},toolbarFixed:{groups:ti},toolbarInline:{groups:ti}}});import{$isListNode as fo,INSERT_ORDERED_LIST_COMMAND as ii,ListItemNode as ou,ListNode as ru}from"@lexical/list";import{$isRangeSelection as nu}from"lexical";import{jsx as $e,jsxs as qc}from"react/jsx-runtime";import"react";var mo=()=>qc("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[$e("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"}),$e("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"}),$e("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),$e("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),$e("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Qc,ListItemNode as eu,ListNode as tu}from"@lexical/list";var ri={type:"element",dependencies:[tu,eu],export:(t,e)=>Qc(t)?me(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:be("number")};var ni=[V([{ChildComponent:mo,isActive:({selection:t})=>{if(!nu(t))return!1;for(let e of t.getNodes()){if(fo(e)&&e.getListType()==="number")continue;let o=e.getParent();if(fo(o)&&o.getListType()==="number")continue;let n=o?.getParent();if(!(fo(n)&&n.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(ii,void 0)},order:10}])],iu=S(({featureProviderMap:t})=>({markdownTransformers:[ri],nodes:t.has("orderedList")?[]:[ru,ou],plugins:t.has("orderedList")?[]:[{Component:Ce,position:"normal"}],slashMenu:{groups:[xe([{Icon:mo,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:e})=>e.t("lexical:orderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(ii,void 0)}}])]},toolbarFixed:{groups:ni},toolbarInline:{groups:ni}}));import{$isListNode as ho,INSERT_UNORDERED_LIST_COMMAND as ai,ListItemNode as uu,ListNode as du}from"@lexical/list";import{$isRangeSelection as mu}from"lexical";import{jsx as _e,jsxs as lu}from"react/jsx-runtime";import"react";var po=()=>lu("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:[_e("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),_e("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),_e("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),_e("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),_e("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),_e("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as su,ListItemNode as au,ListNode as cu}from"@lexical/list";var li={type:"element",dependencies:[cu,au],export:(t,e)=>su(t)?me(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:be("bullet")};var si=[V([{ChildComponent:po,isActive:({selection:t})=>{if(!mu(t))return!1;for(let e of t.getNodes()){if(ho(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(ho(o)&&o.getListType()==="bullet")continue;let n=o?.getParent();if(!(ho(n)&&n.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(ai,void 0)},order:11}])],fu=S({markdownTransformers:[li],nodes:[du,uu],plugins:[{Component:Ce,position:"normal"}],slashMenu:{groups:[xe([{Icon:po,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(ai,void 0)}}])]},toolbarFixed:{groups:si},toolbarInline:{groups:si}});import{jsx as pu}from"react/jsx-runtime";import{addClassNamesToElement as hu}from"@lexical/utils";import{DecoratorNode as gu}from"lexical";import*as ci from"react";var Cu=ci.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),He=class t extends gu{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new t({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return xu({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return hu(o,"unknownConverted"),o}decorate(){return pu(Cu,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function xu({data:t}){return new He({data:t})}var bu=S(()=>({nodes:[He]}));import{jsx as _u}from"react/jsx-runtime";import{addClassNamesToElement as Tu}from"@lexical/utils";import{DecoratorNode as Eu}from"lexical";import*as ui from"react";var wu=ui.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),Be=class t extends Eu{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new t({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return Nu({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return Tu(o,"unknownConverted"),o}decorate(){return _u(wu,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function Nu({data:t}){return new Be({data:t})}var ku=S(()=>({nodes:[Be]}));import{$setBlocksType as fi}from"@lexical/selection";import{$createParagraphNode as pi,$getSelection as hi,$isParagraphNode as di,$isRangeSelection as Lu}from"lexical";var mi=[V([{ChildComponent:Fe,isActive:({selection:t})=>{if(!Lu(t))return!1;for(let e of t.getNodes())if(!di(e)&&!di(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=hi();fi(e,()=>pi())})},order:1}])],Iu=S({slashMenu:{groups:[G([{Icon:Fe,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=hi();fi(e,()=>pi())})}}])]},toolbarFixed:{groups:mi},toolbarInline:{groups:mi}});import{$isNodeSelection as td}from"lexical";import{jsx as je,jsxs as Ru}from"react/jsx-runtime";import"react";var go=()=>Ru("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:[je("g",{clipPath:"url(#clip0_4397_10817)",children:je("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"})}),je("defs",{children:je("clipPath",{id:"clip0_4397_10817",children:je("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{c as Uu}from"react/compiler-runtime";import{jsx as Wu}from"react/jsx-runtime";import{useLexicalComposerContext as Vu}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as zu}from"@lexical/utils";import{useConfig as Ku}from"@payloadcms/ui";import{$getPreviousSelection as Zu,$getSelection as Yu,$isParagraphNode as Ti,$isRangeSelection as Xu,COMMAND_PRIORITY_EDITOR as Ju,createCommand as qu}from"lexical";import{useEffect as Qu}from"react";import{c as $u}from"react/compiler-runtime";import{jsx as ht}from"react/jsx-runtime";import{useLexicalComposerContext as Hu}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as Bu,COMMAND_PRIORITY_EDITOR as ju}from"lexical";import{useEffect as Ci,useState as xi}from"react";import{c as Su}from"react/compiler-runtime";import{jsx as yu}from"react/jsx-runtime";import{useLexicalComposerContext as Mu}from"@lexical/react/LexicalComposerContext";import{useListDrawer as vu,useModal as Au}from"@payloadcms/ui";import{$getPreviousSelection as Du,$getSelection as Fu,$setSelection as Ou}from"lexical";import{useEffect as Pu,useState as gi}from"react";var pt=t=>{let e=Su(23),[o]=Mu(),[n,r]=gi(null),[i,l]=gi(!1),[s,a,c]=vu(t),{closeDrawer:u,drawerSlug:d,isDrawerOpen:m,openDrawer:f}=c,{modalState:p}=Au(),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let L=Fu()??Du();r(L)},e[0]=h):h=e[0];let x=h,E;e[1]!==n||e[2]!==o?(E=()=>{n&&o.update(()=>{Ou(n.clone())},{discrete:!0,skipTransforms:!0})},e[1]=n,e[2]=o,e[3]=E):E=e[3];let v=E,y;e[4]!==u?(y=()=>{u()},e[4]=u,e[5]=y):y=e[5];let g=y,_,b;e[6]!==i||e[7]!==p||e[8]!==d||e[9]!==v?(_=()=>{if(!i)return;let L=p[d];L&&!L?.isOpen&&(l(!1),setTimeout(()=>{v()},1))},b=[p,d,v,i],e[6]=i,e[7]=p,e[8]=d,e[9]=v,e[10]=_,e[11]=b):(_=e[10],b=e[11]),Pu(_,b);let I;e[12]!==a?(I=L=>yu(a,{...L,onClick:()=>{x()}}),e[12]=a,e[13]=I):I=e[13];let w;e[14]!==f?(w=()=>{x(),f(),l(!0)},e[14]=f,e[15]=w):w=e[15];let C;return e[16]!==g||e[17]!==m||e[18]!==s||e[19]!==d||e[20]!==I||e[21]!==w?(C={closeListDrawer:g,isListDrawerOpen:m,ListDrawer:s,listDrawerSlug:d,ListDrawerToggler:I,openListDrawer:w},e[16]=g,e[17]=m,e[18]=s,e[19]=d,e[20]=I,e[21]=w,e[22]=C):C=e[22],C};var Gu=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=Bu(o);r&&r.replace(Se({relationTo:e,value:n}))}):t.dispatchCommand(Co,{relationTo:e,value:n})},bi=t=>{let e=$u(21),{enabledCollectionSlugs:o}=t,[n]=Hu(),r;e[0]!==o?(r=()=>o?.[0],e[0]=o,e[1]=r):r=e[1];let[i,l]=xi(r),[s,a]=xi(null),c=o||void 0,u;e[2]!==c||e[3]!==i?(u={collectionSlugs:c,selectedCollection:i},e[2]=c,e[3]=i,e[4]=u):u=e[4];let{closeListDrawer:d,isListDrawerOpen:m,ListDrawer:f,openListDrawer:p}=pt(u),h,x;e[5]!==n||e[6]!==p?(h=()=>n.registerCommand(Ie,b=>(a(b?.replace?b?.replace.nodeKey:null),p(),!0),ju),x=[n,p],e[5]=n,e[6]=p,e[7]=h,e[8]=x):(h=e[7],x=e[8]),Ci(h,x);let E;e[9]!==n||e[10]!==s||e[11]!==d?(E=b=>{let{collectionSlug:I,docID:w}=b;Gu({editor:n,relationTo:I,replaceNodeKey:s,value:w}),d()},e[9]=n,e[10]=s,e[11]=d,e[12]=E):E=e[12];let v=E,y;e[13]!==o?(y=()=>{l(o?.[0])},e[13]=o,e[14]=y):y=e[14];let g;e[15]!==m||e[16]!==o?(g=[m,o],e[15]=m,e[16]=o,e[17]=g):g=e[17],Ci(y,g);let _;return e[18]!==v||e[19]!==f?(_=ht(f,{onSelect:v}),e[18]=v,e[19]=f,e[20]=_):_=e[20],_},_i=t=>(t?.enabledCollectionSlugs?.length??-1)>0?ht(bi,{...t}):ht(Je,{...t,children:ht(bi,{...t})});var Co=qu("INSERT_RELATIONSHIP_COMMAND"),Ei=t=>{let e=Uu(10),{clientProps:o}=t,[n]=Vu(),{config:r}=Ku(),{collections:i}=r,l=null;if(o?.enabledCollections)l=o?.enabledCollections;else if(o?.disabledCollections){let u;if(e[0]!==o||e[1]!==i){let d;e[3]!==o?(d=m=>{let{slug:f}=m;return!o?.disabledCollections?.includes(f)},e[3]=o,e[4]=d):d=e[4],u=i.filter(d).map(ed),e[0]=o,e[1]=i,e[2]=u}else u=e[2];l=u}let s,a;e[5]!==n?(s=()=>{if(!n.hasNodes([Re]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return n.registerCommand(Co,u=>{let d=Yu()||Zu();if(Xu(d)){let m=Se(u);zu(m);let{focus:f}=d,p=f.getNode();Ti(p)&&p.getTextContentSize()===0&&p.getParentOrThrow().getChildren().filter(h=>Ti(h)).length>1&&p.remove()}return!0},Ju)},a=[n],e[5]=n,e[6]=s,e[7]=a):(s=e[6],a=e[7]),Qu(s,a);let c;return e[8]!==l?(c=Wu(_i,{enabledCollectionSlugs:l}),e[8]=l,e[9]=c):c=e[9],c};function ed(t){let{slug:e}=t;return e}var od=S({nodes:[Re],plugins:[{Component:Ei,position:"normal"}],slashMenu:{groups:[G([{Icon:go,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ie,{replace:!1})}}])]},toolbarFixed:{groups:[q([{ChildComponent:go,isActive:({selection:t})=>{if(!td(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Ht(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ie,{replace:!1})}}])]}});import{c as gd}from"react/compiler-runtime";import{jsx as Z,jsxs as Cd}from"react/jsx-runtime";import{useLexicalComposerContext as xd}from"@lexical/react/LexicalComposerContext.js";import{useScrollInfo as bd,useThrottledEffect as _d,useTranslation as Td}from"@payloadcms/ui";import*as oe from"react";import{useMemo as Ed}from"react";import{jsx as rd}from"react/jsx-runtime";import{mergeRegister as nd}from"@lexical/utils";import{$getSelection as id}from"lexical";import{useCallback as ld,useEffect as gt,useState as xo}from"react";var bo="toolbar-popup__button",Ge=({children:t,editor:e,item:o})=>{let[n,r]=xo(!0),[i,l]=xo(!1),[s,a]=xo(bo),c=H(),u=ld(()=>{e.getEditorState().read(()=>{let d=id();if(d){if(o.isActive){let m=o.isActive({editor:e,editorConfigContext:c,selection:d});i!==m&&l(m)}if(o.isEnabled){let m=o.isEnabled({editor:e,editorConfigContext:c,selection:d});n!==m&&r(m)}}})},[i,e,c,n,o]);return gt(()=>{u()},[u]),gt(()=>(document.addEventListener("mouseup",u),()=>{document.removeEventListener("mouseup",u)}),[u]),gt(()=>nd(e.registerUpdateListener(()=>{u()})),[e,u]),gt(()=>{a([bo,n===!1?"disabled":"",i?"active":"",o?.key?`${bo}-`+o.key:""].filter(Boolean).join(" "))},[n,i,s,o.key]),rd("button",{className:s,onClick:()=>{if(n!==!1)return e._updateTags=new Set([...e._updateTags,"toolbar"]),e.focus(()=>{o.onSelect?.({editor:e,isActive:i})}),!0},onMouseDown:d=>{d.preventDefault()},type:"button",children:t})};import{c as Ri}from"react/compiler-runtime";import{jsx as We,jsxs as dd}from"react/jsx-runtime";import Eo,{useEffect as Ii}from"react";import{mergeRegister as md}from"@lexical/utils";import{useTranslation as fd}from"@payloadcms/ui";import{$getSelection as pd}from"lexical";import{jsx as se,jsxs as wi}from"react/jsx-runtime";import Ct,{useCallback as sd,useEffect as Ue,useMemo as ad,useRef as To,useState as xt}from"react";import{createPortal as cd}from"react-dom";var _o="toolbar-popup__dropdown-item",Ni=Ct.createContext(null);function ki({active:t,children:e,editor:o,enabled:n,item:r,title:i}){let[l,s]=xt(_o);Ue(()=>{s([_o,n===!1?"disabled":"",t?"active":"",r?.key?`${_o}-${r.key}`:""].filter(Boolean).join(" "))},[n,t,l,r.key]);let a=To(null),c=Ct.useContext(Ni);if(c===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:u}=c;return Ue(()=>{a?.current!=null&&u(a)},[a,u]),se("button",{className:l,onClick:()=>{n!==!1&&(o._updateTags=new Set([...o._updateTags,"toolbar"]),o.focus(()=>{r.onSelect?.({editor:o,isActive:t})}))},onMouseDown:d=>{d.preventDefault()},ref:a,title:i,type:"button",children:e})}function ud({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:n}){let[r,i]=xt(),[l,s]=xt(),a=sd(d=>{i(m=>m!=null?[...m,d]:[d])},[i]),c=d=>{if(r==null)return;let{key:m}=d;["ArrowDown","ArrowUp","Escape","Tab"].includes(m)&&d.preventDefault(),m==="Escape"||m==="Tab"?n():m==="ArrowUp"?s(f=>{if(f==null)return r[0];let p=r.indexOf(f)-1;return r[p===-1?r.length-1:p]}):m==="ArrowDown"&&s(f=>f==null?r[0]:r[r.indexOf(f)+1])},u=ad(()=>({registerItem:a}),[a]);return Ue(()=>{r!=null&&l==null&&s(r[0]),l!=null&&l?.current!=null&&l.current.focus()},[r,l]),se(Ni.Provider,{value:u,children:se("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:c,ref:e,children:t})})}function Li({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:n=!1,Icon:r,itemsContainerClassNames:i,label:l,stopCloseOnClickSelf:s}){let a=To(null),c=To(null),[u,d]=xt(!1),m=()=>{d(!1),c?.current!=null&&c.current.focus()};Ue(()=>{let p=c.current,h=a.current;if(u&&p!==null&&h!==null){let{left:x,top:E}=p.getBoundingClientRect(),v=window.scrollY||document.documentElement.scrollTop;h.style.top=`${E+v+p.offsetHeight+5}px`,h.style.left=`${Math.min(x-5,window.innerWidth-h.offsetWidth-20)}px`}},[a,c,u]),Ue(()=>{let p=c.current;if(p!==null&&u){let h=x=>{let{target:E}=x;s!=null&&a.current!=null&&a.current.contains(E)||p.contains(E)||d(!1)};return document.addEventListener("click",h),()=>{document.removeEventListener("click",h)}}},[a,c,u,s]);let f=cd(se(ud,{dropDownRef:a,itemsContainerClassNames:i,onClose:m,children:o}),document.body);return wi(Ct.Fragment,{children:[wi("button",{"aria-label":t,className:e+(u?" active":""),disabled:n,onClick:p=>{p.preventDefault(),d(!u)},onMouseDown:p=>{p.preventDefault()},ref:c,type:"button",children:[r&&se(r,{}),l&&se("span",{className:"toolbar-popup__dropdown-label",children:l}),se("i",{className:"toolbar-popup__dropdown-caret"})]}),u&&se(Ct.Fragment,{children:f})]})}var wo="toolbar-popup__dropdown",hd=t=>{let e=Ri(19),{active:o,anchorElem:n,editor:r,enabled:i,item:l}=t,{i18n:s}=fd(),{field:a}=H(),{richTextComponentMap:c}=a;if(l.Component){let f;return e[0]!==l||e[1]!==o||e[2]!==n||e[3]!==r||e[4]!==i?(f=l?.Component&&We(l.Component,{active:o,anchorElem:n,editor:r,enabled:i,item:l},l.key),e[0]=l,e[1]=o,e[2]=n,e[3]=r,e[4]=i,e[5]=f):f=e[5],f}let u=l.key;if(l.label){let f;e[6]!==l||e[7]!==s||e[8]!==c?(f=typeof l.label=="function"?l.label({i18n:s,richTextComponentMap:c}):l.label,e[6]=l,e[7]=s,e[8]=c,e[9]=f):f=e[9],u=f}u.length>25&&(u=u.substring(0,25)+"...");let d;e[10]!==l?(d=l?.ChildComponent&&We(l.ChildComponent,{}),e[10]=l,e[11]=d):d=e[11];let m;return e[12]!==u||e[13]!==d||e[14]!==o||e[15]!==r||e[16]!==i||e[17]!==l?(m=dd(ki,{active:o,editor:r,enabled:i,item:l,children:[d,We("span",{className:"text",children:u})]},l.key),e[12]=u,e[13]=d,e[14]=o,e[15]=r,e[16]=i,e[17]=l,e[18]=m):m=e[18],m},fe=t=>{let e=Ri(42),{anchorElem:o,classNames:n,editor:r,group:i,Icon:l,itemsContainerClassNames:s,label:a,maxActiveItems:c,onActiveChange:u}=t,d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=[],e[0]=d):d=e[0];let[m,f]=Eo.useState(d),p;e[1]===Symbol.for("react.memo_cache_sentinel")?(p=[],e[1]=p):p=e[1];let[h,x]=Eo.useState(p),[E,v]=Eo.useState(!0),y=H(),{items:g,key:_}=i,b;e[2]!==r||e[3]!==g||e[4]!==c||e[5]!==y||e[6]!==i||e[7]!==u?(b=()=>{r.getEditorState().read(()=>{let B=pd();if(!B)return;let W=[],Ho=[],vt=[];for(let ne of g)ne.isActive&&(!c||W.length<c)&&ne.isActive({editor:r,editorConfigContext:y,selection:B})&&(W.push(ne.key),Ho.push(ne)),ne.isEnabled?ne.isEnabled({editor:r,editorConfigContext:y,selection:B})&&vt.push(ne.key):vt.push(ne.key);i.isEnabled&&v(i.isEnabled({editor:r,editorConfigContext:y,selection:B})),f(W),x(vt),u&&u({activeItems:Ho})})},e[2]=r,e[3]=g,e[4]=c,e[5]=y,e[6]=i,e[7]=u,e[8]=b):b=e[8];let I=b,w,C;e[9]!==I?(w=()=>{I()},C=[I],e[9]=I,e[10]=w,e[11]=C):(w=e[10],C=e[11]),Ii(w,C);let L,T;e[12]!==r||e[13]!==I?(L=()=>md(r.registerUpdateListener(()=>{I()})),T=[r,I],e[12]=r,e[13]=I,e[14]=L,e[15]=T):(L=e[14],T=e[15]),Ii(L,T);let N=`${_} dropdown`,k=`${wo}-${_}`,R;e[16]!==n?(R=n||[],e[16]=n,e[17]=R):R=e[17];let M;e[18]!==k||e[19]!==R?(M=[wo,k,...R].filter(Boolean),e[18]=k,e[19]=R,e[20]=M):M=e[20];let A=M.join(" "),O=!E,F;e[21]!==s?(F=s||[],e[21]=s,e[22]=F):F=e[22];let $;if(e[23]!==F||e[24]!==g||e[25]!==m||e[26]!==o||e[27]!==r||e[28]!==h||e[29]!==N||e[30]!==A||e[31]!==O||e[32]!==l||e[33]!==a||e[34]!==_){let B;e[36]!==g||e[37]!==m||e[38]!==o||e[39]!==r||e[40]!==h?(B=g.length&&g.map(W=>We(hd,{active:m.includes(W.key),anchorElem:o,editor:r,enabled:h.includes(W.key),item:W},W.key)),e[36]=g,e[37]=m,e[38]=o,e[39]=r,e[40]=h,e[41]=B):B=e[41],$=We(Li,{buttonAriaLabel:N,buttonClassName:A,disabled:O,Icon:l,itemsContainerClassNames:[`${wo}-items`,...F],label:a,children:B},_),e[23]=F,e[24]=g,e[25]=m,e[26]=o,e[27]=r,e[28]=h,e[29]=N,e[30]=A,e[31]=O,e[32]=l,e[33]=a,e[34]=_,e[35]=$}else $=e[35];return $};function wd({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&Z(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?Z(Ge,{editor:e,item:o,children:Z(o.ChildComponent,{})},o.key):null}function Nd(t){let e=gd(25),{anchorElem:o,editor:n,editorConfig:r,group:i,index:l}=t,{i18n:s}=Td(),{field:a}=H(),{richTextComponentMap:c}=a,[u,d]=oe.useState(void 0),[m,f]=oe.useState(void 0),p,h;e[0]!==i?(p=()=>{i?.type==="dropdown"&&i.items.length&&i.ChildComponent?f(()=>i.ChildComponent):f(void 0)},h=[i],e[0]=i,e[1]=p,e[2]=h):(p=e[1],h=e[2]),oe.useEffect(p,h);let x;e[3]!==i||e[4]!==s||e[5]!==c?(x=b=>{let{activeItems:I}=b;if(!I.length){i?.type==="dropdown"&&i.items.length&&i.ChildComponent?(f(()=>i.ChildComponent),d(void 0)):(f(void 0),d(void 0));return}let w=I[0],C=w.key;w.label&&(C=typeof w.label=="function"?w.label({i18n:s,richTextComponentMap:c}):w.label),C.length>25&&(C=C.substring(0,25)+"..."),d(C),f(()=>w.ChildComponent)},e[3]=i,e[4]=s,e[5]=c,e[6]=x):x=e[6];let E=x,v=`fixed-toolbar__group fixed-toolbar__group-${i.key}`,y;e[7]!==i||e[8]!==m||e[9]!==o||e[10]!==n||e[11]!==u||e[12]!==E?(y=i.type==="dropdown"&&i.items.length&&(m?Z(fe,{anchorElem:o,editor:n,group:i,Icon:m,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:u,maxActiveItems:1,onActiveChange:E}):Z(fe,{anchorElem:o,editor:n,group:i,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:u,maxActiveItems:1,onActiveChange:E})),e[7]=i,e[8]=m,e[9]=o,e[10]=n,e[11]=u,e[12]=E,e[13]=y):y=e[13];let g;e[14]!==i||e[15]!==o||e[16]!==n?(g=i.type==="buttons"&&i.items.length&&i.items.map(b=>Z(wd,{anchorElem:o,editor:n,item:b},b.key)),e[14]=i,e[15]=o,e[16]=n,e[17]=g):g=e[17];let _;return e[18]!==r.features.toolbarFixed||e[19]!==l||e[20]!==y||e[21]!==g||e[22]!==v||e[23]!==i.key?(_=Cd("div",{className:v,children:[y,g,l<r.features.toolbarFixed?.groups.length-1&&Z("div",{className:"divider"})]},i.key),e[18]=r.features.toolbarFixed,e[19]=l,e[20]=y,e[21]=g,e[22]=v,e[23]=i.key,e[24]=_):_=e[24],_}function kd({anchorElem:t,clientProps:e,editor:o,editorConfig:n,parentWithFixedToolbar:r}){let i=oe.useRef(null),{y:l}=bd(),s=Ed(()=>{if(!r||e?.disableIfParentHasFixedToolbar)return null;let c=r.editorContainerRef.current.previousElementSibling;for(;c;){if(c.classList.contains("fixed-toolbar"))return c;c=c.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,r]);return _d(()=>{if(!s)return;let a=i.current;if(!a)return;let c=a.getBoundingClientRect(),u=s.getBoundingClientRect();if(!(c.bottom<u.top||c.top>u.bottom))a.className="fixed-toolbar fixed-toolbar--overlapping",s.className="fixed-toolbar fixed-toolbar--hide";else{if(!a.classList.contains("fixed-toolbar--overlapping"))return;a.className="fixed-toolbar",s.className="fixed-toolbar"}},50,[i,s,l]),Z("div",{className:"fixed-toolbar",onFocus:a=>{a.stopPropagation()},ref:i,children:o.isEditable()&&Z(oe.Fragment,{children:n?.features&&n.features?.toolbarFixed?.groups.map((a,c)=>Z(Nd,{anchorElem:t,editor:o,editorConfig:n,group:a,index:c},a.key))})})}var Si=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return Si(t.parentEditor)}return!1},yi=({anchorElem:t,clientProps:e})=>{let[o]=xd(),n=H(),{editorConfig:r}=n,i=e.applyToFocusedEditor&&n.focusedEditor?.editor||o,l=e.applyToFocusedEditor&&n.focusedEditor?.editorConfig||r,s=Si(n);return e?.disableIfParentHasFixedToolbar&&s||!l?.features?.toolbarFixed?.groups?.length?null:Z(kd,{anchorElem:t,editor:i,editorConfig:l,parentWithFixedToolbar:s})};var Ld=S({plugins:[{Component:yi,position:"aboveContainer"}]});import{c as Id}from"react/compiler-runtime";import{jsx as X,jsxs as Ai}from"react/jsx-runtime";import{useLexicalComposerContext as Rd}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Di}from"@lexical/utils";import{$getSelection as Fi,$isRangeSelection as Mi,$isTextNode as Sd,COMMAND_PRIORITY_LOW as yd,SELECTION_CHANGE_COMMAND as Md}from"lexical";import{useCallback as Ve,useEffect as ze,useRef as vi,useState as vd}from"react";import*as _t from"react";import{createPortal as Ad}from"react-dom";function No(t,e){let o=t.getRangeAt(0),n;if(t.anchorNode===e){let r=e;for(;r.firstElementChild!=null;)r=r.firstElementChild;n=r.getBoundingClientRect()}else n=o.getBoundingClientRect();return n}function bt(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:n=0,floatingElem:r,horizontalOffset:i=32,horizontalPosition:l="left",specialHandlingForCaret:s=!1,targetRect:a,verticalGap:c=10}=t,u=o.parentElement;if(a===null||u==null){r.style.opacity="0",r.style.transform="translate(-10000px, -10000px)";return}let d=r.getBoundingClientRect(),m=o.getBoundingClientRect(),f=u.getBoundingClientRect(),p=a.top-d.height-c,h=a.left-i;l==="center"&&(h=a.left+a.width/2-d.width/2);let x=0;return!e&&p<f.top&&!s&&(x=d.height+a.height+c*2,p+=x),l==="center"?h+d.width>f.right?h=f.right-d.width-i:h<f.left&&(h=f.left+i):h+d.width>f.right&&(h=f.right-d.width-i),h-=m.left,r.style.opacity="1",s&&n!==0?(p-=m.bottom-n+d.height-3,r.style.transform=`translate(${h}px, ${p}px) rotate(180deg)`):(p-=m.top,r.style.transform=`translate(${h}px, ${p}px)`),x}function Dd({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&X(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?X(Ge,{editor:e,item:o,children:X(o.ChildComponent,{})},o.key):null}function Fd(t){let e=Id(22),{anchorElem:o,editor:n,group:r,index:i}=t,{editorConfig:l}=H(),[s,a]=_t.useState(),c,u;e[0]!==r?(c=()=>{r?.type==="dropdown"&&r.items.length&&r.ChildComponent?a(()=>r.ChildComponent):a(void 0)},u=[r],e[0]=r,e[1]=c,e[2]=u):(c=e[1],u=e[2]),_t.useEffect(c,u);let d;e[3]!==r?(d=E=>{let{activeItems:v}=E;if(!v.length){r?.type==="dropdown"&&r.items.length&&r.ChildComponent?a(()=>r.ChildComponent):a(void 0);return}let y=v[0];a(()=>y.ChildComponent)},e[3]=r,e[4]=d):d=e[4];let m=d,f=`inline-toolbar-popup__group inline-toolbar-popup__group-${r.key}`,p;e[5]!==r||e[6]!==s||e[7]!==o||e[8]!==n||e[9]!==m?(p=r.type==="dropdown"&&r.items.length&&(s?X(fe,{anchorElem:o,editor:n,group:r,Icon:s,maxActiveItems:1,onActiveChange:m}):X(fe,{anchorElem:o,editor:n,group:r,maxActiveItems:1,onActiveChange:m})),e[5]=r,e[6]=s,e[7]=o,e[8]=n,e[9]=m,e[10]=p):p=e[10];let h;e[11]!==r||e[12]!==o||e[13]!==n?(h=r.type==="buttons"&&r.items.length&&r.items.map(E=>X(Dd,{anchorElem:o,editor:n,item:E},E.key)),e[11]=r,e[12]=o,e[13]=n,e[14]=h):h=e[14];let x;return e[15]!==l.features.toolbarInline||e[16]!==i||e[17]!==p||e[18]!==h||e[19]!==f||e[20]!==r.key?(x=Ai("div",{className:f,children:[p,h,i<l.features.toolbarInline?.groups.length-1&&X("div",{className:"divider"})]},r.key),e[15]=l.features.toolbarInline,e[16]=i,e[17]=p,e[18]=h,e[19]=f,e[20]=r.key,e[21]=x):x=e[21],x}function Od({anchorElem:t,editor:e}){let o=vi(null),n=vi(null),{editorConfig:r}=H(),i=Ve(()=>{if(o?.current){let c=o.current.style.opacity==="0",u=o.current.style.pointerEvents==="none";c||(o.current.style.opacity="0"),u||(o.current.style.pointerEvents="none")}},[o]),l=Ve(c=>{if(o?.current&&(c.buttons===1||c.buttons===3)){let u=o.current.style.opacity==="0",d=o.current.style.pointerEvents==="none";if(!u||!d){let m=c.clientX,f=c.clientY,p=document.elementFromPoint(m,f);o.current.contains(p)||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"))},[]);ze(()=>(document.addEventListener("mousemove",l),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",s)}),[o,l,s]);let a=Ve(()=>{let c=Fi(),u=window.getSelection();if(o.current===null)return;let d=t.querySelector(":scope > .link-editor"),m=d!==null&&"style"in d&&d?.style?.opacity==="1",f=e.getRootElement();if(c!==null&&u!==null&&!u.isCollapsed&&f!==null&&f.contains(u.anchorNode)){let p=No(u,f),h=bt({alwaysDisplayOnTop:m,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:p});n.current&&bt({anchorElem:o.current,anchorFlippedOffset:h,floatingElem:n.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:p,verticalGap:8})}else i()},[e,i,t]);return ze(()=>{let c=t.parentElement,u=()=>{e.getEditorState().read(()=>{a()})};return window.addEventListener("resize",u),c&&c.addEventListener("scroll",u),()=>{window.removeEventListener("resize",u),c&&c.removeEventListener("scroll",u)}},[e,a,t]),ze(()=>(e.getEditorState().read(()=>{a()}),Di(e.registerUpdateListener(({editorState:c})=>{c.read(()=>{a()})}),e.registerCommand(Md,()=>(a(),!1),yd))),[e,a]),Ai("div",{className:"inline-toolbar-popup",ref:o,children:[X("div",{className:"caret",ref:n}),r?.features&&r.features?.toolbarInline?.groups.map((c,u)=>X(Fd,{anchorElem:t,editor:e,group:c,index:u},c.key))]})}function Pd(t,e){let[o,n]=vd(!1),r=Ve(()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let i=Fi(),l=window.getSelection(),s=t.getRootElement();if(l!==null&&(!Mi(i)||s===null||!s.contains(l.anchorNode))){n(!1);return}if(!Mi(i))return;if(i.getTextContent()!==""){let c=i.getNodes(),u=!1;for(let d of c)if(Sd(d)){n(!0),u=!0;break}u||n(!1)}else n(!1);let a=i.getTextContent().replace(/\n/g,"");if(!i.isCollapsed()&&a===""){n(!1);return}})},[t]);return ze(()=>(document.addEventListener("selectionchange",r),document.addEventListener("mouseup",r),()=>{document.removeEventListener("selectionchange",r),document.removeEventListener("mouseup",r)}),[r]),ze(()=>Di(t.registerUpdateListener(()=>{r()}),t.registerRootListener(()=>{t.getRootElement()===null&&n(!1)})),[t,r]),!o||!t.isEditable()?null:Ad(X(Od,{anchorElem:e,editor:t}),e)}var Oi=({anchorElem:t})=>{let[e]=Rd();return Pd(e,t)};var $d=S({plugins:[{Component:Oi,position:"floatingAnchorElem"}]});import{TableCellNode as rf,TableNode as nf,TableRowNode as lf}from"@lexical/table";import{jsx as Pi}from"react/jsx-runtime";import"react";var ko=()=>Pi("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Pi("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{jsx as P,jsxs as re}from"react/jsx-runtime";import{useLexicalComposerContext as ji}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Bd}from"@lexical/react/useLexicalEditable";import{$deleteTableColumn__EXPERIMENTAL as jd,$deleteTableRow__EXPERIMENTAL as Gd,$getNodeTriplet as Ud,$getTableCellNodeFromLexicalNode as Wd,$getTableColumnIndexFromTableCellNode as Vd,$getTableNodeFromLexicalNodeOrThrow as Ke,$getTableRowIndexFromTableCellNode as zd,$insertTableColumn__EXPERIMENTAL as Kd,$insertTableRow__EXPERIMENTAL as Zd,$isTableCellNode as Tt,$isTableRowNode as Hi,$isTableSelection as wt,$unmergeCell as Yd,getTableObserverFromTableElement as Xd,TableCellHeaderStates as ae,TableCellNode as Jd}from"@lexical/table";import{useScrollInfo as qd}from"@payloadcms/ui";import{$createParagraphNode as Qd,$getRoot as em,$getSelection as Nt,$isElementNode as tm,$isParagraphNode as Gi,$isRangeSelection as Ro,$isTextNode as om}from"lexical";import*as So from"react";import{useCallback as J,useEffect as pe,useRef as Et,useState as Te}from"react";import{createPortal as Ui}from"react-dom";import{jsx as Lo,jsxs as Hd}from"react/jsx-runtime";import"react";var $i=()=>Hd("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[Lo("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"}),Lo("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"}),Lo("path",{d:"M15 11C15.5523 11 16 10.5523 16 10C16 9.44772 15.5523 9 15 9C14.4477 9 14 9.44772 14 10C14 10.5523 14.4477 11 15 11Z",fill:"currentColor"})]});function Io(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function rm(){let t=Nt();if(Ro(t)&&!t.isCollapsed()||wt(t)&&!t.anchor.is(t.focus)||!Ro(t)&&!wt(t))return!1;let[e]=Ud(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function Bi(t){if(t.getChildrenSize()!==1)return!1;let e=t.getFirstChildOrThrow();return!(!Gi(e)||!e.isEmpty())}function nm(t){let e=t.getLastDescendant();om(e)?e.select():tm(e)?e.selectEnd():e!==null&&e.selectNext()}function im({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:n,tableCellNode:r}){let[i]=ji(),l=Et(null),[s,a]=Te(r),[c,u]=Te({columns:1,rows:1}),[d,m]=Te(!1),[f,p]=Te(!1),{y:h}=qd();pe(()=>i.registerMutationListener(Jd,N=>{N.get(s.getKey())==="updated"&&i.getEditorState().read(()=>{a(s.getLatest())})},{skipInitialization:!0}),[i,s]),pe(()=>{i.getEditorState().read(()=>{let N=Nt();if(wt(N)){let k=Io(N);u(Io(N)),m(k.columns>1||k.rows>1)}p(rm())})},[i]),pe(()=>{let N=e.current,k=l.current,R=i.getRootElement();if(N!=null&&k!=null&&R!=null){let M=R.getBoundingClientRect(),A=N.getBoundingClientRect();k.style.opacity="1";let O=k.getBoundingClientRect(),F=5,$=A.right+F;if($+O.width>window.innerWidth||$+O.width>M.right){let W=A.left-O.width-F;$=(W<0?F:W)+window.pageXOffset}k.style.left=`${$+window.pageXOffset}px`;let B=A.top;if(B+O.height>window.innerHeight){let W=A.bottom-O.height;B=(W<0?F:W)+window.pageYOffset}k.style.top=`${B}px`}},[e,l,i,h]),pe(()=>{function N(k){l.current!=null&&e.current!=null&&!l.current.contains(k.target)&&!e.current.contains(k.target)&&n(!1)}return window.addEventListener("click",N),()=>window.removeEventListener("click",N)},[n,e]);let x=J(()=>{i.update(()=>{if(s.isAttached()){let k=Ke(s),R=i.getElementByKey(k.getKey());if(!R)throw new Error("Expected to find tableElement in DOM");let M=Xd(R);M!==null&&M.clearHighlight(),k.markDirty(),a(s.getLatest())}em().selectStart()})},[i,s]),E=()=>{i.update(()=>{let N=Nt();if(wt(N)){let{columns:k,rows:R}=Io(N),M=N.getNodes(),A=null;for(let O=0;O<M.length;O++){let F=M[O];if(Tt(F))if(A===null){F.setColSpan(k).setRowSpan(R),A=F;let $=Bi(F),B;$&&Gi(B=F.getFirstChild())&&B.remove()}else Tt(A)&&(Bi(F)||A.append(...F.getChildren()),F.remove())}A!==null&&(A.getChildrenSize()===0&&A.append(Qd()),nm(A)),o()}})},v=()=>{i.update(()=>{Yd()})},y=J(N=>{i.update(()=>{Zd(N),o()})},[i,o]),g=J(N=>{i.update(()=>{for(let k=0;k<c.columns;k++)Kd(N);o()})},[i,o,c.columns]),_=J(()=>{i.update(()=>{Gd(),o()})},[i,o]),b=J(()=>{i.update(()=>{Ke(s).remove(),x(),o()})},[i,s,x,o]),I=J(()=>{i.update(()=>{jd(),o()})},[i,o]),w=J(()=>{i.update(()=>{let N=Ke(s),k=zd(s),R=N.getChildren();if(k>=R.length||k<0)throw new Error("Expected table cell to be inside of table row.");let M=R[k];if(!Hi(M))throw new Error("Expected table row");let A=s.getHeaderStyles()^ae.ROW;M.getChildren().forEach(O=>{if(!Tt(O))throw new Error("Expected table cell");O.setHeaderStyles(A,ae.ROW)}),x(),o()})},[i,s,x,o]),C=J(()=>{i.update(()=>{let N=Ke(s),k=Vd(s),R=N.getChildren(),M=Math.max(...R.map(O=>O.getChildren().length));if(k>=M||k<0)throw new Error("Expected table cell to be inside of table row.");let A=s.getHeaderStyles()^ae.COLUMN;for(let O=0;O<R.length;O++){let F=R[O];if(!Hi(F))throw new Error("Expected table row");let $=F.getChildren();if(k>=$.length)continue;let B=$[k];if(!Tt(B))throw new Error("Expected table cell");B.setHeaderStyles(A,ae.COLUMN)}x(),o()})},[i,s,x,o]),L=J(()=>{i.update(()=>{if(s.isAttached()){let N=Ke(s);N&&N.setRowStriping(!N.getRowStriping())}x(),o()})},[i,s,x,o]),T=null;return t&&(d?T=P("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>E(),type:"button",children:"Merge cells"}):f&&(T=P("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>v(),type:"button",children:"Unmerge cells"}))),Ui(re("div",{className:"table-action-menu-dropdown",onClick:N=>{N.stopPropagation()},ref:l,children:[T?re(So.Fragment,{children:[T,P("hr",{})]}):null,P("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>L(),type:"button",children:P("span",{className:"text",children:"Toggle Row Striping"})}),P("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>y(!1),type:"button",children:re("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," above"]})}),P("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>y(!0),type:"button",children:re("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," below"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>g(!1),type:"button",children:re("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","left"]})}),P("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>g(!0),type:"button",children:re("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","right"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>I(),type:"button",children:P("span",{className:"text",children:"Delete column"})}),P("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>_(),type:"button",children:P("span",{className:"text",children:"Delete row"})}),P("button",{className:"item","data-test-id":"table-delete",onClick:()=>b(),type:"button",children:P("span",{className:"text",children:"Delete table"})}),P("hr",{}),P("button",{className:"item",onClick:()=>w(),type:"button",children:re("span",{className:"text",children:[(s.__headerState&ae.ROW)===ae.ROW?"Remove":"Add"," ","row header"]})}),P("button",{className:"item","data-test-id":"table-column-header",onClick:()=>C(),type:"button",children:re("span",{className:"text",children:[(s.__headerState&ae.COLUMN)===ae.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function lm({anchorElem:t,cellMerge:e}){let[o]=ji(),n=Et(null),r=Et(null),[i,l]=Te(!1),[s,a]=Te(null),c=J(()=>{let d=n.current,m=Nt(),f=window.getSelection(),p=document.activeElement;if(m==null||d==null){a(null);return}let h=o.getRootElement();if(Ro(m)&&h!==null&&f!==null&&h.contains(f.anchorNode)){let x=Wd(m.anchor.getNode());if(x==null){a(null);return}if(o.getElementByKey(x.getKey())==null){a(null);return}a(x)}else p||a(null)},[o]);pe(()=>o.registerUpdateListener(()=>{o.getEditorState().read(()=>{c()})})),pe(()=>{let d=n.current;if(d!=null&&s!=null){let m=o.getElementByKey(s.getKey());if(m!=null){let f=m.getBoundingClientRect(),p=d.getBoundingClientRect(),h=t.getBoundingClientRect(),x=f.top-h.top+4,E=f.right-p.width-10-h.left;d.style.opacity="1",d.style.transform=`translate(${E}px, ${x}px)`}else d.style.opacity="0",d.style.transform="translate(-10000px, -10000px)"}},[n,s,o,t]);let u=Et(s);return pe(()=>{u.current!==s&&l(!1),u.current=s},[u,s]),P("div",{className:"table-cell-action-button-container",ref:n,children:s!=null&&re(So.Fragment,{children:[P("button",{className:"table-cell-action-button",onClick:d=>{d.stopPropagation(),l(!i)},ref:r,type:"button",children:P($i,{})}),i&&P(im,{cellMerge:e,contextRef:r,onClose:()=>l(!1),setIsMenuOpen:l,tableCellNode:s})]})})}var Wi=({anchorElem:t})=>{let e=Bd();return Ui(e?P(lm,{anchorElem:t??document.body,cellMerge:!0}):null,t??document.body)};import{jsx as It,jsxs as sm}from"react/jsx-runtime";import{useLexicalComposerContext as am}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as cm}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as um,$getTableNodeFromLexicalNodeOrThrow as yo,$getTableRowIndexFromTableCellNode as dm,$isTableCellNode as Vi,$isTableRowNode as mm,getDOMCellFromTarget as fm,TableNode as pm}from"@lexical/table";import{calculateZoomLevel as zi}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Mo}from"lexical";import*as Yi from"react";import{useCallback as Ee,useEffect as Ki,useMemo as hm,useRef as kt,useState as Lt}from"react";import{createPortal as gm}from"react-dom";var Cm=33,Zi=92;function xm({editor:t}){let e=kt(null),o=kt(null),n=kt(null),r=H(),i=kt(null),[l,s]=Lt(null),[a,c]=Lt(null),[u,d]=Lt(!1),[m,f]=Lt(null),p=Ee(()=>{c(null),e.current=null,f(null),i.current=null,n.current=null},[]),h=C=>(C.buttons&1)===1;Ki(()=>t.registerNodeTransform(pm,C=>{if(C.getColWidths())return C;let L=C.getColumnCount(),T=Zi;return C.setColWidths(Array(L).fill(T)),C}),[t]),Ki(()=>{let C=k=>{setTimeout(()=>{let R=k.target;if(m){s({x:k.clientX,y:k.clientY});return}if(d(h(k)),!(o.current&&o.current.contains(R))&&e.current!==R){e.current=R;let M=fm(R);M&&a!==M?t.update(()=>{let A=Mo(M.elem);if(!A)throw new Error("TableCellResizer: Table cell node not found.");let O=yo(A),F=t.getElementByKey(O.getKey());if(!F)throw new Error("TableCellResizer: Table element not found.");e.current=R,n.current=F.getBoundingClientRect(),c(M)}):M==null&&p()}},0)},L=k=>{setTimeout(()=>{d(!0)},0)},T=k=>{setTimeout(()=>{d(!1)},0)},N=t.registerRootListener((k,R)=>{R?.removeEventListener("mousemove",C),R?.removeEventListener("mousedown",L),R?.removeEventListener("mouseup",T),k?.addEventListener("mousemove",C),k?.addEventListener("mousedown",L),k?.addEventListener("mouseup",T)});return()=>{N()}},[a,m,t,p]);let x=C=>C==="bottom",E=Ee(C=>{if(!a)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let L=Mo(a.elem);if(!Vi(L))throw new Error("TableCellResizer: Table cell node not found.");let T=yo(L),N=dm(L)+L.getRowSpan()-1,k=T.getChildren();if(N>=k.length||N<0)throw new Error("Expected table cell to be inside of table row.");let R=k[N];if(!mm(R))throw new Error("Expected table row");let M=R.getHeight();if(M===void 0){let O=R.getChildren();M=Math.min(...O.map(F=>v(F,t)??1/0))}let A=Math.max(M+C,Cm);R.setHeight(A)},{tag:"skip-scroll-into-view"})},[a,t]),v=(C,L)=>L.getElementByKey(C.getKey())?.clientHeight,y=(C,L)=>{for(let T=0;T<L.length;T++)for(let N=0;N<L[T].length;N++)if(L[T][N].cell===C)return N},g=Ee(C=>{if(!a)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let L=Mo(a.elem);if(!Vi(L))throw new Error("TableCellResizer: Table cell node not found.");let T=yo(L),[N]=um(T,null,null),k=y(L,N);if(k===void 0)throw new Error("TableCellResizer: Table column not found.");let R=T.getColWidths();if(!R)return;let M=R[k];if(M===void 0)return;let A=[...R],O=Math.max(M+C,Zi);A[k]=O,T.setColWidths(A)},{tag:"skip-scroll-into-view"})},[a,t]),_=Ee(C=>{let L=T=>{if(T.preventDefault(),T.stopPropagation(),!a)throw new Error("TableCellResizer: Expected active cell.");if(i.current){let{x:N,y:k}=i.current;if(a===null)return;let R=zi(T.target);if(x(C)){let M=(T.clientY-k)/R;E(M)}else{let M=(T.clientX-N)/R;g(M)}p(),document.removeEventListener("mouseup",L)}};return L},[a,p,g,E]),b=Ee(C=>L=>{if(L.preventDefault(),L.stopPropagation(),!a)throw new Error("TableCellResizer: Expected active cell.");i.current={x:L.clientX,y:L.clientY},s(i.current),f(C),document.addEventListener("mouseup",_(C))},[a,_]),w=Ee(()=>{if(a){let{height:C,left:L,top:T,width:N}=a.elem.getBoundingClientRect(),k=zi(a.elem),R=10,M={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${R}px`,left:`${window.pageXOffset+L}px`,top:`${window.pageYOffset+T+C-R/2}px`,width:`${N}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${C}px`,left:`${window.pageXOffset+L+N-R/2}px`,top:`${window.pageYOffset+T}px`,width:`${R}px`}},A=n.current;return m&&l&&A&&(x(m)?(M[m].left=`${window.pageXOffset+A.left}px`,M[m].top=`${window.pageYOffset+l.y/k}px`,M[m].height="3px",M[m].width=`${A.width}px`):(M[m].top=`${window.pageYOffset+A.top}px`,M[m].left=`${window.pageXOffset+l.x/k}px`,M[m].width="3px",M[m].height=`${A.height}px`),M[m].backgroundColor="#adf"),M}return{bottom:null,left:null,right:null,top:null}},[a,m,l])();return It("div",{ref:o,children:a!=null&&!u&&sm(Yi.Fragment,{children:[It("div",{className:`${r.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:b("right"),style:w.right||void 0}),It("div",{className:`${r.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:b("bottom"),style:w.bottom||void 0})]})})}var Xi=()=>{let[t]=am(),e=cm();return hm(()=>e?gm(It(xm,{editor:t}),document.body):null,[t,e])};import{jsx as vo,jsxs as km,Fragment as Lm}from"react/jsx-runtime";import{useLexicalComposerContext as Im}from"@lexical/react/LexicalComposerContext";import{$getTableColumnIndexFromTableCellNode as Rm,$getTableRowIndexFromTableCellNode as Sm,$insertTableColumn__EXPERIMENTAL as ym,$insertTableRow__EXPERIMENTAL as Mm,$isTableCellNode as vm,$isTableNode as Qi,TableNode as Am}from"@lexical/table";import{$findMatchingParent as Dm,mergeRegister as Fm}from"@lexical/utils";import{$getNearestNodeFromDOMNode as el}from"lexical";import{useEffect as tl,useRef as ol,useState as Rt}from"react";import"react";import{createPortal as Om}from"react-dom";import{useMemo as wm,useRef as Nm}from"react";var bm="Expected a function",_m=Math.max,Tm=Math.min;function Em(t,e,o){let n,r,i=0,l,s=!1,a=!1,c,u,d,m=!0;if(typeof t!="function")throw new TypeError(bm);e=e||0,typeof o=="object"&&(s=!!o.leading,a="maxWait"in o,c=a?_m(o.maxWait||0,e):c,m="trailing"in o?!!o.trailing:m);function f(b){let I=n,w=l;return n=l=void 0,i=b,u=t.apply(w,I),u}function p(b){return i=b,d=setTimeout(E,e),s?f(b):u}function h(b){let I=b-r,w=b-i,C=e-I;return a?Tm(C,c-w):C}function x(b){let I=b-r,w=b-i;return r===void 0||I>=e||I<0||a&&w>=c}function E(){let b=Date.now();if(x(b))return v(b);d=setTimeout(E,h(b))}function v(b){return d=void 0,m&&n?f(b):(n=l=void 0,u)}function y(){d!==void 0&&clearTimeout(d),i=0,n=r=l=d=void 0}function g(){return d===void 0?u:v(Date.now())}function _(){let b=Date.now(),I=x(b);if(n=arguments,l=this,r=b,I){if(d===void 0)return p(r);if(a)return clearTimeout(d),d=setTimeout(E,e),f(r)}return d===void 0&&(d=setTimeout(E,e)),u}return _.cancel=y,_.flush=g,_}var Ji=Em;function qi(t,e,o){let n=Nm(null);return n.current=t,wm(()=>Ji((...r)=>{n.current&&n.current(...r)},e,{maxWait:o}),[e,o])}var rl=20;function Pm({anchorElem:t}){let[e]=Im(),o=H(),[n,r]=Rt(!1),[i,l]=Rt(!1),[s,a]=Rt(!1),[c,u]=Rt({}),d=ol(new Set),m=ol(null),f=qi(h=>{let{isOutside:x,tableDOMNode:E}=$m(h,o.editorConfig?.lexical);if(x){r(!1),l(!1);return}if(!E)return;m.current=E;let v=null,y=null,g=null;if(e.update(()=>{let _=el(E);if(vm(_)){let b=Dm(_,I=>Qi(I));if(!Qi(b))return;if(g=e.getElementByKey(b?.getKey()),g){let I=b.getChildrenSize(),w=b.getChildAtIndex(0)?.getChildrenSize(),C=Sm(_),L=Rm(_);C===I-1?v=_:L===w-1&&(y=_)}}}),g){let{bottom:_,height:b,right:I,width:w,x:C,y:L}=g.getBoundingClientRect(),{left:T,y:N}=t.getBoundingClientRect();v?(l(!1),r(!0),u({height:rl,left:C-T,top:_-N+5,width:w})):y&&(l(!0),r(!1),u({height:b,left:I-T+5,top:L-N,width:rl}))}},50,250);tl(()=>{if(s)return document.addEventListener("mousemove",f),()=>{r(!1),l(!1),document.removeEventListener("mousemove",f)}},[s,f]),tl(()=>Fm(e.registerMutationListener(Am,h=>{e.getEditorState().read(()=>{for(let[x,E]of h)switch(E){case"created":d.current.add(x),a(d.current.size>0);break;case"destroyed":d.current.delete(x),a(d.current.size>0);break;default:break}})},{skipInitialization:!1})),[e]);let p=h=>{e.update(()=>{m.current&&(el(m.current)?.selectEnd(),h?(Mm(),r(!1)):(ym(),l(!1)))})};return km(Lm,{children:[n&&vo("button",{className:o.editorConfig.lexical.theme.tableAddRows,onClick:()=>p(!0),style:{...c}}),i&&vo("button",{className:o.editorConfig.lexical.theme.tableAddColumns,onClick:()=>p(!1),style:{...c}})]})}function $m(t,e){let o=t.target;if(o&&o instanceof HTMLElement){let n=o.closest(`td.${e.theme.tableCell}, th.${e.theme.tableCell}`);return{isOutside:!(n||o.closest(`button.${e.theme.tableAddRows}`)||o.closest(`button.${e.theme.tableAddColumns}`)||o.closest(`div.${e.theme.tableCellResizer}`)),tableDOMNode:n}}else return{isOutside:!0,tableDOMNode:null}}function nl({anchorElem:t=document.body}){return Om(vo(Pm,{anchorElem:t}),t)}import{c as Hm}from"react/compiler-runtime";import{jsx as Ao,jsxs as Bm}from"react/jsx-runtime";import{useLexicalComposerContext as jm}from"@lexical/react/LexicalComposerContext";import{TablePlugin as Gm}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as Um,TableNode as Wm}from"@lexical/table";import{mergeRegister as Vm}from"@lexical/utils";import{formatDrawerSlug as zm,useEditDepth as Km}from"@payloadcms/ui";import{$getSelection as Zm,$isRangeSelection as Ym,COMMAND_PRIORITY_EDITOR as Xm,createCommand as Jm}from"lexical";import{createContext as qm,useContext as Qm,useEffect as ef,useMemo as tf,useState as of}from"react";import*as il from"react";var St=Jm("OPEN_EMBED_DRAWER_COMMAND"),ll=qm({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function sl({children:t}){let[e,o]=of({cellEditorConfig:null,cellEditorPlugins:null});return Ao(ll.Provider,{value:tf(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(n,r)=>{o({cellEditorConfig:n,cellEditorPlugins:r})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var al=()=>{let t=Hm(15),[e]=jm(),o=Qm(ll),n=Km(),{uuid:r}=H(),i="lexical-table-create-"+r,l;t[0]!==i||t[1]!==n?(l=zm({slug:i,depth:n}),t[0]=i,t[1]=n,t[2]=l):l=t[2];let s=l,{toggleDrawer:a}=nt(s),c;t[3]!==e||t[4]!==a?(c=()=>{if(!e.hasNodes([Wm]))throw new Error("TablePlugin: TableNode is not registered on editor");return Vm(e.registerCommand(St,()=>{let f;return f=null,e.getEditorState().read(()=>{let p=Zm();Ym(p)&&(f=p)}),f&&a(),!0},Xm))},t[3]=e,t[4]=a,t[5]=c):c=t[5];let u;t[6]!==o||t[7]!==e||t[8]!==a?(u=[o,e,a],t[6]=o,t[7]=e,t[8]=a,t[9]=u):u=t[9],ef(c,u);let d;t[10]!==e?(d=(f,p)=>{!p.columns||!p.rows||e.dispatchCommand(Um,{columns:String(p.columns),rows:String(p.rows)})},t[10]=e,t[11]=d):d=t[11];let m;return t[12]!==s||t[13]!==d?(m=Bm(il.Fragment,{children:[Ao(ce,{drawerSlug:s,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:d,schemaPathSuffix:"fields"}),Ao(Gm,{hasCellBackgroundColor:!1,hasCellMerge:!0})]}),t[12]=s,t[13]=d,t[14]=m):m=t[14],m};var sf=S({nodes:[nf,rf,lf],plugins:[{Component:al,position:"normal"},{Component:Xi,position:"normal"},{Component:Wi,position:"floatingAnchorElem"},{Component:nl,position:"floatingAnchorElem"}],providers:[sl],slashMenu:{groups:[G([{Icon:ko,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(St,{})}}])]},toolbarFixed:{groups:[q([{ChildComponent:ko,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(St,{})}}])]}});import{$isNodeSelection as yf}from"lexical";import{jsx as Do,jsxs as af}from"react/jsx-runtime";import"react";var Fo=()=>af("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:[Do("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"}),Do("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"}),Do("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{c as Cf}from"react/compiler-runtime";import{jsx as xf}from"react/jsx-runtime";import{useLexicalComposerContext as bf}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as _f,mergeRegister as Tf}from"@lexical/utils";import{useConfig as Ef}from"@payloadcms/ui";import{$getPreviousSelection as wf,$getSelection as Nf,$isParagraphNode as ul,$isRangeSelection as kf,COMMAND_PRIORITY_EDITOR as Lf,createCommand as If}from"lexical";import{useEffect as Rf}from"react";import{c as cf}from"react/compiler-runtime";import{jsx as Oo}from"react/jsx-runtime";import{useLexicalComposerContext as uf}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as df,COMMAND_PRIORITY_EDITOR as mf}from"lexical";import{useEffect as ff,useState as pf}from"react";var hf=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=df(o);r&&r.replace(ve({data:{fields:null,relationTo:e,value:n}}))}):t.dispatchCommand(Po,{fields:null,relationTo:e,value:n})},gf=t=>{let e=cf(13),{enabledCollectionSlugs:o}=t,[n]=uf(),[r,i]=pf(null),l;e[0]!==o?(l={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=l):l=e[1];let{closeListDrawer:s,ListDrawer:a,openListDrawer:c}=pt(l),u,d;e[2]!==n||e[3]!==c?(u=()=>n.registerCommand(ye,h=>(i(h?.replace?h?.replace.nodeKey:null),c(),!0),mf),d=[n,c],e[2]=n,e[3]=c,e[4]=u,e[5]=d):(u=e[4],d=e[5]),ff(u,d);let m;e[6]!==s||e[7]!==n||e[8]!==r?(m=h=>{let{collectionSlug:x,docID:E}=h;s(),hf({editor:n,relationTo:x,replaceNodeKey:r,value:E})},e[6]=s,e[7]=n,e[8]=r,e[9]=m):m=e[9];let f=m,p;return e[10]!==f||e[11]!==a?(p=Oo(a,{onSelect:f}),e[10]=f,e[11]=a,e[12]=p):p=e[12],p},cl=t=>Oo(Je,{...t,uploads:!0,children:Oo(gf,{...t})});var Po=If("INSERT_UPLOAD_COMMAND"),dl=t=>{let e=Cf(5),[o]=bf(),{config:n}=Ef(),{collections:r}=n,i,l;e[0]!==o?(i=()=>{if(!o.hasNodes([Me]))throw new Error("UploadPlugin: UploadNode not registered on editor");return Tf(o.registerCommand(Po,a=>(o.update(()=>{let c=Nf()||wf();if(kf(c)){let u=ve({data:{id:a.id,fields:a.fields,relationTo:a.relationTo,value:a.value}});_f(u);let{focus:d}=c,m=d.getNode();ul(m)&&m.getTextContentSize()===0&&m.getParentOrThrow().getChildren().filter(f=>ul(f)).length>1&&m.remove()}}),!0),Lf))},l=[o],e[0]=o,e[1]=i,e[2]=l):(i=e[1],l=e[2]),Rf(i,l);let s;return e[3]!==r?(s=xf(cl,{enabledCollectionSlugs:r.map(Sf)}),e[3]=r,e[4]=s):s=e[4],s};function Sf(t){let{slug:e}=t;return e}var Mf=S({nodes:[Me],plugins:[{Component:dl,position:"normal"}],slashMenu:{groups:[G([{Icon:Fo,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(ye,{replace:!1})}}])]},toolbarFixed:{groups:[q([{ChildComponent:Fo,isActive:({selection:t})=>{if(!yf(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Bt(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(ye,{replace:!1})}}])]}});import{c as vf}from"react/compiler-runtime";import{jsx as $o}from"react/jsx-runtime";import{ShimmerEffect as Af}from"@payloadcms/ui";import{lazy as Df,Suspense as Ff,useEffect as Of,useState as Pf}from"react";var $f=Df(()=>import("./Field-Y47DV2NP.js").then(t=>({default:t.RichText}))),Hf=t=>{let e=vf(11),{admin:o,field:n,lexicalEditorConfig:r}=t,i;e[0]!==o?(i=o===void 0?{}:o,e[0]=o,e[1]=i):i=e[1];let l=i,{richTextComponentMap:s}=n,[a,c]=Pf(null),u,d;e[2]!==a||e[3]!==s||e[4]!==r||e[5]!==l?(u=()=>{if(a)return;let f=s?.get("features"),p=[];for(let E of f)p.push(E.clientFeature(E.clientFeatureProps));let h=r||Ae,x=qe({unSanitizedEditorConfig:{features:p,lexical:h}});c(De(x,h,l))},d=[r,s,l,a],e[2]=a,e[3]=s,e[4]=r,e[5]=l,e[6]=u,e[7]=d):(u=e[6],d=e[7]),Of(u,d);let m;return e[8]!==a||e[9]!==t?(m=$o(Ff,{fallback:$o(Af,{height:"35vh"}),children:a&&$o($f,{...t,editorConfig:a})}),e[8]=a,e[9]=t,e[10]=m):m=e[10],m};function Bf(...t){return t.filter(Boolean).join(" ")}var yt=new WeakMap;function ml(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function Mt(t,e){let o=yt.get(t);if(o===void 0){let n=new Set,r=l=>{o!==void 0&&(o.start=ml(l))},i=l=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let a=ml(l);for(let c of n)a!==null&&c([a[0]-s[0],a[1]-s[1]],l)};t.addEventListener("touchstart",r),t.addEventListener("touchend",i),o={handleTouchend:i,handleTouchstart:r,listeners:n,start:null},yt.set(t,o)}return o.listeners.add(e),()=>{jf(t,e)}}function jf(t,e){let o=yt.get(t);if(o===void 0)return;let{listeners:n}=o;n.delete(e),n.size===0&&(yt.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function Gf(t,e){return Mt(t,(o,n)=>{let[r,i]=o;r<0&&-r>Math.abs(i)&&e(r,n)})}function Uf(t,e){return Mt(t,(o,n)=>{let[r,i]=o;r>0&&r>Math.abs(i)&&e(r,n)})}function Wf(t,e){return Mt(t,(o,n)=>{let[r,i]=o;i<0&&-i>Math.abs(r)&&e(r,n)})}function Vf(t,e){return Mt(t,(o,n)=>{let[r,i]=o;i>0&&i>Math.abs(r)&&e(r,n)})}var D={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},zf=D.IS_BOLD|D.IS_ITALIC|D.IS_STRIKETHROUGH|D.IS_UNDERLINE|D.IS_CODE|D.IS_SUBSCRIPT|D.IS_SUPERSCRIPT|D.IS_HIGHLIGHT,Kf="\xA0",Zf=`
|
|
34
|
+
`},[t,e]),f=ue((g,_)=>{o(b=>{let I=e.length-1,w=e[I];if(w&&w.name===g){if(g==="type")return[...e.slice(0,I),{...w,value:w.value+_}];if(w.value===_)return[...e.slice(0,I),{...w,count:w.count+1}]}return[...b,{name:g,count:1,value:_}]})},[e,o]);ur(()=>{let g=b=>{if(!n)return;let I=b.key;hs(b)?f("selectAll",""):mr.has(I)?f("press",b.key):[...I].length>1?f("keydown",b.key):f("type",b.key)},_=b=>{if(!n)return;let I=b.key;!mr.has(I)&&[...I].length>1&&f("keyup",b.key)};return t.registerRootListener((b,I)=>{I!==null&&(I.removeEventListener("keydown",g),I.removeEventListener("keyup",_)),b!==null&&(b.addEventListener("keydown",g),b.addEventListener("keyup",_))})},[t,n,f]),ur(()=>{u.current&&u.current.scrollTo(0,u.current.scrollHeight)},[m]),Yt(()=>{if(e){let g=m();g!==null&&s(g),u.current&&u.current.scrollTo(0,u.current.scrollHeight)}},[m,e]),Yt(()=>t.registerUpdateListener(({dirtyElements:_,dirtyLeaves:b,editorState:I})=>{if(!n)return;let w=I._selection,C=a.current,L=c.current;if(C!==w){if(b.size===0&&_.size===0&&!L){let N=window.getSelection();if(N&&(N.anchorNode==null||N.focusNode==null))return}a.current=w}c.current=!1;let T=m();T!==null&&s(T)}),[t,m,n,f]),Yt(()=>n?t.registerUpdateListener(()=>{let _=t.getRootElement();_!==null&&i(_?.innerHTML)}):void 0,[t,n]);let p=ue(g=>{n||(g.update(()=>{let _=ds();_.clear();let b=us();_.append(cs().append(b)),b.select()}),o([])),r(_=>!_)},[n]),h=ue(()=>{if(!n)return;let g=window.getSelection();if(g===null||g.anchorNode==null||g.focusNode==null)return;let{anchorNode:_,anchorOffset:b,focusNode:I,focusOffset:w}=gs(g),C=d().getRootElement(),L;_!==null&&(L=dr(_,C));let T;I!==null&&(T=dr(I,C)),f("snapshot",{anchorNode:_,anchorOffset:b,anchorPath:L,focusNode:I,focusOffset:w,focusPath:T})},[f,n,d]),x=ue(()=>{ms(m())},[m]),E=ue(()=>{fs("test.js",m())},[m]);return[de("button",{className:`editor-dev-button ${n?"active":""}`,id:"test-recorder-button",onClick:g=>{p(d()),g.preventDefault()},title:n?"Disable test recorder":"Enable test recorder",type:"button",children:n?"Disable test recorder":"Enable test recorder"}),n?Jt("div",{className:"test-recorder-output",children:[Jt("div",{className:"test-recorder-toolbar",children:[de("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:g=>{h(),g.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),de("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:g=>{x(),g.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),de("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:g=>{E(),g.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),de("pre",{id:"test-recorder",ref:u,children:l})]}):null]}var pr=()=>{let[t]=as(),[e,o]=Cs(t);return Jt(fr.Fragment,{children:[de("p",{children:"HI"}),e,o,de("p",{children:"DONE"})]})};var xs=S({plugins:[{Component:pr,position:"bottom"}]});import{c as bs}from"react/compiler-runtime";import{jsx as _s}from"react/jsx-runtime";import{useLexicalComposerContext as Ts}from"@lexical/react/LexicalComposerContext.js";import{TreeView as Es}from"@lexical/react/LexicalTreeView.js";import"react";var hr=()=>{let t=bs(2),[e]=Ts(),o;return t[0]!==e?(o=_s(Es,{editor:e,timeTravelButtonClassName:"debug-timetravel-button",timeTravelPanelButtonClassName:"debug-timetravel-panel-button",timeTravelPanelClassName:"debug-timetravel-panel",timeTravelPanelSliderClassName:"debug-timetravel-panel-slider",treeTypeButtonClassName:"debug-treetype-button",viewClassName:"tree-view-output"}),t[0]=e,t[1]=o):o=t[1],o};var ws=S({plugins:[{Component:hr,position:"bottom"}]});import{$isRangeSelection as Ns,FORMAT_TEXT_COMMAND as ks}from"lexical";import{jsx as gr}from"react/jsx-runtime";import"react";var Cr=()=>gr("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:gr("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=t=>({type:"buttons",items:t,key:"format",order:40});var xr={type:"text-format",format:["bold","italic"],tag:"***"},br={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},_r={type:"text-format",format:["bold"],tag:"**"},Tr={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var Er=[U([{ChildComponent:Cr,isActive:({selection:t})=>Ns(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(ks,"bold")},order:1}])],Ls=S(({featureProviderMap:t})=>{let e=[_r,Tr];return t.get("italic")&&e.push(br,xr),{markdownTransformers:e,toolbarFixed:{groups:Er},toolbarInline:{groups:Er}}});import{$isRangeSelection as Rs,FORMAT_TEXT_COMMAND as Ss}from"lexical";import{jsx as wr,jsxs as Is}from"react/jsx-runtime";import"react";var Nr=()=>Is("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 kr={type:"text-format",format:["code"],tag:"`"};var Lr=[U([{ChildComponent:Nr,isActive:({selection:t})=>Rs(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(Ss,"code")},order:7}])],ys=S({markdownTransformers:[kr],toolbarFixed:{groups:Lr},toolbarInline:{groups:Lr}});import{$isRangeSelection as Ms,FORMAT_TEXT_COMMAND as vs}from"lexical";import{jsx as Ir}from"react/jsx-runtime";import"react";var Rr=()=>Ir("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:Ir("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 Sr={type:"text-format",format:["italic"],tag:"*"},yr={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var Mr=[U([{ChildComponent:Rr,isActive:({selection:t})=>Ms(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(vs,"italic")},order:2}])],As=S({markdownTransformers:[Sr,yr],toolbarFixed:{groups:Mr},toolbarInline:{groups:Mr}});import{$isRangeSelection as Fs,FORMAT_TEXT_COMMAND as Os}from"lexical";import{jsx as vr,jsxs as Ds}from"react/jsx-runtime";import"react";var Ar=()=>Ds("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:"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"}),vr("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var Dr={type:"text-format",format:["strikethrough"],tag:"~~"};var Fr=[U([{ChildComponent:Ar,isActive:({selection:t})=>Fs(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(Os,"strikethrough")},order:4}])],Ps=S({markdownTransformers:[Dr],toolbarFixed:{groups:Fr},toolbarInline:{groups:Fr}});import{$isRangeSelection as $s,FORMAT_TEXT_COMMAND as Hs}from"lexical";import{jsx as Or}from"react/jsx-runtime";import"react";var Pr=()=>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 $r=[U([{ChildComponent:Pr,isActive:({selection:t})=>$s(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(Hs,"subscript")},order:5}])],Bs=S({toolbarFixed:{groups:$r},toolbarInline:{groups:$r}});import{$isRangeSelection as js,FORMAT_TEXT_COMMAND as Gs}from"lexical";import{jsx as Hr}from"react/jsx-runtime";import"react";var Br=()=>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.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 jr=[U([{ChildComponent:Br,isActive:({selection:t})=>js(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(Gs,"superscript")},order:6}])],Us=S({toolbarFixed:{groups:jr},toolbarInline:{groups:jr}});import{$isRangeSelection as Vs,FORMAT_TEXT_COMMAND as zs}from"lexical";import{jsx as Gr,jsxs as Ws}from"react/jsx-runtime";import"react";var Ur=()=>Ws("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:[Gr("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"}),Gr("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var Wr=[U([{ChildComponent:Ur,isActive:({selection:t})=>Vs(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(zs,"underline")},order:3}])],Ks=S({toolbarFixed:{groups:Wr},toolbarInline:{groups:Wr}});import{$createHeadingNode as Js,$isHeadingNode as nn,HeadingNode as qs}from"@lexical/rich-text";import{$setBlocksType as Qs}from"@lexical/selection";import{$getSelection as ea,$isRangeSelection as ta}from"lexical";import{jsx as Vr}from"react/jsx-runtime";import"react";var zr=()=>Vr("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:Vr("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 Kr}from"react/jsx-runtime";import"react";var Zr=()=>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.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 Yr}from"react/jsx-runtime";import"react";var Xr=()=>Yr("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Yr("path",{d:"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 Jr}from"react/jsx-runtime";import"react";var qr=()=>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:"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 Qr}from"react/jsx-runtime";import"react";var en=()=>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.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 tn}from"react/jsx-runtime";import"react";var on=()=>tn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:tn("path",{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 Zs,$isHeadingNode as Ys,HeadingNode as Xs}from"@lexical/rich-text";var qt=t=>(e,o,n)=>{let r=t(n);r&&(r.append(...o),e.replace(r),r.select(0,0))};var rn=t=>{let o=`^(${t.map(r=>Number(r.slice(1))).map(r=>`#{${r}}`).join("|")})\\s`,n=new RegExp(o);return{type:"element",dependencies:[Xs],export:(r,i)=>{if(!Ys(r))return null;let l=Number(r.getTag().slice(1));return"#".repeat(l)+" "+i(r)},regExp:n,replace:qt(r=>{let i="h"+r[1].length;return Zs(i)})}};var ln=t=>{let e=ea();Qs(e,()=>Js(t))},sn={h1:zr,h2:Zr,h3:Xr,h4:qr,h5:en,h6:on},oa=S(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[V(e.map((n,r)=>({ChildComponent:sn[n],isActive:({selection:i})=>{if(!ta(i))return!1;for(let l of i.getNodes()){if(nn(l)&&l.getTag()===n)continue;let s=l.getParent();if(!(nn(s)&&s.getTag()===n))return!1}return!0},key:n,label:({i18n:i})=>i.t("lexical:heading:label",{headingLevel:n.charAt(1)}),onSelect:({editor:i})=>{i.update(()=>{ln(n)})},order:r+2})))];return{markdownTransformers:[rn(e)],nodes:[qs],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[G(e.map(n=>({Icon:sn[n],key:`heading-${n.charAt(1)}`,keywords:["heading",n],label:({i18n:r})=>r.t("lexical:heading:label",{headingLevel:n.charAt(1)}),onSelect:({editor:r})=>{r.update(()=>{ln(n)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}});import{$isNodeSelection as da}from"lexical";import{jsx as an}from"react/jsx-runtime";import"react";var Qt=()=>an("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:an("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as cn,jsxs as ra}from"react/jsx-runtime";import"react";var un=()=>ra("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[cn("path",{d:"M5 10h10",stroke:"currentColor"}),cn("path",{d:"M10 15V5",stroke:"currentColor"})]});var q=t=>({type:"dropdown",ChildComponent:un,items:t,key:"add",order:10});var dn={type:"element",dependencies:[Ye],export:(t,e)=>Je(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=Xe();e&&t.replace(e)}};import{c as na}from"react/compiler-runtime";import{useLexicalComposerContext as ia}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as la}from"@lexical/utils";import{$getSelection as sa,$isRangeSelection as aa,COMMAND_PRIORITY_EDITOR as ca}from"lexical";import{useEffect as ua}from"react";var mn=()=>{let t=na(3),[e]=ia(),o,n;return t[0]!==e?(o=()=>e.registerCommand(Ie,r=>{let i=sa();if(!aa(i))return!1;if(i.focus.getNode()!==null){let s=Xe();la(s)}return!0},ca),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),ua(o,n),null};var ma=S({markdownTransformers:[dn],nodes:[Ye],plugins:[{Component:mn,position:"normal"}],slashMenu:{groups:[G([{Icon:Qt,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ie,void 0)}}])]},toolbarFixed:{groups:[q([{ChildComponent:Qt,isActive:({selection:t})=>{if(!da(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Je(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ie,void 0)}}])]}});import{INDENT_CONTENT_COMMAND as ha,OUTDENT_CONTENT_COMMAND as ga}from"lexical";import{jsx as st,jsxs as fa}from"react/jsx-runtime";import"react";var fn=()=>fa("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[st("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),st("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),st("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),st("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as at,jsxs as pa}from"react/jsx-runtime";import"react";var pn=()=>pa("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:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),at("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),at("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),at("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});var hn=t=>({type:"buttons",items:t,key:"indent",order:35});var gn=[hn([{ChildComponent:fn,isActive:()=>!1,isEnabled:({selection:t})=>{if(!t||!t?.getNodes()?.length)return!1;for(let e of t.getNodes()){let o=e.getParentOrThrow();if("__indent"in e&&e.__indent>0||"__indent"in o&&o.__indent>0)return!0}return!1},key:"indentDecrease",label:({i18n:t})=>t.t("lexical:indent:decreaseLabel"),onSelect:({editor:t})=>{t.dispatchCommand(ga,void 0)},order:1},{ChildComponent:pn,isActive:()=>!1,key:"indentIncrease",label:({i18n:t})=>t.t("lexical:indent:increaseLabel"),onSelect:({editor:t})=>{t.dispatchCommand(ha,void 0)},order:2}])],Ca=S({toolbarFixed:{groups:gn},toolbarInline:{groups:gn}});import{$findMatchingParent as Lc}from"@lexical/utils";import{$getSelection as so,$isRangeSelection as zn}from"lexical";import{jsx as Cn}from"react/jsx-runtime";import"react";var xn=()=>Cn("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:Cn("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 bn}from"@lexical/selection";function ge(t){let{anchor:e}=t,{focus:o}=t,n=t.anchor.getNode(),r=t.focus.getNode();return n===r?n:t.isBackward()?bn(o)?n:r:bn(e)?n:r}var eo=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as Ra,$isTextNode as Sa}from"lexical";import{addClassNamesToElement as xa,isHTMLAnchorElement as ba}from"@lexical/utils";import ro from"bson-objectid";import{$applyNodeReplacement as _a,$createTextNode as _n,$getSelection as Ta,$isElementNode as Tn,$isRangeSelection as oo,createCommand as Ea,ElementNode as wa}from"lexical";var Na=new Set(["http:","https:","mailto:","sms:","tel:"]),z=class t extends wa{__fields;__id;constructor({id:e,fields:o={doc:null,linkType:"custom",newTab:!1,url:""},key:n}){super(n),this.__fields=o,this.__id=e}static clone(e){return new t({id:e.__id,fields:e.__fields,key:e.__key})}static getType(){return"link"}static importDOM(){return{a:e=>({conversion:ka,priority:1})}}static importJSON(e){e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),e.version===2&&!e.id&&(e.id=new ro.default().toHexString(),e.version=3);let o=Q({id:e.id,fields:e.fields});return o.setFormat(e.format),o.setIndent(e.indent),o.setDirection(e.direction),o}canBeEmpty(){return!1}canInsertTextAfter(){return!1}canInsertTextBefore(){return!1}createDOM(e){let o=document.createElement("a");return this.__fields?.linkType==="custom"&&(o.href=this.sanitizeUrl(this.__fields.url??"")),(this.__fields?.newTab??!1)&&(o.target="_blank"),this.__fields?.newTab===!0&&this.__fields?.linkType==="custom"&&(o.rel=to(o.rel,"add","noopener")),xa(o,e.theme.link),o}exportJSON(){let e={...super.exportJSON(),type:"link",fields:this.getFields(),version:3},o=this.getID();return o&&(e.id=o),e}extractWithChild(e,o,n){if(!oo(o))return!1;let r=o.anchor.getNode(),i=o.focus.getNode();return this.isParentOf(r)&&this.isParentOf(i)&&o.getTextContent().length>0}getFields(){return this.getLatest().__fields}getID(){return this.getLatest().__id}insertNewAfter(e,o=!0){let n=this.getParentOrThrow().insertNewAfter(e,o);if(Tn(n)){let r=Q({fields:this.__fields});return n.append(r),r}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!Na.has(o.protocol))return"about:blank"}catch{return"https://"}return e}setFields(e){let o=this.getWritable();o.__fields=e}updateDOM(e,o,n){let r=this.__fields?.url,i=this.__fields?.newTab;return r!=null&&r!==e.__fields?.url&&this.__fields?.linkType==="custom"&&(o.href=r),this.__fields?.linkType==="internal"&&e.__fields?.linkType==="custom"&&o.removeAttribute("href"),o.rel==null&&(o.rel=""),i!==e.__fields?.newTab&&(i??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=to(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=to(o.rel,"remove","noopener"))),!1}};function ka(t){let e=null;if(ba(t)){let o=t.textContent;o!==null&&o!==""&&(e=Q({id:new ro.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function Q({id:t,fields:e}){return _a(new z({id:t??new ro.default().toHexString(),fields:e}))}function j(t){return t instanceof z}var Y=Ea("TOGGLE_LINK_COMMAND");function En(t){let e=Ta();if(!oo(e)&&!t.selectedNodes?.length)return;let o=oo(e)?e.extract():t.selectedNodes;if(t===null)o?.forEach(n=>{let r=n.getParent();if(j(r)){let i=r.getChildren();for(let l=0;l<i.length;l+=1)r.insertBefore(i[l]);r.remove()}});else{if(o?.length===1){let i=o[0],l=j(i)?i:La(i);if(l!==null){l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append(_n(t.text)),l.getChildren().forEach(s=>{s!==l.getLastChild()&&s.remove()}));return}}let n=null,r=null;o?.forEach(i=>{let l=i.getParent();if(!(l===r||l===null||Tn(i)&&!i.isInline())){if(j(l)){r=l,l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append(_n(t.text)),l.getChildren().forEach(s=>{s!==l.getLastChild()&&s.remove()}));return}if(l.is(n)||(n=l,r=Q({fields:t.fields}),j(l)?i.getPreviousSibling()===null?l.insertBefore(r):l.insertAfter(r):i.insertBefore(r)),j(i)){if(i.is(r))return;if(r!==null){let s=i.getChildren();for(let a=0;a<s.length;a+=1)r.append(s[a])}i.remove();return}r!==null&&r.append(i)}})}}function La(t){return Ia(t,e=>j(e))}function Ia(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function to(t,e,o){let n,r=`${t}`;if(e==="add"){if(r.includes(o)){let i=new RegExp(o,"g");r=r.replace(i,"").trim()}r=r.trim(),n=r.length===0?`${o}`:`${r} ${o}`}else{let i=new RegExp(o,"g");n=r.replace(i,"").trim()}return n}var wn={type:"text-match",dependencies:[z],export:(t,e,o)=>{if(!j(t))return null;let n=t,{url:r}=n.getFields(),i=`[${n.getTextContent()}](${r})`,l=n.getFirstChild();return n.getChildrenSize()===1&&Sa(l)?o(l,i):i},importRegExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:(t,e)=>{let[,o,n]=e,r=Q({fields:{doc:null,linkType:"custom",newTab:!1,url:n}}),i=Ra(o);i.setFormat(t.getFormat()),r.append(i),t.replace(r)},trigger:")"};import{$applyNodeReplacement as ya,$isElementNode as Ma}from"lexical";var ee=class t extends z{static clone(e){return new t({id:"",fields:e.__fields,key:e.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(e){e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2);let o=Pe({fields:e.fields});return o.setFormat(e.format),o.setIndent(e.indent),o.setDirection(e.direction),o}exportJSON(){let e=super.exportJSON();return{type:"autolink",children:e.children,direction:e.direction,fields:e.fields,format:e.format,indent:e.indent,version:2}}insertNewAfter(e,o=!0){let n=this.getParentOrThrow().insertNewAfter(e,o);if(Ma(n)){let r=Pe({fields:this.__fields});return n.append(r),r}return null}};function Pe({fields:t}){return ya(new ee({id:"",fields:t}))}function te(t){return t instanceof ee}import{c as va}from"react/compiler-runtime";import{useLexicalComposerContext as Aa}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Da}from"@lexical/utils";import{$createTextNode as Nn,$getSelection as Fa,$isElementNode as Ln,$isLineBreakNode as In,$isNodeSelection as Oa,$isRangeSelection as Pa,$isTextNode as $e,TextNode as $a}from"lexical";import{useEffect as Ha}from"react";function kn(t,e=o=>o){return o=>{let n=t.exec(o);return n===null?null:{index:n.index,length:n[0].length,text:n[0],url:e(n[0])}}}function Rn(t,e){for(let o=0;o<e.length;o++){let n=e[o](t);if(n!=null)return n}return null}var Ba=/[.,;\s]/;function ut(t){return Ba.test(t)}function Sn(t){return ut(t[t.length-1])}function io(t){return ut(t[0])}function ja(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function yn(t){let e=t.getPreviousSibling();return Ln(e)&&(e=e.getLastDescendant()),e===null||In(e)||$e(e)&&Sn(e.getTextContent())}function Mn(t){let e=t.getNextSibling();return Ln(e)&&(e=e.getFirstDescendant()),e===null||In(e)||$e(e)&&io(e.getTextContent())}function Ga(t,e,o,n){return(t>0?ut(o[t-1]):yn(n[0]))?e<o.length?ut(o[e]):Mn(n[n.length-1]):!1}function Ua(t,e,o){let n=[],r=[],i=[],l=0,s=0,a=[...t];for(;a.length>0;){let c=a[0],d=c.getTextContent().length,m=s;s+d<=e?(n.push(c),l+=d):m>=o?i.push(c):r.push(c),s+=d,a.shift()}return[l,n,r,i]}function Wa(t,e,o,n){let r={linkType:"custom",url:n.url,...n.fields},i=Pe({fields:r});if(t.length===1){let l=t[0],s;e===0?[s,l]=l.splitText(o):[,s,l]=l.splitText(e,o);let a=Nn(n.text);return a.setFormat(s.getFormat()),a.setDetail(s.getDetail()),a.setStyle(s.getStyle()),i.append(a),s.replace(i),l}else if(t.length>1){let l=t[0],s=l.getTextContent().length,a;e===0?a=l:[,a]=l.splitText(e);let c=[],u;for(let p=1;p<t.length;p++){let h=t[p],E=h.getTextContent().length,v=s,y=s+E;if(v<o)if(y<=o)c.push(h);else{let[g,_]=h.splitText(o-v);c.push(g),u=_}s+=E}let d=Fa(),m=d?d.getNodes().find($e):void 0,f=Nn(a.getTextContent());return f.setFormat(a.getFormat()),f.setDetail(a.getDetail()),f.setStyle(a.getStyle()),i.append(f,...c),m&&m===a&&(Pa(d)?f.select(d.anchor.offset,d.focus.offset):Oa(d)&&f.select(0,f.getTextContent().length)),a.replace(i),u}}function Va(t,e,o){let n=[...t],r=n.map(a=>a.getTextContent()).join(""),i=r,l,s=0;for(;(l=Rn(i,e))!=null&&l!==null;){let a=l.index,c=l.length,u=a+c;if(Ga(s+a,s+u,r,n)){let[m,,f,p]=Ua(n,s+a,s+u),h=s+a-m,x=s+u-m,E=Wa(f,h,x,l);n=E?[E,...p]:p,o(l.url,null),s=0}else s+=u;i=i.substring(u)}}function no(t,e,o){let n=t.getChildren(),r=n.length;for(let a=0;a<r;a++){let c=n[a];if(!$e(c)||!c.isSimpleText()){ct(t),o(null,t.getFields()?.url??null);return}}let i=t.getTextContent(),l=Rn(i,e);if(l===null||l.text!==i){ct(t),o(null,t.getFields()?.url??null);return}if(!yn(t)||!Mn(t)){ct(t),o(null,t.getFields()?.url??null);return}let s=t.getFields()?.url;if(s!==l?.url){let a=t.getFields();a.url=l?.url,t.setFields(a),o(l.url,s??null)}}function za(t,e,o){let n=t.getPreviousSibling(),r=t.getNextSibling(),i=t.getTextContent();if(te(n)){let l=n.getFields()?.url?n.getFields()?.url?.startsWith("mailto:"):!1;(!io(i)||ja(i,l))&&(n.append(t),no(n,e,o),o(null,n.getFields()?.url??null))}te(r)&&!Sn(i)&&(ct(r),no(r,e,o),o(null,r.getFields()?.url??null))}function ct(t){let e=t.getChildren(),o=e.length;for(let n=o-1;n>=0;n--)t.insertAfter(e[n]);return t.remove(),e.map(n=>n.getLatest())}function Ka(t){let e=[t],o=t.getNextSibling();for(;o!==null&&$e(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function Za(t,e,o){let n=va(5),r,i;n[0]!==t||n[1]!==o||n[2]!==e?(r=()=>{if(!t.hasNodes([ee]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let l=(s,a)=>{o?.(s,a)};return Da(t.registerNodeTransform($a,s=>{let a=s.getParentOrThrow(),c=s.getPreviousSibling();if(te(a))no(a,e,l);else if(!j(a)){if(s.isSimpleText()&&(io(s.getTextContent())||!te(c))){let u=Ka(s);Va(u,e,l)}za(s,e,l)}}))},i=[t,e,o],n[0]=t,n[1]=o,n[2]=e,n[3]=r,n[4]=i):(r=n[3],i=n[4]),Ha(r,i)}var Ya=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,Xa=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,Ja=[kn(Ya,t=>t.startsWith("http")?t:`https://${t}`),kn(Xa,t=>`mailto:${t}`)],vn=()=>{let[t]=Aa();return Za(t,Ja),null};import{jsx as qa}from"react/jsx-runtime";import{ClickableLinkPlugin as Qa}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var An=()=>qa(Qa,{});import{jsx as pc}from"react/jsx-runtime";import"react";import{createPortal as hc}from"react-dom";import{jsx as le,jsxs as lo}from"react/jsx-runtime";import{useLexicalComposerContext as tc}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as Dn,mergeRegister as Fn}from"@lexical/utils";import{getTranslation as oc}from"@payloadcms/translations";import{CloseMenuIcon as rc,EditIcon as nc,formatDrawerSlug as ic,useConfig as lc,useEditDepth as sc,useTranslation as ac}from"@payloadcms/ui";import{$getSelection as On,$isLineBreakNode as cc,$isRangeSelection as Pn,COMMAND_PRIORITY_HIGH as uc,COMMAND_PRIORITY_LOW as $n,KEY_ESCAPE_COMMAND as dc,SELECTION_CHANGE_COMMAND as mc}from"lexical";import Hn,{useCallback as Bn,useEffect as ft,useRef as fc,useState as Ce}from"react";function dt(t,e,o,n=10,r=5){let i=o.parentElement;if(t===null||i==null){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let l=e.getBoundingClientRect(),s=o.getBoundingClientRect(),a=i.getBoundingClientRect(),c=t.top-n,u=t.left-r;c<a.top&&(c+=l.height+t.height+n*2),u+l.width>a.right&&(u=a.right-l.width-r),c-=s.top,u-=s.left,e.style.opacity="1",e.style.transform=`translate(${u}px, ${c}px)`}import{createCommand as ec}from"lexical";var mt=ec("TOGGLE_LINK_WITH_MODAL_COMMAND");function jn({anchorElem:t}){let[e]=tc(),o=fc(null),[n,r]=Ce(null),[i,l]=Ce(null),{uuid:s}=H(),{config:a}=lc(),{i18n:c,t:u}=ac(),[d,m]=Ce(),f=sc(),[p,h]=Ce(!1),[x,E]=Ce([]),[v,y]=Ce(!1),g=ic({slug:"lexical-rich-text-link-"+s,depth:f}),{toggleDrawer:_}=he(g),b=Bn(()=>{h(!1),o&&o.current&&(o.current.style.opacity="0",o.current.style.transform="translate(-10000px, -10000px)"),y(!1),r(null),l(null),E([]),m(void 0)},[h,r,l,E]),I=Bn(()=>{let w=On(),C;if(!Pn(w)||!w){b();return}let L=ge(w);C=e.getElementByKey(L.getKey())?.getBoundingClientRect();let T=Dn(L,j),N=w.getNodes().filter(F=>!cc(F)).find(F=>{let $=Dn(F,j);return T&&!T.is($)||$&&!$.is(T)});if(T==null||N){b();return}let k={...T.getFields(),id:T.getID(),text:T.getTextContent()};if(T.getFields()?.linkType==="custom")r(T.getFields()?.url??null),l(null);else{r(`${a.routes.admin==="/"?"":a.routes.admin}/collections/${T.getFields()?.doc?.relationTo}/${T.getFields()?.doc?.value}`);let F=a.collections.find($=>$.slug===T.getFields()?.doc?.relationTo);if(!F)l(T.getFields()?.label?String(T.getFields()?.label):null),r(T.getFields()?.url?String(T.getFields()?.url):null);else{let $=u("fields:linkedTo",{label:oc(F.labels.singular,c)}).replace(/<[^>]*>?/g,"");l($)}}m(k),h(!0),E(w?w?.getNodes():[]),te(T)?y(!0):y(!1);let R=o.current,M=window.getSelection(),{activeElement:A}=document;if(R===null)return;let O=e.getRootElement();return M!==null&&O!==null&&O.contains(M.anchorNode)?(C||(C=M.getRangeAt(0).getBoundingClientRect()),C!=null&&(C.y+=40,dt(C,R,t))):(A==null||A.className!=="link-input")&&(O!==null&&dt(null,R,t),r(null),l(null)),!0},[e,b,a.collections,u,c,t]);return ft(()=>Fn(e.registerCommand(mt,w=>(e.dispatchCommand(Y,w),I(),_(),!0),$n)),[e,I,_,g]),ft(()=>{let w=t.parentElement,C=()=>{e.getEditorState().read(()=>{I()})};return window.addEventListener("resize",C),w?.addEventListener("scroll",C),()=>{window.removeEventListener("resize",C),w?.removeEventListener("scroll",C)}},[t.parentElement,e,I]),ft(()=>Fn(e.registerUpdateListener(({editorState:w})=>{w.read(()=>{I()})}),e.registerCommand(mc,()=>(I(),!0),$n),e.registerCommand(dc,()=>p?(b(),!0):!1,uc)),[e,I,p,b]),ft(()=>{e.getEditorState().read(()=>{I()})},[e,I]),lo(Hn.Fragment,{children:[le("div",{className:"link-editor",ref:o,children:lo("div",{className:"link-input",children:[n&&n.length>0?le("a",{href:n,rel:"noopener noreferrer",target:"_blank",children:i!=null&&i.length>0?i:n}):i!=null&&i.length>0?le("span",{className:"link-input__label-pure",children:i}):null,e.isEditable()&&lo(Hn.Fragment,{children:[le("button",{"aria-label":"Edit link",className:"link-edit",onClick:()=>{_()},onMouseDown:w=>{w.preventDefault()},tabIndex:0,type:"button",children:le(nc,{})}),!v&&le("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(Y,null)},onMouseDown:w=>{w.preventDefault()},tabIndex:0,type:"button",children:le(rc,{})})]})]})}),le(ce,{className:"lexical-link-edit-drawer",data:d,drawerSlug:g,drawerTitle:u("fields:editLink"),featureKey:"link",handleDrawerSubmit:(w,C)=>{let L=C,T={...L};delete T.text,e.update(()=>{let N=On(),k=null;if(Pn(N)?k=ge(N).getParent():x.length&&(k=x[0].getParent()),k&&te(k)){let R=Q({fields:T});k.replace(R,!0)}}),e.dispatchCommand(Y,{fields:T,selectedNodes:x,text:L.text})},schemaPathSuffix:"fields"})]})}var Gn=t=>{let{anchorElem:e=document.body}=t;return hc(pc(jn,{anchorElem:e}),e)};import{c as xc}from"react/compiler-runtime";import{useLexicalComposerContext as bc}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as _c}from"@lexical/utils";import{$getSelection as Tc,$isElementNode as Ec,$isRangeSelection as wc,COMMAND_PRIORITY_LOW as Wn,PASTE_COMMAND as Nc}from"lexical";import{useEffect as kc}from"react";var gc=/(?:[A-Za-z]{3,9}:(?:\/\/)?(?:[-;:&=+$,\w]+@)?[A-Za-z\d.-]+|(?:www.|[-;:&=+$,\w]+@)[A-Za-z\d.-]+)(?:\/[+~%/.\w-]*)?\??[-+=&;%@.\w]*#?\w*/,Cc=/^[\w\-./]*(?:#\w[\w-]*)?$/;function Un(t){if(!t)return!1;if(t==="https://"||gc.test(t)||Cc.test(t))return!0;try{return new URL(t),!0}catch{}return!1}var Vn=()=>{let t=xc(3),[e]=bc(),o,n;return t[0]!==e?(o=()=>{if(!e.hasNodes([z]))throw new Error("LinkPlugin: LinkNode not registered on editor");return _c(e.registerCommand(Y,r=>(En(r),!0),Wn),e.registerCommand(Nc,r=>{let i=Tc();if(!wc(i)||i.isCollapsed()||!(r instanceof ClipboardEvent)||r.clipboardData==null)return!1;let l=r.clipboardData.getData("text");if(!Un(l))return!1;if(!i.getNodes().some(s=>Ec(s))){let s={doc:null,linkType:"custom",newTab:!1,url:l};return e.dispatchCommand(Y,{fields:s,text:null}),r.preventDefault(),!0}return!1},Wn))},n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),kc(o,n),null};var Kn=[eo([{ChildComponent:xn,isActive:({selection:t})=>{if(zn(t)){let e=ge(t);return Lc(e,j)!=null}return!1},isEnabled:({selection:t})=>!!(zn(t)&&so()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(Y,null);else{let o,n=[];if(t.getEditorState().read(()=>{o=so()?.getTextContent(),n=so()?.getNodes()??[]}),!o?.length)return;let r={doc:null,linkType:"custom",newTab:!1,url:"https://"};t.dispatchCommand(mt,{fields:r,selectedNodes:n,text:o})}},order:1}])],Ic=S({markdownTransformers:[wn],nodes:[z,ee],plugins:[{Component:Vn,position:"normal"},{Component:vn,position:"normal"},{Component:An,position:"normal"},{Component:Gn,position:"floatingAnchorElem"}],toolbarFixed:{groups:Kn},toolbarInline:{groups:Kn}});import{$isListNode as uo,INSERT_CHECK_LIST_COMMAND as Qn,ListItemNode as Hc,ListNode as Bc}from"@lexical/list";import{$isRangeSelection as jc}from"lexical";import{jsx as Zn,jsxs as Rc}from"react/jsx-runtime";import"react";var ao=()=>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:[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{jsx as Sc}from"react/jsx-runtime";import{ListPlugin as yc}from"@lexical/react/LexicalListPlugin.js";import"react";var xe=()=>Sc(yc,{});function be(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as Dc,ListItemNode as Fc,ListNode as Oc}from"@lexical/list";import{$createListItemNode as Mc,$createListNode as vc,$isListItemNode as Ac,$isListNode as co}from"@lexical/list";var Yn=4,_e=t=>(e,o,n)=>{let r=e.getPreviousSibling(),i=e.getNextSibling(),l=Mc(t==="check"?n[3]==="x":void 0);if(co(i)&&i.getListType()===t){let a=i.getFirstChild();a!==null?a.insertBefore(l):i.append(l),e.remove()}else if(co(r)&&r.getListType()===t)r.append(l),e.remove();else{let a=vc(t,t==="number"?Number(n[2]):void 0);a.append(l),e.replace(a)}l.append(...o),l.select(0,0);let s=Math.floor(n[1].length/Yn);s&&l.setIndent(s)},me=(t,e,o)=>{let n=[],r=t.getChildren(),i=0;for(let l of r)if(Ac(l)){if(l.getChildrenSize()===1){let u=l.getFirstChild();if(co(u)){n.push(me(u,e,o+1));continue}}let s=" ".repeat(o*Yn),a=t.getListType(),c=a==="number"?`${t.getStart()+i}. `:a==="check"?`- [${l.getChecked()?"x":" "}] `:"- ";n.push(s+c+e(l)),i++}return n.join(`
|
|
35
|
+
`)};var Xn={type:"element",dependencies:[Oc,Fc],export:(t,e)=>Dc(t)?me(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:_e("check")};import{jsx as Pc}from"react/jsx-runtime";import{CheckListPlugin as $c}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var Jn=()=>Pc($c,{});var qn=[V([{ChildComponent:ao,isActive:({selection:t})=>{if(!jc(t))return!1;for(let e of t.getNodes()){if(uo(e)&&e.getListType()==="check")continue;let o=e.getParent();if(uo(o)&&o.getListType()==="check")continue;let n=o?.getParent();if(!(uo(n)&&n.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(Qn,void 0)},order:12}])],Gc=S(({featureProviderMap:t})=>{let e=[{Component:Jn,position:"normal"}];return!t.has("unorderedList")&&!t.has("orderedList")&&e.push({Component:xe,position:"normal"}),{markdownTransformers:[Xn],nodes:t.has("unorderedList")||t.has("orderedList")?[]:[Bc,Hc],plugins:e,slashMenu:{groups:[be([{Icon:ao,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:o})=>o.t("lexical:checklist:label"),onSelect:({editor:o})=>{o.dispatchCommand(Qn,void 0)}}])]},toolbarFixed:{groups:qn},toolbarInline:{groups:qn}}});import{$isListNode as fo,INSERT_ORDERED_LIST_COMMAND as oi,ListItemNode as Kc,ListNode as Zc}from"@lexical/list";import{$isRangeSelection as Yc}from"lexical";import{jsx as He,jsxs as Uc}from"react/jsx-runtime";import"react";var mo=()=>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 Vc,ListNode as zc}from"@lexical/list";var ei={type:"element",dependencies:[zc,Vc],export:(t,e)=>Wc(t)?me(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:_e("number")};var ti=[V([{ChildComponent:mo,isActive:({selection:t})=>{if(!Yc(t))return!1;for(let e of t.getNodes()){if(fo(e)&&e.getListType()==="number")continue;let o=e.getParent();if(fo(o)&&o.getListType()==="number")continue;let n=o?.getParent();if(!(fo(n)&&n.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(oi,void 0)},order:10}])],Xc=S(({featureProviderMap:t})=>({markdownTransformers:[ei],nodes:t.has("orderedList")?[]:[Zc,Kc],plugins:t.has("orderedList")?[]:[{Component:xe,position:"normal"}],slashMenu:{groups:[be([{Icon:mo,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:e})=>e.t("lexical:orderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(oi,void 0)}}])]},toolbarFixed:{groups:ti},toolbarInline:{groups:ti}}));import{$isListNode as ho,INSERT_UNORDERED_LIST_COMMAND as ii,ListItemNode as tu,ListNode as ou}from"@lexical/list";import{$isRangeSelection as ru}from"lexical";import{jsx as Te,jsxs as Jc}from"react/jsx-runtime";import"react";var po=()=>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:[Te("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Te("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Te("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Te("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),Te("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),Te("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as qc,ListItemNode as Qc,ListNode as eu}from"@lexical/list";var ri={type:"element",dependencies:[eu,Qc],export:(t,e)=>qc(t)?me(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:_e("bullet")};var ni=[V([{ChildComponent:po,isActive:({selection:t})=>{if(!ru(t))return!1;for(let e of t.getNodes()){if(ho(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(ho(o)&&o.getListType()==="bullet")continue;let n=o?.getParent();if(!(ho(n)&&n.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(ii,void 0)},order:11}])],nu=S({markdownTransformers:[ri],nodes:[ou,tu],plugins:[{Component:xe,position:"normal"}],slashMenu:{groups:[be([{Icon:po,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(ii,void 0)}}])]},toolbarFixed:{groups:ni},toolbarInline:{groups:ni}});import{jsx as iu}from"react/jsx-runtime";import{addClassNamesToElement as lu}from"@lexical/utils";import{DecoratorNode as su}from"lexical";import*as li from"react";var au=li.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),Be=class t extends su{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new t({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return cu({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return lu(o,"unknownConverted"),o}decorate(){return iu(au,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function cu({data:t}){return new Be({data:t})}var uu=S(()=>({nodes:[Be]}));import{jsx as du}from"react/jsx-runtime";import{addClassNamesToElement as mu}from"@lexical/utils";import{DecoratorNode as fu}from"lexical";import*as si from"react";var pu=si.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),je=class t extends fu{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new t({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return hu({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return mu(o,"unknownConverted"),o}decorate(){return du(pu,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function hu({data:t}){return new je({data:t})}var gu=S(()=>({nodes:[je]}));import{$setBlocksType as ui}from"@lexical/selection";import{$createParagraphNode as di,$getSelection as mi,$isParagraphNode as ai,$isRangeSelection as Cu}from"lexical";var ci=[V([{ChildComponent:Oe,isActive:({selection:t})=>{if(!Cu(t))return!1;for(let e of t.getNodes())if(!ai(e)&&!ai(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=mi();ui(e,()=>di())})},order:1}])],xu=S({slashMenu:{groups:[G([{Icon:Oe,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=mi();ui(e,()=>di())})}}])]},toolbarFixed:{groups:ci},toolbarInline:{groups:ci}});import{$isNodeSelection as zu}from"lexical";import{jsx as Ge,jsxs as bu}from"react/jsx-runtime";import"react";var go=()=>bu("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{c as Du}from"react/compiler-runtime";import{jsx as Fu}from"react/jsx-runtime";import{useLexicalComposerContext as Ou}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Pu}from"@lexical/utils";import{useConfig as $u}from"@payloadcms/ui";import{$getPreviousSelection as Hu,$getSelection as Bu,$isParagraphNode as xi,$isRangeSelection as ju,COMMAND_PRIORITY_EDITOR as Gu,createCommand as Uu}from"lexical";import{useEffect as Wu}from"react";import{c as Su}from"react/compiler-runtime";import{jsx as ht}from"react/jsx-runtime";import{useLexicalComposerContext as yu}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as Mu,COMMAND_PRIORITY_EDITOR as vu}from"lexical";import{useEffect as pi,useState as hi}from"react";import{c as _u}from"react/compiler-runtime";import{jsx as Tu}from"react/jsx-runtime";import{useLexicalComposerContext as Eu}from"@lexical/react/LexicalComposerContext";import{useListDrawer as wu,useModal as Nu}from"@payloadcms/ui";import{$getPreviousSelection as ku,$getSelection as Lu,$setSelection as Iu}from"lexical";import{useEffect as Ru,useState as fi}from"react";var pt=t=>{let e=_u(23),[o]=Eu(),[n,r]=fi(null),[i,l]=fi(!1),[s,a,c]=wu(t),{closeDrawer:u,drawerSlug:d,isDrawerOpen:m,openDrawer:f}=c,{modalState:p}=Nu(),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let L=Lu()??ku();r(L)},e[0]=h):h=e[0];let x=h,E;e[1]!==n||e[2]!==o?(E=()=>{n&&o.update(()=>{Iu(n.clone())},{discrete:!0,skipTransforms:!0})},e[1]=n,e[2]=o,e[3]=E):E=e[3];let v=E,y;e[4]!==u?(y=()=>{u()},e[4]=u,e[5]=y):y=e[5];let g=y,_,b;e[6]!==i||e[7]!==p||e[8]!==d||e[9]!==v?(_=()=>{if(!i)return;let L=p[d];L&&!L?.isOpen&&(l(!1),setTimeout(()=>{v()},1))},b=[p,d,v,i],e[6]=i,e[7]=p,e[8]=d,e[9]=v,e[10]=_,e[11]=b):(_=e[10],b=e[11]),Ru(_,b);let I;e[12]!==a?(I=L=>Tu(a,{...L,onClick:()=>{x()}}),e[12]=a,e[13]=I):I=e[13];let w;e[14]!==f?(w=()=>{x(),f(),l(!0)},e[14]=f,e[15]=w):w=e[15];let C;return e[16]!==g||e[17]!==m||e[18]!==s||e[19]!==d||e[20]!==I||e[21]!==w?(C={closeListDrawer:g,isListDrawerOpen:m,ListDrawer:s,listDrawerSlug:d,ListDrawerToggler:I,openListDrawer:w},e[16]=g,e[17]=m,e[18]=s,e[19]=d,e[20]=I,e[21]=w,e[22]=C):C=e[22],C};var Au=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=Mu(o);r&&r.replace(ye({relationTo:e,value:n}))}):t.dispatchCommand(Co,{relationTo:e,value:n})},gi=t=>{let e=Su(21),{enabledCollectionSlugs:o}=t,[n]=yu(),r;e[0]!==o?(r=()=>o?.[0],e[0]=o,e[1]=r):r=e[1];let[i,l]=hi(r),[s,a]=hi(null),c=o||void 0,u;e[2]!==c||e[3]!==i?(u={collectionSlugs:c,selectedCollection:i},e[2]=c,e[3]=i,e[4]=u):u=e[4];let{closeListDrawer:d,isListDrawerOpen:m,ListDrawer:f,openListDrawer:p}=pt(u),h,x;e[5]!==n||e[6]!==p?(h=()=>n.registerCommand(Re,b=>(a(b?.replace?b?.replace.nodeKey:null),p(),!0),vu),x=[n,p],e[5]=n,e[6]=p,e[7]=h,e[8]=x):(h=e[7],x=e[8]),pi(h,x);let E;e[9]!==n||e[10]!==s||e[11]!==d?(E=b=>{let{collectionSlug:I,docID:w}=b;Au({editor:n,relationTo:I,replaceNodeKey:s,value:w}),d()},e[9]=n,e[10]=s,e[11]=d,e[12]=E):E=e[12];let v=E,y;e[13]!==o?(y=()=>{l(o?.[0])},e[13]=o,e[14]=y):y=e[14];let g;e[15]!==m||e[16]!==o?(g=[m,o],e[15]=m,e[16]=o,e[17]=g):g=e[17],pi(y,g);let _;return e[18]!==v||e[19]!==f?(_=ht(f,{onSelect:v}),e[18]=v,e[19]=f,e[20]=_):_=e[20],_},Ci=t=>(t?.enabledCollectionSlugs?.length??-1)>0?ht(gi,{...t}):ht(qe,{...t,children:ht(gi,{...t})});var Co=Uu("INSERT_RELATIONSHIP_COMMAND"),bi=t=>{let e=Du(10),{clientProps:o}=t,[n]=Ou(),{config:r}=$u(),{collections:i}=r,l=null;if(o?.enabledCollections)l=o?.enabledCollections;else if(o?.disabledCollections){let u;if(e[0]!==o||e[1]!==i){let d;e[3]!==o?(d=m=>{let{slug:f}=m;return!o?.disabledCollections?.includes(f)},e[3]=o,e[4]=d):d=e[4],u=i.filter(d).map(Vu),e[0]=o,e[1]=i,e[2]=u}else u=e[2];l=u}let s,a;e[5]!==n?(s=()=>{if(!n.hasNodes([Se]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return n.registerCommand(Co,u=>{let d=Bu()||Hu();if(ju(d)){let m=ye(u);Pu(m);let{focus:f}=d,p=f.getNode();xi(p)&&p.getTextContentSize()===0&&p.getParentOrThrow().getChildren().filter(h=>xi(h)).length>1&&p.remove()}return!0},Gu)},a=[n],e[5]=n,e[6]=s,e[7]=a):(s=e[6],a=e[7]),Wu(s,a);let c;return e[8]!==l?(c=Fu(Ci,{enabledCollectionSlugs:l}),e[8]=l,e[9]=c):c=e[9],c};function Vu(t){let{slug:e}=t;return e}var Ku=S({nodes:[Se],plugins:[{Component:bi,position:"normal"}],slashMenu:{groups:[G([{Icon:go,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Re,{replace:!1})}}])]},toolbarFixed:{groups:[q([{ChildComponent:go,isActive:({selection:t})=>{if(!zu(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Ht(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Re,{replace:!1})}}])]}});import{c as sd}from"react/compiler-runtime";import{jsx as Z,jsxs as ad}from"react/jsx-runtime";import{useLexicalComposerContext as cd}from"@lexical/react/LexicalComposerContext.js";import{useScrollInfo as ud,useThrottledEffect as dd,useTranslation as md}from"@payloadcms/ui";import*as oe from"react";import{useMemo as fd}from"react";import{jsx as Zu}from"react/jsx-runtime";import{mergeRegister as Yu}from"@lexical/utils";import{$getSelection as Xu}from"lexical";import{useCallback as Ju,useEffect as gt,useState as xo}from"react";var bo="toolbar-popup__button",Ue=({children:t,editor:e,item:o})=>{let[n,r]=xo(!0),[i,l]=xo(!1),[s,a]=xo(bo),c=H(),u=Ju(()=>{e.getEditorState().read(()=>{let d=Xu();if(d){if(o.isActive){let m=o.isActive({editor:e,editorConfigContext:c,selection:d});i!==m&&l(m)}if(o.isEnabled){let m=o.isEnabled({editor:e,editorConfigContext:c,selection:d});n!==m&&r(m)}}})},[i,e,c,n,o]);return gt(()=>{u()},[u]),gt(()=>(document.addEventListener("mouseup",u),()=>{document.removeEventListener("mouseup",u)}),[u]),gt(()=>Yu(e.registerUpdateListener(()=>{u()})),[e,u]),gt(()=>{a([bo,n===!1?"disabled":"",i?"active":"",o?.key?`${bo}-`+o.key:""].filter(Boolean).join(" "))},[n,i,s,o.key]),Zu("button",{className:s,onClick:()=>{if(n!==!1)return e._updateTags=new Set([...e._updateTags,"toolbar"]),e.focus(()=>{o.onSelect?.({editor:e,isActive:i})}),!0},onMouseDown:d=>{d.preventDefault()},type:"button",children:t})};import{c as ki}from"react/compiler-runtime";import{jsx as Ve,jsxs as od}from"react/jsx-runtime";import Eo,{useEffect as Ni}from"react";import{mergeRegister as rd}from"@lexical/utils";import{useTranslation as nd}from"@payloadcms/ui";import{$getSelection as id}from"lexical";import{jsx as se,jsxs as _i}from"react/jsx-runtime";import Ct,{useCallback as qu,useEffect as We,useMemo as Qu,useRef as To,useState as xt}from"react";import{createPortal as ed}from"react-dom";var _o="toolbar-popup__dropdown-item",Ti=Ct.createContext(null);function Ei({active:t,children:e,editor:o,enabled:n,item:r,title:i}){let[l,s]=xt(_o);We(()=>{s([_o,n===!1?"disabled":"",t?"active":"",r?.key?`${_o}-${r.key}`:""].filter(Boolean).join(" "))},[n,t,l,r.key]);let a=To(null),c=Ct.useContext(Ti);if(c===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:u}=c;return We(()=>{a?.current!=null&&u(a)},[a,u]),se("button",{className:l,onClick:()=>{n!==!1&&(o._updateTags=new Set([...o._updateTags,"toolbar"]),o.focus(()=>{r.onSelect?.({editor:o,isActive:t})}))},onMouseDown:d=>{d.preventDefault()},ref:a,title:i,type:"button",children:e})}function td({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:n}){let[r,i]=xt(),[l,s]=xt(),a=qu(d=>{i(m=>m!=null?[...m,d]:[d])},[i]),c=d=>{if(r==null)return;let{key:m}=d;["ArrowDown","ArrowUp","Escape","Tab"].includes(m)&&d.preventDefault(),m==="Escape"||m==="Tab"?n():m==="ArrowUp"?s(f=>{if(f==null)return r[0];let p=r.indexOf(f)-1;return r[p===-1?r.length-1:p]}):m==="ArrowDown"&&s(f=>f==null?r[0]:r[r.indexOf(f)+1])},u=Qu(()=>({registerItem:a}),[a]);return We(()=>{r!=null&&l==null&&s(r[0]),l!=null&&l?.current!=null&&l.current.focus()},[r,l]),se(Ti.Provider,{value:u,children:se("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:c,ref:e,children:t})})}function wi({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:n=!1,Icon:r,itemsContainerClassNames:i,label:l,stopCloseOnClickSelf:s}){let a=To(null),c=To(null),[u,d]=xt(!1),m=()=>{d(!1),c?.current!=null&&c.current.focus()};We(()=>{let p=c.current,h=a.current;if(u&&p!==null&&h!==null){let{left:x,top:E}=p.getBoundingClientRect(),v=window.scrollY||document.documentElement.scrollTop;h.style.top=`${E+v+p.offsetHeight+5}px`,h.style.left=`${Math.min(x-5,window.innerWidth-h.offsetWidth-20)}px`}},[a,c,u]),We(()=>{let p=c.current;if(p!==null&&u){let h=x=>{let{target:E}=x;s!=null&&a.current!=null&&a.current.contains(E)||p.contains(E)||d(!1)};return document.addEventListener("click",h),()=>{document.removeEventListener("click",h)}}},[a,c,u,s]);let f=ed(se(td,{dropDownRef:a,itemsContainerClassNames:i,onClose:m,children:o}),document.body);return _i(Ct.Fragment,{children:[_i("button",{"aria-label":t,className:e+(u?" active":""),disabled:n,onClick:p=>{p.preventDefault(),d(!u)},onMouseDown:p=>{p.preventDefault()},ref:c,type:"button",children:[r&&se(r,{}),l&&se("span",{className:"toolbar-popup__dropdown-label",children:l}),se("i",{className:"toolbar-popup__dropdown-caret"})]}),u&&se(Ct.Fragment,{children:f})]})}var wo="toolbar-popup__dropdown",ld=t=>{let e=ki(19),{active:o,anchorElem:n,editor:r,enabled:i,item:l}=t,{i18n:s}=nd(),{field:a}=H(),{richTextComponentMap:c}=a;if(l.Component){let f;return e[0]!==l||e[1]!==o||e[2]!==n||e[3]!==r||e[4]!==i?(f=l?.Component&&Ve(l.Component,{active:o,anchorElem:n,editor:r,enabled:i,item:l},l.key),e[0]=l,e[1]=o,e[2]=n,e[3]=r,e[4]=i,e[5]=f):f=e[5],f}let u=l.key;if(l.label){let f;e[6]!==l||e[7]!==s||e[8]!==c?(f=typeof l.label=="function"?l.label({i18n:s,richTextComponentMap:c}):l.label,e[6]=l,e[7]=s,e[8]=c,e[9]=f):f=e[9],u=f}u.length>25&&(u=u.substring(0,25)+"...");let d;e[10]!==l?(d=l?.ChildComponent&&Ve(l.ChildComponent,{}),e[10]=l,e[11]=d):d=e[11];let m;return e[12]!==u||e[13]!==d||e[14]!==o||e[15]!==r||e[16]!==i||e[17]!==l?(m=od(Ei,{active:o,editor:r,enabled:i,item:l,children:[d,Ve("span",{className:"text",children:u})]},l.key),e[12]=u,e[13]=d,e[14]=o,e[15]=r,e[16]=i,e[17]=l,e[18]=m):m=e[18],m},fe=t=>{let e=ki(42),{anchorElem:o,classNames:n,editor:r,group:i,Icon:l,itemsContainerClassNames:s,label:a,maxActiveItems:c,onActiveChange:u}=t,d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=[],e[0]=d):d=e[0];let[m,f]=Eo.useState(d),p;e[1]===Symbol.for("react.memo_cache_sentinel")?(p=[],e[1]=p):p=e[1];let[h,x]=Eo.useState(p),[E,v]=Eo.useState(!0),y=H(),{items:g,key:_}=i,b;e[2]!==r||e[3]!==g||e[4]!==c||e[5]!==y||e[6]!==i||e[7]!==u?(b=()=>{r.getEditorState().read(()=>{let B=id();if(!B)return;let W=[],Ho=[],vt=[];for(let ne of g)ne.isActive&&(!c||W.length<c)&&ne.isActive({editor:r,editorConfigContext:y,selection:B})&&(W.push(ne.key),Ho.push(ne)),ne.isEnabled?ne.isEnabled({editor:r,editorConfigContext:y,selection:B})&&vt.push(ne.key):vt.push(ne.key);i.isEnabled&&v(i.isEnabled({editor:r,editorConfigContext:y,selection:B})),f(W),x(vt),u&&u({activeItems:Ho})})},e[2]=r,e[3]=g,e[4]=c,e[5]=y,e[6]=i,e[7]=u,e[8]=b):b=e[8];let I=b,w,C;e[9]!==I?(w=()=>{I()},C=[I],e[9]=I,e[10]=w,e[11]=C):(w=e[10],C=e[11]),Ni(w,C);let L,T;e[12]!==r||e[13]!==I?(L=()=>rd(r.registerUpdateListener(()=>{I()})),T=[r,I],e[12]=r,e[13]=I,e[14]=L,e[15]=T):(L=e[14],T=e[15]),Ni(L,T);let N=`${_} dropdown`,k=`${wo}-${_}`,R;e[16]!==n?(R=n||[],e[16]=n,e[17]=R):R=e[17];let M;e[18]!==k||e[19]!==R?(M=[wo,k,...R].filter(Boolean),e[18]=k,e[19]=R,e[20]=M):M=e[20];let A=M.join(" "),O=!E,F;e[21]!==s?(F=s||[],e[21]=s,e[22]=F):F=e[22];let $;if(e[23]!==F||e[24]!==g||e[25]!==m||e[26]!==o||e[27]!==r||e[28]!==h||e[29]!==N||e[30]!==A||e[31]!==O||e[32]!==l||e[33]!==a||e[34]!==_){let B;e[36]!==g||e[37]!==m||e[38]!==o||e[39]!==r||e[40]!==h?(B=g.length&&g.map(W=>Ve(ld,{active:m.includes(W.key),anchorElem:o,editor:r,enabled:h.includes(W.key),item:W},W.key)),e[36]=g,e[37]=m,e[38]=o,e[39]=r,e[40]=h,e[41]=B):B=e[41],$=Ve(wi,{buttonAriaLabel:N,buttonClassName:A,disabled:O,Icon:l,itemsContainerClassNames:[`${wo}-items`,...F],label:a,children:B},_),e[23]=F,e[24]=g,e[25]=m,e[26]=o,e[27]=r,e[28]=h,e[29]=N,e[30]=A,e[31]=O,e[32]=l,e[33]=a,e[34]=_,e[35]=$}else $=e[35];return $};function pd({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&Z(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?Z(Ue,{editor:e,item:o,children:Z(o.ChildComponent,{})},o.key):null}function hd(t){let e=sd(25),{anchorElem:o,editor:n,editorConfig:r,group:i,index:l}=t,{i18n:s}=md(),{field:a}=H(),{richTextComponentMap:c}=a,[u,d]=oe.useState(void 0),[m,f]=oe.useState(void 0),p,h;e[0]!==i?(p=()=>{i?.type==="dropdown"&&i.items.length&&i.ChildComponent?f(()=>i.ChildComponent):f(void 0)},h=[i],e[0]=i,e[1]=p,e[2]=h):(p=e[1],h=e[2]),oe.useEffect(p,h);let x;e[3]!==i||e[4]!==s||e[5]!==c?(x=b=>{let{activeItems:I}=b;if(!I.length){i?.type==="dropdown"&&i.items.length&&i.ChildComponent?(f(()=>i.ChildComponent),d(void 0)):(f(void 0),d(void 0));return}let w=I[0],C=w.key;w.label&&(C=typeof w.label=="function"?w.label({i18n:s,richTextComponentMap:c}):w.label),C.length>25&&(C=C.substring(0,25)+"..."),d(C),f(()=>w.ChildComponent)},e[3]=i,e[4]=s,e[5]=c,e[6]=x):x=e[6];let E=x,v=`fixed-toolbar__group fixed-toolbar__group-${i.key}`,y;e[7]!==i||e[8]!==m||e[9]!==o||e[10]!==n||e[11]!==u||e[12]!==E?(y=i.type==="dropdown"&&i.items.length&&(m?Z(fe,{anchorElem:o,editor:n,group:i,Icon:m,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:u,maxActiveItems:1,onActiveChange:E}):Z(fe,{anchorElem:o,editor:n,group:i,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:u,maxActiveItems:1,onActiveChange:E})),e[7]=i,e[8]=m,e[9]=o,e[10]=n,e[11]=u,e[12]=E,e[13]=y):y=e[13];let g;e[14]!==i||e[15]!==o||e[16]!==n?(g=i.type==="buttons"&&i.items.length&&i.items.map(b=>Z(pd,{anchorElem:o,editor:n,item:b},b.key)),e[14]=i,e[15]=o,e[16]=n,e[17]=g):g=e[17];let _;return e[18]!==r.features.toolbarFixed||e[19]!==l||e[20]!==y||e[21]!==g||e[22]!==v||e[23]!==i.key?(_=ad("div",{className:v,children:[y,g,l<r.features.toolbarFixed?.groups.length-1&&Z("div",{className:"divider"})]},i.key),e[18]=r.features.toolbarFixed,e[19]=l,e[20]=y,e[21]=g,e[22]=v,e[23]=i.key,e[24]=_):_=e[24],_}function gd({anchorElem:t,clientProps:e,editor:o,editorConfig:n,parentWithFixedToolbar:r}){let i=oe.useRef(null),{y:l}=ud(),s=fd(()=>{if(!r||e?.disableIfParentHasFixedToolbar)return null;let c=r.editorContainerRef.current.previousElementSibling;for(;c;){if(c.classList.contains("fixed-toolbar"))return c;c=c.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,r]);return dd(()=>{if(!s)return;let a=i.current;if(!a)return;let c=a.getBoundingClientRect(),u=s.getBoundingClientRect();if(!(c.bottom<u.top||c.top>u.bottom))a.className="fixed-toolbar fixed-toolbar--overlapping",s.className="fixed-toolbar fixed-toolbar--hide";else{if(!a.classList.contains("fixed-toolbar--overlapping"))return;a.className="fixed-toolbar",s.className="fixed-toolbar"}},50,[i,s,l]),Z("div",{className:"fixed-toolbar",onFocus:a=>{a.stopPropagation()},ref:i,children:o.isEditable()&&Z(oe.Fragment,{children:n?.features&&n.features?.toolbarFixed?.groups.map((a,c)=>Z(hd,{anchorElem:t,editor:o,editorConfig:n,group:a,index:c},a.key))})})}var Li=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return Li(t.parentEditor)}return!1},Ii=({anchorElem:t,clientProps:e})=>{let[o]=cd(),n=H(),{editorConfig:r}=n,i=e.applyToFocusedEditor&&n.focusedEditor?.editor||o,l=e.applyToFocusedEditor&&n.focusedEditor?.editorConfig||r,s=Li(n);return e?.disableIfParentHasFixedToolbar&&s||!l?.features?.toolbarFixed?.groups?.length?null:Z(gd,{anchorElem:t,editor:i,editorConfig:l,parentWithFixedToolbar:s})};var Cd=S({plugins:[{Component:Ii,position:"aboveContainer"}]});import{c as xd}from"react/compiler-runtime";import{jsx as X,jsxs as yi}from"react/jsx-runtime";import{useLexicalComposerContext as bd}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Mi}from"@lexical/utils";import{$getSelection as vi,$isRangeSelection as Ri,$isTextNode as _d,COMMAND_PRIORITY_LOW as Td,SELECTION_CHANGE_COMMAND as Ed}from"lexical";import{useCallback as ze,useEffect as Ke,useRef as Si,useState as wd}from"react";import*as _t from"react";import{createPortal as Nd}from"react-dom";function No(t,e){let o=t.getRangeAt(0),n;if(t.anchorNode===e){let r=e;for(;r.firstElementChild!=null;)r=r.firstElementChild;n=r.getBoundingClientRect()}else n=o.getBoundingClientRect();return n}function bt(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:n=0,floatingElem:r,horizontalOffset:i=32,horizontalPosition:l="left",specialHandlingForCaret:s=!1,targetRect:a,verticalGap:c=10}=t,u=o.parentElement;if(a===null||u==null){r.style.opacity="0",r.style.transform="translate(-10000px, -10000px)";return}let d=r.getBoundingClientRect(),m=o.getBoundingClientRect(),f=u.getBoundingClientRect(),p=a.top-d.height-c,h=a.left-i;l==="center"&&(h=a.left+a.width/2-d.width/2);let x=0;return!e&&p<f.top&&!s&&(x=d.height+a.height+c*2,p+=x),l==="center"?h+d.width>f.right?h=f.right-d.width-i:h<f.left&&(h=f.left+i):h+d.width>f.right&&(h=f.right-d.width-i),h-=m.left,r.style.opacity="1",s&&n!==0?(p-=m.bottom-n+d.height-3,r.style.transform=`translate(${h}px, ${p}px) rotate(180deg)`):(p-=m.top,r.style.transform=`translate(${h}px, ${p}px)`),x}function kd({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&X(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?X(Ue,{editor:e,item:o,children:X(o.ChildComponent,{})},o.key):null}function Ld(t){let e=xd(22),{anchorElem:o,editor:n,group:r,index:i}=t,{editorConfig:l}=H(),[s,a]=_t.useState(),c,u;e[0]!==r?(c=()=>{r?.type==="dropdown"&&r.items.length&&r.ChildComponent?a(()=>r.ChildComponent):a(void 0)},u=[r],e[0]=r,e[1]=c,e[2]=u):(c=e[1],u=e[2]),_t.useEffect(c,u);let d;e[3]!==r?(d=E=>{let{activeItems:v}=E;if(!v.length){r?.type==="dropdown"&&r.items.length&&r.ChildComponent?a(()=>r.ChildComponent):a(void 0);return}let y=v[0];a(()=>y.ChildComponent)},e[3]=r,e[4]=d):d=e[4];let m=d,f=`inline-toolbar-popup__group inline-toolbar-popup__group-${r.key}`,p;e[5]!==r||e[6]!==s||e[7]!==o||e[8]!==n||e[9]!==m?(p=r.type==="dropdown"&&r.items.length&&(s?X(fe,{anchorElem:o,editor:n,group:r,Icon:s,maxActiveItems:1,onActiveChange:m}):X(fe,{anchorElem:o,editor:n,group:r,maxActiveItems:1,onActiveChange:m})),e[5]=r,e[6]=s,e[7]=o,e[8]=n,e[9]=m,e[10]=p):p=e[10];let h;e[11]!==r||e[12]!==o||e[13]!==n?(h=r.type==="buttons"&&r.items.length&&r.items.map(E=>X(kd,{anchorElem:o,editor:n,item:E},E.key)),e[11]=r,e[12]=o,e[13]=n,e[14]=h):h=e[14];let x;return e[15]!==l.features.toolbarInline||e[16]!==i||e[17]!==p||e[18]!==h||e[19]!==f||e[20]!==r.key?(x=yi("div",{className:f,children:[p,h,i<l.features.toolbarInline?.groups.length-1&&X("div",{className:"divider"})]},r.key),e[15]=l.features.toolbarInline,e[16]=i,e[17]=p,e[18]=h,e[19]=f,e[20]=r.key,e[21]=x):x=e[21],x}function Id({anchorElem:t,editor:e}){let o=Si(null),n=Si(null),{editorConfig:r}=H(),i=ze(()=>{if(o?.current){let c=o.current.style.opacity==="0",u=o.current.style.pointerEvents==="none";c||(o.current.style.opacity="0"),u||(o.current.style.pointerEvents="none")}},[o]),l=ze(c=>{if(o?.current&&(c.buttons===1||c.buttons===3)){let u=o.current.style.opacity==="0",d=o.current.style.pointerEvents==="none";if(!u||!d){let m=c.clientX,f=c.clientY,p=document.elementFromPoint(m,f);o.current.contains(p)||i()}}},[i]),s=ze(()=>{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=ze(()=>{let c=vi(),u=window.getSelection();if(o.current===null)return;let d=t.querySelector(":scope > .link-editor"),m=d!==null&&"style"in d&&d?.style?.opacity==="1",f=e.getRootElement();if(c!==null&&u!==null&&!u.isCollapsed&&f!==null&&f.contains(u.anchorNode)){let p=No(u,f),h=bt({alwaysDisplayOnTop:m,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:p});n.current&&bt({anchorElem:o.current,anchorFlippedOffset:h,floatingElem:n.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:p,verticalGap:8})}else i()},[e,i,t]);return Ke(()=>{let c=t.parentElement,u=()=>{e.getEditorState().read(()=>{a()})};return window.addEventListener("resize",u),c&&c.addEventListener("scroll",u),()=>{window.removeEventListener("resize",u),c&&c.removeEventListener("scroll",u)}},[e,a,t]),Ke(()=>(e.getEditorState().read(()=>{a()}),Mi(e.registerUpdateListener(({editorState:c})=>{c.read(()=>{a()})}),e.registerCommand(Ed,()=>(a(),!1),Td))),[e,a]),yi("div",{className:"inline-toolbar-popup",ref:o,children:[X("div",{className:"caret",ref:n}),r?.features&&r.features?.toolbarInline?.groups.map((c,u)=>X(Ld,{anchorElem:t,editor:e,group:c,index:u},c.key))]})}function Rd(t,e){let[o,n]=wd(!1),r=ze(()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let i=vi(),l=window.getSelection(),s=t.getRootElement();if(l!==null&&(!Ri(i)||s===null||!s.contains(l.anchorNode))){n(!1);return}if(!Ri(i))return;if(i.getTextContent()!==""){let c=i.getNodes(),u=!1;for(let d of c)if(_d(d)){n(!0),u=!0;break}u||n(!1)}else n(!1);let a=i.getTextContent().replace(/\n/g,"");if(!i.isCollapsed()&&a===""){n(!1);return}})},[t]);return Ke(()=>(document.addEventListener("selectionchange",r),document.addEventListener("mouseup",r),()=>{document.removeEventListener("selectionchange",r),document.removeEventListener("mouseup",r)}),[r]),Ke(()=>Mi(t.registerUpdateListener(()=>{r()}),t.registerRootListener(()=>{t.getRootElement()===null&&n(!1)})),[t,r]),!o||!t.isEditable()?null:Nd(X(Id,{anchorElem:e,editor:t}),e)}var Ai=({anchorElem:t})=>{let[e]=bd();return Rd(e,t)};var Sd=S({plugins:[{Component:Ai,position:"floatingAnchorElem"}]});import{TableCellNode as Zm,TableNode as Ym,TableRowNode as Xm}from"@lexical/table";import{jsx as Di}from"react/jsx-runtime";import"react";var ko=()=>Di("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Di("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{jsx as P,jsxs as re}from"react/jsx-runtime";import{useLexicalComposerContext as $i}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Md}from"@lexical/react/useLexicalEditable";import{$deleteTableColumn__EXPERIMENTAL as vd,$deleteTableRow__EXPERIMENTAL as Ad,$getNodeTriplet as Dd,$getTableCellNodeFromLexicalNode as Fd,$getTableColumnIndexFromTableCellNode as Od,$getTableNodeFromLexicalNodeOrThrow as Ze,$getTableRowIndexFromTableCellNode as Pd,$insertTableColumn__EXPERIMENTAL as $d,$insertTableRow__EXPERIMENTAL as Hd,$isTableCellNode as Tt,$isTableRowNode as Oi,$isTableSelection as wt,$unmergeCell as Bd,getTableObserverFromTableElement as jd,TableCellHeaderStates as ae,TableCellNode as Gd}from"@lexical/table";import{useScrollInfo as Ud}from"@payloadcms/ui";import{$createParagraphNode as Wd,$getRoot as Vd,$getSelection as Nt,$isElementNode as zd,$isParagraphNode as Hi,$isRangeSelection as Ro,$isTextNode as Kd}from"lexical";import*as So from"react";import{useCallback as J,useEffect as pe,useRef as Et,useState as Ee}from"react";import{createPortal as Bi}from"react-dom";import{jsx as Lo,jsxs as yd}from"react/jsx-runtime";import"react";var Fi=()=>yd("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[Lo("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"}),Lo("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"}),Lo("path",{d:"M15 11C15.5523 11 16 10.5523 16 10C16 9.44772 15.5523 9 15 9C14.4477 9 14 9.44772 14 10C14 10.5523 14.4477 11 15 11Z",fill:"currentColor"})]});function Io(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function Zd(){let t=Nt();if(Ro(t)&&!t.isCollapsed()||wt(t)&&!t.anchor.is(t.focus)||!Ro(t)&&!wt(t))return!1;let[e]=Dd(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function Pi(t){if(t.getChildrenSize()!==1)return!1;let e=t.getFirstChildOrThrow();return!(!Hi(e)||!e.isEmpty())}function Yd(t){let e=t.getLastDescendant();Kd(e)?e.select():zd(e)?e.selectEnd():e!==null&&e.selectNext()}function Xd({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:n,tableCellNode:r}){let[i]=$i(),l=Et(null),[s,a]=Ee(r),[c,u]=Ee({columns:1,rows:1}),[d,m]=Ee(!1),[f,p]=Ee(!1),{y:h}=Ud();pe(()=>i.registerMutationListener(Gd,N=>{N.get(s.getKey())==="updated"&&i.getEditorState().read(()=>{a(s.getLatest())})},{skipInitialization:!0}),[i,s]),pe(()=>{i.getEditorState().read(()=>{let N=Nt();if(wt(N)){let k=Io(N);u(Io(N)),m(k.columns>1||k.rows>1)}p(Zd())})},[i]),pe(()=>{let N=e.current,k=l.current,R=i.getRootElement();if(N!=null&&k!=null&&R!=null){let M=R.getBoundingClientRect(),A=N.getBoundingClientRect();k.style.opacity="1";let O=k.getBoundingClientRect(),F=5,$=A.right+F;if($+O.width>window.innerWidth||$+O.width>M.right){let W=A.left-O.width-F;$=(W<0?F:W)+window.pageXOffset}k.style.left=`${$+window.pageXOffset}px`;let B=A.top;if(B+O.height>window.innerHeight){let W=A.bottom-O.height;B=(W<0?F:W)+window.pageYOffset}k.style.top=`${B}px`}},[e,l,i,h]),pe(()=>{function N(k){l.current!=null&&e.current!=null&&!l.current.contains(k.target)&&!e.current.contains(k.target)&&n(!1)}return window.addEventListener("click",N),()=>window.removeEventListener("click",N)},[n,e]);let x=J(()=>{i.update(()=>{if(s.isAttached()){let k=Ze(s),R=i.getElementByKey(k.getKey());if(!R)throw new Error("Expected to find tableElement in DOM");let M=jd(R);M!==null&&M.clearHighlight(),k.markDirty(),a(s.getLatest())}Vd().selectStart()})},[i,s]),E=()=>{i.update(()=>{let N=Nt();if(wt(N)){let{columns:k,rows:R}=Io(N),M=N.getNodes(),A=null;for(let O=0;O<M.length;O++){let F=M[O];if(Tt(F))if(A===null){F.setColSpan(k).setRowSpan(R),A=F;let $=Pi(F),B;$&&Hi(B=F.getFirstChild())&&B.remove()}else Tt(A)&&(Pi(F)||A.append(...F.getChildren()),F.remove())}A!==null&&(A.getChildrenSize()===0&&A.append(Wd()),Yd(A)),o()}})},v=()=>{i.update(()=>{Bd()})},y=J(N=>{i.update(()=>{Hd(N),o()})},[i,o]),g=J(N=>{i.update(()=>{for(let k=0;k<c.columns;k++)$d(N);o()})},[i,o,c.columns]),_=J(()=>{i.update(()=>{Ad(),o()})},[i,o]),b=J(()=>{i.update(()=>{Ze(s).remove(),x(),o()})},[i,s,x,o]),I=J(()=>{i.update(()=>{vd(),o()})},[i,o]),w=J(()=>{i.update(()=>{let N=Ze(s),k=Pd(s),R=N.getChildren();if(k>=R.length||k<0)throw new Error("Expected table cell to be inside of table row.");let M=R[k];if(!Oi(M))throw new Error("Expected table row");let A=s.getHeaderStyles()^ae.ROW;M.getChildren().forEach(O=>{if(!Tt(O))throw new Error("Expected table cell");O.setHeaderStyles(A,ae.ROW)}),x(),o()})},[i,s,x,o]),C=J(()=>{i.update(()=>{let N=Ze(s),k=Od(s),R=N.getChildren(),M=Math.max(...R.map(O=>O.getChildren().length));if(k>=M||k<0)throw new Error("Expected table cell to be inside of table row.");let A=s.getHeaderStyles()^ae.COLUMN;for(let O=0;O<R.length;O++){let F=R[O];if(!Oi(F))throw new Error("Expected table row");let $=F.getChildren();if(k>=$.length)continue;let B=$[k];if(!Tt(B))throw new Error("Expected table cell");B.setHeaderStyles(A,ae.COLUMN)}x(),o()})},[i,s,x,o]),L=J(()=>{i.update(()=>{if(s.isAttached()){let N=Ze(s);N&&N.setRowStriping(!N.getRowStriping())}x(),o()})},[i,s,x,o]),T=null;return t&&(d?T=P("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>E(),type:"button",children:"Merge cells"}):f&&(T=P("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>v(),type:"button",children:"Unmerge cells"}))),Bi(re("div",{className:"table-action-menu-dropdown",onClick:N=>{N.stopPropagation()},ref:l,children:[T?re(So.Fragment,{children:[T,P("hr",{})]}):null,P("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>L(),type:"button",children:P("span",{className:"text",children:"Toggle Row Striping"})}),P("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>y(!1),type:"button",children:re("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," above"]})}),P("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>y(!0),type:"button",children:re("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," below"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>g(!1),type:"button",children:re("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","left"]})}),P("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>g(!0),type:"button",children:re("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","right"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>I(),type:"button",children:P("span",{className:"text",children:"Delete column"})}),P("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>_(),type:"button",children:P("span",{className:"text",children:"Delete row"})}),P("button",{className:"item","data-test-id":"table-delete",onClick:()=>b(),type:"button",children:P("span",{className:"text",children:"Delete table"})}),P("hr",{}),P("button",{className:"item",onClick:()=>w(),type:"button",children:re("span",{className:"text",children:[(s.__headerState&ae.ROW)===ae.ROW?"Remove":"Add"," ","row header"]})}),P("button",{className:"item","data-test-id":"table-column-header",onClick:()=>C(),type:"button",children:re("span",{className:"text",children:[(s.__headerState&ae.COLUMN)===ae.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function Jd({anchorElem:t,cellMerge:e}){let[o]=$i(),n=Et(null),r=Et(null),[i,l]=Ee(!1),[s,a]=Ee(null),c=J(()=>{let d=n.current,m=Nt(),f=window.getSelection(),p=document.activeElement;if(m==null||d==null){a(null);return}let h=o.getRootElement();if(Ro(m)&&h!==null&&f!==null&&h.contains(f.anchorNode)){let x=Fd(m.anchor.getNode());if(x==null){a(null);return}if(o.getElementByKey(x.getKey())==null){a(null);return}a(x)}else p||a(null)},[o]);pe(()=>o.registerUpdateListener(()=>{o.getEditorState().read(()=>{c()})})),pe(()=>{let d=n.current;if(d!=null&&s!=null){let m=o.getElementByKey(s.getKey());if(m!=null){let f=m.getBoundingClientRect(),p=d.getBoundingClientRect(),h=t.getBoundingClientRect(),x=f.top-h.top+4,E=f.right-p.width-10-h.left;d.style.opacity="1",d.style.transform=`translate(${E}px, ${x}px)`}else d.style.opacity="0",d.style.transform="translate(-10000px, -10000px)"}},[n,s,o,t]);let u=Et(s);return pe(()=>{u.current!==s&&l(!1),u.current=s},[u,s]),P("div",{className:"table-cell-action-button-container",ref:n,children:s!=null&&re(So.Fragment,{children:[P("button",{className:"table-cell-action-button",onClick:d=>{d.stopPropagation(),l(!i)},ref:r,type:"button",children:P(Fi,{})}),i&&P(Xd,{cellMerge:e,contextRef:r,onClose:()=>l(!1),setIsMenuOpen:l,tableCellNode:s})]})})}var ji=({anchorElem:t})=>{let e=Md();return Bi(e?P(Jd,{anchorElem:t??document.body,cellMerge:!0}):null,t??document.body)};import{jsx as It,jsxs as qd}from"react/jsx-runtime";import{useLexicalComposerContext as Qd}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as em}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as tm,$getTableNodeFromLexicalNodeOrThrow as yo,$getTableRowIndexFromTableCellNode as om,$isTableCellNode as Gi,$isTableRowNode as rm,getDOMCellFromTarget as nm,TableNode as im}from"@lexical/table";import{calculateZoomLevel as Ui}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Mo}from"lexical";import*as zi from"react";import{useCallback as we,useEffect as Wi,useMemo as lm,useRef as kt,useState as Lt}from"react";import{createPortal as sm}from"react-dom";var am=33,Vi=92;function cm({editor:t}){let e=kt(null),o=kt(null),n=kt(null),r=H(),i=kt(null),[l,s]=Lt(null),[a,c]=Lt(null),[u,d]=Lt(!1),[m,f]=Lt(null),p=we(()=>{c(null),e.current=null,f(null),i.current=null,n.current=null},[]),h=C=>(C.buttons&1)===1;Wi(()=>t.registerNodeTransform(im,C=>{if(C.getColWidths())return C;let L=C.getColumnCount(),T=Vi;return C.setColWidths(Array(L).fill(T)),C}),[t]),Wi(()=>{let C=k=>{setTimeout(()=>{let R=k.target;if(m){s({x:k.clientX,y:k.clientY});return}if(d(h(k)),!(o.current&&o.current.contains(R))&&e.current!==R){e.current=R;let M=nm(R);M&&a!==M?t.update(()=>{let A=Mo(M.elem);if(!A)throw new Error("TableCellResizer: Table cell node not found.");let O=yo(A),F=t.getElementByKey(O.getKey());if(!F)throw new Error("TableCellResizer: Table element not found.");e.current=R,n.current=F.getBoundingClientRect(),c(M)}):M==null&&p()}},0)},L=k=>{setTimeout(()=>{d(!0)},0)},T=k=>{setTimeout(()=>{d(!1)},0)},N=t.registerRootListener((k,R)=>{R?.removeEventListener("mousemove",C),R?.removeEventListener("mousedown",L),R?.removeEventListener("mouseup",T),k?.addEventListener("mousemove",C),k?.addEventListener("mousedown",L),k?.addEventListener("mouseup",T)});return()=>{N()}},[a,m,t,p]);let x=C=>C==="bottom",E=we(C=>{if(!a)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let L=Mo(a.elem);if(!Gi(L))throw new Error("TableCellResizer: Table cell node not found.");let T=yo(L),N=om(L)+L.getRowSpan()-1,k=T.getChildren();if(N>=k.length||N<0)throw new Error("Expected table cell to be inside of table row.");let R=k[N];if(!rm(R))throw new Error("Expected table row");let M=R.getHeight();if(M===void 0){let O=R.getChildren();M=Math.min(...O.map(F=>v(F,t)??1/0))}let A=Math.max(M+C,am);R.setHeight(A)},{tag:"skip-scroll-into-view"})},[a,t]),v=(C,L)=>L.getElementByKey(C.getKey())?.clientHeight,y=(C,L)=>{for(let T=0;T<L.length;T++)for(let N=0;N<L[T].length;N++)if(L[T][N].cell===C)return N},g=we(C=>{if(!a)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let L=Mo(a.elem);if(!Gi(L))throw new Error("TableCellResizer: Table cell node not found.");let T=yo(L),[N]=tm(T,null,null),k=y(L,N);if(k===void 0)throw new Error("TableCellResizer: Table column not found.");let R=T.getColWidths();if(!R)return;let M=R[k];if(M===void 0)return;let A=[...R],O=Math.max(M+C,Vi);A[k]=O,T.setColWidths(A)},{tag:"skip-scroll-into-view"})},[a,t]),_=we(C=>{let L=T=>{if(T.preventDefault(),T.stopPropagation(),!a)throw new Error("TableCellResizer: Expected active cell.");if(i.current){let{x:N,y:k}=i.current;if(a===null)return;let R=Ui(T.target);if(x(C)){let M=(T.clientY-k)/R;E(M)}else{let M=(T.clientX-N)/R;g(M)}p(),document.removeEventListener("mouseup",L)}};return L},[a,p,g,E]),b=we(C=>L=>{if(L.preventDefault(),L.stopPropagation(),!a)throw new Error("TableCellResizer: Expected active cell.");i.current={x:L.clientX,y:L.clientY},s(i.current),f(C),document.addEventListener("mouseup",_(C))},[a,_]),w=we(()=>{if(a){let{height:C,left:L,top:T,width:N}=a.elem.getBoundingClientRect(),k=Ui(a.elem),R=10,M={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${R}px`,left:`${window.pageXOffset+L}px`,top:`${window.pageYOffset+T+C-R/2}px`,width:`${N}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${C}px`,left:`${window.pageXOffset+L+N-R/2}px`,top:`${window.pageYOffset+T}px`,width:`${R}px`}},A=n.current;return m&&l&&A&&(x(m)?(M[m].left=`${window.pageXOffset+A.left}px`,M[m].top=`${window.pageYOffset+l.y/k}px`,M[m].height="3px",M[m].width=`${A.width}px`):(M[m].top=`${window.pageYOffset+A.top}px`,M[m].left=`${window.pageXOffset+l.x/k}px`,M[m].width="3px",M[m].height=`${A.height}px`),M[m].backgroundColor="#adf"),M}return{bottom:null,left:null,right:null,top:null}},[a,m,l])();return It("div",{ref:o,children:a!=null&&!u&&qd(zi.Fragment,{children:[It("div",{className:`${r.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:b("right"),style:w.right||void 0}),It("div",{className:`${r.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:b("bottom"),style:w.bottom||void 0})]})})}var Ki=()=>{let[t]=Qd(),e=em();return lm(()=>e?sm(It(cm,{editor:t}),document.body):null,[t,e])};import{jsx as vo,jsxs as gm,Fragment as Cm}from"react/jsx-runtime";import{useLexicalComposerContext as xm}from"@lexical/react/LexicalComposerContext";import{$getTableColumnIndexFromTableCellNode as bm,$getTableRowIndexFromTableCellNode as _m,$insertTableColumn__EXPERIMENTAL as Tm,$insertTableRow__EXPERIMENTAL as Em,$isTableCellNode as wm,$isTableNode as Xi,TableNode as Nm}from"@lexical/table";import{$findMatchingParent as km,mergeRegister as Lm}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Ji}from"lexical";import{useEffect as qi,useRef as Qi,useState as Rt}from"react";import"react";import{createPortal as Im}from"react-dom";import{useMemo as pm,useRef as hm}from"react";var um="Expected a function",dm=Math.max,mm=Math.min;function fm(t,e,o){let n,r,i=0,l,s=!1,a=!1,c,u,d,m=!0;if(typeof t!="function")throw new TypeError(um);e=e||0,typeof o=="object"&&(s=!!o.leading,a="maxWait"in o,c=a?dm(o.maxWait||0,e):c,m="trailing"in o?!!o.trailing:m);function f(b){let I=n,w=l;return n=l=void 0,i=b,u=t.apply(w,I),u}function p(b){return i=b,d=setTimeout(E,e),s?f(b):u}function h(b){let I=b-r,w=b-i,C=e-I;return a?mm(C,c-w):C}function x(b){let I=b-r,w=b-i;return r===void 0||I>=e||I<0||a&&w>=c}function E(){let b=Date.now();if(x(b))return v(b);d=setTimeout(E,h(b))}function v(b){return d=void 0,m&&n?f(b):(n=l=void 0,u)}function y(){d!==void 0&&clearTimeout(d),i=0,n=r=l=d=void 0}function g(){return d===void 0?u:v(Date.now())}function _(){let b=Date.now(),I=x(b);if(n=arguments,l=this,r=b,I){if(d===void 0)return p(r);if(a)return clearTimeout(d),d=setTimeout(E,e),f(r)}return d===void 0&&(d=setTimeout(E,e)),u}return _.cancel=y,_.flush=g,_}var Zi=fm;function Yi(t,e,o){let n=hm(null);return n.current=t,pm(()=>Zi((...r)=>{n.current&&n.current(...r)},e,{maxWait:o}),[e,o])}var el=20;function Rm({anchorElem:t}){let[e]=xm(),o=H(),[n,r]=Rt(!1),[i,l]=Rt(!1),[s,a]=Rt(!1),[c,u]=Rt({}),d=Qi(new Set),m=Qi(null),f=Yi(h=>{let{isOutside:x,tableDOMNode:E}=Sm(h,o.editorConfig?.lexical);if(x){r(!1),l(!1);return}if(!E)return;m.current=E;let v=null,y=null,g=null;if(e.update(()=>{let _=Ji(E);if(wm(_)){let b=km(_,I=>Xi(I));if(!Xi(b))return;if(g=e.getElementByKey(b?.getKey()),g){let I=b.getChildrenSize(),w=b.getChildAtIndex(0)?.getChildrenSize(),C=_m(_),L=bm(_);C===I-1?v=_:L===w-1&&(y=_)}}}),g){let{bottom:_,height:b,right:I,width:w,x:C,y:L}=g.getBoundingClientRect(),{left:T,y:N}=t.getBoundingClientRect();v?(l(!1),r(!0),u({height:el,left:C-T,top:_-N+5,width:w})):y&&(l(!0),r(!1),u({height:b,left:I-T+5,top:L-N,width:el}))}},50,250);qi(()=>{if(s)return document.addEventListener("mousemove",f),()=>{r(!1),l(!1),document.removeEventListener("mousemove",f)}},[s,f]),qi(()=>Lm(e.registerMutationListener(Nm,h=>{e.getEditorState().read(()=>{for(let[x,E]of h)switch(E){case"created":d.current.add(x),a(d.current.size>0);break;case"destroyed":d.current.delete(x),a(d.current.size>0);break;default:break}})},{skipInitialization:!1})),[e]);let p=h=>{e.update(()=>{m.current&&(Ji(m.current)?.selectEnd(),h?(Em(),r(!1)):(Tm(),l(!1)))})};return gm(Cm,{children:[n&&vo("button",{className:o.editorConfig.lexical.theme.tableAddRows,onClick:()=>p(!0),style:{...c}}),i&&vo("button",{className:o.editorConfig.lexical.theme.tableAddColumns,onClick:()=>p(!1),style:{...c}})]})}function Sm(t,e){let o=t.target;if(o&&o instanceof HTMLElement){let n=o.closest(`td.${e.theme.tableCell}, th.${e.theme.tableCell}`);return{isOutside:!(n||o.closest(`button.${e.theme.tableAddRows}`)||o.closest(`button.${e.theme.tableAddColumns}`)||o.closest(`div.${e.theme.tableCellResizer}`)),tableDOMNode:n}}else return{isOutside:!0,tableDOMNode:null}}function tl({anchorElem:t=document.body}){return Im(vo(Rm,{anchorElem:t}),t)}import{c as ym}from"react/compiler-runtime";import{jsx as Ao,jsxs as Mm}from"react/jsx-runtime";import{useLexicalComposerContext as vm}from"@lexical/react/LexicalComposerContext";import{TablePlugin as Am}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as Dm,TableNode as Fm}from"@lexical/table";import{mergeRegister as Om}from"@lexical/utils";import{formatDrawerSlug as Pm,useEditDepth as $m}from"@payloadcms/ui";import{$getSelection as Hm,$isRangeSelection as Bm,COMMAND_PRIORITY_EDITOR as jm,createCommand as Gm}from"lexical";import{createContext as Um,useContext as Wm,useEffect as Vm,useMemo as zm,useState as Km}from"react";import*as ol from"react";var St=Gm("OPEN_EMBED_DRAWER_COMMAND"),rl=Um({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function nl({children:t}){let[e,o]=Km({cellEditorConfig:null,cellEditorPlugins:null});return Ao(rl.Provider,{value:zm(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(n,r)=>{o({cellEditorConfig:n,cellEditorPlugins:r})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var il=()=>{let t=ym(15),[e]=vm(),o=Wm(rl),n=$m(),{uuid:r}=H(),i="lexical-table-create-"+r,l;t[0]!==i||t[1]!==n?(l=Pm({slug:i,depth:n}),t[0]=i,t[1]=n,t[2]=l):l=t[2];let s=l,{toggleDrawer:a}=he(s),c;t[3]!==e||t[4]!==a?(c=()=>{if(!e.hasNodes([Fm]))throw new Error("TablePlugin: TableNode is not registered on editor");return Om(e.registerCommand(St,()=>{let f;return f=null,e.getEditorState().read(()=>{let p=Hm();Bm(p)&&(f=p)}),f&&a(),!0},jm))},t[3]=e,t[4]=a,t[5]=c):c=t[5];let u;t[6]!==o||t[7]!==e||t[8]!==a?(u=[o,e,a],t[6]=o,t[7]=e,t[8]=a,t[9]=u):u=t[9],Vm(c,u);let d;t[10]!==e?(d=(f,p)=>{!p.columns||!p.rows||e.dispatchCommand(Dm,{columns:String(p.columns),rows:String(p.rows)})},t[10]=e,t[11]=d):d=t[11];let m;return t[12]!==s||t[13]!==d?(m=Mm(ol.Fragment,{children:[Ao(ce,{drawerSlug:s,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:d,schemaPathSuffix:"fields"}),Ao(Am,{hasCellBackgroundColor:!1,hasCellMerge:!0})]}),t[12]=s,t[13]=d,t[14]=m):m=t[14],m};var Jm=S({nodes:[Ym,Zm,Xm],plugins:[{Component:il,position:"normal"},{Component:Ki,position:"normal"},{Component:ji,position:"floatingAnchorElem"},{Component:tl,position:"floatingAnchorElem"}],providers:[nl],slashMenu:{groups:[G([{Icon:ko,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(St,{})}}])]},toolbarFixed:{groups:[q([{ChildComponent:ko,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(St,{})}}])]}});import{$isNodeSelection as Tf}from"lexical";import{jsx as Do,jsxs as qm}from"react/jsx-runtime";import"react";var Fo=()=>qm("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Do("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"}),Do("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"}),Do("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{c as af}from"react/compiler-runtime";import{jsx as cf}from"react/jsx-runtime";import{useLexicalComposerContext as uf}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as df,mergeRegister as mf}from"@lexical/utils";import{useConfig as ff}from"@payloadcms/ui";import{$getPreviousSelection as pf,$getSelection as hf,$isParagraphNode as sl,$isRangeSelection as gf,COMMAND_PRIORITY_EDITOR as Cf,createCommand as xf}from"lexical";import{useEffect as bf}from"react";import{c as Qm}from"react/compiler-runtime";import{jsx as Oo}from"react/jsx-runtime";import{useLexicalComposerContext as ef}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as tf,COMMAND_PRIORITY_EDITOR as of}from"lexical";import{useEffect as rf,useState as nf}from"react";var lf=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=tf(o);r&&r.replace(Ae({data:{fields:null,relationTo:e,value:n}}))}):t.dispatchCommand(Po,{fields:null,relationTo:e,value:n})},sf=t=>{let e=Qm(13),{enabledCollectionSlugs:o}=t,[n]=ef(),[r,i]=nf(null),l;e[0]!==o?(l={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=l):l=e[1];let{closeListDrawer:s,ListDrawer:a,openListDrawer:c}=pt(l),u,d;e[2]!==n||e[3]!==c?(u=()=>n.registerCommand(Me,h=>(i(h?.replace?h?.replace.nodeKey:null),c(),!0),of),d=[n,c],e[2]=n,e[3]=c,e[4]=u,e[5]=d):(u=e[4],d=e[5]),rf(u,d);let m;e[6]!==s||e[7]!==n||e[8]!==r?(m=h=>{let{collectionSlug:x,docID:E}=h;s(),lf({editor:n,relationTo:x,replaceNodeKey:r,value:E})},e[6]=s,e[7]=n,e[8]=r,e[9]=m):m=e[9];let f=m,p;return e[10]!==f||e[11]!==a?(p=Oo(a,{onSelect:f}),e[10]=f,e[11]=a,e[12]=p):p=e[12],p},ll=t=>Oo(qe,{...t,uploads:!0,children:Oo(sf,{...t})});var Po=xf("INSERT_UPLOAD_COMMAND"),al=t=>{let e=af(5),[o]=uf(),{config:n}=ff(),{collections:r}=n,i,l;e[0]!==o?(i=()=>{if(!o.hasNodes([ve]))throw new Error("UploadPlugin: UploadNode not registered on editor");return mf(o.registerCommand(Po,a=>(o.update(()=>{let c=hf()||pf();if(gf(c)){let u=Ae({data:{id:a.id,fields:a.fields,relationTo:a.relationTo,value:a.value}});df(u);let{focus:d}=c,m=d.getNode();sl(m)&&m.getTextContentSize()===0&&m.getParentOrThrow().getChildren().filter(f=>sl(f)).length>1&&m.remove()}}),!0),Cf))},l=[o],e[0]=o,e[1]=i,e[2]=l):(i=e[1],l=e[2]),bf(i,l);let s;return e[3]!==r?(s=cf(ll,{enabledCollectionSlugs:r.map(_f)}),e[3]=r,e[4]=s):s=e[4],s};function _f(t){let{slug:e}=t;return e}var Ef=S({nodes:[ve],plugins:[{Component:al,position:"normal"}],slashMenu:{groups:[G([{Icon:Fo,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Me,{replace:!1})}}])]},toolbarFixed:{groups:[q([{ChildComponent:Fo,isActive:({selection:t})=>{if(!Tf(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Bt(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Me,{replace:!1})}}])]}});import{c as wf}from"react/compiler-runtime";import{jsx as $o}from"react/jsx-runtime";import{ShimmerEffect as Nf}from"@payloadcms/ui";import{lazy as kf,Suspense as Lf,useEffect as If,useState as Rf}from"react";var Sf=kf(()=>import("./Field-Y47DV2NP.js").then(t=>({default:t.RichText}))),yf=t=>{let e=wf(11),{admin:o,field:n,lexicalEditorConfig:r}=t,i;e[0]!==o?(i=o===void 0?{}:o,e[0]=o,e[1]=i):i=e[1];let l=i,{richTextComponentMap:s}=n,[a,c]=Rf(null),u,d;e[2]!==a||e[3]!==s||e[4]!==r||e[5]!==l?(u=()=>{if(a)return;let f=s?.get("features"),p=[];for(let E of f)p.push(E.clientFeature(E.clientFeatureProps));let h=r||De,x=Qe({unSanitizedEditorConfig:{features:p,lexical:h}});c(Fe(x,h,l))},d=[r,s,l,a],e[2]=a,e[3]=s,e[4]=r,e[5]=l,e[6]=u,e[7]=d):(u=e[6],d=e[7]),If(u,d);let m;return e[8]!==a||e[9]!==t?(m=$o(Lf,{fallback:$o(Nf,{height:"35vh"}),children:a&&$o(Sf,{...t,editorConfig:a})}),e[8]=a,e[9]=t,e[10]=m):m=e[10],m};function Mf(...t){return t.filter(Boolean).join(" ")}var yt=new WeakMap;function cl(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function Mt(t,e){let o=yt.get(t);if(o===void 0){let n=new Set,r=l=>{o!==void 0&&(o.start=cl(l))},i=l=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let a=cl(l);for(let c of n)a!==null&&c([a[0]-s[0],a[1]-s[1]],l)};t.addEventListener("touchstart",r),t.addEventListener("touchend",i),o={handleTouchend:i,handleTouchstart:r,listeners:n,start:null},yt.set(t,o)}return o.listeners.add(e),()=>{vf(t,e)}}function vf(t,e){let o=yt.get(t);if(o===void 0)return;let{listeners:n}=o;n.delete(e),n.size===0&&(yt.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function Af(t,e){return Mt(t,(o,n)=>{let[r,i]=o;r<0&&-r>Math.abs(i)&&e(r,n)})}function Df(t,e){return Mt(t,(o,n)=>{let[r,i]=o;r>0&&r>Math.abs(i)&&e(r,n)})}function Ff(t,e){return Mt(t,(o,n)=>{let[r,i]=o;i<0&&-i>Math.abs(r)&&e(r,n)})}function Of(t,e){return Mt(t,(o,n)=>{let[r,i]=o;i>0&&i>Math.abs(r)&&e(r,n)})}var D={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},Pf=D.IS_BOLD|D.IS_ITALIC|D.IS_STRIKETHROUGH|D.IS_UNDERLINE|D.IS_CODE|D.IS_SUBSCRIPT|D.IS_SUPERSCRIPT|D.IS_HIGHLIGHT,$f="\xA0",Hf=`
|
|
36
36
|
|
|
37
|
-
`,
|
|
37
|
+
`,ul="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",dl="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",Bf=new RegExp("^[^"+dl+"]*["+ul+"]"),jf=new RegExp("^[^"+ul+"]*["+dl+"]"),Gf={bold:D.IS_BOLD,code:D.IS_CODE,highlight:D.IS_HIGHLIGHT,italic:D.IS_ITALIC,strikethrough:D.IS_STRIKETHROUGH,subscript:D.IS_SUBSCRIPT,superscript:D.IS_SUPERSCRIPT,underline:D.IS_UNDERLINE},Uf={directionless:D.IS_DIRECTIONLESS,unmergeable:D.IS_UNMERGEABLE},Wf={center:D.IS_ALIGN_CENTER,end:D.IS_ALIGN_END,justify:D.IS_ALIGN_JUSTIFY,left:D.IS_ALIGN_LEFT,right:D.IS_ALIGN_RIGHT,start:D.IS_ALIGN_START},Vf={[D.IS_ALIGN_CENTER]:"center",[D.IS_ALIGN_END]:"end",[D.IS_ALIGN_JUSTIFY]:"justify",[D.IS_ALIGN_LEFT]:"left",[D.IS_ALIGN_RIGHT]:"right",[D.IS_ALIGN_START]:"start"},zf={normal:D.IS_NORMAL,segmented:D.IS_SEGMENTED,token:D.IS_TOKEN},Kf={[D.IS_NORMAL]:"normal",[D.IS_SEGMENTED]:"segmented",[D.IS_TOKEN]:"token"};export{Pe as $createAutoLinkNode,Dt as $createBlockNode,Pt as $createInlineBlockNode,Q as $createLinkNode,ye as $createRelationshipNode,Ae as $createUploadNode,te as $isAutoLinkNode,pl as $isBlockNode,$t as $isInlineBlockNode,j as $isLinkNode,Ht as $isRelationshipNode,Bt as $isUploadNode,Dl as AlignFeatureClient,ee as AutoLinkNode,Ne as BlockNode,Bl as BlockquoteFeatureClient,is as BlocksFeatureClient,Ls as BoldFeatureClient,K as CAN_USE_DOM,Gc as ChecklistFeatureClient,Uf as DETAIL_TYPE_TO_DETAIL,Hf as DOUBLE_LINE_BREAK,Vf as ELEMENT_FORMAT_TO_TYPE,Wf as ELEMENT_TYPE_TO_FORMAT,xl as ENABLE_SLASH_MENU_COMMAND,fl as EditorConfigProvider,ce as FieldsDrawer,Cd as FixedToolbarFeatureClient,oa as HeadingFeatureClient,ma as HorizontalRuleFeatureClient,Pf as IS_ALL_FORMATTING,Ca as IndentFeatureClient,Ot as InlineBlockNode,ys as InlineCodeFeatureClient,Sd as InlineToolbarFeatureClient,As as ItalicFeatureClient,jf as LTR_REGEX,uu as LexicalPluginToLexicalFeatureClient,Ic as LinkFeatureClient,z as LinkNode,$f as NON_BREAKING_SPACE,D as NodeFormat,Xc as OrderedListFeatureClient,xu as ParagraphFeatureClient,gl as Point,Bf as RTL_REGEX,bl as Rect,Ku as RelationshipFeatureClient,Se as RelationshipNode,Sl as RichTextCell,yf as RichTextField,gu as SlateToLexicalFeatureClient,Ps as StrikethroughFeatureClient,Bs as SubscriptFeatureClient,Us as SuperscriptFeatureClient,zf as TEXT_MODE_TO_TYPE,Gf as TEXT_TYPE_TO_FORMAT,Kf as TEXT_TYPE_TO_MODE,Y as TOGGLE_LINK_COMMAND,Jm as TableFeatureClient,xs as TestRecorderFeatureClient,Ue as ToolbarButton,fe as ToolbarDropdown,ws as TreeViewFeatureClient,Ks as UnderlineFeatureClient,nu as UnorderedListFeatureClient,Ef as UploadFeatureClient,ve as UploadNode,Of as addSwipeDownListener,Af as addSwipeLeftListener,Df as addSwipeRightListener,Ff as addSwipeUpListener,qt as createBlockNode,S as createClientFeature,De as defaultEditorLexicalConfig,No as getDOMRangeRect,At as getEnabledNodes,ge as getSelectedNode,hl as isHTMLElement,Cl as isPoint,Mf as joinClasses,Fe as sanitizeClientEditorConfig,jo as sanitizeClientFeatures,bt as setFloatingElemPosition,dt as setFloatingElemPositionForLinkEditor,G as slashMenuBasicGroupWithItems,q as toolbarAddDropdownGroupWithItems,eo as toolbarFeatureButtonsGroupWithItems,U as toolbarFormatGroupWithItems,V as toolbarTextDropdownGroupWithItems,H as useEditorConfigContext};
|
|
38
38
|
//# sourceMappingURL=index.js.map
|