@payloadcms/richtext-lexical 3.0.0-beta.133 → 3.0.0-beta.134
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/exports/client/Field-S5G27AVI.js +2 -0
- package/dist/exports/client/Field-S5G27AVI.js.map +7 -0
- package/dist/exports/client/bundled.css +1 -1
- package/dist/exports/client/chunk-2CYU43GM.js +2 -0
- package/dist/exports/client/chunk-2CYU43GM.js.map +7 -0
- package/dist/exports/client/chunk-C7S3V4EB.js +2 -0
- package/dist/exports/client/chunk-C7S3V4EB.js.map +7 -0
- package/dist/exports/client/chunk-U7O7EYCP.js +2 -0
- package/dist/exports/client/chunk-U7O7EYCP.js.map +7 -0
- package/dist/exports/client/component-H3EYQ5KG.js +2 -0
- package/dist/exports/client/{component-YICNYPTU.js.map → component-H3EYQ5KG.js.map} +1 -1
- package/dist/exports/client/componentInline-ZGO3K4TA.js +2 -0
- package/dist/exports/client/componentInline-ZGO3K4TA.js.map +7 -0
- package/dist/exports/client/index.d.ts +7 -0
- package/dist/exports/client/index.d.ts.map +1 -1
- package/dist/exports/client/index.js +7 -7
- package/dist/exports/client/index.js.map +4 -4
- package/dist/features/blocks/client/component/BlockContent.d.ts +34 -9
- package/dist/features/blocks/client/component/BlockContent.d.ts.map +1 -1
- package/dist/features/blocks/client/component/BlockContent.js +63 -158
- package/dist/features/blocks/client/component/BlockContent.js.map +1 -1
- package/dist/features/blocks/client/component/components/BlockCollapsible.d.ts +11 -0
- package/dist/features/blocks/client/component/components/BlockCollapsible.d.ts.map +1 -0
- package/dist/features/blocks/client/component/components/BlockCollapsible.js +37 -0
- package/dist/features/blocks/client/component/components/BlockCollapsible.js.map +1 -0
- package/dist/features/blocks/client/component/components/BlockEditButton.d.ts +3 -0
- package/dist/features/blocks/client/component/components/BlockEditButton.d.ts.map +1 -0
- package/dist/features/blocks/client/component/components/BlockEditButton.js +22 -0
- package/dist/features/blocks/client/component/components/BlockEditButton.js.map +1 -0
- package/dist/features/blocks/client/component/components/BlockRemoveButton.d.ts +3 -0
- package/dist/features/blocks/client/component/components/BlockRemoveButton.d.ts.map +1 -0
- package/dist/features/blocks/client/component/components/BlockRemoveButton.js +22 -0
- package/dist/features/blocks/client/component/components/BlockRemoveButton.js.map +1 -0
- package/dist/features/blocks/client/component/index.d.ts.map +1 -1
- package/dist/features/blocks/client/component/index.js +242 -63
- package/dist/features/blocks/client/component/index.js.map +1 -1
- package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.d.ts +5 -0
- package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.d.ts.map +1 -0
- package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.js +28 -0
- package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.js.map +1 -0
- package/dist/features/blocks/client/componentInline/components/InlineBlockEditButton.d.ts +3 -0
- package/dist/features/blocks/client/componentInline/components/InlineBlockEditButton.d.ts.map +1 -0
- package/dist/features/blocks/client/componentInline/components/InlineBlockEditButton.js +22 -0
- package/dist/features/blocks/client/componentInline/components/InlineBlockEditButton.js.map +1 -0
- package/dist/features/blocks/client/componentInline/components/InlineBlockLabel.d.ts +3 -0
- package/dist/features/blocks/client/componentInline/components/InlineBlockLabel.d.ts.map +1 -0
- package/dist/features/blocks/client/componentInline/components/InlineBlockLabel.js +22 -0
- package/dist/features/blocks/client/componentInline/components/InlineBlockLabel.js.map +1 -0
- package/dist/features/blocks/client/componentInline/components/InlineBlockRemoveButton.d.ts +3 -0
- package/dist/features/blocks/client/componentInline/components/InlineBlockRemoveButton.d.ts.map +1 -0
- package/dist/features/blocks/client/componentInline/components/InlineBlockRemoveButton.js +22 -0
- package/dist/features/blocks/client/componentInline/components/InlineBlockRemoveButton.js.map +1 -0
- package/dist/features/blocks/client/componentInline/index.d.ts +13 -1
- package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
- package/dist/features/blocks/client/componentInline/index.js +219 -43
- package/dist/features/blocks/client/componentInline/index.js.map +1 -1
- package/dist/features/blocks/client/index.d.ts.map +1 -1
- package/dist/features/blocks/client/index.js +7 -10
- package/dist/features/blocks/client/index.js.map +1 -1
- package/dist/features/blocks/client/nodes/BlocksNode.d.ts.map +1 -1
- package/dist/features/blocks/client/nodes/BlocksNode.js +1 -3
- package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
- package/dist/features/blocks/client/plugin/commands.d.ts +0 -4
- package/dist/features/blocks/client/plugin/commands.d.ts.map +1 -1
- package/dist/features/blocks/client/plugin/commands.js +0 -1
- package/dist/features/blocks/client/plugin/commands.js.map +1 -1
- package/dist/features/blocks/client/plugin/index.d.ts.map +1 -1
- package/dist/features/blocks/client/plugin/index.js +28 -135
- package/dist/features/blocks/client/plugin/index.js.map +1 -1
- package/dist/features/blocks/server/index.d.ts.map +1 -1
- package/dist/features/blocks/server/index.js +28 -2
- package/dist/features/blocks/server/index.js.map +1 -1
- package/dist/features/typesClient.d.ts +1 -17
- package/dist/features/typesClient.d.ts.map +1 -1
- package/dist/features/typesClient.js.map +1 -1
- package/dist/field/Field.d.ts.map +1 -1
- package/dist/field/Field.js +163 -78
- package/dist/field/Field.js.map +1 -1
- package/dist/field/bundled.css +1 -1
- package/dist/field/rscEntry.d.ts.map +1 -1
- package/dist/field/rscEntry.js +23 -1
- package/dist/field/rscEntry.js.map +1 -1
- package/dist/lexical/LexicalProvider.d.ts.map +1 -1
- package/dist/lexical/LexicalProvider.js +9 -18
- package/dist/lexical/LexicalProvider.js.map +1 -1
- package/dist/lexical/config/client/sanitize.d.ts.map +1 -1
- package/dist/lexical/config/client/sanitize.js +0 -12
- package/dist/lexical/config/client/sanitize.js.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utilities/buildInitialState.d.ts +27 -0
- package/dist/utilities/buildInitialState.d.ts.map +1 -0
- package/dist/utilities/buildInitialState.js +53 -0
- package/dist/utilities/buildInitialState.js.map +1 -0
- package/dist/utilities/fieldsDrawer/DrawerContent.d.ts.map +1 -1
- package/dist/utilities/fieldsDrawer/DrawerContent.js +8 -5
- package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
- package/dist/utilities/fieldsDrawer/useLexicalDrawer.d.ts.map +1 -1
- package/dist/utilities/fieldsDrawer/useLexicalDrawer.js +8 -8
- package/dist/utilities/fieldsDrawer/useLexicalDrawer.js.map +1 -1
- package/package.json +6 -6
- package/dist/exports/client/Field-GWJ72IYP.js +0 -2
- package/dist/exports/client/Field-GWJ72IYP.js.map +0 -7
- package/dist/exports/client/chunk-D7PD5DUW.js +0 -2
- package/dist/exports/client/chunk-D7PD5DUW.js.map +0 -7
- package/dist/exports/client/chunk-XDEGE6I5.js +0 -2
- package/dist/exports/client/chunk-XDEGE6I5.js.map +0 -7
- package/dist/exports/client/chunk-YGRKYSDC.js +0 -2
- package/dist/exports/client/chunk-YGRKYSDC.js.map +0 -7
- package/dist/exports/client/component-KLNTKKNE.js +0 -2
- package/dist/exports/client/component-KLNTKKNE.js.map +0 -7
- package/dist/exports/client/component-YICNYPTU.js +0 -2
- package/dist/exports/client/componentInline-6RPSMLNJ.js +0 -2
- package/dist/exports/client/componentInline-6RPSMLNJ.js.map +0 -7
- package/dist/features/blocks/client/component/FormSavePlugin.d.ts +0 -11
- package/dist/features/blocks/client/component/FormSavePlugin.d.ts.map +0 -1
- package/dist/features/blocks/client/component/FormSavePlugin.js +0 -53
- package/dist/features/blocks/client/component/FormSavePlugin.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use client";import{a as
|
|
1
|
+
"use client";import{a as _e,c as Qt,d as eo,e as to}from"./chunk-U7O7EYCP.js";import{a as je,b as mt,c as pt,d as ft}from"./chunk-XCEM47RI.js";import{a as Ue,b as We,c as Ve,d as oo}from"./chunk-MI5HS4QX.js";import{a as Ge,b as ht,c as Ke,d as ze,e as Ze,f as ro}from"./chunk-C7S3V4EB.js";import{a as be}from"./chunk-2CYU43GM.js";import{a as te,b as Vl,c as Kl,d as zl,f as Zl,h as Yl,i as Xl}from"./chunk-OOBB5GCO.js";import{a as Wl,b as B}from"./chunk-CUIBIFW2.js";function K(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{$isElementNode as Te,$isRangeSelection as Ct,FORMAT_ELEMENT_COMMAND as xt}from"lexical";import{jsx as no,jsxs as Jl}from"react/jsx-runtime";import"react";var sr=()=>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:[no("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),no("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),no("path",{d:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as io,jsxs as ql}from"react/jsx-runtime";import"react";var ar=()=>ql("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[io("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),io("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),io("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as lo,jsxs as Ql}from"react/jsx-runtime";import"react";var gt=()=>Ql("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[lo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),lo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),lo("path",{d:"M2.5 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as so,jsxs as es}from"react/jsx-runtime";import"react";var cr=()=>es("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[so("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),so("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),so("path",{d:"M7.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});var y=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 ur=t=>({type:"dropdown",ChildComponent:gt,items:t,key:"align",order:30});var dr=[ur([{ChildComponent:gt,isActive:({selection:t})=>{if(!Ct(t))return!1;for(let e of t.getNodes()){if(Te(e)&&e.getFormatType()==="left")continue;let o=e.getParent();if(!(Te(o)&&o.getFormatType()==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(xt,"left")},order:1},{ChildComponent:sr,isActive:({selection:t})=>{if(!Ct(t))return!1;for(let e of t.getNodes()){if(Te(e)&&e.getFormatType()==="center")continue;let o=e.getParent();if(!(Te(o)&&o.getFormatType()==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(xt,"center")},order:2},{ChildComponent:cr,isActive:({selection:t})=>{if(!Ct(t))return!1;for(let e of t.getNodes()){if(Te(e)&&e.getFormatType()==="right")continue;let o=e.getParent();if(!(Te(o)&&o.getFormatType()==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(xt,"right")},order:3},{ChildComponent:ar,isActive:({selection:t})=>{if(!Ct(t))return!1;for(let e of t.getNodes()){if(Te(e)&&e.getFormatType()==="justify")continue;let o=e.getParent();if(!(Te(o)&&o.getFormatType()==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(xt,"justify")},order:4}])],ts=y({toolbarFixed:{groups:dr},toolbarInline:{groups:dr}});import{$createQuoteNode as xr,$isQuoteNode as gr,QuoteNode as is}from"@lexical/rich-text";import{$setBlocksType as br}from"@lexical/selection";import{$getSelection as _r,$isRangeSelection as ls}from"lexical";import{jsx as mr}from"react/jsx-runtime";import"react";var ao=()=>mr("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:mr("path",{d:"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 pr}from"react/jsx-runtime";import"react";var Ye=()=>pr("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:pr("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 J=t=>({type:"dropdown",ChildComponent:Ye,items:t,key:"text",order:25});import{$createQuoteNode as os,$isQuoteNode as fr,QuoteNode as rs}from"@lexical/rich-text";import{$createLineBreakNode as ns}from"lexical";var hr={type:"element",dependencies:[rs],export:(t,e)=>{if(!fr(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(Zo(i)){i.splice(i.getChildrenSize(),0,[Fl(),...e]),i.select(0,0),t.remove();return}}let r=Dl();r.append(...e),t.replace(r),r.select(0,0)}};var Jo=[z([{ChildComponent:Vt,isActive:({selection:t})=>{if(!Pl(t))return!1;for(let e of t.getNodes())if(!Xo(e)&&!Xo(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=er();Qo(e,()=>qo())})},order:20}])],Hl=M({markdownTransformers:[Yo],nodes:[$l],slashMenu:{groups:[W([{Icon:Vt,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=er();Qo(e,()=>qo())})}}])]},toolbarFixed:{groups:Jo},toolbarInline:{groups:Jo}});import{getTranslation as lt}from"@payloadcms/translations";import{jsx as Kt,jsxs as Bl}from"react/jsx-runtime";import"react";var nt=()=>Bl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Kt("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),Kt("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),Kt("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as tr}from"react/jsx-runtime";import"react";var it=()=>tr("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:tr("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 Gl}from"react/jsx-runtime";import{useLexicalComposerContext as Ul}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Wl,$wrapNodeInElement as Vl,mergeRegister as Kl}from"@lexical/utils";import{getTranslation as zl}from"@payloadcms/translations";import{formatDrawerSlug as Zl,useEditDepth as Yl,useTranslation as Xl}from"@payloadcms/ui";import{$createParagraphNode as Jl,$getNodeByKey as ql,$getPreviousSelection as Ql,$getSelection as or,$insertNodes as es,$isParagraphNode as rr,$isRangeSelection as nr,$isRootOrShadowRoot as ts,COMMAND_PRIORITY_EDITOR as zt}from"lexical";import{useEffect as os,useState as Zt}from"react";var ir=()=>{let t=jl(27),[e]=Ul(),[o,n]=Zt(null),[r,i]=Zt(""),[l,s]=Zt(null),{i18n:a,t:c}=Xl(),{fieldProps:d}=H(),{featureClientSchemaMap:u,schemaPath:m}=d,{uuid:p}=H(),f=Yl(),h="lexical-inlineBlocks-create-"+p,C;t[0]!==h||t[1]!==f?(C=Zl({slug:h,depth:f}),t[0]=h,t[1]=f,t[2]=C):C=t[2];let L=C,{toggleDrawer:A}=xe(L,!0),D,x;if(t[3]!==e||t[4]!==l||t[5]!==A?(D=()=>{if(!e.hasNodes([Re]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return Kl(e.registerCommand(Se,I=>(e.update(()=>{let E=or()||Ql();if(nr(E)){let v=Dt(I);Wl(v);let{focus:y}=E,O=y.getNode();rr(O)&&O.getTextContentSize()===0&&O.getParentOrThrow().getChildren().filter(B=>rr(B)).length>1&&O.remove()}}),!0),zt),e.registerCommand(Ot,I=>{if(l){let v=ql(l);return!v||!Pt(v)?!1:(v.setFields(I),s(null),!0)}let E=$t(I);return es([E]),ts(E.getParentOrThrow())&&Vl(E,Jl).selectEnd(),!0},zt),e.registerCommand(ye,I=>{let{fields:E,nodeKey:v}=I;if(n(E??null),s(v??null),i(E?.blockType??""),v)return A(),!0;let y;return y=null,e.getEditorState().read(()=>{let O=or();nr(O)&&(y=O)}),y&&A(),!0},zt))},x=[e,l,A],t[3]=e,t[4]=l,t[5]=A,t[6]=D,t[7]=x):(D=t[6],x=t[7]),os(D,x),!o)return null;let T=`${m}.lexical_internal_feature.blocks.lexical_inline_blocks.${o?.blockType}`,N=u.blocks[T][0],R=N.blocks[0];if(!N)return null;let k;t[8]!==R||t[9]!==a?(k=R?.labels?.singular?zl(R?.labels?.singular,a):R?.slug,t[8]=R,t[9]=a,t[10]=k):k=t[10];let w=k,S=`lexical:blocks:inlineBlocks:${o?.id?"edit":"create"}`,g;t[11]!==w||t[12]!==c?(g=w??c("lexical:blocks:inlineBlocks:label"),t[11]=w,t[12]=c,t[13]=g):g=t[13];let _;if(t[14]!==g||t[15]!==c||t[16]!==S||t[17]!==R?.fields||t[18]!==r||t[19]!==e||t[20]!==o||t[21]!==L||t[22]!==m){let I;t[24]!==r||t[25]!==e?(I=(E,v)=>{v&&(v.blockType=r,e.dispatchCommand(Ot,v))},t[24]=r,t[25]=e,t[26]=I):I=t[26],_=Gl(ue,{data:o,drawerSlug:L,drawerTitle:c(S,{label:g}),featureKey:"blocks",fieldMapOverride:R?.fields,handleDrawerSubmit:I,schemaPath:m,schemaPathSuffix:`lexical_inline_blocks.${o?.blockType}.fields`}),t[14]=g,t[15]=c,t[16]=S,t[17]=R?.fields,t[18]=r,t[19]=e,t[20]=o,t[21]=L,t[22]=m,t[23]=_}else _=t[23];return _};var rs=M(({props:t})=>({nodes:[Re,Ft],plugins:[{Component:ir,position:"normal"}],sanitizedClientFeatureProps:t,slashMenu:{groups:[t.clientBlockSlugs?.length?{items:t.clientBlockSlugs.map(e=>({Icon:nt,key:"block-"+e,keywords:["block","blocks",e],label:({featureClientSchemaMap:o,i18n:n,schemaPath:r})=>{if(!o)return e;let i=`${r}.lexical_internal_feature.blocks.lexical_blocks.${e}`,a=o.blocks[i][0].blocks[0];return a?.labels?.singular?lt(a.labels.singular,n):a?.slug},onSelect:({editor:o})=>{o.dispatchCommand(Se,{blockName:"",blockType:e})}})),key:"blocks",label:({i18n:e})=>e.t("lexical:blocks:label")}:null,t.clientInlineBlockSlugs?.length?{items:t.clientInlineBlockSlugs.map(e=>({Icon:it,key:"inlineBlocks-"+e,keywords:["inlineBlock","inline block",e],label:({featureClientSchemaMap:o,i18n:n,schemaPath:r})=>{let i=`${r}.lexical_internal_feature.blocks.lexical_inline_blocks.${e}`,a=o.blocks[i][0].blocks[0];return a?.labels?.singular?lt(a.labels.singular,n):a?.slug},onSelect:({editor:o})=>{o.dispatchCommand(ye,{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:nt,items:t.clientBlockSlugs.map((e,o)=>({ChildComponent:nt,isActive:void 0,key:"block-"+e,label:({featureClientSchemaMap:n,i18n:r,schemaPath:i})=>{let l=`${i}.lexical_internal_feature.blocks.lexical_blocks.${e}`,c=n.blocks[l][0].blocks[0];return c?.labels?.singular?lt(c.labels.singular,r):c?.slug},onSelect:({editor:n})=>{n.dispatchCommand(Se,{blockName:"",blockType:e})},order:o})),key:"blocks",order:20}:null,t.clientInlineBlockSlugs?.length?{type:"dropdown",ChildComponent:it,items:t.clientInlineBlockSlugs.map((e,o)=>({ChildComponent:it,isActive:void 0,key:"inlineBlock-"+e,label:({featureClientSchemaMap:n,i18n:r,schemaPath:i})=>{if(!n)return e;let l=`${i}.lexical_internal_feature.blocks.lexical_inline_blocks.${e}`,c=n.blocks[l][0].blocks[0];return c?.labels?.singular?lt(c.labels.singular,r):c?.slug},onSelect:({editor:n})=>{n.dispatchCommand(ye,{fields:{blockType:e}})},order:o})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}));import{c as ls}from"react/compiler-runtime";import{jsx as me,jsxs as Jt}from"react/jsx-runtime";import{useLexicalComposerContext as ss}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as as,$createTextNode as cs,$getRoot as us}from"lexical";import*as ur from"react";import{useCallback as de,useEffect as Yt,useLayoutEffect as sr,useRef as Xt,useState as st}from"react";var ns=Y&&"documentMode"in document?document.documentMode:null,lr=Y&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),v1=Y&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),A1=Y&&"InputEvent"in window&&!ns?"getTargetRanges"in new window.InputEvent("input"):!1,D1=Y&&/Version\/[\d.].*Safari/.test(navigator.userAgent),O1=Y&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,F1=Y&&/Android/.test(navigator.userAgent),$1=Y&&/Win/.test(navigator.platform),is=Y&&/^(?=.*Chrome).*/i.test(navigator.userAgent),P1=Y&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!is;var ds=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)},ms=(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"keydown":return` await page.keyboard.keydown('${r}');`;case"keyup":return` await page.keyboard.keyup('${r}');`;case"press":return` await page.keyboard.press('${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(fr(i)){i.splice(i.getChildrenSize(),0,[ns(),...e]),i.select(0,0),t.remove();return}}let r=os();r.append(...e),t.replace(r),r.select(0,0)}};var Cr=[J([{ChildComponent:ao,isActive:({selection:t})=>{if(!ls(t))return!1;for(let e of t.getNodes())if(!gr(e)&&!gr(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=_r();br(e,()=>xr())})},order:20}])],ss=y({markdownTransformers:[hr],nodes:[is],slashMenu:{groups:[K([{Icon:ao,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=_r();br(e,()=>xr())})}}])]},toolbarFixed:{groups:Cr},toolbarInline:{groups:Cr}});import{getTranslation as Nt}from"@payloadcms/translations";import{jsx as co,jsxs as as}from"react/jsx-runtime";import"react";var bt=()=>as("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[co("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),co("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),co("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as Tr}from"react/jsx-runtime";import"react";var _t=()=>Tr("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:Tr("path",{clipRule:"evenodd",d:"M5.33333 6.5C5.11232 6.5 4.90036 6.5878 4.74408 6.74408C4.5878 6.90036 4.5 7.11232 4.5 7.33333V12.1667C4.5 12.3877 4.5878 12.5996 4.74408 12.7559C4.90036 12.9122 5.11232 13 5.33333 13H14.6667C14.8877 13 15.0996 12.9122 15.2559 12.7559C15.4122 12.5996 15.5 12.3877 15.5 12.1667V11.6667C15.5 11.3905 15.7239 11.1667 16 11.1667C16.2761 11.1667 16.5 11.3905 16.5 11.6667V12.1667C16.5 12.6529 16.3068 13.1192 15.963 13.463C15.6192 13.8068 15.1529 14 14.6667 14H5.33333C4.8471 14 4.38079 13.8068 4.03697 13.463C3.69315 13.1192 3.5 12.6529 3.5 12.1667V7.33333C3.5 6.8471 3.69315 6.38079 4.03697 6.03697C4.38079 5.69315 4.8471 5.5 5.33333 5.5H10.3333C10.6095 5.5 10.8333 5.72386 10.8333 6C10.8333 6.27614 10.6095 6.5 10.3333 6.5H5.33333ZM13 6.5C12.7239 6.5 12.5 6.27614 12.5 6C12.5 5.72386 12.7239 5.5 13 5.5H16C16.2761 5.5 16.5 5.72386 16.5 6V9C16.5 9.27614 16.2761 9.5 16 9.5C15.7239 9.5 15.5 9.27614 15.5 9V7.20711L13.3536 9.35355C13.1583 9.54882 12.8417 9.54882 12.6464 9.35355C12.4512 9.15829 12.4512 8.84171 12.6464 8.64645L14.7929 6.5H13ZM6.16699 8.33325C6.16699 8.05711 6.39085 7.83325 6.66699 7.83325H11.0003C11.2765 7.83325 11.5003 8.05711 11.5003 8.33325C11.5003 8.60939 11.2765 8.83325 11.0003 8.83325H6.66699C6.39085 8.83325 6.16699 8.60939 6.16699 8.33325ZM6.16699 10.9999C6.16699 10.7238 6.39085 10.4999 6.66699 10.4999H13.3337C13.6098 10.4999 13.8337 10.7238 13.8337 10.9999C13.8337 11.2761 13.6098 11.4999 13.3337 11.4999H6.66699C6.39085 11.4999 6.16699 11.2761 6.16699 10.9999Z",fill:"currentColor",fillRule:"evenodd"})});import{jsx as Bs}from"react/jsx-runtime";import Hs from"bson-objectid";import"react";import{DecoratorBlockNode as cs}from"@lexical/react/LexicalDecoratorBlockNode.js";import us from"bson-objectid";import{deepCopyObjectSimple as ds}from"payload/shared";var Xe=class extends cs{__fields;constructor({fields:e,format:o,key:n}){super(o,n),this.__fields=e}static clone(e){return new this({fields:e.__fields,format:e.__format,key:e.__key})}static getType(){return"block"}static importDOM(){return{}}static importJSON(e){e.version===1&&(e={...e,fields:{...e.fields.data},version:2});let o=ms(e.fields);return o.setFormat(e.format),o}static isInline(){return!1}decorate(e,o){return null}exportDOM(){let e=document.createElement("div"),o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),type:"block",fields:this.getFields(),version:2}}getFields(){return this.getLatest().__fields}getTextContent(){return"Block Field"}setFields(e){let o=ds(e),n=this.getWritable();n.__fields=o}};function ms(t){return new Xe({fields:{...t,id:t?.id||new us.default().toHexString()}})}import{jsx as z,jsxs as wt,Fragment as bs}from"react/jsx-runtime";import{Button as Nr,Collapsible as _s,Drawer as Ts,EditDepthProvider as ws,ErrorPill as Es,Form as ks,formatDrawerSlug as Ns,FormSubmit as Ls,Pill as Is,RenderFields as Ss,SectionTitle as Rs,useDocumentInfo as Lr,useEditDepth as ys,useFormSubmitted as vs,useServerFunctions as Ms,useTranslation as Ds}from"@payloadcms/ui";import{abortAndIgnore as uo}from"@payloadcms/ui/shared";import{deepCopyObjectSimpleWithoutReactComponents as As,reduceFieldsToValues as Ir}from"payload/shared";import mo,{useCallback as po,useEffect as Sr,useMemo as Je,useRef as Fs}from"react";import{useLexicalComposerContext as Os}from"@lexical/react/LexicalComposerContext";import{getTranslation as $s}from"@payloadcms/translations";import{$getNodeByKey as fo}from"lexical";import{v4 as Ps}from"uuid";import{c as ps}from"react/compiler-runtime";import{jsx as Tt,jsxs as fs}from"react/jsx-runtime";import{RenderFields as hs,useFormSubmitted as gs}from"@payloadcms/ui";import Cs,{createContext as xs}from"react";var wr=xs({initialState:!1}),Me=()=>Cs.useContext(wr),Er=t=>{let e=ps(13),{BlockDrawer:o,Collapsible:n,CustomBlock:r,EditButton:i,errorCount:l,formSchema:s,initialState:a,nodeKey:c,RemoveButton:d}=t,m=gs()&&l>0,p,f;e[0]!==n||e[1]!==l||e[2]!==m?(f=E=>Tt(n,{editButton:E.editButton,errorCount:l,fieldHasErrors:m,Label:E.Label,removeButton:E.removeButton,children:E.children}),e[0]=n,e[1]=l,e[2]=m,e[3]=f):f=e[3],p=f;let h=p,g;return e[4]!==r||e[5]!==h||e[6]!==i||e[7]!==a||e[8]!==c||e[9]!==d||e[10]!==o||e[11]!==s?(g=r?fs(wr.Provider,{value:{BlockCollapsible:h,EditButton:i,initialState:a,nodeKey:c,RemoveButton:d},children:[r,Tt(o,{})]}):Tt(h,{children:Tt(hs,{fields:s,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0})}),e[4]=r,e[5]=h,e[6]=i,e[7]=a,e[8]=c,e[9]=d,e[10]=o,e[11]=s,e[12]=g):g=e[12],g};function kr({fields:t}){for(let e in t){let o=t[e];Array.isArray(o.rows)&&"value"in o&&(o.disableFormData=!0)}return t}var re="lexical-block",Rr=t=>{let{formData:e,nodeKey:o}=t,n=vs(),{id:r,collectionSlug:i,globalSlug:l}=Lr(),{fieldProps:{featureClientSchemaMap:s,field:a,initialLexicalFormState:c,permissions:d,readOnly:u,schemaPath:m},uuid:p}=B(),f=Fs(new AbortController),h=ys(),[g,E]=mo.useState(0),D=Ns({slug:`lexical-blocks-create-${p}-${e.id}`,depth:h}),{toggleDrawer:A}=be(D,!0),{getDocPreferences:b,setDocFieldPreferences:T}=Lr(),[C]=Os(),{getFormState:k}=Ms(),S=`${m}.lexical_internal_feature.blocks.lexical_blocks.${e.blockType}.fields`,[w,N]=mo.useState(c?.[e.id]?.formState?{...c?.[e.id]?.formState,blockName:{initialValue:e.blockName,passesCondition:!0,valid:!0,value:e.blockName}}:!1);Sr(()=>{let W=new AbortController;return e&&!w&&(async()=>{let{state:Y}=await k({id:r,collectionSlug:i,data:e,docPermissions:{fields:!0},docPreferences:await b(),globalSlug:l,operation:"update",renderAllFields:!0,schemaPath:S,signal:W.signal});Y&&(Y.blockName={initialValue:e.blockName,passesCondition:!0,valid:!0,value:e.blockName},N(Y))})(),()=>{uo(W)}},[k,S,r,e,w,i,l,b]);let[I,x]=mo.useState(c?.[e.id]?.collapsed??!1),_=`${m}.lexical_internal_feature.blocks.lexical_blocks.${e.blockType}`,M=s.blocks[_][0].blocks[0],{i18n:v,t:F}=Ds(),H=po(async({formState:W,submit:ee})=>{uo(f.current);let Y=new AbortController;f.current=Y;let{state:X}=await k({id:r,collectionSlug:i,docPermissions:{fields:!0},docPreferences:await b(),formState:W,globalSlug:l,operation:"update",schemaPath:S,signal:Y.signal});if(!X)return W;X.blockName=W.blockName;let oe=Ir(kr({fields:As(X)}),!0);if(setTimeout(()=>{C.update(()=>{let xe=fo(o);if(xe&&Et(xe)){let ve={...oe,blockType:e.blockType};xe.setFields(ve)}})},0),ee){let xe=0;for(let ve of Object.values(X))ve?.valid===!1&&xe++;E(xe)}return X},[k,r,i,b,l,S,e.blockType,C,o]);Sr(()=>()=>{uo(f.current)},[]);let $=po(()=>{C.update(()=>{fo(o)?.remove()})},[C,o]),j=w?._components?.customComponents?.BlockLabel,Q=w?._components?.customComponents?.Block,U=M?.labels?.singular?$s(M.labels.singular,v):M?.slug,G=po(W=>{b().then(ee=>{let X=ee?.fields[a.name]?.collapsed,oe=X&&X?.length?X:[];W?oe.includes(e.id)||oe.push(e.id):oe.includes(e.id)&&oe.splice(oe.indexOf(e.id),1),T(a.name,{collapsed:oe,hello:"hi"})})},[b,a.name,T,e.id]),ae=Je(()=>()=>z(Nr,{buttonStyle:"icon-label",className:`${re}__editButton`,disabled:u,el:"div",icon:"edit",onClick:()=>{A()},round:!0,size:"small",tooltip:F("lexical:blocks:inlineBlocks:edit",{label:U})}),[U,u,F,A]),ye=Je(()=>()=>z(Nr,{buttonStyle:"icon-label",className:`${re}__removeButton`,disabled:a?.admin?.readOnly||!1,icon:"x",onClick:W=>{W.preventDefault(),$()},round:!0,tooltip:"Remove Block"}),[a?.admin?.readOnly,$]),Ce=Je(()=>({children:W,editButton:ee,errorCount:Y,fieldHasErrors:X,Label:oe,removeButton:xe})=>z("div",{className:re+" "+re+"-"+e.blockType,children:z(_s,{className:[`${re}__row`,X?`${re}__row--has-errors`:`${re}__row--no-errors`].join(" "),collapsibleStyle:X?"error":"default",header:wt("div",{className:`${re}__block-header`,children:[oe??j?oe??j:wt("div",{children:[z(Is,{className:`${re}__block-pill ${re}__block-pill-${e?.blockType}`,pillStyle:"white",children:U}),z(Rs,{path:"blockName",readOnly:a?.admin?.readOnly||!1}),X&&z(Es,{count:Y??0,i18n:v,withMessage:!0})]}),wt("div",{children:[Q&&ee!==!1||!Q&&ee?z(ae,{}):null,xe!==!1&&C.isEditable()?z(ye,{}):null]})]}),isCollapsed:I,onToggle:ve=>{G(ve),x(ve)},children:W},0)}),[Q,j,ae,ye,U,C,e.blockType,v,I,G,a?.admin?.readOnly]),dt=Je(()=>()=>z(ws,{children:z(Ts,{className:"",slug:D,title:F(`lexical:blocks:inlineBlocks:${e?.id?"edit":"create"}`,{label:U??F("lexical:blocks:inlineBlocks:label")}),children:w?wt(bs,{children:[z(Ss,{fields:M.fields,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:S,permissions:d,readOnly:!1}),z(Ls,{children:F("fields:saveChanges")})]}):null})}),[w,D,U,F,M.fields,S,d]);return Je(()=>w?z(ks,{beforeSubmit:[async({formState:W})=>await H({formState:W,submit:!0})],fields:M.fields,initialState:w,onChange:[H],onSubmit:W=>{let ee=Ir(W);ee.blockType=e.blockType,C.update(()=>{let Y=fo(o);Y&&Et(Y)&&Y.setFields(ee)}),A()},submitted:n,uuid:Ps(),children:z(Er,{baseClass:re,BlockDrawer:dt,Collapsible:Ce,CustomBlock:Q,EditButton:ae,errorCount:g,formSchema:M.fields,initialState:w,nodeKey:o,RemoveButton:ye})}):null,[Ce,dt,Q,ye,ae,C,g,A,M.fields,w,o,H,n])};var ce=class extends Xe{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){e.version===1&&(e={...e,fields:{...e.fields.data},version:2});let o=kt(e.fields);return o.setFormat(e.format),o}decorate(e,o){return Bs(Rr,{formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function kt(t){return new ce({fields:{...t,id:t?.id||new Hs.default().toHexString()}})}function Et(t){return t instanceof ce}import{createCommand as yr}from"lexical";var qe=yr("INSERT_BLOCK_COMMAND"),Qe=yr("INSERT_INLINE_BLOCK_COMMAND");import{c as js}from"react/compiler-runtime";import{useLexicalComposerContext as Gs}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Us,$wrapNodeInElement as Ws,mergeRegister as Vs}from"@lexical/utils";import{formatDrawerSlug as Ks,useEditDepth as zs}from"@payloadcms/ui";import{$createParagraphNode as Zs,$getNodeByKey as Ys,$getPreviousSelection as Xs,$getSelection as Js,$insertNodes as qs,$isParagraphNode as vr,$isRangeSelection as Qs,$isRootOrShadowRoot as ea,COMMAND_PRIORITY_EDITOR as Mr}from"lexical";import{useEffect as ta,useState as oa}from"react";var Dr=()=>{let t=js(10),[e]=Gs(),[o,n]=oa(null),{uuid:r}=B(),i=zs(),l="lexical-inlineBlocks-create-"+r,s;t[0]!==l||t[1]!==i?(s=Ks({slug:l,depth:i}),t[0]=l,t[1]=i,t[2]=s):s=t[2];let a=s,{toggleDrawer:c}=be(a,!0),d;t[3]!==e||t[4]!==o?(d=()=>{if(!e.hasNodes([ce]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return Vs(e.registerCommand(qe,m=>(e.update(()=>{let p=Js()||Xs();if(Qs(p)){let f=kt(m);Us(f);let{focus:h}=p,g=h.getNode();vr(g)&&g.getTextContentSize()===0&&g.getParentOrThrow().getChildren().filter(E=>vr(E)).length>1&&g.remove()}}),!0),Mr),e.registerCommand(Qe,m=>{if(o){let f=Ys(o);return!f||!to(f)?!1:(f.setFields(m),n(null),!0)}let p=eo(m);return qs([p]),ea(p.getParentOrThrow())&&Ws(p,Zs).selectEnd(),!0},Mr))},t[3]=e,t[4]=o,t[5]=d):d=t[5];let u;return t[6]!==e||t[7]!==o||t[8]!==c?(u=[e,o,c],t[6]=e,t[7]=o,t[8]=c,t[9]=u):u=t[9],ta(d,u),null};var ra=y(({props:t})=>({nodes:[ce,Qt],plugins:[{Component:Dr,position:"normal"}],sanitizedClientFeatureProps:t,slashMenu:{groups:[t.clientBlockSlugs?.length?{items:t.clientBlockSlugs.map(e=>({Icon:bt,key:"block-"+e,keywords:["block","blocks",e],label:({featureClientSchemaMap:o,i18n:n,schemaPath:r})=>{if(!o)return e;let i=`${r}.lexical_internal_feature.blocks.lexical_blocks.${e}`,a=o.blocks[i][0].blocks[0];return a?.labels?.singular?Nt(a.labels.singular,n):a?.slug},onSelect:({editor:o})=>{o.dispatchCommand(qe,{blockName:"",blockType:e})}})),key:"blocks",label:({i18n:e})=>e.t("lexical:blocks:label")}:null,t.clientInlineBlockSlugs?.length?{items:t.clientInlineBlockSlugs.map(e=>({Icon:_t,key:"inlineBlocks-"+e,keywords:["inlineBlock","inline block",e],label:({featureClientSchemaMap:o,i18n:n,schemaPath:r})=>{let i=`${r}.lexical_internal_feature.blocks.lexical_inline_blocks.${e}`,a=o.blocks[i][0].blocks[0];return a?.labels?.singular?Nt(a.labels.singular,n):a?.slug},onSelect:({editor:o})=>{o.dispatchCommand(Qe,{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:bt,items:t.clientBlockSlugs.map((e,o)=>({ChildComponent:bt,isActive:void 0,key:"block-"+e,label:({featureClientSchemaMap:n,i18n:r,schemaPath:i})=>{let l=`${i}.lexical_internal_feature.blocks.lexical_blocks.${e}`,c=n.blocks[l][0].blocks[0];return c?.labels?.singular?Nt(c.labels.singular,r):c?.slug},onSelect:({editor:n})=>{n.dispatchCommand(qe,{blockName:"",blockType:e})},order:o})),key:"blocks",order:20}:null,t.clientInlineBlockSlugs?.length?{type:"dropdown",ChildComponent:_t,items:t.clientInlineBlockSlugs.map((e,o)=>({ChildComponent:_t,isActive:void 0,key:"inlineBlock-"+e,label:({featureClientSchemaMap:n,i18n:r,schemaPath:i})=>{if(!n)return e;let l=`${i}.lexical_internal_feature.blocks.lexical_inline_blocks.${e}`,c=n.blocks[l][0].blocks[0];return c?.labels?.singular?Nt(c.labels.singular,r):c?.slug},onSelect:({editor:n})=>{n.dispatchCommand(Qe,{blockName:"",blockType:e})},order:o})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}));import{c as la}from"react/compiler-runtime";import{jsx as Ne,jsxs as Co}from"react/jsx-runtime";import{useLexicalComposerContext as sa}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as aa,$createTextNode as ca,$getRoot as ua}from"lexical";import*as Pr from"react";import{useCallback as ke,useEffect as ho,useLayoutEffect as Fr,useRef as go,useState as Lt}from"react";var na=te&&"documentMode"in document?document.documentMode:null,Ar=te&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),yg=te&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),vg=te&&"InputEvent"in window&&!na?"getTargetRanges"in new window.InputEvent("input"):!1,Mg=te&&/Version\/[\d.].*Safari/.test(navigator.userAgent),Dg=te&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Ag=te&&/Android/.test(navigator.userAgent),Fg=te&&/Win/.test(navigator.platform),ia=te&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Og=te&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!ia;var da=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)},ma=(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)},pa=t=>{let o=((n,r)=>{switch(n){case"click":return` await page.mouse.click(${r.x}, ${r.y});`;case"keydown":return` await page.keyboard.keydown('${r}');`;case"keyup":return` await page.keyboard.keyup('${r}');`;case"press":return` await page.keyboard.press('${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
|
`;case"type":return` await page.keyboard.type('${r}');`;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 fa(t){return t.key.toLowerCase()==="a"&&(Ar?t.metaKey:t.ctrlKey)}function ha(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 Or(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 $r=new Set(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Backspace","Delete","Enter","Escape"]);function ga(t){let[e,o]=Lt([]),[n,r]=Lt(!1),[,i]=Lt(""),[l,s]=Lt(""),a=go(null),c=go(!1),d=go(null),u=ke(()=>t,[t]),m=ke(()=>{let b=t.getRootElement(),T=window.getSelection();return b==null||T==null||T.anchorNode==null||T.focusNode==null||!b.contains(T.anchorNode)||!b.contains(T.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(pa).join(`
|
|
31
31
|
`)}
|
|
32
32
|
});
|
|
33
33
|
});
|
|
34
|
-
`},[t,e]),p=de((x,T)=>{o(b=>{let N=e.length-1,R=e[N];if(R&&R.name===x){if(x==="type")return[...e.slice(0,N),{...R,value:R.value+T}];if(R.value===T)return[...e.slice(0,N),{...R,count:R.count+1}]}return[...b,{name:x,count:1,value:T}]})},[e,o]);sr(()=>{let x=b=>{if(!n)return;let N=b.key;fs(b)?p("selectAll",""):cr.has(N)?p("press",b.key):[...N].length>1?p("keydown",b.key):p("type",b.key)},T=b=>{if(!n)return;let N=b.key;!cr.has(N)&&[...N].length>1&&p("keyup",b.key)};return t.registerRootListener((b,N)=>{N!==null&&(N.removeEventListener("keydown",x),N.removeEventListener("keyup",T)),b!==null&&(b.addEventListener("keydown",x),b.addEventListener("keyup",T))})},[t,n,p]),sr(()=>{d.current&&d.current.scrollTo(0,d.current.scrollHeight)},[m]),Yt(()=>{if(e){let x=m();x!==null&&s(x),d.current&&d.current.scrollTo(0,d.current.scrollHeight)}},[m,e]),Yt(()=>t.registerUpdateListener(({dirtyElements:T,dirtyLeaves:b,editorState:N})=>{if(!n)return;let R=N._selection,k=a.current,w=c.current;if(k!==R){if(b.size===0&&T.size===0&&!w){let g=window.getSelection();if(g&&(g.anchorNode==null||g.focusNode==null))return}a.current=R}c.current=!1;let S=m();S!==null&&s(S)}),[t,m,n,p]),Yt(()=>n?t.registerUpdateListener(()=>{let T=t.getRootElement();T!==null&&i(T?.innerHTML)}):void 0,[t,n]);let f=de(x=>{n||(x.update(()=>{let T=us();T.clear();let b=cs();T.append(as().append(b)),b.select()}),o([])),r(T=>!T)},[n]),h=de(()=>{if(!n)return;let x=window.getSelection();if(x===null||x.anchorNode==null||x.focusNode==null)return;let{anchorNode:T,anchorOffset:b,focusNode:N,focusOffset:R}=hs(x),k=u().getRootElement(),w;T!==null&&(w=ar(T,k));let S;N!==null&&(S=ar(N,k)),p("snapshot",{anchorNode:T,anchorOffset:b,anchorPath:w,focusNode:N,focusOffset:R,focusPath:S})},[p,n,u]),C=de(()=>{ds(m())},[m]),L=de(()=>{ms("test.js",m())},[m]);return[me("button",{className:`editor-dev-button ${n?"active":""}`,id:"test-recorder-button",onClick:x=>{f(u()),x.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:[me("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:x=>{h(),x.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),me("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:x=>{C(),x.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),me("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:x=>{L(),x.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),me("pre",{id:"test-recorder",ref:d,children:l})]}):null]}var dr=()=>{let t=ls(3),[e]=ss(),[o,n]=gs(e),r;return t[0]!==o||t[1]!==n?(r=Jt(ur.Fragment,{children:[me("p",{children:"HI"}),o,n,me("p",{children:"DONE"})]}),t[0]=o,t[1]=n,t[2]=r):r=t[2],r};var Cs=M({plugins:[{Component:dr,position:"bottom"}]});import{c as xs}from"react/compiler-runtime";import{jsx as bs}from"react/jsx-runtime";import{useLexicalComposerContext as _s}from"@lexical/react/LexicalComposerContext.js";import{TreeView as Ts}from"@lexical/react/LexicalTreeView.js";import"react";var mr=()=>{let t=xs(2),[e]=_s(),o;return t[0]!==e?(o=bs(Ts,{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 Es=M({plugins:[{Component:mr,position:"bottom"}]});import{$isTableSelection as ws}from"@lexical/table";import{$isRangeSelection as Ns,FORMAT_TEXT_COMMAND as ks}from"lexical";import{jsx as pr}from"react/jsx-runtime";import"react";var fr=()=>pr("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:pr("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 V=t=>({type:"buttons",items:t,key:"format",order:40});var hr={type:"text-format",format:["bold","italic"],tag:"***"},gr={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},Cr={type:"text-format",format:["bold"],tag:"**"},xr={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var br=[V([{ChildComponent:fr,isActive:({selection:t})=>Ns(t)||ws(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(ks,"bold")},order:1}])],Ls=M(({featureProviderMap:t})=>{let e=[Cr,xr];return t.get("italic")&&e.push(gr,hr),{markdownTransformers:e,toolbarFixed:{groups:br},toolbarInline:{groups:br}}});import{$isTableSelection as Rs}from"@lexical/table";import{$isRangeSelection as Ss,FORMAT_TEXT_COMMAND as ys}from"lexical";import{jsx as _r,jsxs as Is}from"react/jsx-runtime";import"react";var Tr=()=>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:[_r("path",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),_r("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var Er={type:"text-format",format:["code"],tag:"`"};var wr=[V([{ChildComponent:Tr,isActive:({selection:t})=>Ss(t)||Rs(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(ys,"code")},order:7}])],Ms=M({markdownTransformers:[Er],toolbarFixed:{groups:wr},toolbarInline:{groups:wr}});import{$isTableSelection as vs}from"@lexical/table";import{$isRangeSelection as As,FORMAT_TEXT_COMMAND as Ds}from"lexical";import{jsx as Nr}from"react/jsx-runtime";import"react";var kr=()=>Nr("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:Nr("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 Lr={type:"text-format",format:["italic"],tag:"*"},Ir={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var Rr=[V([{ChildComponent:kr,isActive:({selection:t})=>As(t)||vs(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(Ds,"italic")},order:2}])],Os=M({markdownTransformers:[Lr,Ir],toolbarFixed:{groups:Rr},toolbarInline:{groups:Rr}});import{$isTableSelection as $s}from"@lexical/table";import{$isRangeSelection as Ps,FORMAT_TEXT_COMMAND as Hs}from"lexical";import{jsx as Sr,jsxs as Fs}from"react/jsx-runtime";import"react";var yr=()=>Fs("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:[Sr("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"}),Sr("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var Mr={type:"text-format",format:["strikethrough"],tag:"~~"};var vr=[V([{ChildComponent:yr,isActive:({selection:t})=>Ps(t)||$s(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(Hs,"strikethrough")},order:4}])],Bs=M({markdownTransformers:[Mr],toolbarFixed:{groups:vr},toolbarInline:{groups:vr}});import{$isTableSelection as js}from"@lexical/table";import{$isRangeSelection as Gs,FORMAT_TEXT_COMMAND as Us}from"lexical";import{jsx as Ar}from"react/jsx-runtime";import"react";var Dr=()=>Ar("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Ar("path",{d:"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 Or=[V([{ChildComponent:Dr,isActive:({selection:t})=>Gs(t)||js(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(Us,"subscript")},order:5}])],Ws=M({toolbarFixed:{groups:Or},toolbarInline:{groups:Or}});import{$isTableSelection as Vs}from"@lexical/table";import{$isRangeSelection as Ks,FORMAT_TEXT_COMMAND as zs}from"lexical";import{jsx as Fr}from"react/jsx-runtime";import"react";var $r=()=>Fr("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:"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 Pr=[V([{ChildComponent:$r,isActive:({selection:t})=>Ks(t)||Vs(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(zs,"superscript")},order:6}])],Zs=M({toolbarFixed:{groups:Pr},toolbarInline:{groups:Pr}});import{$isTableSelection as Xs}from"@lexical/table";import{$isRangeSelection as Js,FORMAT_TEXT_COMMAND as qs}from"lexical";import{jsx as Hr,jsxs as Ys}from"react/jsx-runtime";import"react";var Br=()=>Ys("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:"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"}),Hr("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var jr=[V([{ChildComponent:Br,isActive:({selection:t})=>Js(t)||Xs(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(qs,"underline")},order:3}])],Qs=M({toolbarFixed:{groups:jr},toolbarInline:{groups:jr}});import{$createHeadingNode as ra,$isHeadingNode as tn,HeadingNode as na}from"@lexical/rich-text";import{$setBlocksType as ia}from"@lexical/selection";import{$getSelection as la,$isRangeSelection as sa}from"lexical";import{jsx as Gr}from"react/jsx-runtime";import"react";var Ur=()=>Gr("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:Gr("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 Wr}from"react/jsx-runtime";import"react";var Vr=()=>Wr("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:"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 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.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 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:"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 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:"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 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:"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 ea,$isHeadingNode as ta,HeadingNode as oa}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 en=t=>{let o=`^(${t.map(r=>Number(r.slice(1))).map(r=>`#{${r}}`).join("|")})\\s`,n=new RegExp(o);return{type:"element",dependencies:[oa],export:(r,i)=>{if(!ta(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 ea(i)})}};var on=t=>{let e=la();ia(e,()=>ra(t))},rn={h1:Ur,h2:Vr,h3:zr,h4:Yr,h5:Jr,h6:Qr},aa=M(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[z(e.map((n,r)=>({ChildComponent:rn[n],isActive:({selection:i})=>{if(!sa(i))return!1;for(let l of i.getNodes()){if(tn(l)&&l.getTag()===n)continue;let s=l.getParent();if(!(tn(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(()=>{on(n)})},order:r+2})))];return{markdownTransformers:[en(e)],nodes:[na],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[W(e.map(n=>({Icon:rn[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(()=>{on(n)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}});import{$isNodeSelection as Ca}from"lexical";import{jsx as nn}from"react/jsx-runtime";import"react";var Qt=()=>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("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as ln,jsxs as ca}from"react/jsx-runtime";import"react";var sn=()=>ca("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[ln("path",{d:"M5 10h10",stroke:"currentColor"}),ln("path",{d:"M10 15V5",stroke:"currentColor"})]});var ee=t=>({type:"dropdown",ChildComponent:sn,items:t,key:"add",order:10});var an={type:"element",dependencies:[Je],export:(t,e)=>Qe(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=qe();e&&t.replace(e)}};import{c as ua}from"react/compiler-runtime";import{useLexicalComposerContext as da}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as ma}from"@lexical/utils";import{$getSelection as pa,$isRangeSelection as fa,COMMAND_PRIORITY_EDITOR as ha}from"lexical";import{useEffect as ga}from"react";var cn=()=>{let t=ua(3),[e]=da(),o,n;return t[0]!==e?(o=()=>e.registerCommand(Me,r=>{let i=pa();if(!fa(i))return!1;if(i.focus.getNode()!==null){let s=qe();ma(s)}return!0},ha),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),ga(o,n),null};var xa=M({markdownTransformers:[an],nodes:[Je],plugins:[{Component:cn,position:"normal"}],slashMenu:{groups:[W([{Icon:Qt,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Me,void 0)}}])]},toolbarFixed:{groups:[ee([{ChildComponent:Qt,isActive:({selection:t})=>{if(!Ca(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Qe(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Me,void 0)}}])]}});import{INDENT_CONTENT_COMMAND as Ta,OUTDENT_CONTENT_COMMAND as Ea}from"lexical";import{jsx as at,jsxs as ba}from"react/jsx-runtime";import"react";var un=()=>ba("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[at("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),at("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),at("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),at("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as ct,jsxs as _a}from"react/jsx-runtime";import"react";var dn=()=>_a("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[ct("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),ct("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),ct("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),ct("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});var mn=t=>({type:"buttons",items:t,key:"indent",order:35});var pn=[mn([{ChildComponent:un,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(Ea,void 0)},order:1},{ChildComponent:dn,isActive:()=>!1,key:"indentIncrease",label:({i18n:t})=>t.t("lexical:indent:increaseLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Ta,void 0)},order:2}])],wa=M({toolbarFixed:{groups:pn},toolbarInline:{groups:pn}});import{$findMatchingParent as Dc}from"@lexical/utils";import{$getSelection as so,$isRangeSelection as Wn}from"lexical";import{jsx as fn}from"react/jsx-runtime";import"react";var hn=()=>fn("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:fn("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 gn}from"@lexical/selection";function be(t){let{anchor:e}=t,{focus:o}=t,n=t.anchor.getNode(),r=t.focus.getNode();return n===r?n:t.isBackward()?gn(o)?n:r:gn(e)?n:r}var eo=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as Da,$isTextNode as Oa}from"lexical";import{addClassNamesToElement as Na,isHTMLAnchorElement as ka}from"@lexical/utils";import ro from"bson-objectid";import{$applyNodeReplacement as La,$createTextNode as Cn,$getSelection as Ia,$isElementNode as xn,$isRangeSelection as oo,createCommand as Ra,ElementNode as Sa}from"lexical";var ya=new Set(["http:","https:","mailto:","sms:","tel:"]),Z=class t extends Sa{__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:Ma,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=te({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")),Na(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(xn(n)){let r=te({fields:this.__fields});return n.append(r),r}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!ya.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 Ma(t){let e=null;if(ka(t)){let o=t.textContent;o!==null&&o!==""&&(e=te({id:new ro.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function te({id:t,fields:e}){return La(new Z({id:t??new ro.default().toHexString(),fields:e}))}function U(t){return t instanceof Z}var J=Ra("TOGGLE_LINK_COMMAND");function bn(t){let e=Ia();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(U(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=U(i)?i:va(i);if(l!==null){l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append(Cn(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||xn(i)&&!i.isInline())){if(U(l)){r=l,l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append(Cn(t.text)),l.getChildren().forEach(s=>{s!==l.getLastChild()&&s.remove()}));return}if(l.is(n)||(n=l,r=te({fields:t.fields}),U(l)?i.getPreviousSibling()===null?l.insertBefore(r):l.insertAfter(r):i.insertBefore(r)),U(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 va(t){return Aa(t,e=>U(e))}function Aa(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 _n={type:"text-match",dependencies:[Z],export:(t,e,o)=>{if(!U(t))return null;let n=t,{url:r}=n.getFields(),i=`[${n.getTextContent()}](${r})`,l=n.getFirstChild();return n.getChildrenSize()===1&&Oa(l)?o(l,i):i},importRegExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:(t,e)=>{let[,o,n]=e,r=te({fields:{doc:null,linkType:"custom",newTab:!1,url:n}}),i=Da(o);i.setFormat(t.getFormat()),r.append(i),t.replace(r)},trigger:")"};import{$applyNodeReplacement as Fa,$isElementNode as $a}from"lexical";var oe=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=He({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($a(n)){let r=He({fields:this.__fields});return n.append(r),r}return null}};function He({fields:t}){return Fa(new oe({id:"",fields:t}))}function re(t){return t instanceof oe}import{c as Pa}from"react/compiler-runtime";import{useLexicalComposerContext as Ha}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Ba}from"@lexical/utils";import{$createTextNode as Tn,$getSelection as ja,$isElementNode as wn,$isLineBreakNode as Nn,$isNodeSelection as Ga,$isRangeSelection as Ua,$isTextNode as Be,TextNode as Wa}from"lexical";import{useEffect as Va}from"react";function En(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 kn(t,e){for(let o=0;o<e.length;o++){let n=e[o](t);if(n!=null)return n}return null}var Ka=/[.,;\s]/;function dt(t){return Ka.test(t)}function Ln(t){return dt(t[t.length-1])}function io(t){return dt(t[0])}function za(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function In(t){let e=t.getPreviousSibling();return wn(e)&&(e=e.getLastDescendant()),e===null||Nn(e)||Be(e)&&Ln(e.getTextContent())}function Rn(t){let e=t.getNextSibling();return wn(e)&&(e=e.getFirstDescendant()),e===null||Nn(e)||Be(e)&&io(e.getTextContent())}function Za(t,e,o,n){return(t>0?dt(o[t-1]):In(n[0]))?e<o.length?dt(o[e]):Rn(n[n.length-1]):!1}function Ya(t,e,o){let n=[],r=[],i=[],l=0,s=0,a=[...t];for(;a.length>0;){let c=a[0],u=c.getTextContent().length,m=s;s+u<=e?(n.push(c),l+=u):m>=o?i.push(c):r.push(c),s+=u,a.shift()}return[l,n,r,i]}function Xa(t,e,o,n){let r={linkType:"custom",url:n.url,...n.fields},i=He({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=Tn(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=[],d;for(let f=1;f<t.length;f++){let h=t[f],L=h.getTextContent().length,A=s,D=s+L;if(A<o)if(D<=o)c.push(h);else{let[x,T]=h.splitText(o-A);c.push(x),d=T}s+=L}let u=ja(),m=u?u.getNodes().find(Be):void 0,p=Tn(a.getTextContent());return p.setFormat(a.getFormat()),p.setDetail(a.getDetail()),p.setStyle(a.getStyle()),i.append(p,...c),m&&m===a&&(Ua(u)?p.select(u.anchor.offset,u.focus.offset):Ga(u)&&p.select(0,p.getTextContent().length)),a.replace(i),d}}function Ja(t,e,o){let n=[...t],r=n.map(a=>a.getTextContent()).join(""),i=r,l,s=0;for(;(l=kn(i,e))!=null&&l!==null;){let a=l.index,c=l.length,d=a+c;if(Za(s+a,s+d,r,n)){let[m,,p,f]=Ya(n,s+a,s+d),h=s+a-m,C=s+d-m,L=Xa(p,h,C,l);n=L?[L,...f]:f,o(l.url,null),s=0}else s+=d;i=i.substring(d)}}function no(t,e,o){let n=t.getChildren(),r=n.length;for(let a=0;a<r;a++){let c=n[a];if(!Be(c)||!c.isSimpleText()){ut(t),o(null,t.getFields()?.url??null);return}}let i=t.getTextContent(),l=kn(i,e);if(l===null||l.text!==i){ut(t),o(null,t.getFields()?.url??null);return}if(!In(t)||!Rn(t)){ut(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 qa(t,e,o){let n=t.getPreviousSibling(),r=t.getNextSibling(),i=t.getTextContent();if(re(n)){let l=n.getFields()?.url?n.getFields()?.url?.startsWith("mailto:"):!1;(!io(i)||za(i,l))&&(n.append(t),no(n,e,o),o(null,n.getFields()?.url??null))}re(r)&&!Ln(i)&&(ut(r),no(r,e,o),o(null,r.getFields()?.url??null))}function ut(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 Qa(t){let e=[t],o=t.getNextSibling();for(;o!==null&&Be(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function ec(t,e,o){let n=Pa(5),r,i;n[0]!==t||n[1]!==o||n[2]!==e?(r=()=>{if(!t.hasNodes([oe]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let l=(s,a)=>{o?.(s,a)};return Ba(t.registerNodeTransform(Wa,s=>{let a=s.getParentOrThrow(),c=s.getPreviousSibling();if(re(a))no(a,e,l);else if(!U(a)){if(s.isSimpleText()&&(io(s.getTextContent())||!re(c))){let d=Qa(s);Ja(d,e,l)}qa(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]),Va(r,i)}var tc=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,oc=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,rc=[En(tc,t=>t.startsWith("http")?t:`https://${t}`),En(oc,t=>`mailto:${t}`)],Sn=()=>{let[t]=Ha();return ec(t,rc),null};import{jsx as nc}from"react/jsx-runtime";import{ClickableLinkPlugin as ic}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var yn=()=>nc(ic,{});import{jsx as Ec}from"react/jsx-runtime";import"react";import{createPortal as wc}from"react-dom";import{jsx as ne,jsxs as je,Fragment as sc}from"react/jsx-runtime";import{useLexicalComposerContext as ac}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as Mn,mergeRegister as vn}from"@lexical/utils";import{getTranslation as lo}from"@payloadcms/translations";import{CloseMenuIcon as cc,EditIcon as uc,ExternalLinkIcon as An,formatDrawerSlug as dc,useConfig as mc,useEditDepth as pc,useLocale as fc,useTranslation as hc}from"@payloadcms/ui";import{requests as gc}from"@payloadcms/ui/shared";import{$getSelection as Dn,$isLineBreakNode as Cc,$isRangeSelection as On,COMMAND_PRIORITY_HIGH as xc,COMMAND_PRIORITY_LOW as Fn,KEY_ESCAPE_COMMAND as bc,SELECTION_CHANGE_COMMAND as _c}from"lexical";import $n,{useCallback as Pn,useEffect as ft,useRef as Tc,useState as pe}from"react";function mt(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,d=t.left-r;c<a.top&&(c+=l.height+t.height+n*2),d+l.width>a.right&&(d=a.right-l.width-r),c-=s.top,d-=s.left,e.style.opacity="1",e.style.transform=`translate(${d}px, ${c}px)`}import{createCommand as lc}from"lexical";var pt=lc("TOGGLE_LINK_WITH_MODAL_COMMAND");function Hn({anchorElem:t}){let[e]=ac(),[o,n]=pe(),r=Tc(null),[i,l]=pe(null),[s,a]=pe(null),{fieldProps:{schemaPath:c},uuid:d}=H(),{config:u}=mc(),{i18n:m,t:p}=hc(),[f,h]=pe(),C=pc(),[L,A]=pe(!1),[D,x]=pe([]),T=fc(),[b,N]=pe(!1),R=dc({slug:"lexical-rich-text-link-"+d,depth:C}),{toggleDrawer:k}=xe(R),w=Pn(()=>{A(!1),r&&r.current&&(r.current.style.opacity="0",r.current.style.transform="translate(-10000px, -10000px)"),N(!1),l(null),a(null),x([]),h(void 0)},[A,l,a,x]),S=Pn(()=>{let g=Dn(),_;if(!On(g)||!g){w();return}let I=be(g);_=e.getElementByKey(I.getKey())?.getBoundingClientRect();let E=Mn(I,U),v=g.getNodes().filter(K=>!Cc(K)).find(K=>{let j=Mn(K,U);return E&&!E.is(j)||j&&!j.is(E)});if(E==null||v){w();return}n(E);let y=E.getFields(),O={...y,id:E.getID(),text:E.getTextContent()};if(y?.linkType==="custom")l(y?.url??null),a(null);else{l(`${u.routes.admin==="/"?"":u.routes.admin}/collections/${y?.doc?.relationTo}/${y?.doc?.value}`);let K=u.collections.find(j=>j.slug===y?.doc?.relationTo);if(!K)a(y?.label?String(y?.label):null),l(y?.url?String(y?.url):null);else{let j=typeof y.doc?.value=="object"?y.doc.value.id:y.doc?.value,Xe=y.doc?.relationTo;if(!j||!Xe)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let gl=p("fields:linkedTo",{label:`${lo(K.labels.singular,m)} - ${p("lexical:link:loadingWithEllipsis",m)}`}).replace(/<[^>]*>?/g,"");a(gl),gc.get(`${u.serverURL}${u.routes.api}/${Xe}/${j}`,{headers:{"Accept-Language":m.language},params:{depth:0,locale:T?.code}}).then(async Ie=>{if(!Ie.ok)throw new Error(`HTTP error! Status: ${Ie.status}`);let Cl=await Ie.json(),xl=K?.admin?.useAsTitle||"id",bl=Cl[xl],_l=p("fields:linkedTo",{label:`${lo(K.labels.singular,m)} - ${bl}`}).replace(/<[^>]*>?/g,"");a(_l)}).catch(()=>{let Ie=p("fields:linkedTo",{label:`${lo(K.labels.singular,m)} - ${p("general:untitled",m)} - ID: ${j}`}).replace(/<[^>]*>?/g,"");a(Ie)})}}h(O),A(!0),x(g?g?.getNodes():[]),re(E)?N(!0):N(!1);let B=r.current,P=window.getSelection(),{activeElement:G}=document;if(B===null)return;let Ce=e.getRootElement();return P!==null&&Ce!==null&&Ce.contains(P.anchorNode)?(_||(_=P.getRangeAt(0).getBoundingClientRect()),_!=null&&(_.y+=40,mt(_,B,t))):(G==null||G.className!=="link-input")&&(Ce!==null&&mt(null,B,t),l(null),a(null)),!0},[e,w,u.routes.admin,u.routes.api,u.collections,u.serverURL,p,m,T?.code,t]);return ft(()=>vn(e.registerCommand(pt,g=>(e.dispatchCommand(J,g),S(),k(),!0),Fn)),[e,S,k,R]),ft(()=>{let g=t.parentElement,_=()=>{e.getEditorState().read(()=>{S()})};return window.addEventListener("resize",_),g?.addEventListener("scroll",_),()=>{window.removeEventListener("resize",_),g?.removeEventListener("scroll",_)}},[t.parentElement,e,S]),ft(()=>vn(e.registerUpdateListener(({editorState:g})=>{g.read(()=>{S()})}),e.registerCommand(_c,()=>(S(),!0),Fn),e.registerCommand(bc,()=>L?(w(),!0):!1,xc)),[e,S,L,w]),ft(()=>{e.getEditorState().read(()=>{S()})},[e,S]),je($n.Fragment,{children:[ne("div",{className:"link-editor",ref:r,children:je("div",{className:"link-input",children:[i&&i.length>0?je("a",{href:i,rel:"noopener noreferrer",target:"_blank",children:[o?.__fields.newTab?ne(An,{}):null,s!=null&&s.length>0?s:i]}):s!=null&&s.length>0?je(sc,{children:[o?.__fields.newTab?ne(An,{}):null,ne("span",{className:"link-input__label-pure",children:s})]}):null,e.isEditable()&&je($n.Fragment,{children:[ne("button",{"aria-label":"Edit link",className:"link-edit",onClick:()=>{k()},onMouseDown:g=>{g.preventDefault()},tabIndex:0,type:"button",children:ne(uc,{})}),!b&&ne("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(J,null)},onMouseDown:g=>{g.preventDefault()},tabIndex:0,type:"button",children:ne(cc,{})})]})]})}),ne(ue,{className:"lexical-link-edit-drawer",data:f,drawerSlug:R,drawerTitle:p("fields:editLink"),featureKey:"link",handleDrawerSubmit:(g,_)=>{let I=_,E={...I};delete E.text,e.update(()=>{let v=Dn(),y=null;if(On(v)?y=be(v).getParent():D.length&&(y=D[0].getParent()),y&&re(y)){let O=te({fields:E});y.replace(O,!0)}}),e.dispatchCommand(J,{fields:E,selectedNodes:D,text:I.text})},schemaPath:c,schemaPathSuffix:"fields"})]})}var Bn=t=>{let{anchorElem:e=document.body}=t;return wc(Ec(Hn,{anchorElem:e}),e)};import{c as Lc}from"react/compiler-runtime";import{useLexicalComposerContext as Ic}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Rc}from"@lexical/utils";import{$getSelection as Sc,$isElementNode as yc,$isRangeSelection as Mc,COMMAND_PRIORITY_LOW as Gn,PASTE_COMMAND as vc}from"lexical";import{useEffect as Ac}from"react";var Nc=/(?:[A-Za-z]{3,9}:(?:\/\/)?(?:[-;:&=+$,\w]+@)?[A-Za-z\d.-]+|(?:www.|[-;:&=+$,\w]+@)[A-Za-z\d.-]+)(?:\/[+~%/.\w-]*)?\??[-+=&;%@.\w]*#?\w*/,kc=/^[\w\-./]*(?:#\w[\w-]*)?$/;function jn(t){if(!t)return!1;if(t==="https://"||Nc.test(t)||kc.test(t))return!0;try{return new URL(t),!0}catch{}return!1}var Un=()=>{let t=Lc(3),[e]=Ic(),o,n;return t[0]!==e?(o=()=>{if(!e.hasNodes([Z]))throw new Error("LinkPlugin: LinkNode not registered on editor");return Rc(e.registerCommand(J,r=>(bn(r),!0),Gn),e.registerCommand(vc,r=>{let i=Sc();if(!Mc(i)||i.isCollapsed()||!(r instanceof ClipboardEvent)||r.clipboardData==null)return!1;let l=r.clipboardData.getData("text");if(!jn(l))return!1;if(!i.getNodes().some(s=>yc(s))){let s={doc:null,linkType:"custom",newTab:!1,url:l};return e.dispatchCommand(J,{fields:s,text:null}),r.preventDefault(),!0}return!1},Gn))},n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),Ac(o,n),null};var Vn=[eo([{ChildComponent:hn,isActive:({selection:t})=>{if(Wn(t)){let e=be(t);return Dc(e,U)!=null}return!1},isEnabled:({selection:t})=>!!(Wn(t)&&so()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(J,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(pt,{fields:r,selectedNodes:n,text:o})}},order:1}])],Oc=M({markdownTransformers:[_n],nodes:[Z,oe],plugins:[{Component:Un,position:"normal"},{Component:Sn,position:"normal"},{Component:yn,position:"normal"},{Component:Bn,position:"floatingAnchorElem"}],toolbarFixed:{groups:Vn},toolbarInline:{groups:Vn}});import{$isListNode as uo,INSERT_CHECK_LIST_COMMAND as Jn,ListItemNode as zc,ListNode as Zc}from"@lexical/list";import{$isRangeSelection as Yc}from"lexical";import{jsx as Kn,jsxs as Fc}from"react/jsx-runtime";import"react";var ao=()=>Fc("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:[Kn("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),Kn("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as $c}from"react/jsx-runtime";import{ListPlugin as Pc}from"@lexical/react/LexicalListPlugin.js";import"react";var _e=()=>$c(Pc,{});function Te(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as Gc,ListItemNode as Uc,ListNode as Wc}from"@lexical/list";import{$createListItemNode as Hc,$createListNode as Bc,$isListItemNode as jc,$isListNode as co}from"@lexical/list";var zn=4,Ee=t=>(e,o,n)=>{let r=e.getPreviousSibling(),i=e.getNextSibling(),l=Hc(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=Bc(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/zn);s&&l.setIndent(s)},fe=(t,e,o)=>{let n=[],r=t.getChildren(),i=0;for(let l of r)if(jc(l)){if(l.getChildrenSize()===1){let d=l.getFirstChild();if(co(d)){n.push(fe(d,e,o+1));continue}}let s=" ".repeat(o*zn),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 Zn={type:"element",dependencies:[Wc,Uc],export:(t,e)=>Gc(t)?fe(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:Ee("check")};import{jsx as Vc}from"react/jsx-runtime";import{CheckListPlugin as Kc}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var Yn=()=>Vc(Kc,{});var Xn=[z([{ChildComponent:ao,isActive:({selection:t})=>{if(!Yc(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(Jn,void 0)},order:12}])],Xc=M(({featureProviderMap:t})=>{let e=[{Component:Yn,position:"normal"}];return!t.has("unorderedList")&&!t.has("orderedList")&&e.push({Component:_e,position:"normal"}),{markdownTransformers:[Zn],nodes:t.has("unorderedList")||t.has("orderedList")?[]:[Zc,zc],plugins:e,slashMenu:{groups:[Te([{Icon:ao,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:o})=>o.t("lexical:checklist:label"),onSelect:({editor:o})=>{o.dispatchCommand(Jn,void 0)}}])]},toolbarFixed:{groups:Xn},toolbarInline:{groups:Xn}}});import{$isListNode as po,INSERT_ORDERED_LIST_COMMAND as ei,ListItemNode as tu,ListNode as ou}from"@lexical/list";import{$isRangeSelection as ru}from"lexical";import{jsx as Ge,jsxs as Jc}from"react/jsx-runtime";import"react";var mo=()=>Jc("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Ge("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"}),Ge("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"}),Ge("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),Ge("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),Ge("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as qc,ListItemNode as Qc,ListNode as eu}from"@lexical/list";var qn={type:"element",dependencies:[eu,Qc],export:(t,e)=>qc(t)?fe(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:Ee("number")};var Qn=[z([{ChildComponent:mo,isActive:({selection:t})=>{if(!ru(t))return!1;for(let e of t.getNodes()){if(po(e)&&e.getListType()==="number")continue;let o=e.getParent();if(po(o)&&o.getListType()==="number")continue;let n=o?.getParent();if(!(po(n)&&n.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(ei,void 0)},order:10}])],nu=M(({featureProviderMap:t})=>({markdownTransformers:[qn],nodes:t.has("orderedList")?[]:[ou,tu],plugins:t.has("orderedList")?[]:[{Component:_e,position:"normal"}],slashMenu:{groups:[Te([{Icon:mo,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:e})=>e.t("lexical:orderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(ei,void 0)}}])]},toolbarFixed:{groups:Qn},toolbarInline:{groups:Qn}}));import{$isListNode as ho,INSERT_UNORDERED_LIST_COMMAND as ri,ListItemNode as cu,ListNode as uu}from"@lexical/list";import{$isRangeSelection as du}from"lexical";import{jsx as we,jsxs as iu}from"react/jsx-runtime";import"react";var fo=()=>iu("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:[we("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),we("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),we("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),we("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),we("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),we("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as lu,ListItemNode as su,ListNode as au}from"@lexical/list";var ti={type:"element",dependencies:[au,su],export:(t,e)=>lu(t)?fe(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:Ee("bullet")};var oi=[z([{ChildComponent:fo,isActive:({selection:t})=>{if(!du(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(ri,void 0)},order:11}])],mu=M({markdownTransformers:[ti],nodes:[uu,cu],plugins:[{Component:_e,position:"normal"}],slashMenu:{groups:[Te([{Icon:fo,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(ri,void 0)}}])]},toolbarFixed:{groups:oi},toolbarInline:{groups:oi}});import{jsx as pu}from"react/jsx-runtime";import{addClassNamesToElement as fu}from"@lexical/utils";import{DecoratorNode as hu}from"lexical";import*as ni from"react";var gu=ni.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),Ue=class t extends hu{__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 fu(o,"unknownConverted"),o}decorate(){return pu(gu,{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 Ue({data:t})}var xu=M(()=>({nodes:[Ue]}));import{jsx as bu}from"react/jsx-runtime";import{addClassNamesToElement as _u}from"@lexical/utils";import{DecoratorNode as Tu}from"lexical";import*as ii from"react";var Eu=ii.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),We=class t extends Tu{__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 wu({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return _u(o,"unknownConverted"),o}decorate(){return bu(Eu,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function wu({data:t}){return new We({data:t})}var Nu=M(()=>({nodes:[We]}));import{$setBlocksType as ai}from"@lexical/selection";import{$createParagraphNode as ci,$getSelection as ui,$isParagraphNode as li,$isRangeSelection as ku}from"lexical";var si=[z([{ChildComponent:Pe,isActive:({selection:t})=>{if(!ku(t))return!1;for(let e of t.getNodes())if(!li(e)&&!li(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=ui();ai(e,()=>ci())})},order:1}])],Lu=M({slashMenu:{groups:[W([{Icon:Pe,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=ui();ai(e,()=>ci())})}}])]},toolbarFixed:{groups:si},toolbarInline:{groups:si}});import{$isNodeSelection as ed}from"lexical";import{jsx as Ve,jsxs as Iu}from"react/jsx-runtime";import"react";var go=()=>Iu("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:[Ve("g",{clipPath:"url(#clip0_4397_10817)",children:Ve("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"})}),Ve("defs",{children:Ve("clipPath",{id:"clip0_4397_10817",children:Ve("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{c as Gu}from"react/compiler-runtime";import{jsx as Uu}from"react/jsx-runtime";import{useLexicalComposerContext as Wu}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Vu}from"@lexical/utils";import{useConfig as Ku}from"@payloadcms/ui";import{$getPreviousSelection as zu,$getSelection as Zu,$isParagraphNode as gi,$isRangeSelection as Yu,COMMAND_PRIORITY_EDITOR as Xu,createCommand as Ju}from"lexical";import{useEffect as qu}from"react";import{c as $u}from"react/compiler-runtime";import{jsx as gt}from"react/jsx-runtime";import{useLexicalComposerContext as Pu}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as Hu,COMMAND_PRIORITY_EDITOR as Bu}from"lexical";import{useEffect as mi,useState as pi}from"react";import{c as Ru}from"react/compiler-runtime";import{jsx as Su}from"react/jsx-runtime";import{useLexicalComposerContext as yu}from"@lexical/react/LexicalComposerContext";import{useListDrawer as Mu,useModal as vu}from"@payloadcms/ui";import{$getPreviousSelection as Au,$getSelection as Du,$setSelection as Ou}from"lexical";import{useEffect as Fu,useState as di}from"react";var ht=t=>{let e=Ru(23),[o]=yu(),[n,r]=di(null),[i,l]=di(!1),[s,a,c]=Mu(t),{closeDrawer:d,drawerSlug:u,isDrawerOpen:m,openDrawer:p}=c,{modalState:f}=vu(),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let w=Du()??Au();r(w)},e[0]=h):h=e[0];let C=h,L;e[1]!==n||e[2]!==o?(L=()=>{n&&o.update(()=>{Ou(n.clone())},{discrete:!0,skipTransforms:!0})},e[1]=n,e[2]=o,e[3]=L):L=e[3];let A=L,D;e[4]!==d?(D=()=>{d()},e[4]=d,e[5]=D):D=e[5];let x=D,T,b;e[6]!==i||e[7]!==f||e[8]!==u||e[9]!==A?(T=()=>{if(!i)return;let w=f[u];w&&!w?.isOpen&&(l(!1),setTimeout(()=>{A()},1))},b=[f,u,A,i],e[6]=i,e[7]=f,e[8]=u,e[9]=A,e[10]=T,e[11]=b):(T=e[10],b=e[11]),Fu(T,b);let N;e[12]!==a?(N=w=>Su(a,{...w,onClick:()=>{C()}}),e[12]=a,e[13]=N):N=e[13];let R;e[14]!==p?(R=()=>{C(),p(),l(!0)},e[14]=p,e[15]=R):R=e[15];let k;return e[16]!==x||e[17]!==m||e[18]!==s||e[19]!==u||e[20]!==N||e[21]!==R?(k={closeListDrawer:x,isListDrawerOpen:m,ListDrawer:s,listDrawerSlug:u,ListDrawerToggler:N,openListDrawer:R},e[16]=x,e[17]=m,e[18]=s,e[19]=u,e[20]=N,e[21]=R,e[22]=k):k=e[22],k};var ju=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=Hu(o);r&&r.replace(De({relationTo:e,value:n}))}):t.dispatchCommand(Co,{relationTo:e,value:n})},fi=t=>{let e=$u(21),{enabledCollectionSlugs:o}=t,[n]=Pu(),r;e[0]!==o?(r=()=>o?.[0],e[0]=o,e[1]=r):r=e[1];let[i,l]=pi(r),[s,a]=pi(null),c=o||void 0,d;e[2]!==c||e[3]!==i?(d={collectionSlugs:c,selectedCollection:i},e[2]=c,e[3]=i,e[4]=d):d=e[4];let{closeListDrawer:u,isListDrawerOpen:m,ListDrawer:p,openListDrawer:f}=ht(d),h,C;e[5]!==n||e[6]!==f?(h=()=>n.registerCommand(ve,b=>(a(b?.replace?b?.replace.nodeKey:null),f(),!0),Bu),C=[n,f],e[5]=n,e[6]=f,e[7]=h,e[8]=C):(h=e[7],C=e[8]),mi(h,C);let L;e[9]!==n||e[10]!==s||e[11]!==u?(L=b=>{let{collectionSlug:N,docID:R}=b;ju({editor:n,relationTo:N,replaceNodeKey:s,value:R}),u()},e[9]=n,e[10]=s,e[11]=u,e[12]=L):L=e[12];let A=L,D;e[13]!==o?(D=()=>{l(o?.[0])},e[13]=o,e[14]=D):D=e[14];let x;e[15]!==m||e[16]!==o?(x=[m,o],e[15]=m,e[16]=o,e[17]=x):x=e[17],mi(D,x);let T;return e[18]!==A||e[19]!==p?(T=gt(p,{onSelect:A}),e[18]=A,e[19]=p,e[20]=T):T=e[20],T},hi=t=>(t?.enabledCollectionSlugs?.length??-1)>0?gt(fi,{...t}):gt(et,{...t,children:gt(fi,{...t})});var Co=Ju("INSERT_RELATIONSHIP_COMMAND"),Ci=t=>{let e=Gu(10),{clientProps:o}=t,[n]=Wu(),{config:r}=Ku(),{collections:i}=r,l=null;if(o?.enabledCollections)l=o?.enabledCollections;else if(o?.disabledCollections){let d;if(e[0]!==o||e[1]!==i){let u;e[3]!==o?(u=m=>{let{slug:p}=m;return!o?.disabledCollections?.includes(p)},e[3]=o,e[4]=u):u=e[4],d=i.filter(u).map(Qu),e[0]=o,e[1]=i,e[2]=d}else d=e[2];l=d}let s,a;e[5]!==n?(s=()=>{if(!n.hasNodes([Ae]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return n.registerCommand(Co,d=>{let u=Zu()||zu();if(Yu(u)){let m=De(d);Vu(m);let{focus:p}=u,f=p.getNode();gi(f)&&f.getTextContentSize()===0&&f.getParentOrThrow().getChildren().filter(h=>gi(h)).length>1&&f.remove()}return!0},Xu)},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=Uu(hi,{enabledCollectionSlugs:l}),e[8]=l,e[9]=c):c=e[9],c};function Qu(t){let{slug:e}=t;return e}var td=M({nodes:[Ae],plugins:[{Component:Ci,position:"normal"}],slashMenu:{groups:[W([{Icon:go,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(ve,{replace:!1})}}])]},toolbarFixed:{groups:[ee([{ChildComponent:go,isActive:({selection:t})=>{if(!ed(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(ve,{replace:!1})}}])]}});import{c as Ni}from"react/compiler-runtime";import{jsx as X,jsxs as hd}from"react/jsx-runtime";import{useLexicalComposerContext as gd}from"@lexical/react/LexicalComposerContext.js";import{useScrollInfo as Cd,useThrottledEffect as xd,useTranslation as bd}from"@payloadcms/ui";import*as ie from"react";import{useMemo as _d}from"react";import{jsx as od}from"react/jsx-runtime";import{mergeRegister as rd}from"@lexical/utils";import{$getSelection as nd}from"lexical";import{useCallback as id,useEffect as Ct,useState as xo}from"react";var bo="toolbar-popup__button",Ke=({children:t,editor:e,item:o})=>{let[n,r]=xo(!0),[i,l]=xo(!1),[s,a]=xo(bo),c=H(),d=id(()=>{e.getEditorState().read(()=>{let u=nd();if(u){if(o.isActive){let m=o.isActive({editor:e,editorConfigContext:c,selection:u});i!==m&&l(m)}if(o.isEnabled){let m=o.isEnabled({editor:e,editorConfigContext:c,selection:u});n!==m&&r(m)}}})},[i,e,c,n,o]);return Ct(()=>{d()},[d]),Ct(()=>(document.addEventListener("mouseup",d),()=>{document.removeEventListener("mouseup",d)}),[d]),Ct(()=>rd(e.registerUpdateListener(()=>{d()})),[e,d]),Ct(()=>{a([bo,n===!1?"disabled":"",i?"active":"",o?.key?`${bo}-`+o.key:""].filter(Boolean).join(" "))},[n,i,s,o.key]),od("button",{className:s,onClick:()=>{if(n!==!1)return e._updateTags=new Set(["toolbar",...e._updateTags]),e.focus(()=>{o.onSelect?.({editor:e,isActive:i})}),!0},onMouseDown:u=>{u.preventDefault()},type:"button",children:t})};import{c as wi}from"react/compiler-runtime";import{jsx as Ne}from"react/jsx-runtime";import Eo,{useEffect as Ei}from"react";import{mergeRegister as dd}from"@lexical/utils";import{useTranslation as md}from"@payloadcms/ui";import{$getSelection as pd}from"lexical";import{jsx as ae,jsxs as xi}from"react/jsx-runtime";import{Button as ld}from"@payloadcms/ui";import xt,{useCallback as sd,useEffect as ze,useMemo as ad,useRef as To,useState as bt}from"react";import{createPortal as cd}from"react-dom";var _o="toolbar-popup__dropdown-item",bi=xt.createContext(null);function _i({active:t,children:e,editor:o,enabled:n,Icon:r,item:i,tooltip:l}){let[s,a]=bt(_o);ze(()=>{a([_o,n===!1?"disabled":"",t?"active":"",i?.key?`${_o}-${i.key}`:""].filter(Boolean).join(" "))},[n,t,s,i.key]);let c=To(null),d=xt.useContext(bi);if(d===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:u}=d;return ze(()=>{c?.current!=null&&u(c)},[c,u]),ae(ld,{"aria-label":l,buttonStyle:"none",className:s,disabled:n===!1,icon:r,iconPosition:"left",iconStyle:"none",onClick:()=>{n!==!1&&(o._updateTags=new Set(["toolbar",...o._updateTags]),o.focus(()=>{i.onSelect?.({editor:o,isActive:t})}))},onMouseDown:m=>{m.preventDefault()},ref:c,tooltip:l,type:"button",children:e})}function ud({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:n}){let[r,i]=bt(),[l,s]=bt(),a=sd(u=>{i(m=>m!=null?[...m,u]:[u])},[i]),c=u=>{if(r==null)return;let{key:m}=u;["ArrowDown","ArrowUp","Escape","Tab"].includes(m)&&u.preventDefault(),m==="Escape"||m==="Tab"?n():m==="ArrowUp"?s(p=>{if(p==null)return r[0];let f=r.indexOf(p)-1;return r[f===-1?r.length-1:f]}):m==="ArrowDown"&&s(p=>p==null?r[0]:r[r.indexOf(p)+1])},d=ad(()=>({registerItem:a}),[a]);return ze(()=>{r!=null&&l==null&&s(r[0]),l!=null&&l?.current!=null&&l.current.focus()},[r,l]),ae(bi.Provider,{value:d,children:ae("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:c,ref:e,children:t})})}function Ti({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:n=!1,Icon:r,itemsContainerClassNames:i,label:l,stopCloseOnClickSelf:s}){let a=To(null),c=To(null),[d,u]=bt(!1),m=()=>{u(!1),c?.current!=null&&c.current.focus()};ze(()=>{let f=c.current,h=a.current;if(d&&f!==null&&h!==null){let{left:C,top:L}=f.getBoundingClientRect(),A=window.scrollY||document.documentElement.scrollTop;h.style.top=`${L+A+f.offsetHeight+5}px`,h.style.left=`${Math.min(C-5,window.innerWidth-h.offsetWidth-20)}px`}},[a,c,d]),ze(()=>{let f=c.current;if(f!==null&&d){let h=C=>{let{target:L}=C;s!=null&&a.current!=null&&a.current.contains(L)||f.contains(L)||u(!1)};return document.addEventListener("click",h),()=>{document.removeEventListener("click",h)}}},[a,c,d,s]);let p=cd(ae(ud,{dropDownRef:a,itemsContainerClassNames:i,onClose:m,children:o}),document.body);return xi(xt.Fragment,{children:[xi("button",{"aria-label":t,className:e+(d?" active":""),disabled:n,onClick:f=>{f.preventDefault(),u(!d)},onMouseDown:f=>{f.preventDefault()},ref:c,type:"button",children:[r&&ae(r,{}),l&&ae("span",{className:"toolbar-popup__dropdown-label",children:l}),ae("i",{className:"toolbar-popup__dropdown-caret"})]}),d&&ae(xt.Fragment,{children:p})]})}var wo="toolbar-popup__dropdown",fd=t=>{let e=wi(18),{active:o,anchorElem:n,editor:r,enabled:i,item:l}=t,{i18n:s}=md(),{fieldProps:a}=H(),{featureClientSchemaMap:c,schemaPath:d}=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&&Ne(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,m;if(l.label){let f;e[6]!==l||e[7]!==c||e[8]!==s||e[9]!==d?(f=typeof l.label=="function"?l.label({featureClientSchemaMap:c,i18n:s,schemaPath:d}):l.label,e[6]=l,e[7]=c,e[8]=s,e[9]=d,e[10]=f):f=e[10],u=f}u.length>25?m=u.substring(0,25)+"...":m=u;let p;return e[11]!==l||e[12]!==m||e[13]!==o||e[14]!==r||e[15]!==i||e[16]!==u?(p=Ne(_i,{active:o,editor:r,enabled:i,Icon:l?.ChildComponent?Ne(l.ChildComponent,{}):void 0,item:l,tooltip:u,children:Ne("span",{className:"text",children:m})},l.key),e[11]=l,e[12]=m,e[13]=o,e[14]=r,e[15]=i,e[16]=u,e[17]=p):p=e[17],p},he=t=>{let e=wi(42),{anchorElem:o,classNames:n,editor:r,group:i,Icon:l,itemsContainerClassNames:s,label:a,maxActiveItems:c,onActiveChange:d}=t,u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=[],e[0]=u):u=e[0];let[m,p]=Eo.useState(u),f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f=[],e[1]=f):f=e[1];let[h,C]=Eo.useState(f),[L,A]=Eo.useState(!0),D=H(),{items:x,key:T}=i,b;e[2]!==r||e[3]!==x||e[4]!==c||e[5]!==D||e[6]!==i||e[7]!==d?(b=()=>{r.getEditorState().read(()=>{let P=pd();if(!P)return;let G=[],Ce=[],K=[];for(let j of x)j.isActive&&(!c||G.length<c)&&j.isActive({editor:r,editorConfigContext:D,selection:P})&&(G.push(j.key),Ce.push(j)),j.isEnabled?j.isEnabled({editor:r,editorConfigContext:D,selection:P})&&K.push(j.key):K.push(j.key);i.isEnabled&&A(i.isEnabled({editor:r,editorConfigContext:D,selection:P})),p(G),C(K),d&&d({activeItems:Ce})})},e[2]=r,e[3]=x,e[4]=c,e[5]=D,e[6]=i,e[7]=d,e[8]=b):b=e[8];let N=b,R,k;e[9]!==N?(R=()=>{N()},k=[N],e[9]=N,e[10]=R,e[11]=k):(R=e[10],k=e[11]),Ei(R,k);let w,S;e[12]!==r||e[13]!==N?(w=()=>dd(r.registerUpdateListener(()=>{N()})),S=[r,N],e[12]=r,e[13]=N,e[14]=w,e[15]=S):(w=e[14],S=e[15]),Ei(w,S);let g=`${T} dropdown`,_=`${wo}-${T}`,I;e[16]!==n?(I=n||[],e[16]=n,e[17]=I):I=e[17];let E;e[18]!==_||e[19]!==I?(E=[wo,_,...I].filter(Boolean),e[18]=_,e[19]=I,e[20]=E):E=e[20];let v=E.join(" "),y=!L,O;e[21]!==s?(O=s||[],e[21]=s,e[22]=O):O=e[22];let B;if(e[23]!==O||e[24]!==x||e[25]!==m||e[26]!==o||e[27]!==r||e[28]!==h||e[29]!==g||e[30]!==v||e[31]!==y||e[32]!==l||e[33]!==a||e[34]!==T){let P;e[36]!==x||e[37]!==m||e[38]!==o||e[39]!==r||e[40]!==h?(P=x.length&&x.map(G=>Ne(fd,{active:m.includes(G.key),anchorElem:o,editor:r,enabled:h.includes(G.key),item:G},G.key)),e[36]=x,e[37]=m,e[38]=o,e[39]=r,e[40]=h,e[41]=P):P=e[41],B=Ne(Ti,{buttonAriaLabel:g,buttonClassName:v,disabled:y,Icon:l,itemsContainerClassNames:[`${wo}-items`,...O],label:a,children:P},T),e[23]=O,e[24]=x,e[25]=m,e[26]=o,e[27]=r,e[28]=h,e[29]=g,e[30]=v,e[31]=y,e[32]=l,e[33]=a,e[34]=T,e[35]=B}else B=e[35];return B};function Td({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(Ke,{editor:e,item:o,children:X(o.ChildComponent,{})},o.key):null}function Ed(t){let e=Ni(26),{anchorElem:o,editor:n,editorConfig:r,group:i,index:l}=t,{i18n:s}=bd(),{fieldProps:a}=H(),{featureClientSchemaMap:c,schemaPath:d}=a,[u,m]=ie.useState(void 0),[p,f]=ie.useState(void 0),h,C;e[0]!==i?(h=()=>{i?.type==="dropdown"&&i.items.length&&i.ChildComponent?f(()=>i.ChildComponent):f(void 0)},C=[i],e[0]=i,e[1]=h,e[2]=C):(h=e[1],C=e[2]),ie.useEffect(h,C);let L;e[3]!==i||e[4]!==c||e[5]!==s||e[6]!==d?(L=N=>{let{activeItems:R}=N;if(!R.length){i?.type==="dropdown"&&i.items.length&&i.ChildComponent?(f(()=>i.ChildComponent),m(void 0)):(f(void 0),m(void 0));return}let k=R[0],w=k.key;k.label&&(w=typeof k.label=="function"?k.label({featureClientSchemaMap:c,i18n:s,schemaPath:d}):k.label),w.length>25&&(w=w.substring(0,25)+"..."),m(w),f(()=>k.ChildComponent)},e[3]=i,e[4]=c,e[5]=s,e[6]=d,e[7]=L):L=e[7];let A=L,D=`fixed-toolbar__group fixed-toolbar__group-${i.key}`,x;e[8]!==i||e[9]!==p||e[10]!==o||e[11]!==n||e[12]!==u||e[13]!==A?(x=i.type==="dropdown"&&i.items.length&&(p?X(he,{anchorElem:o,editor:n,group:i,Icon:p,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:u,maxActiveItems:1,onActiveChange:A}):X(he,{anchorElem:o,editor:n,group:i,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:u,maxActiveItems:1,onActiveChange:A})),e[8]=i,e[9]=p,e[10]=o,e[11]=n,e[12]=u,e[13]=A,e[14]=x):x=e[14];let T;e[15]!==i||e[16]!==o||e[17]!==n?(T=i.type==="buttons"&&i.items.length&&i.items.map(N=>X(Td,{anchorElem:o,editor:n,item:N},N.key)),e[15]=i,e[16]=o,e[17]=n,e[18]=T):T=e[18];let b;return e[19]!==r.features.toolbarFixed||e[20]!==l||e[21]!==x||e[22]!==T||e[23]!==D||e[24]!==i.key?(b=hd("div",{className:D,children:[x,T,l<r.features.toolbarFixed?.groups.length-1&&X("div",{className:"divider"})]},i.key),e[19]=r.features.toolbarFixed,e[20]=l,e[21]=x,e[22]=T,e[23]=D,e[24]=i.key,e[25]=b):b=e[25],b}function wd({anchorElem:t,clientProps:e,editor:o,editorConfig:n,parentWithFixedToolbar:r}){let i=ie.useRef(null),{y:l}=Cd(),s=_d(()=>{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 xd(()=>{if(!s)return;let a=i.current;if(!a)return;let c=a.getBoundingClientRect(),d=s.getBoundingClientRect();if(!(c.bottom<d.top||c.top>d.bottom))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]),X("div",{className:"fixed-toolbar",onFocus:a=>{a.stopPropagation()},ref:i,children:o.isEditable()&&X(ie.Fragment,{children:n?.features&&n.features?.toolbarFixed?.groups.map((a,c)=>X(Ed,{anchorElem:t,editor:o,editorConfig:n,group:a,index:c},a.key))})})}var ki=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return ki(t.parentEditor)}return!1},Li=t=>{let e=Ni(7),{anchorElem:o,clientProps:n}=t,[r]=gd(),i=H(),{editorConfig:l}=i,s=n.applyToFocusedEditor&&i.focusedEditor?.editor||r,a=n.applyToFocusedEditor&&i.focusedEditor?.editorConfig||l,c,d;if(e[0]!==i||e[1]!==n?.disableIfParentHasFixedToolbar||e[2]!==a||e[3]!==o||e[4]!==s){d=Symbol.for("react.early_return_sentinel");e:{let u=ki(i);if(n?.disableIfParentHasFixedToolbar&&u){d=null;break e}if(!a?.features?.toolbarFixed?.groups?.length){d=null;break e}c=X(wd,{anchorElem:o,editor:s,editorConfig:a,parentWithFixedToolbar:u})}e[0]=i,e[1]=n?.disableIfParentHasFixedToolbar,e[2]=a,e[3]=o,e[4]=s,e[5]=c,e[6]=d}else c=e[5],d=e[6];return d!==Symbol.for("react.early_return_sentinel")?d:c};var Nd=M({plugins:[{Component:Li,position:"aboveContainer"}]});import{c as Si}from"react/compiler-runtime";import{jsx as q,jsxs as yi}from"react/jsx-runtime";import{useLexicalComposerContext as kd}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Mi}from"@lexical/utils";import{$getSelection as vi,$isRangeSelection as Ii,$isTextNode as Ld,COMMAND_PRIORITY_LOW as Id,SELECTION_CHANGE_COMMAND as Rd}from"lexical";import{useCallback as Tt,useEffect as Ze,useRef as Ri,useState as Sd}from"react";import*as Et from"react";import{createPortal as yd}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 _t(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,d=o.parentElement;if(a===null||d==null){r.style.opacity="0",r.style.transform="translate(-10000px, -10000px)";return}let u=r.getBoundingClientRect(),m=o.getBoundingClientRect(),p=d.getBoundingClientRect(),f=a.top-u.height-c,h=a.left-i;l==="center"&&(h=a.left+a.width/2-u.width/2);let C=0;return!e&&f<p.top&&!s&&(C=u.height+a.height+c*2,f+=C),l==="center"?h+u.width>p.right?h=p.right-u.width-i:h<p.left&&(h=p.left+i):h+u.width>p.right&&(h=p.right-u.width-i),h-=m.left,r.style.opacity="1",s&&n!==0?(f-=m.bottom-n+u.height-3,r.style.transform=`translate(${h}px, ${f}px) rotate(180deg)`):(f-=m.top,r.style.transform=`translate(${h}px, ${f}px)`),C}function Md({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&q(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?q(Ke,{editor:e,item:o,children:q(o.ChildComponent,{})},o.key):null}function vd(t){let e=Si(22),{anchorElem:o,editor:n,group:r,index:i}=t,{editorConfig:l}=H(),[s,a]=Et.useState(),c,d;e[0]!==r?(c=()=>{r?.type==="dropdown"&&r.items.length&&r.ChildComponent?a(()=>r.ChildComponent):a(void 0)},d=[r],e[0]=r,e[1]=c,e[2]=d):(c=e[1],d=e[2]),Et.useEffect(c,d);let u;e[3]!==r?(u=L=>{let{activeItems:A}=L;if(!A.length){r?.type==="dropdown"&&r.items.length&&r.ChildComponent?a(()=>r.ChildComponent):a(void 0);return}let D=A[0];a(()=>D.ChildComponent)},e[3]=r,e[4]=u):u=e[4];let m=u,p=`inline-toolbar-popup__group inline-toolbar-popup__group-${r.key}`,f;e[5]!==r||e[6]!==s||e[7]!==o||e[8]!==n||e[9]!==m?(f=r.type==="dropdown"&&r.items.length&&(s?q(he,{anchorElem:o,editor:n,group:r,Icon:s,maxActiveItems:1,onActiveChange:m}):q(he,{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]=f):f=e[10];let h;e[11]!==r||e[12]!==o||e[13]!==n?(h=r.type==="buttons"&&r.items.length&&r.items.map(L=>q(Md,{anchorElem:o,editor:n,item:L},L.key)),e[11]=r,e[12]=o,e[13]=n,e[14]=h):h=e[14];let C;return e[15]!==l.features.toolbarInline||e[16]!==i||e[17]!==f||e[18]!==h||e[19]!==p||e[20]!==r.key?(C=yi("div",{className:p,children:[f,h,i<l.features.toolbarInline?.groups.length-1&&q("div",{className:"divider"})]},r.key),e[15]=l.features.toolbarInline,e[16]=i,e[17]=f,e[18]=h,e[19]=p,e[20]=r.key,e[21]=C):C=e[21],C}function Ad({anchorElem:t,editor:e}){let o=Ri(null),n=Ri(null),{editorConfig:r}=H(),i=Tt(()=>{if(o?.current){let c=o.current.style.opacity==="0",d=o.current.style.pointerEvents==="none";c||(o.current.style.opacity="0"),d||(o.current.style.pointerEvents="none")}},[o]),l=Tt(c=>{if(o?.current&&(c.buttons===1||c.buttons===3)){let d=o.current.style.opacity==="0",u=o.current.style.pointerEvents==="none";if(!d||!u){let m=c.clientX,p=c.clientY,f=document.elementFromPoint(m,p);o.current.contains(f)||i()}}},[i]),s=Tt(()=>{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=Tt(()=>{let c=vi(),d=window.getSelection();if(o.current===null)return;let u=t.querySelector(":scope > .link-editor"),m=u!==null&&"style"in u&&u?.style?.opacity==="1",p=e.getRootElement();if(c!==null&&d!==null&&!d.isCollapsed&&p!==null&&p.contains(d.anchorNode)){let f=No(d,p),h=_t({alwaysDisplayOnTop:m,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});n.current&&_t({anchorElem:o.current,anchorFlippedOffset:h,floatingElem:n.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else i()},[e,i,t]);return Ze(()=>{let c=t.parentElement,d=()=>{e.getEditorState().read(()=>{a()})};return window.addEventListener("resize",d),c&&c.addEventListener("scroll",d),()=>{window.removeEventListener("resize",d),c&&c.removeEventListener("scroll",d)}},[e,a,t]),Ze(()=>(e.getEditorState().read(()=>{a()}),Mi(e.registerUpdateListener(({editorState:c})=>{c.read(()=>{a()})}),e.registerCommand(Rd,()=>(a(),!1),Id))),[e,a]),yi("div",{className:"inline-toolbar-popup",ref:o,children:[q("div",{className:"caret",ref:n}),r?.features&&r.features?.toolbarInline?.groups.map((c,d)=>q(vd,{anchorElem:t,editor:e,group:c,index:d},c.key))]})}function Dd(t,e){let o=Si(12),[n,r]=Sd(!1),i;o[0]!==t?(i=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let m=vi(),p=window.getSelection(),f=t.getRootElement();if(p!==null&&(!Ii(m)||f===null||!f.contains(p.anchorNode))){r(!1);return}if(!Ii(m))return;if(m.getTextContent()!==""){let C=m.getNodes(),L=!1;for(let A of C)if(Ld(A)){r(!0),L=!0;break}L||r(!1)}else r(!1);let h=m.getTextContent().replace(/\n/g,"");if(!m.isCollapsed()&&h===""){r(!1);return}})},o[0]=t,o[1]=i):i=o[1];let l=i,s,a;o[2]!==l?(s=()=>(document.addEventListener("selectionchange",l),document.addEventListener("mouseup",l),()=>{document.removeEventListener("selectionchange",l),document.removeEventListener("mouseup",l)}),a=[l],o[2]=l,o[3]=s,o[4]=a):(s=o[3],a=o[4]),Ze(s,a);let c,d;if(o[5]!==t||o[6]!==l?(c=()=>Mi(t.registerUpdateListener(()=>{l()}),t.registerRootListener(()=>{t.getRootElement()===null&&r(!1)})),d=[t,l],o[5]=t,o[6]=l,o[7]=c,o[8]=d):(c=o[7],d=o[8]),Ze(c,d),!n||!t.isEditable())return null;let u;return o[9]!==e||o[10]!==t?(u=yd(q(Ad,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=u):u=o[11],u}var Ai=t=>{let{anchorElem:e}=t,[o]=kd();return Dd(o,e)};var Od=M({plugins:[{Component:Ai,position:"floatingAnchorElem"}]});import{TableCellNode as op,TableNode as rp,TableRowNode as np}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{c as $d}from"react/compiler-runtime";import{jsx as $,jsxs as le}from"react/jsx-runtime";import{useLexicalComposerContext as Pi}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Pd}from"@lexical/react/useLexicalEditable";import{$deleteTableColumn__EXPERIMENTAL as Hd,$deleteTableRow__EXPERIMENTAL as Bd,$getNodeTriplet as jd,$getTableCellNodeFromLexicalNode as Gd,$getTableColumnIndexFromTableCellNode as Ud,$getTableNodeFromLexicalNodeOrThrow as Ye,$getTableRowIndexFromTableCellNode as Wd,$insertTableColumn__EXPERIMENTAL as Vd,$insertTableRow__EXPERIMENTAL as Kd,$isTableCellNode as wt,$isTableRowNode as Fi,$isTableSelection as kt,$unmergeCell as zd,getTableObserverFromTableElement as Zd,TableCellHeaderStates as ce,TableCellNode as Yd}from"@lexical/table";import{useScrollInfo as Xd}from"@payloadcms/ui";import{$createParagraphNode as Jd,$getRoot as qd,$getSelection as Lt,$isElementNode as Qd,$isParagraphNode as Hi,$isRangeSelection as Ro,$isTextNode as em}from"lexical";import*as So from"react";import{useCallback as Q,useEffect as ge,useRef as Nt,useState as ke}from"react";import{createPortal as Bi}from"react-dom";import{jsx as Lo,jsxs as Fd}from"react/jsx-runtime";import"react";var Oi=()=>Fd("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 tm(){let t=Lt();if(Ro(t)&&!t.isCollapsed()||kt(t)&&!t.anchor.is(t.focus)||!Ro(t)&&!kt(t))return!1;let[e]=jd(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function $i(t){if(t.getChildrenSize()!==1)return!1;let e=t.getFirstChildOrThrow();return!(!Hi(e)||!e.isEmpty())}function om(t){let e=t.getLastDescendant();em(e)?e.select():Qd(e)?e.selectEnd():e!==null&&e.selectNext()}function rm({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:n,tableCellNode:r}){let[i]=Pi(),l=Nt(null),[s,a]=ke(r),[c,d]=ke({columns:1,rows:1}),[u,m]=ke(!1),[p,f]=ke(!1),{y:h}=Xd();ge(()=>i.registerMutationListener(Yd,g=>{g.get(s.getKey())==="updated"&&i.getEditorState().read(()=>{a(s.getLatest())})},{skipInitialization:!0}),[i,s]),ge(()=>{i.getEditorState().read(()=>{let g=Lt();if(kt(g)){let _=Io(g);d(Io(g)),m(_.columns>1||_.rows>1)}f(tm())})},[i]),ge(()=>{let g=e.current,_=l.current,I=i.getRootElement();if(g!=null&&_!=null&&I!=null){let E=I.getBoundingClientRect(),v=g.getBoundingClientRect();_.style.opacity="1";let y=_.getBoundingClientRect(),O=5,B=v.right+O;if(B+y.width>window.innerWidth||B+y.width>E.right){let G=v.left-y.width-O;B=(G<0?O:G)+window.pageXOffset}_.style.left=`${B+window.pageXOffset}px`;let P=v.top;if(P+y.height>window.innerHeight){let G=v.bottom-y.height;P=(G<0?O:G)+window.pageYOffset}_.style.top=`${P}px`}},[e,l,i,h]),ge(()=>{function g(_){l.current!=null&&e.current!=null&&!l.current.contains(_.target)&&!e.current.contains(_.target)&&n(!1)}return window.addEventListener("click",g),()=>window.removeEventListener("click",g)},[n,e]);let C=Q(()=>{i.update(()=>{if(s.isAttached()){let _=Ye(s),I=i.getElementByKey(_.getKey());if(!I)throw new Error("Expected to find tableElement in DOM");let E=Zd(I);E!==null&&E.clearHighlight(),_.markDirty(),a(s.getLatest())}qd().selectStart()})},[i,s]),L=()=>{i.update(()=>{let g=Lt();if(kt(g)){let{columns:_,rows:I}=Io(g),E=g.getNodes(),v=null;for(let y=0;y<E.length;y++){let O=E[y];if(wt(O))if(v===null){O.setColSpan(_).setRowSpan(I),v=O;let B=$i(O),P;B&&Hi(P=O.getFirstChild())&&P.remove()}else wt(v)&&($i(O)||v.append(...O.getChildren()),O.remove())}v!==null&&(v.getChildrenSize()===0&&v.append(Jd()),om(v)),o()}})},A=()=>{i.update(()=>{zd()})},D=Q(g=>{i.update(()=>{Kd(g),o()})},[i,o]),x=Q(g=>{i.update(()=>{for(let _=0;_<c.columns;_++)Vd(g);o()})},[i,o,c.columns]),T=Q(()=>{i.update(()=>{Bd(),o()})},[i,o]),b=Q(()=>{i.update(()=>{Ye(s).remove(),C(),o()})},[i,s,C,o]),N=Q(()=>{i.update(()=>{Hd(),o()})},[i,o]),R=Q(()=>{i.update(()=>{let g=Ye(s),_=Wd(s),I=g.getChildren();if(_>=I.length||_<0)throw new Error("Expected table cell to be inside of table row.");let E=I[_];if(!Fi(E))throw new Error("Expected table row");let v=s.getHeaderStyles()^ce.ROW;E.getChildren().forEach(y=>{if(!wt(y))throw new Error("Expected table cell");y.setHeaderStyles(v,ce.ROW)}),C(),o()})},[i,s,C,o]),k=Q(()=>{i.update(()=>{let g=Ye(s),_=Ud(s),I=g.getChildren(),E=Math.max(...I.map(y=>y.getChildren().length));if(_>=E||_<0)throw new Error("Expected table cell to be inside of table row.");let v=s.getHeaderStyles()^ce.COLUMN;for(let y=0;y<I.length;y++){let O=I[y];if(!Fi(O))throw new Error("Expected table row");let B=O.getChildren();if(_>=B.length)continue;let P=B[_];if(!wt(P))throw new Error("Expected table cell");P.setHeaderStyles(v,ce.COLUMN)}C(),o()})},[i,s,C,o]),w=Q(()=>{i.update(()=>{if(s.isAttached()){let g=Ye(s);g&&g.setRowStriping(!g.getRowStriping())}C(),o()})},[i,s,C,o]),S=null;return t&&(u?S=$("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>L(),type:"button",children:"Merge cells"}):p&&(S=$("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>A(),type:"button",children:"Unmerge cells"}))),Bi(le("div",{className:"table-action-menu-dropdown",onClick:g=>{g.stopPropagation()},ref:l,children:[S?le(So.Fragment,{children:[S,$("hr",{})]}):null,$("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>w(),type:"button",children:$("span",{className:"text",children:"Toggle Row Striping"})}),$("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>D(!1),type:"button",children:le("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," above"]})}),$("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>D(!0),type:"button",children:le("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," below"]})}),$("hr",{}),$("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>x(!1),type:"button",children:le("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","left"]})}),$("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>x(!0),type:"button",children:le("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","right"]})}),$("hr",{}),$("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>N(),type:"button",children:$("span",{className:"text",children:"Delete column"})}),$("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>T(),type:"button",children:$("span",{className:"text",children:"Delete row"})}),$("button",{className:"item","data-test-id":"table-delete",onClick:()=>b(),type:"button",children:$("span",{className:"text",children:"Delete table"})}),$("hr",{}),$("button",{className:"item",onClick:()=>R(),type:"button",children:le("span",{className:"text",children:[(s.__headerState&ce.ROW)===ce.ROW?"Remove":"Add"," ","row header"]})}),$("button",{className:"item","data-test-id":"table-column-header",onClick:()=>k(),type:"button",children:le("span",{className:"text",children:[(s.__headerState&ce.COLUMN)===ce.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function nm({anchorElem:t,cellMerge:e}){let[o]=Pi(),n=Nt(null),r=Nt(null),[i,l]=ke(!1),[s,a]=ke(null),c=Q(()=>{let u=n.current,m=Lt(),p=window.getSelection(),f=document.activeElement;if(m==null||u==null){a(null);return}let h=o.getRootElement();if(Ro(m)&&h!==null&&p!==null&&h.contains(p.anchorNode)){let C=Gd(m.anchor.getNode());if(C==null){a(null);return}if(o.getElementByKey(C.getKey())==null){a(null);return}a(C)}else f||a(null)},[o]);ge(()=>o.registerUpdateListener(()=>{o.getEditorState().read(()=>{c()})})),ge(()=>{let u=n.current;if(u!=null&&s!=null){let m=o.getElementByKey(s.getKey());if(m!=null){let p=m.getBoundingClientRect(),f=u.getBoundingClientRect(),h=t.getBoundingClientRect(),C=p.top-h.top+4,L=p.right-f.width-10-h.left;u.style.opacity="1",u.style.transform=`translate(${L}px, ${C}px)`}else u.style.opacity="0",u.style.transform="translate(-10000px, -10000px)"}},[n,s,o,t]);let d=Nt(s);return ge(()=>{d.current!==s&&l(!1),d.current=s},[d,s]),$("div",{className:"table-cell-action-button-container",ref:n,children:s!=null&&le(So.Fragment,{children:[$("button",{className:"table-cell-action-button",onClick:u=>{u.stopPropagation(),l(!i)},ref:r,type:"button",children:$(Oi,{})}),i&&$(rm,{cellMerge:e,contextRef:r,onClose:()=>l(!1),setIsMenuOpen:l,tableCellNode:s})]})})}var ji=t=>{let e=$d(3),{anchorElem:o}=t,n=Pd(),r;return e[0]!==n||e[1]!==o?(r=Bi(n?$(nm,{anchorElem:o??document.body,cellMerge:!0}):null,o??document.body),e[0]=n,e[1]=o,e[2]=r):r=e[2],r};import{c as im}from"react/compiler-runtime";import{jsx as St,jsxs as lm}from"react/jsx-runtime";import{useLexicalComposerContext as sm}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as am}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as cm,$getTableNodeFromLexicalNodeOrThrow as yo,$getTableRowIndexFromTableCellNode as um,$isTableCellNode as Gi,$isTableRowNode as dm,getDOMCellFromTarget as mm,TableNode as pm}from"@lexical/table";import{calculateZoomLevel as Ui}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Mo}from"lexical";import*as Ki from"react";import{useCallback as Le,useEffect as Wi,useRef as It,useState as Rt}from"react";import{createPortal as fm}from"react-dom";var hm=33,Vi=92;function gm({editor:t}){let e=It(null),o=It(null),n=It(null),r=H(),i=It(null),[l,s]=Rt(null),[a,c]=Rt(null),[d,u]=Rt(!1),[m,p]=Rt(null),f=Le(()=>{c(null),e.current=null,p(null),i.current=null,n.current=null},[]),h=k=>(k.buttons&1)===1;Wi(()=>t.registerNodeTransform(pm,k=>{if(k.getColWidths())return k;let w=k.getColumnCount(),S=Vi;return k.setColWidths(Array(w).fill(S)),k}),[t]),Wi(()=>{let k=_=>{setTimeout(()=>{let I=_.target;if(m){s({x:_.clientX,y:_.clientY});return}if(u(h(_)),!(o.current&&o.current.contains(I))&&e.current!==I){e.current=I;let E=mm(I);E&&a!==E?t.update(()=>{let v=Mo(E.elem);if(!v)throw new Error("TableCellResizer: Table cell node not found.");let y=yo(v),O=t.getElementByKey(y.getKey());if(!O)throw new Error("TableCellResizer: Table element not found.");e.current=I,n.current=O.getBoundingClientRect(),c(E)}):E==null&&f()}},0)},w=_=>{setTimeout(()=>{u(!0)},0)},S=_=>{setTimeout(()=>{u(!1)},0)},g=t.registerRootListener((_,I)=>{I?.removeEventListener("mousemove",k),I?.removeEventListener("mousedown",w),I?.removeEventListener("mouseup",S),_?.addEventListener("mousemove",k),_?.addEventListener("mousedown",w),_?.addEventListener("mouseup",S)});return()=>{g()}},[a,m,t,f]);let C=k=>k==="bottom",L=Le(k=>{if(!a)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let w=Mo(a.elem);if(!Gi(w))throw new Error("TableCellResizer: Table cell node not found.");let S=yo(w),g=um(w)+w.getRowSpan()-1,_=S.getChildren();if(g>=_.length||g<0)throw new Error("Expected table cell to be inside of table row.");let I=_[g];if(!dm(I))throw new Error("Expected table row");let E=I.getHeight();if(E===void 0){let y=I.getChildren();E=Math.min(...y.map(O=>A(O,t)??1/0))}let v=Math.max(E+k,hm);I.setHeight(v)},{tag:"skip-scroll-into-view"})},[a,t]),A=(k,w)=>w.getElementByKey(k.getKey())?.clientHeight,D=(k,w)=>{for(let S=0;S<w.length;S++)for(let g=0;g<w[S].length;g++)if(w[S][g].cell===k)return g},x=Le(k=>{if(!a)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let w=Mo(a.elem);if(!Gi(w))throw new Error("TableCellResizer: Table cell node not found.");let S=yo(w),[g]=cm(S,null,null),_=D(w,g);if(_===void 0)throw new Error("TableCellResizer: Table column not found.");let I=S.getColWidths();if(!I)return;let E=I[_];if(E===void 0)return;let v=[...I],y=Math.max(E+k,Vi);v[_]=y,S.setColWidths(v)},{tag:"skip-scroll-into-view"})},[a,t]),T=Le(k=>{let w=S=>{if(S.preventDefault(),S.stopPropagation(),!a)throw new Error("TableCellResizer: Expected active cell.");if(i.current){let{x:g,y:_}=i.current;if(a===null)return;let I=Ui(S.target);if(C(k)){let E=(S.clientY-_)/I;L(E)}else{let E=(S.clientX-g)/I;x(E)}f(),document.removeEventListener("mouseup",w)}};return w},[a,f,x,L]),b=Le(k=>w=>{if(w.preventDefault(),w.stopPropagation(),!a)throw new Error("TableCellResizer: Expected active cell.");i.current={x:w.clientX,y:w.clientY},s(i.current),p(k),document.addEventListener("mouseup",T(k))},[a,T]),R=Le(()=>{if(a){let{height:k,left:w,top:S,width:g}=a.elem.getBoundingClientRect(),_=Ui(a.elem),I=10,E={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${I}px`,left:`${window.pageXOffset+w}px`,top:`${window.pageYOffset+S+k-I/2}px`,width:`${g}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${k}px`,left:`${window.pageXOffset+w+g-I/2}px`,top:`${window.pageYOffset+S}px`,width:`${I}px`}},v=n.current;return m&&l&&v&&(C(m)?(E[m].left=`${window.pageXOffset+v.left}px`,E[m].top=`${window.pageYOffset+l.y/_}px`,E[m].height="3px",E[m].width=`${v.width}px`):(E[m].top=`${window.pageYOffset+v.top}px`,E[m].left=`${window.pageXOffset+l.x/_}px`,E[m].width="3px",E[m].height=`${v.height}px`),E[m].backgroundColor="#adf"),E}return{bottom:null,left:null,right:null,top:null}},[a,m,l])();return St("div",{ref:o,children:a!=null&&!d&&lm(Ki.Fragment,{children:[St("div",{className:`${r.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:b("right"),style:R.right||void 0}),St("div",{className:`${r.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:b("bottom"),style:R.bottom||void 0})]})})}var zi=()=>{let t=im(3),[e]=sm(),o=am(),n,r;return t[0]!==o||t[1]!==e?(r=o?fm(St(gm,{editor:e}),document.body):null,t[0]=o,t[1]=e,t[2]=r):r=t[2],n=r,n};import{c as wm}from"react/compiler-runtime";import{jsx as vo,jsxs as Nm,Fragment as km}from"react/jsx-runtime";import{useLexicalComposerContext as tl}from"@lexical/react/LexicalComposerContext";import{$getTableColumnIndexFromTableCellNode as Lm,$getTableRowIndexFromTableCellNode as Im,$insertTableColumn__EXPERIMENTAL as Rm,$insertTableRow__EXPERIMENTAL as Sm,$isTableCellNode as ym,$isTableNode as Xi,TableNode as Mm}from"@lexical/table";import{$findMatchingParent as vm,mergeRegister as Am}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Ji}from"lexical";import{useEffect as qi,useMemo as Dm,useRef as Qi,useState as yt}from"react";import"react";import{createPortal as Om}from"react-dom";import{useMemo as Tm,useRef as Em}from"react";var Cm="Expected a function",xm=Math.max,bm=Math.min;function _m(t,e,o){let n,r,i=0,l,s=!1,a=!1,c,d,u,m=!0;if(typeof t!="function")throw new TypeError(Cm);e=e||0,typeof o=="object"&&(s=!!o.leading,a="maxWait"in o,c=a?xm(o.maxWait||0,e):c,m="trailing"in o?!!o.trailing:m);function p(b){let N=n,R=l;return n=l=void 0,i=b,d=t.apply(R,N),d}function f(b){return i=b,u=setTimeout(L,e),s?p(b):d}function h(b){let N=b-r,R=b-i,k=e-N;return a?bm(k,c-R):k}function C(b){let N=b-r,R=b-i;return r===void 0||N>=e||N<0||a&&R>=c}function L(){let b=Date.now();if(C(b))return A(b);u=setTimeout(L,h(b))}function A(b){return u=void 0,m&&n?p(b):(n=l=void 0,d)}function D(){u!==void 0&&clearTimeout(u),i=0,n=r=l=u=void 0}function x(){return u===void 0?d:A(Date.now())}function T(){let b=Date.now(),N=C(b);if(n=arguments,l=this,r=b,N){if(u===void 0)return f(r);if(a)return clearTimeout(u),u=setTimeout(L,e),p(r)}return u===void 0&&(u=setTimeout(L,e)),d}return T.cancel=D,T.flush=x,T}var Zi=_m;function Yi(t,e,o){let n=Em(null);return n.current=t,Tm(()=>Zi((...r)=>{n.current&&n.current(...r)},e,{maxWait:o}),[e,o])}var el=20;function Fm({anchorElem:t}){let[e]=tl(),o=H(),[n,r]=yt(!1),[i,l]=yt(!1),[s,a]=yt(!1),[c,d]=yt({}),u=Qi(new Set),m=Qi(null),p=Yi(C=>{let{isOutside:L,tableDOMNode:A}=$m(C,o.editorConfig?.lexical);if(L){r(!1),l(!1);return}if(!A)return;m.current=A;let D=null,x=null,T=null;if(e.update(()=>{let b=Ji(A);if(ym(b)){let N=vm(b,R=>Xi(R));if(!Xi(N))return;if(T=e.getElementByKey(N?.getKey()),T){let R=N.getChildrenSize(),k=N.getChildAtIndex(0)?.getChildrenSize(),w=Im(b),S=Lm(b);w===R-1?D=b:S===k-1&&(x=b)}}}),T){let{bottom:b,height:N,left:R,right:k,width:w,y:S}=T.getBoundingClientRect(),{left:g,y:_}=t.getBoundingClientRect();D?(l(!1),r(!0),d({height:el,left:R-g,top:b-_+5,width:w})):x&&(l(!0),r(!1),d({height:N,left:k-g+5,top:S-_,width:el}))}},50,250),f=Dm(()=>new ResizeObserver(()=>{r(!1),l(!1)}),[]);qi(()=>{if(s)return document.addEventListener("mousemove",p),()=>{r(!1),l(!1),document.removeEventListener("mousemove",p)}},[s,p]),qi(()=>Am(e.registerMutationListener(Mm,C=>{e.getEditorState().read(()=>{for(let[L,A]of C){let D=e.getElementByKey(L);switch(A){case"created":u.current.add(L),a(u.current.size>0),D&&f.observe(D);break;case"destroyed":u.current.delete(L),a(u.current.size>0),f.disconnect(),u.current.forEach(x=>{let T=e.getElementByKey(x);T&&f.observe(T)});break;default:break}}})},{skipInitialization:!1})),[e,f]);let h=C=>{e.update(()=>{m.current&&(Ji(m.current)?.selectEnd(),C?(Sm(),r(!1)):(Rm(),l(!1)))})};return e?.isEditable()?Nm(km,{children:[n&&vo("button",{className:o.editorConfig.lexical.theme.tableAddRows,onClick:()=>h(!0),style:{...c}}),i&&vo("button",{className:o.editorConfig.lexical.theme.tableAddColumns,onClick:()=>h(!1),style:{...c}})]}):null}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 ol(t){let e=wm(2),{anchorElem:o}=t,n=o===void 0?document.body:o,[r]=tl();if(!r?.isEditable())return null;let i;return e[0]!==n?(i=Om(vo(Fm,{anchorElem:n}),n),e[0]=n,e[1]=i):i=e[1],i}import{c as Pm}from"react/compiler-runtime";import{jsx as Ao,jsxs as Hm}from"react/jsx-runtime";import{useLexicalComposerContext as Bm}from"@lexical/react/LexicalComposerContext";import{TablePlugin as jm}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as Gm,TableNode as Um}from"@lexical/table";import{mergeRegister as Wm}from"@lexical/utils";import{formatDrawerSlug as Vm,useEditDepth as Km}from"@payloadcms/ui";import{$getSelection as zm,$isRangeSelection as Zm,COMMAND_PRIORITY_EDITOR as Ym,createCommand as Xm}from"lexical";import{createContext as Jm,useContext as qm,useEffect as Qm,useMemo as ep,useState as tp}from"react";import*as rl from"react";var Mt=Xm("OPEN_EMBED_DRAWER_COMMAND"),nl=Jm({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function il({children:t}){let[e,o]=tp({cellEditorConfig:null,cellEditorPlugins:null});return Ao(nl.Provider,{value:ep(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(n,r)=>{o({cellEditorConfig:n,cellEditorPlugins:r})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var ll=()=>{let t=Pm(16),[e]=Bm(),o=qm(nl),n=Km(),{fieldProps:r,uuid:i}=H(),{schemaPath:l}=r,s="lexical-table-create-"+i,a;t[0]!==s||t[1]!==n?(a=Vm({slug:s,depth:n}),t[0]=s,t[1]=n,t[2]=a):a=t[2];let c=a,{toggleDrawer:d}=xe(c,!0),u;t[3]!==e||t[4]!==d?(u=()=>{if(!e.hasNodes([Um]))throw new Error("TablePlugin: TableNode is not registered on editor");return Wm(e.registerCommand(Mt,()=>{let h;return h=null,e.getEditorState().read(()=>{let C=zm();Zm(C)&&(h=C)}),h&&d(),!0},Ym))},t[3]=e,t[4]=d,t[5]=u):u=t[5];let m;t[6]!==o||t[7]!==e||t[8]!==d?(m=[o,e,d],t[6]=o,t[7]=e,t[8]=d,t[9]=m):m=t[9],Qm(u,m);let p;t[10]!==e?(p=(h,C)=>{!C.columns||!C.rows||e.dispatchCommand(Gm,{columns:String(C.columns),rows:String(C.rows)})},t[10]=e,t[11]=p):p=t[11];let f;return t[12]!==c||t[13]!==p||t[14]!==l?(f=Hm(rl.Fragment,{children:[Ao(ue,{drawerSlug:c,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:p,schemaPath:l,schemaPathSuffix:"fields"}),Ao(jm,{hasCellBackgroundColor:!1,hasCellMerge:!0})]}),t[12]=c,t[13]=p,t[14]=l,t[15]=f):f=t[15],f};var ip=M({nodes:[rp,op,np],plugins:[{Component:ll,position:"normal"},{Component:zi,position:"normal"},{Component:ji,position:"floatingAnchorElem"},{Component:ol,position:"floatingAnchorElem"}],providers:[il],slashMenu:{groups:[W([{Icon:ko,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Mt,{})}}])]},toolbarFixed:{groups:[ee([{ChildComponent:ko,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Mt,{})}}])]}});import{$isNodeSelection as Rp}from"lexical";import{jsx as Do,jsxs as lp}from"react/jsx-runtime";import"react";var Oo=()=>lp("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 hp}from"react/compiler-runtime";import{jsx as gp}from"react/jsx-runtime";import{useLexicalComposerContext as Cp}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as xp,mergeRegister as bp}from"@lexical/utils";import{useConfig as _p}from"@payloadcms/ui";import{$getPreviousSelection as Tp,$getSelection as Ep,$isParagraphNode as al,$isRangeSelection as wp,COMMAND_PRIORITY_EDITOR as Np,createCommand as kp}from"lexical";import{useEffect as Lp}from"react";import{c as sp}from"react/compiler-runtime";import{jsx as Fo}from"react/jsx-runtime";import{useLexicalComposerContext as ap}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as cp,COMMAND_PRIORITY_EDITOR as up}from"lexical";import{useEffect as dp,useState as mp}from"react";var pp=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=cp(o);r&&r.replace($e({data:{fields:null,relationTo:e,value:n}}))}):t.dispatchCommand($o,{fields:null,relationTo:e,value:n})},fp=t=>{let e=sp(13),{enabledCollectionSlugs:o}=t,[n]=ap(),[r,i]=mp(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}=ht(l),d,u;e[2]!==n||e[3]!==c?(d=()=>n.registerCommand(Oe,h=>(i(h?.replace?h?.replace.nodeKey:null),c(),!0),up),u=[n,c],e[2]=n,e[3]=c,e[4]=d,e[5]=u):(d=e[4],u=e[5]),dp(d,u);let m;e[6]!==s||e[7]!==n||e[8]!==r?(m=h=>{let{collectionSlug:C,docID:L}=h;s(),pp({editor:n,relationTo:C,replaceNodeKey:r,value:L})},e[6]=s,e[7]=n,e[8]=r,e[9]=m):m=e[9];let p=m,f;return e[10]!==p||e[11]!==a?(f=Fo(a,{onSelect:p}),e[10]=p,e[11]=a,e[12]=f):f=e[12],f},sl=t=>Fo(et,{...t,uploads:!0,children:Fo(fp,{...t})});var $o=kp("INSERT_UPLOAD_COMMAND"),cl=t=>{let e=hp(5),[o]=Cp(),{config:n}=_p(),{collections:r}=n,i,l;e[0]!==o?(i=()=>{if(!o.hasNodes([Fe]))throw new Error("UploadPlugin: UploadNode not registered on editor");return bp(o.registerCommand($o,a=>(o.update(()=>{let c=Ep()||Tp();if(wp(c)){let d=$e({data:{id:a.id,fields:a.fields,relationTo:a.relationTo,value:a.value}});xp(d);let{focus:u}=c,m=u.getNode();al(m)&&m.getTextContentSize()===0&&m.getParentOrThrow().getChildren().filter(p=>al(p)).length>1&&m.remove()}}),!0),Np))},l=[o],e[0]=o,e[1]=i,e[2]=l):(i=e[1],l=e[2]),Lp(i,l);let s;return e[3]!==r?(s=gp(sl,{enabledCollectionSlugs:r.map(Ip)}),e[3]=r,e[4]=s):s=e[4],s};function Ip(t){let{slug:e}=t;return e}var Sp=M({nodes:[Fe],plugins:[{Component:cl,position:"normal"}],slashMenu:{groups:[W([{Icon:Oo,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Oe,{replace:!1})}}])]},toolbarFixed:{groups:[ee([{ChildComponent:Oo,isActive:({selection:t})=>{if(!Rp(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(Oe,{replace:!1})}}])]}});import{c as yp}from"react/compiler-runtime";import{jsx as Bo}from"react/jsx-runtime";import{ShimmerEffect as Mp}from"@payloadcms/ui";import{lazy as vp,Suspense as Ap,useEffect as Dp,useState as Op}from"react";var ul={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 Po={namespace:"lexical",theme:ul};function dl({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 ml=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 Ho(t,e,o){return{admin:o,features:ml(t),lexical:e,resolvedFeatureMap:t}}var Fp=vp(()=>import("./Field-GWJ72IYP.js").then(t=>({default:t.RichText}))),$p=t=>{let e=yp(11),{admin:o,clientFeatures: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,[s,a]=Op(null),c,d;e[2]!==s||e[3]!==n||e[4]!==r||e[5]!==l?(c=()=>{if(s)return;let m=[];for(let[h,C]of Object.entries(n))C.clientFeatureProvider&&m.push(C.clientFeatureProvider(C.clientFeatureProps));let p=r||Po,f=dl({unSanitizedEditorConfig:{features:m,lexical:p}});a(Ho(f,p,l))},d=[r,l,s,n],e[2]=s,e[3]=n,e[4]=r,e[5]=l,e[6]=c,e[7]=d):(c=e[6],d=e[7]),Dp(c,d);let u;return e[8]!==s||e[9]!==t?(u=Bo(Ap,{fallback:Bo(Mp,{height:"35vh"}),children:s&&Bo(Fp,{...t,editorConfig:s})}),e[8]=s,e[9]=t,e[10]=u):u=e[10],u};function Pp(...t){return t.filter(Boolean).join(" ")}var vt=new WeakMap;function pl(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function At(t,e){let o=vt.get(t);if(o===void 0){let n=new Set,r=l=>{o!==void 0&&(o.start=pl(l))},i=l=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let a=pl(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},vt.set(t,o)}return o.listeners.add(e),()=>{Hp(t,e)}}function Hp(t,e){let o=vt.get(t);if(o===void 0)return;let{listeners:n}=o;n.delete(e),n.size===0&&(vt.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function Bp(t,e){return At(t,(o,n)=>{let[r,i]=o;r<0&&-r>Math.abs(i)&&e(r,n)})}function jp(t,e){return At(t,(o,n)=>{let[r,i]=o;r>0&&r>Math.abs(i)&&e(r,n)})}function Gp(t,e){return At(t,(o,n)=>{let[r,i]=o;i<0&&-i>Math.abs(r)&&e(r,n)})}function Up(t,e){return At(t,(o,n)=>{let[r,i]=o;i>0&&i>Math.abs(r)&&e(r,n)})}var F={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},Wp=F.IS_BOLD|F.IS_ITALIC|F.IS_STRIKETHROUGH|F.IS_UNDERLINE|F.IS_CODE|F.IS_SUBSCRIPT|F.IS_SUPERSCRIPT|F.IS_HIGHLIGHT,Vp="\xA0",Kp=`
|
|
34
|
+
`},[t,e]),p=ke((b,T)=>{o(C=>{let k=e.length-1,S=e[k];if(S&&S.name===b){if(b==="type")return[...e.slice(0,k),{...S,value:S.value+T}];if(S.value===T)return[...e.slice(0,k),{...S,count:S.count+1}]}return[...C,{name:b,count:1,value:T}]})},[e,o]);Fr(()=>{let b=C=>{if(!n)return;let k=C.key;fa(C)?p("selectAll",""):$r.has(k)?p("press",C.key):[...k].length>1?p("keydown",C.key):p("type",C.key)},T=C=>{if(!n)return;let k=C.key;!$r.has(k)&&[...k].length>1&&p("keyup",C.key)};return t.registerRootListener((C,k)=>{k!==null&&(k.removeEventListener("keydown",b),k.removeEventListener("keyup",T)),C!==null&&(C.addEventListener("keydown",b),C.addEventListener("keyup",T))})},[t,n,p]),Fr(()=>{d.current&&d.current.scrollTo(0,d.current.scrollHeight)},[m]),ho(()=>{if(e){let b=m();b!==null&&s(b),d.current&&d.current.scrollTo(0,d.current.scrollHeight)}},[m,e]),ho(()=>t.registerUpdateListener(({dirtyElements:T,dirtyLeaves:C,editorState:k})=>{if(!n)return;let S=k._selection,w=a.current,N=c.current;if(w!==S){if(C.size===0&&T.size===0&&!N){let x=window.getSelection();if(x&&(x.anchorNode==null||x.focusNode==null))return}a.current=S}c.current=!1;let I=m();I!==null&&s(I)}),[t,m,n,p]),ho(()=>n?t.registerUpdateListener(()=>{let T=t.getRootElement();T!==null&&i(T?.innerHTML)}):void 0,[t,n]);let f=ke(b=>{n||(b.update(()=>{let T=ua();T.clear();let C=ca();T.append(aa().append(C)),C.select()}),o([])),r(T=>!T)},[n]),h=ke(()=>{if(!n)return;let b=window.getSelection();if(b===null||b.anchorNode==null||b.focusNode==null)return;let{anchorNode:T,anchorOffset:C,focusNode:k,focusOffset:S}=ha(b),w=u().getRootElement(),N;T!==null&&(N=Or(T,w));let I;k!==null&&(I=Or(k,w)),p("snapshot",{anchorNode:T,anchorOffset:C,anchorPath:N,focusNode:k,focusOffset:S,focusPath:I})},[p,n,u]),g=ke(()=>{da(m())},[m]),E=ke(()=>{ma("test.js",m())},[m]);return[Ne("button",{className:`editor-dev-button ${n?"active":""}`,id:"test-recorder-button",onClick:b=>{f(u()),b.preventDefault()},title:n?"Disable test recorder":"Enable test recorder",type:"button",children:n?"Disable test recorder":"Enable test recorder"}),n?Co("div",{className:"test-recorder-output",children:[Co("div",{className:"test-recorder-toolbar",children:[Ne("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:b=>{h(),b.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),Ne("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:b=>{g(),b.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),Ne("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:b=>{E(),b.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),Ne("pre",{id:"test-recorder",ref:d,children:l})]}):null]}var Br=()=>{let t=la(3),[e]=sa(),[o,n]=ga(e),r;return t[0]!==o||t[1]!==n?(r=Co(Pr.Fragment,{children:[Ne("p",{children:"HI"}),o,n,Ne("p",{children:"DONE"})]}),t[0]=o,t[1]=n,t[2]=r):r=t[2],r};var Ca=y({plugins:[{Component:Br,position:"bottom"}]});import{c as xa}from"react/compiler-runtime";import{jsx as ba}from"react/jsx-runtime";import{useLexicalComposerContext as _a}from"@lexical/react/LexicalComposerContext.js";import{TreeView as Ta}from"@lexical/react/LexicalTreeView.js";import"react";var Hr=()=>{let t=xa(2),[e]=_a(),o;return t[0]!==e?(o=ba(Ta,{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 wa=y({plugins:[{Component:Hr,position:"bottom"}]});import{$isTableSelection as Ea}from"@lexical/table";import{$isRangeSelection as ka,FORMAT_TEXT_COMMAND as Na}from"lexical";import{jsx as jr}from"react/jsx-runtime";import"react";var Gr=()=>jr("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:jr("path",{d:"M10.6772 15H6.27017V5.718H10.4172C12.6792 5.718 13.8492 6.602 13.8492 8.292C13.8492 9.098 13.1992 9.982 12.4712 10.216C13.3812 10.476 14.1742 11.256 14.1742 12.322C14.1742 14.09 12.9002 15 10.6772 15ZM8.46717 9.501H10.3262C11.3012 9.501 11.7042 9.046 11.7042 8.409C11.7042 7.72 11.2362 7.317 10.3392 7.317H8.46717V9.501ZM8.46717 11.061V13.401H10.4822C11.4702 13.401 11.9642 12.959 11.9642 12.218C11.9642 11.49 11.4702 11.061 10.4822 11.061H8.46717Z",fill:"currentColor"})});var Z=t=>({type:"buttons",items:t,key:"format",order:40});var Ur={type:"text-format",format:["bold","italic"],tag:"***"},Wr={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},Vr={type:"text-format",format:["bold"],tag:"**"},Kr={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var zr=[Z([{ChildComponent:Gr,isActive:({selection:t})=>ka(t)||Ea(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(Na,"bold")},order:1}])],La=y(({featureProviderMap:t})=>{let e=[Vr,Kr];return t.get("italic")&&e.push(Wr,Ur),{markdownTransformers:e,toolbarFixed:{groups:zr},toolbarInline:{groups:zr}}});import{$isTableSelection as Sa}from"@lexical/table";import{$isRangeSelection as Ra,FORMAT_TEXT_COMMAND as ya}from"lexical";import{jsx as Zr,jsxs as Ia}from"react/jsx-runtime";import"react";var Yr=()=>Ia("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Zr("path",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),Zr("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var Xr={type:"text-format",format:["code"],tag:"`"};var Jr=[Z([{ChildComponent:Yr,isActive:({selection:t})=>Ra(t)||Sa(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(ya,"code")},order:7}])],va=y({markdownTransformers:[Xr],toolbarFixed:{groups:Jr},toolbarInline:{groups:Jr}});import{$isTableSelection as Ma}from"@lexical/table";import{$isRangeSelection as Da,FORMAT_TEXT_COMMAND as Aa}from"lexical";import{jsx as qr}from"react/jsx-runtime";import"react";var Qr=()=>qr("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:qr("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 en={type:"text-format",format:["italic"],tag:"*"},tn={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var on=[Z([{ChildComponent:Qr,isActive:({selection:t})=>Da(t)||Ma(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(Aa,"italic")},order:2}])],Fa=y({markdownTransformers:[en,tn],toolbarFixed:{groups:on},toolbarInline:{groups:on}});import{$isTableSelection as $a}from"@lexical/table";import{$isRangeSelection as Pa,FORMAT_TEXT_COMMAND as Ba}from"lexical";import{jsx as rn,jsxs as Oa}from"react/jsx-runtime";import"react";var nn=()=>Oa("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[rn("path",{d:"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"}),rn("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var ln={type:"text-format",format:["strikethrough"],tag:"~~"};var sn=[Z([{ChildComponent:nn,isActive:({selection:t})=>Pa(t)||$a(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(Ba,"strikethrough")},order:4}])],Ha=y({markdownTransformers:[ln],toolbarFixed:{groups:sn},toolbarInline:{groups:sn}});import{$isTableSelection as ja}from"@lexical/table";import{$isRangeSelection as Ga,FORMAT_TEXT_COMMAND as Ua}from"lexical";import{jsx as an}from"react/jsx-runtime";import"react";var cn=()=>an("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:an("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 13.258C16.7768 14.155 16.1398 14.532 15.2038 15C14.5538 15.325 14.2808 15.546 14.2418 15.78H16.7898V16.82H12.7208V16.339C12.7208 15.286 13.5918 14.675 14.3588 14.233C15.0868 13.83 15.4378 13.635 15.4378 13.232C15.4378 12.894 15.2038 12.686 14.8268 12.686C14.3848 12.686 14.1248 13.024 14.1118 13.427H12.7468C12.8248 12.426 13.5528 11.633 14.8398 11.633C15.9448 11.633 16.7768 12.257 16.7768 13.258Z",fill:"currentColor"})});var un=[Z([{ChildComponent:cn,isActive:({selection:t})=>Ga(t)||ja(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(Ua,"subscript")},order:5}])],Wa=y({toolbarFixed:{groups:un},toolbarInline:{groups:un}});import{$isTableSelection as Va}from"@lexical/table";import{$isRangeSelection as Ka,FORMAT_TEXT_COMMAND as za}from"lexical";import{jsx as dn}from"react/jsx-runtime";import"react";var mn=()=>dn("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:dn("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 pn=[Z([{ChildComponent:mn,isActive:({selection:t})=>Ka(t)||Va(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(za,"superscript")},order:6}])],Za=y({toolbarFixed:{groups:pn},toolbarInline:{groups:pn}});import{$isTableSelection as Xa}from"@lexical/table";import{$isRangeSelection as Ja,FORMAT_TEXT_COMMAND as qa}from"lexical";import{jsx as fn,jsxs as Ya}from"react/jsx-runtime";import"react";var hn=()=>Ya("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[fn("path",{d:"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"}),fn("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var gn=[Z([{ChildComponent:hn,isActive:({selection:t})=>Ja(t)||Xa(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(qa,"underline")},order:3}])],Qa=y({toolbarFixed:{groups:gn},toolbarInline:{groups:gn}});import{$createHeadingNode as rc,$isHeadingNode as yn,HeadingNode as nc}from"@lexical/rich-text";import{$setBlocksType as ic}from"@lexical/selection";import{$getSelection as lc,$isRangeSelection as sc}from"lexical";import{jsx as Cn}from"react/jsx-runtime";import"react";var xn=()=>Cn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Cn("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 bn}from"react/jsx-runtime";import"react";var _n=()=>bn("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:bn("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 Tn}from"react/jsx-runtime";import"react";var wn=()=>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:"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 kn=()=>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 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.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 In}from"react/jsx-runtime";import"react";var Sn=()=>In("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:In("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 ec,$isHeadingNode as tc,HeadingNode as oc}from"@lexical/rich-text";var xo=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:[oc],export:(r,i)=>{if(!tc(r))return null;let l=Number(r.getTag().slice(1));return"#".repeat(l)+" "+i(r)},regExp:n,replace:xo(r=>{let i="h"+r[1].length;return ec(i)})}};var vn=t=>{let e=lc();ic(e,()=>rc(t))},Mn={h1:xn,h2:_n,h3:wn,h4:kn,h5:Ln,h6:Sn},ac=y(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[J(e.map((n,r)=>({ChildComponent:Mn[n],isActive:({selection:i})=>{if(!sc(i))return!1;for(let l of i.getNodes()){if(yn(l)&&l.getTag()===n)continue;let s=l.getParent();if(!(yn(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(()=>{vn(n)})},order:r+2})))];return{markdownTransformers:[Rn(e)],nodes:[nc],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[K(e.map(n=>({Icon:Mn[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(()=>{vn(n)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}});import{$isNodeSelection as Cc}from"lexical";import{jsx as Dn}from"react/jsx-runtime";import"react";var bo=()=>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 An,jsxs as cc}from"react/jsx-runtime";import"react";var Fn=()=>cc("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[An("path",{d:"M5 10h10",stroke:"currentColor"}),An("path",{d:"M10 15V5",stroke:"currentColor"})]});var ue=t=>({type:"dropdown",ChildComponent:Fn,items:t,key:"add",order:10});var On={type:"element",dependencies:[mt],export:(t,e)=>ft(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=pt();e&&t.replace(e)}};import{c as uc}from"react/compiler-runtime";import{useLexicalComposerContext as dc}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as mc}from"@lexical/utils";import{$getSelection as pc,$isRangeSelection as fc,COMMAND_PRIORITY_EDITOR as hc}from"lexical";import{useEffect as gc}from"react";var $n=()=>{let t=uc(3),[e]=dc(),o,n;return t[0]!==e?(o=()=>e.registerCommand(je,r=>{let i=pc();if(!fc(i))return!1;if(i.focus.getNode()!==null){let s=pt();mc(s)}return!0},hc),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),gc(o,n),null};var xc=y({markdownTransformers:[On],nodes:[mt],plugins:[{Component:$n,position:"normal"}],slashMenu:{groups:[K([{Icon:bo,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(je,void 0)}}])]},toolbarFixed:{groups:[ue([{ChildComponent:bo,isActive:({selection:t})=>{if(!Cc(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return ft(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(je,void 0)}}])]}});import{INDENT_CONTENT_COMMAND as Tc,OUTDENT_CONTENT_COMMAND as wc}from"lexical";import{jsx as It,jsxs as bc}from"react/jsx-runtime";import"react";var Pn=()=>bc("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[It("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),It("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),It("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),It("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as St,jsxs as _c}from"react/jsx-runtime";import"react";var Bn=()=>_c("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:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),St("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),St("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),St("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 jn=[Hn([{ChildComponent:Pn,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(wc,void 0)},order:1},{ChildComponent:Bn,isActive:()=>!1,key:"indentIncrease",label:({i18n:t})=>t.t("lexical:indent:increaseLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Tc,void 0)},order:2}])],Ec=y({toolbarFixed:{groups:jn},toolbarInline:{groups:jn}});import{$findMatchingParent as Au}from"@lexical/utils";import{$getSelection as Io,$isRangeSelection as xi}from"lexical";import{jsx as Gn}from"react/jsx-runtime";import"react";var Un=()=>Gn("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:Gn("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 Wn}from"@lexical/selection";function De(t){let{anchor:e}=t,{focus:o}=t,n=t.anchor.getNode(),r=t.focus.getNode();return n===r?n:t.isBackward()?Wn(o)?n:r:Wn(e)?n:r}var _o=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as Ac,$isTextNode as Fc}from"lexical";import{addClassNamesToElement as kc,isHTMLAnchorElement as Nc}from"@lexical/utils";import Eo from"bson-objectid";import{$applyNodeReplacement as Lc,$createTextNode as Vn,$getSelection as Ic,$isElementNode as Kn,$isRangeSelection as wo,createCommand as Sc,ElementNode as Rc}from"lexical";var yc=new Set(["http:","https:","mailto:","sms:","tel:"]),q=class t extends Rc{__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:vc,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 Eo.default().toHexString(),e.version=3);let o=de({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")),kc(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(!wo(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(Kn(n)){let r=de({fields:this.__fields});return n.append(r),r}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!yc.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 vc(t){let e=null;if(Nc(t)){let o=t.textContent;o!==null&&o!==""&&(e=de({id:new Eo.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function de({id:t,fields:e}){return Lc(new q({id:t??new Eo.default().toHexString(),fields:e}))}function V(t){return t instanceof q}var ie=Sc("TOGGLE_LINK_COMMAND");function zn(t){let e=Ic();if(!wo(e)&&!t.selectedNodes?.length)return;let o=wo(e)?e.extract():t.selectedNodes;if(t===null)o?.forEach(n=>{let r=n.getParent();if(V(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=V(i)?i:Mc(i);if(l!==null){l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append(Vn(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||Kn(i)&&!i.isInline())){if(V(l)){r=l,l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append(Vn(t.text)),l.getChildren().forEach(s=>{s!==l.getLastChild()&&s.remove()}));return}if(l.is(n)||(n=l,r=de({fields:t.fields}),V(l)?i.getPreviousSibling()===null?l.insertBefore(r):l.insertAfter(r):i.insertBefore(r)),V(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 Mc(t){return Dc(t,e=>V(e))}function Dc(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 Zn={type:"text-match",dependencies:[q],export:(t,e,o)=>{if(!V(t))return null;let n=t,{url:r}=n.getFields(),i=`[${n.getTextContent()}](${r})`,l=n.getFirstChild();return n.getChildrenSize()===1&&Fc(l)?o(l,i):i},importRegExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:(t,e)=>{let[,o,n]=e,r=de({fields:{doc:null,linkType:"custom",newTab:!1,url:n}}),i=Ac(o);i.setFormat(t.getFormat()),r.append(i),t.replace(r)},trigger:")"};import{$applyNodeReplacement as Oc,$isElementNode as $c}from"lexical";var me=class t extends q{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=et({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($c(n)){let r=et({fields:this.__fields});return n.append(r),r}return null}};function et({fields:t}){return Oc(new me({id:"",fields:t}))}function pe(t){return t instanceof me}import{c as Pc}from"react/compiler-runtime";import{useLexicalComposerContext as Bc}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Hc}from"@lexical/utils";import{$createTextNode as Yn,$getSelection as jc,$isElementNode as Jn,$isLineBreakNode as qn,$isNodeSelection as Gc,$isRangeSelection as Uc,$isTextNode as tt,TextNode as Wc}from"lexical";import{useEffect as Vc}from"react";function Xn(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 Qn(t,e){for(let o=0;o<e.length;o++){let n=e[o](t);if(n!=null)return n}return null}var Kc=/[.,;\s]/;function yt(t){return Kc.test(t)}function ei(t){return yt(t[t.length-1])}function No(t){return yt(t[0])}function zc(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function ti(t){let e=t.getPreviousSibling();return Jn(e)&&(e=e.getLastDescendant()),e===null||qn(e)||tt(e)&&ei(e.getTextContent())}function oi(t){let e=t.getNextSibling();return Jn(e)&&(e=e.getFirstDescendant()),e===null||qn(e)||tt(e)&&No(e.getTextContent())}function Zc(t,e,o,n){return(t>0?yt(o[t-1]):ti(n[0]))?e<o.length?yt(o[e]):oi(n[n.length-1]):!1}function Yc(t,e,o){let n=[],r=[],i=[],l=0,s=0,a=[...t];for(;a.length>0;){let c=a[0],u=c.getTextContent().length,m=s;s+u<=e?(n.push(c),l+=u):m>=o?i.push(c):r.push(c),s+=u,a.shift()}return[l,n,r,i]}function Xc(t,e,o,n){let r={linkType:"custom",url:n.url,...n.fields},i=et({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=Yn(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=[],d;for(let f=1;f<t.length;f++){let h=t[f],E=h.getTextContent().length,D=s,A=s+E;if(D<o)if(A<=o)c.push(h);else{let[b,T]=h.splitText(o-D);c.push(b),d=T}s+=E}let u=jc(),m=u?u.getNodes().find(tt):void 0,p=Yn(a.getTextContent());return p.setFormat(a.getFormat()),p.setDetail(a.getDetail()),p.setStyle(a.getStyle()),i.append(p,...c),m&&m===a&&(Uc(u)?p.select(u.anchor.offset,u.focus.offset):Gc(u)&&p.select(0,p.getTextContent().length)),a.replace(i),d}}function Jc(t,e,o){let n=[...t],r=n.map(a=>a.getTextContent()).join(""),i=r,l,s=0;for(;(l=Qn(i,e))!=null&&l!==null;){let a=l.index,c=l.length,d=a+c;if(Zc(s+a,s+d,r,n)){let[m,,p,f]=Yc(n,s+a,s+d),h=s+a-m,g=s+d-m,E=Xc(p,h,g,l);n=E?[E,...f]:f,o(l.url,null),s=0}else s+=d;i=i.substring(d)}}function ko(t,e,o){let n=t.getChildren(),r=n.length;for(let a=0;a<r;a++){let c=n[a];if(!tt(c)||!c.isSimpleText()){Rt(t),o(null,t.getFields()?.url??null);return}}let i=t.getTextContent(),l=Qn(i,e);if(l===null||l.text!==i){Rt(t),o(null,t.getFields()?.url??null);return}if(!ti(t)||!oi(t)){Rt(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 qc(t,e,o){let n=t.getPreviousSibling(),r=t.getNextSibling(),i=t.getTextContent();if(pe(n)){let l=n.getFields()?.url?n.getFields()?.url?.startsWith("mailto:"):!1;(!No(i)||zc(i,l))&&(n.append(t),ko(n,e,o),o(null,n.getFields()?.url??null))}pe(r)&&!ei(i)&&(Rt(r),ko(r,e,o),o(null,r.getFields()?.url??null))}function Rt(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 Qc(t){let e=[t],o=t.getNextSibling();for(;o!==null&&tt(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function eu(t,e,o){let n=Pc(5),r,i;n[0]!==t||n[1]!==o||n[2]!==e?(r=()=>{if(!t.hasNodes([me]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let l=(s,a)=>{o?.(s,a)};return Hc(t.registerNodeTransform(Wc,s=>{let a=s.getParentOrThrow(),c=s.getPreviousSibling();if(pe(a))ko(a,e,l);else if(!V(a)){if(s.isSimpleText()&&(No(s.getTextContent())||!pe(c))){let d=Qc(s);Jc(d,e,l)}qc(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]),Vc(r,i)}var tu=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,ou=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,ru=[Xn(tu,t=>t.startsWith("http")?t:`https://${t}`),Xn(ou,t=>`mailto:${t}`)],ri=()=>{let[t]=Bc();return eu(t,ru),null};import{jsx as nu}from"react/jsx-runtime";import{ClickableLinkPlugin as iu}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var ni=()=>nu(iu,{});import{jsx as wu}from"react/jsx-runtime";import"react";import{createPortal as Eu}from"react-dom";import{jsx as fe,jsxs as ot,Fragment as su}from"react/jsx-runtime";import{useLexicalComposerContext as au}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as ii,mergeRegister as li}from"@lexical/utils";import{getTranslation as Lo}from"@payloadcms/translations";import{CloseMenuIcon as cu,EditIcon as uu,ExternalLinkIcon as si,formatDrawerSlug as du,useConfig as mu,useEditDepth as pu,useLocale as fu,useTranslation as hu}from"@payloadcms/ui";import{requests as gu}from"@payloadcms/ui/shared";import{$getSelection as ai,$isLineBreakNode as Cu,$isRangeSelection as ci,COMMAND_PRIORITY_HIGH as xu,COMMAND_PRIORITY_LOW as ui,KEY_ESCAPE_COMMAND as bu,SELECTION_CHANGE_COMMAND as _u}from"lexical";import di,{useCallback as mi,useEffect as Dt,useRef as Tu,useState as Le}from"react";function vt(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,d=t.left-r;c<a.top&&(c+=l.height+t.height+n*2),d+l.width>a.right&&(d=a.right-l.width-r),c-=s.top,d-=s.left,e.style.opacity="1",e.style.transform=`translate(${d}px, ${c}px)`}import{createCommand as lu}from"lexical";var Mt=lu("TOGGLE_LINK_WITH_MODAL_COMMAND");function pi({anchorElem:t}){let[e]=au(),[o,n]=Le(),r=Tu(null),[i,l]=Le(null),[s,a]=Le(null),{fieldProps:{schemaPath:c},uuid:d}=B(),{config:u}=mu(),{i18n:m,t:p}=hu(),[f,h]=Le(),g=pu(),[E,D]=Le(!1),[A,b]=Le([]),T=fu(),[C,k]=Le(!1),S=du({slug:"lexical-rich-text-link-"+d,depth:g}),{toggleDrawer:w}=be(S),N=mi(()=>{D(!1),r&&r.current&&(r.current.style.opacity="0",r.current.style.transform="translate(-10000px, -10000px)"),k(!1),l(null),a(null),b([]),h(void 0)},[D,l,a,b]),I=mi(()=>{let x=ai(),_;if(!ci(x)||!x){N();return}let R=De(x);_=e.getElementByKey(R.getKey())?.getBoundingClientRect();let L=ii(R,V),M=x.getNodes().filter(U=>!Cu(U)).find(U=>{let G=ii(U,V);return L&&!L.is(G)||G&&!G.is(L)});if(L==null||M){N();return}n(L);let v=L.getFields(),F={...v,id:L.getID(),text:L.getTextContent()};if(v?.linkType==="custom")l(v?.url??null),a(null);else{l(`${u.routes.admin==="/"?"":u.routes.admin}/collections/${v?.doc?.relationTo}/${v?.doc?.value}`);let U=u.collections.find(G=>G.slug===v?.doc?.relationTo);if(!U)a(v?.label?String(v?.label):null),l(v?.url?String(v?.url):null);else{let G=typeof v.doc?.value=="object"?v.doc.value.id:v.doc?.value,ae=v.doc?.relationTo;if(!G||!ae)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let ye=p("fields:linkedTo",{label:`${Lo(U.labels.singular,m)} - ${p("lexical:link:loadingWithEllipsis",m)}`}).replace(/<[^>]*>?/g,"");a(ye),gu.get(`${u.serverURL}${u.routes.api}/${ae}/${G}`,{headers:{"Accept-Language":m.language},params:{depth:0,locale:T?.code}}).then(async Ce=>{if(!Ce.ok)throw new Error(`HTTP error! Status: ${Ce.status}`);let dt=await Ce.json(),lr=U?.admin?.useAsTitle||"id",W=dt[lr],ee=p("fields:linkedTo",{label:`${Lo(U.labels.singular,m)} - ${W}`}).replace(/<[^>]*>?/g,"");a(ee)}).catch(()=>{let Ce=p("fields:linkedTo",{label:`${Lo(U.labels.singular,m)} - ${p("general:untitled",m)} - ID: ${G}`}).replace(/<[^>]*>?/g,"");a(Ce)})}}h(F),D(!0),b(x?x?.getNodes():[]),pe(L)?k(!0):k(!1);let H=r.current,$=window.getSelection(),{activeElement:j}=document;if(H===null)return;let Q=e.getRootElement();return $!==null&&Q!==null&&Q.contains($.anchorNode)?(_||(_=$.getRangeAt(0).getBoundingClientRect()),_!=null&&(_.y+=40,vt(_,H,t))):(j==null||j.className!=="link-input")&&(Q!==null&&vt(null,H,t),l(null),a(null)),!0},[e,N,u.routes.admin,u.routes.api,u.collections,u.serverURL,p,m,T?.code,t]);return Dt(()=>li(e.registerCommand(Mt,x=>(e.dispatchCommand(ie,x),I(),w(),!0),ui)),[e,I,w,S]),Dt(()=>{let x=t.parentElement,_=()=>{e.getEditorState().read(()=>{I()})};return window.addEventListener("resize",_),x?.addEventListener("scroll",_),()=>{window.removeEventListener("resize",_),x?.removeEventListener("scroll",_)}},[t.parentElement,e,I]),Dt(()=>li(e.registerUpdateListener(({editorState:x})=>{x.read(()=>{I()})}),e.registerCommand(_u,()=>(I(),!0),ui),e.registerCommand(bu,()=>E?(N(),!0):!1,xu)),[e,I,E,N]),Dt(()=>{e.getEditorState().read(()=>{I()})},[e,I]),ot(di.Fragment,{children:[fe("div",{className:"link-editor",ref:r,children:ot("div",{className:"link-input",children:[i&&i.length>0?ot("a",{href:i,rel:"noopener noreferrer",target:"_blank",children:[o?.__fields.newTab?fe(si,{}):null,s!=null&&s.length>0?s:i]}):s!=null&&s.length>0?ot(su,{children:[o?.__fields.newTab?fe(si,{}):null,fe("span",{className:"link-input__label-pure",children:s})]}):null,e.isEditable()&&ot(di.Fragment,{children:[fe("button",{"aria-label":"Edit link",className:"link-edit",onClick:()=>{w()},onMouseDown:x=>{x.preventDefault()},tabIndex:0,type:"button",children:fe(uu,{})}),!C&&fe("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(ie,null)},onMouseDown:x=>{x.preventDefault()},tabIndex:0,type:"button",children:fe(cu,{})})]})]})}),fe(Ge,{className:"lexical-link-edit-drawer",data:f,drawerSlug:S,drawerTitle:p("fields:editLink"),featureKey:"link",handleDrawerSubmit:(x,_)=>{let R=_,L={...R};delete L.text,e.update(()=>{let M=ai(),v=null;if(ci(M)?v=De(M).getParent():A.length&&(v=A[0].getParent()),v&&pe(v)){let F=de({fields:L});v.replace(F,!0)}}),e.dispatchCommand(ie,{fields:L,selectedNodes:A,text:R.text})},schemaPath:c,schemaPathSuffix:"fields"})]})}var fi=t=>{let{anchorElem:e=document.body}=t;return Eu(wu(pi,{anchorElem:e}),e)};import{c as Lu}from"react/compiler-runtime";import{useLexicalComposerContext as Iu}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Su}from"@lexical/utils";import{$getSelection as Ru,$isElementNode as yu,$isRangeSelection as vu,COMMAND_PRIORITY_LOW as gi,PASTE_COMMAND as Mu}from"lexical";import{useEffect as Du}from"react";var ku=/(?:[A-Za-z]{3,9}:(?:\/\/)?(?:[-;:&=+$,\w]+@)?[A-Za-z\d.-]+|(?:www.|[-;:&=+$,\w]+@)[A-Za-z\d.-]+)(?:\/[+~%/.\w-]*)?\??[-+=&;%@.\w]*#?\w*/,Nu=/^[\w\-./]*(?:#\w[\w-]*)?$/;function hi(t){if(!t)return!1;if(t==="https://"||ku.test(t)||Nu.test(t))return!0;try{return new URL(t),!0}catch{}return!1}var Ci=()=>{let t=Lu(3),[e]=Iu(),o,n;return t[0]!==e?(o=()=>{if(!e.hasNodes([q]))throw new Error("LinkPlugin: LinkNode not registered on editor");return Su(e.registerCommand(ie,r=>(zn(r),!0),gi),e.registerCommand(Mu,r=>{let i=Ru();if(!vu(i)||i.isCollapsed()||!(r instanceof ClipboardEvent)||r.clipboardData==null)return!1;let l=r.clipboardData.getData("text");if(!hi(l))return!1;if(!i.getNodes().some(s=>yu(s))){let s={doc:null,linkType:"custom",newTab:!1,url:l};return e.dispatchCommand(ie,{fields:s,text:null}),r.preventDefault(),!0}return!1},gi))},n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),Du(o,n),null};var bi=[_o([{ChildComponent:Un,isActive:({selection:t})=>{if(xi(t)){let e=De(t);return Au(e,V)!=null}return!1},isEnabled:({selection:t})=>!!(xi(t)&&Io()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(ie,null);else{let o,n=[];if(t.getEditorState().read(()=>{o=Io()?.getTextContent(),n=Io()?.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}])],Fu=y({markdownTransformers:[Zn],nodes:[q,me],plugins:[{Component:Ci,position:"normal"},{Component:ri,position:"normal"},{Component:ni,position:"normal"},{Component:fi,position:"floatingAnchorElem"}],toolbarFixed:{groups:bi},toolbarInline:{groups:bi}});import{$isListNode as yo,INSERT_CHECK_LIST_COMMAND as Ni,ListItemNode as zu,ListNode as Zu}from"@lexical/list";import{$isRangeSelection as Yu}from"lexical";import{jsx as _i,jsxs as Ou}from"react/jsx-runtime";import"react";var So=()=>Ou("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:[_i("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),_i("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as $u}from"react/jsx-runtime";import{ListPlugin as Pu}from"@lexical/react/LexicalListPlugin.js";import"react";var Ae=()=>$u(Pu,{});function Fe(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as Gu,ListItemNode as Uu,ListNode as Wu}from"@lexical/list";import{$createListItemNode as Bu,$createListNode as Hu,$isListItemNode as ju,$isListNode as Ro}from"@lexical/list";var Ti=4,Oe=t=>(e,o,n)=>{let r=e.getPreviousSibling(),i=e.getNextSibling(),l=Bu(t==="check"?n[3]==="x":void 0);if(Ro(i)&&i.getListType()===t){let a=i.getFirstChild();a!==null?a.insertBefore(l):i.append(l),e.remove()}else if(Ro(r)&&r.getListType()===t)r.append(l),e.remove();else{let a=Hu(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/Ti);s&&l.setIndent(s)},Ie=(t,e,o)=>{let n=[],r=t.getChildren(),i=0;for(let l of r)if(ju(l)){if(l.getChildrenSize()===1){let d=l.getFirstChild();if(Ro(d)){n.push(Ie(d,e,o+1));continue}}let s=" ".repeat(o*Ti),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 wi={type:"element",dependencies:[Wu,Uu],export:(t,e)=>Gu(t)?Ie(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:Oe("check")};import{jsx as Vu}from"react/jsx-runtime";import{CheckListPlugin as Ku}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var Ei=()=>Vu(Ku,{});var ki=[J([{ChildComponent:So,isActive:({selection:t})=>{if(!Yu(t))return!1;for(let e of t.getNodes()){if(yo(e)&&e.getListType()==="check")continue;let o=e.getParent();if(yo(o)&&o.getListType()==="check")continue;let n=o?.getParent();if(!(yo(n)&&n.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ni,void 0)},order:12}])],Xu=y(({featureProviderMap:t})=>{let e=[{Component:Ei,position:"normal"}];return!t.has("unorderedList")&&!t.has("orderedList")&&e.push({Component:Ae,position:"normal"}),{markdownTransformers:[wi],nodes:t.has("unorderedList")||t.has("orderedList")?[]:[Zu,zu],plugins:e,slashMenu:{groups:[Fe([{Icon:So,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:o})=>o.t("lexical:checklist:label"),onSelect:({editor:o})=>{o.dispatchCommand(Ni,void 0)}}])]},toolbarFixed:{groups:ki},toolbarInline:{groups:ki}}});import{$isListNode as Mo,INSERT_ORDERED_LIST_COMMAND as Si,ListItemNode as td,ListNode as od}from"@lexical/list";import{$isRangeSelection as rd}from"lexical";import{jsx as rt,jsxs as Ju}from"react/jsx-runtime";import"react";var vo=()=>Ju("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:[rt("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"}),rt("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"}),rt("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),rt("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),rt("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as qu,ListItemNode as Qu,ListNode as ed}from"@lexical/list";var Li={type:"element",dependencies:[ed,Qu],export:(t,e)=>qu(t)?Ie(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:Oe("number")};var Ii=[J([{ChildComponent:vo,isActive:({selection:t})=>{if(!rd(t))return!1;for(let e of t.getNodes()){if(Mo(e)&&e.getListType()==="number")continue;let o=e.getParent();if(Mo(o)&&o.getListType()==="number")continue;let n=o?.getParent();if(!(Mo(n)&&n.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Si,void 0)},order:10}])],nd=y(({featureProviderMap:t})=>({markdownTransformers:[Li],nodes:t.has("orderedList")?[]:[od,td],plugins:t.has("orderedList")?[]:[{Component:Ae,position:"normal"}],slashMenu:{groups:[Fe([{Icon:vo,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:e})=>e.t("lexical:orderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(Si,void 0)}}])]},toolbarFixed:{groups:Ii},toolbarInline:{groups:Ii}}));import{$isListNode as Ao,INSERT_UNORDERED_LIST_COMMAND as vi,ListItemNode as cd,ListNode as ud}from"@lexical/list";import{$isRangeSelection as dd}from"lexical";import{jsx as $e,jsxs as id}from"react/jsx-runtime";import"react";var Do=()=>id("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 ld,ListItemNode as sd,ListNode as ad}from"@lexical/list";var Ri={type:"element",dependencies:[ad,sd],export:(t,e)=>ld(t)?Ie(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:Oe("bullet")};var yi=[J([{ChildComponent:Do,isActive:({selection:t})=>{if(!dd(t))return!1;for(let e of t.getNodes()){if(Ao(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(Ao(o)&&o.getListType()==="bullet")continue;let n=o?.getParent();if(!(Ao(n)&&n.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(vi,void 0)},order:11}])],md=y({markdownTransformers:[Ri],nodes:[ud,cd],plugins:[{Component:Ae,position:"normal"}],slashMenu:{groups:[Fe([{Icon:Do,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(vi,void 0)}}])]},toolbarFixed:{groups:yi},toolbarInline:{groups:yi}});import{jsx as pd}from"react/jsx-runtime";import{addClassNamesToElement as fd}from"@lexical/utils";import{DecoratorNode as hd}from"lexical";import*as Mi from"react";var gd=Mi.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),nt=class t extends hd{__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 Cd({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return fd(o,"unknownConverted"),o}decorate(){return pd(gd,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function Cd({data:t}){return new nt({data:t})}var xd=y(()=>({nodes:[nt]}));import{jsx as bd}from"react/jsx-runtime";import{addClassNamesToElement as _d}from"@lexical/utils";import{DecoratorNode as Td}from"lexical";import*as Di from"react";var wd=Di.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),it=class t extends Td{__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 Ed({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return _d(o,"unknownConverted"),o}decorate(){return bd(wd,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function Ed({data:t}){return new it({data:t})}var kd=y(()=>({nodes:[it]}));import{$setBlocksType as Oi}from"@lexical/selection";import{$createParagraphNode as $i,$getSelection as Pi,$isParagraphNode as Ai,$isRangeSelection as Nd}from"lexical";var Fi=[J([{ChildComponent:Ye,isActive:({selection:t})=>{if(!Nd(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=Pi();Oi(e,()=>$i())})},order:1}])],Ld=y({slashMenu:{groups:[K([{Icon:Ye,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Pi();Oi(e,()=>$i())})}}])]},toolbarFixed:{groups:Fi},toolbarInline:{groups:Fi}});import{$isNodeSelection as em}from"lexical";import{jsx as lt,jsxs as Id}from"react/jsx-runtime";import"react";var Fo=()=>Id("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[lt("g",{clipPath:"url(#clip0_4397_10817)",children:lt("path",{d:"M7.75 12.25L15.25 4.75M15.25 4.75H11.5M15.25 4.75V8.5M13 11.5V13.75C13 14.5784 12.3284 15.25 11.5 15.25H6.25C5.42157 15.25 4.75 14.5784 4.75 13.75V8.5C4.75 7.67157 5.42157 7 6.25 7H8.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})}),lt("defs",{children:lt("clipPath",{id:"clip0_4397_10817",children:lt("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{c as Gd}from"react/compiler-runtime";import{jsx as Ud}from"react/jsx-runtime";import{useLexicalComposerContext as Wd}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Vd}from"@lexical/utils";import{useConfig as Kd}from"@payloadcms/ui";import{$getPreviousSelection as zd,$getSelection as Zd,$isParagraphNode as Wi,$isRangeSelection as Yd,COMMAND_PRIORITY_EDITOR as Xd,createCommand as Jd}from"lexical";import{useEffect as qd}from"react";import{c as $d}from"react/compiler-runtime";import{jsx as Ft}from"react/jsx-runtime";import{useLexicalComposerContext as Pd}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as Bd,COMMAND_PRIORITY_EDITOR as Hd}from"lexical";import{useEffect as Hi,useState as ji}from"react";import{c as Sd}from"react/compiler-runtime";import{jsx as Rd}from"react/jsx-runtime";import{useLexicalComposerContext as yd}from"@lexical/react/LexicalComposerContext";import{useListDrawer as vd,useModal as Md}from"@payloadcms/ui";import{$getPreviousSelection as Dd,$getSelection as Ad,$setSelection as Fd}from"lexical";import{useEffect as Od,useState as Bi}from"react";var At=t=>{let e=Sd(23),[o]=yd(),[n,r]=Bi(null),[i,l]=Bi(!1),[s,a,c]=vd(t),{closeDrawer:d,drawerSlug:u,isDrawerOpen:m,openDrawer:p}=c,{modalState:f}=Md(),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let N=Ad()??Dd();r(N)},e[0]=h):h=e[0];let g=h,E;e[1]!==n||e[2]!==o?(E=()=>{n&&o.update(()=>{Fd(n.clone())},{discrete:!0,skipTransforms:!0})},e[1]=n,e[2]=o,e[3]=E):E=e[3];let D=E,A;e[4]!==d?(A=()=>{d()},e[4]=d,e[5]=A):A=e[5];let b=A,T,C;e[6]!==i||e[7]!==f||e[8]!==u||e[9]!==D?(T=()=>{if(!i)return;let N=f[u];N&&!N?.isOpen&&(l(!1),setTimeout(()=>{D()},1))},C=[f,u,D,i],e[6]=i,e[7]=f,e[8]=u,e[9]=D,e[10]=T,e[11]=C):(T=e[10],C=e[11]),Od(T,C);let k;e[12]!==a?(k=N=>Rd(a,{...N,onClick:()=>{g()}}),e[12]=a,e[13]=k):k=e[13];let S;e[14]!==p?(S=()=>{g(),p(),l(!0)},e[14]=p,e[15]=S):S=e[15];let w;return e[16]!==b||e[17]!==m||e[18]!==s||e[19]!==u||e[20]!==k||e[21]!==S?(w={closeListDrawer:b,isListDrawerOpen:m,ListDrawer:s,listDrawerSlug:u,ListDrawerToggler:k,openListDrawer:S},e[16]=b,e[17]=m,e[18]=s,e[19]=u,e[20]=k,e[21]=S,e[22]=w):w=e[22],w};var jd=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=Bd(o);r&&r.replace(Ve({relationTo:e,value:n}))}):t.dispatchCommand(Oo,{relationTo:e,value:n})},Gi=t=>{let e=$d(21),{enabledCollectionSlugs:o}=t,[n]=Pd(),r;e[0]!==o?(r=()=>o?.[0],e[0]=o,e[1]=r):r=e[1];let[i,l]=ji(r),[s,a]=ji(null),c=o||void 0,d;e[2]!==c||e[3]!==i?(d={collectionSlugs:c,selectedCollection:i},e[2]=c,e[3]=i,e[4]=d):d=e[4];let{closeListDrawer:u,isListDrawerOpen:m,ListDrawer:p,openListDrawer:f}=At(d),h,g;e[5]!==n||e[6]!==f?(h=()=>n.registerCommand(Ue,C=>(a(C?.replace?C?.replace.nodeKey:null),f(),!0),Hd),g=[n,f],e[5]=n,e[6]=f,e[7]=h,e[8]=g):(h=e[7],g=e[8]),Hi(h,g);let E;e[9]!==n||e[10]!==s||e[11]!==u?(E=C=>{let{collectionSlug:k,docID:S}=C;jd({editor:n,relationTo:k,replaceNodeKey:s,value:S}),u()},e[9]=n,e[10]=s,e[11]=u,e[12]=E):E=e[12];let D=E,A;e[13]!==o?(A=()=>{l(o?.[0])},e[13]=o,e[14]=A):A=e[14];let b;e[15]!==m||e[16]!==o?(b=[m,o],e[15]=m,e[16]=o,e[17]=b):b=e[17],Hi(A,b);let T;return e[18]!==D||e[19]!==p?(T=Ft(p,{onSelect:D}),e[18]=D,e[19]=p,e[20]=T):T=e[20],T},Ui=t=>(t?.enabledCollectionSlugs?.length??-1)>0?Ft(Gi,{...t}):Ft(ht,{...t,children:Ft(Gi,{...t})});var Oo=Jd("INSERT_RELATIONSHIP_COMMAND"),Vi=t=>{let e=Gd(10),{clientProps:o}=t,[n]=Wd(),{config:r}=Kd(),{collections:i}=r,l=null;if(o?.enabledCollections)l=o?.enabledCollections;else if(o?.disabledCollections){let d;if(e[0]!==o||e[1]!==i){let u;e[3]!==o?(u=m=>{let{slug:p}=m;return!o?.disabledCollections?.includes(p)},e[3]=o,e[4]=u):u=e[4],d=i.filter(u).map(Qd),e[0]=o,e[1]=i,e[2]=d}else d=e[2];l=d}let s,a;e[5]!==n?(s=()=>{if(!n.hasNodes([We]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return n.registerCommand(Oo,d=>{let u=Zd()||zd();if(Yd(u)){let m=Ve(d);Vd(m);let{focus:p}=u,f=p.getNode();Wi(f)&&f.getTextContentSize()===0&&f.getParentOrThrow().getChildren().filter(h=>Wi(h)).length>1&&f.remove()}return!0},Xd)},a=[n],e[5]=n,e[6]=s,e[7]=a):(s=e[6],a=e[7]),qd(s,a);let c;return e[8]!==l?(c=Ud(Ui,{enabledCollectionSlugs:l}),e[8]=l,e[9]=c):c=e[9],c};function Qd(t){let{slug:e}=t;return e}var tm=y({nodes:[We],plugins:[{Component:Vi,position:"normal"}],slashMenu:{groups:[K([{Icon:Fo,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ue,{replace:!1})}}])]},toolbarFixed:{groups:[ue([{ChildComponent:Fo,isActive:({selection:t})=>{if(!em(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return oo(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ue,{replace:!1})}}])]}});import{c as qi}from"react/compiler-runtime";import{jsx as ne,jsxs as hm}from"react/jsx-runtime";import{useLexicalComposerContext as gm}from"@lexical/react/LexicalComposerContext.js";import{useScrollInfo as Cm,useThrottledEffect as xm,useTranslation as bm}from"@payloadcms/ui";import*as he from"react";import{useMemo as _m}from"react";import{jsx as om}from"react/jsx-runtime";import{mergeRegister as rm}from"@lexical/utils";import{$getSelection as nm}from"lexical";import{useCallback as im,useEffect as Ot,useState as $o}from"react";var Po="toolbar-popup__button",st=({children:t,editor:e,item:o})=>{let[n,r]=$o(!0),[i,l]=$o(!1),[s,a]=$o(Po),c=B(),d=im(()=>{e.getEditorState().read(()=>{let u=nm();if(u){if(o.isActive){let m=o.isActive({editor:e,editorConfigContext:c,selection:u});i!==m&&l(m)}if(o.isEnabled){let m=o.isEnabled({editor:e,editorConfigContext:c,selection:u});n!==m&&r(m)}}})},[i,e,c,n,o]);return Ot(()=>{d()},[d]),Ot(()=>(document.addEventListener("mouseup",d),()=>{document.removeEventListener("mouseup",d)}),[d]),Ot(()=>rm(e.registerUpdateListener(()=>{d()})),[e,d]),Ot(()=>{a([Po,n===!1?"disabled":"",i?"active":"",o?.key?`${Po}-`+o.key:""].filter(Boolean).join(" "))},[n,i,s,o.key]),om("button",{className:s,onClick:()=>{if(n!==!1)return e._updateTags=new Set(["toolbar",...e._updateTags]),e.focus(()=>{o.onSelect?.({editor:e,isActive:i})}),!0},onMouseDown:u=>{u.preventDefault()},type:"button",children:t})};import{c as Ji}from"react/compiler-runtime";import{jsx as Pe}from"react/jsx-runtime";import jo,{useEffect as Xi}from"react";import{mergeRegister as dm}from"@lexical/utils";import{useTranslation as mm}from"@payloadcms/ui";import{$getSelection as pm}from"lexical";import{jsx as we,jsxs as Ki}from"react/jsx-runtime";import{Button as lm}from"@payloadcms/ui";import $t,{useCallback as sm,useEffect as at,useMemo as am,useRef as Ho,useState as Pt}from"react";import{createPortal as cm}from"react-dom";var Bo="toolbar-popup__dropdown-item",zi=$t.createContext(null);function Zi({active:t,children:e,editor:o,enabled:n,Icon:r,item:i,tooltip:l}){let[s,a]=Pt(Bo);at(()=>{a([Bo,n===!1?"disabled":"",t?"active":"",i?.key?`${Bo}-${i.key}`:""].filter(Boolean).join(" "))},[n,t,s,i.key]);let c=Ho(null),d=$t.useContext(zi);if(d===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:u}=d;return at(()=>{c?.current!=null&&u(c)},[c,u]),we(lm,{"aria-label":l,buttonStyle:"none",className:s,disabled:n===!1,icon:r,iconPosition:"left",iconStyle:"none",onClick:()=>{n!==!1&&(o._updateTags=new Set(["toolbar",...o._updateTags]),o.focus(()=>{i.onSelect?.({editor:o,isActive:t})}))},onMouseDown:m=>{m.preventDefault()},ref:c,tooltip:l,type:"button",children:e})}function um({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:n}){let[r,i]=Pt(),[l,s]=Pt(),a=sm(u=>{i(m=>m!=null?[...m,u]:[u])},[i]),c=u=>{if(r==null)return;let{key:m}=u;["ArrowDown","ArrowUp","Escape","Tab"].includes(m)&&u.preventDefault(),m==="Escape"||m==="Tab"?n():m==="ArrowUp"?s(p=>{if(p==null)return r[0];let f=r.indexOf(p)-1;return r[f===-1?r.length-1:f]}):m==="ArrowDown"&&s(p=>p==null?r[0]:r[r.indexOf(p)+1])},d=am(()=>({registerItem:a}),[a]);return at(()=>{r!=null&&l==null&&s(r[0]),l!=null&&l?.current!=null&&l.current.focus()},[r,l]),we(zi.Provider,{value:d,children:we("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:c,ref:e,children:t})})}function Yi({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:n=!1,Icon:r,itemsContainerClassNames:i,label:l,stopCloseOnClickSelf:s}){let a=Ho(null),c=Ho(null),[d,u]=Pt(!1),m=()=>{u(!1),c?.current!=null&&c.current.focus()};at(()=>{let f=c.current,h=a.current;if(d&&f!==null&&h!==null){let{left:g,top:E}=f.getBoundingClientRect(),D=window.scrollY||document.documentElement.scrollTop;h.style.top=`${E+D+f.offsetHeight+5}px`,h.style.left=`${Math.min(g-5,window.innerWidth-h.offsetWidth-20)}px`}},[a,c,d]),at(()=>{let f=c.current;if(f!==null&&d){let h=g=>{let{target:E}=g;s!=null&&a.current!=null&&a.current.contains(E)||f.contains(E)||u(!1)};return document.addEventListener("click",h),()=>{document.removeEventListener("click",h)}}},[a,c,d,s]);let p=cm(we(um,{dropDownRef:a,itemsContainerClassNames:i,onClose:m,children:o}),document.body);return Ki($t.Fragment,{children:[Ki("button",{"aria-label":t,className:e+(d?" active":""),disabled:n,onClick:f=>{f.preventDefault(),u(!d)},onMouseDown:f=>{f.preventDefault()},ref:c,type:"button",children:[r&&we(r,{}),l&&we("span",{className:"toolbar-popup__dropdown-label",children:l}),we("i",{className:"toolbar-popup__dropdown-caret"})]}),d&&we($t.Fragment,{children:p})]})}var Go="toolbar-popup__dropdown",fm=t=>{let e=Ji(18),{active:o,anchorElem:n,editor:r,enabled:i,item:l}=t,{i18n:s}=mm(),{fieldProps:a}=B(),{featureClientSchemaMap:c,schemaPath:d}=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&&Pe(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,m;if(l.label){let f;e[6]!==l||e[7]!==c||e[8]!==s||e[9]!==d?(f=typeof l.label=="function"?l.label({featureClientSchemaMap:c,i18n:s,schemaPath:d}):l.label,e[6]=l,e[7]=c,e[8]=s,e[9]=d,e[10]=f):f=e[10],u=f}u.length>25?m=u.substring(0,25)+"...":m=u;let p;return e[11]!==l||e[12]!==m||e[13]!==o||e[14]!==r||e[15]!==i||e[16]!==u?(p=Pe(Zi,{active:o,editor:r,enabled:i,Icon:l?.ChildComponent?Pe(l.ChildComponent,{}):void 0,item:l,tooltip:u,children:Pe("span",{className:"text",children:m})},l.key),e[11]=l,e[12]=m,e[13]=o,e[14]=r,e[15]=i,e[16]=u,e[17]=p):p=e[17],p},Se=t=>{let e=Ji(42),{anchorElem:o,classNames:n,editor:r,group:i,Icon:l,itemsContainerClassNames:s,label:a,maxActiveItems:c,onActiveChange:d}=t,u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=[],e[0]=u):u=e[0];let[m,p]=jo.useState(u),f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f=[],e[1]=f):f=e[1];let[h,g]=jo.useState(f),[E,D]=jo.useState(!0),A=B(),{items:b,key:T}=i,C;e[2]!==r||e[3]!==b||e[4]!==c||e[5]!==A||e[6]!==i||e[7]!==d?(C=()=>{r.getEditorState().read(()=>{let $=pm();if(!$)return;let j=[],Q=[],U=[];for(let G of b)G.isActive&&(!c||j.length<c)&&G.isActive({editor:r,editorConfigContext:A,selection:$})&&(j.push(G.key),Q.push(G)),G.isEnabled?G.isEnabled({editor:r,editorConfigContext:A,selection:$})&&U.push(G.key):U.push(G.key);i.isEnabled&&D(i.isEnabled({editor:r,editorConfigContext:A,selection:$})),p(j),g(U),d&&d({activeItems:Q})})},e[2]=r,e[3]=b,e[4]=c,e[5]=A,e[6]=i,e[7]=d,e[8]=C):C=e[8];let k=C,S,w;e[9]!==k?(S=()=>{k()},w=[k],e[9]=k,e[10]=S,e[11]=w):(S=e[10],w=e[11]),Xi(S,w);let N,I;e[12]!==r||e[13]!==k?(N=()=>dm(r.registerUpdateListener(()=>{k()})),I=[r,k],e[12]=r,e[13]=k,e[14]=N,e[15]=I):(N=e[14],I=e[15]),Xi(N,I);let x=`${T} dropdown`,_=`${Go}-${T}`,R;e[16]!==n?(R=n||[],e[16]=n,e[17]=R):R=e[17];let L;e[18]!==_||e[19]!==R?(L=[Go,_,...R].filter(Boolean),e[18]=_,e[19]=R,e[20]=L):L=e[20];let M=L.join(" "),v=!E,F;e[21]!==s?(F=s||[],e[21]=s,e[22]=F):F=e[22];let H;if(e[23]!==F||e[24]!==b||e[25]!==m||e[26]!==o||e[27]!==r||e[28]!==h||e[29]!==x||e[30]!==M||e[31]!==v||e[32]!==l||e[33]!==a||e[34]!==T){let $;e[36]!==b||e[37]!==m||e[38]!==o||e[39]!==r||e[40]!==h?($=b.length&&b.map(j=>Pe(fm,{active:m.includes(j.key),anchorElem:o,editor:r,enabled:h.includes(j.key),item:j},j.key)),e[36]=b,e[37]=m,e[38]=o,e[39]=r,e[40]=h,e[41]=$):$=e[41],H=Pe(Yi,{buttonAriaLabel:x,buttonClassName:M,disabled:v,Icon:l,itemsContainerClassNames:[`${Go}-items`,...F],label:a,children:$},T),e[23]=F,e[24]=b,e[25]=m,e[26]=o,e[27]=r,e[28]=h,e[29]=x,e[30]=M,e[31]=v,e[32]=l,e[33]=a,e[34]=T,e[35]=H}else H=e[35];return H};function Tm({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&ne(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?ne(st,{editor:e,item:o,children:ne(o.ChildComponent,{})},o.key):null}function wm(t){let e=qi(26),{anchorElem:o,editor:n,editorConfig:r,group:i,index:l}=t,{i18n:s}=bm(),{fieldProps:a}=B(),{featureClientSchemaMap:c,schemaPath:d}=a,[u,m]=he.useState(void 0),[p,f]=he.useState(void 0),h,g;e[0]!==i?(h=()=>{i?.type==="dropdown"&&i.items.length&&i.ChildComponent?f(()=>i.ChildComponent):f(void 0)},g=[i],e[0]=i,e[1]=h,e[2]=g):(h=e[1],g=e[2]),he.useEffect(h,g);let E;e[3]!==i||e[4]!==c||e[5]!==s||e[6]!==d?(E=k=>{let{activeItems:S}=k;if(!S.length){i?.type==="dropdown"&&i.items.length&&i.ChildComponent?(f(()=>i.ChildComponent),m(void 0)):(f(void 0),m(void 0));return}let w=S[0],N=w.key;w.label&&(N=typeof w.label=="function"?w.label({featureClientSchemaMap:c,i18n:s,schemaPath:d}):w.label),N.length>25&&(N=N.substring(0,25)+"..."),m(N),f(()=>w.ChildComponent)},e[3]=i,e[4]=c,e[5]=s,e[6]=d,e[7]=E):E=e[7];let D=E,A=`fixed-toolbar__group fixed-toolbar__group-${i.key}`,b;e[8]!==i||e[9]!==p||e[10]!==o||e[11]!==n||e[12]!==u||e[13]!==D?(b=i.type==="dropdown"&&i.items.length&&(p?ne(Se,{anchorElem:o,editor:n,group:i,Icon:p,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:u,maxActiveItems:1,onActiveChange:D}):ne(Se,{anchorElem:o,editor:n,group:i,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:u,maxActiveItems:1,onActiveChange:D})),e[8]=i,e[9]=p,e[10]=o,e[11]=n,e[12]=u,e[13]=D,e[14]=b):b=e[14];let T;e[15]!==i||e[16]!==o||e[17]!==n?(T=i.type==="buttons"&&i.items.length&&i.items.map(k=>ne(Tm,{anchorElem:o,editor:n,item:k},k.key)),e[15]=i,e[16]=o,e[17]=n,e[18]=T):T=e[18];let C;return e[19]!==r.features.toolbarFixed||e[20]!==l||e[21]!==b||e[22]!==T||e[23]!==A||e[24]!==i.key?(C=hm("div",{className:A,children:[b,T,l<r.features.toolbarFixed?.groups.length-1&&ne("div",{className:"divider"})]},i.key),e[19]=r.features.toolbarFixed,e[20]=l,e[21]=b,e[22]=T,e[23]=A,e[24]=i.key,e[25]=C):C=e[25],C}function Em({anchorElem:t,clientProps:e,editor:o,editorConfig:n,parentWithFixedToolbar:r}){let i=he.useRef(null),{y:l}=Cm(),s=_m(()=>{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 xm(()=>{if(!s)return;let a=i.current;if(!a)return;let c=a.getBoundingClientRect(),d=s.getBoundingClientRect();if(!(c.bottom<d.top||c.top>d.bottom))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]),ne("div",{className:"fixed-toolbar",onFocus:a=>{a.stopPropagation()},ref:i,children:o.isEditable()&&ne(he.Fragment,{children:n?.features&&n.features?.toolbarFixed?.groups.map((a,c)=>ne(wm,{anchorElem:t,editor:o,editorConfig:n,group:a,index:c},a.key))})})}var Qi=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return Qi(t.parentEditor)}return!1},el=t=>{let e=qi(7),{anchorElem:o,clientProps:n}=t,[r]=gm(),i=B(),{editorConfig:l}=i,s=n.applyToFocusedEditor&&i.focusedEditor?.editor||r,a=n.applyToFocusedEditor&&i.focusedEditor?.editorConfig||l,c,d;if(e[0]!==i||e[1]!==n?.disableIfParentHasFixedToolbar||e[2]!==a||e[3]!==o||e[4]!==s){d=Symbol.for("react.early_return_sentinel");e:{let u=Qi(i);if(n?.disableIfParentHasFixedToolbar&&u){d=null;break e}if(!a?.features?.toolbarFixed?.groups?.length){d=null;break e}c=ne(Em,{anchorElem:o,editor:s,editorConfig:a,parentWithFixedToolbar:u})}e[0]=i,e[1]=n?.disableIfParentHasFixedToolbar,e[2]=a,e[3]=o,e[4]=s,e[5]=c,e[6]=d}else c=e[5],d=e[6];return d!==Symbol.for("react.early_return_sentinel")?d:c};var km=y({plugins:[{Component:el,position:"aboveContainer"}]});import{c as rl}from"react/compiler-runtime";import{jsx as le,jsxs as nl}from"react/jsx-runtime";import{useLexicalComposerContext as Nm}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as il}from"@lexical/utils";import{$getSelection as ll,$isRangeSelection as tl,$isTextNode as Lm,COMMAND_PRIORITY_LOW as Im,SELECTION_CHANGE_COMMAND as Sm}from"lexical";import{useCallback as Ht,useEffect as ct,useRef as ol,useState as Rm}from"react";import*as jt from"react";import{createPortal as ym}from"react-dom";function Uo(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,d=o.parentElement;if(a===null||d==null){r.style.opacity="0",r.style.transform="translate(-10000px, -10000px)";return}let u=r.getBoundingClientRect(),m=o.getBoundingClientRect(),p=d.getBoundingClientRect(),f=a.top-u.height-c,h=a.left-i;l==="center"&&(h=a.left+a.width/2-u.width/2);let g=0;return!e&&f<p.top&&!s&&(g=u.height+a.height+c*2,f+=g),l==="center"?h+u.width>p.right?h=p.right-u.width-i:h<p.left&&(h=p.left+i):h+u.width>p.right&&(h=p.right-u.width-i),h-=m.left,r.style.opacity="1",s&&n!==0?(f-=m.bottom-n+u.height-3,r.style.transform=`translate(${h}px, ${f}px) rotate(180deg)`):(f-=m.top,r.style.transform=`translate(${h}px, ${f}px)`),g}function vm({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&le(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?le(st,{editor:e,item:o,children:le(o.ChildComponent,{})},o.key):null}function Mm(t){let e=rl(22),{anchorElem:o,editor:n,group:r,index:i}=t,{editorConfig:l}=B(),[s,a]=jt.useState(),c,d;e[0]!==r?(c=()=>{r?.type==="dropdown"&&r.items.length&&r.ChildComponent?a(()=>r.ChildComponent):a(void 0)},d=[r],e[0]=r,e[1]=c,e[2]=d):(c=e[1],d=e[2]),jt.useEffect(c,d);let u;e[3]!==r?(u=E=>{let{activeItems:D}=E;if(!D.length){r?.type==="dropdown"&&r.items.length&&r.ChildComponent?a(()=>r.ChildComponent):a(void 0);return}let A=D[0];a(()=>A.ChildComponent)},e[3]=r,e[4]=u):u=e[4];let m=u,p=`inline-toolbar-popup__group inline-toolbar-popup__group-${r.key}`,f;e[5]!==r||e[6]!==s||e[7]!==o||e[8]!==n||e[9]!==m?(f=r.type==="dropdown"&&r.items.length&&(s?le(Se,{anchorElem:o,editor:n,group:r,Icon:s,maxActiveItems:1,onActiveChange:m}):le(Se,{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]=f):f=e[10];let h;e[11]!==r||e[12]!==o||e[13]!==n?(h=r.type==="buttons"&&r.items.length&&r.items.map(E=>le(vm,{anchorElem:o,editor:n,item:E},E.key)),e[11]=r,e[12]=o,e[13]=n,e[14]=h):h=e[14];let g;return e[15]!==l.features.toolbarInline||e[16]!==i||e[17]!==f||e[18]!==h||e[19]!==p||e[20]!==r.key?(g=nl("div",{className:p,children:[f,h,i<l.features.toolbarInline?.groups.length-1&&le("div",{className:"divider"})]},r.key),e[15]=l.features.toolbarInline,e[16]=i,e[17]=f,e[18]=h,e[19]=p,e[20]=r.key,e[21]=g):g=e[21],g}function Dm({anchorElem:t,editor:e}){let o=ol(null),n=ol(null),{editorConfig:r}=B(),i=Ht(()=>{if(o?.current){let c=o.current.style.opacity==="0",d=o.current.style.pointerEvents==="none";c||(o.current.style.opacity="0"),d||(o.current.style.pointerEvents="none")}},[o]),l=Ht(c=>{if(o?.current&&(c.buttons===1||c.buttons===3)){let d=o.current.style.opacity==="0",u=o.current.style.pointerEvents==="none";if(!d||!u){let m=c.clientX,p=c.clientY,f=document.elementFromPoint(m,p);o.current.contains(f)||i()}}},[i]),s=Ht(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);ct(()=>(document.addEventListener("mousemove",l),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",s)}),[o,l,s]);let a=Ht(()=>{let c=ll(),d=window.getSelection();if(o.current===null)return;let u=t.querySelector(":scope > .link-editor"),m=u!==null&&"style"in u&&u?.style?.opacity==="1",p=e.getRootElement();if(c!==null&&d!==null&&!d.isCollapsed&&p!==null&&p.contains(d.anchorNode)){let f=Uo(d,p),h=Bt({alwaysDisplayOnTop:m,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});n.current&&Bt({anchorElem:o.current,anchorFlippedOffset:h,floatingElem:n.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else i()},[e,i,t]);return ct(()=>{let c=t.parentElement,d=()=>{e.getEditorState().read(()=>{a()})};return window.addEventListener("resize",d),c&&c.addEventListener("scroll",d),()=>{window.removeEventListener("resize",d),c&&c.removeEventListener("scroll",d)}},[e,a,t]),ct(()=>(e.getEditorState().read(()=>{a()}),il(e.registerUpdateListener(({editorState:c})=>{c.read(()=>{a()})}),e.registerCommand(Sm,()=>(a(),!1),Im))),[e,a]),nl("div",{className:"inline-toolbar-popup",ref:o,children:[le("div",{className:"caret",ref:n}),r?.features&&r.features?.toolbarInline?.groups.map((c,d)=>le(Mm,{anchorElem:t,editor:e,group:c,index:d},c.key))]})}function Am(t,e){let o=rl(12),[n,r]=Rm(!1),i;o[0]!==t?(i=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let m=ll(),p=window.getSelection(),f=t.getRootElement();if(p!==null&&(!tl(m)||f===null||!f.contains(p.anchorNode))){r(!1);return}if(!tl(m))return;if(m.getTextContent()!==""){let g=m.getNodes(),E=!1;for(let D of g)if(Lm(D)){r(!0),E=!0;break}E||r(!1)}else r(!1);let h=m.getTextContent().replace(/\n/g,"");if(!m.isCollapsed()&&h===""){r(!1);return}})},o[0]=t,o[1]=i):i=o[1];let l=i,s,a;o[2]!==l?(s=()=>(document.addEventListener("selectionchange",l),document.addEventListener("mouseup",l),()=>{document.removeEventListener("selectionchange",l),document.removeEventListener("mouseup",l)}),a=[l],o[2]=l,o[3]=s,o[4]=a):(s=o[3],a=o[4]),ct(s,a);let c,d;if(o[5]!==t||o[6]!==l?(c=()=>il(t.registerUpdateListener(()=>{l()}),t.registerRootListener(()=>{t.getRootElement()===null&&r(!1)})),d=[t,l],o[5]=t,o[6]=l,o[7]=c,o[8]=d):(c=o[7],d=o[8]),ct(c,d),!n||!t.isEditable())return null;let u;return o[9]!==e||o[10]!==t?(u=ym(le(Dm,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=u):u=o[11],u}var sl=t=>{let{anchorElem:e}=t,[o]=Nm();return Am(o,e)};var Fm=y({plugins:[{Component:sl,position:"floatingAnchorElem"}]});import{TableCellNode as of,TableNode as rf,TableRowNode as nf}from"@lexical/table";import{jsx as al}from"react/jsx-runtime";import"react";var Wo=()=>al("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:al("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{c as $m}from"react/compiler-runtime";import{jsx as P,jsxs as ge}from"react/jsx-runtime";import{useLexicalComposerContext as ml}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Pm}from"@lexical/react/useLexicalEditable";import{$deleteTableColumn__EXPERIMENTAL as Bm,$deleteTableRow__EXPERIMENTAL as Hm,$getNodeTriplet as jm,$getTableCellNodeFromLexicalNode as Gm,$getTableColumnIndexFromTableCellNode as Um,$getTableNodeFromLexicalNodeOrThrow as ut,$getTableRowIndexFromTableCellNode as Wm,$insertTableColumn__EXPERIMENTAL as Vm,$insertTableRow__EXPERIMENTAL as Km,$isTableCellNode as Gt,$isTableRowNode as ul,$isTableSelection as Wt,$unmergeCell as zm,getTableObserverFromTableElement as Zm,TableCellHeaderStates as Ee,TableCellNode as Ym}from"@lexical/table";import{useScrollInfo as Xm}from"@payloadcms/ui";import{$createParagraphNode as Jm,$getRoot as qm,$getSelection as Vt,$isElementNode as Qm,$isParagraphNode as pl,$isRangeSelection as zo,$isTextNode as ep}from"lexical";import*as Zo from"react";import{useCallback as se,useEffect as Re,useRef as Ut,useState as Be}from"react";import{createPortal as fl}from"react-dom";import{jsx as Vo,jsxs as Om}from"react/jsx-runtime";import"react";var cl=()=>Om("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[Vo("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"}),Vo("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"}),Vo("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 Ko(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function tp(){let t=Vt();if(zo(t)&&!t.isCollapsed()||Wt(t)&&!t.anchor.is(t.focus)||!zo(t)&&!Wt(t))return!1;let[e]=jm(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function dl(t){if(t.getChildrenSize()!==1)return!1;let e=t.getFirstChildOrThrow();return!(!pl(e)||!e.isEmpty())}function op(t){let e=t.getLastDescendant();ep(e)?e.select():Qm(e)?e.selectEnd():e!==null&&e.selectNext()}function rp({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:n,tableCellNode:r}){let[i]=ml(),l=Ut(null),[s,a]=Be(r),[c,d]=Be({columns:1,rows:1}),[u,m]=Be(!1),[p,f]=Be(!1),{y:h}=Xm();Re(()=>i.registerMutationListener(Ym,x=>{x.get(s.getKey())==="updated"&&i.getEditorState().read(()=>{a(s.getLatest())})},{skipInitialization:!0}),[i,s]),Re(()=>{i.getEditorState().read(()=>{let x=Vt();if(Wt(x)){let _=Ko(x);d(Ko(x)),m(_.columns>1||_.rows>1)}f(tp())})},[i]),Re(()=>{let x=e.current,_=l.current,R=i.getRootElement();if(x!=null&&_!=null&&R!=null){let L=R.getBoundingClientRect(),M=x.getBoundingClientRect();_.style.opacity="1";let v=_.getBoundingClientRect(),F=5,H=M.right+F;if(H+v.width>window.innerWidth||H+v.width>L.right){let j=M.left-v.width-F;H=(j<0?F:j)+window.pageXOffset}_.style.left=`${H+window.pageXOffset}px`;let $=M.top;if($+v.height>window.innerHeight){let j=M.bottom-v.height;$=(j<0?F:j)+window.pageYOffset}_.style.top=`${$}px`}},[e,l,i,h]),Re(()=>{function x(_){l.current!=null&&e.current!=null&&!l.current.contains(_.target)&&!e.current.contains(_.target)&&n(!1)}return window.addEventListener("click",x),()=>window.removeEventListener("click",x)},[n,e]);let g=se(()=>{i.update(()=>{if(s.isAttached()){let _=ut(s),R=i.getElementByKey(_.getKey());if(!R)throw new Error("Expected to find tableElement in DOM");let L=Zm(R);L!==null&&L.clearHighlight(),_.markDirty(),a(s.getLatest())}qm().selectStart()})},[i,s]),E=()=>{i.update(()=>{let x=Vt();if(Wt(x)){let{columns:_,rows:R}=Ko(x),L=x.getNodes(),M=null;for(let v=0;v<L.length;v++){let F=L[v];if(Gt(F))if(M===null){F.setColSpan(_).setRowSpan(R),M=F;let H=dl(F),$;H&&pl($=F.getFirstChild())&&$.remove()}else Gt(M)&&(dl(F)||M.append(...F.getChildren()),F.remove())}M!==null&&(M.getChildrenSize()===0&&M.append(Jm()),op(M)),o()}})},D=()=>{i.update(()=>{zm()})},A=se(x=>{i.update(()=>{Km(x),o()})},[i,o]),b=se(x=>{i.update(()=>{for(let _=0;_<c.columns;_++)Vm(x);o()})},[i,o,c.columns]),T=se(()=>{i.update(()=>{Hm(),o()})},[i,o]),C=se(()=>{i.update(()=>{ut(s).remove(),g(),o()})},[i,s,g,o]),k=se(()=>{i.update(()=>{Bm(),o()})},[i,o]),S=se(()=>{i.update(()=>{let x=ut(s),_=Wm(s),R=x.getChildren();if(_>=R.length||_<0)throw new Error("Expected table cell to be inside of table row.");let L=R[_];if(!ul(L))throw new Error("Expected table row");let M=s.getHeaderStyles()^Ee.ROW;L.getChildren().forEach(v=>{if(!Gt(v))throw new Error("Expected table cell");v.setHeaderStyles(M,Ee.ROW)}),g(),o()})},[i,s,g,o]),w=se(()=>{i.update(()=>{let x=ut(s),_=Um(s),R=x.getChildren(),L=Math.max(...R.map(v=>v.getChildren().length));if(_>=L||_<0)throw new Error("Expected table cell to be inside of table row.");let M=s.getHeaderStyles()^Ee.COLUMN;for(let v=0;v<R.length;v++){let F=R[v];if(!ul(F))throw new Error("Expected table row");let H=F.getChildren();if(_>=H.length)continue;let $=H[_];if(!Gt($))throw new Error("Expected table cell");$.setHeaderStyles(M,Ee.COLUMN)}g(),o()})},[i,s,g,o]),N=se(()=>{i.update(()=>{if(s.isAttached()){let x=ut(s);x&&x.setRowStriping(!x.getRowStriping())}g(),o()})},[i,s,g,o]),I=null;return t&&(u?I=P("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>E(),type:"button",children:"Merge cells"}):p&&(I=P("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>D(),type:"button",children:"Unmerge cells"}))),fl(ge("div",{className:"table-action-menu-dropdown",onClick:x=>{x.stopPropagation()},ref:l,children:[I?ge(Zo.Fragment,{children:[I,P("hr",{})]}):null,P("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>N(),type:"button",children:P("span",{className:"text",children:"Toggle Row Striping"})}),P("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>A(!1),type:"button",children:ge("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:()=>A(!0),type:"button",children:ge("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," below"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>b(!1),type:"button",children:ge("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","left"]})}),P("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>b(!0),type:"button",children:ge("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:()=>k(),type:"button",children:P("span",{className:"text",children:"Delete column"})}),P("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>T(),type:"button",children:P("span",{className:"text",children:"Delete row"})}),P("button",{className:"item","data-test-id":"table-delete",onClick:()=>C(),type:"button",children:P("span",{className:"text",children:"Delete table"})}),P("hr",{}),P("button",{className:"item",onClick:()=>S(),type:"button",children:ge("span",{className:"text",children:[(s.__headerState&Ee.ROW)===Ee.ROW?"Remove":"Add"," ","row header"]})}),P("button",{className:"item","data-test-id":"table-column-header",onClick:()=>w(),type:"button",children:ge("span",{className:"text",children:[(s.__headerState&Ee.COLUMN)===Ee.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function np({anchorElem:t,cellMerge:e}){let[o]=ml(),n=Ut(null),r=Ut(null),[i,l]=Be(!1),[s,a]=Be(null),c=se(()=>{let u=n.current,m=Vt(),p=window.getSelection(),f=document.activeElement;if(m==null||u==null){a(null);return}let h=o.getRootElement();if(zo(m)&&h!==null&&p!==null&&h.contains(p.anchorNode)){let g=Gm(m.anchor.getNode());if(g==null){a(null);return}if(o.getElementByKey(g.getKey())==null){a(null);return}a(g)}else f||a(null)},[o]);Re(()=>o.registerUpdateListener(()=>{o.getEditorState().read(()=>{c()})})),Re(()=>{let u=n.current;if(u!=null&&s!=null){let m=o.getElementByKey(s.getKey());if(m!=null){let p=m.getBoundingClientRect(),f=u.getBoundingClientRect(),h=t.getBoundingClientRect(),g=p.top-h.top+4,E=p.right-f.width-10-h.left;u.style.opacity="1",u.style.transform=`translate(${E}px, ${g}px)`}else u.style.opacity="0",u.style.transform="translate(-10000px, -10000px)"}},[n,s,o,t]);let d=Ut(s);return Re(()=>{d.current!==s&&l(!1),d.current=s},[d,s]),P("div",{className:"table-cell-action-button-container",ref:n,children:s!=null&&ge(Zo.Fragment,{children:[P("button",{className:"table-cell-action-button",onClick:u=>{u.stopPropagation(),l(!i)},ref:r,type:"button",children:P(cl,{})}),i&&P(rp,{cellMerge:e,contextRef:r,onClose:()=>l(!1),setIsMenuOpen:l,tableCellNode:s})]})})}var hl=t=>{let e=$m(3),{anchorElem:o}=t,n=Pm(),r;return e[0]!==n||e[1]!==o?(r=fl(n?P(np,{anchorElem:o??document.body,cellMerge:!0}):null,o??document.body),e[0]=n,e[1]=o,e[2]=r):r=e[2],r};import{c as ip}from"react/compiler-runtime";import{jsx as Zt,jsxs as lp}from"react/jsx-runtime";import{useLexicalComposerContext as sp}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as ap}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as cp,$getTableNodeFromLexicalNodeOrThrow as Yo,$getTableRowIndexFromTableCellNode as up,$isTableCellNode as gl,$isTableRowNode as dp,getDOMCellFromTarget as mp,TableNode as pp}from"@lexical/table";import{calculateZoomLevel as Cl}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Xo}from"lexical";import*as _l from"react";import{useCallback as He,useEffect as xl,useRef as Kt,useState as zt}from"react";import{createPortal as fp}from"react-dom";var hp=33,bl=92;function gp({editor:t}){let e=Kt(null),o=Kt(null),n=Kt(null),r=B(),i=Kt(null),[l,s]=zt(null),[a,c]=zt(null),[d,u]=zt(!1),[m,p]=zt(null),f=He(()=>{c(null),e.current=null,p(null),i.current=null,n.current=null},[]),h=w=>(w.buttons&1)===1;xl(()=>t.registerNodeTransform(pp,w=>{if(w.getColWidths())return w;let N=w.getColumnCount(),I=bl;return w.setColWidths(Array(N).fill(I)),w}),[t]),xl(()=>{let w=_=>{setTimeout(()=>{let R=_.target;if(m){s({x:_.clientX,y:_.clientY});return}if(u(h(_)),!(o.current&&o.current.contains(R))&&e.current!==R){e.current=R;let L=mp(R);L&&a!==L?t.update(()=>{let M=Xo(L.elem);if(!M)throw new Error("TableCellResizer: Table cell node not found.");let v=Yo(M),F=t.getElementByKey(v.getKey());if(!F)throw new Error("TableCellResizer: Table element not found.");e.current=R,n.current=F.getBoundingClientRect(),c(L)}):L==null&&f()}},0)},N=_=>{setTimeout(()=>{u(!0)},0)},I=_=>{setTimeout(()=>{u(!1)},0)},x=t.registerRootListener((_,R)=>{R?.removeEventListener("mousemove",w),R?.removeEventListener("mousedown",N),R?.removeEventListener("mouseup",I),_?.addEventListener("mousemove",w),_?.addEventListener("mousedown",N),_?.addEventListener("mouseup",I)});return()=>{x()}},[a,m,t,f]);let g=w=>w==="bottom",E=He(w=>{if(!a)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let N=Xo(a.elem);if(!gl(N))throw new Error("TableCellResizer: Table cell node not found.");let I=Yo(N),x=up(N)+N.getRowSpan()-1,_=I.getChildren();if(x>=_.length||x<0)throw new Error("Expected table cell to be inside of table row.");let R=_[x];if(!dp(R))throw new Error("Expected table row");let L=R.getHeight();if(L===void 0){let v=R.getChildren();L=Math.min(...v.map(F=>D(F,t)??1/0))}let M=Math.max(L+w,hp);R.setHeight(M)},{tag:"skip-scroll-into-view"})},[a,t]),D=(w,N)=>N.getElementByKey(w.getKey())?.clientHeight,A=(w,N)=>{for(let I=0;I<N.length;I++)for(let x=0;x<N[I].length;x++)if(N[I][x].cell===w)return x},b=He(w=>{if(!a)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let N=Xo(a.elem);if(!gl(N))throw new Error("TableCellResizer: Table cell node not found.");let I=Yo(N),[x]=cp(I,null,null),_=A(N,x);if(_===void 0)throw new Error("TableCellResizer: Table column not found.");let R=I.getColWidths();if(!R)return;let L=R[_];if(L===void 0)return;let M=[...R],v=Math.max(L+w,bl);M[_]=v,I.setColWidths(M)},{tag:"skip-scroll-into-view"})},[a,t]),T=He(w=>{let N=I=>{if(I.preventDefault(),I.stopPropagation(),!a)throw new Error("TableCellResizer: Expected active cell.");if(i.current){let{x,y:_}=i.current;if(a===null)return;let R=Cl(I.target);if(g(w)){let L=(I.clientY-_)/R;E(L)}else{let L=(I.clientX-x)/R;b(L)}f(),document.removeEventListener("mouseup",N)}};return N},[a,f,b,E]),C=He(w=>N=>{if(N.preventDefault(),N.stopPropagation(),!a)throw new Error("TableCellResizer: Expected active cell.");i.current={x:N.clientX,y:N.clientY},s(i.current),p(w),document.addEventListener("mouseup",T(w))},[a,T]),S=He(()=>{if(a){let{height:w,left:N,top:I,width:x}=a.elem.getBoundingClientRect(),_=Cl(a.elem),R=10,L={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${R}px`,left:`${window.pageXOffset+N}px`,top:`${window.pageYOffset+I+w-R/2}px`,width:`${x}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${w}px`,left:`${window.pageXOffset+N+x-R/2}px`,top:`${window.pageYOffset+I}px`,width:`${R}px`}},M=n.current;return m&&l&&M&&(g(m)?(L[m].left=`${window.pageXOffset+M.left}px`,L[m].top=`${window.pageYOffset+l.y/_}px`,L[m].height="3px",L[m].width=`${M.width}px`):(L[m].top=`${window.pageYOffset+M.top}px`,L[m].left=`${window.pageXOffset+l.x/_}px`,L[m].width="3px",L[m].height=`${M.height}px`),L[m].backgroundColor="#adf"),L}return{bottom:null,left:null,right:null,top:null}},[a,m,l])();return Zt("div",{ref:o,children:a!=null&&!d&&lp(_l.Fragment,{children:[Zt("div",{className:`${r.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:C("right"),style:S.right||void 0}),Zt("div",{className:`${r.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:C("bottom"),style:S.bottom||void 0})]})})}var Tl=()=>{let t=ip(3),[e]=sp(),o=ap(),n,r;return t[0]!==o||t[1]!==e?(r=o?fp(Zt(gp,{editor:e}),document.body):null,t[0]=o,t[1]=e,t[2]=r):r=t[2],n=r,n};import{c as Ep}from"react/compiler-runtime";import{jsx as Jo,jsxs as kp,Fragment as Np}from"react/jsx-runtime";import{useLexicalComposerContext as Rl}from"@lexical/react/LexicalComposerContext";import{$getTableColumnIndexFromTableCellNode as Lp,$getTableRowIndexFromTableCellNode as Ip,$insertTableColumn__EXPERIMENTAL as Sp,$insertTableRow__EXPERIMENTAL as Rp,$isTableCellNode as yp,$isTableNode as kl,TableNode as vp}from"@lexical/table";import{$findMatchingParent as Mp,mergeRegister as Dp}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Nl}from"lexical";import{useEffect as Ll,useMemo as Ap,useRef as Il,useState as Yt}from"react";import"react";import{createPortal as Fp}from"react-dom";import{useMemo as Tp,useRef as wp}from"react";var Cp="Expected a function",xp=Math.max,bp=Math.min;function _p(t,e,o){let n,r,i=0,l,s=!1,a=!1,c,d,u,m=!0;if(typeof t!="function")throw new TypeError(Cp);e=e||0,typeof o=="object"&&(s=!!o.leading,a="maxWait"in o,c=a?xp(o.maxWait||0,e):c,m="trailing"in o?!!o.trailing:m);function p(C){let k=n,S=l;return n=l=void 0,i=C,d=t.apply(S,k),d}function f(C){return i=C,u=setTimeout(E,e),s?p(C):d}function h(C){let k=C-r,S=C-i,w=e-k;return a?bp(w,c-S):w}function g(C){let k=C-r,S=C-i;return r===void 0||k>=e||k<0||a&&S>=c}function E(){let C=Date.now();if(g(C))return D(C);u=setTimeout(E,h(C))}function D(C){return u=void 0,m&&n?p(C):(n=l=void 0,d)}function A(){u!==void 0&&clearTimeout(u),i=0,n=r=l=u=void 0}function b(){return u===void 0?d:D(Date.now())}function T(){let C=Date.now(),k=g(C);if(n=arguments,l=this,r=C,k){if(u===void 0)return f(r);if(a)return clearTimeout(u),u=setTimeout(E,e),p(r)}return u===void 0&&(u=setTimeout(E,e)),d}return T.cancel=A,T.flush=b,T}var wl=_p;function El(t,e,o){let n=wp(null);return n.current=t,Tp(()=>wl((...r)=>{n.current&&n.current(...r)},e,{maxWait:o}),[e,o])}var Sl=20;function Op({anchorElem:t}){let[e]=Rl(),o=B(),[n,r]=Yt(!1),[i,l]=Yt(!1),[s,a]=Yt(!1),[c,d]=Yt({}),u=Il(new Set),m=Il(null),p=El(g=>{let{isOutside:E,tableDOMNode:D}=$p(g,o.editorConfig?.lexical);if(E){r(!1),l(!1);return}if(!D)return;m.current=D;let A=null,b=null,T=null;if(e.update(()=>{let C=Nl(D);if(yp(C)){let k=Mp(C,S=>kl(S));if(!kl(k))return;if(T=e.getElementByKey(k?.getKey()),T){let S=k.getChildrenSize(),w=k.getChildAtIndex(0)?.getChildrenSize(),N=Ip(C),I=Lp(C);N===S-1?A=C:I===w-1&&(b=C)}}}),T){let{bottom:C,height:k,left:S,right:w,width:N,y:I}=T.getBoundingClientRect(),{left:x,y:_}=t.getBoundingClientRect();A?(l(!1),r(!0),d({height:Sl,left:S-x,top:C-_+5,width:N})):b&&(l(!0),r(!1),d({height:k,left:w-x+5,top:I-_,width:Sl}))}},50,250),f=Ap(()=>new ResizeObserver(()=>{r(!1),l(!1)}),[]);Ll(()=>{if(s)return document.addEventListener("mousemove",p),()=>{r(!1),l(!1),document.removeEventListener("mousemove",p)}},[s,p]),Ll(()=>Dp(e.registerMutationListener(vp,g=>{e.getEditorState().read(()=>{for(let[E,D]of g){let A=e.getElementByKey(E);switch(D){case"created":u.current.add(E),a(u.current.size>0),A&&f.observe(A);break;case"destroyed":u.current.delete(E),a(u.current.size>0),f.disconnect(),u.current.forEach(b=>{let T=e.getElementByKey(b);T&&f.observe(T)});break;default:break}}})},{skipInitialization:!1})),[e,f]);let h=g=>{e.update(()=>{m.current&&(Nl(m.current)?.selectEnd(),g?(Rp(),r(!1)):(Sp(),l(!1)))})};return e?.isEditable()?kp(Np,{children:[n&&Jo("button",{className:o.editorConfig.lexical.theme.tableAddRows,onClick:()=>h(!0),style:{...c}}),i&&Jo("button",{className:o.editorConfig.lexical.theme.tableAddColumns,onClick:()=>h(!1),style:{...c}})]}):null}function $p(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 yl(t){let e=Ep(2),{anchorElem:o}=t,n=o===void 0?document.body:o,[r]=Rl();if(!r?.isEditable())return null;let i;return e[0]!==n?(i=Fp(Jo(Op,{anchorElem:n}),n),e[0]=n,e[1]=i):i=e[1],i}import{c as Pp}from"react/compiler-runtime";import{jsx as qo,jsxs as Bp}from"react/jsx-runtime";import{useLexicalComposerContext as Hp}from"@lexical/react/LexicalComposerContext";import{TablePlugin as jp}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as Gp,TableNode as Up}from"@lexical/table";import{mergeRegister as Wp}from"@lexical/utils";import{formatDrawerSlug as Vp,useEditDepth as Kp}from"@payloadcms/ui";import{$getSelection as zp,$isRangeSelection as Zp,COMMAND_PRIORITY_EDITOR as Yp,createCommand as Xp}from"lexical";import{createContext as Jp,useContext as qp,useEffect as Qp,useMemo as ef,useState as tf}from"react";import*as vl from"react";var Xt=Xp("OPEN_EMBED_DRAWER_COMMAND"),Ml=Jp({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function Dl({children:t}){let[e,o]=tf({cellEditorConfig:null,cellEditorPlugins:null});return qo(Ml.Provider,{value:ef(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(n,r)=>{o({cellEditorConfig:n,cellEditorPlugins:r})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var Al=()=>{let t=Pp(16),[e]=Hp(),o=qp(Ml),n=Kp(),{fieldProps:r,uuid:i}=B(),{schemaPath:l}=r,s="lexical-table-create-"+i,a;t[0]!==s||t[1]!==n?(a=Vp({slug:s,depth:n}),t[0]=s,t[1]=n,t[2]=a):a=t[2];let c=a,{toggleDrawer:d}=be(c,!0),u;t[3]!==e||t[4]!==d?(u=()=>{if(!e.hasNodes([Up]))throw new Error("TablePlugin: TableNode is not registered on editor");return Wp(e.registerCommand(Xt,()=>{let h;return h=null,e.getEditorState().read(()=>{let g=zp();Zp(g)&&(h=g)}),h&&d(),!0},Yp))},t[3]=e,t[4]=d,t[5]=u):u=t[5];let m;t[6]!==o||t[7]!==e||t[8]!==d?(m=[o,e,d],t[6]=o,t[7]=e,t[8]=d,t[9]=m):m=t[9],Qp(u,m);let p;t[10]!==e?(p=(h,g)=>{!g.columns||!g.rows||e.dispatchCommand(Gp,{columns:String(g.columns),rows:String(g.rows)})},t[10]=e,t[11]=p):p=t[11];let f;return t[12]!==c||t[13]!==p||t[14]!==l?(f=Bp(vl.Fragment,{children:[qo(Ge,{drawerSlug:c,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:p,schemaPath:l,schemaPathSuffix:"fields"}),qo(jp,{hasCellBackgroundColor:!1,hasCellMerge:!0})]}),t[12]=c,t[13]=p,t[14]=l,t[15]=f):f=t[15],f};var lf=y({nodes:[rf,of,nf],plugins:[{Component:Al,position:"normal"},{Component:Tl,position:"normal"},{Component:hl,position:"floatingAnchorElem"},{Component:yl,position:"floatingAnchorElem"}],providers:[Dl],slashMenu:{groups:[K([{Icon:Wo,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Xt,{})}}])]},toolbarFixed:{groups:[ue([{ChildComponent:Wo,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Xt,{})}}])]}});import{$isNodeSelection as Rf}from"lexical";import{jsx as Qo,jsxs as sf}from"react/jsx-runtime";import"react";var er=()=>sf("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Qo("path",{d:"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"}),Qo("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"}),Qo("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 gf}from"react/compiler-runtime";import{jsx as Cf}from"react/jsx-runtime";import{useLexicalComposerContext as xf}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as bf,mergeRegister as _f}from"@lexical/utils";import{useConfig as Tf}from"@payloadcms/ui";import{$getPreviousSelection as wf,$getSelection as Ef,$isParagraphNode as Ol,$isRangeSelection as kf,COMMAND_PRIORITY_EDITOR as Nf,createCommand as Lf}from"lexical";import{useEffect as If}from"react";import{c as af}from"react/compiler-runtime";import{jsx as tr}from"react/jsx-runtime";import{useLexicalComposerContext as cf}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as uf,COMMAND_PRIORITY_EDITOR as df}from"lexical";import{useEffect as mf,useState as pf}from"react";var ff=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=uf(o);r&&r.replace(Ze({data:{fields:null,relationTo:e,value:n}}))}):t.dispatchCommand(or,{fields:null,relationTo:e,value:n})},hf=t=>{let e=af(13),{enabledCollectionSlugs:o}=t,[n]=cf(),[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}=At(l),d,u;e[2]!==n||e[3]!==c?(d=()=>n.registerCommand(Ke,h=>(i(h?.replace?h?.replace.nodeKey:null),c(),!0),df),u=[n,c],e[2]=n,e[3]=c,e[4]=d,e[5]=u):(d=e[4],u=e[5]),mf(d,u);let m;e[6]!==s||e[7]!==n||e[8]!==r?(m=h=>{let{collectionSlug:g,docID:E}=h;s(),ff({editor:n,relationTo:g,replaceNodeKey:r,value:E})},e[6]=s,e[7]=n,e[8]=r,e[9]=m):m=e[9];let p=m,f;return e[10]!==p||e[11]!==a?(f=tr(a,{onSelect:p}),e[10]=p,e[11]=a,e[12]=f):f=e[12],f},Fl=t=>tr(ht,{...t,uploads:!0,children:tr(hf,{...t})});var or=Lf("INSERT_UPLOAD_COMMAND"),$l=t=>{let e=gf(5),[o]=xf(),{config:n}=Tf(),{collections:r}=n,i,l;e[0]!==o?(i=()=>{if(!o.hasNodes([ze]))throw new Error("UploadPlugin: UploadNode not registered on editor");return _f(o.registerCommand(or,a=>(o.update(()=>{let c=Ef()||wf();if(kf(c)){let d=Ze({data:{id:a.id,fields:a.fields,relationTo:a.relationTo,value:a.value}});bf(d);let{focus:u}=c,m=u.getNode();Ol(m)&&m.getTextContentSize()===0&&m.getParentOrThrow().getChildren().filter(p=>Ol(p)).length>1&&m.remove()}}),!0),Nf))},l=[o],e[0]=o,e[1]=i,e[2]=l):(i=e[1],l=e[2]),If(i,l);let s;return e[3]!==r?(s=Cf(Fl,{enabledCollectionSlugs:r.map(Sf)}),e[3]=r,e[4]=s):s=e[4],s};function Sf(t){let{slug:e}=t;return e}var yf=y({nodes:[ze],plugins:[{Component:$l,position:"normal"}],slashMenu:{groups:[K([{Icon:er,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ke,{replace:!1})}}])]},toolbarFixed:{groups:[ue([{ChildComponent:er,isActive:({selection:t})=>{if(!Rf(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return ro(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ke,{replace:!1})}}])]}});import{c as vf}from"react/compiler-runtime";import{jsx as ir}from"react/jsx-runtime";import{ShimmerEffect as Mf}from"@payloadcms/ui";import{lazy as Df,Suspense as Af,useEffect as Ff,useState as Of}from"react";var Pl={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 rr={namespace:"lexical",theme:Pl};function Bl({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 Hl=t=>{let e={enabledFeatures:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}};if(!t?.size)return e;t.forEach(o=>{if(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 nr(t,e,o){return{admin:o,features:Hl(t),lexical:e,resolvedFeatureMap:t}}var $f=Df(()=>import("./Field-S5G27AVI.js").then(t=>({default:t.RichText}))),Pf=t=>{let e=vf(11),{admin:o,clientFeatures: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,[s,a]=Of(null),c,d;e[2]!==s||e[3]!==n||e[4]!==r||e[5]!==l?(c=()=>{if(s)return;let m=[];for(let[h,g]of Object.entries(n))g.clientFeatureProvider&&m.push(g.clientFeatureProvider(g.clientFeatureProps));let p=r||rr,f=Bl({unSanitizedEditorConfig:{features:m,lexical:p}});a(nr(f,p,l))},d=[r,l,s,n],e[2]=s,e[3]=n,e[4]=r,e[5]=l,e[6]=c,e[7]=d):(c=e[6],d=e[7]),Ff(c,d);let u;return e[8]!==s||e[9]!==t?(u=ir(Af,{fallback:ir(Mf,{height:"35vh"}),children:s&&ir($f,{...t,editorConfig:s})}),e[8]=s,e[9]=t,e[10]=u):u=e[10],u};function Bf(...t){return t.filter(Boolean).join(" ")}var Jt=new WeakMap;function jl(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function qt(t,e){let o=Jt.get(t);if(o===void 0){let n=new Set,r=l=>{o!==void 0&&(o.start=jl(l))},i=l=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let a=jl(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},Jt.set(t,o)}return o.listeners.add(e),()=>{Hf(t,e)}}function Hf(t,e){let o=Jt.get(t);if(o===void 0)return;let{listeners:n}=o;n.delete(e),n.size===0&&(Jt.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function jf(t,e){return qt(t,(o,n)=>{let[r,i]=o;r<0&&-r>Math.abs(i)&&e(r,n)})}function Gf(t,e){return qt(t,(o,n)=>{let[r,i]=o;r>0&&r>Math.abs(i)&&e(r,n)})}function Uf(t,e){return qt(t,(o,n)=>{let[r,i]=o;i<0&&-i>Math.abs(r)&&e(r,n)})}function Wf(t,e){return qt(t,(o,n)=>{let[r,i]=o;i>0&&i>Math.abs(r)&&e(r,n)})}var O={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},Vf=O.IS_BOLD|O.IS_ITALIC|O.IS_STRIKETHROUGH|O.IS_UNDERLINE|O.IS_CODE|O.IS_SUBSCRIPT|O.IS_SUPERSCRIPT|O.IS_HIGHLIGHT,Kf="\xA0",zf=`
|
|
36
36
|
|
|
37
|
-
`,
|
|
37
|
+
`,Gl="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",Ul="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",Zf=new RegExp("^[^"+Ul+"]*["+Gl+"]"),Yf=new RegExp("^[^"+Gl+"]*["+Ul+"]"),Xf={bold:O.IS_BOLD,code:O.IS_CODE,highlight:O.IS_HIGHLIGHT,italic:O.IS_ITALIC,strikethrough:O.IS_STRIKETHROUGH,subscript:O.IS_SUBSCRIPT,superscript:O.IS_SUPERSCRIPT,underline:O.IS_UNDERLINE},Jf={directionless:O.IS_DIRECTIONLESS,unmergeable:O.IS_UNMERGEABLE},qf={center:O.IS_ALIGN_CENTER,end:O.IS_ALIGN_END,justify:O.IS_ALIGN_JUSTIFY,left:O.IS_ALIGN_LEFT,right:O.IS_ALIGN_RIGHT,start:O.IS_ALIGN_START},Qf={[O.IS_ALIGN_CENTER]:"center",[O.IS_ALIGN_END]:"end",[O.IS_ALIGN_JUSTIFY]:"justify",[O.IS_ALIGN_LEFT]:"left",[O.IS_ALIGN_RIGHT]:"right",[O.IS_ALIGN_START]:"start"},e1={normal:O.IS_NORMAL,segmented:O.IS_SEGMENTED,token:O.IS_TOKEN},t1={[O.IS_NORMAL]:"normal",[O.IS_SEGMENTED]:"segmented",[O.IS_TOKEN]:"token"};import{c as o1}from"react/compiler-runtime";import{jsx as r1}from"react/jsx-runtime";import"react";var n1=()=>{let t=o1(2),{EditButton:e}=_e(),o;return t[0]!==e?(o=e?r1(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as i1}from"react/compiler-runtime";import{jsx as l1}from"react/jsx-runtime";import"react";var s1=()=>{let t=i1(2),{RemoveButton:e}=_e(),o;return t[0]!==e?(o=e?l1(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as a1}from"react/compiler-runtime";import{jsx as c1}from"react/jsx-runtime";import"react";var u1=()=>{let t=a1(2),{Label:e}=_e(),o;return t[0]!==e?(o=e?c1(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as d1}from"react/compiler-runtime";import{jsx as m1}from"react/jsx-runtime";import"react";var p1=t=>{let e=d1(3),{children:o}=t,{InlineBlockContainer:n}=_e(),r;return e[0]!==n||e[1]!==o?(r=n?m1(n,{children:o}):null,e[0]=n,e[1]=o,e[2]=r):r=e[2],r};import{c as f1}from"react/compiler-runtime";import{jsx as h1}from"react/jsx-runtime";import"react";var g1=t=>{let e=f1(6),{children:o,editButton:n,Label:r,removeButton:i}=t,{BlockCollapsible:l}=Me(),s;return e[0]!==l||e[1]!==n||e[2]!==r||e[3]!==i||e[4]!==o?(s=l?h1(l,{editButton:n,Label:r,removeButton:i,children:o}):null,e[0]=l,e[1]=n,e[2]=r,e[3]=i,e[4]=o,e[5]=s):s=e[5],s};import{c as C1}from"react/compiler-runtime";import{jsx as x1}from"react/jsx-runtime";import"react";var b1=()=>{let t=C1(2),{EditButton:e}=Me(),o;return t[0]!==e?(o=e?x1(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as _1}from"react/compiler-runtime";import{jsx as T1}from"react/jsx-runtime";import"react";var w1=()=>{let t=_1(2),{RemoveButton:e}=Me(),o;return t[0]!==e?(o=e?T1(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};export{et as $createAutoLinkNode,kt as $createBlockNode,eo as $createInlineBlockNode,de as $createLinkNode,Ve as $createRelationshipNode,Ze as $createUploadNode,pe as $isAutoLinkNode,Et as $isBlockNode,to as $isInlineBlockNode,V as $isLinkNode,oo as $isRelationshipNode,ro as $isUploadNode,ts as AlignFeatureClient,me as AutoLinkNode,g1 as BlockCollapsible,b1 as BlockEditButton,ce as BlockNode,w1 as BlockRemoveButton,ss as BlockquoteFeatureClient,ra as BlocksFeatureClient,La as BoldFeatureClient,te as CAN_USE_DOM,Xu as ChecklistFeatureClient,Jf as DETAIL_TYPE_TO_DETAIL,zf as DOUBLE_LINE_BREAK,Qf as ELEMENT_FORMAT_TO_TYPE,qf as ELEMENT_TYPE_TO_FORMAT,Zl as ENABLE_SLASH_MENU_COMMAND,Wl as EditorConfigProvider,Ge as FieldsDrawer,km as FixedToolbarFeatureClient,ac as HeadingFeatureClient,xc as HorizontalRuleFeatureClient,Vf as IS_ALL_FORMATTING,Ec as IndentFeatureClient,p1 as InlineBlockContainer,n1 as InlineBlockEditButton,u1 as InlineBlockLabel,Qt as InlineBlockNode,s1 as InlineBlockRemoveButton,va as InlineCodeFeatureClient,Fm as InlineToolbarFeatureClient,Fa as ItalicFeatureClient,Yf as LTR_REGEX,xd as LexicalPluginToLexicalFeatureClient,Fu as LinkFeatureClient,q as LinkNode,Kf as NON_BREAKING_SPACE,O as NodeFormat,nd as OrderedListFeatureClient,Ld as ParagraphFeatureClient,Kl as Point,Zf as RTL_REGEX,Yl as Rect,tm as RelationshipFeatureClient,We as RelationshipNode,Pf as RichTextField,kd as SlateToLexicalFeatureClient,Ha as StrikethroughFeatureClient,Wa as SubscriptFeatureClient,Za as SuperscriptFeatureClient,e1 as TEXT_MODE_TO_TYPE,Xf as TEXT_TYPE_TO_FORMAT,t1 as TEXT_TYPE_TO_MODE,ie as TOGGLE_LINK_COMMAND,lf as TableFeatureClient,Ca as TestRecorderFeatureClient,st as ToolbarButton,Se as ToolbarDropdown,wa as TreeViewFeatureClient,Qa as UnderlineFeatureClient,md as UnorderedListFeatureClient,yf as UploadFeatureClient,ze as UploadNode,Wf as addSwipeDownListener,jf as addSwipeLeftListener,Gf as addSwipeRightListener,Uf as addSwipeUpListener,xo as createBlockNode,y as createClientFeature,rr as defaultEditorLexicalConfig,Uo as getDOMRangeRect,Xl as getEnabledNodes,De as getSelectedNode,Vl as isHTMLElement,zl as isPoint,Bf as joinClasses,nr as sanitizeClientEditorConfig,Hl as sanitizeClientFeatures,Bt as setFloatingElemPosition,vt as setFloatingElemPositionForLinkEditor,K as slashMenuBasicGroupWithItems,ue as toolbarAddDropdownGroupWithItems,_o as toolbarFeatureButtonsGroupWithItems,Z as toolbarFormatGroupWithItems,J as toolbarTextDropdownGroupWithItems,B as useEditorConfigContext};
|
|
38
38
|
//# sourceMappingURL=index.js.map
|