@payloadcms/richtext-lexical 4.0.0-internal.cd47d20 → 4.0.0-internal.ce66a41
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-MT4FK3IP.js +2 -0
- package/dist/exports/client/Field-MT4FK3IP.js.map +7 -0
- package/dist/exports/client/chunk-3LRZDIIG.js +2 -0
- package/dist/exports/client/{chunk-LN6VX25I.js.map → chunk-3LRZDIIG.js.map} +2 -2
- package/dist/exports/client/chunk-ATPSL6IX.js +2 -0
- package/dist/exports/client/chunk-ATPSL6IX.js.map +7 -0
- package/dist/exports/client/componentInline-ZEP5JPTC.js +2 -0
- package/dist/exports/client/index.js +27 -27
- package/dist/exports/client/index.js.map +4 -4
- package/dist/features/blocks/client/component/index.d.ts.map +1 -1
- package/dist/features/blocks/client/component/index.js +43 -33
- package/dist/features/blocks/client/component/index.js.map +1 -1
- package/dist/features/blocks/client/component/useBlockReordering.js +3 -3
- package/dist/features/blocks/client/component/useBlockReordering.js.map +1 -1
- package/dist/features/blocks/client/componentInline/index.css +0 -1
- package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
- package/dist/features/blocks/client/componentInline/index.js +30 -22
- package/dist/features/blocks/client/componentInline/index.js.map +1 -1
- package/dist/features/blocks/client/getCachedFormStateIfDataMatches.d.ts +9 -0
- package/dist/features/blocks/client/getCachedFormStateIfDataMatches.d.ts.map +1 -0
- package/dist/features/blocks/client/getCachedFormStateIfDataMatches.js +95 -0
- package/dist/features/blocks/client/getCachedFormStateIfDataMatches.js.map +1 -0
- package/dist/features/converters/lexicalToHtml/async/converters/upload.js +3 -3
- package/dist/features/converters/lexicalToHtml/async/converters/upload.js.map +1 -1
- package/dist/features/converters/lexicalToHtml/sync/converters/upload.js +3 -3
- package/dist/features/converters/lexicalToHtml/sync/converters/upload.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/upload.js +4 -4
- package/dist/features/converters/lexicalToJSX/converter/converters/upload.js.map +1 -1
- package/dist/features/indent/client/IndentPlugin.d.ts.map +1 -1
- package/dist/features/indent/client/IndentPlugin.js +122 -1
- package/dist/features/indent/client/IndentPlugin.js.map +1 -1
- package/dist/features/indent/server/i18n.d.ts.map +1 -1
- package/dist/features/indent/server/i18n.js +74 -37
- package/dist/features/indent/server/i18n.js.map +1 -1
- package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.d.ts.map +1 -1
- package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +7 -5
- package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
- package/dist/features/link/client/plugins/floatingLinkEditor/index.css +0 -1
- package/dist/features/relationship/client/components/index.css +3 -6
- package/dist/features/table/client/plugins/TableActionMenuPlugin/index.css +0 -1
- package/dist/features/table/client/plugins/TablePlugin/TableGridPopup/index.css +0 -3
- package/dist/features/toolbars/inline/client/Toolbar/index.d.ts.map +1 -1
- package/dist/features/toolbars/inline/client/Toolbar/index.js +2 -2
- package/dist/features/toolbars/inline/client/Toolbar/index.js.map +1 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/index.css +0 -1
- package/dist/features/typesServer.d.ts +13 -8
- package/dist/features/typesServer.d.ts.map +1 -1
- package/dist/features/typesServer.js.map +1 -1
- package/dist/features/upload/client/component/index.css +0 -2
- package/dist/features/upload/client/plugin/index.d.ts.map +1 -1
- package/dist/features/upload/client/plugin/index.js +3 -1
- package/dist/features/upload/client/plugin/index.js.map +1 -1
- package/dist/field/Diff/converters/relationship/index.css +0 -1
- package/dist/field/Diff/converters/unknown/index.css +0 -1
- package/dist/field/Diff/converters/upload/index.css +0 -1
- package/dist/field/Diff/index.css +0 -2
- package/dist/field/Field.d.ts.map +1 -1
- package/dist/field/Field.js +8 -1
- package/dist/field/Field.js.map +1 -1
- package/dist/field/bundled.css +1 -1
- package/dist/field/index.css +0 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -1
- package/dist/index.js.map +1 -1
- package/dist/lexical/LexicalEditor.css +21 -10
- package/dist/lexical/LexicalEditor.d.ts.map +1 -1
- package/dist/lexical/LexicalEditor.js +61 -64
- package/dist/lexical/LexicalEditor.js.map +1 -1
- package/dist/lexical/plugins/DecoratorPlugin/index.d.ts.map +1 -1
- package/dist/lexical/plugins/DecoratorPlugin/index.js +24 -21
- package/dist/lexical/plugins/DecoratorPlugin/index.js.map +1 -1
- package/dist/lexical/plugins/InsertParagraphAtEnd/index.css +2 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +1 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
- package/dist/lexical/plugins/SlashMenu/index.css +0 -1
- package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.css +1 -0
- package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js +2 -2
- package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js.map +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.css +1 -0
- package/dist/lexical/plugins/handles/utils/setHandlePosition.d.ts.map +1 -1
- package/dist/lexical/plugins/handles/utils/setHandlePosition.js +2 -0
- package/dist/lexical/plugins/handles/utils/setHandlePosition.js.map +1 -1
- package/dist/lexical/theme/EditorTheme.css +0 -2
- package/dist/lexical/ui/ContentEditable.d.ts +2 -1
- package/dist/lexical/ui/ContentEditable.d.ts.map +1 -1
- package/dist/lexical/ui/ContentEditable.js +21 -7
- package/dist/lexical/ui/ContentEditable.js.map +1 -1
- package/dist/presets/llmInstructions.d.ts +2 -0
- package/dist/presets/llmInstructions.d.ts.map +1 -0
- package/dist/presets/llmInstructions.js +13 -0
- package/dist/presets/llmInstructions.js.map +1 -0
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/dist/utilities/buildInitialState.d.ts +1 -0
- package/dist/utilities/buildInitialState.d.ts.map +1 -1
- package/dist/utilities/buildInitialState.js +1 -0
- package/dist/utilities/buildInitialState.js.map +1 -1
- package/dist/validate/hasText.d.ts +2 -2
- package/dist/validate/hasText.d.ts.map +1 -1
- package/dist/validate/hasText.js.map +1 -1
- package/dist/validate/index.d.ts +1 -1
- package/dist/validate/index.d.ts.map +1 -1
- package/package.json +22 -22
- package/dist/exports/client/Field-BPLEYPXV.js +0 -2
- package/dist/exports/client/Field-BPLEYPXV.js.map +0 -7
- package/dist/exports/client/bundled.css +0 -1
- package/dist/exports/client/chunk-ESITTE3C.js +0 -2
- package/dist/exports/client/chunk-ESITTE3C.js.map +0 -7
- package/dist/exports/client/chunk-LN6VX25I.js +0 -2
- package/dist/exports/client/componentInline-H24N7GUG.js +0 -2
- package/dist/features/blocks/client/component/removeEmptyArrayValues.d.ts +0 -11
- package/dist/features/blocks/client/component/removeEmptyArrayValues.d.ts.map +0 -1
- package/dist/features/blocks/client/component/removeEmptyArrayValues.js +0 -20
- package/dist/features/blocks/client/component/removeEmptyArrayValues.js.map +0 -1
- /package/dist/exports/client/{componentInline-H24N7GUG.js.map → componentInline-ZEP5JPTC.js.map} +0 -0
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
"use client";import{a as Ce,c as bt,d as kt,e as _t}from"./chunk-ESITTE3C.js";import{a as Qe}from"./chunk-DBWINSQN.js";import{a as Po,b as et,c as tt,d as ve,e as ot}from"./chunk-43E5QYAA.js";import{a as kr,b as _r,c as Oe}from"./chunk-5VIL27GI.js";import{a as ou}from"./chunk-WSAPGI3Z.js";import{a as ae,b as Tr,c as Er,d as Bo,e as jo,f as nu,g as ru,i as lu,k as iu,n as su}from"./chunk-LN6VX25I.js";import{a as tu,b as W}from"./chunk-RJ5MAOKZ.js";function Q(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{c as mu}from"react/compiler-runtime";import{useLexicalComposerContext as pu}from"@lexical/react/LexicalComposerContext";import{$isDecoratorBlockNode as be}from"@lexical/react/LexicalDecoratorBlockNode";import{$findMatchingParent as fu}from"@lexical/utils";import{$getSelection as hu,$isElementNode as pe,$isNodeSelection as gu,$isRangeSelection as Tt,COMMAND_PRIORITY_LOW as xu,FORMAT_ELEMENT_COMMAND as Et}from"lexical";import{useEffect as Cu}from"react";import{jsx as wr}from"react/jsx-runtime";import"react";var au="M5 7.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m3 4a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5M7.5 15a.5.5 0 0 0 0 1h9a.5.5 0 0 0 0-1z",Sr=({className:t})=>wr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:wr("path",{clipRule:"evenodd",d:au,fill:"currentColor",fillRule:"evenodd"})});import{jsx as Nr}from"react/jsx-runtime";import"react";var cu="M5 7.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m0 4a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m.5 3.5a.5.5 0 0 0 0 1h13a.5.5 0 0 0 0-1z",Lr=({className:t})=>Nr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Nr("path",{clipRule:"evenodd",d:cu,fill:"currentColor",fillRule:"evenodd"})});import{jsx as yr}from"react/jsx-runtime";import"react";var uu="M5 7.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m0 4a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5m.5 3.5a.5.5 0 0 0 0 1h9a.5.5 0 0 0 0-1z",Ut=({className:t})=>yr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:yr("path",{clipRule:"evenodd",d:uu,fill:"currentColor",fillRule:"evenodd"})});import{jsx as Rr}from"react/jsx-runtime";import"react";var du="M19 7.5a.5.5 0 0 0-.5-.5h-13a.5.5 0 0 0 0 1h13a.5.5 0 0 0 .5-.5m0 4a.5.5 0 0 0-.5-.5h-7a.5.5 0 0 0 0 1h7a.5.5 0 0 0 .5-.5m-.5 3.5a.5.5 0 0 1 0 1h-9a.5.5 0 0 1 0-1z",vr=({className:t})=>Rr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Rr("path",{clipRule:"evenodd",d:du,fill:"currentColor",fillRule:"evenodd"})});var M=t=>o=>{let n={clientFeatureProps:o};if(typeof t=="function")n.feature=({config:r,featureClientImportMap:l,featureClientSchemaMap:s,featureProviderMap:i,field:u,resolvedFeatures:d,schemaPath:c,unSanitizedEditorConfig:a})=>{let m=t({config:r,featureClientImportMap:l,featureClientSchemaMap:s,featureProviderMap:i,field:u,props:o,resolvedFeatures:d,schemaPath:c,unSanitizedEditorConfig:a});return m.sanitizedClientFeatureProps===null&&(m.sanitizedClientFeatureProps=o),m};else{let r={...t};r.sanitizedClientFeatureProps=o,n.feature=r}return n};var Ir=t=>({type:"dropdown",ChildComponent:Ut,iconOnly:!0,items:t,key:"align",order:30});var Ie=t=>pe(t)?t.getFormatType():t.__format,Mr=[Ir([{ChildComponent:Ut,isActive:({selection:t})=>{if(!Tt(t))return!1;for(let e of t.getNodes()){if((pe(e)||be(e))&&Ie(e)==="left")continue;let o=e.getParent();if(!((pe(o)||be(o))&&Ie(o)==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Et,"left")},order:1},{ChildComponent:Sr,isActive:({selection:t})=>{if(!Tt(t))return!1;for(let e of t.getNodes()){if((pe(e)||be(e))&&Ie(e)==="center")continue;let o=e.getParent();if(!((pe(o)||be(o))&&Ie(o)==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Et,"center")},order:2},{ChildComponent:vr,isActive:({selection:t})=>{if(!Tt(t))return!1;for(let e of t.getNodes()){if((pe(e)||be(e))&&Ie(e)==="right")continue;let o=e.getParent();if(!((pe(o)||be(o))&&Ie(o)==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Et,"right")},order:3},{ChildComponent:Lr,isActive:({selection:t})=>{if(!Tt(t))return!1;for(let e of t.getNodes()){if((pe(e)||be(e))&&Ie(e)==="justify")continue;let o=e.getParent();if(!((pe(o)||be(o))&&Ie(o)==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Et,"justify")},order:4}])],bu=()=>{let t=mu(3),[e]=pu(),o,n;return t[0]!==e?(o=()=>e.registerCommand(Et,Tu,xu),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),Cu(o,n),null},ku=M({plugins:[{Component:bu,position:"normal"}],toolbarFixed:{groups:Mr},toolbarInline:{groups:Mr}});function _u(t){return(pe(t)||be(t))&&!t.isInline()}function Tu(t){let e=hu();if(!Tt(e)&&!gu(e))return!1;let o=e.getNodes();for(let n of o){let r=fu(n,_u);r!==null&&r.setFormat(t)}return!0}import{QUOTE as Su}from"@lexical/markdown";import{$createQuoteNode as Fr,$isQuoteNode as Dr,QuoteNode as Nu}from"@lexical/rich-text";import{$setBlocksType as Pr}from"@lexical/selection";import{$getSelection as Br,$isRangeSelection as Lu}from"lexical";import{jsx as Ar}from"react/jsx-runtime";import"react";var Eu="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",Ho=({className:t})=>Ar("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Ar("path",{d:Eu,fill:"currentColor"})});import{jsx as $r}from"react/jsx-runtime";import"react";var wu={16:"M3 3.5a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 .5.5V5a.5.5 0 0 1-1 0V4H8.5v8h1a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1h1V4H4v1a.5.5 0 0 1-1 0z",24:"M6 6.5a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 .5.5V9a.5.5 0 0 1-1 0V7h-4.5v10h2a.5.5 0 0 1 0 1h-5a.5.5 0 0 1 0-1h2V7H7v2a.5.5 0 0 1-1 0z"},wt=({className:t,size:e=24})=>$r("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:$r("path",{clipRule:"evenodd",d:wu[e],fill:"currentColor",fillRule:"evenodd"})});var ne=t=>({type:"dropdown",ChildComponent:wt,items:t,key:"text",order:25});var Or=[ne([{ChildComponent:Ho,isActive:({selection:t})=>{if(!Lu(t))return!1;for(let e of t.getNodes())if(!Dr(e)&&!Dr(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Br();Pr(e,()=>Fr())})},order:20}])],yu=M({markdownTransformers:[Su],nodes:[Nu],slashMenu:{groups:[Q([{Icon:Ho,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Br();Pr(e,()=>Fr())})}}])]},toolbarFixed:{groups:Or},toolbarInline:{groups:Or}});import{getTranslation as eo}from"@payloadcms/translations";import{jsx as jr}from"react/jsx-runtime";import"react";var Ru="M10.5 7C11.3284 7 12 7.67157 12 8.5V11.5C12 11.7329 11.9453 11.9527 11.8506 12.1494C12.0473 12.0547 12.2671 12 12.5 12H15.5C16.3284 12 17 12.6716 17 13.5V16.5C17 17.3284 16.3284 18 15.5 18H12.5C12.1151 18 11.7655 17.8535 11.5 17.6152C11.2345 17.8535 10.8849 18 10.5 18H7.5C6.67157 18 6 17.3284 6 16.5V13.5C6 13.1154 6.14578 12.7655 6.38379 12.5C6.14578 12.2345 6 11.8846 6 11.5V8.5C6 7.67157 6.67157 7 7.5 7H10.5ZM12.5 13C12.2239 13 12 13.2239 12 13.5V16.5C12 16.7761 12.2239 17 12.5 17H15.5C15.7761 17 16 16.7761 16 16.5V13.5C16 13.2239 15.7761 13 15.5 13H12.5ZM7.5 13C7.22386 13 7 13.2239 7 13.5V16.5C7 16.7761 7.22386 17 7.5 17H10.5C10.7761 17 11 16.7761 11 16.5V13.5C11 13.2239 10.7761 13 10.5 13H7.5ZM7.5 8C7.22386 8 7 8.22386 7 8.5V11.5C7 11.7761 7.22386 12 7.5 12H10.5C10.7761 12 11 11.7761 11 11.5V8.5C11 8.22386 10.7761 8 10.5 8H7.5ZM17.5 5C18.3284 5 19 5.67157 19 6.5V9.5C19 10.3284 18.3284 11 17.5 11H14.5C13.6716 11 13 10.3284 13 9.5V6.5C13 5.67157 13.6716 5 14.5 5H17.5ZM14.5 6C14.2239 6 14 6.22386 14 6.5V9.5C14 9.77614 14.2239 10 14.5 10H17.5C17.7761 10 18 9.77614 18 9.5V6.5C18 6.22386 17.7761 6 17.5 6H14.5Z",Go=({className:t})=>jr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:jr("path",{d:Ru,fill:"currentColor"})});import{jsx as Hr}from"react/jsx-runtime";import"react";var vu="M17 8C18.1046 8 19 8.89543 19 10V14L18.9893 14.2041C18.8938 15.1457 18.1457 15.8938 17.2041 15.9893L17 16H7L6.7959 15.9893C5.78722 15.887 5 15.0357 5 14V10C5 8.89543 5.89543 8 7 8H17ZM7 9C6.44772 9 6 9.44772 6 10V14C6 14.5523 6.44772 15 7 15H17C17.5523 15 18 14.5523 18 14V10C18 9.44772 17.5523 9 17 9H7ZM9 11C9.55228 11 10 11.4477 10 12C10 12.5523 9.55228 13 9 13C8.44772 13 8 12.5523 8 12C8 11.4477 8.44772 11 9 11ZM12 11C12.5523 11 13 11.4477 13 12C13 12.5523 12.5523 13 12 13C11.4477 13 11 12.5523 11 12C11 11.4477 11.4477 11 12 11ZM15 11C15.5523 11 16 11.4477 16 12C16 12.5523 15.5523 13 15 13C14.4477 13 14 12.5523 14 12C14 11.4477 14.4477 11 15 11Z",zo=({className:t})=>Hr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Hr("path",{clipRule:"evenodd",d:vu,fill:"currentColor",fillRule:"evenodd"})});import{jsx as Iu}from"react/jsx-runtime";import"react";function Gr(t,e){let{admin:o,imageAltText:n,imageURL:r}=t,l=o?.images,s,i;if(l?.icon?(s=typeof l.icon=="string"?l.icon:l.icon.url,i=typeof l.icon=="string"?void 0:l.icon.alt):l?.thumbnail?(s=typeof l.thumbnail=="string"?l.thumbnail:l.thumbnail.url,i=typeof l.thumbnail=="string"?void 0:l.thumbnail.alt):(s=r,i=n),!s)return e;let u=i??"Block Image";return()=>Iu("img",{alt:u,className:"lexical-block-custom-image",src:s,style:{maxHeight:20,maxWidth:20}})}import{$parseSerializedNode as cl}from"lexical";import{JSOX as Uo}from"jsox";function Wt({propsString:t}){let e={},o="",n=!0;for(let r=0;r<t.length;r++){let l=t[r];if(n)l==="="||l===" "?o&&(l===" "?(e[o]=!0,o=""):n=!1):o+=l;else{let s=Mu(t,r);e[o]=s.value,r=s.newIndex,o="",n=!0}}return o&&(e[o]=!0),e}function Mu(t,e){let o=t[e];return o==='"'?zr(t,e):o==="'"?zr(t,e,!0):o==="{"?$u(t,e):o==="["?Au(t,e):Ou(t,e)}function Au(t,e){let o=1,n="",r=e+1;for(;r<t.length&&o>0;)t[r]==="["?o++:t[r]==="]"&&o--,o>0&&(n+=t[r]),r++;return{newIndex:r,value:Uo.parse(`[${n}]`)}}function zr(t,e,o=!1){let n="",r=e+1;for(;r<t.length&&(t[r]!==(o?"'":'"')||t[r-1]==="\\");)n+=t[r],r++;return{newIndex:r,value:n}}function $u(t,e){let o=1,n="",r=e+1;for(;r<t.length&&o>0;)t[r]==="{"?o++:t[r]==="}"&&o--,o>0&&(n+=t[r]),r++;return{newIndex:r,value:Du(n)}}function Du(t){return t[0]!=="{"?Uo.parse(t):Uo.parse(t.replace(/(\w+):/g,'"$1":'))}function Ou(t,e){let o="",n=e;for(;n<t.length&&t[n]!==" ";)o+=t[n],n++;return{newIndex:n-1,value:o}}function St({props:t}){let e=[];for(let[o,n]of Object.entries(t))typeof n=="string"?e.push(`${o}="${Fu(n)}"`):typeof n=="number"?e.push(`${o}={${n}}`):typeof n=="boolean"?n&&e.push(`${o}`):n!==null&&typeof n=="object"&&(Array.isArray(n)?e.push(`${o}={[${n.map(r=>JSON.stringify(r,Ur)).join(", ")}]}`):e.push(`${o}={${JSON.stringify(n,Ur)}}`));return e.join(" ")}function Fu(t){return t.replace(/"/g,""")}function Ur(t,e){return typeof e=="string"?e.replace(/'/g,"\\'"):e}function Vt({isEndOptional:t,lines:e,regexpEndRegex:o,startLineIndex:n,startMatch:r,trimChildren:l}){let s="",i="",u=e.slice(n),d=!1,c=0,a=0,m=null,p=!1,f=0,h=u[0].slice(0,r.index),x=0,C=n;e:for(let[w,g]of u.entries()){let b=l?g.trim():g,k=0;if(l)for(let T=0;T<g.length&&g[T]===" ";T++)k++;let _=0;for(w===0&&(_=(r.index??0)+r[0].length-k);_<b.length;){let T=b[_],I=b[_+1];if(d){if(T==="`"&&f++,f%2===0)if(T==="<"&&I==="/"){if(c--,c<0){i[i.length-1]===`
|
|
2
|
-
`&&(i=i.slice(0,-1)),C=
|
|
3
|
-
`&&(i=i.slice(0,-1)),C=
|
|
1
|
+
"use client";import{a as Ir,b as kt,c as xe,e as _t,f as Tt,g as Et}from"./chunk-ATPSL6IX.js";import{a as Qe}from"./chunk-DBWINSQN.js";import{a as Wo,b as et,c as tt,d as ye,e as ot}from"./chunk-43E5QYAA.js";import{a as Rr,b as vr,c as De}from"./chunk-5VIL27GI.js";import{a as cu}from"./chunk-WSAPGI3Z.js";import{a as se,b as Mr,c as Ar,d as Vo,e as Ko,f as uu,g as du,i as mu,k as fu,n as pu}from"./chunk-3LRZDIIG.js";import{a as au,b as W}from"./chunk-RJ5MAOKZ.js";function Z(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{c as bu}from"react/compiler-runtime";import{useLexicalComposerContext as ku}from"@lexical/react/LexicalComposerContext";import{$isDecoratorBlockNode as Ce}from"@lexical/react/LexicalDecoratorBlockNode";import{$findMatchingParent as _u}from"@lexical/utils";import{$getSelection as Tu,$isElementNode as fe,$isNodeSelection as Eu,$isRangeSelection as wt,COMMAND_PRIORITY_LOW as wu,FORMAT_ELEMENT_COMMAND as St}from"lexical";import{useEffect as Su}from"react";import{jsx as Dr}from"react/jsx-runtime";import"react";var hu="M5 7.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m3 4a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5M7.5 15a.5.5 0 0 0 0 1h9a.5.5 0 0 0 0-1z",$r=({className:t})=>Dr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Dr("path",{clipRule:"evenodd",d:hu,fill:"currentColor",fillRule:"evenodd"})});import{jsx as Or}from"react/jsx-runtime";import"react";var gu="M5 7.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m0 4a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m.5 3.5a.5.5 0 0 0 0 1h13a.5.5 0 0 0 0-1z",Fr=({className:t})=>Or("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Or("path",{clipRule:"evenodd",d:gu,fill:"currentColor",fillRule:"evenodd"})});import{jsx as Pr}from"react/jsx-runtime";import"react";var xu="M5 7.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m0 4a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5m.5 3.5a.5.5 0 0 0 0 1h9a.5.5 0 0 0 0-1z",Jt=({className:t})=>Pr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Pr("path",{clipRule:"evenodd",d:xu,fill:"currentColor",fillRule:"evenodd"})});import{jsx as Br}from"react/jsx-runtime";import"react";var Cu="M19 7.5a.5.5 0 0 0-.5-.5h-13a.5.5 0 0 0 0 1h13a.5.5 0 0 0 .5-.5m0 4a.5.5 0 0 0-.5-.5h-7a.5.5 0 0 0 0 1h7a.5.5 0 0 0 .5-.5m-.5 3.5a.5.5 0 0 1 0 1h-9a.5.5 0 0 1 0-1z",jr=({className:t})=>Br("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Br("path",{clipRule:"evenodd",d:Cu,fill:"currentColor",fillRule:"evenodd"})});var A=t=>o=>{let n={clientFeatureProps:o};if(typeof t=="function")n.feature=({config:r,featureClientImportMap:l,featureClientSchemaMap:s,featureProviderMap:i,field:u,resolvedFeatures:d,schemaPath:c,unSanitizedEditorConfig:a})=>{let m=t({config:r,featureClientImportMap:l,featureClientSchemaMap:s,featureProviderMap:i,field:u,props:o,resolvedFeatures:d,schemaPath:c,unSanitizedEditorConfig:a});return m.sanitizedClientFeatureProps===null&&(m.sanitizedClientFeatureProps=o),m};else{let r={...t};r.sanitizedClientFeatureProps=o,n.feature=r}return n};var Hr=t=>({type:"dropdown",ChildComponent:Jt,iconOnly:!0,items:t,key:"align",order:30});var Re=t=>fe(t)?t.getFormatType():t.__format,Gr=[Hr([{ChildComponent:Jt,isActive:({selection:t})=>{if(!wt(t))return!1;for(let e of t.getNodes()){if((fe(e)||Ce(e))&&Re(e)==="left")continue;let o=e.getParent();if(!((fe(o)||Ce(o))&&Re(o)==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(St,"left")},order:1},{ChildComponent:$r,isActive:({selection:t})=>{if(!wt(t))return!1;for(let e of t.getNodes()){if((fe(e)||Ce(e))&&Re(e)==="center")continue;let o=e.getParent();if(!((fe(o)||Ce(o))&&Re(o)==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(St,"center")},order:2},{ChildComponent:jr,isActive:({selection:t})=>{if(!wt(t))return!1;for(let e of t.getNodes()){if((fe(e)||Ce(e))&&Re(e)==="right")continue;let o=e.getParent();if(!((fe(o)||Ce(o))&&Re(o)==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(St,"right")},order:3},{ChildComponent:Fr,isActive:({selection:t})=>{if(!wt(t))return!1;for(let e of t.getNodes()){if((fe(e)||Ce(e))&&Re(e)==="justify")continue;let o=e.getParent();if(!((fe(o)||Ce(o))&&Re(o)==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(St,"justify")},order:4}])],Nu=()=>{let t=bu(3),[e]=ku(),o,n;return t[0]!==e?(o=()=>e.registerCommand(St,Ru,wu),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),Su(o,n),null},Lu=A({plugins:[{Component:Nu,position:"normal"}],toolbarFixed:{groups:Gr},toolbarInline:{groups:Gr}});function yu(t){return(fe(t)||Ce(t))&&!t.isInline()}function Ru(t){let e=Tu();if(!wt(e)&&!Eu(e))return!1;let o=e.getNodes();for(let n of o){let r=_u(n,yu);r!==null&&r.setFormat(t)}return!0}import{QUOTE as Mu}from"@lexical/markdown";import{$createQuoteNode as Kr,$isQuoteNode as Wr,QuoteNode as Au}from"@lexical/rich-text";import{$setBlocksType as Jr}from"@lexical/selection";import{$getSelection as Xr,$isRangeSelection as Du}from"lexical";import{jsx as Ur}from"react/jsx-runtime";import"react";var vu="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",Jo=({className:t})=>Ur("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Ur("path",{d:vu,fill:"currentColor"})});import{jsx as zr}from"react/jsx-runtime";import"react";var Iu={16:"M3 3.5a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 .5.5V5a.5.5 0 0 1-1 0V4H8.5v8h1a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1h1V4H4v1a.5.5 0 0 1-1 0z",24:"M6 6.5a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 .5.5V9a.5.5 0 0 1-1 0V7h-4.5v10h2a.5.5 0 0 1 0 1h-5a.5.5 0 0 1 0-1h2V7H7v2a.5.5 0 0 1-1 0z"},Nt=({className:t,size:e=24})=>zr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:zr("path",{clipRule:"evenodd",d:Iu[e],fill:"currentColor",fillRule:"evenodd"})});var oe=t=>({type:"dropdown",ChildComponent:Nt,items:t,key:"text",order:25});var Vr=[oe([{ChildComponent:Jo,isActive:({selection:t})=>{if(!Du(t))return!1;for(let e of t.getNodes())if(!Wr(e)&&!Wr(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Xr();Jr(e,()=>Kr())})},order:20}])],$u=A({markdownTransformers:[Mu],nodes:[Au],slashMenu:{groups:[Z([{Icon:Jo,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Xr();Jr(e,()=>Kr())})}}])]},toolbarFixed:{groups:Vr},toolbarInline:{groups:Vr}});import{getTranslation as ro}from"@payloadcms/translations";import{jsx as Yr}from"react/jsx-runtime";import"react";var Ou="M10.5 7C11.3284 7 12 7.67157 12 8.5V11.5C12 11.7329 11.9453 11.9527 11.8506 12.1494C12.0473 12.0547 12.2671 12 12.5 12H15.5C16.3284 12 17 12.6716 17 13.5V16.5C17 17.3284 16.3284 18 15.5 18H12.5C12.1151 18 11.7655 17.8535 11.5 17.6152C11.2345 17.8535 10.8849 18 10.5 18H7.5C6.67157 18 6 17.3284 6 16.5V13.5C6 13.1154 6.14578 12.7655 6.38379 12.5C6.14578 12.2345 6 11.8846 6 11.5V8.5C6 7.67157 6.67157 7 7.5 7H10.5ZM12.5 13C12.2239 13 12 13.2239 12 13.5V16.5C12 16.7761 12.2239 17 12.5 17H15.5C15.7761 17 16 16.7761 16 16.5V13.5C16 13.2239 15.7761 13 15.5 13H12.5ZM7.5 13C7.22386 13 7 13.2239 7 13.5V16.5C7 16.7761 7.22386 17 7.5 17H10.5C10.7761 17 11 16.7761 11 16.5V13.5C11 13.2239 10.7761 13 10.5 13H7.5ZM7.5 8C7.22386 8 7 8.22386 7 8.5V11.5C7 11.7761 7.22386 12 7.5 12H10.5C10.7761 12 11 11.7761 11 11.5V8.5C11 8.22386 10.7761 8 10.5 8H7.5ZM17.5 5C18.3284 5 19 5.67157 19 6.5V9.5C19 10.3284 18.3284 11 17.5 11H14.5C13.6716 11 13 10.3284 13 9.5V6.5C13 5.67157 13.6716 5 14.5 5H17.5ZM14.5 6C14.2239 6 14 6.22386 14 6.5V9.5C14 9.77614 14.2239 10 14.5 10H17.5C17.7761 10 18 9.77614 18 9.5V6.5C18 6.22386 17.7761 6 17.5 6H14.5Z",Xo=({className:t})=>Yr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Yr("path",{d:Ou,fill:"currentColor"})});import{jsx as Zr}from"react/jsx-runtime";import"react";var Fu="M17 8C18.1046 8 19 8.89543 19 10V14L18.9893 14.2041C18.8938 15.1457 18.1457 15.8938 17.2041 15.9893L17 16H7L6.7959 15.9893C5.78722 15.887 5 15.0357 5 14V10C5 8.89543 5.89543 8 7 8H17ZM7 9C6.44772 9 6 9.44772 6 10V14C6 14.5523 6.44772 15 7 15H17C17.5523 15 18 14.5523 18 14V10C18 9.44772 17.5523 9 17 9H7ZM9 11C9.55228 11 10 11.4477 10 12C10 12.5523 9.55228 13 9 13C8.44772 13 8 12.5523 8 12C8 11.4477 8.44772 11 9 11ZM12 11C12.5523 11 13 11.4477 13 12C13 12.5523 12.5523 13 12 13C11.4477 13 11 12.5523 11 12C11 11.4477 11.4477 11 12 11ZM15 11C15.5523 11 16 11.4477 16 12C16 12.5523 15.5523 13 15 13C14.4477 13 14 12.5523 14 12C14 11.4477 14.4477 11 15 11Z",Yo=({className:t})=>Zr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Zr("path",{clipRule:"evenodd",d:Fu,fill:"currentColor",fillRule:"evenodd"})});import{jsx as Pu}from"react/jsx-runtime";import"react";function qr(t,e){let{admin:o,imageAltText:n,imageURL:r}=t,l=o?.images,s,i;if(l?.icon?(s=typeof l.icon=="string"?l.icon:l.icon.url,i=typeof l.icon=="string"?void 0:l.icon.alt):l?.thumbnail?(s=typeof l.thumbnail=="string"?l.thumbnail:l.thumbnail.url,i=typeof l.thumbnail=="string"?void 0:l.thumbnail.alt):(s=r,i=n),!s)return e;let u=i??"Block Image";return()=>Pu("img",{alt:u,className:"lexical-block-custom-image",src:s,style:{maxHeight:20,maxWidth:20}})}import{$parseSerializedNode as xl}from"lexical";import{JSOX as Zo}from"jsox";function Xt({propsString:t}){let e={},o="",n=!0;for(let r=0;r<t.length;r++){let l=t[r];if(n)l==="="||l===" "?o&&(l===" "?(e[o]=!0,o=""):n=!1):o+=l;else{let s=Bu(t,r);e[o]=s.value,r=s.newIndex,o="",n=!0}}return o&&(e[o]=!0),e}function Bu(t,e){let o=t[e];return o==='"'?Qr(t,e):o==="'"?Qr(t,e,!0):o==="{"?Hu(t,e):o==="["?ju(t,e):Uu(t,e)}function ju(t,e){let o=1,n="",r=e+1;for(;r<t.length&&o>0;)t[r]==="["?o++:t[r]==="]"&&o--,o>0&&(n+=t[r]),r++;return{newIndex:r,value:Zo.parse(`[${n}]`)}}function Qr(t,e,o=!1){let n="",r=e+1;for(;r<t.length&&(t[r]!==(o?"'":'"')||t[r-1]==="\\");)n+=t[r],r++;return{newIndex:r,value:n}}function Hu(t,e){let o=1,n="",r=e+1;for(;r<t.length&&o>0;)t[r]==="{"?o++:t[r]==="}"&&o--,o>0&&(n+=t[r]),r++;return{newIndex:r,value:Gu(n)}}function Gu(t){return t[0]!=="{"?Zo.parse(t):Zo.parse(t.replace(/(\w+):/g,'"$1":'))}function Uu(t,e){let o="",n=e;for(;n<t.length&&t[n]!==" ";)o+=t[n],n++;return{newIndex:n-1,value:o}}function Lt({props:t}){let e=[];for(let[o,n]of Object.entries(t))typeof n=="string"?e.push(`${o}="${zu(n)}"`):typeof n=="number"?e.push(`${o}={${n}}`):typeof n=="boolean"?n&&e.push(`${o}`):n!==null&&typeof n=="object"&&(Array.isArray(n)?e.push(`${o}={[${n.map(r=>JSON.stringify(r,el)).join(", ")}]}`):e.push(`${o}={${JSON.stringify(n,el)}}`));return e.join(" ")}function zu(t){return t.replace(/"/g,""")}function el(t,e){return typeof e=="string"?e.replace(/'/g,"\\'"):e}function Yt({isEndOptional:t,lines:e,regexpEndRegex:o,startLineIndex:n,startMatch:r,trimChildren:l}){let s="",i="",u=e.slice(n),d=!1,c=0,a=0,m=null,f=!1,h=0,p=u[0].slice(0,r.index),g=0,C=n;e:for(let[L,x]of u.entries()){let b=l?x.trim():x,k=0;if(l)for(let T=0;T<x.length&&x[T]===" ";T++)k++;let _=0;for(L===0&&(_=(r.index??0)+r[0].length-k);_<b.length;){let T=b[_],I=b[_+1];if(d){if(T==="`"&&h++,h%2===0)if(T==="<"&&I==="/"){if(c--,c<0){i[i.length-1]===`
|
|
2
|
+
`&&(i=i.slice(0,-1)),C=L;for(let N=_;N<b.length;N++)if(b[N]===">"){g=N+1;break}break e}}else if(T==="/"&&I===">"){if(c--,c<0){i[i.length-1]===`
|
|
3
|
+
`&&(i=i.slice(0,-1)),C=L,g=_+2;break e}}else T==="<"&&I!=="/"&&c++;i+=T}else{if(T==="{"&&!m?a++:T==="}"&&!m?a--:(T==='"'||T==="'")&&!m?m=T:T===m&&(m=null),T==="/"&&I===">"&&a===0&&!m){f=!0,C=L,g=_+2;break e}else if(T===">"&&a===0&&!m){d=!0,_++;continue}s+=T}_++}if(d?i?.length>0&&L>0&&(i+=`
|
|
4
4
|
`):s+=`
|
|
5
|
-
`,o&&c<0){let T=b.match(o);if(T?.index!==void 0){C=
|
|
5
|
+
`,o&&c<0){let T=b.match(o);if(T?.index!==void 0){C=L,g=T.index+T[0].length-1;break}}if(L===u.length-1&&!t&&!f)throw new Error("End match not found for lines "+e.join(`
|
|
6
6
|
`)+`
|
|
7
7
|
|
|
8
|
-
. Start match: `+JSON.stringify(r))}return{afterEndLine:u[C].trim().slice(x),beforeStartLine:h,content:i,endLineIndex:n+C,endlineLastCharIndex:x,propsString:s}}import{jsx as Nd}from"react/jsx-runtime";import Ld from"bson-objectid";import{$applyNodeReplacement as yd}from"lexical";import"react";import{DecoratorBlockNode as Pu}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as Bu}from"@lexical/utils";import ju from"bson-objectid";import{$applyNodeReplacement as Hu}from"lexical";var Nt=class extends Pu{__cacheBuster;__fields;constructor({cacheBuster:e,fields:o,format:n,key:r}){super(n,r),this.__fields=o,this.__cacheBuster=e||0}static clone(e){return new this({cacheBuster:e.__cacheBuster,fields:e.__fields,format:e.__format,key:e.__key})}static getType(){return"block"}static importDOM(){return{}}static importJSON(e){e.version===1&&(e={...e,fields:{...e.fields.data},version:2});let o=Gu(e.fields);return o.setFormat(e.format),o}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return Bu(o,e?.theme?.block),o}decorate(e,o){return null}exportDOM(){let e=document.createElement("div"),o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),type:"block",fields:this.getFields(),version:2}}getCacheBuster(){return this.getLatest().__cacheBuster}getFields(){return this.getLatest().__fields}getTextContent(){return"Block Field"}setFields(e,o){let n=this.getWritable();n.__fields=e,o||n.__cacheBuster++}};function Gu(t){return Hu(new Nt({fields:{...t,id:t?.id||new ju.default().toHexString()}}))}import{jsx as G,jsxs as Me,Fragment as od}from"react/jsx-runtime";import{useLexicalComposerContext as nd}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as rd}from"@lexical/react/useLexicalEditable";import{getTranslation as ld}from"@payloadcms/translations";import{Button as Zr,Collapsible as id,Drawer as sd,EditDepthProvider as ad,ErrorPill as cd,Form as ud,formatDrawerSlug as dd,MoreIcon as md,Pill as pd,Popup as fd,PopupList as Lt,RenderFields as hd,SectionTitle as gd,useConfig as xd,useDocumentForm as Cd,useDocumentInfo as qr,useEditDepth as bd,useFormSubmitted as kd,useServerFunctions as _d,useTranslation as Td,XIcon as Ed}from"@payloadcms/ui";import{abortAndIgnore as Ko}from"@payloadcms/ui/shared";import{$getNodeByKey as Xt,$getRoot as wd,SKIP_DOM_SELECTION_TAG as Jo}from"lexical";import{deepCopyObjectSimpleWithoutReactComponents as Yt,reduceFieldsToValues as Qr}from"payload/shared";import Fe,{useCallback as Xo,useEffect as Zt,useMemo as Pe,useRef as Yo}from"react";import{v4 as Sd}from"uuid";import{c as zu}from"react/compiler-runtime";import{jsx as Kt,jsxs as Uu}from"react/jsx-runtime";import{useLexicalEditable as Wu}from"@lexical/react/useLexicalEditable";import{RenderFields as Vu,useFormSubmitted as Ku}from"@payloadcms/ui";import Ju,{createContext as Xu}from"react";var Wr=Xu({baseClass:"LexicalEditorTheme__block",BlockCollapsible:()=>null,BlockDrawer:()=>null,EditButton:()=>null,errorCount:0,formSchema:[],initialState:!1,nodeKey:"",RemoveButton:()=>null}),ce=()=>Ju.use(Wr),Vr=t=>{let e=zu(4),{Collapsible:o,CustomBlock:n,CustomLabel:r,...l}=t,{BlockDrawer:s,errorCount:i,formSchema:u}=l,c=Ku()&&i>0,a=Wu(),m;e[0]!==o||e[1]!==i||e[2]!==c?(m=h=>{let{children:x,...C}=h;return Kt(o,{errorCount:i,fieldHasErrors:c,...C,children:x})},e[0]=o,e[1]=i,e[2]=c,e[3]=m):m=e[3];let p=m,f={...l,BlockCollapsible:p};return n?Uu(Wr,{value:f,children:[n,Kt(s,{})]}):Kt(p,{children:Kt(Vu,{fields:u,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!a})})};import{useId as td}from"react";import{$getNodeByKey as Jt,COMMAND_PRIORITY_HIGH as Yu,KEY_ENTER_COMMAND as Zu,SKIP_DOM_SELECTION_TAG as qu}from"lexical";import{useCallback as Wo,useEffect as Kr,useLayoutEffect as Qu,useRef as Vo,useState as ed}from"react";function Jr({editor:t,nodeKey:e}){let[o,n]=ed(null),r=Vo(null),l=Vo(!1),s=Vo(!1),i=o!==null;Kr(()=>t.registerCommand(Zu,a=>{let m=a?.target;return m instanceof HTMLElement&&!!t.getElementByKey(e)?.contains(m)&&!!m.closest(".collapsible__actions button")},Yu),[t,e]),Kr(()=>{if(!i)return;let a,m=()=>{l.current=!0},p=()=>{l.current=!1,s.current&&(a=setTimeout(()=>{r.current=null,n(null)},0))};return document.addEventListener("pointerdown",m,!0),document.addEventListener("pointerup",p,!0),document.addEventListener("pointercancel",p,!0),()=>{document.removeEventListener("pointerdown",m,!0),document.removeEventListener("pointerup",p,!0),document.removeEventListener("pointercancel",p,!0),clearTimeout(a),l.current=!1,s.current=!1}},[i]),Qu(()=>{if(o===null)return;let a=[];return t.getEditorState().read(()=>{let m=Jt(e),p=m?.getParent()?.getChildren(),f=m?.getIndexWithinParent();if(!p||f===void 0||f===o)return;let h=p.map(I=>t.getElementByKey(I.getKey())),x=h[f],C=h[o],E=h[f+(o>f?1:-1)];if(!x||!C||!E)return;let w=x.getBoundingClientRect(),g=C.getBoundingClientRect(),b=E.getBoundingClientRect(),k=o>f,_=k?g.bottom-w.bottom:g.top-w.top,T=k?w.top-b.top:w.bottom-b.bottom;for(let I=Math.min(f,o);I<=Math.max(f,o);I++){let N=h[I];if(N){let S=N.style.translate;a.push(()=>{N.style.translate=S}),N.style.translate=`0 ${I===f?_:T}px`}}x.querySelector(".collapsible__drag")?.scrollIntoView({block:"nearest"})}),()=>a.forEach(m=>m())},[t,e,o]);let u=Wo(({direction:a,index:m})=>{t.isEditable()&&t.update(()=>{let p=Jt(e),f=p?.getParent()?.getChildren();if(!p||!f)return;let h=p.getIndexWithinParent(),x=m??h+(a??0),C=f[x];C&&C!==p&&(x<h?C.insertBefore(p):C.insertAfter(p))},{onUpdate:()=>{requestAnimationFrame(()=>{let p=t.getElementByKey(e)?.querySelector(".collapsible__toggle-wrap");(p?.querySelector(".collapsible__drag")??p?.querySelector(".LexicalEditorTheme__block__actions-button"))?.focus()})},tag:qu})},[t,e]),d=Wo(a=>{t.isEditable()&&(a.key===" "||a.key==="Enter"?(a.preventDefault(),a.stopPropagation(),r.current===null?(t.getEditorState().read(()=>{r.current=Jt(e)?.getIndexWithinParent()??null}),n(r.current)):(u({index:r.current}),r.current=null,n(null))):r.current!==null&&(a.key==="Escape"||a.key==="Tab"?(r.current=null,n(null),a.key==="Escape"&&(a.preventDefault(),a.stopPropagation())):(a.key==="ArrowUp"||a.key==="ArrowDown")&&(a.preventDefault(),a.stopPropagation(),t.getEditorState().read(()=>{let m=Jt(e)?.getParent()?.getChildrenSize()??0;r.current=Math.max(0,Math.min(m-1,(r.current??0)+(a.key==="ArrowDown"?1:-1)))}),n(r.current))))},[t,u,e]),c=Wo(()=>{if(l.current){s.current=!0;return}r.current=null,n(null)},[]);return{isReordering:i,move:u,onBlur:c,onKeyDown:d,targetIndex:o}}function Xr({children:t,editor:e,nodeKey:o}){let n=Jr({editor:e,nodeKey:o}),r=td();return t({...n,reorderInstructionsID:r})}function Yr({fields:t}){for(let e in t){let o=t[e];Array.isArray(o?.rows)&&"value"in o&&(o.disableFormData=!0)}return t}var el=t=>{let{cacheBuster:e,className:o,CustomBlock:n,CustomLabel:r,formData:l,nodeKey:s}=t,i=kd(),{id:u,collectionSlug:d,globalSlug:c}=qr(),{fieldProps:{featureClientSchemaMap:a,field:m,initialLexicalFormState:p,schemaPath:f},uuid:h}=W(),{fields:x}=Cd(),C=Yo(new AbortController),E=bd(),[w,g]=Fe.useState(0),{config:b}=xd(),k=dd({slug:`lexical-blocks-create-${h}-${l.id}`,depth:E}),{toggleDrawer:_}=Oe(k),{getDocPreferences:T,setDocFieldPreferences:I}=qr(),[N]=nd(),S=rd(),y=l.blockType,{getFormState:L}=_d(),R=`${f}.lexical_internal_feature.blocks.lexical_blocks.${y}.fields`,[v,A]=Fe.useState(()=>{let H=p?.[l.id]?.formState;if(!H)return!1;let q=Object.fromEntries(Object.entries(H).map(([U,K])=>[U,U in l?{...K,initialValue:l[U],value:l[U]}:K]));return q.blockName={initialValue:l.blockName,passesCondition:!0,valid:!0,value:l.blockName},q}),$=Yo(!1),O=Yo(e);Zt(()=>{$.current?(O.current!==e&&A(!1),O.current=e):$.current=!0},[e]);let[B]=Fe.useState(()=>Sd()),[F,z]=Fe.useState(()=>{if(!r)return v?._components?.customComponents?.BlockLabel??void 0}),[V,Ye]=Fe.useState(()=>{if(!n)return v?._components?.customComponents?.Block??void 0}),Re=Pe(()=>n?G(n,{className:o,formData:l,isEditor:!0,isJSXConverter:!1,nodeKey:s,useBlockComponentContext:ce}):V,[n,o,l,s,V]),ge=Pe(()=>r?G(r,{className:o,formData:l,isEditor:!0,isJSXConverter:!1,nodeKey:s,useBlockComponentContext:ce}):F,[r,o,l,s,F]);Zt(()=>{let H=new AbortController;return l&&!v&&(async()=>{let{state:U}=await L({id:u,collectionSlug:d,data:l,docPermissions:{fields:!0},docPreferences:await T(),documentFormState:Yt(x,{excludeFiles:!0}),globalSlug:c,initialBlockData:l,operation:"update",readOnly:!S,renderAllFields:!0,schemaPath:R,signal:H.signal});if(U){U.blockName={initialValue:l.blockName,passesCondition:!0,valid:!0,value:l.blockName};let K=Qr(Yt(U,{excludeFiles:!0}),!0);N.update(()=>{let J=Xt(s);if(J&&Ae(J)){let ue=K;ue.blockType=y,J.setFields(ue,!0)}},{tag:Jo}),A(U),r||z(U._components?.customComponents?.BlockLabel??void 0),n||Ye(U._components?.customComponents?.Block??void 0)}})(),()=>{Ko(H)}},[L,R,S,u,r,n,l,N,s,v,d,c,T,x,y]);let[se,xe]=Fe.useState(p?.[l.id]?.collapsed??!1),Gt=`${f}.lexical_internal_feature.blocks.lexical_blocks.${y}`,xt=a.blocks?.[Gt]?.[0]?.blocks?.[0],oe=typeof xt=="string"?b.blocksMap[xt]:xt,{i18n:Ct,t:Y}=Td(),$o=Xo(async({formState:H,submit:q})=>{Ko(C.current);let U=new AbortController;C.current=U;let{state:K}=await L({id:u,collectionSlug:d,docPermissions:{fields:!0},docPreferences:await T(),documentFormState:Yt(x,{excludeFiles:!0}),formState:H,globalSlug:c,initialBlockFormState:H,operation:"update",readOnly:!S,renderAllFields:!!q,schemaPath:R,signal:U.signal});if(!K)return H;H.blockName&&(K.blockName=H.blockName);let J=Qr(Yr({fields:Yt(K,{excludeFiles:!0})}),!0);if(setTimeout(()=>{N.update(()=>{let ue=Xt(s);if(ue&&Ae(ue)){let De=J;De.blockType=y,ue.setFields(De,!0)}},{tag:Jo})},0),q){r||z(K._components?.customComponents?.BlockLabel??void 0),n||Ye(K._components?.customComponents?.Block??void 0);let ue=0;for(let De of Object.values(K))De?.valid===!1&&ue++;g(ue)}return K},[L,u,d,T,c,R,y,x,S,N,s,n,r]);Zt(()=>()=>{Ko(C.current)},[]);let zt=Xo(()=>{N.update(()=>{Xt(s)?.remove()})},[N,s]),[sr,Vc]=Fe.useState(0);Zt(()=>{let H=()=>{N.getEditorState().read(()=>{let U=wd().getChildren(),K=0;for(let J of U)if(Ae(J)){if(J.getKey()===s){Vc(K);return}K++}})};return H(),N.registerUpdateListener(()=>{H()})},[N,s]);let qe=oe?.labels?.singular?ld(oe.labels.singular,Ct):oe?.slug,ar=Xo(H=>{T().then(q=>{let K=q?.fields?.[m.name]?.collapsed,J=K&&K?.length?K:[];H?J.includes(l.id)||J.push(l.id):J.includes(l.id)&&J.splice(J.indexOf(l.id),1),I(m.name,{collapsed:J,hello:"hi"})})},[T,m.name,I,l.id]),cr=Pe(()=>()=>G(Zr,{buttonStyle:"ghost",className:`${o}__editButton`,disabled:!S,el:"button",icon:"edit",onClick:H=>(H.preventDefault(),H.stopPropagation(),_(),!1),onMouseDown:H=>{H.preventDefault()},round:!0,size:"medium",tooltip:Y("lexical:blocks:inlineBlocks:edit",{label:qe})}),[o,S,Y,qe,_]),ur=Pe(()=>()=>G(Zr,{buttonStyle:"ghost",className:`${o}__removeButton`,disabled:!S,icon:"x",onClick:H=>{H.preventDefault(),zt()},round:!0,tooltip:"Remove Block"}),[o,S,zt]),Do=Pe(()=>function({Actions:q,children:U,className:K,collapsibleProps:J,disableBlockName:ue,editButton:De,errorCount:Jc,fieldHasErrors:Oo,Label:hr,Pill:gr,removeButton:Xc,showDragHandle:Yc=!0,showRowNumber:Zc=!0}){return G(Xr,{editor:N,nodeKey:s,children:({isReordering:xr,move:Cr,onBlur:qc,onKeyDown:Qc,reorderInstructionsID:br,targetIndex:eu})=>G("div",{className:`${o}__container ${o}-${y}`,onKeyDownCapture:X=>{let Fo=X.target;X.altKey||X.ctrlKey||X.metaKey||Fo.closest(".collapsible")?.parentElement!==X.currentTarget||(Fo.matches(".collapsible__drag")&&[" ","ArrowDown","ArrowUp","Enter","Escape","Tab"].includes(X.key)?(Qc(X),X.stopPropagation()):X.key==="Tab"&&Fo.matches(".collapsible__toggle")&&X.stopPropagation())},children:Me(id,{actions:typeof q<"u"?q:S?G(fd,{button:G(md,{}),buttonClassName:`${o}__actions-button`,caret:!1,horizontalAlign:"right",popupType:"menu",render:({close:X})=>Me(Lt.ButtonGroup,{buttonSize:"medium",children:[G(Lt.Button,{onClick:()=>{X(),Cr({direction:-1})},children:Y("general:moveUp")}),G(Lt.Button,{onClick:()=>{X(),Cr({direction:1})},children:Y("general:moveDown")}),(Re&&De!==!1||!Re&&De)&&G(Lt.Button,{onClick:()=>{_(),X()},children:Y("general:edit")}),Xc!==!1&&Me(Lt.Button,{onClick:()=>{zt(),X()},children:[G(Ed,{}),Y("general:remove")]})]}),size:"large"}):null,className:[`${o}__row`,Oo?`${o}__row--has-errors`:`${o}__row--no-errors`,K].filter(Boolean).join(" "),collapsibleStyle:Oo?"error":"default",dragHandleProps:Yc&&S?{id:s,attributes:{"aria-describedby":br,"aria-pressed":xr,role:"button",tabIndex:0},listeners:{onBlur:qc}}:void 0,header:G("div",{className:`${o}__block-header`,children:typeof hr<"u"?hr:typeof ge<"u"?ge:Me("div",{className:`${o}__block-label`,children:[Zc&&G("span",{className:`${o}__block-number`,children:String(sr+1).padStart(2,"0")}),typeof gr<"u"?gr:G(pd,{className:`${o}__block-pill ${o}__block-pill-${y}`,pillStyle:"white",size:"small",children:qe??y}),!ue&&!oe?.admin?.disableBlockName&&G(gd,{path:"blockName",readOnly:!S}),Oo&&G(cd,{count:Jc??0,i18n:Ct,withMessage:!0})]})}),isCollapsed:se,onToggle:X=>{ar(X),xe(X)},...J||{},AfterCollapsible:Me(od,{children:[J?.AfterCollapsible,G("span",{className:"sr-only",role:"status",children:xr?`${Y("general:order")}: ${(eu??0)+1}`:""})]}),children:[Me("span",{className:"sr-only",id:br,children:["Space / Enter \xB7 ",Y("general:moveUp")," \u2191 \xB7 ",Y("general:moveDown")," \u2193 \xB7"," ",Y("general:cancel")," Escape"]}),U]},0)})})},[N,Re,ge,qe,o,oe?.admin?.disableBlockName,y,Ct,se,ar,S,s,zt,sr,Y,_]),dr=l?.id,{headerActions:mr,submitRef:pr}=kr(),fr=Pe(()=>()=>G(ad,{children:G(sd,{className:"",headerActions:mr,slug:k,title:Y(`lexical:blocks:inlineBlocks:${dr?"edit":"create"}`,{label:qe??Y("lexical:blocks:inlineBlocks:label")}),children:v?Me("div",{className:"fields-drawer",children:[G(hd,{fields:oe?.fields??[],forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:R,permissions:!0,readOnly:!S}),G(_r,{submitRef:pr})]}):null})}),[v,k,dr,qe,Y,S,oe?.fields,R,mr,pr]),Kc=Pe(()=>v?G("div",{"data-block-drawer-slug":k,style:{display:"contents"},children:G(ud,{beforeSubmit:[async({formState:H})=>await $o({formState:H,submit:!0})],el:"div",fields:oe?.fields??[],initialState:v,onChange:[$o],onSubmit:(H,q)=>{q.blockType=y,N.update(()=>{let U=Xt(s);U&&Ae(U)&&U.setFields(q,!0)},{tag:Jo}),_()},submitted:i,uuid:B,children:G(Vr,{baseClass:o,BlockDrawer:fr,Collapsible:Do,CustomBlock:Re,CustomLabel:ge,EditButton:cr,errorCount:w,formSchema:oe?.fields??[],initialState:v,nodeKey:s,RemoveButton:ur})})}):null,[Do,fr,Re,ge,y,k,ur,cr,o,N,w,_,oe?.fields,B,v,s,$o,i]);return oe?Kc:G(Do,{disableBlockName:!0,fieldHasErrors:!0,children:Me("div",{className:`${o}-not-found`,children:["Error: Block '",y,"' not found in the config but exists in the lexical data"]})})};var de=class extends Nt{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=Be(e.fields);return o.setFormat(e.format),o}decorate(...[e,o,n,r]){return Nd(el,{cacheBuster:this.getCacheBuster(),className:o.theme.block??"LexicalEditorTheme__block",CustomBlock:n,CustomLabel:r,formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Be(t){return yd(new de({fields:{...t,id:t?.id||new Ld.default().toHexString()}}))}function Ae(t){return t instanceof de}import{createHeadlessEditor as Rd}from"@lexical/headless";import{$convertToMarkdownString as vd}from"@lexical/markdown";function Zo(t,e){return({editorState:n})=>{let r=Rd({nodes:t});try{r.setEditorState(r.parseEditorState(n))}catch(s){console.error("getLexicalToMarkdown: ERROR parsing editor state",s)}let l="";return r.getEditorState().read(()=>{l=vd(e)}),l}}import{createHeadlessEditor as jd}from"@lexical/headless";import{$convertFromMarkdownString as al,TRANSFORMERS as Bd}from"@lexical/markdown";var tl=/^[\t ]*$/,Id=/^(\s*)(\d+)\.\s/,Md=/^(\s*)[-*+]\s/,Ad=/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,ol=/^(#{1,6})\s/,$d=/^>\s/,Dd=/^[ \t]*(\\`\\`\\`|```)(\w+)?/,nl=/[ \t]*(\\`\\`\\`|```)$/,Od=/^[ \t]*```[^`]+(?:(?:`{1,2}|`{4,})[^`]+)*```(?:[^`]|$)/,Fd=/^\|(.+)\|\s?$/,Pd=/^(\| ?:?-*:? ?)+\|\s?$/,rl=/^[ \t]*<[a-z_][\w-]*(?:\s[^<>]*)?\/?>/i,ll=/^[ \t]*<\/[a-z_][\w-]*\s*>/i;function il(t){if(t.endsWith("\\"))return[t.slice(0,-1),"\\"];let e=t.match(/^(.*?\S)( {2,})$/);return e?[e[1],e[2]]:null}function sl(t,e){let o=t.split(`
|
|
9
|
-
`),n=!1,r=[],l=0;for(let s=0;s<o.length;s++){let i=o[s],u=r[r.length-1],d=s<o.length-1?
|
|
10
|
-
`)}function
|
|
11
|
-
`))for(let
|
|
12
|
-
`)){let
|
|
13
|
-
`,p
|
|
14
|
-
`;return`<${i.blockType}${c?" "+
|
|
15
|
-
${
|
|
16
|
-
`)?
|
|
17
|
-
`)){let k=
|
|
18
|
-
`),_=0;for(let T of k){if(_++,T.startsWith(" "))E+=T.slice(2);else if(T==="")E+=T;else{E=
|
|
19
|
-
`)?
|
|
20
|
-
`}}else E=(
|
|
21
|
-
`;if(!t?.jsx?.import)return[!1,u];let
|
|
8
|
+
. Start match: `+JSON.stringify(r))}return{afterEndLine:u[C].trim().slice(g),beforeStartLine:p,content:i,endLineIndex:n+C,endlineLastCharIndex:g,propsString:s}}import{jsx as Ad}from"react/jsx-runtime";import Dd from"bson-objectid";import{$applyNodeReplacement as $d}from"lexical";import"react";import{DecoratorBlockNode as Wu}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as Vu}from"@lexical/utils";import Ku from"bson-objectid";import{$applyNodeReplacement as Ju}from"lexical";var yt=class extends Wu{__cacheBuster;__fields;constructor({cacheBuster:e,fields:o,format:n,key:r}){super(n,r),this.__fields=o,this.__cacheBuster=e||0}static clone(e){return new this({cacheBuster:e.__cacheBuster,fields:e.__fields,format:e.__format,key:e.__key})}static getType(){return"block"}static importDOM(){return{}}static importJSON(e){e.version===1&&(e={...e,fields:{...e.fields.data},version:2});let o=Xu(e.fields);return o.setFormat(e.format),o}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return Vu(o,e?.theme?.block),o}decorate(e,o){return null}exportDOM(){let e=document.createElement("div"),o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),type:"block",fields:this.getFields(),version:2}}getCacheBuster(){return this.getLatest().__cacheBuster}getFields(){return this.getLatest().__fields}getTextContent(){return"Block Field"}setFields(e,o){let n=this.getWritable();n.__fields=e,o||n.__cacheBuster++}};function Xu(t){return Ju(new yt({fields:{...t,id:t?.id||new Ku.default().toHexString()}}))}import{jsx as U,jsxs as ve,Fragment as cd}from"react/jsx-runtime";import{useLexicalComposerContext as ud}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as dd}from"@lexical/react/useLexicalEditable";import{getTranslation as md}from"@payloadcms/translations";import{Button as il,Collapsible as fd,Drawer as pd,EditDepthProvider as hd,ErrorPill as gd,Form as xd,formatDrawerSlug as Cd,MoreIcon as bd,Pill as kd,Popup as _d,PopupList as Rt,RenderFields as Td,SectionTitle as Ed,useConfig as wd,useDocumentForm as Sd,useDocumentInfo as sl,useEditDepth as Nd,useFormSubmitted as Ld,useServerFunctions as yd,useTranslation as Rd,XIcon as vd}from"@payloadcms/ui";import{abortAndIgnore as en}from"@payloadcms/ui/shared";import{$getNodeByKey as Qt,$getRoot as Id,SKIP_DOM_SELECTION_TAG as tn}from"lexical";import{deepCopyObjectSimpleWithoutReactComponents as vt}from"payload/shared";import $e,{useCallback as on,useEffect as eo,useMemo as Oe,useRef as to}from"react";import{v4 as Md}from"uuid";import{c as Yu}from"react/compiler-runtime";import{jsx as Zt,jsxs as Zu}from"react/jsx-runtime";import{useLexicalEditable as qu}from"@lexical/react/useLexicalEditable";import{RenderFields as Qu,useFormSubmitted as ed}from"@payloadcms/ui";import td,{createContext as od}from"react";var tl=od({baseClass:"LexicalEditorTheme__block",BlockCollapsible:()=>null,BlockDrawer:()=>null,EditButton:()=>null,errorCount:0,formSchema:[],initialState:!1,nodeKey:"",RemoveButton:()=>null}),ae=()=>td.use(tl),ol=t=>{let e=Yu(4),{Collapsible:o,CustomBlock:n,CustomLabel:r,...l}=t,{BlockDrawer:s,errorCount:i,formSchema:u}=l,c=ed()&&i>0,a=qu(),m;e[0]!==o||e[1]!==i||e[2]!==c?(m=p=>{let{children:g,...C}=p;return Zt(o,{errorCount:i,fieldHasErrors:c,...C,children:g})},e[0]=o,e[1]=i,e[2]=c,e[3]=m):m=e[3];let f=m,h={...l,BlockCollapsible:f};return n?Zu(tl,{value:h,children:[n,Zt(s,{})]}):Zt(f,{children:Zt(Qu,{fields:u,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!a})})};import{useId as ad}from"react";import{$getNodeByKey as qt,COMMAND_PRIORITY_HIGH as nd,KEY_DOWN_COMMAND as rd,SKIP_DOM_SELECTION_TAG as ld}from"lexical";import{useCallback as qo,useEffect as nl,useLayoutEffect as id,useRef as Qo,useState as sd}from"react";function rl({editor:t,nodeKey:e}){let[o,n]=sd(null),r=Qo(null),l=Qo(!1),s=Qo(!1),i=o!==null;nl(()=>t.registerCommand(rd,a=>{let m=a?.target;return m instanceof HTMLElement&&!!t.getElementByKey(e)?.contains(m)&&!!m.closest(".collapsible__actions button")},nd),[t,e]),nl(()=>{if(!i)return;let a,m=()=>{l.current=!0},f=()=>{l.current=!1,s.current&&(a=setTimeout(()=>{r.current=null,n(null)},0))};return document.addEventListener("pointerdown",m,!0),document.addEventListener("pointerup",f,!0),document.addEventListener("pointercancel",f,!0),()=>{document.removeEventListener("pointerdown",m,!0),document.removeEventListener("pointerup",f,!0),document.removeEventListener("pointercancel",f,!0),clearTimeout(a),l.current=!1,s.current=!1}},[i]),id(()=>{if(o===null)return;let a=[];return t.getEditorState().read(()=>{let m=qt(e),f=m?.getParent()?.getChildren(),h=m?.getIndexWithinParent();if(!f||h===void 0||h===o)return;let p=f.map(I=>t.getElementByKey(I.getKey())),g=p[h],C=p[o],E=p[h+(o>h?1:-1)];if(!g||!C||!E)return;let L=g.getBoundingClientRect(),x=C.getBoundingClientRect(),b=E.getBoundingClientRect(),k=o>h,_=k?x.bottom-L.bottom:x.top-L.top,T=k?L.top-b.top:L.bottom-b.bottom;for(let I=Math.min(h,o);I<=Math.max(h,o);I++){let N=p[I];if(N){let w=N.style.translate;a.push(()=>{N.style.translate=w}),N.style.translate=`0 ${I===h?_:T}px`}}g.querySelector(".collapsible__drag")?.scrollIntoView({block:"nearest"})}),()=>a.forEach(m=>m())},[t,e,o]);let u=qo(({direction:a,index:m})=>{t.isEditable()&&t.update(()=>{let f=qt(e),h=f?.getParent()?.getChildren();if(!f||!h)return;let p=f.getIndexWithinParent(),g=m??p+(a??0),C=h[g];C&&C!==f&&(g<p?C.insertBefore(f):C.insertAfter(f))},{onUpdate:()=>{requestAnimationFrame(()=>{let f=t.getElementByKey(e)?.querySelector(".collapsible__toggle-wrap");(f?.querySelector(".collapsible__drag")??f?.querySelector(".LexicalEditorTheme__block__actions-button"))?.focus()})},tag:ld})},[t,e]),d=qo(a=>{t.isEditable()&&(a.key===" "||a.key==="Enter"?(a.preventDefault(),a.stopPropagation(),r.current===null?(t.getEditorState().read(()=>{r.current=qt(e)?.getIndexWithinParent()??null}),n(r.current)):(u({index:r.current}),r.current=null,n(null))):r.current!==null&&(a.key==="Escape"||a.key==="Tab"?(r.current=null,n(null),a.key==="Escape"&&(a.preventDefault(),a.stopPropagation())):(a.key==="ArrowUp"||a.key==="ArrowDown")&&(a.preventDefault(),a.stopPropagation(),t.getEditorState().read(()=>{let m=qt(e)?.getParent()?.getChildrenSize()??0;r.current=Math.max(0,Math.min(m-1,(r.current??0)+(a.key==="ArrowDown"?1:-1)))}),n(r.current))))},[t,u,e]),c=qo(()=>{if(l.current){s.current=!0;return}r.current=null,n(null)},[]);return{isReordering:i,move:u,onBlur:c,onKeyDown:d,targetIndex:o}}function ll({children:t,editor:e,nodeKey:o}){let n=rl({editor:e,nodeKey:o}),r=ad();return t({...n,reorderInstructionsID:r})}var al=t=>{let{cacheBuster:e,className:o,CustomBlock:n,CustomLabel:r,formData:l,nodeKey:s}=t,i=Ld(),{id:u,collectionSlug:d,globalSlug:c}=sl(),{fieldProps:{featureClientSchemaMap:a,field:m,initialLexicalFormState:f,schemaPath:h},uuid:p}=W(),{fields:g}=Sd(),C=to(new AbortController),E=Nd(),[L,x]=$e.useState(0),{config:b}=wd(),k=Cd({slug:`lexical-blocks-create-${p}-${l.id}`,depth:E}),{toggleDrawer:_}=De(k),{getDocPreferences:T,setDocFieldPreferences:I}=sl(),[N]=ud(),w=dd(),y=l.blockType,S=to(l);S.current=l;let R=`${h}.lexical_internal_feature.blocks.lexical_blocks.${y}`,F=a.blocks?.[R]?.[0]?.blocks?.[0],M=typeof F=="string"?b.blocksMap[F]:F,{getFormState:B}=yd(),$=`${h}.lexical_internal_feature.blocks.lexical_blocks.${y}.fields`,[P,V]=$e.useState(()=>{let H=f?.[l.id],Y=H?.formState;if(!Y)return!1;let K=Ir({cachedFormState:Y,cachedSchemaPath:H.schemaPath,currentSchemaPath:$,formData:l});return K?{...K,blockName:{initialValue:l.blockName,passesCondition:!0,valid:!0,value:l.blockName}}:!1}),Je=to(!1),xt=to(e);eo(()=>{Je.current?(xt.current!==e&&V(!1),xt.current=e):Je.current=!0},[e]);let[Xe]=$e.useState(()=>Md()),[ie,me]=$e.useState(()=>{if(!r)return P?._components?.customComponents?.BlockLabel??void 0}),[Ct,Wt]=$e.useState(()=>{if(!n)return P?._components?.customComponents?.Block??void 0}),ce=Oe(()=>n?U(n,{className:o,formData:l,isEditor:!0,isJSXConverter:!1,nodeKey:s,useBlockComponentContext:ae}):Ct,[n,o,l,s,Ct]),Ae=Oe(()=>r?U(r,{className:o,formData:l,isEditor:!0,isJSXConverter:!1,nodeKey:s,useBlockComponentContext:ae}):ie,[r,o,l,s,ie]);eo(()=>{let H=new AbortController;return M&&l&&!P&&(async()=>{let{state:K}=await B({id:u,collectionSlug:d,data:l,docPermissions:{fields:!0},docPreferences:await T(),documentFormState:vt(g,{excludeFiles:!0}),globalSlug:c,initialBlockData:l,operation:"update",readOnly:!w,renderAllFields:!0,schemaPath:$,signal:H.signal});if(K){K.blockName={initialValue:l.blockName,passesCondition:!0,valid:!0,value:l.blockName};let ee=kt(vt(K,{excludeFiles:!0}));N.update(()=>{let z=Qt(s);if(z&&Ie(z)){let Ze=ee;Ze.blockType=y,z.setFields(Ze,!0)}},{tag:tn}),V(K),r||me(K._components?.customComponents?.BlockLabel??void 0),n||Wt(K._components?.customComponents?.Block??void 0)}})(),()=>{en(H)}},[B,$,w,u,r,n,l,N,s,P,d,c,T,g,y,M]);let[Vt,Bo]=$e.useState(f?.[l.id]?.collapsed??!1),{i18n:bt,t:Q}=Rd(),jo=on(async({formState:H,submit:Y})=>{en(C.current);let K=new AbortController;C.current=K;let ee=kt(vt(H,{excludeFiles:!0}),S.current),{state:z}=await B({id:u,collectionSlug:d,data:ee,docPermissions:{fields:!0},docPreferences:await T(),documentFormState:vt(g,{excludeFiles:!0}),formState:H,globalSlug:c,initialBlockData:ee,operation:"update",readOnly:!w,renderAllFields:!!Y,schemaPath:$,signal:K.signal});if(!z)return H;H.blockName&&(z.blockName=H.blockName);let Ze=kt(vt(z,{excludeFiles:!0}),ee);if(setTimeout(()=>{N.update(()=>{let ge=Qt(s);if(ge&&Ie(ge)){let qe=Ze;qe.blockType=y,ge.setFields(qe,!0)}},{tag:tn})},0),Y){r||me(z._components?.customComponents?.BlockLabel??void 0),n||Wt(z._components?.customComponents?.Block??void 0);let ge=0;for(let qe of Object.values(z))qe?.valid===!1&&ge++;x(ge)}return z},[B,u,d,T,c,$,y,g,w,N,s,n,r]);eo(()=>()=>{en(C.current)},[]);let Kt=on(()=>{N.update(()=>{Qt(s)?.remove()})},[N,s]),[xr,eu]=$e.useState(0);eo(()=>{let H=()=>{N.getEditorState().read(()=>{let K=Id().getChildren(),ee=0;for(let z of K)if(Ie(z)){if(z.getKey()===s){eu(ee);return}ee++}})};return H(),N.registerUpdateListener(()=>{H()})},[N,s]);let Ye=M?.labels?.singular?md(M.labels.singular,bt):M?.slug,Cr=on(H=>{T().then(Y=>{let ee=Y?.fields?.[m.name]?.collapsed,z=ee&&ee?.length?ee:[];H?z.includes(l.id)||z.push(l.id):z.includes(l.id)&&z.splice(z.indexOf(l.id),1),I(m.name,{collapsed:z,hello:"hi"})})},[T,m.name,I,l.id]),br=Oe(()=>()=>U(il,{buttonStyle:"ghost",className:`${o}__editButton`,disabled:!w,el:"button",icon:"edit",onClick:H=>(H.preventDefault(),H.stopPropagation(),_(),!1),onMouseDown:H=>{H.preventDefault()},round:!0,size:"medium",tooltip:Q("lexical:blocks:inlineBlocks:edit",{label:Ye})}),[o,w,Q,Ye,_]),kr=Oe(()=>()=>U(il,{buttonStyle:"ghost",className:`${o}__removeButton`,disabled:!w,icon:"x",onClick:H=>{H.preventDefault(),Kt()},round:!0,tooltip:"Remove Block"}),[o,w,Kt]),Ho=Oe(()=>function({Actions:Y,children:K,className:ee,collapsibleProps:z,disableBlockName:Ze,editButton:ge,errorCount:qe,fieldHasErrors:Go,Label:Sr,Pill:Nr,removeButton:ou,showDragHandle:nu=!0,showRowNumber:ru=!0}){return U(ll,{editor:N,nodeKey:s,children:({isReordering:Uo,move:Lr,onBlur:lu,onKeyDown:iu,reorderInstructionsID:yr,targetIndex:su})=>U("div",{className:`${o}__container ${o}-${y}`,onKeyDownCapture:J=>{let zo=J.target;J.altKey||J.ctrlKey||J.metaKey||zo.closest(".collapsible")?.parentElement!==J.currentTarget||(zo.matches(".collapsible__drag")&&(J.key!=="Escape"||Uo)&&[" ","ArrowDown","ArrowUp","Enter","Escape","Tab"].includes(J.key)?(iu(J),J.stopPropagation()):J.key==="Tab"&&zo.matches(".collapsible__toggle")&&J.stopPropagation())},children:ve(fd,{actions:typeof Y<"u"?Y:w?U(_d,{button:U(bd,{}),buttonClassName:`${o}__actions-button`,caret:!1,horizontalAlign:"right",popupType:"menu",render:({close:J})=>ve(Rt.ButtonGroup,{buttonSize:"medium",children:[U(Rt.Button,{onClick:()=>{J(),Lr({direction:-1})},children:Q("general:moveUp")}),U(Rt.Button,{onClick:()=>{J(),Lr({direction:1})},children:Q("general:moveDown")}),(ce&&ge!==!1||!ce&&ge)&&U(Rt.Button,{onClick:()=>{_(),J()},children:Q("general:edit")}),ou!==!1&&ve(Rt.Button,{onClick:()=>{Kt(),J()},children:[U(vd,{}),Q("general:remove")]})]}),size:"large"}):null,className:[`${o}__row`,Go?`${o}__row--has-errors`:`${o}__row--no-errors`,ee].filter(Boolean).join(" "),collapsibleStyle:Go?"error":"default",dragHandleProps:nu&&w?{id:s,attributes:{"aria-describedby":yr,"aria-pressed":Uo,role:"button",tabIndex:0},listeners:{onBlur:lu}}:void 0,header:U("div",{className:`${o}__block-header`,children:typeof Sr<"u"?Sr:typeof Ae<"u"?Ae:ve("div",{className:`${o}__block-label`,children:[ru&&U("span",{className:`${o}__block-number`,children:String(xr+1).padStart(2,"0")}),typeof Nr<"u"?Nr:U(kd,{className:`${o}__block-pill ${o}__block-pill-${y}`,pillStyle:"white",size:"small",children:Ye??y}),!Ze&&!M?.admin?.disableBlockName&&U(Ed,{path:"blockName",readOnly:!w}),Go&&U(gd,{count:qe??0,i18n:bt,withMessage:!0})]})}),isCollapsed:Vt,onToggle:J=>{Cr(J),Bo(J)},...z||{},AfterCollapsible:ve(cd,{children:[z?.AfterCollapsible,U("span",{className:"sr-only",role:"status",children:Uo?`${Q("general:order")}: ${(su??0)+1}`:""})]}),children:[ve("span",{className:"sr-only",id:yr,children:["Space / Enter \xB7 ",Q("general:moveUp")," \u2191 \xB7 ",Q("general:moveDown")," \u2193 \xB7"," ",Q("general:cancel")," Escape"]}),K]},0)})})},[N,ce,Ae,Ye,o,M?.admin?.disableBlockName,y,bt,Vt,Cr,w,s,Kt,xr,Q,_]),_r=l?.id,{headerActions:Tr,submitRef:Er}=Rr(),wr=Oe(()=>()=>U(hd,{children:U(pd,{className:"",headerActions:Tr,slug:k,title:Q(`lexical:blocks:inlineBlocks:${_r?"edit":"create"}`,{label:Ye??Q("lexical:blocks:inlineBlocks:label")}),children:P?ve("div",{className:"fields-drawer",children:[U(Td,{fields:M?.fields??[],forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:$,permissions:!0,readOnly:!w}),U(vr,{submitRef:Er})]}):null})}),[P,k,_r,Ye,Q,w,M?.fields,$,Tr,Er]),tu=Oe(()=>P?U("div",{"data-block-drawer-slug":k,style:{display:"contents"},children:U(xd,{beforeSubmit:[async({formState:H})=>await jo({formState:H,submit:!0})],el:"div",fields:M?.fields??[],initialState:P,onChange:[jo],onSubmit:H=>{let Y=kt(H,S.current);Y.blockType=y,N.update(()=>{let K=Qt(s);K&&Ie(K)&&K.setFields(Y,!0)},{tag:tn}),_()},submitted:i,uuid:Xe,children:U(ol,{baseClass:o,BlockDrawer:wr,Collapsible:Ho,CustomBlock:ce,CustomLabel:Ae,EditButton:br,errorCount:L,formSchema:M?.fields??[],initialState:P,nodeKey:s,RemoveButton:kr})})}):null,[Ho,wr,ce,Ae,y,k,kr,br,o,N,L,_,M?.fields,Xe,P,s,jo,i]);return M?tu:U(Ho,{disableBlockName:!0,fieldHasErrors:!0,children:ve("div",{className:`${o}-not-found`,children:["Error: Block '",y,"' not found in the config but exists in the lexical data"]})})};var ue=class extends yt{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=Fe(e.fields);return o.setFormat(e.format),o}decorate(...[e,o,n,r]){return Ad(al,{cacheBuster:this.getCacheBuster(),className:o.theme.block??"LexicalEditorTheme__block",CustomBlock:n,CustomLabel:r,formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Fe(t){return $d(new ue({fields:{...t,id:t?.id||new Dd.default().toHexString()}}))}function Ie(t){return t instanceof ue}import{createHeadlessEditor as Od}from"@lexical/headless";import{$convertToMarkdownString as Fd}from"@lexical/markdown";function nn(t,e){return({editorState:n})=>{let r=Od({nodes:t});try{r.setEditorState(r.parseEditorState(n))}catch(s){console.error("getLexicalToMarkdown: ERROR parsing editor state",s)}let l="";return r.getEditorState().read(()=>{l=Fd(e)}),l}}import{createHeadlessEditor as Kd}from"@lexical/headless";import{$convertFromMarkdownString as gl,TRANSFORMERS as Vd}from"@lexical/markdown";var cl=/^[\t ]*$/,Pd=/^(\s*)(\d+)\.\s/,Bd=/^(\s*)[-*+]\s/,jd=/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,ul=/^(#{1,6})\s/,Hd=/^>\s/,Gd=/^[ \t]*(\\`\\`\\`|```)(\w+)?/,dl=/[ \t]*(\\`\\`\\`|```)$/,Ud=/^[ \t]*```[^`]+(?:(?:`{1,2}|`{4,})[^`]+)*```(?:[^`]|$)/,zd=/^\|(.+)\|\s?$/,Wd=/^(\| ?:?-*:? ?)+\|\s?$/,ml=/^[ \t]*<[a-z_][\w-]*(?:\s[^<>]*)?\/?>/i,fl=/^[ \t]*<\/[a-z_][\w-]*\s*>/i;function pl(t){if(t.endsWith("\\"))return[t.slice(0,-1),"\\"];let e=t.match(/^(.*?\S)( {2,})$/);return e?[e[1],e[2]]:null}function hl(t,e){let o=t.split(`
|
|
9
|
+
`),n=!1,r=[],l=0;for(let s=0;s<o.length;s++){let i=o[s],u=r[r.length-1],d=s<o.length-1?pl(i):null,c=u!==void 0&&pl(u)!==null;if(Ud.test(i)){r.push(i);continue}if(dl.test(i)){l===0&&(n=!0),l===1&&(n=!1),l>0&&l--,r.push(i);continue}if(Gd.test(i)){n=!0,l++,r.push(i);continue}if(n){r.push(i);continue}cl.test(i)||cl.test(u)||!u||ul.test(u)||ul.test(i)||Hd.test(i)||Pd.test(i)||Bd.test(i)||jd.test(i)||zd.test(i)||Wd.test(i)||c||!e||ml.test(i)||fl.test(i)||ml.test(u)||fl.test(u)||dl.test(u)?r.push(i):r[r.length-1]=u+" "+(d===null?i.trim():i.trimStart())}return r.join(`
|
|
10
|
+
`)}function oo(t,e=Vd,o,n=!1,r=!1){if(n)return gl(t,e,o,!0);let l=hl(t,r);return gl(l,e,o,!1,!1)}function no(t,e){return({markdown:n})=>{let r=Kd({nodes:t});return r.update(()=>{oo(n,e,void 0,!1,!0)},{discrete:!0}),r.getEditorState().toJSON()}}function Jd(t){let e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{regExpEnd:new RegExp(`</(${e})\\s*>|<${e}[^>]*?/>`,"i"),regExpStart:new RegExp(`<(${e})([^>]*?)\\s*(/?)>`,"i")}}var bl=({blocks:t,inlineBlocks:e})=>{if(!t?.length&&!e?.length)return[];let o=[];if(t?.length)for(let n of t){let r=Cl(n,!1);r&&(o=o.concat(r))}if(e?.length)for(let n of e){let r=Cl(n,!0);r&&(o=o.concat(r))}return o};function Cl(t,e){if(!t.jsx)return null;let o=Jd(t.slug),n=[];return e?(n.push(({allNodes:r,allTransformers:l})=>({type:"text-match",dependencies:[_t],export:s=>{if(!Et(s)||s.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let i=s.getFields(),u=nn(r,l),d=t.jsx.export({fields:i,lexicalToMarkdown:u});if(d===!1)return null;if(typeof d=="string")return d;let c=d.props&&Object.keys(d.props)?.length>0,a=d.props??{};return d?.children?.length?`<${i.blockType}${c?" "+Lt({props:a}):""}>${d.children}</${i.blockType}>`:`<${i.blockType}${c?" "+Lt({props:a}):""}/>`},getEndIndex:(s,i)=>{let{endlineLastCharIndex:u}=Yt({isEndOptional:!1,lines:[s.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:i,trimChildren:!1});return u},importRegExp:t.jsx?.customStartRegex??o.regExpStart,regExp:/___ignoreignoreignore___/g,replace(s,i){let{content:u,propsString:d}=Yt({isEndOptional:!1,lines:[s.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:{...i,index:0},trimChildren:!1});if(!t?.jsx?.import)return;let c=no(r,l),a=t.jsx.import({children:u,closeMatch:null,htmlToLexical:null,markdownToLexical:c,openMatch:i,props:d?Xt({propsString:d}):{}});if(a===!1)return;let m=Tt({blockType:t.slug,...a});s.replace(m)}})),n):(n.push(({allNodes:r,allTransformers:l})=>({dependencies:[ue],export:s=>{if(!Ie(s)||s.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let i=s.getFields(),u=nn(r,l),d=t.jsx.export({fields:i,lexicalToMarkdown:u});if(d===!1)return null;if(typeof d=="string")return d;let c=d.props&&Object.keys(d.props)?.length>0,a=d.props??{};if(d?.children?.length){let m=d.children,f="";if(m.includes(`
|
|
11
|
+
`))for(let h of m.split(`
|
|
12
|
+
`)){let p="";!t?.jsx?.doNotTrimChildren&&h!==""&&(p=" "),p+=h+`
|
|
13
|
+
`,f+=p}else f=(t?.jsx?.doNotTrimChildren?"":" ")+m+`
|
|
14
|
+
`;return`<${i.blockType}${c?" "+Lt({props:a}):""}>
|
|
15
|
+
${f}</${i.blockType}>`}return`<${i.blockType}${c?" "+Lt({props:a}):""}/>`},handleImportAfterStartMatch:t.jsx?.customEndRegex?void 0:({lines:s,rootNode:i,startLineIndex:u,startMatch:d,transformer:c})=>{let a=typeof c.regExpEnd=="object"&&"regExp"in c.regExpEnd?c.regExpEnd.regExp:c.regExpEnd,m=c.regExpEnd&&typeof c.regExpEnd=="object"&&"optional"in c.regExpEnd?c.regExpEnd.optional:!c.regExpEnd,{afterEndLine:f,beforeStartLine:h,content:p,endLineIndex:g,propsString:C}=Yt({isEndOptional:m,lines:s,regexpEndRegex:a,startLineIndex:u,startMatch:d,trimChildren:!1}),E="";if(t?.jsx?.doNotTrimChildren)E=p.endsWith(`
|
|
16
|
+
`)?p.slice(0,-1):p;else if(p.includes(`
|
|
17
|
+
`)){let k=p.split(`
|
|
18
|
+
`),_=0;for(let T of k){if(_++,T.startsWith(" "))E+=T.slice(2);else if(T==="")E+=T;else{E=p.endsWith(`
|
|
19
|
+
`)?p.slice(0,-1):p;break}E+=_===k.length?"":`
|
|
20
|
+
`}}else E=(p.startsWith(" ")?p.slice(2):p)+`
|
|
21
|
+
`;if(!t?.jsx?.import)return[!1,u];let L=no(r,l),x=t.jsx.import({children:E,closeMatch:null,htmlToLexical:null,markdownToLexical:L,openMatch:d,props:C?Xt({propsString:C}):{}});if(x===!1)return[!1,u];let b=Fe({...x,blockType:t.slug});if(b){let k=null,_=null;if(h?.length){k=L({markdown:h})?.root?.children??[];let T=k?.[0];T&&i.append(xl(T))}if(i.append(b),f?.length){_=L({markdown:f})?.root?.children;let T=i.getChildren()[i.getChildren().length-1],I=xl(_[0])?.getChildren();if(I?.length)for(let N of I)T.append(N)}}return[!0,g]},regExpEnd:t.jsx?.customEndRegex??o.regExpEnd,regExpStart:t.jsx?.customStartRegex??o.regExpStart,type:"multiline-element",replace:(s,i,u,d,c)=>{if(t?.jsx?.import){if(!c){let g="";if(i)for(let C of i)g+=C.getTextContent();c=[g]}let a="";t?.jsx?.doNotTrimChildren?a=c.join(`
|
|
22
22
|
`):a=c.join(`
|
|
23
|
-
`).trim();let m=u[1]?.trim(),
|
|
23
|
+
`).trim();let m=u[1]?.trim(),f=no(r,l),h=t.jsx.import({children:a,closeMatch:d,htmlToLexical:null,markdownToLexical:f,openMatch:u,props:m?Xt({propsString:m}):{}});if(h===!1)return!1;let p=Fe({...h,blockType:t.slug});p&&s.append(p);return}return!1}})),n)}import{createCommand as kl}from"lexical";var nt=kl("INSERT_BLOCK_COMMAND"),rt=kl("INSERT_INLINE_BLOCK_COMMAND");import{c as Xd}from"react/compiler-runtime";import{useLexicalComposerContext as Yd}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Zd,$wrapNodeInElement as qd,mergeRegister as Qd}from"@lexical/utils";import{formatDrawerSlug as em,useEditDepth as tm}from"@payloadcms/ui";import{$createParagraphNode as om,$getNodeByKey as nm,$getPreviousSelection as rm,$getSelection as lm,$insertNodes as im,$isParagraphNode as sm,$isRangeSelection as am,$isRootOrShadowRoot as cm,COMMAND_PRIORITY_EDITOR as _l}from"lexical";import{useEffect as um,useState as dm}from"react";var Tl=()=>{let t=Xd(12),[e]=Yd(),[o,n]=dm(null),{setCreatedInlineBlock:r,uuid:l}=W(),s=tm(),i="lexical-inlineBlocks-create-"+l,u;t[0]!==s||t[1]!==i?(u=em({slug:i,depth:s}),t[0]=s,t[1]=i,t[2]=u):u=t[2];let d=u,{toggleDrawer:c}=De(d,!0),a;t[3]!==e||t[4]!==r||t[5]!==o?(a=()=>{if(!e.hasNodes([ue]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return Qd(e.registerCommand(nt,f=>(e.update(()=>{let h=lm()||rm();if(am(h)){let p=Fe(f),{focus:g}=h,C=g.getNode();Zd(p),sm(C)&&!C.__first&&C.remove()}}),!0),_l),e.registerCommand(rt,f=>{if(o){let p=nm(o);return!p||!Et(p)?!1:(p.setFields(f),n(null),!0)}let h=Tt(f);return r?.(h),im([h]),cm(h.getParentOrThrow())&&qd(h,om).selectEnd(),!0},_l))},t[3]=e,t[4]=r,t[5]=o,t[6]=a):a=t[6];let m;return t[7]!==e||t[8]!==r||t[9]!==o||t[10]!==c?(m=[e,r,o,c],t[7]=e,t[8]=r,t[9]=o,t[10]=c,t[11]=m):m=t[11],um(a,m),null};var mm=A(({config:t,featureClientSchemaMap:e,props:o,schemaPath:n})=>{let r=`${n}.lexical_internal_feature.blocks.lexical_blocks`,l=`${n}.lexical_internal_feature.blocks.lexical_inline_blocks`,s=e.blocks;if(!s)return{};let i=Object.entries(s).filter(([a])=>a.startsWith(r+".")&&!a.replace(r+".","").includes(".")).map(([,a])=>a[0]),u=Object.entries(s).filter(([a])=>a.startsWith(l+".")&&!a.replace(l+".","").includes(".")).map(([,a])=>a[0]),d=i.map(a=>{let m=a.blocks[0];return typeof m=="string"?t.blocksMap[m]:m}).filter(a=>a!==void 0),c=u.map(a=>{let m=a.blocks[0];return typeof m=="string"?t.blocksMap[m]:m}).filter(a=>a!==void 0);return{markdownTransformers:bl({blocks:d,inlineBlocks:c}),nodes:[ue,_t],plugins:[{Component:Tl,position:"normal"}],sanitizedClientFeatureProps:o,slashMenu:{groups:[d?.length?{items:d.map(a=>({Icon:qr(a,Xo),key:"block-"+a.slug,keywords:["block","blocks",a.slug],label:({i18n:m})=>a?.labels?.singular?ro(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(nt,{blockName:"",blockType:a.slug})}})),key:"blocks",label:({i18n:a})=>a.t("lexical:blocks:label")}:null,c?.length?{items:c.map(a=>({Icon:Yo,key:"inlineBlocks-"+a.slug,keywords:["inlineBlock","inline block",a.slug],label:({i18n:m})=>a?.labels?.singular?ro(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(rt,{blockName:"",blockType:a.slug})}})),key:"inlineBlocks",label:({i18n:a})=>a.t("lexical:blocks:inlineBlocks:label")}:null].filter(Boolean)},toolbarFixed:{groups:[d.length?{type:"dropdown",ChildComponent:Xo,items:d.map((a,m)=>({isActive:void 0,key:"block-"+a.slug,label:({i18n:f})=>a?.labels?.singular?ro(a.labels.singular,f):a?.slug,onSelect:({editor:f})=>{f.dispatchCommand(nt,{blockName:"",blockType:a.slug})},order:m})),key:"blocks",order:20}:null,c?.length?{type:"dropdown",ChildComponent:Yo,items:c.map((a,m)=>({isActive:void 0,key:"inlineBlock-"+a.slug,label:({i18n:f})=>a?.labels?.singular?ro(a.labels.singular,f):a?.slug,onSelect:({editor:f})=>{f.dispatchCommand(rt,{blockName:"",blockType:a.slug})},order:m})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}});import{c as hm}from"react/compiler-runtime";import{jsx as Be,jsxs as an}from"react/jsx-runtime";import{useLexicalComposerContext as gm}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as xm,$createTextNode as Cm,$getRoot as bm,getDOMSelection as rn}from"lexical";import*as Ll from"react";import{useCallback as Pe,useEffect as ln,useLayoutEffect as wl,useRef as sn,useState as lo}from"react";var fm=se&&"documentMode"in document?document.documentMode:null,El=se&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),U7=se&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),z7=se&&"InputEvent"in window&&!fm?"getTargetRanges"in new window.InputEvent("input"):!1,W7=se&&/Version\/[\d.].*Safari/.test(navigator.userAgent),V7=se&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,K7=se&&/Android/.test(navigator.userAgent),J7=se&&/Win/.test(navigator.platform),pm=se&&/^(?=.*Chrome).*/i.test(navigator.userAgent),X7=se&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!pm;var km=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)},_m=(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)},Tm=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);
|
|
24
24
|
await assertSelection(page, {
|
|
25
25
|
anchorPath: [${r.anchorPath.toString()}],
|
|
26
26
|
anchorOffset: ${r.anchorOffset},
|
|
@@ -30,7 +30,7 @@ ${p}</${i.blockType}>`}return`<${i.blockType}${c?" "+St({props:a}):""}/>`},handl
|
|
|
30
30
|
`;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(`
|
|
31
31
|
`);default:return` await repeat(${t.count}, async () => {
|
|
32
32
|
${o}
|
|
33
|
-
);`}};function
|
|
33
|
+
);`}};function Em(t){return t.key.toLowerCase()==="a"&&(El?t.metaKey:t.ctrlKey)}function wm(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 Sl(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 Nl=new Set(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Backspace","Delete","Enter","Escape"]);function Sm(t){let[e,o]=lo([]),[n,r]=lo(!1),[,l]=lo(""),[s,i]=lo(""),u=sn(null),d=sn(!1),c=sn(null),a=Pe(()=>t,[t]),m=Pe(()=>{let x=t.getRootElement(),b=rn(t._window);return x==null||b==null||b.anchorNode==null||b.focusNode==null||!x.contains(b.anchorNode)||!x.contains(b.focusNode)?null:`
|
|
34
34
|
import {
|
|
35
35
|
initializeE2E,
|
|
36
36
|
assertHTMLSnapshot,
|
|
@@ -47,19 +47,19 @@ describe('Test case', () => {
|
|
|
47
47
|
const {page} = e2e;
|
|
48
48
|
|
|
49
49
|
await page.focus('div[contenteditable="true"]');
|
|
50
|
-
${e.map(
|
|
50
|
+
${e.map(Tm).join(`
|
|
51
51
|
`)}
|
|
52
52
|
});
|
|
53
53
|
});
|
|
54
|
-
`},[t,e]),p=je((g,b)=>{o(k=>{let _=e.length-1,T=e[_];if(T&&T.name===g){if(g==="type")return[...e.slice(0,_),{...T,value:T.value+b}];if(T.value===b)return[...e.slice(0,_),{...T,count:T.count+1}]}return[...k,{name:g,count:1,value:b}]})},[e,o]);gl(()=>{let g=k=>{if(!n)return;let _=k.key;gm(k)?p("selectAll",""):Cl.has(_)?p("press",k.key):[..._].length>1?p("keydown",k.key):p("type",k.key)},b=k=>{if(!n)return;let _=k.key;!Cl.has(_)&&[..._].length>1&&p("keyup",k.key)};return t.registerRootListener((k,_)=>{_!==null&&(_.removeEventListener("keydown",g),_.removeEventListener("keyup",b)),k!==null&&(k.addEventListener("keydown",g),k.addEventListener("keyup",b))})},[t,n,p]),gl(()=>{c.current&&c.current.scrollTo(0,c.current.scrollHeight)},[m]),Qo(()=>{if(e){let g=m();g!==null&&i(g),c.current&&c.current.scrollTo(0,c.current.scrollHeight)}},[m,e]),Qo(()=>t.registerUpdateListener(({dirtyElements:b,dirtyLeaves:k,editorState:_})=>{if(!n)return;let T=_._selection,I=u.current,N=d.current;if(I!==T){if(k.size===0&&b.size===0&&!N){let y=qo(t._window);if(y&&(y.anchorNode==null||y.focusNode==null))return}u.current=T}d.current=!1;let S=m();S!==null&&i(S)}),[t,m,n,p]),Qo(()=>n?t.registerUpdateListener(()=>{let b=t.getRootElement();b!==null&&l(b?.innerHTML)}):void 0,[t,n]);let f=je(g=>{n||(g.update(()=>{let b=mm();b.clear();let k=dm();b.append(um().append(k)),k.select()}),o([])),r(b=>!b)},[n]),h=je(()=>{if(!n)return;let g=qo(t._window);if(g===null||g.anchorNode==null||g.focusNode==null)return;let{anchorNode:b,anchorOffset:k,focusNode:_,focusOffset:T}=xm(g),I=a().getRootElement(),N;b!==null&&(N=xl(b,I));let S;_!==null&&(S=xl(_,I)),p("snapshot",{anchorNode:b,anchorOffset:k,anchorPath:N,focusNode:_,focusOffset:T,focusPath:S})},[p,n,a]),x=je(()=>{pm(m())},[m]),C=je(()=>{fm("test.js",m())},[m]);return[He("button",{className:`editor-dev-button ${n?"active":""}`,id:"test-recorder-button",onClick:g=>{f(a()),g.preventDefault()},title:n?"Disable test recorder":"Enable test recorder",type:"button",children:n?"Disable test recorder":"Enable test recorder"}),n?tn("div",{className:"test-recorder-output",children:[tn("div",{className:"test-recorder-toolbar",children:[He("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:g=>{h(),g.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),He("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:g=>{x(),g.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),He("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:g=>{C(),g.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),He("pre",{id:"test-recorder",ref:c,children:s})]}):null]}var kl=()=>{let t=am(3),[e]=cm(),[o,n]=Cm(e),r;return t[0]!==o||t[1]!==n?(r=tn(bl.Fragment,{children:[He("p",{children:"HI"}),o,n,He("p",{children:"DONE"})]}),t[0]=o,t[1]=n,t[2]=r):r=t[2],r};var bm=M({plugins:[{Component:kl,position:"bottom"}]});import{c as km}from"react/compiler-runtime";import{jsx as _m}from"react/jsx-runtime";import{useLexicalComposerContext as Tm}from"@lexical/react/LexicalComposerContext.js";import{TreeView as Em}from"@lexical/react/LexicalTreeView.js";import"react";var _l=()=>{let t=km(2),[e]=Tm(),o;return t[0]!==e?(o=_m(Em,{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 wm=M({plugins:[{Component:_l,position:"bottom"}]});import{BOLD_ITALIC_STAR as Nm,BOLD_ITALIC_UNDERSCORE as Lm,BOLD_STAR as ym,BOLD_UNDERSCORE as Rm}from"@lexical/markdown";import{$isTableSelection as vm}from"@lexical/table";import{$isRangeSelection as Im,FORMAT_TEXT_COMMAND as Mm}from"lexical";import{jsx as Tl}from"react/jsx-runtime";import"react";var Sm="M14.5 9.25A1.75 1.75 0 0 1 12.75 11H9.5V7.5h3.25c.966 0 1.75.784 1.75 1.75M8 11V7.5A1.5 1.5 0 0 1 9.5 6h3.25a3.25 3.25 0 0 1 2.418 5.422A3.5 3.5 0 0 1 13.5 18h-4A1.5 1.5 0 0 1 8 16.5zm1.5 1.5v4h4a2 2 0 1 0 0-4z",El=({className:t})=>Tl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Tl("path",{clipRule:"evenodd",d:Sm,fill:"currentColor",fillRule:"evenodd"})});var ee=t=>({type:"buttons",items:t,key:"format",order:40});var wl=[ee([{ChildComponent:El,isActive:({selection:t})=>Im(t)||vm(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(Mm,"bold")},order:1}])],Am=M(({featureProviderMap:t})=>{let e=[ym,Rm];return t.get("italic")&&e.push(Lm,Nm),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:wl},toolbarInline:{groups:wl}}});import{INLINE_CODE as Dm}from"@lexical/markdown";import{$isTableSelection as Om}from"@lexical/table";import{$isRangeSelection as Fm,FORMAT_TEXT_COMMAND as Pm}from"lexical";import{jsx as Sl}from"react/jsx-runtime";import"react";var $m="M9.64645 8.14645C9.84171 7.95118 10.1582 7.95118 10.3535 8.14645C10.5487 8.34171 10.5487 8.65822 10.3535 8.85348L7.20699 12L10.3535 15.1464C10.5487 15.3417 10.5487 15.6582 10.3535 15.8535C10.1582 16.0487 9.84171 16.0487 9.64645 15.8535L6.14645 12.3535C5.95118 12.1582 5.95118 11.8417 6.14645 11.6464L9.64645 8.14645ZM13.6464 8.14645C13.8417 7.95118 14.1582 7.95118 14.3535 8.14645L17.8535 11.6464C18.0487 11.8417 18.0487 12.1582 17.8535 12.3535L14.3535 15.8535C14.1582 16.0487 13.8417 16.0487 13.6464 15.8535C13.4512 15.6582 13.4512 15.3417 13.6464 15.1464L16.7929 12L13.6464 8.85348C13.4512 8.65822 13.4512 8.34171 13.6464 8.14645Z",Nl=({className:t})=>Sl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Sl("path",{clipRule:"evenodd",d:$m,fill:"currentColor",fillRule:"evenodd"})});var Ll=[ee([{ChildComponent:Nl,isActive:({selection:t})=>Fm(t)||Om(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(Pm,"code")},order:7}])],Bm=M({enableFormats:["code"],markdownTransformers:[Dm],toolbarFixed:{groups:Ll},toolbarInline:{groups:Ll}});import{ITALIC_STAR as Hm,ITALIC_UNDERSCORE as Gm}from"@lexical/markdown";import{$isTableSelection as zm}from"@lexical/table";import{$isRangeSelection as Um,FORMAT_TEXT_COMMAND as Wm}from"lexical";import{jsx as yl}from"react/jsx-runtime";import"react";var jm="M10 6.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1h-2.083L11.6 17h1.9a.5.5 0 0 1 0 1h-5a.5.5 0 0 1 0-1h2.083L12.4 7h-1.9a.5.5 0 0 1-.5-.5",Rl=({className:t})=>yl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:yl("path",{clipRule:"evenodd",d:jm,fill:"currentColor",fillRule:"evenodd"})});var vl=[ee([{ChildComponent:Rl,isActive:({selection:t})=>Um(t)||zm(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(Wm,"italic")},order:2}])],Vm=M({enableFormats:["italic"],markdownTransformers:[Hm,Gm],toolbarFixed:{groups:vl},toolbarInline:{groups:vl}});import{STRIKETHROUGH as Jm}from"@lexical/markdown";import{$isTableSelection as Xm}from"@lexical/table";import{$isRangeSelection as Ym,FORMAT_TEXT_COMMAND as Zm}from"lexical";import{jsx as Il}from"react/jsx-runtime";import"react";var Km="M15.835 13.5a.27.27 0 0 1 .24.138q.306.554.306 1.316 0 1.01-.543 1.816-.543.8-1.554 1.268-1.01.462-2.409.462-1.323 0-2.295-.419-.972-.424-1.534-1.175a3.2 3.2 0 0 1-.533-1.135c-.082-.326.187-.614.522-.614.299 0 .539.233.625.519q.13.43.415.768.448.524 1.17.8.73.271 1.63.272.996 0 1.764-.32.773-.327 1.215-.906a2.16 2.16 0 0 0 .44-1.348q0-.645-.345-1.09c-.1-.132-.016-.352.15-.352zm-3.846-8q1.215 0 2.142.438.933.43 1.476 1.187.38.518.519 1.134c.07.31-.19.577-.507.577-.286 0-.518-.22-.6-.493q-.22-.738-.875-1.224-.864-.646-2.18-.646-.92 0-1.63.313-.703.308-1.1.85a2.04 2.04 0 0 0-.395 1.237q0 .492.217.874.216.376.588.652.376.278.843.475.474.197.972.338l1.052.288H18.5a.5.5 0 0 1 0 1h-13a.5.5 0 0 1 0-1h3.94a4.4 4.4 0 0 1-.844-.602q-.844-.781-.844-1.982 0-1.009.562-1.778t1.522-1.2q.959-.438 2.153-.438",Ml=({className:t})=>Il("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Il("path",{d:Km,fill:"currentColor"})});var Al=[ee([{ChildComponent:Ml,isActive:({selection:t})=>Ym(t)||Xm(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(Zm,"strikethrough")},order:4}])],qm=M({enableFormats:["strikethrough"],markdownTransformers:[Jm],toolbarFixed:{groups:Al},toolbarInline:{groups:Al}});import{$isTableSelection as ep}from"@lexical/table";import{$isRangeSelection as tp,FORMAT_TEXT_COMMAND as op}from"lexical";import{jsx as $l}from"react/jsx-runtime";import"react";var Qm="M7.51 15.65a.523.523 0 1 1-.985-.352l2.377-6.534a.83.83 0 0 1 1.56 0l2.374 6.534a.523.523 0 1 1-.985.351L9.722 9.57a.043.043 0 0 0-.08 0zm.162-2.238c0-.252.204-.456.456-.456h3.1a.456.456 0 0 1 0 .912h-3.1a.456.456 0 0 1-.456-.456m6.652 3.925a.436.436 0 0 1-.287-.765l1.64-1.431q.259-.228.433-.407.175-.178.266-.345a.76.76 0 0 0 .091-.365.61.61 0 0 0-.258-.52q-.255-.195-.63-.195-.4 0-.643.21a.7.7 0 0 0-.133.151c-.127.197-.3.403-.534.403s-.432-.194-.367-.418q.11-.378.434-.642.494-.402 1.257-.403.513 0 .897.183.387.181.604.501.217.316.217.714 0 .316-.13.586-.125.27-.395.555a9 9 0 0 1-.695.634l-.927.798a.023.023 0 0 0 .016.042h1.895a.357.357 0 0 1 0 .714z",Dl=({className:t})=>$l("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:$l("path",{d:Qm,fill:"currentColor"})});var Ol=[ee([{ChildComponent:Dl,isActive:({selection:t})=>tp(t)||ep(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(op,"subscript")},order:5}])],np=M({enableFormats:["subscript"],toolbarFixed:{groups:Ol},toolbarInline:{groups:Ol}});import{$isTableSelection as lp}from"@lexical/table";import{$isRangeSelection as ip,FORMAT_TEXT_COMMAND as sp}from"lexical";import{jsx as Fl}from"react/jsx-runtime";import"react";var rp="M7.51 15.65a.523.523 0 1 1-.985-.352l2.377-6.534a.83.83 0 0 1 1.56 0l2.374 6.534a.523.523 0 1 1-.985.351L9.722 9.57a.043.043 0 0 0-.08 0zm.162-2.238c0-.252.204-.456.456-.456h3.1a.456.456 0 0 1 0 .912h-3.1a.456.456 0 0 1-.456-.456m6.652-1.303a.436.436 0 0 1-.287-.765l1.64-1.432q.259-.228.433-.406.175-.179.266-.346a.76.76 0 0 0 .091-.365.61.61 0 0 0-.258-.52q-.255-.195-.63-.194-.4 0-.643.209a.7.7 0 0 0-.133.152c-.127.196-.3.403-.534.403s-.432-.194-.367-.419q.11-.378.434-.641.494-.403 1.257-.403.513 0 .897.182.387.183.604.502.217.315.217.714 0 .315-.13.585-.125.27-.395.555a9 9 0 0 1-.695.635l-.927.798a.023.023 0 0 0 .016.041h1.895a.357.357 0 1 1 0 .715z",Pl=({className:t})=>Fl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Fl("path",{d:rp,fill:"currentColor"})});var Bl=[ee([{ChildComponent:Pl,isActive:({selection:t})=>ip(t)||lp(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(sp,"superscript")},order:6}])],ap=M({enableFormats:["superscript"],toolbarFixed:{groups:Bl},toolbarInline:{groups:Bl}});import{$isTableSelection as up}from"@lexical/table";import{$isRangeSelection as dp,FORMAT_TEXT_COMMAND as mp}from"lexical";import{jsx as jl}from"react/jsx-runtime";import"react";var cp="M9 7.5a.5.5 0 0 0-1 0V12a4 4 0 0 0 8 0V7.5a.5.5 0 0 0-1 0V12a3 3 0 1 1-6 0zM16.5 19a.5.5 0 0 0 0-1h-9a.5.5 0 0 0 0 1z",Hl=({className:t})=>jl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:jl("path",{clipRule:"evenodd",d:cp,fill:"currentColor",fillRule:"evenodd"})});var Gl=[ee([{ChildComponent:Hl,isActive:({selection:t})=>dp(t)||up(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(mp,"underline")},order:3}])],pp=M({enableFormats:["underline"],toolbarFixed:{groups:Gl},toolbarInline:{groups:Gl}});import{jsx as nn}from"react/jsx-runtime";import{jsx as fp}from"react/jsx-runtime";function hp(t){return t.replace(/-([a-z])/g,(e,o)=>o.toUpperCase())}var oo=({css:t})=>{let e=t?Object.fromEntries(Object.entries(t).map(([o,n])=>[hp(o),n])):{};return fp("span",{style:{...e,alignItems:"center",borderRadius:"4px",display:"flex",fontSize:"16px",height:"20px",justifyContent:"center",width:"20px"},children:"A"})};import{useLexicalComposerContext as gp}from"@lexical/react/LexicalComposerContext";import{$forEachSelectedTextNode as xp}from"@lexical/selection";import{$getNodeByKey as Cp,$getState as bp,$setState as kp,createState as _p,TextNode as Tp}from"lexical";import{useEffect as Ep}from"react";function zl(t){let e=new Map;for(let o in t){let n=t[o],r=_p(o,{parse:l=>typeof l=="string"&&Object.keys(n).includes(l)?l:void 0});e.set(o,{stateConfig:r,stateValues:n})}return e}function on(t,e,o,n){t.update(()=>{xp(r=>{let l=e.get(o);if(!l)throw new Error(`State config for ${o} not found`);kp(r,l.stateConfig,n)})})}function Ul({stateMap:t}){let[e]=gp();return Ep(()=>e.registerMutationListener(Tp,o=>{e.getEditorState().read(()=>{for(let[n,r]of o){if(r==="destroyed")continue;let l=Cp(n),s=e.getElementByKey(n);if(!l||!s)continue;let i=Object.create(null);t.forEach((u,d)=>{let c=bp(l,u.stateConfig);if(!c){delete s.dataset[d];return}s.dataset[d]=c;let a=u.stateValues[c]?.css;a&&Object.assign(i,a)}),s.style.cssText="",Object.assign(s.style,i)}})}),[e]),null}var Wl=(t,e)=>{let o=[];for(let r in t.state){let l=t.state[r];for(let s in l){let i=l[s];o.push({ChildComponent:()=>nn(oo,{css:i.css}),key:s,label:i.label,onSelect:({editor:u})=>{on(u,e,r,s)}})}}return[{type:"dropdown",ChildComponent:()=>nn(oo,{css:{color:"var(--color-icon-secondary)"}}),items:[...[{ChildComponent:()=>nn(oo,{}),key:"clear-style",label:({i18n:r})=>r.t("lexical:textState:defaultStyle"),onSelect:({editor:r})=>{for(let l in t.state)on(r,e,l,void 0)},order:1}],...o],key:"textState",order:30}]},wp=M(({props:t})=>{let e=zl(t.state);return{plugins:[{Component:()=>Ul({stateMap:e}),position:"normal"}],toolbarFixed:{groups:Wl(t,e)},toolbarInline:{groups:Wl(t,e)}}});import{c as jp}from"react/compiler-runtime";import{useLexicalComposerContext as Hp}from"@lexical/react/LexicalComposerContext";import{$createHeadingNode as Gp,$isHeadingNode as li,HeadingNode as ai}from"@lexical/rich-text";import{$setBlocksType as zp}from"@lexical/selection";import{$getSelection as Up,$isRangeSelection as Wp}from"lexical";import{useEffect as Vp}from"react";import{jsx as Vl}from"react/jsx-runtime";import"react";var Sp="M7 6.5a.5.5 0 0 0-1 0v11a.5.5 0 0 0 1 0V12h6v5.5a.5.5 0 0 0 1 0v-11a.5.5 0 0 0-1 0V11H7zm11 6a.5.5 0 0 0-.777-.416l-1.5 1a.5.5 0 1 0 .554.832l.723-.482V17.5a.5.5 0 0 0 1 0z",Kl=({className:t})=>Vl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Vl("path",{d:Sp,fill:"currentColor"})});import{jsx as Jl}from"react/jsx-runtime";import"react";var Np="M7 6.5a.5.5 0 0 0-1 0v11a.5.5 0 0 0 1 0V12h6v5.5a.5.5 0 0 0 1 0v-11a.5.5 0 0 0-1 0V11H7zm9.034 10.952c0 .303.245.548.548.548h2.97a.448.448 0 0 0 0-.896H17.48v-.04l.997-1.038q.562-.555.873-.945.314-.39.438-.711t.124-.653q0-.497-.245-.885a1.7 1.7 0 0 0-.684-.61A2.24 2.24 0 0 0 17.96 12a2.2 2.2 0 0 0-1.017.228 1.71 1.71 0 0 0-.888 1.13c-.064.268.168.495.444.495.275 0 .479-.236.595-.485l.019-.039q.12-.22.333-.338a1 1 0 0 1 .5-.121q.278 0 .495.11a.83.83 0 0 1 .341.312.9.9 0 0 1 .125.48q0 .245-.096.462t-.288.448-.48.529l-1.85 1.854a.55.55 0 0 0-.16.387",Xl=({className:t})=>Jl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Jl("path",{d:Np,fill:"currentColor"})});import{jsx as Yl,jsxs as Lp}from"react/jsx-runtime";import"react";var yp="M7 6.5a.5.5 0 0 0-1 0v11a.5.5 0 0 0 1 0V12h6v5.5a.5.5 0 0 0 1 0v-11a.5.5 0 0 0-1 0V11H7z",Rp="M16.59 13.32 A1.5 1.25 0 1 1 18 15 A1.5 1.25 0 1 1 16.59 16.68",Zl=({className:t})=>Lp("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:[Yl("path",{d:yp,fill:"currentColor"}),Yl("path",{d:Rp,stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1})]});import{jsx as ql,jsxs as vp}from"react/jsx-runtime";import"react";var Ip="M7 6.5a.5.5 0 0 0-1 0v11a.5.5 0 0 0 1 0V12h6v5.5a.5.5 0 0 0 1 0v-11a.5.5 0 0 0-1 0V11H7z",Mp="M18.85 17.5 V12.5 L16.5 15.85 H19.5",Ql=({className:t})=>vp("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:[ql("path",{d:Ip,fill:"currentColor"}),ql("path",{d:Mp,stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1})]});import{jsx as ei,jsxs as Ap}from"react/jsx-runtime";import"react";var $p="M7 6.5a.5.5 0 0 0-1 0v11a.5.5 0 0 0 1 0V12h6v5.5a.5.5 0 0 0 1 0v-11a.5.5 0 0 0-1 0V11H7z",Dp="M19.2 12.5 H16.8 V14.9 A1.5 1.5 0 1 1 16.7 16.9",ti=({className:t})=>Ap("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:[ei("path",{d:$p,fill:"currentColor"}),ei("path",{d:Dp,stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1})]});import{jsx as oi,jsxs as Op}from"react/jsx-runtime";import"react";var Fp="M7 6.5a.5.5 0 0 0-1 0v11a.5.5 0 0 0 1 0V12h6v5.5a.5.5 0 0 0 1 0v-11a.5.5 0 0 0-1 0V11H7z",Pp="M18.85 12.55 C17.45 13.05 16.5 14.25 16.5 16 A1.5 1.5 0 1 1 19.5 16 A1.5 1.5 0 1 1 16.5 16",ni=({className:t})=>Op("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:[oi("path",{d:Fp,fill:"currentColor"}),oi("path",{d:Pp,stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1})]});import{HEADING as Bp}from"@lexical/markdown";var ri=t=>{let o=`^(${t.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`;return{...Bp,regExp:new RegExp(o)}};var ii=t=>{let e=Up();zp(e,()=>Gp(t))},si={h1:Kl,h2:Xl,h3:Zl,h4:Ql,h5:ti,h6:ni},Kp=M(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[ne(e.map((n,r)=>({ChildComponent:si[n],isActive:({selection:l})=>{if(!Wp(l))return!1;for(let s of l.getNodes()){if(li(s)&&s.getTag()===n)continue;let i=s.getParent();if(!(li(i)&&i.getTag()===n))return!1}return!0},key:n,label:({i18n:l})=>l.t("lexical:heading:label",{headingLevel:n.charAt(1)}),onSelect:({editor:l})=>{l.update(()=>{ii(n)})},order:r+2})))];return{markdownTransformers:[ri(e)],nodes:[ai],plugins:[{Component:Jp,position:"normal"}],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[Q(e.map(n=>({Icon:si[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(()=>{ii(n)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}}),Jp=t=>{let e=jp(9),{clientProps:o}=t,{enabledHeadingSizes:n}=o,r;e[0]!==n?(r=n===void 0?["h1","h2","h3","h4","h5","h6"]:n,e[0]=n,e[1]=r):r=e[1];let l=r,s;e[2]!==l?(s=l.at(-1),e[2]=l,e[3]=s):s=e[3];let i=s,[u]=Hp(),d,c;return e[4]!==u||e[5]!==l||e[6]!==i?(d=()=>{if(!(!i||l.length===6))return u.registerNodeTransform(ai,a=>{l.includes(a.getTag())||a.setTag(i)})},c=[u,l,i],e[4]=u,e[5]=l,e[6]=i,e[7]=d,e[8]=c):(d=e[7],c=e[8]),Vp(d,c),null};import{$isNodeSelection as mf}from"lexical";import{jsx as ci}from"react/jsx-runtime";import"react";var Xp="M18 12a.5.5 0 0 1-.5.5h-11a.5.5 0 0 1 0-1h11a.5.5 0 0 1 .5.5",rn=({className:t})=>ci("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:ci("path",{d:Xp,fill:"currentColor"})});var ke=t=>({type:"dropdown",ChildComponent:Tr,items:t,key:"add",order:10});import{addClassNamesToElement as Yp}from"@lexical/utils";import{$applyNodeReplacement as Zp,createCommand as qp,DecoratorNode as Qp}from"lexical";var Rt=qp("INSERT_HORIZONTAL_RULE_COMMAND"),yt=class extends Qp{static clone(e){return new this(e.__key)}static getType(){return"horizontalrule"}static importDOM(){return{hr:()=>({conversion:ef,priority:0})}}static importJSON(e){return ui()}createDOM(e){let o=document.createElement("hr");return Yp(o,e.theme.hr),o}decorate(){return null}exportDOM(){return{element:document.createElement("hr")}}exportJSON(){return{type:"horizontalrule",version:1}}getTextContent(){return`
|
|
55
|
-
`}isInline(){return!1}updateDOM(){return!1}};function ef(){return{node:ui()}}function ui(){return Zp(new yt)}import{$applyNodeReplacement as tf}from"lexical";import"react";var _e=class extends yt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return lt()}decorate(){return null}exportJSON(){return super.exportJSON()}};function lt(){return tf(new _e)}function Ge(t){return t instanceof _e}var di={type:"element",dependencies:[_e],export:(t,e)=>Ge(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=lt();e&&t.replace(e)}};import{c as of}from"react/compiler-runtime";import{useLexicalComposerContext as nf}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as mi,$insertNodeToNearestRoot as rf}from"@lexical/utils";import{$getRoot as lf,$getSelection as pi,$isRangeSelection as fi,$isRootOrShadowRoot as hi,COMMAND_PRIORITY_EDITOR as sf}from"lexical";import{useEffect as af}from"react";var ln="LexicalEditorTheme__hrSelected",gi=()=>{let t=of(3),[e]=nf(),o,n;return t[0]!==e?(o=()=>{let r=e.registerCommand(Rt,cf,sf),l=e.registerUpdateListener(s=>{let{editorState:i}=s;i.read(()=>{let d=lf().getChildren(),c=pi(),a=[];for(let g=0;g<d.length;g++){let b=d[g];if(Ge(b)){let k=e.getElementByKey(b.getKey());k&&a.push({element:k,index:g})}}if(a.length===0)return;if(!fi(c)||c.isCollapsed()){for(let{element:g}of a)g.classList.remove(ln);return}let m=c.anchor.getNode(),p=c.focus.getNode(),f=mi(m,uf)||m,h=mi(p,df)||p,x=d.indexOf(f),C=d.indexOf(h);if(x===-1||C===-1)return;let E=Math.min(x,C),w=Math.max(x,C);for(let{element:g,index:b}of a)b>=E&&b<=w?g.classList.add(ln):g.classList.remove(ln)})});return()=>{r(),l()}},n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),af(o,n),null};function cf(t){let e=pi();if(!fi(e))return!1;if(e.focus.getNode()!==null){let n=lt();rf(n)}return!0}function uf(t){return hi(t.getParent())}function df(t){return hi(t.getParent())}var pf=M({markdownTransformers:[di],nodes:[_e],plugins:[{Component:gi,position:"normal"}],slashMenu:{groups:[Q([{Icon:rn,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Rt,void 0)}}])]},toolbarFixed:{groups:[ke([{ChildComponent:rn,isActive:({selection:t})=>{if(!mf(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Ge(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Rt,void 0)}}])]}});import{$findMatchingParent as Li}from"@lexical/utils";import{$isElementNode as Nf,INDENT_CONTENT_COMMAND as Lf,OUTDENT_CONTENT_COMMAND as yf}from"lexical";import{jsx as sn}from"react/jsx-runtime";import"react";var ff="M7.854 6.146a.5.5 0 1 0-.708.708L8.293 8H5.5a.5.5 0 0 0 0 1h2.793l-1.147 1.146a.5.5 0 0 0 .708.708l2-2a.5.5 0 0 0 0-.708zM11.5 8a.5.5 0 0 0 0 1h7a.5.5 0 0 0 0-1zM5 12.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m.5 3.5a.5.5 0 0 0 0 1h13a.5.5 0 0 0 0-1z",xi=({className:t})=>sn("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:sn("g",{transform:"scale(-1, 1) translate(-24, 0)",children:sn("path",{clipRule:"evenodd",d:ff,fill:"currentColor",fillRule:"evenodd"})})});import{jsx as Ci}from"react/jsx-runtime";import"react";var hf="M7.854 6.146a.5.5 0 1 0-.708.708L8.293 8H5.5a.5.5 0 0 0 0 1h2.793l-1.147 1.146a.5.5 0 0 0 .708.708l2-2a.5.5 0 0 0 0-.708zM11.5 8a.5.5 0 0 0 0 1h7a.5.5 0 0 0 0-1zM5 12.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m.5 3.5a.5.5 0 0 0 0 1h13a.5.5 0 0 0 0-1z",bi=({className:t})=>Ci("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Ci("path",{clipRule:"evenodd",d:hf,fill:"currentColor",fillRule:"evenodd"})});import{jsx as gf}from"react/jsx-runtime";import{useLexicalComposerContext as xf}from"@lexical/react/LexicalComposerContext";import{TabIndentationPlugin as Cf}from"@lexical/react/LexicalTabIndentationPlugin";import{$findMatchingParent as bf,mergeRegister as ki}from"@lexical/utils";import{$getSelection as kf,$isElementNode as wi,$isRangeSelection as _f,COMMAND_PRIORITY_LOW as _i,INDENT_CONTENT_COMMAND as Ti,KEY_TAB_COMMAND as Tf,OUTDENT_CONTENT_COMMAND as Ef,TabNode as wf}from"lexical";import{useEffect as Ei}from"react";var Si=({clientProps:t})=>{let[e]=xf(),{disabledNodes:o,disableTabNode:n}=t;return Ei(()=>{if(!(!e||!o?.length))return ki(e.registerCommand(Ti,()=>Sf(r=>{if(!o.includes(r.getType())){let l=r.getIndent();r.setIndent(l+1)}}),_i),e.registerUpdateListener(({dirtyElements:r,editorState:l})=>{e.update(()=>{for(let[s]of r){let i=l._nodeMap.get(s);wi(i)&&o.includes(i.getType())&&i.getIndent()>0&&i.setIndent(0)}})}))},[e,o]),Ei(()=>{if(!(!e||!n))return ki(e.registerCommand(Tf,r=>(r.preventDefault(),e.dispatchCommand(r.shiftKey?Ef:Ti,void 0)),_i),e.registerNodeTransform(wf,r=>{r.remove()}))},[e,n]),gf(Cf,{})};function Sf(t){let e=kf();if(!_f(e))return!1;let o=new Set,n=e.getNodes();for(let r=0;r<n.length;r++){let l=n[r],s=l.getKey();if(o.has(s))continue;let i=bf(l,d=>wi(d)&&!d.isInline());if(i===null)continue;let u=i.getKey();i.canIndent()&&!o.has(u)&&(o.add(u),t(i))}return o.size>0}var Ni=t=>({type:"buttons",items:t,key:"indent",order:35});var yi=({disabledNodes:t})=>[Ni([{ChildComponent:xi,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],n=r=>Ri(r)&&r.getIndent()>0;return o.some(r=>n(r)||!!Li(r,n))},key:"indentDecrease",label:({i18n:e})=>e.t("lexical:indent:decreaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(yf,void 0)},order:1},{ChildComponent:bi,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],n=r=>Ri(r)&&!(t??[]).includes(r.getType());return o.some(r=>n(r)||!!Li(r,n))},key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Lf,void 0)},order:2}])],Rf=M(({props:t})=>{let e=t.disabledNodes??[];return{plugins:[{Component:Si,position:"normal"}],sanitizedClientFeatureProps:t,toolbarFixed:{groups:yi({disabledNodes:e})},toolbarInline:{groups:yi({disabledNodes:e})}}}),Ri=t=>Nf(t)&&t.canIndent();import{$findMatchingParent as V1}from"@lexical/utils";import{$getSelection as Cn,$isRangeSelection as us}from"lexical";import{jsx as vi}from"react/jsx-runtime";import"react";var vf={16:"M8.38 6.381a.29.29 0 0 1 .347-.056q.293.161.541.408a2.5 2.5 0 0 1 0 3.535l-2 2a2.5 2.5 0 0 1-3.535-3.535l.571-.573c.25-.249.692-.107.81.224a.46.46 0 0 1-.098.478l-.576.578a1.5 1.5 0 1 0 2.121 2.12l2-2a1.5 1.5 0 0 0 0-2.12c-.23-.23-.493-.509-.358-.805a.9.9 0 0 1 .178-.254m.352-2.648a2.5 2.5 0 1 1 3.535 3.535l-.471.47c-.253.254-.717.082-.819-.261a.44.44 0 0 1 .102-.435l.481-.481A1.5 1.5 0 0 0 9.44 4.44l-2 2a1.5 1.5 0 0 0 0 2.12c.136.138.168.365.031.502l-.182.181c-.154.154-.403.179-.557.025a2.5 2.5 0 0 1 0-3.535z",24:"M12.4436 10.3708C12.6861 10.5041 12.9148 10.6721 13.1204 10.8776C14.2919 12.0492 14.2918 13.9482 13.1204 15.1198L11.1204 17.1198C9.94879 18.2914 8.04975 18.2914 6.87817 17.1198C5.70664 15.9482 5.70661 14.0492 6.87817 12.8776L8.1477 11.6071C8.4098 11.345 8.89329 11.5392 8.97388 11.9011C9.00617 12.0462 8.96861 12.2012 8.86353 12.3063L7.5852 13.5847C6.80417 14.3657 6.80419 15.6317 7.5852 16.4128C8.36625 17.1938 9.63228 17.1938 10.4133 16.4128L12.4133 14.4128C13.1942 13.6317 13.1943 12.3657 12.4133 11.5847C12.4042 11.5755 12.3953 11.5662 12.386 11.5573C12.2925 11.468 12.1984 11.3736 12.1614 11.2497C12.0724 10.9515 12.1448 10.6149 12.3801 10.3796C12.397 10.3628 12.4228 10.3594 12.4436 10.3708ZM12.8782 6.87764C14.0497 5.70615 15.9488 5.70616 17.1204 6.87764C18.2919 8.04919 18.2919 9.94825 17.1204 11.1198L15.8508 12.3903C15.5887 12.6522 15.1053 12.4581 15.0247 12.0964C14.9924 11.9512 15.0308 11.7963 15.136 11.6911L16.4133 10.4128C17.1943 9.63175 17.1943 8.3657 16.4133 7.58467C15.6323 6.80371 14.3662 6.8037 13.5852 7.58467L11.5852 9.58467C10.8046 10.3657 10.8044 11.6319 11.5852 12.4128C11.5943 12.4219 11.6042 12.4303 11.6135 12.4392C11.7064 12.5278 11.7999 12.622 11.8372 12.7448C11.9276 13.044 11.8545 13.3827 11.6184 13.6188C11.6023 13.6347 11.5778 13.6383 11.5579 13.6276C11.3146 13.4942 11.0843 13.3259 10.8782 13.1198C9.7068 11.9484 9.707 10.0492 10.8782 8.87764L12.8782 6.87764Z"},no=({className:t,size:e=24})=>vi("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:vi("path",{d:vf[e],fill:"currentColor"})});import{$isAtNodeEnd as Ii}from"@lexical/selection";function it(t){let{anchor:e}=t,{focus:o}=t,n=t.anchor.getNode(),r=t.focus.getNode();return n===r?n:t.isBackward()?Ii(o)?n:r:Ii(e)?n:r}var an=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as zf}from"lexical";function cn(t){let e=/^(?:(?:https?|mailto|ftp|tel|file|sms):|[^&:/?#]*(?:[/?#]|$))/gi,o=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z\d+/]+=*$/i;return t=String(t).trim(),t.match(e)!=null||t.match(o)!=null?t:"https://"}var If=/^(?:[a-zA-Z][a-zA-Z\d+.-]*:(?:\/\/)?(?:[-;:&=+$,\w]+@)?[A-Za-z\d]+(?:\.[A-Za-z\d]+)+|www\.[A-Za-z\d]+(?:\.[A-Za-z\d]+)+|(?:tel|mailto):[\w+.-]+)(?:\/[+~%/\w-]*)?(?:\?[-;&=%\w]*)?(?:#\w+)?$/,Mf=/^(?:\/[\w\-./]*(?:\?[-;&=%\w]*)?(?:#[\w-]+)?|#[\w\-]+)$/;function Mi(t){if(!t||t.includes(" ")||/^[a-z][a-z\d+.-]*:\/[^/]/i.test(t))return!1;if(t==="https://"||If.test(t)||Mf.test(t))return!0;try{let e=new URL(t);return!(["ftp:","http:","https:"].includes(e.protocol)&&!e.hostname.includes("."))}catch{}return!1}import{addClassNamesToElement as Af,isHTMLAnchorElement as $f}from"@lexical/utils";import mn from"bson-objectid";import{$applyNodeReplacement as Df,$createTextNode as Ai,$getSelection as Of,$isElementNode as $i,$isRangeSelection as dn,createCommand as Ff,ElementNode as Pf}from"lexical";var Bf=new Set(["http:","https:","mailto:","sms:","tel:"]),re=class extends Pf{__fields;__id;constructor({id:e,fields:o={linkType:"custom",newTab:!1},key:n}){super(n),this.__fields=o,this.__id=e}static clone(e){return new this({id:e.__id,fields:e.__fields,key:e.__key})}static getType(){return"link"}static importDOM(){return{a:e=>({conversion:jf,priority:1})}}static importJSON(e){let o=Te({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),e.version===2&&!e.id&&(e.id=new mn.default().toHexString(),e.version=3),o}canBeEmpty(){return!1}canInsertTextAfter(){return!1}canInsertTextBefore(){return!1}createDOM(e){let o=document.createElement("a");return this.__fields?.linkType==="custom"&&(o.href=this.sanitizeUrl(this.__fields.url??"")),(this.__fields?.newTab??!1)&&(o.target="_blank"),this.__fields?.newTab===!0&&this.__fields?.linkType==="custom"&&(o.rel=un(o.rel,"add","noopener")),Af(o,e.theme.link),o}exportJSON(){let e=this.getFields();e?.linkType==="internal"?delete e.url:e?.linkType==="custom"&&delete e.doc;let o={...super.exportJSON(),type:"link",fields:e,version:3},n=this.getID();return n&&(o.id=n),o}extractWithChild(e,o,n){if(!dn(o))return!1;let r=o.anchor.getNode(),l=o.focus.getNode();return this.isParentOf(r)&&this.isParentOf(l)&&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($i(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(!Bf.has(o.protocol))return"about:blank"}catch{return"https://"}return e}setFields(e){let o=this.getWritable();return o.__fields=e,o}setID(e){let o=this.getWritable();return o.__id=e,o}updateDOM(e,o,n){let r=this.__fields?.url,l=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=""),l!==e.__fields?.newTab&&(l??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=un(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=un(o.rel,"remove","noopener"))),!1}updateFromJSON(e){let o=e;return super.updateFromJSON(o).setFields(o.fields).setID(o.id)}};function jf(t){let e=null;if($f(t)){let o=t.textContent;o!==null&&o!==""&&(e=Te({id:new mn.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 Df(new re({id:t??new mn.default().toHexString(),fields:e}))}function Z(t){return t instanceof re}var fe=Ff("TOGGLE_LINK_COMMAND");function pn(t){let e=Of();if(!dn(e)&&(t===null||!t.selectedNodes?.length))return;let o=dn(e)?e.extract():t===null?[]:t.selectedNodes;if(t===null){o?.forEach(l=>{let s=l.getParent();Z(s)&&(s.getChildren().forEach(u=>{s.insertBefore(u)}),s.remove())});return}if(o?.length===1){let l=o[0],s=Z(l)?l:Hf(l);if(s!==null){s.setFields(t.fields),t.text!=null&&t.text!==s.getTextContent()&&(s.append(Ai(t.text)),s.getChildren().forEach(i=>{i!==s.getLastChild()&&i.remove()}));return}}let n=null,r=null;o?.forEach(l=>{let s=l.getParent();if(!(s===r||s===null||$i(l)&&!l.isInline())){if(Z(s)){r=s,s.setFields(t.fields),t.text!=null&&t.text!==s.getTextContent()&&(s.append(Ai(t.text)),s.getChildren().forEach(i=>{i!==s.getLastChild()&&i.remove()}));return}if(s.is(n)||(n=s,r=Te({fields:t.fields}),Z(s)?l.getPreviousSibling()===null?s.insertBefore(r):s.insertAfter(r):l.insertBefore(r)),Z(l)){if(l.is(r))return;if(r!==null){let i=l.getChildren();r.append(...i)}l.remove();return}r!==null&&r.append(l)}})}function Hf(t){return Gf(t,e=>Z(e))}function Gf(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function un(t,e,o){let n,r=`${t}`;if(e==="add"){if(r.includes(o)){let l=new RegExp(o,"g");r=r.replace(l,"").trim()}r=r.trim(),n=r.length===0?`${o}`:`${r} ${o}`}else{let l=new RegExp(o,"g");n=r.replace(l,"").trim()}return n}var Uf=(t,e)=>{let[,o,n]=e,r=Te({fields:{doc:null,linkType:"custom",newTab:!1,url:n}}),l=zf(o);return l.setFormat(t.getFormat()),r.append(l),t.replace(r),l},Wf=t=>({type:"text-match",dependencies:[re],export:(e,o)=>{if(!Z(e))return null;let n=e,r=n.getFields(),l;return r.linkType==="internal"?t?.internalDocToHref?l=cn(t.internalDocToHref({linkNode:n.exportJSON()})):(console.warn("Lexical \u2192 Markdown converter: found internal link but internalDocToHref is not provided \u2014 link will have an empty href"),l=""):l=cn(r.url??""),`[${o(n)}](${l})`},importRegExp:/(?<!!)\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/(?<!!)\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:Uf,trigger:")"}),Di=Wf();import{$applyNodeReplacement as Vf,$isElementNode as Kf}from"lexical";var Ee=class extends re{static clone(e){return new this({id:"",fields:e.__fields,key:e.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(e){let o=vt({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),o}exportJSON(){let e=super.exportJSON();return{type:"autolink",children:e.children,direction:e.direction,fields:e.fields,format:e.format,indent:e.indent,version:2}}insertNewAfter(e,o=!0){let n=this.getParentOrThrow().insertNewAfter(e,o);if(Kf(n)){let r=vt({fields:this.__fields});return n.append(r),r}return null}updateFromJSON(e){let o=e;return super.updateFromJSON(o).setFields(o.fields)}};function vt({fields:t}){return Vf(new Ee({id:"",fields:t}))}function we(t){return t instanceof Ee}import{c as Jf}from"react/compiler-runtime";import{useLexicalComposerContext as Xf}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Yf}from"@lexical/utils";import{$createTextNode as Oi,$getSelection as Zf,$isElementNode as Pi,$isLineBreakNode as Bi,$isNodeSelection as qf,$isRangeSelection as Qf,$isTextNode as It,TextNode as e1}from"lexical";import{useEffect as t1}from"react";function Fi(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 ji(t,e){for(let o of e){let n=o(t);if(n!=null)return n}return null}var o1=/[.,;\s]/;function lo(t){return t!==void 0&&o1.test(t)}function Hi(t){return lo(t[t.length-1])}function hn(t){return lo(t[0])}function n1(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function Gi(t){let e=t.getPreviousSibling();return Pi(e)&&(e=e.getLastDescendant()),e===null||Bi(e)||It(e)&&Hi(e.getTextContent())}function zi(t){let e=t.getNextSibling();return Pi(e)&&(e=e.getFirstDescendant()),e===null||Bi(e)||It(e)&&hn(e.getTextContent())}function r1(t,e,o,n){return(t>0?lo(o[t-1]):Gi(n[0]))?e<o.length?lo(o[e]):zi(n[n.length-1]):!1}function l1(t,e,o){let n=[],r=[],l=[],s=0,i=0,u=[...t];for(;u.length>0;){let d=u[0],a=d.getTextContent().length,m=i;i+a<=e?(n.push(d),s+=a):m>=o?l.push(d):r.push(d),i+=a,u.shift()}return[s,n,r,l]}function i1(t,e,o,n){let r={linkType:"custom",url:n.url,...n.fields},l=vt({fields:r});if(t.length===1){let s=t[0],i;if(e===0?[i]=s.splitText(o):[,i]=s.splitText(e,o),i){let u=Oi(n.text);u.setFormat(i.getFormat()),u.setDetail(i.getDetail()),u.setStyle(i.getStyle()),l.append(u),i.replace(l)}return s}else if(t.length>1){let s=t[0],i=s.getTextContent().length,u;e===0?u=s:[,u]=s.splitText(e);let d=[],c;if(t.forEach(a=>{let p=a.getTextContent().length,f=i,h=i+p;if(f<o)if(h<=o)d.push(a);else{let[x,C]=a.splitText(o-f);x&&d.push(x),c=C}i+=p}),u){let a=Zf(),m=a?a.getNodes().find(It):void 0,p=Oi(u.getTextContent());return p.setFormat(u.getFormat()),p.setDetail(u.getDetail()),p.setStyle(u.getStyle()),l.append(p,...d),m&&m===u&&(Qf(a)?p.select(a.anchor.offset,a.focus.offset):qf(a)&&p.select(0,p.getTextContent().length)),u.replace(l),c}}}function s1(t,e,o){let n=[...t],r=n.map(u=>u.getTextContent()).join(""),l=r,s,i=0;for(;(s=ji(l,e))!=null&&s!==null;){let u=s.index,d=s.length,c=u+d;if(r1(i+u,i+c,r,n)){let[m,,p,f]=l1(n,i+u,i+c),h=i+u-m,x=i+c-m,C=i1(p,h,x,s);n=C?[C,...f]:f,o(s.url,null),i=0}else i+=c;l=l.substring(c)}}function fn(t,e,o){let n=t.getChildren(),r=n.length;for(let u=0;u<r;u++){let d=n[u];if(!It(d)||!d.isSimpleText()){ro(t),o(null,t.getFields()?.url??null);return}}let l=t.getTextContent(),s=ji(l,e);if(s===null||s.text!==l){ro(t),o(null,t.getFields()?.url??null);return}if(!Gi(t)||!zi(t)){ro(t),o(null,t.getFields()?.url??null);return}let i=t.getFields()?.url;if(i!==s?.url){let u=t.getFields();u.url=s?.url,t.setFields(u),o(s.url,i??null)}}function a1(t,e,o){let n=t.getPreviousSibling(),r=t.getNextSibling(),l=t.getTextContent();if(we(n)){let s=n.getFields()?.url?n.getFields()?.url?.startsWith("mailto:")??!1:!1;(!hn(l)||n1(l,s))&&(n.append(t),fn(n,e,o),o(null,n.getFields()?.url??null))}we(r)&&!Hi(l)&&(ro(r),fn(r,e,o),o(null,r.getFields()?.url??null))}function ro(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 c1(t){let e=[t],o=t.getNextSibling();for(;o!==null&&It(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function u1(t,e,o){let n=Jf(5),r,l;n[0]!==t||n[1]!==e||n[2]!==o?(r=()=>{if(!t.hasNodes([Ee]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let s=(i,u)=>{o?.(i,u)};return Yf(t.registerNodeTransform(e1,i=>{let u=i.getParentOrThrow(),d=i.getPreviousSibling();if(we(u))fn(u,e,s);else if(!Z(u)){if(i.isSimpleText()&&(hn(i.getTextContent())||!we(d))){let c=c1(i);s1(c,e,s)}a1(i,e,s)}}))},l=[t,e,o],n[0]=t,n[1]=e,n[2]=o,n[3]=r,n[4]=l):(r=n[3],l=n[4]),t1(r,l)}var d1=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,m1=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,p1=[Fi(d1,t=>t.startsWith("http")?t:`https://${t}`),Fi(m1,t=>`mailto:${t}`)],Ui=()=>{let[t]=Xf();return u1(t,p1),null};import{jsx as f1}from"react/jsx-runtime";import{ClickableLinkPlugin as h1}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var Wi=()=>f1(h1,{});import{jsx as D1}from"react/jsx-runtime";import"react";import{createPortal as O1}from"react-dom";import{jsx as le,jsxs as ze,Fragment as gn}from"react/jsx-runtime";import{useLexicalComposerContext as C1}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as b1}from"@lexical/react/useLexicalEditable";import{$findMatchingParent as Zi,mergeRegister as qi}from"@lexical/utils";import{getTranslation as xn}from"@payloadcms/translations";import{formatDrawerSlug as k1,NewTabIcon as Qi,useConfig as _1,useEditDepth as T1,useLocale as E1,useTranslation as w1,WriteIcon as S1}from"@payloadcms/ui";import{requests as N1}from"@payloadcms/ui/shared";import{$getSelection as es,$isLineBreakNode as L1,$isRangeSelection as ts,COMMAND_PRIORITY_HIGH as y1,COMMAND_PRIORITY_LOW as os,getDOMSelection as R1,KEY_ESCAPE_COMMAND as v1,SELECTION_CHANGE_COMMAND as I1}from"lexical";import{formatAdminURL as M1}from"payload/shared";import A1,{useCallback as ns,useEffect as ao,useLayoutEffect as $1,useRef as rs,useState as Ue}from"react";import{jsx as Vi}from"react/jsx-runtime";import"react";var g1="M12.5 5C12.6326 5 12.7597 5.05272 12.8535 5.14648L16.8535 9.14648C16.9965 9.28948 17.0393 9.50457 16.9619 9.69141C16.8845 9.87821 16.7022 10 16.5 10H12.5C12.2239 10 12 9.77614 12 9.5V6H8.5C8.22386 6 8 6.22386 8 6.5V17.5C8 17.7761 8.22386 18 8.5 18H15.5C15.7761 18 16 17.7761 16 17.5V11.5C16 11.2239 16.2239 11 16.5 11C16.7761 11 17 11.2239 17 11.5V17.5C17 18.3284 16.3284 19 15.5 19H8.5C7.67157 19 7 18.3284 7 17.5V6.5C7 5.67157 7.67157 5 8.5 5H12.5ZM13 9H15.293L13 6.70703V9Z",Ki=({className:t})=>Vi("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Vi("path",{d:g1,fill:"currentColor"})});import{jsx as Ji}from"react/jsx-runtime";import"react";var Xi={default:"M6 5a.5.5 0 0 0-.5.5v1a.5.5 0 0 0 .496.5h12.008a.5.5 0 0 0 .496-.5v-1A.5.5 0 0 0 18 5zM4.5 6.5a1.5 1.5 0 0 0 1.037 1.427L5.725 10H5a.5.5 0 0 0 0 1h.816l.653 7.181A2 2 0 0 0 8.46 20h7.078a2 2 0 0 0 1.992-1.819L18.184 11H19a.5.5 0 0 0 0-1h-.725l.188-2.073A1.5 1.5 0 0 0 19.5 6.5v-1A1.5 1.5 0 0 0 18 4H6a1.5 1.5 0 0 0-1.5 1.5zm2.965 11.59L6.548 8h10.905l-.918 10.09a1 1 0 0 1-.996.91H8.461a1 1 0 0 1-.996-.91M11 10.5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0zm3 0a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0z",small:"M6.5 7a1 1 0 0 1 1-1h9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1h-.039l-.08 1H17a.5.5 0 0 1 0 1h-.7l-.455 5.62A1.5 1.5 0 0 1 14.35 18h-4.7a1.5 1.5 0 0 1-1.495-1.38L7.7 11H7a.5.5 0 0 1 0-1h.62l-.081-1H7.5a1 1 0 0 1-1-1zm9.494 1h.506V7h-9v1zm-.536 1H8.542l.61 7.54a.5.5 0 0 0 .498.46h4.7a.5.5 0 0 0 .499-.46zM11.5 11.5a.5.5 0 0 0-1 0v3a.5.5 0 0 0 1 0zm2 0a.5.5 0 0 0-1 0v3a.5.5 0 0 0 1 0z"},Yi=({className:t,small:e})=>Ji("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Ji("path",{clipRule:"evenodd",d:e?Xi.small:Xi.default,fill:"currentColor",fillRule:"evenodd"})});function io(t,e,o,n=10,r=5){let l=o.parentElement;if(t===null||l==null){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let s=o.getBoundingClientRect(),i=l.getBoundingClientRect(),u=t.top-n,d=t.left-r;e.style.width="max-content",e.style.maxWidth="none";let c=e.scrollWidth,a=i.right-d,m=d-i.left,p;if(c<=a)p=e.getBoundingClientRect();else{let f=m+t.width,h=m>a,C=Math.min(c,h?f:a);C<c&&(e.style.width=`${C}px`,e.style.maxWidth=`${C}px`,e.offsetHeight),h&&(d=t.right-C),p=e.getBoundingClientRect()}u<i.top&&(u+=p.height+t.height+n*2),d+p.width>i.right&&(d=i.right-p.width-r),u-=s.top,d-=s.left,e.style.opacity="1",e.style.transform=`translate(${d}px, ${u}px)`}import{createCommand as x1}from"lexical";var so=x1("TOGGLE_LINK_WITH_MODAL_COMMAND");function ls(t){t.preventDefault()}function is({anchorElem:t}){let[e]=C1(),[o,n]=Ue(),r=rs(null),l=rs(null),[s,i]=Ue(null),[u,d]=Ue(null),{fieldProps:{schemaPath:c},uuid:a}=W(),m=b1(),{config:p,getEntityConfig:f}=_1(),{i18n:h,t:x}=w1(),[C,E]=Ue(),w=T1(),[g,b]=Ue(!1),[k,_]=Ue([]),T=E1(),[I,N]=Ue(!1),S=k1({slug:"lexical-rich-text-link-"+a,depth:w}),{toggleDrawer:y}=Oe(S),L=ns(()=>{b(!1),r&&r.current&&(r.current.style.opacity="0",r.current.style.transform="translate(-10000px, -10000px)"),N(!1),i(null),d(null),_([]),E(void 0)},[b,i,d,_]),R=ns(()=>{let v=es(),A;if(!ts(v)||!v){L();return}let $=it(v);A=e.getElementByKey($.getKey())?.getBoundingClientRect();let O=Zi($,Z),B=v.getNodes().filter(se=>!L1(se)).find(se=>{let xe=Zi(se,Z);return O&&!O.is(xe)||xe&&!xe.is(O)});if(O==null||B){L();return}n(O);let F=O.getFields(),z={...F,id:O.getID(),text:O.getTextContent()};if(F?.linkType==="custom")i(F?.url??null),d(null);else{i(`${p.routes.admin==="/"?"":p.routes.admin}/collections/${F?.doc?.relationTo}/${F?.doc?.value}`);let se=F?.doc?.relationTo?f({collectionSlug:F?.doc?.relationTo}):void 0;if(!se)d(F?.label?String(F?.label):null),i(F?.url?String(F?.url):null);else{let xe=typeof F.doc?.value=="object"?F.doc.value.id:F.doc?.value,Gt=F.doc?.relationTo;if(!xe||!Gt)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let ir=x("fields:linkedTo",{label:`${xn(se.labels.singular,h)} - ${x("lexical:link:loadingWithEllipsis",h)}`}).replace(/<[^>]*>?/g,"");d(ir),N1.get(M1({apiRoute:p.routes.api,path:`/${Gt}/${xe}`,serverURL:p.serverURL}),{headers:{"Accept-Language":h.language},params:{depth:0,locale:T?.code}}).then(async Ze=>{if(!Ze.ok)throw new Error(`HTTP error! Status: ${Ze.status}`);let xt=await Ze.json(),oe=se?.admin?.useAsTitle||"id",Ct=xt[oe],Y=x("fields:linkedTo",{label:`${xn(se.labels.singular,h)} - ${Ct}`}).replace(/<[^>]*>?/g,"");d(Y)}).catch(()=>{let Ze=x("fields:linkedTo",{label:`${xn(se.labels.singular,h)} - ${x("general:untitled",h)} - ID: ${xe}`}).replace(/<[^>]*>?/g,"");d(Ze)})}}E(z),b(!0),_(v?v?.getNodes():[]),we(O)?N(!0):N(!1);let V=r.current,Ye=R1(e._window),{activeElement:Re}=document;if(V===null)return;let ge=e.getRootElement();return Ye!==null&&ge!==null&&ge.contains(Ye.anchorNode)?(A||(A=Ye.getRangeAt(0).getBoundingClientRect()),A!=null&&(A.y+=40,l.current=A)):(Re==null||Re.className!=="link-input")&&(ge!==null&&io(null,V,t),i(null),d(null)),!0},[e,L,p.routes.admin,p.routes.api,p.serverURL,f,x,h,T?.code,t]);return ao(()=>qi(e.registerCommand(so,v=>(e.dispatchCommand(fe,v),R(),y(),!0),os)),[e,R,y,S]),ao(()=>{let v=t.parentElement,A=()=>{e.getEditorState().read(()=>{R()})};return window.addEventListener("resize",A),v?.addEventListener("scroll",A),()=>{window.removeEventListener("resize",A),v?.removeEventListener("scroll",A)}},[t.parentElement,e,R]),ao(()=>qi(e.registerUpdateListener(({editorState:v})=>{v.read(()=>{R()})}),e.registerCommand(I1,()=>(R(),!0),os),e.registerCommand(v1,()=>g?(L(),!0):!1,y1)),[e,R,g,L]),ao(()=>{e.getEditorState().read(()=>{R()})},[e,R]),$1(()=>{!g||!r.current||!t||!l.current||io(l.current,r.current,t)},[s,u,g,t,o]),ze(A1.Fragment,{children:[le("div",{className:"link-editor","data-theme":"dark",hidden:!g,ref:r,children:ze("div",{className:"link-input",children:[o?.__fields?.linkType==="custom"?le(no,{}):le(Ki,{}),s&&s.length>0?ze("a",{className:"link-input__url",href:s,rel:"noopener noreferrer",target:"_blank",children:[u!=null&&u.length>0?u:s,o?.__fields.newTab?ze(gn,{children:[le(Qi,{size:16})," ",le("div",{className:"link-input__divider"})," "]}):null]}):u!=null&&u.length>0?ze(gn,{children:[le("span",{className:"link-input__label-pure",children:u}),o?.__fields.newTab?ze(gn,{children:[le(Qi,{size:16})," ",le("div",{className:"link-input__divider"})," "]}):null]}):null,m&&ze("div",{className:"link-input__actions",children:[le("button",{"aria-label":"Edit link",className:"link-edit",onClick:v=>{v.preventDefault(),y()},onMouseDown:ls,tabIndex:0,type:"button",children:le(S1,{})}),!I&&le("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(fe,null)},onMouseDown:ls,tabIndex:0,type:"button",children:le(Yi,{small:!0})})]})]})}),le(Po,{className:"lexical-link-edit-drawer",data:C,drawerSlug:S,drawerTitle:x("fields:editLink"),featureKey:"link",handleDrawerSubmit:(v,A)=>{let $=A,O={...$};delete O.text,e.update(()=>{let B=es(),F=null;if(ts(B)?F=it(B).getParent():k.length&&(F=k[0]?.getParent()??null),F&&we(F)){let z=Te({fields:O});F.replace(z,!0)}}),e.dispatchCommand(fe,{fields:O,selectedNodes:k,text:$.text})},schemaPath:c,schemaPathSuffix:"fields"})]})}var ss=t=>{let{anchorElem:e=document.body}=t;return O1(D1(is,{anchorElem:e}),e)};import{c as F1}from"react/compiler-runtime";import{useLexicalComposerContext as P1}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as B1}from"@lexical/utils";import{$getSelection as j1,$isElementNode as H1,$isRangeSelection as G1,COMMAND_PRIORITY_LOW as as,PASTE_COMMAND as z1}from"lexical";import{useEffect as U1}from"react";var cs=t=>{let e=F1(5),{clientProps:o}=t,[n]=P1(),r,l;return e[0]!==o.defaultLinkType||e[1]!==o.defaultLinkURL||e[2]!==n?(r=()=>{if(!n.hasNodes([re]))throw new Error("LinkPlugin: LinkNode not registered on editor");return B1(n.registerCommand(fe,s=>s===null?(pn(null),!0):(s.fields?.linkType||(s.fields.linkType=o.defaultLinkType),s.fields?.url||(s.fields.url=o.defaultLinkURL),pn(s),!0),as),n.registerCommand(z1,s=>{let i=j1();if(!G1(i)||i.isCollapsed()||!(s instanceof ClipboardEvent)||s.clipboardData==null)return!1;let u=s.clipboardData.getData("text");if(!Mi(u))return!1;if(!i.getNodes().some(W1)){let d={doc:null,linkType:"custom",newTab:!1,url:u};return n.dispatchCommand(fe,{fields:d,text:null}),s.preventDefault(),!0}return!1},as))},l=[o.defaultLinkType,o.defaultLinkURL,n],e[0]=o.defaultLinkType,e[1]=o.defaultLinkURL,e[2]=n,e[3]=r,e[4]=l):(r=e[3],l=e[4]),U1(r,l),null};function W1(t){return H1(t)}var ds=[an([{ChildComponent:no,isActive:({selection:t})=>{if(us(t)){let e=it(t);return V1(e,Z)!=null}return!1},isEnabled:({selection:t})=>!!(us(t)&&Cn()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(fe,null);else{let o,n=[];if(t.getEditorState().read(()=>{o=Cn()?.getTextContent(),n=Cn()?.getNodes()??[]}),!o?.length)return;let r={doc:null};t.dispatchCommand(so,{fields:r,selectedNodes:n,text:o})}},order:1}])],K1=M(({props:t})=>({markdownTransformers:[Di],nodes:[re,t?.disableAutoLinks===!0?null:Ee].filter(Boolean),plugins:[{Component:cs,position:"normal"},t?.disableAutoLinks===!0||t?.disableAutoLinks==="creationOnly"?null:{Component:Ui,position:"normal"},{Component:Wi,position:"normal"},{Component:ss,position:"floatingAnchorElem"}].filter(Boolean),sanitizedClientFeatureProps:t,toolbarFixed:{groups:ds},toolbarInline:{groups:ds}}));import{$isListNode as kn,INSERT_CHECK_LIST_COMMAND as hs,ListItemNode as Q1,ListNode as e0}from"@lexical/list";import{CHECK_LIST as t0}from"@lexical/markdown";import{$isRangeSelection as o0}from"lexical";import{jsx as ms}from"react/jsx-runtime";import"react";var J1={16:"M5.584 8.223a.5.5 0 0 1 .832.554l-2 3a.502.502 0 0 1-.77.076l-1-1a.5.5 0 1 1 .708-.707l.568.569zM13 10a.5.5 0 0 1 0 1H8a.5.5 0 0 1 0-1zM5.583 3.223a.5.5 0 0 1 .832.554l-2 3a.502.502 0 0 1-.77.076l-1-1a.5.5 0 0 1 .708-.707l.568.569zM13 5a.5.5 0 1 1 0 1H8a.5.5 0 0 1 0-1z",24:"M9.084 15.223a.5.5 0 1 1 .832.554l-2 3a.5.5 0 0 1-.77.076l-1-1a.5.5 0 1 1 .708-.707l.568.569zM17.5 17a.5.5 0 0 1 0 1h-6a.5.5 0 0 1 0-1zm-8.416-6.777a.5.5 0 0 1 .832.554l-2 3a.5.5 0 0 1-.77.077l-1-1a.5.5 0 1 1 .708-.707l.568.568zM17.5 12a.5.5 0 0 1 0 1h-6a.5.5 0 0 1 0-1zM9.084 5.223a.5.5 0 0 1 .832.554l-2 3a.502.502 0 0 1-.77.077l-1-1a.5.5 0 1 1 .708-.708l.568.569zM17.5 7a.5.5 0 0 1 0 1h-6a.5.5 0 0 1 0-1z"},bn=({className:t,size:e=24})=>ms("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:ms("path",{d:J1[e],fill:"currentColor"})});import{jsx as X1}from"react/jsx-runtime";import{ListPlugin as Y1}from"@lexical/react/LexicalListPlugin.js";import"react";var st=()=>X1(Y1,{});function co(t,e){return t==="ordered"?!e.has("unorderedList"):t==="checklist"?!e.has("unorderedList")&&!e.has("orderedList"):!1}function at(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{jsx as Z1}from"react/jsx-runtime";import{CheckListPlugin as q1}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var ps=()=>Z1(q1,{});var fs=[ne([{ChildComponent:bn,isActive:({selection:t})=>{if(!o0(t))return!1;for(let e of t.getNodes()){if(kn(e)&&e.getListType()==="check")continue;let o=e.getParent();if(kn(o)&&o.getListType()==="check")continue;let n=o?.getParent();if(!(kn(n)&&n.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(hs,void 0)},order:12}])],n0=M(({featureProviderMap:t})=>{let e=[{Component:ps,position:"normal"}],o=co("checklist",t);return o&&e.push({Component:st,position:"normal"}),{markdownTransformers:[t0],nodes:o?[e0,Q1]:[],plugins:e,slashMenu:{groups:[at([{Icon:bn,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:n})=>n.t("lexical:checklist:label"),onSelect:({editor:n})=>{n.dispatchCommand(hs,void 0)}}])]},toolbarFixed:{groups:fs},toolbarInline:{groups:fs}}});import{$isListNode as Tn,INSERT_ORDERED_LIST_COMMAND as Cs,ListItemNode as l0,ListNode as i0}from"@lexical/list";import{ORDERED_LIST as s0}from"@lexical/markdown";import{$isRangeSelection as a0}from"lexical";import{jsx as gs}from"react/jsx-runtime";import"react";var r0={16:"M5.6 9.01a.5.5 0 0 1 .4.49v1a.5.5 0 0 1-.276.447L4 11.81V12h1.5a.5.5 0 0 1 0 1h-2a.5.5 0 0 1-.5-.5v-1l.005-.07a.5.5 0 0 1 .271-.377L5 10.19V10H3.5a.5.5 0 0 1 0-1h2zM12.5 12a.5.5 0 0 1 0 1h-4a.5.5 0 0 1 0-1zm0-4.5a.5.5 0 0 1 0 1h-4a.5.5 0 0 1 0-1zM4.6 3.01a.5.5 0 0 1 .4.49v3a.5.5 0 0 1-1 0V4h-.5a.5.5 0 0 1 0-1h1zM12.5 3a.5.5 0 0 1 0 1h-4a.5.5 0 0 1 0-1z",24:"M11 7a.5.5 0 0 1 .5-.5h6a.5.5 0 0 1 0 1h-6A.5.5 0 0 1 11 7M6 7a.5.5 0 0 1 .5-.5h1A.5.5 0 0 1 8 7v3.5a.5.5 0 1 1-1 0v-3h-.5A.5.5 0 0 1 6 7m0 6.5a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 .5.5V15a.5.5 0 0 1-.276.447L7 16.31v.191h1.5a.5.5 0 0 1 0 1h-2A.5.5 0 0 1 6 17v-1a.5.5 0 0 1 .276-.447L8 14.69V14H6.5a.5.5 0 0 1-.5-.5m5.5 3a.5.5 0 1 0 0 1h6a.5.5 0 0 0 0-1zm0-5a.5.5 0 1 0 0 1h6a.5.5 0 0 0 0-1z"},_n=({className:t,size:e=24})=>gs("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:gs("path",{clipRule:"evenodd",d:r0[e],fill:"currentColor",fillRule:"evenodd"})});var xs=[ne([{ChildComponent:_n,isActive:({selection:t})=>{if(!a0(t))return!1;for(let e of t.getNodes()){if(Tn(e)&&e.getListType()==="number")continue;let o=e.getParent();if(Tn(o)&&o.getListType()==="number")continue;let n=o?.getParent();if(!(Tn(n)&&n.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Cs,void 0)},order:10}])],c0=M(({featureProviderMap:t})=>{let e=co("ordered",t);return{markdownTransformers:[s0],nodes:e?[i0,l0]:[],plugins:e?[{Component:st,position:"normal"}]:[],slashMenu:{groups:[at([{Icon:_n,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:o})=>o.t("lexical:orderedList:label"),onSelect:({editor:o})=>{o.dispatchCommand(Cs,void 0)}}])]},toolbarFixed:{groups:xs},toolbarInline:{groups:xs}}});import{$isListNode as wn,INSERT_UNORDERED_LIST_COMMAND as _s,ListItemNode as d0,ListNode as m0}from"@lexical/list";import{UNORDERED_LIST as p0}from"@lexical/markdown";import{$isRangeSelection as f0}from"lexical";import{jsx as bs}from"react/jsx-runtime";import"react";var u0="M7 16C7.55228 16 8 16.4477 8 17C8 17.5523 7.55228 18 7 18C6.44772 18 6 17.5523 6 17C6 16.4477 6.44772 16 7 16ZM17.5 16.5C17.7761 16.5 18 16.7239 18 17C18 17.2761 17.7761 17.5 17.5 17.5H10.5C10.2239 17.5 10 17.2761 10 17C10 16.7239 10.2239 16.5 10.5 16.5H17.5ZM7 11C7.55228 11 8 11.4477 8 12C8 12.5523 7.55228 13 7 13C6.44772 13 6 12.5523 6 12C6 11.4477 6.44772 11 7 11ZM17.5 11.5C17.7761 11.5 18 11.7239 18 12C18 12.2761 17.7761 12.5 17.5 12.5H10.5C10.2239 12.5 10 12.2761 10 12C10 11.7239 10.2239 11.5 10.5 11.5H17.5ZM7 6C7.55228 6 8 6.44772 8 7C8 7.55228 7.55228 8 7 8C6.44772 8 6 7.55228 6 7C6 6.44772 6.44772 6 7 6ZM17.5 6.5C17.7761 6.5 18 6.72386 18 7C18 7.27614 17.7761 7.5 17.5 7.5H10.5C10.2239 7.5 10 7.27614 10 7C10 6.72386 10.2239 6.5 10.5 6.5H17.5Z",En=({className:t})=>bs("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:bs("path",{d:u0,fill:"currentColor"})});var ks=[ne([{ChildComponent:En,isActive:({selection:t})=>{if(!f0(t))return!1;for(let e of t.getNodes()){if(wn(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(wn(o)&&o.getListType()==="bullet")continue;let n=o?.getParent();if(!(wn(n)&&n.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(_s,void 0)},order:11}])],h0=M({markdownTransformers:[p0],nodes:[m0,d0],plugins:[{Component:st,position:"normal"}],slashMenu:{groups:[at([{Icon:En,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(_s,void 0)}}])]},toolbarFixed:{groups:ks},toolbarInline:{groups:ks}});import{$setBlocksType as ws}from"@lexical/selection";import{$createParagraphNode as Ss,$getSelection as Ns,$isParagraphNode as Ts,$isRangeSelection as g0}from"lexical";var Es=[ne([{ChildComponent:wt,isActive:({selection:t})=>{if(!g0(t))return!1;for(let e of t.getNodes())if(!Ts(e)&&!Ts(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=Ns();ws(e,()=>Ss())})},order:1}])],x0=M({slashMenu:{groups:[Q([{Icon:wt,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Ns();ws(e,()=>Ss())})}}])]},toolbarFixed:{groups:Es},toolbarInline:{groups:Es}});import{c as j0}from"react/compiler-runtime";import{jsx as Js}from"react/jsx-runtime";import{useLexicalComposerContext as H0}from"@lexical/react/LexicalComposerContext";import{useEffect as G0,useState as z0}from"react";import{jsx as Ks,Fragment as B0}from"react/jsx-runtime";import"react";import{jsx as C0}from"react/jsx-runtime";var Ls={quote:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return C0("blockquote",{children:o})}};import{jsx as b0}from"react/jsx-runtime";var ys=new Set(["h1","h2","h3","h4","h5","h6"]);var Rs={heading:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),n=ys.has(t.tag)?t.tag:"h1";return b0(n,{children:o})}};import{jsx as k0}from"react/jsx-runtime";var vs={horizontalrule:k0("hr",{})};import{jsx as _0}from"react/jsx-runtime";var Is={linebreak:_0("br",{})};import{jsx as Ms}from"react/jsx-runtime";var As=({internalDocToHref:t})=>({autolink:({node:e,nodesToJSX:o})=>{let n=o({nodes:e.children}),r=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0;return Ms("a",{href:e.fields.url,rel:r,target:l,children:n})},link:({node:e,nodesToJSX:o})=>{let n=o({nodes:e.children}),r=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0,s=e.fields.url??"";return e.fields.linkType==="internal"&&(t?s=t({linkNode:e}):(console.error("Lexical => JSX converter: Link converter: found internal link, but internalDocToHref is not provided"),s="#")),Ms("a",{href:s,rel:r,target:l,children:n})}});import{jsx as ct,jsxs as T0,Fragment as E0}from"react/jsx-runtime";import{v4 as w0}from"uuid";var $s=new Set(["ol","ul"]);var Ds={list:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),n=$s.has(t.tag)?t.tag:"ul";return ct(n,{className:`list-${t?.listType}`,children:o})},listitem:({node:t,nodesToJSX:e,parent:o})=>{let n=t.children.some(l=>l.type==="list"),r=e({nodes:t.children});if("listType"in o&&o?.listType==="check"){let l=w0();return ct("li",{"aria-checked":t.checked?"true":"false",className:`list-item-checkbox${t.checked?" list-item-checkbox-checked":" list-item-checkbox-unchecked"}${n?" nestedListItem":""}`,role:"checkbox",style:{listStyleType:"none"},tabIndex:-1,value:t?.value,children:n?r:T0(E0,{children:[ct("input",{checked:t.checked,id:l,readOnly:!0,type:"checkbox"}),ct("label",{htmlFor:l,children:r}),ct("br",{})]})})}else return ct("li",{className:`${n?"nestedListItem":""}`,style:n?{listStyleType:"none"}:void 0,value:t?.value,children:r})}};import{jsx as Sn}from"react/jsx-runtime";var Os={paragraph:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return o?.length?Sn("p",{children:o}):Sn("p",{children:Sn("br",{})})}};var Fs={tab:" "};import{jsx as Mt}from"react/jsx-runtime";var Ps={table:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return Mt("div",{className:"lexical-table-container",children:Mt("table",{className:"lexical-table",style:{borderCollapse:"collapse"},children:Mt("tbody",{children:o})})})},tablecell:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),n=t.headerState>0?"th":"td",r=`lexical-table-cell-header-${t.headerState}`,l={backgroundColor:t.backgroundColor||void 0,border:"1px solid #ccc",padding:"8px"},s=t.colSpan&&t.colSpan>1?t.colSpan:void 0,i=t.rowSpan&&t.rowSpan>1?t.rowSpan:void 0;return Mt(n,{className:`lexical-table-cell ${r}`,colSpan:s,rowSpan:i,style:l,children:o})},tablerow:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return Mt("tr",{className:"lexical-table-row",children:o})}};import{jsx as We}from"react/jsx-runtime";import"react";var D={DOM_ELEMENT_TYPE:1,DOM_TEXT_TYPE:3,NO_DIRTY_NODES:0,HAS_DIRTY_NODES:1,FULL_RECONCILE:2,IS_NORMAL:0,IS_TOKEN:1,IS_SEGMENTED:2,IS_INERT:3,IS_BOLD:1,IS_ITALIC:2,IS_STRIKETHROUGH:4,IS_UNDERLINE:8,IS_CODE:16,IS_SUBSCRIPT:32,IS_SUPERSCRIPT:64,IS_HIGHLIGHT:128,IS_DIRECTIONLESS:1,IS_UNMERGEABLE:2,IS_ALIGN_LEFT:1,IS_ALIGN_CENTER:2,IS_ALIGN_RIGHT:3,IS_ALIGN_JUSTIFY:4,IS_ALIGN_START:5,IS_ALIGN_END:6},S0=D.IS_BOLD|D.IS_ITALIC|D.IS_STRIKETHROUGH|D.IS_UNDERLINE|D.IS_CODE|D.IS_SUBSCRIPT|D.IS_SUPERSCRIPT|D.IS_HIGHLIGHT,N0="\xA0",L0=`
|
|
54
|
+
`},[t,e]),f=Pe((x,b)=>{o(k=>{let _=e.length-1,T=e[_];if(T&&T.name===x){if(x==="type")return[...e.slice(0,_),{...T,value:T.value+b}];if(T.value===b)return[...e.slice(0,_),{...T,count:T.count+1}]}return[...k,{name:x,count:1,value:b}]})},[e,o]);wl(()=>{let x=k=>{if(!n)return;let _=k.key;Em(k)?f("selectAll",""):Nl.has(_)?f("press",k.key):[..._].length>1?f("keydown",k.key):f("type",k.key)},b=k=>{if(!n)return;let _=k.key;!Nl.has(_)&&[..._].length>1&&f("keyup",k.key)};return t.registerRootListener((k,_)=>{_!==null&&(_.removeEventListener("keydown",x),_.removeEventListener("keyup",b)),k!==null&&(k.addEventListener("keydown",x),k.addEventListener("keyup",b))})},[t,n,f]),wl(()=>{c.current&&c.current.scrollTo(0,c.current.scrollHeight)},[m]),ln(()=>{if(e){let x=m();x!==null&&i(x),c.current&&c.current.scrollTo(0,c.current.scrollHeight)}},[m,e]),ln(()=>t.registerUpdateListener(({dirtyElements:b,dirtyLeaves:k,editorState:_})=>{if(!n)return;let T=_._selection,I=u.current,N=d.current;if(I!==T){if(k.size===0&&b.size===0&&!N){let y=rn(t._window);if(y&&(y.anchorNode==null||y.focusNode==null))return}u.current=T}d.current=!1;let w=m();w!==null&&i(w)}),[t,m,n,f]),ln(()=>n?t.registerUpdateListener(()=>{let b=t.getRootElement();b!==null&&l(b?.innerHTML)}):void 0,[t,n]);let h=Pe(x=>{n||(x.update(()=>{let b=bm();b.clear();let k=Cm();b.append(xm().append(k)),k.select()}),o([])),r(b=>!b)},[n]),p=Pe(()=>{if(!n)return;let x=rn(t._window);if(x===null||x.anchorNode==null||x.focusNode==null)return;let{anchorNode:b,anchorOffset:k,focusNode:_,focusOffset:T}=wm(x),I=a().getRootElement(),N;b!==null&&(N=Sl(b,I));let w;_!==null&&(w=Sl(_,I)),f("snapshot",{anchorNode:b,anchorOffset:k,anchorPath:N,focusNode:_,focusOffset:T,focusPath:w})},[f,n,a]),g=Pe(()=>{km(m())},[m]),C=Pe(()=>{_m("test.js",m())},[m]);return[Be("button",{className:`editor-dev-button ${n?"active":""}`,id:"test-recorder-button",onClick:x=>{h(a()),x.preventDefault()},title:n?"Disable test recorder":"Enable test recorder",type:"button",children:n?"Disable test recorder":"Enable test recorder"}),n?an("div",{className:"test-recorder-output",children:[an("div",{className:"test-recorder-toolbar",children:[Be("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:x=>{p(),x.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),Be("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:x=>{g(),x.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),Be("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:x=>{C(),x.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),Be("pre",{id:"test-recorder",ref:c,children:s})]}):null]}var yl=()=>{let t=hm(3),[e]=gm(),[o,n]=Sm(e),r;return t[0]!==o||t[1]!==n?(r=an(Ll.Fragment,{children:[Be("p",{children:"HI"}),o,n,Be("p",{children:"DONE"})]}),t[0]=o,t[1]=n,t[2]=r):r=t[2],r};var Nm=A({plugins:[{Component:yl,position:"bottom"}]});import{c as Lm}from"react/compiler-runtime";import{jsx as ym}from"react/jsx-runtime";import{useLexicalComposerContext as Rm}from"@lexical/react/LexicalComposerContext.js";import{TreeView as vm}from"@lexical/react/LexicalTreeView.js";import"react";var Rl=()=>{let t=Lm(2),[e]=Rm(),o;return t[0]!==e?(o=ym(vm,{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 Im=A({plugins:[{Component:Rl,position:"bottom"}]});import{BOLD_ITALIC_STAR as Am,BOLD_ITALIC_UNDERSCORE as Dm,BOLD_STAR as $m,BOLD_UNDERSCORE as Om}from"@lexical/markdown";import{$isTableSelection as Fm}from"@lexical/table";import{$isRangeSelection as Pm,FORMAT_TEXT_COMMAND as Bm}from"lexical";import{jsx as vl}from"react/jsx-runtime";import"react";var Mm="M14.5 9.25A1.75 1.75 0 0 1 12.75 11H9.5V7.5h3.25c.966 0 1.75.784 1.75 1.75M8 11V7.5A1.5 1.5 0 0 1 9.5 6h3.25a3.25 3.25 0 0 1 2.418 5.422A3.5 3.5 0 0 1 13.5 18h-4A1.5 1.5 0 0 1 8 16.5zm1.5 1.5v4h4a2 2 0 1 0 0-4z",Il=({className:t})=>vl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:vl("path",{clipRule:"evenodd",d:Mm,fill:"currentColor",fillRule:"evenodd"})});var q=t=>({type:"buttons",items:t,key:"format",order:40});var Ml=[q([{ChildComponent:Il,isActive:({selection:t})=>Pm(t)||Fm(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(Bm,"bold")},order:1}])],jm=A(({featureProviderMap:t})=>{let e=[$m,Om];return t.get("italic")&&e.push(Dm,Am),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:Ml},toolbarInline:{groups:Ml}}});import{INLINE_CODE as Gm}from"@lexical/markdown";import{$isTableSelection as Um}from"@lexical/table";import{$isRangeSelection as zm,FORMAT_TEXT_COMMAND as Wm}from"lexical";import{jsx as Al}from"react/jsx-runtime";import"react";var Hm="M9.64645 8.14645C9.84171 7.95118 10.1582 7.95118 10.3535 8.14645C10.5487 8.34171 10.5487 8.65822 10.3535 8.85348L7.20699 12L10.3535 15.1464C10.5487 15.3417 10.5487 15.6582 10.3535 15.8535C10.1582 16.0487 9.84171 16.0487 9.64645 15.8535L6.14645 12.3535C5.95118 12.1582 5.95118 11.8417 6.14645 11.6464L9.64645 8.14645ZM13.6464 8.14645C13.8417 7.95118 14.1582 7.95118 14.3535 8.14645L17.8535 11.6464C18.0487 11.8417 18.0487 12.1582 17.8535 12.3535L14.3535 15.8535C14.1582 16.0487 13.8417 16.0487 13.6464 15.8535C13.4512 15.6582 13.4512 15.3417 13.6464 15.1464L16.7929 12L13.6464 8.85348C13.4512 8.65822 13.4512 8.34171 13.6464 8.14645Z",Dl=({className:t})=>Al("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Al("path",{clipRule:"evenodd",d:Hm,fill:"currentColor",fillRule:"evenodd"})});var $l=[q([{ChildComponent:Dl,isActive:({selection:t})=>zm(t)||Um(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(Wm,"code")},order:7}])],Vm=A({enableFormats:["code"],markdownTransformers:[Gm],toolbarFixed:{groups:$l},toolbarInline:{groups:$l}});import{ITALIC_STAR as Jm,ITALIC_UNDERSCORE as Xm}from"@lexical/markdown";import{$isTableSelection as Ym}from"@lexical/table";import{$isRangeSelection as Zm,FORMAT_TEXT_COMMAND as qm}from"lexical";import{jsx as Ol}from"react/jsx-runtime";import"react";var Km="M10 6.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 0 1h-2.083L11.6 17h1.9a.5.5 0 0 1 0 1h-5a.5.5 0 0 1 0-1h2.083L12.4 7h-1.9a.5.5 0 0 1-.5-.5",Fl=({className:t})=>Ol("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Ol("path",{clipRule:"evenodd",d:Km,fill:"currentColor",fillRule:"evenodd"})});var Pl=[q([{ChildComponent:Fl,isActive:({selection:t})=>Zm(t)||Ym(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(qm,"italic")},order:2}])],Qm=A({enableFormats:["italic"],markdownTransformers:[Jm,Xm],toolbarFixed:{groups:Pl},toolbarInline:{groups:Pl}});import{STRIKETHROUGH as tf}from"@lexical/markdown";import{$isTableSelection as of}from"@lexical/table";import{$isRangeSelection as nf,FORMAT_TEXT_COMMAND as rf}from"lexical";import{jsx as Bl}from"react/jsx-runtime";import"react";var ef="M15.835 13.5a.27.27 0 0 1 .24.138q.306.554.306 1.316 0 1.01-.543 1.816-.543.8-1.554 1.268-1.01.462-2.409.462-1.323 0-2.295-.419-.972-.424-1.534-1.175a3.2 3.2 0 0 1-.533-1.135c-.082-.326.187-.614.522-.614.299 0 .539.233.625.519q.13.43.415.768.448.524 1.17.8.73.271 1.63.272.996 0 1.764-.32.773-.327 1.215-.906a2.16 2.16 0 0 0 .44-1.348q0-.645-.345-1.09c-.1-.132-.016-.352.15-.352zm-3.846-8q1.215 0 2.142.438.933.43 1.476 1.187.38.518.519 1.134c.07.31-.19.577-.507.577-.286 0-.518-.22-.6-.493q-.22-.738-.875-1.224-.864-.646-2.18-.646-.92 0-1.63.313-.703.308-1.1.85a2.04 2.04 0 0 0-.395 1.237q0 .492.217.874.216.376.588.652.376.278.843.475.474.197.972.338l1.052.288H18.5a.5.5 0 0 1 0 1h-13a.5.5 0 0 1 0-1h3.94a4.4 4.4 0 0 1-.844-.602q-.844-.781-.844-1.982 0-1.009.562-1.778t1.522-1.2q.959-.438 2.153-.438",jl=({className:t})=>Bl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Bl("path",{d:ef,fill:"currentColor"})});var Hl=[q([{ChildComponent:jl,isActive:({selection:t})=>nf(t)||of(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(rf,"strikethrough")},order:4}])],lf=A({enableFormats:["strikethrough"],markdownTransformers:[tf],toolbarFixed:{groups:Hl},toolbarInline:{groups:Hl}});import{$isTableSelection as af}from"@lexical/table";import{$isRangeSelection as cf,FORMAT_TEXT_COMMAND as uf}from"lexical";import{jsx as Gl}from"react/jsx-runtime";import"react";var sf="M7.51 15.65a.523.523 0 1 1-.985-.352l2.377-6.534a.83.83 0 0 1 1.56 0l2.374 6.534a.523.523 0 1 1-.985.351L9.722 9.57a.043.043 0 0 0-.08 0zm.162-2.238c0-.252.204-.456.456-.456h3.1a.456.456 0 0 1 0 .912h-3.1a.456.456 0 0 1-.456-.456m6.652 3.925a.436.436 0 0 1-.287-.765l1.64-1.431q.259-.228.433-.407.175-.178.266-.345a.76.76 0 0 0 .091-.365.61.61 0 0 0-.258-.52q-.255-.195-.63-.195-.4 0-.643.21a.7.7 0 0 0-.133.151c-.127.197-.3.403-.534.403s-.432-.194-.367-.418q.11-.378.434-.642.494-.402 1.257-.403.513 0 .897.183.387.181.604.501.217.316.217.714 0 .316-.13.586-.125.27-.395.555a9 9 0 0 1-.695.634l-.927.798a.023.023 0 0 0 .016.042h1.895a.357.357 0 0 1 0 .714z",Ul=({className:t})=>Gl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Gl("path",{d:sf,fill:"currentColor"})});var zl=[q([{ChildComponent:Ul,isActive:({selection:t})=>cf(t)||af(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(uf,"subscript")},order:5}])],df=A({enableFormats:["subscript"],toolbarFixed:{groups:zl},toolbarInline:{groups:zl}});import{$isTableSelection as ff}from"@lexical/table";import{$isRangeSelection as pf,FORMAT_TEXT_COMMAND as hf}from"lexical";import{jsx as Wl}from"react/jsx-runtime";import"react";var mf="M7.51 15.65a.523.523 0 1 1-.985-.352l2.377-6.534a.83.83 0 0 1 1.56 0l2.374 6.534a.523.523 0 1 1-.985.351L9.722 9.57a.043.043 0 0 0-.08 0zm.162-2.238c0-.252.204-.456.456-.456h3.1a.456.456 0 0 1 0 .912h-3.1a.456.456 0 0 1-.456-.456m6.652-1.303a.436.436 0 0 1-.287-.765l1.64-1.432q.259-.228.433-.406.175-.179.266-.346a.76.76 0 0 0 .091-.365.61.61 0 0 0-.258-.52q-.255-.195-.63-.194-.4 0-.643.209a.7.7 0 0 0-.133.152c-.127.196-.3.403-.534.403s-.432-.194-.367-.419q.11-.378.434-.641.494-.403 1.257-.403.513 0 .897.182.387.183.604.502.217.315.217.714 0 .315-.13.585-.125.27-.395.555a9 9 0 0 1-.695.635l-.927.798a.023.023 0 0 0 .016.041h1.895a.357.357 0 1 1 0 .715z",Vl=({className:t})=>Wl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Wl("path",{d:mf,fill:"currentColor"})});var Kl=[q([{ChildComponent:Vl,isActive:({selection:t})=>pf(t)||ff(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(hf,"superscript")},order:6}])],gf=A({enableFormats:["superscript"],toolbarFixed:{groups:Kl},toolbarInline:{groups:Kl}});import{$isTableSelection as Cf}from"@lexical/table";import{$isRangeSelection as bf,FORMAT_TEXT_COMMAND as kf}from"lexical";import{jsx as Jl}from"react/jsx-runtime";import"react";var xf="M9 7.5a.5.5 0 0 0-1 0V12a4 4 0 0 0 8 0V7.5a.5.5 0 0 0-1 0V12a3 3 0 1 1-6 0zM16.5 19a.5.5 0 0 0 0-1h-9a.5.5 0 0 0 0 1z",Xl=({className:t})=>Jl("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Jl("path",{clipRule:"evenodd",d:xf,fill:"currentColor",fillRule:"evenodd"})});var Yl=[q([{ChildComponent:Xl,isActive:({selection:t})=>bf(t)||Cf(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(kf,"underline")},order:3}])],_f=A({enableFormats:["underline"],toolbarFixed:{groups:Yl},toolbarInline:{groups:Yl}});import{jsx as un}from"react/jsx-runtime";import{jsx as Tf}from"react/jsx-runtime";function Ef(t){return t.replace(/-([a-z])/g,(e,o)=>o.toUpperCase())}var io=({css:t})=>{let e=t?Object.fromEntries(Object.entries(t).map(([o,n])=>[Ef(o),n])):{};return Tf("span",{style:{...e,alignItems:"center",borderRadius:"4px",display:"flex",fontSize:"16px",height:"20px",justifyContent:"center",width:"20px"},children:"A"})};import{useLexicalComposerContext as wf}from"@lexical/react/LexicalComposerContext";import{$forEachSelectedTextNode as Sf}from"@lexical/selection";import{$getNodeByKey as Nf,$getState as Lf,$setState as yf,createState as Rf,TextNode as vf}from"lexical";import{useEffect as If}from"react";function Zl(t){let e=new Map;for(let o in t){let n=t[o],r=Rf(o,{parse:l=>typeof l=="string"&&Object.keys(n).includes(l)?l:void 0});e.set(o,{stateConfig:r,stateValues:n})}return e}function cn(t,e,o,n){t.update(()=>{Sf(r=>{let l=e.get(o);if(!l)throw new Error(`State config for ${o} not found`);yf(r,l.stateConfig,n)})})}function ql({stateMap:t}){let[e]=wf();return If(()=>e.registerMutationListener(vf,o=>{e.getEditorState().read(()=>{for(let[n,r]of o){if(r==="destroyed")continue;let l=Nf(n),s=e.getElementByKey(n);if(!l||!s)continue;let i=Object.create(null);t.forEach((u,d)=>{let c=Lf(l,u.stateConfig);if(!c){delete s.dataset[d];return}s.dataset[d]=c;let a=u.stateValues[c]?.css;a&&Object.assign(i,a)}),s.style.cssText="",Object.assign(s.style,i)}})}),[e]),null}var Ql=(t,e)=>{let o=[];for(let r in t.state){let l=t.state[r];for(let s in l){let i=l[s];o.push({ChildComponent:()=>un(io,{css:i.css}),key:s,label:i.label,onSelect:({editor:u})=>{cn(u,e,r,s)}})}}return[{type:"dropdown",ChildComponent:()=>un(io,{css:{color:"var(--color-icon-secondary)"}}),items:[...[{ChildComponent:()=>un(io,{}),key:"clear-style",label:({i18n:r})=>r.t("lexical:textState:defaultStyle"),onSelect:({editor:r})=>{for(let l in t.state)cn(r,e,l,void 0)},order:1}],...o],key:"textState",order:30}]},Mf=A(({props:t})=>{let e=Zl(t.state);return{plugins:[{Component:()=>ql({stateMap:e}),position:"normal"}],toolbarFixed:{groups:Ql(t,e)},toolbarInline:{groups:Ql(t,e)}}});import{c as Jf}from"react/compiler-runtime";import{useLexicalComposerContext as Xf}from"@lexical/react/LexicalComposerContext";import{$createHeadingNode as Yf,$isHeadingNode as fi,HeadingNode as gi}from"@lexical/rich-text";import{$setBlocksType as Zf}from"@lexical/selection";import{$getSelection as qf,$isRangeSelection as Qf}from"lexical";import{useEffect as ep}from"react";import{jsx as ei}from"react/jsx-runtime";import"react";var Af="M7 6.5a.5.5 0 0 0-1 0v11a.5.5 0 0 0 1 0V12h6v5.5a.5.5 0 0 0 1 0v-11a.5.5 0 0 0-1 0V11H7zm11 6a.5.5 0 0 0-.777-.416l-1.5 1a.5.5 0 1 0 .554.832l.723-.482V17.5a.5.5 0 0 0 1 0z",ti=({className:t})=>ei("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:ei("path",{d:Af,fill:"currentColor"})});import{jsx as oi}from"react/jsx-runtime";import"react";var Df="M7 6.5a.5.5 0 0 0-1 0v11a.5.5 0 0 0 1 0V12h6v5.5a.5.5 0 0 0 1 0v-11a.5.5 0 0 0-1 0V11H7zm9.034 10.952c0 .303.245.548.548.548h2.97a.448.448 0 0 0 0-.896H17.48v-.04l.997-1.038q.562-.555.873-.945.314-.39.438-.711t.124-.653q0-.497-.245-.885a1.7 1.7 0 0 0-.684-.61A2.24 2.24 0 0 0 17.96 12a2.2 2.2 0 0 0-1.017.228 1.71 1.71 0 0 0-.888 1.13c-.064.268.168.495.444.495.275 0 .479-.236.595-.485l.019-.039q.12-.22.333-.338a1 1 0 0 1 .5-.121q.278 0 .495.11a.83.83 0 0 1 .341.312.9.9 0 0 1 .125.48q0 .245-.096.462t-.288.448-.48.529l-1.85 1.854a.55.55 0 0 0-.16.387",ni=({className:t})=>oi("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:oi("path",{d:Df,fill:"currentColor"})});import{jsx as ri,jsxs as $f}from"react/jsx-runtime";import"react";var Of="M7 6.5a.5.5 0 0 0-1 0v11a.5.5 0 0 0 1 0V12h6v5.5a.5.5 0 0 0 1 0v-11a.5.5 0 0 0-1 0V11H7z",Ff="M16.59 13.32 A1.5 1.25 0 1 1 18 15 A1.5 1.25 0 1 1 16.59 16.68",li=({className:t})=>$f("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:[ri("path",{d:Of,fill:"currentColor"}),ri("path",{d:Ff,stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1})]});import{jsx as ii,jsxs as Pf}from"react/jsx-runtime";import"react";var Bf="M7 6.5a.5.5 0 0 0-1 0v11a.5.5 0 0 0 1 0V12h6v5.5a.5.5 0 0 0 1 0v-11a.5.5 0 0 0-1 0V11H7z",jf="M18.85 17.5 V12.5 L16.5 15.85 H19.5",si=({className:t})=>Pf("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:[ii("path",{d:Bf,fill:"currentColor"}),ii("path",{d:jf,stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1})]});import{jsx as ai,jsxs as Hf}from"react/jsx-runtime";import"react";var Gf="M7 6.5a.5.5 0 0 0-1 0v11a.5.5 0 0 0 1 0V12h6v5.5a.5.5 0 0 0 1 0v-11a.5.5 0 0 0-1 0V11H7z",Uf="M19.2 12.5 H16.8 V14.9 A1.5 1.5 0 1 1 16.7 16.9",ci=({className:t})=>Hf("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:[ai("path",{d:Gf,fill:"currentColor"}),ai("path",{d:Uf,stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1})]});import{jsx as ui,jsxs as zf}from"react/jsx-runtime";import"react";var Wf="M7 6.5a.5.5 0 0 0-1 0v11a.5.5 0 0 0 1 0V12h6v5.5a.5.5 0 0 0 1 0v-11a.5.5 0 0 0-1 0V11H7z",Vf="M18.85 12.55 C17.45 13.05 16.5 14.25 16.5 16 A1.5 1.5 0 1 1 19.5 16 A1.5 1.5 0 1 1 16.5 16",di=({className:t})=>zf("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:[ui("path",{d:Wf,fill:"currentColor"}),ui("path",{d:Vf,stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1})]});import{HEADING as Kf}from"@lexical/markdown";var mi=t=>{let o=`^(${t.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`;return{...Kf,regExp:new RegExp(o)}};var pi=t=>{let e=qf();Zf(e,()=>Yf(t))},hi={h1:ti,h2:ni,h3:li,h4:si,h5:ci,h6:di},tp=A(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[oe(e.map((n,r)=>({ChildComponent:hi[n],isActive:({selection:l})=>{if(!Qf(l))return!1;for(let s of l.getNodes()){if(fi(s)&&s.getTag()===n)continue;let i=s.getParent();if(!(fi(i)&&i.getTag()===n))return!1}return!0},key:n,label:({i18n:l})=>l.t("lexical:heading:label",{headingLevel:n.charAt(1)}),onSelect:({editor:l})=>{l.update(()=>{pi(n)})},order:r+2})))];return{markdownTransformers:[mi(e)],nodes:[gi],plugins:[{Component:op,position:"normal"}],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[Z(e.map(n=>({Icon:hi[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(()=>{pi(n)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}}),op=t=>{let e=Jf(9),{clientProps:o}=t,{enabledHeadingSizes:n}=o,r;e[0]!==n?(r=n===void 0?["h1","h2","h3","h4","h5","h6"]:n,e[0]=n,e[1]=r):r=e[1];let l=r,s;e[2]!==l?(s=l.at(-1),e[2]=l,e[3]=s):s=e[3];let i=s,[u]=Xf(),d,c;return e[4]!==u||e[5]!==l||e[6]!==i?(d=()=>{if(!(!i||l.length===6))return u.registerNodeTransform(gi,a=>{l.includes(a.getTag())||a.setTag(i)})},c=[u,l,i],e[4]=u,e[5]=l,e[6]=i,e[7]=d,e[8]=c):(d=e[7],c=e[8]),ep(d,c),null};import{$isNodeSelection as bp}from"lexical";import{jsx as xi}from"react/jsx-runtime";import"react";var np="M18 12a.5.5 0 0 1-.5.5h-11a.5.5 0 0 1 0-1h11a.5.5 0 0 1 .5.5",dn=({className:t})=>xi("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:xi("path",{d:np,fill:"currentColor"})});var be=t=>({type:"dropdown",ChildComponent:Mr,items:t,key:"add",order:10});import{addClassNamesToElement as rp}from"@lexical/utils";import{$applyNodeReplacement as lp,createCommand as ip,DecoratorNode as sp}from"lexical";var Mt=ip("INSERT_HORIZONTAL_RULE_COMMAND"),It=class extends sp{static clone(e){return new this(e.__key)}static getType(){return"horizontalrule"}static importDOM(){return{hr:()=>({conversion:ap,priority:0})}}static importJSON(e){return Ci()}createDOM(e){let o=document.createElement("hr");return rp(o,e.theme.hr),o}decorate(){return null}exportDOM(){return{element:document.createElement("hr")}}exportJSON(){return{type:"horizontalrule",version:1}}getTextContent(){return`
|
|
55
|
+
`}isInline(){return!1}updateDOM(){return!1}};function ap(){return{node:Ci()}}function Ci(){return lp(new It)}import{$applyNodeReplacement as cp}from"lexical";import"react";var ke=class extends It{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return lt()}decorate(){return null}exportJSON(){return super.exportJSON()}};function lt(){return cp(new ke)}function je(t){return t instanceof ke}var bi={type:"element",dependencies:[ke],export:(t,e)=>je(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=lt();e&&t.replace(e)}};import{c as up}from"react/compiler-runtime";import{useLexicalComposerContext as dp}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as ki,$insertNodeToNearestRoot as mp}from"@lexical/utils";import{$getRoot as fp,$getSelection as _i,$isRangeSelection as Ti,$isRootOrShadowRoot as Ei,COMMAND_PRIORITY_EDITOR as pp}from"lexical";import{useEffect as hp}from"react";var mn="LexicalEditorTheme__hrSelected",wi=()=>{let t=up(3),[e]=dp(),o,n;return t[0]!==e?(o=()=>{let r=e.registerCommand(Mt,gp,pp),l=e.registerUpdateListener(s=>{let{editorState:i}=s;i.read(()=>{let d=fp().getChildren(),c=_i(),a=[];for(let x=0;x<d.length;x++){let b=d[x];if(je(b)){let k=e.getElementByKey(b.getKey());k&&a.push({element:k,index:x})}}if(a.length===0)return;if(!Ti(c)||c.isCollapsed()){for(let{element:x}of a)x.classList.remove(mn);return}let m=c.anchor.getNode(),f=c.focus.getNode(),h=ki(m,xp)||m,p=ki(f,Cp)||f,g=d.indexOf(h),C=d.indexOf(p);if(g===-1||C===-1)return;let E=Math.min(g,C),L=Math.max(g,C);for(let{element:x,index:b}of a)b>=E&&b<=L?x.classList.add(mn):x.classList.remove(mn)})});return()=>{r(),l()}},n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),hp(o,n),null};function gp(t){let e=_i();if(!Ti(e))return!1;if(e.focus.getNode()!==null){let n=lt();mp(n)}return!0}function xp(t){return Ei(t.getParent())}function Cp(t){return Ei(t.getParent())}var kp=A({markdownTransformers:[bi],nodes:[ke],plugins:[{Component:wi,position:"normal"}],slashMenu:{groups:[Z([{Icon:dn,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Mt,void 0)}}])]},toolbarFixed:{groups:[be([{ChildComponent:dn,isActive:({selection:t})=>{if(!bp(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return je(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Mt,void 0)}}])]}});import{$findMatchingParent as $i}from"@lexical/utils";import{$isElementNode as $p,INDENT_CONTENT_COMMAND as Op,OUTDENT_CONTENT_COMMAND as Fp}from"lexical";import{jsx as fn}from"react/jsx-runtime";import"react";var _p="M7.854 6.146a.5.5 0 1 0-.708.708L8.293 8H5.5a.5.5 0 0 0 0 1h2.793l-1.147 1.146a.5.5 0 0 0 .708.708l2-2a.5.5 0 0 0 0-.708zM11.5 8a.5.5 0 0 0 0 1h7a.5.5 0 0 0 0-1zM5 12.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m.5 3.5a.5.5 0 0 0 0 1h13a.5.5 0 0 0 0-1z",Si=({className:t})=>fn("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:fn("g",{transform:"scale(-1, 1) translate(-24, 0)",children:fn("path",{clipRule:"evenodd",d:_p,fill:"currentColor",fillRule:"evenodd"})})});import{jsx as Ni}from"react/jsx-runtime";import"react";var Tp="M7.854 6.146a.5.5 0 1 0-.708.708L8.293 8H5.5a.5.5 0 0 0 0 1h2.793l-1.147 1.146a.5.5 0 0 0 .708.708l2-2a.5.5 0 0 0 0-.708zM11.5 8a.5.5 0 0 0 0 1h7a.5.5 0 0 0 0-1zM5 12.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m.5 3.5a.5.5 0 0 0 0 1h13a.5.5 0 0 0 0-1z",Li=({className:t})=>Ni("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Ni("path",{clipRule:"evenodd",d:Tp,fill:"currentColor",fillRule:"evenodd"})});import{jsx as Ep}from"react/jsx-runtime";import{useLexicalComposerContext as wp}from"@lexical/react/LexicalComposerContext";import{TabIndentationPlugin as Sp}from"@lexical/react/LexicalTabIndentationPlugin";import{$findMatchingParent as Np,mergeRegister as pn}from"@lexical/utils";import{$addUpdateTag as hn,$getSelection as vi,$isElementNode as Ii,$isRangeSelection as Mi,$isRootOrShadowRoot as Lp,BLUR_COMMAND as yp,COMMAND_PRIORITY_HIGH as so,COMMAND_PRIORITY_LOW as gn,FOCUS_COMMAND as Rp,INDENT_CONTENT_COMMAND as yi,KEY_ESCAPE_COMMAND as vp,KEY_TAB_COMMAND as Ri,OUTDENT_CONTENT_COMMAND as Ip,SELECTION_CHANGE_COMMAND as Mp,SKIP_DOM_SELECTION_TAG as xn,TabNode as Ap}from"lexical";import{useEffect as Cn}from"react";var Ai=({clientProps:t})=>{let[e]=wp(),{disabledNodes:o,disableTabNode:n}=t;return Cn(()=>{let r=!1,l=!1,s=()=>{r=!1},i,u,d;function c(){s(),l=!1}function a(p){if(p.key!=="Tab"||!r){["Escape","Shift","Tab"].includes(p.key)||s();return}let g=e.getRootElement();if(!g)return;s(),l=!0,p.stopPropagation(),i?.(),clearTimeout(u);let C=g.closest(".rich-text-lexical")??g,E=new Set([g,...C.querySelectorAll('[tabindex], [contenteditable="true"], a[href], button, input, select, textarea, summary, iframe, audio[controls], video[controls]')]),L=new Map;for(let x of E)L.set(x,x.getAttribute("tabindex")),x.setAttribute("tabindex","-1");i=()=>{for(let[x,b]of L)b===null?x.removeAttribute("tabindex"):x.setAttribute("tabindex",b);i=void 0},u=setTimeout(()=>i?.(),0),e.update(()=>hn(xn))}function m(p){if(p.key==="Escape"&&!p.defaultPrevented&&e.isEditable()){if(r&&!p.repeat)return;p.preventDefault(),p.stopPropagation(),r=!0}}let f=e.registerRootListener(p=>{d?.abort(),d=new AbortController;let{signal:g}=d;p?.addEventListener("pointerdown",c,{signal:g}),p?.addEventListener("keydown",a,{capture:!0,signal:g}),p?.addEventListener("keydown",m,{signal:g})}),h=pn(e.registerCommand(vp,p=>e.isEditable()?(m(p),!0):!1,gn),e.registerCommand(Ri,()=>{let p=vi();return Mi(p)&&p.isCollapsed()&&Lp(p.anchor.getNode())?(s(),l=!0,hn(xn),!0):!1},so),e.registerCommand(yp,()=>(s(),!1),so),e.registerCommand(Rp,()=>(c(),!1),so),e.registerCommand(Mp,()=>{let p=e.getRootElement();return l&&p?.ownerDocument.activeElement!==p&&hn(xn),!1},so));return()=>{h(),f(),d?.abort(),clearTimeout(u),i?.()}},[e]),Cn(()=>{if(!(!e||!o?.length))return pn(e.registerCommand(yi,()=>Dp(r=>{if(!o.includes(r.getType())){let l=r.getIndent();r.setIndent(l+1)}}),gn),e.registerUpdateListener(({dirtyElements:r,editorState:l})=>{e.update(()=>{for(let[s]of r){let i=l._nodeMap.get(s);Ii(i)&&o.includes(i.getType())&&i.getIndent()>0&&i.setIndent(0)}})}))},[e,o]),Cn(()=>{if(!(!e||!n))return pn(e.registerCommand(Ri,r=>(r.preventDefault(),e.dispatchCommand(r.shiftKey?Ip:yi,void 0)),gn),e.registerNodeTransform(Ap,r=>{r.remove()}))},[e,n]),Ep(Sp,{})};function Dp(t){let e=vi();if(!Mi(e))return!1;let o=new Set,n=e.getNodes();for(let r=0;r<n.length;r++){let l=n[r],s=l.getKey();if(o.has(s))continue;let i=Np(l,d=>Ii(d)&&!d.isInline());if(i===null)continue;let u=i.getKey();i.canIndent()&&!o.has(u)&&(o.add(u),t(i))}return o.size>0}var Di=t=>({type:"buttons",items:t,key:"indent",order:35});var Oi=({disabledNodes:t})=>[Di([{ChildComponent:Si,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],n=r=>Fi(r)&&r.getIndent()>0;return o.some(r=>n(r)||!!$i(r,n))},key:"indentDecrease",label:({i18n:e})=>e.t("lexical:indent:decreaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Fp,void 0)},order:1},{ChildComponent:Li,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],n=r=>Fi(r)&&!(t??[]).includes(r.getType());return o.some(r=>n(r)||!!$i(r,n))},key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Op,void 0)},order:2}])],Pp=A(({props:t})=>{let e=t.disabledNodes??[];return{plugins:[{Component:Ai,position:"normal"}],sanitizedClientFeatureProps:t,toolbarFixed:{groups:Oi({disabledNodes:e})},toolbarInline:{groups:Oi({disabledNodes:e})}}}),Fi=t=>$p(t)&&t.canIndent();import{$findMatchingParent as o0}from"@lexical/utils";import{$getSelection as Rn,$isRangeSelection as Cs}from"lexical";import{jsx as Pi}from"react/jsx-runtime";import"react";var Bp={16:"M8.38 6.381a.29.29 0 0 1 .347-.056q.293.161.541.408a2.5 2.5 0 0 1 0 3.535l-2 2a2.5 2.5 0 0 1-3.535-3.535l.571-.573c.25-.249.692-.107.81.224a.46.46 0 0 1-.098.478l-.576.578a1.5 1.5 0 1 0 2.121 2.12l2-2a1.5 1.5 0 0 0 0-2.12c-.23-.23-.493-.509-.358-.805a.9.9 0 0 1 .178-.254m.352-2.648a2.5 2.5 0 1 1 3.535 3.535l-.471.47c-.253.254-.717.082-.819-.261a.44.44 0 0 1 .102-.435l.481-.481A1.5 1.5 0 0 0 9.44 4.44l-2 2a1.5 1.5 0 0 0 0 2.12c.136.138.168.365.031.502l-.182.181c-.154.154-.403.179-.557.025a2.5 2.5 0 0 1 0-3.535z",24:"M12.4436 10.3708C12.6861 10.5041 12.9148 10.6721 13.1204 10.8776C14.2919 12.0492 14.2918 13.9482 13.1204 15.1198L11.1204 17.1198C9.94879 18.2914 8.04975 18.2914 6.87817 17.1198C5.70664 15.9482 5.70661 14.0492 6.87817 12.8776L8.1477 11.6071C8.4098 11.345 8.89329 11.5392 8.97388 11.9011C9.00617 12.0462 8.96861 12.2012 8.86353 12.3063L7.5852 13.5847C6.80417 14.3657 6.80419 15.6317 7.5852 16.4128C8.36625 17.1938 9.63228 17.1938 10.4133 16.4128L12.4133 14.4128C13.1942 13.6317 13.1943 12.3657 12.4133 11.5847C12.4042 11.5755 12.3953 11.5662 12.386 11.5573C12.2925 11.468 12.1984 11.3736 12.1614 11.2497C12.0724 10.9515 12.1448 10.6149 12.3801 10.3796C12.397 10.3628 12.4228 10.3594 12.4436 10.3708ZM12.8782 6.87764C14.0497 5.70615 15.9488 5.70616 17.1204 6.87764C18.2919 8.04919 18.2919 9.94825 17.1204 11.1198L15.8508 12.3903C15.5887 12.6522 15.1053 12.4581 15.0247 12.0964C14.9924 11.9512 15.0308 11.7963 15.136 11.6911L16.4133 10.4128C17.1943 9.63175 17.1943 8.3657 16.4133 7.58467C15.6323 6.80371 14.3662 6.8037 13.5852 7.58467L11.5852 9.58467C10.8046 10.3657 10.8044 11.6319 11.5852 12.4128C11.5943 12.4219 11.6042 12.4303 11.6135 12.4392C11.7064 12.5278 11.7999 12.622 11.8372 12.7448C11.9276 13.044 11.8545 13.3827 11.6184 13.6188C11.6023 13.6347 11.5778 13.6383 11.5579 13.6276C11.3146 13.4942 11.0843 13.3259 10.8782 13.1198C9.7068 11.9484 9.707 10.0492 10.8782 8.87764L12.8782 6.87764Z"},ao=({className:t,size:e=24})=>Pi("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:Pi("path",{d:Bp[e],fill:"currentColor"})});import{$isAtNodeEnd as Bi}from"@lexical/selection";function it(t){let{anchor:e}=t,{focus:o}=t,n=t.anchor.getNode(),r=t.focus.getNode();return n===r?n:t.isBackward()?Bi(o)?n:r:Bi(e)?n:r}var bn=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as qp}from"lexical";function kn(t){let e=/^(?:(?:https?|mailto|ftp|tel|file|sms):|[^&:/?#]*(?:[/?#]|$))/gi,o=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z\d+/]+=*$/i;return t=String(t).trim(),t.match(e)!=null||t.match(o)!=null?t:"https://"}var jp=/^(?:[a-zA-Z][a-zA-Z\d+.-]*:(?:\/\/)?(?:[-;:&=+$,\w]+@)?[A-Za-z\d]+(?:\.[A-Za-z\d]+)+|www\.[A-Za-z\d]+(?:\.[A-Za-z\d]+)+|(?:tel|mailto):[\w+.-]+)(?:\/[+~%/\w-]*)?(?:\?[-;&=%\w]*)?(?:#\w+)?$/,Hp=/^(?:\/[\w\-./]*(?:\?[-;&=%\w]*)?(?:#[\w-]+)?|#[\w\-]+)$/;function ji(t){if(!t||t.includes(" ")||/^[a-z][a-z\d+.-]*:\/[^/]/i.test(t))return!1;if(t==="https://"||jp.test(t)||Hp.test(t))return!0;try{let e=new URL(t);return!(["ftp:","http:","https:"].includes(e.protocol)&&!e.hostname.includes("."))}catch{}return!1}import{addClassNamesToElement as Gp,isHTMLAnchorElement as Up}from"@lexical/utils";import En from"bson-objectid";import{$applyNodeReplacement as zp,$createTextNode as Hi,$getSelection as Wp,$isElementNode as Gi,$isRangeSelection as Tn,createCommand as Vp,ElementNode as Kp}from"lexical";var Jp=new Set(["http:","https:","mailto:","sms:","tel:"]),ne=class extends Kp{__fields;__id;constructor({id:e,fields:o={linkType:"custom",newTab:!1},key:n}){super(n),this.__fields=o,this.__id=e}static clone(e){return new this({id:e.__id,fields:e.__fields,key:e.__key})}static getType(){return"link"}static importDOM(){return{a:e=>({conversion:Xp,priority:1})}}static importJSON(e){let o=_e({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),e.version===2&&!e.id&&(e.id=new En.default().toHexString(),e.version=3),o}canBeEmpty(){return!1}canInsertTextAfter(){return!1}canInsertTextBefore(){return!1}createDOM(e){let o=document.createElement("a");return this.__fields?.linkType==="custom"&&(o.href=this.sanitizeUrl(this.__fields.url??"")),(this.__fields?.newTab??!1)&&(o.target="_blank"),this.__fields?.newTab===!0&&this.__fields?.linkType==="custom"&&(o.rel=_n(o.rel,"add","noopener")),Gp(o,e.theme.link),o}exportJSON(){let e=this.getFields();e?.linkType==="internal"?delete e.url:e?.linkType==="custom"&&delete e.doc;let o={...super.exportJSON(),type:"link",fields:e,version:3},n=this.getID();return n&&(o.id=n),o}extractWithChild(e,o,n){if(!Tn(o))return!1;let r=o.anchor.getNode(),l=o.focus.getNode();return this.isParentOf(r)&&this.isParentOf(l)&&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(Gi(n)){let r=_e({fields:this.__fields});return n.append(r),r}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!Jp.has(o.protocol))return"about:blank"}catch{return"https://"}return e}setFields(e){let o=this.getWritable();return o.__fields=e,o}setID(e){let o=this.getWritable();return o.__id=e,o}updateDOM(e,o,n){let r=this.__fields?.url,l=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=""),l!==e.__fields?.newTab&&(l??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=_n(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=_n(o.rel,"remove","noopener"))),!1}updateFromJSON(e){let o=e;return super.updateFromJSON(o).setFields(o.fields).setID(o.id)}};function Xp(t){let e=null;if(Up(t)){let o=t.textContent;o!==null&&o!==""&&(e=_e({id:new En.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function _e({id:t,fields:e}){return zp(new ne({id:t??new En.default().toHexString(),fields:e}))}function X(t){return t instanceof ne}var pe=Vp("TOGGLE_LINK_COMMAND");function wn(t){let e=Wp();if(!Tn(e)&&(t===null||!t.selectedNodes?.length))return;let o=Tn(e)?e.extract():t===null?[]:t.selectedNodes;if(t===null){o?.forEach(l=>{let s=l.getParent();X(s)&&(s.getChildren().forEach(u=>{s.insertBefore(u)}),s.remove())});return}if(o?.length===1){let l=o[0],s=X(l)?l:Yp(l);if(s!==null){s.setFields(t.fields),t.text!=null&&t.text!==s.getTextContent()&&(s.append(Hi(t.text)),s.getChildren().forEach(i=>{i!==s.getLastChild()&&i.remove()}));return}}let n=null,r=null;o?.forEach(l=>{let s=l.getParent();if(!(s===r||s===null||Gi(l)&&!l.isInline())){if(X(s)){r=s,s.setFields(t.fields),t.text!=null&&t.text!==s.getTextContent()&&(s.append(Hi(t.text)),s.getChildren().forEach(i=>{i!==s.getLastChild()&&i.remove()}));return}if(s.is(n)||(n=s,r=_e({fields:t.fields}),X(s)?l.getPreviousSibling()===null?s.insertBefore(r):s.insertAfter(r):l.insertBefore(r)),X(l)){if(l.is(r))return;if(r!==null){let i=l.getChildren();r.append(...i)}l.remove();return}r!==null&&r.append(l)}})}function Yp(t){return Zp(t,e=>X(e))}function Zp(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function _n(t,e,o){let n,r=`${t}`;if(e==="add"){if(r.includes(o)){let l=new RegExp(o,"g");r=r.replace(l,"").trim()}r=r.trim(),n=r.length===0?`${o}`:`${r} ${o}`}else{let l=new RegExp(o,"g");n=r.replace(l,"").trim()}return n}var Qp=(t,e)=>{let[,o,n]=e,r=_e({fields:{doc:null,linkType:"custom",newTab:!1,url:n}}),l=qp(o);return l.setFormat(t.getFormat()),r.append(l),t.replace(r),l},e1=t=>({type:"text-match",dependencies:[ne],export:(e,o)=>{if(!X(e))return null;let n=e,r=n.getFields(),l;return r.linkType==="internal"?t?.internalDocToHref?l=kn(t.internalDocToHref({linkNode:n.exportJSON()})):(console.warn("Lexical \u2192 Markdown converter: found internal link but internalDocToHref is not provided \u2014 link will have an empty href"),l=""):l=kn(r.url??""),`[${o(n)}](${l})`},importRegExp:/(?<!!)\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/(?<!!)\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:Qp,trigger:")"}),Ui=e1();import{$applyNodeReplacement as t1,$isElementNode as o1}from"lexical";var Te=class extends ne{static clone(e){return new this({id:"",fields:e.__fields,key:e.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(e){let o=At({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),o}exportJSON(){let e=super.exportJSON();return{type:"autolink",children:e.children,direction:e.direction,fields:e.fields,format:e.format,indent:e.indent,version:2}}insertNewAfter(e,o=!0){let n=this.getParentOrThrow().insertNewAfter(e,o);if(o1(n)){let r=At({fields:this.__fields});return n.append(r),r}return null}updateFromJSON(e){let o=e;return super.updateFromJSON(o).setFields(o.fields)}};function At({fields:t}){return t1(new Te({id:"",fields:t}))}function Ee(t){return t instanceof Te}import{c as n1}from"react/compiler-runtime";import{useLexicalComposerContext as r1}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as l1}from"@lexical/utils";import{$createTextNode as zi,$getSelection as i1,$isElementNode as Vi,$isLineBreakNode as Ki,$isNodeSelection as s1,$isRangeSelection as a1,$isTextNode as Dt,TextNode as c1}from"lexical";import{useEffect as u1}from"react";function Wi(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 Ji(t,e){for(let o of e){let n=o(t);if(n!=null)return n}return null}var d1=/[.,;\s]/;function uo(t){return t!==void 0&&d1.test(t)}function Xi(t){return uo(t[t.length-1])}function Nn(t){return uo(t[0])}function m1(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function Yi(t){let e=t.getPreviousSibling();return Vi(e)&&(e=e.getLastDescendant()),e===null||Ki(e)||Dt(e)&&Xi(e.getTextContent())}function Zi(t){let e=t.getNextSibling();return Vi(e)&&(e=e.getFirstDescendant()),e===null||Ki(e)||Dt(e)&&Nn(e.getTextContent())}function f1(t,e,o,n){return(t>0?uo(o[t-1]):Yi(n[0]))?e<o.length?uo(o[e]):Zi(n[n.length-1]):!1}function p1(t,e,o){let n=[],r=[],l=[],s=0,i=0,u=[...t];for(;u.length>0;){let d=u[0],a=d.getTextContent().length,m=i;i+a<=e?(n.push(d),s+=a):m>=o?l.push(d):r.push(d),i+=a,u.shift()}return[s,n,r,l]}function h1(t,e,o,n){let r={linkType:"custom",url:n.url,...n.fields},l=At({fields:r});if(t.length===1){let s=t[0],i;if(e===0?[i]=s.splitText(o):[,i]=s.splitText(e,o),i){let u=zi(n.text);u.setFormat(i.getFormat()),u.setDetail(i.getDetail()),u.setStyle(i.getStyle()),l.append(u),i.replace(l)}return s}else if(t.length>1){let s=t[0],i=s.getTextContent().length,u;e===0?u=s:[,u]=s.splitText(e);let d=[],c;if(t.forEach(a=>{let f=a.getTextContent().length,h=i,p=i+f;if(h<o)if(p<=o)d.push(a);else{let[g,C]=a.splitText(o-h);g&&d.push(g),c=C}i+=f}),u){let a=i1(),m=a?a.getNodes().find(Dt):void 0,f=zi(u.getTextContent());return f.setFormat(u.getFormat()),f.setDetail(u.getDetail()),f.setStyle(u.getStyle()),l.append(f,...d),m&&m===u&&(a1(a)?f.select(a.anchor.offset,a.focus.offset):s1(a)&&f.select(0,f.getTextContent().length)),u.replace(l),c}}}function g1(t,e,o){let n=[...t],r=n.map(u=>u.getTextContent()).join(""),l=r,s,i=0;for(;(s=Ji(l,e))!=null&&s!==null;){let u=s.index,d=s.length,c=u+d;if(f1(i+u,i+c,r,n)){let[m,,f,h]=p1(n,i+u,i+c),p=i+u-m,g=i+c-m,C=h1(f,p,g,s);n=C?[C,...h]:h,o(s.url,null),i=0}else i+=c;l=l.substring(c)}}function Sn(t,e,o){let n=t.getChildren(),r=n.length;for(let u=0;u<r;u++){let d=n[u];if(!Dt(d)||!d.isSimpleText()){co(t),o(null,t.getFields()?.url??null);return}}let l=t.getTextContent(),s=Ji(l,e);if(s===null||s.text!==l){co(t),o(null,t.getFields()?.url??null);return}if(!Yi(t)||!Zi(t)){co(t),o(null,t.getFields()?.url??null);return}let i=t.getFields()?.url;if(i!==s?.url){let u=t.getFields();u.url=s?.url,t.setFields(u),o(s.url,i??null)}}function x1(t,e,o){let n=t.getPreviousSibling(),r=t.getNextSibling(),l=t.getTextContent();if(Ee(n)){let s=n.getFields()?.url?n.getFields()?.url?.startsWith("mailto:")??!1:!1;(!Nn(l)||m1(l,s))&&(n.append(t),Sn(n,e,o),o(null,n.getFields()?.url??null))}Ee(r)&&!Xi(l)&&(co(r),Sn(r,e,o),o(null,r.getFields()?.url??null))}function co(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 C1(t){let e=[t],o=t.getNextSibling();for(;o!==null&&Dt(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function b1(t,e,o){let n=n1(5),r,l;n[0]!==t||n[1]!==e||n[2]!==o?(r=()=>{if(!t.hasNodes([Te]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let s=(i,u)=>{o?.(i,u)};return l1(t.registerNodeTransform(c1,i=>{let u=i.getParentOrThrow(),d=i.getPreviousSibling();if(Ee(u))Sn(u,e,s);else if(!X(u)){if(i.isSimpleText()&&(Nn(i.getTextContent())||!Ee(d))){let c=C1(i);g1(c,e,s)}x1(i,e,s)}}))},l=[t,e,o],n[0]=t,n[1]=e,n[2]=o,n[3]=r,n[4]=l):(r=n[3],l=n[4]),u1(r,l)}var k1=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,_1=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,T1=[Wi(k1,t=>t.startsWith("http")?t:`https://${t}`),Wi(_1,t=>`mailto:${t}`)],qi=()=>{let[t]=r1();return b1(t,T1),null};import{jsx as E1}from"react/jsx-runtime";import{ClickableLinkPlugin as w1}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var Qi=()=>E1(w1,{});import{jsx as W1}from"react/jsx-runtime";import"react";import{createPortal as V1}from"react-dom";import{jsx as re,jsxs as He,Fragment as Ln}from"react/jsx-runtime";import{useLexicalComposerContext as L1}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as y1}from"@lexical/react/useLexicalEditable";import{$findMatchingParent as ls,mergeRegister as is}from"@lexical/utils";import{getTranslation as yn}from"@payloadcms/translations";import{formatDrawerSlug as R1,NewTabIcon as ss,useConfig as v1,useEditDepth as I1,useLocale as M1,useTranslation as A1,WriteIcon as D1}from"@payloadcms/ui";import{requests as $1}from"@payloadcms/ui/shared";import{$getSelection as as,$isLineBreakNode as O1,$isRangeSelection as cs,$onUpdate as F1,COMMAND_PRIORITY_HIGH as P1,COMMAND_PRIORITY_LOW as us,getDOMSelection as B1,KEY_ESCAPE_COMMAND as j1,SELECTION_CHANGE_COMMAND as H1}from"lexical";import{formatAdminURL as G1}from"payload/shared";import U1,{useCallback as ds,useEffect as po,useLayoutEffect as z1,useRef as ms,useState as Ge}from"react";import{jsx as es}from"react/jsx-runtime";import"react";var S1="M12.5 5C12.6326 5 12.7597 5.05272 12.8535 5.14648L16.8535 9.14648C16.9965 9.28948 17.0393 9.50457 16.9619 9.69141C16.8845 9.87821 16.7022 10 16.5 10H12.5C12.2239 10 12 9.77614 12 9.5V6H8.5C8.22386 6 8 6.22386 8 6.5V17.5C8 17.7761 8.22386 18 8.5 18H15.5C15.7761 18 16 17.7761 16 17.5V11.5C16 11.2239 16.2239 11 16.5 11C16.7761 11 17 11.2239 17 11.5V17.5C17 18.3284 16.3284 19 15.5 19H8.5C7.67157 19 7 18.3284 7 17.5V6.5C7 5.67157 7.67157 5 8.5 5H12.5ZM13 9H15.293L13 6.70703V9Z",ts=({className:t})=>es("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:es("path",{d:S1,fill:"currentColor"})});import{jsx as os}from"react/jsx-runtime";import"react";var ns={default:"M6 5a.5.5 0 0 0-.5.5v1a.5.5 0 0 0 .496.5h12.008a.5.5 0 0 0 .496-.5v-1A.5.5 0 0 0 18 5zM4.5 6.5a1.5 1.5 0 0 0 1.037 1.427L5.725 10H5a.5.5 0 0 0 0 1h.816l.653 7.181A2 2 0 0 0 8.46 20h7.078a2 2 0 0 0 1.992-1.819L18.184 11H19a.5.5 0 0 0 0-1h-.725l.188-2.073A1.5 1.5 0 0 0 19.5 6.5v-1A1.5 1.5 0 0 0 18 4H6a1.5 1.5 0 0 0-1.5 1.5zm2.965 11.59L6.548 8h10.905l-.918 10.09a1 1 0 0 1-.996.91H8.461a1 1 0 0 1-.996-.91M11 10.5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0zm3 0a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0z",small:"M6.5 7a1 1 0 0 1 1-1h9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1h-.039l-.08 1H17a.5.5 0 0 1 0 1h-.7l-.455 5.62A1.5 1.5 0 0 1 14.35 18h-4.7a1.5 1.5 0 0 1-1.495-1.38L7.7 11H7a.5.5 0 0 1 0-1h.62l-.081-1H7.5a1 1 0 0 1-1-1zm9.494 1h.506V7h-9v1zm-.536 1H8.542l.61 7.54a.5.5 0 0 0 .498.46h4.7a.5.5 0 0 0 .499-.46zM11.5 11.5a.5.5 0 0 0-1 0v3a.5.5 0 0 0 1 0zm2 0a.5.5 0 0 0-1 0v3a.5.5 0 0 0 1 0z"},rs=({className:t,small:e})=>os("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:os("path",{clipRule:"evenodd",d:e?ns.small:ns.default,fill:"currentColor",fillRule:"evenodd"})});function mo(t,e,o,n=10,r=5){let l=o.parentElement;if(t===null||l==null){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let s=o.getBoundingClientRect(),i=l.getBoundingClientRect(),u=t.top-n,d=t.left-r;e.style.width="max-content",e.style.maxWidth="none";let c=e.scrollWidth,a=i.right-d,m=d-i.left,f;if(c<=a)f=e.getBoundingClientRect();else{let h=m+t.width,p=m>a,C=Math.min(c,p?h:a);C<c&&(e.style.width=`${C}px`,e.style.maxWidth=`${C}px`,e.offsetHeight),p&&(d=t.right-C),f=e.getBoundingClientRect()}u<i.top&&(u+=f.height+t.height+n*2),d+f.width>i.right&&(d=i.right-f.width-r),u-=s.top,d-=s.left,e.style.opacity="1",e.style.transform=`translate(${d}px, ${u}px)`}import{createCommand as N1}from"lexical";var fo=N1("TOGGLE_LINK_WITH_MODAL_COMMAND");function fs(t){t.preventDefault()}function ps({anchorElem:t}){let[e]=L1(),[o,n]=Ge(),r=ms(null),l=ms(null),[s,i]=Ge(null),[u,d]=Ge(null),{fieldProps:{schemaPath:c},uuid:a}=W(),m=y1(),{config:f,getEntityConfig:h}=v1(),{i18n:p,t:g}=A1(),[C,E]=Ge(),L=I1(),[x,b]=Ge(!1),[k,_]=Ge([]),T=M1(),[I,N]=Ge(!1),w=R1({slug:"lexical-rich-text-link-"+a,depth:L}),{toggleDrawer:y}=De(w),S=ds(()=>{b(!1),r&&r.current&&(r.current.style.opacity="0",r.current.style.transform="translate(-10000px, -10000px)"),N(!1),i(null),d(null),_([]),E(void 0)},[b,i,d,_]),R=ds(()=>{let v=as(),D;if(!cs(v)||!v){S();return}let F=it(v);D=e.getElementByKey(F.getKey())?.getBoundingClientRect();let M=ls(F,X),B=v.getNodes().filter(ie=>!O1(ie)).find(ie=>{let me=ls(ie,X);return M&&!M.is(me)||me&&!me.is(M)});if(M==null||B){S();return}n(M);let $=M.getFields(),P={...$,id:M.getID(),text:M.getTextContent()};if($?.linkType==="custom")i($?.url??null),d(null);else{i(`${f.routes.admin==="/"?"":f.routes.admin}/collections/${$?.doc?.relationTo}/${$?.doc?.value}`);let ie=$?.doc?.relationTo?h({collectionSlug:$?.doc?.relationTo}):void 0;if(!ie)d($?.label?String($?.label):null),i($?.url?String($?.url):null);else{let me=typeof $.doc?.value=="object"?$.doc.value.id:$.doc?.value,Ct=$.doc?.relationTo;if(!me||!Ct)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let Wt=g("fields:linkedTo",{label:`${yn(ie.labels.singular,p)} - ${g("lexical:link:loadingWithEllipsis",p)}`}).replace(/<[^>]*>?/g,"");d(Wt),$1.get(G1({apiRoute:f.routes.api,path:`/${Ct}/${me}`,serverURL:f.serverURL}),{headers:{"Accept-Language":p.language},params:{depth:0,locale:T?.code}}).then(async ce=>{if(!ce.ok)throw new Error(`HTTP error! Status: ${ce.status}`);let Ae=await ce.json(),Vt=ie?.admin?.useAsTitle||"id",Bo=Ae[Vt],bt=g("fields:linkedTo",{label:`${yn(ie.labels.singular,p)} - ${Bo}`}).replace(/<[^>]*>?/g,"");d(bt)}).catch(()=>{let ce=g("fields:linkedTo",{label:`${yn(ie.labels.singular,p)} - ${g("general:untitled",p)} - ID: ${me}`}).replace(/<[^>]*>?/g,"");d(ce)})}}E(P),b(!0),_(v?v?.getNodes():[]),Ee(M)?N(!0):N(!1);let V=r.current,Je=B1(e._window),{activeElement:xt}=document;if(V===null)return;let Xe=e.getRootElement();return Je!==null&&Xe!==null&&Xe.contains(Je.anchorNode)?(D||(D=Je.getRangeAt(0).getBoundingClientRect()),D!=null&&(D.y+=40,l.current=D)):(xt==null||xt.className!=="link-input")&&(Xe!==null&&mo(null,V,t),i(null),d(null)),!0},[e,S,f.routes.admin,f.routes.api,f.serverURL,h,g,p,T?.code,t]);return po(()=>is(e.registerCommand(fo,v=>(e.dispatchCommand(pe,v),R(),y(),!0),us)),[e,R,y,w]),po(()=>{let v=t.parentElement,D=()=>{e.getEditorState().read(()=>{R()})};return window.addEventListener("resize",D),v?.addEventListener("scroll",D),()=>{window.removeEventListener("resize",D),v?.removeEventListener("scroll",D)}},[t.parentElement,e,R]),po(()=>is(e.registerUpdateListener(({editorState:v})=>{v.read(()=>{R()})}),e.registerCommand(H1,()=>(F1(()=>e.read("latest",R)),!0),us),e.registerCommand(j1,v=>x?(v.preventDefault(),v.stopImmediatePropagation(),S(),!0):!1,P1)),[e,R,x,S]),po(()=>{e.getEditorState().read(()=>{R()})},[e,R]),z1(()=>{!x||!r.current||!t||!l.current||mo(l.current,r.current,t)},[s,u,x,t,o]),He(U1.Fragment,{children:[re("div",{className:"link-editor","data-theme":"dark",hidden:!x,ref:r,children:He("div",{className:"link-input",children:[o?.__fields?.linkType==="custom"?re(ao,{}):re(ts,{}),s&&s.length>0?He("a",{className:"link-input__url",href:s,rel:"noopener noreferrer",target:"_blank",children:[u!=null&&u.length>0?u:s,o?.__fields.newTab?He(Ln,{children:[re(ss,{size:16})," ",re("div",{className:"link-input__divider"})," "]}):null]}):u!=null&&u.length>0?He(Ln,{children:[re("span",{className:"link-input__label-pure",children:u}),o?.__fields.newTab?He(Ln,{children:[re(ss,{size:16})," ",re("div",{className:"link-input__divider"})," "]}):null]}):null,m&&He("div",{className:"link-input__actions",children:[re("button",{"aria-label":"Edit link",className:"link-edit",onClick:v=>{v.preventDefault(),y()},onMouseDown:fs,tabIndex:0,type:"button",children:re(D1,{})}),!I&&re("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(pe,null)},onMouseDown:fs,tabIndex:0,type:"button",children:re(rs,{small:!0})})]})]})}),re(Wo,{className:"lexical-link-edit-drawer",data:C,drawerSlug:w,drawerTitle:g("fields:editLink"),featureKey:"link",handleDrawerSubmit:(v,D)=>{let F=D,M={...F};delete M.text,e.update(()=>{let B=as(),$=null;if(cs(B)?$=it(B).getParent():k.length&&($=k[0]?.getParent()??null),$&&Ee($)){let P=_e({fields:M});$.replace(P,!0)}}),e.dispatchCommand(pe,{fields:M,selectedNodes:k,text:F.text})},schemaPath:c,schemaPathSuffix:"fields"})]})}var hs=t=>{let{anchorElem:e=document.body}=t;return V1(W1(ps,{anchorElem:e}),e)};import{c as K1}from"react/compiler-runtime";import{useLexicalComposerContext as J1}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as X1}from"@lexical/utils";import{$getSelection as Y1,$isElementNode as Z1,$isRangeSelection as q1,COMMAND_PRIORITY_LOW as gs,PASTE_COMMAND as Q1}from"lexical";import{useEffect as e0}from"react";var xs=t=>{let e=K1(5),{clientProps:o}=t,[n]=J1(),r,l;return e[0]!==o.defaultLinkType||e[1]!==o.defaultLinkURL||e[2]!==n?(r=()=>{if(!n.hasNodes([ne]))throw new Error("LinkPlugin: LinkNode not registered on editor");return X1(n.registerCommand(pe,s=>s===null?(wn(null),!0):(s.fields?.linkType||(s.fields.linkType=o.defaultLinkType),s.fields?.url||(s.fields.url=o.defaultLinkURL),wn(s),!0),gs),n.registerCommand(Q1,s=>{let i=Y1();if(!q1(i)||i.isCollapsed()||!(s instanceof ClipboardEvent)||s.clipboardData==null)return!1;let u=s.clipboardData.getData("text");if(!ji(u))return!1;if(!i.getNodes().some(t0)){let d={doc:null,linkType:"custom",newTab:!1,url:u};return n.dispatchCommand(pe,{fields:d,text:null}),s.preventDefault(),!0}return!1},gs))},l=[o.defaultLinkType,o.defaultLinkURL,n],e[0]=o.defaultLinkType,e[1]=o.defaultLinkURL,e[2]=n,e[3]=r,e[4]=l):(r=e[3],l=e[4]),e0(r,l),null};function t0(t){return Z1(t)}var bs=[bn([{ChildComponent:ao,isActive:({selection:t})=>{if(Cs(t)){let e=it(t);return o0(e,X)!=null}return!1},isEnabled:({selection:t})=>!!(Cs(t)&&Rn()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(pe,null);else{let o,n=[];if(t.getEditorState().read(()=>{o=Rn()?.getTextContent(),n=Rn()?.getNodes()??[]}),!o?.length)return;let r={doc:null};t.dispatchCommand(fo,{fields:r,selectedNodes:n,text:o})}},order:1}])],n0=A(({props:t})=>({markdownTransformers:[Ui],nodes:[ne,t?.disableAutoLinks===!0?null:Te].filter(Boolean),plugins:[{Component:xs,position:"normal"},t?.disableAutoLinks===!0||t?.disableAutoLinks==="creationOnly"?null:{Component:qi,position:"normal"},{Component:Qi,position:"normal"},{Component:hs,position:"floatingAnchorElem"}].filter(Boolean),sanitizedClientFeatureProps:t,toolbarFixed:{groups:bs},toolbarInline:{groups:bs}}));import{$isListNode as In,INSERT_CHECK_LIST_COMMAND as Es,ListItemNode as c0,ListNode as u0}from"@lexical/list";import{CHECK_LIST as d0}from"@lexical/markdown";import{$isRangeSelection as m0}from"lexical";import{jsx as ks}from"react/jsx-runtime";import"react";var r0={16:"M5.584 8.223a.5.5 0 0 1 .832.554l-2 3a.502.502 0 0 1-.77.076l-1-1a.5.5 0 1 1 .708-.707l.568.569zM13 10a.5.5 0 0 1 0 1H8a.5.5 0 0 1 0-1zM5.583 3.223a.5.5 0 0 1 .832.554l-2 3a.502.502 0 0 1-.77.076l-1-1a.5.5 0 0 1 .708-.707l.568.569zM13 5a.5.5 0 1 1 0 1H8a.5.5 0 0 1 0-1z",24:"M9.084 15.223a.5.5 0 1 1 .832.554l-2 3a.5.5 0 0 1-.77.076l-1-1a.5.5 0 1 1 .708-.707l.568.569zM17.5 17a.5.5 0 0 1 0 1h-6a.5.5 0 0 1 0-1zm-8.416-6.777a.5.5 0 0 1 .832.554l-2 3a.5.5 0 0 1-.77.077l-1-1a.5.5 0 1 1 .708-.707l.568.568zM17.5 12a.5.5 0 0 1 0 1h-6a.5.5 0 0 1 0-1zM9.084 5.223a.5.5 0 0 1 .832.554l-2 3a.502.502 0 0 1-.77.077l-1-1a.5.5 0 1 1 .708-.708l.568.569zM17.5 7a.5.5 0 0 1 0 1h-6a.5.5 0 0 1 0-1z"},vn=({className:t,size:e=24})=>ks("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:ks("path",{d:r0[e],fill:"currentColor"})});import{jsx as l0}from"react/jsx-runtime";import{ListPlugin as i0}from"@lexical/react/LexicalListPlugin.js";import"react";var st=()=>l0(i0,{});function ho(t,e){return t==="ordered"?!e.has("unorderedList"):t==="checklist"?!e.has("unorderedList")&&!e.has("orderedList"):!1}function at(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{jsx as s0}from"react/jsx-runtime";import{CheckListPlugin as a0}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var _s=()=>s0(a0,{});var Ts=[oe([{ChildComponent:vn,isActive:({selection:t})=>{if(!m0(t))return!1;for(let e of t.getNodes()){if(In(e)&&e.getListType()==="check")continue;let o=e.getParent();if(In(o)&&o.getListType()==="check")continue;let n=o?.getParent();if(!(In(n)&&n.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(Es,void 0)},order:12}])],f0=A(({featureProviderMap:t})=>{let e=[{Component:_s,position:"normal"}],o=ho("checklist",t);return o&&e.push({Component:st,position:"normal"}),{markdownTransformers:[d0],nodes:o?[u0,c0]:[],plugins:e,slashMenu:{groups:[at([{Icon:vn,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:n})=>n.t("lexical:checklist:label"),onSelect:({editor:n})=>{n.dispatchCommand(Es,void 0)}}])]},toolbarFixed:{groups:Ts},toolbarInline:{groups:Ts}}});import{$isListNode as An,INSERT_ORDERED_LIST_COMMAND as Ns,ListItemNode as h0,ListNode as g0}from"@lexical/list";import{ORDERED_LIST as x0}from"@lexical/markdown";import{$isRangeSelection as C0}from"lexical";import{jsx as ws}from"react/jsx-runtime";import"react";var p0={16:"M5.6 9.01a.5.5 0 0 1 .4.49v1a.5.5 0 0 1-.276.447L4 11.81V12h1.5a.5.5 0 0 1 0 1h-2a.5.5 0 0 1-.5-.5v-1l.005-.07a.5.5 0 0 1 .271-.377L5 10.19V10H3.5a.5.5 0 0 1 0-1h2zM12.5 12a.5.5 0 0 1 0 1h-4a.5.5 0 0 1 0-1zm0-4.5a.5.5 0 0 1 0 1h-4a.5.5 0 0 1 0-1zM4.6 3.01a.5.5 0 0 1 .4.49v3a.5.5 0 0 1-1 0V4h-.5a.5.5 0 0 1 0-1h1zM12.5 3a.5.5 0 0 1 0 1h-4a.5.5 0 0 1 0-1z",24:"M11 7a.5.5 0 0 1 .5-.5h6a.5.5 0 0 1 0 1h-6A.5.5 0 0 1 11 7M6 7a.5.5 0 0 1 .5-.5h1A.5.5 0 0 1 8 7v3.5a.5.5 0 1 1-1 0v-3h-.5A.5.5 0 0 1 6 7m0 6.5a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 .5.5V15a.5.5 0 0 1-.276.447L7 16.31v.191h1.5a.5.5 0 0 1 0 1h-2A.5.5 0 0 1 6 17v-1a.5.5 0 0 1 .276-.447L8 14.69V14H6.5a.5.5 0 0 1-.5-.5m5.5 3a.5.5 0 1 0 0 1h6a.5.5 0 0 0 0-1zm0-5a.5.5 0 1 0 0 1h6a.5.5 0 0 0 0-1z"},Mn=({className:t,size:e=24})=>ws("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:ws("path",{clipRule:"evenodd",d:p0[e],fill:"currentColor",fillRule:"evenodd"})});var Ss=[oe([{ChildComponent:Mn,isActive:({selection:t})=>{if(!C0(t))return!1;for(let e of t.getNodes()){if(An(e)&&e.getListType()==="number")continue;let o=e.getParent();if(An(o)&&o.getListType()==="number")continue;let n=o?.getParent();if(!(An(n)&&n.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ns,void 0)},order:10}])],b0=A(({featureProviderMap:t})=>{let e=ho("ordered",t);return{markdownTransformers:[x0],nodes:e?[g0,h0]:[],plugins:e?[{Component:st,position:"normal"}]:[],slashMenu:{groups:[at([{Icon:Mn,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:o})=>o.t("lexical:orderedList:label"),onSelect:({editor:o})=>{o.dispatchCommand(Ns,void 0)}}])]},toolbarFixed:{groups:Ss},toolbarInline:{groups:Ss}}});import{$isListNode as $n,INSERT_UNORDERED_LIST_COMMAND as Rs,ListItemNode as _0,ListNode as T0}from"@lexical/list";import{UNORDERED_LIST as E0}from"@lexical/markdown";import{$isRangeSelection as w0}from"lexical";import{jsx as Ls}from"react/jsx-runtime";import"react";var k0="M7 16C7.55228 16 8 16.4477 8 17C8 17.5523 7.55228 18 7 18C6.44772 18 6 17.5523 6 17C6 16.4477 6.44772 16 7 16ZM17.5 16.5C17.7761 16.5 18 16.7239 18 17C18 17.2761 17.7761 17.5 17.5 17.5H10.5C10.2239 17.5 10 17.2761 10 17C10 16.7239 10.2239 16.5 10.5 16.5H17.5ZM7 11C7.55228 11 8 11.4477 8 12C8 12.5523 7.55228 13 7 13C6.44772 13 6 12.5523 6 12C6 11.4477 6.44772 11 7 11ZM17.5 11.5C17.7761 11.5 18 11.7239 18 12C18 12.2761 17.7761 12.5 17.5 12.5H10.5C10.2239 12.5 10 12.2761 10 12C10 11.7239 10.2239 11.5 10.5 11.5H17.5ZM7 6C7.55228 6 8 6.44772 8 7C8 7.55228 7.55228 8 7 8C6.44772 8 6 7.55228 6 7C6 6.44772 6.44772 6 7 6ZM17.5 6.5C17.7761 6.5 18 6.72386 18 7C18 7.27614 17.7761 7.5 17.5 7.5H10.5C10.2239 7.5 10 7.27614 10 7C10 6.72386 10.2239 6.5 10.5 6.5H17.5Z",Dn=({className:t})=>Ls("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Ls("path",{d:k0,fill:"currentColor"})});var ys=[oe([{ChildComponent:Dn,isActive:({selection:t})=>{if(!w0(t))return!1;for(let e of t.getNodes()){if($n(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if($n(o)&&o.getListType()==="bullet")continue;let n=o?.getParent();if(!($n(n)&&n.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Rs,void 0)},order:11}])],S0=A({markdownTransformers:[E0],nodes:[T0,_0],plugins:[{Component:st,position:"normal"}],slashMenu:{groups:[at([{Icon:Dn,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Rs,void 0)}}])]},toolbarFixed:{groups:ys},toolbarInline:{groups:ys}});import{$setBlocksType as Ms}from"@lexical/selection";import{$createParagraphNode as As,$getSelection as Ds,$isParagraphNode as vs,$isRangeSelection as N0}from"lexical";var Is=[oe([{ChildComponent:Nt,isActive:({selection:t})=>{if(!N0(t))return!1;for(let e of t.getNodes())if(!vs(e)&&!vs(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=Ds();Ms(e,()=>As())})},order:1}])],L0=A({slashMenu:{groups:[Z([{Icon:Nt,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Ds();Ms(e,()=>As())})}}])]},toolbarFixed:{groups:Is},toolbarInline:{groups:Is}});import{c as Y0}from"react/compiler-runtime";import{jsx as oa}from"react/jsx-runtime";import{useLexicalComposerContext as Z0}from"@lexical/react/LexicalComposerContext";import{useEffect as q0,useState as Q0}from"react";import{jsx as ta,Fragment as X0}from"react/jsx-runtime";import"react";import{jsx as y0}from"react/jsx-runtime";var $s={quote:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return y0("blockquote",{children:o})}};import{jsx as R0}from"react/jsx-runtime";var Os=new Set(["h1","h2","h3","h4","h5","h6"]);var Fs={heading:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),n=Os.has(t.tag)?t.tag:"h1";return R0(n,{children:o})}};import{jsx as v0}from"react/jsx-runtime";var Ps={horizontalrule:v0("hr",{})};import{jsx as I0}from"react/jsx-runtime";var Bs={linebreak:I0("br",{})};import{jsx as js}from"react/jsx-runtime";var Hs=({internalDocToHref:t})=>({autolink:({node:e,nodesToJSX:o})=>{let n=o({nodes:e.children}),r=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0;return js("a",{href:e.fields.url,rel:r,target:l,children:n})},link:({node:e,nodesToJSX:o})=>{let n=o({nodes:e.children}),r=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0,s=e.fields.url??"";return e.fields.linkType==="internal"&&(t?s=t({linkNode:e}):(console.error("Lexical => JSX converter: Link converter: found internal link, but internalDocToHref is not provided"),s="#")),js("a",{href:s,rel:r,target:l,children:n})}});import{jsx as ct,jsxs as M0,Fragment as A0}from"react/jsx-runtime";import{v4 as D0}from"uuid";var Gs=new Set(["ol","ul"]);var Us={list:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),n=Gs.has(t.tag)?t.tag:"ul";return ct(n,{className:`list-${t?.listType}`,children:o})},listitem:({node:t,nodesToJSX:e,parent:o})=>{let n=t.children.some(l=>l.type==="list"),r=e({nodes:t.children});if("listType"in o&&o?.listType==="check"){let l=D0();return ct("li",{"aria-checked":t.checked?"true":"false",className:`list-item-checkbox${t.checked?" list-item-checkbox-checked":" list-item-checkbox-unchecked"}${n?" nestedListItem":""}`,role:"checkbox",style:{listStyleType:"none"},tabIndex:-1,value:t?.value,children:n?r:M0(A0,{children:[ct("input",{checked:t.checked,id:l,readOnly:!0,type:"checkbox"}),ct("label",{htmlFor:l,children:r}),ct("br",{})]})})}else return ct("li",{className:`${n?"nestedListItem":""}`,style:n?{listStyleType:"none"}:void 0,value:t?.value,children:r})}};import{jsx as On}from"react/jsx-runtime";var zs={paragraph:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return o?.length?On("p",{children:o}):On("p",{children:On("br",{})})}};var Ws={tab:" "};import{jsx as $t}from"react/jsx-runtime";var Vs={table:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return $t("div",{className:"lexical-table-container",children:$t("table",{className:"lexical-table",style:{borderCollapse:"collapse"},children:$t("tbody",{children:o})})})},tablecell:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),n=t.headerState>0?"th":"td",r=`lexical-table-cell-header-${t.headerState}`,l={backgroundColor:t.backgroundColor||void 0,border:"1px solid #ccc",padding:"8px"},s=t.colSpan&&t.colSpan>1?t.colSpan:void 0,i=t.rowSpan&&t.rowSpan>1?t.rowSpan:void 0;return $t(n,{className:`lexical-table-cell ${r}`,colSpan:s,rowSpan:i,style:l,children:o})},tablerow:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return $t("tr",{className:"lexical-table-row",children:o})}};import{jsx as Ue}from"react/jsx-runtime";import"react";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},$0=O.IS_BOLD|O.IS_ITALIC|O.IS_STRIKETHROUGH|O.IS_UNDERLINE|O.IS_CODE|O.IS_SUBSCRIPT|O.IS_SUPERSCRIPT|O.IS_HIGHLIGHT,O0="\xA0",F0=`
|
|
56
56
|
|
|
57
|
-
`,Bs="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",js="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",y0=new RegExp("^[^"+js+"]*["+Bs+"]"),R0=new RegExp("^[^"+Bs+"]*["+js+"]"),v0={bold:D.IS_BOLD,code:D.IS_CODE,highlight:D.IS_HIGHLIGHT,italic:D.IS_ITALIC,strikethrough:D.IS_STRIKETHROUGH,subscript:D.IS_SUBSCRIPT,superscript:D.IS_SUPERSCRIPT,underline:D.IS_UNDERLINE},I0={directionless:D.IS_DIRECTIONLESS,unmergeable:D.IS_UNMERGEABLE},M0={center:D.IS_ALIGN_CENTER,end:D.IS_ALIGN_END,justify:D.IS_ALIGN_JUSTIFY,left:D.IS_ALIGN_LEFT,right:D.IS_ALIGN_RIGHT,start:D.IS_ALIGN_START},A0={[D.IS_ALIGN_CENTER]:"center",[D.IS_ALIGN_END]:"end",[D.IS_ALIGN_JUSTIFY]:"justify",[D.IS_ALIGN_LEFT]:"left",[D.IS_ALIGN_RIGHT]:"right",[D.IS_ALIGN_START]:"start"},$0={normal:D.IS_NORMAL,segmented:D.IS_SEGMENTED,token:D.IS_TOKEN},D0={[D.IS_NORMAL]:"normal",[D.IS_SEGMENTED]:"segmented",[D.IS_TOKEN]:"token"};var Hs={text:({node:t})=>{let e=t.text;return t.format&D.IS_BOLD&&(e=We("strong",{children:e})),t.format&D.IS_ITALIC&&(e=We("em",{children:e})),t.format&D.IS_STRIKETHROUGH&&(e=We("span",{style:{textDecoration:"line-through"},children:e})),t.format&D.IS_UNDERLINE&&(e=We("span",{style:{textDecoration:"underline"},children:e})),t.format&D.IS_CODE&&(e=We("code",{children:e})),t.format&D.IS_SUBSCRIPT&&(e=We("sub",{children:e})),t.format&D.IS_SUPERSCRIPT&&(e=We("sup",{children:e})),e}};import{jsx as At}from"react/jsx-runtime";var Gs={upload:({node:t})=>{let e=t;if(typeof e.value!="object")return null;let o=e.value,n=e.fields?.alt||o?.alt||"",r=o.url;if(!o.mimeType.startsWith("image"))return At("a",{href:r,rel:"noopener noreferrer",children:o.filename});if(!o.sizes||!Object.keys(o.sizes).length)return At("img",{alt:n,height:o.height,src:r,width:o.width});let l=[];for(let s in o.sizes){let i=o.sizes[s];if(!i||!i.width||!i.height||!i.mimeType||!i.filesize||!i.filename||!i.url)continue;let u=i?.url;l.push(At("source",{media:`(max-width: ${i.width}px)`,srcSet:u,type:i.mimeType},s))}return l.push(At("img",{alt:n,height:o?.height,src:r,width:o?.width},"image")),At("picture",{children:l})}};var ut={...Os,...Hs,...Is,...Ls,...Ps,...Rs,...vs,...Ds,...As({}),...Gs,...Fs};import{jsx as mo,Fragment as O0}from"react/jsx-runtime";import uo from"react";function zs(t){if(!!!t?.root?.children?.length)return!1;let o=!1;if(t?.root?.children?.length===1&&t?.root?.children[0]?.type==="paragraph"){let n=t?.root?.children[0];if(!n?.children||n?.children?.length===0)o=!0;else if(n?.children?.length===1){let r=n?.children[0];r?.type==="text"&&(r?.text?.length||(o=!0))}}return!o}function F0(t){return e=>{let o={...e,isEditor:!1,isJSXConverter:!0};if(t.Component)return t.Component(o);if(t.html){let n=typeof t.html=="function"?t.html(o):t.html;return mo("span",{dangerouslySetInnerHTML:{__html:n}})}return null}}function Us(t){return e=>{if(t.Component){let o={...e,isEditor:!1,isJSXConverter:!0};return t.Component(o)}if(t.Block){let o=e.node,n={childIndex:e.childIndex,converters:e.converters,formData:o.fields??{},isEditor:!1,isJSXConverter:!0,node:o,nodesToJSX:e.nodesToJSX,parent:e.parent};return uo.createElement(t.Block,n)}if(t.html){let o={...e,isEditor:!1,isJSXConverter:!0},n=typeof t.html=="function"?t.html(o):t.html;return mo("span",{dangerouslySetInnerHTML:{__html:n}})}return null}}function P0(t){let e={};for(let[o,n]of Object.entries(t)){if(!n||typeof n!="object")continue;if(o==="blocks"){e.blocks={};for(let[l,s]of Object.entries(n)){let i=s;(i.Component||i.Block||i.html)&&(e.blocks[l]=Us(i))}continue}if(o==="inlineBlocks"){e.inlineBlocks={};for(let[l,s]of Object.entries(n)){let i=s;(i.Component||i.Block||i.html)&&(e.inlineBlocks[l]=Us(i))}continue}let r=n;(r.Component||r.html)&&(e[o]=F0(r))}return e}function Ws({converters:t,data:e,disableIndent:o,disableTextAlign:n,nodeMap:r}){if(zs(e)){let l=r?P0(r):void 0,s=l?{...t,...l,blocks:{...t.blocks,...l.blocks},inlineBlocks:{...t.inlineBlocks,...l.inlineBlocks}}:t;return Vs({converters:s,disableIndent:o,disableTextAlign:n,nodes:e.root.children,parent:e.root})}return mo(O0,{})}function Vs({converters:t,disableIndent:e,disableTextAlign:o,nodes:n,parent:r}){let l=t.unknown;return n.map((i,u)=>{let d;i.type==="block"?(d=t?.blocks?.[i?.fields?.blockType],!d&&!l&&console.error(`Lexical => JSX converter: Blocks converter: found ${i?.fields?.blockType} block, but no converter is provided`)):i.type==="inlineBlock"?(d=t?.inlineBlocks?.[i?.fields?.blockType],!d&&!l&&console.error(`Lexical => JSX converter: Inline Blocks converter: found ${i?.fields?.blockType} inline block, but no converter is provided`)):d=t[i.type];try{!d&&l&&(d=l);let c;d?c=typeof d=="function"?d({childIndex:u,converters:t,node:i,nodesToJSX:p=>Vs({converters:p.converters??t,disableIndent:p.disableIndent??e,disableTextAlign:p.disableTextAlign??o,nodes:p.nodes,parent:p.parent??{...i,parent:r}}),parent:r}):d:c=mo("span",{children:"unknown node"},u);let a={};if(!o&&(!Array.isArray(o)||!o?.includes(i.type))&&"format"in i&&i.format)switch(i.format){case"center":a.textAlign="center";break;case"end":a.textAlign="right";break;case"justify":a.textAlign="justify";break;case"left":break;case"right":a.textAlign="right";break;case"start":a.textAlign="left";break}if(!e&&(!Array.isArray(e)||!e?.includes(i.type))&&"indent"in i&&i.indent&&i.type!=="listitem"&&(a.paddingInlineStart=`${Number(i.indent)*40}px`),uo.isValidElement(c)){if(a.textAlign||a.paddingInlineStart){let m={...a,...c?.props?.style??{}};return uo.cloneElement(c,{key:u,style:m})}return uo.cloneElement(c,{key:u})}return c}catch(c){return console.error("Error converting lexical node to JSX:",c,"node:",i),null}}).filter(Boolean)}function Nn({className:t,converters:e,data:o,disableContainer:n,disableIndent:r,disableTextAlign:l,nodeMap:s}){if(!o)return null;let i=e,u={};i?typeof i=="function"?u=i({defaultConverters:ut}):u=i:u=ut;let d=o&&!Array.isArray(o)&&typeof o=="object"&&"root"in o&&Ws({converters:u,data:o,disableIndent:r,disableTextAlign:l,nodeMap:s});return n?Ks(B0,{children:d}):Ks("div",{className:t??"payload-richtext",children:d})}function Xs(){let t=j0(7),[e]=H0(),o;t[0]!==e?(o=()=>e.getEditorState().toJSON(),t[0]=e,t[1]=o):o=t[1];let[n,r]=z0(o),l,s;t[2]!==e?(l=()=>e.registerUpdateListener(u=>{let{editorState:d}=u;r(d.toJSON())}),s=[e],t[2]=e,t[3]=l,t[4]=s):(l=t[3],s=t[4]),G0(l,s);let i;return t[5]!==n?(i=Js("div",{className:"debug-jsx-converter",children:Js(Nn,{converters:ut,data:n})}),t[5]=n,t[6]=i):i=t[6],i}var U0=M({plugins:[{Component:Xs,position:"bottom"}]});var j={amber:{50:"oklch(0.987 0.022 95.277)",100:"oklch(0.962 0.059 95.617)",200:"oklch(0.924 0.12 95.746)",300:"oklch(0.879 0.169 91.605)",400:"oklch(0.828 0.189 84.429)",500:"oklch(0.769 0.188 70.08)",600:"oklch(0.666 0.179 58.318)",700:"oklch(0.555 0.163 48.998)",800:"oklch(0.473 0.137 46.201)",900:"oklch(0.414 0.112 45.904)",950:"oklch(0.279 0.077 45.635)"},black:"#000",blue:{50:"oklch(0.97 0.014 254.604)",100:"oklch(0.932 0.032 255.585)",200:"oklch(0.882 0.059 254.128)",300:"oklch(0.809 0.105 251.813)",400:"oklch(0.707 0.165 254.624)",500:"oklch(0.623 0.214 259.815)",600:"oklch(0.546 0.245 262.881)",700:"oklch(0.488 0.243 264.376)",800:"oklch(0.424 0.199 265.638)",900:"oklch(0.379 0.146 265.522)",950:"oklch(0.282 0.091 267.935)"},current:"currentColor",cyan:{50:"oklch(0.984 0.019 200.873)",100:"oklch(0.956 0.045 203.388)",200:"oklch(0.917 0.08 205.041)",300:"oklch(0.865 0.127 207.078)",400:"oklch(0.789 0.154 211.53)",500:"oklch(0.715 0.143 215.221)",600:"oklch(0.609 0.126 221.723)",700:"oklch(0.52 0.105 223.128)",800:"oklch(0.45 0.085 224.283)",900:"oklch(0.398 0.07 227.392)",950:"oklch(0.302 0.056 229.695)"},emerald:{50:"oklch(0.979 0.021 166.113)",100:"oklch(0.95 0.052 163.051)",200:"oklch(0.905 0.093 164.15)",300:"oklch(0.845 0.143 164.978)",400:"oklch(0.765 0.177 163.223)",500:"oklch(0.696 0.17 162.48)",600:"oklch(0.596 0.145 163.225)",700:"oklch(0.508 0.118 165.612)",800:"oklch(0.432 0.095 166.913)",900:"oklch(0.378 0.077 168.94)",950:"oklch(0.262 0.051 172.552)"},fuchsia:{50:"oklch(0.977 0.017 320.058)",100:"oklch(0.952 0.037 318.852)",200:"oklch(0.903 0.076 319.62)",300:"oklch(0.833 0.145 321.434)",400:"oklch(0.74 0.238 322.16)",500:"oklch(0.667 0.295 322.15)",600:"oklch(0.591 0.293 322.896)",700:"oklch(0.518 0.253 323.949)",800:"oklch(0.452 0.211 324.591)",900:"oklch(0.401 0.17 325.612)",950:"oklch(0.293 0.136 325.661)"},gray:{50:"oklch(0.985 0.002 247.839)",100:"oklch(0.967 0.003 264.542)",200:"oklch(0.928 0.006 264.531)",300:"oklch(0.872 0.01 258.338)",400:"oklch(0.707 0.022 261.325)",500:"oklch(0.551 0.027 264.364)",600:"oklch(0.446 0.03 256.802)",700:"oklch(0.373 0.034 259.733)",800:"oklch(0.278 0.033 256.848)",900:"oklch(0.21 0.034 264.665)",950:"oklch(0.13 0.028 261.692)"},green:{50:"oklch(0.982 0.018 155.826)",100:"oklch(0.962 0.044 156.743)",200:"oklch(0.925 0.084 155.995)",300:"oklch(0.871 0.15 154.449)",400:"oklch(0.792 0.209 151.711)",500:"oklch(0.723 0.219 149.579)",600:"oklch(0.627 0.194 149.214)",700:"oklch(0.527 0.154 150.069)",800:"oklch(0.448 0.119 151.328)",900:"oklch(0.393 0.095 152.535)",950:"oklch(0.266 0.065 152.934)"},indigo:{50:"oklch(0.962 0.018 272.314)",100:"oklch(0.93 0.034 272.788)",200:"oklch(0.87 0.065 274.039)",300:"oklch(0.785 0.115 274.713)",400:"oklch(0.673 0.182 276.935)",500:"oklch(0.585 0.233 277.117)",600:"oklch(0.511 0.262 276.966)",700:"oklch(0.457 0.24 277.023)",800:"oklch(0.398 0.195 277.366)",900:"oklch(0.359 0.144 278.697)",950:"oklch(0.257 0.09 281.288)"},inherit:"inherit",lime:{50:"oklch(0.986 0.031 120.757)",100:"oklch(0.967 0.067 122.328)",200:"oklch(0.938 0.127 124.321)",300:"oklch(0.897 0.196 126.665)",400:"oklch(0.841 0.238 128.85)",500:"oklch(0.768 0.233 130.85)",600:"oklch(0.648 0.2 131.684)",700:"oklch(0.532 0.157 131.589)",800:"oklch(0.453 0.124 130.933)",900:"oklch(0.405 0.101 131.063)",950:"oklch(0.274 0.072 132.109)"},neutral:{50:"oklch(0.985 0 0)",100:"oklch(0.97 0 0)",200:"oklch(0.922 0 0)",300:"oklch(0.87 0 0)",400:"oklch(0.708 0 0)",500:"oklch(0.556 0 0)",600:"oklch(0.439 0 0)",700:"oklch(0.371 0 0)",800:"oklch(0.269 0 0)",900:"oklch(0.205 0 0)",950:"oklch(0.145 0 0)"},orange:{50:"oklch(0.98 0.016 73.684)",100:"oklch(0.954 0.038 75.164)",200:"oklch(0.901 0.076 70.697)",300:"oklch(0.837 0.128 66.29)",400:"oklch(0.75 0.183 55.934)",500:"oklch(0.705 0.213 47.604)",600:"oklch(0.646 0.222 41.116)",700:"oklch(0.553 0.195 38.402)",800:"oklch(0.47 0.157 37.304)",900:"oklch(0.408 0.123 38.172)",950:"oklch(0.266 0.079 36.259)"},pink:{50:"oklch(0.971 0.014 343.198)",100:"oklch(0.948 0.028 342.258)",200:"oklch(0.899 0.061 343.231)",300:"oklch(0.823 0.12 346.018)",400:"oklch(0.718 0.202 349.761)",500:"oklch(0.656 0.241 354.308)",600:"oklch(0.592 0.249 0.584)",700:"oklch(0.525 0.223 3.958)",800:"oklch(0.459 0.187 3.815)",900:"oklch(0.408 0.153 2.432)",950:"oklch(0.284 0.109 3.907)"},purple:{50:"oklch(0.977 0.014 308.299)",100:"oklch(0.946 0.033 307.174)",200:"oklch(0.902 0.063 306.703)",300:"oklch(0.827 0.119 306.383)",400:"oklch(0.714 0.203 305.504)",500:"oklch(0.627 0.265 303.9)",600:"oklch(0.558 0.288 302.321)",700:"oklch(0.496 0.265 301.924)",800:"oklch(0.438 0.218 303.724)",900:"oklch(0.381 0.176 304.987)",950:"oklch(0.291 0.149 302.717)"},red:{50:"oklch(0.971 0.013 17.38)",100:"oklch(0.936 0.032 17.717)",200:"oklch(0.885 0.062 18.334)",300:"oklch(0.808 0.114 19.571)",400:"oklch(0.704 0.191 22.216)",500:"oklch(0.637 0.237 25.331)",600:"oklch(0.577 0.245 27.325)",700:"oklch(0.505 0.213 27.518)",800:"oklch(0.444 0.177 26.899)",900:"oklch(0.396 0.141 25.723)",950:"oklch(0.258 0.092 26.042)"},rose:{50:"oklch(0.969 0.015 12.422)",100:"oklch(0.941 0.03 12.58)",200:"oklch(0.892 0.058 10.001)",300:"oklch(0.81 0.117 11.638)",400:"oklch(0.712 0.194 13.428)",500:"oklch(0.645 0.246 16.439)",600:"oklch(0.586 0.253 17.585)",700:"oklch(0.514 0.222 16.935)",800:"oklch(0.455 0.188 13.697)",900:"oklch(0.41 0.159 10.272)",950:"oklch(0.271 0.105 12.094)"},sky:{50:"oklch(0.977 0.013 236.62)",100:"oklch(0.951 0.026 236.824)",200:"oklch(0.901 0.058 230.902)",300:"oklch(0.828 0.111 230.318)",400:"oklch(0.746 0.16 232.661)",500:"oklch(0.685 0.169 237.323)",600:"oklch(0.588 0.158 241.966)",700:"oklch(0.5 0.134 242.749)",800:"oklch(0.443 0.11 240.79)",900:"oklch(0.391 0.09 240.876)",950:"oklch(0.293 0.066 243.157)"},slate:{50:"oklch(0.984 0.003 247.858)",100:"oklch(0.968 0.007 247.896)",200:"oklch(0.929 0.013 255.508)",300:"oklch(0.869 0.022 252.894)",400:"oklch(0.704 0.04 256.788)",500:"oklch(0.554 0.046 257.417)",600:"oklch(0.446 0.043 257.281)",700:"oklch(0.372 0.044 257.287)",800:"oklch(0.279 0.041 260.031)",900:"oklch(0.208 0.042 265.755)",950:"oklch(0.129 0.042 264.695)"},stone:{50:"oklch(0.985 0.001 106.423)",100:"oklch(0.97 0.001 106.424)",200:"oklch(0.923 0.003 48.717)",300:"oklch(0.869 0.005 56.366)",400:"oklch(0.709 0.01 56.259)",500:"oklch(0.553 0.013 58.071)",600:"oklch(0.444 0.011 73.639)",700:"oklch(0.374 0.01 67.558)",800:"oklch(0.268 0.007 34.298)",900:"oklch(0.216 0.006 56.043)",950:"oklch(0.147 0.004 49.25)"},teal:{50:"oklch(0.984 0.014 180.72)",100:"oklch(0.953 0.051 180.801)",200:"oklch(0.91 0.096 180.426)",300:"oklch(0.855 0.138 181.071)",400:"oklch(0.777 0.152 181.912)",500:"oklch(0.704 0.14 182.503)",600:"oklch(0.6 0.118 184.704)",700:"oklch(0.511 0.096 186.391)",800:"oklch(0.437 0.078 188.216)",900:"oklch(0.386 0.063 188.416)",950:"oklch(0.277 0.046 192.524)"},transparent:"transparent",violet:{50:"oklch(0.969 0.016 293.756)",100:"oklch(0.943 0.029 294.588)",200:"oklch(0.894 0.057 293.283)",300:"oklch(0.811 0.111 293.571)",400:"oklch(0.702 0.183 293.541)",500:"oklch(0.606 0.25 292.717)",600:"oklch(0.541 0.281 293.009)",700:"oklch(0.491 0.27 292.581)",800:"oklch(0.432 0.232 292.759)",900:"oklch(0.38 0.189 293.745)",950:"oklch(0.283 0.141 291.089)"},white:"#fff",yellow:{50:"oklch(0.987 0.026 102.212)",100:"oklch(0.973 0.071 103.193)",200:"oklch(0.945 0.129 101.54)",300:"oklch(0.905 0.182 98.111)",400:"oklch(0.852 0.199 91.936)",500:"oklch(0.795 0.184 86.047)",600:"oklch(0.681 0.162 75.834)",700:"oklch(0.554 0.135 66.442)",800:"oklch(0.476 0.114 61.907)",900:"oklch(0.421 0.095 57.708)",950:"oklch(0.286 0.066 53.813)"},zinc:{50:"oklch(0.985 0 0)",100:"oklch(0.967 0.001 286.375)",200:"oklch(0.92 0.004 286.32)",300:"oklch(0.871 0.006 286.286)",400:"oklch(0.705 0.015 286.067)",500:"oklch(0.552 0.016 285.938)",600:"oklch(0.442 0.017 285.786)",700:"oklch(0.37 0.013 285.805)",800:"oklch(0.274 0.006 286.033)",900:"oklch(0.21 0.006 285.885)",950:"oklch(0.141 0.005 285.823)"}},W0={text:{"text-red":{css:{color:`light-dark(${j.red[600]}, ${j.red[400]})`},label:"Red"},"text-orange":{css:{color:`light-dark(${j.orange[600]}, ${j.orange[400]})`},label:"Orange"},"text-yellow":{css:{color:`light-dark(${j.yellow[700]}, ${j.yellow[300]})`},label:"Yellow"},"text-green":{css:{color:`light-dark(${j.green[700]}, ${j.green[400]})`},label:"Green"},"text-blue":{css:{color:`light-dark(${j.blue[600]}, ${j.blue[400]})`},label:"Blue"},"text-purple":{css:{color:`light-dark(${j.purple[600]}, ${j.purple[400]})`},label:"Purple"},"text-pink":{css:{color:`light-dark(${j.pink[600]}, ${j.pink[400]})`},label:"Pink"}},background:{"bg-red":{css:{"background-color":`light-dark(${j.red[400]}, ${j.red[600]})`},label:"Red"},"bg-orange":{css:{"background-color":`light-dark(${j.orange[400]}, ${j.orange[600]})`},label:"Orange"},"bg-yellow":{css:{"background-color":`light-dark(${j.yellow[300]}, ${j.yellow[700]})`},label:"Yellow"},"bg-green":{css:{"background-color":`light-dark(${j.green[400]}, ${j.green[700]})`},label:"Green"},"bg-blue":{css:{"background-color":`light-dark(${j.blue[400]}, ${j.blue[600]})`},label:"Blue"},"bg-purple":{css:{"background-color":`light-dark(${j.purple[400]}, ${j.purple[600]})`},label:"Purple"},"bg-pink":{css:{"background-color":`light-dark(${j.pink[400]}, ${j.pink[600]})`},label:"Pink"}}};import{$isNodeSelection as Dh}from"lexical";import{jsx as Ys}from"react/jsx-runtime";import"react";var V0="M9.5 6C9.77614 6 10 6.22386 10 6.5C10 6.77614 9.77614 7 9.5 7H7.5C7.22386 7 7 7.22386 7 7.5V16.5C7 16.7761 7.22386 17 7.5 17H16.5C16.7761 17 17 16.7761 17 16.5V14.5C17 14.2239 17.2239 14 17.5 14C17.7761 14 18 14.2239 18 14.5V16.5C18 17.3284 17.3284 18 16.5 18H7.5C6.67157 18 6 17.3284 6 16.5V7.5C6 6.67157 6.67157 6 7.5 6H9.5ZM17.5 6C17.7761 6 18 6.22386 18 6.5V11.5C18 11.7761 17.7761 12 17.5 12C17.2239 12 17 11.7761 17 11.5V7.70703L12.8535 11.8535C12.6583 12.0488 12.3417 12.0488 12.1465 11.8535C11.9512 11.6583 11.9512 11.3417 12.1465 11.1465L16.293 7H12.5C12.2239 7 12 6.77614 12 6.5C12 6.22386 12.2239 6 12.5 6H17.5Z",Ln=({className:t})=>Ys("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Ys("path",{d:V0,fill:"currentColor"})});import{jsx as Z0}from"react/jsx-runtime";import{$applyNodeReplacement as q0}from"lexical";import*as qs from"react";import{DecoratorBlockNode as K0}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as J0}from"@lexical/utils";import{$applyNodeReplacement as X0}from"lexical";function Y0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Zs({relationTo:o,value:e})}:null}var $t=class extends K0{__data;constructor({data:e,format:o,key:n}){super(o,n),this.__data=e}static clone(e){return new this({data:e.__data,format:e.__format,key:e.__key})}static getType(){return"relationship"}static importDOM(){return{div:e=>!e.hasAttribute("data-lexical-relationship-relationTo")||!e.hasAttribute("data-lexical-relationship-id")?null:{conversion:Y0,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},n=Zs(o);return n.setFormat(e.format),n}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return J0(o,e?.theme?.relationship),o}decorate(e,o){return null}exportDOM(){let e=document.createElement("div");e.setAttribute("data-lexical-relationship-id",String(typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value)),e.setAttribute("data-lexical-relationship-relationTo",this.__data?.relationTo);let o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"relationship",version:2}}getData(){return this.getLatest().__data}getTextContent(){return`${this.__data?.relationTo} relation to ${typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value}`}setData(e){let o=this.getWritable();o.__data=e}};function Zs(t){return X0(new $t({data:t}))}var Q0=qs.lazy(()=>import("./RelationshipComponent-YCPAKOL7.js").then(t=>({default:t.RelationshipComponent})));function eh(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Ve({relationTo:o,value:e})}:null}var Se=class extends $t{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{div:e=>!e.hasAttribute("data-lexical-relationship-relationTo")||!e.hasAttribute("data-lexical-relationship-id")?null:{conversion:eh,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},n=Ve(o);return n.setFormat(e.format),n}decorate(e,o){return Z0(Q0,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Ve(t){return q0(new Se({data:t}))}function yn(t){return t instanceof Se}import{c as Eh}from"react/compiler-runtime";import{jsx as wh}from"react/jsx-runtime";import{useLexicalComposerContext as Sh}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Nh}from"@lexical/utils";import{$getPreviousSelection as Lh,$getSelection as yh,$isParagraphNode as Rh,$isRangeSelection as vh,COMMAND_PRIORITY_EDITOR as Ih,createCommand as Mh}from"lexical";import{useEffect as Ah}from"react";import{c as ta}from"react/compiler-runtime";import{jsx as Rn}from"react/jsx-runtime";import{useLexicalComposerContext as oa}from"@lexical/react/LexicalComposerContext.js";import{toast as mh}from"@payloadcms/ui";import{$getNodeByKey as ph,COMMAND_PRIORITY_EDITOR as na}from"lexical";import{useEffect as ra,useState as fh}from"react";import{c as th}from"react/compiler-runtime";import{jsx as oh}from"react/jsx-runtime";import{useLexicalComposerContext as nh}from"@lexical/react/LexicalComposerContext";import{useListDrawer as rh,useModal as lh}from"@payloadcms/ui";import{$getNodeByKey as Qs,$getPreviousSelection as ih,$getRoot as sh,$getSelection as ah,$isRangeSelection as ch,$setSelection as uh}from"lexical";import{useEffect as dh,useState as ea}from"react";var Dt=t=>{let e=th(23),[o]=nh(),[n,r]=ea(null),[l,s]=ea(!1),[i,u,d]=rh(t),{closeDrawer:c,drawerSlug:a,isDrawerOpen:m,openDrawer:p}=d,{modalState:f}=lh(),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let N=ah()??ih();r(N)},e[0]=h):h=e[0];let x=h,C;e[1]!==o||e[2]!==n?(C=()=>{n&&o.update(()=>{if(ch(n)){let{anchor:N,focus:S}=n;Qs(N.key)&&Qs(S.key)&&uh(n.clone())}else sh().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=n,e[3]=C):C=e[3];let E=C,w;e[4]!==c?(w=()=>{c()},e[4]=c,e[5]=w):w=e[5];let g=w,b,k;e[6]!==a||e[7]!==f||e[8]!==E||e[9]!==l?(b=()=>{if(!l)return;let N=f[a];N&&!N?.isOpen&&(s(!1),setTimeout(()=>{E()},1))},k=[f,a,E,l],e[6]=a,e[7]=f,e[8]=E,e[9]=l,e[10]=b,e[11]=k):(b=e[10],k=e[11]),dh(b,k);let _;e[12]!==u?(_=N=>oh(u,{...N,onClick:()=>{x()}}),e[12]=u,e[13]=_):_=e[13];let T;e[14]!==p?(T=()=>{x(),p(),s(!0)},e[14]=p,e[15]=T):T=e[15];let I;return e[16]!==i||e[17]!==g||e[18]!==m||e[19]!==a||e[20]!==_||e[21]!==T?(I={closeListDrawer:g,isListDrawerOpen:m,ListDrawer:i,listDrawerSlug:a,ListDrawerToggler:_,openListDrawer:T},e[16]=i,e[17]=g,e[18]=m,e[19]=a,e[20]=_,e[21]=T,e[22]=I):I=e[22],I};var hh=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=ph(o);r&&r.replace(Ve({relationTo:e,value:n}))}):t.dispatchCommand(vn,{relationTo:e,value:n})},gh=t=>{let e=ta(14),{enabledCollectionSlugs:o}=t,[n]=oa(),[r,l]=fh(null),s=o?.[0],i;e[0]!==o||e[1]!==s?(i={collectionSlugs:o,selectedCollection:s},e[0]=o,e[1]=s,e[2]=i):i=e[2];let{closeListDrawer:u,ListDrawer:d,openListDrawer:c}=Dt(i),a,m;e[3]!==n||e[4]!==c?(a=()=>n.registerCommand(Qe,x=>(l(x?.replace?x?.replace.nodeKey:null),c(),!0),na),m=[n,c],e[3]=n,e[4]=c,e[5]=a,e[6]=m):(a=e[5],m=e[6]),ra(a,m);let p;e[7]!==u||e[8]!==n||e[9]!==r?(p=x=>{let{collectionSlug:C,doc:E}=x;hh({editor:n,relationTo:C,replaceNodeKey:r,value:E.id}),u()},e[7]=u,e[8]=n,e[9]=r,e[10]=p):p=e[10];let f=p,h;return e[11]!==d||e[12]!==f?(h=Rn(d,{onSelect:f}),e[11]=d,e[12]=f,e[13]=h):h=e[13],h},xh=()=>{let t=ta(3),[e]=oa(),o,n;return t[0]!==e?(o=()=>e.registerCommand(Qe,Ch,na),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),ra(o,n),null},la=({enabledCollectionSlugs:t})=>t?.length?Rn(gh,{enabledCollectionSlugs:t}):Rn(xh,{});function Ch(){return mh.error("No relationship collections enabled"),!0}import{c as bh}from"react/compiler-runtime";import{useConfig as kh,useEntityVisibility as _h}from"@payloadcms/ui";import"react";var po=t=>{let e=bh(11),{enabledCollectionSlugs:o}=t,{config:n}=kh(),{collections:r}=n,{visibleEntities:l}=_h(),s,i;if(e[0]!==r||e[1]!==o||e[2]!==l){let d;e[5]!==o||e[6]!==l?(d=a=>{let{slug:m}=a;return o.includes(m)&&(!l?.collections||l.collections.includes(m))},e[5]=o,e[6]=l,e[7]=d):d=e[7];let c=r.filter(d);s=c,i=c.map(Th),e[0]=r,e[1]=o,e[2]=l,e[3]=s,e[4]=i}else s=e[3],i=e[4];let u;return e[8]!==s||e[9]!==i?(u={enabledCollections:s,enabledCollectionSlugs:i},e[8]=s,e[9]=i,e[10]=u):u=e[10],u};function Th(t){return t.slug}var vn=Mh("INSERT_RELATIONSHIP_COMMAND"),ia=t=>{let e=Eh(7),{clientProps:o}=t,[n]=Sh(),r;e[0]!==o.enabledCollectionSlugs?(r={enabledCollectionSlugs:o.enabledCollectionSlugs},e[0]=o.enabledCollectionSlugs,e[1]=r):r=e[1];let{enabledCollectionSlugs:l}=po(r),s,i;e[2]!==n?(s=()=>{if(!n.hasNodes([Se]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return n.registerCommand(vn,$h,Ih)},i=[n],e[2]=n,e[3]=s,e[4]=i):(s=e[3],i=e[4]),Ah(s,i);let u;return e[5]!==l?(u=wh(la,{enabledCollectionSlugs:l}),e[5]=l,e[6]=u):u=e[6],u};function $h(t){let e=yh()||Lh();if(vh(e)){let o=Ve(t),{focus:n}=e,r=n.getNode();Nh(o),Rh(r)&&!r.__first&&r.remove()}return!0}var Oh=M({nodes:[Se],plugins:[{Component:ia,position:"normal"}],slashMenu:{groups:[Q([{Icon:Ln,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Qe,{replace:!1})}}])]},toolbarFixed:{groups:[ke([{ChildComponent:Ln,isActive:({selection:t})=>{if(!Dh(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return yn(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Qe,{replace:!1})}}])]}});import{c as x5}from"react/compiler-runtime";import{jsx as he,jsxs as C5}from"react/jsx-runtime";import{useLexicalComposerContext as b5}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as Ca}from"@lexical/react/useLexicalEditable";import{useScrollInfo as k5,useThrottledEffect as _5,useTranslation as T5}from"@payloadcms/ui";import*as ba from"react";import{useMemo as Dn}from"react";import{jsx as Fh,jsxs as Ph}from"react/jsx-runtime";import{Tooltip as Bh,useTranslation as jh}from"@payloadcms/ui";import{$addUpdateTag as Hh}from"lexical";import{useCallback as sa,useEffect as Gh,useMemo as aa,useRef as zh,useState as Uh}from"react";var In="toolbar-popup__button",Ot=({active:t=!1,children:e,editor:o,enabled:n=!0,item:r})=>{let{i18n:l}=jh(),{fieldProps:{featureClientSchemaMap:s,schemaPath:i}}=W(),[u,d]=Uh(!1),c=zh(null);Gh(()=>{c.current?.removeAttribute("data-pressing")},[t]);let a=aa(()=>r.label?typeof r.label=="function"?r.label({featureClientSchemaMap:s,i18n:l,schemaPath:i}):r.label:r.key.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^./,h=>h.toUpperCase()),[s,l,i,r]),m=aa(()=>[In,n?"":"disabled",t?"active":"",r.key?`${In}-${r.key}`:""].filter(Boolean).join(" "),[t,n,r.key]),p=sa(()=>{n&&o.focus(()=>{o.update(()=>{Hh("toolbar")}),r.onSelect?.({editor:o,isActive:t})})},[o,r,t,n]),f=sa(h=>{h.preventDefault(),h.currentTarget.setAttribute("data-pressing","")},[]);return Ph("button",{"aria-label":a,"aria-pressed":r.isActive?t:void 0,className:m,"data-button-key":r.key,disabled:!n,onClick:p,onMouseDown:f,onPointerEnter:()=>d(!0),onPointerLeave:()=>{d(!1),c.current?.removeAttribute("data-pressing")},ref:c,type:"button",children:[Fh(Bh,{className:`${In}__tooltip`,show:u,children:a}),e]})};import{c as Zh}from"react/compiler-runtime";import{jsx as dt}from"react/jsx-runtime";import qh,{useMemo as Qh}from"react";import{useTranslation as e5}from"@payloadcms/ui";import{jsx as Ke,jsxs as ca}from"react/jsx-runtime";import{Button as Wh}from"@payloadcms/ui";import{$addUpdateTag as Vh,isDOMNode as Kh}from"lexical";import An,{useCallback as Jh,useEffect as ho,useId as Xh,useMemo as da,useRef as fo,useState as Mn}from"react";var ua="toolbar-popup__dropdown-item",ma=An.createContext(null);function pa({active:t,children:e,editor:o,enabled:n,Icon:r,item:l,itemKey:s,tooltip:i}){let u=da(()=>[ua,n===!1?"disabled":"",t?"active":"",l?.key?`${ua}-${l.key}`:""].filter(Boolean).join(" "),[n,t,l.key]),d=fo(null),c=An.use(ma);if(c===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=c;return ho(()=>{d?.current!=null&&a(d)},[d,a]),Ke(Wh,{"aria-label":i,buttonStyle:"ghost",className:u,disabled:n===!1,extraButtonProps:{"aria-checked":l.isActive?!!t:void 0,"data-item-key":s,role:l.isActive?"menuitemcheckbox":"menuitem",tabIndex:-1},icon:r,iconPosition:"left",onClick:()=>{n!==!1&&o.focus(()=>{o.update(()=>{Vh("toolbar")}),l.onSelect?.({editor:o,isActive:t})})},onMouseDown:m=>{m.preventDefault()},ref:d,tooltip:i,type:"button",children:e})}function Yh({id:t,children:e,dropdownKey:o,dropDownRef:n,itemsContainerClassNames:r,onClose:l,shouldAutoFocus:s}){let[i,u]=Mn(),[d,c]=Mn(),a=Jh(f=>{u(h=>h!=null?[...h,f]:[f])},[u]),m=f=>{if(i==null)return;let{key:h}=f,x=i.filter(C=>!C.current?.disabled);["ArrowDown","ArrowUp","Escape"].includes(h)&&f.preventDefault(),h==="Escape"?l():h==="Tab"?setTimeout(()=>l({restoreFocus:!1})):h==="ArrowUp"?c(C=>{if(C==null)return x[0];let E=x.indexOf(C)-1;return x[E===-1?x.length-1:E]}):h==="ArrowDown"&&c(C=>{if(C==null)return x[0];let E=x.indexOf(C);return x[E===x.length-1?0:E+1]})},p=da(()=>({registerItem:a}),[a]);return ho(()=>{s&&i!=null&&d==null&&c(i.find(f=>!f.current?.disabled)),d!=null&&d?.current!=null&&d.current.focus()},[i,d,s]),Ke(ma,{value:p,children:Ke("div",{className:(r??["toolbar-popup__dropdown-items"]).join(" "),"data-dropdown-key":o,"data-theme":"dark",id:t,onKeyDown:m,popover:"manual",ref:n,role:"menu",tabIndex:-1,children:e})})}function fa({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:n=!1,dropdownKey:r,Icon:l,itemsContainerClassNames:s,label:i,stopCloseOnClickSelf:u}){let d=fo(null),c=fo(null),a=fo(!1),m=Xh(),p=`toolbar-dropdown-${r}-${m}`,[f,h]=Mn(!1),x=({restoreFocus:C=!0}={})=>{h(!1),C&&c?.current!=null&&c.current.focus()};return ho(()=>{let C=c.current,E=d.current;if(f&&C!==null&&E!==null){E.matches(":popover-open")||E.showPopover();let w=()=>{let{bottom:g,left:b,top:k}=C.getBoundingClientRect(),_=8,T=5,I=g+T,N=k-E.offsetHeight-T,S=Math.max(_,window.innerHeight-E.offsetHeight-_),y=I+E.offsetHeight+_<=window.innerHeight?I:N>=_?N:I;E.style.position="fixed",E.style.top=`${Math.max(_,Math.min(y,S))}px`,E.style.left=`${Math.max(8,Math.min(b-5,window.innerWidth-E.offsetWidth-20))}px`};return w(),window.addEventListener("resize",w),window.addEventListener("scroll",w,{capture:!0,passive:!0}),()=>{window.removeEventListener("resize",w),window.removeEventListener("scroll",w,{capture:!0})}}},[d,c,f]),ho(()=>{let C=c.current;if(C!==null&&f){let E=w=>{let g=w.target;Kh(g)&&(u&&d.current&&d.current.contains(g)||C.contains(g)||h(!1))};return document.addEventListener("click",E),()=>{document.removeEventListener("click",E)}}},[d,c,f,u]),ca(An.Fragment,{children:[ca("button",{"aria-controls":p,"aria-expanded":f,"aria-haspopup":"menu","aria-label":t,className:e+(f?" active":""),"data-dropdown-key":r,disabled:n,onClick:C=>{C.preventDefault(),a.current=!1,h(!f)},onKeyDown:C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),a.current=!0,h(!f))},onMouseDown:C=>{C.preventDefault()},ref:c,type:"button",children:[l&&Ke(l,{}),i&&Ke("span",{className:"toolbar-popup__dropdown-label",children:i}),Ke("i",{className:"toolbar-popup__dropdown-caret"})]}),f&&Ke(Yh,{dropdownKey:r,dropDownRef:d,id:p,itemsContainerClassNames:s,onClose:x,shouldAutoFocus:a.current,children:o})]})}var $n="toolbar-popup__dropdown",t5=t=>{let e=Zh(15),{active:o,anchorElem:n,editor:r,enabled:l,iconOnly:s,item:i}=t,{i18n:u}=e5(),{fieldProps:d}=W(),{featureClientSchemaMap:c,schemaPath:a}=d;if(i.Component){let p;return e[0]!==o||e[1]!==n||e[2]!==r||e[3]!==l||e[4]!==i?(p=i?.Component&&dt(i.Component,{active:o,anchorElem:n,editor:r,enabled:l,item:i},i.key),e[0]=o,e[1]=n,e[2]=r,e[3]=l,e[4]=i,e[5]=p):p=e[5],p}let m;if(e[6]!==o||e[7]!==r||e[8]!==l||e[9]!==c||e[10]!==u||e[11]!==s||e[12]!==i||e[13]!==a){let p=i.key,f;i.label&&(p=typeof i.label=="function"?i.label({featureClientSchemaMap:c,i18n:u,schemaPath:a}):i.label),p.length>25?f=p.substring(0,25)+"...":f=p,m=dt(pa,{active:o,editor:r,enabled:l,Icon:i?.ChildComponent?dt(i.ChildComponent,{}):void 0,item:i,itemKey:i.key,tooltip:s?p:void 0,children:dt("span",{className:"text",children:f})},i.key),e[6]=o,e[7]=r,e[8]=l,e[9]=c,e[10]=u,e[11]=s,e[12]=i,e[13]=a,e[14]=m}else m=e[14];return m},o5=qh.memo(t5),Ft=({anchorElem:t,classNames:e,editor:o,group:n,groupState:r,Icon:l,itemsContainerClassNames:s,label:i})=>{let{items:u,key:d}=n,c=Qh(()=>u?.length?u.map(a=>dt(o5,{active:r.activeItemKeys.includes(a.key),anchorElem:t,editor:o,enabled:r.enabledItemKeys.includes(a.key),iconOnly:n.iconOnly,item:a},a.key)):null,[u,r.activeItemKeys,r.enabledItemKeys,t,o]);return dt(fa,{buttonAriaLabel:`${d} dropdown`,buttonClassName:[$n,`${$n}-${d}`,...e||[]].filter(Boolean).join(" "),disabled:!r.enabledGroup,dropdownKey:d,Icon:l,itemsContainerClassNames:[`${$n}-items`,...s||[]],label:i,children:c},d)};import{mergeRegister as n5}from"@lexical/utils";import{$getSelection as r5}from"lexical";import{useCallback as l5,useDeferredValue as i5,useEffect as s5,useRef as ha,useState as a5}from"react";function c5(t){let e=new Map,o=new Map;if(!t?.length)return{groupStates:o,itemStates:e};for(let n of t){let r=[];for(let l of n.items)e.set(l.key,{active:!1,enabled:!0}),r.push(l.key);o.set(n.key,{activeItemKeys:[],activeItems:[],enabledGroup:!0,enabledItemKeys:r})}return{groupStates:o,itemStates:e}}function go(t,e){let[o,n]=a5(()=>c5(e)),r=i5(o),l=W(),s=ha(l);s.current=l;let i=ha(e);i.current=e;let u=Er(),d=l5(()=>{t.getEditorState().read(()=>{let c=r5();if(!c)return;let a=i.current;if(!a?.length)return;let m=s.current,p=new Map,f=new Map;for(let h of a){let x=[],C=[],E=[],w=h.type==="dropdown"?h.maxActiveItems??1:void 0;for(let b of h.items){let k=b.isActive?(!w||x.length<w)&&b.isActive({editor:t,editorConfigContext:m,selection:c}):!1,_=b.isEnabled?b.isEnabled({editor:t,editorConfigContext:m,selection:c}):!0;k&&(x.push(b.key),C.push(b)),_&&E.push(b.key),p.set(b.key,{active:k,enabled:_})}let g=h.type==="dropdown"&&h.isEnabled?h.isEnabled({editor:t,editorConfigContext:m,selection:c}):!0;f.set(h.key,{activeItemKeys:x,activeItems:C,enabledGroup:g,enabledItemKeys:E})}n({groupStates:f,itemStates:p})})},[t]);return s5(()=>{u(d);let c=()=>{u(d)},a=n5(t.registerUpdateListener(c));return document.addEventListener("mouseup",c),()=>{a(),document.removeEventListener("mouseup",c)}},[t,u,d]),r}import{c as u5}from"react/compiler-runtime";import{useEffect as d5}from"react";var m5=".fixed-toolbar__scroll",p5=40;function f5({clientWidth:t,deltaMode:e,deltaY:o,isRightToLeft:n}){let r=e===1?o*p5:e===2?o*t:o;return n?-r:r}function ga(t){if(!(Math.abs(t.deltaY)>Math.abs(t.deltaX)))return;let o=t.target;if(!(o instanceof Element))return;let n=o.closest(m5);!n||!(n.scrollWidth>n.clientWidth)||(t.preventDefault(),n.scrollLeft+=f5({clientWidth:n.clientWidth,deltaMode:t.deltaMode,deltaY:t.deltaY,isRightToLeft:getComputedStyle(n).direction==="rtl"}))}var mt=0;function xa(){let t=u5(1),e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],t[0]=e):e=t[0],d5(h5,e)}function h5(){return mt===0&&document.addEventListener("wheel",ga,{passive:!1}),mt=mt+1,g5}function g5(){mt=mt-1,mt===0&&document.removeEventListener("wheel",ga)}function E5({active:t,anchorElem:e,editor:o,enabled:n,item:r}){return r.Component?r?.Component&&he(r.Component,{anchorElem:e,editor:o,item:r},r.key):r.ChildComponent?he(Ot,{active:t,editor:o,enabled:n,item:r,children:he(r.ChildComponent,{})},r.key):null}function w5({anchorElem:t,editor:e,editorConfig:o,group:n,index:r,toolbarStates:l}){let{i18n:s}=T5(),{fieldProps:{featureClientSchemaMap:i,schemaPath:u}}=W(),d=l.groupStates.get(n.key),c=Dn(()=>{if(n.type!=="dropdown")return;let m=d?.activeItems?.[0];return m?m.ChildComponent:n.ChildComponent},[n,d?.activeItems]),a=Dn(()=>{if(n.type!=="dropdown")return;let m=d?.activeItems;if(!m?.length)return;if(m.length>1)return s.t("lexical:general:toolbarItemsActive",{count:m.length});let p=m[0],f=p.key;return p.label&&(f=typeof p.label=="function"?p.label({featureClientSchemaMap:i,i18n:s,schemaPath:u}):p.label),f.length>25&&(f=f.substring(0,25)+"..."),f},[n,d?.activeItems,s,i,u]);return C5("div",{className:`fixed-toolbar__group fixed-toolbar__group-${n.key}`,"data-toolbar-group-key":n.key,children:[n.type==="dropdown"&&n.items.length&&d?he(Ft,{anchorElem:t,editor:e,group:n,groupState:d,Icon:c,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a}):null,n.type==="buttons"&&n.items.length?n.items.map(m=>{let p=l.itemStates.get(m.key);return he(E5,{active:p?.active??!1,anchorElem:t,editor:e,enabled:p?.enabled??!0,item:m},m.key)}):null,r<o.features.toolbarFixed?.groups.length-1&&he("div",{className:"divider"})]},n.key)}function S5({anchorElem:t,clientProps:e,editor:o,editorConfig:n,parentWithFixedToolbar:r}){let l=ba.useRef(null),s=Ca(),{y:i}=k5();xa();let u=go(o,n?.features?.toolbarFixed?.groups),d=Dn(()=>{if(!r||e?.disableIfParentHasFixedToolbar)return null;let a=r.editorContainerRef.current.previousElementSibling;for(;a;){if(a.classList.contains("fixed-toolbar"))return a;a=a.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,r]);return _5(()=>{if(!d)return;let c=l.current;if(!c)return;let a=c.getBoundingClientRect(),m=d.getBoundingClientRect();if(!(a.bottom<m.top||a.top>m.bottom))c.classList.remove("fixed-toolbar"),c.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),d.classList.remove("fixed-toolbar"),d.classList.add("fixed-toolbar","fixed-toolbar--hide");else{if(!c.classList.contains("fixed-toolbar--overlapping"))return;c.classList.remove("fixed-toolbar--overlapping"),c.classList.add("fixed-toolbar"),d.classList.remove("fixed-toolbar--hide"),d.classList.add("fixed-toolbar")}},50,[l,d,i]),he("div",{className:"fixed-toolbar",onFocus:c=>{c.stopPropagation()},ref:l,children:s&&he("div",{className:"fixed-toolbar__scroll",children:n?.features&&n.features?.toolbarFixed?.groups.map((c,a)=>he(w5,{anchorElem:t,editor:o,editorConfig:n,group:c,index:a,toolbarStates:u},c.key))})})}var ka=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return ka(t.parentEditor)}return!1},_a=t=>{let e=x5(6),{clientProps:o}=t,[n]=b5(),r=W();if(!Ca())return null;let{editorConfig:s}=r,i=o.applyToFocusedEditor&&r.focusedEditor?.editor||n,u=o.applyToFocusedEditor&&r.focusedEditor?.editorConfig||s,d,c;if(e[0]!==o||e[1]!==i||e[2]!==u||e[3]!==r){c=Symbol.for("react.early_return_sentinel");e:{let a=ka(r);if(o?.disableIfParentHasFixedToolbar&&a){c=null;break e}if(!u?.features?.toolbarFixed?.groups?.length){c=null;break e}d=he(S5,{anchorElem:document.body,clientProps:o,editor:i,editorConfig:u,parentWithFixedToolbar:a})}e[0]=o,e[1]=i,e[2]=u,e[3]=r,e[4]=d,e[5]=c}else d=e[4],c=e[5];return c!==Symbol.for("react.early_return_sentinel")?c:d};var N5=M({plugins:[{Component:_a,position:"aboveContainer"}]});import{c as L5}from"react/compiler-runtime";import{jsx as Ne,jsxs as wa}from"react/jsx-runtime";import{useLexicalComposerContext as y5}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as R5}from"@lexical/react/useLexicalEditable";import{mergeRegister as Sa}from"@lexical/utils";import{$getSelection as Na,$isRangeSelection as Ta,$isTextNode as v5,COMMAND_PRIORITY_LOW as I5,getDOMSelection as La,SELECTION_CHANGE_COMMAND as M5}from"lexical";import{useCallback as Co,useEffect as Pt,useMemo as A5,useRef as Ea,useState as $5}from"react";import"react";import{createPortal as D5}from"react-dom";function On(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 xo(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:n=0,floatingElem:r,horizontalOffset:l=32,horizontalPosition:s="left",specialHandlingForCaret:i=!1,targetRect:u,verticalGap:d=10}=t,c=o.parentElement;if(u===null||c==null){r.style.opacity="0",r.style.transform="translate(-10000px, -10000px)";return}let a=r.getBoundingClientRect(),m=o.getBoundingClientRect(),p=c.getBoundingClientRect(),f=u.top-a.height-d,h=u.left-l;s==="center"&&(h=u.left+u.width/2-a.width/2);let x=0;return!e&&f<p.top&&!i&&(x=a.height+u.height+d*2,f+=x),s==="center"?h+a.width>p.right?h=p.right-a.width-l:h<p.left&&(h=p.left+l):h+a.width>p.right&&(h=p.right-a.width-l),h-=m.left,r.style.opacity="1",i&&n!==0?(f-=m.bottom-n+a.height-3,r.style.transform=`translate(${h}px, ${f}px) rotate(180deg)`):(f-=m.top,r.style.transform=`translate(${h}px, ${f}px)`),x}function O5({active:t,anchorElem:e,editor:o,enabled:n,item:r}){return r.Component?r?.Component&&Ne(r.Component,{anchorElem:e,editor:o,item:r},r.key):r.ChildComponent?Ne(Ot,{active:t,editor:o,enabled:n,item:r,children:Ne(r.ChildComponent,{})},r.key):null}function F5({anchorElem:t,editor:e,group:o,index:n,toolbarStates:r}){let{editorConfig:l}=W(),s=r.groupStates.get(o.key),i=A5(()=>o.type!=="dropdown"?void 0:s?.activeItems?.[0]?.ChildComponent??o.ChildComponent,[o,s?.activeItems]);return wa("div",{className:`inline-toolbar-popup__group inline-toolbar-popup__group-${o.key}`,"data-toolbar-group-key":o.key,children:[o.type==="dropdown"&&o.items.length&&s?Ne(Ft,{anchorElem:t,editor:e,group:o,groupState:s,Icon:i}):null,o.type==="buttons"&&o.items.length?o.items.map(u=>{let d=r.itemStates.get(u.key);return Ne(O5,{active:d?.active??!1,anchorElem:t,editor:e,enabled:d?.enabled??!0,item:u},u.key)}):null,n<l.features.toolbarInline?.groups.length-1&&Ne("div",{className:"divider"})]},o.key)}function P5({anchorElem:t,editor:e}){let o=Ea(null),n=Ea(null),{editorConfig:r}=W(),l=go(e,r?.features?.toolbarInline?.groups),s=Co(()=>{if(o?.current){let c=o.current.style.opacity==="0",a=o.current.style.pointerEvents==="none";c||(o.current.style.opacity="0"),a||(o.current.style.pointerEvents="none")}},[o]),i=Co(c=>{if(o?.current&&(c.buttons===1||c.buttons===3)){let a=o.current.style.opacity==="0",m=o.current.style.pointerEvents==="none";if(!a||!m){let p=c.clientX,f=c.clientY,h=document.elementFromPoint(p,f);o.current.contains(h)||s()}}},[s]),u=Co(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);Pt(()=>(document.addEventListener("mousemove",i),document.addEventListener("mouseup",u),()=>{document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",u)}),[o,i,u]);let d=Co(()=>{let c=Na(),a=La(e._window);if(o.current===null)return;let m=t.querySelector(":scope > .link-editor"),p=m!==null&&"style"in m&&m?.style?.opacity==="1",f=e.getRootElement();if(c!==null&&a!==null&&!a.isCollapsed&&f!==null&&f.contains(a.anchorNode)){let h=On(a,f),x=xo({alwaysDisplayOnTop:p,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:h});n.current&&xo({anchorElem:o.current,anchorFlippedOffset:x,floatingElem:n.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:h,verticalGap:8})}else s()},[e,s,t]);return Pt(()=>{let c=t.parentElement,a=()=>{e.getEditorState().read(()=>{d()})};return window.addEventListener("resize",a),c&&c.addEventListener("scroll",a),()=>{window.removeEventListener("resize",a),c&&c.removeEventListener("scroll",a)}},[e,d,t]),Pt(()=>(e.getEditorState().read(()=>{d()}),Sa(e.registerUpdateListener(({editorState:c})=>{c.read(()=>{d()})}),e.registerCommand(M5,()=>(d(),!1),I5))),[e,d]),wa("div",{className:"inline-toolbar-popup",ref:o,children:[Ne("div",{className:"caret",ref:n}),r?.features&&r.features?.toolbarInline?.groups.map((c,a)=>Ne(F5,{anchorElem:t,editor:e,group:c,index:a,toolbarStates:l},c.key))]})}function B5(t,e){let o=L5(12),[n,r]=$5(!1),l=R5(),s;o[0]!==t?(s=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let p=Na(),f=La(t._window),h=t.getRootElement();if(f!==null&&(!Ta(p)||h===null||!h.contains(f.anchorNode))){r(!1);return}if(!Ta(p))return;if(p.getTextContent()!==""){let C=p.getNodes(),E=!1;for(let w of C)if(v5(w)){r(!0),E=!0;break}E||r(!1)}else r(!1);let x=p.getTextContent().replace(/\n/g,"");if(!p.isCollapsed()&&x===""){r(!1);return}})},o[0]=t,o[1]=s):s=o[1];let i=s,u,d;o[2]!==i?(u=()=>(document.addEventListener("selectionchange",i),document.addEventListener("mouseup",i),()=>{document.removeEventListener("selectionchange",i),document.removeEventListener("mouseup",i)}),d=[i],o[2]=i,o[3]=u,o[4]=d):(u=o[3],d=o[4]),Pt(u,d);let c,a;if(o[5]!==t||o[6]!==i?(c=()=>Sa(t.registerUpdateListener(()=>{i()}),t.registerRootListener(()=>{t.getRootElement()===null&&r(!1)})),a=[t,i],o[5]=t,o[6]=i,o[7]=c,o[8]=a):(c=o[7],a=o[8]),Pt(c,a),!n||!l)return null;let m;return o[9]!==e||o[10]!==t?(m=D5(Ne(P5,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=m):m=o[11],m}var ya=t=>{let{anchorElem:e}=t,[o]=y5();return B5(o,e)};var j5=M({plugins:[{Component:ya,position:"floatingAnchorElem"}]});import{TableCellNode as D2,TableNode as O2,TableRowNode as F2}from"@lexical/table";import{jsx as Ra}from"react/jsx-runtime";import"react";var H5={16:"M7 4h4.5a.5.5 0 0 1 .5.5V6H7zM6 4H4.5a.5.5 0 0 0-.5.5V6h2zm0 3H4v2h2zm0 3H4v1.5a.5.5 0 0 0 .5.5H6zm1 2h4.5a.5.5 0 0 0 .5-.5V10H7zm0-3V7h5v2zM3 4.5A1.5 1.5 0 0 1 4.5 3h7A1.5 1.5 0 0 1 13 4.5v7a1.5 1.5 0 0 1-1.5 1.5h-7A1.5 1.5 0 0 1 3 11.5z",24:"M17.204 6.51A2 2 0 0 1 19 8.5V16l-.011.204a2 2 0 0 1-1.785 1.785L17 18H7l-.204-.01a2 2 0 0 1-1.786-1.786L5 16V8.5a2 2 0 0 1 1.796-1.99L7 6.5h10zM6 16a1 1 0 0 0 1 1h2v-2.5H6zm4-1.5V17h7a1 1 0 0 0 .995-.898L18 16v-1.5zm-4-1h3V11H6zm4-2.5v2.5h8V11zM7 7.5a1 1 0 0 0-.995.897L6 8.5V10h3V7.5zm3 2.5h8V8.5a1 1 0 0 0-1-1h-7z"},Fn=({className:t,size:e=24})=>Ra("svg",{className:["icon",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:Ra("path",{clipRule:"evenodd",d:H5[e],fill:"currentColor",fillRule:"evenodd"})});import{$convertToMarkdownString as G5}from"@lexical/markdown";import{$createTableCellNode as z5,$createTableNode as U5,$createTableRowNode as W5,$isTableCellNode as va,$isTableNode as Pn,$isTableRowNode as Bn,TableCellHeaderStates as bo,TableCellNode as V5,TableNode as K5,TableRowNode as J5}from"@lexical/table";import{$isParagraphNode as X5,$isTextNode as Y5}from"lexical";var Ma=/^\|(.+)\|\s?$/,Z5=/^(\| ?:?-*:? ?)+\|\s?$/,Aa=({allTransformers:t})=>({type:"element",dependencies:[K5,J5,V5],export:e=>{if(!Pn(e))return null;let o=[];for(let n of e.getChildren()){let r=[];if(!Bn(n))continue;let l=!1;for(let s of n.getChildren())va(s)&&(r.push(G5(t,s).replace(/\n/g,"\\n").trim()),s.__headerState===bo.ROW&&(l=!0));o.push(`| ${r.join(" | ")} |`),l&&o.push(`| ${r.map(s=>"---").join(" | ")} |`)}return o.join(`
|
|
58
|
-
`)},regExp:
|
|
59
|
-
`);let o=z5(bo.NO_STATUS);return qt(t,e,o,!1,!0),o},Ia=(t,e)=>{let o=t.match(Ma);return!o||!o[1]?null:o[1].split("|").map(n=>$a(n,e))};import{c as og}from"react/compiler-runtime";import{jsx as P,jsxs as Le}from"react/jsx-runtime";import{useLexicalComposerContext as ja}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as ng}from"@lexical/react/useLexicalEditable";import{$computeTableMap as rg,$deleteTableColumnAtSelection as lg,$deleteTableRowAtSelection as ig,$getNodeTriplet as sg,$getTableCellNodeFromLexicalNode as Ba,$getTableNodeFromLexicalNodeOrThrow as $e,$getTableRowIndexFromTableCellNode as ag,$insertTableColumnAtSelection as cg,$insertTableRowAtSelection as ug,$isTableCellNode as Ha,$isTableSelection as Bt,$mergeCells as dg,$setTableColumnIsHeader as mg,$setTableRowIsHeader as pg,$unmergeCell as fg,getTableElement as jn,getTableObserverFromTableElement as Hn,TableCellHeaderStates as pt,TableCellNode as hg}from"@lexical/table";import{mergeRegister as gg}from"@lexical/utils";import{useScrollInfo as xg}from"@payloadcms/ui";import{$getSelection as _o,$isElementNode as Cg,$isRangeSelection as Gn,$isTextNode as bg,$setSelection as kg,COMMAND_PRIORITY_CRITICAL as _g,getDOMSelection as Tg,isDOMNode as Eg,SELECTION_CHANGE_COMMAND as wg}from"lexical";import*as zn from"react";import{useCallback as me,useEffect as ft,useRef as ko,useState as ht}from"react";import{createPortal as Ga}from"react-dom";import{jsx as Da}from"react/jsx-runtime";import"react";var Q5={16:"M5 8a1 1 0 1 1-2 0 1 1 0 0 1 2 0m4 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0m3 1a1 1 0 1 0 0-2 1 1 0 0 0 0 2",24:"M7.5 12a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m6 0a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m4.5 1.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3"},Oa=({className:t,size:e=24})=>Da("svg",{className:t,fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:Da("path",{clipRule:"evenodd",d:Q5[e],fill:"currentColor",fillRule:"evenodd"})});import{$computeTableCellRectBoundary as eg,$computeTableMap as tg,$getNodeTriplet as Fa}from"@lexical/table";function Pa({selection:t}){let[e,,o]=Fa(t.anchor),[n]=Fa(t.focus),[r,l,s]=tg(o,e,n),{maxColumn:i,maxRow:u,minColumn:d,minRow:c}=eg(r,l,s);return{columns:i-d+1,rows:u-c+1}}function Sg(){let t=_o();if(Gn(t)&&!t.isCollapsed()||Bt(t)&&!t.anchor.is(t.focus)||!Gn(t)&&!Bt(t))return!1;let[e]=sg(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function Ng(t){let e=t.getLastDescendant();bg(e)?e.select():Cg(e)?e.selectEnd():e!==null&&e.selectNext()}function Lg({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:n,tableCellNode:r}){let[l]=ja(),s=ko(null),[i,u]=ht(r),[d,c]=ht({columns:1,rows:1}),[a,m]=ht(!1),[p,f]=ht(!1),{y:h}=xg();ft(()=>l.registerMutationListener(hg,L=>{L.get(i.getKey())==="updated"&&l.getEditorState().read(()=>{u(i.getLatest())})},{skipInitialization:!0}),[l,i]),ft(()=>{l.getEditorState().read(()=>{let L=_o();if(Bt(L)){let R=Pa({selection:L});c(R);let v=L.anchor.is(L.focus);m(!v&&(R.columns>1||R.rows>1))}f(Sg())})},[l]),ft(()=>{let L=e.current,R=s.current,v=l.getRootElement();if(L!=null&&R!=null&&v!=null){let A=v.getBoundingClientRect(),$=L.getBoundingClientRect();R.style.opacity="1";let O=R.getBoundingClientRect(),B=5,F=$.right+B;if(F+O.width>window.innerWidth||F+O.width>A.right){let V=$.left-O.width-B;F=(V<0?B:V)+window.pageXOffset}R.style.left=`${F+window.pageXOffset}px`;let z=$.top;if(z+O.height>window.innerHeight){let V=$.bottom-O.height;z=V<0?B:V}R.style.top=`${z}px`}},[e,s,l,h]),ft(()=>{function L(R){s.current!=null&&e.current!=null&&Eg(R.target)&&!s.current.contains(R.target)&&!e.current.contains(R.target)&&n(!1)}return window.addEventListener("click",L),()=>window.removeEventListener("click",L)},[n,e]);let x=me(()=>{l.update(()=>{if(i.isAttached()){let L=$e(i),R=jn(L,l.getElementByKey(L.getKey()));if(R===null)throw new Error("Expected to find tableElement in DOM");let v=Hn(R);v!==null&&v.$clearHighlight(),L.markDirty(),u(i.getLatest())}kg(null)})},[l,i]),C=()=>{l.update(()=>{let L=_o();if(!Bt(L))return;let v=L.getNodes().filter(Ha),A=dg(v);A&&(Ng(A),o())})},E=()=>{l.update(()=>{fg()}),x()},w=me(L=>{l.update(()=>{for(let R=0;R<d.rows;R++)ug(L);o()})},[l,o,d.rows]),g=me(L=>{l.update(()=>{for(let R=0;R<d.columns;R++)cg(L);o()})},[l,o,d.columns]),b=me(()=>{l.update(()=>{ig(),o()})},[l,o]),k=me(()=>{l.update(()=>{$e(i).remove(),x(),o()})},[l,i,x,o]),_=me(()=>{l.update(()=>{lg(),o()})},[l,o]),T=me(()=>{l.update(()=>{let L=$e(i),R=ag(i),v=!i.hasHeaderState(pt.ROW);pg(L,R,v),x(),o()})},[l,i,x,o]),I=me(()=>{l.update(()=>{let L=$e(i),[,R]=rg(L,i,i),v=!i.hasHeaderState(pt.COLUMN);mg(L,R.startColumn,v),x(),o()})},[l,i,x,o]),N=me(()=>{l.update(()=>{if(i.isAttached()){let L=$e(i);L&&L.setRowStriping(!L.getRowStriping())}x(),o()})},[l,i,x,o]),S=me(()=>{l.update(()=>{if(i.isAttached()){let L=$e(i);L&&L.setFrozenColumns(L.getFrozenColumns()===0?1:0)}x(),o()})},[l,i,x,o]),y=null;return t&&(a?y=P("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>C(),type:"button",children:P("span",{className:"text",children:"Merge cells"})}):p&&(y=P("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>E(),type:"button",children:P("span",{className:"text",children:"Unmerge cells"})}))),Ga(Le("div",{className:"table-action-menu-dropdown",onClick:L=>{L.stopPropagation()},ref:s,children:[y?Le(zn.Fragment,{children:[y,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-freeze-first-column",onClick:()=>S(),type:"button",children:P("span",{className:"text",children:"Toggle first column freeze"})}),P("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>w(!1),type:"button",children:Le("span",{className:"text",children:["Insert ",d.rows===1?"row":`${d.rows} rows`," above"]})}),P("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>w(!0),type:"button",children:Le("span",{className:"text",children:["Insert ",d.rows===1?"row":`${d.rows} rows`," below"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>g(!1),type:"button",children:Le("span",{className:"text",children:["Insert ",d.columns===1?"column":`${d.columns} columns`," ","left"]})}),P("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>g(!0),type:"button",children:Le("span",{className:"text",children:["Insert ",d.columns===1?"column":`${d.columns} columns`," ","right"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>_(),type:"button",children:P("span",{className:"text",children:"Delete column"})}),P("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>b(),type:"button",children:P("span",{className:"text",children:"Delete row"})}),P("button",{className:"item","data-test-id":"table-delete",onClick:()=>k(),type:"button",children:P("span",{className:"text",children:"Delete table"})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-row-header",onClick:()=>T(),type:"button",children:Le("span",{className:"text",children:[(i.__headerState&pt.ROW)===pt.ROW?"Remove":"Add"," ","row header"]})}),P("button",{className:"item","data-test-id":"table-column-header",onClick:()=>I(),type:"button",children:Le("span",{className:"text",children:[(i.__headerState&pt.COLUMN)===pt.COLUMN?"Remove":"Add"," ","column header"]})})]}),l.getRootElement()?.closest('dialog, [role="dialog"]')??document.body)}function yg({anchorElem:t,cellMerge:e}){let[o]=ja(),n=ko(null),r=ko(null),[l,s]=ht(!1),[i,u]=ht(null),d=me(()=>{let a=n.current,m=_o(),p=Tg(o._window),f=document.activeElement;function h(){a&&(a.classList.remove("table-cell-action-button-container--active"),a.classList.add("table-cell-action-button-container--inactive")),u(null)}if(m==null||a==null)return h();let x=o.getRootElement(),C=null,E=null;if(Gn(m)&&x!==null&&p!==null&&x.contains(p.anchorNode)){let g=Ba(m.anchor.getNode());if(g==null||(E=o.getElementByKey(g.getKey()),E==null||!g.isAttached()))return h();let b=$e(g),k=jn(b,o.getElementByKey(b.getKey()));if(k===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");C=Hn(k),u(g)}else if(Bt(m)){let g=Ba(m.anchor.getNode());if(!Ha(g))throw new Error("TableSelection anchorNode must be a TableCellNode");let b=$e(g),k=jn(b,o.getElementByKey(b.getKey()));if(k===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");C=Hn(k),E=o.getElementByKey(g.getKey())}else if(!f)return h();if(C===null||E===null)return h();let w=!C||!C.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",w),a.classList.toggle("table-cell-action-button-container--inactive",!w),w){let g=E.getBoundingClientRect(),b=t.getBoundingClientRect(),k=g.top-b.top,_=g.right-b.left;a.style.transform=`translate(${_}px, ${k}px)`}},[o,t]);ft(()=>{let a,m=()=>{a=void 0,o.getEditorState().read(d)},p=()=>(a===void 0&&(a=setTimeout(m,0)),!1);return gg(o.registerUpdateListener(p),o.registerCommand(wg,p,_g),o.registerRootListener((f,h)=>{h&&h.removeEventListener("pointerup",p),f&&(f.addEventListener("pointerup",p),p())}),()=>clearTimeout(a))});let c=ko(i);return ft(()=>{c.current!==i&&s(!1),c.current=i},[c,i]),P("div",{className:"table-cell-action-button-container",ref:n,children:i!=null&&Le(zn.Fragment,{children:[P("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),s(!l)},ref:r,type:"button",children:P(Oa,{})}),l&&P(Lg,{cellMerge:e,contextRef:r,onClose:()=>s(!1),setIsMenuOpen:s,tableCellNode:i})]})})}var za=t=>{let e=og(3),{anchorElem:o}=t,n=ng(),r;return e[0]!==o||e[1]!==n?(r=Ga(n?P(yg,{anchorElem:o??document.body,cellMerge:!0}):null,o??document.body),e[0]=o,e[1]=n,e[2]=r):r=e[2],r};import{c as Rg}from"react/compiler-runtime";import{jsx as Eo,jsxs as vg}from"react/jsx-runtime";import{useLexicalComposerContext as Ig}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Mg}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as Ag,$getTableNodeFromLexicalNodeOrThrow as Un,$getTableRowIndexFromTableCellNode as $g,$isTableCellNode as Ua,$isTableRowNode as Dg,getDOMCellFromTarget as Og,getTableElement as Fg,TableNode as Wa}from"@lexical/table";import{calculateZoomLevel as Va,mergeRegister as Pg}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Wn,isHTMLElement as Bg,SKIP_SCROLL_INTO_VIEW_TAG as Ka}from"lexical";import*as Xa from"react";import{useCallback as jt,useEffect as wo,useRef as To,useState as Je}from"react";import{createPortal as jg}from"react-dom";var Hg=33,Ja=92;function Gg({editor:t}){let e=To(null),o=To(null),n=To(null),[r,l]=Je(!1),s=W(),i=To(null),[u,d]=Je(null),[c,a]=Je(null),[m,p]=Je(!1),[f,h]=Je(null),x=jt(()=>{a(null),e.current=null,h(null),i.current=null,n.current=null},[]),C=S=>(S.buttons&1)===1;wo(()=>{let S=new Set;return Pg(t.registerMutationListener(Wa,y=>{for(let[L,R]of y)R==="destroyed"?S.delete(L):S.add(L);l(S.size>0)}),t.registerNodeTransform(Wa,y=>{if(y.getColWidths())return y;let L=y.getColumnCount(),R=Ja;return y.setColWidths(Array(L).fill(R)),y}))},[t]),wo(()=>{if(!r)return;let S=v=>{let A=v.target;if(Bg(A)){if(f){d({x:v.clientX,y:v.clientY});return}if(p(C(v)),!(o.current&&o.current.contains(A))&&e.current!==A){e.current=A;let $=Og(A);$&&c!==$?t.getEditorState().read(()=>{let O=Wn($.elem);if(!O)throw new Error("TableCellResizer: Table cell node not found.");let B=Un(O),F=Fg(B,t.getElementByKey(B.getKey()));if(!F)throw new Error("TableCellResizer: Table element not found.");e.current=A,n.current=F.getBoundingClientRect(),a($)},{editor:t}):$==null&&x()}}},y=v=>{p(!0)},L=v=>{p(!1)},R=t.registerRootListener((v,A)=>{A?.removeEventListener("mousemove",S),A?.removeEventListener("mousedown",y),A?.removeEventListener("mouseup",L),v?.addEventListener("mousemove",S),v?.addEventListener("mousedown",y),v?.addEventListener("mouseup",L)});return()=>{R()}},[c,f,t,r,x]);let E=S=>S==="bottom",w=jt(S=>{if(!c)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let y=Wn(c.elem);if(!Ua(y))throw new Error("TableCellResizer: Table cell node not found.");let L=Un(y),R=$g(y),v=L.getChildren(),$=y.getColSpan()===L.getColumnCount()?R:R+y.getRowSpan()-1;if($>=v.length||$<0)throw new Error("Expected table cell to be inside of table row.");let O=v[$];if(!Dg(O))throw new Error("Expected table row");let B=O.getHeight();if(B===void 0){let z=O.getChildren();B=Math.min(...z.map(V=>g(V,t)??1/0))}let F=Math.max(B+S,Hg);O.setHeight(F)},{tag:Ka})},[c,t]),g=(S,y)=>y.getElementByKey(S.getKey())?.clientHeight,b=(S,y)=>{let L;return y.forEach(R=>{R.forEach((v,A)=>{v.cell===S&&(L=A)})}),L},k=jt(S=>{if(!c)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let y=Wn(c.elem);if(!Ua(y))throw new Error("TableCellResizer: Table cell node not found.");let L=Un(y),[R]=Ag(L,null,null),v=b(y,R);if(v===void 0)throw new Error("TableCellResizer: Table column not found.");let A=L.getColWidths();if(!A)return;let $=A[v];if($===void 0)return;let O=[...A],B=Math.max($+S,Ja);O[v]=B,L.setColWidths(O)},{tag:Ka})},[c,t]),_=jt(S=>{let y=L=>{if(L.preventDefault(),L.stopPropagation(),!c)throw new Error("TableCellResizer: Expected active cell.");if(i.current){let{x:R,y:v}=i.current;if(c===null)return;let A=Va(L.target);if(E(S)){let $=(L.clientY-v)/A;w($)}else{let $=(L.clientX-R)/A;k($)}x(),document.removeEventListener("mouseup",y)}};return y},[c,x,k,w]),T=jt(S=>y=>{if(y.preventDefault(),y.stopPropagation(),!c)throw new Error("TableCellResizer: Expected active cell.");i.current={x:y.clientX,y:y.clientY},d(i.current),h(S),document.addEventListener("mouseup",_(S))},[c,_]),[I,N]=Je({bottom:null,left:null,right:null,top:null});return wo(()=>{if(c){let{height:S,left:y,top:L,width:R}=c.elem.getBoundingClientRect(),v=Va(c.elem),A=!!t.getRootElement()?.closest('dialog, [role="dialog"]'),$=A?0:window.scrollX,O=A?0:window.scrollY,B=A?"fixed":"absolute",F=10,z={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${F}px`,left:`${$+y}px`,position:B,top:`${O+L+S-F/2}px`,width:`${R}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${S}px`,left:`${$+y+R-F/2}px`,position:B,top:`${O+L}px`,width:`${F}px`}},V=n.current;f&&u&&V&&(E(f)?(z[f].left=`${$+V.left}px`,z[f].top=`${O+u.y/v}px`,z[f].height="3px",z[f].width=`${V.width}px`):(z[f].top=`${O+V.top}px`,z[f].left=`${$+u.x/v}px`,z[f].width="3px",z[f].height=`${V.height}px`),z[f].backgroundColor="#adf"),N(z)}else N({bottom:null,left:null,right:null,top:null})},[c,f,t,u]),Eo("div",{ref:o,children:c!=null&&!m&&vg(Xa.Fragment,{children:[Eo("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:T("right"),style:I.right||void 0}),Eo("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:T("bottom"),style:I.bottom||void 0})]})})}var Ya=()=>{let t=Rg(7),[e]=Ig(),o=Mg(),[n,r]=Je(null),l,s;t[0]!==e?(l=()=>e.registerRootListener(u=>{r(u?.closest('dialog, [role="dialog"]')??document.body)}),s=[e],t[0]=e,t[1]=l,t[2]=s):(l=t[1],s=t[2]),wo(l,s);let i;return t[3]!==e||t[4]!==o||t[5]!==n?(i=o&&n?jg(Eo(Gg,{editor:e}),n):null,t[3]=e,t[4]=o,t[5]=n,t[6]=i):i=t[6],i};import{c as Yg}from"react/compiler-runtime";import{jsx as Vn,jsxs as Zg,Fragment as qg}from"react/jsx-runtime";import{useLexicalComposerContext as Qg}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as rc}from"@lexical/react/useLexicalEditable";import{$getTableAndElementByKey as e2,$getTableColumnIndexFromTableCellNode as t2,$getTableRowIndexFromTableCellNode as o2,$insertTableColumnAtSelection as n2,$insertTableRowAtSelection as r2,$isTableCellNode as l2,$isTableNode as Qa,getTableElement as i2,TableNode as s2}from"@lexical/table";import{$findMatchingParent as a2,mergeRegister as c2}from"@lexical/utils";import{$getNearestNodeFromDOMNode as ec,isHTMLElement as u2}from"lexical";import{useEffect as tc,useMemo as d2,useRef as oc,useState as So}from"react";import"react";import{createPortal as m2}from"react-dom";import{c as Kg}from"react/compiler-runtime";import{useEffect as Jg,useRef as Xg}from"react";var zg="Expected a function",Ug=Math.max,Wg=Math.min;function Vg(t,e,o){let n,r,l=0,s,i=!1,u=!1,d,c,a,m=!0;if(typeof t!="function")throw new TypeError(zg);e=e||0,typeof o=="object"&&(i=!!o.leading,u="maxWait"in o,d=u?Ug(o.maxWait||0,e):d,m="trailing"in o?!!o.trailing:m);function p(k){let _=n,T=s;return n=s=void 0,l=k,c=t.apply(T,_),c}function f(k){return l=k,a=setTimeout(C,e),i?p(k):c}function h(k){let _=k-r,T=k-l,I=e-_;return u?Wg(I,d-T):I}function x(k){let _=k-r,T=k-l;return r===void 0||_>=e||_<0||u&&T>=d}function C(){let k=Date.now();if(x(k))return E(k);a=setTimeout(C,h(k))}function E(k){return a=void 0,m&&n?p(k):(n=s=void 0,c)}function w(){a!==void 0&&clearTimeout(a),l=0,n=r=s=a=void 0}function g(){return a===void 0?c:E(Date.now())}function b(){let k=Date.now(),_=x(k);if(n=arguments,s=this,r=k,_){if(a===void 0)return f(r);if(u)return clearTimeout(a),a=setTimeout(C,e),p(r)}return a===void 0&&(a=setTimeout(C,e)),c}return b.cancel=w,b.flush=g,b}var Za=Vg;function qa(t,e,o){let n=Kg(6),r=Xg(null),l,s;n[0]!==t||n[1]!==o||n[2]!==e?(l=()=>(r.current=Za(t,e,{maxWait:o}),()=>{r.current?.cancel()}),s=[t,e,o],n[0]=t,n[1]=o,n[2]=e,n[3]=l,n[4]=s):(l=n[3],s=n[4]),Jg(l,s);let i;return n[5]===Symbol.for("react.memo_cache_sentinel")?(i=(...d)=>{let c=d;r.current&&r.current(...c)},n[5]=i):i=n[5],i}var nc=16;function p2({anchorElem:t}){let[e]=Qg(),o=rc(),n=W(),[r,l]=So(!1),[s,i]=So(!1),[u,d]=So(!1),[c,a]=So({}),m=oc(new Set),p=oc(null),f=qa(C=>{let{isOutside:E,tableDOMNode:w}=f2(C,n.editorConfig?.lexical);if(E){l(!1),i(!1);return}if(!w)return;p.current=w;let g=null,b=null,k=null;if(e.getEditorState().read(()=>{let $=ec(w);if(l2($)){let O=a2($,B=>Qa(B));if(!Qa(O))return;if(k=i2(O,e.getElementByKey(O.getKey())),k){let B=O.getChildrenSize(),F=O.getChildAtIndex(0)?.getChildrenSize(),z=o2($),V=t2($);z===B-1?g=$:V===F-1&&(b=$)}}},{editor:e}),!k)return;let _=k.parentElement;if(!_)return;let{bottom:T,height:I,left:N,right:S,width:y,y:L}=k.getBoundingClientRect(),R=!1;_&&_.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(R=_.scrollWidth>_.clientWidth);let{left:v,y:A}=t.getBoundingClientRect();g?(i(!1),l(!0),a({height:nc,left:R&&_?_.offsetLeft:N-v,top:T-A+5,width:R&&_?_.offsetWidth:y})):b&&(i(!0),l(!1),a({height:I,left:S-v+5,top:L-A,width:nc}))},50,250),h=d2(()=>new ResizeObserver(()=>{l(!1),i(!1)}),[]);tc(()=>{if(u)return document.addEventListener("mousemove",f),()=>{l(!1),i(!1),document.removeEventListener("mousemove",f)}},[u,f]),tc(()=>c2(e.registerMutationListener(s2,C=>{e.getEditorState().read(()=>{let E=!1;for(let[w,g]of C)switch(g){case"created":{m.current.add(w),E=!0;break}case"destroyed":{m.current.delete(w),E=!0;break}default:break}if(E){h.disconnect();for(let w of m.current){let{tableElement:g}=e2(w);h.observe(g)}d(m.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,h]);let x=C=>{e.update(()=>{p.current&&(ec(p.current)?.selectEnd(),C?(r2(),l(!1)):(n2(),i(!1)))})};return o?Zg(qg,{children:[r&&Vn("button",{"aria-label":"Add Row",className:n.editorConfig.lexical.theme.tableAddRows,onClick:()=>x(!0),style:{...c},type:"button"}),s&&Vn("button",{"aria-label":"Add Column",className:n.editorConfig.lexical.theme.tableAddColumns,onClick:()=>x(!1),style:{...c},type:"button"})]}):null}function f2(t,e){let o=t.target;if(u2(o)){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 lc(t){let e=Yg(2),{anchorElem:o}=t,n=o===void 0?document.body:o;if(!rc())return null;let l;return e[0]!==n?(l=m2(Vn(p2,{anchorElem:n}),n),e[0]=n,e[1]=l):l=e[1],l}import{jsx as Xn,jsxs as C2}from"react/jsx-runtime";import{useLexicalComposerContext as b2}from"@lexical/react/LexicalComposerContext";import{TablePlugin as k2}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as _2,TableCellNode as T2,TableNode as E2,TableRowNode as w2}from"@lexical/table";import{mergeRegister as S2}from"@lexical/utils";import{$getSelection as N2,$isRangeSelection as L2,$setSelection as y2,COMMAND_PRIORITY_EDITOR as R2,createCommand as v2}from"lexical";import{createContext as I2,use as M2,useCallback as dc,useEffect as mc,useMemo as A2,useRef as $2,useState as No}from"react";import*as pc from"react";import{jsx as te,jsxs as ye}from"react/jsx-runtime";import{useCallback as Kn,useEffect as ic,useRef as Jn,useState as Ht}from"react";import*as cc from"react";import{createPortal as h2}from"react-dom";var sc=10,ac=7;function g2(){return ye("svg",{fill:"none",height:"12",viewBox:"0 0 12 12",width:"12",xmlns:"http://www.w3.org/2000/svg",children:[te("rect",{height:"9",rx:"1",stroke:"currentColor",width:"3",x:"1.5",y:"1.5"}),te("rect",{height:"9",rx:"1",stroke:"currentColor",width:"3",x:"7.5",y:"1.5"})]})}function x2(){return ye("svg",{fill:"none",height:"12",viewBox:"0 0 12 12",width:"12",xmlns:"http://www.w3.org/2000/svg",children:[te("rect",{height:"3",rx:"1",stroke:"currentColor",width:"9",x:"1.5",y:"1.5"}),te("rect",{height:"3",rx:"1",stroke:"currentColor",width:"9",x:"1.5",y:"7.5"})]})}function uc({anchorElem:t,editor:e,isOpen:o,onClose:n,onInsert:r,position:l}){let[s,i]=Ht(0),[u,d]=Ht(0),[c,a]=Ht(""),[m,p]=Ht(""),[f,h]=Ht(null),x=Jn(null),C=Jn(null),E=Jn(null),w=s>0?s:c?parseInt(c,10)||0:5,g=u>0?u:m?parseInt(m,10)||0:5;ic(()=>{o||(i(0),d(0),a(""),p(""),h(null))},[o]),ic(()=>{if(!o)return;let N=S=>{if(S.key==="Escape"&&(S.preventDefault(),S.stopPropagation(),n()),S.key==="Enter"&&f){S.preventDefault();let y=parseInt(c,10),L=parseInt(m,10);y>0&&L>0&&r(y,L)}};return document.addEventListener("keydown",N,!0),()=>document.removeEventListener("keydown",N,!0)},[o,n,r,f,c,m]);let b=Kn((N,S)=>{N>0&&S>0&&r(N,S)},[r]),k=Kn((N,S)=>{i(N),d(S)},[]),_=Kn(()=>{i(0),d(0)},[]);if(!o||!l||!t)return null;let T=[];for(let N=1;N<=ac;N++)for(let S=1;S<=sc;S++){let y=S<=w&&N<=g,L=S<=s&&N<=u,R="table-grid-popup__cell";y&&L?R+=" table-grid-popup__cell--hover":y&&(R+=" table-grid-popup__cell--selected"),T.push(te("div",{"aria-label":`${S} columns, ${N} rows`,className:R,onClick:()=>b(S,N),onKeyDown:v=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),b(S,N))},onMouseEnter:()=>k(S,N),role:"button",tabIndex:-1},`${N}-${S}`))}let I=s>0&&u>0;return h2(ye(cc.Fragment,{children:[te("div",{className:"table-grid-popup__backdrop",onClick:n}),te("div",{className:"table-grid-popup",ref:x,style:{transform:`translate(${l.left}px, ${l.top}px)`},children:ye("div",{className:"table-grid-popup__content",children:[ye("div",{className:"table-grid-popup__header",children:[ye("div",{className:`table-grid-popup__input-group${f==="cols"?" table-grid-popup__input-group--focused":""}`,children:[te("div",{className:"table-grid-popup__input-icon",children:te(g2,{})}),te("input",{"aria-label":"Columns",className:"table-grid-popup__input",min:1,onBlur:()=>h(null),onChange:N=>a(N.target.value),onFocus:()=>h("cols"),placeholder:s>0?String(s):"5",ref:C,type:"number",value:c})]}),te("span",{className:"table-grid-popup__separator",children:"\xD7"}),ye("div",{className:`table-grid-popup__input-group${f==="rows"?" table-grid-popup__input-group--focused":""}`,children:[te("div",{className:"table-grid-popup__input-icon",children:te(x2,{})}),te("input",{"aria-label":"Rows",className:"table-grid-popup__input",min:1,onBlur:()=>h(null),onChange:N=>p(N.target.value),onFocus:()=>h("rows"),placeholder:u>0?String(u):"5",ref:E,type:"number",value:m})]})]}),ye("div",{className:"table-grid-popup__grid",onMouseLeave:_,children:[T,I&&ye("div",{className:"table-grid-popup__tooltip",style:{left:`calc(${(s-.5)/sc*100}%)`,top:`calc(${(u-1)/ac*100}%)`},children:[w," \xD7 ",g]})]})]})})]}),t)}var Lo=v2("OPEN_EMBED_DRAWER_COMMAND"),fc=I2({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function hc({children:t}){let[e,o]=No({cellEditorConfig:null,cellEditorPlugins:null});return Xn(fc,{value:A2(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(n,r)=>{o({cellEditorConfig:n,cellEditorPlugins:r})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var gc=()=>{let[t]=b2(),e=M2(fc),[o,n]=No(!1),[r,l]=No(null),s=$2(null),[i,u]=No(null);mc(()=>{let a=t.getRootElement();if(a){let m=a.closest(".editor")??null;u(m??a.parentElement)}},[t]),mc(()=>{if(!t.hasNodes([E2,w2,T2]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return S2(t.registerCommand(Lo,()=>{let a=i;if(!a)return!0;let m=a.getBoundingClientRect(),p=null;t.getEditorState().read(()=>{let h=N2();if(L2(h)){s.current=h.clone();let x=h.anchor.getNode(),C=t.getElementByKey(x.getKey());if(C){let E=C.getBoundingClientRect();E.height>0&&(p={left:E.left-m.left,top:E.bottom-m.top+8})}}});let f=window.getSelection();if(f&&f.rangeCount>0){let x=f.getRangeAt(0).getBoundingClientRect();x.height>0&&(p={left:x.left-m.left,top:x.bottom-m.top+8})}return p||(p={left:0,top:40}),l(p),n(!0),!0},R2))},[e,t,i]);let d=dc(()=>{n(!1)},[]),c=dc((a,m)=>{n(!1),t.focus(),t.update(()=>{s.current&&y2(s.current.clone())},{discrete:!0,skipTransforms:!0}),setTimeout(()=>{t.dispatchCommand(_2,{columns:String(a),rows:String(m)})},1)},[t]);return C2(pc.Fragment,{children:[Xn(uc,{anchorElem:i,editor:t,isOpen:o,onClose:d,onInsert:c,position:r}),Xn(k2,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]})};var P2=M({markdownTransformers:[Aa],nodes:[O2,D2,F2],plugins:[{Component:gc,position:"normal"},{Component:Ya,position:"normal"},{Component:za,position:"floatingAnchorElem"},{Component:lc,position:"floatingAnchorElem"}],providers:[hc],slashMenu:{groups:[Q([{Icon:Fn,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Lo,{})}}])]},toolbarFixed:{groups:[ke([{ChildComponent:Fn,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Lo,{})}}])]}});import{$isNodeSelection as px}from"lexical";import{jsx as xc}from"react/jsx-runtime";import"react";var B2="M16.2041 6.01074C17.2128 6.113 18 6.96435 18 8V16L17.9893 16.2041C17.8938 17.1457 17.1457 17.8938 16.2041 17.9893L16 18H8C6.96435 18 6.113 17.2128 6.01074 16.2041L6 16V8C6 6.89543 6.89543 6 8 6H16L16.2041 6.01074ZM8 7C7.44772 7 7 7.44772 7 8V16C7 16.5523 7.44772 17 8 17H16C16.5523 17 17 16.5523 17 16V8C17 7.44772 16.5523 7 16 7H8ZM9.72461 11.582C9.91869 11.4539 10.1827 11.4756 10.3535 11.6465L13.8535 15.1465C14.0488 15.3417 14.0488 15.6583 13.8535 15.8535C13.6583 16.0488 13.3417 16.0488 13.1465 15.8535L10 12.707L8.85352 13.8535C8.65825 14.0488 8.34175 14.0488 8.14648 13.8535C7.95122 13.6583 7.95122 13.3417 8.14648 13.1465L9.64648 11.6465L9.72461 11.582ZM14 8C15.1046 8 16 8.89543 16 10C16 11.1046 15.1046 12 14 12C12.8954 12 12 11.1046 12 10C12 8.89543 12.8954 8 14 8ZM14 9C13.4477 9 13 9.44772 13 10C13 10.5523 13.4477 11 14 11C14.5523 11 15 10.5523 15 10C15 9.44772 14.5523 9 14 9Z",Yn=({className:t})=>xc("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:xc("path",{clipRule:"evenodd",d:B2,fill:"currentColor",fillRule:"evenodd"})});import{c as K2}from"react/compiler-runtime";import{jsx as J2}from"react/jsx-runtime";import{useLexicalComposerContext as X2}from"@lexical/react/LexicalComposerContext.js";import{$dfsIterator as yc,$insertNodeToNearestRoot as Qn,mergeRegister as Y2}from"@lexical/utils";import{useBulkUpload as Z2,useEffectEvent as q2,useModal as Q2}from"@payloadcms/ui";import er from"bson-objectid";import{$createRangeSelection as ex,$getPreviousSelection as Ec,$getSelection as wc,$isParagraphNode as tr,$isRangeSelection as Sc,$setSelection as tx,COMMAND_PRIORITY_EDITOR as ox,COMMAND_PRIORITY_LOW as Nc,createCommand as nx,DROP_COMMAND as rx,getDOMSelectionFromTarget as lx,isHTMLElement as Lc,PASTE_COMMAND as ix}from"lexical";import{useEffect as sx}from"react";import{c as Cc}from"react/compiler-runtime";import{jsx as Zn}from"react/jsx-runtime";import{useLexicalComposerContext as bc}from"@lexical/react/LexicalComposerContext.js";import{toast as j2}from"@payloadcms/ui";import{$getNodeByKey as H2,COMMAND_PRIORITY_EDITOR as kc}from"lexical";import{useEffect as _c,useState as G2}from"react";var z2=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=H2(o);r&&r.replace(ve({data:{fields:null,relationTo:e,value:n}}))}):t.dispatchCommand(qn,{fields:null,relationTo:e,value:n})},U2=t=>{let e=Cc(13),{enabledCollectionSlugs:o}=t,[n]=bc(),[r,l]=G2(null),s;e[0]!==o?(s={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=s):s=e[1];let{closeListDrawer:i,ListDrawer:u,openListDrawer:d}=Dt(s),c,a;e[2]!==n||e[3]!==d?(c=()=>n.registerCommand(et,h=>(l(h?.replace?h?.replace.nodeKey:null),d(),!0),kc),a=[n,d],e[2]=n,e[3]=d,e[4]=c,e[5]=a):(c=e[4],a=e[5]),_c(c,a);let m;e[6]!==i||e[7]!==n||e[8]!==r?(m=h=>{let{collectionSlug:x,doc:C}=h;i(),z2({editor:n,relationTo:x,replaceNodeKey:r,value:C.id})},e[6]=i,e[7]=n,e[8]=r,e[9]=m):m=e[9];let p=m,f;return e[10]!==u||e[11]!==p?(f=Zn(u,{onSelect:p}),e[10]=u,e[11]=p,e[12]=f):f=e[12],f},W2=()=>{let t=Cc(3),[e]=bc(),o,n;return t[0]!==e?(o=()=>e.registerCommand(et,V2,kc),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),_c(o,n),null},Tc=({enabledCollectionSlugs:t})=>t?.length?Zn(U2,{enabledCollectionSlugs:t}):Zn(W2,{});function V2(){return j2.error("No upload collections enabled"),!0}function ax(t){let e=t.target;return!!(Lc(e)&&!e.closest("code, span.editor-image")&&Lc(e.parentElement)&&e.parentElement.closest("div.ContentEditable__root"))}function cx(t){let e,o=lx(t.target);if(document.caretRangeFromPoint)e=document.caretRangeFromPoint(t.clientX,t.clientY);else if(t.rangeParent&&o!==null)o.collapse(t.rangeParent,t.rangeOffset||0),e=o.getRangeAt(0);else throw Error("Cannot get the selection when dragging");return e}var qn=nx("INSERT_UPLOAD_COMMAND"),Rc=t=>{let e=K2(20),{clientProps:o}=t,[n]=X2(),r;e[0]!==o.enabledCollectionSlugs?(r={enabledCollectionSlugs:o.enabledCollectionSlugs},e[0]=o.enabledCollectionSlugs,e[1]=r):r=e[1];let{enabledCollectionSlugs:l}=po(r),{modalSlug:s,setCollectionSlug:i,setInitialForms:u,setOnCancel:d,setOnSuccess:c,setSelectableCollections:a}=Z2(),{isModalOpen:m,openModal:p}=Q2(),f;e[2]!==s||e[3]!==n||e[4]!==l||e[5]!==m||e[6]!==p||e[7]!==i||e[8]!==u||e[9]!==d||e[10]!==c||e[11]!==a?(f=w=>{let{files:g}=w;if(g?.length!==0&&(u(b=>[...b??[],...g.map(ux)]),!m(s))){if(!l.length||!l[0])return;i(l[0]),a(l),d(()=>{n.update(dx)}),c(b=>{let k=new Map(b.map(mx));n.update(()=>{for(let _ of yc()){let T=_.node;if(ot(T)){let I=T.getData();if(I?.pending){let N=k.get(I.pending?.formID);N&&T.replace(ve({data:{id:new er.default().toHexString(),fields:{},relationTo:N.collectionSlug,value:N.doc.id}}))}}}})}),p(s)}},e[2]=s,e[3]=n,e[4]=l,e[5]=m,e[6]=p,e[7]=i,e[8]=u,e[9]=d,e[10]=c,e[11]=a,e[12]=f):f=e[12];let h=q2(f),x;e[13]!==n||e[14]!==h?(x=()=>{if(!n.hasNodes([tt]))throw new Error("UploadPlugin: UploadNode not registered on editor");return Y2(n.registerNodeTransform(tt,w=>{let g=w.getData();if(!g?.pending)return;(async function(){let _=null,T=g?.pending?.src,I=g?.pending?.formID;if(T?.startsWith("data:")){let N=T.match(/data:(image\/[a-zA-Z]+);base64,/),S=N?N[1]:"image/png",y=T.replace(/^data:image\/[a-zA-Z]+;base64,/,""),L=atob(y),R=new Array(L.length);for(let $=0;$<L.length;$++)R[$]=L.charCodeAt($);let v=new Uint8Array(R);_={alt:void 0,file:new File([v],"pasted-image."+S?.split("/",2)[1],{type:S}),formID:I}}else if(T?.startsWith("http")||T?.startsWith("https")){let S=await(await fetch(T)).blob(),y=T.split("/").pop()||"pasted-image"+S.type.split("/",2)[1];_={alt:void 0,file:new File([S],y,{type:S.type}),formID:I}}_&&h({files:[_]})})()}),n.registerCommand(qn,w=>(n.update(()=>{let g=wc()||Ec();if(Sc(g)){let b=ve({data:{id:w.id,fields:w.fields,relationTo:w.relationTo,value:w.value}}),{focus:k}=g,_=k.getNode();Qn(b),tr(_)&&!_.__first&&_.remove()}}),!0),ox),n.registerCommand(ix,w=>{if(!(w instanceof ClipboardEvent))return!1;let g=w.clipboardData;if(!g?.types?.length||g?.types?.includes("text/html"))return!1;let b=[];return g?.files?.length&&Array.from(g.files).forEach(k=>{b.push({alt:"",file:k,formID:new er.default().toHexString()})}),b.length?(n.update(()=>{let k=wc()||Ec();if(Sc(k))for(let _ of b){let T=ve({data:{pending:{formID:_.formID,src:URL.createObjectURL(_.file)}}}),{focus:I}=k,N=I.getNode();Qn(T),tr(N)&&!N.__first&&N.remove()}}),h({files:b}),!0):!1},Nc),n.registerCommand(rx,w=>{if(!(w instanceof DragEvent))return!1;let g=w.dataTransfer;if(!g?.types?.length)return!1;let b=[];return g?.files?.length&&Array.from(g.files).forEach(k=>{b.push({alt:"",file:k,formID:new er.default().toHexString()})}),b.length?(w.preventDefault(),w.stopPropagation(),n.update(()=>{if(ax(w)){let k=cx(w),_=ex();k!=null&&_.applyDOMRange(k),tx(_);for(let T of b){let I=ve({data:{pending:{formID:T.formID,src:URL.createObjectURL(T.file)}}}),{focus:N}=_,S=N.getNode();Qn(I),tr(S)&&!S.__first&&S.remove()}}}),h({files:b}),!0):!1},Nc))},e[13]=n,e[14]=h,e[15]=x):x=e[15];let C;e[16]!==n?(C=[n],e[16]=n,e[17]=C):C=e[17],sx(x,C);let E;return e[18]!==l?(E=J2(Tc,{enabledCollectionSlugs:l}),e[18]=l,e[19]=E):E=e[19],E};function ux(t){return{file:t.file,formID:t.formID}}function dx(){for(let t of yc()){let e=t.node;ot(e)&&e.getData()?.pending&&e.remove()}}function mx(t){return[t.formID,t]}var fx=M({nodes:[tt],plugins:[{Component:Rc,position:"normal"}],slashMenu:{groups:[Q([{Icon:Yn,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(et,{replace:!1})}}])]},toolbarFixed:{groups:[ke([{ChildComponent:Yn,isActive:({selection:t})=>{if(!px(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return ot(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(et,{replace:!1})}}])]}});import{c as gx}from"react/compiler-runtime";import{jsx as yo}from"react/jsx-runtime";import{createElement as xx}from"react";import{ShimmerEffect as Cx,useConfig as bx}from"@payloadcms/ui";import{lazy as kx,Suspense as _x,useEffect as Tx,useState as Ex}from"react";var vc={block:"LexicalEditorTheme__block",blockCursor:"LexicalEditorTheme__blockCursor",characterLimit:"LexicalEditorTheme__characterLimit",code:"LexicalEditorTheme__code",inlineBlock:"LexicalEditorTheme__inlineBlock",heading:{h1:"LexicalEditorTheme__h1",h2:"LexicalEditorTheme__h2",h3:"LexicalEditorTheme__h3",h4:"LexicalEditorTheme__h4",h5:"LexicalEditorTheme__h5",h6:"LexicalEditorTheme__h6"},hr:"LexicalEditorTheme__hr",hrSelected:"LexicalEditorTheme__hrSelected",indent:"LexicalEditorTheme__indent",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",placeholder:"LexicalEditorTheme__placeholder",quote:"LexicalEditorTheme__quote",relationship:"LexicalEditorTheme__relationship",root:"LexicalEditorTheme",rtl:"LexicalEditorTheme__rtl",tab:"LexicalEditorTheme__tabNode",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableAlignment:{center:"LexicalEditorTheme__tableAlignmentCenter",right:"LexicalEditorTheme__tableAlignmentRight"},tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableFrozenColumn:"LexicalEditorTheme__tableFrozenColumn",tableRowStriping:"LexicalEditorTheme__tableRowStriping",tableScrollableWrapper:"LexicalEditorTheme__tableScrollableWrapper",tableSelected:"LexicalEditorTheme__tableSelected",tableSelection:"LexicalEditorTheme__tableSelection",text:{bold:"LexicalEditorTheme__textBold",code:"LexicalEditorTheme__textCode",italic:"LexicalEditorTheme__textItalic",strikethrough:"LexicalEditorTheme__textStrikethrough",subscript:"LexicalEditorTheme__textSubscript",superscript:"LexicalEditorTheme__textSuperscript",underline:"LexicalEditorTheme__textUnderline",underlineStrikethrough:"LexicalEditorTheme__textUnderlineStrikethrough"},upload:"LexicalEditorTheme__upload"};var or={namespace:"lexical",theme:vc};function Ic({config:t,featureClientImportMap:e,featureClientSchemaMap:o,field:n,schemaPath:r,unSanitizedEditorConfig:l}){let s=new Map,i=[];for(let c of l.features){if(!c?.clientFeatureProps?.featureKey||c?.clientFeatureProps?.order===void 0||c?.clientFeatureProps?.order===null){console.warn("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. Skipping feature.");continue}s.set(c.clientFeatureProps.featureKey,c),i.push(c)}l.features=i,l.features=l.features.sort((c,a)=>c.clientFeatureProps.order-a.clientFeatureProps.order);let u=new Map,d=0;for(let c of l.features){let a=typeof c.feature=="function"?c.feature({config:t,featureClientImportMap:e,featureClientSchemaMap:o,featureProviderMap:s,field:n,resolvedFeatures:u,schemaPath:r,unSanitizedEditorConfig:l}):c.feature;a.key=c.clientFeatureProps.featureKey,a.order=d,u.set(c.clientFeatureProps.featureKey,a),d++}return u}import{deepMerge as hx}from"payload/shared";var Mc=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}},o={};if(t.forEach(n=>{n.key==="toolbarFixed"&&n.sanitizedClientFeatureProps?.customGroups&&(o={...o,...n.sanitizedClientFeatureProps.customGroups})}),!t?.size)return e;t.forEach(n=>{if(n.providers?.length&&(e.providers=e.providers.concat(n.providers)),n.enableFormats?.length&&e.enabledFormats.push(...n.enableFormats),n.nodes?.length)for(let r of n.nodes)e.nodes.push(r);if(n.plugins?.length&&n.plugins.forEach((r,l)=>{e.plugins?.push({clientProps:n.sanitizedClientFeatureProps,Component:r.Component,key:n.key+l,position:r.position})}),n.toolbarInline?.groups?.length)for(let r of n.toolbarInline.groups){let l=e.toolbarInline.groups.find(s=>s.key===r.key);l?e.toolbarInline.groups=e.toolbarInline.groups.filter(s=>s.key!==r.key):l={...r,items:[]},r?.items?.length&&(l.items=l.items.concat(r.items)),e.toolbarInline?.groups.push(l)}if(n.toolbarFixed?.groups?.length)for(let r of n.toolbarFixed.groups){let l=e.toolbarFixed.groups.find(s=>s.key===r.key);l?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(s=>s.key!==r.key):l={...r,items:[]},r?.items?.length&&(l.items=l.items.concat(r.items)),e.toolbarFixed?.groups.push(l)}if(n.slashMenu?.groups){n.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(n.slashMenu.dynamicGroups));for(let r of n.slashMenu.groups){let l=e.slashMenu.groups.find(s=>s.key===r.key);l?e.slashMenu.groups=e.slashMenu.groups.filter(s=>s.key!==r.key):l={...r,items:[]},r?.items?.length&&(l.items=l.items.concat(r.items)),e.slashMenu.groups.push(l)}}if(n.markdownTransformers?.length)for(let r of n.markdownTransformers)typeof r=="function"?e.markdownTransformers.push(r({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(r);e.enabledFeatures.push(n.key)}),Object.keys(o).length>0&&(e.toolbarFixed.groups=e.toolbarFixed.groups.map(n=>{let r=o[n.key];return r?hx(n,r):n})),e.toolbarInline.groups.sort((n,r)=>n.order&&r.order?n.order-r.order:n.order?-1:r.order?1:0),e.toolbarFixed.groups.sort((n,r)=>n.order&&r.order?n.order-r.order:n.order?-1:r.order?1:0);for(let n of e.toolbarInline.groups)n.items.sort((r,l)=>r.order&&l.order?r.order-l.order:r.order?-1:l.order?1:0);for(let n of e.toolbarFixed.groups)n.items.sort((r,l)=>r.order&&l.order?r.order-l.order:r.order?-1:l.order?1:0);return e};function nr(t,e,o,n){return{admin:o,features:Mc(t),lexical:e,resolvedFeatureMap:t,view:n}}var wx=kx(()=>import("./Field-BPLEYPXV.js").then(t=>({default:t.RichText}))),Sx=t=>yo(Bo,{inheritable:!0,views:t.views,children:yo(Nx,{...t})}),Nx=t=>{let e=gx(23),{admin:o,clientFeatures:n,featureClientImportMap:r,featureClientSchemaMap:l,field:s,lexicalEditorConfig:i,schemaPath:u,views:d}=t,c;e[0]!==o?(c=o===void 0?{}:o,e[0]=o,e[1]=c):c=e[1];let a=c,m;e[2]!==r?(m=r===void 0?{}:r,e[2]=r,e[3]=m):m=e[3];let p=m,f=i===void 0?or:i,{currentView:h}=jo(),x=d?.[h]?.admin??a,C=d?.[h]?.lexical,E;e[4]!==f||e[5]!==C?(E=typeof C=="function"?C(f):C??f,e[4]=f,e[5]=C,e[6]=E):E=e[6];let w=E,{config:g}=bx(),[b,k]=Ex(null),_,T;e[7]!==n||e[8]!==g||e[9]!==h||e[10]!==x||e[11]!==w||e[12]!==p||e[13]!==l||e[14]!==s||e[15]!==b||e[16]!==u||e[17]!==d?(_=()=>{if(b&&b.view===h)return;let N=d?.[h],S=N?.filterFeatures?N.filterFeatures(n):n,y=[];for(let R of Object.values(S))!R.clientFeatureProvider||!R.clientFeatureProps||y.push(R.clientFeatureProvider(R.clientFeatureProps));let L=Ic({config:g,featureClientImportMap:p,featureClientSchemaMap:l,field:s,schemaPath:u??s.name,unSanitizedEditorConfig:{features:y,lexical:w}});k(nr(L,w,x,h))},T=[x,n,g,p,l,s,b,w,u,h,d],e[7]=n,e[8]=g,e[9]=h,e[10]=x,e[11]=w,e[12]=p,e[13]=l,e[14]=s,e[15]=b,e[16]=u,e[17]=d,e[18]=_,e[19]=T):(_=e[18],T=e[19]),Tx(_,T);let I;return e[20]!==b||e[21]!==t?(I=yo(_x,{fallback:yo(Cx,{height:"35vh"}),children:b&&xx(wx,{...t,editorConfig:b,key:b.view})}),e[20]=b,e[21]=t,e[22]=I):I=e[22],I};function Lx(...t){return t.filter(Boolean).join(" ")}var yx=t=>(e,o,n)=>{let r=t(n);r&&(r.append(...o),e.replace(r),r.select(0,0))};var Ro=new WeakMap;function Ac(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function vo(t,e){let o=Ro.get(t);if(o===void 0){let n=new Set,r=s=>{o!==void 0&&(o.start=Ac(s))},l=s=>{if(o===void 0)return;let{start:i}=o;if(i===null)return;let u=Ac(s);for(let d of n)u!==null&&d([u[0]-i[0],u[1]-i[1]],s)};t.addEventListener("touchstart",r),t.addEventListener("touchend",l),o={handleTouchend:l,handleTouchstart:r,listeners:n,start:null},Ro.set(t,o)}return o.listeners.add(e),()=>{Rx(t,e)}}function Rx(t,e){let o=Ro.get(t);if(o===void 0)return;let{listeners:n}=o;n.delete(e),n.size===0&&(Ro.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function vx(t,e){return vo(t,(o,n)=>{let[r,l]=o;r<0&&-r>Math.abs(l)&&e(r,n)})}function Ix(t,e){return vo(t,(o,n)=>{let[r,l]=o;r>0&&r>Math.abs(l)&&e(r,n)})}function Mx(t,e){return vo(t,(o,n)=>{let[r,l]=o;l<0&&-l>Math.abs(r)&&e(r,n)})}function Ax(t,e){return vo(t,(o,n)=>{let[r,l]=o;l>0&&l>Math.abs(r)&&e(r,n)})}import{c as $x}from"react/compiler-runtime";import{jsx as Dx}from"react/jsx-runtime";import"react";var Ox=()=>{let t=$x(2),{EditButton:e}=Ce(),o;return t[0]!==e?(o=e?Dx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Fx}from"react/compiler-runtime";import{jsx as Px}from"react/jsx-runtime";import"react";var Bx=()=>{let t=Fx(2),{RemoveButton:e}=Ce(),o;return t[0]!==e?(o=e?Px(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as jx}from"react/compiler-runtime";import{jsx as Hx}from"react/jsx-runtime";import"react";var Gx=()=>{let t=jx(2),{Label:e}=Ce(),o;return t[0]!==e?(o=e?Hx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as zx}from"react/compiler-runtime";import{jsx as Ux}from"react/jsx-runtime";import"react";var Wx=t=>{let e=zx(3),{children:o}=t,{InlineBlockContainer:n}=Ce(),r;return e[0]!==n||e[1]!==o?(r=n?Ux(n,{children:o}):null,e[0]=n,e[1]=o,e[2]=r):r=e[2],r};import{jsx as Vx}from"react/jsx-runtime";import"react";var Kx=t=>{let{children:e,...o}=t,{BlockCollapsible:n}=ce();return n?Vx(n,{...o,children:e}):null};import{c as Jx}from"react/compiler-runtime";import{jsx as Xx}from"react/jsx-runtime";import"react";var Yx=()=>{let t=Jx(2),{EditButton:e}=ce(),o;return t[0]!==e?(o=e?Xx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Zx}from"react/compiler-runtime";import{jsx as qx}from"react/jsx-runtime";import"react";var Qx=()=>{let t=Zx(2),{RemoveButton:e}=ce(),o;return t[0]!==e?(o=e?qx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as eC}from"qs-esm";var tC=({apiURL:t,depth:e,draft:o,locale:n})=>async({id:l,collectionSlug:s,select:i})=>{let u=eC({depth:e??0,draft:o??!1,locale:n,select:i},{addQueryPrefix:!0});return await fetch(`${t}/${s}/${l}${u}`,{credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json"},method:"GET"}).then(c=>c.json())};var $c={customEndRegex:{optional:!0,regExp:/[ \t]*```$/},customStartRegex:/^[ \t]*```(\w+)?/,doNotTrimChildren:!0,export:({fields:t})=>!t.code.includes(`
|
|
57
|
+
`,Ks="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",Js="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",P0=new RegExp("^[^"+Js+"]*["+Ks+"]"),B0=new RegExp("^[^"+Ks+"]*["+Js+"]"),j0={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},H0={directionless:O.IS_DIRECTIONLESS,unmergeable:O.IS_UNMERGEABLE},G0={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},U0={[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"},z0={normal:O.IS_NORMAL,segmented:O.IS_SEGMENTED,token:O.IS_TOKEN},W0={[O.IS_NORMAL]:"normal",[O.IS_SEGMENTED]:"segmented",[O.IS_TOKEN]:"token"};var Xs={text:({node:t})=>{let e=t.text;return t.format&O.IS_BOLD&&(e=Ue("strong",{children:e})),t.format&O.IS_ITALIC&&(e=Ue("em",{children:e})),t.format&O.IS_STRIKETHROUGH&&(e=Ue("span",{style:{textDecoration:"line-through"},children:e})),t.format&O.IS_UNDERLINE&&(e=Ue("span",{style:{textDecoration:"underline"},children:e})),t.format&O.IS_CODE&&(e=Ue("code",{children:e})),t.format&O.IS_SUBSCRIPT&&(e=Ue("sub",{children:e})),t.format&O.IS_SUPERSCRIPT&&(e=Ue("sup",{children:e})),e}};import{jsx as Ot}from"react/jsx-runtime";var Ys={upload:({node:t})=>{let e=t;if(typeof e.value!="object")return null;let o=e.value,n=e.fields?.alt||o?.alt||"",r=o.url;if(!o.mimeType.startsWith("image"))return Ot("a",{href:r,rel:"noopener noreferrer",children:o.filename});if(!o.variants||!Object.keys(o.variants).length)return Ot("img",{alt:n,height:o.height,src:r,width:o.width});let l=[];for(let s in o.variants){let i=o.variants[s];if(!i||!i.width||!i.height||!i.mimeType||!i.filesize||!i.filename||!i.url)continue;let u=i?.url;l.push(Ot("source",{media:`(max-width: ${i.width}px)`,srcSet:u,type:i.mimeType},s))}return l.push(Ot("img",{alt:n,height:o?.height,src:r,width:o?.width},"image")),Ot("picture",{children:l})}};var ut={...zs,...Xs,...Bs,...$s,...Vs,...Fs,...Ps,...Us,...Hs({}),...Ys,...Ws};import{jsx as xo,Fragment as V0}from"react/jsx-runtime";import go from"react";function Zs(t){if(!!!t?.root?.children?.length)return!1;let o=!1;if(t?.root?.children?.length===1&&t?.root?.children[0]?.type==="paragraph"){let n=t?.root?.children[0];if(!n?.children||n?.children?.length===0)o=!0;else if(n?.children?.length===1){let r=n?.children[0];r?.type==="text"&&(r?.text?.length||(o=!0))}}return!o}function K0(t){return e=>{let o={...e,isEditor:!1,isJSXConverter:!0};if(t.Component)return t.Component(o);if(t.html){let n=typeof t.html=="function"?t.html(o):t.html;return xo("span",{dangerouslySetInnerHTML:{__html:n}})}return null}}function qs(t){return e=>{if(t.Component){let o={...e,isEditor:!1,isJSXConverter:!0};return t.Component(o)}if(t.Block){let o=e.node,n={childIndex:e.childIndex,converters:e.converters,formData:o.fields??{},isEditor:!1,isJSXConverter:!0,node:o,nodesToJSX:e.nodesToJSX,parent:e.parent};return go.createElement(t.Block,n)}if(t.html){let o={...e,isEditor:!1,isJSXConverter:!0},n=typeof t.html=="function"?t.html(o):t.html;return xo("span",{dangerouslySetInnerHTML:{__html:n}})}return null}}function J0(t){let e={};for(let[o,n]of Object.entries(t)){if(!n||typeof n!="object")continue;if(o==="blocks"){e.blocks={};for(let[l,s]of Object.entries(n)){let i=s;(i.Component||i.Block||i.html)&&(e.blocks[l]=qs(i))}continue}if(o==="inlineBlocks"){e.inlineBlocks={};for(let[l,s]of Object.entries(n)){let i=s;(i.Component||i.Block||i.html)&&(e.inlineBlocks[l]=qs(i))}continue}let r=n;(r.Component||r.html)&&(e[o]=K0(r))}return e}function Qs({converters:t,data:e,disableIndent:o,disableTextAlign:n,nodeMap:r}){if(Zs(e)){let l=r?J0(r):void 0,s=l?{...t,...l,blocks:{...t.blocks,...l.blocks},inlineBlocks:{...t.inlineBlocks,...l.inlineBlocks}}:t;return ea({converters:s,disableIndent:o,disableTextAlign:n,nodes:e.root.children,parent:e.root})}return xo(V0,{})}function ea({converters:t,disableIndent:e,disableTextAlign:o,nodes:n,parent:r}){let l=t.unknown;return n.map((i,u)=>{let d;i.type==="block"?(d=t?.blocks?.[i?.fields?.blockType],!d&&!l&&console.error(`Lexical => JSX converter: Blocks converter: found ${i?.fields?.blockType} block, but no converter is provided`)):i.type==="inlineBlock"?(d=t?.inlineBlocks?.[i?.fields?.blockType],!d&&!l&&console.error(`Lexical => JSX converter: Inline Blocks converter: found ${i?.fields?.blockType} inline block, but no converter is provided`)):d=t[i.type];try{!d&&l&&(d=l);let c;d?c=typeof d=="function"?d({childIndex:u,converters:t,node:i,nodesToJSX:f=>ea({converters:f.converters??t,disableIndent:f.disableIndent??e,disableTextAlign:f.disableTextAlign??o,nodes:f.nodes,parent:f.parent??{...i,parent:r}}),parent:r}):d:c=xo("span",{children:"unknown node"},u);let a={};if(!o&&(!Array.isArray(o)||!o?.includes(i.type))&&"format"in i&&i.format)switch(i.format){case"center":a.textAlign="center";break;case"end":a.textAlign="right";break;case"justify":a.textAlign="justify";break;case"left":break;case"right":a.textAlign="right";break;case"start":a.textAlign="left";break}if(!e&&(!Array.isArray(e)||!e?.includes(i.type))&&"indent"in i&&i.indent&&i.type!=="listitem"&&(a.paddingInlineStart=`${Number(i.indent)*40}px`),go.isValidElement(c)){if(a.textAlign||a.paddingInlineStart){let m={...a,...c?.props?.style??{}};return go.cloneElement(c,{key:u,style:m})}return go.cloneElement(c,{key:u})}return c}catch(c){return console.error("Error converting lexical node to JSX:",c,"node:",i),null}}).filter(Boolean)}function Fn({className:t,converters:e,data:o,disableContainer:n,disableIndent:r,disableTextAlign:l,nodeMap:s}){if(!o)return null;let i=e,u={};i?typeof i=="function"?u=i({defaultConverters:ut}):u=i:u=ut;let d=o&&!Array.isArray(o)&&typeof o=="object"&&"root"in o&&Qs({converters:u,data:o,disableIndent:r,disableTextAlign:l,nodeMap:s});return n?ta(X0,{children:d}):ta("div",{className:t??"payload-richtext",children:d})}function na(){let t=Y0(7),[e]=Z0(),o;t[0]!==e?(o=()=>e.getEditorState().toJSON(),t[0]=e,t[1]=o):o=t[1];let[n,r]=Q0(o),l,s;t[2]!==e?(l=()=>e.registerUpdateListener(u=>{let{editorState:d}=u;r(d.toJSON())}),s=[e],t[2]=e,t[3]=l,t[4]=s):(l=t[3],s=t[4]),q0(l,s);let i;return t[5]!==n?(i=oa("div",{className:"debug-jsx-converter",children:oa(Fn,{converters:ut,data:n})}),t[5]=n,t[6]=i):i=t[6],i}var eh=A({plugins:[{Component:na,position:"bottom"}]});var G={amber:{50:"oklch(0.987 0.022 95.277)",100:"oklch(0.962 0.059 95.617)",200:"oklch(0.924 0.12 95.746)",300:"oklch(0.879 0.169 91.605)",400:"oklch(0.828 0.189 84.429)",500:"oklch(0.769 0.188 70.08)",600:"oklch(0.666 0.179 58.318)",700:"oklch(0.555 0.163 48.998)",800:"oklch(0.473 0.137 46.201)",900:"oklch(0.414 0.112 45.904)",950:"oklch(0.279 0.077 45.635)"},black:"#000",blue:{50:"oklch(0.97 0.014 254.604)",100:"oklch(0.932 0.032 255.585)",200:"oklch(0.882 0.059 254.128)",300:"oklch(0.809 0.105 251.813)",400:"oklch(0.707 0.165 254.624)",500:"oklch(0.623 0.214 259.815)",600:"oklch(0.546 0.245 262.881)",700:"oklch(0.488 0.243 264.376)",800:"oklch(0.424 0.199 265.638)",900:"oklch(0.379 0.146 265.522)",950:"oklch(0.282 0.091 267.935)"},current:"currentColor",cyan:{50:"oklch(0.984 0.019 200.873)",100:"oklch(0.956 0.045 203.388)",200:"oklch(0.917 0.08 205.041)",300:"oklch(0.865 0.127 207.078)",400:"oklch(0.789 0.154 211.53)",500:"oklch(0.715 0.143 215.221)",600:"oklch(0.609 0.126 221.723)",700:"oklch(0.52 0.105 223.128)",800:"oklch(0.45 0.085 224.283)",900:"oklch(0.398 0.07 227.392)",950:"oklch(0.302 0.056 229.695)"},emerald:{50:"oklch(0.979 0.021 166.113)",100:"oklch(0.95 0.052 163.051)",200:"oklch(0.905 0.093 164.15)",300:"oklch(0.845 0.143 164.978)",400:"oklch(0.765 0.177 163.223)",500:"oklch(0.696 0.17 162.48)",600:"oklch(0.596 0.145 163.225)",700:"oklch(0.508 0.118 165.612)",800:"oklch(0.432 0.095 166.913)",900:"oklch(0.378 0.077 168.94)",950:"oklch(0.262 0.051 172.552)"},fuchsia:{50:"oklch(0.977 0.017 320.058)",100:"oklch(0.952 0.037 318.852)",200:"oklch(0.903 0.076 319.62)",300:"oklch(0.833 0.145 321.434)",400:"oklch(0.74 0.238 322.16)",500:"oklch(0.667 0.295 322.15)",600:"oklch(0.591 0.293 322.896)",700:"oklch(0.518 0.253 323.949)",800:"oklch(0.452 0.211 324.591)",900:"oklch(0.401 0.17 325.612)",950:"oklch(0.293 0.136 325.661)"},gray:{50:"oklch(0.985 0.002 247.839)",100:"oklch(0.967 0.003 264.542)",200:"oklch(0.928 0.006 264.531)",300:"oklch(0.872 0.01 258.338)",400:"oklch(0.707 0.022 261.325)",500:"oklch(0.551 0.027 264.364)",600:"oklch(0.446 0.03 256.802)",700:"oklch(0.373 0.034 259.733)",800:"oklch(0.278 0.033 256.848)",900:"oklch(0.21 0.034 264.665)",950:"oklch(0.13 0.028 261.692)"},green:{50:"oklch(0.982 0.018 155.826)",100:"oklch(0.962 0.044 156.743)",200:"oklch(0.925 0.084 155.995)",300:"oklch(0.871 0.15 154.449)",400:"oklch(0.792 0.209 151.711)",500:"oklch(0.723 0.219 149.579)",600:"oklch(0.627 0.194 149.214)",700:"oklch(0.527 0.154 150.069)",800:"oklch(0.448 0.119 151.328)",900:"oklch(0.393 0.095 152.535)",950:"oklch(0.266 0.065 152.934)"},indigo:{50:"oklch(0.962 0.018 272.314)",100:"oklch(0.93 0.034 272.788)",200:"oklch(0.87 0.065 274.039)",300:"oklch(0.785 0.115 274.713)",400:"oklch(0.673 0.182 276.935)",500:"oklch(0.585 0.233 277.117)",600:"oklch(0.511 0.262 276.966)",700:"oklch(0.457 0.24 277.023)",800:"oklch(0.398 0.195 277.366)",900:"oklch(0.359 0.144 278.697)",950:"oklch(0.257 0.09 281.288)"},inherit:"inherit",lime:{50:"oklch(0.986 0.031 120.757)",100:"oklch(0.967 0.067 122.328)",200:"oklch(0.938 0.127 124.321)",300:"oklch(0.897 0.196 126.665)",400:"oklch(0.841 0.238 128.85)",500:"oklch(0.768 0.233 130.85)",600:"oklch(0.648 0.2 131.684)",700:"oklch(0.532 0.157 131.589)",800:"oklch(0.453 0.124 130.933)",900:"oklch(0.405 0.101 131.063)",950:"oklch(0.274 0.072 132.109)"},neutral:{50:"oklch(0.985 0 0)",100:"oklch(0.97 0 0)",200:"oklch(0.922 0 0)",300:"oklch(0.87 0 0)",400:"oklch(0.708 0 0)",500:"oklch(0.556 0 0)",600:"oklch(0.439 0 0)",700:"oklch(0.371 0 0)",800:"oklch(0.269 0 0)",900:"oklch(0.205 0 0)",950:"oklch(0.145 0 0)"},orange:{50:"oklch(0.98 0.016 73.684)",100:"oklch(0.954 0.038 75.164)",200:"oklch(0.901 0.076 70.697)",300:"oklch(0.837 0.128 66.29)",400:"oklch(0.75 0.183 55.934)",500:"oklch(0.705 0.213 47.604)",600:"oklch(0.646 0.222 41.116)",700:"oklch(0.553 0.195 38.402)",800:"oklch(0.47 0.157 37.304)",900:"oklch(0.408 0.123 38.172)",950:"oklch(0.266 0.079 36.259)"},pink:{50:"oklch(0.971 0.014 343.198)",100:"oklch(0.948 0.028 342.258)",200:"oklch(0.899 0.061 343.231)",300:"oklch(0.823 0.12 346.018)",400:"oklch(0.718 0.202 349.761)",500:"oklch(0.656 0.241 354.308)",600:"oklch(0.592 0.249 0.584)",700:"oklch(0.525 0.223 3.958)",800:"oklch(0.459 0.187 3.815)",900:"oklch(0.408 0.153 2.432)",950:"oklch(0.284 0.109 3.907)"},purple:{50:"oklch(0.977 0.014 308.299)",100:"oklch(0.946 0.033 307.174)",200:"oklch(0.902 0.063 306.703)",300:"oklch(0.827 0.119 306.383)",400:"oklch(0.714 0.203 305.504)",500:"oklch(0.627 0.265 303.9)",600:"oklch(0.558 0.288 302.321)",700:"oklch(0.496 0.265 301.924)",800:"oklch(0.438 0.218 303.724)",900:"oklch(0.381 0.176 304.987)",950:"oklch(0.291 0.149 302.717)"},red:{50:"oklch(0.971 0.013 17.38)",100:"oklch(0.936 0.032 17.717)",200:"oklch(0.885 0.062 18.334)",300:"oklch(0.808 0.114 19.571)",400:"oklch(0.704 0.191 22.216)",500:"oklch(0.637 0.237 25.331)",600:"oklch(0.577 0.245 27.325)",700:"oklch(0.505 0.213 27.518)",800:"oklch(0.444 0.177 26.899)",900:"oklch(0.396 0.141 25.723)",950:"oklch(0.258 0.092 26.042)"},rose:{50:"oklch(0.969 0.015 12.422)",100:"oklch(0.941 0.03 12.58)",200:"oklch(0.892 0.058 10.001)",300:"oklch(0.81 0.117 11.638)",400:"oklch(0.712 0.194 13.428)",500:"oklch(0.645 0.246 16.439)",600:"oklch(0.586 0.253 17.585)",700:"oklch(0.514 0.222 16.935)",800:"oklch(0.455 0.188 13.697)",900:"oklch(0.41 0.159 10.272)",950:"oklch(0.271 0.105 12.094)"},sky:{50:"oklch(0.977 0.013 236.62)",100:"oklch(0.951 0.026 236.824)",200:"oklch(0.901 0.058 230.902)",300:"oklch(0.828 0.111 230.318)",400:"oklch(0.746 0.16 232.661)",500:"oklch(0.685 0.169 237.323)",600:"oklch(0.588 0.158 241.966)",700:"oklch(0.5 0.134 242.749)",800:"oklch(0.443 0.11 240.79)",900:"oklch(0.391 0.09 240.876)",950:"oklch(0.293 0.066 243.157)"},slate:{50:"oklch(0.984 0.003 247.858)",100:"oklch(0.968 0.007 247.896)",200:"oklch(0.929 0.013 255.508)",300:"oklch(0.869 0.022 252.894)",400:"oklch(0.704 0.04 256.788)",500:"oklch(0.554 0.046 257.417)",600:"oklch(0.446 0.043 257.281)",700:"oklch(0.372 0.044 257.287)",800:"oklch(0.279 0.041 260.031)",900:"oklch(0.208 0.042 265.755)",950:"oklch(0.129 0.042 264.695)"},stone:{50:"oklch(0.985 0.001 106.423)",100:"oklch(0.97 0.001 106.424)",200:"oklch(0.923 0.003 48.717)",300:"oklch(0.869 0.005 56.366)",400:"oklch(0.709 0.01 56.259)",500:"oklch(0.553 0.013 58.071)",600:"oklch(0.444 0.011 73.639)",700:"oklch(0.374 0.01 67.558)",800:"oklch(0.268 0.007 34.298)",900:"oklch(0.216 0.006 56.043)",950:"oklch(0.147 0.004 49.25)"},teal:{50:"oklch(0.984 0.014 180.72)",100:"oklch(0.953 0.051 180.801)",200:"oklch(0.91 0.096 180.426)",300:"oklch(0.855 0.138 181.071)",400:"oklch(0.777 0.152 181.912)",500:"oklch(0.704 0.14 182.503)",600:"oklch(0.6 0.118 184.704)",700:"oklch(0.511 0.096 186.391)",800:"oklch(0.437 0.078 188.216)",900:"oklch(0.386 0.063 188.416)",950:"oklch(0.277 0.046 192.524)"},transparent:"transparent",violet:{50:"oklch(0.969 0.016 293.756)",100:"oklch(0.943 0.029 294.588)",200:"oklch(0.894 0.057 293.283)",300:"oklch(0.811 0.111 293.571)",400:"oklch(0.702 0.183 293.541)",500:"oklch(0.606 0.25 292.717)",600:"oklch(0.541 0.281 293.009)",700:"oklch(0.491 0.27 292.581)",800:"oklch(0.432 0.232 292.759)",900:"oklch(0.38 0.189 293.745)",950:"oklch(0.283 0.141 291.089)"},white:"#fff",yellow:{50:"oklch(0.987 0.026 102.212)",100:"oklch(0.973 0.071 103.193)",200:"oklch(0.945 0.129 101.54)",300:"oklch(0.905 0.182 98.111)",400:"oklch(0.852 0.199 91.936)",500:"oklch(0.795 0.184 86.047)",600:"oklch(0.681 0.162 75.834)",700:"oklch(0.554 0.135 66.442)",800:"oklch(0.476 0.114 61.907)",900:"oklch(0.421 0.095 57.708)",950:"oklch(0.286 0.066 53.813)"},zinc:{50:"oklch(0.985 0 0)",100:"oklch(0.967 0.001 286.375)",200:"oklch(0.92 0.004 286.32)",300:"oklch(0.871 0.006 286.286)",400:"oklch(0.705 0.015 286.067)",500:"oklch(0.552 0.016 285.938)",600:"oklch(0.442 0.017 285.786)",700:"oklch(0.37 0.013 285.805)",800:"oklch(0.274 0.006 286.033)",900:"oklch(0.21 0.006 285.885)",950:"oklch(0.141 0.005 285.823)"}},th={text:{"text-red":{css:{color:`light-dark(${G.red[600]}, ${G.red[400]})`},label:"Red"},"text-orange":{css:{color:`light-dark(${G.orange[600]}, ${G.orange[400]})`},label:"Orange"},"text-yellow":{css:{color:`light-dark(${G.yellow[700]}, ${G.yellow[300]})`},label:"Yellow"},"text-green":{css:{color:`light-dark(${G.green[700]}, ${G.green[400]})`},label:"Green"},"text-blue":{css:{color:`light-dark(${G.blue[600]}, ${G.blue[400]})`},label:"Blue"},"text-purple":{css:{color:`light-dark(${G.purple[600]}, ${G.purple[400]})`},label:"Purple"},"text-pink":{css:{color:`light-dark(${G.pink[600]}, ${G.pink[400]})`},label:"Pink"}},background:{"bg-red":{css:{"background-color":`light-dark(${G.red[400]}, ${G.red[600]})`},label:"Red"},"bg-orange":{css:{"background-color":`light-dark(${G.orange[400]}, ${G.orange[600]})`},label:"Orange"},"bg-yellow":{css:{"background-color":`light-dark(${G.yellow[300]}, ${G.yellow[700]})`},label:"Yellow"},"bg-green":{css:{"background-color":`light-dark(${G.green[400]}, ${G.green[700]})`},label:"Green"},"bg-blue":{css:{"background-color":`light-dark(${G.blue[400]}, ${G.blue[600]})`},label:"Blue"},"bg-purple":{css:{"background-color":`light-dark(${G.purple[400]}, ${G.purple[600]})`},label:"Purple"},"bg-pink":{css:{"background-color":`light-dark(${G.pink[400]}, ${G.pink[600]})`},label:"Pink"}}};import{$isNodeSelection as Wh}from"lexical";import{jsx as ra}from"react/jsx-runtime";import"react";var oh="M9.5 6C9.77614 6 10 6.22386 10 6.5C10 6.77614 9.77614 7 9.5 7H7.5C7.22386 7 7 7.22386 7 7.5V16.5C7 16.7761 7.22386 17 7.5 17H16.5C16.7761 17 17 16.7761 17 16.5V14.5C17 14.2239 17.2239 14 17.5 14C17.7761 14 18 14.2239 18 14.5V16.5C18 17.3284 17.3284 18 16.5 18H7.5C6.67157 18 6 17.3284 6 16.5V7.5C6 6.67157 6.67157 6 7.5 6H9.5ZM17.5 6C17.7761 6 18 6.22386 18 6.5V11.5C18 11.7761 17.7761 12 17.5 12C17.2239 12 17 11.7761 17 11.5V7.70703L12.8535 11.8535C12.6583 12.0488 12.3417 12.0488 12.1465 11.8535C11.9512 11.6583 11.9512 11.3417 12.1465 11.1465L16.293 7H12.5C12.2239 7 12 6.77614 12 6.5C12 6.22386 12.2239 6 12.5 6H17.5Z",Pn=({className:t})=>ra("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:ra("path",{d:oh,fill:"currentColor"})});import{jsx as sh}from"react/jsx-runtime";import{$applyNodeReplacement as ah}from"lexical";import*as ia from"react";import{DecoratorBlockNode as nh}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as rh}from"@lexical/utils";import{$applyNodeReplacement as lh}from"lexical";function ih(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:la({relationTo:o,value:e})}:null}var Ft=class extends nh{__data;constructor({data:e,format:o,key:n}){super(o,n),this.__data=e}static clone(e){return new this({data:e.__data,format:e.__format,key:e.__key})}static getType(){return"relationship"}static importDOM(){return{div:e=>!e.hasAttribute("data-lexical-relationship-relationTo")||!e.hasAttribute("data-lexical-relationship-id")?null:{conversion:ih,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},n=la(o);return n.setFormat(e.format),n}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return rh(o,e?.theme?.relationship),o}decorate(e,o){return null}exportDOM(){let e=document.createElement("div");e.setAttribute("data-lexical-relationship-id",String(typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value)),e.setAttribute("data-lexical-relationship-relationTo",this.__data?.relationTo);let o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"relationship",version:2}}getData(){return this.getLatest().__data}getTextContent(){return`${this.__data?.relationTo} relation to ${typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value}`}setData(e){let o=this.getWritable();o.__data=e}};function la(t){return lh(new Ft({data:t}))}var ch=ia.lazy(()=>import("./RelationshipComponent-YCPAKOL7.js").then(t=>({default:t.RelationshipComponent})));function uh(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:ze({relationTo:o,value:e})}:null}var we=class extends Ft{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{div:e=>!e.hasAttribute("data-lexical-relationship-relationTo")||!e.hasAttribute("data-lexical-relationship-id")?null:{conversion:uh,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},n=ze(o);return n.setFormat(e.format),n}decorate(e,o){return sh(ch,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function ze(t){return ah(new we({data:t}))}function Bn(t){return t instanceof we}import{c as Ah}from"react/compiler-runtime";import{jsx as Dh}from"react/jsx-runtime";import{useLexicalComposerContext as $h}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Oh}from"@lexical/utils";import{$getPreviousSelection as Fh,$getSelection as Ph,$isParagraphNode as Bh,$isRangeSelection as jh,COMMAND_PRIORITY_EDITOR as Hh,createCommand as Gh}from"lexical";import{useEffect as Uh}from"react";import{c as ca}from"react/compiler-runtime";import{jsx as jn}from"react/jsx-runtime";import{useLexicalComposerContext as ua}from"@lexical/react/LexicalComposerContext.js";import{toast as Th}from"@payloadcms/ui";import{$getNodeByKey as Eh,COMMAND_PRIORITY_EDITOR as da}from"lexical";import{useEffect as ma,useState as wh}from"react";import{c as dh}from"react/compiler-runtime";import{jsx as mh}from"react/jsx-runtime";import{useLexicalComposerContext as fh}from"@lexical/react/LexicalComposerContext";import{useListDrawer as ph,useModal as hh}from"@payloadcms/ui";import{$getNodeByKey as sa,$getPreviousSelection as gh,$getRoot as xh,$getSelection as Ch,$isRangeSelection as bh,$setSelection as kh}from"lexical";import{useEffect as _h,useState as aa}from"react";var Pt=t=>{let e=dh(23),[o]=fh(),[n,r]=aa(null),[l,s]=aa(!1),[i,u,d]=ph(t),{closeDrawer:c,drawerSlug:a,isDrawerOpen:m,openDrawer:f}=d,{modalState:h}=hh(),p;e[0]===Symbol.for("react.memo_cache_sentinel")?(p=()=>{let N=Ch()??gh();r(N)},e[0]=p):p=e[0];let g=p,C;e[1]!==o||e[2]!==n?(C=()=>{n&&o.update(()=>{if(bh(n)){let{anchor:N,focus:w}=n;sa(N.key)&&sa(w.key)&&kh(n.clone())}else xh().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=n,e[3]=C):C=e[3];let E=C,L;e[4]!==c?(L=()=>{c()},e[4]=c,e[5]=L):L=e[5];let x=L,b,k;e[6]!==a||e[7]!==h||e[8]!==E||e[9]!==l?(b=()=>{if(!l)return;let N=h[a];N&&!N?.isOpen&&(s(!1),setTimeout(()=>{E()},1))},k=[h,a,E,l],e[6]=a,e[7]=h,e[8]=E,e[9]=l,e[10]=b,e[11]=k):(b=e[10],k=e[11]),_h(b,k);let _;e[12]!==u?(_=N=>mh(u,{...N,onClick:()=>{g()}}),e[12]=u,e[13]=_):_=e[13];let T;e[14]!==f?(T=()=>{g(),f(),s(!0)},e[14]=f,e[15]=T):T=e[15];let I;return e[16]!==i||e[17]!==x||e[18]!==m||e[19]!==a||e[20]!==_||e[21]!==T?(I={closeListDrawer:x,isListDrawerOpen:m,ListDrawer:i,listDrawerSlug:a,ListDrawerToggler:_,openListDrawer:T},e[16]=i,e[17]=x,e[18]=m,e[19]=a,e[20]=_,e[21]=T,e[22]=I):I=e[22],I};var Sh=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=Eh(o);r&&r.replace(ze({relationTo:e,value:n}))}):t.dispatchCommand(Hn,{relationTo:e,value:n})},Nh=t=>{let e=ca(14),{enabledCollectionSlugs:o}=t,[n]=ua(),[r,l]=wh(null),s=o?.[0],i;e[0]!==o||e[1]!==s?(i={collectionSlugs:o,selectedCollection:s},e[0]=o,e[1]=s,e[2]=i):i=e[2];let{closeListDrawer:u,ListDrawer:d,openListDrawer:c}=Pt(i),a,m;e[3]!==n||e[4]!==c?(a=()=>n.registerCommand(Qe,g=>(l(g?.replace?g?.replace.nodeKey:null),c(),!0),da),m=[n,c],e[3]=n,e[4]=c,e[5]=a,e[6]=m):(a=e[5],m=e[6]),ma(a,m);let f;e[7]!==u||e[8]!==n||e[9]!==r?(f=g=>{let{collectionSlug:C,doc:E}=g;Sh({editor:n,relationTo:C,replaceNodeKey:r,value:E.id}),u()},e[7]=u,e[8]=n,e[9]=r,e[10]=f):f=e[10];let h=f,p;return e[11]!==d||e[12]!==h?(p=jn(d,{onSelect:h}),e[11]=d,e[12]=h,e[13]=p):p=e[13],p},Lh=()=>{let t=ca(3),[e]=ua(),o,n;return t[0]!==e?(o=()=>e.registerCommand(Qe,yh,da),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),ma(o,n),null},fa=({enabledCollectionSlugs:t})=>t?.length?jn(Nh,{enabledCollectionSlugs:t}):jn(Lh,{});function yh(){return Th.error("No relationship collections enabled"),!0}import{c as Rh}from"react/compiler-runtime";import{useConfig as vh,useEntityVisibility as Ih}from"@payloadcms/ui";import"react";var Co=t=>{let e=Rh(11),{enabledCollectionSlugs:o}=t,{config:n}=vh(),{collections:r}=n,{visibleEntities:l}=Ih(),s,i;if(e[0]!==r||e[1]!==o||e[2]!==l){let d;e[5]!==o||e[6]!==l?(d=a=>{let{slug:m}=a;return o.includes(m)&&(!l?.collections||l.collections.includes(m))},e[5]=o,e[6]=l,e[7]=d):d=e[7];let c=r.filter(d);s=c,i=c.map(Mh),e[0]=r,e[1]=o,e[2]=l,e[3]=s,e[4]=i}else s=e[3],i=e[4];let u;return e[8]!==s||e[9]!==i?(u={enabledCollections:s,enabledCollectionSlugs:i},e[8]=s,e[9]=i,e[10]=u):u=e[10],u};function Mh(t){return t.slug}var Hn=Gh("INSERT_RELATIONSHIP_COMMAND"),pa=t=>{let e=Ah(7),{clientProps:o}=t,[n]=$h(),r;e[0]!==o.enabledCollectionSlugs?(r={enabledCollectionSlugs:o.enabledCollectionSlugs},e[0]=o.enabledCollectionSlugs,e[1]=r):r=e[1];let{enabledCollectionSlugs:l}=Co(r),s,i;e[2]!==n?(s=()=>{if(!n.hasNodes([we]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return n.registerCommand(Hn,zh,Hh)},i=[n],e[2]=n,e[3]=s,e[4]=i):(s=e[3],i=e[4]),Uh(s,i);let u;return e[5]!==l?(u=Dh(fa,{enabledCollectionSlugs:l}),e[5]=l,e[6]=u):u=e[6],u};function zh(t){let e=Ph()||Fh();if(jh(e)){let o=ze(t),{focus:n}=e,r=n.getNode();Oh(o),Bh(r)&&!r.__first&&r.remove()}return!0}var Vh=A({nodes:[we],plugins:[{Component:pa,position:"normal"}],slashMenu:{groups:[Z([{Icon:Pn,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Qe,{replace:!1})}}])]},toolbarFixed:{groups:[be([{ChildComponent:Pn,isActive:({selection:t})=>{if(!Wh(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Bn(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Qe,{replace:!1})}}])]}});import{c as L5}from"react/compiler-runtime";import{jsx as he,jsxs as y5}from"react/jsx-runtime";import{useLexicalComposerContext as R5}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as Na}from"@lexical/react/useLexicalEditable";import{useScrollInfo as v5,useThrottledEffect as I5,useTranslation as M5}from"@payloadcms/ui";import*as La from"react";import{useMemo as Vn}from"react";import{jsx as Kh,jsxs as Jh}from"react/jsx-runtime";import{Tooltip as Xh,useTranslation as Yh}from"@payloadcms/ui";import{$addUpdateTag as Zh}from"lexical";import{useCallback as ha,useEffect as qh,useMemo as ga,useRef as Qh,useState as e5}from"react";var Gn="toolbar-popup__button",Bt=({active:t=!1,children:e,editor:o,enabled:n=!0,item:r})=>{let{i18n:l}=Yh(),{fieldProps:{featureClientSchemaMap:s,schemaPath:i}}=W(),[u,d]=e5(!1),c=Qh(null);qh(()=>{c.current?.removeAttribute("data-pressing")},[t]);let a=ga(()=>r.label?typeof r.label=="function"?r.label({featureClientSchemaMap:s,i18n:l,schemaPath:i}):r.label:r.key.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^./,p=>p.toUpperCase()),[s,l,i,r]),m=ga(()=>[Gn,n?"":"disabled",t?"active":"",r.key?`${Gn}-${r.key}`:""].filter(Boolean).join(" "),[t,n,r.key]),f=ha(()=>{n&&o.focus(()=>{o.update(()=>{Zh("toolbar")}),r.onSelect?.({editor:o,isActive:t})})},[o,r,t,n]),h=ha(p=>{p.preventDefault(),p.currentTarget.setAttribute("data-pressing","")},[]);return Jh("button",{"aria-label":a,"aria-pressed":r.isActive?t:void 0,className:m,"data-button-key":r.key,disabled:!n,onClick:f,onMouseDown:h,onPointerEnter:()=>d(!0),onPointerLeave:()=>{d(!1),c.current?.removeAttribute("data-pressing")},ref:c,type:"button",children:[Kh(Xh,{className:`${Gn}__tooltip`,show:u,children:a}),e]})};import{c as s5}from"react/compiler-runtime";import{jsx as dt}from"react/jsx-runtime";import a5,{useMemo as c5}from"react";import{useTranslation as u5}from"@payloadcms/ui";import{jsx as We,jsxs as xa}from"react/jsx-runtime";import{Button as t5}from"@payloadcms/ui";import{$addUpdateTag as o5,isDOMNode as n5}from"lexical";import zn,{useCallback as r5,useEffect as ko,useId as l5,useMemo as ba,useRef as bo,useState as Un}from"react";var Ca="toolbar-popup__dropdown-item",ka=zn.createContext(null);function _a({active:t,children:e,editor:o,enabled:n,Icon:r,item:l,itemKey:s,tooltip:i}){let u=ba(()=>[Ca,n===!1?"disabled":"",t?"active":"",l?.key?`${Ca}-${l.key}`:""].filter(Boolean).join(" "),[n,t,l.key]),d=bo(null),c=zn.use(ka);if(c===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=c;return ko(()=>{d?.current!=null&&a(d)},[d,a]),We(t5,{"aria-label":i,buttonStyle:"ghost",className:u,disabled:n===!1,extraButtonProps:{"aria-checked":l.isActive?!!t:void 0,"data-item-key":s,role:l.isActive?"menuitemcheckbox":"menuitem",tabIndex:-1},icon:r,iconPosition:"left",onClick:()=>{n!==!1&&o.focus(()=>{o.update(()=>{o5("toolbar")}),l.onSelect?.({editor:o,isActive:t})})},onMouseDown:m=>{m.preventDefault()},ref:d,tooltip:i,type:"button",children:e})}function i5({id:t,children:e,dropdownKey:o,dropDownRef:n,itemsContainerClassNames:r,onClose:l,shouldAutoFocus:s}){let[i,u]=Un(),[d,c]=Un(),a=r5(h=>{u(p=>p!=null?[...p,h]:[h])},[u]),m=h=>{if(i==null)return;let{key:p}=h,g=i.filter(C=>!C.current?.disabled);["ArrowDown","ArrowUp","Escape"].includes(p)&&h.preventDefault(),p==="Escape"?l():p==="Tab"?setTimeout(()=>l({restoreFocus:!1})):p==="ArrowUp"?c(C=>{if(C==null)return g[0];let E=g.indexOf(C)-1;return g[E===-1?g.length-1:E]}):p==="ArrowDown"&&c(C=>{if(C==null)return g[0];let E=g.indexOf(C);return g[E===g.length-1?0:E+1]})},f=ba(()=>({registerItem:a}),[a]);return ko(()=>{s&&i!=null&&d==null&&c(i.find(h=>!h.current?.disabled)),d!=null&&d?.current!=null&&d.current.focus()},[i,d,s]),We(ka,{value:f,children:We("div",{className:(r??["toolbar-popup__dropdown-items"]).join(" "),"data-dropdown-key":o,"data-theme":"dark",id:t,onKeyDown:m,popover:"manual",ref:n,role:"menu",tabIndex:-1,children:e})})}function Ta({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:n=!1,dropdownKey:r,Icon:l,itemsContainerClassNames:s,label:i,stopCloseOnClickSelf:u}){let d=bo(null),c=bo(null),a=bo(!1),m=l5(),f=`toolbar-dropdown-${r}-${m}`,[h,p]=Un(!1),g=({restoreFocus:C=!0}={})=>{p(!1),C&&c?.current!=null&&c.current.focus()};return ko(()=>{let C=c.current,E=d.current;if(h&&C!==null&&E!==null){E.matches(":popover-open")||E.showPopover();let L=()=>{let{bottom:x,left:b,top:k}=C.getBoundingClientRect(),_=8,T=5,I=x+T,N=k-E.offsetHeight-T,w=Math.max(_,window.innerHeight-E.offsetHeight-_),y=I+E.offsetHeight+_<=window.innerHeight?I:N>=_?N:I;E.style.position="fixed",E.style.top=`${Math.max(_,Math.min(y,w))}px`,E.style.left=`${Math.max(8,Math.min(b-5,window.innerWidth-E.offsetWidth-20))}px`};return L(),window.addEventListener("resize",L),window.addEventListener("scroll",L,{capture:!0,passive:!0}),()=>{window.removeEventListener("resize",L),window.removeEventListener("scroll",L,{capture:!0})}}},[d,c,h]),ko(()=>{let C=c.current;if(C!==null&&h){let E=L=>{let x=L.target;n5(x)&&(u&&d.current&&d.current.contains(x)||C.contains(x)||p(!1))};return document.addEventListener("click",E),()=>{document.removeEventListener("click",E)}}},[d,c,h,u]),xa(zn.Fragment,{children:[xa("button",{"aria-controls":f,"aria-expanded":h,"aria-haspopup":"menu","aria-label":t,className:e+(h?" active":""),"data-dropdown-key":r,disabled:n,onClick:C=>{C.preventDefault(),a.current=!1,p(!h)},onKeyDown:C=>{(C.key==="Enter"||C.key===" ")&&(C.preventDefault(),a.current=!0,p(!h))},onMouseDown:C=>{C.preventDefault()},ref:c,type:"button",children:[l&&We(l,{}),i&&We("span",{className:"toolbar-popup__dropdown-label",children:i}),We("i",{className:"toolbar-popup__dropdown-caret"})]}),h&&We(i5,{dropdownKey:r,dropDownRef:d,id:f,itemsContainerClassNames:s,onClose:g,shouldAutoFocus:a.current,children:o})]})}var Wn="toolbar-popup__dropdown",d5=t=>{let e=s5(15),{active:o,anchorElem:n,editor:r,enabled:l,iconOnly:s,item:i}=t,{i18n:u}=u5(),{fieldProps:d}=W(),{featureClientSchemaMap:c,schemaPath:a}=d;if(i.Component){let f;return e[0]!==o||e[1]!==n||e[2]!==r||e[3]!==l||e[4]!==i?(f=i?.Component&&dt(i.Component,{active:o,anchorElem:n,editor:r,enabled:l,item:i},i.key),e[0]=o,e[1]=n,e[2]=r,e[3]=l,e[4]=i,e[5]=f):f=e[5],f}let m;if(e[6]!==o||e[7]!==r||e[8]!==l||e[9]!==c||e[10]!==u||e[11]!==s||e[12]!==i||e[13]!==a){let f=i.key,h;i.label&&(f=typeof i.label=="function"?i.label({featureClientSchemaMap:c,i18n:u,schemaPath:a}):i.label),f.length>25?h=f.substring(0,25)+"...":h=f,m=dt(_a,{active:o,editor:r,enabled:l,Icon:i?.ChildComponent?dt(i.ChildComponent,{}):void 0,item:i,itemKey:i.key,tooltip:s?f:void 0,children:dt("span",{className:"text",children:h})},i.key),e[6]=o,e[7]=r,e[8]=l,e[9]=c,e[10]=u,e[11]=s,e[12]=i,e[13]=a,e[14]=m}else m=e[14];return m},m5=a5.memo(d5),jt=({anchorElem:t,classNames:e,editor:o,group:n,groupState:r,Icon:l,itemsContainerClassNames:s,label:i})=>{let{items:u,key:d}=n,c=c5(()=>u?.length?u.map(a=>dt(m5,{active:r.activeItemKeys.includes(a.key),anchorElem:t,editor:o,enabled:r.enabledItemKeys.includes(a.key),iconOnly:n.iconOnly,item:a},a.key)):null,[u,r.activeItemKeys,r.enabledItemKeys,t,o]);return dt(Ta,{buttonAriaLabel:`${d} dropdown`,buttonClassName:[Wn,`${Wn}-${d}`,...e||[]].filter(Boolean).join(" "),disabled:!r.enabledGroup,dropdownKey:d,Icon:l,itemsContainerClassNames:[`${Wn}-items`,...s||[]],label:i,children:c},d)};import{mergeRegister as f5}from"@lexical/utils";import{$getSelection as p5}from"lexical";import{useCallback as h5,useDeferredValue as g5,useEffect as x5,useRef as Ea,useState as C5}from"react";function b5(t){let e=new Map,o=new Map;if(!t?.length)return{groupStates:o,itemStates:e};for(let n of t){let r=[];for(let l of n.items)e.set(l.key,{active:!1,enabled:!0}),r.push(l.key);o.set(n.key,{activeItemKeys:[],activeItems:[],enabledGroup:!0,enabledItemKeys:r})}return{groupStates:o,itemStates:e}}function _o(t,e){let[o,n]=C5(()=>b5(e)),r=g5(o),l=W(),s=Ea(l);s.current=l;let i=Ea(e);i.current=e;let u=Ar(),d=h5(()=>{t.getEditorState().read(()=>{let c=p5();if(!c)return;let a=i.current;if(!a?.length)return;let m=s.current,f=new Map,h=new Map;for(let p of a){let g=[],C=[],E=[],L=p.type==="dropdown"?p.maxActiveItems??1:void 0;for(let b of p.items){let k=b.isActive?(!L||g.length<L)&&b.isActive({editor:t,editorConfigContext:m,selection:c}):!1,_=b.isEnabled?b.isEnabled({editor:t,editorConfigContext:m,selection:c}):!0;k&&(g.push(b.key),C.push(b)),_&&E.push(b.key),f.set(b.key,{active:k,enabled:_})}let x=p.type==="dropdown"&&p.isEnabled?p.isEnabled({editor:t,editorConfigContext:m,selection:c}):!0;h.set(p.key,{activeItemKeys:g,activeItems:C,enabledGroup:x,enabledItemKeys:E})}n({groupStates:h,itemStates:f})})},[t]);return x5(()=>{u(d);let c=()=>{u(d)},a=f5(t.registerUpdateListener(c));return document.addEventListener("mouseup",c),()=>{a(),document.removeEventListener("mouseup",c)}},[t,u,d]),r}import{c as k5}from"react/compiler-runtime";import{useEffect as _5}from"react";var T5=".fixed-toolbar__scroll",E5=40;function w5({clientWidth:t,deltaMode:e,deltaY:o,isRightToLeft:n}){let r=e===1?o*E5:e===2?o*t:o;return n?-r:r}function wa(t){if(!(Math.abs(t.deltaY)>Math.abs(t.deltaX)))return;let o=t.target;if(!(o instanceof Element))return;let n=o.closest(T5);!n||!(n.scrollWidth>n.clientWidth)||(t.preventDefault(),n.scrollLeft+=w5({clientWidth:n.clientWidth,deltaMode:t.deltaMode,deltaY:t.deltaY,isRightToLeft:getComputedStyle(n).direction==="rtl"}))}var mt=0;function Sa(){let t=k5(1),e;t[0]===Symbol.for("react.memo_cache_sentinel")?(e=[],t[0]=e):e=t[0],_5(S5,e)}function S5(){return mt===0&&document.addEventListener("wheel",wa,{passive:!1}),mt=mt+1,N5}function N5(){mt=mt-1,mt===0&&document.removeEventListener("wheel",wa)}function A5({active:t,anchorElem:e,editor:o,enabled:n,item:r}){return r.Component?r?.Component&&he(r.Component,{anchorElem:e,editor:o,item:r},r.key):r.ChildComponent?he(Bt,{active:t,editor:o,enabled:n,item:r,children:he(r.ChildComponent,{})},r.key):null}function D5({anchorElem:t,editor:e,editorConfig:o,group:n,index:r,toolbarStates:l}){let{i18n:s}=M5(),{fieldProps:{featureClientSchemaMap:i,schemaPath:u}}=W(),d=l.groupStates.get(n.key),c=Vn(()=>{if(n.type!=="dropdown")return;let m=d?.activeItems?.[0];return m?m.ChildComponent:n.ChildComponent},[n,d?.activeItems]),a=Vn(()=>{if(n.type!=="dropdown")return;let m=d?.activeItems;if(!m?.length)return;if(m.length>1)return s.t("lexical:general:toolbarItemsActive",{count:m.length});let f=m[0],h=f.key;return f.label&&(h=typeof f.label=="function"?f.label({featureClientSchemaMap:i,i18n:s,schemaPath:u}):f.label),h.length>25&&(h=h.substring(0,25)+"..."),h},[n,d?.activeItems,s,i,u]);return y5("div",{className:`fixed-toolbar__group fixed-toolbar__group-${n.key}`,"data-toolbar-group-key":n.key,children:[n.type==="dropdown"&&n.items.length&&d?he(jt,{anchorElem:t,editor:e,group:n,groupState:d,Icon:c,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a}):null,n.type==="buttons"&&n.items.length?n.items.map(m=>{let f=l.itemStates.get(m.key);return he(A5,{active:f?.active??!1,anchorElem:t,editor:e,enabled:f?.enabled??!0,item:m},m.key)}):null,r<o.features.toolbarFixed?.groups.length-1&&he("div",{className:"divider"})]},n.key)}function $5({anchorElem:t,clientProps:e,editor:o,editorConfig:n,parentWithFixedToolbar:r}){let l=La.useRef(null),s=Na(),{y:i}=v5();Sa();let u=_o(o,n?.features?.toolbarFixed?.groups),d=Vn(()=>{if(!r||e?.disableIfParentHasFixedToolbar)return null;let a=r.editorContainerRef.current.previousElementSibling;for(;a;){if(a.classList.contains("fixed-toolbar"))return a;a=a.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,r]);return I5(()=>{if(!d)return;let c=l.current;if(!c)return;let a=c.getBoundingClientRect(),m=d.getBoundingClientRect();if(!(a.bottom<m.top||a.top>m.bottom))c.classList.remove("fixed-toolbar"),c.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),d.classList.remove("fixed-toolbar"),d.classList.add("fixed-toolbar","fixed-toolbar--hide");else{if(!c.classList.contains("fixed-toolbar--overlapping"))return;c.classList.remove("fixed-toolbar--overlapping"),c.classList.add("fixed-toolbar"),d.classList.remove("fixed-toolbar--hide"),d.classList.add("fixed-toolbar")}},50,[l,d,i]),he("div",{className:"fixed-toolbar",onFocus:c=>{c.stopPropagation()},ref:l,children:s&&he("div",{className:"fixed-toolbar__scroll",children:n?.features&&n.features?.toolbarFixed?.groups.map((c,a)=>he(D5,{anchorElem:t,editor:o,editorConfig:n,group:c,index:a,toolbarStates:u},c.key))})})}var ya=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return ya(t.parentEditor)}return!1},Ra=t=>{let e=L5(6),{clientProps:o}=t,[n]=R5(),r=W();if(!Na())return null;let{editorConfig:s}=r,i=o.applyToFocusedEditor&&r.focusedEditor?.editor||n,u=o.applyToFocusedEditor&&r.focusedEditor?.editorConfig||s,d,c;if(e[0]!==o||e[1]!==i||e[2]!==u||e[3]!==r){c=Symbol.for("react.early_return_sentinel");e:{let a=ya(r);if(o?.disableIfParentHasFixedToolbar&&a){c=null;break e}if(!u?.features?.toolbarFixed?.groups?.length){c=null;break e}d=he($5,{anchorElem:document.body,clientProps:o,editor:i,editorConfig:u,parentWithFixedToolbar:a})}e[0]=o,e[1]=i,e[2]=u,e[3]=r,e[4]=d,e[5]=c}else d=e[4],c=e[5];return c!==Symbol.for("react.early_return_sentinel")?c:d};var O5=A({plugins:[{Component:Ra,position:"aboveContainer"}]});import{c as F5}from"react/compiler-runtime";import{jsx as Se,jsxs as Ma}from"react/jsx-runtime";import{useLexicalComposerContext as P5}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as B5}from"@lexical/react/useLexicalEditable";import{mergeRegister as Aa}from"@lexical/utils";import{$getSelection as Da,$isRangeSelection as va,$isTextNode as j5,$onUpdate as H5,COMMAND_PRIORITY_LOW as G5,getDOMSelection as $a,SELECTION_CHANGE_COMMAND as U5}from"lexical";import{useCallback as Eo,useEffect as Ht,useMemo as z5,useRef as Ia,useState as W5}from"react";import"react";import{createPortal as V5}from"react-dom";function Kn(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 To(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:n=0,floatingElem:r,horizontalOffset:l=32,horizontalPosition:s="left",specialHandlingForCaret:i=!1,targetRect:u,verticalGap:d=10}=t,c=o.parentElement;if(u===null||c==null){r.style.opacity="0",r.style.transform="translate(-10000px, -10000px)";return}let a=r.getBoundingClientRect(),m=o.getBoundingClientRect(),f=c.getBoundingClientRect(),h=u.top-a.height-d,p=u.left-l;s==="center"&&(p=u.left+u.width/2-a.width/2);let g=0;return!e&&h<f.top&&!i&&(g=a.height+u.height+d*2,h+=g),s==="center"?p+a.width>f.right?p=f.right-a.width-l:p<f.left&&(p=f.left+l):p+a.width>f.right&&(p=f.right-a.width-l),p-=m.left,r.style.opacity="1",i&&n!==0?(h-=m.bottom-n+a.height-3,r.style.transform=`translate(${p}px, ${h}px) rotate(180deg)`):(h-=m.top,r.style.transform=`translate(${p}px, ${h}px)`),g}function K5({active:t,anchorElem:e,editor:o,enabled:n,item:r}){return r.Component?r?.Component&&Se(r.Component,{anchorElem:e,editor:o,item:r},r.key):r.ChildComponent?Se(Bt,{active:t,editor:o,enabled:n,item:r,children:Se(r.ChildComponent,{})},r.key):null}function J5({anchorElem:t,editor:e,group:o,index:n,toolbarStates:r}){let{editorConfig:l}=W(),s=r.groupStates.get(o.key),i=z5(()=>o.type!=="dropdown"?void 0:s?.activeItems?.[0]?.ChildComponent??o.ChildComponent,[o,s?.activeItems]);return Ma("div",{className:`inline-toolbar-popup__group inline-toolbar-popup__group-${o.key}`,"data-toolbar-group-key":o.key,children:[o.type==="dropdown"&&o.items.length&&s?Se(jt,{anchorElem:t,editor:e,group:o,groupState:s,Icon:i}):null,o.type==="buttons"&&o.items.length?o.items.map(u=>{let d=r.itemStates.get(u.key);return Se(K5,{active:d?.active??!1,anchorElem:t,editor:e,enabled:d?.enabled??!0,item:u},u.key)}):null,n<l.features.toolbarInline?.groups.length-1&&Se("div",{className:"divider"})]},o.key)}function X5({anchorElem:t,editor:e}){let o=Ia(null),n=Ia(null),{editorConfig:r}=W(),l=_o(e,r?.features?.toolbarInline?.groups),s=Eo(()=>{if(o?.current){let c=o.current.style.opacity==="0",a=o.current.style.pointerEvents==="none";c||(o.current.style.opacity="0"),a||(o.current.style.pointerEvents="none")}},[o]),i=Eo(c=>{if(o?.current&&(c.buttons===1||c.buttons===3)){let a=o.current.style.opacity==="0",m=o.current.style.pointerEvents==="none";if(!a||!m){let f=c.clientX,h=c.clientY,p=document.elementFromPoint(f,h);o.current.contains(p)||s()}}},[s]),u=Eo(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);Ht(()=>(document.addEventListener("mousemove",i),document.addEventListener("mouseup",u),()=>{document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",u)}),[o,i,u]);let d=Eo(()=>{let c=Da(),a=$a(e._window);if(o.current===null)return;let m=t.querySelector(":scope > .link-editor"),f=m!==null&&"style"in m&&m?.style?.opacity==="1",h=e.getRootElement();if(c!==null&&a!==null&&!a.isCollapsed&&h!==null&&h.contains(a.anchorNode)){let p=Kn(a,h),g=To({alwaysDisplayOnTop:f,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:p});n.current&&To({anchorElem:o.current,anchorFlippedOffset:g,floatingElem:n.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:p,verticalGap:8})}else s()},[e,s,t]);return Ht(()=>{let c=t.parentElement,a=()=>{e.getEditorState().read(()=>{d()})};return window.addEventListener("resize",a),c&&c.addEventListener("scroll",a),()=>{window.removeEventListener("resize",a),c&&c.removeEventListener("scroll",a)}},[e,d,t]),Ht(()=>(e.getEditorState().read(()=>{d()}),Aa(e.registerUpdateListener(({editorState:c})=>{c.read(()=>{d()})}),e.registerCommand(U5,()=>(H5(()=>e.read("latest",d)),!1),G5))),[e,d]),Ma("div",{className:"inline-toolbar-popup",ref:o,children:[Se("div",{className:"caret",ref:n}),r?.features&&r.features?.toolbarInline?.groups.map((c,a)=>Se(J5,{anchorElem:t,editor:e,group:c,index:a,toolbarStates:l},c.key))]})}function Y5(t,e){let o=F5(12),[n,r]=W5(!1),l=B5(),s;o[0]!==t?(s=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let f=Da(),h=$a(t._window),p=t.getRootElement();if(h!==null&&(!va(f)||p===null||!p.contains(h.anchorNode))){r(!1);return}if(!va(f))return;if(f.getTextContent()!==""){let C=f.getNodes(),E=!1;for(let L of C)if(j5(L)){r(!0),E=!0;break}E||r(!1)}else r(!1);let g=f.getTextContent().replace(/\n/g,"");if(!f.isCollapsed()&&g===""){r(!1);return}})},o[0]=t,o[1]=s):s=o[1];let i=s,u,d;o[2]!==i?(u=()=>(document.addEventListener("selectionchange",i),document.addEventListener("mouseup",i),()=>{document.removeEventListener("selectionchange",i),document.removeEventListener("mouseup",i)}),d=[i],o[2]=i,o[3]=u,o[4]=d):(u=o[3],d=o[4]),Ht(u,d);let c,a;if(o[5]!==t||o[6]!==i?(c=()=>Aa(t.registerUpdateListener(()=>{i()}),t.registerRootListener(()=>{t.getRootElement()===null&&r(!1)})),a=[t,i],o[5]=t,o[6]=i,o[7]=c,o[8]=a):(c=o[7],a=o[8]),Ht(c,a),!n||!l)return null;let m;return o[9]!==e||o[10]!==t?(m=V5(Se(X5,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=m):m=o[11],m}var Oa=t=>{let{anchorElem:e}=t,[o]=P5();return Y5(o,e)};var Z5=A({plugins:[{Component:Oa,position:"floatingAnchorElem"}]});import{TableCellNode as V2,TableNode as K2,TableRowNode as J2}from"@lexical/table";import{jsx as Fa}from"react/jsx-runtime";import"react";var q5={16:"M7 4h4.5a.5.5 0 0 1 .5.5V6H7zM6 4H4.5a.5.5 0 0 0-.5.5V6h2zm0 3H4v2h2zm0 3H4v1.5a.5.5 0 0 0 .5.5H6zm1 2h4.5a.5.5 0 0 0 .5-.5V10H7zm0-3V7h5v2zM3 4.5A1.5 1.5 0 0 1 4.5 3h7A1.5 1.5 0 0 1 13 4.5v7a1.5 1.5 0 0 1-1.5 1.5h-7A1.5 1.5 0 0 1 3 11.5z",24:"M17.204 6.51A2 2 0 0 1 19 8.5V16l-.011.204a2 2 0 0 1-1.785 1.785L17 18H7l-.204-.01a2 2 0 0 1-1.786-1.786L5 16V8.5a2 2 0 0 1 1.796-1.99L7 6.5h10zM6 16a1 1 0 0 0 1 1h2v-2.5H6zm4-1.5V17h7a1 1 0 0 0 .995-.898L18 16v-1.5zm-4-1h3V11H6zm4-2.5v2.5h8V11zM7 7.5a1 1 0 0 0-.995.897L6 8.5V10h3V7.5zm3 2.5h8V8.5a1 1 0 0 0-1-1h-7z"},Jn=({className:t,size:e=24})=>Fa("svg",{className:["icon",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:Fa("path",{clipRule:"evenodd",d:q5[e],fill:"currentColor",fillRule:"evenodd"})});import{$convertToMarkdownString as Q5}from"@lexical/markdown";import{$createTableCellNode as eg,$createTableNode as tg,$createTableRowNode as og,$isTableCellNode as Pa,$isTableNode as Xn,$isTableRowNode as Yn,TableCellHeaderStates as wo,TableCellNode as ng,TableNode as rg,TableRowNode as lg}from"@lexical/table";import{$isParagraphNode as ig,$isTextNode as sg}from"lexical";var ja=/^\|(.+)\|\s?$/,ag=/^(\| ?:?-*:? ?)+\|\s?$/,Ha=({allTransformers:t})=>({type:"element",dependencies:[rg,lg,ng],export:e=>{if(!Xn(e))return null;let o=[];for(let n of e.getChildren()){let r=[];if(!Yn(n))continue;let l=!1;for(let s of n.getChildren())Pa(s)&&(r.push(Q5(t,s).replace(/\n/g,"\\n").trim()),s.__headerState===wo.ROW&&(l=!0));o.push(`| ${r.join(" | ")} |`),l&&o.push(`| ${r.map(s=>"---").join(" | ")} |`)}return o.join(`
|
|
58
|
+
`)},regExp:ja,replace:(e,o,n)=>{let r=n[0];if(!r)return;if(ag.test(r)){let a=e.getPreviousSibling();if(!a||!Xn(a))return;let m=a.getChildren(),f=m[m.length-1];if(!f||!Yn(f))return;f.getChildren().forEach(h=>{Pa(h)&&h.setHeaderStyles(wo.ROW,wo.ROW)}),e.remove();return}let l=Ba(r,t);if(l==null)return;let s=[l],i=e.getPreviousSibling(),u=l.length;for(;i&&!(!ig(i)||i.getChildrenSize()!==1);){let a=i.getFirstChild();if(!sg(a))break;let m=Ba(a.getTextContent(),t);if(m==null)break;u=Math.max(u,m.length),s.unshift(m);let f=i.getPreviousSibling();i.remove(),i=f}let d=tg();for(let a of s){let m=og();d.append(m);for(let f=0;f<u;f++)m.append(f<a.length?a[f]:Ga("",t))}let c=e.getPreviousSibling();Xn(c)&&cg(c)===u?(c.append(...d.getChildren()),e.remove()):e.replace(d),d.selectEnd()}});function cg(t){let e=t.getFirstChild();return Yn(e)?e.getChildrenSize():0}var Ga=(t,e)=>{t=t.replace(/\\n/g,`
|
|
59
|
+
`);let o=eg(wo.NO_STATUS);return oo(t,e,o,!1,!0),o},Ba=(t,e)=>{let o=t.match(ja);return!o||!o[1]?null:o[1].split("|").map(n=>Ga(n,e))};import{c as fg}from"react/compiler-runtime";import{jsx as j,jsxs as Ne}from"react/jsx-runtime";import{useLexicalComposerContext as Ja}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as pg}from"@lexical/react/useLexicalEditable";import{$computeTableMap as hg,$deleteTableColumnAtSelection as gg,$deleteTableRowAtSelection as xg,$getNodeTriplet as Cg,$getTableCellNodeFromLexicalNode as Ka,$getTableNodeFromLexicalNodeOrThrow as Me,$getTableRowIndexFromTableCellNode as bg,$insertTableColumnAtSelection as kg,$insertTableRowAtSelection as _g,$isTableCellNode as Xa,$isTableSelection as Gt,$mergeCells as Tg,$setTableColumnIsHeader as Eg,$setTableRowIsHeader as wg,$unmergeCell as Sg,getTableElement as Zn,getTableObserverFromTableElement as qn,TableCellHeaderStates as ft,TableCellNode as Ng}from"@lexical/table";import{mergeRegister as Lg}from"@lexical/utils";import{useScrollInfo as yg}from"@payloadcms/ui";import{$getSelection as No,$isElementNode as Rg,$isRangeSelection as Qn,$isTextNode as vg,$setSelection as Ig,COMMAND_PRIORITY_CRITICAL as Mg,getDOMSelection as Ag,isDOMNode as Dg,SELECTION_CHANGE_COMMAND as $g}from"lexical";import*as er from"react";import{useCallback as de,useEffect as pt,useRef as So,useState as ht}from"react";import{createPortal as Ya}from"react-dom";import{jsx as Ua}from"react/jsx-runtime";import"react";var ug={16:"M5 8a1 1 0 1 1-2 0 1 1 0 0 1 2 0m4 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0m3 1a1 1 0 1 0 0-2 1 1 0 0 0 0 2",24:"M7.5 12a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m6 0a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m4.5 1.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3"},za=({className:t,size:e=24})=>Ua("svg",{className:t,fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:Ua("path",{clipRule:"evenodd",d:ug[e],fill:"currentColor",fillRule:"evenodd"})});import{$computeTableCellRectBoundary as dg,$computeTableMap as mg,$getNodeTriplet as Wa}from"@lexical/table";function Va({selection:t}){let[e,,o]=Wa(t.anchor),[n]=Wa(t.focus),[r,l,s]=mg(o,e,n),{maxColumn:i,maxRow:u,minColumn:d,minRow:c}=dg(r,l,s);return{columns:i-d+1,rows:u-c+1}}function Og(){let t=No();if(Qn(t)&&!t.isCollapsed()||Gt(t)&&!t.anchor.is(t.focus)||!Qn(t)&&!Gt(t))return!1;let[e]=Cg(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function Fg(t){let e=t.getLastDescendant();vg(e)?e.select():Rg(e)?e.selectEnd():e!==null&&e.selectNext()}function Pg({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:n,tableCellNode:r}){let[l]=Ja(),s=So(null),[i,u]=ht(r),[d,c]=ht({columns:1,rows:1}),[a,m]=ht(!1),[f,h]=ht(!1),{y:p}=yg();pt(()=>l.registerMutationListener(Ng,S=>{S.get(i.getKey())==="updated"&&l.getEditorState().read(()=>{u(i.getLatest())})},{skipInitialization:!0}),[l,i]),pt(()=>{l.getEditorState().read(()=>{let S=No();if(Gt(S)){let R=Va({selection:S});c(R);let v=S.anchor.is(S.focus);m(!v&&(R.columns>1||R.rows>1))}h(Og())})},[l]),pt(()=>{let S=e.current,R=s.current,v=l.getRootElement();if(S!=null&&R!=null&&v!=null){let D=v.getBoundingClientRect(),F=S.getBoundingClientRect();R.style.opacity="1";let M=R.getBoundingClientRect(),B=5,$=F.right+B;if($+M.width>window.innerWidth||$+M.width>D.right){let V=F.left-M.width-B;$=(V<0?B:V)+window.pageXOffset}R.style.left=`${$+window.pageXOffset}px`;let P=F.top;if(P+M.height>window.innerHeight){let V=F.bottom-M.height;P=V<0?B:V}R.style.top=`${P}px`}},[e,s,l,p]),pt(()=>{function S(R){s.current!=null&&e.current!=null&&Dg(R.target)&&!s.current.contains(R.target)&&!e.current.contains(R.target)&&n(!1)}return window.addEventListener("click",S),()=>window.removeEventListener("click",S)},[n,e]);let g=de(()=>{l.update(()=>{if(i.isAttached()){let S=Me(i),R=Zn(S,l.getElementByKey(S.getKey()));if(R===null)throw new Error("Expected to find tableElement in DOM");let v=qn(R);v!==null&&v.$clearHighlight(),S.markDirty(),u(i.getLatest())}Ig(null)})},[l,i]),C=()=>{l.update(()=>{let S=No();if(!Gt(S))return;let v=S.getNodes().filter(Xa),D=Tg(v);D&&(Fg(D),o())})},E=()=>{l.update(()=>{Sg()}),g()},L=de(S=>{l.update(()=>{for(let R=0;R<d.rows;R++)_g(S);o()})},[l,o,d.rows]),x=de(S=>{l.update(()=>{for(let R=0;R<d.columns;R++)kg(S);o()})},[l,o,d.columns]),b=de(()=>{l.update(()=>{xg(),o()})},[l,o]),k=de(()=>{l.update(()=>{Me(i).remove(),g(),o()})},[l,i,g,o]),_=de(()=>{l.update(()=>{gg(),o()})},[l,o]),T=de(()=>{l.update(()=>{let S=Me(i),R=bg(i),v=!i.hasHeaderState(ft.ROW);wg(S,R,v),g(),o()})},[l,i,g,o]),I=de(()=>{l.update(()=>{let S=Me(i),[,R]=hg(S,i,i),v=!i.hasHeaderState(ft.COLUMN);Eg(S,R.startColumn,v),g(),o()})},[l,i,g,o]),N=de(()=>{l.update(()=>{if(i.isAttached()){let S=Me(i);S&&S.setRowStriping(!S.getRowStriping())}g(),o()})},[l,i,g,o]),w=de(()=>{l.update(()=>{if(i.isAttached()){let S=Me(i);S&&S.setFrozenColumns(S.getFrozenColumns()===0?1:0)}g(),o()})},[l,i,g,o]),y=null;return t&&(a?y=j("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>C(),type:"button",children:j("span",{className:"text",children:"Merge cells"})}):f&&(y=j("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>E(),type:"button",children:j("span",{className:"text",children:"Unmerge cells"})}))),Ya(Ne("div",{className:"table-action-menu-dropdown",onClick:S=>{S.stopPropagation()},ref:s,children:[y?Ne(er.Fragment,{children:[y,j("hr",{})]}):null,j("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>N(),type:"button",children:j("span",{className:"text",children:"Toggle row striping"})}),j("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>w(),type:"button",children:j("span",{className:"text",children:"Toggle first column freeze"})}),j("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>L(!1),type:"button",children:Ne("span",{className:"text",children:["Insert ",d.rows===1?"row":`${d.rows} rows`," above"]})}),j("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>L(!0),type:"button",children:Ne("span",{className:"text",children:["Insert ",d.rows===1?"row":`${d.rows} rows`," below"]})}),j("hr",{}),j("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>x(!1),type:"button",children:Ne("span",{className:"text",children:["Insert ",d.columns===1?"column":`${d.columns} columns`," ","left"]})}),j("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>x(!0),type:"button",children:Ne("span",{className:"text",children:["Insert ",d.columns===1?"column":`${d.columns} columns`," ","right"]})}),j("hr",{}),j("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>_(),type:"button",children:j("span",{className:"text",children:"Delete column"})}),j("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>b(),type:"button",children:j("span",{className:"text",children:"Delete row"})}),j("button",{className:"item","data-test-id":"table-delete",onClick:()=>k(),type:"button",children:j("span",{className:"text",children:"Delete table"})}),j("hr",{}),j("button",{className:"item","data-test-id":"table-row-header",onClick:()=>T(),type:"button",children:Ne("span",{className:"text",children:[(i.__headerState&ft.ROW)===ft.ROW?"Remove":"Add"," ","row header"]})}),j("button",{className:"item","data-test-id":"table-column-header",onClick:()=>I(),type:"button",children:Ne("span",{className:"text",children:[(i.__headerState&ft.COLUMN)===ft.COLUMN?"Remove":"Add"," ","column header"]})})]}),l.getRootElement()?.closest('dialog, [role="dialog"]')??document.body)}function Bg({anchorElem:t,cellMerge:e}){let[o]=Ja(),n=So(null),r=So(null),[l,s]=ht(!1),[i,u]=ht(null),d=de(()=>{let a=n.current,m=No(),f=Ag(o._window),h=document.activeElement;function p(){a&&(a.classList.remove("table-cell-action-button-container--active"),a.classList.add("table-cell-action-button-container--inactive")),u(null)}if(m==null||a==null)return p();let g=o.getRootElement(),C=null,E=null;if(Qn(m)&&g!==null&&f!==null&&g.contains(f.anchorNode)){let x=Ka(m.anchor.getNode());if(x==null||(E=o.getElementByKey(x.getKey()),E==null||!x.isAttached()))return p();let b=Me(x),k=Zn(b,o.getElementByKey(b.getKey()));if(k===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");C=qn(k),u(x)}else if(Gt(m)){let x=Ka(m.anchor.getNode());if(!Xa(x))throw new Error("TableSelection anchorNode must be a TableCellNode");let b=Me(x),k=Zn(b,o.getElementByKey(b.getKey()));if(k===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");C=qn(k),E=o.getElementByKey(x.getKey())}else if(!h)return p();if(C===null||E===null)return p();let L=!C||!C.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",L),a.classList.toggle("table-cell-action-button-container--inactive",!L),L){let x=E.getBoundingClientRect(),b=t.getBoundingClientRect(),k=x.top-b.top,_=x.right-b.left;a.style.transform=`translate(${_}px, ${k}px)`}},[o,t]);pt(()=>{let a,m=()=>{a=void 0,o.getEditorState().read(d)},f=()=>(a===void 0&&(a=setTimeout(m,0)),!1);return Lg(o.registerUpdateListener(f),o.registerCommand($g,f,Mg),o.registerRootListener((h,p)=>{p&&p.removeEventListener("pointerup",f),h&&(h.addEventListener("pointerup",f),f())}),()=>clearTimeout(a))});let c=So(i);return pt(()=>{c.current!==i&&s(!1),c.current=i},[c,i]),j("div",{className:"table-cell-action-button-container",ref:n,children:i!=null&&Ne(er.Fragment,{children:[j("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),s(!l)},ref:r,type:"button",children:j(za,{})}),l&&j(Pg,{cellMerge:e,contextRef:r,onClose:()=>s(!1),setIsMenuOpen:s,tableCellNode:i})]})})}var Za=t=>{let e=fg(3),{anchorElem:o}=t,n=pg(),r;return e[0]!==o||e[1]!==n?(r=Ya(n?j(Bg,{anchorElem:o??document.body,cellMerge:!0}):null,o??document.body),e[0]=o,e[1]=n,e[2]=r):r=e[2],r};import{c as jg}from"react/compiler-runtime";import{jsx as yo,jsxs as Hg}from"react/jsx-runtime";import{useLexicalComposerContext as Gg}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Ug}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as zg,$getTableNodeFromLexicalNodeOrThrow as tr,$getTableRowIndexFromTableCellNode as Wg,$isTableCellNode as qa,$isTableRowNode as Vg,getDOMCellFromTarget as Kg,getTableElement as Jg,TableNode as Qa}from"@lexical/table";import{calculateZoomLevel as ec,mergeRegister as Xg}from"@lexical/utils";import{$getNearestNodeFromDOMNode as or,isHTMLElement as Yg,SKIP_SCROLL_INTO_VIEW_TAG as tc}from"lexical";import*as nc from"react";import{useCallback as Ut,useEffect as Ro,useRef as Lo,useState as Ve}from"react";import{createPortal as Zg}from"react-dom";var qg=33,oc=92;function Qg({editor:t}){let e=Lo(null),o=Lo(null),n=Lo(null),[r,l]=Ve(!1),s=W(),i=Lo(null),[u,d]=Ve(null),[c,a]=Ve(null),[m,f]=Ve(!1),[h,p]=Ve(null),g=Ut(()=>{a(null),e.current=null,p(null),i.current=null,n.current=null},[]),C=w=>(w.buttons&1)===1;Ro(()=>{let w=new Set;return Xg(t.registerMutationListener(Qa,y=>{for(let[S,R]of y)R==="destroyed"?w.delete(S):w.add(S);l(w.size>0)}),t.registerNodeTransform(Qa,y=>{if(y.getColWidths())return y;let S=y.getColumnCount(),R=oc;return y.setColWidths(Array(S).fill(R)),y}))},[t]),Ro(()=>{if(!r)return;let w=v=>{let D=v.target;if(Yg(D)){if(h){d({x:v.clientX,y:v.clientY});return}if(f(C(v)),!(o.current&&o.current.contains(D))&&e.current!==D){e.current=D;let F=Kg(D);F&&c!==F?t.getEditorState().read(()=>{let M=or(F.elem);if(!M)throw new Error("TableCellResizer: Table cell node not found.");let B=tr(M),$=Jg(B,t.getElementByKey(B.getKey()));if(!$)throw new Error("TableCellResizer: Table element not found.");e.current=D,n.current=$.getBoundingClientRect(),a(F)},{editor:t}):F==null&&g()}}},y=v=>{f(!0)},S=v=>{f(!1)},R=t.registerRootListener((v,D)=>{D?.removeEventListener("mousemove",w),D?.removeEventListener("mousedown",y),D?.removeEventListener("mouseup",S),v?.addEventListener("mousemove",w),v?.addEventListener("mousedown",y),v?.addEventListener("mouseup",S)});return()=>{R()}},[c,h,t,r,g]);let E=w=>w==="bottom",L=Ut(w=>{if(!c)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let y=or(c.elem);if(!qa(y))throw new Error("TableCellResizer: Table cell node not found.");let S=tr(y),R=Wg(y),v=S.getChildren(),F=y.getColSpan()===S.getColumnCount()?R:R+y.getRowSpan()-1;if(F>=v.length||F<0)throw new Error("Expected table cell to be inside of table row.");let M=v[F];if(!Vg(M))throw new Error("Expected table row");let B=M.getHeight();if(B===void 0){let P=M.getChildren();B=Math.min(...P.map(V=>x(V,t)??1/0))}let $=Math.max(B+w,qg);M.setHeight($)},{tag:tc})},[c,t]),x=(w,y)=>y.getElementByKey(w.getKey())?.clientHeight,b=(w,y)=>{let S;return y.forEach(R=>{R.forEach((v,D)=>{v.cell===w&&(S=D)})}),S},k=Ut(w=>{if(!c)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let y=or(c.elem);if(!qa(y))throw new Error("TableCellResizer: Table cell node not found.");let S=tr(y),[R]=zg(S,null,null),v=b(y,R);if(v===void 0)throw new Error("TableCellResizer: Table column not found.");let D=S.getColWidths();if(!D)return;let F=D[v];if(F===void 0)return;let M=[...D],B=Math.max(F+w,oc);M[v]=B,S.setColWidths(M)},{tag:tc})},[c,t]),_=Ut(w=>{let y=S=>{if(S.preventDefault(),S.stopPropagation(),!c)throw new Error("TableCellResizer: Expected active cell.");if(i.current){let{x:R,y:v}=i.current;if(c===null)return;let D=ec(S.target);if(E(w)){let F=(S.clientY-v)/D;L(F)}else{let F=(S.clientX-R)/D;k(F)}g(),document.removeEventListener("mouseup",y)}};return y},[c,g,k,L]),T=Ut(w=>y=>{if(y.preventDefault(),y.stopPropagation(),!c)throw new Error("TableCellResizer: Expected active cell.");i.current={x:y.clientX,y:y.clientY},d(i.current),p(w),document.addEventListener("mouseup",_(w))},[c,_]),[I,N]=Ve({bottom:null,left:null,right:null,top:null});return Ro(()=>{if(c){let{height:w,left:y,top:S,width:R}=c.elem.getBoundingClientRect(),v=ec(c.elem),D=!!t.getRootElement()?.closest('dialog, [role="dialog"]'),F=D?0:window.scrollX,M=D?0:window.scrollY,B=D?"fixed":"absolute",$=10,P={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${$}px`,left:`${F+y}px`,position:B,top:`${M+S+w-$/2}px`,width:`${R}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${w}px`,left:`${F+y+R-$/2}px`,position:B,top:`${M+S}px`,width:`${$}px`}},V=n.current;h&&u&&V&&(E(h)?(P[h].left=`${F+V.left}px`,P[h].top=`${M+u.y/v}px`,P[h].height="3px",P[h].width=`${V.width}px`):(P[h].top=`${M+V.top}px`,P[h].left=`${F+u.x/v}px`,P[h].width="3px",P[h].height=`${V.height}px`),P[h].backgroundColor="#adf"),N(P)}else N({bottom:null,left:null,right:null,top:null})},[c,h,t,u]),yo("div",{ref:o,children:c!=null&&!m&&Hg(nc.Fragment,{children:[yo("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:T("right"),style:I.right||void 0}),yo("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:T("bottom"),style:I.bottom||void 0})]})})}var rc=()=>{let t=jg(7),[e]=Gg(),o=Ug(),[n,r]=Ve(null),l,s;t[0]!==e?(l=()=>e.registerRootListener(u=>{r(u?.closest('dialog, [role="dialog"]')??document.body)}),s=[e],t[0]=e,t[1]=l,t[2]=s):(l=t[1],s=t[2]),Ro(l,s);let i;return t[3]!==e||t[4]!==o||t[5]!==n?(i=o&&n?Zg(yo(Qg,{editor:e}),n):null,t[3]=e,t[4]=o,t[5]=n,t[6]=i):i=t[6],i};import{c as s2}from"react/compiler-runtime";import{jsx as nr,jsxs as a2,Fragment as c2}from"react/jsx-runtime";import{useLexicalComposerContext as u2}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as mc}from"@lexical/react/useLexicalEditable";import{$getTableAndElementByKey as d2,$getTableColumnIndexFromTableCellNode as m2,$getTableRowIndexFromTableCellNode as f2,$insertTableColumnAtSelection as p2,$insertTableRowAtSelection as h2,$isTableCellNode as g2,$isTableNode as sc,getTableElement as x2,TableNode as C2}from"@lexical/table";import{$findMatchingParent as b2,mergeRegister as k2}from"@lexical/utils";import{$getNearestNodeFromDOMNode as ac,isHTMLElement as _2}from"lexical";import{useEffect as cc,useMemo as T2,useRef as uc,useState as vo}from"react";import"react";import{createPortal as E2}from"react-dom";import{c as r2}from"react/compiler-runtime";import{useEffect as l2,useRef as i2}from"react";var e2="Expected a function",t2=Math.max,o2=Math.min;function n2(t,e,o){let n,r,l=0,s,i=!1,u=!1,d,c,a,m=!0;if(typeof t!="function")throw new TypeError(e2);e=e||0,typeof o=="object"&&(i=!!o.leading,u="maxWait"in o,d=u?t2(o.maxWait||0,e):d,m="trailing"in o?!!o.trailing:m);function f(k){let _=n,T=s;return n=s=void 0,l=k,c=t.apply(T,_),c}function h(k){return l=k,a=setTimeout(C,e),i?f(k):c}function p(k){let _=k-r,T=k-l,I=e-_;return u?o2(I,d-T):I}function g(k){let _=k-r,T=k-l;return r===void 0||_>=e||_<0||u&&T>=d}function C(){let k=Date.now();if(g(k))return E(k);a=setTimeout(C,p(k))}function E(k){return a=void 0,m&&n?f(k):(n=s=void 0,c)}function L(){a!==void 0&&clearTimeout(a),l=0,n=r=s=a=void 0}function x(){return a===void 0?c:E(Date.now())}function b(){let k=Date.now(),_=g(k);if(n=arguments,s=this,r=k,_){if(a===void 0)return h(r);if(u)return clearTimeout(a),a=setTimeout(C,e),f(r)}return a===void 0&&(a=setTimeout(C,e)),c}return b.cancel=L,b.flush=x,b}var lc=n2;function ic(t,e,o){let n=r2(6),r=i2(null),l,s;n[0]!==t||n[1]!==o||n[2]!==e?(l=()=>(r.current=lc(t,e,{maxWait:o}),()=>{r.current?.cancel()}),s=[t,e,o],n[0]=t,n[1]=o,n[2]=e,n[3]=l,n[4]=s):(l=n[3],s=n[4]),l2(l,s);let i;return n[5]===Symbol.for("react.memo_cache_sentinel")?(i=(...d)=>{let c=d;r.current&&r.current(...c)},n[5]=i):i=n[5],i}var dc=16;function w2({anchorElem:t}){let[e]=u2(),o=mc(),n=W(),[r,l]=vo(!1),[s,i]=vo(!1),[u,d]=vo(!1),[c,a]=vo({}),m=uc(new Set),f=uc(null),h=ic(C=>{let{isOutside:E,tableDOMNode:L}=S2(C,n.editorConfig?.lexical);if(E){l(!1),i(!1);return}if(!L)return;f.current=L;let x=null,b=null,k=null;if(e.getEditorState().read(()=>{let F=ac(L);if(g2(F)){let M=b2(F,B=>sc(B));if(!sc(M))return;if(k=x2(M,e.getElementByKey(M.getKey())),k){let B=M.getChildrenSize(),$=M.getChildAtIndex(0)?.getChildrenSize(),P=f2(F),V=m2(F);P===B-1?x=F:V===$-1&&(b=F)}}},{editor:e}),!k)return;let _=k.parentElement;if(!_)return;let{bottom:T,height:I,left:N,right:w,width:y,y:S}=k.getBoundingClientRect(),R=!1;_&&_.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(R=_.scrollWidth>_.clientWidth);let{left:v,y:D}=t.getBoundingClientRect();x?(i(!1),l(!0),a({height:dc,left:R&&_?_.offsetLeft:N-v,top:T-D+5,width:R&&_?_.offsetWidth:y})):b&&(i(!0),l(!1),a({height:I,left:w-v+5,top:S-D,width:dc}))},50,250),p=T2(()=>new ResizeObserver(()=>{l(!1),i(!1)}),[]);cc(()=>{if(u)return document.addEventListener("mousemove",h),()=>{l(!1),i(!1),document.removeEventListener("mousemove",h)}},[u,h]),cc(()=>k2(e.registerMutationListener(C2,C=>{e.getEditorState().read(()=>{let E=!1;for(let[L,x]of C)switch(x){case"created":{m.current.add(L),E=!0;break}case"destroyed":{m.current.delete(L),E=!0;break}default:break}if(E){p.disconnect();for(let L of m.current){let{tableElement:x}=d2(L);p.observe(x)}d(m.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,p]);let g=C=>{e.update(()=>{f.current&&(ac(f.current)?.selectEnd(),C?(h2(),l(!1)):(p2(),i(!1)))})};return o?a2(c2,{children:[r&&nr("button",{"aria-label":"Add Row",className:n.editorConfig.lexical.theme.tableAddRows,onClick:()=>g(!0),style:{...c},type:"button"}),s&&nr("button",{"aria-label":"Add Column",className:n.editorConfig.lexical.theme.tableAddColumns,onClick:()=>g(!1),style:{...c},type:"button"})]}):null}function S2(t,e){let o=t.target;if(_2(o)){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 fc(t){let e=s2(2),{anchorElem:o}=t,n=o===void 0?document.body:o;if(!mc())return null;let l;return e[0]!==n?(l=E2(nr(w2,{anchorElem:n}),n),e[0]=n,e[1]=l):l=e[1],l}import{jsx as ir,jsxs as R2}from"react/jsx-runtime";import{useLexicalComposerContext as v2}from"@lexical/react/LexicalComposerContext";import{TablePlugin as I2}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as M2,TableCellNode as A2,TableNode as D2,TableRowNode as $2}from"@lexical/table";import{mergeRegister as O2}from"@lexical/utils";import{$getSelection as F2,$isRangeSelection as P2,$setSelection as B2,COMMAND_PRIORITY_EDITOR as j2,createCommand as H2}from"lexical";import{createContext as G2,use as U2,useCallback as bc,useEffect as kc,useMemo as z2,useRef as W2,useState as Io}from"react";import*as _c from"react";import{jsx as te,jsxs as Le}from"react/jsx-runtime";import{useCallback as rr,useEffect as pc,useRef as lr,useState as zt}from"react";import*as xc from"react";import{createPortal as N2}from"react-dom";var hc=10,gc=7;function L2(){return Le("svg",{fill:"none",height:"12",viewBox:"0 0 12 12",width:"12",xmlns:"http://www.w3.org/2000/svg",children:[te("rect",{height:"9",rx:"1",stroke:"currentColor",width:"3",x:"1.5",y:"1.5"}),te("rect",{height:"9",rx:"1",stroke:"currentColor",width:"3",x:"7.5",y:"1.5"})]})}function y2(){return Le("svg",{fill:"none",height:"12",viewBox:"0 0 12 12",width:"12",xmlns:"http://www.w3.org/2000/svg",children:[te("rect",{height:"3",rx:"1",stroke:"currentColor",width:"9",x:"1.5",y:"1.5"}),te("rect",{height:"3",rx:"1",stroke:"currentColor",width:"9",x:"1.5",y:"7.5"})]})}function Cc({anchorElem:t,editor:e,isOpen:o,onClose:n,onInsert:r,position:l}){let[s,i]=zt(0),[u,d]=zt(0),[c,a]=zt(""),[m,f]=zt(""),[h,p]=zt(null),g=lr(null),C=lr(null),E=lr(null),L=s>0?s:c?parseInt(c,10)||0:5,x=u>0?u:m?parseInt(m,10)||0:5;pc(()=>{o||(i(0),d(0),a(""),f(""),p(null))},[o]),pc(()=>{if(!o)return;let N=w=>{if(w.key==="Escape"&&(w.preventDefault(),w.stopPropagation(),n()),w.key==="Enter"&&h){w.preventDefault();let y=parseInt(c,10),S=parseInt(m,10);y>0&&S>0&&r(y,S)}};return document.addEventListener("keydown",N,!0),()=>document.removeEventListener("keydown",N,!0)},[o,n,r,h,c,m]);let b=rr((N,w)=>{N>0&&w>0&&r(N,w)},[r]),k=rr((N,w)=>{i(N),d(w)},[]),_=rr(()=>{i(0),d(0)},[]);if(!o||!l||!t)return null;let T=[];for(let N=1;N<=gc;N++)for(let w=1;w<=hc;w++){let y=w<=L&&N<=x,S=w<=s&&N<=u,R="table-grid-popup__cell";y&&S?R+=" table-grid-popup__cell--hover":y&&(R+=" table-grid-popup__cell--selected"),T.push(te("div",{"aria-label":`${w} columns, ${N} rows`,className:R,onClick:()=>b(w,N),onKeyDown:v=>{(v.key==="Enter"||v.key===" ")&&(v.preventDefault(),b(w,N))},onMouseEnter:()=>k(w,N),role:"button",tabIndex:-1},`${N}-${w}`))}let I=s>0&&u>0;return N2(Le(xc.Fragment,{children:[te("div",{className:"table-grid-popup__backdrop",onClick:n}),te("div",{className:"table-grid-popup",ref:g,style:{transform:`translate(${l.left}px, ${l.top}px)`},children:Le("div",{className:"table-grid-popup__content",children:[Le("div",{className:"table-grid-popup__header",children:[Le("div",{className:`table-grid-popup__input-group${h==="cols"?" table-grid-popup__input-group--focused":""}`,children:[te("div",{className:"table-grid-popup__input-icon",children:te(L2,{})}),te("input",{"aria-label":"Columns",className:"table-grid-popup__input",min:1,onBlur:()=>p(null),onChange:N=>a(N.target.value),onFocus:()=>p("cols"),placeholder:s>0?String(s):"5",ref:C,type:"number",value:c})]}),te("span",{className:"table-grid-popup__separator",children:"\xD7"}),Le("div",{className:`table-grid-popup__input-group${h==="rows"?" table-grid-popup__input-group--focused":""}`,children:[te("div",{className:"table-grid-popup__input-icon",children:te(y2,{})}),te("input",{"aria-label":"Rows",className:"table-grid-popup__input",min:1,onBlur:()=>p(null),onChange:N=>f(N.target.value),onFocus:()=>p("rows"),placeholder:u>0?String(u):"5",ref:E,type:"number",value:m})]})]}),Le("div",{className:"table-grid-popup__grid",onMouseLeave:_,children:[T,I&&Le("div",{className:"table-grid-popup__tooltip",style:{left:`calc(${(s-.5)/hc*100}%)`,top:`calc(${(u-1)/gc*100}%)`},children:[L," \xD7 ",x]})]})]})})]}),t)}var Mo=H2("OPEN_EMBED_DRAWER_COMMAND"),Tc=G2({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function Ec({children:t}){let[e,o]=Io({cellEditorConfig:null,cellEditorPlugins:null});return ir(Tc,{value:z2(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(n,r)=>{o({cellEditorConfig:n,cellEditorPlugins:r})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var wc=()=>{let[t]=v2(),e=U2(Tc),[o,n]=Io(!1),[r,l]=Io(null),s=W2(null),[i,u]=Io(null);kc(()=>{let a=t.getRootElement();if(a){let m=a.closest(".editor")??null;u(m??a.parentElement)}},[t]),kc(()=>{if(!t.hasNodes([D2,$2,A2]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return O2(t.registerCommand(Mo,()=>{let a=i;if(!a)return!0;let m=a.getBoundingClientRect(),f=null;t.getEditorState().read(()=>{let p=F2();if(P2(p)){s.current=p.clone();let g=p.anchor.getNode(),C=t.getElementByKey(g.getKey());if(C){let E=C.getBoundingClientRect();E.height>0&&(f={left:E.left-m.left,top:E.bottom-m.top+8})}}});let h=window.getSelection();if(h&&h.rangeCount>0){let g=h.getRangeAt(0).getBoundingClientRect();g.height>0&&(f={left:g.left-m.left,top:g.bottom-m.top+8})}return f||(f={left:0,top:40}),l(f),n(!0),!0},j2))},[e,t,i]);let d=bc(()=>{n(!1)},[]),c=bc((a,m)=>{n(!1),t.focus(),t.update(()=>{s.current&&B2(s.current.clone())},{discrete:!0,skipTransforms:!0}),setTimeout(()=>{t.dispatchCommand(M2,{columns:String(a),rows:String(m)})},1)},[t]);return R2(_c.Fragment,{children:[ir(Cc,{anchorElem:i,editor:t,isOpen:o,onClose:d,onInsert:c,position:r}),ir(I2,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]})};var X2=A({markdownTransformers:[Ha],nodes:[K2,V2,J2],plugins:[{Component:wc,position:"normal"},{Component:rc,position:"normal"},{Component:Za,position:"floatingAnchorElem"},{Component:fc,position:"floatingAnchorElem"}],providers:[Ec],slashMenu:{groups:[Z([{Icon:Jn,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Mo,{})}}])]},toolbarFixed:{groups:[be([{ChildComponent:Jn,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Mo,{})}}])]}});import{$isNodeSelection as wx}from"lexical";import{jsx as Sc}from"react/jsx-runtime";import"react";var Y2="M16.2041 6.01074C17.2128 6.113 18 6.96435 18 8V16L17.9893 16.2041C17.8938 17.1457 17.1457 17.8938 16.2041 17.9893L16 18H8C6.96435 18 6.113 17.2128 6.01074 16.2041L6 16V8C6 6.89543 6.89543 6 8 6H16L16.2041 6.01074ZM8 7C7.44772 7 7 7.44772 7 8V16C7 16.5523 7.44772 17 8 17H16C16.5523 17 17 16.5523 17 16V8C17 7.44772 16.5523 7 16 7H8ZM9.72461 11.582C9.91869 11.4539 10.1827 11.4756 10.3535 11.6465L13.8535 15.1465C14.0488 15.3417 14.0488 15.6583 13.8535 15.8535C13.6583 16.0488 13.3417 16.0488 13.1465 15.8535L10 12.707L8.85352 13.8535C8.65825 14.0488 8.34175 14.0488 8.14648 13.8535C7.95122 13.6583 7.95122 13.3417 8.14648 13.1465L9.64648 11.6465L9.72461 11.582ZM14 8C15.1046 8 16 8.89543 16 10C16 11.1046 15.1046 12 14 12C12.8954 12 12 11.1046 12 10C12 8.89543 12.8954 8 14 8ZM14 9C13.4477 9 13 9.44772 13 10C13 10.5523 13.4477 11 14 11C14.5523 11 15 10.5523 15 10C15 9.44772 14.5523 9 14 9Z",sr=({className:t})=>Sc("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Sc("path",{clipRule:"evenodd",d:Y2,fill:"currentColor",fillRule:"evenodd"})});import{c as rx}from"react/compiler-runtime";import{jsx as lx}from"react/jsx-runtime";import{useLexicalComposerContext as ix}from"@lexical/react/LexicalComposerContext.js";import{$dfsIterator as Oc,$insertNodeToNearestRoot as ur,mergeRegister as sx}from"@lexical/utils";import{useBulkUpload as ax,useEffectEvent as cx,useModal as ux}from"@payloadcms/ui";import dr from"bson-objectid";import{$createRangeSelection as dx,$getPreviousSelection as Ic,$getSelection as Mc,$isParagraphNode as mr,$isRangeSelection as Ac,$setSelection as mx,COMMAND_PRIORITY_EDITOR as fx,COMMAND_PRIORITY_LOW as Dc,createCommand as px,DROP_COMMAND as hx,getDOMSelectionFromTarget as gx,isHTMLElement as $c,PASTE_COMMAND as xx}from"lexical";import{useEffect as Cx}from"react";import{c as Nc}from"react/compiler-runtime";import{jsx as ar}from"react/jsx-runtime";import{useLexicalComposerContext as Lc}from"@lexical/react/LexicalComposerContext.js";import{toast as Z2}from"@payloadcms/ui";import{$getNodeByKey as q2,COMMAND_PRIORITY_EDITOR as yc}from"lexical";import{useEffect as Rc,useState as Q2}from"react";var ex=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=q2(o);r&&r.replace(ye({data:{fields:null,relationTo:e,value:n}}))}):t.dispatchCommand(cr,{fields:null,relationTo:e,value:n})},tx=t=>{let e=Nc(13),{enabledCollectionSlugs:o}=t,[n]=Lc(),[r,l]=Q2(null),s;e[0]!==o?(s={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=s):s=e[1];let{closeListDrawer:i,ListDrawer:u,openListDrawer:d}=Pt(s),c,a;e[2]!==n||e[3]!==d?(c=()=>n.registerCommand(et,p=>(l(p?.replace?p?.replace.nodeKey:null),d(),!0),yc),a=[n,d],e[2]=n,e[3]=d,e[4]=c,e[5]=a):(c=e[4],a=e[5]),Rc(c,a);let m;e[6]!==i||e[7]!==n||e[8]!==r?(m=p=>{let{collectionSlug:g,doc:C}=p;i(),ex({editor:n,relationTo:g,replaceNodeKey:r,value:C.id})},e[6]=i,e[7]=n,e[8]=r,e[9]=m):m=e[9];let f=m,h;return e[10]!==u||e[11]!==f?(h=ar(u,{onSelect:f}),e[10]=u,e[11]=f,e[12]=h):h=e[12],h},ox=()=>{let t=Nc(3),[e]=Lc(),o,n;return t[0]!==e?(o=()=>e.registerCommand(et,nx,yc),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),Rc(o,n),null},vc=({enabledCollectionSlugs:t})=>t?.length?ar(tx,{enabledCollectionSlugs:t}):ar(ox,{});function nx(){return Z2.error("No upload collections enabled"),!0}function bx(t){let e=t.target;return!!($c(e)&&!e.closest("code, span.editor-image")&&$c(e.parentElement)&&e.parentElement.closest("div.ContentEditable__root"))}function kx(t){let e,o=gx(t.target);if(document.caretRangeFromPoint)e=document.caretRangeFromPoint(t.clientX,t.clientY);else if(t.rangeParent&&o!==null)o.collapse(t.rangeParent,t.rangeOffset||0),e=o.getRangeAt(0);else throw Error("Cannot get the selection when dragging");return e}var cr=px("INSERT_UPLOAD_COMMAND"),Fc=t=>{let e=rx(20),{clientProps:o}=t,[n]=ix(),r;e[0]!==o.enabledCollectionSlugs?(r={enabledCollectionSlugs:o.enabledCollectionSlugs},e[0]=o.enabledCollectionSlugs,e[1]=r):r=e[1];let{enabledCollectionSlugs:l}=Co(r),{modalSlug:s,setCollectionSlug:i,setInitialForms:u,setOnCancel:d,setOnSuccess:c,setSelectableCollections:a}=ax(),{isModalOpen:m,openModal:f}=ux(),h;e[2]!==s||e[3]!==n||e[4]!==l||e[5]!==m||e[6]!==f||e[7]!==i||e[8]!==u||e[9]!==d||e[10]!==c||e[11]!==a?(h=L=>{let{files:x}=L;if(x?.length!==0&&(u(b=>[...b??[],...x.map(_x)]),!m(s))){if(!l.length||!l[0])return;i(l[0]),a(l),d(()=>{n.update(Tx)}),c(b=>{let k=new Map(b.map(Ex));n.update(()=>{for(let _ of Oc()){let T=_.node;if(ot(T)){let I=T.getData();if(I?.pending){let N=k.get(I.pending?.formID);N&&T.replace(ye({data:{id:new dr.default().toHexString(),fields:{},relationTo:N.collectionSlug,value:N.doc.id}}))}}}})}),f(s)}},e[2]=s,e[3]=n,e[4]=l,e[5]=m,e[6]=f,e[7]=i,e[8]=u,e[9]=d,e[10]=c,e[11]=a,e[12]=h):h=e[12];let p=cx(h),g;e[13]!==n||e[14]!==p?(g=()=>{if(!n.hasNodes([tt]))throw new Error("UploadPlugin: UploadNode not registered on editor");let L=new WeakSet;return sx(n.registerNodeTransform(tt,x=>{let b=x.getData();if(!b?.pending||L.has(b.pending))return;L.add(b.pending),async function(){let T=null,I=b?.pending?.src,N=b?.pending?.formID;if(I?.startsWith("data:")){let w=I.match(/data:(image\/[a-zA-Z]+);base64,/),y=w?w[1]:"image/png",S=I.replace(/^data:image\/[a-zA-Z]+;base64,/,""),R=atob(S),v=new Array(R.length);for(let M=0;M<R.length;M++)v[M]=R.charCodeAt(M);let D=new Uint8Array(v);T={alt:void 0,file:new File([D],"pasted-image."+y?.split("/",2)[1],{type:y}),formID:N}}else if(I?.startsWith("http")||I?.startsWith("https")){let y=await(await fetch(I)).blob(),S=I.split("/").pop()||"pasted-image"+y.type.split("/",2)[1];T={alt:void 0,file:new File([y],S,{type:y.type}),formID:N}}T&&p({files:[T]})}()}),n.registerCommand(cr,x=>(n.update(()=>{let b=Mc()||Ic();if(Ac(b)){let k=ye({data:{id:x.id,fields:x.fields,relationTo:x.relationTo,value:x.value}}),{focus:_}=b,T=_.getNode();ur(k),mr(T)&&!T.__first&&T.remove()}}),!0),fx),n.registerCommand(xx,x=>{if(!(x instanceof ClipboardEvent))return!1;let b=x.clipboardData;if(!b?.types?.length||b?.types?.includes("text/html"))return!1;let k=[];return b?.files?.length&&Array.from(b.files).forEach(_=>{k.push({alt:"",file:_,formID:new dr.default().toHexString()})}),k.length?(n.update(()=>{let _=Mc()||Ic();if(Ac(_))for(let T of k){let I=ye({data:{pending:{formID:T.formID,src:URL.createObjectURL(T.file)}}}),{focus:N}=_,w=N.getNode();ur(I),mr(w)&&!w.__first&&w.remove()}}),p({files:k}),!0):!1},Dc),n.registerCommand(hx,x=>{if(!(x instanceof DragEvent))return!1;let b=x.dataTransfer;if(!b?.types?.length)return!1;let k=[];return b?.files?.length&&Array.from(b.files).forEach(_=>{k.push({alt:"",file:_,formID:new dr.default().toHexString()})}),k.length?(x.preventDefault(),x.stopPropagation(),n.update(()=>{if(bx(x)){let _=kx(x),T=dx();_!=null&&T.applyDOMRange(_),mx(T);for(let I of k){let N=ye({data:{pending:{formID:I.formID,src:URL.createObjectURL(I.file)}}}),{focus:w}=T,y=w.getNode();ur(N),mr(y)&&!y.__first&&y.remove()}}}),p({files:k}),!0):!1},Dc))},e[13]=n,e[14]=p,e[15]=g):g=e[15];let C;e[16]!==n?(C=[n],e[16]=n,e[17]=C):C=e[17],Cx(g,C);let E;return e[18]!==l?(E=lx(vc,{enabledCollectionSlugs:l}),e[18]=l,e[19]=E):E=e[19],E};function _x(t){return{file:t.file,formID:t.formID}}function Tx(){for(let t of Oc()){let e=t.node;ot(e)&&e.getData()?.pending&&e.remove()}}function Ex(t){return[t.formID,t]}var Sx=A({nodes:[tt],plugins:[{Component:Fc,position:"normal"}],slashMenu:{groups:[Z([{Icon:sr,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(et,{replace:!1})}}])]},toolbarFixed:{groups:[be([{ChildComponent:sr,isActive:({selection:t})=>{if(!wx(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return ot(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(et,{replace:!1})}}])]}});import{c as Lx}from"react/compiler-runtime";import{jsx as Ao}from"react/jsx-runtime";import{createElement as yx}from"react";import{ShimmerEffect as Rx,useConfig as vx}from"@payloadcms/ui";import{lazy as Ix,Suspense as Mx,useEffect as Ax,useState as Dx}from"react";var Pc={block:"LexicalEditorTheme__block",blockCursor:"LexicalEditorTheme__blockCursor",characterLimit:"LexicalEditorTheme__characterLimit",code:"LexicalEditorTheme__code",inlineBlock:"LexicalEditorTheme__inlineBlock",heading:{h1:"LexicalEditorTheme__h1",h2:"LexicalEditorTheme__h2",h3:"LexicalEditorTheme__h3",h4:"LexicalEditorTheme__h4",h5:"LexicalEditorTheme__h5",h6:"LexicalEditorTheme__h6"},hr:"LexicalEditorTheme__hr",hrSelected:"LexicalEditorTheme__hrSelected",indent:"LexicalEditorTheme__indent",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",placeholder:"LexicalEditorTheme__placeholder",quote:"LexicalEditorTheme__quote",relationship:"LexicalEditorTheme__relationship",root:"LexicalEditorTheme",rtl:"LexicalEditorTheme__rtl",tab:"LexicalEditorTheme__tabNode",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableAlignment:{center:"LexicalEditorTheme__tableAlignmentCenter",right:"LexicalEditorTheme__tableAlignmentRight"},tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableFrozenColumn:"LexicalEditorTheme__tableFrozenColumn",tableRowStriping:"LexicalEditorTheme__tableRowStriping",tableScrollableWrapper:"LexicalEditorTheme__tableScrollableWrapper",tableSelected:"LexicalEditorTheme__tableSelected",tableSelection:"LexicalEditorTheme__tableSelection",text:{bold:"LexicalEditorTheme__textBold",code:"LexicalEditorTheme__textCode",italic:"LexicalEditorTheme__textItalic",strikethrough:"LexicalEditorTheme__textStrikethrough",subscript:"LexicalEditorTheme__textSubscript",superscript:"LexicalEditorTheme__textSuperscript",underline:"LexicalEditorTheme__textUnderline",underlineStrikethrough:"LexicalEditorTheme__textUnderlineStrikethrough"},upload:"LexicalEditorTheme__upload"};var fr={namespace:"lexical",theme:Pc};function Bc({config:t,featureClientImportMap:e,featureClientSchemaMap:o,field:n,schemaPath:r,unSanitizedEditorConfig:l}){let s=new Map,i=[];for(let c of l.features){if(!c?.clientFeatureProps?.featureKey||c?.clientFeatureProps?.order===void 0||c?.clientFeatureProps?.order===null){console.warn("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. Skipping feature.");continue}s.set(c.clientFeatureProps.featureKey,c),i.push(c)}l.features=i,l.features=l.features.sort((c,a)=>c.clientFeatureProps.order-a.clientFeatureProps.order);let u=new Map,d=0;for(let c of l.features){let a=typeof c.feature=="function"?c.feature({config:t,featureClientImportMap:e,featureClientSchemaMap:o,featureProviderMap:s,field:n,resolvedFeatures:u,schemaPath:r,unSanitizedEditorConfig:l}):c.feature;a.key=c.clientFeatureProps.featureKey,a.order=d,u.set(c.clientFeatureProps.featureKey,a),d++}return u}import{deepMerge as Nx}from"payload/shared";var jc=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}},o={};if(t.forEach(n=>{n.key==="toolbarFixed"&&n.sanitizedClientFeatureProps?.customGroups&&(o={...o,...n.sanitizedClientFeatureProps.customGroups})}),!t?.size)return e;t.forEach(n=>{if(n.providers?.length&&(e.providers=e.providers.concat(n.providers)),n.enableFormats?.length&&e.enabledFormats.push(...n.enableFormats),n.nodes?.length)for(let r of n.nodes)e.nodes.push(r);if(n.plugins?.length&&n.plugins.forEach((r,l)=>{e.plugins?.push({clientProps:n.sanitizedClientFeatureProps,Component:r.Component,key:n.key+l,position:r.position})}),n.toolbarInline?.groups?.length)for(let r of n.toolbarInline.groups){let l=e.toolbarInline.groups.find(s=>s.key===r.key);l?e.toolbarInline.groups=e.toolbarInline.groups.filter(s=>s.key!==r.key):l={...r,items:[]},r?.items?.length&&(l.items=l.items.concat(r.items)),e.toolbarInline?.groups.push(l)}if(n.toolbarFixed?.groups?.length)for(let r of n.toolbarFixed.groups){let l=e.toolbarFixed.groups.find(s=>s.key===r.key);l?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(s=>s.key!==r.key):l={...r,items:[]},r?.items?.length&&(l.items=l.items.concat(r.items)),e.toolbarFixed?.groups.push(l)}if(n.slashMenu?.groups){n.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(n.slashMenu.dynamicGroups));for(let r of n.slashMenu.groups){let l=e.slashMenu.groups.find(s=>s.key===r.key);l?e.slashMenu.groups=e.slashMenu.groups.filter(s=>s.key!==r.key):l={...r,items:[]},r?.items?.length&&(l.items=l.items.concat(r.items)),e.slashMenu.groups.push(l)}}if(n.markdownTransformers?.length)for(let r of n.markdownTransformers)typeof r=="function"?e.markdownTransformers.push(r({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(r);e.enabledFeatures.push(n.key)}),Object.keys(o).length>0&&(e.toolbarFixed.groups=e.toolbarFixed.groups.map(n=>{let r=o[n.key];return r?Nx(n,r):n})),e.toolbarInline.groups.sort((n,r)=>n.order&&r.order?n.order-r.order:n.order?-1:r.order?1:0),e.toolbarFixed.groups.sort((n,r)=>n.order&&r.order?n.order-r.order:n.order?-1:r.order?1:0);for(let n of e.toolbarInline.groups)n.items.sort((r,l)=>r.order&&l.order?r.order-l.order:r.order?-1:l.order?1:0);for(let n of e.toolbarFixed.groups)n.items.sort((r,l)=>r.order&&l.order?r.order-l.order:r.order?-1:l.order?1:0);return e};function pr(t,e,o,n){return{admin:o,features:jc(t),lexical:e,resolvedFeatureMap:t,view:n}}var $x=Ix(()=>import("./Field-MT4FK3IP.js").then(t=>({default:t.RichText}))),Ox=t=>Ao(Vo,{inheritable:!0,views:t.views,children:Ao(Fx,{...t})}),Fx=t=>{let e=Lx(23),{admin:o,clientFeatures:n,featureClientImportMap:r,featureClientSchemaMap:l,field:s,lexicalEditorConfig:i,schemaPath:u,views:d}=t,c;e[0]!==o?(c=o===void 0?{}:o,e[0]=o,e[1]=c):c=e[1];let a=c,m;e[2]!==r?(m=r===void 0?{}:r,e[2]=r,e[3]=m):m=e[3];let f=m,h=i===void 0?fr:i,{currentView:p}=Ko(),g=d?.[p]?.admin??a,C=d?.[p]?.lexical,E;e[4]!==h||e[5]!==C?(E=typeof C=="function"?C(h):C??h,e[4]=h,e[5]=C,e[6]=E):E=e[6];let L=E,{config:x}=vx(),[b,k]=Dx(null),_,T;e[7]!==n||e[8]!==x||e[9]!==p||e[10]!==g||e[11]!==L||e[12]!==f||e[13]!==l||e[14]!==s||e[15]!==b||e[16]!==u||e[17]!==d?(_=()=>{if(b&&b.view===p)return;let N=d?.[p],w=N?.filterFeatures?N.filterFeatures(n):n,y=[];for(let R of Object.values(w))!R.clientFeatureProvider||!R.clientFeatureProps||y.push(R.clientFeatureProvider(R.clientFeatureProps));let S=Bc({config:x,featureClientImportMap:f,featureClientSchemaMap:l,field:s,schemaPath:u??s.name,unSanitizedEditorConfig:{features:y,lexical:L}});k(pr(S,L,g,p))},T=[g,n,x,f,l,s,b,L,u,p,d],e[7]=n,e[8]=x,e[9]=p,e[10]=g,e[11]=L,e[12]=f,e[13]=l,e[14]=s,e[15]=b,e[16]=u,e[17]=d,e[18]=_,e[19]=T):(_=e[18],T=e[19]),Ax(_,T);let I;return e[20]!==b||e[21]!==t?(I=Ao(Mx,{fallback:Ao(Rx,{height:"35vh"}),children:b&&yx($x,{...t,editorConfig:b,key:b.view})}),e[20]=b,e[21]=t,e[22]=I):I=e[22],I};function Px(...t){return t.filter(Boolean).join(" ")}var Bx=t=>(e,o,n)=>{let r=t(n);r&&(r.append(...o),e.replace(r),r.select(0,0))};var Do=new WeakMap;function Hc(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function $o(t,e){let o=Do.get(t);if(o===void 0){let n=new Set,r=s=>{o!==void 0&&(o.start=Hc(s))},l=s=>{if(o===void 0)return;let{start:i}=o;if(i===null)return;let u=Hc(s);for(let d of n)u!==null&&d([u[0]-i[0],u[1]-i[1]],s)};t.addEventListener("touchstart",r),t.addEventListener("touchend",l),o={handleTouchend:l,handleTouchstart:r,listeners:n,start:null},Do.set(t,o)}return o.listeners.add(e),()=>{jx(t,e)}}function jx(t,e){let o=Do.get(t);if(o===void 0)return;let{listeners:n}=o;n.delete(e),n.size===0&&(Do.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function Hx(t,e){return $o(t,(o,n)=>{let[r,l]=o;r<0&&-r>Math.abs(l)&&e(r,n)})}function Gx(t,e){return $o(t,(o,n)=>{let[r,l]=o;r>0&&r>Math.abs(l)&&e(r,n)})}function Ux(t,e){return $o(t,(o,n)=>{let[r,l]=o;l<0&&-l>Math.abs(r)&&e(r,n)})}function zx(t,e){return $o(t,(o,n)=>{let[r,l]=o;l>0&&l>Math.abs(r)&&e(r,n)})}import{c as Wx}from"react/compiler-runtime";import{jsx as Vx}from"react/jsx-runtime";import"react";var Kx=()=>{let t=Wx(2),{EditButton:e}=xe(),o;return t[0]!==e?(o=e?Vx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Jx}from"react/compiler-runtime";import{jsx as Xx}from"react/jsx-runtime";import"react";var Yx=()=>{let t=Jx(2),{RemoveButton:e}=xe(),o;return t[0]!==e?(o=e?Xx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Zx}from"react/compiler-runtime";import{jsx as qx}from"react/jsx-runtime";import"react";var Qx=()=>{let t=Zx(2),{Label:e}=xe(),o;return t[0]!==e?(o=e?qx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as eC}from"react/compiler-runtime";import{jsx as tC}from"react/jsx-runtime";import"react";var oC=t=>{let e=eC(3),{children:o}=t,{InlineBlockContainer:n}=xe(),r;return e[0]!==n||e[1]!==o?(r=n?tC(n,{children:o}):null,e[0]=n,e[1]=o,e[2]=r):r=e[2],r};import{jsx as nC}from"react/jsx-runtime";import"react";var rC=t=>{let{children:e,...o}=t,{BlockCollapsible:n}=ae();return n?nC(n,{...o,children:e}):null};import{c as lC}from"react/compiler-runtime";import{jsx as iC}from"react/jsx-runtime";import"react";var sC=()=>{let t=lC(2),{EditButton:e}=ae(),o;return t[0]!==e?(o=e?iC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as aC}from"react/compiler-runtime";import{jsx as cC}from"react/jsx-runtime";import"react";var uC=()=>{let t=aC(2),{RemoveButton:e}=ae(),o;return t[0]!==e?(o=e?cC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as dC}from"qs-esm";var mC=({apiURL:t,depth:e,draft:o,locale:n})=>async({id:l,collectionSlug:s,select:i})=>{let u=dC({depth:e??0,draft:o??!1,locale:n,select:i},{addQueryPrefix:!0});return await fetch(`${t}/${s}/${l}${u}`,{credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json"},method:"GET"}).then(c=>c.json())};var Gc={customEndRegex:{optional:!0,regExp:/[ \t]*```$/},customStartRegex:/^[ \t]*```(\w+)?/,doNotTrimChildren:!0,export:({fields:t})=>!t.code.includes(`
|
|
60
60
|
`)&&!t.language?.length?"```"+t.code+"```":"```"+(t.language||"")+(t.code?`
|
|
61
61
|
`+t.code:"")+"\n```",import:({children:t,closeMatch:e,openMatch:o})=>{let n=o?.[1];return t.startsWith(`
|
|
62
62
|
`)&&(t=t.slice(1)),t.endsWith(`
|
|
63
63
|
`)&&(t=t.slice(0,-1)),!!e&&!t.includes(`
|
|
64
|
-
`)&&o?.input?.trim()!=="```"+n?{code:n+(t?.length?t:""),language:""}:{code:t,language:n}}};import{jsx as oC}from"react/jsx-runtime";import{CodeField as nC,useFormFields as rC}from"@payloadcms/ui";import{useId as lC,useMemo as iC}from"react";var Io={abap:"ABAP",apex:"Apex",azcli:"Azure CLI",bat:"Batch",bicep:"Bicep",cameligo:"CameLIGO",clojure:"Clojure",coffee:"CoffeeScript",cpp:"C++",csharp:"C#",csp:"CSP",css:"CSS",cypher:"Cypher",dart:"Dart",dockerfile:"Dockerfile",ecl:"ECL",elixir:"Elixir",flow9:"Flow9",freemarker2:"FreeMarker 2",fsharp:"F#",go:"Go",graphql:"GraphQL",handlebars:"Handlebars",hcl:"HCL",html:"HTML",ini:"INI",java:"Java",javascript:"JavaScript",julia:"Julia",kotlin:"Kotlin",less:"Less",lexon:"Lexon",liquid:"Liquid",lua:"Lua",m3:"M3",markdown:"Markdown",mdx:"MDX",mips:"MIPS",msdax:"DAX",mysql:"MySQL","objective-c":"Objective-C",pascal:"Pascal",pascaligo:"PascaLIGO",perl:"Perl",pgsql:"PostgreSQL",php:"PHP",pla:"PLA",plaintext:"Plain Text",postiats:"Postiats",powerquery:"Power Query",powershell:"PowerShell",protobuf:"Protobuf",pug:"Pug",python:"Python",qsharp:"Q#",r:"R",razor:"Razor",redis:"Redis",redshift:"Amazon Redshift",restructuredtext:"reStructuredText",ruby:"Ruby",rust:"Rust",sb:"Small Basic",scala:"Scala",scheme:"Scheme",scss:"SCSS",shell:"Shell",solidity:"Solidity",sophia:"Sophia",sparql:"SPARQL",sql:"SQL",st:"Structured Text",swift:"Swift",systemverilog:"SystemVerilog",tcl:"Tcl",twig:"Twig",typescript:"TypeScript",typespec:"TypeSpec",vb:"Visual Basic",wgsl:"WGSL",xml:"XML",yaml:"YAML"};var sC=({autoComplete:t,field:e,forceRender:o,languages:n=Io,path:r,permissions:l,readOnly:s,renderedBlocks:i,schemaPath:u,typescript:d,validate:c})=>{let a=rC(([C])=>C.language),m=a?.value||a?.initialValue||"typescript",p=lC(),f=n[m],h=iC(()=>({...e,type:"code",admin:{...e.admin,editorOptions:{},editorProps:{defaultPath:m==="ts"?`file-${e.name}-${p}.tsx`:void 0},language:m}}),[e,m,p]),x=`${e.name}-${m}-${f}`;return h&&oC(nC,{autoComplete:t,field:h,forceRender:o,onMount:(C,E)=>{E.editor.defineTheme("vs-dark",{base:"vs-dark",colors:{"editor.background":"#222222"},inherit:!0,rules:[]}),E.editor.defineTheme("vs",{base:"vs",colors:{"editor.background":"#f5f5f5"},inherit:!0,rules:[]}),E.languages.typescript.typescriptDefaults.setCompilerOptions({allowNonTsExtensions:!0,allowJs:!0,allowSyntheticDefaultImports:!0,esModuleInterop:!0,jsx:E.languages.typescript.JsxEmit.React,moduleResolution:E.languages.typescript.ModuleResolutionKind.NodeJs,noEmit:!0,paths:d?.paths,reactNamespace:"React",target:E.languages.typescript.ScriptTarget[d?.target??"ESNext"],typeRoots:d?.typeRoots??["node_modules/@types"]}),E.languages.typescript.typescriptDefaults.setDiagnosticsOptions({noSemanticValidation:!d?.enableSemanticValidation,noSyntaxValidation:!1}),(async()=>d?.fetchTypes&&Array.isArray(d.fetchTypes)&&d.fetchTypes.length>0&&await Promise.all(d.fetchTypes.map(async g=>{let k=await(await fetch(g.url)).text();E.languages.typescript.typescriptDefaults.addExtraLib(k,g.filePath)})))()},path:r,permissions:l,readOnly:s,renderedBlocks:i,schemaPath:u,validate:c},x)};import{jsx as ie,jsxs as Hc}from"react/jsx-runtime";import{useLexicalEditable as xC}from"@lexical/react/useLexicalEditable";import{ChevronIcon as CC,Combobox as bC,CopyToClipboard as kC,PopupList as _C,RenderFields as TC,useForm as EC,useFormFields as Gc,useTranslation as wC}from"@payloadcms/ui";import SC from"react";import{jsx as Dc}from"react/jsx-runtime";import"react";var aC={16:"M6.646 6.146a.5.5 0 1 0 .708.708l1.5-1.5a.5.5 0 0 0 0-.708l-1.5-1.5a.5.5 0 1 0-.708.708L7.793 5zm-1.292-3a.5.5 0 0 1 0 .708L4.207 5l1.147 1.146a.5.5 0 1 1-.708.708l-1.5-1.5a.5.5 0 0 1 0-.708l1.5-1.5a.5.5 0 0 1 .708 0M10.5 3h1A1.5 1.5 0 0 1 13 4.5v7a1.5 1.5 0 0 1-1.5 1.5h-7A1.5 1.5 0 0 1 3 11.5v-3a.5.5 0 0 1 1 0v3a.5.5 0 0 0 .5.5h7a.5.5 0 0 0 .5-.5v-7a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 1 0-1",24:"M16.5 6C17.3284 6 18 6.67157 18 7.5V16.5C18 17.3284 17.3284 18 16.5 18H7.5C6.67157 18 6 17.3284 6 16.5V12.5C6 12.2239 6.22386 12 6.5 12C6.77614 12 7 12.2239 7 12.5V16.5C7 16.7761 7.22386 17 7.5 17H16.5C16.7761 17 17 16.7761 17 16.5V7.5C17 7.22386 16.7761 7 16.5 7H15.5C15.2239 7 15 6.77614 15 6.5C15 6.22386 15.2239 6 15.5 6H16.5ZM8.14648 6.14648C8.34175 5.95122 8.65825 5.95122 8.85352 6.14648C9.04878 6.34175 9.04878 6.65825 8.85352 6.85352L7.20703 8.5L8.85352 10.1465C9.04878 10.3417 9.04878 10.6583 8.85352 10.8535C8.65825 11.0488 8.34175 11.0488 8.14648 10.8535L6.14648 8.85352C5.95122 8.65825 5.95122 8.34175 6.14648 8.14648L8.14648 6.14648ZM11.1465 6.14648C11.3417 5.95122 11.6583 5.95122 11.8535 6.14648L13.8535 8.14648C14.0488 8.34175 14.0488 8.65825 13.8535 8.85352L11.8535 10.8535C11.6583 11.0488 11.3417 11.0488 11.1465 10.8535C10.9512 10.6583 10.9512 10.3417 11.1465 10.1465L12.793 8.5L11.1465 6.85352C10.9512 6.65825 10.9512 6.34175 11.1465 6.14648Z"},Oc=({className:t,size:e=24})=>Dc("svg",{className:t,fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:Dc("path",{clipRule:"evenodd",d:aC[e],fill:"currentColor",fillRule:"evenodd"})});import{jsx as rr}from"react/jsx-runtime";import"react";import{useCollapsible as mC}from"@payloadcms/ui";import{jsx as Fc}from"react/jsx-runtime";import"react";var cC="M11.4999 13C11.6325 13 11.7597 13.0527 11.8535 13.1464L14.8535 16.1464C15.0487 16.3417 15.0487 16.6582 14.8535 16.8535C14.6582 17.0487 14.3417 17.0487 14.1464 16.8535L11.4999 14.207L8.85346 16.8535C8.6582 17.0487 8.34169 17.0487 8.14643 16.8535C7.95119 16.6582 7.95119 16.3417 8.14643 16.1464L11.1464 13.1464C11.2402 13.0527 11.3674 13 11.4999 13ZM14.1464 7.14644C14.3417 6.95119 14.6582 6.95118 14.8535 7.14644C15.0487 7.3417 15.0487 7.65821 14.8535 7.85347L11.8535 10.8535C11.7597 10.9472 11.6325 10.9999 11.4999 11C11.3674 10.9999 11.2402 10.9472 11.1464 10.8535L8.14643 7.85347C7.95119 7.65821 7.95119 7.3417 8.14643 7.14644C8.34169 6.9512 8.6582 6.9512 8.85346 7.14644L11.4999 9.79292L14.1464 7.14644Z",Mo=({className:t})=>Fc("svg",{className:t,fill:"none",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Fc("path",{d:cC,fill:"currentColor"})});import{jsx as Pc}from"react/jsx-runtime";import"react";var uC="M11.5 6C11.6326 6 11.7597 6.05272 11.8535 6.14648L14.8535 9.14648C15.0487 9.34175 15.0487 9.65825 14.8535 9.85352C14.6582 10.0488 14.3417 10.0488 14.1464 9.85352L12 7.70703V16.293L14.1464 14.1465C14.3417 13.9512 14.6582 13.9512 14.8535 14.1465C15.0487 14.3417 15.0487 14.6583 14.8535 14.8535L11.8535 17.8535C11.6582 18.0488 11.3417 18.0488 11.1464 17.8535L8.14645 14.8535C7.95119 14.6583 7.95119 14.3417 8.14645 14.1465C8.34171 13.9512 8.65822 13.9512 8.85348 14.1465L11 16.293V7.70703L8.85348 9.85352C8.65822 10.0488 8.34171 10.0488 8.14645 9.85352C7.95118 9.65825 7.95118 9.34175 8.14645 9.14648L11.1464 6.14648C11.2402 6.05272 11.3674 6 11.5 6Z",Ao=({className:t})=>Pc("svg",{className:t,fill:"none",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Pc("path",{clipRule:"evenodd",d:uC,fill:"currentColor",fillRule:"evenodd"})});var dC="code-block-collapse-button",Bc=()=>{let{isCollapsed:t,toggle:e}=mC();return rr("button",{className:dC,onClick:e,type:"button",children:t?rr(Ao,{}):rr(Mo,{})})};import{jsx as lr,jsxs as pC}from"react/jsx-runtime";import{useCollapsible as fC,useTranslation as hC}from"@payloadcms/ui";import"react";var gC="code-block-floating-collapse-button",jc=()=>{let{isCollapsed:t,toggle:e}=fC(),{t:o}=hC();return pC("button",{className:gC,onClick:e,type:"button",children:[t?lr(Ao,{}):lr(Mo,{}),lr("span",{children:o(t?"general:expand":"general:collapse")})]})};var Xe="payload-richtext-code-block",NC=t=>{let{languages:e}=t,o=e||Io,{BlockCollapsible:n,formSchema:r,RemoveButton:l}=ce(),{setModified:s}=EC(),{t:i}=wC(),{codeField:u}=Gc(([f])=>({codeField:f?.code})),{selectedLanguageField:d,setSelectedLanguage:c}=Gc(([f,h])=>({selectedLanguageField:f?.language,setSelectedLanguage:x=>{h({type:"UPDATE",path:"language",value:x}),s(!0)}})),a=o[d?.value],m=xC(),p=SC.useMemo(()=>Object.entries(o).map(([f,h])=>({name:`${f} ${h}`,Component:ie(_C.Button,{active:!1,disabled:!1,onClick:()=>{c(f)},children:ie("span",{className:`${Xe}__language-code`,"data-language":f,children:h})})})),[o,c]);return ie(n,{Actions:Hc("div",{className:`${Xe}__actions`,children:[ie(bC,{"aria-label":i("general:language"),button:Hc("div",{className:`${Xe}__language-selector-button`,"data-selected-language":d?.value,children:[ie("span",{children:a}),ie(CC,{className:`${Xe}__chevron`})]}),buttonType:"custom",className:`${Xe}__language-selector`,disabled:!m,entries:p,horizontalAlign:"right",minEntriesForSearch:8,searchPlaceholder:i("fields:searchForLanguage"),showScrollbar:!0,size:"large"}),ie(kC,{value:u?.value??""}),ie(Bc,{}),m&&ie(l,{})]}),className:Xe,collapsibleProps:{AfterCollapsible:ie(jc,{}),disableHeaderToggle:!0,disableToggleIndicator:!0},Pill:ie("div",{className:`${Xe}__pill`,children:ie(Oc,{})}),showDragHandle:!1,showRowNumber:!1,children:ie(TC,{fields:r,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!m})})};import{c as LC}from"react/compiler-runtime";import{jsx as gt}from"react/jsx-runtime";import{FieldContext as yC,FieldPathContext as zc,ServerFunctionsContext as Uc,ShimmerEffect as RC,useServerFunctions as vC}from"@payloadcms/ui";import IC,{useEffect as MC,useRef as AC}from"react";var $C=t=>{let e=LC(10),{name:o,field:n,initialValue:r,label:l,Loading:s,path:i,schemaPath:u,setValue:d,value:c}=t,[a,m]=IC.useState(null),p=vC(),{_internal_renderField:f}=p,[h,x]=u.split(".",2),C=o!==void 0?o:n?.name,E=l!==void 0?l:n?.label,w=i??C??"",g;e[0]!==f||e[1]!==E||e[2]!==C||e[3]!==r||e[4]!==i||e[5]!==u?(g=()=>{(async function(){let{Field:L}=await f({name:C,hidden:!1,initialValue:r??void 0,label:typeof E=="function"?void 0:E,path:i,schemaPath:u});m(L)})()},e[0]=f,e[1]=E,e[2]=C,e[3]=r,e[4]=i,e[5]=u,e[6]=g):g=e[6];let b=g,k=AC(!1),_,T;if(e[7]!==b?(_=()=>{k.current||(k.current=!0,b())},T=[b],e[7]=b,e[8]=_,e[9]=T):(_=e[8],T=e[9]),MC(_,T),!a)return typeof s<"u"?s:gt(RC,{});let I={...p,getFormState:async S=>p.getFormState({...S,collectionSlug:h==="collection"?x:void 0,globalSlug:h==="global"?x:void 0})};if(typeof c>"u"&&!d)return gt(Uc,{value:{...I},children:gt(zc,{value:w,children:a},w)});let N={disabled:!1,formInitializing:!1,formProcessing:!1,formSubmitted:!1,initialValue:c,path:w,setValue:d??DC,showError:!1,value:c};return gt(Uc,{value:{...I},children:gt(zc,{value:w,children:gt(yC,{value:N,children:a})},w)})};function DC(){}function Wc({nodes:t,text:e}){let o={root:{type:"root",children:[],direction:"ltr",format:"",indent:0,version:1}};return e&&o.root.children.push({type:"paragraph",children:[{type:"text",detail:0,format:0,mode:"normal",style:"",text:e,version:1}],direction:"ltr",format:"",indent:0,textFormat:0,textStyle:"",version:1}),t?.length&&o.root.children.push(...t),o.root.children.length===0&&o.root.children.push({type:"paragraph",children:[],direction:"ltr",format:"",indent:0,textFormat:0,textStyle:"",version:1}),o}var OC=Wc;export{vt as $createAutoLinkNode,Be as $createBlockNode,lt as $createHorizontalRuleNode,kt as $createInlineBlockNode,Te as $createLinkNode,Ve as $createRelationshipNode,ve as $createUploadNode,we as $isAutoLinkNode,Ae as $isBlockNode,Ge as $isHorizontalRuleNode,_t as $isInlineBlockNode,Z as $isLinkNode,yn as $isRelationshipNode,ot as $isUploadNode,ku as AlignFeatureClient,Ee as AutoLinkNode,Kx as BlockCollapsible,Yx as BlockEditButton,de as BlockNode,Qx as BlockRemoveButton,yu as BlockquoteFeatureClient,lm as BlocksFeatureClient,Am as BoldFeatureClient,ae as CAN_USE_DOM,n0 as ChecklistFeatureClient,NC as CodeBlockBlockComponent,sC as CodeComponent,I0 as DETAIL_TYPE_TO_DETAIL,L0 as DOUBLE_LINE_BREAK,U0 as DebugJsxConverterFeatureClient,A0 as ELEMENT_FORMAT_TO_TYPE,M0 as ELEMENT_TYPE_TO_FORMAT,lu as ENABLE_SLASH_MENU_COMMAND,tu as EditorConfigProvider,Po as FieldsDrawer,N5 as FixedToolbarFeatureClient,Kp as HeadingFeatureClient,pf as HorizontalRuleFeatureClient,_e as HorizontalRuleNode,nt as INSERT_BLOCK_COMMAND,rt as INSERT_INLINE_BLOCK_COMMAND,S0 as IS_ALL_FORMATTING,Rf as IndentFeatureClient,Wx as InlineBlockContainer,Ox as InlineBlockEditButton,Gx as InlineBlockLabel,bt as InlineBlockNode,Bx as InlineBlockRemoveButton,Bm as InlineCodeFeatureClient,j5 as InlineToolbarFeatureClient,Vm as ItalicFeatureClient,R0 as LTR_REGEX,K1 as LinkFeatureClient,re as LinkNode,N0 as NON_BREAKING_SPACE,D as NodeFormat,c0 as OrderedListFeatureClient,x0 as ParagraphFeatureClient,nu as Point,y0 as RTL_REGEX,iu as Rect,Oh as RelationshipFeatureClient,Se as RelationshipNode,$C as RenderLexical,Sx as RichTextField,Bo as RichTextViewProvider,qm as StrikethroughFeatureClient,np as SubscriptFeatureClient,ap as SuperscriptFeatureClient,$0 as TEXT_MODE_TO_TYPE,v0 as TEXT_TYPE_TO_FORMAT,D0 as TEXT_TYPE_TO_MODE,fe as TOGGLE_LINK_COMMAND,P2 as TableFeatureClient,bm as TestRecorderFeatureClient,wp as TextStateFeatureClient,Ot as ToolbarButton,Ft as ToolbarDropdown,wm as TreeViewFeatureClient,pp as UnderlineFeatureClient,h0 as UnorderedListFeatureClient,fx as UploadFeatureClient,tt as UploadNode,Ax as addSwipeDownListener,vx as addSwipeLeftListener,Ix as addSwipeRightListener,Mx as addSwipeUpListener,OC as buildDefaultEditorState,Wc as buildEditorState,$c as codeConverterClient,yx as createBlockNode,M as createClientFeature,W0 as defaultColors,or as defaultEditorLexicalConfig,On as getDOMRangeRect,su as getEnabledNodes,tC as getRestPopulateFn,it as getSelectedNode,ru as isPoint,Lx as joinClasses,nr as sanitizeClientEditorConfig,Mc as sanitizeClientFeatures,xo as setFloatingElemPosition,io as setFloatingElemPositionForLinkEditor,Q as slashMenuBasicGroupWithItems,ke as toolbarAddDropdownGroupWithItems,an as toolbarFeatureButtonsGroupWithItems,ee as toolbarFormatGroupWithItems,ne as toolbarTextDropdownGroupWithItems,ce as useBlockComponentContext,W as useEditorConfigContext,Ce as useInlineBlockComponentContext,ou as useLexicalDocumentDrawer,Oe as useLexicalDrawer,Dt as useLexicalListDrawer,jo as useRichTextView};
|
|
64
|
+
`)&&o?.input?.trim()!=="```"+n?{code:n+(t?.length?t:""),language:""}:{code:t,language:n}}};import{jsx as fC}from"react/jsx-runtime";import{CodeField as pC,useFormFields as hC}from"@payloadcms/ui";import{useId as gC,useMemo as xC}from"react";var Oo={abap:"ABAP",apex:"Apex",azcli:"Azure CLI",bat:"Batch",bicep:"Bicep",cameligo:"CameLIGO",clojure:"Clojure",coffee:"CoffeeScript",cpp:"C++",csharp:"C#",csp:"CSP",css:"CSS",cypher:"Cypher",dart:"Dart",dockerfile:"Dockerfile",ecl:"ECL",elixir:"Elixir",flow9:"Flow9",freemarker2:"FreeMarker 2",fsharp:"F#",go:"Go",graphql:"GraphQL",handlebars:"Handlebars",hcl:"HCL",html:"HTML",ini:"INI",java:"Java",javascript:"JavaScript",julia:"Julia",kotlin:"Kotlin",less:"Less",lexon:"Lexon",liquid:"Liquid",lua:"Lua",m3:"M3",markdown:"Markdown",mdx:"MDX",mips:"MIPS",msdax:"DAX",mysql:"MySQL","objective-c":"Objective-C",pascal:"Pascal",pascaligo:"PascaLIGO",perl:"Perl",pgsql:"PostgreSQL",php:"PHP",pla:"PLA",plaintext:"Plain Text",postiats:"Postiats",powerquery:"Power Query",powershell:"PowerShell",protobuf:"Protobuf",pug:"Pug",python:"Python",qsharp:"Q#",r:"R",razor:"Razor",redis:"Redis",redshift:"Amazon Redshift",restructuredtext:"reStructuredText",ruby:"Ruby",rust:"Rust",sb:"Small Basic",scala:"Scala",scheme:"Scheme",scss:"SCSS",shell:"Shell",solidity:"Solidity",sophia:"Sophia",sparql:"SPARQL",sql:"SQL",st:"Structured Text",swift:"Swift",systemverilog:"SystemVerilog",tcl:"Tcl",twig:"Twig",typescript:"TypeScript",typespec:"TypeSpec",vb:"Visual Basic",wgsl:"WGSL",xml:"XML",yaml:"YAML"};var CC=({autoComplete:t,field:e,forceRender:o,languages:n=Oo,path:r,permissions:l,readOnly:s,renderedBlocks:i,schemaPath:u,typescript:d,validate:c})=>{let a=hC(([C])=>C.language),m=a?.value||a?.initialValue||"typescript",f=gC(),h=n[m],p=xC(()=>({...e,type:"code",admin:{...e.admin,editorOptions:{},editorProps:{defaultPath:m==="ts"?`file-${e.name}-${f}.tsx`:void 0},language:m}}),[e,m,f]),g=`${e.name}-${m}-${h}`;return p&&fC(pC,{autoComplete:t,field:p,forceRender:o,onMount:(C,E)=>{E.editor.defineTheme("vs-dark",{base:"vs-dark",colors:{"editor.background":"#222222"},inherit:!0,rules:[]}),E.editor.defineTheme("vs",{base:"vs",colors:{"editor.background":"#f5f5f5"},inherit:!0,rules:[]}),E.languages.typescript.typescriptDefaults.setCompilerOptions({allowNonTsExtensions:!0,allowJs:!0,allowSyntheticDefaultImports:!0,esModuleInterop:!0,jsx:E.languages.typescript.JsxEmit.React,moduleResolution:E.languages.typescript.ModuleResolutionKind.NodeJs,noEmit:!0,paths:d?.paths,reactNamespace:"React",target:E.languages.typescript.ScriptTarget[d?.target??"ESNext"],typeRoots:d?.typeRoots??["node_modules/@types"]}),E.languages.typescript.typescriptDefaults.setDiagnosticsOptions({noSemanticValidation:!d?.enableSemanticValidation,noSyntaxValidation:!1}),(async()=>d?.fetchTypes&&Array.isArray(d.fetchTypes)&&d.fetchTypes.length>0&&await Promise.all(d.fetchTypes.map(async x=>{let k=await(await fetch(x.url)).text();E.languages.typescript.typescriptDefaults.addExtraLib(k,x.filePath)})))()},path:r,permissions:l,readOnly:s,renderedBlocks:i,schemaPath:u,validate:c},g)};import{jsx as le,jsxs as Xc}from"react/jsx-runtime";import{useLexicalEditable as yC}from"@lexical/react/useLexicalEditable";import{ChevronIcon as RC,Combobox as vC,CopyToClipboard as IC,PopupList as MC,RenderFields as AC,useForm as DC,useFormFields as Yc,useTranslation as $C}from"@payloadcms/ui";import OC from"react";import{jsx as Uc}from"react/jsx-runtime";import"react";var bC={16:"M6.646 6.146a.5.5 0 1 0 .708.708l1.5-1.5a.5.5 0 0 0 0-.708l-1.5-1.5a.5.5 0 1 0-.708.708L7.793 5zm-1.292-3a.5.5 0 0 1 0 .708L4.207 5l1.147 1.146a.5.5 0 1 1-.708.708l-1.5-1.5a.5.5 0 0 1 0-.708l1.5-1.5a.5.5 0 0 1 .708 0M10.5 3h1A1.5 1.5 0 0 1 13 4.5v7a1.5 1.5 0 0 1-1.5 1.5h-7A1.5 1.5 0 0 1 3 11.5v-3a.5.5 0 0 1 1 0v3a.5.5 0 0 0 .5.5h7a.5.5 0 0 0 .5-.5v-7a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 1 0-1",24:"M16.5 6C17.3284 6 18 6.67157 18 7.5V16.5C18 17.3284 17.3284 18 16.5 18H7.5C6.67157 18 6 17.3284 6 16.5V12.5C6 12.2239 6.22386 12 6.5 12C6.77614 12 7 12.2239 7 12.5V16.5C7 16.7761 7.22386 17 7.5 17H16.5C16.7761 17 17 16.7761 17 16.5V7.5C17 7.22386 16.7761 7 16.5 7H15.5C15.2239 7 15 6.77614 15 6.5C15 6.22386 15.2239 6 15.5 6H16.5ZM8.14648 6.14648C8.34175 5.95122 8.65825 5.95122 8.85352 6.14648C9.04878 6.34175 9.04878 6.65825 8.85352 6.85352L7.20703 8.5L8.85352 10.1465C9.04878 10.3417 9.04878 10.6583 8.85352 10.8535C8.65825 11.0488 8.34175 11.0488 8.14648 10.8535L6.14648 8.85352C5.95122 8.65825 5.95122 8.34175 6.14648 8.14648L8.14648 6.14648ZM11.1465 6.14648C11.3417 5.95122 11.6583 5.95122 11.8535 6.14648L13.8535 8.14648C14.0488 8.34175 14.0488 8.65825 13.8535 8.85352L11.8535 10.8535C11.6583 11.0488 11.3417 11.0488 11.1465 10.8535C10.9512 10.6583 10.9512 10.3417 11.1465 10.1465L12.793 8.5L11.1465 6.85352C10.9512 6.65825 10.9512 6.34175 11.1465 6.14648Z"},zc=({className:t,size:e=24})=>Uc("svg",{className:t,fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:Uc("path",{clipRule:"evenodd",d:bC[e],fill:"currentColor",fillRule:"evenodd"})});import{jsx as hr}from"react/jsx-runtime";import"react";import{useCollapsible as EC}from"@payloadcms/ui";import{jsx as Wc}from"react/jsx-runtime";import"react";var kC="M11.4999 13C11.6325 13 11.7597 13.0527 11.8535 13.1464L14.8535 16.1464C15.0487 16.3417 15.0487 16.6582 14.8535 16.8535C14.6582 17.0487 14.3417 17.0487 14.1464 16.8535L11.4999 14.207L8.85346 16.8535C8.6582 17.0487 8.34169 17.0487 8.14643 16.8535C7.95119 16.6582 7.95119 16.3417 8.14643 16.1464L11.1464 13.1464C11.2402 13.0527 11.3674 13 11.4999 13ZM14.1464 7.14644C14.3417 6.95119 14.6582 6.95118 14.8535 7.14644C15.0487 7.3417 15.0487 7.65821 14.8535 7.85347L11.8535 10.8535C11.7597 10.9472 11.6325 10.9999 11.4999 11C11.3674 10.9999 11.2402 10.9472 11.1464 10.8535L8.14643 7.85347C7.95119 7.65821 7.95119 7.3417 8.14643 7.14644C8.34169 6.9512 8.6582 6.9512 8.85346 7.14644L11.4999 9.79292L14.1464 7.14644Z",Fo=({className:t})=>Wc("svg",{className:t,fill:"none",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Wc("path",{d:kC,fill:"currentColor"})});import{jsx as Vc}from"react/jsx-runtime";import"react";var _C="M11.5 6C11.6326 6 11.7597 6.05272 11.8535 6.14648L14.8535 9.14648C15.0487 9.34175 15.0487 9.65825 14.8535 9.85352C14.6582 10.0488 14.3417 10.0488 14.1464 9.85352L12 7.70703V16.293L14.1464 14.1465C14.3417 13.9512 14.6582 13.9512 14.8535 14.1465C15.0487 14.3417 15.0487 14.6583 14.8535 14.8535L11.8535 17.8535C11.6582 18.0488 11.3417 18.0488 11.1464 17.8535L8.14645 14.8535C7.95119 14.6583 7.95119 14.3417 8.14645 14.1465C8.34171 13.9512 8.65822 13.9512 8.85348 14.1465L11 16.293V7.70703L8.85348 9.85352C8.65822 10.0488 8.34171 10.0488 8.14645 9.85352C7.95118 9.65825 7.95118 9.34175 8.14645 9.14648L11.1464 6.14648C11.2402 6.05272 11.3674 6 11.5 6Z",Po=({className:t})=>Vc("svg",{className:t,fill:"none",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Vc("path",{clipRule:"evenodd",d:_C,fill:"currentColor",fillRule:"evenodd"})});var TC="code-block-collapse-button",Kc=()=>{let{isCollapsed:t,toggle:e}=EC();return hr("button",{className:TC,onClick:e,type:"button",children:t?hr(Po,{}):hr(Fo,{})})};import{jsx as gr,jsxs as wC}from"react/jsx-runtime";import{useCollapsible as SC,useTranslation as NC}from"@payloadcms/ui";import"react";var LC="code-block-floating-collapse-button",Jc=()=>{let{isCollapsed:t,toggle:e}=SC(),{t:o}=NC();return wC("button",{className:LC,onClick:e,type:"button",children:[t?gr(Po,{}):gr(Fo,{}),gr("span",{children:o(t?"general:expand":"general:collapse")})]})};var Ke="payload-richtext-code-block",FC=t=>{let{languages:e}=t,o=e||Oo,{BlockCollapsible:n,formSchema:r,RemoveButton:l}=ae(),{setModified:s}=DC(),{t:i}=$C(),{codeField:u}=Yc(([h])=>({codeField:h?.code})),{selectedLanguageField:d,setSelectedLanguage:c}=Yc(([h,p])=>({selectedLanguageField:h?.language,setSelectedLanguage:g=>{p({type:"UPDATE",path:"language",value:g}),s(!0)}})),a=o[d?.value],m=yC(),f=OC.useMemo(()=>Object.entries(o).map(([h,p])=>({name:`${h} ${p}`,Component:le(MC.Button,{active:!1,disabled:!1,onClick:()=>{c(h)},children:le("span",{className:`${Ke}__language-code`,"data-language":h,children:p})})})),[o,c]);return le(n,{Actions:Xc("div",{className:`${Ke}__actions`,children:[le(vC,{"aria-label":i("general:language"),button:Xc("div",{className:`${Ke}__language-selector-button`,"data-selected-language":d?.value,children:[le("span",{children:a}),le(RC,{className:`${Ke}__chevron`})]}),buttonType:"custom",className:`${Ke}__language-selector`,disabled:!m,entries:f,horizontalAlign:"right",minEntriesForSearch:8,searchPlaceholder:i("fields:searchForLanguage"),showScrollbar:!0,size:"large"}),le(IC,{value:u?.value??""}),le(Kc,{}),m&&le(l,{})]}),className:Ke,collapsibleProps:{AfterCollapsible:le(Jc,{}),disableHeaderToggle:!0,disableToggleIndicator:!0},Pill:le("div",{className:`${Ke}__pill`,children:le(zc,{})}),showDragHandle:!1,showRowNumber:!1,children:le(AC,{fields:r,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!m})})};import{c as PC}from"react/compiler-runtime";import{jsx as gt}from"react/jsx-runtime";import{FieldContext as BC,FieldPathContext as Zc,ServerFunctionsContext as qc,ShimmerEffect as jC,useServerFunctions as HC}from"@payloadcms/ui";import GC,{useEffect as UC,useRef as zC}from"react";var WC=t=>{let e=PC(10),{name:o,field:n,initialValue:r,label:l,Loading:s,path:i,schemaPath:u,setValue:d,value:c}=t,[a,m]=GC.useState(null),f=HC(),{_internal_renderField:h}=f,[p,g]=u.split(".",2),C=o!==void 0?o:n?.name,E=l!==void 0?l:n?.label,L=i??C??"",x;e[0]!==h||e[1]!==E||e[2]!==C||e[3]!==r||e[4]!==i||e[5]!==u?(x=()=>{(async function(){let{Field:S}=await h({name:C,hidden:!1,initialValue:r??void 0,label:typeof E=="function"?void 0:E,path:i,schemaPath:u});m(S)})()},e[0]=h,e[1]=E,e[2]=C,e[3]=r,e[4]=i,e[5]=u,e[6]=x):x=e[6];let b=x,k=zC(!1),_,T;if(e[7]!==b?(_=()=>{k.current||(k.current=!0,b())},T=[b],e[7]=b,e[8]=_,e[9]=T):(_=e[8],T=e[9]),UC(_,T),!a)return typeof s<"u"?s:gt(jC,{});let I={...f,getFormState:async w=>f.getFormState({...w,collectionSlug:p==="collection"?g:void 0,globalSlug:p==="global"?g:void 0})};if(typeof c>"u"&&!d)return gt(qc,{value:{...I},children:gt(Zc,{value:L,children:a},L)});let N={disabled:!1,formInitializing:!1,formProcessing:!1,formSubmitted:!1,initialValue:c,path:L,setValue:d??VC,showError:!1,value:c};return gt(qc,{value:{...I},children:gt(Zc,{value:L,children:gt(BC,{value:N,children:a})},L)})};function VC(){}function Qc({nodes:t,text:e}){let o={root:{type:"root",children:[],direction:"ltr",format:"",indent:0,version:1}};return e&&o.root.children.push({type:"paragraph",children:[{type:"text",detail:0,format:0,mode:"normal",style:"",text:e,version:1}],direction:"ltr",format:"",indent:0,textFormat:0,textStyle:"",version:1}),t?.length&&o.root.children.push(...t),o.root.children.length===0&&o.root.children.push({type:"paragraph",children:[],direction:"ltr",format:"",indent:0,textFormat:0,textStyle:"",version:1}),o}var KC=Qc;export{At as $createAutoLinkNode,Fe as $createBlockNode,lt as $createHorizontalRuleNode,Tt as $createInlineBlockNode,_e as $createLinkNode,ze as $createRelationshipNode,ye as $createUploadNode,Ee as $isAutoLinkNode,Ie as $isBlockNode,je as $isHorizontalRuleNode,Et as $isInlineBlockNode,X as $isLinkNode,Bn as $isRelationshipNode,ot as $isUploadNode,Lu as AlignFeatureClient,Te as AutoLinkNode,rC as BlockCollapsible,sC as BlockEditButton,ue as BlockNode,uC as BlockRemoveButton,$u as BlockquoteFeatureClient,mm as BlocksFeatureClient,jm as BoldFeatureClient,se as CAN_USE_DOM,f0 as ChecklistFeatureClient,FC as CodeBlockBlockComponent,CC as CodeComponent,H0 as DETAIL_TYPE_TO_DETAIL,F0 as DOUBLE_LINE_BREAK,eh as DebugJsxConverterFeatureClient,U0 as ELEMENT_FORMAT_TO_TYPE,G0 as ELEMENT_TYPE_TO_FORMAT,mu as ENABLE_SLASH_MENU_COMMAND,au as EditorConfigProvider,Wo as FieldsDrawer,O5 as FixedToolbarFeatureClient,tp as HeadingFeatureClient,kp as HorizontalRuleFeatureClient,ke as HorizontalRuleNode,nt as INSERT_BLOCK_COMMAND,rt as INSERT_INLINE_BLOCK_COMMAND,$0 as IS_ALL_FORMATTING,Pp as IndentFeatureClient,oC as InlineBlockContainer,Kx as InlineBlockEditButton,Qx as InlineBlockLabel,_t as InlineBlockNode,Yx as InlineBlockRemoveButton,Vm as InlineCodeFeatureClient,Z5 as InlineToolbarFeatureClient,Qm as ItalicFeatureClient,B0 as LTR_REGEX,n0 as LinkFeatureClient,ne as LinkNode,O0 as NON_BREAKING_SPACE,O as NodeFormat,b0 as OrderedListFeatureClient,L0 as ParagraphFeatureClient,uu as Point,P0 as RTL_REGEX,fu as Rect,Vh as RelationshipFeatureClient,we as RelationshipNode,WC as RenderLexical,Ox as RichTextField,Vo as RichTextViewProvider,lf as StrikethroughFeatureClient,df as SubscriptFeatureClient,gf as SuperscriptFeatureClient,z0 as TEXT_MODE_TO_TYPE,j0 as TEXT_TYPE_TO_FORMAT,W0 as TEXT_TYPE_TO_MODE,pe as TOGGLE_LINK_COMMAND,X2 as TableFeatureClient,Nm as TestRecorderFeatureClient,Mf as TextStateFeatureClient,Bt as ToolbarButton,jt as ToolbarDropdown,Im as TreeViewFeatureClient,_f as UnderlineFeatureClient,S0 as UnorderedListFeatureClient,Sx as UploadFeatureClient,tt as UploadNode,zx as addSwipeDownListener,Hx as addSwipeLeftListener,Gx as addSwipeRightListener,Ux as addSwipeUpListener,KC as buildDefaultEditorState,Qc as buildEditorState,Gc as codeConverterClient,Bx as createBlockNode,A as createClientFeature,th as defaultColors,fr as defaultEditorLexicalConfig,Kn as getDOMRangeRect,pu as getEnabledNodes,mC as getRestPopulateFn,it as getSelectedNode,du as isPoint,Px as joinClasses,pr as sanitizeClientEditorConfig,jc as sanitizeClientFeatures,To as setFloatingElemPosition,mo as setFloatingElemPositionForLinkEditor,Z as slashMenuBasicGroupWithItems,be as toolbarAddDropdownGroupWithItems,bn as toolbarFeatureButtonsGroupWithItems,q as toolbarFormatGroupWithItems,oe as toolbarTextDropdownGroupWithItems,ae as useBlockComponentContext,W as useEditorConfigContext,xe as useInlineBlockComponentContext,cu as useLexicalDocumentDrawer,De as useLexicalDrawer,Pt as useLexicalListDrawer,Ko as useRichTextView};
|
|
65
65
|
//# sourceMappingURL=index.js.map
|