@payloadcms/richtext-lexical 3.2.3-canary.2d2e7d5 → 3.2.3-canary.673b4b5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/exports/client/bundled.css +1 -1
- package/dist/exports/client/{chunk-YSJURFKK.js → chunk-H6YVKFZN.js} +2 -2
- package/dist/exports/client/chunk-H6YVKFZN.js.map +7 -0
- package/dist/exports/client/componentInline-WMS3WMBA.js +2 -0
- package/dist/exports/client/index.d.ts +4 -0
- package/dist/exports/client/index.d.ts.map +1 -1
- package/dist/exports/client/index.js +11 -11
- package/dist/exports/client/index.js.map +4 -4
- package/dist/features/align/server/i18n.d.ts.map +1 -1
- package/dist/features/align/server/i18n.js +6 -0
- package/dist/features/align/server/i18n.js.map +1 -1
- package/dist/features/blockquote/server/i18n.d.ts.map +1 -1
- package/dist/features/blockquote/server/i18n.js +3 -0
- package/dist/features/blockquote/server/i18n.js.map +1 -1
- package/dist/features/blocks/WrapperBlockNode.d.ts +1151 -0
- package/dist/features/blocks/WrapperBlockNode.d.ts.map +1 -0
- package/dist/features/blocks/WrapperBlockNode.js +113 -0
- package/dist/features/blocks/WrapperBlockNode.js.map +1 -0
- package/dist/features/blocks/client/component/index.d.ts +1 -1
- package/dist/features/blocks/client/component/index.d.ts.map +1 -1
- package/dist/features/blocks/client/component/index.js.map +1 -1
- package/dist/features/blocks/client/componentInline/index.d.ts +1 -1
- package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
- package/dist/features/blocks/client/componentInline/index.js.map +1 -1
- package/dist/features/blocks/client/index.d.ts.map +1 -1
- package/dist/features/blocks/client/index.js +65 -4
- package/dist/features/blocks/client/index.js.map +1 -1
- package/dist/features/blocks/client/nodes/BlocksNode.d.ts +2 -2
- package/dist/features/blocks/client/nodes/BlocksNode.d.ts.map +1 -1
- package/dist/features/blocks/client/nodes/BlocksNode.js +1 -1
- package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
- package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts +2 -2
- package/dist/features/blocks/client/nodes/InlineBlocksNode.d.ts.map +1 -1
- package/dist/features/blocks/client/nodes/InlineBlocksNode.js +1 -1
- package/dist/features/blocks/client/nodes/InlineBlocksNode.js.map +1 -1
- package/dist/features/blocks/client/plugin/commands.d.ts +12 -1
- package/dist/features/blocks/client/plugin/commands.d.ts.map +1 -1
- package/dist/features/blocks/client/plugin/commands.js +2 -0
- package/dist/features/blocks/client/plugin/commands.js.map +1 -1
- package/dist/features/blocks/client/plugin/index.d.ts +1 -1
- package/dist/features/blocks/client/plugin/index.d.ts.map +1 -1
- package/dist/features/blocks/client/plugin/index.js +30 -35
- package/dist/features/blocks/client/plugin/index.js.map +1 -1
- package/dist/features/blocks/client/plugin/wrapperBlocks/BlockEditor/index.d.ts +23 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/BlockEditor/index.d.ts.map +1 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/BlockEditor/index.js +330 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/BlockEditor/index.js.map +1 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/BlockEditor/useLexicalFormState.d.ts +22 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/BlockEditor/useLexicalFormState.d.ts.map +1 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/BlockEditor/useLexicalFormState.js +169 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/BlockEditor/useLexicalFormState.js.map +1 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/components/WrapperBlockContainer.d.ts +5 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/components/WrapperBlockContainer.d.ts.map +1 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/components/WrapperBlockContainer.js +28 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/components/WrapperBlockContainer.js.map +1 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/components/WrapperBlockEditButton.d.ts +3 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/components/WrapperBlockEditButton.d.ts.map +1 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/components/WrapperBlockEditButton.js +22 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/components/WrapperBlockEditButton.js.map +1 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/components/WrapperBlockLabel.d.ts +3 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/components/WrapperBlockLabel.d.ts.map +1 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/components/WrapperBlockLabel.js +22 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/components/WrapperBlockLabel.js.map +1 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/components/WrapperBlockRemoveButton.d.ts +3 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/components/WrapperBlockRemoveButton.d.ts.map +1 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/components/WrapperBlockRemoveButton.js +22 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/components/WrapperBlockRemoveButton.js.map +1 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/index.d.ts +9 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/index.d.ts.map +1 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/index.js +111 -0
- package/dist/features/blocks/client/plugin/wrapperBlocks/index.js.map +1 -0
- package/dist/features/blocks/server/graphQLPopulationPromise.d.ts +4 -3
- package/dist/features/blocks/server/graphQLPopulationPromise.d.ts.map +1 -1
- package/dist/features/blocks/server/graphQLPopulationPromise.js.map +1 -1
- package/dist/features/blocks/server/i18n.d.ts.map +1 -1
- package/dist/features/blocks/server/i18n.js +144 -33
- package/dist/features/blocks/server/i18n.js.map +1 -1
- package/dist/features/blocks/server/index.d.ts +5 -1
- package/dist/features/blocks/server/index.d.ts.map +1 -1
- package/dist/features/blocks/server/index.js +82 -2
- package/dist/features/blocks/server/index.js.map +1 -1
- package/dist/features/blocks/server/markdownTransformer.js +2 -2
- package/dist/features/blocks/server/markdownTransformer.js.map +1 -1
- package/dist/features/blocks/server/nodes/{BlocksNode.d.ts → BlockNode.d.ts} +2 -2
- package/dist/features/blocks/server/nodes/BlockNode.d.ts.map +1 -0
- package/dist/features/blocks/server/nodes/{BlocksNode.js → BlockNode.js} +1 -1
- package/dist/features/blocks/server/nodes/BlockNode.js.map +1 -0
- package/dist/features/blocks/server/nodes/{InlineBlocksNode.d.ts → InlineBlockNode.d.ts} +1 -1
- package/dist/features/blocks/server/nodes/InlineBlockNode.d.ts.map +1 -0
- package/dist/features/blocks/server/nodes/{InlineBlocksNode.js → InlineBlockNode.js} +1 -1
- package/dist/features/blocks/server/nodes/InlineBlockNode.js.map +1 -0
- package/dist/features/blocks/server/validate.d.ts +4 -3
- package/dist/features/blocks/server/validate.d.ts.map +1 -1
- package/dist/features/blocks/server/validate.js.map +1 -1
- package/dist/features/heading/server/i18n.d.ts.map +1 -1
- package/dist/features/heading/server/i18n.js +3 -0
- package/dist/features/heading/server/i18n.js.map +1 -1
- package/dist/features/horizontalRule/server/i18n.d.ts.map +1 -1
- package/dist/features/horizontalRule/server/i18n.js +3 -0
- package/dist/features/horizontalRule/server/i18n.js.map +1 -1
- package/dist/features/indent/server/i18n.d.ts.map +1 -1
- package/dist/features/indent/server/i18n.js +4 -0
- package/dist/features/indent/server/i18n.js.map +1 -1
- package/dist/features/link/server/i18n.d.ts.map +1 -1
- package/dist/features/link/server/i18n.js +4 -0
- package/dist/features/link/server/i18n.js.map +1 -1
- package/dist/features/lists/checklist/server/i18n.d.ts.map +1 -1
- package/dist/features/lists/checklist/server/i18n.js +3 -0
- package/dist/features/lists/checklist/server/i18n.js.map +1 -1
- package/dist/features/lists/orderedList/server/i18n.d.ts.map +1 -1
- package/dist/features/lists/orderedList/server/i18n.js +3 -0
- package/dist/features/lists/orderedList/server/i18n.js.map +1 -1
- package/dist/features/lists/unorderedList/server/i18n.d.ts.map +1 -1
- package/dist/features/lists/unorderedList/server/i18n.js +3 -0
- package/dist/features/lists/unorderedList/server/i18n.js.map +1 -1
- package/dist/features/paragraph/server/i18n.d.ts.map +1 -1
- package/dist/features/paragraph/server/i18n.js +4 -0
- package/dist/features/paragraph/server/i18n.js.map +1 -1
- package/dist/features/relationship/server/i18n.d.ts.map +1 -1
- package/dist/features/relationship/server/i18n.js +3 -0
- package/dist/features/relationship/server/i18n.js.map +1 -1
- package/dist/features/typesClient.d.ts +3 -2
- package/dist/features/typesClient.d.ts.map +1 -1
- package/dist/features/typesClient.js.map +1 -1
- package/dist/features/typesServer.d.ts +8 -1
- package/dist/features/typesServer.d.ts.map +1 -1
- package/dist/features/typesServer.js.map +1 -1
- package/dist/features/upload/server/i18n.d.ts.map +1 -1
- package/dist/features/upload/server/i18n.js +3 -0
- package/dist/features/upload/server/i18n.js.map +1 -1
- package/dist/field/bundled.css +1 -1
- package/dist/field/index.d.ts.map +1 -1
- package/dist/field/index.js +19 -16
- package/dist/field/index.js.map +1 -1
- package/dist/field/rscEntry.js +2 -0
- package/dist/field/rscEntry.js.map +1 -1
- package/dist/i18n.d.ts.map +1 -1
- package/dist/i18n.js +6 -0
- package/dist/i18n.js.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lexical/config/client/loader.d.ts +2 -1
- package/dist/lexical/config/client/loader.d.ts.map +1 -1
- package/dist/lexical/config/client/loader.js +2 -0
- package/dist/lexical/config/client/loader.js.map +1 -1
- package/dist/nodeTypes.d.ts +2 -2
- package/dist/nodeTypes.d.ts.map +1 -1
- package/dist/nodeTypes.js.map +1 -1
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utilities/createClientFeature.d.ts +1 -0
- package/dist/utilities/createClientFeature.d.ts.map +1 -1
- package/dist/utilities/createClientFeature.js +2 -0
- package/dist/utilities/createClientFeature.js.map +1 -1
- package/dist/utilities/generateImportMap.d.ts.map +1 -1
- package/dist/utilities/generateImportMap.js +5 -2
- package/dist/utilities/generateImportMap.js.map +1 -1
- package/dist/utilities/initLexicalFeatures.d.ts +1 -0
- package/dist/utilities/initLexicalFeatures.d.ts.map +1 -1
- package/dist/utilities/initLexicalFeatures.js +18 -1
- package/dist/utilities/initLexicalFeatures.js.map +1 -1
- package/package.json +6 -6
- package/dist/exports/client/chunk-YSJURFKK.js.map +0 -7
- package/dist/exports/client/componentInline-OK3ZQ6YQ.js +0 -2
- package/dist/features/blocks/server/nodes/BlocksNode.d.ts.map +0 -1
- package/dist/features/blocks/server/nodes/BlocksNode.js.map +0 -1
- package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts.map +0 -1
- package/dist/features/blocks/server/nodes/InlineBlocksNode.js.map +0 -1
- /package/dist/exports/client/{componentInline-OK3ZQ6YQ.js.map → componentInline-WMS3WMBA.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use client";import{a as
|
|
1
|
+
"use client";import{a as Te,c as mo,d as po,e as fo}from"./chunk-H6YVKFZN.js";import{a as Xe,b as kt,c as Nt,d as Lt}from"./chunk-XCEM47RI.js";import{a as Je,b as qe,c as Qe,d as ho}from"./chunk-ZTAS32RX.js";import{a as Ye,b as Rt,c as et,d as tt,e as ot,f as go}from"./chunk-DOK5S7LE.js";import{a as se}from"./chunk-2CYU43GM.js";import{a as Os}from"./chunk-5PBXL4HT.js";import{a as As,b as Tr,d as wr,e as kr,f as Nr,g as Fs,h as $s,i as Ps,k as Bs,m as Hs,n as js}from"./chunk-2L2Z4JHF.js";import{a as Ds,b as B}from"./chunk-CUIBIFW2.js";function q(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{$isElementNode as we,$isRangeSelection as It,FORMAT_ELEMENT_COMMAND as yt}from"lexical";import{jsx as Co,jsxs as Ws}from"react/jsx-runtime";import"react";var Lr=()=>Ws("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Co("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Co("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Co("path",{d:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as xo,jsxs as Gs}from"react/jsx-runtime";import"react";var Rr=()=>Gs("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[xo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),xo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),xo("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as bo,jsxs as Us}from"react/jsx-runtime";import"react";var St=()=>Us("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[bo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),bo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),bo("path",{d:"M2.5 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as _o,jsxs as Vs}from"react/jsx-runtime";import"react";var Sr=()=>Vs("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[_o("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),_o("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),_o("path",{d:"M7.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});var D=t=>o=>{let r={clientFeatureProps:o};if(typeof t=="function")r.feature=({featureClientImportMap:n,featureClientSchemaMap:i,featureProviderMap:l,field:s,resolvedFeatures:a,schemaPath:c,unSanitizedEditorConfig:d})=>{let u=t({featureClientImportMap:n,featureClientSchemaMap:i,featureProviderMap:l,field:s,props:o,resolvedFeatures:a,schemaPath:c,unSanitizedEditorConfig:d});return u.sanitizedClientFeatureProps===null&&(u.sanitizedClientFeatureProps=o),u};else{let n={...t};n.sanitizedClientFeatureProps=o,r.feature=n}return r};var Ir=t=>({type:"dropdown",ChildComponent:St,items:t,key:"align",order:30});var yr=[Ir([{ChildComponent:St,isActive:({selection:t})=>{if(!It(t))return!1;for(let e of t.getNodes()){if(we(e)&&e.getFormatType()==="left")continue;let o=e.getParent();if(!(we(o)&&o.getFormatType()==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(yt,"left")},order:1},{ChildComponent:Lr,isActive:({selection:t})=>{if(!It(t))return!1;for(let e of t.getNodes()){if(we(e)&&e.getFormatType()==="center")continue;let o=e.getParent();if(!(we(o)&&o.getFormatType()==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(yt,"center")},order:2},{ChildComponent:Sr,isActive:({selection:t})=>{if(!It(t))return!1;for(let e of t.getNodes()){if(we(e)&&e.getFormatType()==="right")continue;let o=e.getParent();if(!(we(o)&&o.getFormatType()==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(yt,"right")},order:3},{ChildComponent:Rr,isActive:({selection:t})=>{if(!It(t))return!1;for(let e of t.getNodes()){if(we(e)&&e.getFormatType()==="justify")continue;let o=e.getParent();if(!(we(o)&&o.getFormatType()==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(yt,"justify")},order:4}])],Ks=D({toolbarFixed:{groups:yr},toolbarInline:{groups:yr}});import{$createQuoteNode as $r,$isQuoteNode as Or,QuoteNode as Ys}from"@lexical/rich-text";import{$setBlocksType as Pr}from"@lexical/selection";import{$getSelection as Br,$isRangeSelection as Js}from"lexical";import{jsx as vr}from"react/jsx-runtime";import"react";var Eo=()=>vr("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:vr("path",{d:"M13.5353 10.5725C13.5353 9.47709 11.0456 9.99991 11.0456 7.85883C11.0456 6.46464 12.1162 5.61816 13.361 5.61816C14.805 5.61816 16 6.86298 16 8.92937C16 11.2945 14.4564 13.7841 11.1203 14.3816L10.8216 13.1368C12.888 12.4895 13.5353 11.4937 13.5353 10.5725ZM6.71369 10.5725C6.71369 9.47709 4.22407 9.99991 4.22407 7.85883C4.22407 6.46464 5.29461 5.61816 6.53942 5.61816C7.9834 5.61816 9.17842 6.86298 9.17842 8.92937C9.17842 11.2945 7.63485 13.7841 4.29876 14.3816L4 13.1368C6.06639 12.4895 6.71369 11.4937 6.71369 10.5725Z",fill:"currentColor"})});import{jsx as Mr}from"react/jsx-runtime";import"react";var rt=()=>Mr("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Mr("path",{d:"M11.708 14.5H7.79785V13.9414H8.01367C9.00391 13.9414 9.15625 13.9033 9.15625 13.6113V6.70508H8.07715C6.82031 6.70508 6.73145 7.08594 6.28711 8.67285H5.80469L5.91895 6.12109H13.5869L13.7012 8.67285H13.2188C12.7744 7.08594 12.6855 6.70508 11.4287 6.70508H10.3496V13.6113C10.3496 13.9033 10.502 13.9414 11.4922 13.9414H11.708V14.5Z",fill:"currentColor"})});var ie=t=>({type:"dropdown",ChildComponent:rt,items:t,key:"text",order:25});import{$createQuoteNode as zs,$isQuoteNode as Dr,QuoteNode as Zs}from"@lexical/rich-text";import{$createLineBreakNode as Xs}from"lexical";var Ar={type:"element",dependencies:[Zs],export:(t,e)=>{if(!Dr(t))return null;let o=e(t).split(`
|
|
2
2
|
`),r=[];for(let n of o)r.push("> "+n);return r.join(`
|
|
3
|
-
`)},regExp:/^>\s/,replace:(t,e,o,r)=>{if(r){let i=t.getPreviousSibling();if(wr(i)){i.splice(i.getChildrenSize(),0,[Ss(),...e]),i.select(0,0),t.remove();return}}let n=Ls();n.append(...e),t.replace(n),n.select(0,0)}};var Lr=[q([{ChildComponent:po,isActive:({selection:t})=>{if(!ys(t))return!1;for(let e of t.getNodes())if(!Nr(e)&&!Nr(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Ir();Sr(e,()=>Rr())})},order:20}])],vs=y({markdownTransformers:[kr],nodes:[Is],slashMenu:{groups:[Z([{Icon:po,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Ir();Sr(e,()=>Rr())})}}])]},toolbarFixed:{groups:Lr},toolbarInline:{groups:Lr}});import{getTranslation as It}from"@payloadcms/translations";import{jsx as fo,jsxs as Ms}from"react/jsx-runtime";import"react";var wt=()=>Ms("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[fo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),fo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),fo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as yr}from"react/jsx-runtime";import"react";var kt=()=>yr("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:yr("path",{clipRule:"evenodd",d:"M5.33333 6.5C5.11232 6.5 4.90036 6.5878 4.74408 6.74408C4.5878 6.90036 4.5 7.11232 4.5 7.33333V12.1667C4.5 12.3877 4.5878 12.5996 4.74408 12.7559C4.90036 12.9122 5.11232 13 5.33333 13H14.6667C14.8877 13 15.0996 12.9122 15.2559 12.7559C15.4122 12.5996 15.5 12.3877 15.5 12.1667V11.6667C15.5 11.3905 15.7239 11.1667 16 11.1667C16.2761 11.1667 16.5 11.3905 16.5 11.6667V12.1667C16.5 12.6529 16.3068 13.1192 15.963 13.463C15.6192 13.8068 15.1529 14 14.6667 14H5.33333C4.8471 14 4.38079 13.8068 4.03697 13.463C3.69315 13.1192 3.5 12.6529 3.5 12.1667V7.33333C3.5 6.8471 3.69315 6.38079 4.03697 6.03697C4.38079 5.69315 4.8471 5.5 5.33333 5.5H10.3333C10.6095 5.5 10.8333 5.72386 10.8333 6C10.8333 6.27614 10.6095 6.5 10.3333 6.5H5.33333ZM13 6.5C12.7239 6.5 12.5 6.27614 12.5 6C12.5 5.72386 12.7239 5.5 13 5.5H16C16.2761 5.5 16.5 5.72386 16.5 6V9C16.5 9.27614 16.2761 9.5 16 9.5C15.7239 9.5 15.5 9.27614 15.5 9V7.20711L13.3536 9.35355C13.1583 9.54882 12.8417 9.54882 12.6464 9.35355C12.4512 9.15829 12.4512 8.84171 12.6464 8.64645L14.7929 6.5H13ZM6.16699 8.33325C6.16699 8.05711 6.39085 7.83325 6.66699 7.83325H11.0003C11.2765 7.83325 11.5003 8.05711 11.5003 8.33325C11.5003 8.60939 11.2765 8.83325 11.0003 8.83325H6.66699C6.39085 8.83325 6.16699 8.60939 6.16699 8.33325ZM6.16699 10.9999C6.16699 10.7238 6.39085 10.4999 6.66699 10.4999H13.3337C13.6098 10.4999 13.8337 10.7238 13.8337 10.9999C13.8337 11.2761 13.6098 11.4999 13.3337 11.4999H6.66699C6.39085 11.4999 6.16699 11.2761 6.16699 10.9999Z",fill:"currentColor",fillRule:"evenodd"})});import{jsx as aa}from"react/jsx-runtime";import ca from"bson-objectid";import"react";import{DecoratorBlockNode as Ds}from"@lexical/react/LexicalDecoratorBlockNode.js";import As from"bson-objectid";var Ze=class extends Ds{__fields;constructor({fields:e,format:o,key:r}){super(o,r),this.__fields=e}static clone(e){return new this({fields:e.__fields,format:e.__format,key:e.__key})}static getType(){return"block"}static importDOM(){return{}}static importJSON(e){e.version===1&&(e={...e,fields:{...e.fields.data},version:2});let o=Fs(e.fields);return o.setFormat(e.format),o}static isInline(){return!1}decorate(e,o){return null}exportDOM(){let e=document.createElement("div"),o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),type:"block",fields:this.getFields(),version:2}}getFields(){return this.getLatest().__fields}getTextContent(){return"Block Field"}setFields(e){let o=this.getWritable();o.__fields=e}};function Fs(t){return new Ze({fields:{...t,id:t?.id||new As.default().toHexString()}})}import{jsx as X,jsxs as Lt,Fragment as Gs}from"react/jsx-runtime";import{Button as Ar,Collapsible as Us,Drawer as Ws,EditDepthProvider as Vs,ErrorPill as Ks,Form as zs,formatDrawerSlug as Zs,FormSubmit as Xs,Pill as Ys,RenderFields as Js,SectionTitle as qs,useDocumentInfo as Fr,useEditDepth as Qs,useFormSubmitted as ea,useServerFunctions as ta,useTranslation as oa}from"@payloadcms/ui";import{abortAndIgnore as ho}from"@payloadcms/ui/shared";import{deepCopyObjectSimpleWithoutReactComponents as ra,reduceFieldsToValues as Or}from"payload/shared";import Xe,{useCallback as go,useEffect as $r,useMemo as Ye,useRef as na}from"react";import{useLexicalComposerContext as ia}from"@lexical/react/LexicalComposerContext";import{getTranslation as la}from"@payloadcms/translations";import{$getNodeByKey as Co}from"lexical";import{v4 as sa}from"uuid";import{c as Os}from"react/compiler-runtime";import{jsx as Nt,jsxs as $s}from"react/jsx-runtime";import{RenderFields as Ps,useFormSubmitted as Bs}from"@payloadcms/ui";import Hs,{createContext as js}from"react";var vr=js({initialState:!1}),ve=()=>Hs.useContext(vr),Mr=t=>{let e=Os(13),{BlockDrawer:o,Collapsible:r,CustomBlock:n,EditButton:i,errorCount:l,formSchema:s,initialState:a,nodeKey:d,RemoveButton:c}=t,m=Bs()&&l>0,p,f;e[0]!==r||e[1]!==l||e[2]!==m?(f=w=>Nt(r,{editButton:w.editButton,errorCount:l,fieldHasErrors:m,Label:w.Label,removeButton:w.removeButton,children:w.children}),e[0]=r,e[1]=l,e[2]=m,e[3]=f):f=e[3],p=f;let h=p,C;return e[4]!==n||e[5]!==h||e[6]!==i||e[7]!==a||e[8]!==d||e[9]!==c||e[10]!==o||e[11]!==s?(C=n?$s(vr.Provider,{value:{BlockCollapsible:h,EditButton:i,initialState:a,nodeKey:d,RemoveButton:c},children:[n,Nt(o,{})]}):Nt(h,{children:Nt(Ps,{fields:s,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0})}),e[4]=n,e[5]=h,e[6]=i,e[7]=a,e[8]=d,e[9]=c,e[10]=o,e[11]=s,e[12]=C):C=e[12],C};function Dr({fields:t}){for(let e in t){let o=t[e];Array.isArray(o.rows)&&"value"in o&&(o.disableFormData=!0)}return t}var re="lexical-block",Pr=t=>{let{formData:e,nodeKey:o}=t,r=ea(),{id:n,collectionSlug:i,globalSlug:l}=Fr(),{fieldProps:{featureClientSchemaMap:s,field:a,initialLexicalFormState:d,permissions:c,readOnly:u,schemaPath:m},uuid:p}=B(),f=na(new AbortController),h=Qs(),[C,w]=Xe.useState(0),v=Zs({slug:`lexical-blocks-create-${p}-${e.id}`,depth:h}),{toggleDrawer:D}=ce(v),{getDocPreferences:x,setDocFieldPreferences:E}=Fr(),[g]=ia(),{getFormState:_}=ta(),N=`${m}.lexical_internal_feature.blocks.lexical_blocks.${e.blockType}.fields`,[k,R]=Xe.useState(d?.[e.id]?.formState?{...d?.[e.id]?.formState,blockName:{initialValue:e.blockName,passesCondition:!0,valid:!0,value:e.blockName}}:!1),[S,b]=Xe.useState(k?._components?.customComponents?.BlockLabel),[T,I]=Xe.useState(k?._components?.customComponents?.Block);$r(()=>{let j=new AbortController;return e&&!k&&(async()=>{let{state:K}=await _({id:n,collectionSlug:i,data:e,docPermissions:{fields:!0},docPreferences:await x(),globalSlug:l,operation:"update",renderAllFields:!0,schemaPath:N,signal:j.signal});K&&(K.blockName={initialValue:e.blockName,passesCondition:!0,valid:!0,value:e.blockName},R(K),b(K._components?.customComponents?.BlockLabel),I(K._components?.customComponents?.Block))})(),()=>{ho(j)}},[_,N,n,e,k,i,l,x]);let[L,A]=Xe.useState(d?.[e.id]?.collapsed??!1),M=`${m}.lexical_internal_feature.blocks.lexical_blocks.${e.blockType}`,$=s.blocks[M][0].blocks[0],{i18n:W,t:J}=oa(),U=go(async({formState:j,submit:te})=>{ho(f.current);let K=new AbortController;f.current=K;let{state:z}=await _({id:n,collectionSlug:i,docPermissions:{fields:!0},docPreferences:await x(),formState:j,globalSlug:l,operation:"update",renderAllFields:!!te,schemaPath:N,signal:K.signal});if(!z)return j;z.blockName=j.blockName;let oe=Or(Dr({fields:ra(z)}),!0);if(setTimeout(()=>{g.update(()=>{let xe=Co(o);if(xe&&Rt(xe)){let we=oe;we.blockType=e.blockType,xe.setFields(we)}})},0),te){b(z._components?.customComponents?.BlockLabel),I(z._components?.customComponents?.Block);let xe=0;for(let we of Object.values(z))we?.valid===!1&&xe++;w(xe)}return z},[_,n,i,x,l,N,e.blockType,g,o]);$r(()=>()=>{ho(f.current)},[]);let H=go(()=>{g.update(()=>{Co(o)?.remove()})},[g,o]),ee=$?.labels?.singular?la($.labels.singular,W):$?.slug,pt=go(j=>{x().then(te=>{let z=te?.fields?.[a.name]?.collapsed,oe=z&&z?.length?z:[];j?oe.includes(e.id)||oe.push(e.id):oe.includes(e.id)&&oe.splice(oe.indexOf(e.id),1),E(a.name,{collapsed:oe,hello:"hi"})})},[x,a.name,E,e.id]),ie=Ye(()=>()=>X(Ar,{buttonStyle:"icon-label",className:`${re}__editButton`,disabled:u,el:"button",icon:"edit",onClick:j=>(j.preventDefault(),j.stopPropagation(),D(),!1),onMouseDown:j=>{j.preventDefault()},round:!0,size:"small",tooltip:J("lexical:blocks:inlineBlocks:edit",{label:ee})}),[ee,u,J,D]),ye=Ye(()=>()=>X(Ar,{buttonStyle:"icon-label",className:`${re}__removeButton`,disabled:a?.admin?.readOnly||!1,icon:"x",onClick:j=>{j.preventDefault(),H()},round:!0,tooltip:"Remove Block"}),[a?.admin?.readOnly,H]),ft=Ye(()=>({children:j,editButton:te,errorCount:K,fieldHasErrors:z,Label:oe,removeButton:xe})=>X("div",{className:re+" "+re+"-"+e.blockType,children:X(Us,{className:[`${re}__row`,z?`${re}__row--has-errors`:`${re}__row--no-errors`].join(" "),collapsibleStyle:z?"error":"default",header:Lt("div",{className:`${re}__block-header`,children:[oe??S?oe??S:Lt("div",{children:[X(Ys,{className:`${re}__block-pill ${re}__block-pill-${e?.blockType}`,pillStyle:"white",children:ee}),X(qs,{path:"blockName",readOnly:a?.admin?.readOnly||!1}),z&&X(Ks,{count:K??0,i18n:W,withMessage:!0})]}),Lt("div",{children:[T&&te!==!1||!T&&te?X(ie,{}):null,xe!==!1&&g.isEditable()?X(ye,{}):null]})]}),isCollapsed:L,onToggle:we=>{pt(we),A(we)},children:j},0)}),[T,S,ie,ye,ee,g,e.blockType,W,L,pt,a?.admin?.readOnly]),ht=Ye(()=>()=>X(Vs,{children:X(Ws,{className:"",slug:v,title:J(`lexical:blocks:inlineBlocks:${e?.id?"edit":"create"}`,{label:ee??J("lexical:blocks:inlineBlocks:label")}),children:k?Lt(Gs,{children:[X(Js,{fields:$.fields,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:N,permissions:c,readOnly:!1}),X(Xs,{programmaticSubmit:!0,children:J("fields:saveChanges")})]}):null})}),[k,v,ee,J,$.fields,N,c]);return Ye(()=>k?X(zs,{beforeSubmit:[async({formState:j})=>await U({formState:j,submit:!0})],fields:$.fields,initialState:k,onChange:[U],onSubmit:j=>{let te=Or(j);te.blockType=e.blockType,g.update(()=>{let K=Co(o);K&&Rt(K)&&K.setFields(te)}),D()},submitted:r,uuid:sa(),children:X(Mr,{baseClass:re,BlockDrawer:ht,Collapsible:ft,CustomBlock:T,EditButton:ie,errorCount:C,formSchema:$.fields,initialState:k,nodeKey:o,RemoveButton:ye})}):null,[ft,ht,T,ye,ie,g,C,D,$.fields,k,o,U,r])};var ue=class extends Ze{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=St(e.fields);return o.setFormat(e.format),o}decorate(e,o){return aa(Pr,{formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function St(t){return new ue({fields:{...t,id:t?.id||new ca.default().toHexString()}})}function Rt(t){return t instanceof ue}import{createCommand as Br}from"lexical";var Je=Br("INSERT_BLOCK_COMMAND"),qe=Br("INSERT_INLINE_BLOCK_COMMAND");import{c as ua}from"react/compiler-runtime";import{useLexicalComposerContext as da}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as ma,$wrapNodeInElement as pa,mergeRegister as fa}from"@lexical/utils";import{formatDrawerSlug as ha,useEditDepth as ga}from"@payloadcms/ui";import{$createParagraphNode as Ca,$getNodeByKey as xa,$getPreviousSelection as ba,$getSelection as _a,$insertNodes as Ta,$isParagraphNode as Hr,$isRangeSelection as Ea,$isRootOrShadowRoot as wa,COMMAND_PRIORITY_EDITOR as jr}from"lexical";import{useEffect as ka,useState as Na}from"react";var Gr=()=>{let t=ua(10),[e]=da(),[o,r]=Na(null),{uuid:n}=B(),i=ga(),l="lexical-inlineBlocks-create-"+n,s;t[0]!==l||t[1]!==i?(s=ha({slug:l,depth:i}),t[0]=l,t[1]=i,t[2]=s):s=t[2];let a=s,{toggleDrawer:d}=ce(a,!0),c;t[3]!==e||t[4]!==o?(c=()=>{if(!e.hasNodes([ue]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return fa(e.registerCommand(Je,m=>(e.update(()=>{let p=_a()||ba();if(Ea(p)){let f=St(m);ma(f);let{focus:h}=p,C=h.getNode();Hr(C)&&C.getTextContentSize()===0&&C.getParentOrThrow().getChildren().filter(w=>Hr(w)).length>1&&C.remove()}}),!0),jr),e.registerCommand(qe,m=>{if(o){let f=xa(o);return!f||!io(f)?!1:(f.setFields(m),r(null),!0)}let p=no(m);return Ta([p]),wa(p.getParentOrThrow())&&pa(p,Ca).selectEnd(),!0},jr))},t[3]=e,t[4]=o,t[5]=c):c=t[5];let u;return t[6]!==e||t[7]!==o||t[8]!==d?(u=[e,o,d],t[6]=e,t[7]=o,t[8]=d,t[9]=u):u=t[9],ka(c,u),null};var La=y(({featureClientSchemaMap:t,props:e,schemaPath:o})=>{let r=`${o}.lexical_internal_feature.blocks.lexical_blocks`,n=`${o}.lexical_internal_feature.blocks.lexical_inline_blocks`,i=t.blocks,l=Object.entries(i).filter(([c])=>c.startsWith(r+".")&&!c.replace(r+".","").includes(".")).map(([c,u])=>u[0]),s=Object.entries(i).filter(([c])=>c.startsWith(n+".")&&!c.replace(n+".","").includes(".")).map(([c,u])=>u[0]),a=l.map(c=>c.blocks[0]),d=s.map(c=>c.blocks[0]);return{nodes:[ue,ro],plugins:[{Component:Gr,position:"normal"}],sanitizedClientFeatureProps:e,slashMenu:{groups:[a?.length?{items:a.map(c=>({Icon:wt,key:"block-"+c.slug,keywords:["block","blocks",c.slug],label:({i18n:u})=>c?.labels?.singular?It(c.labels.singular,u):c?.slug,onSelect:({editor:u})=>{u.dispatchCommand(Je,{blockName:"",blockType:c.slug})}})),key:"blocks",label:({i18n:c})=>c.t("lexical:blocks:label")}:null,d?.length?{items:d.map(c=>({Icon:kt,key:"inlineBlocks-"+c.slug,keywords:["inlineBlock","inline block",c.slug],label:({i18n:u})=>c?.labels?.singular?It(c.labels.singular,u):c?.slug,onSelect:({editor:u})=>{u.dispatchCommand(qe,{blockName:"",blockType:c.slug})}})),key:"inlineBlocks",label:({i18n:c})=>c.t("lexical:blocks:inlineBlocks:label")}:null].filter(Boolean)},toolbarFixed:{groups:[a.length?{type:"dropdown",ChildComponent:wt,items:a.map((c,u)=>({ChildComponent:wt,isActive:void 0,key:"block-"+c.slug,label:({i18n:m})=>c?.labels?.singular?It(c.labels.singular,m):c?.slug,onSelect:({editor:m})=>{m.dispatchCommand(Je,{blockName:"",blockType:c.slug})},order:u})),key:"blocks",order:20}:null,d?.length?{type:"dropdown",ChildComponent:kt,items:d.map((c,u)=>({ChildComponent:kt,isActive:void 0,key:"inlineBlock-"+c.slug,label:({i18n:m})=>c?.labels?.singular?It(c.labels.singular,m):c?.slug,onSelect:({editor:m})=>{m.dispatchCommand(qe,{blockName:"",blockType:c.slug})},order:u})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}});import{c as Ra}from"react/compiler-runtime";import{jsx as Ne,jsxs as _o}from"react/jsx-runtime";import{useLexicalComposerContext as Sa}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as Ia,$createTextNode as ya,$getRoot as va}from"lexical";import*as Kr from"react";import{useCallback as ke,useEffect as xo,useLayoutEffect as Ur,useRef as bo,useState as yt}from"react";var Ma=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)},Da=(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)},Aa=t=>{let o=((r,n)=>{switch(r){case"click":return` await page.mouse.click(${n.x}, ${n.y});`;case"keydown":return` await page.keyboard.keydown('${n}');`;case"keyup":return` await page.keyboard.keyup('${n}');`;case"press":return` await page.keyboard.press('${n}');`;case"selectAll":return" await selectAll(page);";case"snapshot":return` await assertHTMLSnapshot(page);
|
|
3
|
+
`)},regExp:/^>\s/,replace:(t,e,o,r)=>{if(r){let i=t.getPreviousSibling();if(Dr(i)){i.splice(i.getChildrenSize(),0,[Xs(),...e]),i.select(0,0),t.remove();return}}let n=zs();n.append(...e),t.replace(n),n.select(0,0)}};var Fr=[ie([{ChildComponent:Eo,isActive:({selection:t})=>{if(!Js(t))return!1;for(let e of t.getNodes())if(!Or(e)&&!Or(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,()=>$r())})},order:20}])],qs=D({markdownTransformers:[Ar],nodes:[Ys],slashMenu:{groups:[q([{Icon:Eo,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Br();Pr(e,()=>$r())})}}])]},toolbarFixed:{groups:Fr},toolbarInline:{groups:Fr}});import{getTranslation as ct}from"@payloadcms/translations";import{withMergedProps as Fc}from"@payloadcms/ui/shared";import{jsx as To,jsxs as Qs}from"react/jsx-runtime";import"react";var vt=()=>Qs("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[To("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),To("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),To("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as Hr}from"react/jsx-runtime";import"react";var He=()=>Hr("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Hr("path",{clipRule:"evenodd",d:"M5.33333 6.5C5.11232 6.5 4.90036 6.5878 4.74408 6.74408C4.5878 6.90036 4.5 7.11232 4.5 7.33333V12.1667C4.5 12.3877 4.5878 12.5996 4.74408 12.7559C4.90036 12.9122 5.11232 13 5.33333 13H14.6667C14.8877 13 15.0996 12.9122 15.2559 12.7559C15.4122 12.5996 15.5 12.3877 15.5 12.1667V11.6667C15.5 11.3905 15.7239 11.1667 16 11.1667C16.2761 11.1667 16.5 11.3905 16.5 11.6667V12.1667C16.5 12.6529 16.3068 13.1192 15.963 13.463C15.6192 13.8068 15.1529 14 14.6667 14H5.33333C4.8471 14 4.38079 13.8068 4.03697 13.463C3.69315 13.1192 3.5 12.6529 3.5 12.1667V7.33333C3.5 6.8471 3.69315 6.38079 4.03697 6.03697C4.38079 5.69315 4.8471 5.5 5.33333 5.5H10.3333C10.6095 5.5 10.8333 5.72386 10.8333 6C10.8333 6.27614 10.6095 6.5 10.3333 6.5H5.33333ZM13 6.5C12.7239 6.5 12.5 6.27614 12.5 6C12.5 5.72386 12.7239 5.5 13 5.5H16C16.2761 5.5 16.5 5.72386 16.5 6V9C16.5 9.27614 16.2761 9.5 16 9.5C15.7239 9.5 15.5 9.27614 15.5 9V7.20711L13.3536 9.35355C13.1583 9.54882 12.8417 9.54882 12.6464 9.35355C12.4512 9.15829 12.4512 8.84171 12.6464 8.64645L14.7929 6.5H13ZM6.16699 8.33325C6.16699 8.05711 6.39085 7.83325 6.66699 7.83325H11.0003C11.2765 7.83325 11.5003 8.05711 11.5003 8.33325C11.5003 8.60939 11.2765 8.83325 11.0003 8.83325H6.66699C6.39085 8.83325 6.16699 8.60939 6.16699 8.33325ZM6.16699 10.9999C6.16699 10.7238 6.39085 10.4999 6.66699 10.4999H13.3337C13.6098 10.4999 13.8337 10.7238 13.8337 10.9999C13.8337 11.2761 13.6098 11.4999 13.3337 11.4999H6.66699C6.39085 11.4999 6.16699 11.2761 6.16699 10.9999Z",fill:"currentColor",fillRule:"evenodd"})});import ea from"bson-objectid";import{$isElementNode as ta,$isRangeSelection as oa,ElementNode as ra}from"lexical";import{deepCopyObjectSimple as na}from"payload/shared";function jr(t){class e extends ra{__fields;constructor({fields:i,key:l}){super(l),this.__fields=i}static clone(i){return new this({fields:i.__fields,key:i.__key})}static getType(){return"wrapperBlock"}static importDOM(){return{}}static importJSON(i){return o(i.fields)}canBeEmpty(){return!1}canInsertTextAfter(){return!1}canInsertTextBefore(){return!1}createDOM(i,l){return t[this.__fields.blockType]({editor:l,editorConfig:i,node:this})}exportDOM(){let i=document.createElement("span");i.classList.add("wrapper-block-container");let l=document.createTextNode(this.getTextContent());return i.append(l),{element:i}}exportJSON(){return{...super.exportJSON(),type:"wrapperBlock",fields:this.getFields(),version:1}}extractWithChild(i,l,s){if(!oa(l))return!1;let a=l.anchor.getNode(),c=l.focus.getNode();return this.isParentOf(a)&&this.isParentOf(c)&&l.getTextContent().length>0}getFields(){return this.getLatest().__fields}insertNewAfter(i,l=!0){let s=this.getParentOrThrow().insertNewAfter(i,l);if(ta(s)){let a=o(this.__fields);return s.append(a),a}return null}isInline(){return!0}setFields(i){let l=na(i),s=this.getWritable();s.__fields=l}updateDOM(i,l,s){return!0}}function o(n){return new e({fields:{...n,id:n?.id||new ea.default().toHexString()}})}function r(n){return n instanceof e}return{$createWrapperBlockNode:o,$isWrapperBlockNode:r,WrapperBlockNode:e,WrapperBlockNodeInstance:null}}import{jsx as Aa}from"react/jsx-runtime";import Oa from"bson-objectid";import"react";import{DecoratorBlockNode as ia}from"@lexical/react/LexicalDecoratorBlockNode.js";import la from"bson-objectid";var nt=class extends ia{__fields;constructor({fields:e,format:o,key:r}){super(o,r),this.__fields=e}static clone(e){return new this({fields:e.__fields,format:e.__format,key:e.__key})}static getType(){return"block"}static importDOM(){return{}}static importJSON(e){e.version===1&&(e={...e,fields:{...e.fields.data},version:2});let o=sa(e.fields);return o.setFormat(e.format),o}static isInline(){return!1}decorate(e,o){return null}exportDOM(){let e=document.createElement("div"),o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),type:"block",fields:this.getFields(),version:2}}getFields(){return this.getLatest().__fields}getTextContent(){return"Block Field"}setFields(e){let o=this.getWritable();o.__fields=e}};function sa(t){return new nt({fields:{...t,id:t?.id||new la.default().toHexString()}})}import{jsx as Q,jsxs as Dt,Fragment as fa}from"react/jsx-runtime";import{Button as Vr,Collapsible as ha,Drawer as ga,EditDepthProvider as Ca,ErrorPill as xa,Form as ba,formatDrawerSlug as _a,FormSubmit as Ea,Pill as Ta,RenderFields as wa,SectionTitle as ka,useDocumentInfo as Kr,useEditDepth as Na,useFormSubmitted as La,useServerFunctions as Ra,useTranslation as Sa}from"@payloadcms/ui";import{abortAndIgnore as wo}from"@payloadcms/ui/shared";import{deepCopyObjectSimpleWithoutReactComponents as Ia,reduceFieldsToValues as zr}from"payload/shared";import it,{useCallback as ko,useEffect as Zr,useMemo as lt,useRef as ya}from"react";import{useLexicalComposerContext as va}from"@lexical/react/LexicalComposerContext";import{getTranslation as Ma}from"@payloadcms/translations";import{$getNodeByKey as No}from"lexical";import{v4 as Da}from"uuid";import{c as aa}from"react/compiler-runtime";import{jsx as Mt,jsxs as ca}from"react/jsx-runtime";import{RenderFields as ua,useFormSubmitted as da}from"@payloadcms/ui";import ma,{createContext as pa}from"react";var Wr=pa({initialState:!1}),je=()=>ma.useContext(Wr),Gr=t=>{let e=aa(13),{BlockDrawer:o,Collapsible:r,CustomBlock:n,EditButton:i,errorCount:l,formSchema:s,initialState:a,nodeKey:c,RemoveButton:d}=t,m=da()&&l>0,p,f;e[0]!==r||e[1]!==l||e[2]!==m?(f=E=>Mt(r,{editButton:E.editButton,errorCount:l,fieldHasErrors:m,Label:E.Label,removeButton:E.removeButton,children:E.children}),e[0]=r,e[1]=l,e[2]=m,e[3]=f):f=e[3],p=f;let h=p,g;return e[4]!==n||e[5]!==h||e[6]!==i||e[7]!==a||e[8]!==c||e[9]!==d||e[10]!==o||e[11]!==s?(g=n?ca(Wr.Provider,{value:{BlockCollapsible:h,EditButton:i,initialState:a,nodeKey:c,RemoveButton:d},children:[n,Mt(o,{})]}):Mt(h,{children:Mt(ua,{fields:s,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0})}),e[4]=n,e[5]=h,e[6]=i,e[7]=a,e[8]=c,e[9]=d,e[10]=o,e[11]=s,e[12]=g):g=e[12],g};function Ur({fields:t}){for(let e in t){let o=t[e];Array.isArray(o.rows)&&"value"in o&&(o.disableFormData=!0)}return t}var ae="lexical-block",Xr=t=>{let{formData:e,nodeKey:o}=t,r=La(),{id:n,collectionSlug:i,globalSlug:l}=Kr(),{fieldProps:{featureClientSchemaMap:s,field:a,initialLexicalFormState:c,permissions:d,readOnly:u,schemaPath:m},uuid:p}=B(),f=ya(new AbortController),h=Na(),[g,E]=it.useState(0),L=_a({slug:`lexical-blocks-create-${p}-${e.id}`,depth:h}),{toggleDrawer:C}=se(L),{getDocPreferences:x,setDocFieldPreferences:b}=Kr(),[_]=va(),{getFormState:T}=Ra(),R=`${m}.lexical_internal_feature.blocks.lexical_blocks.${e.blockType}.fields`,[N,S]=it.useState(c?.[e.id]?.formState?{...c?.[e.id]?.formState,blockName:{initialValue:e.blockName,passesCondition:!0,valid:!0,value:e.blockName}}:!1),[y,w]=it.useState(N?._components?.customComponents?.BlockLabel),[k,v]=it.useState(N?._components?.customComponents?.Block);Zr(()=>{let G=new AbortController;return e&&!N&&(async()=>{let{state:K}=await T({id:n,collectionSlug:i,data:e,docPermissions:{fields:!0},docPreferences:await x(),globalSlug:l,operation:"update",renderAllFields:!0,schemaPath:R,signal:G.signal});K&&(K.blockName={initialValue:e.blockName,passesCondition:!0,valid:!0,value:e.blockName},S(K),w(K._components?.customComponents?.BlockLabel),v(K._components?.customComponents?.Block))})(),()=>{wo(G)}},[T,R,n,e,N,i,l,x]);let[I,A]=it.useState(c?.[e.id]?.collapsed??!1),M=`${m}.lexical_internal_feature.blocks.lexical_blocks.${e.blockType}`,P=s.blocks[M][0].blocks[0],{i18n:z,t:X}=Sa(),V=ko(async({formState:G,submit:re})=>{wo(f.current);let K=new AbortController;f.current=K;let{state:H}=await T({id:n,collectionSlug:i,docPermissions:{fields:!0},docPreferences:await x(),formState:G,globalSlug:l,operation:"update",renderAllFields:!!re,schemaPath:R,signal:K.signal});if(!H)return G;H.blockName=G.blockName;let J=zr(Ur({fields:Ia(H)}),!0);if(setTimeout(()=>{_.update(()=>{let ue=No(o);if(ue&&At(ue)){let Ee=J;Ee.blockType=e.blockType,ue.setFields(Ee)}})},0),re){w(H._components?.customComponents?.BlockLabel),v(H._components?.customComponents?.Block);let ue=0;for(let Ee of Object.values(H))Ee?.valid===!1&&ue++;E(ue)}return H},[T,n,i,x,l,R,e.blockType,_,o]);Zr(()=>()=>{wo(f.current)},[]);let W=ko(()=>{_.update(()=>{No(o)?.remove()})},[_,o]),O=P?.labels?.singular?Ma(P.labels.singular,z):P?.slug,Z=ko(G=>{x().then(re=>{let H=re?.fields?.[a.name]?.collapsed,J=H&&H?.length?H:[];G?J.includes(e.id)||J.push(e.id):J.includes(e.id)&&J.splice(J.indexOf(e.id),1),b(a.name,{collapsed:J,hello:"hi"})})},[x,a.name,b,e.id]),ne=lt(()=>()=>Q(Vr,{buttonStyle:"icon-label",className:`${ae}__editButton`,disabled:u,el:"button",icon:"edit",onClick:G=>(G.preventDefault(),G.stopPropagation(),C(),!1),onMouseDown:G=>{G.preventDefault()},round:!0,size:"small",tooltip:X("lexical:blocks:inlineBlocks:edit",{label:O})}),[O,u,X,C]),oe=lt(()=>()=>Q(Vr,{buttonStyle:"icon-label",className:`${ae}__removeButton`,disabled:a?.admin?.readOnly||!1,icon:"x",onClick:G=>{G.preventDefault(),W()},round:!0,tooltip:"Remove Block"}),[a?.admin?.readOnly,W]),Pe=lt(()=>({children:G,editButton:re,errorCount:K,fieldHasErrors:H,Label:J,removeButton:ue})=>Q("div",{className:ae+" "+ae+"-"+e.blockType,children:Q(ha,{className:[`${ae}__row`,H?`${ae}__row--has-errors`:`${ae}__row--no-errors`].join(" "),collapsibleStyle:H?"error":"default",header:Dt("div",{className:`${ae}__block-header`,children:[J??y?J??y:Dt("div",{children:[Q(Ta,{className:`${ae}__block-pill ${ae}__block-pill-${e?.blockType}`,pillStyle:"white",children:O}),Q(ka,{path:"blockName",readOnly:a?.admin?.readOnly||!1}),H&&Q(xa,{count:K??0,i18n:z,withMessage:!0})]}),Dt("div",{children:[k&&re!==!1||!k&&re?Q(ne,{}):null,ue!==!1&&_.isEditable()?Q(oe,{}):null]})]}),isCollapsed:I,onToggle:Ee=>{Z(Ee),A(Ee)},children:G},0)}),[k,y,ne,oe,O,_,e.blockType,z,I,Z,a?.admin?.readOnly]),Se=lt(()=>()=>Q(Ca,{children:Q(ga,{className:"",slug:L,title:X(`lexical:blocks:inlineBlocks:${e?.id?"edit":"create"}`,{label:O??X("lexical:blocks:inlineBlocks:label")}),children:N?Dt(fa,{children:[Q(wa,{fields:P.fields,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:R,permissions:d,readOnly:!1}),Q(Ea,{programmaticSubmit:!0,children:X("fields:saveChanges")})]}):null})}),[N,L,O,X,P.fields,R,d]);return lt(()=>N?Q(ba,{beforeSubmit:[async({formState:G})=>await V({formState:G,submit:!0})],fields:P.fields,initialState:N,onChange:[V],onSubmit:G=>{let re=zr(G);re.blockType=e.blockType,_.update(()=>{let K=No(o);K&&At(K)&&K.setFields(re)}),C()},submitted:r,uuid:Da(),children:Q(Gr,{baseClass:ae,BlockDrawer:Se,Collapsible:Pe,CustomBlock:k,EditButton:ne,errorCount:g,formSchema:P.fields,initialState:N,nodeKey:o,RemoveButton:oe})}):null,[Pe,Se,k,oe,ne,_,g,C,P.fields,N,o,V,r])};var Ie=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=Ot(e.fields);return o.setFormat(e.format),o}decorate(e,o){return Aa(Xr,{formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Ot(t){return new Ie({fields:{...t,id:t?.id||new Oa.default().toHexString()}})}function At(t){return t instanceof Ie}import{createCommand as Ft}from"lexical";var st=Ft("INSERT_BLOCK_COMMAND"),at=Ft("INSERT_INLINE_BLOCK_COMMAND"),ye=Ft("INSERT_WRAPPER_BLOCK_COMMAND"),Yr=Ft("TOGGLE_WRAPPER_BLOCK_WITH_MODAL_COMMAND");import{c as Fa}from"react/compiler-runtime";import{useLexicalComposerContext as $a}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Pa,$wrapNodeInElement as Ba,mergeRegister as Ha}from"@lexical/utils";import{formatDrawerSlug as ja,useEditDepth as Wa}from"@payloadcms/ui";import{$createParagraphNode as Ga,$getNodeByKey as Ua,$getPreviousSelection as Va,$getSelection as Ka,$insertNodes as za,$isParagraphNode as Jr,$isRangeSelection as Za,$isRootOrShadowRoot as Xa,COMMAND_PRIORITY_EDITOR as qr}from"lexical";import{useEffect as Ya,useState as Ja}from"react";var Qr=()=>{let t=Fa(10),[e]=$a(),[o,r]=Ja(null),{uuid:n}=B(),i=Wa(),l="lexical-inlineBlocks-create-"+n,s;t[0]!==l||t[1]!==i?(s=ja({slug:l,depth:i}),t[0]=l,t[1]=i,t[2]=s):s=t[2];let a=s,{toggleDrawer:c}=se(a,!0),d;t[3]!==e||t[4]!==o?(d=()=>Ha(e.registerCommand(st,m=>(e.update(()=>{let p=Ka()||Va();if(Za(p)){let f=Ot(m);Pa(f);let{focus:h}=p,g=h.getNode();Jr(g)&&g.getTextContentSize()===0&&g.getParentOrThrow().getChildren().filter(E=>Jr(E)).length>1&&g.remove()}}),!0),qr),e.registerCommand(at,m=>{if(o){let f=Ua(o);return!f||!fo(f)?!1:(f.setFields(m),r(null),!0)}let p=po(m);return za([p]),Xa(p.getParentOrThrow())&&Ba(p,Ga).selectEnd(),!0},qr)),t[3]=e,t[4]=o,t[5]=d):d=t[5];let u;return t[6]!==e||t[7]!==o||t[8]!==c?(u=[e,o,c],t[6]=e,t[7]=o,t[8]=c,t[9]=u):u=t[9],Ya(d,u),null};import{c as Rc}from"react/compiler-runtime";import{jsx as Sc}from"react/jsx-runtime";import{useLexicalComposerContext as Ic}from"@lexical/react/LexicalComposerContext";import{mergeRegister as yc}from"@lexical/utils";import{$getSelection as vc,$isElementNode as Mc,$isRangeSelection as cn,COMMAND_PRIORITY_EDITOR as Dc}from"lexical";import{useEffect as Ac}from"react";import{createPortal as Oc}from"react-dom";import{jsx as ee,jsxs as $t,Fragment as nc}from"react/jsx-runtime";import{useLexicalComposerContext as ic}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as rn,mergeRegister as nn}from"@lexical/utils";import{getTranslation as lc}from"@payloadcms/translations";import{CloseMenuIcon as sc,Drawer as ac,EditDepthProvider as cc,EditIcon as uc,Form as dc,formatDrawerSlug as mc,FormSubmit as pc,RenderFields as fc,useEditDepth as hc,useTranslation as gc}from"@payloadcms/ui";import{$getSelection as Cc,$isLineBreakNode as xc,$isRangeSelection as bc,COMMAND_PRIORITY_HIGH as _c,COMMAND_PRIORITY_LOW as ln,KEY_ESCAPE_COMMAND as Ec,SELECTION_CHANGE_COMMAND as Tc}from"lexical";import{reduceFieldsToValues as wc}from"payload/shared";import So,{createContext as kc,useCallback as Lo,useEffect as Ro,useMemo as Pt,useRef as Nc,useState as ve}from"react";import{v4 as Lc}from"uuid";import{$isAtNodeEnd as en}from"@lexical/selection";function ke(t){let{anchor:e}=t,{focus:o}=t,r=t.anchor.getNode(),n=t.focus.getNode();return r===n?r:t.isBackward()?en(o)?r:n:en(e)?r:n}function We(t,e,o,r=10,n=5){let i=o.parentElement;if(t===null||i==null){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let l=e.getBoundingClientRect(),s=o.getBoundingClientRect(),a=i.getBoundingClientRect(),c=t.top-r,d=t.left-n;c<a.top&&(c+=l.height+t.height+r*2),d+l.width>a.right&&(d=a.right-l.width-n),c-=s.top,d-=s.left,e.style.opacity="1",e.style.transform=`translate(${d}px, ${c}px)`}import{c as qa}from"react/compiler-runtime";import{useDocumentInfo as Qa,useServerFunctions as ec}from"@payloadcms/ui";import{abortAndIgnore as tn}from"@payloadcms/ui/shared";import tc,{useEffect as oc,useRef as rc}from"react";var on=t=>{let e=qa(23),{onReceiveRenderedFields:o,schemaFieldsPath:r}=t,{id:n,collectionSlug:i,getDocPreferences:l,globalSlug:s}=Qa(),{getFormState:a}=ec(),[c,d]=tc.useState(void 0),u;e[0]!==r||e[1]!==a||e[2]!==n||e[3]!==i||e[4]!==l||e[5]!==s||e[6]!==o?(u=x=>{let{formData:b,schemaFieldsPath:_}=x,T=_??r;if(!T)return;let R=new AbortController,N=async()=>{let{state:S}=await a({id:n,collectionSlug:i,data:b,docPermissions:{fields:!0},docPreferences:await l(),globalSlug:s,operation:"update",renderAllFields:!0,schemaPath:T,signal:R.signal});S&&(d(S),o&&o({state:S}))};d(void 0),b&&N()},e[0]=r,e[1]=a,e[2]=n,e[3]=i,e[4]=l,e[5]=s,e[6]=o,e[7]=u):u=e[7];let m=u,p;e[8]===Symbol.for("react.memo_cache_sentinel")?(p=new AbortController,e[8]=p):p=e[8];let f=rc(p),h;e[9]!==r||e[10]!==a||e[11]!==n||e[12]!==i||e[13]!==l||e[14]!==s||e[15]!==o?(h=async x=>{let{formState:b,submit:_}=x;if(r===null)return b;tn(f.current);let T=new AbortController;f.current=T;let{state:R}=await a({id:n,collectionSlug:i,docPermissions:{fields:!0},docPreferences:await l(),formState:b,globalSlug:s,operation:"update",renderAllFields:!!_,schemaPath:r,signal:T.signal});return R?(_&&o&&o({state:R}),R):b},e[9]=r,e[10]=a,e[11]=n,e[12]=i,e[13]=l,e[14]=s,e[15]=o,e[16]=h):h=e[16];let g=h,E,L;e[17]===Symbol.for("react.memo_cache_sentinel")?(E=()=>()=>{tn(f.current)},L=[],e[17]=E,e[18]=L):(E=e[17],L=e[18]),oc(E,L);let C;return e[19]!==c||e[20]!==m||e[21]!==g?(C={initialState:c,loadInitialState:m,onFormChange:g},e[19]=c,e[20]=m,e[21]=g,e[22]=C):C=e[22],C};var sn=kc({formData:void 0,initialState:!1}),Ne=()=>So.useContext(sn);function an({$createWrapperBlockNode:t,$isWrapperBlockNode:e,anchorElem:o}){let[r]=ic(),[n,i]=ve(),l=Nc(null),[s,a]=ve(null),[c,d]=ve(null),[u,m]=ve(null),{fieldProps:{featureClientSchemaMap:p,permissions:f,schemaPath:h},uuid:g}=B(),[E,L]=ve(),{i18n:C,t:x}=gc(),[b,_]=So.useState(null),{initialState:T,loadInitialState:R,onFormChange:N}=on({onReceiveRenderedFields:({state:O})=>{a(O._components?.customComponents?.Block),d(O._components?.customComponents?.BlockLabel)},schemaFieldsPath:b}),S=hc(),[y,w]=ve(!1),[k,v]=ve([]),I=mc({slug:"lexical-rich-text-wrapper-block-"+g,depth:S}),{toggleDrawer:A}=se(I),M=Lo(()=>{y&&(w(!1),l&&l.current&&(l.current.style.opacity="0",l.current.style.transform="translate(-10000px, -10000px)"),i(null),a(null),d(null),m(null),v([]),L(void 0),_(null))},[y]),F=Lo(()=>{let O=Cc(),Z;if(!bc(O)||!O){M();return}let ne=ke(O);Z=r.getElementByKey(ne.getKey())?.getBoundingClientRect();let oe=rn(ne,e),Pe=O.getNodes().filter(K=>!xc(K)).find(K=>{let H=rn(K,e);return oe&&!oe.is(H)||H&&!H.is(oe)});if(oe==null||Pe){M();return}let Se=l.current,Be=window.getSelection(),{activeElement:G}=document;if(Se===null)return;let re=r.getRootElement();if(Be!==null&&re!==null&&re.contains(Be.anchorNode)){if(Z||(Z=Be.getRangeAt(0).getBoundingClientRect()),Z!=null){Z.y+=40,We(Z,Se,o);let H={...oe.getFields(),text:oe.getTextContent()},J=`${h}.lexical_internal_feature.blocks.lexical_wrapper_blocks.${H.blockType}.fields`;if(J===b&&H.id===E?.id)return!1;i(oe);let ue=`${h}.lexical_internal_feature.blocks.lexical_wrapper_blocks.${H.blockType}`;_(J),L(H),w(!0),v(O?O?.getNodes():[]);let Ms=p.blocks[ue][0].blocks[0];m(Ms),R({formData:H,schemaFieldsPath:J})}}else(G==null||G.className!=="wraper-block-popup__content")&&M();return!0},[r,e,M,o,h,b,E?.id,p,R]);Ro(()=>nn(r.registerCommand(Yr,O=>O?(r.dispatchCommand(ye,O.fields),F(),A(),!0):!1,ln)),[r,F,A,I]),Ro(()=>{let O=o.parentElement,Z=()=>{r.getEditorState().read(()=>{F()})};return window.addEventListener("resize",Z),O?.addEventListener("scroll",Z),()=>{window.removeEventListener("resize",Z),O?.removeEventListener("scroll",Z)}},[o.parentElement,r,F]),Ro(()=>nn(r.registerUpdateListener(({editorState:O})=>{O.read(()=>{F()})}),r.registerCommand(Tc,()=>(F(),!0),ln),r.registerCommand(Ec,()=>y?(M(),!0):!1,_c)),[r,F,y,M]);let U=Lo(O=>{let Z=wc(O);Z.blockType=E?.blockType,r.update(()=>{n&&e(n)&&n.setFields(Z)})},[E?.blockType,r,n,e]),P=u?.labels?.singular?lc(u.labels.singular,C):u?.slug,z=Pt(()=>()=>ee("button",{"aria-label":"Edit Wrapper Block",className:"wrapper-block-popup__edit",onClick:()=>{A()},onMouseDown:O=>{O.preventDefault()},tabIndex:0,type:"button",children:ee(uc,{})}),[A]),X=Pt(()=>()=>ee("button",{"aria-label":"Remove Wrapper Block",className:"wrapper-block-popup__remove",onClick:()=>{r.dispatchCommand(ye,null)},onMouseDown:O=>{O.preventDefault()},tabIndex:0,type:"button",children:ee(sc,{})}),[r]),V=Pt(()=>c?()=>c:()=>P,[P,c]),W=Pt(()=>({children:O})=>ee("div",{className:"wrapper-block-popup__wrapper",children:ee("div",{className:"wrapper-block-popup__content",children:O})}),[]);return $t(dc,{beforeSubmit:[async({formState:O})=>await N({formState:O,submit:!0})],disableValidationOnSubmit:!0,fields:u?.fields??[],initialState:T??{},onChange:[N],onSubmit:O=>{U(O),A()},uuid:Lc(),children:[ee("div",{className:"wrapper-block-popup",ref:l,children:s?ee(sn.Provider,{value:{EditButton:z,formData:E,initialState:T,Label:V,RemoveButton:X,WrapperBlockContainer:W,wrapperBlockNode:n},children:s}):$t(W,{children:[ee(V,{}),r.isEditable()&&$t(So.Fragment,{children:[ee(z,{}),ee(X,{})]})]})}),ee(cc,{children:ee(ac,{className:"",slug:I,title:x(`lexical:blocks:inlineBlocks:${E?.id?"edit":"create"}`,{label:P??x("lexical:blocks:inlineBlocks:label")}),children:T&&u&&b?$t(nc,{children:[ee(fc,{fields:u.fields,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:b,permissions:f,readOnly:!1}),ee(pc,{programmaticSubmit:!0,children:x("fields:saveChanges")})]}):null})})]})}var un=t=>{let e=Rc(9),{$createWrapperBlockNode:o,$isWrapperBlockNode:r,anchorElem:n}=t,i=n===void 0?document.body:n,[l]=Ic(),s,a;e[0]!==l||e[1]!==r||e[2]!==o?(s=()=>yc(l.registerCommand(ye,d=>{let u=vc();if(!cn(u))return!1;let m=cn(u)?u.extract():[],p;p=null;let f;return f=null,d===null?(m?.forEach(h=>{let g=h.getParent();if(r(g)){let E=g.getChildren();for(let L=0;L<E.length;L=L+1,L)g.insertBefore(E[L]);g.remove()}}),!0):(m?.forEach(h=>{let g=h.getParent();if(!(g===f||g===null||Mc(h)&&!h.isInline())){if(g.is(p)||(p=g,f=o(d),r(g)?h.getPreviousSibling()===null?g.insertBefore(f):g.insertAfter(f):h.insertBefore(f)),r(h)){if(h.is(f))return;if(f!==null){let E=h.getChildren();for(let L=0;L<E.length;L=L+1,L)f.append(E[L])}h.remove();return}f!==null&&f.append(h)}}),!0)},Dc)),a=[o,r,l],e[0]=l,e[1]=r,e[2]=o,e[3]=s,e[4]=a):(s=e[3],a=e[4]),Ac(s,a);let c;return e[5]!==o||e[6]!==r||e[7]!==i?(c=Oc(Sc(an,{$createWrapperBlockNode:o,$isWrapperBlockNode:r,anchorElem:i}),i),e[5]=o,e[6]=r,e[7]=i,e[8]=c):c=e[8],c};var $c=D(({featureClientImportMap:t,featureClientSchemaMap:e,props:o,schemaPath:r})=>{let n=`${r}.lexical_internal_feature.blocks.lexical_blocks`,i=`${r}.lexical_internal_feature.blocks.lexical_inline_blocks`,l=`${r}.lexical_internal_feature.blocks.lexical_wrapper_blocks`,s=e.blocks,a=Object.entries(s).filter(([C])=>C.startsWith(n+".")&&!C.replace(n+".","").includes(".")).map(([C,x])=>x[0]),c=Object.entries(s).filter(([C])=>C.startsWith(i+".")&&!C.replace(i+".","").includes(".")).map(([C,x])=>x[0]),d=Object.entries(s).filter(([C])=>C.startsWith(l+".")&&!C.replace(l+".","").includes(".")).map(([C,x])=>x[0]),u=a.map(C=>C.blocks[0]),m=c.map(C=>C.blocks[0]),p=d.map(C=>C.blocks[0]),f={};if(p.length)for(let C of p)f[C.slug]=t[`blocks.${C.slug}`];let{$createWrapperBlockNode:h,$isWrapperBlockNode:g,WrapperBlockNode:E}=jr(f),L=p?.length?{type:"dropdown",ChildComponent:He,items:p.map((C,x)=>({ChildComponent:He,isActive:void 0,key:"wrapperBlock-"+C.slug,label:({i18n:b})=>C?.labels?.singular?ct(C.labels.singular,b):C?.slug,onSelect:({editor:b})=>{b.dispatchCommand(ye,{blockName:"",blockType:C.slug})},order:x})),key:"wrapperBlocks",order:25}:null;return{nodes:[u?.length?Ie:null,m?.length?mo:null,p?.length?E:null].filter(Boolean),plugins:[{Component:Qr,position:"normal"},p?.length?{Component:Fc({Component:un,sanitizeServerOnlyProps:!1,toMergeIntoProps:{$createWrapperBlockNode:h,$isWrapperBlockNode:g}}),position:"floatingAnchorElem"}:null].filter(Boolean),sanitizedClientFeatureProps:o,slashMenu:{groups:[u?.length?{items:u.map(C=>({Icon:vt,key:"block-"+C.slug,keywords:["block","blocks",C.slug],label:({i18n:x})=>C?.labels?.singular?ct(C.labels.singular,x):C?.slug,onSelect:({editor:x})=>{x.dispatchCommand(st,{blockName:"",blockType:C.slug})}})),key:"blocks",label:({i18n:C})=>C.t("lexical:blocks:label")}:null,m?.length?{items:m.map(C=>({Icon:He,key:"inlineBlocks-"+C.slug,keywords:["inlineBlock","inline block",C.slug],label:({i18n:x})=>C?.labels?.singular?ct(C.labels.singular,x):C?.slug,onSelect:({editor:x})=>{x.dispatchCommand(at,{blockName:"",blockType:C.slug})}})),key:"inlineBlocks",label:({i18n:C})=>C.t("lexical:blocks:inlineBlocks:label")}:null].filter(Boolean)},toolbarFixed:{groups:[u.length?{type:"dropdown",ChildComponent:vt,items:u.map((C,x)=>({ChildComponent:vt,isActive:void 0,key:"block-"+C.slug,label:({i18n:b})=>C?.labels?.singular?ct(C.labels.singular,b):C?.slug,onSelect:({editor:b})=>{b.dispatchCommand(st,{blockName:"",blockType:C.slug})},order:x})),key:"blocks",order:20}:null,m?.length?{type:"dropdown",ChildComponent:He,items:m.map((C,x)=>({ChildComponent:He,isActive:void 0,key:"inlineBlock-"+C.slug,label:({i18n:b})=>C?.labels?.singular?ct(C.labels.singular,b):C?.slug,onSelect:({editor:b})=>{b.dispatchCommand(at,{blockName:"",blockType:C.slug})},order:x})),key:"inlineBlocks",order:25}:null,L].filter(Boolean)},toolbarInline:{groups:[L].filter(Boolean)}}});import{c as Pc}from"react/compiler-runtime";import{jsx as De,jsxs as vo}from"react/jsx-runtime";import{useLexicalComposerContext as Bc}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as Hc,$createTextNode as jc,$getRoot as Wc}from"lexical";import*as fn from"react";import{useCallback as Me,useEffect as Io,useLayoutEffect as dn,useRef as yo,useState as Bt}from"react";var Gc=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)},Uc=(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)},Vc=t=>{let o=((r,n)=>{switch(r){case"click":return` await page.mouse.click(${n.x}, ${n.y});`;case"keydown":return` await page.keyboard.keydown('${n}');`;case"keyup":return` await page.keyboard.keyup('${n}');`;case"press":return` await page.keyboard.press('${n}');`;case"selectAll":return" await selectAll(page);";case"snapshot":return` await assertHTMLSnapshot(page);
|
|
4
4
|
await assertSelection(page, {
|
|
5
5
|
anchorPath: [${n.anchorPath.toString()}],
|
|
6
6
|
anchorOffset: ${n.anchorOffset},
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
`;case"type":return` await page.keyboard.type('${n}');`;default:return""}})(t.name,t.value);switch(t.count){case 1:return o;case 2:return[o,o].join(`
|
|
11
11
|
`);default:return` await repeat(${t.count}, async () => {
|
|
12
12
|
${o}
|
|
13
|
-
);`}};function
|
|
13
|
+
);`}};function Kc(t){return t.key.toLowerCase()==="a"&&(Tr?t.metaKey:t.ctrlKey)}function zc(t){let{anchorNode:e,focusNode:o}=t,{anchorOffset:r,focusOffset:n}=t;return r!==0&&r--,n!==0&&n--,{anchorNode:e,anchorOffset:r,focusNode:o,focusOffset:n}}function mn(t,e){let o=t,r=[];for(;o!==e;)o!=null&&r.unshift(Array.from(o?.parentNode?.childNodes??[]).indexOf(o)),o=o?.parentNode;return r}var pn=new Set(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Backspace","Delete","Enter","Escape"]);function Zc(t){let[e,o]=Bt([]),[r,n]=Bt(!1),[,i]=Bt(""),[l,s]=Bt(""),a=yo(null),c=yo(!1),d=yo(null),u=Me(()=>t,[t]),m=Me(()=>{let x=t.getRootElement(),b=window.getSelection();return x==null||b==null||b.anchorNode==null||b.focusNode==null||!x.contains(b.anchorNode)||!x.contains(b.focusNode)?null:`
|
|
14
14
|
import {
|
|
15
15
|
initializeE2E,
|
|
16
16
|
assertHTMLSnapshot,
|
|
@@ -27,16 +27,16 @@ describe('Test case', () => {
|
|
|
27
27
|
const {page} = e2e;
|
|
28
28
|
|
|
29
29
|
await page.focus('div[contenteditable="true"]');
|
|
30
|
-
${e.map(
|
|
30
|
+
${e.map(Vc).join(`
|
|
31
31
|
`)}
|
|
32
32
|
});
|
|
33
33
|
});
|
|
34
|
-
`},[t,e]),p=ke((x,E)=>{o(g=>{let _=e.length-1,N=e[_];if(N&&N.name===x){if(x==="type")return[...e.slice(0,_),{...N,value:N.value+E}];if(N.value===E)return[...e.slice(0,_),{...N,count:N.count+1}]}return[...g,{name:x,count:1,value:E}]})},[e,o]);Ur(()=>{let x=g=>{if(!r)return;let _=g.key;Fa(g)?p("selectAll",""):Vr.has(_)?p("press",g.key):[..._].length>1?p("keydown",g.key):p("type",g.key)},E=g=>{if(!r)return;let _=g.key;!Vr.has(_)&&[..._].length>1&&p("keyup",g.key)};return t.registerRootListener((g,_)=>{_!==null&&(_.removeEventListener("keydown",x),_.removeEventListener("keyup",E)),g!==null&&(g.addEventListener("keydown",x),g.addEventListener("keyup",E))})},[t,r,p]),Ur(()=>{c.current&&c.current.scrollTo(0,c.current.scrollHeight)},[m]),xo(()=>{if(e){let x=m();x!==null&&s(x),c.current&&c.current.scrollTo(0,c.current.scrollHeight)}},[m,e]),xo(()=>t.registerUpdateListener(({dirtyElements:E,dirtyLeaves:g,editorState:_})=>{if(!r)return;let N=_._selection,k=a.current,R=d.current;if(k!==N){if(g.size===0&&E.size===0&&!R){let b=window.getSelection();if(b&&(b.anchorNode==null||b.focusNode==null))return}a.current=N}d.current=!1;let S=m();S!==null&&s(S)}),[t,m,r,p]),xo(()=>r?t.registerUpdateListener(()=>{let E=t.getRootElement();E!==null&&i(E?.innerHTML)}):void 0,[t,r]);let f=ke(x=>{r||(x.update(()=>{let E=va();E.clear();let g=ya();E.append(Ia().append(g)),g.select()}),o([])),n(E=>!E)},[r]),h=ke(()=>{if(!r)return;let x=window.getSelection();if(x===null||x.anchorNode==null||x.focusNode==null)return;let{anchorNode:E,anchorOffset:g,focusNode:_,focusOffset:N}=Oa(x),k=u().getRootElement(),R;E!==null&&(R=Wr(E,k));let S;_!==null&&(S=Wr(_,k)),p("snapshot",{anchorNode:E,anchorOffset:g,anchorPath:R,focusNode:_,focusOffset:N,focusPath:S})},[p,r,u]),C=ke(()=>{Ma(m())},[m]),w=ke(()=>{Da("test.js",m())},[m]);return[Ne("button",{className:`editor-dev-button ${r?"active":""}`,id:"test-recorder-button",onClick:x=>{f(u()),x.preventDefault()},title:r?"Disable test recorder":"Enable test recorder",type:"button",children:r?"Disable test recorder":"Enable test recorder"}),r?_o("div",{className:"test-recorder-output",children:[_o("div",{className:"test-recorder-toolbar",children:[Ne("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:x=>{h(),x.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),Ne("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:x=>{C(),x.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),Ne("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:x=>{w(),x.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),Ne("pre",{id:"test-recorder",ref:c,children:l})]}):null]}var zr=()=>{let t=Ra(3),[e]=Sa(),[o,r]=$a(e),n;return t[0]!==o||t[1]!==r?(n=_o(Kr.Fragment,{children:[Ne("p",{children:"HI"}),o,r,Ne("p",{children:"DONE"})]}),t[0]=o,t[1]=r,t[2]=n):n=t[2],n};var Pa=y({plugins:[{Component:zr,position:"bottom"}]});import{c as Ba}from"react/compiler-runtime";import{jsx as Ha}from"react/jsx-runtime";import{useLexicalComposerContext as ja}from"@lexical/react/LexicalComposerContext.js";import{TreeView as Ga}from"@lexical/react/LexicalTreeView.js";import"react";var Zr=()=>{let t=Ba(2),[e]=ja(),o;return t[0]!==e?(o=Ha(Ga,{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 Ua=y({plugins:[{Component:Zr,position:"bottom"}]});import{$isTableSelection as Wa}from"@lexical/table";import{$isRangeSelection as Va,FORMAT_TEXT_COMMAND as Ka}from"lexical";import{jsx as Xr}from"react/jsx-runtime";import"react";var Yr=()=>Xr("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Xr("path",{d:"M10.6772 15H6.27017V5.718H10.4172C12.6792 5.718 13.8492 6.602 13.8492 8.292C13.8492 9.098 13.1992 9.982 12.4712 10.216C13.3812 10.476 14.1742 11.256 14.1742 12.322C14.1742 14.09 12.9002 15 10.6772 15ZM8.46717 9.501H10.3262C11.3012 9.501 11.7042 9.046 11.7042 8.409C11.7042 7.72 11.2362 7.317 10.3392 7.317H8.46717V9.501ZM8.46717 11.061V13.401H10.4822C11.4702 13.401 11.9642 12.959 11.9642 12.218C11.9642 11.49 11.4702 11.061 10.4822 11.061H8.46717Z",fill:"currentColor"})});var Y=t=>({type:"buttons",items:t,key:"format",order:40});var Jr={type:"text-format",format:["bold","italic"],tag:"***"},qr={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},Qr={type:"text-format",format:["bold"],tag:"**"},en={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var tn=[Y([{ChildComponent:Yr,isActive:({selection:t})=>Va(t)||Wa(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(Ka,"bold")},order:1}])],za=y(({featureProviderMap:t})=>{let e=[Qr,en];return t.get("italic")&&e.push(qr,Jr),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:tn},toolbarInline:{groups:tn}}});import{$isTableSelection as Xa}from"@lexical/table";import{$isRangeSelection as Ya,FORMAT_TEXT_COMMAND as Ja}from"lexical";import{jsx as on,jsxs as Za}from"react/jsx-runtime";import"react";var rn=()=>Za("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[on("path",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),on("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var nn={type:"text-format",format:["code"],tag:"`"};var ln=[Y([{ChildComponent:rn,isActive:({selection:t})=>Ya(t)||Xa(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(Ja,"code")},order:7}])],qa=y({enableFormats:["code"],markdownTransformers:[nn],toolbarFixed:{groups:ln},toolbarInline:{groups:ln}});import{$isTableSelection as Qa}from"@lexical/table";import{$isRangeSelection as ec,FORMAT_TEXT_COMMAND as tc}from"lexical";import{jsx as sn}from"react/jsx-runtime";import"react";var an=()=>sn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:sn("path",{d:"M11.311 14.2969L11.0327 15H6.18408L6.4624 14.2969C7.54639 14.2969 7.70752 14.209 7.83936 13.8721L10.8423 6.45996C10.8716 6.38672 10.8862 6.32812 10.8862 6.26953C10.8862 6.09375 10.6519 6.03516 9.80225 6.03516L10.0952 5.33203H14.9438L14.6509 6.03516C13.5669 6.03516 13.4204 6.12305 13.2886 6.45996L10.2856 13.8721C10.2563 13.9453 10.2271 14.0039 10.2271 14.0625C10.2271 14.2383 10.4614 14.2969 11.311 14.2969Z",fill:"currentColor"})});var cn={type:"text-format",format:["italic"],tag:"*"},un={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var dn=[Y([{ChildComponent:an,isActive:({selection:t})=>ec(t)||Qa(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(tc,"italic")},order:2}])],oc=y({enableFormats:["italic"],markdownTransformers:[cn,un],toolbarFixed:{groups:dn},toolbarInline:{groups:dn}});import{$isTableSelection as nc}from"@lexical/table";import{$isRangeSelection as ic,FORMAT_TEXT_COMMAND as lc}from"lexical";import{jsx as mn,jsxs as rc}from"react/jsx-runtime";import"react";var pn=()=>rc("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[mn("path",{d:"M5.50756 12.76H7.42756C7.56256 14.215 8.82256 14.71 10.1576 14.71C11.4326 14.71 12.4226 14.14 12.4226 13.06C12.4226 12.28 11.9576 11.845 10.6676 11.605L8.70256 11.245C7.12756 10.96 5.85256 10.21 5.85256 8.335C5.85256 6.43 7.53256 5.11 9.87256 5.11C12.4226 5.11 13.9526 6.22 14.1626 8.23H12.2876C12.1526 7.18 11.2226 6.595 9.88756 6.595C8.59756 6.595 7.78756 7.27 7.78756 8.215C7.78756 9.1 8.34256 9.385 9.49756 9.61L11.5676 10.015C13.3226 10.345 14.3726 11.215 14.3726 12.94C14.3726 14.89 12.5876 16.18 10.2176 16.18C7.66756 16.18 5.70256 15.115 5.50756 12.76Z",fill:"currentColor"}),mn("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var fn={type:"text-format",format:["strikethrough"],tag:"~~"};var hn=[Y([{ChildComponent:pn,isActive:({selection:t})=>ic(t)||nc(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(lc,"strikethrough")},order:4}])],sc=y({enableFormats:["strikethrough"],markdownTransformers:[fn],toolbarFixed:{groups:hn},toolbarInline:{groups:hn}});import{$isTableSelection as ac}from"@lexical/table";import{$isRangeSelection as cc,FORMAT_TEXT_COMMAND as uc}from"lexical";import{jsx as gn}from"react/jsx-runtime";import"react";var Cn=()=>gn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:gn("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 13.258C16.7768 14.155 16.1398 14.532 15.2038 15C14.5538 15.325 14.2808 15.546 14.2418 15.78H16.7898V16.82H12.7208V16.339C12.7208 15.286 13.5918 14.675 14.3588 14.233C15.0868 13.83 15.4378 13.635 15.4378 13.232C15.4378 12.894 15.2038 12.686 14.8268 12.686C14.3848 12.686 14.1248 13.024 14.1118 13.427H12.7468C12.8248 12.426 13.5528 11.633 14.8398 11.633C15.9448 11.633 16.7768 12.257 16.7768 13.258Z",fill:"currentColor"})});var xn=[Y([{ChildComponent:Cn,isActive:({selection:t})=>cc(t)||ac(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(uc,"subscript")},order:5}])],dc=y({enableFormats:["subscript"],toolbarFixed:{groups:xn},toolbarInline:{groups:xn}});import{$isTableSelection as mc}from"@lexical/table";import{$isRangeSelection as pc,FORMAT_TEXT_COMMAND as fc}from"lexical";import{jsx as bn}from"react/jsx-runtime";import"react";var _n=()=>bn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:bn("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 7.252C16.7768 8.149 16.1398 8.526 15.2038 8.994C14.5538 9.319 14.2808 9.54 14.2418 9.774H16.7898V10.814H12.7208V10.333C12.7208 9.28 13.5918 8.669 14.3588 8.227C15.0868 7.824 15.4378 7.629 15.4378 7.226C15.4378 6.888 15.2038 6.68 14.8268 6.68C14.3848 6.68 14.1248 7.018 14.1118 7.421H12.7468C12.8248 6.42 13.5528 5.627 14.8398 5.627C15.9448 5.627 16.7768 6.251 16.7768 7.252Z",fill:"currentColor"})});var Tn=[Y([{ChildComponent:_n,isActive:({selection:t})=>pc(t)||mc(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(fc,"superscript")},order:6}])],hc=y({enableFormats:["superscript"],toolbarFixed:{groups:Tn},toolbarInline:{groups:Tn}});import{$isTableSelection as Cc}from"@lexical/table";import{$isRangeSelection as xc,FORMAT_TEXT_COMMAND as bc}from"lexical";import{jsx as En,jsxs as gc}from"react/jsx-runtime";import"react";var wn=()=>gc("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[En("path",{d:"M13.9656 11.256C13.9656 13.791 12.5096 15.156 10.0006 15.156C7.50461 15.156 6.03561 13.791 6.03561 11.23V5.718H7.76461V11.243C7.76461 12.868 8.50561 13.778 10.0006 13.778C11.4956 13.778 12.2496 12.868 12.2496 11.243V5.718H13.9656V11.256Z",fill:"currentColor"}),En("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var kn=[Y([{ChildComponent:wn,isActive:({selection:t})=>xc(t)||Cc(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(bc,"underline")},order:3}])],_c=y({enableFormats:["underline"],toolbarFixed:{groups:kn},toolbarInline:{groups:kn}});import{$createHeadingNode as kc,$isHeadingNode as Pn,HeadingNode as Nc}from"@lexical/rich-text";import{$setBlocksType as Lc}from"@lexical/selection";import{$getSelection as Rc,$isRangeSelection as Sc}from"lexical";import{jsx as Nn}from"react/jsx-runtime";import"react";var Ln=()=>Nn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Nn("path",{d:"M4.639 13.5V7.074H6.196V9.648H9.076V7.074H10.642V13.5H9.076V10.836H6.196V13.5H4.639ZM11.5656 9.045V8.019C12.6636 8.019 13.1316 7.731 13.2846 7.065H14.4006V13.5H12.8436V9.045H11.5656Z",fill:"currentColor"})});import{jsx as Rn}from"react/jsx-runtime";import"react";var Sn=()=>Rn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Rn("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM15.9796 8.973C15.9796 10.116 15.1696 10.656 14.0356 11.232C13.2256 11.646 12.8206 11.943 12.7846 12.294H15.9886V13.5H11.0566V12.951C11.0566 11.601 12.1636 10.845 13.1176 10.287C14.0356 9.756 14.5126 9.486 14.5126 8.946C14.5126 8.46 14.2156 8.145 13.6306 8.145C13.0186 8.145 12.6586 8.613 12.6226 9.198H11.1196C11.2186 7.947 12.1006 6.966 13.6396 6.966C15.0346 6.966 15.9796 7.785 15.9796 8.973Z",fill:"currentColor"})});import{jsx as In}from"react/jsx-runtime";import"react";var yn=()=>In("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:In("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM16.1146 11.745C16.1146 12.744 15.2236 13.608 13.6126 13.608C12.0736 13.608 11.0926 12.762 10.9846 11.547H12.4696C12.5146 12.114 13.0006 12.456 13.6126 12.456C14.2876 12.456 14.6746 12.132 14.6746 11.619C14.6746 11.061 14.2426 10.836 13.6216 10.836H12.9826V9.738H13.6036C14.1526 9.738 14.5486 9.486 14.5486 8.937C14.5486 8.46 14.2156 8.127 13.6486 8.127C13.0366 8.127 12.6586 8.514 12.6226 9.045H11.1916C11.2726 7.929 12.1276 6.966 13.6666 6.966C15.1876 6.966 15.9706 7.848 15.9706 8.865C15.9706 9.603 15.5026 10.143 14.8186 10.269C15.6196 10.404 16.1146 10.971 16.1146 11.745Z",fill:"currentColor"})});import{jsx as vn}from"react/jsx-runtime";import"react";var Mn=()=>vn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:vn("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM15.1736 7.074V10.854H16.3706V12.033H15.1736V13.5H13.6796V12.033H10.5116V10.845L13.4996 7.074H15.1736ZM13.6796 8.46L11.8256 10.854H13.6796V8.46Z",fill:"currentColor"})});import{jsx as Dn}from"react/jsx-runtime";import"react";var An=()=>Dn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Dn("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.1576 10.269C12.6896 10.269 12.3746 10.494 12.2216 10.737H10.8176L11.1956 7.074H15.2546V8.28H12.3206L12.1856 9.549C12.4016 9.351 12.8516 9.126 13.4636 9.126C14.7866 9.126 15.6596 10.053 15.6596 11.358C15.6596 12.609 14.7326 13.608 13.1756 13.608C11.5826 13.608 10.6556 12.753 10.5566 11.511H12.1136C12.1586 12.06 12.5456 12.465 13.1576 12.465C13.8236 12.465 14.1746 11.97 14.1746 11.376C14.1746 10.764 13.8416 10.269 13.1576 10.269Z",fill:"currentColor"})});import{jsx as Fn}from"react/jsx-runtime";import"react";var On=()=>Fn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Fn("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.3646 8.127C12.5456 8.127 12.0416 8.937 12.0416 9.999C12.3296 9.54 12.8246 9.207 13.5536 9.207C14.8586 9.207 15.8036 10.134 15.8036 11.376C15.8036 12.645 14.8226 13.608 13.3196 13.608C11.7266 13.608 10.6196 12.393 10.6196 10.395C10.6196 8.316 11.7716 6.966 13.4186 6.966C14.7056 6.966 15.5786 7.749 15.7316 8.829H14.3186C14.2016 8.415 13.9226 8.127 13.3646 8.127ZM13.3106 12.51C13.9586 12.51 14.3816 12.042 14.3816 11.385C14.3816 10.737 13.9586 10.278 13.3106 10.278C12.6536 10.278 12.2126 10.737 12.2126 11.385C12.2126 12.042 12.6536 12.51 13.3106 12.51Z",fill:"currentColor"})});import{$createHeadingNode as Tc,$isHeadingNode as Ec,HeadingNode as wc}from"@lexical/rich-text";var To=t=>(e,o,r)=>{let n=t(r);n&&(n.append(...o),e.replace(n),n.select(0,0))};var $n=t=>{let o=`^(${t.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`,r=new RegExp(o);return{type:"element",dependencies:[wc],export:(n,i)=>{if(!Ec(n))return null;let l=Number(n.getTag().slice(1));return"#".repeat(l)+" "+i(n)},regExp:r,replace:To(n=>{let i="h"+n[1].length;return Tc(i)})}};var Bn=t=>{let e=Rc();Lc(e,()=>kc(t))},Hn={h1:Ln,h2:Sn,h3:yn,h4:Mn,h5:An,h6:On},Ic=y(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[q(e.map((r,n)=>({ChildComponent:Hn[r],isActive:({selection:i})=>{if(!Sc(i))return!1;for(let l of i.getNodes()){if(Pn(l)&&l.getTag()===r)continue;let s=l.getParent();if(!(Pn(s)&&s.getTag()===r))return!1}return!0},key:r,label:({i18n:i})=>i.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:i})=>{i.update(()=>{Bn(r)})},order:n+2})))];return{markdownTransformers:[$n(e)],nodes:[Nc],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[Z(e.map(r=>({Icon:Hn[r],key:`heading-${r.charAt(1)}`,keywords:["heading",r],label:({i18n:n})=>n.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:n})=>{n.update(()=>{Bn(r)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}});import{$isNodeSelection as Pc}from"lexical";import{jsx as jn}from"react/jsx-runtime";import"react";var Eo=()=>jn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:jn("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as Gn,jsxs as yc}from"react/jsx-runtime";import"react";var Un=()=>yc("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Gn("path",{d:"M5 10h10",stroke:"currentColor"}),Gn("path",{d:"M10 15V5",stroke:"currentColor"})]});var de=t=>({type:"dropdown",ChildComponent:Un,items:t,key:"add",order:10});var Wn={type:"element",dependencies:[gt],export:(t,e)=>xt(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=Ct();e&&t.replace(e)}};import{c as vc}from"react/compiler-runtime";import{useLexicalComposerContext as Mc}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Dc}from"@lexical/utils";import{$getSelection as Ac,$isRangeSelection as Fc,COMMAND_PRIORITY_EDITOR as Oc}from"lexical";import{useEffect as $c}from"react";var Vn=()=>{let t=vc(3),[e]=Mc(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Be,n=>{let i=Ac();if(!Fc(i))return!1;if(i.focus.getNode()!==null){let s=Ct();Dc(s)}return!0},Oc),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),$c(o,r),null};var Bc=y({markdownTransformers:[Wn],nodes:[gt],plugins:[{Component:Vn,position:"normal"}],slashMenu:{groups:[Z([{Icon:Eo,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Be,void 0)}}])]},toolbarFixed:{groups:[de([{ChildComponent:Eo,isActive:({selection:t})=>{if(!Pc(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return xt(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Be,void 0)}}])]}});import{INDENT_CONTENT_COMMAND as Yc,OUTDENT_CONTENT_COMMAND as Jc}from"lexical";import{jsx as vt,jsxs as Hc}from"react/jsx-runtime";import"react";var Kn=()=>Hc("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[vt("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),vt("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),vt("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),vt("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as Mt,jsxs as jc}from"react/jsx-runtime";import"react";var zn=()=>jc("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Mt("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),Mt("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),Mt("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),Mt("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});import{c as Gc}from"react/compiler-runtime";import{jsx as Uc}from"react/jsx-runtime";import{useLexicalComposerContext as Wc}from"@lexical/react/LexicalComposerContext.js";import{TabIndentationPlugin as Vc}from"@lexical/react/LexicalTabIndentationPlugin";import{mergeRegister as Kc}from"@lexical/utils";import{COMMAND_PRIORITY_NORMAL as Zn,FOCUS_COMMAND as zc,KEY_ESCAPE_COMMAND as Zc}from"lexical";import{useEffect as Xn,useState as Xc}from"react";var Yn=()=>{let t=Gc(8),[e]=Wc(),[o,r]=Xc(!1),n,i;t[0]!==e?(n=()=>Kc(e.registerCommand(zc,()=>(r(!1),!0),Zn),e.registerCommand(Zc,()=>(r(!0),e.getRootElement()?.blur(),!0),Zn)),i=[e,r],t[0]=e,t[1]=n,t[2]=i):(n=t[1],i=t[2]),Xn(n,i);let l,s;t[3]!==o||t[4]!==e?(l=()=>{if(!o)return;let d=c=>{["Escape","Shift"].includes(c.key)||r(!1),c.shiftKey&&c.key==="Tab"&&e.getRootElement()?.parentElement?.focus()};return document.addEventListener("keydown",d),()=>{document.removeEventListener("keydown",d)}},s=[e,o],t[3]=o,t[4]=e,t[5]=l,t[6]=s):(l=t[5],s=t[6]),Xn(l,s);let a;return t[7]===Symbol.for("react.memo_cache_sentinel")?(a=Uc(Vc,{}),t[7]=a):a=t[7],a};var Jn=t=>({type:"buttons",items:t,key:"indent",order:35});var qn=[Jn([{ChildComponent:Kn,isActive:()=>!1,isEnabled:({selection:t})=>{if(!t||!t?.getNodes()?.length)return!1;for(let e of t.getNodes()){let o=e.getParentOrThrow();if("__indent"in e&&e.__indent>0||"__indent"in o&&o.__indent>0)return!0}return!1},key:"indentDecrease",label:({i18n:t})=>t.t("lexical:indent:decreaseLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Jc,void 0)},order:1},{ChildComponent:zn,isActive:()=>!1,key:"indentIncrease",label:({i18n:t})=>t.t("lexical:indent:increaseLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Yc,void 0)},order:2}])],qc=y({plugins:[{Component:Yn,position:"normal"}],toolbarFixed:{groups:qn},toolbarInline:{groups:qn}});import{$findMatchingParent as cd}from"@lexical/utils";import{$getSelection as yo,$isRangeSelection as Ii}from"lexical";import{jsx as Qn}from"react/jsx-runtime";import"react";var ei=()=>Qn("svg",{"aria-hidden":"true",className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Qn("path",{d:"M8.5 11.5L11.5 8.5M8.5 7L9.625 5.875C10.868 4.633 12.882 4.633 14.125 5.875C15.368 7.118 15.368 9.133 14.125 10.375L13 11.5M7 8.5L5.746 9.754C4.56 10.94 4.519 12.85 5.652 14.087C6.814 15.354 8.78 15.449 10.058 14.298L11.5 13",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})});import{$isAtNodeEnd as ti}from"@lexical/selection";function Me(t){let{anchor:e}=t,{focus:o}=t,r=t.anchor.getNode(),n=t.focus.getNode();return r===n?r:t.isBackward()?ti(o)?r:n:ti(e)?r:n}var wo=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as cu,$isTextNode as uu}from"lexical";import{addClassNamesToElement as Qc,isHTMLAnchorElement as eu}from"@lexical/utils";import Lo from"bson-objectid";import{$applyNodeReplacement as tu,$createTextNode as oi,$getSelection as ou,$isElementNode as ri,$isRangeSelection as No,createCommand as ru,ElementNode as nu}from"lexical";var iu=new Set(["http:","https:","mailto:","sms:","tel:"]),Q=class t extends nu{__fields;__id;constructor({id:e,fields:o={doc:null,linkType:"custom",newTab:!1,url:""},key:r}){super(r),this.__fields=o,this.__id=e}static clone(e){return new t({id:e.__id,fields:e.__fields,key:e.__key})}static getType(){return"link"}static importDOM(){return{a:e=>({conversion:lu,priority:1})}}static importJSON(e){e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),e.version===2&&!e.id&&(e.id=new Lo.default().toHexString(),e.version=3);let o=me({id:e.id,fields:e.fields});return o.setFormat(e.format),o.setIndent(e.indent),o.setDirection(e.direction),o}canBeEmpty(){return!1}canInsertTextAfter(){return!1}canInsertTextBefore(){return!1}createDOM(e){let o=document.createElement("a");return this.__fields?.linkType==="custom"&&(o.href=this.sanitizeUrl(this.__fields.url??"")),(this.__fields?.newTab??!1)&&(o.target="_blank"),this.__fields?.newTab===!0&&this.__fields?.linkType==="custom"&&(o.rel=ko(o.rel,"add","noopener")),Qc(o,e.theme.link),o}exportJSON(){let e={...super.exportJSON(),type:"link",fields:this.getFields(),version:3},o=this.getID();return o&&(e.id=o),e}extractWithChild(e,o,r){if(!No(o))return!1;let n=o.anchor.getNode(),i=o.focus.getNode();return this.isParentOf(n)&&this.isParentOf(i)&&o.getTextContent().length>0}getFields(){return this.getLatest().__fields}getID(){return this.getLatest().__id}insertNewAfter(e,o=!0){let r=this.getParentOrThrow().insertNewAfter(e,o);if(ri(r)){let n=me({fields:this.__fields});return r.append(n),n}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!iu.has(o.protocol))return"about:blank"}catch{return"https://"}return e}setFields(e){let o=this.getWritable();o.__fields=e}updateDOM(e,o,r){let n=this.__fields?.url,i=this.__fields?.newTab;return n!=null&&n!==e.__fields?.url&&this.__fields?.linkType==="custom"&&(o.href=n),this.__fields?.linkType==="internal"&&e.__fields?.linkType==="custom"&&o.removeAttribute("href"),o.rel==null&&(o.rel=""),i!==e.__fields?.newTab&&(i??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=ko(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=ko(o.rel,"remove","noopener"))),!1}};function lu(t){let e=null;if(eu(t)){let o=t.textContent;o!==null&&o!==""&&(e=me({id:new Lo.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function me({id:t,fields:e}){return tu(new Q({id:t??new Lo.default().toHexString(),fields:e}))}function V(t){return t instanceof Q}var le=ru("TOGGLE_LINK_COMMAND");function ni(t){let e=ou();if(!No(e)&&!t.selectedNodes?.length)return;let o=No(e)?e.extract():t.selectedNodes;if(t===null)o?.forEach(r=>{let n=r.getParent();if(V(n)){let i=n.getChildren();for(let l=0;l<i.length;l+=1)n.insertBefore(i[l]);n.remove()}});else{if(o?.length===1){let i=o[0],l=V(i)?i:su(i);if(l!==null){l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append(oi(t.text)),l.getChildren().forEach(s=>{s!==l.getLastChild()&&s.remove()}));return}}let r=null,n=null;o?.forEach(i=>{let l=i.getParent();if(!(l===n||l===null||ri(i)&&!i.isInline())){if(V(l)){n=l,l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append(oi(t.text)),l.getChildren().forEach(s=>{s!==l.getLastChild()&&s.remove()}));return}if(l.is(r)||(r=l,n=me({fields:t.fields}),V(l)?i.getPreviousSibling()===null?l.insertBefore(n):l.insertAfter(n):i.insertBefore(n)),V(i)){if(i.is(n))return;if(n!==null){let s=i.getChildren();for(let a=0;a<s.length;a+=1)n.append(s[a])}i.remove();return}n!==null&&n.append(i)}})}}function su(t){return au(t,e=>V(e))}function au(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function ko(t,e,o){let r,n=`${t}`;if(e==="add"){if(n.includes(o)){let i=new RegExp(o,"g");n=n.replace(i,"").trim()}n=n.trim(),r=n.length===0?`${o}`:`${n} ${o}`}else{let i=new RegExp(o,"g");r=n.replace(i,"").trim()}return r}var ii={type:"text-match",dependencies:[Q],export:(t,e,o)=>{if(!V(t))return null;let r=t,{url:n}=r.getFields(),i=`[${r.getTextContent()}](${n})`,l=r.getFirstChild();return r.getChildrenSize()===1&&uu(l)?o(l,i):i},importRegExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:(t,e)=>{let[,o,r]=e,n=me({fields:{doc:null,linkType:"custom",newTab:!1,url:r}}),i=cu(o);i.setFormat(t.getFormat()),n.append(i),t.replace(n)},trigger:")"};import{$applyNodeReplacement as du,$isElementNode as mu}from"lexical";var pe=class t extends Q{static clone(e){return new t({id:"",fields:e.__fields,key:e.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(e){e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2);let o=Qe({fields:e.fields});return o.setFormat(e.format),o.setIndent(e.indent),o.setDirection(e.direction),o}exportJSON(){let e=super.exportJSON();return{type:"autolink",children:e.children,direction:e.direction,fields:e.fields,format:e.format,indent:e.indent,version:2}}insertNewAfter(e,o=!0){let r=this.getParentOrThrow().insertNewAfter(e,o);if(mu(r)){let n=Qe({fields:this.__fields});return r.append(n),n}return null}};function Qe({fields:t}){return du(new pe({id:"",fields:t}))}function fe(t){return t instanceof pe}import{c as pu}from"react/compiler-runtime";import{useLexicalComposerContext as fu}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as hu}from"@lexical/utils";import{$createTextNode as li,$getSelection as gu,$isElementNode as ai,$isLineBreakNode as ci,$isNodeSelection as Cu,$isRangeSelection as xu,$isTextNode as et,TextNode as bu}from"lexical";import{useEffect as _u}from"react";function si(t,e=o=>o){return o=>{let r=t.exec(o);return r===null?null:{index:r.index,length:r[0].length,text:r[0],url:e(r[0])}}}function ui(t,e){for(let o=0;o<e.length;o++){let r=e[o](t);if(r!=null)return r}return null}var Tu=/[.,;\s]/;function At(t){return Tu.test(t)}function di(t){return At(t[t.length-1])}function So(t){return At(t[0])}function Eu(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function mi(t){let e=t.getPreviousSibling();return ai(e)&&(e=e.getLastDescendant()),e===null||ci(e)||et(e)&&di(e.getTextContent())}function pi(t){let e=t.getNextSibling();return ai(e)&&(e=e.getFirstDescendant()),e===null||ci(e)||et(e)&&So(e.getTextContent())}function wu(t,e,o,r){return(t>0?At(o[t-1]):mi(r[0]))?e<o.length?At(o[e]):pi(r[r.length-1]):!1}function ku(t,e,o){let r=[],n=[],i=[],l=0,s=0,a=[...t];for(;a.length>0;){let d=a[0],u=d.getTextContent().length,m=s;s+u<=e?(r.push(d),l+=u):m>=o?i.push(d):n.push(d),s+=u,a.shift()}return[l,r,n,i]}function Nu(t,e,o,r){let n={linkType:"custom",url:r.url,...r.fields},i=Qe({fields:n});if(t.length===1){let l=t[0],s;e===0?[s,l]=l.splitText(o):[,s,l]=l.splitText(e,o);let a=li(r.text);return a.setFormat(s.getFormat()),a.setDetail(s.getDetail()),a.setStyle(s.getStyle()),i.append(a),s.replace(i),l}else if(t.length>1){let l=t[0],s=l.getTextContent().length,a;e===0?a=l:[,a]=l.splitText(e);let d=[],c;for(let f=1;f<t.length;f++){let h=t[f],w=h.getTextContent().length,v=s,D=s+w;if(v<o)if(D<=o)d.push(h);else{let[x,E]=h.splitText(o-v);d.push(x),c=E}s+=w}let u=gu(),m=u?u.getNodes().find(et):void 0,p=li(a.getTextContent());return p.setFormat(a.getFormat()),p.setDetail(a.getDetail()),p.setStyle(a.getStyle()),i.append(p,...d),m&&m===a&&(xu(u)?p.select(u.anchor.offset,u.focus.offset):Cu(u)&&p.select(0,p.getTextContent().length)),a.replace(i),c}}function Lu(t,e,o){let r=[...t],n=r.map(a=>a.getTextContent()).join(""),i=n,l,s=0;for(;(l=ui(i,e))!=null&&l!==null;){let a=l.index,d=l.length,c=a+d;if(wu(s+a,s+c,n,r)){let[m,,p,f]=ku(r,s+a,s+c),h=s+a-m,C=s+c-m,w=Nu(p,h,C,l);r=w?[w,...f]:f,o(l.url,null),s=0}else s+=c;i=i.substring(c)}}function Ro(t,e,o){let r=t.getChildren(),n=r.length;for(let a=0;a<n;a++){let d=r[a];if(!et(d)||!d.isSimpleText()){Dt(t),o(null,t.getFields()?.url??null);return}}let i=t.getTextContent(),l=ui(i,e);if(l===null||l.text!==i){Dt(t),o(null,t.getFields()?.url??null);return}if(!mi(t)||!pi(t)){Dt(t),o(null,t.getFields()?.url??null);return}let s=t.getFields()?.url;if(s!==l?.url){let a=t.getFields();a.url=l?.url,t.setFields(a),o(l.url,s??null)}}function Ru(t,e,o){let r=t.getPreviousSibling(),n=t.getNextSibling(),i=t.getTextContent();if(fe(r)){let l=r.getFields()?.url?r.getFields()?.url?.startsWith("mailto:"):!1;(!So(i)||Eu(i,l))&&(r.append(t),Ro(r,e,o),o(null,r.getFields()?.url??null))}fe(n)&&!di(i)&&(Dt(n),Ro(n,e,o),o(null,n.getFields()?.url??null))}function Dt(t){let e=t.getChildren(),o=e.length;for(let r=o-1;r>=0;r--)t.insertAfter(e[r]);return t.remove(),e.map(r=>r.getLatest())}function Su(t){let e=[t],o=t.getNextSibling();for(;o!==null&&et(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function Iu(t,e,o){let r=pu(5),n,i;r[0]!==t||r[1]!==o||r[2]!==e?(n=()=>{if(!t.hasNodes([pe]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let l=(s,a)=>{o?.(s,a)};return hu(t.registerNodeTransform(bu,s=>{let a=s.getParentOrThrow(),d=s.getPreviousSibling();if(fe(a))Ro(a,e,l);else if(!V(a)){if(s.isSimpleText()&&(So(s.getTextContent())||!fe(d))){let c=Su(s);Lu(c,e,l)}Ru(s,e,l)}}))},i=[t,e,o],r[0]=t,r[1]=o,r[2]=e,r[3]=n,r[4]=i):(n=r[3],i=r[4]),_u(n,i)}var yu=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,vu=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,Mu=[si(yu,t=>t.startsWith("http")?t:`https://${t}`),si(vu,t=>`mailto:${t}`)],fi=()=>{let[t]=fu();return Iu(t,Mu),null};import{jsx as Du}from"react/jsx-runtime";import{ClickableLinkPlugin as Au}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var hi=()=>Du(Au,{});import{jsx as Ju}from"react/jsx-runtime";import"react";import{createPortal as qu}from"react-dom";import{jsx as he,jsxs as tt,Fragment as Ou}from"react/jsx-runtime";import{useLexicalComposerContext as $u}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as gi,mergeRegister as Ci}from"@lexical/utils";import{getTranslation as Io}from"@payloadcms/translations";import{CloseMenuIcon as Pu,EditIcon as Bu,ExternalLinkIcon as xi,formatDrawerSlug as Hu,useConfig as ju,useEditDepth as Gu,useLocale as Uu,useTranslation as Wu}from"@payloadcms/ui";import{requests as Vu}from"@payloadcms/ui/shared";import{$getSelection as bi,$isLineBreakNode as Ku,$isRangeSelection as _i,COMMAND_PRIORITY_HIGH as zu,COMMAND_PRIORITY_LOW as Ti,KEY_ESCAPE_COMMAND as Zu,SELECTION_CHANGE_COMMAND as Xu}from"lexical";import Ei,{useCallback as wi,useEffect as $t,useRef as Yu,useState as Le}from"react";function Ft(t,e,o,r=10,n=5){let i=o.parentElement;if(t===null||i==null){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let l=e.getBoundingClientRect(),s=o.getBoundingClientRect(),a=i.getBoundingClientRect(),d=t.top-r,c=t.left-n;d<a.top&&(d+=l.height+t.height+r*2),c+l.width>a.right&&(c=a.right-l.width-n),d-=s.top,c-=s.left,e.style.opacity="1",e.style.transform=`translate(${c}px, ${d}px)`}import{createCommand as Fu}from"lexical";var Ot=Fu("TOGGLE_LINK_WITH_MODAL_COMMAND");function ki({anchorElem:t}){let[e]=$u(),[o,r]=Le(),n=Yu(null),[i,l]=Le(null),[s,a]=Le(null),{fieldProps:{schemaPath:d},uuid:c}=B(),{config:u}=ju(),{i18n:m,t:p}=Wu(),[f,h]=Le(),C=Gu(),[w,v]=Le(!1),[D,x]=Le([]),E=Uu(),[g,_]=Le(!1),N=Hu({slug:"lexical-rich-text-link-"+c,depth:C}),{toggleDrawer:k}=ce(N),R=wi(()=>{v(!1),n&&n.current&&(n.current.style.opacity="0",n.current.style.transform="translate(-10000px, -10000px)"),_(!1),l(null),a(null),x([]),h(void 0)},[v,l,a,x]),S=wi(()=>{let b=bi(),T;if(!_i(b)||!b){R();return}let I=Me(b);T=e.getElementByKey(I.getKey())?.getBoundingClientRect();let L=gi(I,V),A=b.getNodes().filter(U=>!Ku(U)).find(U=>{let H=gi(U,V);return L&&!L.is(H)||H&&!H.is(L)});if(L==null||A){R();return}r(L);let M=L.getFields(),O={...M,id:L.getID(),text:L.getTextContent()};if(M?.linkType==="custom")l(M?.url??null),a(null);else{l(`${u.routes.admin==="/"?"":u.routes.admin}/collections/${M?.doc?.relationTo}/${M?.doc?.value}`);let U=u.collections.find(H=>H.slug===M?.doc?.relationTo);if(!U)a(M?.label?String(M?.label):null),l(M?.url?String(M?.url):null);else{let H=typeof M.doc?.value=="object"?M.doc.value.id:M.doc?.value,ee=M.doc?.relationTo;if(!H||!ee)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let pt=p("fields:linkedTo",{label:`${Io(U.labels.singular,m)} - ${p("lexical:link:loadingWithEllipsis",m)}`}).replace(/<[^>]*>?/g,"");a(pt),Vu.get(`${u.serverURL}${u.routes.api}/${ee}/${H}`,{headers:{"Accept-Language":m.language},params:{depth:0,locale:E?.code}}).then(async ie=>{if(!ie.ok)throw new Error(`HTTP error! Status: ${ie.status}`);let ye=await ie.json(),ft=U?.admin?.useAsTitle||"id",ht=ye[ft],dr=p("fields:linkedTo",{label:`${Io(U.labels.singular,m)} - ${ht}`}).replace(/<[^>]*>?/g,"");a(dr)}).catch(()=>{let ie=p("fields:linkedTo",{label:`${Io(U.labels.singular,m)} - ${p("general:untitled",m)} - ID: ${H}`}).replace(/<[^>]*>?/g,"");a(ie)})}}h(O),v(!0),x(b?b?.getNodes():[]),fe(L)?_(!0):_(!1);let G=n.current,$=window.getSelection(),{activeElement:W}=document;if(G===null)return;let J=e.getRootElement();return $!==null&&J!==null&&J.contains($.anchorNode)?(T||(T=$.getRangeAt(0).getBoundingClientRect()),T!=null&&(T.y+=40,Ft(T,G,t))):(W==null||W.className!=="link-input")&&(J!==null&&Ft(null,G,t),l(null),a(null)),!0},[e,R,u.routes.admin,u.routes.api,u.collections,u.serverURL,p,m,E?.code,t]);return $t(()=>Ci(e.registerCommand(Ot,b=>(e.dispatchCommand(le,b),S(),k(),!0),Ti)),[e,S,k,N]),$t(()=>{let b=t.parentElement,T=()=>{e.getEditorState().read(()=>{S()})};return window.addEventListener("resize",T),b?.addEventListener("scroll",T),()=>{window.removeEventListener("resize",T),b?.removeEventListener("scroll",T)}},[t.parentElement,e,S]),$t(()=>Ci(e.registerUpdateListener(({editorState:b})=>{b.read(()=>{S()})}),e.registerCommand(Xu,()=>(S(),!0),Ti),e.registerCommand(Zu,()=>w?(R(),!0):!1,zu)),[e,S,w,R]),$t(()=>{e.getEditorState().read(()=>{S()})},[e,S]),tt(Ei.Fragment,{children:[he("div",{className:"link-editor",ref:n,children:tt("div",{className:"link-input",children:[i&&i.length>0?tt("a",{href:i,rel:"noopener noreferrer",target:"_blank",children:[o?.__fields.newTab?he(xi,{}):null,s!=null&&s.length>0?s:i]}):s!=null&&s.length>0?tt(Ou,{children:[o?.__fields.newTab?he(xi,{}):null,he("span",{className:"link-input__label-pure",children:s})]}):null,e.isEditable()&&tt(Ei.Fragment,{children:[he("button",{"aria-label":"Edit link",className:"link-edit",onClick:()=>{k()},onMouseDown:b=>{b.preventDefault()},tabIndex:0,type:"button",children:he(Bu,{})}),!g&&he("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(le,null)},onMouseDown:b=>{b.preventDefault()},tabIndex:0,type:"button",children:he(Pu,{})})]})]})}),he(He,{className:"lexical-link-edit-drawer",data:f,drawerSlug:N,drawerTitle:p("fields:editLink"),featureKey:"link",handleDrawerSubmit:(b,T)=>{let I=T,L={...I};delete L.text,e.update(()=>{let A=bi(),M=null;if(_i(A)?M=Me(A).getParent():D.length&&(M=D[0].getParent()),M&&fe(M)){let O=me({fields:L});M.replace(O,!0)}}),e.dispatchCommand(le,{fields:L,selectedNodes:D,text:I.text})},schemaPath:d,schemaPathSuffix:"fields"})]})}var Ni=t=>{let{anchorElem:e=document.body}=t;return qu(Ju(ki,{anchorElem:e}),e)};import{c as td}from"react/compiler-runtime";import{useLexicalComposerContext as od}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as rd}from"@lexical/utils";import{$getSelection as nd,$isElementNode as id,$isRangeSelection as ld,COMMAND_PRIORITY_LOW as Ri,PASTE_COMMAND as sd}from"lexical";import{useEffect as ad}from"react";var Qu=/(?:[A-Za-z]{3,9}:(?:\/\/)?(?:[-;:&=+$,\w]+@)?[A-Za-z\d.-]+|(?:www.|[-;:&=+$,\w]+@)[A-Za-z\d.-]+)(?:\/[+~%/.\w-]*)?\??[-+=&;%@.\w]*#?\w*/,ed=/^[\w\-./]*(?:#\w[\w-]*)?$/;function Li(t){if(!t)return!1;if(t==="https://"||Qu.test(t)||ed.test(t))return!0;try{return new URL(t),!0}catch{}return!1}var Si=()=>{let t=td(3),[e]=od(),o,r;return t[0]!==e?(o=()=>{if(!e.hasNodes([Q]))throw new Error("LinkPlugin: LinkNode not registered on editor");return rd(e.registerCommand(le,n=>(ni(n),!0),Ri),e.registerCommand(sd,n=>{let i=nd();if(!ld(i)||i.isCollapsed()||!(n instanceof ClipboardEvent)||n.clipboardData==null)return!1;let l=n.clipboardData.getData("text");if(!Li(l))return!1;if(!i.getNodes().some(s=>id(s))){let s={doc:null,linkType:"custom",newTab:!1,url:l};return e.dispatchCommand(le,{fields:s,text:null}),n.preventDefault(),!0}return!1},Ri))},r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),ad(o,r),null};var yi=[wo([{ChildComponent:ei,isActive:({selection:t})=>{if(Ii(t)){let e=Me(t);return cd(e,V)!=null}return!1},isEnabled:({selection:t})=>!!(Ii(t)&&yo()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(le,null);else{let o,r=[];if(t.getEditorState().read(()=>{o=yo()?.getTextContent(),r=yo()?.getNodes()??[]}),!o?.length)return;let n={doc:null,linkType:"custom",newTab:!1,url:"https://"};t.dispatchCommand(Ot,{fields:n,selectedNodes:r,text:o})}},order:1}])],ud=y({markdownTransformers:[ii],nodes:[Q,pe],plugins:[{Component:Si,position:"normal"},{Component:fi,position:"normal"},{Component:hi,position:"normal"},{Component:Ni,position:"floatingAnchorElem"}],toolbarFixed:{groups:yi},toolbarInline:{groups:yi}});import{$isListNode as Do,INSERT_CHECK_LIST_COMMAND as Oi,ListItemNode as Ed,ListNode as wd}from"@lexical/list";import{$isRangeSelection as kd}from"lexical";import{jsx as vi,jsxs as dd}from"react/jsx-runtime";import"react";var vo=()=>dd("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[vi("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),vi("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as md}from"react/jsx-runtime";import{ListPlugin as pd}from"@lexical/react/LexicalListPlugin.js";import"react";var De=()=>md(pd,{});function Ae(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as Cd,ListItemNode as xd,ListNode as bd}from"@lexical/list";import{$createListItemNode as fd,$createListNode as hd,$isListItemNode as gd,$isListNode as Mo}from"@lexical/list";var Mi=4,Fe=t=>(e,o,r)=>{let n=e.getPreviousSibling(),i=e.getNextSibling(),l=fd(t==="check"?r[3]==="x":void 0);if(Mo(i)&&i.getListType()===t){let a=i.getFirstChild();a!==null?a.insertBefore(l):i.append(l),e.remove()}else if(Mo(n)&&n.getListType()===t)n.append(l),e.remove();else{let a=hd(t,t==="number"?Number(r[2]):void 0);a.append(l),e.replace(a)}l.append(...o),l.select(0,0);let s=Math.floor(r[1].length/Mi);s&&l.setIndent(s)},Re=(t,e,o)=>{let r=[],n=t.getChildren(),i=0;for(let l of n)if(gd(l)){if(l.getChildrenSize()===1){let c=l.getFirstChild();if(Mo(c)){r.push(Re(c,e,o+1));continue}}let s=" ".repeat(o*Mi),a=t.getListType(),d=a==="number"?`${t.getStart()+i}. `:a==="check"?`- [${l.getChecked()?"x":" "}] `:"- ";r.push(s+d+e(l)),i++}return r.join(`
|
|
35
|
-
`)};var Di={type:"element",dependencies:[bd,xd],export:(t,e)=>Cd(t)?Re(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:Fe("check")};import{jsx as _d}from"react/jsx-runtime";import{CheckListPlugin as Td}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var Ai=()=>_d(Td,{});var Fi=[q([{ChildComponent:vo,isActive:({selection:t})=>{if(!kd(t))return!1;for(let e of t.getNodes()){if(Do(e)&&e.getListType()==="check")continue;let o=e.getParent();if(Do(o)&&o.getListType()==="check")continue;let r=o?.getParent();if(!(Do(r)&&r.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(Oi,void 0)},order:12}])],Nd=y(({featureProviderMap:t})=>{let e=[{Component:Ai,position:"normal"}];return!t.has("unorderedList")&&!t.has("orderedList")&&e.push({Component:De,position:"normal"}),{markdownTransformers:[Di],nodes:t.has("unorderedList")||t.has("orderedList")?[]:[wd,Ed],plugins:e,slashMenu:{groups:[Ae([{Icon:vo,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:o})=>o.t("lexical:checklist:label"),onSelect:({editor:o})=>{o.dispatchCommand(Oi,void 0)}}])]},toolbarFixed:{groups:Fi},toolbarInline:{groups:Fi}}});import{$isListNode as Fo,INSERT_ORDERED_LIST_COMMAND as Bi,ListItemNode as yd,ListNode as vd}from"@lexical/list";import{$isRangeSelection as Md}from"lexical";import{jsx as ot,jsxs as Ld}from"react/jsx-runtime";import"react";var Ao=()=>Ld("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[ot("path",{d:"M5.89284 12.479C5.89284 13.368 5.26284 13.788 4.38084 14.236C3.75084 14.558 3.43584 14.789 3.40784 15.062H5.89984V16H2.06384V15.573C2.06384 14.523 2.92484 13.935 3.66684 13.501C4.38084 13.088 4.75184 12.878 4.75184 12.458C4.75184 12.08 4.52084 11.835 4.06584 11.835C3.58984 11.835 3.30984 12.199 3.28184 12.654H2.11284C2.18984 11.681 2.87584 10.918 4.07284 10.918C5.15784 10.918 5.89284 11.555 5.89284 12.479Z",fill:"currentColor"}),ot("path",{d:"M2.68608 4.535V3.737C3.54008 3.737 3.90408 3.513 4.02308 2.995H4.89108V8H3.68008L3.68008 4.535H2.68608Z",fill:"currentColor"}),ot("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),ot("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),ot("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Rd,ListItemNode as Sd,ListNode as Id}from"@lexical/list";var $i={type:"element",dependencies:[Id,Sd],export:(t,e)=>Rd(t)?Re(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:Fe("number")};var Pi=[q([{ChildComponent:Ao,isActive:({selection:t})=>{if(!Md(t))return!1;for(let e of t.getNodes()){if(Fo(e)&&e.getListType()==="number")continue;let o=e.getParent();if(Fo(o)&&o.getListType()==="number")continue;let r=o?.getParent();if(!(Fo(r)&&r.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Bi,void 0)},order:10}])],Dd=y(({featureProviderMap:t})=>({markdownTransformers:[$i],nodes:t.has("orderedList")?[]:[vd,yd],plugins:t.has("orderedList")?[]:[{Component:De,position:"normal"}],slashMenu:{groups:[Ae([{Icon:Ao,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:e})=>e.t("lexical:orderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(Bi,void 0)}}])]},toolbarFixed:{groups:Pi},toolbarInline:{groups:Pi}}));import{$isListNode as $o,INSERT_UNORDERED_LIST_COMMAND as Gi,ListItemNode as Pd,ListNode as Bd}from"@lexical/list";import{$isRangeSelection as Hd}from"lexical";import{jsx as Oe,jsxs as Ad}from"react/jsx-runtime";import"react";var Oo=()=>Ad("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Oe("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Oe("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Oe("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Oe("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),Oe("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),Oe("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Fd,ListItemNode as Od,ListNode as $d}from"@lexical/list";var Hi={type:"element",dependencies:[$d,Od],export:(t,e)=>Fd(t)?Re(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:Fe("bullet")};var ji=[q([{ChildComponent:Oo,isActive:({selection:t})=>{if(!Hd(t))return!1;for(let e of t.getNodes()){if($o(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if($o(o)&&o.getListType()==="bullet")continue;let r=o?.getParent();if(!($o(r)&&r.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Gi,void 0)},order:11}])],jd=y({markdownTransformers:[Hi],nodes:[Bd,Pd],plugins:[{Component:De,position:"normal"}],slashMenu:{groups:[Ae([{Icon:Oo,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Gi,void 0)}}])]},toolbarFixed:{groups:ji},toolbarInline:{groups:ji}});import{jsx as Gd}from"react/jsx-runtime";import{addClassNamesToElement as Ud}from"@lexical/utils";import{DecoratorNode as Wd}from"lexical";import*as Ui from"react";var Vd=Ui.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),rt=class t extends Wd{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new t({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return Kd({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return Ud(o,"unknownConverted"),o}decorate(){return Gd(Vd,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function Kd({data:t}){return new rt({data:t})}var zd=y(()=>({nodes:[rt]}));import{jsx as Zd}from"react/jsx-runtime";import{addClassNamesToElement as Xd}from"@lexical/utils";import{DecoratorNode as Yd}from"lexical";import*as Wi from"react";var Jd=Wi.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),nt=class t extends Yd{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new t({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return qd({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return Xd(o,"unknownConverted"),o}decorate(){return Zd(Jd,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function qd({data:t}){return new nt({data:t})}var Qd=y(()=>({nodes:[nt]}));import{$setBlocksType as zi}from"@lexical/selection";import{$createParagraphNode as Zi,$getSelection as Xi,$isParagraphNode as Vi,$isRangeSelection as em}from"lexical";var Ki=[q([{ChildComponent:ze,isActive:({selection:t})=>{if(!em(t))return!1;for(let e of t.getNodes())if(!Vi(e)&&!Vi(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=Xi();zi(e,()=>Zi())})},order:1}])],tm=y({slashMenu:{groups:[Z([{Icon:ze,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Xi();zi(e,()=>Zi())})}}])]},toolbarFixed:{groups:Ki},toolbarInline:{groups:Ki}});import{$isNodeSelection as Im}from"lexical";import{jsx as it,jsxs as om}from"react/jsx-runtime";import"react";var Po=()=>om("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[it("g",{clipPath:"url(#clip0_4397_10817)",children:it("path",{d:"M7.75 12.25L15.25 4.75M15.25 4.75H11.5M15.25 4.75V8.5M13 11.5V13.75C13 14.5784 12.3284 15.25 11.5 15.25H6.25C5.42157 15.25 4.75 14.5784 4.75 13.75V8.5C4.75 7.67157 5.42157 7 6.25 7H8.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})}),it("defs",{children:it("clipPath",{id:"clip0_4397_10817",children:it("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{c as Cm}from"react/compiler-runtime";import{jsx as xm}from"react/jsx-runtime";import{useLexicalComposerContext as bm}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as _m}from"@lexical/utils";import{useConfig as Tm}from"@payloadcms/ui";import{$getPreviousSelection as Em,$getSelection as wm,$isParagraphNode as tl,$isRangeSelection as km,COMMAND_PRIORITY_EDITOR as Nm,createCommand as Lm}from"lexical";import{useEffect as Rm}from"react";import{c as mm}from"react/compiler-runtime";import{jsx as Pt}from"react/jsx-runtime";import{useLexicalComposerContext as pm}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as fm,COMMAND_PRIORITY_EDITOR as hm}from"lexical";import{useEffect as Ji,useState as qi}from"react";import{c as rm}from"react/compiler-runtime";import{jsx as nm}from"react/jsx-runtime";import{useLexicalComposerContext as im}from"@lexical/react/LexicalComposerContext";import{useListDrawer as lm,useModal as sm}from"@payloadcms/ui";import{$getPreviousSelection as am,$getSelection as cm,$setSelection as um}from"lexical";import{useEffect as dm,useState as Yi}from"react";var lt=t=>{let e=rm(23),[o]=im(),[r,n]=Yi(null),[i,l]=Yi(!1),[s,a,d]=lm(t),{closeDrawer:c,drawerSlug:u,isDrawerOpen:m,openDrawer:p}=d,{modalState:f}=sm(),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let R=cm()??am();n(R)},e[0]=h):h=e[0];let C=h,w;e[1]!==r||e[2]!==o?(w=()=>{r&&o.update(()=>{um(r.clone())},{discrete:!0,skipTransforms:!0})},e[1]=r,e[2]=o,e[3]=w):w=e[3];let v=w,D;e[4]!==c?(D=()=>{c()},e[4]=c,e[5]=D):D=e[5];let x=D,E,g;e[6]!==i||e[7]!==f||e[8]!==u||e[9]!==v?(E=()=>{if(!i)return;let R=f[u];R&&!R?.isOpen&&(l(!1),setTimeout(()=>{v()},1))},g=[f,u,v,i],e[6]=i,e[7]=f,e[8]=u,e[9]=v,e[10]=E,e[11]=g):(E=e[10],g=e[11]),dm(E,g);let _;e[12]!==a?(_=R=>nm(a,{...R,onClick:()=>{C()}}),e[12]=a,e[13]=_):_=e[13];let N;e[14]!==p?(N=()=>{C(),p(),l(!0)},e[14]=p,e[15]=N):N=e[15];let k;return e[16]!==x||e[17]!==m||e[18]!==s||e[19]!==u||e[20]!==_||e[21]!==N?(k={closeListDrawer:x,isListDrawerOpen:m,ListDrawer:s,listDrawerSlug:u,ListDrawerToggler:_,openListDrawer:N},e[16]=x,e[17]=m,e[18]=s,e[19]=u,e[20]=_,e[21]=N,e[22]=k):k=e[22],k};var gm=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=fm(o);n&&n.replace(Ue({relationTo:e,value:r}))}):t.dispatchCommand(Bo,{relationTo:e,value:r})},Qi=t=>{let e=mm(21),{enabledCollectionSlugs:o}=t,[r]=pm(),n;e[0]!==o?(n=()=>o?.[0],e[0]=o,e[1]=n):n=e[1];let[i,l]=qi(n),[s,a]=qi(null),d=o||void 0,c;e[2]!==d||e[3]!==i?(c={collectionSlugs:d,selectedCollection:i},e[2]=d,e[3]=i,e[4]=c):c=e[4];let{closeListDrawer:u,isListDrawerOpen:m,ListDrawer:p,openListDrawer:f}=lt(c),h,C;e[5]!==r||e[6]!==f?(h=()=>r.registerCommand(je,g=>(a(g?.replace?g?.replace.nodeKey:null),f(),!0),hm),C=[r,f],e[5]=r,e[6]=f,e[7]=h,e[8]=C):(h=e[7],C=e[8]),Ji(h,C);let w;e[9]!==r||e[10]!==s||e[11]!==u?(w=g=>{let{collectionSlug:_,docID:N}=g;gm({editor:r,relationTo:_,replaceNodeKey:s,value:N}),u()},e[9]=r,e[10]=s,e[11]=u,e[12]=w):w=e[12];let v=w,D;e[13]!==o?(D=()=>{l(o?.[0])},e[13]=o,e[14]=D):D=e[14];let x;e[15]!==m||e[16]!==o?(x=[m,o],e[15]=m,e[16]=o,e[17]=x):x=e[17],Ji(D,x);let E;return e[18]!==v||e[19]!==p?(E=Pt(p,{onSelect:v}),e[18]=v,e[19]=p,e[20]=E):E=e[20],E},el=t=>(t?.enabledCollectionSlugs?.length??-1)>0?Pt(Qi,{...t}):Pt(bt,{...t,children:Pt(Qi,{...t})});var Bo=Lm("INSERT_RELATIONSHIP_COMMAND"),ol=t=>{let e=Cm(10),{clientProps:o}=t,[r]=bm(),{config:n}=Tm(),{collections:i}=n,l=null;if(o?.enabledCollections)l=o?.enabledCollections;else if(o?.disabledCollections){let c;if(e[0]!==o||e[1]!==i){let u;e[3]!==o?(u=m=>{let{slug:p}=m;return!o?.disabledCollections?.includes(p)},e[3]=o,e[4]=u):u=e[4],c=i.filter(u).map(Sm),e[0]=o,e[1]=i,e[2]=c}else c=e[2];l=c}let s,a;e[5]!==r?(s=()=>{if(!r.hasNodes([Ge]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return r.registerCommand(Bo,c=>{let u=wm()||Em();if(km(u)){let m=Ue(c);_m(m);let{focus:p}=u,f=p.getNode();tl(f)&&f.getTextContentSize()===0&&f.getParentOrThrow().getChildren().filter(h=>tl(h)).length>1&&f.remove()}return!0},Nm)},a=[r],e[5]=r,e[6]=s,e[7]=a):(s=e[6],a=e[7]),Rm(s,a);let d;return e[8]!==l?(d=xm(el,{enabledCollectionSlugs:l}),e[8]=l,e[9]=d):d=e[9],d};function Sm(t){let{slug:e}=t;return e}var ym=y({nodes:[Ge],plugins:[{Component:ol,position:"normal"}],slashMenu:{groups:[Z([{Icon:Po,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(je,{replace:!1})}}])]},toolbarFixed:{groups:[de([{ChildComponent:Po,isActive:({selection:t})=>{if(!Im(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return lo(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(je,{replace:!1})}}])]}});import{c as cl}from"react/compiler-runtime";import{jsx as ne,jsxs as zm}from"react/jsx-runtime";import{useLexicalComposerContext as Zm}from"@lexical/react/LexicalComposerContext.js";import{useScrollInfo as Xm,useThrottledEffect as Ym,useTranslation as Jm}from"@payloadcms/ui";import*as ge from"react";import{useMemo as qm}from"react";import{c as vm}from"react/compiler-runtime";import{jsx as Mm}from"react/jsx-runtime";import{mergeRegister as Dm}from"@lexical/utils";import{$addUpdateTag as Am,$getSelection as Fm}from"lexical";import{useEffect as Bt,useState as Ho}from"react";var jo="toolbar-popup__button",st=t=>{let e=vm(34),{children:o,editor:r,item:n}=t,[i,l]=Ho(!0),[s,a]=Ho(!1),[d,c]=Ho(jo),u=B(),m;e[0]!==r||e[1]!==n||e[2]!==u||e[3]!==s||e[4]!==i?(m=()=>{r.getEditorState().read(()=>{let N=Fm();if(N){if(n.isActive){let k=n.isActive({editor:r,editorConfigContext:u,selection:N});s!==k&&a(k)}if(n.isEnabled){let k=n.isEnabled({editor:r,editorConfigContext:u,selection:N});i!==k&&l(k)}}})},e[0]=r,e[1]=n,e[2]=u,e[3]=s,e[4]=i,e[5]=m):m=e[5];let p=m,f,h;e[6]!==p?(f=()=>{p()},h=[p],e[6]=p,e[7]=f,e[8]=h):(f=e[7],h=e[8]),Bt(f,h);let C,w;e[9]!==p?(C=()=>(document.addEventListener("mouseup",p),()=>{document.removeEventListener("mouseup",p)}),w=[p],e[9]=p,e[10]=C,e[11]=w):(C=e[10],w=e[11]),Bt(C,w);let v,D;e[12]!==r||e[13]!==p?(v=()=>Dm(r.registerUpdateListener(()=>{p()})),D=[r,p],e[12]=r,e[13]=p,e[14]=v,e[15]=D):(v=e[14],D=e[15]),Bt(v,D);let x;e[16]!==i||e[17]!==s||e[18]!==n?(x=()=>{c([jo,i===!1?"disabled":"",s?"active":"",n?.key?`${jo}-`+n.key:""].filter(Boolean).join(" "))},e[16]=i,e[17]=s,e[18]=n,e[19]=x):x=e[19];let E;e[20]!==i||e[21]!==s||e[22]!==d||e[23]!==n.key?(E=[i,s,d,n.key],e[20]=i,e[21]=s,e[22]=d,e[23]=n.key,e[24]=E):E=e[24],Bt(x,E);let g;e[25]!==i||e[26]!==r||e[27]!==n.onSelect||e[28]!==s?(g=()=>{if(i!==!1)return r.focus(()=>{r.update(()=>{Am("toolbar")}),n.onSelect?.({editor:r,isActive:s})}),!0},e[25]=i,e[26]=r,e[27]=n.onSelect,e[28]=s,e[29]=g):g=e[29];let _;return e[30]!==d||e[31]!==g||e[32]!==o?(_=Mm("button",{className:d,onClick:g,onMouseDown:Om,type:"button",children:o}),e[30]=d,e[31]=g,e[32]=o,e[33]=_):_=e[33],_};function Om(t){t.preventDefault()}import{c as al}from"react/compiler-runtime";import{jsx as $e}from"react/jsx-runtime";import Wo,{useEffect as sl}from"react";import{mergeRegister as Um}from"@lexical/utils";import{useTranslation as Wm}from"@payloadcms/ui";import{$getSelection as Vm}from"lexical";import{jsx as Te,jsxs as rl}from"react/jsx-runtime";import{Button as $m}from"@payloadcms/ui";import{$addUpdateTag as Pm}from"lexical";import Ht,{useCallback as Bm,useEffect as at,useMemo as Hm,useRef as Uo,useState as jt}from"react";import{createPortal as jm}from"react-dom";var Go="toolbar-popup__dropdown-item",nl=Ht.createContext(null);function il({active:t,children:e,editor:o,enabled:r,Icon:n,item:i,tooltip:l}){let[s,a]=jt(Go);at(()=>{a([Go,r===!1?"disabled":"",t?"active":"",i?.key?`${Go}-${i.key}`:""].filter(Boolean).join(" "))},[r,t,s,i.key]);let d=Uo(null),c=Ht.useContext(nl);if(c===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:u}=c;return at(()=>{d?.current!=null&&u(d)},[d,u]),Te($m,{"aria-label":l,buttonStyle:"none",className:s,disabled:r===!1,icon:n,iconPosition:"left",iconStyle:"none",onClick:()=>{r!==!1&&o.focus(()=>{o.update(()=>{Pm("toolbar")}),i.onSelect?.({editor:o,isActive:t})})},onMouseDown:m=>{m.preventDefault()},ref:d,tooltip:l,type:"button",children:e})}function Gm({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:r}){let[n,i]=jt(),[l,s]=jt(),a=Bm(u=>{i(m=>m!=null?[...m,u]:[u])},[i]),d=u=>{if(n==null)return;let{key:m}=u;["ArrowDown","ArrowUp","Escape","Tab"].includes(m)&&u.preventDefault(),m==="Escape"||m==="Tab"?r():m==="ArrowUp"?s(p=>{if(p==null)return n[0];let f=n.indexOf(p)-1;return n[f===-1?n.length-1:f]}):m==="ArrowDown"&&s(p=>p==null?n[0]:n[n.indexOf(p)+1])},c=Hm(()=>({registerItem:a}),[a]);return at(()=>{n!=null&&l==null&&s(n[0]),l!=null&&l?.current!=null&&l.current.focus()},[n,l]),Te(nl.Provider,{value:c,children:Te("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:d,ref:e,children:t})})}function ll({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:r=!1,Icon:n,itemsContainerClassNames:i,label:l,stopCloseOnClickSelf:s}){let a=Uo(null),d=Uo(null),[c,u]=jt(!1),m=()=>{u(!1),d?.current!=null&&d.current.focus()};at(()=>{let f=d.current,h=a.current;if(c&&f!==null&&h!==null){let{left:C,top:w}=f.getBoundingClientRect(),v=window.scrollY||document.documentElement.scrollTop;h.style.top=`${w+v+f.offsetHeight+5}px`,h.style.left=`${Math.min(C-5,window.innerWidth-h.offsetWidth-20)}px`}},[a,d,c]),at(()=>{let f=d.current;if(f!==null&&c){let h=C=>{let{target:w}=C;s!=null&&a.current!=null&&a.current.contains(w)||f.contains(w)||u(!1)};return document.addEventListener("click",h),()=>{document.removeEventListener("click",h)}}},[a,d,c,s]);let p=jm(Te(Gm,{dropDownRef:a,itemsContainerClassNames:i,onClose:m,children:o}),document.body);return rl(Ht.Fragment,{children:[rl("button",{"aria-label":t,className:e+(c?" active":""),disabled:r,onClick:f=>{f.preventDefault(),u(!c)},onMouseDown:f=>{f.preventDefault()},ref:d,type:"button",children:[n&&Te(n,{}),l&&Te("span",{className:"toolbar-popup__dropdown-label",children:l}),Te("i",{className:"toolbar-popup__dropdown-caret"})]}),c&&Te(Ht.Fragment,{children:p})]})}var Vo="toolbar-popup__dropdown",Km=t=>{let e=al(18),{active:o,anchorElem:r,editor:n,enabled:i,item:l}=t,{i18n:s}=Wm(),{fieldProps:a}=B(),{featureClientSchemaMap:d,schemaPath:c}=a;if(l.Component){let f;return e[0]!==l||e[1]!==o||e[2]!==r||e[3]!==n||e[4]!==i?(f=l?.Component&&$e(l.Component,{active:o,anchorElem:r,editor:n,enabled:i,item:l},l.key),e[0]=l,e[1]=o,e[2]=r,e[3]=n,e[4]=i,e[5]=f):f=e[5],f}let u=l.key,m;if(l.label){let f;e[6]!==l||e[7]!==d||e[8]!==s||e[9]!==c?(f=typeof l.label=="function"?l.label({featureClientSchemaMap:d,i18n:s,schemaPath:c}):l.label,e[6]=l,e[7]=d,e[8]=s,e[9]=c,e[10]=f):f=e[10],u=f}u.length>25?m=u.substring(0,25)+"...":m=u;let p;return e[11]!==l||e[12]!==m||e[13]!==o||e[14]!==n||e[15]!==i||e[16]!==u?(p=$e(il,{active:o,editor:n,enabled:i,Icon:l?.ChildComponent?$e(l.ChildComponent,{}):void 0,item:l,tooltip:u,children:$e("span",{className:"text",children:m})},l.key),e[11]=l,e[12]=m,e[13]=o,e[14]=n,e[15]=i,e[16]=u,e[17]=p):p=e[17],p},Se=t=>{let e=al(36),{anchorElem:o,classNames:r,editor:n,group:i,Icon:l,itemsContainerClassNames:s,label:a,maxActiveItems:d,onActiveChange:c}=t,u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=[],e[0]=u):u=e[0];let[m,p]=Wo.useState(u),f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f=[],e[1]=f):f=e[1];let[h,C]=Wo.useState(f),[w,v]=Wo.useState(!0),D=B(),{items:x,key:E}=i,g;e[2]!==n||e[3]!==x||e[4]!==d||e[5]!==D||e[6]!==i||e[7]!==c?(g=()=>{n.getEditorState().read(()=>{let $=Vm();if(!$)return;let W=[],J=[],U=[];for(let H of x)H.isActive&&(!d||W.length<d)&&H.isActive({editor:n,editorConfigContext:D,selection:$})&&(W.push(H.key),J.push(H)),H.isEnabled?H.isEnabled({editor:n,editorConfigContext:D,selection:$})&&U.push(H.key):U.push(H.key);i.isEnabled&&v(i.isEnabled({editor:n,editorConfigContext:D,selection:$})),p(W),C(U),c&&c({activeItems:J})})},e[2]=n,e[3]=x,e[4]=d,e[5]=D,e[6]=i,e[7]=c,e[8]=g):g=e[8];let _=g,N,k;e[9]!==_?(N=()=>{_()},k=[_],e[9]=_,e[10]=N,e[11]=k):(N=e[10],k=e[11]),sl(N,k);let R,S;e[12]!==n||e[13]!==_?(R=()=>Um(n.registerUpdateListener(()=>{_()})),S=[n,_],e[12]=n,e[13]=_,e[14]=R,e[15]=S):(R=e[14],S=e[15]),sl(R,S);let b=`${E} dropdown`,T=`${Vo}-${E}`,I;e[16]!==r?(I=r||[],e[16]=r,e[17]=I):I=e[17];let L;e[18]!==T||e[19]!==I?(L=[Vo,T,...I].filter(Boolean),e[18]=T,e[19]=I,e[20]=L):L=e[20];let A=L.join(" "),M=!w,O;e[21]!==s?(O=s||[],e[21]=s,e[22]=O):O=e[22];let G;return e[23]!==O||e[24]!==x||e[25]!==m||e[26]!==o||e[27]!==n||e[28]!==h||e[29]!==b||e[30]!==A||e[31]!==M||e[32]!==l||e[33]!==a||e[34]!==E?(G=$e(ll,{buttonAriaLabel:b,buttonClassName:A,disabled:M,Icon:l,itemsContainerClassNames:[`${Vo}-items`,...O],label:a,children:x.length?x.map($=>$e(Km,{active:m.includes($.key),anchorElem:o,editor:n,enabled:h.includes($.key),item:$},$.key)):null},E),e[23]=O,e[24]=x,e[25]=m,e[26]=o,e[27]=n,e[28]=h,e[29]=b,e[30]=A,e[31]=M,e[32]=l,e[33]=a,e[34]=E,e[35]=G):G=e[35],G};function Qm({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&ne(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?ne(st,{editor:e,item:o,children:ne(o.ChildComponent,{})},o.key):null}function ep(t){let e=cl(18),{anchorElem:o,editor:r,editorConfig:n,group:i,index:l}=t,{i18n:s}=Jm(),{fieldProps:a}=B(),{featureClientSchemaMap:d,schemaPath:c}=a,[u,m]=ge.useState(void 0),[p,f]=ge.useState(void 0),h,C;e[0]!==i?(h=()=>{i?.type==="dropdown"&&i.items.length&&i.ChildComponent?f(()=>i.ChildComponent):f(void 0)},C=[i],e[0]=i,e[1]=h,e[2]=C):(h=e[1],C=e[2]),ge.useEffect(h,C);let w;e[3]!==i||e[4]!==d||e[5]!==s||e[6]!==c?(w=E=>{let{activeItems:g}=E;if(!g.length){i?.type==="dropdown"&&i.items.length&&i.ChildComponent?(f(()=>i.ChildComponent),m(void 0)):(f(void 0),m(void 0));return}let _=g[0],N=_.key;_.label&&(N=typeof _.label=="function"?_.label({featureClientSchemaMap:d,i18n:s,schemaPath:c}):_.label),N.length>25&&(N=N.substring(0,25)+"..."),g.length===1?(m(N),f(()=>_.ChildComponent)):(m(s.t("lexical:general:toolbarItemsActive",{count:g.length})),i?.type==="dropdown"&&i.items.length&&i.ChildComponent?f(()=>i.ChildComponent):f(void 0))},e[3]=i,e[4]=d,e[5]=s,e[6]=c,e[7]=w):w=e[7];let v=w,D=`fixed-toolbar__group fixed-toolbar__group-${i.key}`,x;return e[8]!==i||e[9]!==p||e[10]!==o||e[11]!==r||e[12]!==u||e[13]!==v||e[14]!==n.features.toolbarFixed||e[15]!==l||e[16]!==D?(x=zm("div",{className:D,children:[i.type==="dropdown"&&i.items.length?p?ne(Se,{anchorElem:o,editor:r,group:i,Icon:p,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:u,maxActiveItems:i.maxActiveItems??1,onActiveChange:v}):ne(Se,{anchorElem:o,editor:r,group:i,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:u,maxActiveItems:i.maxActiveItems??1,onActiveChange:v}):null,i.type==="buttons"&&i.items.length?i.items.map(E=>ne(Qm,{anchorElem:o,editor:r,item:E},E.key)):null,l<n.features.toolbarFixed?.groups.length-1&&ne("div",{className:"divider"})]},i.key),e[8]=i,e[9]=p,e[10]=o,e[11]=r,e[12]=u,e[13]=v,e[14]=n.features.toolbarFixed,e[15]=l,e[16]=D,e[17]=x):x=e[17],x}function tp({anchorElem:t,clientProps:e,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let i=ge.useRef(null),{y:l}=Xm(),s=qm(()=>{if(!n||e?.disableIfParentHasFixedToolbar)return null;let d=n.editorContainerRef.current.previousElementSibling;for(;d;){if(d.classList.contains("fixed-toolbar"))return d;d=d.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,n]);return Ym(()=>{if(!s)return;let a=i.current;if(!a)return;let d=a.getBoundingClientRect(),c=s.getBoundingClientRect();if(!(d.bottom<c.top||d.top>c.bottom))a.classList.remove("fixed-toolbar"),a.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),s.classList.remove("fixed-toolbar"),s.classList.add("fixed-toolbar","fixed-toolbar--hide");else{if(!a.classList.contains("fixed-toolbar--overlapping"))return;a.classList.remove("fixed-toolbar--overlapping"),a.classList.add("fixed-toolbar"),s.classList.remove("fixed-toolbar--hide"),s.classList.add("fixed-toolbar")}},50,[i,s,l]),ne("div",{className:"fixed-toolbar",onFocus:a=>{a.stopPropagation()},ref:i,children:o.isEditable()&&ne(ge.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((a,d)=>ne(ep,{anchorElem:t,editor:o,editorConfig:r,group:a,index:d},a.key))})})}var ul=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return ul(t.parentEditor)}return!1},dl=t=>{let e=cl(6),{clientProps:o}=t,[r]=Zm(),n=B(),{editorConfig:i}=n,l=o.applyToFocusedEditor&&n.focusedEditor?.editor||r,s=o.applyToFocusedEditor&&n.focusedEditor?.editorConfig||i,a,d;if(e[0]!==n||e[1]!==o?.disableIfParentHasFixedToolbar||e[2]!==s||e[3]!==l){d=Symbol.for("react.early_return_sentinel");e:{let c=ul(n);if(o?.disableIfParentHasFixedToolbar&&c){d=null;break e}if(!s?.features?.toolbarFixed?.groups?.length){d=null;break e}a=ne(tp,{anchorElem:document.body,editor:l,editorConfig:s,parentWithFixedToolbar:c})}e[0]=n,e[1]=o?.disableIfParentHasFixedToolbar,e[2]=s,e[3]=l,e[4]=a,e[5]=d}else a=e[4],d=e[5];return d!==Symbol.for("react.early_return_sentinel")?d:a};var op=y({plugins:[{Component:dl,position:"aboveContainer"}]});import{c as fl}from"react/compiler-runtime";import{jsx as se,jsxs as hl}from"react/jsx-runtime";import{useLexicalComposerContext as rp}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as gl}from"@lexical/utils";import{$getSelection as Cl,$isRangeSelection as ml,$isTextNode as np,COMMAND_PRIORITY_LOW as ip,SELECTION_CHANGE_COMMAND as lp}from"lexical";import{useCallback as Ut,useEffect as ct,useRef as pl,useState as sp}from"react";import*as Wt from"react";import{createPortal as ap}from"react-dom";function Ko(t,e){let o=t.getRangeAt(0),r;if(t.anchorNode===e){let n=e;for(;n.firstElementChild!=null;)n=n.firstElementChild;r=n.getBoundingClientRect()}else r=o.getBoundingClientRect();return r}function Gt(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:r=0,floatingElem:n,horizontalOffset:i=32,horizontalPosition:l="left",specialHandlingForCaret:s=!1,targetRect:a,verticalGap:d=10}=t,c=o.parentElement;if(a===null||c==null){n.style.opacity="0",n.style.transform="translate(-10000px, -10000px)";return}let u=n.getBoundingClientRect(),m=o.getBoundingClientRect(),p=c.getBoundingClientRect(),f=a.top-u.height-d,h=a.left-i;l==="center"&&(h=a.left+a.width/2-u.width/2);let C=0;return!e&&f<p.top&&!s&&(C=u.height+a.height+d*2,f+=C),l==="center"?h+u.width>p.right?h=p.right-u.width-i:h<p.left&&(h=p.left+i):h+u.width>p.right&&(h=p.right-u.width-i),h-=m.left,n.style.opacity="1",s&&r!==0?(f-=m.bottom-r+u.height-3,n.style.transform=`translate(${h}px, ${f}px) rotate(180deg)`):(f-=m.top,n.style.transform=`translate(${h}px, ${f}px)`),C}function cp({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&se(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?se(st,{editor:e,item:o,children:se(o.ChildComponent,{})},o.key):null}function up(t){let e=fl(14),{anchorElem:o,editor:r,group:n,index:i}=t,{editorConfig:l}=B(),[s,a]=Wt.useState(),d,c;e[0]!==n?(d=()=>{n?.type==="dropdown"&&n.items.length&&n.ChildComponent?a(()=>n.ChildComponent):a(void 0)},c=[n],e[0]=n,e[1]=d,e[2]=c):(d=e[1],c=e[2]),Wt.useEffect(d,c);let u;e[3]!==n?(u=h=>{let{activeItems:C}=h;if(!C.length){n?.type==="dropdown"&&n.items.length&&n.ChildComponent?a(()=>n.ChildComponent):a(void 0);return}let w=C[0];a(()=>w.ChildComponent)},e[3]=n,e[4]=u):u=e[4];let m=u,p=`inline-toolbar-popup__group inline-toolbar-popup__group-${n.key}`,f;return e[5]!==n||e[6]!==s||e[7]!==o||e[8]!==r||e[9]!==m||e[10]!==l.features.toolbarInline||e[11]!==i||e[12]!==p?(f=hl("div",{className:p,children:[n.type==="dropdown"&&n.items.length?s?se(Se,{anchorElem:o,editor:r,group:n,Icon:s,maxActiveItems:n.maxActiveItems??1,onActiveChange:m}):se(Se,{anchorElem:o,editor:r,group:n,maxActiveItems:n.maxActiveItems??1,onActiveChange:m}):null,n.type==="buttons"&&n.items.length?n.items.map(h=>se(cp,{anchorElem:o,editor:r,item:h},h.key)):null,i<l.features.toolbarInline?.groups.length-1&&se("div",{className:"divider"})]},n.key),e[5]=n,e[6]=s,e[7]=o,e[8]=r,e[9]=m,e[10]=l.features.toolbarInline,e[11]=i,e[12]=p,e[13]=f):f=e[13],f}function dp({anchorElem:t,editor:e}){let o=pl(null),r=pl(null),{editorConfig:n}=B(),i=Ut(()=>{if(o?.current){let d=o.current.style.opacity==="0",c=o.current.style.pointerEvents==="none";d||(o.current.style.opacity="0"),c||(o.current.style.pointerEvents="none")}},[o]),l=Ut(d=>{if(o?.current&&(d.buttons===1||d.buttons===3)){let c=o.current.style.opacity==="0",u=o.current.style.pointerEvents==="none";if(!c||!u){let m=d.clientX,p=d.clientY,f=document.elementFromPoint(m,p);o.current.contains(f)||i()}}},[i]),s=Ut(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);ct(()=>(document.addEventListener("mousemove",l),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",s)}),[o,l,s]);let a=Ut(()=>{let d=Cl(),c=window.getSelection();if(o.current===null)return;let u=t.querySelector(":scope > .link-editor"),m=u!==null&&"style"in u&&u?.style?.opacity==="1",p=e.getRootElement();if(d!==null&&c!==null&&!c.isCollapsed&&p!==null&&p.contains(c.anchorNode)){let f=Ko(c,p),h=Gt({alwaysDisplayOnTop:m,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});r.current&&Gt({anchorElem:o.current,anchorFlippedOffset:h,floatingElem:r.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else i()},[e,i,t]);return ct(()=>{let d=t.parentElement,c=()=>{e.getEditorState().read(()=>{a()})};return window.addEventListener("resize",c),d&&d.addEventListener("scroll",c),()=>{window.removeEventListener("resize",c),d&&d.removeEventListener("scroll",c)}},[e,a,t]),ct(()=>(e.getEditorState().read(()=>{a()}),gl(e.registerUpdateListener(({editorState:d})=>{d.read(()=>{a()})}),e.registerCommand(lp,()=>(a(),!1),ip))),[e,a]),hl("div",{className:"inline-toolbar-popup",ref:o,children:[se("div",{className:"caret",ref:r}),n?.features&&n.features?.toolbarInline?.groups.map((d,c)=>se(up,{anchorElem:t,editor:e,group:d,index:c},d.key))]})}function mp(t,e){let o=fl(12),[r,n]=sp(!1),i;o[0]!==t?(i=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let m=Cl(),p=window.getSelection(),f=t.getRootElement();if(p!==null&&(!ml(m)||f===null||!f.contains(p.anchorNode))){n(!1);return}if(!ml(m))return;if(m.getTextContent()!==""){let C=m.getNodes(),w=!1;for(let v of C)if(np(v)){n(!0),w=!0;break}w||n(!1)}else n(!1);let h=m.getTextContent().replace(/\n/g,"");if(!m.isCollapsed()&&h===""){n(!1);return}})},o[0]=t,o[1]=i):i=o[1];let l=i,s,a;o[2]!==l?(s=()=>(document.addEventListener("selectionchange",l),document.addEventListener("mouseup",l),()=>{document.removeEventListener("selectionchange",l),document.removeEventListener("mouseup",l)}),a=[l],o[2]=l,o[3]=s,o[4]=a):(s=o[3],a=o[4]),ct(s,a);let d,c;if(o[5]!==t||o[6]!==l?(d=()=>gl(t.registerUpdateListener(()=>{l()}),t.registerRootListener(()=>{t.getRootElement()===null&&n(!1)})),c=[t,l],o[5]=t,o[6]=l,o[7]=d,o[8]=c):(d=o[7],c=o[8]),ct(d,c),!r||!t.isEditable())return null;let u;return o[9]!==e||o[10]!==t?(u=ap(se(dp,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=u):u=o[11],u}var xl=t=>{let{anchorElem:e}=t,[o]=rp();return mp(o,e)};var pp=y({plugins:[{Component:xl,position:"floatingAnchorElem"}]});import{TableCellNode as e1,TableNode as t1,TableRowNode as o1}from"@lexical/table";import{jsx as bl}from"react/jsx-runtime";import"react";var zo=()=>bl("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:bl("path",{clipRule:"evenodd",d:"M5.33333 4.5C4.8731 4.5 4.5 4.8731 4.5 5.33333V7.5H9.5V4.5H5.33333ZM5.33333 3.5C4.32081 3.5 3.5 4.32081 3.5 5.33333V14.6667C3.5 15.6792 4.32081 16.5 5.33333 16.5H14.6667C15.6792 16.5 16.5 15.6792 16.5 14.6667V5.33333C16.5 4.32081 15.6792 3.5 14.6667 3.5H5.33333ZM10.5 4.5V7.5H15.5V5.33333C15.5 4.8731 15.1269 4.5 14.6667 4.5H10.5ZM15.5 8.5H10.5V11.5H15.5V8.5ZM15.5 12.5H10.5V15.5H14.6667C15.1269 15.5 15.5 15.1269 15.5 14.6667V12.5ZM9.5 15.5V12.5H4.5V14.6667C4.5 15.1269 4.8731 15.5 5.33333 15.5H9.5ZM4.5 11.5H9.5V8.5H4.5V11.5Z",fill:"currentColor",fillRule:"evenodd"})});import{$createTableCellNode as Ep,$createTableNode as wp,$createTableRowNode as kp,$isTableCellNode as Rl,$isTableNode as Zo,$isTableRowNode as Xo,TableCellHeaderStates as Vt,TableCellNode as Np,TableNode as Lp,TableRowNode as Rp}from"@lexical/table";import{$isParagraphNode as Sp,$isTextNode as Ip}from"lexical";var _l=/^[\t ]*$/,fp=/^(\s*)(\d+)\.\s/,hp=/^(\s*)[-*+]\s/,gp=/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,Tl=/^(#{1,6})\s/,Cp=/^>\s/,El=/^[ \t]*```(\w+)?/,wl=/[ \t]*```$/,xp=/^[ \t]*```[^`]+(?:(?:`{1,2}|`{4,})[^`]+)*```(?:[^`]|$)/,bp=/^\|(.+)\|\s?$/,_p=/^(\| ?:?-*:? ?)+\|\s?$/,kl=/^[ \t]*<[a-z_][\w-]*(?:\s[^<>]*)?\/?>/i,Nl=/^[ \t]*<\/[a-z_][\w-]*\s*>/i;function Tp(t,e=!1){let o=t.split(`
|
|
36
|
-
`),r=!1,n=[];for(let i=0;i<o.length;i++){let l=o[i],s=n[n.length-1];if(
|
|
37
|
-
`)}function
|
|
38
|
-
`)},regExp:
|
|
39
|
-
`);let o=Ep(Vt.NO_STATUS);return Ll(t,e,o),o},Sl=(t,e)=>{let o=t.match(Il);return!o||!o[1]?null:o[1].split("|").map(r=>vl(r,e))};import{c as Dp}from"react/compiler-runtime";import{jsx as P,jsxs as Ce}from"react/jsx-runtime";import{useLexicalComposerContext as Fl}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Ap}from"@lexical/react/useLexicalEditable";import{$deleteTableColumn__EXPERIMENTAL as Fp,$deleteTableRow__EXPERIMENTAL as Op,$getNodeTriplet as $p,$getTableCellNodeFromLexicalNode as Pp,$getTableColumnIndexFromTableCellNode as Bp,$getTableNodeFromLexicalNodeOrThrow as ut,$getTableRowIndexFromTableCellNode as Hp,$insertTableColumn__EXPERIMENTAL as jp,$insertTableRow__EXPERIMENTAL as Gp,$isTableCellNode as Kt,$isTableRowNode as Dl,$isTableSelection as Zt,$unmergeCell as Up,getTableObserverFromTableElement as Wp,TableCellHeaderStates as Ee,TableCellNode as Vp}from"@lexical/table";import{useScrollInfo as Kp}from"@payloadcms/ui";import{$createParagraphNode as zp,$getRoot as Zp,$getSelection as Xt,$isElementNode as Xp,$isParagraphNode as Ol,$isRangeSelection as qo,$isTextNode as Yp}from"lexical";import*as Qo from"react";import{useCallback as ae,useEffect as Ie,useRef as zt,useState as Pe}from"react";import{createPortal as $l}from"react-dom";import{jsx as Yo,jsxs as Mp}from"react/jsx-runtime";import"react";var Ml=()=>Mp("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[Yo("path",{d:"M5 11C5.55228 11 6 10.5523 6 10C6 9.44772 5.55228 9 5 9C4.44772 9 4 9.44772 4 10C4 10.5523 4.44772 11 5 11Z",fill:"currentColor"}),Yo("path",{d:"M10 11C10.5523 11 11 10.5523 11 10C11 9.44772 10.5523 9 10 9C9.44772 9 9 9.44772 9 10C9 10.5523 9.44772 11 10 11Z",fill:"currentColor"}),Yo("path",{d:"M15 11C15.5523 11 16 10.5523 16 10C16 9.44772 15.5523 9 15 9C14.4477 9 14 9.44772 14 10C14 10.5523 14.4477 11 15 11Z",fill:"currentColor"})]});function Jo(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function Jp(){let t=Xt();if(qo(t)&&!t.isCollapsed()||Zt(t)&&!t.anchor.is(t.focus)||!qo(t)&&!Zt(t))return!1;let[e]=$p(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function Al(t){if(t.getChildrenSize()!==1)return!1;let e=t.getFirstChildOrThrow();return!(!Ol(e)||!e.isEmpty())}function qp(t){let e=t.getLastDescendant();Yp(e)?e.select():Xp(e)?e.selectEnd():e!==null&&e.selectNext()}function Qp({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[i]=Fl(),l=zt(null),[s,a]=Pe(n),[d,c]=Pe({columns:1,rows:1}),[u,m]=Pe(!1),[p,f]=Pe(!1),{y:h}=Kp();Ie(()=>i.registerMutationListener(Vp,b=>{b.get(s.getKey())==="updated"&&i.getEditorState().read(()=>{a(s.getLatest())})},{skipInitialization:!0}),[i,s]),Ie(()=>{i.getEditorState().read(()=>{let b=Xt();if(Zt(b)){let T=Jo(b);c(Jo(b)),m(T.columns>1||T.rows>1)}f(Jp())})},[i]),Ie(()=>{let b=e.current,T=l.current,I=i.getRootElement();if(b!=null&&T!=null&&I!=null){let L=I.getBoundingClientRect(),A=b.getBoundingClientRect();T.style.opacity="1";let M=T.getBoundingClientRect(),O=5,G=A.right+O;if(G+M.width>window.innerWidth||G+M.width>L.right){let W=A.left-M.width-O;G=(W<0?O:W)+window.pageXOffset}T.style.left=`${G+window.pageXOffset}px`;let $=A.top;if($+M.height>window.innerHeight){let W=A.bottom-M.height;$=(W<0?O:W)+window.pageYOffset}T.style.top=`${$}px`}},[e,l,i,h]),Ie(()=>{function b(T){l.current!=null&&e.current!=null&&!l.current.contains(T.target)&&!e.current.contains(T.target)&&r(!1)}return window.addEventListener("click",b),()=>window.removeEventListener("click",b)},[r,e]);let C=ae(()=>{i.update(()=>{if(s.isAttached()){let T=ut(s),I=i.getElementByKey(T.getKey());if(!I)throw new Error("Expected to find tableElement in DOM");let L=Wp(I);L!==null&&L.clearHighlight(),T.markDirty(),a(s.getLatest())}Zp().selectStart()})},[i,s]),w=()=>{i.update(()=>{let b=Xt();if(Zt(b)){let{columns:T,rows:I}=Jo(b),L=b.getNodes(),A=null;for(let M=0;M<L.length;M++){let O=L[M];if(Kt(O))if(A===null){O.setColSpan(T).setRowSpan(I),A=O;let G=Al(O),$;G&&Ol($=O.getFirstChild())&&$.remove()}else Kt(A)&&(Al(O)||A.append(...O.getChildren()),O.remove())}A!==null&&(A.getChildrenSize()===0&&A.append(zp()),qp(A)),o()}})},v=()=>{i.update(()=>{Up()})},D=ae(b=>{i.update(()=>{Gp(b),o()})},[i,o]),x=ae(b=>{i.update(()=>{for(let T=0;T<d.columns;T++)jp(b);o()})},[i,o,d.columns]),E=ae(()=>{i.update(()=>{Op(),o()})},[i,o]),g=ae(()=>{i.update(()=>{ut(s).remove(),C(),o()})},[i,s,C,o]),_=ae(()=>{i.update(()=>{Fp(),o()})},[i,o]),N=ae(()=>{i.update(()=>{let b=ut(s),T=Hp(s),I=b.getChildren();if(T>=I.length||T<0)throw new Error("Expected table cell to be inside of table row.");let L=I[T];if(!Dl(L))throw new Error("Expected table row");let A=s.getHeaderStyles()^Ee.ROW;L.getChildren().forEach(M=>{if(!Kt(M))throw new Error("Expected table cell");M.setHeaderStyles(A,Ee.ROW)}),C(),o()})},[i,s,C,o]),k=ae(()=>{i.update(()=>{let b=ut(s),T=Bp(s),I=b.getChildren(),L=Math.max(...I.map(M=>M.getChildren().length));if(T>=L||T<0)throw new Error("Expected table cell to be inside of table row.");let A=s.getHeaderStyles()^Ee.COLUMN;for(let M=0;M<I.length;M++){let O=I[M];if(!Dl(O))throw new Error("Expected table row");let G=O.getChildren();if(T>=G.length)continue;let $=G[T];if(!Kt($))throw new Error("Expected table cell");$.setHeaderStyles(A,Ee.COLUMN)}C(),o()})},[i,s,C,o]),R=ae(()=>{i.update(()=>{if(s.isAttached()){let b=ut(s);b&&b.setRowStriping(!b.getRowStriping())}C(),o()})},[i,s,C,o]),S=null;return t&&(u?S=P("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>w(),type:"button",children:"Merge cells"}):p&&(S=P("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>v(),type:"button",children:"Unmerge cells"}))),$l(Ce("div",{className:"table-action-menu-dropdown",onClick:b=>{b.stopPropagation()},ref:l,children:[S?Ce(Qo.Fragment,{children:[S,P("hr",{})]}):null,P("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>R(),type:"button",children:P("span",{className:"text",children:"Toggle Row Striping"})}),P("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>D(!1),type:"button",children:Ce("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:()=>D(!0),type:"button",children:Ce("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:()=>x(!1),type:"button",children:Ce("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:()=>x(!0),type:"button",children:Ce("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:()=>E(),type:"button",children:P("span",{className:"text",children:"Delete row"})}),P("button",{className:"item","data-test-id":"table-delete",onClick:()=>g(),type:"button",children:P("span",{className:"text",children:"Delete table"})}),P("hr",{}),P("button",{className:"item",onClick:()=>N(),type:"button",children:Ce("span",{className:"text",children:[(s.__headerState&Ee.ROW)===Ee.ROW?"Remove":"Add"," ","row header"]})}),P("button",{className:"item","data-test-id":"table-column-header",onClick:()=>k(),type:"button",children:Ce("span",{className:"text",children:[(s.__headerState&Ee.COLUMN)===Ee.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function ef({anchorElem:t,cellMerge:e}){let[o]=Fl(),r=zt(null),n=zt(null),[i,l]=Pe(!1),[s,a]=Pe(null),d=ae(()=>{let u=r.current,m=Xt(),p=window.getSelection(),f=document.activeElement;if(m==null||u==null){a(null);return}let h=o.getRootElement();if(qo(m)&&h!==null&&p!==null&&h.contains(p.anchorNode)){let C=Pp(m.anchor.getNode());if(C==null){a(null);return}if(o.getElementByKey(C.getKey())==null){a(null);return}a(C)}else f||a(null)},[o]);Ie(()=>o.registerUpdateListener(()=>{o.getEditorState().read(()=>{d()})})),Ie(()=>{let u=r.current;if(u!=null&&s!=null){let m=o.getElementByKey(s.getKey());if(m!=null){let p=m.getBoundingClientRect(),f=u.getBoundingClientRect(),h=t.getBoundingClientRect(),C=p.top-h.top+4,w=p.right-f.width-10-h.left;u.style.opacity="1",u.style.transform=`translate(${w}px, ${C}px)`}else u.style.opacity="0",u.style.transform="translate(-10000px, -10000px)"}},[r,s,o,t]);let c=zt(s);return Ie(()=>{c.current!==s&&l(!1),c.current=s},[c,s]),P("div",{className:"table-cell-action-button-container",ref:r,children:s!=null&&Ce(Qo.Fragment,{children:[P("button",{className:"table-cell-action-button",onClick:u=>{u.stopPropagation(),l(!i)},ref:n,type:"button",children:P(Ml,{})}),i&&P(Qp,{cellMerge:e,contextRef:n,onClose:()=>l(!1),setIsMenuOpen:l,tableCellNode:s})]})})}var Pl=t=>{let e=Dp(3),{anchorElem:o}=t,r=Ap(),n;return e[0]!==r||e[1]!==o?(n=$l(r?P(ef,{anchorElem:o??document.body,cellMerge:!0}):null,o??document.body),e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{c as tf}from"react/compiler-runtime";import{jsx as Jt,jsxs as of}from"react/jsx-runtime";import{useLexicalComposerContext as rf}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as nf}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as lf,$getTableNodeFromLexicalNodeOrThrow as er,$getTableRowIndexFromTableCellNode as sf,$isTableCellNode as Bl,$isTableRowNode as af,getDOMCellFromTarget as cf,TableNode as uf}from"@lexical/table";import{calculateZoomLevel as Hl}from"@lexical/utils";import{$getNearestNodeFromDOMNode as tr}from"lexical";import*as Gl from"react";import{useCallback as dt,useEffect as or,useRef as Yt,useState as mt}from"react";import{createPortal as df}from"react-dom";var mf=33,jl=92;function pf({editor:t}){let e=Yt(null),o=Yt(null),r=Yt(null),n=B(),i=Yt(null),[l,s]=mt(null),[a,d]=mt(null),[c,u]=mt(!1),[m,p]=mt(null),f=dt(()=>{d(null),e.current=null,p(null),i.current=null,r.current=null},[]),h=k=>(k.buttons&1)===1;or(()=>t.registerNodeTransform(uf,k=>{if(k.getColWidths())return k;let R=k.getColumnCount(),S=jl;return k.setColWidths(Array(R).fill(S)),k}),[t]),or(()=>{let k=T=>{setTimeout(()=>{let I=T.target;if(m){s({x:T.clientX,y:T.clientY});return}if(u(h(T)),!(o.current&&o.current.contains(I))&&e.current!==I){e.current=I;let L=cf(I);L&&a!==L?t.update(()=>{let A=tr(L.elem);if(!A)throw new Error("TableCellResizer: Table cell node not found.");let M=er(A),O=t.getElementByKey(M.getKey());if(!O)throw new Error("TableCellResizer: Table element not found.");e.current=I,r.current=O.getBoundingClientRect(),d(L)}):L==null&&f()}},0)},R=T=>{setTimeout(()=>{u(!0)},0)},S=T=>{setTimeout(()=>{u(!1)},0)},b=t.registerRootListener((T,I)=>{I?.removeEventListener("mousemove",k),I?.removeEventListener("mousedown",R),I?.removeEventListener("mouseup",S),T?.addEventListener("mousemove",k),T?.addEventListener("mousedown",R),T?.addEventListener("mouseup",S)});return()=>{b()}},[a,m,t,f]);let C=k=>k==="bottom",w=dt(k=>{if(!a)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let R=tr(a.elem);if(!Bl(R))throw new Error("TableCellResizer: Table cell node not found.");let S=er(R),b=sf(R)+R.getRowSpan()-1,T=S.getChildren();if(b>=T.length||b<0)throw new Error("Expected table cell to be inside of table row.");let I=T[b];if(!af(I))throw new Error("Expected table row");let L=I.getHeight();if(L===void 0){let M=I.getChildren();L=Math.min(...M.map(O=>v(O,t)??1/0))}let A=Math.max(L+k,mf);I.setHeight(A)},{tag:"skip-scroll-into-view"})},[a,t]),v=(k,R)=>R.getElementByKey(k.getKey())?.clientHeight,D=(k,R)=>{for(let S=0;S<R.length;S++)for(let b=0;b<R[S].length;b++)if(R[S][b].cell===k)return b},x=dt(k=>{if(!a)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let R=tr(a.elem);if(!Bl(R))throw new Error("TableCellResizer: Table cell node not found.");let S=er(R),[b]=lf(S,null,null),T=D(R,b);if(T===void 0)throw new Error("TableCellResizer: Table column not found.");let I=S.getColWidths();if(!I)return;let L=I[T];if(L===void 0)return;let A=[...I],M=Math.max(L+k,jl);A[T]=M,S.setColWidths(A)},{tag:"skip-scroll-into-view"})},[a,t]),E=dt(k=>{let R=S=>{if(S.preventDefault(),S.stopPropagation(),!a)throw new Error("TableCellResizer: Expected active cell.");if(i.current){let{x:b,y:T}=i.current;if(a===null)return;let I=Hl(S.target);if(C(k)){let L=(S.clientY-T)/I;w(L)}else{let L=(S.clientX-b)/I;x(L)}f(),document.removeEventListener("mouseup",R)}};return R},[a,f,x,w]),g=dt(k=>R=>{if(R.preventDefault(),R.stopPropagation(),!a)throw new Error("TableCellResizer: Expected active cell.");i.current={x:R.clientX,y:R.clientY},s(i.current),p(k),document.addEventListener("mouseup",E(k))},[a,E]),[_,N]=mt({bottom:null,left:null,right:null,top:null});return or(()=>{if(a){let{height:k,left:R,top:S,width:b}=a.elem.getBoundingClientRect(),T=Hl(a.elem),I=10,L={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${I}px`,left:`${window.scrollX+R}px`,top:`${window.scrollY+S+k-I/2}px`,width:`${b}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${k}px`,left:`${window.scrollX+R+b-I/2}px`,top:`${window.scrollY+S}px`,width:`${I}px`}},A=r.current;m&&l&&A&&(C(m)?(L[m].left=`${window.scrollX+A.left}px`,L[m].top=`${window.scrollY+l.y/T}px`,L[m].height="3px",L[m].width=`${A.width}px`):(L[m].top=`${window.scrollY+A.top}px`,L[m].left=`${window.scrollX+l.x/T}px`,L[m].width="3px",L[m].height=`${A.height}px`),L[m].backgroundColor="#adf"),N(L)}else N({bottom:null,left:null,right:null,top:null})},[a,m,l]),Jt("div",{ref:o,children:a!=null&&!c&&of(Gl.Fragment,{children:[Jt("div",{className:`${n.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:g("right"),style:_.right||void 0}),Jt("div",{className:`${n.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:g("bottom"),style:_.bottom||void 0})]})})}var Ul=()=>{let t=tf(3),[e]=rf(),o=nf(),r,n;return t[0]!==o||t[1]!==e?(n=o?df(Jt(pf,{editor:e}),document.body):null,t[0]=o,t[1]=e,t[2]=n):n=t[2],r=n,r};import{c as Tf}from"react/compiler-runtime";import{jsx as rr,jsxs as Ef,Fragment as wf}from"react/jsx-runtime";import{useLexicalComposerContext as Jl}from"@lexical/react/LexicalComposerContext";import{$getTableColumnIndexFromTableCellNode as kf,$getTableRowIndexFromTableCellNode as Nf,$insertTableColumn__EXPERIMENTAL as Lf,$insertTableRow__EXPERIMENTAL as Rf,$isTableCellNode as Sf,$isTableNode as Kl,TableNode as If}from"@lexical/table";import{$findMatchingParent as yf,mergeRegister as vf}from"@lexical/utils";import{$getNearestNodeFromDOMNode as zl}from"lexical";import{useEffect as Zl,useMemo as Mf,useRef as Xl,useState as qt}from"react";import"react";import{createPortal as Df}from"react-dom";import{c as xf}from"react/compiler-runtime";import{useEffect as bf,useRef as _f}from"react";var ff="Expected a function",hf=Math.max,gf=Math.min;function Cf(t,e,o){let r,n,i=0,l,s=!1,a=!1,d,c,u,m=!0;if(typeof t!="function")throw new TypeError(ff);e=e||0,typeof o=="object"&&(s=!!o.leading,a="maxWait"in o,d=a?hf(o.maxWait||0,e):d,m="trailing"in o?!!o.trailing:m);function p(g){let _=r,N=l;return r=l=void 0,i=g,c=t.apply(N,_),c}function f(g){return i=g,u=setTimeout(w,e),s?p(g):c}function h(g){let _=g-n,N=g-i,k=e-_;return a?gf(k,d-N):k}function C(g){let _=g-n,N=g-i;return n===void 0||_>=e||_<0||a&&N>=d}function w(){let g=Date.now();if(C(g))return v(g);u=setTimeout(w,h(g))}function v(g){return u=void 0,m&&r?p(g):(r=l=void 0,c)}function D(){u!==void 0&&clearTimeout(u),i=0,r=n=l=u=void 0}function x(){return u===void 0?c:v(Date.now())}function E(){let g=Date.now(),_=C(g);if(r=arguments,l=this,n=g,_){if(u===void 0)return f(n);if(a)return clearTimeout(u),u=setTimeout(w,e),p(n)}return u===void 0&&(u=setTimeout(w,e)),c}return E.cancel=D,E.flush=x,E}var Wl=Cf;function Vl(t,e,o){let r=xf(6),n=_f(null),i,l;r[0]!==t||r[1]!==e||r[2]!==o?(i=()=>(n.current=Wl(t,e,{maxWait:o}),()=>{n.current?.cancel()}),l=[t,e,o],r[0]=t,r[1]=e,r[2]=o,r[3]=i,r[4]=l):(i=r[3],l=r[4]),bf(i,l);let s;return r[5]===Symbol.for("react.memo_cache_sentinel")?(s=(...d)=>{let c=d;n.current&&n.current(...c)},r[5]=s):s=r[5],s}var Yl=20;function Af({anchorElem:t}){let[e]=Jl(),o=B(),[r,n]=qt(!1),[i,l]=qt(!1),[s,a]=qt(!1),[d,c]=qt({}),u=Xl(new Set),m=Xl(null),p=Vl(C=>{let{isOutside:w,tableDOMNode:v}=Ff(C,o.editorConfig?.lexical);if(w){n(!1),l(!1);return}if(!v)return;m.current=v;let D=null,x=null,E=null;if(e.update(()=>{let g=zl(v);if(Sf(g)){let _=yf(g,N=>Kl(N));if(!Kl(_))return;if(E=e.getElementByKey(_?.getKey()),E){let N=_.getChildrenSize(),k=_.getChildAtIndex(0)?.getChildrenSize(),R=Nf(g),S=kf(g);R===N-1?D=g:S===k-1&&(x=g)}}}),E){let{bottom:g,height:_,left:N,right:k,width:R,y:S}=E.getBoundingClientRect(),{left:b,y:T}=t.getBoundingClientRect();D?(l(!1),n(!0),c({height:Yl,left:N-b,top:g-T+5,width:R})):x&&(l(!0),n(!1),c({height:_,left:k-b+5,top:S-T,width:Yl}))}},50,250),f=Mf(()=>new ResizeObserver(()=>{n(!1),l(!1)}),[]);Zl(()=>{if(s)return document.addEventListener("mousemove",p),()=>{n(!1),l(!1),document.removeEventListener("mousemove",p)}},[s,p]),Zl(()=>vf(e.registerMutationListener(If,C=>{e.getEditorState().read(()=>{for(let[w,v]of C){let D=e.getElementByKey(w);switch(v){case"created":u.current.add(w),a(u.current.size>0),D&&f.observe(D);break;case"destroyed":u.current.delete(w),a(u.current.size>0),f.disconnect(),u.current.forEach(x=>{let E=e.getElementByKey(x);E&&f.observe(E)});break;default:break}}})},{skipInitialization:!1})),[e,f]);let h=C=>{e.update(()=>{m.current&&(zl(m.current)?.selectEnd(),C?(Rf(),n(!1)):(Lf(),l(!1)))})};return e?.isEditable()?Ef(wf,{children:[r&&rr("button",{className:o.editorConfig.lexical.theme.tableAddRows,onClick:()=>h(!0),style:{...d},type:"button"}),i&&rr("button",{className:o.editorConfig.lexical.theme.tableAddColumns,onClick:()=>h(!1),style:{...d},type:"button"})]}):null}function Ff(t,e){let o=t.target;if(o&&o instanceof HTMLElement){let r=o.closest(`td.${e.theme.tableCell}, th.${e.theme.tableCell}`);return{isOutside:!(r||o.closest(`button.${e.theme.tableAddRows}`)||o.closest(`button.${e.theme.tableAddColumns}`)||o.closest(`div.${e.theme.tableCellResizer}`)),tableDOMNode:r}}else return{isOutside:!0,tableDOMNode:null}}function ql(t){let e=Tf(2),{anchorElem:o}=t,r=o===void 0?document.body:o,[n]=Jl();if(!n?.isEditable())return null;let i;return e[0]!==r?(i=Df(rr(Af,{anchorElem:r}),r),e[0]=r,e[1]=i):i=e[1],i}import{c as Of}from"react/compiler-runtime";import{jsx as nr,jsxs as $f}from"react/jsx-runtime";import{useLexicalComposerContext as Pf}from"@lexical/react/LexicalComposerContext";import{TablePlugin as Bf}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as Hf,TableNode as jf}from"@lexical/table";import{mergeRegister as Gf}from"@lexical/utils";import{formatDrawerSlug as Uf,useEditDepth as Wf}from"@payloadcms/ui";import{$getSelection as Vf,$isRangeSelection as Kf,COMMAND_PRIORITY_EDITOR as zf,createCommand as Zf}from"lexical";import{createContext as Xf,useContext as Yf,useEffect as Jf,useMemo as qf,useState as Qf}from"react";import*as Ql from"react";var Qt=Zf("OPEN_EMBED_DRAWER_COMMAND"),es=Xf({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function ts({children:t}){let[e,o]=Qf({cellEditorConfig:null,cellEditorPlugins:null});return nr(es.Provider,{value:qf(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var os=()=>{let t=Of(16),[e]=Pf(),o=Yf(es),r=Wf(),{fieldProps:n,uuid:i}=B(),{schemaPath:l}=n,s="lexical-table-create-"+i,a;t[0]!==s||t[1]!==r?(a=Uf({slug:s,depth:r}),t[0]=s,t[1]=r,t[2]=a):a=t[2];let d=a,{toggleDrawer:c}=ce(d,!0),u;t[3]!==e||t[4]!==c?(u=()=>{if(!e.hasNodes([jf]))throw new Error("TablePlugin: TableNode is not registered on editor");return Gf(e.registerCommand(Qt,()=>{let h;return h=null,e.getEditorState().read(()=>{let C=Vf();Kf(C)&&(h=C)}),h&&c(),!0},zf))},t[3]=e,t[4]=c,t[5]=u):u=t[5];let m;t[6]!==o||t[7]!==e||t[8]!==c?(m=[o,e,c],t[6]=o,t[7]=e,t[8]=c,t[9]=m):m=t[9],Jf(u,m);let p;t[10]!==e?(p=(h,C)=>{!C.columns||!C.rows||e.dispatchCommand(Hf,{columns:String(C.columns),rows:String(C.rows)})},t[10]=e,t[11]=p):p=t[11];let f;return t[12]!==d||t[13]!==p||t[14]!==l?(f=$f(Ql.Fragment,{children:[nr(He,{drawerSlug:d,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:p,schemaPath:l,schemaPathSuffix:"fields"}),nr(Bf,{hasCellBackgroundColor:!1,hasCellMerge:!0})]}),t[12]=d,t[13]=p,t[14]=l,t[15]=f):f=t[15],f};var r1=y({markdownTransformers:[yl],nodes:[t1,e1,o1],plugins:[{Component:os,position:"normal"},{Component:Ul,position:"normal"},{Component:Pl,position:"floatingAnchorElem"},{Component:ql,position:"floatingAnchorElem"}],providers:[ts],slashMenu:{groups:[Z([{Icon:zo,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Qt,{})}}])]},toolbarFixed:{groups:[de([{ChildComponent:zo,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Qt,{})}}])]}});import{$isNodeSelection as L1}from"lexical";import{jsx as ir,jsxs as n1}from"react/jsx-runtime";import"react";var lr=()=>n1("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[ir("path",{d:"M14.6667 4H5.33333C4.59695 4 4 4.59695 4 5.33333V14.6667C4 15.403 4.59695 16 5.33333 16H14.6667C15.403 16 16 15.403 16 14.6667V5.33333C16 4.59695 15.403 4 14.6667 4Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),ir("path",{d:"M7.99984 9.33366C8.73622 9.33366 9.33317 8.73671 9.33317 8.00033C9.33317 7.26395 8.73622 6.66699 7.99984 6.66699C7.26346 6.66699 6.6665 7.26395 6.6665 8.00033C6.6665 8.73671 7.26346 9.33366 7.99984 9.33366Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),ir("path",{d:"M16 11.9995L13.9427 9.94214C13.6926 9.69218 13.3536 9.55176 13 9.55176C12.6464 9.55176 12.3074 9.69218 12.0573 9.94214L6 15.9995",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})]});import{c as p1}from"react/compiler-runtime";import{jsx as f1}from"react/jsx-runtime";import{useLexicalComposerContext as h1}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as g1,mergeRegister as C1}from"@lexical/utils";import{useConfig as x1}from"@payloadcms/ui";import{$getPreviousSelection as b1,$getSelection as _1,$isParagraphNode as ns,$isRangeSelection as T1,COMMAND_PRIORITY_EDITOR as E1,createCommand as w1}from"lexical";import{useEffect as k1}from"react";import{c as i1}from"react/compiler-runtime";import{jsx as sr}from"react/jsx-runtime";import{useLexicalComposerContext as l1}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as s1,COMMAND_PRIORITY_EDITOR as a1}from"lexical";import{useEffect as c1,useState as u1}from"react";var d1=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=s1(o);n&&n.replace(Ke({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(ar,{fields:null,relationTo:e,value:r})},m1=t=>{let e=i1(13),{enabledCollectionSlugs:o}=t,[r]=l1(),[n,i]=u1(null),l;e[0]!==o?(l={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=l):l=e[1];let{closeListDrawer:s,ListDrawer:a,openListDrawer:d}=lt(l),c,u;e[2]!==r||e[3]!==d?(c=()=>r.registerCommand(We,h=>(i(h?.replace?h?.replace.nodeKey:null),d(),!0),a1),u=[r,d],e[2]=r,e[3]=d,e[4]=c,e[5]=u):(c=e[4],u=e[5]),c1(c,u);let m;e[6]!==s||e[7]!==r||e[8]!==n?(m=h=>{let{collectionSlug:C,docID:w}=h;s(),d1({editor:r,relationTo:C,replaceNodeKey:n,value:w})},e[6]=s,e[7]=r,e[8]=n,e[9]=m):m=e[9];let p=m,f;return e[10]!==p||e[11]!==a?(f=sr(a,{onSelect:p}),e[10]=p,e[11]=a,e[12]=f):f=e[12],f},rs=t=>sr(bt,{...t,uploads:!0,children:sr(m1,{...t})});var ar=w1("INSERT_UPLOAD_COMMAND"),is=t=>{let e=p1(5),[o]=h1(),{config:r}=x1(),{collections:n}=r,i,l;e[0]!==o?(i=()=>{if(!o.hasNodes([Ve]))throw new Error("UploadPlugin: UploadNode not registered on editor");return C1(o.registerCommand(ar,a=>(o.update(()=>{let d=_1()||b1();if(T1(d)){let c=Ke({data:{id:a.id,fields:a.fields,relationTo:a.relationTo,value:a.value}});g1(c);let{focus:u}=d,m=u.getNode();ns(m)&&m.getTextContentSize()===0&&m.getParentOrThrow().getChildren().filter(p=>ns(p)).length>1&&m.remove()}}),!0),E1))},l=[o],e[0]=o,e[1]=i,e[2]=l):(i=e[1],l=e[2]),k1(i,l);let s;return e[3]!==n?(s=f1(rs,{enabledCollectionSlugs:n.map(N1)}),e[3]=n,e[4]=s):s=e[4],s};function N1(t){let{slug:e}=t;return e}var R1=y({nodes:[Ve],plugins:[{Component:is,position:"normal"}],slashMenu:{groups:[Z([{Icon:lr,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(We,{replace:!1})}}])]},toolbarFixed:{groups:[de([{ChildComponent:lr,isActive:({selection:t})=>{if(!L1(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return so(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(We,{replace:!1})}}])]}});import{c as S1}from"react/compiler-runtime";import{jsx as ur}from"react/jsx-runtime";import{ShimmerEffect as I1}from"@payloadcms/ui";import{lazy as y1,Suspense as v1,useEffect as M1,useState as D1}from"react";var ls={block:"LexicalEditorTheme__block",blockCursor:"LexicalEditorTheme__blockCursor",characterLimit:"LexicalEditorTheme__characterLimit",code:"LexicalEditorTheme__code",codeHighlight:{atrule:"LexicalEditorTheme__tokenAttr",attr:"LexicalEditorTheme__tokenAttr",boolean:"LexicalEditorTheme__tokenProperty",builtin:"LexicalEditorTheme__tokenSelector",cdata:"LexicalEditorTheme__tokenComment",char:"LexicalEditorTheme__tokenSelector",class:"LexicalEditorTheme__tokenFunction","class-name":"LexicalEditorTheme__tokenFunction",comment:"LexicalEditorTheme__tokenComment",constant:"LexicalEditorTheme__tokenProperty",deleted:"LexicalEditorTheme__tokenProperty",doctype:"LexicalEditorTheme__tokenComment",entity:"LexicalEditorTheme__tokenOperator",function:"LexicalEditorTheme__tokenFunction",important:"LexicalEditorTheme__tokenVariable",inserted:"LexicalEditorTheme__tokenSelector",keyword:"LexicalEditorTheme__tokenAttr",namespace:"LexicalEditorTheme__tokenVariable",number:"LexicalEditorTheme__tokenProperty",operator:"LexicalEditorTheme__tokenOperator",prolog:"LexicalEditorTheme__tokenComment",property:"LexicalEditorTheme__tokenProperty",punctuation:"LexicalEditorTheme__tokenPunctuation",regex:"LexicalEditorTheme__tokenVariable",selector:"LexicalEditorTheme__tokenSelector",string:"LexicalEditorTheme__tokenSelector",symbol:"LexicalEditorTheme__tokenProperty",tag:"LexicalEditorTheme__tokenProperty",url:"LexicalEditorTheme__tokenOperator",variable:"LexicalEditorTheme__tokenVariable"},embedBlock:{base:"LexicalEditorTheme__embedBlock",focus:"LexicalEditorTheme__embedBlockFocus"},hashtag:"LexicalEditorTheme__hashtag",heading:{h1:"LexicalEditorTheme__h1",h2:"LexicalEditorTheme__h2",h3:"LexicalEditorTheme__h3",h4:"LexicalEditorTheme__h4",h5:"LexicalEditorTheme__h5",h6:"LexicalEditorTheme__h6"},hr:"LexicalEditorTheme__hr",indent:"LexicalEditorTheme__indent",inlineImage:"LexicalEditor__inline-image",link:"LexicalEditorTheme__link",list:{checklist:"LexicalEditorTheme__checklist",listitem:"LexicalEditorTheme__listItem",listitemChecked:"LexicalEditorTheme__listItemChecked",listitemUnchecked:"LexicalEditorTheme__listItemUnchecked",nested:{listitem:"LexicalEditorTheme__nestedListItem"},olDepth:["LexicalEditorTheme__ol1","LexicalEditorTheme__ol2","LexicalEditorTheme__ol3","LexicalEditorTheme__ol4","LexicalEditorTheme__ol5"],ul:"LexicalEditorTheme__ul"},ltr:"LexicalEditorTheme__ltr",mark:"LexicalEditorTheme__mark",markOverlap:"LexicalEditorTheme__markOverlap",paragraph:"LexicalEditorTheme__paragraph",quote:"LexicalEditorTheme__quote",relationship:"LexicalEditorTheme__relationship",rtl:"LexicalEditorTheme__rtl",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellEditing:"LexicalEditorTheme__tableCellEditing",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellPrimarySelected:"LexicalEditorTheme__tableCellPrimarySelected",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableCellSortedIndicator:"LexicalEditorTheme__tableCellSortedIndicator",tableResizeRuler:"LexicalEditorTheme__tableCellResizeRuler",tableRowStriping:"LexicalEditorTheme__tableRowStriping",tableSelected:"LexicalEditorTheme__tableSelected",text:{bold:"LexicalEditorTheme__textBold",code:"LexicalEditorTheme__textCode",italic:"LexicalEditorTheme__textItalic",strikethrough:"LexicalEditorTheme__textStrikethrough",subscript:"LexicalEditorTheme__textSubscript",superscript:"LexicalEditorTheme__textSuperscript",underline:"LexicalEditorTheme__textUnderline",underlineStrikethrough:"LexicalEditorTheme__textUnderlineStrikethrough"},upload:"editor-upload"};var eo={namespace:"lexical",theme:ls};function ss({featureClientSchemaMap:t,field:e,schemaPath:o,unSanitizedEditorConfig:r}){for(let s of r.features)if(!s?.clientFeatureProps?.featureKey||s?.clientFeatureProps?.order===void 0||s?.clientFeatureProps?.order===null)throw new Error("A Feature you have installed does not return the client props as clientFeatureProps. Please make sure to always return those props, even if they are null, as other important props like order and featureKey are later on injected.");r.features=r.features.sort((s,a)=>s.clientFeatureProps.order-a.clientFeatureProps.order);let n=new Map;for(let s of r.features)n.set(s.clientFeatureProps.featureKey,s);let i=new Map,l=0;for(let s of r.features){let a=typeof s.feature=="function"?s.feature({featureClientSchemaMap:t,featureProviderMap:n,field:e,resolvedFeatures:i,schemaPath:o,unSanitizedEditorConfig:r}):s.feature;a.key=s.clientFeatureProps.featureKey,a.order=l,i.set(s.clientFeatureProps.featureKey,a),l++}return i}var as=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}};if(!t?.size)return e;t.forEach(o=>{if(o.providers?.length&&(e.providers=e.providers.concat(o.providers)),o.enableFormats?.length&&e.enabledFormats.push(...o.enableFormats),o.nodes?.length)for(let r of o.nodes)e.nodes.push(r);if(o.plugins?.length&&o.plugins.forEach((r,n)=>{e.plugins?.push({clientProps:o.sanitizedClientFeatureProps,Component:r.Component,key:o.key+n,position:r.position})}),o.toolbarInline?.groups?.length)for(let r of o.toolbarInline.groups){let n=e.toolbarInline.groups.find(i=>i.key===r.key);n?e.toolbarInline.groups=e.toolbarInline.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),e.toolbarInline?.groups.push(n)}if(o.toolbarFixed?.groups?.length)for(let r of o.toolbarFixed.groups){let n=e.toolbarFixed.groups.find(i=>i.key===r.key);n?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),e.toolbarFixed?.groups.push(n)}if(o.slashMenu?.groups){o.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(o.slashMenu.dynamicGroups));for(let r of o.slashMenu.groups){let n=e.slashMenu.groups.find(i=>i.key===r.key);n?e.slashMenu.groups=e.slashMenu.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),e.slashMenu.groups.push(n)}}if(o.markdownTransformers?.length)for(let r of o.markdownTransformers)typeof r=="function"?e.markdownTransformers.push(r({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(r);e.enabledFeatures.push(o.key)}),e.toolbarInline.groups.sort((o,r)=>o.order&&r.order?o.order-r.order:o.order?-1:r.order?1:0),e.toolbarFixed.groups.sort((o,r)=>o.order&&r.order?o.order-r.order:o.order?-1:r.order?1:0);for(let o of e.toolbarInline.groups)o.items.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);for(let o of e.toolbarFixed.groups)o.items.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);return e};function cr(t,e,o){return{admin:o,features:as(t),lexical:e,resolvedFeatureMap:t}}var A1=y1(()=>import("./Field-JP7H7AZE.js").then(t=>({default:t.RichText}))),F1=t=>{let e=S1(14),{admin:o,clientFeatures:r,featureClientSchemaMap:n,field:i,lexicalEditorConfig:l,schemaPath:s}=t,a;e[0]!==o?(a=o===void 0?{}:o,e[0]=o,e[1]=a):a=e[1];let d=a,c=l===void 0?eo:l,[u,m]=D1(null),p,f;e[2]!==u||e[3]!==r||e[4]!==c||e[5]!==n||e[6]!==i||e[7]!==s||e[8]!==d?(p=()=>{if(u)return;let C=[];for(let[D,x]of Object.entries(r))x.clientFeatureProvider&&C.push(x.clientFeatureProvider(x.clientFeatureProps));let w=c||eo,v=ss({featureClientSchemaMap:n,field:i,schemaPath:s??i.name,unSanitizedEditorConfig:{features:C,lexical:w}});m(cr(v,w,d))},f=[c,d,u,r,n,i,s],e[2]=u,e[3]=r,e[4]=c,e[5]=n,e[6]=i,e[7]=s,e[8]=d,e[9]=p,e[10]=f):(p=e[9],f=e[10]),M1(p,f);let h;return e[11]!==u||e[12]!==t?(h=ur(v1,{fallback:ur(I1,{height:"35vh"}),children:u&&ur(A1,{...t,editorConfig:u})}),e[11]=u,e[12]=t,e[13]=h):h=e[13],h};function O1(...t){return t.filter(Boolean).join(" ")}var to=new WeakMap;function cs(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function oo(t,e){let o=to.get(t);if(o===void 0){let r=new Set,n=l=>{o!==void 0&&(o.start=cs(l))},i=l=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let a=cs(l);for(let d of r)a!==null&&d([a[0]-s[0],a[1]-s[1]],l)};t.addEventListener("touchstart",n),t.addEventListener("touchend",i),o={handleTouchend:i,handleTouchstart:n,listeners:r,start:null},to.set(t,o)}return o.listeners.add(e),()=>{$1(t,e)}}function $1(t,e){let o=to.get(t);if(o===void 0)return;let{listeners:r}=o;r.delete(e),r.size===0&&(to.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function P1(t,e){return oo(t,(o,r)=>{let[n,i]=o;n<0&&-n>Math.abs(i)&&e(n,r)})}function B1(t,e){return oo(t,(o,r)=>{let[n,i]=o;n>0&&n>Math.abs(i)&&e(n,r)})}function H1(t,e){return oo(t,(o,r)=>{let[n,i]=o;i<0&&-i>Math.abs(n)&&e(n,r)})}function j1(t,e){return oo(t,(o,r)=>{let[n,i]=o;i>0&&i>Math.abs(n)&&e(n,r)})}var F={DOM_ELEMENT_TYPE:1,DOM_TEXT_TYPE:3,NO_DIRTY_NODES:0,HAS_DIRTY_NODES:1,FULL_RECONCILE:2,IS_NORMAL:0,IS_TOKEN:1,IS_SEGMENTED:2,IS_INERT:3,IS_BOLD:1,IS_ITALIC:2,IS_STRIKETHROUGH:4,IS_UNDERLINE:8,IS_CODE:16,IS_SUBSCRIPT:32,IS_SUPERSCRIPT:64,IS_HIGHLIGHT:128,IS_DIRECTIONLESS:1,IS_UNMERGEABLE:2,IS_ALIGN_LEFT:1,IS_ALIGN_CENTER:2,IS_ALIGN_RIGHT:3,IS_ALIGN_JUSTIFY:4,IS_ALIGN_START:5,IS_ALIGN_END:6},G1=F.IS_BOLD|F.IS_ITALIC|F.IS_STRIKETHROUGH|F.IS_UNDERLINE|F.IS_CODE|F.IS_SUBSCRIPT|F.IS_SUPERSCRIPT|F.IS_HIGHLIGHT,U1="\xA0",W1=`
|
|
34
|
+
`},[t,e]),p=Me((x,b)=>{o(_=>{let T=e.length-1,R=e[T];if(R&&R.name===x){if(x==="type")return[...e.slice(0,T),{...R,value:R.value+b}];if(R.value===b)return[...e.slice(0,T),{...R,count:R.count+1}]}return[..._,{name:x,count:1,value:b}]})},[e,o]);dn(()=>{let x=_=>{if(!r)return;let T=_.key;Kc(_)?p("selectAll",""):pn.has(T)?p("press",_.key):[...T].length>1?p("keydown",_.key):p("type",_.key)},b=_=>{if(!r)return;let T=_.key;!pn.has(T)&&[...T].length>1&&p("keyup",_.key)};return t.registerRootListener((_,T)=>{T!==null&&(T.removeEventListener("keydown",x),T.removeEventListener("keyup",b)),_!==null&&(_.addEventListener("keydown",x),_.addEventListener("keyup",b))})},[t,r,p]),dn(()=>{d.current&&d.current.scrollTo(0,d.current.scrollHeight)},[m]),Io(()=>{if(e){let x=m();x!==null&&s(x),d.current&&d.current.scrollTo(0,d.current.scrollHeight)}},[m,e]),Io(()=>t.registerUpdateListener(({dirtyElements:b,dirtyLeaves:_,editorState:T})=>{if(!r)return;let R=T._selection,N=a.current,S=c.current;if(N!==R){if(_.size===0&&b.size===0&&!S){let w=window.getSelection();if(w&&(w.anchorNode==null||w.focusNode==null))return}a.current=R}c.current=!1;let y=m();y!==null&&s(y)}),[t,m,r,p]),Io(()=>r?t.registerUpdateListener(()=>{let b=t.getRootElement();b!==null&&i(b?.innerHTML)}):void 0,[t,r]);let f=Me(x=>{r||(x.update(()=>{let b=Wc();b.clear();let _=jc();b.append(Hc().append(_)),_.select()}),o([])),n(b=>!b)},[r]),h=Me(()=>{if(!r)return;let x=window.getSelection();if(x===null||x.anchorNode==null||x.focusNode==null)return;let{anchorNode:b,anchorOffset:_,focusNode:T,focusOffset:R}=zc(x),N=u().getRootElement(),S;b!==null&&(S=mn(b,N));let y;T!==null&&(y=mn(T,N)),p("snapshot",{anchorNode:b,anchorOffset:_,anchorPath:S,focusNode:T,focusOffset:R,focusPath:y})},[p,r,u]),g=Me(()=>{Gc(m())},[m]),E=Me(()=>{Uc("test.js",m())},[m]);return[De("button",{className:`editor-dev-button ${r?"active":""}`,id:"test-recorder-button",onClick:x=>{f(u()),x.preventDefault()},title:r?"Disable test recorder":"Enable test recorder",type:"button",children:r?"Disable test recorder":"Enable test recorder"}),r?vo("div",{className:"test-recorder-output",children:[vo("div",{className:"test-recorder-toolbar",children:[De("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:x=>{h(),x.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),De("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:x=>{g(),x.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),De("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:x=>{E(),x.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),De("pre",{id:"test-recorder",ref:d,children:l})]}):null]}var hn=()=>{let t=Pc(3),[e]=Bc(),[o,r]=Zc(e),n;return t[0]!==o||t[1]!==r?(n=vo(fn.Fragment,{children:[De("p",{children:"HI"}),o,r,De("p",{children:"DONE"})]}),t[0]=o,t[1]=r,t[2]=n):n=t[2],n};var Xc=D({plugins:[{Component:hn,position:"bottom"}]});import{c as Yc}from"react/compiler-runtime";import{jsx as Jc}from"react/jsx-runtime";import{useLexicalComposerContext as qc}from"@lexical/react/LexicalComposerContext.js";import{TreeView as Qc}from"@lexical/react/LexicalTreeView.js";import"react";var gn=()=>{let t=Yc(2),[e]=qc(),o;return t[0]!==e?(o=Jc(Qc,{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 eu=D({plugins:[{Component:gn,position:"bottom"}]});import{$isTableSelection as tu}from"@lexical/table";import{$isRangeSelection as ou,FORMAT_TEXT_COMMAND as ru}from"lexical";import{jsx as Cn}from"react/jsx-runtime";import"react";var xn=()=>Cn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Cn("path",{d:"M10.6772 15H6.27017V5.718H10.4172C12.6792 5.718 13.8492 6.602 13.8492 8.292C13.8492 9.098 13.1992 9.982 12.4712 10.216C13.3812 10.476 14.1742 11.256 14.1742 12.322C14.1742 14.09 12.9002 15 10.6772 15ZM8.46717 9.501H10.3262C11.3012 9.501 11.7042 9.046 11.7042 8.409C11.7042 7.72 11.2362 7.317 10.3392 7.317H8.46717V9.501ZM8.46717 11.061V13.401H10.4822C11.4702 13.401 11.9642 12.959 11.9642 12.218C11.9642 11.49 11.4702 11.061 10.4822 11.061H8.46717Z",fill:"currentColor"})});var te=t=>({type:"buttons",items:t,key:"format",order:40});var bn={type:"text-format",format:["bold","italic"],tag:"***"},_n={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},En={type:"text-format",format:["bold"],tag:"**"},Tn={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var wn=[te([{ChildComponent:xn,isActive:({selection:t})=>ou(t)||tu(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(ru,"bold")},order:1}])],nu=D(({featureProviderMap:t})=>{let e=[En,Tn];return t.get("italic")&&e.push(_n,bn),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:wn},toolbarInline:{groups:wn}}});import{$isTableSelection as lu}from"@lexical/table";import{$isRangeSelection as su,FORMAT_TEXT_COMMAND as au}from"lexical";import{jsx as kn,jsxs as iu}from"react/jsx-runtime";import"react";var Nn=()=>iu("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[kn("path",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),kn("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var Ln={type:"text-format",format:["code"],tag:"`"};var Rn=[te([{ChildComponent:Nn,isActive:({selection:t})=>su(t)||lu(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(au,"code")},order:7}])],cu=D({enableFormats:["code"],markdownTransformers:[Ln],toolbarFixed:{groups:Rn},toolbarInline:{groups:Rn}});import{$isTableSelection as uu}from"@lexical/table";import{$isRangeSelection as du,FORMAT_TEXT_COMMAND as mu}from"lexical";import{jsx as Sn}from"react/jsx-runtime";import"react";var In=()=>Sn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Sn("path",{d:"M11.311 14.2969L11.0327 15H6.18408L6.4624 14.2969C7.54639 14.2969 7.70752 14.209 7.83936 13.8721L10.8423 6.45996C10.8716 6.38672 10.8862 6.32812 10.8862 6.26953C10.8862 6.09375 10.6519 6.03516 9.80225 6.03516L10.0952 5.33203H14.9438L14.6509 6.03516C13.5669 6.03516 13.4204 6.12305 13.2886 6.45996L10.2856 13.8721C10.2563 13.9453 10.2271 14.0039 10.2271 14.0625C10.2271 14.2383 10.4614 14.2969 11.311 14.2969Z",fill:"currentColor"})});var yn={type:"text-format",format:["italic"],tag:"*"},vn={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var Mn=[te([{ChildComponent:In,isActive:({selection:t})=>du(t)||uu(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(mu,"italic")},order:2}])],pu=D({enableFormats:["italic"],markdownTransformers:[yn,vn],toolbarFixed:{groups:Mn},toolbarInline:{groups:Mn}});import{$isTableSelection as hu}from"@lexical/table";import{$isRangeSelection as gu,FORMAT_TEXT_COMMAND as Cu}from"lexical";import{jsx as Dn,jsxs as fu}from"react/jsx-runtime";import"react";var An=()=>fu("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Dn("path",{d:"M5.50756 12.76H7.42756C7.56256 14.215 8.82256 14.71 10.1576 14.71C11.4326 14.71 12.4226 14.14 12.4226 13.06C12.4226 12.28 11.9576 11.845 10.6676 11.605L8.70256 11.245C7.12756 10.96 5.85256 10.21 5.85256 8.335C5.85256 6.43 7.53256 5.11 9.87256 5.11C12.4226 5.11 13.9526 6.22 14.1626 8.23H12.2876C12.1526 7.18 11.2226 6.595 9.88756 6.595C8.59756 6.595 7.78756 7.27 7.78756 8.215C7.78756 9.1 8.34256 9.385 9.49756 9.61L11.5676 10.015C13.3226 10.345 14.3726 11.215 14.3726 12.94C14.3726 14.89 12.5876 16.18 10.2176 16.18C7.66756 16.18 5.70256 15.115 5.50756 12.76Z",fill:"currentColor"}),Dn("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var On={type:"text-format",format:["strikethrough"],tag:"~~"};var Fn=[te([{ChildComponent:An,isActive:({selection:t})=>gu(t)||hu(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(Cu,"strikethrough")},order:4}])],xu=D({enableFormats:["strikethrough"],markdownTransformers:[On],toolbarFixed:{groups:Fn},toolbarInline:{groups:Fn}});import{$isTableSelection as bu}from"@lexical/table";import{$isRangeSelection as _u,FORMAT_TEXT_COMMAND as Eu}from"lexical";import{jsx as $n}from"react/jsx-runtime";import"react";var Pn=()=>$n("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:$n("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 13.258C16.7768 14.155 16.1398 14.532 15.2038 15C14.5538 15.325 14.2808 15.546 14.2418 15.78H16.7898V16.82H12.7208V16.339C12.7208 15.286 13.5918 14.675 14.3588 14.233C15.0868 13.83 15.4378 13.635 15.4378 13.232C15.4378 12.894 15.2038 12.686 14.8268 12.686C14.3848 12.686 14.1248 13.024 14.1118 13.427H12.7468C12.8248 12.426 13.5528 11.633 14.8398 11.633C15.9448 11.633 16.7768 12.257 16.7768 13.258Z",fill:"currentColor"})});var Bn=[te([{ChildComponent:Pn,isActive:({selection:t})=>_u(t)||bu(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(Eu,"subscript")},order:5}])],Tu=D({enableFormats:["subscript"],toolbarFixed:{groups:Bn},toolbarInline:{groups:Bn}});import{$isTableSelection as wu}from"@lexical/table";import{$isRangeSelection as ku,FORMAT_TEXT_COMMAND as Nu}from"lexical";import{jsx as Hn}from"react/jsx-runtime";import"react";var jn=()=>Hn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Hn("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 7.252C16.7768 8.149 16.1398 8.526 15.2038 8.994C14.5538 9.319 14.2808 9.54 14.2418 9.774H16.7898V10.814H12.7208V10.333C12.7208 9.28 13.5918 8.669 14.3588 8.227C15.0868 7.824 15.4378 7.629 15.4378 7.226C15.4378 6.888 15.2038 6.68 14.8268 6.68C14.3848 6.68 14.1248 7.018 14.1118 7.421H12.7468C12.8248 6.42 13.5528 5.627 14.8398 5.627C15.9448 5.627 16.7768 6.251 16.7768 7.252Z",fill:"currentColor"})});var Wn=[te([{ChildComponent:jn,isActive:({selection:t})=>ku(t)||wu(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(Nu,"superscript")},order:6}])],Lu=D({enableFormats:["superscript"],toolbarFixed:{groups:Wn},toolbarInline:{groups:Wn}});import{$isTableSelection as Su}from"@lexical/table";import{$isRangeSelection as Iu,FORMAT_TEXT_COMMAND as yu}from"lexical";import{jsx as Gn,jsxs as Ru}from"react/jsx-runtime";import"react";var Un=()=>Ru("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Gn("path",{d:"M13.9656 11.256C13.9656 13.791 12.5096 15.156 10.0006 15.156C7.50461 15.156 6.03561 13.791 6.03561 11.23V5.718H7.76461V11.243C7.76461 12.868 8.50561 13.778 10.0006 13.778C11.4956 13.778 12.2496 12.868 12.2496 11.243V5.718H13.9656V11.256Z",fill:"currentColor"}),Gn("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var Vn=[te([{ChildComponent:Un,isActive:({selection:t})=>Iu(t)||Su(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(yu,"underline")},order:3}])],vu=D({enableFormats:["underline"],toolbarFixed:{groups:Vn},toolbarInline:{groups:Vn}});import{$createHeadingNode as Ou,$isHeadingNode as ii,HeadingNode as Fu}from"@lexical/rich-text";import{$setBlocksType as $u}from"@lexical/selection";import{$getSelection as Pu,$isRangeSelection as Bu}from"lexical";import{jsx as Kn}from"react/jsx-runtime";import"react";var zn=()=>Kn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Kn("path",{d:"M4.639 13.5V7.074H6.196V9.648H9.076V7.074H10.642V13.5H9.076V10.836H6.196V13.5H4.639ZM11.5656 9.045V8.019C12.6636 8.019 13.1316 7.731 13.2846 7.065H14.4006V13.5H12.8436V9.045H11.5656Z",fill:"currentColor"})});import{jsx as Zn}from"react/jsx-runtime";import"react";var Xn=()=>Zn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Zn("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM15.9796 8.973C15.9796 10.116 15.1696 10.656 14.0356 11.232C13.2256 11.646 12.8206 11.943 12.7846 12.294H15.9886V13.5H11.0566V12.951C11.0566 11.601 12.1636 10.845 13.1176 10.287C14.0356 9.756 14.5126 9.486 14.5126 8.946C14.5126 8.46 14.2156 8.145 13.6306 8.145C13.0186 8.145 12.6586 8.613 12.6226 9.198H11.1196C11.2186 7.947 12.1006 6.966 13.6396 6.966C15.0346 6.966 15.9796 7.785 15.9796 8.973Z",fill:"currentColor"})});import{jsx as Yn}from"react/jsx-runtime";import"react";var Jn=()=>Yn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Yn("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM16.1146 11.745C16.1146 12.744 15.2236 13.608 13.6126 13.608C12.0736 13.608 11.0926 12.762 10.9846 11.547H12.4696C12.5146 12.114 13.0006 12.456 13.6126 12.456C14.2876 12.456 14.6746 12.132 14.6746 11.619C14.6746 11.061 14.2426 10.836 13.6216 10.836H12.9826V9.738H13.6036C14.1526 9.738 14.5486 9.486 14.5486 8.937C14.5486 8.46 14.2156 8.127 13.6486 8.127C13.0366 8.127 12.6586 8.514 12.6226 9.045H11.1916C11.2726 7.929 12.1276 6.966 13.6666 6.966C15.1876 6.966 15.9706 7.848 15.9706 8.865C15.9706 9.603 15.5026 10.143 14.8186 10.269C15.6196 10.404 16.1146 10.971 16.1146 11.745Z",fill:"currentColor"})});import{jsx as qn}from"react/jsx-runtime";import"react";var Qn=()=>qn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:qn("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM15.1736 7.074V10.854H16.3706V12.033H15.1736V13.5H13.6796V12.033H10.5116V10.845L13.4996 7.074H15.1736ZM13.6796 8.46L11.8256 10.854H13.6796V8.46Z",fill:"currentColor"})});import{jsx as ei}from"react/jsx-runtime";import"react";var ti=()=>ei("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:ei("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.1576 10.269C12.6896 10.269 12.3746 10.494 12.2216 10.737H10.8176L11.1956 7.074H15.2546V8.28H12.3206L12.1856 9.549C12.4016 9.351 12.8516 9.126 13.4636 9.126C14.7866 9.126 15.6596 10.053 15.6596 11.358C15.6596 12.609 14.7326 13.608 13.1756 13.608C11.5826 13.608 10.6556 12.753 10.5566 11.511H12.1136C12.1586 12.06 12.5456 12.465 13.1576 12.465C13.8236 12.465 14.1746 11.97 14.1746 11.376C14.1746 10.764 13.8416 10.269 13.1576 10.269Z",fill:"currentColor"})});import{jsx as oi}from"react/jsx-runtime";import"react";var ri=()=>oi("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:oi("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.3646 8.127C12.5456 8.127 12.0416 8.937 12.0416 9.999C12.3296 9.54 12.8246 9.207 13.5536 9.207C14.8586 9.207 15.8036 10.134 15.8036 11.376C15.8036 12.645 14.8226 13.608 13.3196 13.608C11.7266 13.608 10.6196 12.393 10.6196 10.395C10.6196 8.316 11.7716 6.966 13.4186 6.966C14.7056 6.966 15.5786 7.749 15.7316 8.829H14.3186C14.2016 8.415 13.9226 8.127 13.3646 8.127ZM13.3106 12.51C13.9586 12.51 14.3816 12.042 14.3816 11.385C14.3816 10.737 13.9586 10.278 13.3106 10.278C12.6536 10.278 12.2126 10.737 12.2126 11.385C12.2126 12.042 12.6536 12.51 13.3106 12.51Z",fill:"currentColor"})});import{$createHeadingNode as Mu,$isHeadingNode as Du,HeadingNode as Au}from"@lexical/rich-text";var Mo=t=>(e,o,r)=>{let n=t(r);n&&(n.append(...o),e.replace(n),n.select(0,0))};var ni=t=>{let o=`^(${t.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`,r=new RegExp(o);return{type:"element",dependencies:[Au],export:(n,i)=>{if(!Du(n))return null;let l=Number(n.getTag().slice(1));return"#".repeat(l)+" "+i(n)},regExp:r,replace:Mo(n=>{let i="h"+n[1].length;return Mu(i)})}};var li=t=>{let e=Pu();$u(e,()=>Ou(t))},si={h1:zn,h2:Xn,h3:Jn,h4:Qn,h5:ti,h6:ri},Hu=D(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[ie(e.map((r,n)=>({ChildComponent:si[r],isActive:({selection:i})=>{if(!Bu(i))return!1;for(let l of i.getNodes()){if(ii(l)&&l.getTag()===r)continue;let s=l.getParent();if(!(ii(s)&&s.getTag()===r))return!1}return!0},key:r,label:({i18n:i})=>i.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:i})=>{i.update(()=>{li(r)})},order:n+2})))];return{markdownTransformers:[ni(e)],nodes:[Fu],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[q(e.map(r=>({Icon:si[r],key:`heading-${r.charAt(1)}`,keywords:["heading",r],label:({i18n:n})=>n.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:n})=>{n.update(()=>{li(r)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}});import{$isNodeSelection as Xu}from"lexical";import{jsx as ai}from"react/jsx-runtime";import"react";var Do=()=>ai("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:ai("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as ci,jsxs as ju}from"react/jsx-runtime";import"react";var ui=()=>ju("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[ci("path",{d:"M5 10h10",stroke:"currentColor"}),ci("path",{d:"M10 15V5",stroke:"currentColor"})]});var fe=t=>({type:"dropdown",ChildComponent:ui,items:t,key:"add",order:10});var di={type:"element",dependencies:[kt],export:(t,e)=>Lt(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=Nt();e&&t.replace(e)}};import{c as Wu}from"react/compiler-runtime";import{useLexicalComposerContext as Gu}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Uu}from"@lexical/utils";import{$getSelection as Vu,$isRangeSelection as Ku,COMMAND_PRIORITY_EDITOR as zu}from"lexical";import{useEffect as Zu}from"react";var mi=()=>{let t=Wu(3),[e]=Gu(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Xe,n=>{let i=Vu();if(!Ku(i))return!1;if(i.focus.getNode()!==null){let s=Nt();Uu(s)}return!0},zu),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Zu(o,r),null};var Yu=D({markdownTransformers:[di],nodes:[kt],plugins:[{Component:mi,position:"normal"}],slashMenu:{groups:[q([{Icon:Do,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Xe,void 0)}}])]},toolbarFixed:{groups:[fe([{ChildComponent:Do,isActive:({selection:t})=>{if(!Xu(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Lt(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Xe,void 0)}}])]}});import{INDENT_CONTENT_COMMAND as sd,OUTDENT_CONTENT_COMMAND as ad}from"lexical";import{jsx as Ht,jsxs as Ju}from"react/jsx-runtime";import"react";var pi=()=>Ju("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Ht("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),Ht("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),Ht("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ht("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as jt,jsxs as qu}from"react/jsx-runtime";import"react";var fi=()=>qu("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[jt("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),jt("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),jt("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),jt("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});import{c as Qu}from"react/compiler-runtime";import{jsx as ed}from"react/jsx-runtime";import{useLexicalComposerContext as td}from"@lexical/react/LexicalComposerContext.js";import{TabIndentationPlugin as od}from"@lexical/react/LexicalTabIndentationPlugin";import{mergeRegister as rd}from"@lexical/utils";import{COMMAND_PRIORITY_NORMAL as hi,FOCUS_COMMAND as nd,KEY_ESCAPE_COMMAND as id}from"lexical";import{useEffect as gi,useState as ld}from"react";var Ci=()=>{let t=Qu(8),[e]=td(),[o,r]=ld(!1),n,i;t[0]!==e?(n=()=>rd(e.registerCommand(nd,()=>(r(!1),!0),hi),e.registerCommand(id,()=>(r(!0),e.getRootElement()?.blur(),!0),hi)),i=[e,r],t[0]=e,t[1]=n,t[2]=i):(n=t[1],i=t[2]),gi(n,i);let l,s;t[3]!==o||t[4]!==e?(l=()=>{if(!o)return;let c=d=>{["Escape","Shift"].includes(d.key)||r(!1),d.shiftKey&&d.key==="Tab"&&e.getRootElement()?.parentElement?.focus()};return document.addEventListener("keydown",c),()=>{document.removeEventListener("keydown",c)}},s=[e,o],t[3]=o,t[4]=e,t[5]=l,t[6]=s):(l=t[5],s=t[6]),gi(l,s);let a;return t[7]===Symbol.for("react.memo_cache_sentinel")?(a=ed(od,{}),t[7]=a):a=t[7],a};var xi=t=>({type:"buttons",items:t,key:"indent",order:35});var bi=[xi([{ChildComponent:pi,isActive:()=>!1,isEnabled:({selection:t})=>{if(!t||!t?.getNodes()?.length)return!1;for(let e of t.getNodes()){let o=e.getParentOrThrow();if("__indent"in e&&e.__indent>0||"__indent"in o&&o.__indent>0)return!0}return!1},key:"indentDecrease",label:({i18n:t})=>t.t("lexical:indent:decreaseLabel"),onSelect:({editor:t})=>{t.dispatchCommand(ad,void 0)},order:1},{ChildComponent:fi,isActive:()=>!1,key:"indentIncrease",label:({i18n:t})=>t.t("lexical:indent:increaseLabel"),onSelect:({editor:t})=>{t.dispatchCommand(sd,void 0)},order:2}])],cd=D({plugins:[{Component:Ci,position:"normal"}],toolbarFixed:{groups:bi},toolbarInline:{groups:bi}});import{$findMatchingParent as _m}from"@lexical/utils";import{$getSelection as jo,$isRangeSelection as Xi}from"lexical";import{jsx as _i}from"react/jsx-runtime";import"react";var Ei=()=>_i("svg",{"aria-hidden":"true",className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:_i("path",{d:"M8.5 11.5L11.5 8.5M8.5 7L9.625 5.875C10.868 4.633 12.882 4.633 14.125 5.875C15.368 7.118 15.368 9.133 14.125 10.375L13 11.5M7 8.5L5.746 9.754C4.56 10.94 4.519 12.85 5.652 14.087C6.814 15.354 8.78 15.449 10.058 14.298L11.5 13",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})});var Ao=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as _d,$isTextNode as Ed}from"lexical";import{addClassNamesToElement as ud,isHTMLAnchorElement as dd}from"@lexical/utils";import $o from"bson-objectid";import{$applyNodeReplacement as md,$createTextNode as Ti,$getSelection as pd,$isElementNode as wi,$isRangeSelection as Fo,createCommand as fd,ElementNode as hd}from"lexical";var gd=new Set(["http:","https:","mailto:","sms:","tel:"]),le=class t extends hd{__fields;__id;constructor({id:e,fields:o={doc:null,linkType:"custom",newTab:!1,url:""},key:r}){super(r),this.__fields=o,this.__id=e}static clone(e){return new t({id:e.__id,fields:e.__fields,key:e.__key})}static getType(){return"link"}static importDOM(){return{a:e=>({conversion:Cd,priority:1})}}static importJSON(e){e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),e.version===2&&!e.id&&(e.id=new $o.default().toHexString(),e.version=3);let o=he({id:e.id,fields:e.fields});return o.setFormat(e.format),o.setIndent(e.indent),o.setDirection(e.direction),o}canBeEmpty(){return!1}canInsertTextAfter(){return!1}canInsertTextBefore(){return!1}createDOM(e){let o=document.createElement("a");return this.__fields?.linkType==="custom"&&(o.href=this.sanitizeUrl(this.__fields.url??"")),(this.__fields?.newTab??!1)&&(o.target="_blank"),this.__fields?.newTab===!0&&this.__fields?.linkType==="custom"&&(o.rel=Oo(o.rel,"add","noopener")),ud(o,e.theme.link),o}exportJSON(){let e={...super.exportJSON(),type:"link",fields:this.getFields(),version:3},o=this.getID();return o&&(e.id=o),e}extractWithChild(e,o,r){if(!Fo(o))return!1;let n=o.anchor.getNode(),i=o.focus.getNode();return this.isParentOf(n)&&this.isParentOf(i)&&o.getTextContent().length>0}getFields(){return this.getLatest().__fields}getID(){return this.getLatest().__id}insertNewAfter(e,o=!0){let r=this.getParentOrThrow().insertNewAfter(e,o);if(wi(r)){let n=he({fields:this.__fields});return r.append(n),n}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!gd.has(o.protocol))return"about:blank"}catch{return"https://"}return e}setFields(e){let o=this.getWritable();o.__fields=e}updateDOM(e,o,r){let n=this.__fields?.url,i=this.__fields?.newTab;return n!=null&&n!==e.__fields?.url&&this.__fields?.linkType==="custom"&&(o.href=n),this.__fields?.linkType==="internal"&&e.__fields?.linkType==="custom"&&o.removeAttribute("href"),o.rel==null&&(o.rel=""),i!==e.__fields?.newTab&&(i??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=Oo(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=Oo(o.rel,"remove","noopener"))),!1}};function Cd(t){let e=null;if(dd(t)){let o=t.textContent;o!==null&&o!==""&&(e=he({id:new $o.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function he({id:t,fields:e}){return md(new le({id:t??new $o.default().toHexString(),fields:e}))}function Y(t){return t instanceof le}var de=fd("TOGGLE_LINK_COMMAND");function ki(t){let e=pd();if(!Fo(e)&&!t.selectedNodes?.length)return;let o=Fo(e)?e.extract():t.selectedNodes;if(t===null)o?.forEach(r=>{let n=r.getParent();if(Y(n)){let i=n.getChildren();for(let l=0;l<i.length;l+=1)n.insertBefore(i[l]);n.remove()}});else{if(o?.length===1){let i=o[0],l=Y(i)?i:xd(i);if(l!==null){l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append(Ti(t.text)),l.getChildren().forEach(s=>{s!==l.getLastChild()&&s.remove()}));return}}let r=null,n=null;o?.forEach(i=>{let l=i.getParent();if(!(l===n||l===null||wi(i)&&!i.isInline())){if(Y(l)){n=l,l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append(Ti(t.text)),l.getChildren().forEach(s=>{s!==l.getLastChild()&&s.remove()}));return}if(l.is(r)||(r=l,n=he({fields:t.fields}),Y(l)?i.getPreviousSibling()===null?l.insertBefore(n):l.insertAfter(n):i.insertBefore(n)),Y(i)){if(i.is(n))return;if(n!==null){let s=i.getChildren();for(let a=0;a<s.length;a+=1)n.append(s[a])}i.remove();return}n!==null&&n.append(i)}})}}function xd(t){return bd(t,e=>Y(e))}function bd(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function Oo(t,e,o){let r,n=`${t}`;if(e==="add"){if(n.includes(o)){let i=new RegExp(o,"g");n=n.replace(i,"").trim()}n=n.trim(),r=n.length===0?`${o}`:`${n} ${o}`}else{let i=new RegExp(o,"g");r=n.replace(i,"").trim()}return r}var Ni={type:"text-match",dependencies:[le],export:(t,e,o)=>{if(!Y(t))return null;let r=t,{url:n}=r.getFields(),i=`[${r.getTextContent()}](${n})`,l=r.getFirstChild();return r.getChildrenSize()===1&&Ed(l)?o(l,i):i},importRegExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:(t,e)=>{let[,o,r]=e,n=he({fields:{doc:null,linkType:"custom",newTab:!1,url:r}}),i=_d(o);i.setFormat(t.getFormat()),n.append(i),t.replace(n)},trigger:")"};import{$applyNodeReplacement as Td,$isElementNode as wd}from"lexical";var ge=class t extends le{static clone(e){return new t({id:"",fields:e.__fields,key:e.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(e){e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2);let o=ut({fields:e.fields});return o.setFormat(e.format),o.setIndent(e.indent),o.setDirection(e.direction),o}exportJSON(){let e=super.exportJSON();return{type:"autolink",children:e.children,direction:e.direction,fields:e.fields,format:e.format,indent:e.indent,version:2}}insertNewAfter(e,o=!0){let r=this.getParentOrThrow().insertNewAfter(e,o);if(wd(r)){let n=ut({fields:this.__fields});return r.append(n),n}return null}};function ut({fields:t}){return Td(new ge({id:"",fields:t}))}function Ce(t){return t instanceof ge}import{c as kd}from"react/compiler-runtime";import{useLexicalComposerContext as Nd}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Ld}from"@lexical/utils";import{$createTextNode as Li,$getSelection as Rd,$isElementNode as Si,$isLineBreakNode as Ii,$isNodeSelection as Sd,$isRangeSelection as Id,$isTextNode as dt,TextNode as yd}from"lexical";import{useEffect as vd}from"react";function Ri(t,e=o=>o){return o=>{let r=t.exec(o);return r===null?null:{index:r.index,length:r[0].length,text:r[0],url:e(r[0])}}}function yi(t,e){for(let o=0;o<e.length;o++){let r=e[o](t);if(r!=null)return r}return null}var Md=/[.,;\s]/;function Gt(t){return Md.test(t)}function vi(t){return Gt(t[t.length-1])}function Bo(t){return Gt(t[0])}function Dd(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function Mi(t){let e=t.getPreviousSibling();return Si(e)&&(e=e.getLastDescendant()),e===null||Ii(e)||dt(e)&&vi(e.getTextContent())}function Di(t){let e=t.getNextSibling();return Si(e)&&(e=e.getFirstDescendant()),e===null||Ii(e)||dt(e)&&Bo(e.getTextContent())}function Ad(t,e,o,r){return(t>0?Gt(o[t-1]):Mi(r[0]))?e<o.length?Gt(o[e]):Di(r[r.length-1]):!1}function Od(t,e,o){let r=[],n=[],i=[],l=0,s=0,a=[...t];for(;a.length>0;){let c=a[0],u=c.getTextContent().length,m=s;s+u<=e?(r.push(c),l+=u):m>=o?i.push(c):n.push(c),s+=u,a.shift()}return[l,r,n,i]}function Fd(t,e,o,r){let n={linkType:"custom",url:r.url,...r.fields},i=ut({fields:n});if(t.length===1){let l=t[0],s;e===0?[s,l]=l.splitText(o):[,s,l]=l.splitText(e,o);let a=Li(r.text);return a.setFormat(s.getFormat()),a.setDetail(s.getDetail()),a.setStyle(s.getStyle()),i.append(a),s.replace(i),l}else if(t.length>1){let l=t[0],s=l.getTextContent().length,a;e===0?a=l:[,a]=l.splitText(e);let c=[],d;for(let f=1;f<t.length;f++){let h=t[f],E=h.getTextContent().length,L=s,C=s+E;if(L<o)if(C<=o)c.push(h);else{let[x,b]=h.splitText(o-L);c.push(x),d=b}s+=E}let u=Rd(),m=u?u.getNodes().find(dt):void 0,p=Li(a.getTextContent());return p.setFormat(a.getFormat()),p.setDetail(a.getDetail()),p.setStyle(a.getStyle()),i.append(p,...c),m&&m===a&&(Id(u)?p.select(u.anchor.offset,u.focus.offset):Sd(u)&&p.select(0,p.getTextContent().length)),a.replace(i),d}}function $d(t,e,o){let r=[...t],n=r.map(a=>a.getTextContent()).join(""),i=n,l,s=0;for(;(l=yi(i,e))!=null&&l!==null;){let a=l.index,c=l.length,d=a+c;if(Ad(s+a,s+d,n,r)){let[m,,p,f]=Od(r,s+a,s+d),h=s+a-m,g=s+d-m,E=Fd(p,h,g,l);r=E?[E,...f]:f,o(l.url,null),s=0}else s+=d;i=i.substring(d)}}function Po(t,e,o){let r=t.getChildren(),n=r.length;for(let a=0;a<n;a++){let c=r[a];if(!dt(c)||!c.isSimpleText()){Wt(t),o(null,t.getFields()?.url??null);return}}let i=t.getTextContent(),l=yi(i,e);if(l===null||l.text!==i){Wt(t),o(null,t.getFields()?.url??null);return}if(!Mi(t)||!Di(t)){Wt(t),o(null,t.getFields()?.url??null);return}let s=t.getFields()?.url;if(s!==l?.url){let a=t.getFields();a.url=l?.url,t.setFields(a),o(l.url,s??null)}}function Pd(t,e,o){let r=t.getPreviousSibling(),n=t.getNextSibling(),i=t.getTextContent();if(Ce(r)){let l=r.getFields()?.url?r.getFields()?.url?.startsWith("mailto:"):!1;(!Bo(i)||Dd(i,l))&&(r.append(t),Po(r,e,o),o(null,r.getFields()?.url??null))}Ce(n)&&!vi(i)&&(Wt(n),Po(n,e,o),o(null,n.getFields()?.url??null))}function Wt(t){let e=t.getChildren(),o=e.length;for(let r=o-1;r>=0;r--)t.insertAfter(e[r]);return t.remove(),e.map(r=>r.getLatest())}function Bd(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 Hd(t,e,o){let r=kd(5),n,i;r[0]!==t||r[1]!==o||r[2]!==e?(n=()=>{if(!t.hasNodes([ge]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let l=(s,a)=>{o?.(s,a)};return Ld(t.registerNodeTransform(yd,s=>{let a=s.getParentOrThrow(),c=s.getPreviousSibling();if(Ce(a))Po(a,e,l);else if(!Y(a)){if(s.isSimpleText()&&(Bo(s.getTextContent())||!Ce(c))){let d=Bd(s);$d(d,e,l)}Pd(s,e,l)}}))},i=[t,e,o],r[0]=t,r[1]=o,r[2]=e,r[3]=n,r[4]=i):(n=r[3],i=r[4]),vd(n,i)}var jd=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,Wd=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,Gd=[Ri(jd,t=>t.startsWith("http")?t:`https://${t}`),Ri(Wd,t=>`mailto:${t}`)],Ai=()=>{let[t]=Nd();return Hd(t,Gd),null};import{jsx as Ud}from"react/jsx-runtime";import{ClickableLinkPlugin as Vd}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var Oi=()=>Ud(Vd,{});import{jsx as am}from"react/jsx-runtime";import"react";import{createPortal as cm}from"react-dom";import{jsx as xe,jsxs as mt,Fragment as zd}from"react/jsx-runtime";import{useLexicalComposerContext as Zd}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as Fi,mergeRegister as $i}from"@lexical/utils";import{getTranslation as Ho}from"@payloadcms/translations";import{CloseMenuIcon as Xd,EditIcon as Yd,ExternalLinkIcon as Pi,formatDrawerSlug as Jd,useConfig as qd,useEditDepth as Qd,useLocale as em,useTranslation as tm}from"@payloadcms/ui";import{requests as om}from"@payloadcms/ui/shared";import{$getSelection as Bi,$isLineBreakNode as rm,$isRangeSelection as Hi,COMMAND_PRIORITY_HIGH as nm,COMMAND_PRIORITY_LOW as ji,KEY_ESCAPE_COMMAND as im,SELECTION_CHANGE_COMMAND as lm}from"lexical";import Wi,{useCallback as Gi,useEffect as Vt,useRef as sm,useState as Ae}from"react";import{createCommand as Kd}from"lexical";var Ut=Kd("TOGGLE_LINK_WITH_MODAL_COMMAND");function Ui({anchorElem:t}){let[e]=Zd(),[o,r]=Ae(),n=sm(null),[i,l]=Ae(null),[s,a]=Ae(null),{fieldProps:{schemaPath:c},uuid:d}=B(),{config:u}=qd(),{i18n:m,t:p}=tm(),[f,h]=Ae(),g=Qd(),[E,L]=Ae(!1),[C,x]=Ae([]),b=em(),[_,T]=Ae(!1),R=Jd({slug:"lexical-rich-text-link-"+d,depth:g}),{toggleDrawer:N}=se(R),S=Gi(()=>{L(!1),n&&n.current&&(n.current.style.opacity="0",n.current.style.transform="translate(-10000px, -10000px)"),T(!1),l(null),a(null),x([]),h(void 0)},[L,l,a,x]),y=Gi(()=>{let w=Bi(),k;if(!Hi(w)||!w){S();return}let v=ke(w);k=e.getElementByKey(v.getKey())?.getBoundingClientRect();let I=Fi(v,Y),A=w.getNodes().filter(V=>!rm(V)).find(V=>{let W=Fi(V,Y);return I&&!I.is(W)||W&&!W.is(I)});if(I==null||A){S();return}r(I);let M=I.getFields(),F={...M,id:I.getID(),text:I.getTextContent()};if(M?.linkType==="custom")l(M?.url??null),a(null);else{l(`${u.routes.admin==="/"?"":u.routes.admin}/collections/${M?.doc?.relationTo}/${M?.doc?.value}`);let V=u.collections.find(W=>W.slug===M?.doc?.relationTo);if(!V)a(M?.label?String(M?.label):null),l(M?.url?String(M?.url):null);else{let W=typeof M.doc?.value=="object"?M.doc.value.id:M.doc?.value,O=M.doc?.relationTo;if(!W||!O)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let Z=p("fields:linkedTo",{label:`${Ho(V.labels.singular,m)} - ${p("lexical:link:loadingWithEllipsis",m)}`}).replace(/<[^>]*>?/g,"");a(Z),om.get(`${u.serverURL}${u.routes.api}/${O}/${W}`,{headers:{"Accept-Language":m.language},params:{depth:0,locale:b?.code}}).then(async ne=>{if(!ne.ok)throw new Error(`HTTP error! Status: ${ne.status}`);let oe=await ne.json(),Pe=V?.admin?.useAsTitle||"id",Se=oe[Pe],Be=p("fields:linkedTo",{label:`${Ho(V.labels.singular,m)} - ${Se}`}).replace(/<[^>]*>?/g,"");a(Be)}).catch(()=>{let ne=p("fields:linkedTo",{label:`${Ho(V.labels.singular,m)} - ${p("general:untitled",m)} - ID: ${W}`}).replace(/<[^>]*>?/g,"");a(ne)})}}h(F),L(!0),x(w?w?.getNodes():[]),Ce(I)?T(!0):T(!1);let U=n.current,P=window.getSelection(),{activeElement:z}=document;if(U===null)return;let X=e.getRootElement();return P!==null&&X!==null&&X.contains(P.anchorNode)?(k||(k=P.getRangeAt(0).getBoundingClientRect()),k!=null&&(k.y+=40,We(k,U,t))):(z==null||z.className!=="link-input")&&(X!==null&&We(null,U,t),l(null),a(null)),!0},[e,S,u.routes.admin,u.routes.api,u.collections,u.serverURL,p,m,b?.code,t]);return Vt(()=>$i(e.registerCommand(Ut,w=>(e.dispatchCommand(de,w),y(),N(),!0),ji)),[e,y,N,R]),Vt(()=>{let w=t.parentElement,k=()=>{e.getEditorState().read(()=>{y()})};return window.addEventListener("resize",k),w?.addEventListener("scroll",k),()=>{window.removeEventListener("resize",k),w?.removeEventListener("scroll",k)}},[t.parentElement,e,y]),Vt(()=>$i(e.registerUpdateListener(({editorState:w})=>{w.read(()=>{y()})}),e.registerCommand(lm,()=>(y(),!0),ji),e.registerCommand(im,()=>E?(S(),!0):!1,nm)),[e,y,E,S]),Vt(()=>{e.getEditorState().read(()=>{y()})},[e,y]),mt(Wi.Fragment,{children:[xe("div",{className:"link-editor",ref:n,children:mt("div",{className:"link-input",children:[i&&i.length>0?mt("a",{href:i,rel:"noopener noreferrer",target:"_blank",children:[o?.__fields.newTab?xe(Pi,{}):null,s!=null&&s.length>0?s:i]}):s!=null&&s.length>0?mt(zd,{children:[o?.__fields.newTab?xe(Pi,{}):null,xe("span",{className:"link-input__label-pure",children:s})]}):null,e.isEditable()&&mt(Wi.Fragment,{children:[xe("button",{"aria-label":"Edit link",className:"link-edit",onClick:()=>{N()},onMouseDown:w=>{w.preventDefault()},tabIndex:0,type:"button",children:xe(Yd,{})}),!_&&xe("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(de,null)},onMouseDown:w=>{w.preventDefault()},tabIndex:0,type:"button",children:xe(Xd,{})})]})]})}),xe(Ye,{className:"lexical-link-edit-drawer",data:f,drawerSlug:R,drawerTitle:p("fields:editLink"),featureKey:"link",handleDrawerSubmit:(w,k)=>{let v=k,I={...v};delete I.text,e.update(()=>{let A=Bi(),M=null;if(Hi(A)?M=ke(A).getParent():C.length&&(M=C[0].getParent()),M&&Ce(M)){let F=he({fields:I});M.replace(F,!0)}}),e.dispatchCommand(de,{fields:I,selectedNodes:C,text:v.text})},schemaPath:c,schemaPathSuffix:"fields"})]})}var Vi=t=>{let{anchorElem:e=document.body}=t;return cm(am(Ui,{anchorElem:e}),e)};import{c as mm}from"react/compiler-runtime";import{useLexicalComposerContext as pm}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as fm}from"@lexical/utils";import{$getSelection as hm,$isElementNode as gm,$isRangeSelection as Cm,COMMAND_PRIORITY_LOW as zi,PASTE_COMMAND as xm}from"lexical";import{useEffect as bm}from"react";var um=/(?:[A-Za-z]{3,9}:(?:\/\/)?(?:[-;:&=+$,\w]+@)?[A-Za-z\d.-]+|(?:www.|[-;:&=+$,\w]+@)[A-Za-z\d.-]+)(?:\/[+~%/.\w-]*)?\??[-+=&;%@.\w]*#?\w*/,dm=/^[\w\-./]*(?:#\w[\w-]*)?$/;function Ki(t){if(!t)return!1;if(t==="https://"||um.test(t)||dm.test(t))return!0;try{return new URL(t),!0}catch{}return!1}var Zi=()=>{let t=mm(3),[e]=pm(),o,r;return t[0]!==e?(o=()=>{if(!e.hasNodes([le]))throw new Error("LinkPlugin: LinkNode not registered on editor");return fm(e.registerCommand(de,n=>(ki(n),!0),zi),e.registerCommand(xm,n=>{let i=hm();if(!Cm(i)||i.isCollapsed()||!(n instanceof ClipboardEvent)||n.clipboardData==null)return!1;let l=n.clipboardData.getData("text");if(!Ki(l))return!1;if(!i.getNodes().some(s=>gm(s))){let s={doc:null,linkType:"custom",newTab:!1,url:l};return e.dispatchCommand(de,{fields:s,text:null}),n.preventDefault(),!0}return!1},zi))},r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),bm(o,r),null};var Yi=[Ao([{ChildComponent:Ei,isActive:({selection:t})=>{if(Xi(t)){let e=ke(t);return _m(e,Y)!=null}return!1},isEnabled:({selection:t})=>!!(Xi(t)&&jo()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(de,null);else{let o,r=[];if(t.getEditorState().read(()=>{o=jo()?.getTextContent(),r=jo()?.getNodes()??[]}),!o?.length)return;let n={doc:null,linkType:"custom",newTab:!1,url:"https://"};t.dispatchCommand(Ut,{fields:n,selectedNodes:r,text:o})}},order:1}])],Em=D({markdownTransformers:[Ni],nodes:[le,ge],plugins:[{Component:Zi,position:"normal"},{Component:Ai,position:"normal"},{Component:Oi,position:"normal"},{Component:Vi,position:"floatingAnchorElem"}],toolbarFixed:{groups:Yi},toolbarInline:{groups:Yi}});import{$isListNode as Uo,INSERT_CHECK_LIST_COMMAND as ol,ListItemNode as Dm,ListNode as Am}from"@lexical/list";import{$isRangeSelection as Om}from"lexical";import{jsx as Ji,jsxs as Tm}from"react/jsx-runtime";import"react";var Wo=()=>Tm("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Ji("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),Ji("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as wm}from"react/jsx-runtime";import{ListPlugin as km}from"@lexical/react/LexicalListPlugin.js";import"react";var Ge=()=>wm(km,{});function Ue(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as Sm,ListItemNode as Im,ListNode as ym}from"@lexical/list";import{$createListItemNode as Nm,$createListNode as Lm,$isListItemNode as Rm,$isListNode as Go}from"@lexical/list";var qi=4,Ve=t=>(e,o,r)=>{let n=e.getPreviousSibling(),i=e.getNextSibling(),l=Nm(t==="check"?r[3]==="x":void 0);if(Go(i)&&i.getListType()===t){let a=i.getFirstChild();a!==null?a.insertBefore(l):i.append(l),e.remove()}else if(Go(n)&&n.getListType()===t)n.append(l),e.remove();else{let a=Lm(t,t==="number"?Number(r[2]):void 0);a.append(l),e.replace(a)}l.append(...o),l.select(0,0);let s=Math.floor(r[1].length/qi);s&&l.setIndent(s)},Oe=(t,e,o)=>{let r=[],n=t.getChildren(),i=0;for(let l of n)if(Rm(l)){if(l.getChildrenSize()===1){let d=l.getFirstChild();if(Go(d)){r.push(Oe(d,e,o+1));continue}}let s=" ".repeat(o*qi),a=t.getListType(),c=a==="number"?`${t.getStart()+i}. `:a==="check"?`- [${l.getChecked()?"x":" "}] `:"- ";r.push(s+c+e(l)),i++}return r.join(`
|
|
35
|
+
`)};var Qi={type:"element",dependencies:[ym,Im],export:(t,e)=>Sm(t)?Oe(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:Ve("check")};import{jsx as vm}from"react/jsx-runtime";import{CheckListPlugin as Mm}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var el=()=>vm(Mm,{});var tl=[ie([{ChildComponent:Wo,isActive:({selection:t})=>{if(!Om(t))return!1;for(let e of t.getNodes()){if(Uo(e)&&e.getListType()==="check")continue;let o=e.getParent();if(Uo(o)&&o.getListType()==="check")continue;let r=o?.getParent();if(!(Uo(r)&&r.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(ol,void 0)},order:12}])],Fm=D(({featureProviderMap:t})=>{let e=[{Component:el,position:"normal"}];return!t.has("unorderedList")&&!t.has("orderedList")&&e.push({Component:Ge,position:"normal"}),{markdownTransformers:[Qi],nodes:t.has("unorderedList")||t.has("orderedList")?[]:[Am,Dm],plugins:e,slashMenu:{groups:[Ue([{Icon:Wo,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:o})=>o.t("lexical:checklist:label"),onSelect:({editor:o})=>{o.dispatchCommand(ol,void 0)}}])]},toolbarFixed:{groups:tl},toolbarInline:{groups:tl}}});import{$isListNode as Ko,INSERT_ORDERED_LIST_COMMAND as il,ListItemNode as jm,ListNode as Wm}from"@lexical/list";import{$isRangeSelection as Gm}from"lexical";import{jsx as pt,jsxs as $m}from"react/jsx-runtime";import"react";var Vo=()=>$m("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[pt("path",{d:"M5.89284 12.479C5.89284 13.368 5.26284 13.788 4.38084 14.236C3.75084 14.558 3.43584 14.789 3.40784 15.062H5.89984V16H2.06384V15.573C2.06384 14.523 2.92484 13.935 3.66684 13.501C4.38084 13.088 4.75184 12.878 4.75184 12.458C4.75184 12.08 4.52084 11.835 4.06584 11.835C3.58984 11.835 3.30984 12.199 3.28184 12.654H2.11284C2.18984 11.681 2.87584 10.918 4.07284 10.918C5.15784 10.918 5.89284 11.555 5.89284 12.479Z",fill:"currentColor"}),pt("path",{d:"M2.68608 4.535V3.737C3.54008 3.737 3.90408 3.513 4.02308 2.995H4.89108V8H3.68008L3.68008 4.535H2.68608Z",fill:"currentColor"}),pt("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),pt("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),pt("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Pm,ListItemNode as Bm,ListNode as Hm}from"@lexical/list";var rl={type:"element",dependencies:[Hm,Bm],export:(t,e)=>Pm(t)?Oe(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:Ve("number")};var nl=[ie([{ChildComponent:Vo,isActive:({selection:t})=>{if(!Gm(t))return!1;for(let e of t.getNodes()){if(Ko(e)&&e.getListType()==="number")continue;let o=e.getParent();if(Ko(o)&&o.getListType()==="number")continue;let r=o?.getParent();if(!(Ko(r)&&r.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(il,void 0)},order:10}])],Um=D(({featureProviderMap:t})=>({markdownTransformers:[rl],nodes:t.has("orderedList")?[]:[Wm,jm],plugins:t.has("orderedList")?[]:[{Component:Ge,position:"normal"}],slashMenu:{groups:[Ue([{Icon:Vo,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:e})=>e.t("lexical:orderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(il,void 0)}}])]},toolbarFixed:{groups:nl},toolbarInline:{groups:nl}}));import{$isListNode as Zo,INSERT_UNORDERED_LIST_COMMAND as al,ListItemNode as Xm,ListNode as Ym}from"@lexical/list";import{$isRangeSelection as Jm}from"lexical";import{jsx as Ke,jsxs as Vm}from"react/jsx-runtime";import"react";var zo=()=>Vm("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Ke("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Ke("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Ke("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Ke("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),Ke("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),Ke("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Km,ListItemNode as zm,ListNode as Zm}from"@lexical/list";var ll={type:"element",dependencies:[Zm,zm],export:(t,e)=>Km(t)?Oe(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:Ve("bullet")};var sl=[ie([{ChildComponent:zo,isActive:({selection:t})=>{if(!Jm(t))return!1;for(let e of t.getNodes()){if(Zo(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(Zo(o)&&o.getListType()==="bullet")continue;let r=o?.getParent();if(!(Zo(r)&&r.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(al,void 0)},order:11}])],qm=D({markdownTransformers:[ll],nodes:[Ym,Xm],plugins:[{Component:Ge,position:"normal"}],slashMenu:{groups:[Ue([{Icon:zo,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(al,void 0)}}])]},toolbarFixed:{groups:sl},toolbarInline:{groups:sl}});import{jsx as Qm}from"react/jsx-runtime";import{addClassNamesToElement as ep}from"@lexical/utils";import{DecoratorNode as tp}from"lexical";import*as cl from"react";var op=cl.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),ft=class t extends tp{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new t({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return rp({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return ep(o,"unknownConverted"),o}decorate(){return Qm(op,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function rp({data:t}){return new ft({data:t})}var np=D(()=>({nodes:[ft]}));import{jsx as ip}from"react/jsx-runtime";import{addClassNamesToElement as lp}from"@lexical/utils";import{DecoratorNode as sp}from"lexical";import*as ul from"react";var ap=ul.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),ht=class t extends sp{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new t({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return cp({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return lp(o,"unknownConverted"),o}decorate(){return ip(ap,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function cp({data:t}){return new ht({data:t})}var up=D(()=>({nodes:[ht]}));import{$setBlocksType as pl}from"@lexical/selection";import{$createParagraphNode as fl,$getSelection as hl,$isParagraphNode as dl,$isRangeSelection as dp}from"lexical";var ml=[ie([{ChildComponent:rt,isActive:({selection:t})=>{if(!dp(t))return!1;for(let e of t.getNodes())if(!dl(e)&&!dl(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=hl();pl(e,()=>fl())})},order:1}])],mp=D({slashMenu:{groups:[q([{Icon:rt,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=hl();pl(e,()=>fl())})}}])]},toolbarFixed:{groups:ml},toolbarInline:{groups:ml}});import{$isNodeSelection as Hp}from"lexical";import{jsx as gt,jsxs as pp}from"react/jsx-runtime";import"react";var Xo=()=>pp("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[gt("g",{clipPath:"url(#clip0_4397_10817)",children:gt("path",{d:"M7.75 12.25L15.25 4.75M15.25 4.75H11.5M15.25 4.75V8.5M13 11.5V13.75C13 14.5784 12.3284 15.25 11.5 15.25H6.25C5.42157 15.25 4.75 14.5784 4.75 13.75V8.5C4.75 7.67157 5.42157 7 6.25 7H8.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})}),gt("defs",{children:gt("clipPath",{id:"clip0_4397_10817",children:gt("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{c as Sp}from"react/compiler-runtime";import{jsx as Ip}from"react/jsx-runtime";import{useLexicalComposerContext as yp}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as vp}from"@lexical/utils";import{useConfig as Mp}from"@payloadcms/ui";import{$getPreviousSelection as Dp,$getSelection as Ap,$isParagraphNode as El,$isRangeSelection as Op,COMMAND_PRIORITY_EDITOR as Fp,createCommand as $p}from"lexical";import{useEffect as Pp}from"react";import{c as wp}from"react/compiler-runtime";import{jsx as Kt}from"react/jsx-runtime";import{useLexicalComposerContext as kp}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as Np,COMMAND_PRIORITY_EDITOR as Lp}from"lexical";import{useEffect as Cl,useState as xl}from"react";import{c as fp}from"react/compiler-runtime";import{jsx as hp}from"react/jsx-runtime";import{useLexicalComposerContext as gp}from"@lexical/react/LexicalComposerContext";import{useListDrawer as Cp,useModal as xp}from"@payloadcms/ui";import{$getPreviousSelection as bp,$getSelection as _p,$setSelection as Ep}from"lexical";import{useEffect as Tp,useState as gl}from"react";var Ct=t=>{let e=fp(23),[o]=gp(),[r,n]=gl(null),[i,l]=gl(!1),[s,a,c]=Cp(t),{closeDrawer:d,drawerSlug:u,isDrawerOpen:m,openDrawer:p}=c,{modalState:f}=xp(),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let S=_p()??bp();n(S)},e[0]=h):h=e[0];let g=h,E;e[1]!==r||e[2]!==o?(E=()=>{r&&o.update(()=>{Ep(r.clone())},{discrete:!0,skipTransforms:!0})},e[1]=r,e[2]=o,e[3]=E):E=e[3];let L=E,C;e[4]!==d?(C=()=>{d()},e[4]=d,e[5]=C):C=e[5];let x=C,b,_;e[6]!==i||e[7]!==f||e[8]!==u||e[9]!==L?(b=()=>{if(!i)return;let S=f[u];S&&!S?.isOpen&&(l(!1),setTimeout(()=>{L()},1))},_=[f,u,L,i],e[6]=i,e[7]=f,e[8]=u,e[9]=L,e[10]=b,e[11]=_):(b=e[10],_=e[11]),Tp(b,_);let T;e[12]!==a?(T=S=>hp(a,{...S,onClick:()=>{g()}}),e[12]=a,e[13]=T):T=e[13];let R;e[14]!==p?(R=()=>{g(),p(),l(!0)},e[14]=p,e[15]=R):R=e[15];let N;return e[16]!==x||e[17]!==m||e[18]!==s||e[19]!==u||e[20]!==T||e[21]!==R?(N={closeListDrawer:x,isListDrawerOpen:m,ListDrawer:s,listDrawerSlug:u,ListDrawerToggler:T,openListDrawer:R},e[16]=x,e[17]=m,e[18]=s,e[19]=u,e[20]=T,e[21]=R,e[22]=N):N=e[22],N};var Rp=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=Np(o);n&&n.replace(Qe({relationTo:e,value:r}))}):t.dispatchCommand(Yo,{relationTo:e,value:r})},bl=t=>{let e=wp(21),{enabledCollectionSlugs:o}=t,[r]=kp(),n;e[0]!==o?(n=()=>o?.[0],e[0]=o,e[1]=n):n=e[1];let[i,l]=xl(n),[s,a]=xl(null),c=o||void 0,d;e[2]!==c||e[3]!==i?(d={collectionSlugs:c,selectedCollection:i},e[2]=c,e[3]=i,e[4]=d):d=e[4];let{closeListDrawer:u,isListDrawerOpen:m,ListDrawer:p,openListDrawer:f}=Ct(d),h,g;e[5]!==r||e[6]!==f?(h=()=>r.registerCommand(Je,_=>(a(_?.replace?_?.replace.nodeKey:null),f(),!0),Lp),g=[r,f],e[5]=r,e[6]=f,e[7]=h,e[8]=g):(h=e[7],g=e[8]),Cl(h,g);let E;e[9]!==r||e[10]!==s||e[11]!==u?(E=_=>{let{collectionSlug:T,docID:R}=_;Rp({editor:r,relationTo:T,replaceNodeKey:s,value:R}),u()},e[9]=r,e[10]=s,e[11]=u,e[12]=E):E=e[12];let L=E,C;e[13]!==o?(C=()=>{l(o?.[0])},e[13]=o,e[14]=C):C=e[14];let x;e[15]!==m||e[16]!==o?(x=[m,o],e[15]=m,e[16]=o,e[17]=x):x=e[17],Cl(C,x);let b;return e[18]!==L||e[19]!==p?(b=Kt(p,{onSelect:L}),e[18]=L,e[19]=p,e[20]=b):b=e[20],b},_l=t=>(t?.enabledCollectionSlugs?.length??-1)>0?Kt(bl,{...t}):Kt(Rt,{...t,children:Kt(bl,{...t})});var Yo=$p("INSERT_RELATIONSHIP_COMMAND"),Tl=t=>{let e=Sp(10),{clientProps:o}=t,[r]=yp(),{config:n}=Mp(),{collections:i}=n,l=null;if(o?.enabledCollections)l=o?.enabledCollections;else if(o?.disabledCollections){let d;if(e[0]!==o||e[1]!==i){let u;e[3]!==o?(u=m=>{let{slug:p}=m;return!o?.disabledCollections?.includes(p)},e[3]=o,e[4]=u):u=e[4],d=i.filter(u).map(Bp),e[0]=o,e[1]=i,e[2]=d}else d=e[2];l=d}let s,a;e[5]!==r?(s=()=>{if(!r.hasNodes([qe]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return r.registerCommand(Yo,d=>{let u=Ap()||Dp();if(Op(u)){let m=Qe(d);vp(m);let{focus:p}=u,f=p.getNode();El(f)&&f.getTextContentSize()===0&&f.getParentOrThrow().getChildren().filter(h=>El(h)).length>1&&f.remove()}return!0},Fp)},a=[r],e[5]=r,e[6]=s,e[7]=a):(s=e[6],a=e[7]),Pp(s,a);let c;return e[8]!==l?(c=Ip(_l,{enabledCollectionSlugs:l}),e[8]=l,e[9]=c):c=e[9],c};function Bp(t){let{slug:e}=t;return e}var jp=D({nodes:[qe],plugins:[{Component:Tl,position:"normal"}],slashMenu:{groups:[q([{Icon:Xo,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Je,{replace:!1})}}])]},toolbarFixed:{groups:[fe([{ChildComponent:Xo,isActive:({selection:t})=>{if(!Hp(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return ho(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Je,{replace:!1})}}])]}});import{c as Il}from"react/compiler-runtime";import{jsx as ce,jsxs as nf}from"react/jsx-runtime";import{useLexicalComposerContext as lf}from"@lexical/react/LexicalComposerContext.js";import{useScrollInfo as sf,useThrottledEffect as af,useTranslation as cf}from"@payloadcms/ui";import*as be from"react";import{useMemo as uf}from"react";import{c as Wp}from"react/compiler-runtime";import{jsx as Gp}from"react/jsx-runtime";import{mergeRegister as Up}from"@lexical/utils";import{$addUpdateTag as Vp,$getSelection as Kp}from"lexical";import{useEffect as zt,useState as Jo}from"react";var qo="toolbar-popup__button",xt=t=>{let e=Wp(34),{children:o,editor:r,item:n}=t,[i,l]=Jo(!0),[s,a]=Jo(!1),[c,d]=Jo(qo),u=B(),m;e[0]!==r||e[1]!==n||e[2]!==u||e[3]!==s||e[4]!==i?(m=()=>{r.getEditorState().read(()=>{let R=Kp();if(R){if(n.isActive){let N=n.isActive({editor:r,editorConfigContext:u,selection:R});s!==N&&a(N)}if(n.isEnabled){let N=n.isEnabled({editor:r,editorConfigContext:u,selection:R});i!==N&&l(N)}}})},e[0]=r,e[1]=n,e[2]=u,e[3]=s,e[4]=i,e[5]=m):m=e[5];let p=m,f,h;e[6]!==p?(f=()=>{p()},h=[p],e[6]=p,e[7]=f,e[8]=h):(f=e[7],h=e[8]),zt(f,h);let g,E;e[9]!==p?(g=()=>(document.addEventListener("mouseup",p),()=>{document.removeEventListener("mouseup",p)}),E=[p],e[9]=p,e[10]=g,e[11]=E):(g=e[10],E=e[11]),zt(g,E);let L,C;e[12]!==r||e[13]!==p?(L=()=>Up(r.registerUpdateListener(()=>{p()})),C=[r,p],e[12]=r,e[13]=p,e[14]=L,e[15]=C):(L=e[14],C=e[15]),zt(L,C);let x;e[16]!==i||e[17]!==s||e[18]!==n?(x=()=>{d([qo,i===!1?"disabled":"",s?"active":"",n?.key?`${qo}-`+n.key:""].filter(Boolean).join(" "))},e[16]=i,e[17]=s,e[18]=n,e[19]=x):x=e[19];let b;e[20]!==i||e[21]!==s||e[22]!==c||e[23]!==n.key?(b=[i,s,c,n.key],e[20]=i,e[21]=s,e[22]=c,e[23]=n.key,e[24]=b):b=e[24],zt(x,b);let _;e[25]!==i||e[26]!==r||e[27]!==n.onSelect||e[28]!==s?(_=()=>{if(i!==!1)return r.focus(()=>{r.update(()=>{Vp("toolbar")}),n.onSelect?.({editor:r,isActive:s})}),!0},e[25]=i,e[26]=r,e[27]=n.onSelect,e[28]=s,e[29]=_):_=e[29];let T;return e[30]!==c||e[31]!==_||e[32]!==o?(T=Gp("button",{className:c,onClick:_,onMouseDown:zp,type:"button",children:o}),e[30]=c,e[31]=_,e[32]=o,e[33]=T):T=e[33],T};function zp(t){t.preventDefault()}import{c as Sl}from"react/compiler-runtime";import{jsx as ze}from"react/jsx-runtime";import tr,{useEffect as Rl}from"react";import{mergeRegister as ef}from"@lexical/utils";import{useTranslation as tf}from"@payloadcms/ui";import{$getSelection as of}from"lexical";import{jsx as Le,jsxs as wl}from"react/jsx-runtime";import{Button as Zp}from"@payloadcms/ui";import{$addUpdateTag as Xp}from"lexical";import Zt,{useCallback as Yp,useEffect as bt,useMemo as Jp,useRef as er,useState as Xt}from"react";import{createPortal as qp}from"react-dom";var Qo="toolbar-popup__dropdown-item",kl=Zt.createContext(null);function Nl({active:t,children:e,editor:o,enabled:r,Icon:n,item:i,tooltip:l}){let[s,a]=Xt(Qo);bt(()=>{a([Qo,r===!1?"disabled":"",t?"active":"",i?.key?`${Qo}-${i.key}`:""].filter(Boolean).join(" "))},[r,t,s,i.key]);let c=er(null),d=Zt.useContext(kl);if(d===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:u}=d;return bt(()=>{c?.current!=null&&u(c)},[c,u]),Le(Zp,{"aria-label":l,buttonStyle:"none",className:s,disabled:r===!1,icon:n,iconPosition:"left",iconStyle:"none",onClick:()=>{r!==!1&&o.focus(()=>{o.update(()=>{Xp("toolbar")}),i.onSelect?.({editor:o,isActive:t})})},onMouseDown:m=>{m.preventDefault()},ref:c,tooltip:l,type:"button",children:e})}function Qp({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:r}){let[n,i]=Xt(),[l,s]=Xt(),a=Yp(u=>{i(m=>m!=null?[...m,u]:[u])},[i]),c=u=>{if(n==null)return;let{key:m}=u;["ArrowDown","ArrowUp","Escape","Tab"].includes(m)&&u.preventDefault(),m==="Escape"||m==="Tab"?r():m==="ArrowUp"?s(p=>{if(p==null)return n[0];let f=n.indexOf(p)-1;return n[f===-1?n.length-1:f]}):m==="ArrowDown"&&s(p=>p==null?n[0]:n[n.indexOf(p)+1])},d=Jp(()=>({registerItem:a}),[a]);return bt(()=>{n!=null&&l==null&&s(n[0]),l!=null&&l?.current!=null&&l.current.focus()},[n,l]),Le(kl.Provider,{value:d,children:Le("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:c,ref:e,children:t})})}function Ll({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:r=!1,Icon:n,itemsContainerClassNames:i,label:l,stopCloseOnClickSelf:s}){let a=er(null),c=er(null),[d,u]=Xt(!1),m=()=>{u(!1),c?.current!=null&&c.current.focus()};bt(()=>{let f=c.current,h=a.current;if(d&&f!==null&&h!==null){let{left:g,top:E}=f.getBoundingClientRect(),L=window.scrollY||document.documentElement.scrollTop;h.style.top=`${E+L+f.offsetHeight+5}px`,h.style.left=`${Math.min(g-5,window.innerWidth-h.offsetWidth-20)}px`}},[a,c,d]),bt(()=>{let f=c.current;if(f!==null&&d){let h=g=>{let{target:E}=g;s!=null&&a.current!=null&&a.current.contains(E)||f.contains(E)||u(!1)};return document.addEventListener("click",h),()=>{document.removeEventListener("click",h)}}},[a,c,d,s]);let p=qp(Le(Qp,{dropDownRef:a,itemsContainerClassNames:i,onClose:m,children:o}),document.body);return wl(Zt.Fragment,{children:[wl("button",{"aria-label":t,className:e+(d?" active":""),disabled:r,onClick:f=>{f.preventDefault(),u(!d)},onMouseDown:f=>{f.preventDefault()},ref:c,type:"button",children:[n&&Le(n,{}),l&&Le("span",{className:"toolbar-popup__dropdown-label",children:l}),Le("i",{className:"toolbar-popup__dropdown-caret"})]}),d&&Le(Zt.Fragment,{children:p})]})}var or="toolbar-popup__dropdown",rf=t=>{let e=Sl(18),{active:o,anchorElem:r,editor:n,enabled:i,item:l}=t,{i18n:s}=tf(),{fieldProps:a}=B(),{featureClientSchemaMap:c,schemaPath:d}=a;if(l.Component){let f;return e[0]!==l||e[1]!==o||e[2]!==r||e[3]!==n||e[4]!==i?(f=l?.Component&&ze(l.Component,{active:o,anchorElem:r,editor:n,enabled:i,item:l},l.key),e[0]=l,e[1]=o,e[2]=r,e[3]=n,e[4]=i,e[5]=f):f=e[5],f}let u=l.key,m;if(l.label){let f;e[6]!==l||e[7]!==c||e[8]!==s||e[9]!==d?(f=typeof l.label=="function"?l.label({featureClientSchemaMap:c,i18n:s,schemaPath:d}):l.label,e[6]=l,e[7]=c,e[8]=s,e[9]=d,e[10]=f):f=e[10],u=f}u.length>25?m=u.substring(0,25)+"...":m=u;let p;return e[11]!==l||e[12]!==m||e[13]!==o||e[14]!==n||e[15]!==i||e[16]!==u?(p=ze(Nl,{active:o,editor:n,enabled:i,Icon:l?.ChildComponent?ze(l.ChildComponent,{}):void 0,item:l,tooltip:u,children:ze("span",{className:"text",children:m})},l.key),e[11]=l,e[12]=m,e[13]=o,e[14]=n,e[15]=i,e[16]=u,e[17]=p):p=e[17],p},Fe=t=>{let e=Sl(36),{anchorElem:o,classNames:r,editor:n,group:i,Icon:l,itemsContainerClassNames:s,label:a,maxActiveItems:c,onActiveChange:d}=t,u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=[],e[0]=u):u=e[0];let[m,p]=tr.useState(u),f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f=[],e[1]=f):f=e[1];let[h,g]=tr.useState(f),[E,L]=tr.useState(!0),C=B(),{items:x,key:b}=i,_;e[2]!==n||e[3]!==x||e[4]!==c||e[5]!==C||e[6]!==i||e[7]!==d?(_=()=>{n.getEditorState().read(()=>{let P=of();if(!P)return;let z=[],X=[],V=[];for(let W of x)W.isActive&&(!c||z.length<c)&&W.isActive({editor:n,editorConfigContext:C,selection:P})&&(z.push(W.key),X.push(W)),W.isEnabled?W.isEnabled({editor:n,editorConfigContext:C,selection:P})&&V.push(W.key):V.push(W.key);i.isEnabled&&L(i.isEnabled({editor:n,editorConfigContext:C,selection:P})),p(z),g(V),d&&d({activeItems:X})})},e[2]=n,e[3]=x,e[4]=c,e[5]=C,e[6]=i,e[7]=d,e[8]=_):_=e[8];let T=_,R,N;e[9]!==T?(R=()=>{T()},N=[T],e[9]=T,e[10]=R,e[11]=N):(R=e[10],N=e[11]),Rl(R,N);let S,y;e[12]!==n||e[13]!==T?(S=()=>ef(n.registerUpdateListener(()=>{T()})),y=[n,T],e[12]=n,e[13]=T,e[14]=S,e[15]=y):(S=e[14],y=e[15]),Rl(S,y);let w=`${b} dropdown`,k=`${or}-${b}`,v;e[16]!==r?(v=r||[],e[16]=r,e[17]=v):v=e[17];let I;e[18]!==k||e[19]!==v?(I=[or,k,...v].filter(Boolean),e[18]=k,e[19]=v,e[20]=I):I=e[20];let A=I.join(" "),M=!E,F;e[21]!==s?(F=s||[],e[21]=s,e[22]=F):F=e[22];let U;return e[23]!==F||e[24]!==x||e[25]!==m||e[26]!==o||e[27]!==n||e[28]!==h||e[29]!==w||e[30]!==A||e[31]!==M||e[32]!==l||e[33]!==a||e[34]!==b?(U=ze(Ll,{buttonAriaLabel:w,buttonClassName:A,disabled:M,Icon:l,itemsContainerClassNames:[`${or}-items`,...F],label:a,children:x.length?x.map(P=>ze(rf,{active:m.includes(P.key),anchorElem:o,editor:n,enabled:h.includes(P.key),item:P},P.key)):null},b),e[23]=F,e[24]=x,e[25]=m,e[26]=o,e[27]=n,e[28]=h,e[29]=w,e[30]=A,e[31]=M,e[32]=l,e[33]=a,e[34]=b,e[35]=U):U=e[35],U};function df({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&ce(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?ce(xt,{editor:e,item:o,children:ce(o.ChildComponent,{})},o.key):null}function mf(t){let e=Il(18),{anchorElem:o,editor:r,editorConfig:n,group:i,index:l}=t,{i18n:s}=cf(),{fieldProps:a}=B(),{featureClientSchemaMap:c,schemaPath:d}=a,[u,m]=be.useState(void 0),[p,f]=be.useState(void 0),h,g;e[0]!==i?(h=()=>{i?.type==="dropdown"&&i.items.length&&i.ChildComponent?f(()=>i.ChildComponent):f(void 0)},g=[i],e[0]=i,e[1]=h,e[2]=g):(h=e[1],g=e[2]),be.useEffect(h,g);let E;e[3]!==i||e[4]!==c||e[5]!==s||e[6]!==d?(E=b=>{let{activeItems:_}=b;if(!_.length){i?.type==="dropdown"&&i.items.length&&i.ChildComponent?(f(()=>i.ChildComponent),m(void 0)):(f(void 0),m(void 0));return}let T=_[0],R=T.key;T.label&&(R=typeof T.label=="function"?T.label({featureClientSchemaMap:c,i18n:s,schemaPath:d}):T.label),R.length>25&&(R=R.substring(0,25)+"..."),_.length===1?(m(R),f(()=>T.ChildComponent)):(m(s.t("lexical:general:toolbarItemsActive",{count:_.length})),i?.type==="dropdown"&&i.items.length&&i.ChildComponent?f(()=>i.ChildComponent):f(void 0))},e[3]=i,e[4]=c,e[5]=s,e[6]=d,e[7]=E):E=e[7];let L=E,C=`fixed-toolbar__group fixed-toolbar__group-${i.key}`,x;return e[8]!==i||e[9]!==p||e[10]!==o||e[11]!==r||e[12]!==u||e[13]!==L||e[14]!==n.features.toolbarFixed||e[15]!==l||e[16]!==C?(x=nf("div",{className:C,children:[i.type==="dropdown"&&i.items.length?p?ce(Fe,{anchorElem:o,editor:r,group:i,Icon:p,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:u,maxActiveItems:i.maxActiveItems??1,onActiveChange:L}):ce(Fe,{anchorElem:o,editor:r,group:i,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:u,maxActiveItems:i.maxActiveItems??1,onActiveChange:L}):null,i.type==="buttons"&&i.items.length?i.items.map(b=>ce(df,{anchorElem:o,editor:r,item:b},b.key)):null,l<n.features.toolbarFixed?.groups.length-1&&ce("div",{className:"divider"})]},i.key),e[8]=i,e[9]=p,e[10]=o,e[11]=r,e[12]=u,e[13]=L,e[14]=n.features.toolbarFixed,e[15]=l,e[16]=C,e[17]=x):x=e[17],x}function pf({anchorElem:t,clientProps:e,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let i=be.useRef(null),{y:l}=sf(),s=uf(()=>{if(!n||e?.disableIfParentHasFixedToolbar)return null;let c=n.editorContainerRef.current.previousElementSibling;for(;c;){if(c.classList.contains("fixed-toolbar"))return c;c=c.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,n]);return af(()=>{if(!s)return;let a=i.current;if(!a)return;let c=a.getBoundingClientRect(),d=s.getBoundingClientRect();if(!(c.bottom<d.top||c.top>d.bottom))a.classList.remove("fixed-toolbar"),a.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),s.classList.remove("fixed-toolbar"),s.classList.add("fixed-toolbar","fixed-toolbar--hide");else{if(!a.classList.contains("fixed-toolbar--overlapping"))return;a.classList.remove("fixed-toolbar--overlapping"),a.classList.add("fixed-toolbar"),s.classList.remove("fixed-toolbar--hide"),s.classList.add("fixed-toolbar")}},50,[i,s,l]),ce("div",{className:"fixed-toolbar",onFocus:a=>{a.stopPropagation()},ref:i,children:o.isEditable()&&ce(be.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((a,c)=>ce(mf,{anchorElem:t,editor:o,editorConfig:r,group:a,index:c},a.key))})})}var yl=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return yl(t.parentEditor)}return!1},vl=t=>{let e=Il(6),{clientProps:o}=t,[r]=lf(),n=B(),{editorConfig:i}=n,l=o.applyToFocusedEditor&&n.focusedEditor?.editor||r,s=o.applyToFocusedEditor&&n.focusedEditor?.editorConfig||i,a,c;if(e[0]!==n||e[1]!==o?.disableIfParentHasFixedToolbar||e[2]!==s||e[3]!==l){c=Symbol.for("react.early_return_sentinel");e:{let d=yl(n);if(o?.disableIfParentHasFixedToolbar&&d){c=null;break e}if(!s?.features?.toolbarFixed?.groups?.length){c=null;break e}a=ce(pf,{anchorElem:document.body,editor:l,editorConfig:s,parentWithFixedToolbar:d})}e[0]=n,e[1]=o?.disableIfParentHasFixedToolbar,e[2]=s,e[3]=l,e[4]=a,e[5]=c}else a=e[4],c=e[5];return c!==Symbol.for("react.early_return_sentinel")?c:a};var ff=D({plugins:[{Component:vl,position:"aboveContainer"}]});import{c as Al}from"react/compiler-runtime";import{jsx as me,jsxs as Ol}from"react/jsx-runtime";import{useLexicalComposerContext as hf}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Fl}from"@lexical/utils";import{$getSelection as $l,$isRangeSelection as Ml,$isTextNode as gf,COMMAND_PRIORITY_LOW as Cf,SELECTION_CHANGE_COMMAND as xf}from"lexical";import{useCallback as Jt,useEffect as _t,useRef as Dl,useState as bf}from"react";import*as qt from"react";import{createPortal as _f}from"react-dom";function rr(t,e){let o=t.getRangeAt(0),r;if(t.anchorNode===e){let n=e;for(;n.firstElementChild!=null;)n=n.firstElementChild;r=n.getBoundingClientRect()}else r=o.getBoundingClientRect();return r}function Yt(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:r=0,floatingElem:n,horizontalOffset:i=32,horizontalPosition:l="left",specialHandlingForCaret:s=!1,targetRect:a,verticalGap:c=10}=t,d=o.parentElement;if(a===null||d==null){n.style.opacity="0",n.style.transform="translate(-10000px, -10000px)";return}let u=n.getBoundingClientRect(),m=o.getBoundingClientRect(),p=d.getBoundingClientRect(),f=a.top-u.height-c,h=a.left-i;l==="center"&&(h=a.left+a.width/2-u.width/2);let g=0;return!e&&f<p.top&&!s&&(g=u.height+a.height+c*2,f+=g),l==="center"?h+u.width>p.right?h=p.right-u.width-i:h<p.left&&(h=p.left+i):h+u.width>p.right&&(h=p.right-u.width-i),h-=m.left,n.style.opacity="1",s&&r!==0?(f-=m.bottom-r+u.height-3,n.style.transform=`translate(${h}px, ${f}px) rotate(180deg)`):(f-=m.top,n.style.transform=`translate(${h}px, ${f}px)`),g}function Ef({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&me(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?me(xt,{editor:e,item:o,children:me(o.ChildComponent,{})},o.key):null}function Tf(t){let e=Al(14),{anchorElem:o,editor:r,group:n,index:i}=t,{editorConfig:l}=B(),[s,a]=qt.useState(),c,d;e[0]!==n?(c=()=>{n?.type==="dropdown"&&n.items.length&&n.ChildComponent?a(()=>n.ChildComponent):a(void 0)},d=[n],e[0]=n,e[1]=c,e[2]=d):(c=e[1],d=e[2]),qt.useEffect(c,d);let u;e[3]!==n?(u=h=>{let{activeItems:g}=h;if(!g.length){n?.type==="dropdown"&&n.items.length&&n.ChildComponent?a(()=>n.ChildComponent):a(void 0);return}let E=g[0];a(()=>E.ChildComponent)},e[3]=n,e[4]=u):u=e[4];let m=u,p=`inline-toolbar-popup__group inline-toolbar-popup__group-${n.key}`,f;return e[5]!==n||e[6]!==s||e[7]!==o||e[8]!==r||e[9]!==m||e[10]!==l.features.toolbarInline||e[11]!==i||e[12]!==p?(f=Ol("div",{className:p,children:[n.type==="dropdown"&&n.items.length?s?me(Fe,{anchorElem:o,editor:r,group:n,Icon:s,maxActiveItems:n.maxActiveItems??1,onActiveChange:m}):me(Fe,{anchorElem:o,editor:r,group:n,maxActiveItems:n.maxActiveItems??1,onActiveChange:m}):null,n.type==="buttons"&&n.items.length?n.items.map(h=>me(Ef,{anchorElem:o,editor:r,item:h},h.key)):null,i<l.features.toolbarInline?.groups.length-1&&me("div",{className:"divider"})]},n.key),e[5]=n,e[6]=s,e[7]=o,e[8]=r,e[9]=m,e[10]=l.features.toolbarInline,e[11]=i,e[12]=p,e[13]=f):f=e[13],f}function wf({anchorElem:t,editor:e}){let o=Dl(null),r=Dl(null),{editorConfig:n}=B(),i=Jt(()=>{if(o?.current){let c=o.current.style.opacity==="0",d=o.current.style.pointerEvents==="none";c||(o.current.style.opacity="0"),d||(o.current.style.pointerEvents="none")}},[o]),l=Jt(c=>{if(o?.current&&(c.buttons===1||c.buttons===3)){let d=o.current.style.opacity==="0",u=o.current.style.pointerEvents==="none";if(!d||!u){let m=c.clientX,p=c.clientY,f=document.elementFromPoint(m,p);o.current.contains(f)||i()}}},[i]),s=Jt(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);_t(()=>(document.addEventListener("mousemove",l),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",s)}),[o,l,s]);let a=Jt(()=>{let c=$l(),d=window.getSelection();if(o.current===null)return;let u=t.querySelector(":scope > .link-editor"),m=u!==null&&"style"in u&&u?.style?.opacity==="1",p=e.getRootElement();if(c!==null&&d!==null&&!d.isCollapsed&&p!==null&&p.contains(d.anchorNode)){let f=rr(d,p),h=Yt({alwaysDisplayOnTop:m,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});r.current&&Yt({anchorElem:o.current,anchorFlippedOffset:h,floatingElem:r.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else i()},[e,i,t]);return _t(()=>{let c=t.parentElement,d=()=>{e.getEditorState().read(()=>{a()})};return window.addEventListener("resize",d),c&&c.addEventListener("scroll",d),()=>{window.removeEventListener("resize",d),c&&c.removeEventListener("scroll",d)}},[e,a,t]),_t(()=>(e.getEditorState().read(()=>{a()}),Fl(e.registerUpdateListener(({editorState:c})=>{c.read(()=>{a()})}),e.registerCommand(xf,()=>(a(),!1),Cf))),[e,a]),Ol("div",{className:"inline-toolbar-popup",ref:o,children:[me("div",{className:"caret",ref:r}),n?.features&&n.features?.toolbarInline?.groups.map((c,d)=>me(Tf,{anchorElem:t,editor:e,group:c,index:d},c.key))]})}function kf(t,e){let o=Al(12),[r,n]=bf(!1),i;o[0]!==t?(i=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let m=$l(),p=window.getSelection(),f=t.getRootElement();if(p!==null&&(!Ml(m)||f===null||!f.contains(p.anchorNode))){n(!1);return}if(!Ml(m))return;if(m.getTextContent()!==""){let g=m.getNodes(),E=!1;for(let L of g)if(gf(L)){n(!0),E=!0;break}E||n(!1)}else n(!1);let h=m.getTextContent().replace(/\n/g,"");if(!m.isCollapsed()&&h===""){n(!1);return}})},o[0]=t,o[1]=i):i=o[1];let l=i,s,a;o[2]!==l?(s=()=>(document.addEventListener("selectionchange",l),document.addEventListener("mouseup",l),()=>{document.removeEventListener("selectionchange",l),document.removeEventListener("mouseup",l)}),a=[l],o[2]=l,o[3]=s,o[4]=a):(s=o[3],a=o[4]),_t(s,a);let c,d;if(o[5]!==t||o[6]!==l?(c=()=>Fl(t.registerUpdateListener(()=>{l()}),t.registerRootListener(()=>{t.getRootElement()===null&&n(!1)})),d=[t,l],o[5]=t,o[6]=l,o[7]=c,o[8]=d):(c=o[7],d=o[8]),_t(c,d),!r||!t.isEditable())return null;let u;return o[9]!==e||o[10]!==t?(u=_f(me(wf,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=u):u=o[11],u}var Pl=t=>{let{anchorElem:e}=t,[o]=hf();return kf(o,e)};var Nf=D({plugins:[{Component:Pl,position:"floatingAnchorElem"}]});import{TableCellNode as dh,TableNode as mh,TableRowNode as ph}from"@lexical/table";import{jsx as Bl}from"react/jsx-runtime";import"react";var nr=()=>Bl("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Bl("path",{clipRule:"evenodd",d:"M5.33333 4.5C4.8731 4.5 4.5 4.8731 4.5 5.33333V7.5H9.5V4.5H5.33333ZM5.33333 3.5C4.32081 3.5 3.5 4.32081 3.5 5.33333V14.6667C3.5 15.6792 4.32081 16.5 5.33333 16.5H14.6667C15.6792 16.5 16.5 15.6792 16.5 14.6667V5.33333C16.5 4.32081 15.6792 3.5 14.6667 3.5H5.33333ZM10.5 4.5V7.5H15.5V5.33333C15.5 4.8731 15.1269 4.5 14.6667 4.5H10.5ZM15.5 8.5H10.5V11.5H15.5V8.5ZM15.5 12.5H10.5V15.5H14.6667C15.1269 15.5 15.5 15.1269 15.5 14.6667V12.5ZM9.5 15.5V12.5H4.5V14.6667C4.5 15.1269 4.8731 15.5 5.33333 15.5H9.5ZM4.5 11.5H9.5V8.5H4.5V11.5Z",fill:"currentColor",fillRule:"evenodd"})});import{$createTableCellNode as Af,$createTableNode as Of,$createTableRowNode as Ff,$isTableCellNode as zl,$isTableNode as ir,$isTableRowNode as lr,TableCellHeaderStates as Qt,TableCellNode as $f,TableNode as Pf,TableRowNode as Bf}from"@lexical/table";import{$isParagraphNode as Hf,$isTextNode as jf}from"lexical";var Hl=/^[\t ]*$/,Lf=/^(\s*)(\d+)\.\s/,Rf=/^(\s*)[-*+]\s/,Sf=/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,jl=/^(#{1,6})\s/,If=/^>\s/,Wl=/^[ \t]*```(\w+)?/,Gl=/[ \t]*```$/,yf=/^[ \t]*```[^`]+(?:(?:`{1,2}|`{4,})[^`]+)*```(?:[^`]|$)/,vf=/^\|(.+)\|\s?$/,Mf=/^(\| ?:?-*:? ?)+\|\s?$/,Ul=/^[ \t]*<[a-z_][\w-]*(?:\s[^<>]*)?\/?>/i,Vl=/^[ \t]*<\/[a-z_][\w-]*\s*>/i;function Df(t,e=!1){let o=t.split(`
|
|
36
|
+
`),r=!1,n=[];for(let i=0;i<o.length;i++){let l=o[i],s=n[n.length-1];if(yf.test(l)){n.push(l);continue}if((Wl.test(l)&&!r||Gl.test(l)&&r)&&(r=!r),Wl.test(l)||Gl.test(l)){n.push(l);continue}if(r){n.push(l);continue}Hl.test(l)||Hl.test(s)||!s||jl.test(s)||jl.test(l)||If.test(l)||Lf.test(l)||Rf.test(l)||Sf.test(l)||vf.test(l)||Mf.test(l)||!e||Ul.test(l)||Vl.test(l)||Ul.test(s)||Vl.test(s)?n.push(l):n[n.length-1]=s+" "+l.trim()}return n.join(`
|
|
37
|
+
`)}function Kl(t,e=wr,o,r=!1,n=!0){let i=r?t:Df(t,n);return kr(i,e,o)}var Xl=/^\|(.+)\|\s?$/,Wf=/^(\| ?:?-*:? ?)+\|\s?$/,Yl=({allTransformers:t})=>({type:"element",dependencies:[Pf,Bf,$f],export:e=>{if(!ir(e))return null;let o=[];for(let r of e.getChildren()){let n=[];if(!lr(r))continue;let i=!1;for(let l of r.getChildren())zl(l)&&(n.push(Nr(t,l).replace(/\n/g,"\\n")),l.__headerState===Qt.ROW&&(i=!0));o.push(`| ${n.join(" | ")} |`),i&&o.push(`| ${n.map(l=>"---").join(" | ")} |`)}return o.join(`
|
|
38
|
+
`)},regExp:Xl,replace:(e,o,r)=>{if(Wf.test(r[0])){let d=e.getPreviousSibling();if(!d||!ir(d))return;let u=d.getChildren(),m=u[u.length-1];if(!m||!lr(m))return;m.getChildren().forEach(p=>{zl(p)&&p.setHeaderStyles(Qt.ROW,Qt.ROW)}),e.remove();return}let n=Zl(r[0],t);if(n==null)return;let i=[n],l=e.getPreviousSibling(),s=n.length;for(;l&&!(!Hf(l)||l.getChildrenSize()!==1);){let d=l.getFirstChild();if(!jf(d))break;let u=Zl(d.getTextContent(),t);if(u==null)break;s=Math.max(s,u.length),i.unshift(u);let m=l.getPreviousSibling();l.remove(),l=m}let a=Of();for(let d of i){let u=Ff();a.append(u);for(let m=0;m<s;m++)u.append(m<d.length?d[m]:Jl("",t))}let c=e.getPreviousSibling();ir(c)&&Gf(c)===s?(c.append(...a.getChildren()),e.remove()):e.replace(a),a.selectEnd()}});function Gf(t){let e=t.getFirstChild();return lr(e)?e.getChildrenSize():0}var Jl=(t,e)=>{t=t.replace(/\\n/g,`
|
|
39
|
+
`);let o=Af(Qt.NO_STATUS);return Kl(t,e,o),o},Zl=(t,e)=>{let o=t.match(Xl);return!o||!o[1]?null:o[1].split("|").map(r=>Jl(r,e))};import{c as Vf}from"react/compiler-runtime";import{jsx as j,jsxs as _e}from"react/jsx-runtime";import{useLexicalComposerContext as ts}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Kf}from"@lexical/react/useLexicalEditable";import{$deleteTableColumn__EXPERIMENTAL as zf,$deleteTableRow__EXPERIMENTAL as Zf,$getNodeTriplet as Xf,$getTableCellNodeFromLexicalNode as Yf,$getTableColumnIndexFromTableCellNode as Jf,$getTableNodeFromLexicalNodeOrThrow as Et,$getTableRowIndexFromTableCellNode as qf,$insertTableColumn__EXPERIMENTAL as Qf,$insertTableRow__EXPERIMENTAL as e1,$isTableCellNode as eo,$isTableRowNode as Ql,$isTableSelection as oo,$unmergeCell as t1,getTableObserverFromTableElement as o1,TableCellHeaderStates as Re,TableCellNode as r1}from"@lexical/table";import{useScrollInfo as n1}from"@payloadcms/ui";import{$createParagraphNode as i1,$getRoot as l1,$getSelection as ro,$isElementNode as s1,$isParagraphNode as os,$isRangeSelection as cr,$isTextNode as a1}from"lexical";import*as ur from"react";import{useCallback as pe,useEffect as $e,useRef as to,useState as Ze}from"react";import{createPortal as rs}from"react-dom";import{jsx as sr,jsxs as Uf}from"react/jsx-runtime";import"react";var ql=()=>Uf("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[sr("path",{d:"M5 11C5.55228 11 6 10.5523 6 10C6 9.44772 5.55228 9 5 9C4.44772 9 4 9.44772 4 10C4 10.5523 4.44772 11 5 11Z",fill:"currentColor"}),sr("path",{d:"M10 11C10.5523 11 11 10.5523 11 10C11 9.44772 10.5523 9 10 9C9.44772 9 9 9.44772 9 10C9 10.5523 9.44772 11 10 11Z",fill:"currentColor"}),sr("path",{d:"M15 11C15.5523 11 16 10.5523 16 10C16 9.44772 15.5523 9 15 9C14.4477 9 14 9.44772 14 10C14 10.5523 14.4477 11 15 11Z",fill:"currentColor"})]});function ar(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function c1(){let t=ro();if(cr(t)&&!t.isCollapsed()||oo(t)&&!t.anchor.is(t.focus)||!cr(t)&&!oo(t))return!1;let[e]=Xf(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function es(t){if(t.getChildrenSize()!==1)return!1;let e=t.getFirstChildOrThrow();return!(!os(e)||!e.isEmpty())}function u1(t){let e=t.getLastDescendant();a1(e)?e.select():s1(e)?e.selectEnd():e!==null&&e.selectNext()}function d1({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[i]=ts(),l=to(null),[s,a]=Ze(n),[c,d]=Ze({columns:1,rows:1}),[u,m]=Ze(!1),[p,f]=Ze(!1),{y:h}=n1();$e(()=>i.registerMutationListener(r1,w=>{w.get(s.getKey())==="updated"&&i.getEditorState().read(()=>{a(s.getLatest())})},{skipInitialization:!0}),[i,s]),$e(()=>{i.getEditorState().read(()=>{let w=ro();if(oo(w)){let k=ar(w);d(ar(w)),m(k.columns>1||k.rows>1)}f(c1())})},[i]),$e(()=>{let w=e.current,k=l.current,v=i.getRootElement();if(w!=null&&k!=null&&v!=null){let I=v.getBoundingClientRect(),A=w.getBoundingClientRect();k.style.opacity="1";let M=k.getBoundingClientRect(),F=5,U=A.right+F;if(U+M.width>window.innerWidth||U+M.width>I.right){let z=A.left-M.width-F;U=(z<0?F:z)+window.pageXOffset}k.style.left=`${U+window.pageXOffset}px`;let P=A.top;if(P+M.height>window.innerHeight){let z=A.bottom-M.height;P=(z<0?F:z)+window.pageYOffset}k.style.top=`${P}px`}},[e,l,i,h]),$e(()=>{function w(k){l.current!=null&&e.current!=null&&!l.current.contains(k.target)&&!e.current.contains(k.target)&&r(!1)}return window.addEventListener("click",w),()=>window.removeEventListener("click",w)},[r,e]);let g=pe(()=>{i.update(()=>{if(s.isAttached()){let k=Et(s),v=i.getElementByKey(k.getKey());if(!v)throw new Error("Expected to find tableElement in DOM");let I=o1(v);I!==null&&I.clearHighlight(),k.markDirty(),a(s.getLatest())}l1().selectStart()})},[i,s]),E=()=>{i.update(()=>{let w=ro();if(oo(w)){let{columns:k,rows:v}=ar(w),I=w.getNodes(),A=null;for(let M=0;M<I.length;M++){let F=I[M];if(eo(F))if(A===null){F.setColSpan(k).setRowSpan(v),A=F;let U=es(F),P;U&&os(P=F.getFirstChild())&&P.remove()}else eo(A)&&(es(F)||A.append(...F.getChildren()),F.remove())}A!==null&&(A.getChildrenSize()===0&&A.append(i1()),u1(A)),o()}})},L=()=>{i.update(()=>{t1()})},C=pe(w=>{i.update(()=>{e1(w),o()})},[i,o]),x=pe(w=>{i.update(()=>{for(let k=0;k<c.columns;k++)Qf(w);o()})},[i,o,c.columns]),b=pe(()=>{i.update(()=>{Zf(),o()})},[i,o]),_=pe(()=>{i.update(()=>{Et(s).remove(),g(),o()})},[i,s,g,o]),T=pe(()=>{i.update(()=>{zf(),o()})},[i,o]),R=pe(()=>{i.update(()=>{let w=Et(s),k=qf(s),v=w.getChildren();if(k>=v.length||k<0)throw new Error("Expected table cell to be inside of table row.");let I=v[k];if(!Ql(I))throw new Error("Expected table row");let A=s.getHeaderStyles()^Re.ROW;I.getChildren().forEach(M=>{if(!eo(M))throw new Error("Expected table cell");M.setHeaderStyles(A,Re.ROW)}),g(),o()})},[i,s,g,o]),N=pe(()=>{i.update(()=>{let w=Et(s),k=Jf(s),v=w.getChildren(),I=Math.max(...v.map(M=>M.getChildren().length));if(k>=I||k<0)throw new Error("Expected table cell to be inside of table row.");let A=s.getHeaderStyles()^Re.COLUMN;for(let M=0;M<v.length;M++){let F=v[M];if(!Ql(F))throw new Error("Expected table row");let U=F.getChildren();if(k>=U.length)continue;let P=U[k];if(!eo(P))throw new Error("Expected table cell");P.setHeaderStyles(A,Re.COLUMN)}g(),o()})},[i,s,g,o]),S=pe(()=>{i.update(()=>{if(s.isAttached()){let w=Et(s);w&&w.setRowStriping(!w.getRowStriping())}g(),o()})},[i,s,g,o]),y=null;return t&&(u?y=j("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>E(),type:"button",children:"Merge cells"}):p&&(y=j("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>L(),type:"button",children:"Unmerge cells"}))),rs(_e("div",{className:"table-action-menu-dropdown",onClick:w=>{w.stopPropagation()},ref:l,children:[y?_e(ur.Fragment,{children:[y,j("hr",{})]}):null,j("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>S(),type:"button",children:j("span",{className:"text",children:"Toggle Row Striping"})}),j("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>C(!1),type:"button",children:_e("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," above"]})}),j("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>C(!0),type:"button",children:_e("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," below"]})}),j("hr",{}),j("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>x(!1),type:"button",children:_e("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","left"]})}),j("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>x(!0),type:"button",children:_e("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","right"]})}),j("hr",{}),j("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>T(),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:()=>_(),type:"button",children:j("span",{className:"text",children:"Delete table"})}),j("hr",{}),j("button",{className:"item",onClick:()=>R(),type:"button",children:_e("span",{className:"text",children:[(s.__headerState&Re.ROW)===Re.ROW?"Remove":"Add"," ","row header"]})}),j("button",{className:"item","data-test-id":"table-column-header",onClick:()=>N(),type:"button",children:_e("span",{className:"text",children:[(s.__headerState&Re.COLUMN)===Re.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function m1({anchorElem:t,cellMerge:e}){let[o]=ts(),r=to(null),n=to(null),[i,l]=Ze(!1),[s,a]=Ze(null),c=pe(()=>{let u=r.current,m=ro(),p=window.getSelection(),f=document.activeElement;if(m==null||u==null){a(null);return}let h=o.getRootElement();if(cr(m)&&h!==null&&p!==null&&h.contains(p.anchorNode)){let g=Yf(m.anchor.getNode());if(g==null){a(null);return}if(o.getElementByKey(g.getKey())==null){a(null);return}a(g)}else f||a(null)},[o]);$e(()=>o.registerUpdateListener(()=>{o.getEditorState().read(()=>{c()})})),$e(()=>{let u=r.current;if(u!=null&&s!=null){let m=o.getElementByKey(s.getKey());if(m!=null){let p=m.getBoundingClientRect(),f=u.getBoundingClientRect(),h=t.getBoundingClientRect(),g=p.top-h.top+4,E=p.right-f.width-10-h.left;u.style.opacity="1",u.style.transform=`translate(${E}px, ${g}px)`}else u.style.opacity="0",u.style.transform="translate(-10000px, -10000px)"}},[r,s,o,t]);let d=to(s);return $e(()=>{d.current!==s&&l(!1),d.current=s},[d,s]),j("div",{className:"table-cell-action-button-container",ref:r,children:s!=null&&_e(ur.Fragment,{children:[j("button",{className:"table-cell-action-button",onClick:u=>{u.stopPropagation(),l(!i)},ref:n,type:"button",children:j(ql,{})}),i&&j(d1,{cellMerge:e,contextRef:n,onClose:()=>l(!1),setIsMenuOpen:l,tableCellNode:s})]})})}var ns=t=>{let e=Vf(3),{anchorElem:o}=t,r=Kf(),n;return e[0]!==r||e[1]!==o?(n=rs(r?j(m1,{anchorElem:o??document.body,cellMerge:!0}):null,o??document.body),e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{c as p1}from"react/compiler-runtime";import{jsx as io,jsxs as f1}from"react/jsx-runtime";import{useLexicalComposerContext as h1}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as g1}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as C1,$getTableNodeFromLexicalNodeOrThrow as dr,$getTableRowIndexFromTableCellNode as x1,$isTableCellNode as is,$isTableRowNode as b1,getDOMCellFromTarget as _1,TableNode as E1}from"@lexical/table";import{calculateZoomLevel as ls}from"@lexical/utils";import{$getNearestNodeFromDOMNode as mr}from"lexical";import*as as from"react";import{useCallback as Tt,useEffect as pr,useRef as no,useState as wt}from"react";import{createPortal as T1}from"react-dom";var w1=33,ss=92;function k1({editor:t}){let e=no(null),o=no(null),r=no(null),n=B(),i=no(null),[l,s]=wt(null),[a,c]=wt(null),[d,u]=wt(!1),[m,p]=wt(null),f=Tt(()=>{c(null),e.current=null,p(null),i.current=null,r.current=null},[]),h=N=>(N.buttons&1)===1;pr(()=>t.registerNodeTransform(E1,N=>{if(N.getColWidths())return N;let S=N.getColumnCount(),y=ss;return N.setColWidths(Array(S).fill(y)),N}),[t]),pr(()=>{let N=k=>{setTimeout(()=>{let v=k.target;if(m){s({x:k.clientX,y:k.clientY});return}if(u(h(k)),!(o.current&&o.current.contains(v))&&e.current!==v){e.current=v;let I=_1(v);I&&a!==I?t.update(()=>{let A=mr(I.elem);if(!A)throw new Error("TableCellResizer: Table cell node not found.");let M=dr(A),F=t.getElementByKey(M.getKey());if(!F)throw new Error("TableCellResizer: Table element not found.");e.current=v,r.current=F.getBoundingClientRect(),c(I)}):I==null&&f()}},0)},S=k=>{setTimeout(()=>{u(!0)},0)},y=k=>{setTimeout(()=>{u(!1)},0)},w=t.registerRootListener((k,v)=>{v?.removeEventListener("mousemove",N),v?.removeEventListener("mousedown",S),v?.removeEventListener("mouseup",y),k?.addEventListener("mousemove",N),k?.addEventListener("mousedown",S),k?.addEventListener("mouseup",y)});return()=>{w()}},[a,m,t,f]);let g=N=>N==="bottom",E=Tt(N=>{if(!a)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let S=mr(a.elem);if(!is(S))throw new Error("TableCellResizer: Table cell node not found.");let y=dr(S),w=x1(S)+S.getRowSpan()-1,k=y.getChildren();if(w>=k.length||w<0)throw new Error("Expected table cell to be inside of table row.");let v=k[w];if(!b1(v))throw new Error("Expected table row");let I=v.getHeight();if(I===void 0){let M=v.getChildren();I=Math.min(...M.map(F=>L(F,t)??1/0))}let A=Math.max(I+N,w1);v.setHeight(A)},{tag:"skip-scroll-into-view"})},[a,t]),L=(N,S)=>S.getElementByKey(N.getKey())?.clientHeight,C=(N,S)=>{for(let y=0;y<S.length;y++)for(let w=0;w<S[y].length;w++)if(S[y][w].cell===N)return w},x=Tt(N=>{if(!a)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let S=mr(a.elem);if(!is(S))throw new Error("TableCellResizer: Table cell node not found.");let y=dr(S),[w]=C1(y,null,null),k=C(S,w);if(k===void 0)throw new Error("TableCellResizer: Table column not found.");let v=y.getColWidths();if(!v)return;let I=v[k];if(I===void 0)return;let A=[...v],M=Math.max(I+N,ss);A[k]=M,y.setColWidths(A)},{tag:"skip-scroll-into-view"})},[a,t]),b=Tt(N=>{let S=y=>{if(y.preventDefault(),y.stopPropagation(),!a)throw new Error("TableCellResizer: Expected active cell.");if(i.current){let{x:w,y:k}=i.current;if(a===null)return;let v=ls(y.target);if(g(N)){let I=(y.clientY-k)/v;E(I)}else{let I=(y.clientX-w)/v;x(I)}f(),document.removeEventListener("mouseup",S)}};return S},[a,f,x,E]),_=Tt(N=>S=>{if(S.preventDefault(),S.stopPropagation(),!a)throw new Error("TableCellResizer: Expected active cell.");i.current={x:S.clientX,y:S.clientY},s(i.current),p(N),document.addEventListener("mouseup",b(N))},[a,b]),[T,R]=wt({bottom:null,left:null,right:null,top:null});return pr(()=>{if(a){let{height:N,left:S,top:y,width:w}=a.elem.getBoundingClientRect(),k=ls(a.elem),v=10,I={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${v}px`,left:`${window.scrollX+S}px`,top:`${window.scrollY+y+N-v/2}px`,width:`${w}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${N}px`,left:`${window.scrollX+S+w-v/2}px`,top:`${window.scrollY+y}px`,width:`${v}px`}},A=r.current;m&&l&&A&&(g(m)?(I[m].left=`${window.scrollX+A.left}px`,I[m].top=`${window.scrollY+l.y/k}px`,I[m].height="3px",I[m].width=`${A.width}px`):(I[m].top=`${window.scrollY+A.top}px`,I[m].left=`${window.scrollX+l.x/k}px`,I[m].width="3px",I[m].height=`${A.height}px`),I[m].backgroundColor="#adf"),R(I)}else R({bottom:null,left:null,right:null,top:null})},[a,m,l]),io("div",{ref:o,children:a!=null&&!d&&f1(as.Fragment,{children:[io("div",{className:`${n.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:_("right"),style:T.right||void 0}),io("div",{className:`${n.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:_("bottom"),style:T.bottom||void 0})]})})}var cs=()=>{let t=p1(3),[e]=h1(),o=g1(),r,n;return t[0]!==o||t[1]!==e?(n=o?T1(io(k1,{editor:e}),document.body):null,t[0]=o,t[1]=e,t[2]=n):n=t[2],r=n,r};import{c as M1}from"react/compiler-runtime";import{jsx as fr,jsxs as D1,Fragment as A1}from"react/jsx-runtime";import{useLexicalComposerContext as Cs}from"@lexical/react/LexicalComposerContext";import{$getTableColumnIndexFromTableCellNode as O1,$getTableRowIndexFromTableCellNode as F1,$insertTableColumn__EXPERIMENTAL as $1,$insertTableRow__EXPERIMENTAL as P1,$isTableCellNode as B1,$isTableNode as ms,TableNode as H1}from"@lexical/table";import{$findMatchingParent as j1,mergeRegister as W1}from"@lexical/utils";import{$getNearestNodeFromDOMNode as ps}from"lexical";import{useEffect as fs,useMemo as G1,useRef as hs,useState as lo}from"react";import"react";import{createPortal as U1}from"react-dom";import{c as I1}from"react/compiler-runtime";import{useEffect as y1,useRef as v1}from"react";var N1="Expected a function",L1=Math.max,R1=Math.min;function S1(t,e,o){let r,n,i=0,l,s=!1,a=!1,c,d,u,m=!0;if(typeof t!="function")throw new TypeError(N1);e=e||0,typeof o=="object"&&(s=!!o.leading,a="maxWait"in o,c=a?L1(o.maxWait||0,e):c,m="trailing"in o?!!o.trailing:m);function p(_){let T=r,R=l;return r=l=void 0,i=_,d=t.apply(R,T),d}function f(_){return i=_,u=setTimeout(E,e),s?p(_):d}function h(_){let T=_-n,R=_-i,N=e-T;return a?R1(N,c-R):N}function g(_){let T=_-n,R=_-i;return n===void 0||T>=e||T<0||a&&R>=c}function E(){let _=Date.now();if(g(_))return L(_);u=setTimeout(E,h(_))}function L(_){return u=void 0,m&&r?p(_):(r=l=void 0,d)}function C(){u!==void 0&&clearTimeout(u),i=0,r=n=l=u=void 0}function x(){return u===void 0?d:L(Date.now())}function b(){let _=Date.now(),T=g(_);if(r=arguments,l=this,n=_,T){if(u===void 0)return f(n);if(a)return clearTimeout(u),u=setTimeout(E,e),p(n)}return u===void 0&&(u=setTimeout(E,e)),d}return b.cancel=C,b.flush=x,b}var us=S1;function ds(t,e,o){let r=I1(6),n=v1(null),i,l;r[0]!==t||r[1]!==e||r[2]!==o?(i=()=>(n.current=us(t,e,{maxWait:o}),()=>{n.current?.cancel()}),l=[t,e,o],r[0]=t,r[1]=e,r[2]=o,r[3]=i,r[4]=l):(i=r[3],l=r[4]),y1(i,l);let s;return r[5]===Symbol.for("react.memo_cache_sentinel")?(s=(...c)=>{let d=c;n.current&&n.current(...d)},r[5]=s):s=r[5],s}var gs=20;function V1({anchorElem:t}){let[e]=Cs(),o=B(),[r,n]=lo(!1),[i,l]=lo(!1),[s,a]=lo(!1),[c,d]=lo({}),u=hs(new Set),m=hs(null),p=ds(g=>{let{isOutside:E,tableDOMNode:L}=K1(g,o.editorConfig?.lexical);if(E){n(!1),l(!1);return}if(!L)return;m.current=L;let C=null,x=null,b=null;if(e.update(()=>{let _=ps(L);if(B1(_)){let T=j1(_,R=>ms(R));if(!ms(T))return;if(b=e.getElementByKey(T?.getKey()),b){let R=T.getChildrenSize(),N=T.getChildAtIndex(0)?.getChildrenSize(),S=F1(_),y=O1(_);S===R-1?C=_:y===N-1&&(x=_)}}}),b){let{bottom:_,height:T,left:R,right:N,width:S,y}=b.getBoundingClientRect(),{left:w,y:k}=t.getBoundingClientRect();C?(l(!1),n(!0),d({height:gs,left:R-w,top:_-k+5,width:S})):x&&(l(!0),n(!1),d({height:T,left:N-w+5,top:y-k,width:gs}))}},50,250),f=G1(()=>new ResizeObserver(()=>{n(!1),l(!1)}),[]);fs(()=>{if(s)return document.addEventListener("mousemove",p),()=>{n(!1),l(!1),document.removeEventListener("mousemove",p)}},[s,p]),fs(()=>W1(e.registerMutationListener(H1,g=>{e.getEditorState().read(()=>{for(let[E,L]of g){let C=e.getElementByKey(E);switch(L){case"created":u.current.add(E),a(u.current.size>0),C&&f.observe(C);break;case"destroyed":u.current.delete(E),a(u.current.size>0),f.disconnect(),u.current.forEach(x=>{let b=e.getElementByKey(x);b&&f.observe(b)});break;default:break}}})},{skipInitialization:!1})),[e,f]);let h=g=>{e.update(()=>{m.current&&(ps(m.current)?.selectEnd(),g?(P1(),n(!1)):($1(),l(!1)))})};return e?.isEditable()?D1(A1,{children:[r&&fr("button",{className:o.editorConfig.lexical.theme.tableAddRows,onClick:()=>h(!0),style:{...c},type:"button"}),i&&fr("button",{className:o.editorConfig.lexical.theme.tableAddColumns,onClick:()=>h(!1),style:{...c},type:"button"})]}):null}function K1(t,e){let o=t.target;if(o&&o instanceof HTMLElement){let r=o.closest(`td.${e.theme.tableCell}, th.${e.theme.tableCell}`);return{isOutside:!(r||o.closest(`button.${e.theme.tableAddRows}`)||o.closest(`button.${e.theme.tableAddColumns}`)||o.closest(`div.${e.theme.tableCellResizer}`)),tableDOMNode:r}}else return{isOutside:!0,tableDOMNode:null}}function xs(t){let e=M1(2),{anchorElem:o}=t,r=o===void 0?document.body:o,[n]=Cs();if(!n?.isEditable())return null;let i;return e[0]!==r?(i=U1(fr(V1,{anchorElem:r}),r),e[0]=r,e[1]=i):i=e[1],i}import{c as z1}from"react/compiler-runtime";import{jsx as hr,jsxs as Z1}from"react/jsx-runtime";import{useLexicalComposerContext as X1}from"@lexical/react/LexicalComposerContext";import{TablePlugin as Y1}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as J1,TableNode as q1}from"@lexical/table";import{mergeRegister as Q1}from"@lexical/utils";import{formatDrawerSlug as eh,useEditDepth as th}from"@payloadcms/ui";import{$getSelection as oh,$isRangeSelection as rh,COMMAND_PRIORITY_EDITOR as nh,createCommand as ih}from"lexical";import{createContext as lh,useContext as sh,useEffect as ah,useMemo as ch,useState as uh}from"react";import*as bs from"react";var so=ih("OPEN_EMBED_DRAWER_COMMAND"),_s=lh({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function Es({children:t}){let[e,o]=uh({cellEditorConfig:null,cellEditorPlugins:null});return hr(_s.Provider,{value:ch(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var Ts=()=>{let t=z1(16),[e]=X1(),o=sh(_s),r=th(),{fieldProps:n,uuid:i}=B(),{schemaPath:l}=n,s="lexical-table-create-"+i,a;t[0]!==s||t[1]!==r?(a=eh({slug:s,depth:r}),t[0]=s,t[1]=r,t[2]=a):a=t[2];let c=a,{toggleDrawer:d}=se(c,!0),u;t[3]!==e||t[4]!==d?(u=()=>{if(!e.hasNodes([q1]))throw new Error("TablePlugin: TableNode is not registered on editor");return Q1(e.registerCommand(so,()=>{let h;return h=null,e.getEditorState().read(()=>{let g=oh();rh(g)&&(h=g)}),h&&d(),!0},nh))},t[3]=e,t[4]=d,t[5]=u):u=t[5];let m;t[6]!==o||t[7]!==e||t[8]!==d?(m=[o,e,d],t[6]=o,t[7]=e,t[8]=d,t[9]=m):m=t[9],ah(u,m);let p;t[10]!==e?(p=(h,g)=>{!g.columns||!g.rows||e.dispatchCommand(J1,{columns:String(g.columns),rows:String(g.rows)})},t[10]=e,t[11]=p):p=t[11];let f;return t[12]!==c||t[13]!==p||t[14]!==l?(f=Z1(bs.Fragment,{children:[hr(Ye,{drawerSlug:c,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:p,schemaPath:l,schemaPathSuffix:"fields"}),hr(Y1,{hasCellBackgroundColor:!1,hasCellMerge:!0})]}),t[12]=c,t[13]=p,t[14]=l,t[15]=f):f=t[15],f};var fh=D({markdownTransformers:[Yl],nodes:[mh,dh,ph],plugins:[{Component:Ts,position:"normal"},{Component:cs,position:"normal"},{Component:ns,position:"floatingAnchorElem"},{Component:xs,position:"floatingAnchorElem"}],providers:[Es],slashMenu:{groups:[q([{Icon:nr,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(so,{})}}])]},toolbarFixed:{groups:[fe([{ChildComponent:nr,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(so,{})}}])]}});import{$isNodeSelection as $h}from"lexical";import{jsx as gr,jsxs as hh}from"react/jsx-runtime";import"react";var Cr=()=>hh("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[gr("path",{d:"M14.6667 4H5.33333C4.59695 4 4 4.59695 4 5.33333V14.6667C4 15.403 4.59695 16 5.33333 16H14.6667C15.403 16 16 15.403 16 14.6667V5.33333C16 4.59695 15.403 4 14.6667 4Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),gr("path",{d:"M7.99984 9.33366C8.73622 9.33366 9.33317 8.73671 9.33317 8.00033C9.33317 7.26395 8.73622 6.66699 7.99984 6.66699C7.26346 6.66699 6.6665 7.26395 6.6665 8.00033C6.6665 8.73671 7.26346 9.33366 7.99984 9.33366Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),gr("path",{d:"M16 11.9995L13.9427 9.94214C13.6926 9.69218 13.3536 9.55176 13 9.55176C12.6464 9.55176 12.3074 9.69218 12.0573 9.94214L6 15.9995",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})]});import{c as kh}from"react/compiler-runtime";import{jsx as Nh}from"react/jsx-runtime";import{useLexicalComposerContext as Lh}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Rh,mergeRegister as Sh}from"@lexical/utils";import{useConfig as Ih}from"@payloadcms/ui";import{$getPreviousSelection as yh,$getSelection as vh,$isParagraphNode as ks,$isRangeSelection as Mh,COMMAND_PRIORITY_EDITOR as Dh,createCommand as Ah}from"lexical";import{useEffect as Oh}from"react";import{c as gh}from"react/compiler-runtime";import{jsx as xr}from"react/jsx-runtime";import{useLexicalComposerContext as Ch}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as xh,COMMAND_PRIORITY_EDITOR as bh}from"lexical";import{useEffect as _h,useState as Eh}from"react";var Th=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=xh(o);n&&n.replace(ot({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(br,{fields:null,relationTo:e,value:r})},wh=t=>{let e=gh(13),{enabledCollectionSlugs:o}=t,[r]=Ch(),[n,i]=Eh(null),l;e[0]!==o?(l={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=l):l=e[1];let{closeListDrawer:s,ListDrawer:a,openListDrawer:c}=Ct(l),d,u;e[2]!==r||e[3]!==c?(d=()=>r.registerCommand(et,h=>(i(h?.replace?h?.replace.nodeKey:null),c(),!0),bh),u=[r,c],e[2]=r,e[3]=c,e[4]=d,e[5]=u):(d=e[4],u=e[5]),_h(d,u);let m;e[6]!==s||e[7]!==r||e[8]!==n?(m=h=>{let{collectionSlug:g,docID:E}=h;s(),Th({editor:r,relationTo:g,replaceNodeKey:n,value:E})},e[6]=s,e[7]=r,e[8]=n,e[9]=m):m=e[9];let p=m,f;return e[10]!==p||e[11]!==a?(f=xr(a,{onSelect:p}),e[10]=p,e[11]=a,e[12]=f):f=e[12],f},ws=t=>xr(Rt,{...t,uploads:!0,children:xr(wh,{...t})});var br=Ah("INSERT_UPLOAD_COMMAND"),Ns=t=>{let e=kh(5),[o]=Lh(),{config:r}=Ih(),{collections:n}=r,i,l;e[0]!==o?(i=()=>{if(!o.hasNodes([tt]))throw new Error("UploadPlugin: UploadNode not registered on editor");return Sh(o.registerCommand(br,a=>(o.update(()=>{let c=vh()||yh();if(Mh(c)){let d=ot({data:{id:a.id,fields:a.fields,relationTo:a.relationTo,value:a.value}});Rh(d);let{focus:u}=c,m=u.getNode();ks(m)&&m.getTextContentSize()===0&&m.getParentOrThrow().getChildren().filter(p=>ks(p)).length>1&&m.remove()}}),!0),Dh))},l=[o],e[0]=o,e[1]=i,e[2]=l):(i=e[1],l=e[2]),Oh(i,l);let s;return e[3]!==n?(s=Nh(ws,{enabledCollectionSlugs:n.map(Fh)}),e[3]=n,e[4]=s):s=e[4],s};function Fh(t){let{slug:e}=t;return e}var Ph=D({nodes:[tt],plugins:[{Component:Ns,position:"normal"}],slashMenu:{groups:[q([{Icon:Cr,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:[fe([{ChildComponent:Cr,isActive:({selection:t})=>{if(!$h(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return go(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(et,{replace:!1})}}])]}});import{c as Bh}from"react/compiler-runtime";import{jsx as Er}from"react/jsx-runtime";import{ShimmerEffect as Hh}from"@payloadcms/ui";import{lazy as jh,Suspense as Wh,useEffect as Gh,useState as Uh}from"react";var Ls={block:"LexicalEditorTheme__block",blockCursor:"LexicalEditorTheme__blockCursor",characterLimit:"LexicalEditorTheme__characterLimit",code:"LexicalEditorTheme__code",codeHighlight:{atrule:"LexicalEditorTheme__tokenAttr",attr:"LexicalEditorTheme__tokenAttr",boolean:"LexicalEditorTheme__tokenProperty",builtin:"LexicalEditorTheme__tokenSelector",cdata:"LexicalEditorTheme__tokenComment",char:"LexicalEditorTheme__tokenSelector",class:"LexicalEditorTheme__tokenFunction","class-name":"LexicalEditorTheme__tokenFunction",comment:"LexicalEditorTheme__tokenComment",constant:"LexicalEditorTheme__tokenProperty",deleted:"LexicalEditorTheme__tokenProperty",doctype:"LexicalEditorTheme__tokenComment",entity:"LexicalEditorTheme__tokenOperator",function:"LexicalEditorTheme__tokenFunction",important:"LexicalEditorTheme__tokenVariable",inserted:"LexicalEditorTheme__tokenSelector",keyword:"LexicalEditorTheme__tokenAttr",namespace:"LexicalEditorTheme__tokenVariable",number:"LexicalEditorTheme__tokenProperty",operator:"LexicalEditorTheme__tokenOperator",prolog:"LexicalEditorTheme__tokenComment",property:"LexicalEditorTheme__tokenProperty",punctuation:"LexicalEditorTheme__tokenPunctuation",regex:"LexicalEditorTheme__tokenVariable",selector:"LexicalEditorTheme__tokenSelector",string:"LexicalEditorTheme__tokenSelector",symbol:"LexicalEditorTheme__tokenProperty",tag:"LexicalEditorTheme__tokenProperty",url:"LexicalEditorTheme__tokenOperator",variable:"LexicalEditorTheme__tokenVariable"},embedBlock:{base:"LexicalEditorTheme__embedBlock",focus:"LexicalEditorTheme__embedBlockFocus"},hashtag:"LexicalEditorTheme__hashtag",heading:{h1:"LexicalEditorTheme__h1",h2:"LexicalEditorTheme__h2",h3:"LexicalEditorTheme__h3",h4:"LexicalEditorTheme__h4",h5:"LexicalEditorTheme__h5",h6:"LexicalEditorTheme__h6"},hr:"LexicalEditorTheme__hr",indent:"LexicalEditorTheme__indent",inlineImage:"LexicalEditor__inline-image",link:"LexicalEditorTheme__link",list:{checklist:"LexicalEditorTheme__checklist",listitem:"LexicalEditorTheme__listItem",listitemChecked:"LexicalEditorTheme__listItemChecked",listitemUnchecked:"LexicalEditorTheme__listItemUnchecked",nested:{listitem:"LexicalEditorTheme__nestedListItem"},olDepth:["LexicalEditorTheme__ol1","LexicalEditorTheme__ol2","LexicalEditorTheme__ol3","LexicalEditorTheme__ol4","LexicalEditorTheme__ol5"],ul:"LexicalEditorTheme__ul"},ltr:"LexicalEditorTheme__ltr",mark:"LexicalEditorTheme__mark",markOverlap:"LexicalEditorTheme__markOverlap",paragraph:"LexicalEditorTheme__paragraph",quote:"LexicalEditorTheme__quote",relationship:"LexicalEditorTheme__relationship",rtl:"LexicalEditorTheme__rtl",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellEditing:"LexicalEditorTheme__tableCellEditing",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellPrimarySelected:"LexicalEditorTheme__tableCellPrimarySelected",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableCellSortedIndicator:"LexicalEditorTheme__tableCellSortedIndicator",tableResizeRuler:"LexicalEditorTheme__tableCellResizeRuler",tableRowStriping:"LexicalEditorTheme__tableRowStriping",tableSelected:"LexicalEditorTheme__tableSelected",text:{bold:"LexicalEditorTheme__textBold",code:"LexicalEditorTheme__textCode",italic:"LexicalEditorTheme__textItalic",strikethrough:"LexicalEditorTheme__textStrikethrough",subscript:"LexicalEditorTheme__textSubscript",superscript:"LexicalEditorTheme__textSuperscript",underline:"LexicalEditorTheme__textUnderline",underlineStrikethrough:"LexicalEditorTheme__textUnderlineStrikethrough"},upload:"editor-upload"};var ao={namespace:"lexical",theme:Ls};function Rs({featureClientImportMap:t,featureClientSchemaMap:e,field:o,schemaPath:r,unSanitizedEditorConfig:n}){for(let a of n.features)if(!a?.clientFeatureProps?.featureKey||a?.clientFeatureProps?.order===void 0||a?.clientFeatureProps?.order===null)throw new Error("A Feature you have installed does not return the client props as clientFeatureProps. Please make sure to always return those props, even if they are null, as other important props like order and featureKey are later on injected.");n.features=n.features.sort((a,c)=>a.clientFeatureProps.order-c.clientFeatureProps.order);let i=new Map;for(let a of n.features)i.set(a.clientFeatureProps.featureKey,a);let l=new Map,s=0;for(let a of n.features){let c=typeof a.feature=="function"?a.feature({featureClientImportMap:t,featureClientSchemaMap:e,featureProviderMap:i,field:o,resolvedFeatures:l,schemaPath:r,unSanitizedEditorConfig:n}):a.feature;c.key=a.clientFeatureProps.featureKey,c.order=s,l.set(a.clientFeatureProps.featureKey,c),s++}return l}var Ss=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}};if(!t?.size)return e;t.forEach(o=>{if(o.providers?.length&&(e.providers=e.providers.concat(o.providers)),o.enableFormats?.length&&e.enabledFormats.push(...o.enableFormats),o.nodes?.length)for(let r of o.nodes)e.nodes.push(r);if(o.plugins?.length&&o.plugins.forEach((r,n)=>{e.plugins?.push({clientProps:o.sanitizedClientFeatureProps,Component:r.Component,key:o.key+n,position:r.position})}),o.toolbarInline?.groups?.length)for(let r of o.toolbarInline.groups){let n=e.toolbarInline.groups.find(i=>i.key===r.key);n?e.toolbarInline.groups=e.toolbarInline.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),e.toolbarInline?.groups.push(n)}if(o.toolbarFixed?.groups?.length)for(let r of o.toolbarFixed.groups){let n=e.toolbarFixed.groups.find(i=>i.key===r.key);n?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),e.toolbarFixed?.groups.push(n)}if(o.slashMenu?.groups){o.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(o.slashMenu.dynamicGroups));for(let r of o.slashMenu.groups){let n=e.slashMenu.groups.find(i=>i.key===r.key);n?e.slashMenu.groups=e.slashMenu.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),e.slashMenu.groups.push(n)}}if(o.markdownTransformers?.length)for(let r of o.markdownTransformers)typeof r=="function"?e.markdownTransformers.push(r({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(r);e.enabledFeatures.push(o.key)}),e.toolbarInline.groups.sort((o,r)=>o.order&&r.order?o.order-r.order:o.order?-1:r.order?1:0),e.toolbarFixed.groups.sort((o,r)=>o.order&&r.order?o.order-r.order:o.order?-1:r.order?1:0);for(let o of e.toolbarInline.groups)o.items.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);for(let o of e.toolbarFixed.groups)o.items.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);return e};function _r(t,e,o){return{admin:o,features:Ss(t),lexical:e,resolvedFeatureMap:t}}var Vh=jh(()=>import("./Field-JP7H7AZE.js").then(t=>({default:t.RichText}))),Kh=t=>{let e=Bh(15),{admin:o,clientFeatures:r,featureClientImportMap:n,featureClientSchemaMap:i,field:l,lexicalEditorConfig:s,schemaPath:a}=t,c;e[0]!==o?(c=o===void 0?{}:o,e[0]=o,e[1]=c):c=e[1];let d=c,u=s===void 0?ao:s,[m,p]=Uh(null),f,h;e[2]!==m||e[3]!==r||e[4]!==u||e[5]!==n||e[6]!==i||e[7]!==l||e[8]!==a||e[9]!==d?(f=()=>{if(m)return;let E=[];for(let[x,b]of Object.entries(r))b.clientFeatureProvider&&E.push(b.clientFeatureProvider(b.clientFeatureProps));let L=u||ao,C=Rs({featureClientImportMap:n,featureClientSchemaMap:i,field:l,schemaPath:a??l.name,unSanitizedEditorConfig:{features:E,lexical:L}});p(_r(C,L,d))},h=[u,d,m,r,i,n,l,a],e[2]=m,e[3]=r,e[4]=u,e[5]=n,e[6]=i,e[7]=l,e[8]=a,e[9]=d,e[10]=f,e[11]=h):(f=e[10],h=e[11]),Gh(f,h);let g;return e[12]!==m||e[13]!==t?(g=Er(Wh,{fallback:Er(Hh,{height:"35vh"}),children:m&&Er(Vh,{...t,editorConfig:m})}),e[12]=m,e[13]=t,e[14]=g):g=e[14],g};function zh(...t){return t.filter(Boolean).join(" ")}var co=new WeakMap;function Is(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function uo(t,e){let o=co.get(t);if(o===void 0){let r=new Set,n=l=>{o!==void 0&&(o.start=Is(l))},i=l=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let a=Is(l);for(let c of r)a!==null&&c([a[0]-s[0],a[1]-s[1]],l)};t.addEventListener("touchstart",n),t.addEventListener("touchend",i),o={handleTouchend:i,handleTouchstart:n,listeners:r,start:null},co.set(t,o)}return o.listeners.add(e),()=>{Zh(t,e)}}function Zh(t,e){let o=co.get(t);if(o===void 0)return;let{listeners:r}=o;r.delete(e),r.size===0&&(co.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function Xh(t,e){return uo(t,(o,r)=>{let[n,i]=o;n<0&&-n>Math.abs(i)&&e(n,r)})}function Yh(t,e){return uo(t,(o,r)=>{let[n,i]=o;n>0&&n>Math.abs(i)&&e(n,r)})}function Jh(t,e){return uo(t,(o,r)=>{let[n,i]=o;i<0&&-i>Math.abs(n)&&e(n,r)})}function qh(t,e){return uo(t,(o,r)=>{let[n,i]=o;i>0&&i>Math.abs(n)&&e(n,r)})}var $={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},Qh=$.IS_BOLD|$.IS_ITALIC|$.IS_STRIKETHROUGH|$.IS_UNDERLINE|$.IS_CODE|$.IS_SUBSCRIPT|$.IS_SUPERSCRIPT|$.IS_HIGHLIGHT,eg="\xA0",tg=`
|
|
40
40
|
|
|
41
|
-
`,
|
|
41
|
+
`,ys="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",vs="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",og=new RegExp("^[^"+vs+"]*["+ys+"]"),rg=new RegExp("^[^"+ys+"]*["+vs+"]"),ng={bold:$.IS_BOLD,code:$.IS_CODE,highlight:$.IS_HIGHLIGHT,italic:$.IS_ITALIC,strikethrough:$.IS_STRIKETHROUGH,subscript:$.IS_SUBSCRIPT,superscript:$.IS_SUPERSCRIPT,underline:$.IS_UNDERLINE},ig={directionless:$.IS_DIRECTIONLESS,unmergeable:$.IS_UNMERGEABLE},lg={center:$.IS_ALIGN_CENTER,end:$.IS_ALIGN_END,justify:$.IS_ALIGN_JUSTIFY,left:$.IS_ALIGN_LEFT,right:$.IS_ALIGN_RIGHT,start:$.IS_ALIGN_START},sg={[$.IS_ALIGN_CENTER]:"center",[$.IS_ALIGN_END]:"end",[$.IS_ALIGN_JUSTIFY]:"justify",[$.IS_ALIGN_LEFT]:"left",[$.IS_ALIGN_RIGHT]:"right",[$.IS_ALIGN_START]:"start"},ag={normal:$.IS_NORMAL,segmented:$.IS_SEGMENTED,token:$.IS_TOKEN},cg={[$.IS_NORMAL]:"normal",[$.IS_SEGMENTED]:"segmented",[$.IS_TOKEN]:"token"};import{c as ug}from"react/compiler-runtime";import{jsx as dg}from"react/jsx-runtime";import"react";var mg=()=>{let t=ug(2),{EditButton:e}=Te(),o;return t[0]!==e?(o=e?dg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as pg}from"react/compiler-runtime";import{jsx as fg}from"react/jsx-runtime";import"react";var hg=()=>{let t=pg(2),{RemoveButton:e}=Te(),o;return t[0]!==e?(o=e?fg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as gg}from"react/compiler-runtime";import{jsx as Cg}from"react/jsx-runtime";import"react";var xg=()=>{let t=gg(2),{Label:e}=Te(),o;return t[0]!==e?(o=e?Cg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as bg}from"react/compiler-runtime";import{jsx as _g}from"react/jsx-runtime";import"react";var Eg=t=>{let e=bg(3),{children:o}=t,{InlineBlockContainer:r}=Te(),n;return e[0]!==r||e[1]!==o?(n=r?_g(r,{children:o}):null,e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{c as Tg}from"react/compiler-runtime";import{jsx as wg}from"react/jsx-runtime";import"react";var kg=t=>{let e=Tg(6),{children:o,editButton:r,Label:n,removeButton:i}=t,{BlockCollapsible:l}=je(),s;return e[0]!==l||e[1]!==r||e[2]!==n||e[3]!==i||e[4]!==o?(s=l?wg(l,{editButton:r,Label:n,removeButton:i,children:o}):null,e[0]=l,e[1]=r,e[2]=n,e[3]=i,e[4]=o,e[5]=s):s=e[5],s};import{c as Ng}from"react/compiler-runtime";import{jsx as Lg}from"react/jsx-runtime";import"react";var Rg=()=>{let t=Ng(2),{EditButton:e}=je(),o;return t[0]!==e?(o=e?Lg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Sg}from"react/compiler-runtime";import{jsx as Ig}from"react/jsx-runtime";import"react";var yg=()=>{let t=Sg(2),{RemoveButton:e}=je(),o;return t[0]!==e?(o=e?Ig(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as vg}from"react/compiler-runtime";import{jsx as Mg}from"react/jsx-runtime";import"react";var Dg=()=>{let t=vg(2),{EditButton:e}=Ne(),o;return t[0]!==e?(o=e?Mg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Ag}from"react/compiler-runtime";import{jsx as Og}from"react/jsx-runtime";import"react";var Fg=()=>{let t=Ag(2),{RemoveButton:e}=Ne(),o;return t[0]!==e?(o=e?Og(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as $g}from"react/compiler-runtime";import{jsx as Pg}from"react/jsx-runtime";import"react";var Bg=()=>{let t=$g(2),{Label:e}=Ne(),o;return t[0]!==e?(o=e?Pg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Hg}from"react/compiler-runtime";import{jsx as jg}from"react/jsx-runtime";import"react";var Wg=t=>{let e=Hg(3),{children:o}=t,{WrapperBlockContainer:r}=Ne(),n;return e[0]!==r||e[1]!==o?(n=r?jg(r,{children:o}):null,e[0]=r,e[1]=o,e[2]=n):n=e[2],n};export{ut as $createAutoLinkNode,Ot as $createBlockNode,po as $createInlineBlockNode,he as $createLinkNode,Qe as $createRelationshipNode,ot as $createUploadNode,Ce as $isAutoLinkNode,At as $isBlockNode,fo as $isInlineBlockNode,Y as $isLinkNode,ho as $isRelationshipNode,go as $isUploadNode,Ks as AlignFeatureClient,ge as AutoLinkNode,kg as BlockCollapsible,Rg as BlockEditButton,Ie as BlockNode,yg as BlockRemoveButton,qs as BlockquoteFeatureClient,$c as BlocksFeatureClient,nu as BoldFeatureClient,As as CAN_USE_DOM,Fm as ChecklistFeatureClient,ig as DETAIL_TYPE_TO_DETAIL,tg as DOUBLE_LINE_BREAK,sg as ELEMENT_FORMAT_TO_TYPE,lg as ELEMENT_TYPE_TO_FORMAT,Bs as ENABLE_SLASH_MENU_COMMAND,Ds as EditorConfigProvider,Ye as FieldsDrawer,ff as FixedToolbarFeatureClient,Hu as HeadingFeatureClient,Yu as HorizontalRuleFeatureClient,Qh as IS_ALL_FORMATTING,cd as IndentFeatureClient,Eg as InlineBlockContainer,mg as InlineBlockEditButton,xg as InlineBlockLabel,mo as InlineBlockNode,hg as InlineBlockRemoveButton,cu as InlineCodeFeatureClient,Nf as InlineToolbarFeatureClient,pu as ItalicFeatureClient,rg as LTR_REGEX,np as LexicalPluginToLexicalFeatureClient,Em as LinkFeatureClient,le as LinkNode,eg as NON_BREAKING_SPACE,$ as NodeFormat,Um as OrderedListFeatureClient,mp as ParagraphFeatureClient,$s as Point,og as RTL_REGEX,Hs as Rect,jp as RelationshipFeatureClient,qe as RelationshipNode,Kh as RichTextField,up as SlateToLexicalFeatureClient,xu as StrikethroughFeatureClient,Tu as SubscriptFeatureClient,Lu as SuperscriptFeatureClient,ag as TEXT_MODE_TO_TYPE,ng as TEXT_TYPE_TO_FORMAT,cg as TEXT_TYPE_TO_MODE,de as TOGGLE_LINK_COMMAND,fh as TableFeatureClient,Xc as TestRecorderFeatureClient,xt as ToolbarButton,Fe as ToolbarDropdown,eu as TreeViewFeatureClient,vu as UnderlineFeatureClient,qm as UnorderedListFeatureClient,Ph as UploadFeatureClient,tt as UploadNode,Wg as WrapperBlockContainer,Dg as WrapperBlockEditButton,Bg as WrapperBlockLabel,Fg as WrapperBlockRemoveButton,qh as addSwipeDownListener,Xh as addSwipeLeftListener,Yh as addSwipeRightListener,Jh as addSwipeUpListener,Mo as createBlockNode,D as createClientFeature,ao as defaultEditorLexicalConfig,rr as getDOMRangeRect,js as getEnabledNodes,ke as getSelectedNode,Fs as isHTMLElement,Ps as isPoint,zh as joinClasses,_r as sanitizeClientEditorConfig,Ss as sanitizeClientFeatures,Yt as setFloatingElemPosition,We as setFloatingElemPositionForLinkEditor,q as slashMenuBasicGroupWithItems,fe as toolbarAddDropdownGroupWithItems,Ao as toolbarFeatureButtonsGroupWithItems,te as toolbarFormatGroupWithItems,ie as toolbarTextDropdownGroupWithItems,B as useEditorConfigContext,Os as useLexicalDocumentDrawer,se as useLexicalDrawer,Ct as useLexicalListDrawer};
|
|
42
42
|
//# sourceMappingURL=index.js.map
|