@payloadcms/richtext-lexical 3.59.0-internal.ff6711a → 3.59.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/exports/client/Field-EHRBYNHO.js +2 -0
- package/dist/exports/client/Field-EHRBYNHO.js.map +7 -0
- package/dist/exports/client/RelationshipComponent-APF3CN47.js +2 -0
- package/dist/exports/client/RelationshipComponent-APF3CN47.js.map +7 -0
- package/dist/exports/client/bundled.css +1 -1
- package/dist/exports/client/{chunk-TLQLXR6Q.js → chunk-2Y72RT72.js} +2 -2
- package/dist/exports/client/chunk-3BY5IZJD.js +2 -0
- package/dist/exports/client/chunk-3BY5IZJD.js.map +7 -0
- package/dist/exports/client/chunk-CYLMY5ZJ.js +2 -0
- package/dist/exports/client/chunk-CYLMY5ZJ.js.map +7 -0
- package/dist/exports/client/component-VDJI45F2.js +2 -0
- package/dist/exports/client/component-VDJI45F2.js.map +7 -0
- package/dist/exports/client/componentInline-7TPI7ZBC.js +2 -0
- package/dist/exports/client/index.d.ts +0 -3
- package/dist/exports/client/index.d.ts.map +1 -1
- package/dist/exports/client/index.js +10 -35
- package/dist/exports/client/index.js.map +4 -4
- package/dist/features/blocks/client/component/BlockContent.d.ts +27 -52
- package/dist/features/blocks/client/component/BlockContent.d.ts.map +1 -1
- package/dist/features/blocks/client/component/BlockContent.js +51 -48
- package/dist/features/blocks/client/component/BlockContent.js.map +1 -1
- package/dist/features/blocks/client/component/components/BlockCollapsible.d.ts +9 -2
- package/dist/features/blocks/client/component/components/BlockCollapsible.d.ts.map +1 -1
- package/dist/features/blocks/client/component/components/BlockCollapsible.js +25 -7
- package/dist/features/blocks/client/component/components/BlockCollapsible.js.map +1 -1
- package/dist/features/blocks/client/component/index.d.ts.map +1 -1
- package/dist/features/blocks/client/component/index.js +56 -71
- package/dist/features/blocks/client/component/index.js.map +1 -1
- package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
- package/dist/features/blocks/client/componentInline/index.js +11 -13
- 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 +0 -5
- package/dist/features/blocks/client/index.js.map +1 -1
- package/dist/features/blocks/client/markdownTransformer.d.ts +17 -0
- package/dist/features/blocks/client/markdownTransformer.d.ts.map +1 -0
- package/dist/features/blocks/client/markdownTransformer.js +144 -0
- package/dist/features/blocks/client/markdownTransformer.js.map +1 -0
- package/dist/features/blocks/server/index.js +1 -1
- package/dist/features/blocks/server/index.js.map +1 -1
- package/dist/features/blocks/server/linesFromMatchToContentAndPropsString.d.ts.map +1 -0
- package/dist/features/blocks/server/linesFromMatchToContentAndPropsString.js.map +1 -0
- package/dist/features/blocks/server/markdownTransformer.d.ts +22 -0
- package/dist/features/blocks/server/markdownTransformer.d.ts.map +1 -0
- package/dist/features/blocks/server/{markdown/markdownTransformer.js → markdownTransformer.js} +48 -6
- package/dist/features/blocks/server/markdownTransformer.js.map +1 -0
- package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.d.ts.map +1 -1
- package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js +3 -5
- package/dist/features/experimental_table/client/plugins/TableHoverActionsPlugin/index.js.map +1 -1
- package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.d.ts.map +1 -1
- package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +1 -3
- package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
- package/dist/features/relationship/client/components/RelationshipComponent.d.ts.map +1 -1
- package/dist/features/relationship/client/components/RelationshipComponent.js +9 -5
- package/dist/features/relationship/client/components/RelationshipComponent.js.map +1 -1
- package/dist/features/toolbars/fixed/client/Toolbar/index.d.ts.map +1 -1
- package/dist/features/toolbars/fixed/client/Toolbar/index.js +1 -7
- package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
- package/dist/features/toolbars/inline/client/Toolbar/index.d.ts.map +1 -1
- package/dist/features/toolbars/inline/client/Toolbar/index.js +1 -3
- package/dist/features/toolbars/inline/client/Toolbar/index.js.map +1 -1
- package/dist/features/upload/client/component/index.d.ts.map +1 -1
- package/dist/features/upload/client/component/index.js +5 -6
- package/dist/features/upload/client/component/index.js.map +1 -1
- package/dist/field/bundled.css +1 -1
- package/dist/field/rscEntry.d.ts.map +1 -1
- package/dist/field/rscEntry.js +0 -2
- package/dist/field/rscEntry.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/lexical/LexicalEditor.d.ts.map +1 -1
- package/dist/lexical/LexicalEditor.js +26 -20
- package/dist/lexical/LexicalEditor.js.map +1 -1
- package/dist/lexical/ui/icons/CodeBlock/index.d.ts.map +1 -1
- package/dist/lexical/ui/icons/CodeBlock/index.js +15 -10
- package/dist/lexical/ui/icons/CodeBlock/index.js.map +1 -1
- package/dist/utilities/buildInitialState.d.ts +0 -1
- package/dist/utilities/buildInitialState.d.ts.map +1 -1
- package/dist/utilities/buildInitialState.js +0 -1
- package/dist/utilities/buildInitialState.js.map +1 -1
- package/dist/utilities/fieldsDrawer/DrawerContent.d.ts.map +1 -1
- package/dist/utilities/fieldsDrawer/DrawerContent.js +3 -7
- package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
- package/dist/utilities/jsx/collectTopLevelJSXInLines.js +2 -2
- package/dist/utilities/jsx/collectTopLevelJSXInLines.js.map +1 -1
- package/package.json +6 -6
- package/dist/exports/client/Field-CJFETHA3.js +0 -2
- package/dist/exports/client/Field-CJFETHA3.js.map +0 -7
- package/dist/exports/client/RelationshipComponent-TSIENULZ.js +0 -2
- package/dist/exports/client/RelationshipComponent-TSIENULZ.js.map +0 -7
- package/dist/exports/client/chunk-BQCXN3B4.js +0 -2
- package/dist/exports/client/chunk-BQCXN3B4.js.map +0 -7
- package/dist/exports/client/chunk-XNERFY6G.js +0 -2
- package/dist/exports/client/chunk-XNERFY6G.js.map +0 -7
- package/dist/exports/client/component-CYFKY3IL.js +0 -2
- package/dist/exports/client/component-CYFKY3IL.js.map +0 -7
- package/dist/exports/client/componentInline-NGTRUSGB.js +0 -2
- package/dist/features/blocks/client/markdown/getLexicalToMarkdown.d.ts +0 -6
- package/dist/features/blocks/client/markdown/getLexicalToMarkdown.d.ts.map +0 -1
- package/dist/features/blocks/client/markdown/getLexicalToMarkdown.js +0 -24
- package/dist/features/blocks/client/markdown/getLexicalToMarkdown.js.map +0 -1
- package/dist/features/blocks/client/markdown/getMarkdownToLexical.d.ts +0 -6
- package/dist/features/blocks/client/markdown/getMarkdownToLexical.d.ts.map +0 -1
- package/dist/features/blocks/client/markdown/getMarkdownToLexical.js +0 -20
- package/dist/features/blocks/client/markdown/getMarkdownToLexical.js.map +0 -1
- package/dist/features/blocks/client/markdown/markdownTransformer.d.ts +0 -12
- package/dist/features/blocks/client/markdown/markdownTransformer.d.ts.map +0 -1
- package/dist/features/blocks/client/markdown/markdownTransformer.js +0 -348
- package/dist/features/blocks/client/markdown/markdownTransformer.js.map +0 -1
- package/dist/features/blocks/premade/CodeBlock/Component/Block.d.ts +0 -5
- package/dist/features/blocks/premade/CodeBlock/Component/Block.d.ts.map +0 -1
- package/dist/features/blocks/premade/CodeBlock/Component/Block.js +0 -156
- package/dist/features/blocks/premade/CodeBlock/Component/Block.js.map +0 -1
- package/dist/features/blocks/premade/CodeBlock/Component/Code.d.ts +0 -61
- package/dist/features/blocks/premade/CodeBlock/Component/Code.d.ts.map +0 -1
- package/dist/features/blocks/premade/CodeBlock/Component/Code.js +0 -99
- package/dist/features/blocks/premade/CodeBlock/Component/Code.js.map +0 -1
- package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.d.ts +0 -4
- package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.d.ts.map +0 -1
- package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.js +0 -17
- package/dist/features/blocks/premade/CodeBlock/Component/Collapse/index.js.map +0 -1
- package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.d.ts +0 -4
- package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.d.ts.map +0 -1
- package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.js +0 -26
- package/dist/features/blocks/premade/CodeBlock/Component/FloatingCollapse/index.js.map +0 -1
- package/dist/features/blocks/premade/CodeBlock/converter.d.ts +0 -7
- package/dist/features/blocks/premade/CodeBlock/converter.d.ts.map +0 -1
- package/dist/features/blocks/premade/CodeBlock/converter.js +0 -46
- package/dist/features/blocks/premade/CodeBlock/converter.js.map +0 -1
- package/dist/features/blocks/premade/CodeBlock/converterClient.d.ts +0 -2
- package/dist/features/blocks/premade/CodeBlock/converterClient.d.ts.map +0 -1
- package/dist/features/blocks/premade/CodeBlock/converterClient.js +0 -4
- package/dist/features/blocks/premade/CodeBlock/converterClient.js.map +0 -1
- package/dist/features/blocks/premade/CodeBlock/index.d.ts +0 -7
- package/dist/features/blocks/premade/CodeBlock/index.d.ts.map +0 -1
- package/dist/features/blocks/premade/CodeBlock/index.js +0 -52
- package/dist/features/blocks/premade/CodeBlock/index.js.map +0 -1
- package/dist/features/blocks/server/markdown/getLexicalToMarkdown.d.ts +0 -6
- package/dist/features/blocks/server/markdown/getLexicalToMarkdown.d.ts.map +0 -1
- package/dist/features/blocks/server/markdown/getLexicalToMarkdown.js +0 -27
- package/dist/features/blocks/server/markdown/getLexicalToMarkdown.js.map +0 -1
- package/dist/features/blocks/server/markdown/getMarkdownToLexical.d.ts +0 -7
- package/dist/features/blocks/server/markdown/getMarkdownToLexical.d.ts.map +0 -1
- package/dist/features/blocks/server/markdown/getMarkdownToLexical.js +0 -22
- package/dist/features/blocks/server/markdown/getMarkdownToLexical.js.map +0 -1
- package/dist/features/blocks/server/markdown/linesFromMatchToContentAndPropsString.d.ts.map +0 -1
- package/dist/features/blocks/server/markdown/linesFromMatchToContentAndPropsString.js.map +0 -1
- package/dist/features/blocks/server/markdown/markdownTransformer.d.ts +0 -15
- package/dist/features/blocks/server/markdown/markdownTransformer.d.ts.map +0 -1
- package/dist/features/blocks/server/markdown/markdownTransformer.js.map +0 -1
- package/dist/lexical/ui/icons/Collapse/index.d.ts +0 -3
- package/dist/lexical/ui/icons/Collapse/index.d.ts.map +0 -1
- package/dist/lexical/ui/icons/Collapse/index.js +0 -18
- package/dist/lexical/ui/icons/Collapse/index.js.map +0 -1
- /package/dist/exports/client/{chunk-TLQLXR6Q.js.map → chunk-2Y72RT72.js.map} +0 -0
- /package/dist/exports/client/{componentInline-NGTRUSGB.js.map → componentInline-7TPI7ZBC.js.map} +0 -0
- /package/dist/features/blocks/server/{markdown/linesFromMatchToContentAndPropsString.d.ts → linesFromMatchToContentAndPropsString.d.ts} +0 -0
- /package/dist/features/blocks/server/{markdown/linesFromMatchToContentAndPropsString.js → linesFromMatchToContentAndPropsString.js} +0 -0
|
@@ -1,26 +1,6 @@
|
|
|
1
|
-
"use client";import{a as
|
|
1
|
+
"use client";import{a as pe,c as wo,d as Eo,e as So}from"./chunk-3BY5IZJD.js";import{a as lt}from"./chunk-DBWINSQN.js";import{a as nt,b as Ot,c as Ue}from"./chunk-CYLMY5ZJ.js";import{a as me}from"./chunk-INBEEENE.js";import{a as Da}from"./chunk-F26IQ5RE.js";import{a as re,b as Ft,d as jr,e as Ur,f as Aa,g as Oa,i as Fa,k as $a,l as Pa}from"./chunk-2Y72RT72.js";import{a as Ma,b as H}from"./chunk-BZZVLW4U.js";function Z(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{$isElementNode as Se,$isRangeSelection as Pt,FORMAT_ELEMENT_COMMAND as Bt}from"lexical";import{jsx as No,jsxs as Ba}from"react/jsx-runtime";import"react";var Gr=()=>Ba("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[No("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),No("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),No("path",{d:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Lo,jsxs as Ha}from"react/jsx-runtime";import"react";var Wr=()=>Ha("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Lo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Lo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Lo("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as yo,jsxs as ja}from"react/jsx-runtime";import"react";var $t=()=>ja("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[yo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),yo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),yo("path",{d:"M2.5 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Io,jsxs as Ua}from"react/jsx-runtime";import"react";var Vr=()=>Ua("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Io("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Io("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Io("path",{d:"M7.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});var v=t=>o=>{let r={clientFeatureProps:o};if(typeof t=="function")r.feature=({config:n,featureClientImportMap:l,featureClientSchemaMap:i,featureProviderMap:s,field:u,resolvedFeatures:c,schemaPath:d,unSanitizedEditorConfig:a})=>{let p=t({config:n,featureClientImportMap:l,featureClientSchemaMap:i,featureProviderMap:s,field:u,props:o,resolvedFeatures:c,schemaPath:d,unSanitizedEditorConfig:a});return p.sanitizedClientFeatureProps===null&&(p.sanitizedClientFeatureProps=o),p};else{let n={...t};n.sanitizedClientFeatureProps=o,r.feature=n}return r};var Kr=t=>({type:"dropdown",ChildComponent:$t,items:t,key:"align",order:30});var Jr=[Kr([{ChildComponent:$t,isActive:({selection:t})=>{if(!Pt(t))return!1;for(let e of t.getNodes()){if(Se(e)&&e.getFormatType()==="left")continue;let o=e.getParent();if(!(Se(o)&&o.getFormatType()==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Bt,"left")},order:1},{ChildComponent:Gr,isActive:({selection:t})=>{if(!Pt(t))return!1;for(let e of t.getNodes()){if(Se(e)&&e.getFormatType()==="center")continue;let o=e.getParent();if(!(Se(o)&&o.getFormatType()==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Bt,"center")},order:2},{ChildComponent:Vr,isActive:({selection:t})=>{if(!Pt(t))return!1;for(let e of t.getNodes()){if(Se(e)&&e.getFormatType()==="right")continue;let o=e.getParent();if(!(Se(o)&&o.getFormatType()==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Bt,"right")},order:3},{ChildComponent:Wr,isActive:({selection:t})=>{if(!Pt(t))return!1;for(let e of t.getNodes()){if(Se(e)&&e.getFormatType()==="justify")continue;let o=e.getParent();if(!(Se(o)&&o.getFormatType()==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Bt,"justify")},order:4}])],Ga=v({toolbarFixed:{groups:Jr},toolbarInline:{groups:Jr}});import{$createQuoteNode as en,$isQuoteNode as qr,QuoteNode as Ka}from"@lexical/rich-text";import{$setBlocksType as tn}from"@lexical/selection";import{$getSelection as on,$isRangeSelection as Ja}from"lexical";import{jsx as Xr}from"react/jsx-runtime";import"react";var Ro=()=>Xr("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Xr("path",{d:"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 zr}from"react/jsx-runtime";import"react";var it=()=>zr("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:zr("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 Q=t=>({type:"dropdown",ChildComponent:it,items:t,key:"text",order:25});import{$createQuoteNode as Wa,$isQuoteNode as Zr,QuoteNode as Va}from"@lexical/rich-text";var Yr={type:"element",dependencies:[Va],export:(t,e)=>{if(!Zr(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 l=t.getPreviousSibling();if(un(l)){l.splice(l.getChildrenSize(),0,[...e]),l.select(0,0),t.remove();return}}let n=Tc();n.append(...e),t.replace(n),n.select(0,0)}};var pn=[ee([{ChildComponent:jo,isActive:({selection:t})=>{if(!Sc(t))return!1;for(let e of t.getNodes())if(!mn(e)&&!mn(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=gn();hn(e,()=>fn())})},order:20}])],Lc=v({markdownTransformers:[dn],nodes:[Ec],slashMenu:{groups:[z([{Icon:jo,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=gn();hn(e,()=>fn())})}}])]},toolbarFixed:{groups:pn},toolbarInline:{groups:pn}});import{getTranslation as ro}from"@payloadcms/translations";import{jsx as Ho,jsxs as Nc}from"react/jsx-runtime";import"react";var Xt=()=>Nc("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:[Ho("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),Ho("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),Ho("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as xn}from"react/jsx-runtime";import"react";var zt=()=>xn("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:xn("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 yc}from"react/jsx-runtime";import"react";function Zt(t,e){return t?()=>yc("img",{alt:e??"Block Image",className:"lexical-block-custom-image",src:t,style:{maxHeight:20,maxWidth:20}}):Xt}import{$parseSerializedNode as yn}from"lexical";import{JSOX as Uo}from"jsox";function Yt({propsString:t}){let e={},o="",r=!0;for(let n=0;n<t.length;n++){let l=t[n];if(r)l==="="||l===" "?o&&(l===" "?(e[o]=!0,o=""):r=!1):o+=l;else{let i=Rc(t,n);e[o]=i.value,n=i.newIndex,o="",r=!0}}return o&&(e[o]=!0),e}function Rc(t,e){let o=t[e];return o==='"'?Cn(t,e):o==="'"?Cn(t,e,!0):o==="{"?vc(t,e):o==="["?Ic(t,e):Dc(t,e)}function Ic(t,e){let o=1,r="",n=e+1;for(;n<t.length&&o>0;)t[n]==="["?o++:t[n]==="]"&&o--,o>0&&(r+=t[n]),n++;return{newIndex:n,value:Uo.parse(`[${r}]`)}}function Cn(t,e,o=!1){let r="",n=e+1;for(;n<t.length&&(t[n]!==(o?"'":'"')||t[n-1]==="\\");)r+=t[n],n++;return{newIndex:n,value:r}}function vc(t,e){let o=1,r="",n=e+1;for(;n<t.length&&o>0;)t[n]==="{"?o++:t[n]==="}"&&o--,o>0&&(r+=t[n]),n++;return{newIndex:n,value:Mc(r)}}function Mc(t){return t[0]!=="{"?Uo.parse(t):Uo.parse(t.replace(/(\w+):/g,'"$1":'))}function Dc(t,e){let o="",r=e;for(;r<t.length&&t[r]!==" ";)o+=t[r],r++;return{newIndex:r-1,value:o}}function gt({props:t}){let e=[];for(let[o,r]of Object.entries(t))typeof r=="string"?e.push(`${o}="${Ac(r)}"`):typeof r=="number"?e.push(`${o}={${r}}`):typeof r=="boolean"?r&&e.push(`${o}`):r!==null&&typeof r=="object"&&(Array.isArray(r)?e.push(`${o}={[${r.map(n=>JSON.stringify(n,bn)).join(", ")}]}`):e.push(`${o}={${JSON.stringify(r,bn)}}`));return e.join(" ")}function Ac(t){return t.replace(/"/g,""")}function bn(t,e){return typeof e=="string"?e.replace(/'/g,"\\'"):e}function qt({isEndOptional:t,lines:e,regexpEndRegex:o,startLineIndex:r,startMatch:n,trimChildren:l}){let i="",s="",d=e.slice(r),c=!1,u=0,a=0,m=null,p=!1,f=0,h=d[0].slice(0,n.index),x=0,g=r;e:for(let[E,C]of d.entries()){let k=l?C.trim():C,b=0;if(l)for(let _=0;_<C.length&&C[_]===" ";_++)b++;let T=0;for(E===0&&(T=(n.index??0)+n[0].length-b);T<k.length;){let _=k[T],N=k[T+1];if(c){if(_==="`"&&f++,f%2===0)if(_==="<"&&N==="/"){if(u--,u<0){s[s.length-1]===`
|
|
4
|
-
`&&(s=s.slice(0,-1)),g=E;for(let F=T;F<k.length;F++)if(k[F]===">"){x=F+1;break}break e}}else if(_==="/"&&N===">"){if(u--,u<0){s[s.length-1]===`
|
|
5
|
-
`&&(s=s.slice(0,-1)),g=E,x=T+2;break e}}else _==="<"&&N!=="/"&&u++;s+=_}else{if(_==="{"&&!m?a++:_==="}"&&!m?a--:(_==='"'||_==="'")&&!m?m=_:_===m&&(m=null),_==="/"&&N===">"&&a===0&&!m){p=!0,g=E,x=T+2;break e}else if(_===">"&&a===0&&!m){c=!0,T++;continue}i+=_}T++}if(c?s?.length>0&&E>0&&(s+=`
|
|
6
|
-
`):i+=`
|
|
7
|
-
`,o&&u<0){let _=k.match(o);if(_?.index!==void 0){g=E,x=_.index+_[0].length-1;break}}if(E===d.length-1&&!t&&!p)throw new Error("End match not found for lines "+e.join(`
|
|
8
|
-
`)+`
|
|
9
|
-
|
|
10
|
-
. Start match: `+JSON.stringify(n))}return{afterEndLine:d[g].trim().slice(x),beforeStartLine:h,content:s,endLineIndex:r+g,endlineLastCharIndex:x,propsString:i}}import{jsx as du}from"react/jsx-runtime";import mu from"bson-objectid";import"react";import{DecoratorBlockNode as $c}from"@lexical/react/LexicalDecoratorBlockNode.js";import Oc from"bson-objectid";var xt=class extends $c{__cacheBuster;__fields;constructor({cacheBuster:e,fields:o,format:r,key:n}){super(r,n),this.__fields=o,this.__cacheBuster=e||0}static clone(e){return new this({cacheBuster:e.__cacheBuster,fields:e.__fields,format:e.__format,key:e.__key})}static getType(){return"block"}static importDOM(){return{}}static importJSON(e){e.version===1&&(e={...e,fields:{...e.fields.data},version:2});let o=Fc(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}}getCacheBuster(){return this.getLatest().__cacheBuster}getFields(){return this.getLatest().__fields}getTextContent(){return"Block Field"}setFields(e,o){let r=this.getWritable();r.__fields=e,o||r.__cacheBuster++}};function Fc(t){return new xt({fields:{...t,id:t?.id||new Oc.default().toHexString()}})}import{jsx as G,jsxs as Ct,Fragment as wn}from"react/jsx-runtime";import{Button as En,Collapsible as Vc,Drawer as Kc,EditDepthProvider as Jc,ErrorPill as Xc,Form as zc,formatDrawerSlug as Zc,FormSubmit as Yc,Pill as qc,RenderFields as Qc,SectionTitle as eu,useConfig as tu,useDocumentForm as ou,useDocumentInfo as Sn,useEditDepth as ru,useFormSubmitted as nu,useServerFunctions as lu,useTranslation as iu}from"@payloadcms/ui";import{abortAndIgnore as Wo}from"@payloadcms/ui/shared";import{deepCopyObjectSimpleWithoutReactComponents as eo,reduceFieldsToValues as Ln}from"payload/shared";import bt,{useCallback as Go,useEffect as Vo,useMemo as kt,useRef as Ko}from"react";import{useLexicalComposerContext as su}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as au}from"@lexical/react/useLexicalEditable";import{getTranslation as cu}from"@payloadcms/translations";import{$getNodeByKey as to}from"lexical";import{v4 as uu}from"uuid";import{c as Pc}from"react/compiler-runtime";import{jsx as Qt,jsxs as Bc}from"react/jsx-runtime";import{useLexicalEditable as jc}from"@lexical/react/useLexicalEditable";import{RenderFields as Hc,useFormSubmitted as Uc}from"@payloadcms/ui";import Wc,{createContext as Gc}from"react";var kn=Gc({baseClass:"lexical-block",BlockCollapsible:()=>null,BlockDrawer:()=>null,CustomBlock:null,EditButton:()=>null,errorCount:0,formSchema:[],initialState:!1,nodeKey:"",RemoveButton:()=>null}),xe=()=>Wc.use(kn),_n=t=>{let e=Pc(4),{Collapsible:o,...r}=t,{BlockDrawer:n,CustomBlock:l,errorCount:i,formSchema:s}=r,c=Uc()&&i>0,u=jc(),a;e[0]!==o||e[1]!==i||e[2]!==c?(a=p=>{let{children:f,...h}=p;return Qt(o,{errorCount:i,fieldHasErrors:c,...h,children:f})},e[0]=o,e[1]=i,e[2]=c,e[3]=a):a=e[3];let m=a;return l?Bc(kn,{value:{...r,BlockCollapsible:m},children:[l,Qt(n,{})]}):Qt(m,{children:Qt(Hc,{fields:s,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!u})})};function Tn({fields:t}){for(let e in t){let o=t[e];Array.isArray(o?.rows)&&"value"in o&&(o.disableFormData=!0)}return t}var te="lexical-block",Nn=t=>{let{cacheBuster:e,formData:o,nodeKey:r}=t,n=nu(),{id:l,collectionSlug:i,globalSlug:s}=Sn(),{fieldProps:{featureClientSchemaMap:d,field:c,initialLexicalFormState:u,schemaPath:a},uuid:m}=j(),{fields:p}=ou(),f=Ko(new AbortController),h=ru(),[x,g]=bt.useState(0),{config:w}=tu(),E=Zc({slug:`lexical-blocks-create-${m}-${o.id}`,depth:h}),{toggleDrawer:C}=he(E),{getDocPreferences:k,setDocFieldPreferences:b}=Sn(),[T]=su(),_=au(),N=o.blockType,{getFormState:F}=lu(),M=`${a}.lexical_internal_feature.blocks.lexical_blocks.${N}.fields`,[y,S]=bt.useState(()=>u?.[o.id]?.formState?{...u?.[o.id]?.formState,blockName:{initialValue:o.blockName,passesCondition:!0,valid:!0,value:o.blockName}}:!1),L=Ko(!1),R=Ko(e);Vo(()=>{L.current?(R.current!==e&&S(!1),R.current=e):L.current=!0},[e]);let[A,I]=bt.useState(y?._components?.customComponents?.BlockLabel??void 0),[$,D]=bt.useState(y?._components?.customComponents?.Block??void 0);Vo(()=>{let H=new AbortController;return o&&!y&&(async()=>{let{state:V}=await F({id:l,collectionSlug:i,data:o,docPermissions:{fields:!0},docPreferences:await k(),documentFormState:eo(p),globalSlug:s,initialBlockData:o,operation:"update",readOnly:!_,renderAllFields:!0,schemaPath:M,signal:H.signal});if(V){V.blockName={initialValue:o.blockName,passesCondition:!0,valid:!0,value:o.blockName};let X=Ln(eo(V),!0);T.update(()=>{let q=to(r);if(q&&Ae(q)){let re=X;re.blockType=N,q.setFields(re,!0)}}),S(V),I(V._components?.customComponents?.BlockLabel??void 0),D(V._components?.customComponents?.Block??void 0)}})(),()=>{Wo(H)}},[F,M,_,l,o,T,r,y,i,s,k,p,N]);let[W,Q]=bt.useState(u?.[o.id]?.collapsed??!1),J=`${a}.lexical_internal_feature.blocks.lexical_blocks.${N}`,pe=d.blocks?.[J]?.[0],U=pe.blockReferences?typeof pe?.blockReferences?.[0]=="string"?w.blocksMap[pe?.blockReferences?.[0]]:pe?.blockReferences?.[0]:pe?.blocks?.[0],{i18n:ie,t:fe}=iu(),ct=Go(async({formState:H,submit:ue})=>{Wo(f.current);let V=new AbortController;f.current=V;let{state:X}=await F({id:l,collectionSlug:i,docPermissions:{fields:!0},docPreferences:await k(),documentFormState:eo(p),formState:H,globalSlug:s,initialBlockFormState:H,operation:"update",readOnly:!_,renderAllFields:!!ue,schemaPath:M,signal:V.signal});if(!X)return H;H.blockName&&(X.blockName=H.blockName);let q=Ln(Tn({fields:eo(X)}),!0);if(setTimeout(()=>{T.update(()=>{let re=to(r);if(re&&Ae(re)){let Ke=q;Ke.blockType=N,re.setFields(Ke,!0)}})},0),ue){I(X._components?.customComponents?.BlockLabel??void 0),D(X._components?.customComponents?.Block??void 0);let re=0;for(let Ke of Object.values(X))Ke?.valid===!1&&re++;g(re)}return X},[F,l,i,k,s,M,N,p,_,T,r]);Vo(()=>()=>{Wo(f.current)},[]);let Le=Go(()=>{T.update(()=>{to(r)?.remove()})},[T,r]),Ne=U?.labels?.singular?cu(U.labels.singular,ie):U?.slug,jt=Go(H=>{k().then(ue=>{let X=ue?.fields?.[c.name]?.collapsed,q=X&&X?.length?X:[];H?q.includes(o.id)||q.push(o.id):q.includes(o.id)&&q.splice(q.indexOf(o.id),1),b(c.name,{collapsed:q,hello:"hi"})})},[k,c.name,b,o.id]),Ge=kt(()=>()=>G(En,{buttonStyle:"icon-label",className:`${te}__editButton`,disabled:!_,el:"button",icon:"edit",onClick:H=>(H.preventDefault(),H.stopPropagation(),C(),!1),onMouseDown:H=>{H.preventDefault()},round:!0,size:"small",tooltip:fe("lexical:blocks:inlineBlocks:edit",{label:Ne})}),[Ne,fe,_,C]),Ve=kt(()=>()=>G(En,{buttonStyle:"icon-label",className:`${te}__removeButton`,disabled:!_,icon:"x",onClick:H=>{H.preventDefault(),Le()},round:!0,tooltip:"Remove Block"}),[_,Le]),Ao=kt(()=>({Actions:H,children:ue,className:V,collapsibleProps:X,disableBlockName:q,editButton:re,errorCount:Ke,fieldHasErrors:$o,Label:Qr,Pill:en,removeButton:cc})=>G("div",{className:te+" "+te+"-"+N,children:G(Vc,{className:[`${te}__row`,$o?`${te}__row--has-errors`:`${te}__row--no-errors`,V].filter(Boolean).join(" "),collapsibleStyle:$o?"error":"default",header:Ct("div",{className:`${te}__block-header`,children:[typeof Qr<"u"?Qr:typeof A<"u"?A:Ct("div",{className:`${te}__block-label`,children:[typeof en<"u"?en:G(qc,{className:`${te}__block-pill ${te}__block-pill-${N}`,pillStyle:"white",size:"small",children:Ne??N}),!q&&!U?.admin?.disableBlockName&&G(eu,{path:"blockName",readOnly:!_}),$o&&G(Xc,{count:Ke??0,i18n:ie,withMessage:!0})]}),G("div",{className:`${te}__block-actions`,children:typeof H<"u"?H:Ct(wn,{children:[$&&re!==!1||!$&&re?G(Ge,{}):null,cc!==!1&&_?G(Ve,{}):null]})})]}),isCollapsed:W,onToggle:tn=>{jt(tn),Q(tn)},...X||{},children:ue},0)}),[$,A,Ge,Ve,Ne,U?.admin?.disableBlockName,N,ie,W,jt,_]),Yr=o?.id,qr=kt(()=>()=>G(Jc,{children:G(Kc,{className:"",slug:E,title:fe(`lexical:blocks:inlineBlocks:${Yr?"edit":"create"}`,{label:Ne??fe("lexical:blocks:inlineBlocks:label")}),children:y?Ct(wn,{children:[G(Qc,{fields:U?.fields??[],forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:M,permissions:!0,readOnly:!_}),G(Yc,{programmaticSubmit:!0,children:fe("fields:saveChanges")})]}):null})}),[y,E,Yr,Ne,fe,_,U?.fields,M]),ac=kt(()=>y?G(zc,{beforeSubmit:[async({formState:H})=>await ct({formState:H,submit:!0})],el:"div",fields:U?.fields??[],initialState:y,onChange:[ct],onSubmit:(H,ue)=>{ue.blockType=N,T.update(()=>{let V=to(r);V&&Ae(V)&&V.setFields(ue,!0)}),C()},submitted:n,uuid:uu(),children:G(_n,{baseClass:te,BlockDrawer:qr,Collapsible:Ao,CustomBlock:$,EditButton:Ge,errorCount:x,formSchema:U?.fields??[],initialState:y,nodeKey:r,RemoveButton:Ve})}):null,[Ao,qr,$,N,Ve,Ge,T,x,C,U?.fields,y,r,ct,n]);return U?ac:G(Ao,{disableBlockName:!0,fieldHasErrors:!0,children:Ct("div",{className:"lexical-block-not-found",children:["Error: Block '",N,"' not found in the config but exists in the lexical data"]})})};var se=class extends xt{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=$e(e.fields);return o.setFormat(e.format),o}decorate(e,o){return du(Nn,{cacheBuster:this.getCacheBuster(),formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function $e(t){return new se({fields:{...t,id:t?.id||new mu.default().toHexString()}})}function Ae(t){return t instanceof se}import{createHeadlessEditor as pu}from"@lexical/headless";function Jo(t,e){return({editorState:r})=>{let n=pu({nodes:t});try{n.setEditorState(n.parseEditorState(r))}catch(i){console.error("getLexicalToMarkdown: ERROR parsing editor state",i)}let l="";return n.getEditorState().read(()=>{l=Ut(e)}),l}}import{createHeadlessEditor as fu}from"@lexical/headless";function oo(t,e){return({markdown:r})=>{let n=fu({nodes:t});return n.update(()=>{Ht(r,e)},{discrete:!0}),n.getEditorState().toJSON()}}function hu(t){let e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{regExpEnd:new RegExp(`</(${e})\\s*>|<${e}[^>]*?/>`,"i"),regExpStart:new RegExp(`<(${e})([^>]*?)\\s*(/?)>`,"i")}}var In=({blocks:t,inlineBlocks:e})=>{if(!t?.length&&!e?.length)return[];let o=[];if(t?.length)for(let r of t){let n=Rn(r,!1);n&&(o=o.concat(n))}if(e?.length)for(let r of e){let n=Rn(r,!0);n&&(o=o.concat(n))}return o};function Rn(t,e){if(!t.jsx)return null;let o=hu(t.slug),r=[];return e?(r.push(({allNodes:n,allTransformers:l})=>({type:"text-match",dependencies:[ut],export:i=>{if(!mt(i)||i.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let s=i.getFields(),d=Jo(n,l),c=t.jsx.export({fields:s,lexicalToMarkdown:d});if(c===!1)return null;if(typeof c=="string")return c;let u=c.props&&Object.keys(c.props)?.length>0,a=c.props??{};return c?.children?.length?`<${s.blockType}${u?" "+gt({props:a}):""}>${c.children}</${s.blockType}>`:`<${s.blockType}${u?" "+gt({props:a}):""}/>`},getEndIndex:(i,s)=>{let{endlineLastCharIndex:d}=qt({isEndOptional:!1,lines:[i.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:s,trimChildren:!1});return d},importRegExp:t.jsx?.customStartRegex??o.regExpStart,regExp:/___ignoreignoreignore___/g,replace(i,s){let{content:d,propsString:c}=qt({isEndOptional:!1,lines:[i.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:{...s,index:0},trimChildren:!1});if(!t?.jsx?.import)return;let u=oo(n,l),a=t.jsx.import({children:d,closeMatch:null,htmlToLexical:null,markdownToLexical:u,openMatch:s,props:c?Yt({propsString:c}):{}});if(a===!1)return;let m=dt({blockType:t.slug,...a});i.replace(m)}})),r):(r.push(({allNodes:n,allTransformers:l})=>({dependencies:[se],export:i=>{if(!Ae(i)||i.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let s=i.getFields(),d=Jo(n,l),c=t.jsx.export({fields:s,lexicalToMarkdown:d});if(c===!1)return null;if(typeof c=="string")return c;let u=c.props&&Object.keys(c.props)?.length>0,a=c.props??{};if(c?.children?.length){let m=c.children,p="";if(m.includes(`
|
|
11
|
-
`))for(let f of m.split(`
|
|
12
|
-
`)){let h="";!t?.jsx?.doNotTrimChildren&&f!==""&&(h=" "),h+=f+`
|
|
13
|
-
`,p+=h}else p=(t?.jsx?.doNotTrimChildren?"":" ")+m+`
|
|
14
|
-
`;return`<${s.blockType}${u?" "+gt({props:a}):""}>
|
|
15
|
-
${p}</${s.blockType}>`}return`<${s.blockType}${u?" "+gt({props:a}):""}/>`},handleImportAfterStartMatch:t.jsx?.customEndRegex?void 0:({lines:i,rootNode:s,startLineIndex:d,startMatch:c,transformer:u})=>{let a=typeof u.regExpEnd=="object"&&"regExp"in u.regExpEnd?u.regExpEnd.regExp:u.regExpEnd,m=u.regExpEnd&&typeof u.regExpEnd=="object"&&"optional"in u.regExpEnd?u.regExpEnd.optional:!u.regExpEnd,{afterEndLine:p,beforeStartLine:f,content:h,endLineIndex:x,propsString:g}=qt({isEndOptional:m,lines:i,regexpEndRegex:a,startLineIndex:d,startMatch:c,trimChildren:!1}),w="";if(t?.jsx?.doNotTrimChildren)w=h.endsWith(`
|
|
16
|
-
`)?h.slice(0,-1):h;else if(h.includes(`
|
|
17
|
-
`)){let b=h.split(`
|
|
18
|
-
`),T=0;for(let _ of b){if(T++,_.startsWith(" "))w+=_.slice(2);else if(_==="")w+=_;else{w=h.endsWith(`
|
|
19
|
-
`)?h.slice(0,-1):h;break}w+=T===b.length?"":`
|
|
20
|
-
`}}else w=(h.startsWith(" ")?h.slice(2):h)+`
|
|
21
|
-
`;if(!t?.jsx?.import)return[!1,d];let E=oo(n,l),C=t.jsx.import({children:w,closeMatch:null,htmlToLexical:null,markdownToLexical:E,openMatch:c,props:g?Yt({propsString:g}):{}});if(C===!1)return[!1,d];let k=$e({blockType:t.slug,...C});if(k){let b=null,T=null;if(f?.length){b=E({markdown:f})?.root?.children??[];let _=b?.[0];_&&s.append(yn(_))}if(s.append(k),p?.length){T=E({markdown:p})?.root?.children;let _=s.getChildren()[s.getChildren().length-1],N=yn(T[0])?.getChildren();if(N?.length)for(let F of N)_.append(F)}}return[!0,x]},regExpEnd:t.jsx?.customEndRegex??o.regExpEnd,regExpStart:t.jsx?.customStartRegex??o.regExpStart,type:"multiline-element",replace:(i,s,d,c,u)=>{if(t?.jsx?.import){if(!u){let x="";if(s)for(let g of s)x+=g.getTextContent();u=[x]}let a="";t?.jsx?.doNotTrimChildren?a=u.join(`
|
|
22
|
-
`):a=u.join(`
|
|
23
|
-
`).trim();let m=d[1]?.trim(),p=oo(n,l),f=t.jsx.import({children:a,closeMatch:c,htmlToLexical:null,markdownToLexical:p,openMatch:d,props:m?Yt({propsString:m}):{}});if(f===!1)return!1;let h=$e({blockType:t.slug,...f});h&&i.append(h);return}return!1}})),r)}import{createCommand as vn}from"lexical";var Xe=vn("INSERT_BLOCK_COMMAND"),ze=vn("INSERT_INLINE_BLOCK_COMMAND");import{c as gu}from"react/compiler-runtime";import{useLexicalComposerContext as xu}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Cu,$wrapNodeInElement as bu,mergeRegister as ku}from"@lexical/utils";import{formatDrawerSlug as _u,useEditDepth as Tu}from"@payloadcms/ui";import{$createParagraphNode as wu,$getNodeByKey as Eu,$getPreviousSelection as Su,$getSelection as Lu,$insertNodes as Nu,$isParagraphNode as yu,$isRangeSelection as Ru,$isRootOrShadowRoot as Iu,COMMAND_PRIORITY_EDITOR as Mn}from"lexical";import{useEffect as vu,useState as Mu}from"react";var Dn=()=>{let t=gu(12),[e]=xu(),[o,r]=Mu(null),{setCreatedInlineBlock:n,uuid:l}=j(),i=Tu(),s="lexical-inlineBlocks-create-"+l,d;t[0]!==i||t[1]!==s?(d=_u({slug:s,depth:i}),t[0]=i,t[1]=s,t[2]=d):d=t[2];let c=d,{toggleDrawer:u}=he(c,!0),a;t[3]!==e||t[4]!==n||t[5]!==o?(a=()=>{if(!e.hasNodes([se]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return ku(e.registerCommand(Xe,p=>(e.update(()=>{let f=Lu()||Su();if(Ru(f)){let h=$e(p),{focus:x}=f,g=x.getNode();Cu(h),yu(g)&&!g.__first&&g.remove()}}),!0),Mn),e.registerCommand(ze,p=>{if(o){let h=Eu(o);return!h||!mt(h)?!1:(h.setFields(p),r(null),!0)}let f=dt(p);return n?.(f),Nu([f]),Iu(f.getParentOrThrow())&&bu(f,wu).selectEnd(),!0},Mn))},t[3]=e,t[4]=n,t[5]=o,t[6]=a):a=t[6];let m;return t[7]!==e||t[8]!==n||t[9]!==o||t[10]!==u?(m=[e,n,o,u],t[7]=e,t[8]=n,t[9]=o,t[10]=u,t[11]=m):m=t[11],vu(a,m),null};var Du=v(({config:t,featureClientSchemaMap:e,props:o,schemaPath:r})=>{let n=`${r}.lexical_internal_feature.blocks.lexical_blocks`,l=`${r}.lexical_internal_feature.blocks.lexical_inline_blocks`,i=e.blocks;if(!i)return{};let s=Object.entries(i).filter(([a])=>a.startsWith(n+".")&&!a.replace(n+".","").includes(".")).map(([,a])=>a[0]),d=Object.entries(i).filter(([a])=>a.startsWith(l+".")&&!a.replace(l+".","").includes(".")).map(([,a])=>a[0]),c=s.map(a=>a.blockReferences?typeof a.blockReferences[0]=="string"?t.blocksMap[a.blockReferences[0]]:a.blockReferences[0]:a.blocks[0]).filter(a=>a!==void 0),u=d.map(a=>a.blockReferences?typeof a.blockReferences[0]=="string"?t.blocksMap[a.blockReferences[0]]:a.blockReferences[0]:a.blocks[0]).filter(a=>a!==void 0);return{markdownTransformers:In({blocks:c,inlineBlocks:u}),nodes:[se,ut],plugins:[{Component:Dn,position:"normal"}],sanitizedClientFeatureProps:o,slashMenu:{groups:[c?.length?{items:c.map(a=>({Icon:Zt(a.imageURL,a.imageAltText),key:"block-"+a.slug,keywords:["block","blocks",a.slug],label:({i18n:m})=>a?.labels?.singular?ro(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(Xe,{blockName:"",blockType:a.slug})}})),key:"blocks",label:({i18n:a})=>a.t("lexical:blocks:label")}:null,u?.length?{items:u.map(a=>({Icon:zt,key:"inlineBlocks-"+a.slug,keywords:["inlineBlock","inline block",a.slug],label:({i18n:m})=>a?.labels?.singular?ro(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(ze,{blockName:"",blockType:a.slug})}})),key:"inlineBlocks",label:({i18n:a})=>a.t("lexical:blocks:inlineBlocks:label")}:null].filter(Boolean)},toolbarFixed:{groups:[c.length?{type:"dropdown",ChildComponent:Xt,items:c.map((a,m)=>({ChildComponent:Zt(a.imageURL,a.imageAltText),isActive:void 0,key:"block-"+a.slug,label:({i18n:p})=>a?.labels?.singular?ro(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(Xe,{blockName:"",blockType:a.slug})},order:m})),key:"blocks",order:20}:null,u?.length?{type:"dropdown",ChildComponent:zt,items:u.map((a,m)=>({ChildComponent:a.imageURL?Zt(a.imageURL,a.imageAltText):zt,isActive:void 0,key:"inlineBlock-"+a.slug,label:({i18n:p})=>a?.labels?.singular?ro(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(ze,{blockName:"",blockType:a.slug})},order:m})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}});import{c as Ou}from"react/compiler-runtime";import{jsx as Fe,jsxs as Yo}from"react/jsx-runtime";import{useLexicalComposerContext as Fu}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as Pu,$createTextNode as Bu,$getRoot as ju,getDOMSelection as Xo}from"lexical";import*as Pn from"react";import{useCallback as Oe,useEffect as zo,useLayoutEffect as $n,useRef as Zo,useState as no}from"react";var Au=ne&&"documentMode"in document?document.documentMode:null,An=ne&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),g5=ne&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),x5=ne&&"InputEvent"in window&&!Au?"getTargetRanges"in new window.InputEvent("input"):!1,C5=ne&&/Version\/[\d.].*Safari/.test(navigator.userAgent),b5=ne&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,k5=ne&&/Android/.test(navigator.userAgent),_5=ne&&/Win/.test(navigator.platform),$u=ne&&/^(?=.*Chrome).*/i.test(navigator.userAgent),T5=ne&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!$u;var Hu=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)},Uu=(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)},Wu=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 l=t.getPreviousSibling();if(Zr(l)){l.splice(l.getChildrenSize(),0,[...e]),l.select(0,0),t.remove();return}}let n=Wa();n.append(...e),t.replace(n),n.select(0,0)}};var Qr=[Q([{ChildComponent:Ro,isActive:({selection:t})=>{if(!Ja(t))return!1;for(let e of t.getNodes())if(!qr(e)&&!qr(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=on();tn(e,()=>en())})},order:20}])],Xa=v({markdownTransformers:[Yr],nodes:[Ka],slashMenu:{groups:[Z([{Icon:Ro,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=on();tn(e,()=>en())})}}])]},toolbarFixed:{groups:Qr},toolbarInline:{groups:Qr}});import{getTranslation as Jt}from"@payloadcms/translations";import{jsx as vo,jsxs as za}from"react/jsx-runtime";import"react";var Ht=()=>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:[vo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),vo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),vo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as rn}from"react/jsx-runtime";import"react";var jt=()=>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",{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 Za}from"react/jsx-runtime";import"react";function Ut(t,e){return t?()=>Za("img",{alt:e??"Block Image",className:"lexical-block-custom-image",src:t,style:{maxHeight:20,maxWidth:20}}):Ht}import{jsx as Nc}from"react/jsx-runtime";import Lc from"bson-objectid";import"react";import{DecoratorBlockNode as Ya}from"@lexical/react/LexicalDecoratorBlockNode.js";import qa from"bson-objectid";var st=class extends Ya{__cacheBuster;__fields;constructor({cacheBuster:e,fields:o,format:r,key:n}){super(r,n),this.__fields=o,this.__cacheBuster=e||0}static clone(e){return new this({cacheBuster:e.__cacheBuster,fields:e.__fields,format:e.__format,key:e.__key})}static getType(){return"block"}static importDOM(){return{}}static importJSON(e){e.version===1&&(e={...e,fields:{...e.fields.data},version:2});let o=Qa(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}}getCacheBuster(){return this.getLatest().__cacheBuster}getFields(){return this.getLatest().__fields}getTextContent(){return"Block Field"}setFields(e,o){let r=this.getWritable();r.__fields=e,o||r.__cacheBuster++}};function Qa(t){return new st({fields:{...t,id:t?.id||new qa.default().toHexString()}})}import{jsx as K,jsxs as at,Fragment as ic}from"react/jsx-runtime";import{Button as an,Collapsible as sc,Drawer as ac,EditDepthProvider as cc,ErrorPill as uc,Form as dc,formatDrawerSlug as mc,FormSubmit as pc,Pill as fc,RenderFields as hc,SectionTitle as gc,useConfig as xc,useDocumentForm as Cc,useDocumentInfo as cn,useEditDepth as bc,useFormSubmitted as kc,useServerFunctions as _c,useTranslation as Tc}from"@payloadcms/ui";import{abortAndIgnore as Mo}from"@payloadcms/ui/shared";import{deepCopyObjectSimpleWithoutReactComponents as Wt,reduceFieldsToValues as un}from"payload/shared";import ct,{useCallback as Do,useEffect as Ao,useMemo as ut,useRef as Oo}from"react";import{useLexicalComposerContext as wc}from"@lexical/react/LexicalComposerContext";import{getTranslation as Ec}from"@payloadcms/translations";import{$getNodeByKey as Vt}from"lexical";import{v4 as Sc}from"uuid";import{c as ec}from"react/compiler-runtime";import{jsx as Gt,jsxs as tc}from"react/jsx-runtime";import{RenderFields as oc,useFormSubmitted as rc}from"@payloadcms/ui";import nc,{createContext as lc}from"react";var nn=lc({initialState:!1}),ve=()=>nc.use(nn),ln=t=>{let e=ec(13),{BlockDrawer:o,Collapsible:r,CustomBlock:n,EditButton:l,errorCount:i,formSchema:s,initialState:u,nodeKey:c,RemoveButton:d}=t,p=rc()&&i>0,m;e[0]!==r||e[1]!==i||e[2]!==p?(m=x=>Gt(r,{editButton:x.editButton,errorCount:i,fieldHasErrors:p,Label:x.Label,removeButton:x.removeButton,children:x.children}),e[0]=r,e[1]=i,e[2]=p,e[3]=m):m=e[3];let f=m,h;return e[4]!==o||e[5]!==f||e[6]!==n||e[7]!==l||e[8]!==d||e[9]!==s||e[10]!==u||e[11]!==c?(h=n?tc(nn,{value:{BlockCollapsible:f,EditButton:l,initialState:u,nodeKey:c,RemoveButton:d},children:[n,Gt(o,{})]}):Gt(f,{children:Gt(oc,{fields:s,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0})}),e[4]=o,e[5]=f,e[6]=n,e[7]=l,e[8]=d,e[9]=s,e[10]=u,e[11]=c,e[12]=h):h=e[12],h};function sn({fields:t}){for(let e in t){let o=t[e];Array.isArray(o?.rows)&&"value"in o&&(o.disableFormData=!0)}return t}var le="lexical-block",dn=t=>{let{cacheBuster:e,formData:o,nodeKey:r}=t,n=kc(),{id:l,collectionSlug:i,globalSlug:s}=cn(),{fieldProps:{featureClientSchemaMap:u,field:c,initialLexicalFormState:d,permissions:a,readOnly:p,schemaPath:m},uuid:f}=H(),{fields:h}=Cc(),x=Oo(new AbortController),b=bc(),[T,E]=ct.useState(0),{config:C}=xc(),k=mc({slug:`lexical-blocks-create-${f}-${o.id}`,depth:b}),{toggleDrawer:g}=me(k),{getDocPreferences:w,setDocFieldPreferences:L}=cn(),[D]=wc(),{getFormState:F}=_c(),R=`${m}.lexical_internal_feature.blocks.lexical_blocks.${o.blockType}.fields`,[S,_]=ct.useState(()=>d?.[o.id]?.formState?{...d?.[o.id]?.formState,blockName:{initialValue:o.blockName,passesCondition:!0,valid:!0,value:o.blockName}}:!1),N=Oo(!1),M=Oo(e);Ao(()=>{N.current?(M.current!==e&&_(!1),M.current=e):N.current=!0},[e]);let[I,A]=ct.useState(S?._components?.customComponents?.BlockLabel),[y,$]=ct.useState(S?._components?.customComponents?.Block);Ao(()=>{let j=new AbortController;return o&&!S&&(async()=>{let{state:W}=await F({id:l,collectionSlug:i,data:o,docPermissions:{fields:!0},docPreferences:await w(),documentFormState:Wt(h),globalSlug:s,initialBlockData:o,operation:"update",renderAllFields:!0,schemaPath:R,signal:j.signal});if(W){W.blockName={initialValue:o.blockName,passesCondition:!0,valid:!0,value:o.blockName};let z=un(Wt(W),!0);D.update(()=>{let V=Vt(r);if(V&&dt(V)){let oe=z;oe.blockType=o.blockType,V.setFields(oe,!0)}}),_(W),A(W._components?.customComponents?.BlockLabel),$(W._components?.customComponents?.Block)}})(),()=>{Mo(j)}},[F,R,l,o,D,r,S,i,s,w,h]);let[G,q]=ct.useState(d?.[o.id]?.collapsed??!1),te=`${m}.lexical_internal_feature.blocks.lexical_blocks.${o.blockType}`,X=u.blocks?.[te]?.[0],U=X.blockReferences?typeof X?.blockReferences?.[0]=="string"?C.blocksMap[X?.blockReferences?.[0]]:X?.blockReferences?.[0]:X?.blocks?.[0],{i18n:Be,t:we}=Tc(),de=Do(async({formState:j,submit:ae})=>{Mo(x.current);let W=new AbortController;x.current=W;let{state:z}=await F({id:l,collectionSlug:i,docPermissions:{fields:!0},docPreferences:await w(),documentFormState:Wt(h),formState:j,globalSlug:s,initialBlockFormState:j,operation:"update",renderAllFields:!!ae,schemaPath:R,signal:W.signal});if(!z)return j;j.blockName&&(z.blockName=j.blockName);let V=un(sn({fields:Wt(z)}),!0);if(setTimeout(()=>{D.update(()=>{let oe=Vt(r);if(oe&&dt(oe)){let je=V;je.blockType=o.blockType,oe.setFields(je,!0)}})},0),ae){A(z._components?.customComponents?.BlockLabel),$(z._components?.customComponents?.Block);let oe=0;for(let je of Object.values(z))je?.valid===!1&&oe++;E(oe)}return z},[F,l,i,w,s,R,o.blockType,h,D,r]);Ao(()=>()=>{Mo(x.current)},[]);let Mt=Do(()=>{D.update(()=>{Vt(r)?.remove()})},[D,r]),Ee=U?.labels?.singular?Ec(U.labels.singular,Be):U?.slug,Dt=Do(j=>{w().then(ae=>{let z=ae?.fields?.[c.name]?.collapsed,V=z&&z?.length?z:[];j?V.includes(o.id)||V.push(o.id):V.includes(o.id)&&V.splice(V.indexOf(o.id),1),L(c.name,{collapsed:V,hello:"hi"})})},[w,c.name,L,o.id]),He=ut(()=>()=>K(an,{buttonStyle:"icon-label",className:`${le}__editButton`,disabled:p,el:"button",icon:"edit",onClick:j=>(j.preventDefault(),j.stopPropagation(),g(),!1),onMouseDown:j=>{j.preventDefault()},round:!0,size:"small",tooltip:we("lexical:blocks:inlineBlocks:edit",{label:Ee})}),[Ee,p,we,g]),At=ut(()=>()=>K(an,{buttonStyle:"icon-label",className:`${le}__removeButton`,disabled:c?.admin?.readOnly||!1,icon:"x",onClick:j=>{j.preventDefault(),Mt()},round:!0,tooltip:"Remove Block"}),[c?.admin?.readOnly,Mt]),To=ut(()=>({children:j,disableBlockName:ae,editButton:W,errorCount:z,fieldHasErrors:V,Label:oe,removeButton:je})=>K("div",{className:le+" "+le+"-"+o.blockType,children:K(sc,{className:[`${le}__row`,V?`${le}__row--has-errors`:`${le}__row--no-errors`].join(" "),collapsibleStyle:V?"error":"default",header:at("div",{className:`${le}__block-header`,children:[oe??I?oe??I:at("div",{children:[K(fc,{className:`${le}__block-pill ${le}__block-pill-${o?.blockType}`,pillStyle:"white",size:"small",children:Ee??o?.blockType}),!ae&&!U?.admin?.disableBlockName&&K(gc,{path:"blockName",readOnly:c?.admin?.readOnly||!1}),V&&K(uc,{count:z??0,i18n:Be,withMessage:!0})]}),at("div",{children:[y&&W!==!1||!y&&W?K(He,{}):null,je!==!1&&D.isEditable()?K(At,{}):null]})]}),isCollapsed:G,onToggle:Hr=>{Dt(Hr),q(Hr)},children:j},0)}),[y,I,He,At,Ee,U?.admin?.disableBlockName,D,o.blockType,Be,G,Dt,c?.admin?.readOnly]),Br=ut(()=>()=>K(cc,{children:K(ac,{className:"",slug:k,title:we(`lexical:blocks:inlineBlocks:${o?.id?"edit":"create"}`,{label:Ee??we("lexical:blocks:inlineBlocks:label")}),children:S?at(ic,{children:[K(hc,{fields:U?.fields??[],forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:R,permissions:!0,readOnly:!1}),K(pc,{programmaticSubmit:!0,children:we("fields:saveChanges")})]}):null})}),[S,k,Ee,we,U?.fields,R,a]),va=ut(()=>S?K(dc,{beforeSubmit:[async({formState:j})=>await de({formState:j,submit:!0})],el:"div",fields:U?.fields??[],initialState:S,onChange:[de],onSubmit:(j,ae)=>{ae.blockType=o.blockType,D.update(()=>{let W=Vt(r);W&&dt(W)&&W.setFields(ae,!0)}),g()},submitted:n,uuid:Sc(),children:K(ln,{baseClass:le,BlockDrawer:Br,Collapsible:To,CustomBlock:y,EditButton:He,errorCount:T,formSchema:U?.fields??[],initialState:S,nodeKey:r,RemoveButton:At})}):null,[To,Br,y,U?.fields,At,He,D,T,g,U?.fields,S,r,de,n]);return U?va:K(To,{disableBlockName:!0,fieldHasErrors:!0,children:at("div",{className:"lexical-block-not-found",children:["Error: Block '",o.blockType,"' not found in the config but exists in the lexical data"]})})};var fe=class extends st{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){e.version===1&&(e={...e,fields:{...e.fields.data},version:2});let o=Kt(e.fields);return o.setFormat(e.format),o}decorate(e,o){return Nc(dn,{cacheBuster:this.getCacheBuster(),formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Kt(t){return new fe({fields:{...t,id:t?.id||new Lc.default().toHexString()}})}function dt(t){return t instanceof fe}import{createCommand as mn}from"lexical";var Ge=mn("INSERT_BLOCK_COMMAND"),We=mn("INSERT_INLINE_BLOCK_COMMAND");import{c as yc}from"react/compiler-runtime";import{useLexicalComposerContext as Ic}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Rc,$wrapNodeInElement as vc,mergeRegister as Mc}from"@lexical/utils";import{formatDrawerSlug as Dc,useEditDepth as Ac}from"@payloadcms/ui";import{$createParagraphNode as Oc,$getNodeByKey as Fc,$getPreviousSelection as $c,$getSelection as Pc,$insertNodes as Bc,$isParagraphNode as Hc,$isRangeSelection as jc,$isRootOrShadowRoot as Uc,COMMAND_PRIORITY_EDITOR as pn}from"lexical";import{useEffect as Gc,useState as Wc}from"react";var fn=()=>{let t=yc(12),[e]=Ic(),[o,r]=Wc(null),{setCreatedInlineBlock:n,uuid:l}=H(),i=Ac(),s="lexical-inlineBlocks-create-"+l,u;t[0]!==i||t[1]!==s?(u=Dc({slug:s,depth:i}),t[0]=i,t[1]=s,t[2]=u):u=t[2];let c=u,{toggleDrawer:d}=me(c,!0),a;t[3]!==e||t[4]!==n||t[5]!==o?(a=()=>{if(!e.hasNodes([fe]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return Mc(e.registerCommand(Ge,m=>(e.update(()=>{let f=Pc()||$c();if(jc(f)){let h=Kt(m),{focus:x}=f,b=x.getNode();Rc(h),Hc(b)&&!b.__first&&b.remove()}}),!0),pn),e.registerCommand(We,m=>{if(o){let h=Fc(o);return!h||!So(h)?!1:(h.setFields(m),r(null),!0)}let f=Eo(m);return n?.(f),Bc([f]),Uc(f.getParentOrThrow())&&vc(f,Oc).selectEnd(),!0},pn))},t[3]=e,t[4]=n,t[5]=o,t[6]=a):a=t[6];let p;return t[7]!==e||t[8]!==n||t[9]!==o||t[10]!==d?(p=[e,n,o,d],t[7]=e,t[8]=n,t[9]=o,t[10]=d,t[11]=p):p=t[11],Gc(a,p),null};var Vc=v(({config:t,featureClientSchemaMap:e,props:o,schemaPath:r})=>{let n=`${r}.lexical_internal_feature.blocks.lexical_blocks`,l=`${r}.lexical_internal_feature.blocks.lexical_inline_blocks`,i=e.blocks;if(!i)return{};let s=Object.entries(i).filter(([a])=>a.startsWith(n+".")&&!a.replace(n+".","").includes(".")).map(([,a])=>a[0]),u=Object.entries(i).filter(([a])=>a.startsWith(l+".")&&!a.replace(l+".","").includes(".")).map(([,a])=>a[0]),c=s.map(a=>a.blockReferences?typeof a.blockReferences[0]=="string"?t.blocksMap[a.blockReferences[0]]:a.blockReferences[0]:a.blocks[0]).filter(a=>a!==void 0),d=u.map(a=>a.blockReferences?typeof a.blockReferences[0]=="string"?t.blocksMap[a.blockReferences[0]]:a.blockReferences[0]:a.blocks[0]).filter(a=>a!==void 0);return{nodes:[fe,wo],plugins:[{Component:fn,position:"normal"}],sanitizedClientFeatureProps:o,slashMenu:{groups:[c?.length?{items:c.map(a=>({Icon:Ut(a.imageURL,a.imageAltText),key:"block-"+a.slug,keywords:["block","blocks",a.slug],label:({i18n:p})=>a?.labels?.singular?Jt(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(Ge,{blockName:"",blockType:a.slug})}})),key:"blocks",label:({i18n:a})=>a.t("lexical:blocks:label")}:null,d?.length?{items:d.map(a=>({Icon:jt,key:"inlineBlocks-"+a.slug,keywords:["inlineBlock","inline block",a.slug],label:({i18n:p})=>a?.labels?.singular?Jt(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(We,{blockName:"",blockType:a.slug})}})),key:"inlineBlocks",label:({i18n:a})=>a.t("lexical:blocks:inlineBlocks:label")}:null].filter(Boolean)},toolbarFixed:{groups:[c.length?{type:"dropdown",ChildComponent:Ht,items:c.map((a,p)=>({ChildComponent:Ut(a.imageURL,a.imageAltText),isActive:void 0,key:"block-"+a.slug,label:({i18n:m})=>a?.labels?.singular?Jt(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(Ge,{blockName:"",blockType:a.slug})},order:p})),key:"blocks",order:20}:null,d?.length?{type:"dropdown",ChildComponent:jt,items:d.map((a,p)=>({ChildComponent:a.imageURL?Ut(a.imageURL,a.imageAltText):jt,isActive:void 0,key:"inlineBlock-"+a.slug,label:({i18n:m})=>a?.labels?.singular?Jt(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(We,{blockName:"",blockType:a.slug})},order:p})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}});import{c as Xc}from"react/compiler-runtime";import{jsx as De,jsxs as Bo}from"react/jsx-runtime";import{useLexicalComposerContext as zc}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as Zc,$createTextNode as Yc,$getRoot as qc,getDOMSelection as Fo}from"lexical";import*as bn from"react";import{useCallback as Me,useEffect as $o,useLayoutEffect as gn,useRef as Po,useState as Xt}from"react";var Kc=re&&"documentMode"in document?document.documentMode:null,hn=re&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),$2=re&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),P2=re&&"InputEvent"in window&&!Kc?"getTargetRanges"in new window.InputEvent("input"):!1,B2=re&&/Version\/[\d.].*Safari/.test(navigator.userAgent),H2=re&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,j2=re&&/Android/.test(navigator.userAgent),U2=re&&/Win/.test(navigator.platform),Jc=re&&/^(?=.*Chrome).*/i.test(navigator.userAgent),G2=re&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!Jc;var Qc=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)},eu=(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)},tu=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);
|
|
24
4
|
await assertSelection(page, {
|
|
25
5
|
anchorPath: [${n.anchorPath.toString()}],
|
|
26
6
|
anchorOffset: ${n.anchorOffset},
|
|
@@ -30,7 +10,7 @@ ${p}</${s.blockType}>`}return`<${s.blockType}${u?" "+gt({props:a}):""}/>`},handl
|
|
|
30
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(`
|
|
31
11
|
`);default:return` await repeat(${t.count}, async () => {
|
|
32
12
|
${o}
|
|
33
|
-
);`}};function
|
|
13
|
+
);`}};function ou(t){return t.key.toLowerCase()==="a"&&(hn?t.metaKey:t.ctrlKey)}function ru(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 xn(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 Cn=new Set(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Backspace","Delete","Enter","Escape"]);function nu(t){let[e,o]=Xt([]),[r,n]=Xt(!1),[,l]=Xt(""),[i,s]=Xt(""),u=Po(null),c=Po(!1),d=Po(null),a=Me(()=>t,[t]),p=Me(()=>{let C=t.getRootElement(),k=Fo(t._window);return C==null||k==null||k.anchorNode==null||k.focusNode==null||!C.contains(k.anchorNode)||!C.contains(k.focusNode)?null:`
|
|
34
14
|
import {
|
|
35
15
|
initializeE2E,
|
|
36
16
|
assertHTMLSnapshot,
|
|
@@ -47,20 +27,15 @@ describe('Test case', () => {
|
|
|
47
27
|
const {page} = e2e;
|
|
48
28
|
|
|
49
29
|
await page.focus('div[contenteditable="true"]');
|
|
50
|
-
${e.map(
|
|
30
|
+
${e.map(tu).join(`
|
|
51
31
|
`)}
|
|
52
32
|
});
|
|
53
33
|
});
|
|
54
|
-
`},[t,e]),p=Oe((C,k)=>{o(b=>{let T=e.length-1,_=e[T];if(_&&_.name===C){if(C==="type")return[...e.slice(0,T),{..._,value:_.value+k}];if(_.value===k)return[...e.slice(0,T),{..._,count:_.count+1}]}return[...b,{name:C,count:1,value:k}]})},[e,o]);$n(()=>{let C=b=>{if(!r)return;let T=b.key;Gu(b)?p("selectAll",""):Fn.has(T)?p("press",b.key):[...T].length>1?p("keydown",b.key):p("type",b.key)},k=b=>{if(!r)return;let T=b.key;!Fn.has(T)&&[...T].length>1&&p("keyup",b.key)};return t.registerRootListener((b,T)=>{T!==null&&(T.removeEventListener("keydown",C),T.removeEventListener("keyup",k)),b!==null&&(b.addEventListener("keydown",C),b.addEventListener("keyup",k))})},[t,r,p]),$n(()=>{u.current&&u.current.scrollTo(0,u.current.scrollHeight)},[m]),zo(()=>{if(e){let C=m();C!==null&&s(C),u.current&&u.current.scrollTo(0,u.current.scrollHeight)}},[m,e]),zo(()=>t.registerUpdateListener(({dirtyElements:k,dirtyLeaves:b,editorState:T})=>{if(!r)return;let _=T._selection,N=d.current,F=c.current;if(N!==_){if(b.size===0&&k.size===0&&!F){let y=Xo(t._window);if(y&&(y.anchorNode==null||y.focusNode==null))return}d.current=_}c.current=!1;let M=m();M!==null&&s(M)}),[t,m,r,p]),zo(()=>r?t.registerUpdateListener(()=>{let k=t.getRootElement();k!==null&&l(k?.innerHTML)}):void 0,[t,r]);let f=Oe(C=>{r||(C.update(()=>{let k=ju();k.clear();let b=Bu();k.append(Pu().append(b)),b.select()}),o([])),n(k=>!k)},[r]),h=Oe(()=>{if(!r)return;let C=Xo(t._window);if(C===null||C.anchorNode==null||C.focusNode==null)return;let{anchorNode:k,anchorOffset:b,focusNode:T,focusOffset:_}=Vu(C),N=a().getRootElement(),F;k!==null&&(F=On(k,N));let M;T!==null&&(M=On(T,N)),p("snapshot",{anchorNode:k,anchorOffset:b,anchorPath:F,focusNode:T,focusOffset:_,focusPath:M})},[p,r,a]),x=Oe(()=>{Hu(m())},[m]),g=Oe(()=>{Uu("test.js",m())},[m]);return[Fe("button",{className:`editor-dev-button ${r?"active":""}`,id:"test-recorder-button",onClick:C=>{f(a()),C.preventDefault()},title:r?"Disable test recorder":"Enable test recorder",type:"button",children:r?"Disable test recorder":"Enable test recorder"}),r?Yo("div",{className:"test-recorder-output",children:[Yo("div",{className:"test-recorder-toolbar",children:[Fe("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:C=>{h(),C.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),Fe("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:C=>{x(),C.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),Fe("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:C=>{g(),C.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),Fe("pre",{id:"test-recorder",ref:u,children:i})]}):null]}var Bn=()=>{let t=Ou(3),[e]=Fu(),[o,r]=Ku(e),n;return t[0]!==o||t[1]!==r?(n=Yo(Pn.Fragment,{children:[Fe("p",{children:"HI"}),o,r,Fe("p",{children:"DONE"})]}),t[0]=o,t[1]=r,t[2]=n):n=t[2],n};var Ju=v({plugins:[{Component:Bn,position:"bottom"}]});import{c as Xu}from"react/compiler-runtime";import{jsx as zu}from"react/jsx-runtime";import{useLexicalComposerContext as Zu}from"@lexical/react/LexicalComposerContext.js";import{TreeView as Yu}from"@lexical/react/LexicalTreeView.js";import"react";var jn=()=>{let t=Xu(2),[e]=Zu(),o;return t[0]!==e?(o=zu(Yu,{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 qu=v({plugins:[{Component:jn,position:"bottom"}]});import{$isTableSelection as Qu}from"@lexical/table";import{$isRangeSelection as ed,FORMAT_TEXT_COMMAND as td}from"lexical";import{jsx as Hn}from"react/jsx-runtime";import"react";var Un=()=>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.6772 15H6.27017V5.718H10.4172C12.6792 5.718 13.8492 6.602 13.8492 8.292C13.8492 9.098 13.1992 9.982 12.4712 10.216C13.3812 10.476 14.1742 11.256 14.1742 12.322C14.1742 14.09 12.9002 15 10.6772 15ZM8.46717 9.501H10.3262C11.3012 9.501 11.7042 9.046 11.7042 8.409C11.7042 7.72 11.2362 7.317 10.3392 7.317H8.46717V9.501ZM8.46717 11.061V13.401H10.4822C11.4702 13.401 11.9642 12.959 11.9642 12.218C11.9642 11.49 11.4702 11.061 10.4822 11.061H8.46717Z",fill:"currentColor"})});var Z=t=>({type:"buttons",items:t,key:"format",order:40});var Wn={type:"text-format",format:["bold","italic"],tag:"***"},Gn={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},Vn={type:"text-format",format:["bold"],tag:"**"},Kn={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var Jn=[Z([{ChildComponent:Un,isActive:({selection:t})=>ed(t)||Qu(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(td,"bold")},order:1}])],od=v(({featureProviderMap:t})=>{let e=[Vn,Kn];return t.get("italic")&&e.push(Gn,Wn),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:Jn},toolbarInline:{groups:Jn}}});import{$isTableSelection as nd}from"@lexical/table";import{$isRangeSelection as ld,FORMAT_TEXT_COMMAND as id}from"lexical";import{jsx as Xn,jsxs as rd}from"react/jsx-runtime";import"react";var zn=()=>rd("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:[Xn("path",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),Xn("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var Zn={type:"text-format",format:["code"],tag:"`"};var Yn=[Z([{ChildComponent:zn,isActive:({selection:t})=>ld(t)||nd(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(id,"code")},order:7}])],sd=v({enableFormats:["code"],markdownTransformers:[Zn],toolbarFixed:{groups:Yn},toolbarInline:{groups:Yn}});import{$isTableSelection as ad}from"@lexical/table";import{$isRangeSelection as cd,FORMAT_TEXT_COMMAND as ud}from"lexical";import{jsx as qn}from"react/jsx-runtime";import"react";var Qn=()=>qn("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:qn("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 el={type:"text-format",format:["italic"],tag:"*"},tl={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var ol=[Z([{ChildComponent:Qn,isActive:({selection:t})=>cd(t)||ad(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(ud,"italic")},order:2}])],dd=v({enableFormats:["italic"],markdownTransformers:[el,tl],toolbarFixed:{groups:ol},toolbarInline:{groups:ol}});import{$isTableSelection as pd}from"@lexical/table";import{$isRangeSelection as fd,FORMAT_TEXT_COMMAND as hd}from"lexical";import{jsx as rl,jsxs as md}from"react/jsx-runtime";import"react";var nl=()=>md("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:[rl("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"}),rl("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var ll={type:"text-format",format:["strikethrough"],tag:"~~"};var il=[Z([{ChildComponent:nl,isActive:({selection:t})=>fd(t)||pd(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(hd,"strikethrough")},order:4}])],gd=v({enableFormats:["strikethrough"],markdownTransformers:[ll],toolbarFixed:{groups:il},toolbarInline:{groups:il}});import{$isTableSelection as xd}from"@lexical/table";import{$isRangeSelection as Cd,FORMAT_TEXT_COMMAND as bd}from"lexical";import{jsx as sl}from"react/jsx-runtime";import"react";var al=()=>sl("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:sl("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 cl=[Z([{ChildComponent:al,isActive:({selection:t})=>Cd(t)||xd(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(bd,"subscript")},order:5}])],kd=v({enableFormats:["subscript"],toolbarFixed:{groups:cl},toolbarInline:{groups:cl}});import{$isTableSelection as _d}from"@lexical/table";import{$isRangeSelection as Td,FORMAT_TEXT_COMMAND as wd}from"lexical";import{jsx as ul}from"react/jsx-runtime";import"react";var dl=()=>ul("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:ul("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 ml=[Z([{ChildComponent:dl,isActive:({selection:t})=>Td(t)||_d(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(wd,"superscript")},order:6}])],Ed=v({enableFormats:["superscript"],toolbarFixed:{groups:ml},toolbarInline:{groups:ml}});import{$isTableSelection as Ld}from"@lexical/table";import{$isRangeSelection as Nd,FORMAT_TEXT_COMMAND as yd}from"lexical";import{jsx as pl,jsxs as Sd}from"react/jsx-runtime";import"react";var fl=()=>Sd("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:[pl("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"}),pl("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var hl=[Z([{ChildComponent:fl,isActive:({selection:t})=>Nd(t)||Ld(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(yd,"underline")},order:3}])],Rd=v({enableFormats:["underline"],toolbarFixed:{groups:hl},toolbarInline:{groups:hl}});import{jsx as er}from"react/jsx-runtime";import{jsx as Id}from"react/jsx-runtime";function vd(t){return t.replace(/-([a-z])/g,(e,o)=>o.toUpperCase())}var lo=({css:t})=>{let e=t?Object.fromEntries(Object.entries(t).map(([o,r])=>[vd(o),r])):{};return Id("span",{style:{...e,alignItems:"center",borderRadius:"4px",display:"flex",fontSize:"16px",height:"20px",justifyContent:"center",width:"20px"},children:"A"})};import{useLexicalComposerContext as Md}from"@lexical/react/LexicalComposerContext";import{$forEachSelectedTextNode as Dd}from"@lexical/selection";import{$getNodeByKey as Ad,$getState as $d,$setState as Od,createState as Fd,TextNode as Pd}from"lexical";import{useEffect as Bd}from"react";var qo=new Map;function gl(t){for(let e in t){let o=t[e],r=Fd(e,{parse:n=>typeof n=="string"&&Object.keys(o).includes(n)?n:void 0});qo.set(e,{stateConfig:r,stateValues:o})}}function Qo(t,e,o){t.update(()=>{Dd(r=>{let n=qo.get(e);if(!n)throw new Error(`State config for ${e} not found`);Od(r,n.stateConfig,o)})})}function xl(){let[t]=Md();return Bd(()=>t.registerMutationListener(Pd,e=>{t.getEditorState().read(()=>{for(let[o,r]of e){if(r==="destroyed")continue;let n=Ad(o),l=t.getElementByKey(o);if(!n||!l)continue;let i=Object.create(null);qo.forEach((s,d)=>{let c=$d(n,s.stateConfig);if(!c){delete l.dataset[d];return}l.dataset[d]=c;let u=s.stateValues[c]?.css;u&&Object.assign(i,u)}),l.style.cssText="",Object.assign(l.style,i)}})}),[t]),null}var Cl=t=>{let e=[];for(let r in t.state){let n=t.state[r];for(let l in n){let i=n[l];e.push({ChildComponent:()=>er(lo,{css:i.css}),key:l,label:i.label,onSelect:({editor:s})=>{Qo(s,r,l)}})}}return[{type:"dropdown",ChildComponent:()=>er(lo,{css:{color:"var(--theme-elevation-600)"}}),items:[...[{ChildComponent:()=>er(lo,{}),key:"clear-style",label:({i18n:r})=>r.t("lexical:textState:defaultStyle"),onSelect:({editor:r})=>{for(let n in t.state)Qo(r,n,void 0)},order:1}],...e],key:"textState",order:30}]},jd=v(({props:t})=>(gl(t.state),{plugins:[{Component:xl,position:"normal"}],toolbarFixed:{groups:Cl(t)},toolbarInline:{groups:Cl(t)}}));import{c as Gd}from"react/compiler-runtime";import{useLexicalComposerContext as Vd}from"@lexical/react/LexicalComposerContext";import{$createHeadingNode as Kd,$isHeadingNode as Ml,HeadingNode as $l}from"@lexical/rich-text";import{$setBlocksType as Jd}from"@lexical/selection";import{$getSelection as Xd,$isRangeSelection as zd}from"lexical";import{useEffect as Zd}from"react";import{jsx as bl}from"react/jsx-runtime";import"react";var kl=()=>bl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:bl("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 _l}from"react/jsx-runtime";import"react";var Tl=()=>_l("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:_l("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 wl}from"react/jsx-runtime";import"react";var El=()=>wl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:wl("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 Sl}from"react/jsx-runtime";import"react";var Ll=()=>Sl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Sl("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 Nl}from"react/jsx-runtime";import"react";var yl=()=>Nl("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:Nl("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 Rl}from"react/jsx-runtime";import"react";var Il=()=>Rl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Rl("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 Hd,$isHeadingNode as Ud,HeadingNode as Wd}from"@lexical/rich-text";var tr=t=>(e,o,r)=>{let n=t(r);n&&(n.append(...o),e.replace(n),n.select(0,0))};var vl=t=>{let o=`^(${t.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`,r=new RegExp(o);return{type:"element",dependencies:[Wd],export:(n,l)=>{if(!Ud(n))return null;let i=Number(n.getTag().slice(1));return"#".repeat(i)+" "+l(n)},regExp:r,replace:tr(n=>{let l="h"+n[1]?.length;return Hd(l)})}};var Dl=t=>{let e=Xd();Jd(e,()=>Kd(t))},Al={h1:kl,h2:Tl,h3:El,h4:Ll,h5:yl,h6:Il},Yd=v(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[ee(e.map((r,n)=>({ChildComponent:Al[r],isActive:({selection:l})=>{if(!zd(l))return!1;for(let i of l.getNodes()){if(Ml(i)&&i.getTag()===r)continue;let s=i.getParent();if(!(Ml(s)&&s.getTag()===r))return!1}return!0},key:r,label:({i18n:l})=>l.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:l})=>{l.update(()=>{Dl(r)})},order:n+2})))];return{markdownTransformers:[vl(e)],nodes:[$l],plugins:[{Component:qd,position:"normal"}],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[z(e.map(r=>({Icon:Al[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(()=>{Dl(r)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}}),qd=t=>{let e=Gd(9),{clientProps:o}=t,{enabledHeadingSizes:r}=o,n;e[0]!==r?(n=r===void 0?["h1","h2","h3","h4","h5","h6"]:r,e[0]=r,e[1]=n):n=e[1];let l=n,i;e[2]!==l?(i=l.at(-1),e[2]=l,e[3]=i):i=e[3];let s=i,[d]=Vd(),c,u;return e[4]!==d||e[5]!==l||e[6]!==s?(c=()=>{if(!(!s||l.length===6))return d.registerNodeTransform($l,a=>{l.includes(a.getTag())||a.setTag(s)})},u=[d,l,s],e[4]=d,e[5]=l,e[6]=s,e[7]=c,e[8]=u):(c=e[7],u=e[8]),Zd(c,u),null};import{$isNodeSelection as fm}from"lexical";import{jsx as Ol}from"react/jsx-runtime";import"react";var or=()=>Ol("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Ol("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as Fl,jsxs as Qd}from"react/jsx-runtime";import"react";var Pl=()=>Qd("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Fl("path",{d:"M5 10h10",stroke:"currentColor"}),Fl("path",{d:"M10 15V5",stroke:"currentColor"})]});var Ce=t=>({type:"dropdown",ChildComponent:Pl,items:t,key:"add",order:10});import{addClassNamesToElement as em}from"@lexical/utils";import{$applyNodeReplacement as tm,createCommand as om,DecoratorNode as rm}from"lexical";var Tt=om("INSERT_HORIZONTAL_RULE_COMMAND"),_t=class extends rm{static clone(e){return new this(e.__key)}static getType(){return"horizontalrule"}static importDOM(){return{hr:()=>({conversion:nm,priority:0})}}static importJSON(e){return Bl()}createDOM(e){let o=document.createElement("hr");return em(o,e.theme.hr),o}decorate(){return null}exportDOM(){return{element:document.createElement("hr")}}exportJSON(){return{type:"horizontalrule",version:1}}getTextContent(){return`
|
|
55
|
-
`}isInline(){return!1}updateDOM(){return!1}};function nm(){return{node:Bl()}}function Bl(){return tm(new _t)}import{$applyNodeReplacement as lm}from"lexical";import"react";var Re=class extends _t{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return wt()}decorate(){return null}exportJSON(){return super.exportJSON()}};function wt(){return lm(new Re)}function io(t){return t instanceof Re}var jl={type:"element",dependencies:[Re],export:(t,e)=>io(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=wt();e&&t.replace(e)}};import{c as im}from"react/compiler-runtime";import{useLexicalComposerContext as sm}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as am}from"@lexical/utils";import{$getSelection as cm,$isRangeSelection as um,COMMAND_PRIORITY_EDITOR as dm}from"lexical";import{useEffect as mm}from"react";var Hl=()=>{let t=im(3),[e]=sm(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Tt,pm,dm),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),mm(o,r),null};function pm(t){let e=cm();if(!um(e))return!1;if(e.focus.getNode()!==null){let r=wt();am(r)}return!0}var hm=v({markdownTransformers:[jl],nodes:[Re],plugins:[{Component:Hl,position:"normal"}],slashMenu:{groups:[z([{Icon:or,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Tt,void 0)}}])]},toolbarFixed:{groups:[Ce([{ChildComponent:or,isActive:({selection:t})=>{if(!fm(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return io(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Tt,void 0)}}])]}});import{$findMatchingParent as Yl}from"@lexical/utils";import{$isElementNode as ym,INDENT_CONTENT_COMMAND as Rm,OUTDENT_CONTENT_COMMAND as Im}from"lexical";import{jsx as so,jsxs as gm}from"react/jsx-runtime";import"react";var Ul=()=>gm("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[so("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),so("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),so("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),so("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as ao,jsxs as xm}from"react/jsx-runtime";import"react";var Wl=()=>xm("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[ao("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),ao("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),ao("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),ao("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});import{jsx as Cm}from"react/jsx-runtime";import{useLexicalComposerContext as bm}from"@lexical/react/LexicalComposerContext";import{TabIndentationPlugin as km}from"@lexical/react/LexicalTabIndentationPlugin";import{$findMatchingParent as _m,mergeRegister as Gl}from"@lexical/utils";import{$getSelection as Tm,$isElementNode as Xl,$isRangeSelection as wm,COMMAND_PRIORITY_LOW as Vl,INDENT_CONTENT_COMMAND as Kl,KEY_TAB_COMMAND as Em,OUTDENT_CONTENT_COMMAND as Sm,TabNode as Lm}from"lexical";import{useEffect as Jl}from"react";var zl=({clientProps:t})=>{let[e]=bm(),{disabledNodes:o,disableTabNode:r}=t;return Jl(()=>{if(!(!e||!o?.length))return Gl(e.registerCommand(Kl,()=>Nm(n=>{if(!o.includes(n.getType())){let l=n.getIndent();n.setIndent(l+1)}}),Vl),e.registerUpdateListener(({dirtyElements:n,editorState:l})=>{e.update(()=>{for(let[i]of n){let s=l._nodeMap.get(i);Xl(s)&&o.includes(s.getType())&&s.getIndent()>0&&s.setIndent(0)}})}))},[e,o]),Jl(()=>{if(!(!e||!r))return Gl(e.registerCommand(Em,n=>(n.preventDefault(),e.dispatchCommand(n.shiftKey?Sm:Kl,void 0)),Vl),e.registerNodeTransform(Lm,n=>{n.remove()}))},[e,r]),Cm(km,{})};function Nm(t){let e=Tm();if(!wm(e))return!1;let o=new Set,r=e.getNodes();for(let n=0;n<r.length;n++){let l=r[n],i=l.getKey();if(o.has(i))continue;let s=_m(l,c=>Xl(c)&&!c.isInline());if(s===null)continue;let d=s.getKey();s.canIndent()&&!o.has(d)&&(o.add(d),t(s))}return o.size>0}var Zl=t=>({type:"buttons",items:t,key:"indent",order:35});var ql=({disabledNodes:t})=>[Zl([{ChildComponent:Ul,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>Ql(n)&&n.getIndent()>0;return o.some(n=>r(n)||!!Yl(n,r))},key:"indentDecrease",label:({i18n:e})=>e.t("lexical:indent:decreaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Im,void 0)},order:1},{ChildComponent:Wl,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>Ql(n)&&!(t??[]).includes(n.getType());return o.some(n=>r(n)||!!Yl(n,r))},key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Rm,void 0)},order:2}])],vm=v(({props:t})=>{let e=t.disabledNodes??[];return{plugins:[{Component:zl,position:"normal"}],sanitizedClientFeatureProps:t,toolbarFixed:{groups:ql({disabledNodes:e})},toolbarInline:{groups:ql({disabledNodes:e})}}}),Ql=t=>ym(t)&&t.canIndent();import{$findMatchingParent as Gp}from"@lexical/utils";import{$getSelection as dr,$isRangeSelection as Ii}from"lexical";import{jsx as ei}from"react/jsx-runtime";import"react";var ti=()=>ei("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:ei("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 oi}from"@lexical/selection";function Ze(t){let{anchor:e}=t,{focus:o}=t,r=t.anchor.getNode(),n=t.focus.getNode();return r===n?r:t.isBackward()?oi(o)?r:n:oi(e)?r:n}var rr=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as Um}from"lexical";import{addClassNamesToElement as Mm,isHTMLAnchorElement as Dm}from"@lexical/utils";import ir from"bson-objectid";import{$applyNodeReplacement as Am,$createTextNode as ri,$getSelection as $m,$isElementNode as ni,$isRangeSelection as lr,createCommand as Om,ElementNode as Fm}from"lexical";var Pm=new Set(["http:","https:","mailto:","sms:","tel:"]),oe=class t extends Fm{__fields;__id;constructor({id:e,fields:o={linkType:"custom",newTab:!1},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:Bm,priority:1})}}static importJSON(e){let o=be({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),e.version===2&&!e.id&&(e.id=new ir.default().toHexString(),e.version=3),o}canBeEmpty(){return!1}canInsertTextAfter(){return!1}canInsertTextBefore(){return!1}createDOM(e){let o=document.createElement("a");return this.__fields?.linkType==="custom"&&(o.href=this.sanitizeUrl(this.__fields.url??"")),(this.__fields?.newTab??!1)&&(o.target="_blank"),this.__fields?.newTab===!0&&this.__fields?.linkType==="custom"&&(o.rel=nr(o.rel,"add","noopener")),Mm(o,e.theme.link),o}exportJSON(){let e=this.getFields();e?.linkType==="internal"?delete e.url:e?.linkType==="custom"&&delete e.doc;let o={...super.exportJSON(),type:"link",fields:e,version:3},r=this.getID();return r&&(o.id=r),o}extractWithChild(e,o,r){if(!lr(o))return!1;let n=o.anchor.getNode(),l=o.focus.getNode();return this.isParentOf(n)&&this.isParentOf(l)&&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(ni(r)){let n=be({fields:this.__fields});return r.append(n),n}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!Pm.has(o.protocol))return"about:blank"}catch{return"https://"}return e}setFields(e){let o=this.getWritable();return o.__fields=e,o}setID(e){let o=this.getWritable();return o.__id=e,o}updateDOM(e,o,r){let n=this.__fields?.url,l=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=""),l!==e.__fields?.newTab&&(l??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=nr(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=nr(o.rel,"remove","noopener"))),!1}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields).setID(e.id)}};function Bm(t){let e=null;if(Dm(t)){let o=t.textContent;o!==null&&o!==""&&(e=be({id:new ir.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function be({id:t,fields:e}){return Am(new oe({id:t??new ir.default().toHexString(),fields:e}))}function K(t){return t instanceof oe}var de=Om("TOGGLE_LINK_COMMAND");function sr(t){let e=$m();if(!lr(e)&&(t===null||!t.selectedNodes?.length))return;let o=lr(e)?e.extract():t===null?[]:t.selectedNodes;if(t===null){o?.forEach(l=>{let i=l.getParent();K(i)&&(i.getChildren().forEach(d=>{i.insertBefore(d)}),i.remove())});return}if(o?.length===1){let l=o[0],i=K(l)?l:jm(l);if(i!==null){i.setFields(t.fields),t.text!=null&&t.text!==i.getTextContent()&&(i.append(ri(t.text)),i.getChildren().forEach(s=>{s!==i.getLastChild()&&s.remove()}));return}}let r=null,n=null;o?.forEach(l=>{let i=l.getParent();if(!(i===n||i===null||ni(l)&&!l.isInline())){if(K(i)){n=i,i.setFields(t.fields),t.text!=null&&t.text!==i.getTextContent()&&(i.append(ri(t.text)),i.getChildren().forEach(s=>{s!==i.getLastChild()&&s.remove()}));return}if(i.is(r)||(r=i,n=be({fields:t.fields}),K(i)?l.getPreviousSibling()===null?i.insertBefore(n):i.insertAfter(n):l.insertBefore(n)),K(l)){if(l.is(n))return;if(n!==null){let s=l.getChildren();n.append(...s)}l.remove();return}n!==null&&n.append(l)}})}function jm(t){return Hm(t,e=>K(e))}function Hm(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function nr(t,e,o){let r,n=`${t}`;if(e==="add"){if(n.includes(o)){let l=new RegExp(o,"g");n=n.replace(l,"").trim()}n=n.trim(),r=n.length===0?`${o}`:`${n} ${o}`}else{let l=new RegExp(o,"g");r=n.replace(l,"").trim()}return r}var li={type:"text-match",dependencies:[oe],export:(t,e)=>{if(!K(t))return null;let o=t,{url:r}=o.getFields();return`[${e(o)}](${r})`},importRegExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:(t,e)=>{let[,o,r]=e,n=be({fields:{doc:null,linkType:"custom",newTab:!1,url:r}}),l=Um(o);return l.setFormat(t.getFormat()),n.append(l),t.replace(n),l},trigger:")"};import{$applyNodeReplacement as Wm,$isElementNode as Gm}from"lexical";var ke=class t extends oe{static clone(e){return new t({id:"",fields:e.__fields,key:e.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(e){let o=Et({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),o}exportJSON(){let e=super.exportJSON();return{type:"autolink",children:e.children,direction:e.direction,fields:e.fields,format:e.format,indent:e.indent,version:2}}insertNewAfter(e,o=!0){let r=this.getParentOrThrow().insertNewAfter(e,o);if(Gm(r)){let n=Et({fields:this.__fields});return r.append(n),n}return null}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields)}};function Et({fields:t}){return Wm(new ke({id:"",fields:t}))}function _e(t){return t instanceof ke}import{c as Vm}from"react/compiler-runtime";import{useLexicalComposerContext as Km}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Jm}from"@lexical/utils";import{$createTextNode as ii,$getSelection as Xm,$isElementNode as ai,$isLineBreakNode as ci,$isNodeSelection as zm,$isRangeSelection as Zm,$isTextNode as St,TextNode as Ym}from"lexical";import{useEffect as qm}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 of e){let r=o(t);if(r!=null)return r}return null}var Qm=/[.,;\s]/;function uo(t){return t!==void 0&&Qm.test(t)}function di(t){return uo(t[t.length-1])}function cr(t){return uo(t[0])}function ep(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)||St(e)&&di(e.getTextContent())}function pi(t){let e=t.getNextSibling();return ai(e)&&(e=e.getFirstDescendant()),e===null||ci(e)||St(e)&&cr(e.getTextContent())}function tp(t,e,o,r){return(t>0?uo(o[t-1]):mi(r[0]))?e<o.length?uo(o[e]):pi(r[r.length-1]):!1}function op(t,e,o){let r=[],n=[],l=[],i=0,s=0,d=[...t];for(;d.length>0;){let c=d[0],a=c.getTextContent().length,m=s;s+a<=e?(r.push(c),i+=a):m>=o?l.push(c):n.push(c),s+=a,d.shift()}return[i,r,n,l]}function rp(t,e,o,r){let n={linkType:"custom",url:r.url,...r.fields},l=Et({fields:n});if(t.length===1){let i=t[0],s;if(e===0?[s]=i.splitText(o):[,s]=i.splitText(e,o),s){let d=ii(r.text);d.setFormat(s.getFormat()),d.setDetail(s.getDetail()),d.setStyle(s.getStyle()),l.append(d),s.replace(l)}return i}else if(t.length>1){let i=t[0],s=i.getTextContent().length,d;e===0?d=i:[,d]=i.splitText(e);let c=[],u;if(t.forEach(a=>{let p=a.getTextContent().length,f=s,h=s+p;if(f<o)if(h<=o)c.push(a);else{let[x,g]=a.splitText(o-f);x&&c.push(x),u=g}s+=p}),d){let a=Xm(),m=a?a.getNodes().find(St):void 0,p=ii(d.getTextContent());return p.setFormat(d.getFormat()),p.setDetail(d.getDetail()),p.setStyle(d.getStyle()),l.append(p,...c),m&&m===d&&(Zm(a)?p.select(a.anchor.offset,a.focus.offset):zm(a)&&p.select(0,p.getTextContent().length)),d.replace(l),u}}}function np(t,e,o){let r=[...t],n=r.map(d=>d.getTextContent()).join(""),l=n,i,s=0;for(;(i=ui(l,e))!=null&&i!==null;){let d=i.index,c=i.length,u=d+c;if(tp(s+d,s+u,n,r)){let[m,,p,f]=op(r,s+d,s+u),h=s+d-m,x=s+u-m,g=rp(p,h,x,i);r=g?[g,...f]:f,o(i.url,null),s=0}else s+=u;l=l.substring(u)}}function ar(t,e,o){let r=t.getChildren(),n=r.length;for(let d=0;d<n;d++){let c=r[d];if(!St(c)||!c.isSimpleText()){co(t),o(null,t.getFields()?.url??null);return}}let l=t.getTextContent(),i=ui(l,e);if(i===null||i.text!==l){co(t),o(null,t.getFields()?.url??null);return}if(!mi(t)||!pi(t)){co(t),o(null,t.getFields()?.url??null);return}let s=t.getFields()?.url;if(s!==i?.url){let d=t.getFields();d.url=i?.url,t.setFields(d),o(i.url,s??null)}}function lp(t,e,o){let r=t.getPreviousSibling(),n=t.getNextSibling(),l=t.getTextContent();if(_e(r)){let i=r.getFields()?.url?r.getFields()?.url?.startsWith("mailto:")??!1:!1;(!cr(l)||ep(l,i))&&(r.append(t),ar(r,e,o),o(null,r.getFields()?.url??null))}_e(n)&&!di(l)&&(co(n),ar(n,e,o),o(null,n.getFields()?.url??null))}function co(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 ip(t){let e=[t],o=t.getNextSibling();for(;o!==null&&St(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function sp(t,e,o){let r=Vm(5),n,l;r[0]!==t||r[1]!==e||r[2]!==o?(n=()=>{if(!t.hasNodes([ke]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let i=(s,d)=>{o?.(s,d)};return Jm(t.registerNodeTransform(Ym,s=>{let d=s.getParentOrThrow(),c=s.getPreviousSibling();if(_e(d))ar(d,e,i);else if(!K(d)){if(s.isSimpleText()&&(cr(s.getTextContent())||!_e(c))){let u=ip(s);np(u,e,i)}lp(s,e,i)}}))},l=[t,e,o],r[0]=t,r[1]=e,r[2]=o,r[3]=n,r[4]=l):(n=r[3],l=r[4]),qm(n,l)}var ap=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,cp=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,up=[si(ap,t=>t.startsWith("http")?t:`https://${t}`),si(cp,t=>`mailto:${t}`)],fi=()=>{let[t]=Km();return sp(t,up),null};import{jsx as dp}from"react/jsx-runtime";import{ClickableLinkPlugin as mp}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var hi=()=>dp(mp,{});import{jsx as vp}from"react/jsx-runtime";import"react";import{createPortal as Mp}from"react-dom";import{jsx as Te,jsxs as Lt,Fragment as fp}from"react/jsx-runtime";import{useLexicalComposerContext as hp}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as gp}from"@lexical/react/useLexicalEditable";import{$findMatchingParent as gi,mergeRegister as xi}from"@lexical/utils";import{getTranslation as ur}from"@payloadcms/translations";import{CloseMenuIcon as xp,EditIcon as Cp,ExternalLinkIcon as Ci,formatDrawerSlug as bp,useConfig as kp,useEditDepth as _p,useLocale as Tp,useTranslation as wp}from"@payloadcms/ui";import{requests as Ep}from"@payloadcms/ui/shared";import{$getSelection as bi,$isLineBreakNode as Sp,$isRangeSelection as ki,COMMAND_PRIORITY_HIGH as Lp,COMMAND_PRIORITY_LOW as _i,getDOMSelection as Np,KEY_ESCAPE_COMMAND as yp,SELECTION_CHANGE_COMMAND as Rp}from"lexical";import Ti,{useCallback as wi,useEffect as fo,useRef as Ip,useState as Pe}from"react";function mo(t,e,o,r=10,n=5){let l=o.parentElement;if(t===null||l==null){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let i=e.getBoundingClientRect(),s=o.getBoundingClientRect(),d=l.getBoundingClientRect(),c=t.top-r,u=t.left-n;c<d.top&&(c+=i.height+t.height+r*2),u+i.width>d.right&&(u=d.right-i.width-n),c-=s.top,u-=s.left,e.style.opacity="1",e.style.transform=`translate(${u}px, ${c}px)`}import{createCommand as pp}from"lexical";var po=pp("TOGGLE_LINK_WITH_MODAL_COMMAND");function Ei(t){t.preventDefault()}function Si({anchorElem:t}){let[e]=hp(),[o,r]=Pe(),n=Ip(null),[l,i]=Pe(null),[s,d]=Pe(null),{fieldProps:{schemaPath:c},uuid:u}=j(),a=gp(),{config:m,getEntityConfig:p}=kp(),{i18n:f,t:h}=wp(),[x,g]=Pe(),w=_p(),[E,C]=Pe(!1),[k,b]=Pe([]),T=Tp(),[_,N]=Pe(!1),F=bp({slug:"lexical-rich-text-link-"+u,depth:w}),{toggleDrawer:M}=he(F),y=wi(()=>{C(!1),n&&n.current&&(n.current.style.opacity="0",n.current.style.transform="translate(-10000px, -10000px)"),N(!1),i(null),d(null),b([]),g(void 0)},[C,i,d,b]),S=wi(()=>{let L=bi(),R;if(!ki(L)||!L){y();return}let A=Ze(L);R=e.getElementByKey(A.getKey())?.getBoundingClientRect();let I=gi(A,K),$=L.getNodes().filter(U=>!Sp(U)).find(U=>{let ie=gi(U,K);return I&&!I.is(ie)||ie&&!ie.is(I)});if(I==null||$){y();return}r(I);let D=I.getFields(),W={...D,id:I.getID(),text:I.getTextContent()};if(D?.linkType==="custom")i(D?.url??null),d(null);else{i(`${m.routes.admin==="/"?"":m.routes.admin}/collections/${D?.doc?.relationTo}/${D?.doc?.value}`);let U=D?.doc?.relationTo?p({collectionSlug:D?.doc?.relationTo}):void 0;if(!U)d(D?.label?String(D?.label):null),i(D?.url?String(D?.url):null);else{let ie=typeof D.doc?.value=="object"?D.doc.value.id:D.doc?.value,fe=D.doc?.relationTo;if(!ie||!fe)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let ct=h("fields:linkedTo",{label:`${ur(U.labels.singular,f)} - ${h("lexical:link:loadingWithEllipsis",f)}`}).replace(/<[^>]*>?/g,"");d(ct),Ep.get(`${m.serverURL}${m.routes.api}/${fe}/${ie}`,{headers:{"Accept-Language":f.language},params:{depth:0,locale:T?.code}}).then(async Le=>{if(!Le.ok)throw new Error(`HTTP error! Status: ${Le.status}`);let Ne=await Le.json(),jt=U?.admin?.useAsTitle||"id",Ge=Ne[jt],Ve=h("fields:linkedTo",{label:`${ur(U.labels.singular,f)} - ${Ge}`}).replace(/<[^>]*>?/g,"");d(Ve)}).catch(()=>{let Le=h("fields:linkedTo",{label:`${ur(U.labels.singular,f)} - ${h("general:untitled",f)} - ID: ${ie}`}).replace(/<[^>]*>?/g,"");d(Le)})}}g(W),C(!0),b(L?L?.getNodes():[]),_e(I)?N(!0):N(!1);let Q=n.current,J=Np(e._window),{activeElement:Do}=document;if(Q===null)return;let pe=e.getRootElement();return J!==null&&pe!==null&&pe.contains(J.anchorNode)?(R||(R=J.getRangeAt(0).getBoundingClientRect()),R!=null&&(R.y+=40,mo(R,Q,t))):(Do==null||Do.className!=="link-input")&&(pe!==null&&mo(null,Q,t),i(null),d(null)),!0},[e,y,m.routes.admin,m.routes.api,m.serverURL,p,h,f,T?.code,t]);return fo(()=>xi(e.registerCommand(po,L=>(e.dispatchCommand(de,L),S(),M(),!0),_i)),[e,S,M,F]),fo(()=>{let L=t.parentElement,R=()=>{e.getEditorState().read(()=>{S()})};return window.addEventListener("resize",R),L?.addEventListener("scroll",R),()=>{window.removeEventListener("resize",R),L?.removeEventListener("scroll",R)}},[t.parentElement,e,S]),fo(()=>xi(e.registerUpdateListener(({editorState:L})=>{L.read(()=>{S()})}),e.registerCommand(Rp,()=>(S(),!0),_i),e.registerCommand(yp,()=>E?(y(),!0):!1,Lp)),[e,S,E,y]),fo(()=>{e.getEditorState().read(()=>{S()})},[e,S]),Lt(Ti.Fragment,{children:[Te("div",{className:"link-editor",ref:n,children:Lt("div",{className:"link-input",children:[l&&l.length>0?Lt("a",{href:l,rel:"noopener noreferrer",target:"_blank",children:[o?.__fields.newTab?Te(Ci,{}):null,s!=null&&s.length>0?s:l]}):s!=null&&s.length>0?Lt(fp,{children:[o?.__fields.newTab?Te(Ci,{}):null,Te("span",{className:"link-input__label-pure",children:s})]}):null,a&&Lt(Ti.Fragment,{children:[Te("button",{"aria-label":"Edit link",className:"link-edit",onClick:L=>{L.preventDefault(),M()},onMouseDown:Ei,tabIndex:0,type:"button",children:Te(Cp,{})}),!_&&Te("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(de,null)},onMouseDown:Ei,tabIndex:0,type:"button",children:Te(xp,{})})]})]})}),Te(pt,{className:"lexical-link-edit-drawer",data:x,drawerSlug:F,drawerTitle:h("fields:editLink"),featureKey:"link",handleDrawerSubmit:(L,R)=>{let A=R,I={...A};delete I.text,e.update(()=>{let $=bi(),D=null;if(ki($)?D=Ze($).getParent():k.length&&(D=k[0]?.getParent()??null),D&&_e(D)){let W=be({fields:I});D.replace(W,!0)}}),e.dispatchCommand(de,{fields:I,selectedNodes:k,text:A.text})},schemaPath:c,schemaPathSuffix:"fields"})]})}var Li=t=>{let{anchorElem:e=document.body}=t;return Mp(vp(Si,{anchorElem:e}),e)};import{c as $p}from"react/compiler-runtime";import{useLexicalComposerContext as Op}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Fp}from"@lexical/utils";import{$getSelection as Pp,$isElementNode as Bp,$isRangeSelection as jp,COMMAND_PRIORITY_LOW as yi,PASTE_COMMAND as Hp}from"lexical";import{useEffect as Up}from"react";var Dp=/^(?:[a-zA-Z][a-zA-Z\d+.-]*:(?:\/\/)?(?:[-;:&=+$,\w]+@)?[A-Za-z\d]+(?:\.[A-Za-z\d]+)+|www\.[A-Za-z\d]+(?:\.[A-Za-z\d]+)+|(?:tel|mailto):[\w+.-]+)(?:\/[+~%/\w-]*)?(?:\?[-;&=%\w]*)?(?:#\w+)?$/,Ap=/^(?:\/[\w\-./]*(?:#\w[\w-]*)?|#[\w\-]+)$/;function Ni(t){if(!t)return!1;if(t==="https://"||Dp.test(t)||Ap.test(t))return!0;try{return new URL(t),!0}catch{}return!1}var Ri=t=>{let e=$p(5),{clientProps:o}=t,[r]=Op(),n,l;return e[0]!==o.defaultLinkType||e[1]!==o.defaultLinkURL||e[2]!==r?(n=()=>{if(!r.hasNodes([oe]))throw new Error("LinkPlugin: LinkNode not registered on editor");return Fp(r.registerCommand(de,i=>i===null?(sr(null),!0):(i.fields?.linkType||(i.fields.linkType=o.defaultLinkType),i.fields?.url||(i.fields.url=o.defaultLinkURL),sr(i),!0),yi),r.registerCommand(Hp,i=>{let s=Pp();if(!jp(s)||s.isCollapsed()||!(i instanceof ClipboardEvent)||i.clipboardData==null)return!1;let d=i.clipboardData.getData("text");if(!Ni(d))return!1;if(!s.getNodes().some(Wp)){let c={doc:null,linkType:"custom",newTab:!1,url:d};return r.dispatchCommand(de,{fields:c,text:null}),i.preventDefault(),!0}return!1},yi))},l=[o.defaultLinkType,o.defaultLinkURL,r],e[0]=o.defaultLinkType,e[1]=o.defaultLinkURL,e[2]=r,e[3]=n,e[4]=l):(n=e[3],l=e[4]),Up(n,l),null};function Wp(t){return Bp(t)}var vi=[rr([{ChildComponent:ti,isActive:({selection:t})=>{if(Ii(t)){let e=Ze(t);return Gp(e,K)!=null}return!1},isEnabled:({selection:t})=>!!(Ii(t)&&dr()?.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=dr()?.getTextContent(),r=dr()?.getNodes()??[]}),!o?.length)return;let n={doc:null};t.dispatchCommand(po,{fields:n,selectedNodes:r,text:o})}},order:1}])],Vp=v(({props:t})=>({markdownTransformers:[li],nodes:[oe,t?.disableAutoLinks===!0?null:ke].filter(Boolean),plugins:[{Component:Ri,position:"normal"},t?.disableAutoLinks===!0||t?.disableAutoLinks==="creationOnly"?null:{Component:fi,position:"normal"},{Component:hi,position:"normal"},{Component:Li,position:"floatingAnchorElem"}].filter(Boolean),sanitizedClientFeatureProps:t,toolbarFixed:{groups:vi},toolbarInline:{groups:vi}}));import{$isListNode as fr,INSERT_CHECK_LIST_COMMAND as Fi,ListItemNode as rf,ListNode as nf}from"@lexical/list";import{$isRangeSelection as lf}from"lexical";import{jsx as Mi,jsxs as Kp}from"react/jsx-runtime";import"react";var mr=()=>Kp("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:[Mi("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),Mi("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Jp}from"react/jsx-runtime";import{ListPlugin as Xp}from"@lexical/react/LexicalListPlugin.js";import"react";var Ye=()=>Jp(Xp,{});function qe(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as qp,ListItemNode as Qp,ListNode as ef}from"@lexical/list";import{$createListItemNode as zp,$createListNode as Zp,$isListItemNode as Yp,$isListNode as pr}from"@lexical/list";var Di=4,Qe=t=>(e,o,r)=>{let n=e.getPreviousSibling(),l=e.getNextSibling(),i=zp(t==="check"?r[3]==="x":void 0);if(pr(l)&&l.getListType()===t){let d=l.getFirstChild();d!==null?d.insertBefore(i):l.append(i),e.remove()}else if(pr(n)&&n.getListType()===t)n.append(i),e.remove();else{let d=Zp(t,t==="number"?Number(r[2]):void 0);d.append(i),e.replace(d)}i.append(...o),i.select(0,0);let s=Math.floor(r[1].length/Di);s&&i.setIndent(s)},Be=(t,e,o)=>{let r=[],n=t.getChildren(),l=0;for(let i of n)if(Yp(i)){if(i.getChildrenSize()===1){let u=i.getFirstChild();if(pr(u)){r.push(Be(u,e,o+1));continue}}let s=" ".repeat(o*Di),d=t.getListType(),c=d==="number"?`${t.getStart()+l}. `:d==="check"?`- [${i.getChecked()?"x":" "}] `:"- ";r.push(s+c+e(i)),l++}return r.join(`
|
|
56
|
-
`)};var Ai={type:"element",dependencies:[ef,Qp],export:(t,e)=>qp(t)?Be(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:Qe("check")};import{jsx as tf}from"react/jsx-runtime";import{CheckListPlugin as of}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var $i=()=>tf(of,{});var Oi=[ee([{ChildComponent:mr,isActive:({selection:t})=>{if(!lf(t))return!1;for(let e of t.getNodes()){if(fr(e)&&e.getListType()==="check")continue;let o=e.getParent();if(fr(o)&&o.getListType()==="check")continue;let r=o?.getParent();if(!(fr(r)&&r.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(Fi,void 0)},order:12}])],sf=v(({featureProviderMap:t})=>{let e=[{Component:$i,position:"normal"}];return!t.has("unorderedList")&&!t.has("orderedList")&&e.push({Component:Ye,position:"normal"}),{markdownTransformers:[Ai],nodes:t.has("unorderedList")||t.has("orderedList")?[]:[nf,rf],plugins:e,slashMenu:{groups:[qe([{Icon:mr,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:o})=>o.t("lexical:checklist:label"),onSelect:({editor:o})=>{o.dispatchCommand(Fi,void 0)}}])]},toolbarFixed:{groups:Oi},toolbarInline:{groups:Oi}}});import{$isListNode as gr,INSERT_ORDERED_LIST_COMMAND as ji,ListItemNode as mf,ListNode as pf}from"@lexical/list";import{$isRangeSelection as ff}from"lexical";import{jsx as Nt,jsxs as af}from"react/jsx-runtime";import"react";var hr=()=>af("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Nt("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"}),Nt("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"}),Nt("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),Nt("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),Nt("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as cf,ListItemNode as uf,ListNode as df}from"@lexical/list";var Pi={type:"element",dependencies:[df,uf],export:(t,e)=>cf(t)?Be(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:Qe("number")};var Bi=[ee([{ChildComponent:hr,isActive:({selection:t})=>{if(!ff(t))return!1;for(let e of t.getNodes()){if(gr(e)&&e.getListType()==="number")continue;let o=e.getParent();if(gr(o)&&o.getListType()==="number")continue;let r=o?.getParent();if(!(gr(r)&&r.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(ji,void 0)},order:10}])],hf=v(({featureProviderMap:t})=>({markdownTransformers:[Pi],nodes:t.has("orderedList")?[]:[pf,mf],plugins:t.has("orderedList")?[]:[{Component:Ye,position:"normal"}],slashMenu:{groups:[qe([{Icon:hr,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:e})=>e.t("lexical:orderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(ji,void 0)}}])]},toolbarFixed:{groups:Bi},toolbarInline:{groups:Bi}}));import{$isListNode as Cr,INSERT_UNORDERED_LIST_COMMAND as Wi,ListItemNode as kf,ListNode as _f}from"@lexical/list";import{$isRangeSelection as Tf}from"lexical";import{jsx as et,jsxs as gf}from"react/jsx-runtime";import"react";var xr=()=>gf("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:[et("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),et("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),et("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),et("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),et("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),et("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as xf,ListItemNode as Cf,ListNode as bf}from"@lexical/list";var Hi={type:"element",dependencies:[bf,Cf],export:(t,e)=>xf(t)?Be(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:Qe("bullet")};var Ui=[ee([{ChildComponent:xr,isActive:({selection:t})=>{if(!Tf(t))return!1;for(let e of t.getNodes()){if(Cr(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(Cr(o)&&o.getListType()==="bullet")continue;let r=o?.getParent();if(!(Cr(r)&&r.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Wi,void 0)},order:11}])],wf=v({markdownTransformers:[Hi],nodes:[_f,kf],plugins:[{Component:Ye,position:"normal"}],slashMenu:{groups:[qe([{Icon:xr,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Wi,void 0)}}])]},toolbarFixed:{groups:Ui},toolbarInline:{groups:Ui}});import{jsx as Ef}from"react/jsx-runtime";import{addClassNamesToElement as Sf}from"@lexical/utils";import{DecoratorNode as Lf}from"lexical";import*as Gi from"react";var Nf=Gi.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),yt=class t extends Lf{__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 yf({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return Sf(o,"unknownConverted"),o}decorate(){return Ef(Nf,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function yf({data:t}){return new yt({data:t})}var Rf=v(()=>({nodes:[yt]}));import{jsx as If}from"react/jsx-runtime";import{addClassNamesToElement as vf}from"@lexical/utils";import{DecoratorNode as Mf}from"lexical";import*as Vi from"react";var Df=Vi.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),Rt=class t extends Mf{__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 Af({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return vf(o,"unknownConverted"),o}decorate(){return If(Df,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function Af({data:t}){return new Rt({data:t})}var $f=v(()=>({nodes:[Rt]}));import{$setBlocksType as Xi}from"@lexical/selection";import{$createParagraphNode as zi,$getSelection as Zi,$isParagraphNode as Ki,$isRangeSelection as Of}from"lexical";var Ji=[ee([{ChildComponent:ht,isActive:({selection:t})=>{if(!Of(t))return!1;for(let e of t.getNodes())if(!Ki(e)&&!Ki(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=Zi();Xi(e,()=>zi())})},order:1}])],Ff=v({slashMenu:{groups:[z([{Icon:ht,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Zi();Xi(e,()=>zi())})}}])]},toolbarFixed:{groups:Ji},toolbarInline:{groups:Ji}});import{c as n0}from"react/compiler-runtime";import{jsx as gs}from"react/jsx-runtime";import{useLexicalComposerContext as l0}from"@lexical/react/LexicalComposerContext";import{useEffect as i0,useState as s0}from"react";import{jsx as hs,Fragment as r0}from"react/jsx-runtime";import"react";import{jsx as Pf}from"react/jsx-runtime";var Yi={quote:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return Pf("blockquote",{children:o})}};import{jsx as Bf}from"react/jsx-runtime";var qi={heading:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.tag;return Bf(r,{children:o})}};import{jsx as jf}from"react/jsx-runtime";var Qi={horizontalrule:jf("hr",{})};import{jsx as Hf}from"react/jsx-runtime";var es={linebreak:Hf("br",{})};import{jsx as ts}from"react/jsx-runtime";var os=({internalDocToHref:t})=>({autolink:({node:e,nodesToJSX:o})=>{let r=o({nodes:e.children}),n=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0;return ts("a",{href:e.fields.url,rel:n,target:l,children:r})},link:({node:e,nodesToJSX:o})=>{let r=o({nodes:e.children}),n=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0,i=e.fields.url??"";return e.fields.linkType==="internal"&&(t?i=t({linkNode:e}):(console.error("Lexical => JSX converter: Link converter: found internal link, but internalDocToHref is not provided"),i="#")),ts("a",{href:i,rel:n,target:l,children:r})}});import{jsx as tt,jsxs as Uf,Fragment as Wf}from"react/jsx-runtime";import{v4 as Gf}from"uuid";var rs={list:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.tag;return tt(r,{className:`list-${t?.listType}`,children:o})},listitem:({node:t,nodesToJSX:e,parent:o})=>{let r=t.children.some(l=>l.type==="list"),n=e({nodes:t.children});if("listType"in o&&o?.listType==="check"){let l=Gf();return tt("li",{"aria-checked":t.checked?"true":"false",className:`list-item-checkbox${t.checked?" list-item-checkbox-checked":" list-item-checkbox-unchecked"}${r?" nestedListItem":""}`,role:"checkbox",style:{listStyleType:"none"},tabIndex:-1,value:t?.value,children:r?n:Uf(Wf,{children:[tt("input",{checked:t.checked,id:l,readOnly:!0,type:"checkbox"}),tt("label",{htmlFor:l,children:n}),tt("br",{})]})})}else return tt("li",{className:`${r?"nestedListItem":""}`,style:r?{listStyleType:"none"}:void 0,value:t?.value,children:n})}};import{jsx as br}from"react/jsx-runtime";var ns={paragraph:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return o?.length?br("p",{children:o}):br("p",{children:br("br",{})})}};var ls={tab:" "};import{jsx as It}from"react/jsx-runtime";var is={table:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return It("div",{className:"lexical-table-container",children:It("table",{className:"lexical-table",style:{borderCollapse:"collapse"},children:It("tbody",{children:o})})})},tablecell:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.headerState>0?"th":"td",n=`lexical-table-cell-header-${t.headerState}`,l={backgroundColor:t.backgroundColor||void 0,border:"1px solid #ccc",padding:"8px"},i=t.colSpan&&t.colSpan>1?t.colSpan:void 0,s=t.rowSpan&&t.rowSpan>1?t.rowSpan:void 0;return It(r,{className:`lexical-table-cell ${n}`,colSpan:i,rowSpan:s,style:l,children:o})},tablerow:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return It("tr",{className:"lexical-table-row",children:o})}};import{jsx as je}from"react/jsx-runtime";import"react";var O={DOM_ELEMENT_TYPE:1,DOM_TEXT_TYPE:3,NO_DIRTY_NODES:0,HAS_DIRTY_NODES:1,FULL_RECONCILE:2,IS_NORMAL:0,IS_TOKEN:1,IS_SEGMENTED:2,IS_INERT:3,IS_BOLD:1,IS_ITALIC:2,IS_STRIKETHROUGH:4,IS_UNDERLINE:8,IS_CODE:16,IS_SUBSCRIPT:32,IS_SUPERSCRIPT:64,IS_HIGHLIGHT:128,IS_DIRECTIONLESS:1,IS_UNMERGEABLE:2,IS_ALIGN_LEFT:1,IS_ALIGN_CENTER:2,IS_ALIGN_RIGHT:3,IS_ALIGN_JUSTIFY:4,IS_ALIGN_START:5,IS_ALIGN_END:6},Vf=O.IS_BOLD|O.IS_ITALIC|O.IS_STRIKETHROUGH|O.IS_UNDERLINE|O.IS_CODE|O.IS_SUBSCRIPT|O.IS_SUPERSCRIPT|O.IS_HIGHLIGHT,Kf="\xA0",Jf=`
|
|
34
|
+
`},[t,e]),m=Me((C,k)=>{o(g=>{let w=e.length-1,L=e[w];if(L&&L.name===C){if(C==="type")return[...e.slice(0,w),{...L,value:L.value+k}];if(L.value===k)return[...e.slice(0,w),{...L,count:L.count+1}]}return[...g,{name:C,count:1,value:k}]})},[e,o]);gn(()=>{let C=g=>{if(!r)return;let w=g.key;ou(g)?m("selectAll",""):Cn.has(w)?m("press",g.key):[...w].length>1?m("keydown",g.key):m("type",g.key)},k=g=>{if(!r)return;let w=g.key;!Cn.has(w)&&[...w].length>1&&m("keyup",g.key)};return t.registerRootListener((g,w)=>{w!==null&&(w.removeEventListener("keydown",C),w.removeEventListener("keyup",k)),g!==null&&(g.addEventListener("keydown",C),g.addEventListener("keyup",k))})},[t,r,m]),gn(()=>{d.current&&d.current.scrollTo(0,d.current.scrollHeight)},[p]),$o(()=>{if(e){let C=p();C!==null&&s(C),d.current&&d.current.scrollTo(0,d.current.scrollHeight)}},[p,e]),$o(()=>t.registerUpdateListener(({dirtyElements:k,dirtyLeaves:g,editorState:w})=>{if(!r)return;let L=w._selection,D=u.current,F=c.current;if(D!==L){if(g.size===0&&k.size===0&&!F){let S=Fo(t._window);if(S&&(S.anchorNode==null||S.focusNode==null))return}u.current=L}c.current=!1;let R=p();R!==null&&s(R)}),[t,p,r,m]),$o(()=>r?t.registerUpdateListener(()=>{let k=t.getRootElement();k!==null&&l(k?.innerHTML)}):void 0,[t,r]);let f=Me(C=>{r||(C.update(()=>{let k=qc();k.clear();let g=Yc();k.append(Zc().append(g)),g.select()}),o([])),n(k=>!k)},[r]),h=Me(()=>{if(!r)return;let C=Fo(t._window);if(C===null||C.anchorNode==null||C.focusNode==null)return;let{anchorNode:k,anchorOffset:g,focusNode:w,focusOffset:L}=ru(C),D=a().getRootElement(),F;k!==null&&(F=xn(k,D));let R;w!==null&&(R=xn(w,D)),m("snapshot",{anchorNode:k,anchorOffset:g,anchorPath:F,focusNode:w,focusOffset:L,focusPath:R})},[m,r,a]),x=Me(()=>{Qc(p())},[p]),b=Me(()=>{eu("test.js",p())},[p]);return[De("button",{className:`editor-dev-button ${r?"active":""}`,id:"test-recorder-button",onClick:C=>{f(a()),C.preventDefault()},title:r?"Disable test recorder":"Enable test recorder",type:"button",children:r?"Disable test recorder":"Enable test recorder"}),r?Bo("div",{className:"test-recorder-output",children:[Bo("div",{className:"test-recorder-toolbar",children:[De("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:C=>{h(),C.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),De("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:C=>{x(),C.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),De("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:C=>{b(),C.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),De("pre",{id:"test-recorder",ref:d,children:i})]}):null]}var kn=()=>{let t=Xc(3),[e]=zc(),[o,r]=nu(e),n;return t[0]!==o||t[1]!==r?(n=Bo(bn.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 lu=v({plugins:[{Component:kn,position:"bottom"}]});import{c as iu}from"react/compiler-runtime";import{jsx as su}from"react/jsx-runtime";import{useLexicalComposerContext as au}from"@lexical/react/LexicalComposerContext.js";import{TreeView as cu}from"@lexical/react/LexicalTreeView.js";import"react";var _n=()=>{let t=iu(2),[e]=au(),o;return t[0]!==e?(o=su(cu,{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 uu=v({plugins:[{Component:_n,position:"bottom"}]});import{$isTableSelection as du}from"@lexical/table";import{$isRangeSelection as mu,FORMAT_TEXT_COMMAND as pu}from"lexical";import{jsx as Tn}from"react/jsx-runtime";import"react";var wn=()=>Tn("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:Tn("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 En={type:"text-format",format:["bold","italic"],tag:"***"},Sn={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},Nn={type:"text-format",format:["bold"],tag:"**"},Ln={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var yn=[Y([{ChildComponent:wn,isActive:({selection:t})=>mu(t)||du(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(pu,"bold")},order:1}])],fu=v(({featureProviderMap:t})=>{let e=[Nn,Ln];return t.get("italic")&&e.push(Sn,En),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:yn},toolbarInline:{groups:yn}}});import{$isTableSelection as gu}from"@lexical/table";import{$isRangeSelection as xu,FORMAT_TEXT_COMMAND as Cu}from"lexical";import{jsx as In,jsxs as hu}from"react/jsx-runtime";import"react";var Rn=()=>hu("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:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),In("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var vn={type:"text-format",format:["code"],tag:"`"};var Mn=[Y([{ChildComponent:Rn,isActive:({selection:t})=>xu(t)||gu(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(Cu,"code")},order:7}])],bu=v({enableFormats:["code"],markdownTransformers:[vn],toolbarFixed:{groups:Mn},toolbarInline:{groups:Mn}});import{$isTableSelection as ku}from"@lexical/table";import{$isRangeSelection as _u,FORMAT_TEXT_COMMAND as Tu}from"lexical";import{jsx as Dn}from"react/jsx-runtime";import"react";var An=()=>Dn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Dn("path",{d:"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 On={type:"text-format",format:["italic"],tag:"*"},Fn={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var $n=[Y([{ChildComponent:An,isActive:({selection:t})=>_u(t)||ku(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(Tu,"italic")},order:2}])],wu=v({enableFormats:["italic"],markdownTransformers:[On,Fn],toolbarFixed:{groups:$n},toolbarInline:{groups:$n}});import{$isTableSelection as Su}from"@lexical/table";import{$isRangeSelection as Nu,FORMAT_TEXT_COMMAND as Lu}from"lexical";import{jsx as Pn,jsxs as Eu}from"react/jsx-runtime";import"react";var Bn=()=>Eu("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:[Pn("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"}),Pn("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var Hn={type:"text-format",format:["strikethrough"],tag:"~~"};var jn=[Y([{ChildComponent:Bn,isActive:({selection:t})=>Nu(t)||Su(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(Lu,"strikethrough")},order:4}])],yu=v({enableFormats:["strikethrough"],markdownTransformers:[Hn],toolbarFixed:{groups:jn},toolbarInline:{groups:jn}});import{$isTableSelection as Iu}from"@lexical/table";import{$isRangeSelection as Ru,FORMAT_TEXT_COMMAND as vu}from"lexical";import{jsx as Un}from"react/jsx-runtime";import"react";var Gn=()=>Un("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:Un("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 Wn=[Y([{ChildComponent:Gn,isActive:({selection:t})=>Ru(t)||Iu(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(vu,"subscript")},order:5}])],Mu=v({enableFormats:["subscript"],toolbarFixed:{groups:Wn},toolbarInline:{groups:Wn}});import{$isTableSelection as Du}from"@lexical/table";import{$isRangeSelection as Au,FORMAT_TEXT_COMMAND as Ou}from"lexical";import{jsx as Vn}from"react/jsx-runtime";import"react";var Kn=()=>Vn("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:Vn("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 Jn=[Y([{ChildComponent:Kn,isActive:({selection:t})=>Au(t)||Du(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(Ou,"superscript")},order:6}])],Fu=v({enableFormats:["superscript"],toolbarFixed:{groups:Jn},toolbarInline:{groups:Jn}});import{$isTableSelection as Pu}from"@lexical/table";import{$isRangeSelection as Bu,FORMAT_TEXT_COMMAND as Hu}from"lexical";import{jsx as Xn,jsxs as $u}from"react/jsx-runtime";import"react";var zn=()=>$u("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:[Xn("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"}),Xn("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var Zn=[Y([{ChildComponent:zn,isActive:({selection:t})=>Bu(t)||Pu(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(Hu,"underline")},order:3}])],ju=v({enableFormats:["underline"],toolbarFixed:{groups:Zn},toolbarInline:{groups:Zn}});import{jsx as Uo}from"react/jsx-runtime";import{jsx as Uu}from"react/jsx-runtime";function Gu(t){return t.replace(/-([a-z])/g,(e,o)=>o.toUpperCase())}var zt=({css:t})=>{let e=t?Object.fromEntries(Object.entries(t).map(([o,r])=>[Gu(o),r])):{};return Uu("span",{style:{...e,alignItems:"center",borderRadius:"4px",display:"flex",fontSize:"16px",height:"20px",justifyContent:"center",width:"20px"},children:"A"})};import{useLexicalComposerContext as Wu}from"@lexical/react/LexicalComposerContext";import{$forEachSelectedTextNode as Vu}from"@lexical/selection";import{$getNodeByKey as Ku,$getState as Ju,$setState as Xu,createState as zu,TextNode as Zu}from"lexical";import{useEffect as Yu}from"react";var Ho=new Map;function Yn(t){for(let e in t){let o=t[e],r=zu(e,{parse:n=>typeof n=="string"&&Object.keys(o).includes(n)?n:void 0});Ho.set(e,{stateConfig:r,stateValues:o})}}function jo(t,e,o){t.update(()=>{Vu(r=>{let n=Ho.get(e);if(!n)throw new Error(`State config for ${e} not found`);Xu(r,n.stateConfig,o)})})}function qn(){let[t]=Wu();return Yu(()=>t.registerMutationListener(Zu,e=>{t.getEditorState().read(()=>{for(let[o,r]of e){if(r==="destroyed")continue;let n=Ku(o),l=t.getElementByKey(o);if(!n||!l)continue;let i=Object.create(null);Ho.forEach((s,u)=>{let c=Ju(n,s.stateConfig);if(!c){delete l.dataset[u];return}l.dataset[u]=c;let d=s.stateValues[c]?.css;d&&Object.assign(i,d)}),l.style.cssText="",Object.assign(l.style,i)}})}),[t]),null}var Qn=t=>{let e=[];for(let r in t.state){let n=t.state[r];for(let l in n){let i=n[l];e.push({ChildComponent:()=>Uo(zt,{css:i.css}),key:l,label:i.label,onSelect:({editor:s})=>{jo(s,r,l)}})}}return[{type:"dropdown",ChildComponent:()=>Uo(zt,{css:{color:"var(--theme-elevation-600)"}}),items:[...[{ChildComponent:()=>Uo(zt,{}),key:"clear-style",label:({i18n:r})=>r.t("lexical:textState:defaultStyle"),onSelect:({editor:r})=>{for(let n in t.state)jo(r,n,void 0)},order:1}],...e],key:"textState",order:30}]},qu=v(({props:t})=>(Yn(t.state),{plugins:[{Component:qn,position:"normal"}],toolbarFixed:{groups:Qn(t)},toolbarInline:{groups:Qn(t)}}));import{c as od}from"react/compiler-runtime";import{useLexicalComposerContext as rd}from"@lexical/react/LexicalComposerContext";import{$createHeadingNode as nd,$isHeadingNode as pl,HeadingNode as gl}from"@lexical/rich-text";import{$setBlocksType as ld}from"@lexical/selection";import{$getSelection as id,$isRangeSelection as sd}from"lexical";import{useEffect as ad}from"react";import{jsx as el}from"react/jsx-runtime";import"react";var tl=()=>el("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:el("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 ol}from"react/jsx-runtime";import"react";var rl=()=>ol("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:ol("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 nl}from"react/jsx-runtime";import"react";var ll=()=>nl("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:nl("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 il}from"react/jsx-runtime";import"react";var sl=()=>il("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:il("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 al}from"react/jsx-runtime";import"react";var cl=()=>al("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:al("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 ul}from"react/jsx-runtime";import"react";var dl=()=>ul("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:ul("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 Qu,$isHeadingNode as ed,HeadingNode as td}from"@lexical/rich-text";var Go=t=>(e,o,r)=>{let n=t(r);n&&(n.append(...o),e.replace(n),n.select(0,0))};var ml=t=>{let o=`^(${t.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`,r=new RegExp(o);return{type:"element",dependencies:[td],export:(n,l)=>{if(!ed(n))return null;let i=Number(n.getTag().slice(1));return"#".repeat(i)+" "+l(n)},regExp:r,replace:Go(n=>{let l="h"+n[1]?.length;return Qu(l)})}};var fl=t=>{let e=id();ld(e,()=>nd(t))},hl={h1:tl,h2:rl,h3:ll,h4:sl,h5:cl,h6:dl},cd=v(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[Q(e.map((r,n)=>({ChildComponent:hl[r],isActive:({selection:l})=>{if(!sd(l))return!1;for(let i of l.getNodes()){if(pl(i)&&i.getTag()===r)continue;let s=i.getParent();if(!(pl(s)&&s.getTag()===r))return!1}return!0},key:r,label:({i18n:l})=>l.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:l})=>{l.update(()=>{fl(r)})},order:n+2})))];return{markdownTransformers:[ml(e)],nodes:[gl],plugins:[{Component:ud,position:"normal"}],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[Z(e.map(r=>({Icon:hl[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(()=>{fl(r)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}}),ud=t=>{let e=od(9),{clientProps:o}=t,{enabledHeadingSizes:r}=o,n;e[0]!==r?(n=r===void 0?["h1","h2","h3","h4","h5","h6"]:r,e[0]=r,e[1]=n):n=e[1];let l=n,i;e[2]!==l?(i=l.at(-1),e[2]=l,e[3]=i):i=e[3];let s=i,[u]=rd(),c,d;return e[4]!==u||e[5]!==l||e[6]!==s?(c=()=>{if(!(!s||l.length===6))return u.registerNodeTransform(gl,a=>{l.includes(a.getTag())||a.setTag(s)})},d=[u,l,s],e[4]=u,e[5]=l,e[6]=s,e[7]=c,e[8]=d):(c=e[7],d=e[8]),ad(c,d),null};import{$isNodeSelection as Nd}from"lexical";import{jsx as xl}from"react/jsx-runtime";import"react";var Wo=()=>xl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:xl("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as Cl,jsxs as dd}from"react/jsx-runtime";import"react";var bl=()=>dd("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Cl("path",{d:"M5 10h10",stroke:"currentColor"}),Cl("path",{d:"M10 15V5",stroke:"currentColor"})]});var he=t=>({type:"dropdown",ChildComponent:bl,items:t,key:"add",order:10});import{addClassNamesToElement as md}from"@lexical/utils";import{$applyNodeReplacement as pd,createCommand as fd,DecoratorNode as hd}from"lexical";var pt=fd("INSERT_HORIZONTAL_RULE_COMMAND"),mt=class extends hd{static clone(e){return new this(e.__key)}static getType(){return"horizontalrule"}static importDOM(){return{hr:()=>({conversion:gd,priority:0})}}static importJSON(e){return kl()}createDOM(e){let o=document.createElement("hr");return md(o,e.theme.hr),o}decorate(){return null}exportDOM(){return{element:document.createElement("hr")}}exportJSON(){return{type:"horizontalrule",version:1}}getTextContent(){return`
|
|
35
|
+
`}isInline(){return!1}updateDOM(){return!1}};function gd(){return{node:kl()}}function kl(){return pd(new mt)}import{$applyNodeReplacement as xd}from"lexical";import"react";var Ne=class extends mt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return ft()}decorate(){return null}exportJSON(){return super.exportJSON()}};function ft(){return xd(new Ne)}function Zt(t){return t instanceof Ne}var _l={type:"element",dependencies:[Ne],export:(t,e)=>Zt(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=ft();e&&t.replace(e)}};import{c as Cd}from"react/compiler-runtime";import{useLexicalComposerContext as bd}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as kd}from"@lexical/utils";import{$getSelection as _d,$isRangeSelection as Td,COMMAND_PRIORITY_EDITOR as wd}from"lexical";import{useEffect as Ed}from"react";var Tl=()=>{let t=Cd(3),[e]=bd(),o,r;return t[0]!==e?(o=()=>e.registerCommand(pt,Sd,wd),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Ed(o,r),null};function Sd(t){let e=_d();if(!Td(e))return!1;if(e.focus.getNode()!==null){let r=ft();kd(r)}return!0}var Ld=v({markdownTransformers:[_l],nodes:[Ne],plugins:[{Component:Tl,position:"normal"}],slashMenu:{groups:[Z([{Icon:Wo,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(pt,void 0)}}])]},toolbarFixed:{groups:[he([{ChildComponent:Wo,isActive:({selection:t})=>{if(!Nd(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Zt(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(pt,void 0)}}])]}});import{$findMatchingParent as Ml}from"@lexical/utils";import{$isElementNode as Hd,INDENT_CONTENT_COMMAND as jd,OUTDENT_CONTENT_COMMAND as Ud}from"lexical";import{jsx as Yt,jsxs as yd}from"react/jsx-runtime";import"react";var wl=()=>yd("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Yt("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),Yt("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),Yt("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Yt("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as qt,jsxs as Id}from"react/jsx-runtime";import"react";var El=()=>Id("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[qt("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),qt("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),qt("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),qt("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});import{jsx as Rd}from"react/jsx-runtime";import{useLexicalComposerContext as vd}from"@lexical/react/LexicalComposerContext";import{TabIndentationPlugin as Md}from"@lexical/react/LexicalTabIndentationPlugin";import{$findMatchingParent as Dd,mergeRegister as Sl}from"@lexical/utils";import{$getSelection as Ad,$isElementNode as Il,$isRangeSelection as Od,COMMAND_PRIORITY_LOW as Nl,INDENT_CONTENT_COMMAND as Ll,KEY_TAB_COMMAND as Fd,OUTDENT_CONTENT_COMMAND as $d,TabNode as Pd}from"lexical";import{useEffect as yl}from"react";var Rl=({clientProps:t})=>{let[e]=vd(),{disabledNodes:o,disableTabNode:r}=t;return yl(()=>{if(!(!e||!o?.length))return Sl(e.registerCommand(Ll,()=>Bd(n=>{if(!o.includes(n.getType())){let l=n.getIndent();n.setIndent(l+1)}}),Nl),e.registerUpdateListener(({dirtyElements:n,editorState:l})=>{e.update(()=>{for(let[i]of n){let s=l._nodeMap.get(i);Il(s)&&o.includes(s.getType())&&s.getIndent()>0&&s.setIndent(0)}})}))},[e,o]),yl(()=>{if(!(!e||!r))return Sl(e.registerCommand(Fd,n=>(n.preventDefault(),e.dispatchCommand(n.shiftKey?$d:Ll,void 0)),Nl),e.registerNodeTransform(Pd,n=>{n.remove()}))},[e,r]),Rd(Md,{})};function Bd(t){let e=Ad();if(!Od(e))return!1;let o=new Set,r=e.getNodes();for(let n=0;n<r.length;n++){let l=r[n],i=l.getKey();if(o.has(i))continue;let s=Dd(l,c=>Il(c)&&!c.isInline());if(s===null)continue;let u=s.getKey();s.canIndent()&&!o.has(u)&&(o.add(u),t(s))}return o.size>0}var vl=t=>({type:"buttons",items:t,key:"indent",order:35});var Dl=({disabledNodes:t})=>[vl([{ChildComponent:wl,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>Al(n)&&n.getIndent()>0;return o.some(n=>r(n)||!!Ml(n,r))},key:"indentDecrease",label:({i18n:e})=>e.t("lexical:indent:decreaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Ud,void 0)},order:1},{ChildComponent:El,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>Al(n)&&!(t??[]).includes(n.getType());return o.some(n=>r(n)||!!Ml(n,r))},key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(jd,void 0)},order:2}])],Gd=v(({props:t})=>{let e=t.disabledNodes??[];return{plugins:[{Component:Rl,position:"normal"}],sanitizedClientFeatureProps:t,toolbarFixed:{groups:Dl({disabledNodes:e})},toolbarInline:{groups:Dl({disabledNodes:e})}}}),Al=t=>Hd(t)&&t.canIndent();import{$findMatchingParent as tp}from"@lexical/utils";import{$getSelection as Qo,$isRangeSelection as di}from"lexical";import{jsx as Ol}from"react/jsx-runtime";import"react";var Fl=()=>Ol("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:Ol("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 $l}from"@lexical/selection";function Ve(t){let{anchor:e}=t,{focus:o}=t,r=t.anchor.getNode(),n=t.focus.getNode();return r===n?r:t.isBackward()?$l(o)?r:n:$l(e)?r:n}var Vo=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as em}from"lexical";import{addClassNamesToElement as Wd,isHTMLAnchorElement as Vd}from"@lexical/utils";import Xo from"bson-objectid";import{$applyNodeReplacement as Kd,$createTextNode as Pl,$getSelection as Jd,$isElementNode as Bl,$isRangeSelection as Jo,createCommand as Xd,ElementNode as zd}from"lexical";var Zd=new Set(["http:","https:","mailto:","sms:","tel:"]),ee=class t extends zd{__fields;__id;constructor({id:e,fields:o={linkType:"custom",newTab:!1},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:Yd,priority:1})}}static importJSON(e){let o=ge({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),e.version===2&&!e.id&&(e.id=new Xo.default().toHexString(),e.version=3),o}canBeEmpty(){return!1}canInsertTextAfter(){return!1}canInsertTextBefore(){return!1}createDOM(e){let o=document.createElement("a");return this.__fields?.linkType==="custom"&&(o.href=this.sanitizeUrl(this.__fields.url??"")),(this.__fields?.newTab??!1)&&(o.target="_blank"),this.__fields?.newTab===!0&&this.__fields?.linkType==="custom"&&(o.rel=Ko(o.rel,"add","noopener")),Wd(o,e.theme.link),o}exportJSON(){let e=this.getFields();e?.linkType==="internal"?delete e.url:e?.linkType==="custom"&&delete e.doc;let o={...super.exportJSON(),type:"link",fields:e,version:3},r=this.getID();return r&&(o.id=r),o}extractWithChild(e,o,r){if(!Jo(o))return!1;let n=o.anchor.getNode(),l=o.focus.getNode();return this.isParentOf(n)&&this.isParentOf(l)&&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(Bl(r)){let n=ge({fields:this.__fields});return r.append(n),n}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!Zd.has(o.protocol))return"about:blank"}catch{return"https://"}return e}setFields(e){let o=this.getWritable();return o.__fields=e,o}setID(e){let o=this.getWritable();return o.__id=e,o}updateDOM(e,o,r){let n=this.__fields?.url,l=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=""),l!==e.__fields?.newTab&&(l??!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}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields).setID(e.id)}};function Yd(t){let e=null;if(Vd(t)){let o=t.textContent;o!==null&&o!==""&&(e=ge({id:new Xo.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function ge({id:t,fields:e}){return Kd(new ee({id:t??new Xo.default().toHexString(),fields:e}))}function J(t){return t instanceof ee}var ce=Xd("TOGGLE_LINK_COMMAND");function zo(t){let e=Jd();if(!Jo(e)&&(t===null||!t.selectedNodes?.length))return;let o=Jo(e)?e.extract():t===null?[]:t.selectedNodes;if(t===null){o?.forEach(l=>{let i=l.getParent();J(i)&&(i.getChildren().forEach(u=>{i.insertBefore(u)}),i.remove())});return}if(o?.length===1){let l=o[0],i=J(l)?l:qd(l);if(i!==null){i.setFields(t.fields),t.text!=null&&t.text!==i.getTextContent()&&(i.append(Pl(t.text)),i.getChildren().forEach(s=>{s!==i.getLastChild()&&s.remove()}));return}}let r=null,n=null;o?.forEach(l=>{let i=l.getParent();if(!(i===n||i===null||Bl(l)&&!l.isInline())){if(J(i)){n=i,i.setFields(t.fields),t.text!=null&&t.text!==i.getTextContent()&&(i.append(Pl(t.text)),i.getChildren().forEach(s=>{s!==i.getLastChild()&&s.remove()}));return}if(i.is(r)||(r=i,n=ge({fields:t.fields}),J(i)?l.getPreviousSibling()===null?i.insertBefore(n):i.insertAfter(n):l.insertBefore(n)),J(l)){if(l.is(n))return;if(n!==null){let s=l.getChildren();n.append(...s)}l.remove();return}n!==null&&n.append(l)}})}function qd(t){return Qd(t,e=>J(e))}function Qd(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 l=new RegExp(o,"g");n=n.replace(l,"").trim()}n=n.trim(),r=n.length===0?`${o}`:`${n} ${o}`}else{let l=new RegExp(o,"g");r=n.replace(l,"").trim()}return r}var Hl={type:"text-match",dependencies:[ee],export:(t,e)=>{if(!J(t))return null;let o=t,{url:r}=o.getFields();return`[${e(o)}](${r})`},importRegExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:(t,e)=>{let[,o,r]=e,n=ge({fields:{doc:null,linkType:"custom",newTab:!1,url:r}}),l=em(o);return l.setFormat(t.getFormat()),n.append(l),t.replace(n),l},trigger:")"};import{$applyNodeReplacement as tm,$isElementNode as om}from"lexical";var xe=class t extends ee{static clone(e){return new t({id:"",fields:e.__fields,key:e.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(e){let o=ht({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),o}exportJSON(){let e=super.exportJSON();return{type:"autolink",children:e.children,direction:e.direction,fields:e.fields,format:e.format,indent:e.indent,version:2}}insertNewAfter(e,o=!0){let r=this.getParentOrThrow().insertNewAfter(e,o);if(om(r)){let n=ht({fields:this.__fields});return r.append(n),n}return null}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields)}};function ht({fields:t}){return tm(new xe({id:"",fields:t}))}function Ce(t){return t instanceof xe}import{c as rm}from"react/compiler-runtime";import{useLexicalComposerContext as nm}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as lm}from"@lexical/utils";import{$createTextNode as jl,$getSelection as im,$isElementNode as Gl,$isLineBreakNode as Wl,$isNodeSelection as sm,$isRangeSelection as am,$isTextNode as gt,TextNode as cm}from"lexical";import{useEffect as um}from"react";function Ul(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 Vl(t,e){for(let o of e){let r=o(t);if(r!=null)return r}return null}var dm=/[.,;\s]/;function eo(t){return t!==void 0&&dm.test(t)}function Kl(t){return eo(t[t.length-1])}function Yo(t){return eo(t[0])}function mm(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function Jl(t){let e=t.getPreviousSibling();return Gl(e)&&(e=e.getLastDescendant()),e===null||Wl(e)||gt(e)&&Kl(e.getTextContent())}function Xl(t){let e=t.getNextSibling();return Gl(e)&&(e=e.getFirstDescendant()),e===null||Wl(e)||gt(e)&&Yo(e.getTextContent())}function pm(t,e,o,r){return(t>0?eo(o[t-1]):Jl(r[0]))?e<o.length?eo(o[e]):Xl(r[r.length-1]):!1}function fm(t,e,o){let r=[],n=[],l=[],i=0,s=0,u=[...t];for(;u.length>0;){let c=u[0],a=c.getTextContent().length,p=s;s+a<=e?(r.push(c),i+=a):p>=o?l.push(c):n.push(c),s+=a,u.shift()}return[i,r,n,l]}function hm(t,e,o,r){let n={linkType:"custom",url:r.url,...r.fields},l=ht({fields:n});if(t.length===1){let i=t[0],s;if(e===0?[s]=i.splitText(o):[,s]=i.splitText(e,o),s){let u=jl(r.text);u.setFormat(s.getFormat()),u.setDetail(s.getDetail()),u.setStyle(s.getStyle()),l.append(u),s.replace(l)}return i}else if(t.length>1){let i=t[0],s=i.getTextContent().length,u;e===0?u=i:[,u]=i.splitText(e);let c=[],d;if(t.forEach(a=>{let m=a.getTextContent().length,f=s,h=s+m;if(f<o)if(h<=o)c.push(a);else{let[x,b]=a.splitText(o-f);x&&c.push(x),d=b}s+=m}),u){let a=im(),p=a?a.getNodes().find(gt):void 0,m=jl(u.getTextContent());return m.setFormat(u.getFormat()),m.setDetail(u.getDetail()),m.setStyle(u.getStyle()),l.append(m,...c),p&&p===u&&(am(a)?m.select(a.anchor.offset,a.focus.offset):sm(a)&&m.select(0,m.getTextContent().length)),u.replace(l),d}}}function gm(t,e,o){let r=[...t],n=r.map(u=>u.getTextContent()).join(""),l=n,i,s=0;for(;(i=Vl(l,e))!=null&&i!==null;){let u=i.index,c=i.length,d=u+c;if(pm(s+u,s+d,n,r)){let[p,,m,f]=fm(r,s+u,s+d),h=s+u-p,x=s+d-p,b=hm(m,h,x,i);r=b?[b,...f]:f,o(i.url,null),s=0}else s+=d;l=l.substring(d)}}function Zo(t,e,o){let r=t.getChildren(),n=r.length;for(let u=0;u<n;u++){let c=r[u];if(!gt(c)||!c.isSimpleText()){Qt(t),o(null,t.getFields()?.url??null);return}}let l=t.getTextContent(),i=Vl(l,e);if(i===null||i.text!==l){Qt(t),o(null,t.getFields()?.url??null);return}if(!Jl(t)||!Xl(t)){Qt(t),o(null,t.getFields()?.url??null);return}let s=t.getFields()?.url;if(s!==i?.url){let u=t.getFields();u.url=i?.url,t.setFields(u),o(i.url,s??null)}}function xm(t,e,o){let r=t.getPreviousSibling(),n=t.getNextSibling(),l=t.getTextContent();if(Ce(r)){let i=r.getFields()?.url?r.getFields()?.url?.startsWith("mailto:")??!1:!1;(!Yo(l)||mm(l,i))&&(r.append(t),Zo(r,e,o),o(null,r.getFields()?.url??null))}Ce(n)&&!Kl(l)&&(Qt(n),Zo(n,e,o),o(null,n.getFields()?.url??null))}function Qt(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 Cm(t){let e=[t],o=t.getNextSibling();for(;o!==null&>(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function bm(t,e,o){let r=rm(5),n,l;r[0]!==t||r[1]!==e||r[2]!==o?(n=()=>{if(!t.hasNodes([xe]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let i=(s,u)=>{o?.(s,u)};return lm(t.registerNodeTransform(cm,s=>{let u=s.getParentOrThrow(),c=s.getPreviousSibling();if(Ce(u))Zo(u,e,i);else if(!J(u)){if(s.isSimpleText()&&(Yo(s.getTextContent())||!Ce(c))){let d=Cm(s);gm(d,e,i)}xm(s,e,i)}}))},l=[t,e,o],r[0]=t,r[1]=e,r[2]=o,r[3]=n,r[4]=l):(n=r[3],l=r[4]),um(n,l)}var km=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,_m=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,Tm=[Ul(km,t=>t.startsWith("http")?t:`https://${t}`),Ul(_m,t=>`mailto:${t}`)],zl=()=>{let[t]=nm();return bm(t,Tm),null};import{jsx as wm}from"react/jsx-runtime";import{ClickableLinkPlugin as Em}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var Zl=()=>wm(Em,{});import{jsx as Um}from"react/jsx-runtime";import"react";import{createPortal as Gm}from"react-dom";import{jsx as be,jsxs as xt,Fragment as Nm}from"react/jsx-runtime";import{useLexicalComposerContext as Lm}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as Yl,mergeRegister as ql}from"@lexical/utils";import{getTranslation as qo}from"@payloadcms/translations";import{CloseMenuIcon as ym,EditIcon as Im,ExternalLinkIcon as Ql,formatDrawerSlug as Rm,useConfig as vm,useEditDepth as Mm,useLocale as Dm,useTranslation as Am}from"@payloadcms/ui";import{requests as Om}from"@payloadcms/ui/shared";import{$getSelection as ei,$isLineBreakNode as Fm,$isRangeSelection as ti,COMMAND_PRIORITY_HIGH as $m,COMMAND_PRIORITY_LOW as oi,getDOMSelection as Pm,KEY_ESCAPE_COMMAND as Bm,SELECTION_CHANGE_COMMAND as Hm}from"lexical";import ri,{useCallback as ni,useEffect as ro,useRef as jm,useState as Ae}from"react";function to(t,e,o,r=10,n=5){let l=o.parentElement;if(t===null||l==null){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let i=e.getBoundingClientRect(),s=o.getBoundingClientRect(),u=l.getBoundingClientRect(),c=t.top-r,d=t.left-n;c<u.top&&(c+=i.height+t.height+r*2),d+i.width>u.right&&(d=u.right-i.width-n),c-=s.top,d-=s.left,e.style.opacity="1",e.style.transform=`translate(${d}px, ${c}px)`}import{createCommand as Sm}from"lexical";var oo=Sm("TOGGLE_LINK_WITH_MODAL_COMMAND");function li(t){t.preventDefault()}function ii({anchorElem:t}){let[e]=Lm(),[o,r]=Ae(),n=jm(null),[l,i]=Ae(null),[s,u]=Ae(null),{fieldProps:{schemaPath:c},uuid:d}=H(),{config:a,getEntityConfig:p}=vm(),{i18n:m,t:f}=Am(),[h,x]=Ae(),b=Mm(),[T,E]=Ae(!1),[C,k]=Ae([]),g=Dm(),[w,L]=Ae(!1),D=Rm({slug:"lexical-rich-text-link-"+d,depth:b}),{toggleDrawer:F}=me(D),R=ni(()=>{E(!1),n&&n.current&&(n.current.style.opacity="0",n.current.style.transform="translate(-10000px, -10000px)"),L(!1),i(null),u(null),k([]),x(void 0)},[E,i,u,k]),S=ni(()=>{let _=ei(),N;if(!ti(_)||!_){R();return}let M=Ve(_);N=e.getElementByKey(M.getKey())?.getBoundingClientRect();let I=Yl(M,J),A=_.getNodes().filter(X=>!Fm(X)).find(X=>{let U=Yl(X,J);return I&&!I.is(U)||U&&!U.is(I)});if(I==null||A){R();return}r(I);let y=I.getFields(),$={...y,id:I.getID(),text:I.getTextContent()};if(y?.linkType==="custom")i(y?.url??null),u(null);else{i(`${a.routes.admin==="/"?"":a.routes.admin}/collections/${y?.doc?.relationTo}/${y?.doc?.value}`);let X=y?.doc?.relationTo?p({collectionSlug:y?.doc?.relationTo}):void 0;if(!X)u(y?.label?String(y?.label):null),i(y?.url?String(y?.url):null);else{let U=typeof y.doc?.value=="object"?y.doc.value.id:y.doc?.value,Be=y.doc?.relationTo;if(!U||!Be)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let we=f("fields:linkedTo",{label:`${qo(X.labels.singular,m)} - ${f("lexical:link:loadingWithEllipsis",m)}`}).replace(/<[^>]*>?/g,"");u(we),Om.get(`${a.serverURL}${a.routes.api}/${Be}/${U}`,{headers:{"Accept-Language":m.language},params:{depth:0,locale:g?.code}}).then(async de=>{if(!de.ok)throw new Error(`HTTP error! Status: ${de.status}`);let Mt=await de.json(),Ee=X?.admin?.useAsTitle||"id",Dt=Mt[Ee],He=f("fields:linkedTo",{label:`${qo(X.labels.singular,m)} - ${Dt}`}).replace(/<[^>]*>?/g,"");u(He)}).catch(()=>{let de=f("fields:linkedTo",{label:`${qo(X.labels.singular,m)} - ${f("general:untitled",m)} - ID: ${U}`}).replace(/<[^>]*>?/g,"");u(de)})}}x($),E(!0),k(_?_?.getNodes():[]),Ce(I)?L(!0):L(!1);let G=n.current,q=Pm(e._window),{activeElement:te}=document;if(G===null)return;let vt=e.getRootElement();return q!==null&&vt!==null&&vt.contains(q.anchorNode)?(N||(N=q.getRangeAt(0).getBoundingClientRect()),N!=null&&(N.y+=40,to(N,G,t))):(te==null||te.className!=="link-input")&&(vt!==null&&to(null,G,t),i(null),u(null)),!0},[e,R,a.routes.admin,a.routes.api,a.serverURL,p,f,m,g?.code,t]);return ro(()=>ql(e.registerCommand(oo,_=>(e.dispatchCommand(ce,_),S(),F(),!0),oi)),[e,S,F,D]),ro(()=>{let _=t.parentElement,N=()=>{e.getEditorState().read(()=>{S()})};return window.addEventListener("resize",N),_?.addEventListener("scroll",N),()=>{window.removeEventListener("resize",N),_?.removeEventListener("scroll",N)}},[t.parentElement,e,S]),ro(()=>ql(e.registerUpdateListener(({editorState:_})=>{_.read(()=>{S()})}),e.registerCommand(Hm,()=>(S(),!0),oi),e.registerCommand(Bm,()=>T?(R(),!0):!1,$m)),[e,S,T,R]),ro(()=>{e.getEditorState().read(()=>{S()})},[e,S]),xt(ri.Fragment,{children:[be("div",{className:"link-editor",ref:n,children:xt("div",{className:"link-input",children:[l&&l.length>0?xt("a",{href:l,rel:"noopener noreferrer",target:"_blank",children:[o?.__fields.newTab?be(Ql,{}):null,s!=null&&s.length>0?s:l]}):s!=null&&s.length>0?xt(Nm,{children:[o?.__fields.newTab?be(Ql,{}):null,be("span",{className:"link-input__label-pure",children:s})]}):null,e.isEditable()&&xt(ri.Fragment,{children:[be("button",{"aria-label":"Edit link",className:"link-edit",onClick:_=>{_.preventDefault(),F()},onMouseDown:li,tabIndex:0,type:"button",children:be(Im,{})}),!w&&be("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(ce,null)},onMouseDown:li,tabIndex:0,type:"button",children:be(ym,{})})]})]})}),be(nt,{className:"lexical-link-edit-drawer",data:h,drawerSlug:D,drawerTitle:f("fields:editLink"),featureKey:"link",handleDrawerSubmit:(_,N)=>{let M=N,I={...M};delete I.text,e.update(()=>{let A=ei(),y=null;if(ti(A)?y=Ve(A).getParent():C.length&&(y=C[0]?.getParent()??null),y&&Ce(y)){let $=ge({fields:I});y.replace($,!0)}}),e.dispatchCommand(ce,{fields:I,selectedNodes:C,text:M.text})},schemaPath:c,schemaPathSuffix:"fields"})]})}var si=t=>{let{anchorElem:e=document.body}=t;return Gm(Um(ii,{anchorElem:e}),e)};import{c as Km}from"react/compiler-runtime";import{useLexicalComposerContext as Jm}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Xm}from"@lexical/utils";import{$getSelection as zm,$isElementNode as Zm,$isRangeSelection as Ym,COMMAND_PRIORITY_LOW as ci,PASTE_COMMAND as qm}from"lexical";import{useEffect as Qm}from"react";var Wm=/^(?:[a-zA-Z][a-zA-Z\d+.-]*:(?:\/\/)?(?:[-;:&=+$,\w]+@)?[A-Za-z\d]+(?:\.[A-Za-z\d]+)+|www\.[A-Za-z\d]+(?:\.[A-Za-z\d]+)+|(?:tel|mailto):[\w+.-]+)(?:\/[+~%/\w-]*)?(?:\?[-;&=%\w]*)?(?:#\w+)?$/,Vm=/^(?:\/[\w\-./]*(?:#\w[\w-]*)?|#[\w\-]+)$/;function ai(t){if(!t)return!1;if(t==="https://"||Wm.test(t)||Vm.test(t))return!0;try{return new URL(t),!0}catch{}return!1}var ui=t=>{let e=Km(5),{clientProps:o}=t,[r]=Jm(),n,l;return e[0]!==o.defaultLinkType||e[1]!==o.defaultLinkURL||e[2]!==r?(n=()=>{if(!r.hasNodes([ee]))throw new Error("LinkPlugin: LinkNode not registered on editor");return Xm(r.registerCommand(ce,i=>i===null?(zo(null),!0):(i.fields?.linkType||(i.fields.linkType=o.defaultLinkType),i.fields?.url||(i.fields.url=o.defaultLinkURL),zo(i),!0),ci),r.registerCommand(qm,i=>{let s=zm();if(!Ym(s)||s.isCollapsed()||!(i instanceof ClipboardEvent)||i.clipboardData==null)return!1;let u=i.clipboardData.getData("text");if(!ai(u))return!1;if(!s.getNodes().some(ep)){let c={doc:null,linkType:"custom",newTab:!1,url:u};return r.dispatchCommand(ce,{fields:c,text:null}),i.preventDefault(),!0}return!1},ci))},l=[o.defaultLinkType,o.defaultLinkURL,r],e[0]=o.defaultLinkType,e[1]=o.defaultLinkURL,e[2]=r,e[3]=n,e[4]=l):(n=e[3],l=e[4]),Qm(n,l),null};function ep(t){return Zm(t)}var mi=[Vo([{ChildComponent:Fl,isActive:({selection:t})=>{if(di(t)){let e=Ve(t);return tp(e,J)!=null}return!1},isEnabled:({selection:t})=>!!(di(t)&&Qo()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(ce,null);else{let o,r=[];if(t.getEditorState().read(()=>{o=Qo()?.getTextContent(),r=Qo()?.getNodes()??[]}),!o?.length)return;let n={doc:null};t.dispatchCommand(oo,{fields:n,selectedNodes:r,text:o})}},order:1}])],op=v(({props:t})=>({markdownTransformers:[Hl],nodes:[ee,t?.disableAutoLinks===!0?null:xe].filter(Boolean),plugins:[{Component:ui,position:"normal"},t?.disableAutoLinks===!0||t?.disableAutoLinks==="creationOnly"?null:{Component:zl,position:"normal"},{Component:Zl,position:"normal"},{Component:si,position:"floatingAnchorElem"}].filter(Boolean),sanitizedClientFeatureProps:t,toolbarFixed:{groups:mi},toolbarInline:{groups:mi}}));import{$isListNode as or,INSERT_CHECK_LIST_COMMAND as Ci,ListItemNode as fp,ListNode as hp}from"@lexical/list";import{$isRangeSelection as gp}from"lexical";import{jsx as pi,jsxs as rp}from"react/jsx-runtime";import"react";var er=()=>rp("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:[pi("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),pi("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as np}from"react/jsx-runtime";import{ListPlugin as lp}from"@lexical/react/LexicalListPlugin.js";import"react";var Ke=()=>np(lp,{});function Je(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as cp,ListItemNode as up,ListNode as dp}from"@lexical/list";import{$createListItemNode as ip,$createListNode as sp,$isListItemNode as ap,$isListNode as tr}from"@lexical/list";var fi=4,Xe=t=>(e,o,r)=>{let n=e.getPreviousSibling(),l=e.getNextSibling(),i=ip(t==="check"?r[3]==="x":void 0);if(tr(l)&&l.getListType()===t){let u=l.getFirstChild();u!==null?u.insertBefore(i):l.append(i),e.remove()}else if(tr(n)&&n.getListType()===t)n.append(i),e.remove();else{let u=sp(t,t==="number"?Number(r[2]):void 0);u.append(i),e.replace(u)}i.append(...o),i.select(0,0);let s=Math.floor(r[1].length/fi);s&&i.setIndent(s)},Oe=(t,e,o)=>{let r=[],n=t.getChildren(),l=0;for(let i of n)if(ap(i)){if(i.getChildrenSize()===1){let d=i.getFirstChild();if(tr(d)){r.push(Oe(d,e,o+1));continue}}let s=" ".repeat(o*fi),u=t.getListType(),c=u==="number"?`${t.getStart()+l}. `:u==="check"?`- [${i.getChecked()?"x":" "}] `:"- ";r.push(s+c+e(i)),l++}return r.join(`
|
|
36
|
+
`)};var hi={type:"element",dependencies:[dp,up],export:(t,e)=>cp(t)?Oe(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:Xe("check")};import{jsx as mp}from"react/jsx-runtime";import{CheckListPlugin as pp}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var gi=()=>mp(pp,{});var xi=[Q([{ChildComponent:er,isActive:({selection:t})=>{if(!gp(t))return!1;for(let e of t.getNodes()){if(or(e)&&e.getListType()==="check")continue;let o=e.getParent();if(or(o)&&o.getListType()==="check")continue;let r=o?.getParent();if(!(or(r)&&r.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ci,void 0)},order:12}])],xp=v(({featureProviderMap:t})=>{let e=[{Component:gi,position:"normal"}];return!t.has("unorderedList")&&!t.has("orderedList")&&e.push({Component:Ke,position:"normal"}),{markdownTransformers:[hi],nodes:t.has("unorderedList")||t.has("orderedList")?[]:[hp,fp],plugins:e,slashMenu:{groups:[Je([{Icon:er,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:o})=>o.t("lexical:checklist:label"),onSelect:({editor:o})=>{o.dispatchCommand(Ci,void 0)}}])]},toolbarFixed:{groups:xi},toolbarInline:{groups:xi}}});import{$isListNode as nr,INSERT_ORDERED_LIST_COMMAND as _i,ListItemNode as Tp,ListNode as wp}from"@lexical/list";import{$isRangeSelection as Ep}from"lexical";import{jsx as Ct,jsxs as Cp}from"react/jsx-runtime";import"react";var rr=()=>Cp("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Ct("path",{d:"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"}),Ct("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"}),Ct("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),Ct("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),Ct("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as bp,ListItemNode as kp,ListNode as _p}from"@lexical/list";var bi={type:"element",dependencies:[_p,kp],export:(t,e)=>bp(t)?Oe(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:Xe("number")};var ki=[Q([{ChildComponent:rr,isActive:({selection:t})=>{if(!Ep(t))return!1;for(let e of t.getNodes()){if(nr(e)&&e.getListType()==="number")continue;let o=e.getParent();if(nr(o)&&o.getListType()==="number")continue;let r=o?.getParent();if(!(nr(r)&&r.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(_i,void 0)},order:10}])],Sp=v(({featureProviderMap:t})=>({markdownTransformers:[bi],nodes:t.has("orderedList")?[]:[wp,Tp],plugins:t.has("orderedList")?[]:[{Component:Ke,position:"normal"}],slashMenu:{groups:[Je([{Icon:rr,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:e})=>e.t("lexical:orderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(_i,void 0)}}])]},toolbarFixed:{groups:ki},toolbarInline:{groups:ki}}));import{$isListNode as ir,INSERT_UNORDERED_LIST_COMMAND as Ei,ListItemNode as Rp,ListNode as vp}from"@lexical/list";import{$isRangeSelection as Mp}from"lexical";import{jsx as ze,jsxs as Np}from"react/jsx-runtime";import"react";var lr=()=>Np("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[ze("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),ze("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),ze("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),ze("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),ze("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),ze("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Lp,ListItemNode as yp,ListNode as Ip}from"@lexical/list";var Ti={type:"element",dependencies:[Ip,yp],export:(t,e)=>Lp(t)?Oe(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:Xe("bullet")};var wi=[Q([{ChildComponent:lr,isActive:({selection:t})=>{if(!Mp(t))return!1;for(let e of t.getNodes()){if(ir(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(ir(o)&&o.getListType()==="bullet")continue;let r=o?.getParent();if(!(ir(r)&&r.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ei,void 0)},order:11}])],Dp=v({markdownTransformers:[Ti],nodes:[vp,Rp],plugins:[{Component:Ke,position:"normal"}],slashMenu:{groups:[Je([{Icon:lr,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ei,void 0)}}])]},toolbarFixed:{groups:wi},toolbarInline:{groups:wi}});import{jsx as Ap}from"react/jsx-runtime";import{addClassNamesToElement as Op}from"@lexical/utils";import{DecoratorNode as Fp}from"lexical";import*as Si from"react";var $p=Si.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),bt=class t extends Fp{__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 Pp({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return Op(o,"unknownConverted"),o}decorate(){return Ap($p,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function Pp({data:t}){return new bt({data:t})}var Bp=v(()=>({nodes:[bt]}));import{jsx as Hp}from"react/jsx-runtime";import{addClassNamesToElement as jp}from"@lexical/utils";import{DecoratorNode as Up}from"lexical";import*as Ni from"react";var Gp=Ni.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),kt=class t extends Up{__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 Wp({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return jp(o,"unknownConverted"),o}decorate(){return Hp(Gp,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function Wp({data:t}){return new kt({data:t})}var Vp=v(()=>({nodes:[kt]}));import{$setBlocksType as Ii}from"@lexical/selection";import{$createParagraphNode as Ri,$getSelection as vi,$isParagraphNode as Li,$isRangeSelection as Kp}from"lexical";var yi=[Q([{ChildComponent:it,isActive:({selection:t})=>{if(!Kp(t))return!1;for(let e of t.getNodes())if(!Li(e)&&!Li(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=vi();Ii(e,()=>Ri())})},order:1}])],Jp=v({slashMenu:{groups:[Z([{Icon:it,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=vi();Ii(e,()=>Ri())})}}])]},toolbarFixed:{groups:yi},toolbarInline:{groups:yi}});import{c as hf}from"react/compiler-runtime";import{jsx as Yi}from"react/jsx-runtime";import{useLexicalComposerContext as gf}from"@lexical/react/LexicalComposerContext";import{useEffect as xf,useState as Cf}from"react";import{jsx as Zi,Fragment as ff}from"react/jsx-runtime";import"react";import{jsx as Xp}from"react/jsx-runtime";var Mi={quote:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return Xp("blockquote",{children:o})}};import{jsx as zp}from"react/jsx-runtime";var Di={heading:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.tag;return zp(r,{children:o})}};import{jsx as Zp}from"react/jsx-runtime";var Ai={horizontalrule:Zp("hr",{})};import{jsx as Yp}from"react/jsx-runtime";var Oi={linebreak:Yp("br",{})};import{jsx as Fi}from"react/jsx-runtime";var $i=({internalDocToHref:t})=>({autolink:({node:e,nodesToJSX:o})=>{let r=o({nodes:e.children}),n=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0;return Fi("a",{href:e.fields.url,rel:n,target:l,children:r})},link:({node:e,nodesToJSX:o})=>{let r=o({nodes:e.children}),n=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0,i=e.fields.url??"";return e.fields.linkType==="internal"&&(t?i=t({linkNode:e}):(console.error("Lexical => JSX converter: Link converter: found internal link, but internalDocToHref is not provided"),i="#")),Fi("a",{href:i,rel:n,target:l,children:r})}});import{jsx as Ze,jsxs as qp,Fragment as Qp}from"react/jsx-runtime";import{v4 as ef}from"uuid";var Pi={list:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.tag;return Ze(r,{className:`list-${t?.listType}`,children:o})},listitem:({node:t,nodesToJSX:e,parent:o})=>{let r=t.children.some(l=>l.type==="list"),n=e({nodes:t.children});if("listType"in o&&o?.listType==="check"){let l=ef();return Ze("li",{"aria-checked":t.checked?"true":"false",className:`list-item-checkbox${t.checked?" list-item-checkbox-checked":" list-item-checkbox-unchecked"}${r?" nestedListItem":""}`,role:"checkbox",style:{listStyleType:"none"},tabIndex:-1,value:t?.value,children:r?n:qp(Qp,{children:[Ze("input",{checked:t.checked,id:l,readOnly:!0,type:"checkbox"}),Ze("label",{htmlFor:l,children:n}),Ze("br",{})]})})}else return Ze("li",{className:`${r?"nestedListItem":""}`,style:r?{listStyleType:"none"}:void 0,value:t?.value,children:n})}};import{jsx as sr}from"react/jsx-runtime";var Bi={paragraph:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return o?.length?sr("p",{children:o}):sr("p",{children:sr("br",{})})}};var Hi={tab:" "};import{jsx as _t}from"react/jsx-runtime";var ji={table:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return _t("div",{className:"lexical-table-container",children:_t("table",{className:"lexical-table",style:{borderCollapse:"collapse"},children:_t("tbody",{children:o})})})},tablecell:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.headerState>0?"th":"td",n=`lexical-table-cell-header-${t.headerState}`,l={backgroundColor:t.backgroundColor||void 0,border:"1px solid #ccc",padding:"8px"},i=t.colSpan&&t.colSpan>1?t.colSpan:void 0,s=t.rowSpan&&t.rowSpan>1?t.rowSpan:void 0;return _t(r,{className:`lexical-table-cell ${n}`,colSpan:i,rowSpan:s,style:l,children:o})},tablerow:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return _t("tr",{className:"lexical-table-row",children:o})}};import{jsx as Fe}from"react/jsx-runtime";import"react";var O={DOM_ELEMENT_TYPE:1,DOM_TEXT_TYPE:3,NO_DIRTY_NODES:0,HAS_DIRTY_NODES:1,FULL_RECONCILE:2,IS_NORMAL:0,IS_TOKEN:1,IS_SEGMENTED:2,IS_INERT:3,IS_BOLD:1,IS_ITALIC:2,IS_STRIKETHROUGH:4,IS_UNDERLINE:8,IS_CODE:16,IS_SUBSCRIPT:32,IS_SUPERSCRIPT:64,IS_HIGHLIGHT:128,IS_DIRECTIONLESS:1,IS_UNMERGEABLE:2,IS_ALIGN_LEFT:1,IS_ALIGN_CENTER:2,IS_ALIGN_RIGHT:3,IS_ALIGN_JUSTIFY:4,IS_ALIGN_START:5,IS_ALIGN_END:6},tf=O.IS_BOLD|O.IS_ITALIC|O.IS_STRIKETHROUGH|O.IS_UNDERLINE|O.IS_CODE|O.IS_SUBSCRIPT|O.IS_SUPERSCRIPT|O.IS_HIGHLIGHT,of="\xA0",rf=`
|
|
57
37
|
|
|
58
|
-
`,ss="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",as="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",Xf=new RegExp("^[^"+as+"]*["+ss+"]"),zf=new RegExp("^[^"+ss+"]*["+as+"]"),Zf={bold:O.IS_BOLD,code:O.IS_CODE,highlight:O.IS_HIGHLIGHT,italic:O.IS_ITALIC,strikethrough:O.IS_STRIKETHROUGH,subscript:O.IS_SUBSCRIPT,superscript:O.IS_SUPERSCRIPT,underline:O.IS_UNDERLINE},Yf={directionless:O.IS_DIRECTIONLESS,unmergeable:O.IS_UNMERGEABLE},qf={center:O.IS_ALIGN_CENTER,end:O.IS_ALIGN_END,justify:O.IS_ALIGN_JUSTIFY,left:O.IS_ALIGN_LEFT,right:O.IS_ALIGN_RIGHT,start:O.IS_ALIGN_START},Qf={[O.IS_ALIGN_CENTER]:"center",[O.IS_ALIGN_END]:"end",[O.IS_ALIGN_JUSTIFY]:"justify",[O.IS_ALIGN_LEFT]:"left",[O.IS_ALIGN_RIGHT]:"right",[O.IS_ALIGN_START]:"start"},e0={normal:O.IS_NORMAL,segmented:O.IS_SEGMENTED,token:O.IS_TOKEN},t0={[O.IS_NORMAL]:"normal",[O.IS_SEGMENTED]:"segmented",[O.IS_TOKEN]:"token"};var cs={text:({node:t})=>{let e=t.text;return t.format&O.IS_BOLD&&(e=je("strong",{children:e})),t.format&O.IS_ITALIC&&(e=je("em",{children:e})),t.format&O.IS_STRIKETHROUGH&&(e=je("span",{style:{textDecoration:"line-through"},children:e})),t.format&O.IS_UNDERLINE&&(e=je("span",{style:{textDecoration:"underline"},children:e})),t.format&O.IS_CODE&&(e=je("code",{children:e})),t.format&O.IS_SUBSCRIPT&&(e=je("sub",{children:e})),t.format&O.IS_SUPERSCRIPT&&(e=je("sup",{children:e})),e}};import{jsx as vt}from"react/jsx-runtime";var us={upload:({node:t})=>{let e=t;if(typeof e.value!="object")return null;let o=e.value,r=o.url;if(!o.mimeType.startsWith("image"))return vt("a",{href:r,rel:"noopener noreferrer",children:o.filename});if(!o.sizes||!Object.keys(o.sizes).length)return vt("img",{alt:o.filename,height:o.height,src:r,width:o.width});let n=[];for(let l in o.sizes){let i=o.sizes[l];if(!i||!i.width||!i.height||!i.mimeType||!i.filesize||!i.filename||!i.url)continue;let s=i?.url;n.push(vt("source",{media:`(max-width: ${i.width}px)`,srcSet:s,type:i.mimeType},l))}return n.push(vt("img",{alt:o?.filename,height:o?.height,src:r,width:o?.width},"image")),vt("picture",{children:n})}};var ot={...ns,...cs,...es,...Yi,...is,...qi,...Qi,...rs,...os({}),...us,...ls};import{jsx as ms,Fragment as o0}from"react/jsx-runtime";import kr from"react";function ds(t){let e=!!t?.root?.children?.length,o=!1;if(t?.root?.children?.length===1&&t?.root?.children[0]?.type==="paragraph"){let r=t?.root?.children[0];if(!r?.children||r?.children?.length===0)o=!0;else if(r?.children?.length===1){let n=r?.children[0];n?.type==="text"&&(n?.text?.length||(o=!0))}}return!(!e||o)}function ps({converters:t,data:e,disableIndent:o,disableTextAlign:r}){return ds(e)?fs({converters:t,disableIndent:o,disableTextAlign:r,nodes:e?.root?.children,parent:e?.root}):ms(o0,{})}function fs({converters:t,disableIndent:e,disableTextAlign:o,nodes:r,parent:n}){let l=t.unknown;return r.map((s,d)=>{let c;s.type==="block"?(c=t?.blocks?.[s?.fields?.blockType],!c&&!l&&console.error(`Lexical => JSX converter: Blocks converter: found ${s?.fields?.blockType} block, but no converter is provided`)):s.type==="inlineBlock"?(c=t?.inlineBlocks?.[s?.fields?.blockType],!c&&!l&&console.error(`Lexical => JSX converter: Inline Blocks converter: found ${s?.fields?.blockType} inline block, but no converter is provided`)):c=t[s.type];try{!c&&l&&(c=l);let u;c?u=typeof c=="function"?c({childIndex:d,converters:t,node:s,nodesToJSX:p=>fs({converters:p.converters??t,disableIndent:p.disableIndent??e,disableTextAlign:p.disableTextAlign??o,nodes:p.nodes,parent:p.parent??{...s,parent:n}}),parent:n}):c:u=ms("span",{children:"unknown node"},d);let a={};if(!o&&(!Array.isArray(o)||!o?.includes(s.type))&&"format"in s&&s.format)switch(s.format){case"center":a.textAlign="center";break;case"end":a.textAlign="right";break;case"justify":a.textAlign="justify";break;case"left":break;case"right":a.textAlign="right";break;case"start":a.textAlign="left";break}if(!e&&(!Array.isArray(e)||!e?.includes(s.type))&&"indent"in s&&s.indent&&s.type!=="listitem"&&(a.paddingInlineStart=`${Number(s.indent)*40}px`),kr.isValidElement(u)){if(a.textAlign||a.paddingInlineStart){let m={...a,...u?.props?.style??{}};return kr.cloneElement(u,{key:d,style:m})}return kr.cloneElement(u,{key:d})}return u}catch(u){return console.error("Error converting lexical node to JSX:",u,"node:",s),null}}).filter(Boolean)}var _r=({className:t,converters:e,data:o,disableContainer:r,disableIndent:n,disableTextAlign:l})=>{if(!o)return null;let i={};e?typeof e=="function"?i=e({defaultConverters:ot}):i=e:i=ot;let s=o&&!Array.isArray(o)&&typeof o=="object"&&"root"in o&&ps({converters:i,data:o,disableIndent:n,disableTextAlign:l});return r?hs(r0,{children:s}):hs("div",{className:t??"payload-richtext",children:s})};function xs(){let t=n0(7),[e]=l0(),o;t[0]!==e?(o=e.getEditorState().toJSON(),t[0]=e,t[1]=o):o=t[1];let[r,n]=s0(o),l,i;t[2]!==e?(l=()=>e.registerUpdateListener(d=>{let{editorState:c}=d;n(c.toJSON())}),i=[e],t[2]=e,t[3]=l,t[4]=i):(l=t[3],i=t[4]),i0(l,i);let s;return t[5]!==r?(s=gs("div",{className:"debug-jsx-converter",children:gs(_r,{converters:ot,data:r})}),t[5]=r,t[6]=s):s=t[6],s}var a0=v({plugins:[{Component:xs,position:"bottom"}]});var B={amber:{50:"oklch(0.987 0.022 95.277)",100:"oklch(0.962 0.059 95.617)",200:"oklch(0.924 0.12 95.746)",300:"oklch(0.879 0.169 91.605)",400:"oklch(0.828 0.189 84.429)",500:"oklch(0.769 0.188 70.08)",600:"oklch(0.666 0.179 58.318)",700:"oklch(0.555 0.163 48.998)",800:"oklch(0.473 0.137 46.201)",900:"oklch(0.414 0.112 45.904)",950:"oklch(0.279 0.077 45.635)"},black:"#000",blue:{50:"oklch(0.97 0.014 254.604)",100:"oklch(0.932 0.032 255.585)",200:"oklch(0.882 0.059 254.128)",300:"oklch(0.809 0.105 251.813)",400:"oklch(0.707 0.165 254.624)",500:"oklch(0.623 0.214 259.815)",600:"oklch(0.546 0.245 262.881)",700:"oklch(0.488 0.243 264.376)",800:"oklch(0.424 0.199 265.638)",900:"oklch(0.379 0.146 265.522)",950:"oklch(0.282 0.091 267.935)"},current:"currentColor",cyan:{50:"oklch(0.984 0.019 200.873)",100:"oklch(0.956 0.045 203.388)",200:"oklch(0.917 0.08 205.041)",300:"oklch(0.865 0.127 207.078)",400:"oklch(0.789 0.154 211.53)",500:"oklch(0.715 0.143 215.221)",600:"oklch(0.609 0.126 221.723)",700:"oklch(0.52 0.105 223.128)",800:"oklch(0.45 0.085 224.283)",900:"oklch(0.398 0.07 227.392)",950:"oklch(0.302 0.056 229.695)"},emerald:{50:"oklch(0.979 0.021 166.113)",100:"oklch(0.95 0.052 163.051)",200:"oklch(0.905 0.093 164.15)",300:"oklch(0.845 0.143 164.978)",400:"oklch(0.765 0.177 163.223)",500:"oklch(0.696 0.17 162.48)",600:"oklch(0.596 0.145 163.225)",700:"oklch(0.508 0.118 165.612)",800:"oklch(0.432 0.095 166.913)",900:"oklch(0.378 0.077 168.94)",950:"oklch(0.262 0.051 172.552)"},fuchsia:{50:"oklch(0.977 0.017 320.058)",100:"oklch(0.952 0.037 318.852)",200:"oklch(0.903 0.076 319.62)",300:"oklch(0.833 0.145 321.434)",400:"oklch(0.74 0.238 322.16)",500:"oklch(0.667 0.295 322.15)",600:"oklch(0.591 0.293 322.896)",700:"oklch(0.518 0.253 323.949)",800:"oklch(0.452 0.211 324.591)",900:"oklch(0.401 0.17 325.612)",950:"oklch(0.293 0.136 325.661)"},gray:{50:"oklch(0.985 0.002 247.839)",100:"oklch(0.967 0.003 264.542)",200:"oklch(0.928 0.006 264.531)",300:"oklch(0.872 0.01 258.338)",400:"oklch(0.707 0.022 261.325)",500:"oklch(0.551 0.027 264.364)",600:"oklch(0.446 0.03 256.802)",700:"oklch(0.373 0.034 259.733)",800:"oklch(0.278 0.033 256.848)",900:"oklch(0.21 0.034 264.665)",950:"oklch(0.13 0.028 261.692)"},green:{50:"oklch(0.982 0.018 155.826)",100:"oklch(0.962 0.044 156.743)",200:"oklch(0.925 0.084 155.995)",300:"oklch(0.871 0.15 154.449)",400:"oklch(0.792 0.209 151.711)",500:"oklch(0.723 0.219 149.579)",600:"oklch(0.627 0.194 149.214)",700:"oklch(0.527 0.154 150.069)",800:"oklch(0.448 0.119 151.328)",900:"oklch(0.393 0.095 152.535)",950:"oklch(0.266 0.065 152.934)"},indigo:{50:"oklch(0.962 0.018 272.314)",100:"oklch(0.93 0.034 272.788)",200:"oklch(0.87 0.065 274.039)",300:"oklch(0.785 0.115 274.713)",400:"oklch(0.673 0.182 276.935)",500:"oklch(0.585 0.233 277.117)",600:"oklch(0.511 0.262 276.966)",700:"oklch(0.457 0.24 277.023)",800:"oklch(0.398 0.195 277.366)",900:"oklch(0.359 0.144 278.697)",950:"oklch(0.257 0.09 281.288)"},inherit:"inherit",lime:{50:"oklch(0.986 0.031 120.757)",100:"oklch(0.967 0.067 122.328)",200:"oklch(0.938 0.127 124.321)",300:"oklch(0.897 0.196 126.665)",400:"oklch(0.841 0.238 128.85)",500:"oklch(0.768 0.233 130.85)",600:"oklch(0.648 0.2 131.684)",700:"oklch(0.532 0.157 131.589)",800:"oklch(0.453 0.124 130.933)",900:"oklch(0.405 0.101 131.063)",950:"oklch(0.274 0.072 132.109)"},neutral:{50:"oklch(0.985 0 0)",100:"oklch(0.97 0 0)",200:"oklch(0.922 0 0)",300:"oklch(0.87 0 0)",400:"oklch(0.708 0 0)",500:"oklch(0.556 0 0)",600:"oklch(0.439 0 0)",700:"oklch(0.371 0 0)",800:"oklch(0.269 0 0)",900:"oklch(0.205 0 0)",950:"oklch(0.145 0 0)"},orange:{50:"oklch(0.98 0.016 73.684)",100:"oklch(0.954 0.038 75.164)",200:"oklch(0.901 0.076 70.697)",300:"oklch(0.837 0.128 66.29)",400:"oklch(0.75 0.183 55.934)",500:"oklch(0.705 0.213 47.604)",600:"oklch(0.646 0.222 41.116)",700:"oklch(0.553 0.195 38.402)",800:"oklch(0.47 0.157 37.304)",900:"oklch(0.408 0.123 38.172)",950:"oklch(0.266 0.079 36.259)"},pink:{50:"oklch(0.971 0.014 343.198)",100:"oklch(0.948 0.028 342.258)",200:"oklch(0.899 0.061 343.231)",300:"oklch(0.823 0.12 346.018)",400:"oklch(0.718 0.202 349.761)",500:"oklch(0.656 0.241 354.308)",600:"oklch(0.592 0.249 0.584)",700:"oklch(0.525 0.223 3.958)",800:"oklch(0.459 0.187 3.815)",900:"oklch(0.408 0.153 2.432)",950:"oklch(0.284 0.109 3.907)"},purple:{50:"oklch(0.977 0.014 308.299)",100:"oklch(0.946 0.033 307.174)",200:"oklch(0.902 0.063 306.703)",300:"oklch(0.827 0.119 306.383)",400:"oklch(0.714 0.203 305.504)",500:"oklch(0.627 0.265 303.9)",600:"oklch(0.558 0.288 302.321)",700:"oklch(0.496 0.265 301.924)",800:"oklch(0.438 0.218 303.724)",900:"oklch(0.381 0.176 304.987)",950:"oklch(0.291 0.149 302.717)"},red:{50:"oklch(0.971 0.013 17.38)",100:"oklch(0.936 0.032 17.717)",200:"oklch(0.885 0.062 18.334)",300:"oklch(0.808 0.114 19.571)",400:"oklch(0.704 0.191 22.216)",500:"oklch(0.637 0.237 25.331)",600:"oklch(0.577 0.245 27.325)",700:"oklch(0.505 0.213 27.518)",800:"oklch(0.444 0.177 26.899)",900:"oklch(0.396 0.141 25.723)",950:"oklch(0.258 0.092 26.042)"},rose:{50:"oklch(0.969 0.015 12.422)",100:"oklch(0.941 0.03 12.58)",200:"oklch(0.892 0.058 10.001)",300:"oklch(0.81 0.117 11.638)",400:"oklch(0.712 0.194 13.428)",500:"oklch(0.645 0.246 16.439)",600:"oklch(0.586 0.253 17.585)",700:"oklch(0.514 0.222 16.935)",800:"oklch(0.455 0.188 13.697)",900:"oklch(0.41 0.159 10.272)",950:"oklch(0.271 0.105 12.094)"},sky:{50:"oklch(0.977 0.013 236.62)",100:"oklch(0.951 0.026 236.824)",200:"oklch(0.901 0.058 230.902)",300:"oklch(0.828 0.111 230.318)",400:"oklch(0.746 0.16 232.661)",500:"oklch(0.685 0.169 237.323)",600:"oklch(0.588 0.158 241.966)",700:"oklch(0.5 0.134 242.749)",800:"oklch(0.443 0.11 240.79)",900:"oklch(0.391 0.09 240.876)",950:"oklch(0.293 0.066 243.157)"},slate:{50:"oklch(0.984 0.003 247.858)",100:"oklch(0.968 0.007 247.896)",200:"oklch(0.929 0.013 255.508)",300:"oklch(0.869 0.022 252.894)",400:"oklch(0.704 0.04 256.788)",500:"oklch(0.554 0.046 257.417)",600:"oklch(0.446 0.043 257.281)",700:"oklch(0.372 0.044 257.287)",800:"oklch(0.279 0.041 260.031)",900:"oklch(0.208 0.042 265.755)",950:"oklch(0.129 0.042 264.695)"},stone:{50:"oklch(0.985 0.001 106.423)",100:"oklch(0.97 0.001 106.424)",200:"oklch(0.923 0.003 48.717)",300:"oklch(0.869 0.005 56.366)",400:"oklch(0.709 0.01 56.259)",500:"oklch(0.553 0.013 58.071)",600:"oklch(0.444 0.011 73.639)",700:"oklch(0.374 0.01 67.558)",800:"oklch(0.268 0.007 34.298)",900:"oklch(0.216 0.006 56.043)",950:"oklch(0.147 0.004 49.25)"},teal:{50:"oklch(0.984 0.014 180.72)",100:"oklch(0.953 0.051 180.801)",200:"oklch(0.91 0.096 180.426)",300:"oklch(0.855 0.138 181.071)",400:"oklch(0.777 0.152 181.912)",500:"oklch(0.704 0.14 182.503)",600:"oklch(0.6 0.118 184.704)",700:"oklch(0.511 0.096 186.391)",800:"oklch(0.437 0.078 188.216)",900:"oklch(0.386 0.063 188.416)",950:"oklch(0.277 0.046 192.524)"},transparent:"transparent",violet:{50:"oklch(0.969 0.016 293.756)",100:"oklch(0.943 0.029 294.588)",200:"oklch(0.894 0.057 293.283)",300:"oklch(0.811 0.111 293.571)",400:"oklch(0.702 0.183 293.541)",500:"oklch(0.606 0.25 292.717)",600:"oklch(0.541 0.281 293.009)",700:"oklch(0.491 0.27 292.581)",800:"oklch(0.432 0.232 292.759)",900:"oklch(0.38 0.189 293.745)",950:"oklch(0.283 0.141 291.089)"},white:"#fff",yellow:{50:"oklch(0.987 0.026 102.212)",100:"oklch(0.973 0.071 103.193)",200:"oklch(0.945 0.129 101.54)",300:"oklch(0.905 0.182 98.111)",400:"oklch(0.852 0.199 91.936)",500:"oklch(0.795 0.184 86.047)",600:"oklch(0.681 0.162 75.834)",700:"oklch(0.554 0.135 66.442)",800:"oklch(0.476 0.114 61.907)",900:"oklch(0.421 0.095 57.708)",950:"oklch(0.286 0.066 53.813)"},zinc:{50:"oklch(0.985 0 0)",100:"oklch(0.967 0.001 286.375)",200:"oklch(0.92 0.004 286.32)",300:"oklch(0.871 0.006 286.286)",400:"oklch(0.705 0.015 286.067)",500:"oklch(0.552 0.016 285.938)",600:"oklch(0.442 0.017 285.786)",700:"oklch(0.37 0.013 285.805)",800:"oklch(0.274 0.006 286.033)",900:"oklch(0.21 0.006 285.885)",950:"oklch(0.141 0.005 285.823)"}},c0={text:{"text-red":{css:{color:`light-dark(${B.red[600]}, ${B.red[400]})`},label:"Red"},"text-orange":{css:{color:`light-dark(${B.orange[600]}, ${B.orange[400]})`},label:"Orange"},"text-yellow":{css:{color:`light-dark(${B.yellow[700]}, ${B.yellow[300]})`},label:"Yellow"},"text-green":{css:{color:`light-dark(${B.green[700]}, ${B.green[400]})`},label:"Green"},"text-blue":{css:{color:`light-dark(${B.blue[600]}, ${B.blue[400]})`},label:"Blue"},"text-purple":{css:{color:`light-dark(${B.purple[600]}, ${B.purple[400]})`},label:"Purple"},"text-pink":{css:{color:`light-dark(${B.pink[600]}, ${B.pink[400]})`},label:"Pink"}},background:{"bg-red":{css:{"background-color":`light-dark(${B.red[400]}, ${B.red[600]})`},label:"Red"},"bg-orange":{css:{"background-color":`light-dark(${B.orange[400]}, ${B.orange[600]})`},label:"Orange"},"bg-yellow":{css:{"background-color":`light-dark(${B.yellow[300]}, ${B.yellow[700]})`},label:"Yellow"},"bg-green":{css:{"background-color":`light-dark(${B.green[400]}, ${B.green[700]})`},label:"Green"},"bg-blue":{css:{"background-color":`light-dark(${B.blue[400]}, ${B.blue[600]})`},label:"Blue"},"bg-purple":{css:{"background-color":`light-dark(${B.purple[400]}, ${B.purple[600]})`},label:"Purple"},"bg-pink":{css:{"background-color":`light-dark(${B.pink[400]}, ${B.pink[600]})`},label:"Pink"}}};import{$isNodeSelection as J0}from"lexical";import{jsx as Mt,jsxs as u0}from"react/jsx-runtime";import"react";var Tr=()=>u0("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("g",{clipPath:"url(#clip0_4397_10817)",children:Mt("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"})}),Mt("defs",{children:Mt("clipPath",{id:"clip0_4397_10817",children:Mt("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{jsx as p0}from"react/jsx-runtime";import*as bs from"react";import{DecoratorBlockNode as d0}from"@lexical/react/LexicalDecoratorBlockNode.js";function m0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Cs({relationTo:o,value:e})}:null}var Dt=class extends d0{__data;constructor({data:e,format:o,key:r}){super(o,r),this.__data=e}static clone(e){return new this({data:e.__data,format:e.__format,key:e.__key})}static getType(){return"relationship"}static importDOM(){return{div:e=>!e.hasAttribute("data-lexical-relationship-relationTo")||!e.hasAttribute("data-lexical-relationship-id")?null:{conversion:m0,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},r=Cs(o);return r.setFormat(e.format),r}static isInline(){return!1}decorate(e,o){return null}exportDOM(){let e=document.createElement("div");e.setAttribute("data-lexical-relationship-id",String(typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value)),e.setAttribute("data-lexical-relationship-relationTo",this.__data?.relationTo);let o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"relationship",version:2}}getData(){return this.getLatest().__data}getTextContent(){return`${this.__data?.relationTo} relation to ${typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value}`}setData(e){let o=this.getWritable();o.__data=e}};function Cs(t){return new Dt({data:t})}var f0=bs.lazy(()=>import("./RelationshipComponent-TSIENULZ.js").then(t=>({default:t.RelationshipComponent})));function h0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:He({relationTo:o,value:e})}:null}var we=class extends Dt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{div:e=>!e.hasAttribute("data-lexical-relationship-relationTo")||!e.hasAttribute("data-lexical-relationship-id")?null:{conversion:h0,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},r=He(o);return r.setFormat(e.format),r}decorate(e,o){return p0(f0,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function He(t){return new we({data:t})}function wr(t){return t instanceof we}import{c as D0}from"react/compiler-runtime";import{jsx as A0}from"react/jsx-runtime";import{useLexicalComposerContext as $0}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as O0}from"@lexical/utils";import{useConfig as F0}from"@payloadcms/ui";import{$getPreviousSelection as P0,$getSelection as B0,$isParagraphNode as j0,$isRangeSelection as H0,COMMAND_PRIORITY_EDITOR as U0,createCommand as W0}from"lexical";import{useEffect as G0}from"react";import{c as N0}from"react/compiler-runtime";import{jsx as ho}from"react/jsx-runtime";import{useLexicalComposerContext as y0}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as R0,COMMAND_PRIORITY_EDITOR as I0}from"lexical";import{useEffect as v0,useState as Ts}from"react";import{c as g0}from"react/compiler-runtime";import{jsx as x0}from"react/jsx-runtime";import{useLexicalComposerContext as C0}from"@lexical/react/LexicalComposerContext";import{useListDrawer as b0,useModal as k0}from"@payloadcms/ui";import{$getNodeByKey as ks,$getPreviousSelection as _0,$getRoot as T0,$getSelection as w0,$isRangeSelection as E0,$setSelection as S0}from"lexical";import{useEffect as L0,useState as _s}from"react";var At=t=>{let e=g0(23),[o]=C0(),[r,n]=_s(null),[l,i]=_s(!1),[s,d,c]=b0(t),{closeDrawer:u,drawerSlug:a,isDrawerOpen:m,openDrawer:p}=c,{modalState:f}=k0(),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let F=w0()??_0();n(F)},e[0]=h):h=e[0];let x=h,g;e[1]!==o||e[2]!==r?(g=()=>{r&&o.update(()=>{if(E0(r)){let{anchor:F,focus:M}=r;ks(F.key)&&ks(M.key)&&S0(r.clone())}else T0().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=r,e[3]=g):g=e[3];let w=g,E;e[4]!==u?(E=()=>{u()},e[4]=u,e[5]=E):E=e[5];let C=E,k,b;e[6]!==a||e[7]!==f||e[8]!==w||e[9]!==l?(k=()=>{if(!l)return;let F=f[a];F&&!F?.isOpen&&(i(!1),setTimeout(()=>{w()},1))},b=[f,a,w,l],e[6]=a,e[7]=f,e[8]=w,e[9]=l,e[10]=k,e[11]=b):(k=e[10],b=e[11]),L0(k,b);let T;e[12]!==d?(T=F=>x0(d,{...F,onClick:()=>{x()}}),e[12]=d,e[13]=T):T=e[13];let _;e[14]!==p?(_=()=>{x(),p(),i(!0)},e[14]=p,e[15]=_):_=e[15];let N;return e[16]!==s||e[17]!==C||e[18]!==m||e[19]!==a||e[20]!==T||e[21]!==_?(N={closeListDrawer:C,isListDrawerOpen:m,ListDrawer:s,listDrawerSlug:a,ListDrawerToggler:T,openListDrawer:_},e[16]=s,e[17]=C,e[18]=m,e[19]=a,e[20]=T,e[21]=_,e[22]=N):N=e[22],N};var M0=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=R0(o);n&&n.replace(He({relationTo:e,value:r}))}):t.dispatchCommand(Er,{relationTo:e,value:r})},ws=t=>{let e=N0(16),{enabledCollectionSlugs:o}=t,[r]=y0(),n;e[0]!==o?.[0]?(n=()=>o?.[0],e[0]=o?.[0],e[1]=n):n=e[1];let[l]=Ts(n),[i,s]=Ts(null),d=o||void 0,c;e[2]!==l||e[3]!==d?(c={collectionSlugs:d,selectedCollection:l},e[2]=l,e[3]=d,e[4]=c):c=e[4];let{closeListDrawer:u,ListDrawer:a,openListDrawer:m}=At(c),p,f;e[5]!==r||e[6]!==m?(p=()=>r.registerCommand(ft,w=>(s(w?.replace?w?.replace.nodeKey:null),m(),!0),I0),f=[r,m],e[5]=r,e[6]=m,e[7]=p,e[8]=f):(p=e[7],f=e[8]),v0(p,f);let h;e[9]!==u||e[10]!==r||e[11]!==i?(h=w=>{let{collectionSlug:E,doc:C}=w;M0({editor:r,relationTo:E,replaceNodeKey:i,value:C.id}),u()},e[9]=u,e[10]=r,e[11]=i,e[12]=h):h=e[12];let x=h,g;return e[13]!==a||e[14]!==x?(g=ho(a,{onSelect:x}),e[13]=a,e[14]=x,e[15]=g):g=e[15],g},Es=t=>(t?.enabledCollectionSlugs?.length??-1)>0?ho(ws,{...t}):ho(Wt,{...t,children:ho(ws,{...t})});var Er=W0("INSERT_RELATIONSHIP_COMMAND"),Ss=t=>{let e=D0(5),{clientProps:o}=t,[r]=$0(),{config:n}=F0(),{collections:l}=n,i=null;if(o?.enabledCollections)i=o?.enabledCollections;else if(o?.disabledCollections){let c;e[0]!==o?.disabledCollections?(c=u=>{let{slug:a}=u;return!o?.disabledCollections?.includes(a)},e[0]=o?.disabledCollections,e[1]=c):c=e[1],i=l.filter(c).map(V0)}let s,d;return e[2]!==r?(s=()=>{if(!r.hasNodes([we]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return r.registerCommand(Er,K0,U0)},d=[r],e[2]=r,e[3]=s,e[4]=d):(s=e[3],d=e[4]),G0(s,d),A0(Es,{enabledCollectionSlugs:i})};function V0(t){let{slug:e}=t;return e}function K0(t){let e=B0()||P0();if(H0(e)){let o=He(t),{focus:r}=e,n=r.getNode();O0(o),j0(n)&&!n.__first&&n.remove()}return!0}var X0=v({nodes:[we],plugins:[{Component:Ss,position:"normal"}],slashMenu:{groups:[z([{Icon:Tr,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(ft,{replace:!1})}}])]},toolbarFixed:{groups:[Ce([{ChildComponent:Tr,isActive:({selection:t})=>{if(!J0(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return wr(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(ft,{replace:!1})}}])]}});import{c as As}from"react/compiler-runtime";import{jsx as ae,jsxs as _1}from"react/jsx-runtime";import{useLexicalComposerContext as T1}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as $s}from"@lexical/react/useLexicalEditable";import{useScrollInfo as w1,useThrottledEffect as E1,useTranslation as S1}from"@payloadcms/ui";import*as Ee from"react";import{useMemo as L1}from"react";import{c as z0}from"react/compiler-runtime";import{jsx as Z0}from"react/jsx-runtime";import{mergeRegister as Y0}from"@lexical/utils";import{$addUpdateTag as q0,$getSelection as Q0}from"lexical";import{useDeferredValue as e1,useEffect as t1,useState as o1}from"react";var Ls="toolbar-popup__button",$t=t=>{let e=z0(23),{children:o,editor:r,item:n}=t,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={active:!1,enabled:!0},e[0]=l):l=e[0];let[i,s]=o1(l),d=e1(i),c=j(),u=d.enabled?"":"disabled",a=d.active?"active":"",m=n.key?`${Ls}-${n.key}`:"",p;e[1]!==u||e[2]!==a||e[3]!==m?(p=[Ls,u,a,m].filter(Boolean),e[1]=u,e[2]=a,e[3]=m,e[4]=p):p=e[4];let f=p.join(" "),h;e[5]!==r||e[6]!==c||e[7]!==n?(h=()=>{r.getEditorState().read(()=>{let _=Q0();if(!_)return;let N=n.isActive?n.isActive({editor:r,editorConfigContext:c,selection:_}):!1,F=n.isEnabled?n.isEnabled({editor:r,editorConfigContext:c,selection:_}):!0;s(M=>M.active===N&&M.enabled===F?M:{active:N,enabled:F})})},e[5]=r,e[6]=c,e[7]=n,e[8]=h):h=e[8];let x=h,g=Gt(),w,E;e[9]!==r||e[10]!==g||e[11]!==x?(w=()=>{g(x);let _=()=>g(x),N=Y0(r.registerUpdateListener(_));return document.addEventListener("mouseup",_),()=>{N(),document.removeEventListener("mouseup",_)}},E=[r,g,x],e[9]=r,e[10]=g,e[11]=x,e[12]=w,e[13]=E):(w=e[12],E=e[13]),t1(w,E);let C;e[14]!==i||e[15]!==r||e[16]!==n?(C=()=>{i.enabled&&r.focus(()=>{r.update(r1),n.onSelect?.({editor:r,isActive:i.active})})},e[14]=i,e[15]=r,e[16]=n,e[17]=C):C=e[17];let k=C,b=n1,T;return e[18]!==o||e[19]!==f||e[20]!==k||e[21]!==n.key?(T=Z0("button",{className:f,"data-button-key":n.key,onClick:k,onMouseDown:b,type:"button",children:o}),e[18]=o,e[19]=f,e[20]=k,e[21]=n.key,e[22]=T):T=e[22],T};function r1(){q0("toolbar")}function n1(t){t.preventDefault()}import{c as d1}from"react/compiler-runtime";import{jsx as rt}from"react/jsx-runtime";import Ds,{useCallback as m1,useDeferredValue as p1,useEffect as f1,useMemo as h1}from"react";import{mergeRegister as g1}from"@lexical/utils";import{useTranslation as x1}from"@payloadcms/ui";import{$getSelection as C1}from"lexical";import{jsx as Ie,jsxs as Ns}from"react/jsx-runtime";import{Button as l1}from"@payloadcms/ui";import{$addUpdateTag as i1,isDOMNode as s1}from"lexical";import go,{useCallback as a1,useEffect as xo,useMemo as Rs,useRef as Sr,useState as Lr}from"react";import{createPortal as c1}from"react-dom";var ys="toolbar-popup__dropdown-item",Is=go.createContext(null);function vs({active:t,children:e,editor:o,enabled:r,Icon:n,item:l,itemKey:i,tooltip:s}){let d=Rs(()=>[ys,r===!1?"disabled":"",t?"active":"",l?.key?`${ys}-${l.key}`:""].filter(Boolean).join(" "),[r,t,l.key]),c=Sr(null),u=go.use(Is);if(u===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=u;return xo(()=>{c?.current!=null&&a(c)},[c,a]),Ie(l1,{"aria-label":s,buttonStyle:"none",className:d,disabled:r===!1,extraButtonProps:{"data-item-key":i},icon:n,iconPosition:"left",iconStyle:"none",onClick:()=>{r!==!1&&o.focus(()=>{o.update(()=>{i1("toolbar")}),l.onSelect?.({editor:o,isActive:t})})},onMouseDown:m=>{m.preventDefault()},ref:c,tooltip:s,type:"button",children:e})}function u1({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:r}){let[n,l]=Lr(),[i,s]=Lr(),d=a1(a=>{l(m=>m!=null?[...m,a]:[a])},[l]),c=a=>{if(n==null)return;let{key:m}=a;["ArrowDown","ArrowUp","Escape","Tab"].includes(m)&&a.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])},u=Rs(()=>({registerItem:d}),[d]);return xo(()=>{n!=null&&i==null&&s(n[0]),i!=null&&i?.current!=null&&i.current.focus()},[n,i]),Ie(Is,{value:u,children:Ie("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:c,ref:e,children:t})})}function Ms({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:r=!1,dropdownKey:n,Icon:l,itemsContainerClassNames:i,label:s,stopCloseOnClickSelf:d}){let c=Sr(null),u=Sr(null),[a,m]=Lr(!1),p=()=>{m(!1),u?.current!=null&&u.current.focus()};xo(()=>{let h=u.current,x=c.current;if(a&&h!==null&&x!==null){let{left:g,top:w}=h.getBoundingClientRect(),E=window.scrollY||document.documentElement.scrollTop;x.style.top=`${w+E+h.offsetHeight+5}px`,x.style.left=`${Math.min(g-5,window.innerWidth-x.offsetWidth-20)}px`}},[c,u,a]),xo(()=>{let h=u.current;if(h!==null&&a){let x=g=>{let w=g.target;s1(w)&&(d&&c.current&&c.current.contains(w)||h.contains(w)||m(!1))};return document.addEventListener("click",x),()=>{document.removeEventListener("click",x)}}},[c,u,a,d]);let f=c1(Ie(u1,{dropDownRef:c,itemsContainerClassNames:i,onClose:p,children:o}),document.body);return Ns(go.Fragment,{children:[Ns("button",{"aria-label":t,className:e+(a?" active":""),"data-dropdown-key":n,disabled:r,onClick:h=>{h.preventDefault(),m(!a)},onMouseDown:h=>{h.preventDefault()},ref:u,type:"button",children:[l&&Ie(l,{}),s&&Ie("span",{className:"toolbar-popup__dropdown-label",children:s}),Ie("i",{className:"toolbar-popup__dropdown-caret"})]}),a&&Ie(go.Fragment,{children:f})]})}var Nr="toolbar-popup__dropdown",b1=t=>{let e=d1(14),{active:o,anchorElem:r,editor:n,enabled:l,item:i}=t,{i18n:s}=x1(),{fieldProps:d}=j(),{featureClientSchemaMap:c,schemaPath:u}=d;if(i.Component){let m;return e[0]!==o||e[1]!==r||e[2]!==n||e[3]!==l||e[4]!==i?(m=i?.Component&&rt(i.Component,{active:o,anchorElem:r,editor:n,enabled:l,item:i},i.key),e[0]=o,e[1]=r,e[2]=n,e[3]=l,e[4]=i,e[5]=m):m=e[5],m}let a;if(e[6]!==o||e[7]!==n||e[8]!==l||e[9]!==c||e[10]!==s||e[11]!==i||e[12]!==u){let m=i.key,p;i.label&&(m=typeof i.label=="function"?i.label({featureClientSchemaMap:c,i18n:s,schemaPath:u}):i.label),m.length>25?p=m.substring(0,25)+"...":p=m,a=rt(vs,{active:o,editor:n,enabled:l,Icon:i?.ChildComponent?rt(i.ChildComponent,{}):void 0,item:i,itemKey:i.key,tooltip:m,children:rt("span",{className:"text",children:p})},i.key),e[6]=o,e[7]=n,e[8]=l,e[9]=c,e[10]=s,e[11]=i,e[12]=u,e[13]=a}else a=e[13];return a},k1=Ds.memo(b1),Ue=({anchorElem:t,classNames:e,editor:o,group:r,Icon:n,itemsContainerClassNames:l,label:i,maxActiveItems:s,onActiveChange:d})=>{let[c,u]=Ds.useState({activeItemKeys:[],enabledGroup:!0,enabledItemKeys:[]}),a=p1(c),m=j(),{items:p,key:f}=r,h=Gt(),x=m1(()=>{o.getEditorState().read(()=>{let w=C1();if(!w)return;let E=[],C=[],k=[];for(let b of p)b.isActive&&(!s||E.length<s)&&b.isActive({editor:o,editorConfigContext:m,selection:w})&&(E.push(b.key),C.push(b)),b.isEnabled?b.isEnabled({editor:o,editorConfigContext:m,selection:w})&&k.push(b.key):k.push(b.key);u({activeItemKeys:E,enabledGroup:r.isEnabled?r.isEnabled({editor:o,editorConfigContext:m,selection:w}):!0,enabledItemKeys:k}),d&&d({activeItems:C})})},[o,m,r,p,s,d]);f1(()=>(h(x),g1(o.registerUpdateListener(async()=>{await h(x)}))),[o,h,x]);let g=h1(()=>p?.length?p.map(w=>rt(k1,{active:a.activeItemKeys.includes(w.key),anchorElem:t,editor:o,enabled:a.enabledItemKeys.includes(w.key),item:w},w.key)):null,[p,a,t,o]);return rt(Ms,{buttonAriaLabel:`${f} dropdown`,buttonClassName:[Nr,`${Nr}-${f}`,...e||[]].filter(Boolean).join(" "),disabled:!a.enabledGroup,dropdownKey:f,Icon:n,itemsContainerClassNames:[`${Nr}-items`,...l||[]],label:i,children:g},f)};function N1({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&ae(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?ae($t,{editor:e,item:o,children:ae(o.ChildComponent,{})},o.key):null}function y1(t){let e=As(23),{anchorElem:o,editor:r,editorConfig:n,group:l,index:i}=t,{i18n:s}=S1(),{fieldProps:d}=j(),{featureClientSchemaMap:c,schemaPath:u}=d,[a,m]=Ee.useState(void 0),[p,f]=Ee.useState(void 0),h;e[0]!==l.ChildComponent||e[1]!==l.items||e[2]!==l.type?(h=()=>{l?.type==="dropdown"&&l.items.length&&l.ChildComponent?f(()=>l.ChildComponent):f(void 0)},e[0]=l.ChildComponent,e[1]=l.items,e[2]=l.type,e[3]=h):h=e[3];let x;e[4]!==l?(x=[l],e[4]=l,e[5]=x):x=e[5],Ee.useEffect(h,x);let g;e[6]!==c||e[7]!==l.ChildComponent||e[8]!==l.items||e[9]!==l.type||e[10]!==s||e[11]!==u?(g=k=>{let{activeItems:b}=k;if(!b.length){l?.type==="dropdown"&&l.items.length&&l.ChildComponent?(f(()=>l.ChildComponent),m(void 0)):(f(void 0),m(void 0));return}let T=b[0],_=T.key;T.label&&(_=typeof T.label=="function"?T.label({featureClientSchemaMap:c,i18n:s,schemaPath:u}):T.label),_.length>25&&(_=_.substring(0,25)+"..."),b.length===1?(m(_),f(()=>T.ChildComponent)):(m(s.t("lexical:general:toolbarItemsActive",{count:b.length})),l?.type==="dropdown"&&l.items.length&&l.ChildComponent?f(()=>l.ChildComponent):f(void 0))},e[6]=c,e[7]=l.ChildComponent,e[8]=l.items,e[9]=l.type,e[10]=s,e[11]=u,e[12]=g):g=e[12];let w=g,E=`fixed-toolbar__group fixed-toolbar__group-${l.key}`,C;return e[13]!==p||e[14]!==o||e[15]!==a||e[16]!==r||e[17]!==n.features.toolbarFixed?.groups.length||e[18]!==l||e[19]!==i||e[20]!==w||e[21]!==E?(C=_1("div",{className:E,"data-toolbar-group-key":l.key,children:[l.type==="dropdown"&&l.items.length?p?ae(Ue,{anchorElem:o,editor:r,group:l,Icon:p,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:l.maxActiveItems??1,onActiveChange:w}):ae(Ue,{anchorElem:o,editor:r,group:l,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:l.maxActiveItems??1,onActiveChange:w}):null,l.type==="buttons"&&l.items.length?l.items.map(k=>ae(N1,{anchorElem:o,editor:r,item:k},k.key)):null,i<n.features.toolbarFixed?.groups.length-1&&ae("div",{className:"divider"})]},l.key),e[13]=p,e[14]=o,e[15]=a,e[16]=r,e[17]=n.features.toolbarFixed?.groups.length,e[18]=l,e[19]=i,e[20]=w,e[21]=E,e[22]=C):C=e[22],C}function R1({anchorElem:t,clientProps:e,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let l=Ee.useRef(null),i=$s(),{y:s}=w1(),d=L1(()=>{if(!n||e?.disableIfParentHasFixedToolbar)return null;let u=n.editorContainerRef.current.previousElementSibling;for(;u;){if(u.classList.contains("fixed-toolbar"))return u;u=u.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,n]);return E1(()=>{if(!d)return;let c=l.current;if(!c)return;let u=c.getBoundingClientRect(),a=d.getBoundingClientRect();if(!(u.bottom<a.top||u.top>a.bottom))c.classList.remove("fixed-toolbar"),c.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),d.classList.remove("fixed-toolbar"),d.classList.add("fixed-toolbar","fixed-toolbar--hide");else{if(!c.classList.contains("fixed-toolbar--overlapping"))return;c.classList.remove("fixed-toolbar--overlapping"),c.classList.add("fixed-toolbar"),d.classList.remove("fixed-toolbar--hide"),d.classList.add("fixed-toolbar")}},50,[l,d,s]),ae("div",{className:"fixed-toolbar",onFocus:c=>{c.stopPropagation()},ref:l,children:i&&ae(Ee.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((c,u)=>ae(y1,{anchorElem:t,editor:o,editorConfig:r,group:c,index:u},c.key))})})}var Os=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return Os(t.parentEditor)}return!1},Fs=t=>{let e=As(6),{clientProps:o}=t,[r]=T1(),n=j();if(!$s())return null;let{editorConfig:i}=n,s=o.applyToFocusedEditor&&n.focusedEditor?.editor||r,d=o.applyToFocusedEditor&&n.focusedEditor?.editorConfig||i,c,u;if(e[0]!==o.disableIfParentHasFixedToolbar||e[1]!==s||e[2]!==d||e[3]!==n){u=Symbol.for("react.early_return_sentinel");e:{let a=Os(n);if(o?.disableIfParentHasFixedToolbar&&a){u=null;break e}if(!d?.features?.toolbarFixed?.groups?.length){u=null;break e}c=ae(R1,{anchorElem:document.body,editor:s,editorConfig:d,parentWithFixedToolbar:a})}e[0]=o.disableIfParentHasFixedToolbar,e[1]=s,e[2]=d,e[3]=n,e[4]=c,e[5]=u}else c=e[4],u=e[5];return u!==Symbol.for("react.early_return_sentinel")?u:c};var I1=v({plugins:[{Component:Fs,position:"aboveContainer"}]});import{c as js}from"react/compiler-runtime";import{jsx as me,jsxs as Hs}from"react/jsx-runtime";import{useLexicalComposerContext as v1}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as M1}from"@lexical/react/useLexicalEditable";import{mergeRegister as Us}from"@lexical/utils";import{$getSelection as Ws,$isRangeSelection as Ps,$isTextNode as D1,COMMAND_PRIORITY_LOW as A1,getDOMSelection as Gs,SELECTION_CHANGE_COMMAND as $1}from"lexical";import{useCallback as bo,useEffect as Ot,useRef as Bs,useState as O1}from"react";import*as ko from"react";import{createPortal as F1}from"react-dom";function yr(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 Co(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:r=0,floatingElem:n,horizontalOffset:l=32,horizontalPosition:i="left",specialHandlingForCaret:s=!1,targetRect:d,verticalGap:c=10}=t,u=o.parentElement;if(d===null||u==null){n.style.opacity="0",n.style.transform="translate(-10000px, -10000px)";return}let a=n.getBoundingClientRect(),m=o.getBoundingClientRect(),p=u.getBoundingClientRect(),f=d.top-a.height-c,h=d.left-l;i==="center"&&(h=d.left+d.width/2-a.width/2);let x=0;return!e&&f<p.top&&!s&&(x=a.height+d.height+c*2,f+=x),i==="center"?h+a.width>p.right?h=p.right-a.width-l:h<p.left&&(h=p.left+l):h+a.width>p.right&&(h=p.right-a.width-l),h-=m.left,n.style.opacity="1",s&&r!==0?(f-=m.bottom-r+a.height-3,n.style.transform=`translate(${h}px, ${f}px) rotate(180deg)`):(f-=m.top,n.style.transform=`translate(${h}px, ${f}px)`),x}function P1({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($t,{editor:e,item:o,children:me(o.ChildComponent,{})},o.key):null}function B1(t){let e=js(19),{anchorElem:o,editor:r,group:n,index:l}=t,{editorConfig:i}=j(),[s,d]=ko.useState(),c;e[0]!==n.ChildComponent||e[1]!==n.items||e[2]!==n.type?(c=()=>{n?.type==="dropdown"&&n.items.length&&n.ChildComponent?d(()=>n.ChildComponent):d(void 0)},e[0]=n.ChildComponent,e[1]=n.items,e[2]=n.type,e[3]=c):c=e[3];let u;e[4]!==n?(u=[n],e[4]=n,e[5]=u):u=e[5],ko.useEffect(c,u);let a;e[6]!==n.ChildComponent||e[7]!==n.items||e[8]!==n.type?(a=h=>{let{activeItems:x}=h;if(!x.length){n?.type==="dropdown"&&n.items.length&&n.ChildComponent?d(()=>n.ChildComponent):d(void 0);return}let g=x[0];d(()=>g?.ChildComponent)},e[6]=n.ChildComponent,e[7]=n.items,e[8]=n.type,e[9]=a):a=e[9];let m=a,p=`inline-toolbar-popup__group inline-toolbar-popup__group-${n.key}`,f;return e[10]!==s||e[11]!==o||e[12]!==r||e[13]!==i.features.toolbarInline?.groups.length||e[14]!==n||e[15]!==l||e[16]!==m||e[17]!==p?(f=Hs("div",{className:p,"data-toolbar-group-key":n.key,children:[n.type==="dropdown"&&n.items.length?s?me(Ue,{anchorElem:o,editor:r,group:n,Icon:s,maxActiveItems:n.maxActiveItems??1,onActiveChange:m}):me(Ue,{anchorElem:o,editor:r,group:n,maxActiveItems:n.maxActiveItems??1,onActiveChange:m}):null,n.type==="buttons"&&n.items.length?n.items.map(h=>me(P1,{anchorElem:o,editor:r,item:h},h.key)):null,l<i.features.toolbarInline?.groups.length-1&&me("div",{className:"divider"})]},n.key),e[10]=s,e[11]=o,e[12]=r,e[13]=i.features.toolbarInline?.groups.length,e[14]=n,e[15]=l,e[16]=m,e[17]=p,e[18]=f):f=e[18],f}function j1({anchorElem:t,editor:e}){let o=Bs(null),r=Bs(null),{editorConfig:n}=j(),l=bo(()=>{if(o?.current){let c=o.current.style.opacity==="0",u=o.current.style.pointerEvents==="none";c||(o.current.style.opacity="0"),u||(o.current.style.pointerEvents="none")}},[o]),i=bo(c=>{if(o?.current&&(c.buttons===1||c.buttons===3)){let u=o.current.style.opacity==="0",a=o.current.style.pointerEvents==="none";if(!u||!a){let m=c.clientX,p=c.clientY,f=document.elementFromPoint(m,p);o.current.contains(f)||l()}}},[l]),s=bo(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);Ot(()=>(document.addEventListener("mousemove",i),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",s)}),[o,i,s]);let d=bo(()=>{let c=Ws(),u=Gs(e._window);if(o.current===null)return;let a=t.querySelector(":scope > .link-editor"),m=a!==null&&"style"in a&&a?.style?.opacity==="1",p=e.getRootElement();if(c!==null&&u!==null&&!u.isCollapsed&&p!==null&&p.contains(u.anchorNode)){let f=yr(u,p),h=Co({alwaysDisplayOnTop:m,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});r.current&&Co({anchorElem:o.current,anchorFlippedOffset:h,floatingElem:r.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else l()},[e,l,t]);return Ot(()=>{let c=t.parentElement,u=()=>{e.getEditorState().read(()=>{d()})};return window.addEventListener("resize",u),c&&c.addEventListener("scroll",u),()=>{window.removeEventListener("resize",u),c&&c.removeEventListener("scroll",u)}},[e,d,t]),Ot(()=>(e.getEditorState().read(()=>{d()}),Us(e.registerUpdateListener(({editorState:c})=>{c.read(()=>{d()})}),e.registerCommand($1,()=>(d(),!1),A1))),[e,d]),Hs("div",{className:"inline-toolbar-popup",ref:o,children:[me("div",{className:"caret",ref:r}),n?.features&&n.features?.toolbarInline?.groups.map((c,u)=>me(B1,{anchorElem:t,editor:e,group:c,index:u},c.key))]})}function H1(t,e){let o=js(12),[r,n]=O1(!1),l=M1(),i;o[0]!==t?(i=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let p=Ws(),f=Gs(t._window),h=t.getRootElement();if(f!==null&&(!Ps(p)||h===null||!h.contains(f.anchorNode))){n(!1);return}if(!Ps(p))return;if(p.getTextContent()!==""){let g=p.getNodes(),w=!1;for(let E of g)if(D1(E)){n(!0),w=!0;break}w||n(!1)}else n(!1);let x=p.getTextContent().replace(/\n/g,"");if(!p.isCollapsed()&&x===""){n(!1);return}})},o[0]=t,o[1]=i):i=o[1];let s=i,d,c;o[2]!==s?(d=()=>(document.addEventListener("selectionchange",s),document.addEventListener("mouseup",s),()=>{document.removeEventListener("selectionchange",s),document.removeEventListener("mouseup",s)}),c=[s],o[2]=s,o[3]=d,o[4]=c):(d=o[3],c=o[4]),Ot(d,c);let u,a;if(o[5]!==t||o[6]!==s?(u=()=>Us(t.registerUpdateListener(()=>{s()}),t.registerRootListener(()=>{t.getRootElement()===null&&n(!1)})),a=[t,s],o[5]=t,o[6]=s,o[7]=u,o[8]=a):(u=o[7],a=o[8]),Ot(u,a),!r||!l)return null;let m;return o[9]!==e||o[10]!==t?(m=F1(me(j1,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=m):m=o[11],m}var Vs=t=>{let{anchorElem:e}=t,[o]=v1();return H1(o,e)};var U1=v({plugins:[{Component:Vs,position:"floatingAnchorElem"}]});import{TableCellNode as vg,TableNode as Mg,TableRowNode as Dg}from"@lexical/table";import{jsx as Ks}from"react/jsx-runtime";import"react";var Rr=()=>Ks("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Ks("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 W1,$createTableNode as G1,$createTableRowNode as V1,$isTableCellNode as Js,$isTableNode as Ir,$isTableRowNode as vr,TableCellHeaderStates as _o,TableCellNode as K1,TableNode as J1,TableRowNode as X1}from"@lexical/table";import{$isParagraphNode as z1,$isTextNode as Z1}from"lexical";var zs=/^\|(.+)\|\s?$/,Y1=/^(\| ?:?-*:? ?)+\|\s?$/,Zs=({allTransformers:t})=>({type:"element",dependencies:[J1,X1,K1],export:e=>{if(!Ir(e))return null;let o=[];for(let r of e.getChildren()){let n=[];if(!vr(r))continue;let l=!1;for(let i of r.getChildren())Js(i)&&(n.push(Ut(t,i).replace(/\n/g,"\\n").trim()),i.__headerState===_o.ROW&&(l=!0));o.push(`| ${n.join(" | ")} |`),l&&o.push(`| ${n.map(i=>"---").join(" | ")} |`)}return o.join(`
|
|
59
|
-
`)},regExp:
|
|
60
|
-
`);let o=W1(_o.NO_STATUS);return Ht(t,e,o),o},Xs=(t,e)=>{let o=t.match(zs);return!o||!o[1]?null:o[1].split("|").map(r=>Ys(r,e))};import{c as eh}from"react/compiler-runtime";import{jsx as P,jsxs as Se}from"react/jsx-runtime";import{useLexicalComposerContext as oa}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as th}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as Qs,$deleteTableColumnAtSelection as oh,$deleteTableRowAtSelection as rh,$getNodeTriplet as nh,$getTableCellNodeFromLexicalNode as ea,$getTableColumnIndexFromTableCellNode as lh,$getTableNodeFromLexicalNodeOrThrow as Me,$getTableRowIndexFromTableCellNode as ih,$insertTableColumnAtSelection as sh,$insertTableRowAtSelection as ah,$isTableCellNode as ra,$isTableSelection as Ft,$mergeCells as ch,$unmergeCell as uh,getTableElement as Dr,getTableObserverFromTableElement as Ar,TableCellHeaderStates as ve,TableCellNode as dh}from"@lexical/table";import{mergeRegister as mh}from"@lexical/utils";import{useScrollInfo as ph}from"@payloadcms/ui";import{$getSelection as wo,$isElementNode as fh,$isRangeSelection as $r,$isTextNode as hh,$setSelection as gh,COMMAND_PRIORITY_CRITICAL as xh,getDOMSelection as Ch,isDOMNode as bh,SELECTION_CHANGE_COMMAND as kh}from"lexical";import*as Or from"react";import{useCallback as ce,useEffect as nt,useRef as To,useState as lt}from"react";import{createPortal as na}from"react-dom";import{jsx as Mr,jsxs as Q1}from"react/jsx-runtime";import"react";var qs=()=>Q1("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[Mr("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"}),Mr("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"}),Mr("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 ta(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function _h(){let t=wo();if($r(t)&&!t.isCollapsed()||Ft(t)&&!t.anchor.is(t.focus)||!$r(t)&&!Ft(t))return!1;let[e]=nh(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function Th(t){let e=t.getLastDescendant();hh(e)?e.select():fh(e)?e.selectEnd():e!==null&&e.selectNext()}function wh({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[l]=oa(),i=To(null),[s,d]=lt(n),[c,u]=lt({columns:1,rows:1}),[a,m]=lt(!1),[p,f]=lt(!1),{y:h}=ph();nt(()=>l.registerMutationListener(dh,S=>{S.get(s.getKey())==="updated"&&l.getEditorState().read(()=>{d(s.getLatest())})},{skipInitialization:!0}),[l,s]),nt(()=>{l.getEditorState().read(()=>{let S=wo();if(Ft(S)){let L=ta(S);u(ta(S)),m(L.columns>1||L.rows>1)}f(_h())})},[l]),nt(()=>{let S=e.current,L=i.current,R=l.getRootElement();if(S!=null&&L!=null&&R!=null){let A=R.getBoundingClientRect(),I=S.getBoundingClientRect();L.style.opacity="1";let $=L.getBoundingClientRect(),D=5,W=I.right+D;if(W+$.width>window.innerWidth||W+$.width>A.right){let J=I.left-$.width-D;W=(J<0?D:J)+window.pageXOffset}L.style.left=`${W+window.pageXOffset}px`;let Q=I.top;if(Q+$.height>window.innerHeight){let J=I.bottom-$.height;Q=J<0?D:J}L.style.top=`${Q}px`}},[e,i,l,h]),nt(()=>{function S(L){i.current!=null&&e.current!=null&&bh(L.target)&&!i.current.contains(L.target)&&!e.current.contains(L.target)&&r(!1)}return window.addEventListener("click",S),()=>window.removeEventListener("click",S)},[r,e]);let x=ce(()=>{l.update(()=>{if(s.isAttached()){let S=Me(s),L=Dr(S,l.getElementByKey(S.getKey()));if(L===null)throw new Error("Expected to find tableElement in DOM");let R=Ar(L);R!==null&&R.$clearHighlight(),S.markDirty(),d(s.getLatest())}gh(null)})},[l,s]),g=()=>{l.update(()=>{let S=wo();if(!Ft(S))return;let R=S.getNodes().filter(ra),A=ch(R);A&&(Th(A),o())})},w=()=>{l.update(()=>{uh()})},E=ce(S=>{l.update(()=>{for(let L=0;L<c.rows;L++)ah(S);o()})},[l,o,c.rows]),C=ce(S=>{l.update(()=>{for(let L=0;L<c.columns;L++)sh(S);o()})},[l,o,c.columns]),k=ce(()=>{l.update(()=>{rh(),o()})},[l,o]),b=ce(()=>{l.update(()=>{Me(s).remove(),x(),o()})},[l,s,x,o]),T=ce(()=>{l.update(()=>{oh(),o()})},[l,o]),_=ce(()=>{l.update(()=>{let S=Me(s),L=ih(s),[R]=Qs(S,null,null),A=new Set,I=s.getHeaderStyles()^ve.ROW;if(R[L])for(let $=0;$<R[L].length;$++){let D=R[L][$];D?.cell&&(A.has(D.cell)||(A.add(D.cell),D.cell.setHeaderStyles(I,ve.ROW)))}x(),o()})},[l,s,x,o]),N=ce(()=>{l.update(()=>{let S=Me(s),L=lh(s),[R]=Qs(S,null,null),A=new Set,I=s.getHeaderStyles()^ve.COLUMN;if(R)for(let $=0;$<R.length;$++){let D=R?.[$]?.[L];D?.cell&&(A.has(D.cell)||(A.add(D.cell),D.cell.setHeaderStyles(I,ve.COLUMN)))}x(),o()})},[l,s,x,o]),F=ce(()=>{l.update(()=>{if(s.isAttached()){let S=Me(s);S&&S.setRowStriping(!S.getRowStriping())}x(),o()})},[l,s,x,o]),M=ce(()=>{l.update(()=>{if(s.isAttached()){let S=Me(s);S&&S.setFrozenColumns(S.getFrozenColumns()===0?1:0)}x(),o()})},[l,s,x,o]),y=null;return t&&(a?y=P("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>g(),type:"button",children:P("span",{className:"text",children:"Merge cells"})}):p&&(y=P("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>w(),type:"button",children:P("span",{className:"text",children:"Unmerge cells"})}))),na(Se("div",{className:"table-action-menu-dropdown",onClick:S=>{S.stopPropagation()},ref:i,children:[y?Se(Or.Fragment,{children:[y,P("hr",{})]}):null,P("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>F(),type:"button",children:P("span",{className:"text",children:"Toggle Row Striping"})}),P("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>M(),type:"button",children:P("span",{className:"text",children:"Toggle First Column Freeze"})}),P("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>E(!1),type:"button",children:Se("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," above"]})}),P("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>E(!0),type:"button",children:Se("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," below"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>C(!1),type:"button",children:Se("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","left"]})}),P("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>C(!0),type:"button",children:Se("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","right"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>T(),type:"button",children:P("span",{className:"text",children:"Delete column"})}),P("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>k(),type:"button",children:P("span",{className:"text",children:"Delete row"})}),P("button",{className:"item","data-test-id":"table-delete",onClick:()=>b(),type:"button",children:P("span",{className:"text",children:"Delete table"})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-row-header",onClick:()=>_(),type:"button",children:Se("span",{className:"text",children:[(s.__headerState&ve.ROW)===ve.ROW?"Remove":"Add"," ","row header"]})}),P("button",{className:"item","data-test-id":"table-column-header",onClick:()=>N(),type:"button",children:Se("span",{className:"text",children:[(s.__headerState&ve.COLUMN)===ve.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function Eh({anchorElem:t,cellMerge:e}){let[o]=oa(),r=To(null),n=To(null),[l,i]=lt(!1),[s,d]=lt(null),c=ce(()=>{let a=r.current,m=wo(),p=Ch(o._window),f=document.activeElement;function h(){a&&(a.classList.remove("table-cell-action-button-container--active"),a.classList.add("table-cell-action-button-container--inactive")),d(null)}if(m==null||a==null)return h();let x=o.getRootElement(),g=null,w=null;if($r(m)&&x!==null&&p!==null&&x.contains(p.anchorNode)){let C=ea(m.anchor.getNode());if(C==null||(w=o.getElementByKey(C.getKey()),w==null||!C.isAttached()))return h();let k=Me(C),b=Dr(k,o.getElementByKey(k.getKey()));if(b===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");g=Ar(b),d(C)}else if(Ft(m)){let C=ea(m.anchor.getNode());if(!ra(C))throw new Error("TableSelection anchorNode must be a TableCellNode");let k=Me(C),b=Dr(k,o.getElementByKey(k.getKey()));if(b===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");g=Ar(b),w=o.getElementByKey(C.getKey())}else if(!f)return h();if(g===null||w===null)return h();let E=!g||!g.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",E),a.classList.toggle("table-cell-action-button-container--inactive",!E),E){let C=w.getBoundingClientRect(),k=t.getBoundingClientRect(),b=C.top-k.top,T=C.right-k.left;a.style.transform=`translate(${T}px, ${b}px)`}},[o,t]);nt(()=>{let a,m=()=>{a=void 0,o.getEditorState().read(c)},p=()=>(a===void 0&&(a=setTimeout(m,0)),!1);return mh(o.registerUpdateListener(p),o.registerCommand(kh,p,xh),o.registerRootListener((f,h)=>{h&&h.removeEventListener("pointerup",p),f&&(f.addEventListener("pointerup",p),p())}),()=>clearTimeout(a))});let u=To(s);return nt(()=>{u.current!==s&&i(!1),u.current=s},[u,s]),P("div",{className:"table-cell-action-button-container",ref:r,children:s!=null&&Se(Or.Fragment,{children:[P("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),i(!l)},ref:n,type:"button",children:P(qs,{})}),l&&P(wh,{cellMerge:e,contextRef:n,onClose:()=>i(!1),setIsMenuOpen:i,tableCellNode:s})]})})}var la=t=>{let e=eh(3),{anchorElem:o}=t,r=th(),n;return e[0]!==o||e[1]!==r?(n=na(r?P(Eh,{anchorElem:o??document.body,cellMerge:!0}):null,o??document.body),e[0]=o,e[1]=r,e[2]=n):n=e[2],n};import{c as Sh}from"react/compiler-runtime";import{jsx as So,jsxs as Lh}from"react/jsx-runtime";import{useLexicalComposerContext as Nh}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as yh}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as Rh,$getTableNodeFromLexicalNodeOrThrow as Fr,$getTableRowIndexFromTableCellNode as Ih,$isTableCellNode as ia,$isTableRowNode as vh,getDOMCellFromTarget as Mh,getTableElement as Dh,TableNode as sa}from"@lexical/table";import{calculateZoomLevel as aa,mergeRegister as Ah}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Pr,isHTMLElement as $h,SKIP_SCROLL_INTO_VIEW_TAG as ca}from"lexical";import*as da from"react";import{useCallback as Pt,useEffect as Br,useRef as Eo,useState as it}from"react";import{createPortal as Oh}from"react-dom";var Fh=33,ua=92;function Ph({editor:t}){let e=Eo(null),o=Eo(null),r=Eo(null),[n,l]=it(!1),i=j(),s=Eo(null),[d,c]=it(null),[u,a]=it(null),[m,p]=it(!1),[f,h]=it(null),x=Pt(()=>{a(null),e.current=null,h(null),s.current=null,r.current=null},[]),g=M=>(M.buttons&1)===1;Br(()=>{let M=new Set;return Ah(t.registerMutationListener(sa,y=>{for(let[S,L]of y)L==="destroyed"?M.delete(S):M.add(S);l(M.size>0)}),t.registerNodeTransform(sa,y=>{if(y.getColWidths())return y;let S=y.getColumnCount(),L=ua;return y.setColWidths(Array(S).fill(L)),y}))},[t]),Br(()=>{if(!n)return;let M=R=>{let A=R.target;if($h(A)){if(f){c({x:R.clientX,y:R.clientY});return}if(p(g(R)),!(o.current&&o.current.contains(A))&&e.current!==A){e.current=A;let I=Mh(A);I&&u!==I?t.getEditorState().read(()=>{let $=Pr(I.elem);if(!$)throw new Error("TableCellResizer: Table cell node not found.");let D=Fr($),W=Dh(D,t.getElementByKey(D.getKey()));if(!W)throw new Error("TableCellResizer: Table element not found.");e.current=A,r.current=W.getBoundingClientRect(),a(I)},{editor:t}):I==null&&x()}}},y=R=>{p(!0)},S=R=>{p(!1)},L=t.registerRootListener((R,A)=>{A?.removeEventListener("mousemove",M),A?.removeEventListener("mousedown",y),A?.removeEventListener("mouseup",S),R?.addEventListener("mousemove",M),R?.addEventListener("mousedown",y),R?.addEventListener("mouseup",S)});return()=>{L()}},[u,f,t,n,x]);let w=M=>M==="bottom",E=Pt(M=>{if(!u)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let y=Pr(u.elem);if(!ia(y))throw new Error("TableCellResizer: Table cell node not found.");let S=Fr(y),L=Ih(y),R=S.getChildren(),I=y.getColSpan()===S.getColumnCount()?L:L+y.getRowSpan()-1;if(I>=R.length||I<0)throw new Error("Expected table cell to be inside of table row.");let $=R[I];if(!vh($))throw new Error("Expected table row");let D=$.getHeight();if(D===void 0){let Q=$.getChildren();D=Math.min(...Q.map(J=>C(J,t)??1/0))}let W=Math.max(D+M,Fh);$.setHeight(W)},{tag:ca})},[u,t]),C=(M,y)=>y.getElementByKey(M.getKey())?.clientHeight,k=(M,y)=>{let S;return y.forEach(L=>{L.forEach((R,A)=>{R.cell===M&&(S=A)})}),S},b=Pt(M=>{if(!u)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let y=Pr(u.elem);if(!ia(y))throw new Error("TableCellResizer: Table cell node not found.");let S=Fr(y),[L]=Rh(S,null,null),R=k(y,L);if(R===void 0)throw new Error("TableCellResizer: Table column not found.");let A=S.getColWidths();if(!A)return;let I=A[R];if(I===void 0)return;let $=[...A],D=Math.max(I+M,ua);$[R]=D,S.setColWidths($)},{tag:ca})},[u,t]),T=Pt(M=>{let y=S=>{if(S.preventDefault(),S.stopPropagation(),!u)throw new Error("TableCellResizer: Expected active cell.");if(s.current){let{x:L,y:R}=s.current;if(u===null)return;let A=aa(S.target);if(w(M)){let I=(S.clientY-R)/A;E(I)}else{let I=(S.clientX-L)/A;b(I)}x(),document.removeEventListener("mouseup",y)}};return y},[u,x,b,E]),_=Pt(M=>y=>{if(y.preventDefault(),y.stopPropagation(),!u)throw new Error("TableCellResizer: Expected active cell.");s.current={x:y.clientX,y:y.clientY},c(s.current),h(M),document.addEventListener("mouseup",T(M))},[u,T]),[N,F]=it({bottom:null,left:null,right:null,top:null});return Br(()=>{if(u){let{height:M,left:y,top:S,width:L}=u.elem.getBoundingClientRect(),R=aa(u.elem),A=10,I={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${A}px`,left:`${window.scrollX+y}px`,top:`${window.scrollY+S+M-A/2}px`,width:`${L}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${M}px`,left:`${window.scrollX+y+L-A/2}px`,top:`${window.scrollY+S}px`,width:`${A}px`}},$=r.current;f&&d&&$&&(w(f)?(I[f].left=`${window.scrollX+$.left}px`,I[f].top=`${window.scrollY+d.y/R}px`,I[f].height="3px",I[f].width=`${$.width}px`):(I[f].top=`${window.scrollY+$.top}px`,I[f].left=`${window.scrollX+d.x/R}px`,I[f].width="3px",I[f].height=`${$.height}px`),I[f].backgroundColor="#adf"),F(I)}else F({bottom:null,left:null,right:null,top:null})},[u,f,d]),So("div",{ref:o,children:u!=null&&!m&&Lh(da.Fragment,{children:[So("div",{className:`${i.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:_("right"),style:N.right||void 0}),So("div",{className:`${i.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:_("bottom"),style:N.bottom||void 0})]})})}var ma=()=>{let t=Sh(3),[e]=Nh(),o=yh(),r;return t[0]!==e||t[1]!==o?(r=o?Oh(So(Ph,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=r):r=t[2],r};import{c as Kh}from"react/compiler-runtime";import{jsx as jr,jsxs as Jh,Fragment as Xh}from"react/jsx-runtime";import{useLexicalComposerContext as zh}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as ka}from"@lexical/react/useLexicalEditable";import{$getTableAndElementByKey as Zh,$getTableColumnIndexFromTableCellNode as Yh,$getTableRowIndexFromTableCellNode as qh,$insertTableColumnAtSelection as Qh,$insertTableRowAtSelection as eg,$isTableCellNode as tg,$isTableNode as ha,getTableElement as og,TableNode as rg}from"@lexical/table";import{$findMatchingParent as ng,mergeRegister as lg}from"@lexical/utils";import{$getNearestNodeFromDOMNode as ga,isHTMLElement as ig}from"lexical";import{useEffect as xa,useMemo as sg,useRef as Ca,useState as Lo}from"react";import"react";import{createPortal as ag}from"react-dom";import{c as Wh}from"react/compiler-runtime";import{useEffect as Gh,useRef as Vh}from"react";var Bh="Expected a function",jh=Math.max,Hh=Math.min;function Uh(t,e,o){let r,n,l=0,i,s=!1,d=!1,c,u,a,m=!0;if(typeof t!="function")throw new TypeError(Bh);e=e||0,typeof o=="object"&&(s=!!o.leading,d="maxWait"in o,c=d?jh(o.maxWait||0,e):c,m="trailing"in o?!!o.trailing:m);function p(b){let T=r,_=i;return r=i=void 0,l=b,u=t.apply(_,T),u}function f(b){return l=b,a=setTimeout(g,e),s?p(b):u}function h(b){let T=b-n,_=b-l,N=e-T;return d?Hh(N,c-_):N}function x(b){let T=b-n,_=b-l;return n===void 0||T>=e||T<0||d&&_>=c}function g(){let b=Date.now();if(x(b))return w(b);a=setTimeout(g,h(b))}function w(b){return a=void 0,m&&r?p(b):(r=i=void 0,u)}function E(){a!==void 0&&clearTimeout(a),l=0,r=n=i=a=void 0}function C(){return a===void 0?u:w(Date.now())}function k(){let b=Date.now(),T=x(b);if(r=arguments,i=this,n=b,T){if(a===void 0)return f(n);if(d)return clearTimeout(a),a=setTimeout(g,e),p(n)}return a===void 0&&(a=setTimeout(g,e)),u}return k.cancel=E,k.flush=C,k}var pa=Uh;function fa(t,e,o){let r=Wh(6),n=Vh(null),l,i;r[0]!==t||r[1]!==o||r[2]!==e?(l=()=>(n.current=pa(t,e,{maxWait:o}),()=>{n.current?.cancel()}),i=[t,e,o],r[0]=t,r[1]=o,r[2]=e,r[3]=l,r[4]=i):(l=r[3],i=r[4]),Gh(l,i);let s;return r[5]===Symbol.for("react.memo_cache_sentinel")?(s=(...c)=>{let u=c;n.current&&n.current(...u)},r[5]=s):s=r[5],s}var ba=20;function cg({anchorElem:t}){let[e]=zh(),o=ka(),r=j(),[n,l]=Lo(!1),[i,s]=Lo(!1),[d,c]=Lo(!1),[u,a]=Lo({}),m=Ca(new Set),p=Ca(null),f=fa(g=>{let{isOutside:w,tableDOMNode:E}=ug(g,r.editorConfig?.lexical);if(w){l(!1),s(!1);return}if(!E)return;p.current=E;let C=null,k=null,b=null;if(e.getEditorState().read(()=>{let I=ga(E);if(tg(I)){let $=ng(I,D=>ha(D));if(!ha($))return;if(b=og($,e.getElementByKey($.getKey())),b){let D=$.getChildrenSize(),W=$.getChildAtIndex(0)?.getChildrenSize(),Q=qh(I),J=Yh(I);Q===D-1?C=I:J===W-1&&(k=I)}}},{editor:e}),!b)return;let T=b.parentElement;if(!T)return;let{bottom:_,height:N,left:F,right:M,width:y,y:S}=b.getBoundingClientRect(),L=!1;T&&T.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(L=T.scrollWidth>T.clientWidth);let{left:R,y:A}=t.getBoundingClientRect();C?(s(!1),l(!0),a({height:ba,left:L&&T?T.offsetLeft:F-R,top:_-A+5,width:L&&T?T.offsetWidth:y})):k&&(s(!0),l(!1),a({height:N,left:M-R+5,top:S-A,width:ba}))},50,250),h=sg(()=>new ResizeObserver(()=>{l(!1),s(!1)}),[]);xa(()=>{if(d)return document.addEventListener("mousemove",f),()=>{l(!1),s(!1),document.removeEventListener("mousemove",f)}},[d,f]),xa(()=>lg(e.registerMutationListener(rg,g=>{e.getEditorState().read(()=>{let w=!1;for(let[E,C]of g)switch(C){case"created":{m.current.add(E),w=!0;break}case"destroyed":{m.current.delete(E),w=!0;break}default:break}if(w){h.disconnect();for(let E of m.current){let{tableElement:C}=Zh(E);h.observe(C)}c(m.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,h]);let x=g=>{e.update(()=>{p.current&&(ga(p.current)?.selectEnd(),g?(eg(),l(!1)):(Qh(),s(!1)))})};return o?Jh(Xh,{children:[n&&jr("button",{"aria-label":"Add Row",className:r.editorConfig.lexical.theme.tableAddRows,onClick:()=>x(!0),style:{...u},type:"button"}),i&&jr("button",{"aria-label":"Add Column",className:r.editorConfig.lexical.theme.tableAddColumns,onClick:()=>x(!1),style:{...u},type:"button"})]}):null}function ug(t,e){let o=t.target;if(ig(o)){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 _a(t){let e=Kh(2),{anchorElem:o}=t,r=o===void 0?document.body:o;if(!ka())return null;let l;return e[0]!==r?(l=ag(jr(cg,{anchorElem:r}),r),e[0]=r,e[1]=l):l=e[1],l}import{c as dg}from"react/compiler-runtime";import{jsx as Hr,jsxs as mg}from"react/jsx-runtime";import{useLexicalComposerContext as pg}from"@lexical/react/LexicalComposerContext";import{TablePlugin as fg}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as hg,TableCellNode as gg,TableNode as xg,TableRowNode as Cg}from"@lexical/table";import{mergeRegister as bg}from"@lexical/utils";import{formatDrawerSlug as kg,useEditDepth as _g}from"@payloadcms/ui";import{$getSelection as Tg,$isRangeSelection as wg,COMMAND_PRIORITY_EDITOR as Eg,createCommand as Sg}from"lexical";import{createContext as Lg,use as Ng,useEffect as yg,useMemo as Rg,useState as Ig}from"react";import*as Ta from"react";var No=Sg("OPEN_EMBED_DRAWER_COMMAND"),wa=Lg({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function Ea({children:t}){let[e,o]=Ig({cellEditorConfig:null,cellEditorPlugins:null});return Hr(wa,{value:Rg(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var Sa=()=>{let t=dg(16),[e]=pg(),o=Ng(wa),r=_g(),{fieldProps:n,uuid:l}=j(),{schemaPath:i}=n,s="lexical-table-create-"+l,d;t[0]!==r||t[1]!==s?(d=kg({slug:s,depth:r}),t[0]=r,t[1]=s,t[2]=d):d=t[2];let c=d,{toggleDrawer:u}=he(c,!0),a;t[3]!==e||t[4]!==u?(a=()=>{if(!e.hasNodes([xg,Cg,gg]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return bg(e.registerCommand(No,()=>{let h=null;return e.getEditorState().read(()=>{let x=Tg();wg(x)&&(h=x)}),h&&u(),!0},Eg))},t[3]=e,t[4]=u,t[5]=a):a=t[5];let m;t[6]!==o||t[7]!==e||t[8]!==u?(m=[o,e,u],t[6]=o,t[7]=e,t[8]=u,t[9]=m):m=t[9],yg(a,m);let p;t[10]!==e?(p=(h,x)=>{!x.columns||!x.rows||e.dispatchCommand(hg,{columns:String(x.columns),rows:String(x.rows)})},t[10]=e,t[11]=p):p=t[11];let f;return t[12]!==c||t[13]!==i||t[14]!==p?(f=mg(Ta.Fragment,{children:[Hr(pt,{drawerSlug:c,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:p,schemaPath:i,schemaPathSuffix:"fields"}),Hr(fg,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]}),t[12]=c,t[13]=i,t[14]=p,t[15]=f):f=t[15],f};var Ag=v({markdownTransformers:[Zs],nodes:[Mg,vg,Dg],plugins:[{Component:Sa,position:"normal"},{Component:ma,position:"normal"},{Component:la,position:"floatingAnchorElem"},{Component:_a,position:"floatingAnchorElem"}],providers:[Ea],slashMenu:{groups:[z([{Icon:Rr,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(No,{})}}])]},toolbarFixed:{groups:[Ce([{ChildComponent:Rr,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(No,{})}}])]}});import{$isNodeSelection as bx}from"lexical";import{jsx as Ur,jsxs as $g}from"react/jsx-runtime";import"react";var Wr=()=>$g("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:[Ur("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"}),Ur("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"}),Ur("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{jsx as Ia}from"react/jsx-runtime";import va from"bson-objectid";import{$applyNodeReplacement as jg}from"lexical";import*as Ma from"react";import Og from"bson-objectid";function yo(t,e){if(t.hasAttribute("data-lexical-pending-upload-form-id")){let r=t.getAttribute("data-lexical-pending-upload-form-id");if(r!=null)return{node:e({data:{pending:{formID:r,src:t.getAttribute("src")||""}}})}}if(t.hasAttribute("data-lexical-upload-relation-to")&&t.hasAttribute("data-lexical-upload-id")){let r=t.getAttribute("data-lexical-upload-id"),n=t.getAttribute("data-lexical-upload-relation-to");if(r!=null&&n!=null)return{node:e({data:{fields:{},relationTo:n,value:r}})}}return{node:e({data:{pending:{formID:new Og.default().toHexString(),src:t.getAttribute("src")||""}}})}}import{DecoratorBlockNode as Fg}from"@lexical/react/LexicalDecoratorBlockNode.js";import Na from"bson-objectid";import{$applyNodeReplacement as Pg}from"lexical";var Bt=class extends Fg{__data;constructor({data:e,format:o,key:r}){super(o,r),this.__data=e}static clone(e){return new this({data:e.__data,format:e.__format,key:e.__key})}static getType(){return"upload"}static importDOM(){return{img:e=>({conversion:o=>yo(o,La),priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new Na.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,pending:e.pending,relationTo:e.relationTo,value:e.value},r=La({data:o});return r.setFormat(e.format),r}static isInline(){return!1}decorate(){return null}exportDOM(){let e=document.createElement("img"),o=this.__data;return o.pending?(e.setAttribute("data-lexical-pending-upload-form-id",String(o?.pending?.formID)),e.setAttribute("src",o?.pending?.src||"")):(e.setAttribute("data-lexical-upload-id",String(o?.value)),e.setAttribute("data-lexical-upload-relation-to",o?.relationTo)),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"upload",version:3}}getData(){return this.getLatest().__data}setData(e){let o=this.getWritable();o.__data=e}updateDOM(){return!1}};function La({data:t}){return t?.id||(t.id=new Na.default().toHexString()),Pg(new Bt({data:t}))}import{jsx as ya}from"react/jsx-runtime";import{ShimmerEffect as Bg}from"@payloadcms/ui";var Ra=()=>ya("div",{className:"lexical-upload",children:ya(Bg,{height:"95px",width:"203px"})});var Hg=Ma.lazy(()=>import("./component-CYFKY3IL.js").then(t=>({default:t.UploadComponent}))),le=class extends Bt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{img:e=>({conversion:o=>yo(o,De),priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new va.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,pending:e.pending,relationTo:e.relationTo,value:e.value},r=De({data:o});return r.setFormat(e.format),r}decorate(){return this.__data.pending?Ia(Ra,{}):Ia(Hg,{data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function De({data:t}){return t?.id||(t.id=new va.default().toHexString()),jg(new le({data:t}))}function st(t){return t instanceof le}import{c as zg}from"react/compiler-runtime";import{jsx as Zg}from"react/jsx-runtime";import{useLexicalComposerContext as Yg}from"@lexical/react/LexicalComposerContext.js";import{$dfsIterator as Wa,$insertNodeToNearestRoot as Kr,mergeRegister as qg}from"@lexical/utils";import{useBulkUpload as Qg,useConfig as ex,useEffectEvent as tx,useModal as ox}from"@payloadcms/ui";import Jr from"bson-objectid";import{$createRangeSelection as rx,$getPreviousSelection as Pa,$getSelection as Ba,$isParagraphNode as Xr,$isRangeSelection as ja,$setSelection as nx,COMMAND_PRIORITY_EDITOR as lx,COMMAND_PRIORITY_LOW as Ha,createCommand as ix,DROP_COMMAND as sx,getDOMSelectionFromTarget as ax,isHTMLElement as Ua,PASTE_COMMAND as cx}from"lexical";import{useEffect as ux}from"react";import{c as Da}from"react/compiler-runtime";import{jsx as Gr}from"react/jsx-runtime";import{useLexicalComposerContext as Aa}from"@lexical/react/LexicalComposerContext.js";import{toast as Ug}from"@payloadcms/ui";import{$getNodeByKey as Wg,COMMAND_PRIORITY_EDITOR as $a}from"lexical";import{useEffect as Oa,useState as Gg}from"react";var Vg=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=Wg(o);n&&n.replace(De({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(Vr,{fields:null,relationTo:e,value:r})},Kg=t=>{let e=Da(13),{enabledCollectionSlugs:o}=t,[r]=Aa(),[n,l]=Gg(null),i;e[0]!==o?(i={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=i):i=e[1];let{closeListDrawer:s,ListDrawer:d,openListDrawer:c}=At(i),u,a;e[2]!==r||e[3]!==c?(u=()=>r.registerCommand(Je,h=>(l(h?.replace?h?.replace.nodeKey:null),c(),!0),$a),a=[r,c],e[2]=r,e[3]=c,e[4]=u,e[5]=a):(u=e[4],a=e[5]),Oa(u,a);let m;e[6]!==s||e[7]!==r||e[8]!==n?(m=h=>{let{collectionSlug:x,doc:g}=h;s(),Vg({editor:r,relationTo:x,replaceNodeKey:n,value:g.id})},e[6]=s,e[7]=r,e[8]=n,e[9]=m):m=e[9];let p=m,f;return e[10]!==d||e[11]!==p?(f=Gr(d,{onSelect:p}),e[10]=d,e[11]=p,e[12]=f):f=e[12],f},Jg=()=>{let t=Da(3),[e]=Aa(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Je,Xg,$a),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Oa(o,r),null},Fa=t=>Gr(Wt,{...t,FallbackComponent:Jg,uploads:!0,children:Gr(Kg,{...t})});function Xg(){return Ug.error("No upload collections enabled"),!0}function dx(t){let e=t.target;return!!(Ua(e)&&!e.closest("code, span.editor-image")&&Ua(e.parentElement)&&e.parentElement.closest("div.ContentEditable__root"))}function mx(t){let e,o=ax(t.target);if(document.caretRangeFromPoint)e=document.caretRangeFromPoint(t.clientX,t.clientY);else if(t.rangeParent&&o!==null)o.collapse(t.rangeParent,t.rangeOffset||0),e=o.getRangeAt(0);else throw Error("Cannot get the selection when dragging");return e}var Vr=ix("INSERT_UPLOAD_COMMAND"),Ga=()=>{let t=zg(18),[e]=Yg(),{config:o}=ex(),{collections:r}=o,{drawerSlug:n,setCollectionSlug:l,setInitialForms:i,setOnCancel:s,setOnSuccess:d,setSelectableCollections:c}=Qg(),{isModalOpen:u,openModal:a}=ox(),m;t[0]!==n||t[1]!==r||t[2]!==e||t[3]!==u||t[4]!==a||t[5]!==l||t[6]!==i||t[7]!==s||t[8]!==d||t[9]!==c?(m=g=>{let{files:w}=g;if(w?.length!==0&&(i(E=>[...E??[],...w.map(px)]),!u(n))){let E=r.filter(fx).map(hx);if(!E.length||!E[0])return;l(E[0]),c(E),s(()=>{e.update(gx)}),d(C=>{let k=new Map(C.map(xx));e.update(()=>{for(let b of Wa()){let T=b.node;if(st(T)){let _=T.getData();if(_?.pending){let N=k.get(_.pending?.formID);N&&T.replace(De({data:{id:new Jr.default().toHexString(),fields:{},relationTo:N.collectionSlug,value:N.doc.id}}))}}}})}),a(n)}},t[0]=n,t[1]=r,t[2]=e,t[3]=u,t[4]=a,t[5]=l,t[6]=i,t[7]=s,t[8]=d,t[9]=c,t[10]=m):m=t[10];let p=tx(m),f;t[11]!==e||t[12]!==p?(f=()=>{if(!e.hasNodes([le]))throw new Error("UploadPlugin: UploadNode not registered on editor");return qg(e.registerNodeTransform(le,g=>{let w=g.getData();if(!w?.pending)return;(async function(){let k=null,b=w?.pending?.src,T=w?.pending?.formID;if(b?.startsWith("data:")){let _=b.match(/data:(image\/[a-zA-Z]+);base64,/),N=_?_[1]:"image/png",F=b.replace(/^data:image\/[a-zA-Z]+;base64,/,""),M=atob(F),y=new Array(M.length);for(let R=0;R<M.length;R++)y[R]=M.charCodeAt(R);let S=new Uint8Array(y);k={alt:void 0,file:new File([S],"pasted-image."+N?.split("/")[1],{type:N}),formID:T}}else if(b?.startsWith("http")||b?.startsWith("https")){let N=await(await fetch(b)).blob(),F=b.split("/").pop()||"pasted-image"+N.type.split("/")[1];k={alt:void 0,file:new File([N],F,{type:N.type}),formID:T}}k&&p({files:[k]})})()}),e.registerCommand(Vr,g=>(e.update(()=>{let w=Ba()||Pa();if(ja(w)){let E=De({data:{id:g.id,fields:g.fields,relationTo:g.relationTo,value:g.value}}),{focus:C}=w,k=C.getNode();Kr(E),Xr(k)&&!k.__first&&k.remove()}}),!0),lx),e.registerCommand(cx,g=>{if(!(g instanceof ClipboardEvent))return!1;let w=g.clipboardData;if(!w?.types?.length||w?.types?.includes("text/html"))return!1;let E=[];return w?.files?.length&&Array.from(w.files).forEach(C=>{E.push({alt:"",file:C,formID:new Jr.default().toHexString()})}),E.length?(e.update(()=>{let C=Ba()||Pa();if(ja(C))for(let k of E){let b=new le({data:{pending:{formID:k.formID,src:URL.createObjectURL(k.file)}}}),{focus:T}=C,_=T.getNode();Kr(b),Xr(_)&&!_.__first&&_.remove()}}),p({files:E}),!0):!1},Ha),e.registerCommand(sx,g=>{if(!(g instanceof DragEvent))return!1;let w=g.dataTransfer;if(!w?.types?.length)return!1;let E=[];return w?.files?.length&&Array.from(w.files).forEach(C=>{E.push({alt:"",file:C,formID:new Jr.default().toHexString()})}),E.length?(g.preventDefault(),g.stopPropagation(),e.update(()=>{if(dx(g)){let C=mx(g),k=rx();C!=null&&k.applyDOMRange(C),nx(k);for(let b of E){let T=new le({data:{pending:{formID:b.formID,src:URL.createObjectURL(b.file)}}}),{focus:_}=k,N=_.getNode();Kr(T),Xr(N)&&!N.__first&&N.remove()}}}),p({files:E}),!0):!1},Ha))},t[11]=e,t[12]=p,t[13]=f):f=t[13];let h;t[14]!==e?(h=[e],t[14]=e,t[15]=h):h=t[15],ux(f,h);let x;return t[16]!==r?(x=Zg(Fa,{enabledCollectionSlugs:r.map(Cx)}),t[16]=r,t[17]=x):x=t[17],x};function px(t){return{file:t.file,formID:t.formID}}function fx(t){let{upload:e}=t;return!!e}function hx(t){let{slug:e}=t;return e}function gx(){for(let t of Wa()){let e=t.node;st(e)&&e.getData()?.pending&&e.remove()}}function xx(t){return[t.formID,t]}function Cx(t){let{slug:e}=t;return e}var kx=v({nodes:[le],plugins:[{Component:Ga,position:"normal"}],slashMenu:{groups:[z([{Icon:Wr,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Je,{replace:!1})}}])]},toolbarFixed:{groups:[Ce([{ChildComponent:Wr,isActive:({selection:t})=>{if(!bx(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return st(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Je,{replace:!1})}}])]}});import{c as Tx}from"react/compiler-runtime";import{jsx as Zr}from"react/jsx-runtime";import{ShimmerEffect as wx,useConfig as Ex}from"@payloadcms/ui";import{lazy as Sx,Suspense as Lx,useEffect as Nx,useState as yx}from"react";var Va={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",hrSelected:"LexicalEditorTheme__hrSelected",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",tab:"LexicalEditorTheme__tabNode",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableAlignment:{center:"LexicalEditorTheme__tableAlignmentCenter",right:"LexicalEditorTheme__tableAlignmentRight"},tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableFrozenColumn:"LexicalEditorTheme__tableFrozenColumn",tableRowStriping:"LexicalEditorTheme__tableRowStriping",tableScrollableWrapper:"LexicalEditorTheme__tableScrollableWrapper",tableSelected:"LexicalEditorTheme__tableSelected",tableSelection:"LexicalEditorTheme__tableSelection",text:{bold:"LexicalEditorTheme__textBold",code:"LexicalEditorTheme__textCode",italic:"LexicalEditorTheme__textItalic",strikethrough:"LexicalEditorTheme__textStrikethrough",subscript:"LexicalEditorTheme__textSubscript",superscript:"LexicalEditorTheme__textSuperscript",underline:"LexicalEditorTheme__textUnderline",underlineStrikethrough:"LexicalEditorTheme__textUnderlineStrikethrough"},upload:"editor-upload"};var Ro={namespace:"lexical",theme:Va};function Ka({config:t,featureClientImportMap:e,featureClientSchemaMap:o,field:r,schemaPath:n,unSanitizedEditorConfig:l}){for(let c of l.features)if(!c?.clientFeatureProps?.featureKey||c?.clientFeatureProps?.order===void 0||c?.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.");l.features=l.features.sort((c,u)=>c.clientFeatureProps.order-u.clientFeatureProps.order);let i=new Map;for(let c of l.features)i.set(c.clientFeatureProps.featureKey,c);let s=new Map,d=0;for(let c of l.features){let u=typeof c.feature=="function"?c.feature({config:t,featureClientImportMap:e,featureClientSchemaMap:o,featureProviderMap:i,field:r,resolvedFeatures:s,schemaPath:n,unSanitizedEditorConfig:l}):c.feature;u.key=c.clientFeatureProps.featureKey,u.order=d,s.set(c.clientFeatureProps.featureKey,u),d++}return s}import{deepMerge as _x}from"payload/shared";var Ja=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}},o={};if(t.forEach(r=>{r.key==="toolbarFixed"&&r.sanitizedClientFeatureProps?.customGroups&&(o={...o,...r.sanitizedClientFeatureProps.customGroups})}),!t?.size)return e;t.forEach(r=>{if(r.providers?.length&&(e.providers=e.providers.concat(r.providers)),r.enableFormats?.length&&e.enabledFormats.push(...r.enableFormats),r.nodes?.length)for(let n of r.nodes)e.nodes.push(n);if(r.plugins?.length&&r.plugins.forEach((n,l)=>{e.plugins?.push({clientProps:r.sanitizedClientFeatureProps,Component:n.Component,key:r.key+l,position:n.position})}),r.toolbarInline?.groups?.length)for(let n of r.toolbarInline.groups){let l=e.toolbarInline.groups.find(i=>i.key===n.key);l?e.toolbarInline.groups=e.toolbarInline.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.toolbarInline?.groups.push(l)}if(r.toolbarFixed?.groups?.length)for(let n of r.toolbarFixed.groups){let l=e.toolbarFixed.groups.find(i=>i.key===n.key);l?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.toolbarFixed?.groups.push(l)}if(r.slashMenu?.groups){r.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(r.slashMenu.dynamicGroups));for(let n of r.slashMenu.groups){let l=e.slashMenu.groups.find(i=>i.key===n.key);l?e.slashMenu.groups=e.slashMenu.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.slashMenu.groups.push(l)}}if(r.markdownTransformers?.length)for(let n of r.markdownTransformers)typeof n=="function"?e.markdownTransformers.push(n({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(n);e.enabledFeatures.push(r.key)}),Object.keys(o).length>0&&(e.toolbarFixed.groups=e.toolbarFixed.groups.map(r=>{let n=o[r.key];return n?_x(r,n):r})),e.toolbarInline.groups.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0),e.toolbarFixed.groups.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);for(let r of e.toolbarInline.groups)r.items.sort((n,l)=>n.order&&l.order?n.order-l.order:n.order?-1:l.order?1:0);for(let r of e.toolbarFixed.groups)r.items.sort((n,l)=>n.order&&l.order?n.order-l.order:n.order?-1:l.order?1:0);return e};function zr(t,e,o){return{admin:o,features:Ja(t),lexical:e,resolvedFeatureMap:t}}var Rx=Sx(()=>import("./Field-CJFETHA3.js").then(t=>({default:t.RichText}))),Ix=t=>{let e=Tx(16),{admin:o,clientFeatures:r,featureClientImportMap:n,featureClientSchemaMap:l,field:i,lexicalEditorConfig:s,schemaPath:d}=t,c;e[0]!==o?(c=o===void 0?{}:o,e[0]=o,e[1]=c):c=e[1];let u=c,a=s===void 0?Ro:s,{config:m}=Ex(),[p,f]=yx(null),h,x;e[2]!==u||e[3]!==r||e[4]!==m||e[5]!==n||e[6]!==l||e[7]!==i||e[8]!==p||e[9]!==a||e[10]!==d?(h=()=>{if(p)return;let w=[];for(let[k,b]of Object.entries(r))b.clientFeatureProvider&&w.push(b.clientFeatureProvider(b.clientFeatureProps));let E=a||Ro,C=Ka({config:m,featureClientImportMap:n,featureClientSchemaMap:l,field:i,schemaPath:d??i.name,unSanitizedEditorConfig:{features:w,lexical:E}});f(zr(C,E,u))},x=[a,u,p,r,n,l,i,m,d],e[2]=u,e[3]=r,e[4]=m,e[5]=n,e[6]=l,e[7]=i,e[8]=p,e[9]=a,e[10]=d,e[11]=h,e[12]=x):(h=e[11],x=e[12]),Nx(h,x);let g;return e[13]!==p||e[14]!==t?(g=Zr(Lx,{fallback:Zr(wx,{height:"35vh"}),children:p&&Zr(Rx,{...t,editorConfig:p})}),e[13]=p,e[14]=t,e[15]=g):g=e[15],g};function vx(t){return t instanceof HTMLElement}function Mx(...t){return t.filter(Boolean).join(" ")}var Io=new WeakMap;function Xa(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function vo(t,e){let o=Io.get(t);if(o===void 0){let r=new Set,n=i=>{o!==void 0&&(o.start=Xa(i))},l=i=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let d=Xa(i);for(let c of r)d!==null&&c([d[0]-s[0],d[1]-s[1]],i)};t.addEventListener("touchstart",n),t.addEventListener("touchend",l),o={handleTouchend:l,handleTouchstart:n,listeners:r,start:null},Io.set(t,o)}return o.listeners.add(e),()=>{Dx(t,e)}}function Dx(t,e){let o=Io.get(t);if(o===void 0)return;let{listeners:r}=o;r.delete(e),r.size===0&&(Io.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function Ax(t,e){return vo(t,(o,r)=>{let[n,l]=o;n<0&&-n>Math.abs(l)&&e(n,r)})}function $x(t,e){return vo(t,(o,r)=>{let[n,l]=o;n>0&&n>Math.abs(l)&&e(n,r)})}function Ox(t,e){return vo(t,(o,r)=>{let[n,l]=o;l<0&&-l>Math.abs(n)&&e(n,r)})}function Fx(t,e){return vo(t,(o,r)=>{let[n,l]=o;l>0&&l>Math.abs(n)&&e(n,r)})}import{c as Px}from"react/compiler-runtime";import{jsx as Bx}from"react/jsx-runtime";import"react";var jx=()=>{let t=Px(2),{EditButton:e}=ge(),o;return t[0]!==e?(o=e?Bx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Hx}from"react/compiler-runtime";import{jsx as Ux}from"react/jsx-runtime";import"react";var Wx=()=>{let t=Hx(2),{RemoveButton:e}=ge(),o;return t[0]!==e?(o=e?Ux(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Gx}from"react/compiler-runtime";import{jsx as Vx}from"react/jsx-runtime";import"react";var Kx=()=>{let t=Gx(2),{Label:e}=ge(),o;return t[0]!==e?(o=e?Vx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Jx}from"react/compiler-runtime";import{jsx as Xx}from"react/jsx-runtime";import"react";var zx=t=>{let e=Jx(3),{children:o}=t,{InlineBlockContainer:r}=ge(),n;return e[0]!==r||e[1]!==o?(n=r?Xx(r,{children:o}):null,e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{jsx as Zx}from"react/jsx-runtime";import"react";var Yx=t=>{let{children:e,...o}=t,{BlockCollapsible:r}=xe();return r?Zx(r,{...o,children:e}):null};import{c as qx}from"react/compiler-runtime";import{jsx as Qx}from"react/jsx-runtime";import"react";var eC=()=>{let t=qx(2),{EditButton:e}=xe(),o;return t[0]!==e?(o=e?Qx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as tC}from"react/compiler-runtime";import{jsx as oC}from"react/jsx-runtime";import"react";var rC=()=>{let t=tC(2),{RemoveButton:e}=xe(),o;return t[0]!==e?(o=e?oC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as nC}from"qs-esm";var lC=({apiURL:t,depth:e,draft:o,locale:r})=>async({id:l,collectionSlug:i,select:s})=>{let d=nC({depth:e??0,draft:o??!1,locale:r,select:s},{addQueryPrefix:!0});return await fetch(`${t}/${i}/${l}${d}`,{credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json"},method:"GET"}).then(u=>u.json())};var za={customEndRegex:{optional:!0,regExp:/[ \t]*```$/},customStartRegex:/^[ \t]*```(\w+)?/,doNotTrimChildren:!0,export:({fields:t})=>!t.code.includes(`
|
|
61
|
-
`)&&!t.language?.length?"```"+t.code+"```":"```"+(t.language||"")+(t.code?`
|
|
62
|
-
`+t.code:"")+"\n```",import:({children:t,closeMatch:e,openMatch:o})=>{let r=o?.[1];return t.startsWith(`
|
|
63
|
-
`)&&(t=t.slice(1)),t.endsWith(`
|
|
64
|
-
`)&&(t=t.slice(0,-1)),!!e&&!t.includes(`
|
|
65
|
-
`)&&o?.input?.trim()!=="```"+r?{code:r+(t?.length?t:""),language:""}:{code:t,language:r}}};import{jsx as iC}from"react/jsx-runtime";import{CodeField as sC,useFormFields as aC}from"@payloadcms/ui";import{useMemo as cC}from"react";var uC=({autoComplete:t,field:e,forceRender:o,languages:r={js:"JavaScript",plaintext:"Plain Text",ts:"TypeScript"},path:n,permissions:l,readOnly:i,renderedBlocks:s,schemaPath:d,typescript:c,validate:u})=>{let a=aC(([x])=>x.language),m=a?.value||a?.initialValue||"typescript",p=r[m],f=cC(()=>({...e,type:"code",admin:{...e.admin,editorOptions:{},editorProps:{defaultPath:m==="ts"?"file.tsx":void 0},language:m}}),[e,m]),h=`${e.name}-${m}-${p}`;return f&&iC(sC,{autoComplete:t,field:f,forceRender:o,onMount:(x,g)=>{g.editor.defineTheme("vs-dark",{base:"vs-dark",colors:{"editor.background":"#222222"},inherit:!0,rules:[]}),g.editor.defineTheme("vs",{base:"vs",colors:{"editor.background":"#f5f5f5"},inherit:!0,rules:[]}),g.languages.typescript.typescriptDefaults.setCompilerOptions({allowNonTsExtensions:!0,allowJs:!0,allowSyntheticDefaultImports:!0,esModuleInterop:!0,jsx:g.languages.typescript.JsxEmit.React,moduleResolution:g.languages.typescript.ModuleResolutionKind.NodeJs,noEmit:!0,paths:c?.paths,reactNamespace:"React",target:g.languages.typescript.ScriptTarget[c?.target??"ESNext"],typeRoots:c?.typeRoots??["node_modules/@types"]}),g.languages.typescript.typescriptDefaults.setDiagnosticsOptions({noSemanticValidation:!c?.enableSemanticValidation,noSyntaxValidation:!1}),(async()=>{c?.fetchTypes&&Array.isArray(c.fetchTypes)&&c.fetchTypes.length>0&&await Promise.all(c.fetchTypes.map(async E=>{let k=await(await fetch(E.url)).text();g.languages.typescript.typescriptDefaults.addExtraLib(k,E.filePath)}))})()},path:n,permissions:l,readOnly:i,renderedBlocks:s,schemaPath:d,validate:u},h)};import{c as xC}from"react/compiler-runtime";import{jsx as Y,jsxs as rc,Fragment as CC}from"react/jsx-runtime";import{useLexicalEditable as bC}from"@lexical/react/useLexicalEditable";import{ChevronIcon as kC,CopyToClipboard as _C,Popup as TC,PopupList as nc,RenderFields as wC,useForm as EC,useFormFields as lc}from"@payloadcms/ui";import"react";import{jsx as Za}from"react/jsx-runtime";import"react";var Ya=()=>Za("svg",{fill:"none",height:"12",viewBox:"0 0 15 12",width:"15",xmlns:"http://www.w3.org/2000/svg",children:Za("path",{d:"M11.3738 8.62598L14.0404 5.95931L11.3738 3.29264M3.37376 3.29264L0.707092 5.95931L3.37376 8.62598M9.04043 0.625977L5.70709 11.2926",stroke:"currentColor",strokeLinecap:"square"})});import{jsx as Qa}from"react/jsx-runtime";import"react";import{useCollapsible as mC}from"@payloadcms/ui";import{jsx as qa}from"react/jsx-runtime";import"react";var Mo=()=>qa("svg",{fill:"none",height:"15",viewBox:"0 0 15 15",width:"15",xmlns:"http://www.w3.org/2000/svg",children:qa("path",{d:"M7.16667 13.8333V9.83333M7.16667 9.83333L9.16667 11.8333M7.16667 9.83333L5.16667 11.8333M7.16667 4.5V0.5M7.16667 4.5L9.16667 2.5M7.16667 4.5L5.16667 2.5M1.83333 7.16667H0.5M5.83333 7.16667H4.5M9.83333 7.16667H8.5M13.8333 7.16667H12.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})});var dC="code-block-collapse-button",ec=()=>{let{toggle:t}=mC();return Qa("button",{className:dC,onClick:t,type:"button",children:Qa(Mo,{})})};import{jsx as tc,jsxs as pC}from"react/jsx-runtime";import"react";import{useCollapsible as hC,useTranslation as gC}from"@payloadcms/ui";var fC="code-block-floating-collapse-button",oc=()=>{let{isCollapsed:t,toggle:e}=hC(),{t:o}=gC();return t?pC("button",{className:fC,onClick:e,type:"button",children:[tc("span",{children:o("general:collapse")}),tc(Mo,{})]}):null};var We="payload-richtext-code-block",SC=t=>{let e=xC(15),{languages:o}=t,{BlockCollapsible:r,formSchema:n,RemoveButton:l}=xe(),{setModified:i}=EC(),{codeField:s}=lc(LC),d;e[0]!==i?(d=h=>{let[x,g]=h;return{selectedLanguageField:x?.language,setSelectedLanguage:w=>{g({type:"UPDATE",path:"language",value:w}),i(!0)}}},e[0]=i,e[1]=d):d=e[1];let{selectedLanguageField:c,setSelectedLanguage:u}=lc(d),a=o[c?.value],m=bC(),p=c?.value,f;if(e[2]!==r||e[3]!==l||e[4]!==s?.value||e[5]!==n||e[6]!==m||e[7]!==o||e[8]!==a||e[9]!==u||e[10]!==p){let h;e[12]!==o||e[13]!==u?(h=x=>{let{close:g}=x;return Y(nc.ButtonGroup,{children:Object.entries(o).map(w=>{let[E,C]=w;return Y(nc.Button,{active:!1,disabled:!1,onClick:()=>{u(E),g()},children:Y("span",{className:`${We}__language-code`,"data-language":E,children:C})},E)})})},e[12]=o,e[13]=u,e[14]=h):h=e[14],f=Y(r,{Actions:rc("div",{className:`${We}__actions`,children:[Y(TC,{button:rc("div",{className:`${We}__language-selector-button`,"data-selected-language":p,children:[Y("span",{children:a}),Y(kC,{className:`${We}__chevron`})]}),className:`${We}__language-selector`,disabled:!m,horizontalAlign:"right",render:h,showScrollbar:!0,size:"large"}),Y(_C,{value:s?.value??""}),Y(ec,{}),m&&Y(l,{})]}),className:We,collapsibleProps:{AfterCollapsible:Y(oc,{}),disableHeaderToggle:!0,disableToggleIndicator:!0},Pill:Y("div",{className:`${We}__pill`,children:Y(Ya,{})}),children:Y(CC,{children:Y(wC,{fields:n,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!m})})}),e[2]=r,e[3]=l,e[4]=s?.value,e[5]=n,e[6]=m,e[7]=o,e[8]=a,e[9]=u,e[10]=p,e[11]=f}else f=e[11];return f};function LC(t){let[e]=t;return{codeField:e?.code}}import{c as NC}from"react/compiler-runtime";import{jsx as at}from"react/jsx-runtime";import{FieldContext as yC,FieldPathContext as ic,ServerFunctionsContext as sc,ShimmerEffect as RC,useServerFunctions as IC}from"@payloadcms/ui";import vC,{useEffect as MC,useRef as DC}from"react";var AC=t=>{let e=NC(9),{field:o,initialValue:r,Loading:n,path:l,schemaPath:i,setValue:s,value:d}=t,[c,u]=vC.useState(null),a=IC(),{_internal_renderField:m}=a,[p,f]=i.split("."),h=l??(o&&"name"in o?o?.name:"")??"",x;e[0]!==m||e[1]!==o||e[2]!==r||e[3]!==l||e[4]!==i?(x=()=>{(async function(){let{Field:N}=await m({field:{...o||{},type:"richText",admin:{...o?.admin||{},hidden:!1}},initialValue:r??void 0,path:l,schemaPath:i});u(N)})()},e[0]=m,e[1]=o,e[2]=r,e[3]=l,e[4]=i,e[5]=x):x=e[5];let g=x,w=DC(!1),E,C;if(e[6]!==g?(E=()=>{w.current||(w.current=!0,g())},C=[g],e[6]=g,e[7]=E,e[8]=C):(E=e[7],C=e[8]),MC(E,C),!c)return typeof n<"u"?n:at(RC,{});let k={...a,getFormState:async T=>a.getFormState({...T,collectionSlug:p==="collection"?f:void 0,globalSlug:p==="global"?f:void 0})};if(typeof d>"u"&&!s)return at(sc,{value:{...k},children:at(ic,{value:h,children:c},h)});let b={disabled:!1,formInitializing:!1,formProcessing:!1,formSubmitted:!1,initialValue:d,path:h,setValue:s??$C,showError:!1,value:d};return at(sc,{value:{...k},children:at(ic,{value:h,children:at(yC,{value:b,children:c})},h)})};function $C(){}function OC({nodes:t,text:e}){let o={root:{type:"root",children:[],direction:"ltr",format:"",indent:0,version:1}};return e&&o.root.children.push({type:"paragraph",children:[{type:"text",detail:0,format:0,mode:"normal",style:"",text:e,version:1}],direction:"ltr",format:"",indent:0,textFormat:0,textStyle:"",version:1}),t?.length&&o.root.children.push(...t),o}export{Et as $createAutoLinkNode,$e as $createBlockNode,dt as $createInlineBlockNode,be as $createLinkNode,He as $createRelationshipNode,De as $createUploadNode,_e as $isAutoLinkNode,Ae as $isBlockNode,mt as $isInlineBlockNode,K as $isLinkNode,wr as $isRelationshipNode,st as $isUploadNode,_c as AlignFeatureClient,ke as AutoLinkNode,Yx as BlockCollapsible,eC as BlockEditButton,se as BlockNode,rC as BlockRemoveButton,Lc as BlockquoteFeatureClient,Du as BlocksFeatureClient,od as BoldFeatureClient,ne as CAN_USE_DOM,sf as ChecklistFeatureClient,SC as CodeBlockBlockComponent,uC as CodeComponent,Yf as DETAIL_TYPE_TO_DETAIL,Jf as DOUBLE_LINE_BREAK,a0 as DebugJsxConverterFeatureClient,Qf as ELEMENT_FORMAT_TO_TYPE,qf as ELEMENT_TYPE_TO_FORMAT,fc as ENABLE_SLASH_MENU_COMMAND,uc as EditorConfigProvider,pt as FieldsDrawer,I1 as FixedToolbarFeatureClient,Yd as HeadingFeatureClient,hm as HorizontalRuleFeatureClient,Xe as INSERT_BLOCK_COMMAND,ze as INSERT_INLINE_BLOCK_COMMAND,Vf as IS_ALL_FORMATTING,vm as IndentFeatureClient,zx as InlineBlockContainer,jx as InlineBlockEditButton,Kx as InlineBlockLabel,ut as InlineBlockNode,Wx as InlineBlockRemoveButton,sd as InlineCodeFeatureClient,U1 as InlineToolbarFeatureClient,dd as ItalicFeatureClient,zf as LTR_REGEX,Rf as LexicalPluginToLexicalFeatureClient,Vp as LinkFeatureClient,oe as LinkNode,Kf as NON_BREAKING_SPACE,O as NodeFormat,hf as OrderedListFeatureClient,Ff as ParagraphFeatureClient,mc as Point,Xf as RTL_REGEX,hc as Rect,X0 as RelationshipFeatureClient,we as RelationshipNode,AC as RenderLexical,Ix as RichTextField,$f as SlateToLexicalFeatureClient,gd as StrikethroughFeatureClient,kd as SubscriptFeatureClient,Ed as SuperscriptFeatureClient,e0 as TEXT_MODE_TO_TYPE,Zf as TEXT_TYPE_TO_FORMAT,t0 as TEXT_TYPE_TO_MODE,de as TOGGLE_LINK_COMMAND,Ag as TableFeatureClient,Ju as TestRecorderFeatureClient,jd as TextStateFeatureClient,$t as ToolbarButton,Ue as ToolbarDropdown,qu as TreeViewFeatureClient,Rd as UnderlineFeatureClient,wf as UnorderedListFeatureClient,kx as UploadFeatureClient,le as UploadNode,Fx as addSwipeDownListener,Ax as addSwipeLeftListener,$x as addSwipeRightListener,Ox as addSwipeUpListener,OC as buildEditorState,za as codeConverterClient,tr as createBlockNode,v as createClientFeature,c0 as defaultColors,Ro as defaultEditorLexicalConfig,yr as getDOMRangeRect,gc as getEnabledNodes,lC as getRestPopulateFn,Ze as getSelectedNode,vx as isHTMLElement,pc as isPoint,Mx as joinClasses,zr as sanitizeClientEditorConfig,Ja as sanitizeClientFeatures,Co as setFloatingElemPosition,mo as setFloatingElemPositionForLinkEditor,z as slashMenuBasicGroupWithItems,Ce as toolbarAddDropdownGroupWithItems,rr as toolbarFeatureButtonsGroupWithItems,Z as toolbarFormatGroupWithItems,ee as toolbarTextDropdownGroupWithItems,xe as useBlockComponentContext,j as useEditorConfigContext,ge as useInlineBlockComponentContext,dc as useLexicalDocumentDrawer,he as useLexicalDrawer,At as useLexicalListDrawer};
|
|
38
|
+
`,Ui="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",Gi="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",nf=new RegExp("^[^"+Gi+"]*["+Ui+"]"),lf=new RegExp("^[^"+Ui+"]*["+Gi+"]"),sf={bold:O.IS_BOLD,code:O.IS_CODE,highlight:O.IS_HIGHLIGHT,italic:O.IS_ITALIC,strikethrough:O.IS_STRIKETHROUGH,subscript:O.IS_SUBSCRIPT,superscript:O.IS_SUPERSCRIPT,underline:O.IS_UNDERLINE},af={directionless:O.IS_DIRECTIONLESS,unmergeable:O.IS_UNMERGEABLE},cf={center:O.IS_ALIGN_CENTER,end:O.IS_ALIGN_END,justify:O.IS_ALIGN_JUSTIFY,left:O.IS_ALIGN_LEFT,right:O.IS_ALIGN_RIGHT,start:O.IS_ALIGN_START},uf={[O.IS_ALIGN_CENTER]:"center",[O.IS_ALIGN_END]:"end",[O.IS_ALIGN_JUSTIFY]:"justify",[O.IS_ALIGN_LEFT]:"left",[O.IS_ALIGN_RIGHT]:"right",[O.IS_ALIGN_START]:"start"},df={normal:O.IS_NORMAL,segmented:O.IS_SEGMENTED,token:O.IS_TOKEN},mf={[O.IS_NORMAL]:"normal",[O.IS_SEGMENTED]:"segmented",[O.IS_TOKEN]:"token"};var Wi={text:({node:t})=>{let e=t.text;return t.format&O.IS_BOLD&&(e=Fe("strong",{children:e})),t.format&O.IS_ITALIC&&(e=Fe("em",{children:e})),t.format&O.IS_STRIKETHROUGH&&(e=Fe("span",{style:{textDecoration:"line-through"},children:e})),t.format&O.IS_UNDERLINE&&(e=Fe("span",{style:{textDecoration:"underline"},children:e})),t.format&O.IS_CODE&&(e=Fe("code",{children:e})),t.format&O.IS_SUBSCRIPT&&(e=Fe("sub",{children:e})),t.format&O.IS_SUPERSCRIPT&&(e=Fe("sup",{children:e})),e}};import{jsx as Tt}from"react/jsx-runtime";var Vi={upload:({node:t})=>{let e=t;if(typeof e.value!="object")return null;let o=e.value,r=o.url;if(!o.mimeType.startsWith("image"))return Tt("a",{href:r,rel:"noopener noreferrer",children:o.filename});if(!o.sizes||!Object.keys(o.sizes).length)return Tt("img",{alt:o.filename,height:o.height,src:r,width:o.width});let n=[];for(let l in o.sizes){let i=o.sizes[l];if(!i||!i.width||!i.height||!i.mimeType||!i.filesize||!i.filename||!i.url)continue;let s=i?.url;n.push(Tt("source",{media:`(max-width: ${i.width}px)`,srcSet:s,type:i.mimeType},l))}return n.push(Tt("img",{alt:o?.filename,height:o?.height,src:r,width:o?.width},"image")),Tt("picture",{children:n})}};var Ye={...Bi,...Wi,...Oi,...Mi,...ji,...Di,...Ai,...Pi,...$i({}),...Vi,...Hi};import{jsx as Ji,Fragment as pf}from"react/jsx-runtime";import ar from"react";function Ki(t){let e=!!t?.root?.children?.length,o=!1;if(t?.root?.children?.length===1&&t?.root?.children[0]?.type==="paragraph"){let r=t?.root?.children[0];if(!r?.children||r?.children?.length===0)o=!0;else if(r?.children?.length===1){let n=r?.children[0];n?.type==="text"&&(n?.text?.length||(o=!0))}}return!(!e||o)}function Xi({converters:t,data:e,disableIndent:o,disableTextAlign:r}){return Ki(e)?zi({converters:t,disableIndent:o,disableTextAlign:r,nodes:e?.root?.children,parent:e?.root}):Ji(pf,{})}function zi({converters:t,disableIndent:e,disableTextAlign:o,nodes:r,parent:n}){let l=t.unknown;return r.map((s,u)=>{let c;s.type==="block"?(c=t?.blocks?.[s?.fields?.blockType],!c&&!l&&console.error(`Lexical => JSX converter: Blocks converter: found ${s?.fields?.blockType} block, but no converter is provided`)):s.type==="inlineBlock"?(c=t?.inlineBlocks?.[s?.fields?.blockType],!c&&!l&&console.error(`Lexical => JSX converter: Inline Blocks converter: found ${s?.fields?.blockType} inline block, but no converter is provided`)):c=t[s.type];try{!c&&l&&(c=l);let d;c?d=typeof c=="function"?c({childIndex:u,converters:t,node:s,nodesToJSX:m=>zi({converters:m.converters??t,disableIndent:m.disableIndent??e,disableTextAlign:m.disableTextAlign??o,nodes:m.nodes,parent:m.parent??{...s,parent:n}}),parent:n}):c:d=Ji("span",{children:"unknown node"},u);let a={};if(!o&&(!Array.isArray(o)||!o?.includes(s.type))&&"format"in s&&s.format)switch(s.format){case"center":a.textAlign="center";break;case"end":a.textAlign="right";break;case"justify":a.textAlign="justify";break;case"left":break;case"right":a.textAlign="right";break;case"start":a.textAlign="left";break}if(!e&&(!Array.isArray(e)||!e?.includes(s.type))&&"indent"in s&&s.indent&&s.type!=="listitem"&&(a.paddingInlineStart=`${Number(s.indent)*40}px`),ar.isValidElement(d)){if(a.textAlign||a.paddingInlineStart){let p={...a,...d?.props?.style??{}};return ar.cloneElement(d,{key:u,style:p})}return ar.cloneElement(d,{key:u})}return d}catch(d){return console.error("Error converting lexical node to JSX:",d,"node:",s),null}}).filter(Boolean)}var cr=({className:t,converters:e,data:o,disableContainer:r,disableIndent:n,disableTextAlign:l})=>{if(!o)return null;let i={};e?typeof e=="function"?i=e({defaultConverters:Ye}):i=e:i=Ye;let s=o&&!Array.isArray(o)&&typeof o=="object"&&"root"in o&&Xi({converters:i,data:o,disableIndent:n,disableTextAlign:l});return r?Zi(ff,{children:s}):Zi("div",{className:t??"payload-richtext",children:s})};function qi(){let t=hf(7),[e]=gf(),o;t[0]!==e?(o=e.getEditorState().toJSON(),t[0]=e,t[1]=o):o=t[1];let[r,n]=Cf(o),l,i;t[2]!==e?(l=()=>e.registerUpdateListener(u=>{let{editorState:c}=u;n(c.toJSON())}),i=[e],t[2]=e,t[3]=l,t[4]=i):(l=t[3],i=t[4]),xf(l,i);let s;return t[5]!==r?(s=Yi("div",{className:"debug-jsx-converter",children:Yi(cr,{converters:Ye,data:r})}),t[5]=r,t[6]=s):s=t[6],s}var bf=v({plugins:[{Component:qi,position:"bottom"}]});var B={amber:{50:"oklch(0.987 0.022 95.277)",100:"oklch(0.962 0.059 95.617)",200:"oklch(0.924 0.12 95.746)",300:"oklch(0.879 0.169 91.605)",400:"oklch(0.828 0.189 84.429)",500:"oklch(0.769 0.188 70.08)",600:"oklch(0.666 0.179 58.318)",700:"oklch(0.555 0.163 48.998)",800:"oklch(0.473 0.137 46.201)",900:"oklch(0.414 0.112 45.904)",950:"oklch(0.279 0.077 45.635)"},black:"#000",blue:{50:"oklch(0.97 0.014 254.604)",100:"oklch(0.932 0.032 255.585)",200:"oklch(0.882 0.059 254.128)",300:"oklch(0.809 0.105 251.813)",400:"oklch(0.707 0.165 254.624)",500:"oklch(0.623 0.214 259.815)",600:"oklch(0.546 0.245 262.881)",700:"oklch(0.488 0.243 264.376)",800:"oklch(0.424 0.199 265.638)",900:"oklch(0.379 0.146 265.522)",950:"oklch(0.282 0.091 267.935)"},current:"currentColor",cyan:{50:"oklch(0.984 0.019 200.873)",100:"oklch(0.956 0.045 203.388)",200:"oklch(0.917 0.08 205.041)",300:"oklch(0.865 0.127 207.078)",400:"oklch(0.789 0.154 211.53)",500:"oklch(0.715 0.143 215.221)",600:"oklch(0.609 0.126 221.723)",700:"oklch(0.52 0.105 223.128)",800:"oklch(0.45 0.085 224.283)",900:"oklch(0.398 0.07 227.392)",950:"oklch(0.302 0.056 229.695)"},emerald:{50:"oklch(0.979 0.021 166.113)",100:"oklch(0.95 0.052 163.051)",200:"oklch(0.905 0.093 164.15)",300:"oklch(0.845 0.143 164.978)",400:"oklch(0.765 0.177 163.223)",500:"oklch(0.696 0.17 162.48)",600:"oklch(0.596 0.145 163.225)",700:"oklch(0.508 0.118 165.612)",800:"oklch(0.432 0.095 166.913)",900:"oklch(0.378 0.077 168.94)",950:"oklch(0.262 0.051 172.552)"},fuchsia:{50:"oklch(0.977 0.017 320.058)",100:"oklch(0.952 0.037 318.852)",200:"oklch(0.903 0.076 319.62)",300:"oklch(0.833 0.145 321.434)",400:"oklch(0.74 0.238 322.16)",500:"oklch(0.667 0.295 322.15)",600:"oklch(0.591 0.293 322.896)",700:"oklch(0.518 0.253 323.949)",800:"oklch(0.452 0.211 324.591)",900:"oklch(0.401 0.17 325.612)",950:"oklch(0.293 0.136 325.661)"},gray:{50:"oklch(0.985 0.002 247.839)",100:"oklch(0.967 0.003 264.542)",200:"oklch(0.928 0.006 264.531)",300:"oklch(0.872 0.01 258.338)",400:"oklch(0.707 0.022 261.325)",500:"oklch(0.551 0.027 264.364)",600:"oklch(0.446 0.03 256.802)",700:"oklch(0.373 0.034 259.733)",800:"oklch(0.278 0.033 256.848)",900:"oklch(0.21 0.034 264.665)",950:"oklch(0.13 0.028 261.692)"},green:{50:"oklch(0.982 0.018 155.826)",100:"oklch(0.962 0.044 156.743)",200:"oklch(0.925 0.084 155.995)",300:"oklch(0.871 0.15 154.449)",400:"oklch(0.792 0.209 151.711)",500:"oklch(0.723 0.219 149.579)",600:"oklch(0.627 0.194 149.214)",700:"oklch(0.527 0.154 150.069)",800:"oklch(0.448 0.119 151.328)",900:"oklch(0.393 0.095 152.535)",950:"oklch(0.266 0.065 152.934)"},indigo:{50:"oklch(0.962 0.018 272.314)",100:"oklch(0.93 0.034 272.788)",200:"oklch(0.87 0.065 274.039)",300:"oklch(0.785 0.115 274.713)",400:"oklch(0.673 0.182 276.935)",500:"oklch(0.585 0.233 277.117)",600:"oklch(0.511 0.262 276.966)",700:"oklch(0.457 0.24 277.023)",800:"oklch(0.398 0.195 277.366)",900:"oklch(0.359 0.144 278.697)",950:"oklch(0.257 0.09 281.288)"},inherit:"inherit",lime:{50:"oklch(0.986 0.031 120.757)",100:"oklch(0.967 0.067 122.328)",200:"oklch(0.938 0.127 124.321)",300:"oklch(0.897 0.196 126.665)",400:"oklch(0.841 0.238 128.85)",500:"oklch(0.768 0.233 130.85)",600:"oklch(0.648 0.2 131.684)",700:"oklch(0.532 0.157 131.589)",800:"oklch(0.453 0.124 130.933)",900:"oklch(0.405 0.101 131.063)",950:"oklch(0.274 0.072 132.109)"},neutral:{50:"oklch(0.985 0 0)",100:"oklch(0.97 0 0)",200:"oklch(0.922 0 0)",300:"oklch(0.87 0 0)",400:"oklch(0.708 0 0)",500:"oklch(0.556 0 0)",600:"oklch(0.439 0 0)",700:"oklch(0.371 0 0)",800:"oklch(0.269 0 0)",900:"oklch(0.205 0 0)",950:"oklch(0.145 0 0)"},orange:{50:"oklch(0.98 0.016 73.684)",100:"oklch(0.954 0.038 75.164)",200:"oklch(0.901 0.076 70.697)",300:"oklch(0.837 0.128 66.29)",400:"oklch(0.75 0.183 55.934)",500:"oklch(0.705 0.213 47.604)",600:"oklch(0.646 0.222 41.116)",700:"oklch(0.553 0.195 38.402)",800:"oklch(0.47 0.157 37.304)",900:"oklch(0.408 0.123 38.172)",950:"oklch(0.266 0.079 36.259)"},pink:{50:"oklch(0.971 0.014 343.198)",100:"oklch(0.948 0.028 342.258)",200:"oklch(0.899 0.061 343.231)",300:"oklch(0.823 0.12 346.018)",400:"oklch(0.718 0.202 349.761)",500:"oklch(0.656 0.241 354.308)",600:"oklch(0.592 0.249 0.584)",700:"oklch(0.525 0.223 3.958)",800:"oklch(0.459 0.187 3.815)",900:"oklch(0.408 0.153 2.432)",950:"oklch(0.284 0.109 3.907)"},purple:{50:"oklch(0.977 0.014 308.299)",100:"oklch(0.946 0.033 307.174)",200:"oklch(0.902 0.063 306.703)",300:"oklch(0.827 0.119 306.383)",400:"oklch(0.714 0.203 305.504)",500:"oklch(0.627 0.265 303.9)",600:"oklch(0.558 0.288 302.321)",700:"oklch(0.496 0.265 301.924)",800:"oklch(0.438 0.218 303.724)",900:"oklch(0.381 0.176 304.987)",950:"oklch(0.291 0.149 302.717)"},red:{50:"oklch(0.971 0.013 17.38)",100:"oklch(0.936 0.032 17.717)",200:"oklch(0.885 0.062 18.334)",300:"oklch(0.808 0.114 19.571)",400:"oklch(0.704 0.191 22.216)",500:"oklch(0.637 0.237 25.331)",600:"oklch(0.577 0.245 27.325)",700:"oklch(0.505 0.213 27.518)",800:"oklch(0.444 0.177 26.899)",900:"oklch(0.396 0.141 25.723)",950:"oklch(0.258 0.092 26.042)"},rose:{50:"oklch(0.969 0.015 12.422)",100:"oklch(0.941 0.03 12.58)",200:"oklch(0.892 0.058 10.001)",300:"oklch(0.81 0.117 11.638)",400:"oklch(0.712 0.194 13.428)",500:"oklch(0.645 0.246 16.439)",600:"oklch(0.586 0.253 17.585)",700:"oklch(0.514 0.222 16.935)",800:"oklch(0.455 0.188 13.697)",900:"oklch(0.41 0.159 10.272)",950:"oklch(0.271 0.105 12.094)"},sky:{50:"oklch(0.977 0.013 236.62)",100:"oklch(0.951 0.026 236.824)",200:"oklch(0.901 0.058 230.902)",300:"oklch(0.828 0.111 230.318)",400:"oklch(0.746 0.16 232.661)",500:"oklch(0.685 0.169 237.323)",600:"oklch(0.588 0.158 241.966)",700:"oklch(0.5 0.134 242.749)",800:"oklch(0.443 0.11 240.79)",900:"oklch(0.391 0.09 240.876)",950:"oklch(0.293 0.066 243.157)"},slate:{50:"oklch(0.984 0.003 247.858)",100:"oklch(0.968 0.007 247.896)",200:"oklch(0.929 0.013 255.508)",300:"oklch(0.869 0.022 252.894)",400:"oklch(0.704 0.04 256.788)",500:"oklch(0.554 0.046 257.417)",600:"oklch(0.446 0.043 257.281)",700:"oklch(0.372 0.044 257.287)",800:"oklch(0.279 0.041 260.031)",900:"oklch(0.208 0.042 265.755)",950:"oklch(0.129 0.042 264.695)"},stone:{50:"oklch(0.985 0.001 106.423)",100:"oklch(0.97 0.001 106.424)",200:"oklch(0.923 0.003 48.717)",300:"oklch(0.869 0.005 56.366)",400:"oklch(0.709 0.01 56.259)",500:"oklch(0.553 0.013 58.071)",600:"oklch(0.444 0.011 73.639)",700:"oklch(0.374 0.01 67.558)",800:"oklch(0.268 0.007 34.298)",900:"oklch(0.216 0.006 56.043)",950:"oklch(0.147 0.004 49.25)"},teal:{50:"oklch(0.984 0.014 180.72)",100:"oklch(0.953 0.051 180.801)",200:"oklch(0.91 0.096 180.426)",300:"oklch(0.855 0.138 181.071)",400:"oklch(0.777 0.152 181.912)",500:"oklch(0.704 0.14 182.503)",600:"oklch(0.6 0.118 184.704)",700:"oklch(0.511 0.096 186.391)",800:"oklch(0.437 0.078 188.216)",900:"oklch(0.386 0.063 188.416)",950:"oklch(0.277 0.046 192.524)"},transparent:"transparent",violet:{50:"oklch(0.969 0.016 293.756)",100:"oklch(0.943 0.029 294.588)",200:"oklch(0.894 0.057 293.283)",300:"oklch(0.811 0.111 293.571)",400:"oklch(0.702 0.183 293.541)",500:"oklch(0.606 0.25 292.717)",600:"oklch(0.541 0.281 293.009)",700:"oklch(0.491 0.27 292.581)",800:"oklch(0.432 0.232 292.759)",900:"oklch(0.38 0.189 293.745)",950:"oklch(0.283 0.141 291.089)"},white:"#fff",yellow:{50:"oklch(0.987 0.026 102.212)",100:"oklch(0.973 0.071 103.193)",200:"oklch(0.945 0.129 101.54)",300:"oklch(0.905 0.182 98.111)",400:"oklch(0.852 0.199 91.936)",500:"oklch(0.795 0.184 86.047)",600:"oklch(0.681 0.162 75.834)",700:"oklch(0.554 0.135 66.442)",800:"oklch(0.476 0.114 61.907)",900:"oklch(0.421 0.095 57.708)",950:"oklch(0.286 0.066 53.813)"},zinc:{50:"oklch(0.985 0 0)",100:"oklch(0.967 0.001 286.375)",200:"oklch(0.92 0.004 286.32)",300:"oklch(0.871 0.006 286.286)",400:"oklch(0.705 0.015 286.067)",500:"oklch(0.552 0.016 285.938)",600:"oklch(0.442 0.017 285.786)",700:"oklch(0.37 0.013 285.805)",800:"oklch(0.274 0.006 286.033)",900:"oklch(0.21 0.006 285.885)",950:"oklch(0.141 0.005 285.823)"}},kf={text:{"text-red":{css:{color:`light-dark(${B.red[600]}, ${B.red[400]})`},label:"Red"},"text-orange":{css:{color:`light-dark(${B.orange[600]}, ${B.orange[400]})`},label:"Orange"},"text-yellow":{css:{color:`light-dark(${B.yellow[700]}, ${B.yellow[300]})`},label:"Yellow"},"text-green":{css:{color:`light-dark(${B.green[700]}, ${B.green[400]})`},label:"Green"},"text-blue":{css:{color:`light-dark(${B.blue[600]}, ${B.blue[400]})`},label:"Blue"},"text-purple":{css:{color:`light-dark(${B.purple[600]}, ${B.purple[400]})`},label:"Purple"},"text-pink":{css:{color:`light-dark(${B.pink[600]}, ${B.pink[400]})`},label:"Pink"}},background:{"bg-red":{css:{"background-color":`light-dark(${B.red[400]}, ${B.red[600]})`},label:"Red"},"bg-orange":{css:{"background-color":`light-dark(${B.orange[400]}, ${B.orange[600]})`},label:"Orange"},"bg-yellow":{css:{"background-color":`light-dark(${B.yellow[300]}, ${B.yellow[700]})`},label:"Yellow"},"bg-green":{css:{"background-color":`light-dark(${B.green[400]}, ${B.green[700]})`},label:"Green"},"bg-blue":{css:{"background-color":`light-dark(${B.blue[400]}, ${B.blue[600]})`},label:"Blue"},"bg-purple":{css:{"background-color":`light-dark(${B.purple[400]}, ${B.purple[600]})`},label:"Purple"},"bg-pink":{css:{"background-color":`light-dark(${B.pink[400]}, ${B.pink[600]})`},label:"Pink"}}};import{$isNodeSelection as n0}from"lexical";import{jsx as wt,jsxs as _f}from"react/jsx-runtime";import"react";var ur=()=>_f("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[wt("g",{clipPath:"url(#clip0_4397_10817)",children:wt("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"})}),wt("defs",{children:wt("clipPath",{id:"clip0_4397_10817",children:wt("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{jsx as Ef}from"react/jsx-runtime";import*as es from"react";import{DecoratorBlockNode as Tf}from"@lexical/react/LexicalDecoratorBlockNode.js";function wf(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Qi({relationTo:o,value:e})}:null}var Et=class extends Tf{__data;constructor({data:e,format:o,key:r}){super(o,r),this.__data=e}static clone(e){return new this({data:e.__data,format:e.__format,key:e.__key})}static getType(){return"relationship"}static importDOM(){return{div:e=>!e.hasAttribute("data-lexical-relationship-relationTo")||!e.hasAttribute("data-lexical-relationship-id")?null:{conversion:wf,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},r=Qi(o);return r.setFormat(e.format),r}static isInline(){return!1}decorate(e,o){return null}exportDOM(){let e=document.createElement("div");e.setAttribute("data-lexical-relationship-id",String(typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value)),e.setAttribute("data-lexical-relationship-relationTo",this.__data?.relationTo);let o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"relationship",version:2}}getData(){return this.getLatest().__data}getTextContent(){return`${this.__data?.relationTo} relation to ${typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value}`}setData(e){let o=this.getWritable();o.__data=e}};function Qi(t){return new Et({data:t})}var Sf=es.lazy(()=>import("./RelationshipComponent-APF3CN47.js").then(t=>({default:t.RelationshipComponent})));function Nf(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:$e({relationTo:o,value:e})}:null}var ke=class extends Et{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{div:e=>!e.hasAttribute("data-lexical-relationship-relationTo")||!e.hasAttribute("data-lexical-relationship-id")?null:{conversion:Nf,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},r=$e(o);return r.setFormat(e.format),r}decorate(e,o){return Ef(Sf,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function $e(t){return new ke({data:t})}function dr(t){return t instanceof ke}import{c as Wf}from"react/compiler-runtime";import{jsx as Vf}from"react/jsx-runtime";import{useLexicalComposerContext as Kf}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Jf}from"@lexical/utils";import{useConfig as Xf}from"@payloadcms/ui";import{$getPreviousSelection as zf,$getSelection as Zf,$isParagraphNode as Yf,$isRangeSelection as qf,COMMAND_PRIORITY_EDITOR as Qf,createCommand as e0}from"lexical";import{useEffect as t0}from"react";import{c as Pf}from"react/compiler-runtime";import{jsx as no}from"react/jsx-runtime";import{useLexicalComposerContext as Bf}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as Hf,COMMAND_PRIORITY_EDITOR as jf}from"lexical";import{useEffect as Uf,useState as rs}from"react";import{c as Lf}from"react/compiler-runtime";import{jsx as yf}from"react/jsx-runtime";import{useLexicalComposerContext as If}from"@lexical/react/LexicalComposerContext";import{useListDrawer as Rf,useModal as vf}from"@payloadcms/ui";import{$getNodeByKey as ts,$getPreviousSelection as Mf,$getRoot as Df,$getSelection as Af,$isRangeSelection as Of,$setSelection as Ff}from"lexical";import{useEffect as $f,useState as os}from"react";var St=t=>{let e=Lf(23),[o]=If(),[r,n]=os(null),[l,i]=os(!1),[s,u,c]=Rf(t),{closeDrawer:d,drawerSlug:a,isDrawerOpen:p,openDrawer:m}=c,{modalState:f}=vf(),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let F=Af()??Mf();n(F)},e[0]=h):h=e[0];let x=h,b;e[1]!==o||e[2]!==r?(b=()=>{r&&o.update(()=>{if(Of(r)){let{anchor:F,focus:R}=r;ts(F.key)&&ts(R.key)&&Ff(r.clone())}else Df().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=r,e[3]=b):b=e[3];let T=b,E;e[4]!==d?(E=()=>{d()},e[4]=d,e[5]=E):E=e[5];let C=E,k,g;e[6]!==a||e[7]!==f||e[8]!==T||e[9]!==l?(k=()=>{if(!l)return;let F=f[a];F&&!F?.isOpen&&(i(!1),setTimeout(()=>{T()},1))},g=[f,a,T,l],e[6]=a,e[7]=f,e[8]=T,e[9]=l,e[10]=k,e[11]=g):(k=e[10],g=e[11]),$f(k,g);let w;e[12]!==u?(w=F=>yf(u,{...F,onClick:()=>{x()}}),e[12]=u,e[13]=w):w=e[13];let L;e[14]!==m?(L=()=>{x(),m(),i(!0)},e[14]=m,e[15]=L):L=e[15];let D;return e[16]!==s||e[17]!==C||e[18]!==p||e[19]!==a||e[20]!==w||e[21]!==L?(D={closeListDrawer:C,isListDrawerOpen:p,ListDrawer:s,listDrawerSlug:a,ListDrawerToggler:w,openListDrawer:L},e[16]=s,e[17]=C,e[18]=p,e[19]=a,e[20]=w,e[21]=L,e[22]=D):D=e[22],D};var Gf=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=Hf(o);n&&n.replace($e({relationTo:e,value:r}))}):t.dispatchCommand(mr,{relationTo:e,value:r})},ns=t=>{let e=Pf(16),{enabledCollectionSlugs:o}=t,[r]=Bf(),n;e[0]!==o?.[0]?(n=()=>o?.[0],e[0]=o?.[0],e[1]=n):n=e[1];let[l]=rs(n),[i,s]=rs(null),u=o||void 0,c;e[2]!==l||e[3]!==u?(c={collectionSlugs:u,selectedCollection:l},e[2]=l,e[3]=u,e[4]=c):c=e[4];let{closeListDrawer:d,ListDrawer:a,openListDrawer:p}=St(c),m,f;e[5]!==r||e[6]!==p?(m=()=>r.registerCommand(lt,T=>(s(T?.replace?T?.replace.nodeKey:null),p(),!0),jf),f=[r,p],e[5]=r,e[6]=p,e[7]=m,e[8]=f):(m=e[7],f=e[8]),Uf(m,f);let h;e[9]!==d||e[10]!==r||e[11]!==i?(h=T=>{let{collectionSlug:E,doc:C}=T;Gf({editor:r,relationTo:E,replaceNodeKey:i,value:C.id}),d()},e[9]=d,e[10]=r,e[11]=i,e[12]=h):h=e[12];let x=h,b;return e[13]!==a||e[14]!==x?(b=no(a,{onSelect:x}),e[13]=a,e[14]=x,e[15]=b):b=e[15],b},ls=t=>(t?.enabledCollectionSlugs?.length??-1)>0?no(ns,{...t}):no(Ot,{...t,children:no(ns,{...t})});var mr=e0("INSERT_RELATIONSHIP_COMMAND"),is=t=>{let e=Wf(5),{clientProps:o}=t,[r]=Kf(),{config:n}=Xf(),{collections:l}=n,i=null;if(o?.enabledCollections)i=o?.enabledCollections;else if(o?.disabledCollections){let c;e[0]!==o?.disabledCollections?(c=d=>{let{slug:a}=d;return!o?.disabledCollections?.includes(a)},e[0]=o?.disabledCollections,e[1]=c):c=e[1],i=l.filter(c).map(o0)}let s,u;return e[2]!==r?(s=()=>{if(!r.hasNodes([ke]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return r.registerCommand(mr,r0,Qf)},u=[r],e[2]=r,e[3]=s,e[4]=u):(s=e[3],u=e[4]),t0(s,u),Vf(ls,{enabledCollectionSlugs:i})};function o0(t){let{slug:e}=t;return e}function r0(t){let e=Zf()||zf();if(qf(e)){let o=$e(t),{focus:r}=e,n=r.getNode();Jf(o),Yf(n)&&!n.__first&&n.remove()}return!0}var l0=v({nodes:[ke],plugins:[{Component:is,position:"normal"}],slashMenu:{groups:[Z([{Icon:ur,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(lt,{replace:!1})}}])]},toolbarFixed:{groups:[he([{ChildComponent:ur,isActive:({selection:t})=>{if(!n0(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return dr(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(lt,{replace:!1})}}])]}});import{c as hs}from"react/compiler-runtime";import{jsx as ie,jsxs as M0}from"react/jsx-runtime";import{useLexicalComposerContext as D0}from"@lexical/react/LexicalComposerContext.js";import{useScrollInfo as A0,useThrottledEffect as O0,useTranslation as F0}from"@payloadcms/ui";import*as _e from"react";import{useMemo as $0}from"react";import{c as i0}from"react/compiler-runtime";import{jsx as s0}from"react/jsx-runtime";import{mergeRegister as a0}from"@lexical/utils";import{$addUpdateTag as c0,$getSelection as u0}from"lexical";import{useDeferredValue as d0,useEffect as m0,useState as p0}from"react";var ss="toolbar-popup__button",Nt=t=>{let e=i0(23),{children:o,editor:r,item:n}=t,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={active:!1,enabled:!0},e[0]=l):l=e[0];let[i,s]=p0(l),u=d0(i),c=H(),d=u.enabled?"":"disabled",a=u.active?"active":"",p=n.key?`${ss}-${n.key}`:"",m;e[1]!==d||e[2]!==a||e[3]!==p?(m=[ss,d,a,p].filter(Boolean),e[1]=d,e[2]=a,e[3]=p,e[4]=m):m=e[4];let f=m.join(" "),h;e[5]!==r||e[6]!==c||e[7]!==n?(h=()=>{r.getEditorState().read(()=>{let L=u0();if(!L)return;let D=n.isActive?n.isActive({editor:r,editorConfigContext:c,selection:L}):!1,F=n.isEnabled?n.isEnabled({editor:r,editorConfigContext:c,selection:L}):!0;s(R=>R.active===D&&R.enabled===F?R:{active:D,enabled:F})})},e[5]=r,e[6]=c,e[7]=n,e[8]=h):h=e[8];let x=h,b=Ft(),T,E;e[9]!==r||e[10]!==b||e[11]!==x?(T=()=>{b(x);let L=()=>b(x),D=a0(r.registerUpdateListener(L));return document.addEventListener("mouseup",L),()=>{D(),document.removeEventListener("mouseup",L)}},E=[r,b,x],e[9]=r,e[10]=b,e[11]=x,e[12]=T,e[13]=E):(T=e[12],E=e[13]),m0(T,E);let C;e[14]!==i||e[15]!==r||e[16]!==n?(C=()=>{i.enabled&&r.focus(()=>{r.update(f0),n.onSelect?.({editor:r,isActive:i.active})})},e[14]=i,e[15]=r,e[16]=n,e[17]=C):C=e[17];let k=C,g=h0,w;return e[18]!==o||e[19]!==f||e[20]!==k||e[21]!==n.key?(w=s0("button",{className:f,"data-button-key":n.key,onClick:k,onMouseDown:g,type:"button",children:o}),e[18]=o,e[19]=f,e[20]=k,e[21]=n.key,e[22]=w):w=e[22],w};function f0(){c0("toolbar")}function h0(t){t.preventDefault()}import{c as T0}from"react/compiler-runtime";import{jsx as qe}from"react/jsx-runtime";import fs,{useCallback as w0,useDeferredValue as E0,useEffect as S0,useMemo as N0}from"react";import{mergeRegister as L0}from"@lexical/utils";import{useTranslation as y0}from"@payloadcms/ui";import{$getSelection as I0}from"lexical";import{jsx as Le,jsxs as as}from"react/jsx-runtime";import{Button as g0}from"@payloadcms/ui";import{$addUpdateTag as x0,isDOMNode as C0}from"lexical";import lo,{useCallback as b0,useEffect as io,useMemo as us,useRef as pr,useState as fr}from"react";import{createPortal as k0}from"react-dom";var cs="toolbar-popup__dropdown-item",ds=lo.createContext(null);function ms({active:t,children:e,editor:o,enabled:r,Icon:n,item:l,itemKey:i,tooltip:s}){let u=us(()=>[cs,r===!1?"disabled":"",t?"active":"",l?.key?`${cs}-${l.key}`:""].filter(Boolean).join(" "),[r,t,l.key]),c=pr(null),d=lo.use(ds);if(d===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=d;return io(()=>{c?.current!=null&&a(c)},[c,a]),Le(g0,{"aria-label":s,buttonStyle:"none",className:u,disabled:r===!1,extraButtonProps:{"data-item-key":i},icon:n,iconPosition:"left",iconStyle:"none",onClick:()=>{r!==!1&&o.focus(()=>{o.update(()=>{x0("toolbar")}),l.onSelect?.({editor:o,isActive:t})})},onMouseDown:p=>{p.preventDefault()},ref:c,tooltip:s,type:"button",children:e})}function _0({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:r}){let[n,l]=fr(),[i,s]=fr(),u=b0(a=>{l(p=>p!=null?[...p,a]:[a])},[l]),c=a=>{if(n==null)return;let{key:p}=a;["ArrowDown","ArrowUp","Escape","Tab"].includes(p)&&a.preventDefault(),p==="Escape"||p==="Tab"?r():p==="ArrowUp"?s(m=>{if(m==null)return n[0];let f=n.indexOf(m)-1;return n[f===-1?n.length-1:f]}):p==="ArrowDown"&&s(m=>m==null?n[0]:n[n.indexOf(m)+1])},d=us(()=>({registerItem:u}),[u]);return io(()=>{n!=null&&i==null&&s(n[0]),i!=null&&i?.current!=null&&i.current.focus()},[n,i]),Le(ds,{value:d,children:Le("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:c,ref:e,children:t})})}function ps({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:r=!1,dropdownKey:n,Icon:l,itemsContainerClassNames:i,label:s,stopCloseOnClickSelf:u}){let c=pr(null),d=pr(null),[a,p]=fr(!1),m=()=>{p(!1),d?.current!=null&&d.current.focus()};io(()=>{let h=d.current,x=c.current;if(a&&h!==null&&x!==null){let{left:b,top:T}=h.getBoundingClientRect(),E=window.scrollY||document.documentElement.scrollTop;x.style.top=`${T+E+h.offsetHeight+5}px`,x.style.left=`${Math.min(b-5,window.innerWidth-x.offsetWidth-20)}px`}},[c,d,a]),io(()=>{let h=d.current;if(h!==null&&a){let x=b=>{let T=b.target;C0(T)&&(u&&c.current&&c.current.contains(T)||h.contains(T)||p(!1))};return document.addEventListener("click",x),()=>{document.removeEventListener("click",x)}}},[c,d,a,u]);let f=k0(Le(_0,{dropDownRef:c,itemsContainerClassNames:i,onClose:m,children:o}),document.body);return as(lo.Fragment,{children:[as("button",{"aria-label":t,className:e+(a?" active":""),"data-dropdown-key":n,disabled:r,onClick:h=>{h.preventDefault(),p(!a)},onMouseDown:h=>{h.preventDefault()},ref:d,type:"button",children:[l&&Le(l,{}),s&&Le("span",{className:"toolbar-popup__dropdown-label",children:s}),Le("i",{className:"toolbar-popup__dropdown-caret"})]}),a&&Le(lo.Fragment,{children:f})]})}var hr="toolbar-popup__dropdown",R0=t=>{let e=T0(14),{active:o,anchorElem:r,editor:n,enabled:l,item:i}=t,{i18n:s}=y0(),{fieldProps:u}=H(),{featureClientSchemaMap:c,schemaPath:d}=u;if(i.Component){let p;return e[0]!==o||e[1]!==r||e[2]!==n||e[3]!==l||e[4]!==i?(p=i?.Component&&qe(i.Component,{active:o,anchorElem:r,editor:n,enabled:l,item:i},i.key),e[0]=o,e[1]=r,e[2]=n,e[3]=l,e[4]=i,e[5]=p):p=e[5],p}let a;if(e[6]!==o||e[7]!==n||e[8]!==l||e[9]!==c||e[10]!==s||e[11]!==i||e[12]!==d){let p=i.key,m;i.label&&(p=typeof i.label=="function"?i.label({featureClientSchemaMap:c,i18n:s,schemaPath:d}):i.label),p.length>25?m=p.substring(0,25)+"...":m=p,a=qe(ms,{active:o,editor:n,enabled:l,Icon:i?.ChildComponent?qe(i.ChildComponent,{}):void 0,item:i,itemKey:i.key,tooltip:p,children:qe("span",{className:"text",children:m})},i.key),e[6]=o,e[7]=n,e[8]=l,e[9]=c,e[10]=s,e[11]=i,e[12]=d,e[13]=a}else a=e[13];return a},v0=fs.memo(R0),Pe=({anchorElem:t,classNames:e,editor:o,group:r,Icon:n,itemsContainerClassNames:l,label:i,maxActiveItems:s,onActiveChange:u})=>{let[c,d]=fs.useState({activeItemKeys:[],enabledGroup:!0,enabledItemKeys:[]}),a=E0(c),p=H(),{items:m,key:f}=r,h=Ft(),x=w0(()=>{o.getEditorState().read(()=>{let T=I0();if(!T)return;let E=[],C=[],k=[];for(let g of m)g.isActive&&(!s||E.length<s)&&g.isActive({editor:o,editorConfigContext:p,selection:T})&&(E.push(g.key),C.push(g)),g.isEnabled?g.isEnabled({editor:o,editorConfigContext:p,selection:T})&&k.push(g.key):k.push(g.key);d({activeItemKeys:E,enabledGroup:r.isEnabled?r.isEnabled({editor:o,editorConfigContext:p,selection:T}):!0,enabledItemKeys:k}),u&&u({activeItems:C})})},[o,p,r,m,s,u]);S0(()=>(h(x),L0(o.registerUpdateListener(async()=>{await h(x)}))),[o,h,x]);let b=N0(()=>m?.length?m.map(T=>qe(v0,{active:a.activeItemKeys.includes(T.key),anchorElem:t,editor:o,enabled:a.enabledItemKeys.includes(T.key),item:T},T.key)):null,[m,a,t,o]);return qe(ps,{buttonAriaLabel:`${f} dropdown`,buttonClassName:[hr,`${hr}-${f}`,...e||[]].filter(Boolean).join(" "),disabled:!a.enabledGroup,dropdownKey:f,Icon:n,itemsContainerClassNames:[`${hr}-items`,...l||[]],label:i,children:b},f)};function P0({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&ie(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?ie(Nt,{editor:e,item:o,children:ie(o.ChildComponent,{})},o.key):null}function B0(t){let e=hs(23),{anchorElem:o,editor:r,editorConfig:n,group:l,index:i}=t,{i18n:s}=F0(),{fieldProps:u}=H(),{featureClientSchemaMap:c,schemaPath:d}=u,[a,p]=_e.useState(void 0),[m,f]=_e.useState(void 0),h;e[0]!==l.ChildComponent||e[1]!==l.items||e[2]!==l.type?(h=()=>{l?.type==="dropdown"&&l.items.length&&l.ChildComponent?f(()=>l.ChildComponent):f(void 0)},e[0]=l.ChildComponent,e[1]=l.items,e[2]=l.type,e[3]=h):h=e[3];let x;e[4]!==l?(x=[l],e[4]=l,e[5]=x):x=e[5],_e.useEffect(h,x);let b;e[6]!==c||e[7]!==l.ChildComponent||e[8]!==l.items||e[9]!==l.type||e[10]!==s||e[11]!==d?(b=k=>{let{activeItems:g}=k;if(!g.length){l?.type==="dropdown"&&l.items.length&&l.ChildComponent?(f(()=>l.ChildComponent),p(void 0)):(f(void 0),p(void 0));return}let w=g[0],L=w.key;w.label&&(L=typeof w.label=="function"?w.label({featureClientSchemaMap:c,i18n:s,schemaPath:d}):w.label),L.length>25&&(L=L.substring(0,25)+"..."),g.length===1?(p(L),f(()=>w.ChildComponent)):(p(s.t("lexical:general:toolbarItemsActive",{count:g.length})),l?.type==="dropdown"&&l.items.length&&l.ChildComponent?f(()=>l.ChildComponent):f(void 0))},e[6]=c,e[7]=l.ChildComponent,e[8]=l.items,e[9]=l.type,e[10]=s,e[11]=d,e[12]=b):b=e[12];let T=b,E=`fixed-toolbar__group fixed-toolbar__group-${l.key}`,C;return e[13]!==m||e[14]!==o||e[15]!==a||e[16]!==r||e[17]!==n.features.toolbarFixed?.groups.length||e[18]!==l||e[19]!==i||e[20]!==T||e[21]!==E?(C=M0("div",{className:E,"data-toolbar-group-key":l.key,children:[l.type==="dropdown"&&l.items.length?m?ie(Pe,{anchorElem:o,editor:r,group:l,Icon:m,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:l.maxActiveItems??1,onActiveChange:T}):ie(Pe,{anchorElem:o,editor:r,group:l,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:l.maxActiveItems??1,onActiveChange:T}):null,l.type==="buttons"&&l.items.length?l.items.map(k=>ie(P0,{anchorElem:o,editor:r,item:k},k.key)):null,i<n.features.toolbarFixed?.groups.length-1&&ie("div",{className:"divider"})]},l.key),e[13]=m,e[14]=o,e[15]=a,e[16]=r,e[17]=n.features.toolbarFixed?.groups.length,e[18]=l,e[19]=i,e[20]=T,e[21]=E,e[22]=C):C=e[22],C}function H0({anchorElem:t,clientProps:e,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let l=_e.useRef(null),{y:i}=A0(),s=$0(()=>{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 O0(()=>{if(!s)return;let u=l.current;if(!u)return;let c=u.getBoundingClientRect(),d=s.getBoundingClientRect();if(!(c.bottom<d.top||c.top>d.bottom))u.classList.remove("fixed-toolbar"),u.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),s.classList.remove("fixed-toolbar"),s.classList.add("fixed-toolbar","fixed-toolbar--hide");else{if(!u.classList.contains("fixed-toolbar--overlapping"))return;u.classList.remove("fixed-toolbar--overlapping"),u.classList.add("fixed-toolbar"),s.classList.remove("fixed-toolbar--hide"),s.classList.add("fixed-toolbar")}},50,[l,s,i]),ie("div",{className:"fixed-toolbar",onFocus:u=>{u.stopPropagation()},ref:l,children:o.isEditable()&&ie(_e.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((u,c)=>ie(B0,{anchorElem:t,editor:o,editorConfig:r,group:u,index:c},u.key))})})}var gs=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return gs(t.parentEditor)}return!1},xs=t=>{let e=hs(6),{clientProps:o}=t,[r]=D0(),n=H(),{editorConfig:l}=n,i=o.applyToFocusedEditor&&n.focusedEditor?.editor||r,s=o.applyToFocusedEditor&&n.focusedEditor?.editorConfig||l,u,c;if(e[0]!==o.disableIfParentHasFixedToolbar||e[1]!==i||e[2]!==s||e[3]!==n){c=Symbol.for("react.early_return_sentinel");e:{let d=gs(n);if(o?.disableIfParentHasFixedToolbar&&d){c=null;break e}if(!s?.features?.toolbarFixed?.groups?.length){c=null;break e}u=ie(H0,{anchorElem:document.body,editor:i,editorConfig:s,parentWithFixedToolbar:d})}e[0]=o.disableIfParentHasFixedToolbar,e[1]=i,e[2]=s,e[3]=n,e[4]=u,e[5]=c}else u=e[4],c=e[5];return c!==Symbol.for("react.early_return_sentinel")?c:u};var j0=v({plugins:[{Component:xs,position:"aboveContainer"}]});import{c as ks}from"react/compiler-runtime";import{jsx as ue,jsxs as _s}from"react/jsx-runtime";import{useLexicalComposerContext as U0}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Ts}from"@lexical/utils";import{$getSelection as ws,$isRangeSelection as Cs,$isTextNode as G0,COMMAND_PRIORITY_LOW as W0,getDOMSelection as Es,SELECTION_CHANGE_COMMAND as V0}from"lexical";import{useCallback as ao,useEffect as Lt,useRef as bs,useState as K0}from"react";import*as co from"react";import{createPortal as J0}from"react-dom";function gr(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 so(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:r=0,floatingElem:n,horizontalOffset:l=32,horizontalPosition:i="left",specialHandlingForCaret:s=!1,targetRect:u,verticalGap:c=10}=t,d=o.parentElement;if(u===null||d==null){n.style.opacity="0",n.style.transform="translate(-10000px, -10000px)";return}let a=n.getBoundingClientRect(),p=o.getBoundingClientRect(),m=d.getBoundingClientRect(),f=u.top-a.height-c,h=u.left-l;i==="center"&&(h=u.left+u.width/2-a.width/2);let x=0;return!e&&f<m.top&&!s&&(x=a.height+u.height+c*2,f+=x),i==="center"?h+a.width>m.right?h=m.right-a.width-l:h<m.left&&(h=m.left+l):h+a.width>m.right&&(h=m.right-a.width-l),h-=p.left,n.style.opacity="1",s&&r!==0?(f-=p.bottom-r+a.height-3,n.style.transform=`translate(${h}px, ${f}px) rotate(180deg)`):(f-=p.top,n.style.transform=`translate(${h}px, ${f}px)`),x}function X0({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&ue(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?ue(Nt,{editor:e,item:o,children:ue(o.ChildComponent,{})},o.key):null}function z0(t){let e=ks(19),{anchorElem:o,editor:r,group:n,index:l}=t,{editorConfig:i}=H(),[s,u]=co.useState(),c;e[0]!==n.ChildComponent||e[1]!==n.items||e[2]!==n.type?(c=()=>{n?.type==="dropdown"&&n.items.length&&n.ChildComponent?u(()=>n.ChildComponent):u(void 0)},e[0]=n.ChildComponent,e[1]=n.items,e[2]=n.type,e[3]=c):c=e[3];let d;e[4]!==n?(d=[n],e[4]=n,e[5]=d):d=e[5],co.useEffect(c,d);let a;e[6]!==n.ChildComponent||e[7]!==n.items||e[8]!==n.type?(a=h=>{let{activeItems:x}=h;if(!x.length){n?.type==="dropdown"&&n.items.length&&n.ChildComponent?u(()=>n.ChildComponent):u(void 0);return}let b=x[0];u(()=>b?.ChildComponent)},e[6]=n.ChildComponent,e[7]=n.items,e[8]=n.type,e[9]=a):a=e[9];let p=a,m=`inline-toolbar-popup__group inline-toolbar-popup__group-${n.key}`,f;return e[10]!==s||e[11]!==o||e[12]!==r||e[13]!==i.features.toolbarInline?.groups.length||e[14]!==n||e[15]!==l||e[16]!==p||e[17]!==m?(f=_s("div",{className:m,"data-toolbar-group-key":n.key,children:[n.type==="dropdown"&&n.items.length?s?ue(Pe,{anchorElem:o,editor:r,group:n,Icon:s,maxActiveItems:n.maxActiveItems??1,onActiveChange:p}):ue(Pe,{anchorElem:o,editor:r,group:n,maxActiveItems:n.maxActiveItems??1,onActiveChange:p}):null,n.type==="buttons"&&n.items.length?n.items.map(h=>ue(X0,{anchorElem:o,editor:r,item:h},h.key)):null,l<i.features.toolbarInline?.groups.length-1&&ue("div",{className:"divider"})]},n.key),e[10]=s,e[11]=o,e[12]=r,e[13]=i.features.toolbarInline?.groups.length,e[14]=n,e[15]=l,e[16]=p,e[17]=m,e[18]=f):f=e[18],f}function Z0({anchorElem:t,editor:e}){let o=bs(null),r=bs(null),{editorConfig:n}=H(),l=ao(()=>{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]),i=ao(c=>{if(o?.current&&(c.buttons===1||c.buttons===3)){let d=o.current.style.opacity==="0",a=o.current.style.pointerEvents==="none";if(!d||!a){let p=c.clientX,m=c.clientY,f=document.elementFromPoint(p,m);o.current.contains(f)||l()}}},[l]),s=ao(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);Lt(()=>(document.addEventListener("mousemove",i),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",s)}),[o,i,s]);let u=ao(()=>{let c=ws(),d=Es(e._window);if(o.current===null)return;let a=t.querySelector(":scope > .link-editor"),p=a!==null&&"style"in a&&a?.style?.opacity==="1",m=e.getRootElement();if(c!==null&&d!==null&&!d.isCollapsed&&m!==null&&m.contains(d.anchorNode)){let f=gr(d,m),h=so({alwaysDisplayOnTop:p,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});r.current&&so({anchorElem:o.current,anchorFlippedOffset:h,floatingElem:r.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else l()},[e,l,t]);return Lt(()=>{let c=t.parentElement,d=()=>{e.getEditorState().read(()=>{u()})};return window.addEventListener("resize",d),c&&c.addEventListener("scroll",d),()=>{window.removeEventListener("resize",d),c&&c.removeEventListener("scroll",d)}},[e,u,t]),Lt(()=>(e.getEditorState().read(()=>{u()}),Ts(e.registerUpdateListener(({editorState:c})=>{c.read(()=>{u()})}),e.registerCommand(V0,()=>(u(),!1),W0))),[e,u]),_s("div",{className:"inline-toolbar-popup",ref:o,children:[ue("div",{className:"caret",ref:r}),n?.features&&n.features?.toolbarInline?.groups.map((c,d)=>ue(z0,{anchorElem:t,editor:e,group:c,index:d},c.key))]})}function Y0(t,e){let o=ks(12),[r,n]=K0(!1),l;o[0]!==t?(l=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let p=ws(),m=Es(t._window),f=t.getRootElement();if(m!==null&&(!Cs(p)||f===null||!f.contains(m.anchorNode))){n(!1);return}if(!Cs(p))return;if(p.getTextContent()!==""){let x=p.getNodes(),b=!1;for(let T of x)if(G0(T)){n(!0),b=!0;break}b||n(!1)}else n(!1);let h=p.getTextContent().replace(/\n/g,"");if(!p.isCollapsed()&&h===""){n(!1);return}})},o[0]=t,o[1]=l):l=o[1];let i=l,s,u;o[2]!==i?(s=()=>(document.addEventListener("selectionchange",i),document.addEventListener("mouseup",i),()=>{document.removeEventListener("selectionchange",i),document.removeEventListener("mouseup",i)}),u=[i],o[2]=i,o[3]=s,o[4]=u):(s=o[3],u=o[4]),Lt(s,u);let c,d;if(o[5]!==t||o[6]!==i?(c=()=>Ts(t.registerUpdateListener(()=>{i()}),t.registerRootListener(()=>{t.getRootElement()===null&&n(!1)})),d=[t,i],o[5]=t,o[6]=i,o[7]=c,o[8]=d):(c=o[7],d=o[8]),Lt(c,d),!r||!t.isEditable())return null;let a;return o[9]!==e||o[10]!==t?(a=J0(ue(Z0,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=a):a=o[11],a}var Ss=t=>{let{anchorElem:e}=t,[o]=U0();return Y0(o,e)};var q0=v({plugins:[{Component:Ss,position:"floatingAnchorElem"}]});import{TableCellNode as Hh,TableNode as jh,TableRowNode as Uh}from"@lexical/table";import{jsx as Ns}from"react/jsx-runtime";import"react";var xr=()=>Ns("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Ns("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 Q0,$createTableNode as e1,$createTableRowNode as t1,$isTableCellNode as Ls,$isTableNode as Cr,$isTableRowNode as br,TableCellHeaderStates as uo,TableCellNode as o1,TableNode as r1,TableRowNode as n1}from"@lexical/table";import{$isParagraphNode as l1,$isTextNode as i1}from"lexical";var Is=/^\|(.+)\|\s?$/,s1=/^(\| ?:?-*:? ?)+\|\s?$/,Rs=({allTransformers:t})=>({type:"element",dependencies:[r1,n1,o1],export:e=>{if(!Cr(e))return null;let o=[];for(let r of e.getChildren()){let n=[];if(!br(r))continue;let l=!1;for(let i of r.getChildren())Ls(i)&&(n.push(Ur(t,i).replace(/\n/g,"\\n").trim()),i.__headerState===uo.ROW&&(l=!0));o.push(`| ${n.join(" | ")} |`),l&&o.push(`| ${n.map(i=>"---").join(" | ")} |`)}return o.join(`
|
|
39
|
+
`)},regExp:Is,replace:(e,o,r)=>{let n=r[0];if(!n)return;if(s1.test(n)){let a=e.getPreviousSibling();if(!a||!Cr(a))return;let p=a.getChildren(),m=p[p.length-1];if(!m||!br(m))return;m.getChildren().forEach(f=>{Ls(f)&&f.setHeaderStyles(uo.ROW,uo.ROW)}),e.remove();return}let l=ys(n,t);if(l==null)return;let i=[l],s=e.getPreviousSibling(),u=l.length;for(;s&&!(!l1(s)||s.getChildrenSize()!==1);){let a=s.getFirstChild();if(!i1(a))break;let p=ys(a.getTextContent(),t);if(p==null)break;u=Math.max(u,p.length),i.unshift(p);let m=s.getPreviousSibling();s.remove(),s=m}let c=e1();for(let a of i){let p=t1();c.append(p);for(let m=0;m<u;m++)p.append(m<a.length?a[m]:vs("",t))}let d=e.getPreviousSibling();Cr(d)&&a1(d)===u?(d.append(...c.getChildren()),e.remove()):e.replace(c),c.selectEnd()}});function a1(t){let e=t.getFirstChild();return br(e)?e.getChildrenSize():0}var vs=(t,e)=>{t=t.replace(/\\n/g,`
|
|
40
|
+
`);let o=Q0(uo.NO_STATUS);return jr(t,e,o),o},ys=(t,e)=>{let o=t.match(Is);return!o||!o[1]?null:o[1].split("|").map(r=>vs(r,e))};import{c as u1}from"react/compiler-runtime";import{jsx as P,jsxs as Te}from"react/jsx-runtime";import{useLexicalComposerContext as Fs}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as d1}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as Ds,$deleteTableColumnAtSelection as m1,$deleteTableRowAtSelection as p1,$getNodeTriplet as f1,$getTableCellNodeFromLexicalNode as As,$getTableColumnIndexFromTableCellNode as h1,$getTableNodeFromLexicalNodeOrThrow as Ie,$getTableRowIndexFromTableCellNode as g1,$insertTableColumnAtSelection as x1,$insertTableRowAtSelection as C1,$isTableCellNode as $s,$isTableSelection as yt,$mergeCells as b1,$unmergeCell as k1,getTableElement as _r,getTableObserverFromTableElement as Tr,TableCellHeaderStates as ye,TableCellNode as _1}from"@lexical/table";import{mergeRegister as T1}from"@lexical/utils";import{useScrollInfo as w1}from"@payloadcms/ui";import{$getSelection as po,$isElementNode as E1,$isRangeSelection as wr,$isTextNode as S1,$setSelection as N1,COMMAND_PRIORITY_CRITICAL as L1,getDOMSelection as y1,isDOMNode as I1,SELECTION_CHANGE_COMMAND as R1}from"lexical";import*as Er from"react";import{useCallback as se,useEffect as Qe,useRef as mo,useState as et}from"react";import{createPortal as Ps}from"react-dom";import{jsx as kr,jsxs as c1}from"react/jsx-runtime";import"react";var Ms=()=>c1("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[kr("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"}),kr("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"}),kr("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 Os(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function v1(){let t=po();if(wr(t)&&!t.isCollapsed()||yt(t)&&!t.anchor.is(t.focus)||!wr(t)&&!yt(t))return!1;let[e]=f1(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function M1(t){let e=t.getLastDescendant();S1(e)?e.select():E1(e)?e.selectEnd():e!==null&&e.selectNext()}function D1({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[l]=Fs(),i=mo(null),[s,u]=et(n),[c,d]=et({columns:1,rows:1}),[a,p]=et(!1),[m,f]=et(!1),{y:h}=w1();Qe(()=>l.registerMutationListener(_1,_=>{_.get(s.getKey())==="updated"&&l.getEditorState().read(()=>{u(s.getLatest())})},{skipInitialization:!0}),[l,s]),Qe(()=>{l.getEditorState().read(()=>{let _=po();if(yt(_)){let N=Os(_);d(Os(_)),p(N.columns>1||N.rows>1)}f(v1())})},[l]),Qe(()=>{let _=e.current,N=i.current,M=l.getRootElement();if(_!=null&&N!=null&&M!=null){let I=M.getBoundingClientRect(),A=_.getBoundingClientRect();N.style.opacity="1";let y=N.getBoundingClientRect(),$=5,G=A.right+$;if(G+y.width>window.innerWidth||G+y.width>I.right){let te=A.left-y.width-$;G=(te<0?$:te)+window.pageXOffset}N.style.left=`${G+window.pageXOffset}px`;let q=A.top;if(q+y.height>window.innerHeight){let te=A.bottom-y.height;q=te<0?$:te}N.style.top=`${q}px`}},[e,i,l,h]),Qe(()=>{function _(N){i.current!=null&&e.current!=null&&I1(N.target)&&!i.current.contains(N.target)&&!e.current.contains(N.target)&&r(!1)}return window.addEventListener("click",_),()=>window.removeEventListener("click",_)},[r,e]);let x=se(()=>{l.update(()=>{if(s.isAttached()){let _=Ie(s),N=_r(_,l.getElementByKey(_.getKey()));if(N===null)throw new Error("Expected to find tableElement in DOM");let M=Tr(N);M!==null&&M.$clearHighlight(),_.markDirty(),u(s.getLatest())}N1(null)})},[l,s]),b=()=>{l.update(()=>{let _=po();if(!yt(_))return;let M=_.getNodes().filter($s),I=b1(M);I&&(M1(I),o())})},T=()=>{l.update(()=>{k1()})},E=se(_=>{l.update(()=>{for(let N=0;N<c.rows;N++)C1(_);o()})},[l,o,c.rows]),C=se(_=>{l.update(()=>{for(let N=0;N<c.columns;N++)x1(_);o()})},[l,o,c.columns]),k=se(()=>{l.update(()=>{p1(),o()})},[l,o]),g=se(()=>{l.update(()=>{Ie(s).remove(),x(),o()})},[l,s,x,o]),w=se(()=>{l.update(()=>{m1(),o()})},[l,o]),L=se(()=>{l.update(()=>{let _=Ie(s),N=g1(s),[M]=Ds(_,null,null),I=new Set,A=s.getHeaderStyles()^ye.ROW;if(M[N])for(let y=0;y<M[N].length;y++){let $=M[N][y];$?.cell&&(I.has($.cell)||(I.add($.cell),$.cell.setHeaderStyles(A,ye.ROW)))}x(),o()})},[l,s,x,o]),D=se(()=>{l.update(()=>{let _=Ie(s),N=h1(s),[M]=Ds(_,null,null),I=new Set,A=s.getHeaderStyles()^ye.COLUMN;if(M)for(let y=0;y<M.length;y++){let $=M?.[y]?.[N];$?.cell&&(I.has($.cell)||(I.add($.cell),$.cell.setHeaderStyles(A,ye.COLUMN)))}x(),o()})},[l,s,x,o]),F=se(()=>{l.update(()=>{if(s.isAttached()){let _=Ie(s);_&&_.setRowStriping(!_.getRowStriping())}x(),o()})},[l,s,x,o]),R=se(()=>{l.update(()=>{if(s.isAttached()){let _=Ie(s);_&&_.setFrozenColumns(_.getFrozenColumns()===0?1:0)}x(),o()})},[l,s,x,o]),S=null;return t&&(a?S=P("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>b(),type:"button",children:P("span",{className:"text",children:"Merge cells"})}):m&&(S=P("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>T(),type:"button",children:P("span",{className:"text",children:"Unmerge cells"})}))),Ps(Te("div",{className:"table-action-menu-dropdown",onClick:_=>{_.stopPropagation()},ref:i,children:[S?Te(Er.Fragment,{children:[S,P("hr",{})]}):null,P("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>F(),type:"button",children:P("span",{className:"text",children:"Toggle Row Striping"})}),P("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>R(),type:"button",children:P("span",{className:"text",children:"Toggle First Column Freeze"})}),P("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>E(!1),type:"button",children:Te("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," above"]})}),P("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>E(!0),type:"button",children:Te("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," below"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>C(!1),type:"button",children:Te("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","left"]})}),P("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>C(!0),type:"button",children:Te("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","right"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>w(),type:"button",children:P("span",{className:"text",children:"Delete column"})}),P("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>k(),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","data-test-id":"table-row-header",onClick:()=>L(),type:"button",children:Te("span",{className:"text",children:[(s.__headerState&ye.ROW)===ye.ROW?"Remove":"Add"," ","row header"]})}),P("button",{className:"item","data-test-id":"table-column-header",onClick:()=>D(),type:"button",children:Te("span",{className:"text",children:[(s.__headerState&ye.COLUMN)===ye.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function A1({anchorElem:t,cellMerge:e}){let[o]=Fs(),r=mo(null),n=mo(null),[l,i]=et(!1),[s,u]=et(null),c=se(()=>{let a=r.current,p=po(),m=y1(o._window),f=document.activeElement;function h(){a&&(a.classList.remove("table-cell-action-button-container--active"),a.classList.add("table-cell-action-button-container--inactive")),u(null)}if(p==null||a==null)return h();let x=o.getRootElement(),b=null,T=null;if(wr(p)&&x!==null&&m!==null&&x.contains(m.anchorNode)){let C=As(p.anchor.getNode());if(C==null||(T=o.getElementByKey(C.getKey()),T==null||!C.isAttached()))return h();let k=Ie(C),g=_r(k,o.getElementByKey(k.getKey()));if(g===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");b=Tr(g),u(C)}else if(yt(p)){let C=As(p.anchor.getNode());if(!$s(C))throw new Error("TableSelection anchorNode must be a TableCellNode");let k=Ie(C),g=_r(k,o.getElementByKey(k.getKey()));if(g===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");b=Tr(g),T=o.getElementByKey(C.getKey())}else if(!f)return h();if(b===null||T===null)return h();let E=!b||!b.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",E),a.classList.toggle("table-cell-action-button-container--inactive",!E),E){let C=T.getBoundingClientRect(),k=t.getBoundingClientRect(),g=C.top-k.top,w=C.right-k.left;a.style.transform=`translate(${w}px, ${g}px)`}},[o,t]);Qe(()=>{let a,p=()=>{a=void 0,o.getEditorState().read(c)},m=()=>(a===void 0&&(a=setTimeout(p,0)),!1);return T1(o.registerUpdateListener(m),o.registerCommand(R1,m,L1),o.registerRootListener((f,h)=>{h&&h.removeEventListener("pointerup",m),f&&(f.addEventListener("pointerup",m),m())}),()=>clearTimeout(a))});let d=mo(s);return Qe(()=>{d.current!==s&&i(!1),d.current=s},[d,s]),P("div",{className:"table-cell-action-button-container",ref:r,children:s!=null&&Te(Er.Fragment,{children:[P("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),i(!l)},ref:n,type:"button",children:P(Ms,{})}),l&&P(D1,{cellMerge:e,contextRef:n,onClose:()=>i(!1),setIsMenuOpen:i,tableCellNode:s})]})})}var Bs=t=>{let e=u1(3),{anchorElem:o}=t,r=d1(),n;return e[0]!==o||e[1]!==r?(n=Ps(r?P(A1,{anchorElem:o??document.body,cellMerge:!0}):null,o??document.body),e[0]=o,e[1]=r,e[2]=n):n=e[2],n};import{c as O1}from"react/compiler-runtime";import{jsx as ho,jsxs as F1}from"react/jsx-runtime";import{useLexicalComposerContext as $1}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as P1}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as B1,$getTableNodeFromLexicalNodeOrThrow as Sr,$getTableRowIndexFromTableCellNode as H1,$isTableCellNode as Hs,$isTableRowNode as j1,getDOMCellFromTarget as U1,getTableElement as G1,TableNode as js}from"@lexical/table";import{calculateZoomLevel as Us,mergeRegister as W1}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Nr,isHTMLElement as V1,SKIP_SCROLL_INTO_VIEW_TAG as Gs}from"lexical";import*as Vs from"react";import{useCallback as It,useEffect as Lr,useRef as fo,useState as tt}from"react";import{createPortal as K1}from"react-dom";var J1=33,Ws=92;function X1({editor:t}){let e=fo(null),o=fo(null),r=fo(null),[n,l]=tt(!1),i=H(),s=fo(null),[u,c]=tt(null),[d,a]=tt(null),[p,m]=tt(!1),[f,h]=tt(null),x=It(()=>{a(null),e.current=null,h(null),s.current=null,r.current=null},[]),b=R=>(R.buttons&1)===1;Lr(()=>{let R=new Set;return W1(t.registerMutationListener(js,S=>{for(let[_,N]of S)N==="destroyed"?R.delete(_):R.add(_);l(R.size>0)}),t.registerNodeTransform(js,S=>{if(S.getColWidths())return S;let _=S.getColumnCount(),N=Ws;return S.setColWidths(Array(_).fill(N)),S}))},[t]),Lr(()=>{if(!n)return;let R=M=>{let I=M.target;if(V1(I)){if(f){c({x:M.clientX,y:M.clientY});return}if(m(b(M)),!(o.current&&o.current.contains(I))&&e.current!==I){e.current=I;let A=U1(I);A&&d!==A?t.getEditorState().read(()=>{let y=Nr(A.elem);if(!y)throw new Error("TableCellResizer: Table cell node not found.");let $=Sr(y),G=G1($,t.getElementByKey($.getKey()));if(!G)throw new Error("TableCellResizer: Table element not found.");e.current=I,r.current=G.getBoundingClientRect(),a(A)},{editor:t}):A==null&&x()}}},S=M=>{m(!0)},_=M=>{m(!1)},N=t.registerRootListener((M,I)=>{I?.removeEventListener("mousemove",R),I?.removeEventListener("mousedown",S),I?.removeEventListener("mouseup",_),M?.addEventListener("mousemove",R),M?.addEventListener("mousedown",S),M?.addEventListener("mouseup",_)});return()=>{N()}},[d,f,t,n,x]);let T=R=>R==="bottom",E=It(R=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let S=Nr(d.elem);if(!Hs(S))throw new Error("TableCellResizer: Table cell node not found.");let _=Sr(S),N=H1(S),M=_.getChildren(),A=S.getColSpan()===_.getColumnCount()?N:N+S.getRowSpan()-1;if(A>=M.length||A<0)throw new Error("Expected table cell to be inside of table row.");let y=M[A];if(!j1(y))throw new Error("Expected table row");let $=y.getHeight();if($===void 0){let q=y.getChildren();$=Math.min(...q.map(te=>C(te,t)??1/0))}let G=Math.max($+R,J1);y.setHeight(G)},{tag:Gs})},[d,t]),C=(R,S)=>S.getElementByKey(R.getKey())?.clientHeight,k=(R,S)=>{let _;return S.forEach(N=>{N.forEach((M,I)=>{M.cell===R&&(_=I)})}),_},g=It(R=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let S=Nr(d.elem);if(!Hs(S))throw new Error("TableCellResizer: Table cell node not found.");let _=Sr(S),[N]=B1(_,null,null),M=k(S,N);if(M===void 0)throw new Error("TableCellResizer: Table column not found.");let I=_.getColWidths();if(!I)return;let A=I[M];if(A===void 0)return;let y=[...I],$=Math.max(A+R,Ws);y[M]=$,_.setColWidths(y)},{tag:Gs})},[d,t]),w=It(R=>{let S=_=>{if(_.preventDefault(),_.stopPropagation(),!d)throw new Error("TableCellResizer: Expected active cell.");if(s.current){let{x:N,y:M}=s.current;if(d===null)return;let I=Us(_.target);if(T(R)){let A=(_.clientY-M)/I;E(A)}else{let A=(_.clientX-N)/I;g(A)}x(),document.removeEventListener("mouseup",S)}};return S},[d,x,g,E]),L=It(R=>S=>{if(S.preventDefault(),S.stopPropagation(),!d)throw new Error("TableCellResizer: Expected active cell.");s.current={x:S.clientX,y:S.clientY},c(s.current),h(R),document.addEventListener("mouseup",w(R))},[d,w]),[D,F]=tt({bottom:null,left:null,right:null,top:null});return Lr(()=>{if(d){let{height:R,left:S,top:_,width:N}=d.elem.getBoundingClientRect(),M=Us(d.elem),I=10,A={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${I}px`,left:`${window.scrollX+S}px`,top:`${window.scrollY+_+R-I/2}px`,width:`${N}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${R}px`,left:`${window.scrollX+S+N-I/2}px`,top:`${window.scrollY+_}px`,width:`${I}px`}},y=r.current;f&&u&&y&&(T(f)?(A[f].left=`${window.scrollX+y.left}px`,A[f].top=`${window.scrollY+u.y/M}px`,A[f].height="3px",A[f].width=`${y.width}px`):(A[f].top=`${window.scrollY+y.top}px`,A[f].left=`${window.scrollX+u.x/M}px`,A[f].width="3px",A[f].height=`${y.height}px`),A[f].backgroundColor="#adf"),F(A)}else F({bottom:null,left:null,right:null,top:null})},[d,f,u]),ho("div",{ref:o,children:d!=null&&!p&&F1(Vs.Fragment,{children:[ho("div",{className:`${i.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:L("right"),style:D.right||void 0}),ho("div",{className:`${i.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:L("bottom"),style:D.bottom||void 0})]})})}var Ks=()=>{let t=O1(3),[e]=$1(),o=P1(),r;return t[0]!==e||t[1]!==o?(r=o?K1(ho(X1,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=r):r=t[2],r};import{c as oh}from"react/compiler-runtime";import{jsx as yr,jsxs as rh,Fragment as nh}from"react/jsx-runtime";import{useLexicalComposerContext as ea}from"@lexical/react/LexicalComposerContext";import{$getTableAndElementByKey as lh,$getTableColumnIndexFromTableCellNode as ih,$getTableRowIndexFromTableCellNode as sh,$insertTableColumnAtSelection as ah,$insertTableRowAtSelection as ch,$isTableCellNode as uh,$isTableNode as zs,getTableElement as dh,TableNode as mh}from"@lexical/table";import{$findMatchingParent as ph,mergeRegister as fh}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Zs,isHTMLElement as hh}from"lexical";import{useEffect as Ys,useMemo as gh,useRef as qs,useState as go}from"react";import"react";import{createPortal as xh}from"react-dom";import{c as Q1}from"react/compiler-runtime";import{useEffect as eh,useRef as th}from"react";var z1="Expected a function",Z1=Math.max,Y1=Math.min;function q1(t,e,o){let r,n,l=0,i,s=!1,u=!1,c,d,a,p=!0;if(typeof t!="function")throw new TypeError(z1);e=e||0,typeof o=="object"&&(s=!!o.leading,u="maxWait"in o,c=u?Z1(o.maxWait||0,e):c,p="trailing"in o?!!o.trailing:p);function m(g){let w=r,L=i;return r=i=void 0,l=g,d=t.apply(L,w),d}function f(g){return l=g,a=setTimeout(b,e),s?m(g):d}function h(g){let w=g-n,L=g-l,D=e-w;return u?Y1(D,c-L):D}function x(g){let w=g-n,L=g-l;return n===void 0||w>=e||w<0||u&&L>=c}function b(){let g=Date.now();if(x(g))return T(g);a=setTimeout(b,h(g))}function T(g){return a=void 0,p&&r?m(g):(r=i=void 0,d)}function E(){a!==void 0&&clearTimeout(a),l=0,r=n=i=a=void 0}function C(){return a===void 0?d:T(Date.now())}function k(){let g=Date.now(),w=x(g);if(r=arguments,i=this,n=g,w){if(a===void 0)return f(n);if(u)return clearTimeout(a),a=setTimeout(b,e),m(n)}return a===void 0&&(a=setTimeout(b,e)),d}return k.cancel=E,k.flush=C,k}var Js=q1;function Xs(t,e,o){let r=Q1(6),n=th(null),l,i;r[0]!==t||r[1]!==o||r[2]!==e?(l=()=>(n.current=Js(t,e,{maxWait:o}),()=>{n.current?.cancel()}),i=[t,e,o],r[0]=t,r[1]=o,r[2]=e,r[3]=l,r[4]=i):(l=r[3],i=r[4]),eh(l,i);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 Qs=20;function Ch({anchorElem:t}){let[e]=ea(),o=H(),[r,n]=go(!1),[l,i]=go(!1),[s,u]=go(!1),[c,d]=go({}),a=qs(new Set),p=qs(null),m=Xs(x=>{let{isOutside:b,tableDOMNode:T}=bh(x,o.editorConfig?.lexical);if(b){n(!1),i(!1);return}if(!T)return;p.current=T;let E=null,C=null,k=null;if(e.getEditorState().read(()=>{let I=Zs(T);if(uh(I)){let A=ph(I,y=>zs(y));if(!zs(A))return;if(k=dh(A,e.getElementByKey(A.getKey())),k){let y=A.getChildrenSize(),$=A.getChildAtIndex(0)?.getChildrenSize(),G=sh(I),q=ih(I);G===y-1?E=I:q===$-1&&(C=I)}}},{editor:e}),!k)return;let g=k.parentElement;if(!g)return;let{bottom:w,height:L,left:D,right:F,width:R,y:S}=k.getBoundingClientRect(),_=!1;g&&g.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(_=g.scrollWidth>g.clientWidth);let{left:N,y:M}=t.getBoundingClientRect();E?(i(!1),n(!0),d({height:Qs,left:_&&g?g.offsetLeft:D-N,top:w-M+5,width:_&&g?g.offsetWidth:R})):C&&(i(!0),n(!1),d({height:L,left:F-N+5,top:S-M,width:Qs}))},50,250),f=gh(()=>new ResizeObserver(()=>{n(!1),i(!1)}),[]);Ys(()=>{if(s)return document.addEventListener("mousemove",m),()=>{n(!1),i(!1),document.removeEventListener("mousemove",m)}},[s,m]),Ys(()=>fh(e.registerMutationListener(mh,x=>{e.getEditorState().read(()=>{let b=!1;for(let[T,E]of x)switch(E){case"created":{a.current.add(T),b=!0;break}case"destroyed":{a.current.delete(T),b=!0;break}default:break}if(b){f.disconnect();for(let T of a.current){let{tableElement:E}=lh(T);f.observe(E)}u(a.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,f]);let h=x=>{e.update(()=>{p.current&&(Zs(p.current)?.selectEnd(),x?(ch(),n(!1)):(ah(),i(!1)))})};return e?.isEditable()?rh(nh,{children:[r&&yr("button",{"aria-label":"Add Row",className:o.editorConfig.lexical.theme.tableAddRows,onClick:()=>h(!0),style:{...c},type:"button"}),l&&yr("button",{"aria-label":"Add Column",className:o.editorConfig.lexical.theme.tableAddColumns,onClick:()=>h(!1),style:{...c},type:"button"})]}):null}function bh(t,e){let o=t.target;if(hh(o)){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 ta(t){let e=oh(2),{anchorElem:o}=t,r=o===void 0?document.body:o,[n]=ea();if(!n?.isEditable())return null;let l;return e[0]!==r?(l=xh(yr(Ch,{anchorElem:r}),r),e[0]=r,e[1]=l):l=e[1],l}import{c as kh}from"react/compiler-runtime";import{jsx as Ir,jsxs as _h}from"react/jsx-runtime";import{useLexicalComposerContext as Th}from"@lexical/react/LexicalComposerContext";import{TablePlugin as wh}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as Eh,TableCellNode as Sh,TableNode as Nh,TableRowNode as Lh}from"@lexical/table";import{mergeRegister as yh}from"@lexical/utils";import{formatDrawerSlug as Ih,useEditDepth as Rh}from"@payloadcms/ui";import{$getSelection as vh,$isRangeSelection as Mh,COMMAND_PRIORITY_EDITOR as Dh,createCommand as Ah}from"lexical";import{createContext as Oh,use as Fh,useEffect as $h,useMemo as Ph,useState as Bh}from"react";import*as oa from"react";var xo=Ah("OPEN_EMBED_DRAWER_COMMAND"),ra=Oh({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function na({children:t}){let[e,o]=Bh({cellEditorConfig:null,cellEditorPlugins:null});return Ir(ra,{value:Ph(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var la=()=>{let t=kh(16),[e]=Th(),o=Fh(ra),r=Rh(),{fieldProps:n,uuid:l}=H(),{schemaPath:i}=n,s="lexical-table-create-"+l,u;t[0]!==r||t[1]!==s?(u=Ih({slug:s,depth:r}),t[0]=r,t[1]=s,t[2]=u):u=t[2];let c=u,{toggleDrawer:d}=me(c,!0),a;t[3]!==e||t[4]!==d?(a=()=>{if(!e.hasNodes([Nh,Lh,Sh]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return yh(e.registerCommand(xo,()=>{let h=null;return e.getEditorState().read(()=>{let x=vh();Mh(x)&&(h=x)}),h&&d(),!0},Dh))},t[3]=e,t[4]=d,t[5]=a):a=t[5];let p;t[6]!==o||t[7]!==e||t[8]!==d?(p=[o,e,d],t[6]=o,t[7]=e,t[8]=d,t[9]=p):p=t[9],$h(a,p);let m;t[10]!==e?(m=(h,x)=>{!x.columns||!x.rows||e.dispatchCommand(Eh,{columns:String(x.columns),rows:String(x.rows)})},t[10]=e,t[11]=m):m=t[11];let f;return t[12]!==c||t[13]!==i||t[14]!==m?(f=_h(oa.Fragment,{children:[Ir(nt,{drawerSlug:c,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:m,schemaPath:i,schemaPathSuffix:"fields"}),Ir(wh,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]}),t[12]=c,t[13]=i,t[14]=m,t[15]=f):f=t[15],f};var Gh=v({markdownTransformers:[Rs],nodes:[jh,Hh,Uh],plugins:[{Component:la,position:"normal"},{Component:Ks,position:"normal"},{Component:Bs,position:"floatingAnchorElem"},{Component:ta,position:"floatingAnchorElem"}],providers:[na],slashMenu:{groups:[Z([{Icon:xr,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(xo,{})}}])]},toolbarFixed:{groups:[he([{ChildComponent:xr,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(xo,{})}}])]}});import{$isNodeSelection as yg}from"lexical";import{jsx as Rr,jsxs as Wh}from"react/jsx-runtime";import"react";var vr=()=>Wh("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:[Rr("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"}),Rr("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"}),Rr("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{jsx as ua}from"react/jsx-runtime";import da from"bson-objectid";import{$applyNodeReplacement as zh}from"lexical";import*as ma from"react";import Vh from"bson-objectid";function Co(t,e){if(t.hasAttribute("data-lexical-pending-upload-form-id")){let r=t.getAttribute("data-lexical-pending-upload-form-id");if(r!=null)return{node:e({data:{pending:{formID:r,src:t.getAttribute("src")||""}}})}}if(t.hasAttribute("data-lexical-upload-relation-to")&&t.hasAttribute("data-lexical-upload-id")){let r=t.getAttribute("data-lexical-upload-id"),n=t.getAttribute("data-lexical-upload-relation-to");if(r!=null&&n!=null)return{node:e({data:{fields:{},relationTo:n,value:r}})}}return{node:e({data:{pending:{formID:new Vh.default().toHexString(),src:t.getAttribute("src")||""}}})}}import{DecoratorBlockNode as Kh}from"@lexical/react/LexicalDecoratorBlockNode.js";import sa from"bson-objectid";import{$applyNodeReplacement as Jh}from"lexical";var Rt=class extends Kh{__data;constructor({data:e,format:o,key:r}){super(o,r),this.__data=e}static clone(e){return new this({data:e.__data,format:e.__format,key:e.__key})}static getType(){return"upload"}static importDOM(){return{img:e=>({conversion:o=>Co(o,ia),priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new sa.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,pending:e.pending,relationTo:e.relationTo,value:e.value},r=ia({data:o});return r.setFormat(e.format),r}static isInline(){return!1}decorate(){return null}exportDOM(){let e=document.createElement("img"),o=this.__data;return o.pending?(e.setAttribute("data-lexical-pending-upload-form-id",String(o?.pending?.formID)),e.setAttribute("src",o?.pending?.src||"")):(e.setAttribute("data-lexical-upload-id",String(o?.value)),e.setAttribute("data-lexical-upload-relation-to",o?.relationTo)),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"upload",version:3}}getData(){return this.getLatest().__data}setData(e){let o=this.getWritable();o.__data=e}updateDOM(){return!1}};function ia({data:t}){return t?.id||(t.id=new sa.default().toHexString()),Jh(new Rt({data:t}))}import{jsx as aa}from"react/jsx-runtime";import{ShimmerEffect as Xh}from"@payloadcms/ui";var ca=()=>aa("div",{className:"lexical-upload",children:aa(Xh,{height:"95px",width:"203px"})});var Zh=ma.lazy(()=>import("./component-VDJI45F2.js").then(t=>({default:t.UploadComponent}))),ne=class extends Rt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{img:e=>({conversion:o=>Co(o,Re),priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new da.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,pending:e.pending,relationTo:e.relationTo,value:e.value},r=Re({data:o});return r.setFormat(e.format),r}decorate(){return this.__data.pending?ua(ca,{}):ua(Zh,{data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Re({data:t}){return t?.id||(t.id=new da.default().toHexString()),zh(new ne({data:t}))}function ot(t){return t instanceof ne}import{c as ng}from"react/compiler-runtime";import{jsx as lg}from"react/jsx-runtime";import{useLexicalComposerContext as ig}from"@lexical/react/LexicalComposerContext.js";import{$dfsIterator as wa,$insertNodeToNearestRoot as Ar,mergeRegister as sg}from"@lexical/utils";import{useBulkUpload as ag,useConfig as cg,useEffectEvent as ug,useModal as dg}from"@payloadcms/ui";import Or from"bson-objectid";import{$createRangeSelection as mg,$getPreviousSelection as Ca,$getSelection as ba,$isParagraphNode as Fr,$isRangeSelection as ka,$setSelection as pg,COMMAND_PRIORITY_EDITOR as fg,COMMAND_PRIORITY_LOW as _a,createCommand as hg,DROP_COMMAND as gg,getDOMSelectionFromTarget as xg,isHTMLElement as Ta,PASTE_COMMAND as Cg}from"lexical";import{useEffect as bg}from"react";import{c as pa}from"react/compiler-runtime";import{jsx as Mr}from"react/jsx-runtime";import{useLexicalComposerContext as fa}from"@lexical/react/LexicalComposerContext.js";import{toast as Yh}from"@payloadcms/ui";import{$getNodeByKey as qh,COMMAND_PRIORITY_EDITOR as ha}from"lexical";import{useEffect as ga,useState as Qh}from"react";var eg=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=qh(o);n&&n.replace(Re({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(Dr,{fields:null,relationTo:e,value:r})},tg=t=>{let e=pa(13),{enabledCollectionSlugs:o}=t,[r]=fa(),[n,l]=Qh(null),i;e[0]!==o?(i={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=i):i=e[1];let{closeListDrawer:s,ListDrawer:u,openListDrawer:c}=St(i),d,a;e[2]!==r||e[3]!==c?(d=()=>r.registerCommand(Ue,h=>(l(h?.replace?h?.replace.nodeKey:null),c(),!0),ha),a=[r,c],e[2]=r,e[3]=c,e[4]=d,e[5]=a):(d=e[4],a=e[5]),ga(d,a);let p;e[6]!==s||e[7]!==r||e[8]!==n?(p=h=>{let{collectionSlug:x,doc:b}=h;s(),eg({editor:r,relationTo:x,replaceNodeKey:n,value:b.id})},e[6]=s,e[7]=r,e[8]=n,e[9]=p):p=e[9];let m=p,f;return e[10]!==u||e[11]!==m?(f=Mr(u,{onSelect:m}),e[10]=u,e[11]=m,e[12]=f):f=e[12],f},og=()=>{let t=pa(3),[e]=fa(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Ue,rg,ha),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),ga(o,r),null},xa=t=>Mr(Ot,{...t,FallbackComponent:og,uploads:!0,children:Mr(tg,{...t})});function rg(){return Yh.error("No upload collections enabled"),!0}function kg(t){let e=t.target;return!!(Ta(e)&&!e.closest("code, span.editor-image")&&Ta(e.parentElement)&&e.parentElement.closest("div.ContentEditable__root"))}function _g(t){let e,o=xg(t.target);if(document.caretRangeFromPoint)e=document.caretRangeFromPoint(t.clientX,t.clientY);else if(t.rangeParent&&o!==null)o.collapse(t.rangeParent,t.rangeOffset||0),e=o.getRangeAt(0);else throw Error("Cannot get the selection when dragging");return e}var Dr=hg("INSERT_UPLOAD_COMMAND"),Ea=()=>{let t=ng(18),[e]=ig(),{config:o}=cg(),{collections:r}=o,{drawerSlug:n,setCollectionSlug:l,setInitialForms:i,setOnCancel:s,setOnSuccess:u,setSelectableCollections:c}=ag(),{isModalOpen:d,openModal:a}=dg(),p;t[0]!==n||t[1]!==r||t[2]!==e||t[3]!==d||t[4]!==a||t[5]!==l||t[6]!==i||t[7]!==s||t[8]!==u||t[9]!==c?(p=b=>{let{files:T}=b;if(T?.length!==0&&(i(E=>[...E??[],...T.map(Tg)]),!d(n))){let E=r.filter(wg).map(Eg);if(!E.length||!E[0])return;l(E[0]),c(E),s(()=>{e.update(Sg)}),u(C=>{let k=new Map(C.map(Ng));e.update(()=>{for(let g of wa()){let w=g.node;if(ot(w)){let L=w.getData();if(L?.pending){let D=k.get(L.pending?.formID);D&&w.replace(Re({data:{id:new Or.default().toHexString(),fields:{},relationTo:D.collectionSlug,value:D.doc.id}}))}}}})}),a(n)}},t[0]=n,t[1]=r,t[2]=e,t[3]=d,t[4]=a,t[5]=l,t[6]=i,t[7]=s,t[8]=u,t[9]=c,t[10]=p):p=t[10];let m=ug(p),f;t[11]!==e||t[12]!==m?(f=()=>{if(!e.hasNodes([ne]))throw new Error("UploadPlugin: UploadNode not registered on editor");return sg(e.registerNodeTransform(ne,b=>{let T=b.getData();if(!T?.pending)return;(async function(){let k=null,g=T?.pending?.src,w=T?.pending?.formID;if(g?.startsWith("data:")){let L=g.match(/data:(image\/[a-zA-Z]+);base64,/),D=L?L[1]:"image/png",F=g.replace(/^data:image\/[a-zA-Z]+;base64,/,""),R=atob(F),S=new Array(R.length);for(let M=0;M<R.length;M++)S[M]=R.charCodeAt(M);let _=new Uint8Array(S);k={alt:void 0,file:new File([_],"pasted-image."+D?.split("/")[1],{type:D}),formID:w}}else if(g?.startsWith("http")||g?.startsWith("https")){let D=await(await fetch(g)).blob(),F=g.split("/").pop()||"pasted-image"+D.type.split("/")[1];k={alt:void 0,file:new File([D],F,{type:D.type}),formID:w}}k&&m({files:[k]})})()}),e.registerCommand(Dr,b=>(e.update(()=>{let T=ba()||Ca();if(ka(T)){let E=Re({data:{id:b.id,fields:b.fields,relationTo:b.relationTo,value:b.value}}),{focus:C}=T,k=C.getNode();Ar(E),Fr(k)&&!k.__first&&k.remove()}}),!0),fg),e.registerCommand(Cg,b=>{if(!(b instanceof ClipboardEvent))return!1;let T=b.clipboardData;if(!T?.types?.length||T?.types?.includes("text/html"))return!1;let E=[];return T?.files?.length&&Array.from(T.files).forEach(C=>{E.push({alt:"",file:C,formID:new Or.default().toHexString()})}),E.length?(e.update(()=>{let C=ba()||Ca();if(ka(C))for(let k of E){let g=new ne({data:{pending:{formID:k.formID,src:URL.createObjectURL(k.file)}}}),{focus:w}=C,L=w.getNode();Ar(g),Fr(L)&&!L.__first&&L.remove()}}),m({files:E}),!0):!1},_a),e.registerCommand(gg,b=>{if(!(b instanceof DragEvent))return!1;let T=b.dataTransfer;if(!T?.types?.length)return!1;let E=[];return T?.files?.length&&Array.from(T.files).forEach(C=>{E.push({alt:"",file:C,formID:new Or.default().toHexString()})}),E.length?(b.preventDefault(),b.stopPropagation(),e.update(()=>{if(kg(b)){let C=_g(b),k=mg();C!=null&&k.applyDOMRange(C),pg(k);for(let g of E){let w=new ne({data:{pending:{formID:g.formID,src:URL.createObjectURL(g.file)}}}),{focus:L}=k,D=L.getNode();Ar(w),Fr(D)&&!D.__first&&D.remove()}}}),m({files:E}),!0):!1},_a))},t[11]=e,t[12]=m,t[13]=f):f=t[13];let h;t[14]!==e?(h=[e],t[14]=e,t[15]=h):h=t[15],bg(f,h);let x;return t[16]!==r?(x=lg(xa,{enabledCollectionSlugs:r.map(Lg)}),t[16]=r,t[17]=x):x=t[17],x};function Tg(t){return{file:t.file,formID:t.formID}}function wg(t){let{upload:e}=t;return!!e}function Eg(t){let{slug:e}=t;return e}function Sg(){for(let t of wa()){let e=t.node;ot(e)&&e.getData()?.pending&&e.remove()}}function Ng(t){return[t.formID,t]}function Lg(t){let{slug:e}=t;return e}var Ig=v({nodes:[ne],plugins:[{Component:Ea,position:"normal"}],slashMenu:{groups:[Z([{Icon:vr,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ue,{replace:!1})}}])]},toolbarFixed:{groups:[he([{ChildComponent:vr,isActive:({selection:t})=>{if(!yg(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return ot(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ue,{replace:!1})}}])]}});import{c as vg}from"react/compiler-runtime";import{jsx as Pr}from"react/jsx-runtime";import{ShimmerEffect as Mg,useConfig as Dg}from"@payloadcms/ui";import{lazy as Ag,Suspense as Og,useEffect as Fg,useState as $g}from"react";var Sa={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",hrSelected:"LexicalEditorTheme__hrSelected",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",tab:"LexicalEditorTheme__tabNode",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableAlignment:{center:"LexicalEditorTheme__tableAlignmentCenter",right:"LexicalEditorTheme__tableAlignmentRight"},tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableFrozenColumn:"LexicalEditorTheme__tableFrozenColumn",tableRowStriping:"LexicalEditorTheme__tableRowStriping",tableScrollableWrapper:"LexicalEditorTheme__tableScrollableWrapper",tableSelected:"LexicalEditorTheme__tableSelected",tableSelection:"LexicalEditorTheme__tableSelection",text:{bold:"LexicalEditorTheme__textBold",code:"LexicalEditorTheme__textCode",italic:"LexicalEditorTheme__textItalic",strikethrough:"LexicalEditorTheme__textStrikethrough",subscript:"LexicalEditorTheme__textSubscript",superscript:"LexicalEditorTheme__textSuperscript",underline:"LexicalEditorTheme__textUnderline",underlineStrikethrough:"LexicalEditorTheme__textUnderlineStrikethrough"},upload:"editor-upload"};var bo={namespace:"lexical",theme:Sa};function Na({config:t,featureClientImportMap:e,featureClientSchemaMap:o,field:r,schemaPath:n,unSanitizedEditorConfig:l}){for(let c of l.features)if(!c?.clientFeatureProps?.featureKey||c?.clientFeatureProps?.order===void 0||c?.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.");l.features=l.features.sort((c,d)=>c.clientFeatureProps.order-d.clientFeatureProps.order);let i=new Map;for(let c of l.features)i.set(c.clientFeatureProps.featureKey,c);let s=new Map,u=0;for(let c of l.features){let d=typeof c.feature=="function"?c.feature({config:t,featureClientImportMap:e,featureClientSchemaMap:o,featureProviderMap:i,field:r,resolvedFeatures:s,schemaPath:n,unSanitizedEditorConfig:l}):c.feature;d.key=c.clientFeatureProps.featureKey,d.order=u,s.set(c.clientFeatureProps.featureKey,d),u++}return s}import{deepMerge as Rg}from"payload/shared";var La=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}},o={};if(t.forEach(r=>{r.key==="toolbarFixed"&&r.sanitizedClientFeatureProps?.customGroups&&(o={...o,...r.sanitizedClientFeatureProps.customGroups})}),!t?.size)return e;t.forEach(r=>{if(r.providers?.length&&(e.providers=e.providers.concat(r.providers)),r.enableFormats?.length&&e.enabledFormats.push(...r.enableFormats),r.nodes?.length)for(let n of r.nodes)e.nodes.push(n);if(r.plugins?.length&&r.plugins.forEach((n,l)=>{e.plugins?.push({clientProps:r.sanitizedClientFeatureProps,Component:n.Component,key:r.key+l,position:n.position})}),r.toolbarInline?.groups?.length)for(let n of r.toolbarInline.groups){let l=e.toolbarInline.groups.find(i=>i.key===n.key);l?e.toolbarInline.groups=e.toolbarInline.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.toolbarInline?.groups.push(l)}if(r.toolbarFixed?.groups?.length)for(let n of r.toolbarFixed.groups){let l=e.toolbarFixed.groups.find(i=>i.key===n.key);l?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.toolbarFixed?.groups.push(l)}if(r.slashMenu?.groups){r.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(r.slashMenu.dynamicGroups));for(let n of r.slashMenu.groups){let l=e.slashMenu.groups.find(i=>i.key===n.key);l?e.slashMenu.groups=e.slashMenu.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.slashMenu.groups.push(l)}}if(r.markdownTransformers?.length)for(let n of r.markdownTransformers)typeof n=="function"?e.markdownTransformers.push(n({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(n);e.enabledFeatures.push(r.key)}),Object.keys(o).length>0&&(e.toolbarFixed.groups=e.toolbarFixed.groups.map(r=>{let n=o[r.key];return n?Rg(r,n):r})),e.toolbarInline.groups.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0),e.toolbarFixed.groups.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);for(let r of e.toolbarInline.groups)r.items.sort((n,l)=>n.order&&l.order?n.order-l.order:n.order?-1:l.order?1:0);for(let r of e.toolbarFixed.groups)r.items.sort((n,l)=>n.order&&l.order?n.order-l.order:n.order?-1:l.order?1:0);return e};function $r(t,e,o){return{admin:o,features:La(t),lexical:e,resolvedFeatureMap:t}}var Pg=Ag(()=>import("./Field-EHRBYNHO.js").then(t=>({default:t.RichText}))),Bg=t=>{let e=vg(16),{admin:o,clientFeatures:r,featureClientImportMap:n,featureClientSchemaMap:l,field:i,lexicalEditorConfig:s,schemaPath:u}=t,c;e[0]!==o?(c=o===void 0?{}:o,e[0]=o,e[1]=c):c=e[1];let d=c,a=s===void 0?bo:s,{config:p}=Dg(),[m,f]=$g(null),h,x;e[2]!==d||e[3]!==r||e[4]!==p||e[5]!==n||e[6]!==l||e[7]!==i||e[8]!==m||e[9]!==a||e[10]!==u?(h=()=>{if(m)return;let T=[];for(let[k,g]of Object.entries(r))g.clientFeatureProvider&&T.push(g.clientFeatureProvider(g.clientFeatureProps));let E=a||bo,C=Na({config:p,featureClientImportMap:n,featureClientSchemaMap:l,field:i,schemaPath:u??i.name,unSanitizedEditorConfig:{features:T,lexical:E}});f($r(C,E,d))},x=[a,d,m,r,n,l,i,p,u],e[2]=d,e[3]=r,e[4]=p,e[5]=n,e[6]=l,e[7]=i,e[8]=m,e[9]=a,e[10]=u,e[11]=h,e[12]=x):(h=e[11],x=e[12]),Fg(h,x);let b;return e[13]!==m||e[14]!==t?(b=Pr(Og,{fallback:Pr(Mg,{height:"35vh"}),children:m&&Pr(Pg,{...t,editorConfig:m})}),e[13]=m,e[14]=t,e[15]=b):b=e[15],b};function Hg(t){return t instanceof HTMLElement}function jg(...t){return t.filter(Boolean).join(" ")}var ko=new WeakMap;function ya(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function _o(t,e){let o=ko.get(t);if(o===void 0){let r=new Set,n=i=>{o!==void 0&&(o.start=ya(i))},l=i=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let u=ya(i);for(let c of r)u!==null&&c([u[0]-s[0],u[1]-s[1]],i)};t.addEventListener("touchstart",n),t.addEventListener("touchend",l),o={handleTouchend:l,handleTouchstart:n,listeners:r,start:null},ko.set(t,o)}return o.listeners.add(e),()=>{Ug(t,e)}}function Ug(t,e){let o=ko.get(t);if(o===void 0)return;let{listeners:r}=o;r.delete(e),r.size===0&&(ko.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function Gg(t,e){return _o(t,(o,r)=>{let[n,l]=o;n<0&&-n>Math.abs(l)&&e(n,r)})}function Wg(t,e){return _o(t,(o,r)=>{let[n,l]=o;n>0&&n>Math.abs(l)&&e(n,r)})}function Vg(t,e){return _o(t,(o,r)=>{let[n,l]=o;l<0&&-l>Math.abs(n)&&e(n,r)})}function Kg(t,e){return _o(t,(o,r)=>{let[n,l]=o;l>0&&l>Math.abs(n)&&e(n,r)})}import{c as Jg}from"react/compiler-runtime";import{jsx as Xg}from"react/jsx-runtime";import"react";var zg=()=>{let t=Jg(2),{EditButton:e}=pe(),o;return t[0]!==e?(o=e?Xg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Zg}from"react/compiler-runtime";import{jsx as Yg}from"react/jsx-runtime";import"react";var qg=()=>{let t=Zg(2),{RemoveButton:e}=pe(),o;return t[0]!==e?(o=e?Yg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Qg}from"react/compiler-runtime";import{jsx as ex}from"react/jsx-runtime";import"react";var tx=()=>{let t=Qg(2),{Label:e}=pe(),o;return t[0]!==e?(o=e?ex(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as ox}from"react/compiler-runtime";import{jsx as rx}from"react/jsx-runtime";import"react";var nx=t=>{let e=ox(3),{children:o}=t,{InlineBlockContainer:r}=pe(),n;return e[0]!==r||e[1]!==o?(n=r?rx(r,{children:o}):null,e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{c as lx}from"react/compiler-runtime";import{jsx as ix}from"react/jsx-runtime";import"react";var sx=t=>{let e=lx(6),{children:o,editButton:r,Label:n,removeButton:l}=t,{BlockCollapsible:i}=ve(),s;return e[0]!==i||e[1]!==n||e[2]!==o||e[3]!==r||e[4]!==l?(s=i?ix(i,{editButton:r,Label:n,removeButton:l,children:o}):null,e[0]=i,e[1]=n,e[2]=o,e[3]=r,e[4]=l,e[5]=s):s=e[5],s};import{c as ax}from"react/compiler-runtime";import{jsx as cx}from"react/jsx-runtime";import"react";var ux=()=>{let t=ax(2),{EditButton:e}=ve(),o;return t[0]!==e?(o=e?cx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as dx}from"react/compiler-runtime";import{jsx as mx}from"react/jsx-runtime";import"react";var px=()=>{let t=dx(2),{RemoveButton:e}=ve(),o;return t[0]!==e?(o=e?mx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as fx}from"qs-esm";var hx=({apiURL:t,depth:e,draft:o,locale:r})=>async({id:l,collectionSlug:i,select:s})=>{let u=fx({depth:e??0,draft:o??!1,locale:r,select:s},{addQueryPrefix:!0});return await fetch(`${t}/${i}/${l}${u}`,{credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json"},method:"GET"}).then(d=>d.json())};import{c as gx}from"react/compiler-runtime";import{jsx as rt}from"react/jsx-runtime";import{FieldContext as xx,FieldPathContext as Ia,ServerFunctionsContext as Ra,ShimmerEffect as Cx,useServerFunctions as bx}from"@payloadcms/ui";import kx,{useEffect as _x,useRef as Tx}from"react";var wx=t=>{let e=gx(9),{field:o,initialValue:r,Loading:n,path:l,schemaPath:i,setValue:s,value:u}=t,[c,d]=kx.useState(null),a=bx(),{_internal_renderField:p}=a,[m,f]=i.split("."),h=l??(o&&"name"in o?o?.name:"")??"",x;e[0]!==p||e[1]!==o||e[2]!==r||e[3]!==l||e[4]!==i?(x=()=>{(async function(){let{Field:D}=await p({field:{...o||{},type:"richText",admin:{...o?.admin||{},hidden:!1}},initialValue:r??void 0,path:l,schemaPath:i});d(D)})()},e[0]=p,e[1]=o,e[2]=r,e[3]=l,e[4]=i,e[5]=x):x=e[5];let b=x,T=Tx(!1),E,C;if(e[6]!==b?(E=()=>{T.current||(T.current=!0,b())},C=[b],e[6]=b,e[7]=E,e[8]=C):(E=e[7],C=e[8]),_x(E,C),!c)return typeof n<"u"?n:rt(Cx,{});let k={...a,getFormState:async w=>a.getFormState({...w,collectionSlug:m==="collection"?f:void 0,globalSlug:m==="global"?f:void 0})};if(typeof u>"u"&&!s)return rt(Ra,{value:{...k},children:rt(Ia,{value:h,children:c},h)});let g={disabled:!1,formInitializing:!1,formProcessing:!1,formSubmitted:!1,initialValue:u,path:h,setValue:s??Ex,showError:!1,value:u};return rt(Ra,{value:{...k},children:rt(Ia,{value:h,children:rt(xx,{value:g,children:c})},h)})};function Ex(){}function Sx({nodes:t,text:e}){let o={root:{type:"root",children:[],direction:"ltr",format:"",indent:0,version:1}};return e&&o.root.children.push({type:"paragraph",children:[{type:"text",detail:0,format:0,mode:"normal",style:"",text:e,version:1}],direction:"ltr",format:"",indent:0,textFormat:0,textStyle:"",version:1}),t?.length&&o.root.children.push(...t),o}export{ht as $createAutoLinkNode,Kt as $createBlockNode,Eo as $createInlineBlockNode,ge as $createLinkNode,$e as $createRelationshipNode,Re as $createUploadNode,Ce as $isAutoLinkNode,dt as $isBlockNode,So as $isInlineBlockNode,J as $isLinkNode,dr as $isRelationshipNode,ot as $isUploadNode,Ga as AlignFeatureClient,xe as AutoLinkNode,sx as BlockCollapsible,ux as BlockEditButton,fe as BlockNode,px as BlockRemoveButton,Xa as BlockquoteFeatureClient,Vc as BlocksFeatureClient,fu as BoldFeatureClient,re as CAN_USE_DOM,xp as ChecklistFeatureClient,af as DETAIL_TYPE_TO_DETAIL,rf as DOUBLE_LINE_BREAK,bf as DebugJsxConverterFeatureClient,uf as ELEMENT_FORMAT_TO_TYPE,cf as ELEMENT_TYPE_TO_FORMAT,Fa as ENABLE_SLASH_MENU_COMMAND,Ma as EditorConfigProvider,nt as FieldsDrawer,j0 as FixedToolbarFeatureClient,cd as HeadingFeatureClient,Ld as HorizontalRuleFeatureClient,Ge as INSERT_BLOCK_COMMAND,We as INSERT_INLINE_BLOCK_COMMAND,tf as IS_ALL_FORMATTING,Gd as IndentFeatureClient,nx as InlineBlockContainer,zg as InlineBlockEditButton,tx as InlineBlockLabel,wo as InlineBlockNode,qg as InlineBlockRemoveButton,bu as InlineCodeFeatureClient,q0 as InlineToolbarFeatureClient,wu as ItalicFeatureClient,lf as LTR_REGEX,Bp as LexicalPluginToLexicalFeatureClient,op as LinkFeatureClient,ee as LinkNode,of as NON_BREAKING_SPACE,O as NodeFormat,Sp as OrderedListFeatureClient,Jp as ParagraphFeatureClient,Aa as Point,nf as RTL_REGEX,$a as Rect,l0 as RelationshipFeatureClient,ke as RelationshipNode,wx as RenderLexical,Bg as RichTextField,Vp as SlateToLexicalFeatureClient,yu as StrikethroughFeatureClient,Mu as SubscriptFeatureClient,Fu as SuperscriptFeatureClient,df as TEXT_MODE_TO_TYPE,sf as TEXT_TYPE_TO_FORMAT,mf as TEXT_TYPE_TO_MODE,ce as TOGGLE_LINK_COMMAND,Gh as TableFeatureClient,lu as TestRecorderFeatureClient,qu as TextStateFeatureClient,Nt as ToolbarButton,Pe as ToolbarDropdown,uu as TreeViewFeatureClient,ju as UnderlineFeatureClient,Dp as UnorderedListFeatureClient,Ig as UploadFeatureClient,ne as UploadNode,Kg as addSwipeDownListener,Gg as addSwipeLeftListener,Wg as addSwipeRightListener,Vg as addSwipeUpListener,Sx as buildEditorState,Go as createBlockNode,v as createClientFeature,kf as defaultColors,bo as defaultEditorLexicalConfig,gr as getDOMRangeRect,Pa as getEnabledNodes,hx as getRestPopulateFn,Ve as getSelectedNode,Hg as isHTMLElement,Oa as isPoint,jg as joinClasses,$r as sanitizeClientEditorConfig,La as sanitizeClientFeatures,so as setFloatingElemPosition,to as setFloatingElemPositionForLinkEditor,Z as slashMenuBasicGroupWithItems,he as toolbarAddDropdownGroupWithItems,Vo as toolbarFeatureButtonsGroupWithItems,Y as toolbarFormatGroupWithItems,Q as toolbarTextDropdownGroupWithItems,ve as useBlockComponentContext,H as useEditorConfigContext,pe as useInlineBlockComponentContext,Da as useLexicalDocumentDrawer,me as useLexicalDrawer,St as useLexicalListDrawer};
|
|
66
41
|
//# sourceMappingURL=index.js.map
|