@payloadcms/richtext-lexical 3.33.0-canary.2 → 3.33.0-canary.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/exports/client/bundled.css +1 -1
- package/dist/exports/client/index.d.ts +1 -0
- package/dist/exports/client/index.d.ts.map +1 -1
- package/dist/exports/client/index.js +10 -10
- package/dist/exports/client/index.js.map +4 -4
- package/dist/features/debug/jsxConverter/client/index.d.ts +2 -0
- package/dist/features/debug/jsxConverter/client/index.d.ts.map +1 -0
- package/dist/features/debug/jsxConverter/client/index.js +11 -0
- package/dist/features/debug/jsxConverter/client/index.js.map +1 -0
- package/dist/features/debug/jsxConverter/client/plugin/index.d.ts +2 -0
- package/dist/features/debug/jsxConverter/client/plugin/index.d.ts.map +1 -0
- package/dist/features/debug/jsxConverter/client/plugin/index.js +52 -0
- package/dist/features/debug/jsxConverter/client/plugin/index.js.map +1 -0
- package/dist/features/debug/jsxConverter/server/index.d.ts +2 -0
- package/dist/features/debug/jsxConverter/server/index.d.ts.map +1 -0
- package/dist/features/debug/jsxConverter/server/index.js +8 -0
- package/dist/features/debug/jsxConverter/server/index.js.map +1 -0
- package/dist/features/upload/server/validate.d.ts.map +1 -1
- package/dist/features/upload/server/validate.js.map +1 -1
- package/dist/field/bundled.css +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use client";import{a as Ce,c as
|
|
1
|
+
"use client";import{a as Ce,c as _o,d as To,e as wo}from"./chunk-TMS3LIBB.js";import{a as st}from"./chunk-DBWINSQN.js";import{a as lt,b as Ot,c as Ve}from"./chunk-FSKAVN4P.js";import{a as ge}from"./chunk-INBEEENE.js";import{a as ca}from"./chunk-F26IQ5RE.js";import{a as ae,c as Pr,d as Br,e as ua,f as da,h as ma,j as pa,k as fa}from"./chunk-DOZWITPU.js";import{a as aa,b as H}from"./chunk-BZZVLW4U.js";function Q(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{$isElementNode as Ie,$isRangeSelection as $t,FORMAT_ELEMENT_COMMAND as Pt}from"lexical";import{jsx as ko,jsxs as ha}from"react/jsx-runtime";import"react";var Hr=()=>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:[ko("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),ko("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),ko("path",{d:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Eo,jsxs as ga}from"react/jsx-runtime";import"react";var jr=()=>ga("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:[Eo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Eo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Eo("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as No,jsxs as Ca}from"react/jsx-runtime";import"react";var Ft=()=>Ca("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:"M2.5 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Lo,jsxs as xa}from"react/jsx-runtime";import"react";var Ur=()=>xa("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:"M7.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});var R=t=>o=>{let r={clientFeatureProps:o};if(typeof t=="function")r.feature=({config:n,featureClientImportMap:i,featureClientSchemaMap:l,featureProviderMap:s,field:u,resolvedFeatures:c,schemaPath:d,unSanitizedEditorConfig:a})=>{let p=t({config:n,featureClientImportMap:i,featureClientSchemaMap:l,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 Gr=t=>({type:"dropdown",ChildComponent:Ft,items:t,key:"align",order:30});var Wr=[Gr([{ChildComponent:Ft,isActive:({selection:t})=>{if(!$t(t))return!1;for(let e of t.getNodes()){if(Ie(e)&&e.getFormatType()==="left")continue;let o=e.getParent();if(!(Ie(o)&&o.getFormatType()==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Pt,"left")},order:1},{ChildComponent:Hr,isActive:({selection:t})=>{if(!$t(t))return!1;for(let e of t.getNodes()){if(Ie(e)&&e.getFormatType()==="center")continue;let o=e.getParent();if(!(Ie(o)&&o.getFormatType()==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Pt,"center")},order:2},{ChildComponent:Ur,isActive:({selection:t})=>{if(!$t(t))return!1;for(let e of t.getNodes()){if(Ie(e)&&e.getFormatType()==="right")continue;let o=e.getParent();if(!(Ie(o)&&o.getFormatType()==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Pt,"right")},order:3},{ChildComponent:jr,isActive:({selection:t})=>{if(!$t(t))return!1;for(let e of t.getNodes()){if(Ie(e)&&e.getFormatType()==="justify")continue;let o=e.getParent();if(!(Ie(o)&&o.getFormatType()==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Pt,"justify")},order:4}])],ba=R({toolbarFixed:{groups:Wr},toolbarInline:{groups:Wr}});import{$createQuoteNode as Yr,$isQuoteNode as zr,QuoteNode as wa}from"@lexical/rich-text";import{$setBlocksType as qr}from"@lexical/selection";import{$getSelection as Qr,$isRangeSelection as ka}from"lexical";import{jsx as Vr}from"react/jsx-runtime";import"react";var So=()=>Vr("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Vr("path",{d:"M13.5353 10.5725C13.5353 9.47709 11.0456 9.99991 11.0456 7.85883C11.0456 6.46464 12.1162 5.61816 13.361 5.61816C14.805 5.61816 16 6.86298 16 8.92937C16 11.2945 14.4564 13.7841 11.1203 14.3816L10.8216 13.1368C12.888 12.4895 13.5353 11.4937 13.5353 10.5725ZM6.71369 10.5725C6.71369 9.47709 4.22407 9.99991 4.22407 7.85883C4.22407 6.46464 5.29461 5.61816 6.53942 5.61816C7.9834 5.61816 9.17842 6.86298 9.17842 8.92937C9.17842 11.2945 7.63485 13.7841 4.29876 14.3816L4 13.1368C6.06639 12.4895 6.71369 11.4937 6.71369 10.5725Z",fill:"currentColor"})});import{jsx as Kr}from"react/jsx-runtime";import"react";var at=()=>Kr("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:Kr("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 ne=t=>({type:"dropdown",ChildComponent:at,items:t,key:"text",order:25});import{$createQuoteNode as _a,$isQuoteNode as Jr,QuoteNode as Ta}from"@lexical/rich-text";var Xr={type:"element",dependencies:[Ta],export:(t,e)=>{if(!Jr(t))return null;let o=e(t).split(`
|
|
2
2
|
`),r=[];for(let n of o)r.push("> "+n);return r.join(`
|
|
3
|
-
`)},regExp:/^>\s/,replace:(t,e,o,r)=>{if(r){let i=t.getPreviousSibling();if(Br(i)){i.splice(i.getChildrenSize(),0,[...e]),i.select(0,0),t.remove();return}}let n=zs();n.append(...e),t.replace(n),n.select(0,0)}};var Ur=[ne([{ChildComponent:Eo,isActive:({selection:t})=>{if(!Xs(t))return!1;for(let e of t.getNodes())if(!jr(e)&&!jr(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Vr();Wr(e,()=>Gr())})},order:20}])],qs=R({markdownTransformers:[Hr],nodes:[Js],slashMenu:{groups:[Q([{Icon:Eo,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Vr();Wr(e,()=>Gr())})}}])]},toolbarFixed:{groups:Ur},toolbarInline:{groups:Ur}});import{getTranslation as jt}from"@payloadcms/translations";import{jsx as wo,jsxs as Qs}from"react/jsx-runtime";import"react";var At=()=>Qs("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[wo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),wo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),wo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as Kr}from"react/jsx-runtime";import"react";var Ot=()=>Kr("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Kr("path",{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 ea}from"react/jsx-runtime";import"react";function Ft(t,e){return t?()=>ea("img",{alt:e??"Block Image",className:"lexical-block-custom-image",src:t,style:{maxHeight:20,maxWidth:20}}):At}import{jsx as ya}from"react/jsx-runtime";import va from"bson-objectid";import"react";import{DecoratorBlockNode as ta}from"@lexical/react/LexicalDecoratorBlockNode.js";import oa from"bson-objectid";var lt=class extends ta{__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=ra(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 ra(t){return new lt({fields:{...t,id:t?.id||new oa.default().toHexString()}})}import{jsx as z,jsxs as st,Fragment as ua}from"react/jsx-runtime";import{Button as Jr,Collapsible as da,Drawer as ma,EditDepthProvider as pa,ErrorPill as fa,Form as ha,formatDrawerSlug as ga,FormSubmit as Ca,Pill as xa,RenderFields as ba,SectionTitle as _a,useConfig as Ta,useDocumentForm as Ea,useDocumentInfo as Xr,useEditDepth as wa,useFormSubmitted as ka,useServerFunctions as Na,useTranslation as La}from"@payloadcms/ui";import{abortAndIgnore as ko}from"@payloadcms/ui/shared";import{deepCopyObjectSimpleWithoutReactComponents as Pt,reduceFieldsToValues as qr}from"payload/shared";import at,{useCallback as No,useEffect as Lo,useMemo as ct,useRef as So}from"react";import{useLexicalComposerContext as Sa}from"@lexical/react/LexicalComposerContext";import{getTranslation as Ra}from"@payloadcms/translations";import{$getNodeByKey as Bt}from"lexical";import{v4 as Ia}from"uuid";import{c as na}from"react/compiler-runtime";import{jsx as $t,jsxs as ia}from"react/jsx-runtime";import{RenderFields as la,useFormSubmitted as sa}from"@payloadcms/ui";import aa,{createContext as ca}from"react";var Zr=ca({initialState:!1}),Ae=()=>aa.use(Zr),zr=t=>{let e=na(13),{BlockDrawer:o,Collapsible:r,CustomBlock:n,EditButton:i,errorCount:l,formSchema:s,initialState:c,nodeKey:u,RemoveButton:d}=t,p=sa()&&l>0,m,f;e[0]!==r||e[1]!==l||e[2]!==p?(f=b=>$t(r,{editButton:b.editButton,errorCount:l,fieldHasErrors:p,Label:b.Label,removeButton:b.removeButton,children:b.children}),e[0]=r,e[1]=l,e[2]=p,e[3]=f):f=e[3],m=f;let h=m,g;return e[4]!==o||e[5]!==h||e[6]!==n||e[7]!==i||e[8]!==d||e[9]!==s||e[10]!==c||e[11]!==u?(g=n?ia(Zr,{value:{BlockCollapsible:h,EditButton:i,initialState:c,nodeKey:u,RemoveButton:d},children:[n,$t(o,{})]}):$t(h,{children:$t(la,{fields:s,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0})}),e[4]=o,e[5]=h,e[6]=n,e[7]=i,e[8]=d,e[9]=s,e[10]=c,e[11]=u,e[12]=g):g=e[12],g};function Yr({fields:t}){for(let e in t){let o=t[e];Array.isArray(o?.rows)&&"value"in o&&(o.disableFormData=!0)}return t}var ue="lexical-block",Qr=t=>{let{cacheBuster:e,formData:o,nodeKey:r}=t,n=ka(),{id:i,collectionSlug:l,globalSlug:s}=Xr(),{fieldProps:{featureClientSchemaMap:c,field:u,initialLexicalFormState:d,permissions:a,readOnly:p,schemaPath:m},uuid:f}=H(),{fields:h}=Ea(),g=So(new AbortController),b=wa(),[L,I]=at.useState(0),{config:_}=Ta(),T=ga({slug:`lexical-blocks-create-${f}-${o.id}`,depth:b}),{toggleDrawer:C}=ge(T),{getDocPreferences:E,setDocFieldPreferences:M}=Xr(),[A]=Sa(),{getFormState:$}=Na(),D=`${m}.lexical_internal_feature.blocks.lexical_blocks.${o.blockType}.fields`,[k,x]=at.useState(()=>d?.[o.id]?.formState?{...d?.[o.id]?.formState,blockName:{initialValue:o.blockName,passesCondition:!0,valid:!0,value:o.blockName}}:!1),N=So(!1),y=So(e);Lo(()=>{N.current?(y.current!==e&&x(!1),y.current=e):N.current=!0},[e]);let[S,v]=at.useState(k?._components?.customComponents?.BlockLabel),[w,O]=at.useState(k?._components?.customComponents?.Block);Lo(()=>{let j=new AbortController;return o&&!k&&(async()=>{let{state:K}=await $({id:i,collectionSlug:l,data:o,docPermissions:{fields:!0},docPreferences:await E(),documentFormState:Pt(h),globalSlug:s,initialBlockData:o,operation:"update",renderAllFields:!0,schemaPath:D,signal:j.signal});if(K){K.blockName={initialValue:o.blockName,passesCondition:!0,valid:!0,value:o.blockName};let q=qr(Pt(K),!0);A.update(()=>{let Z=Bt(r);if(Z&&ut(Z)){let se=q;se.blockType=o.blockType,Z.setFields(se,!0)}}),x(K),v(K._components?.customComponents?.BlockLabel),O(K._components?.customComponents?.Block)}})(),()=>{ko(j)}},[$,D,i,o,A,r,k,l,s,E,h]);let[B,U]=at.useState(d?.[o.id]?.collapsed??!1),J=`${m}.lexical_internal_feature.blocks.lexical_blocks.${o.blockType}`,W=c.blocks?.[J]?.[0],G=W.blockReferences?typeof W?.blockReferences?.[0]=="string"?_.blocksMap[W?.blockReferences?.[0]]:W?.blockReferences?.[0]:W?.blocks?.[0],{i18n:te,t:ce}=La(),X=No(async({formState:j,submit:pe})=>{ko(g.current);let K=new AbortController;g.current=K;let{state:q}=await $({id:i,collectionSlug:l,docPermissions:{fields:!0},docPreferences:await E(),documentFormState:Pt(h),formState:j,globalSlug:s,initialBlockFormState:j,operation:"update",renderAllFields:!!pe,schemaPath:D,signal:K.signal});if(!q)return j;j.blockName&&(q.blockName=j.blockName);let Z=qr(Yr({fields:Pt(q)}),!0);if(setTimeout(()=>{A.update(()=>{let se=Bt(r);if(se&&ut(se)){let Ge=Z;Ge.blockType=o.blockType,se.setFields(Ge,!0)}})},0),pe){v(q._components?.customComponents?.BlockLabel),O(q._components?.customComponents?.Block);let se=0;for(let Ge of Object.values(q))Ge?.valid===!1&&se++;I(se)}return q},[$,i,l,E,s,D,o.blockType,h,A,r]);Lo(()=>()=>{ko(g.current)},[]);let V=No(()=>{A.update(()=>{Bt(r)?.remove()})},[A,r]),oe=G?.labels?.singular?Ra(G.labels.singular,te):G?.slug,re=No(j=>{E().then(pe=>{let q=pe?.fields?.[u.name]?.collapsed,Z=q&&q?.length?q:[];j?Z.includes(o.id)||Z.push(o.id):Z.includes(o.id)&&Z.splice(Z.indexOf(o.id),1),M(u.name,{collapsed:Z,hello:"hi"})})},[E,u.name,M,o.id]),le=ct(()=>()=>z(Jr,{buttonStyle:"icon-label",className:`${ue}__editButton`,disabled:p,el:"button",icon:"edit",onClick:j=>(j.preventDefault(),j.stopPropagation(),C(),!1),onMouseDown:j=>{j.preventDefault()},round:!0,size:"small",tooltip:ce("lexical:blocks:inlineBlocks:edit",{label:oe})}),[oe,p,ce,C]),De=ct(()=>()=>z(Jr,{buttonStyle:"icon-label",className:`${ue}__removeButton`,disabled:u?.admin?.readOnly||!1,icon:"x",onClick:j=>{j.preventDefault(),V()},round:!0,tooltip:"Remove Block"}),[u?.admin?.readOnly,V]),ot=ct(()=>({children:j,disableBlockName:pe,editButton:K,errorCount:q,fieldHasErrors:Z,Label:se,removeButton:Ge})=>z("div",{className:ue+" "+ue+"-"+o.blockType,children:z(da,{className:[`${ue}__row`,Z?`${ue}__row--has-errors`:`${ue}__row--no-errors`].join(" "),collapsibleStyle:Z?"error":"default",header:st("div",{className:`${ue}__block-header`,children:[se??S?se??S:st("div",{children:[z(xa,{className:`${ue}__block-pill ${ue}__block-pill-${o?.blockType}`,pillStyle:"white",children:oe??o?.blockType}),!pe&&z(_a,{path:"blockName",readOnly:u?.admin?.readOnly||!1}),Z&&z(fa,{count:q??0,i18n:te,withMessage:!0})]}),st("div",{children:[w&&K!==!1||!w&&K?z(le,{}):null,Ge!==!1&&A.isEditable()?z(De,{}):null]})]}),isCollapsed:B,onToggle:Ir=>{re(Ir),U(Ir)},children:j},0)}),[w,S,le,De,oe,A,o.blockType,te,B,re,u?.admin?.readOnly]),It=G?.fields??[],Rr=ct(()=>()=>z(pa,{children:z(ma,{className:"",slug:T,title:ce(`lexical:blocks:inlineBlocks:${o?.id?"edit":"create"}`,{label:oe??ce("lexical:blocks:inlineBlocks:label")}),children:k?st(ua,{children:[z(ba,{fields:It,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:D,permissions:!0,readOnly:!1}),z(Ca,{programmaticSubmit:!0,children:ce("fields:saveChanges")})]}):null})}),[k,T,oe,ce,G?.fields,D,a]),Os=ct(()=>k?z(ha,{beforeSubmit:[async({formState:j})=>await X({formState:j,submit:!0})],el:"div",fields:It,initialState:k,onChange:[X],onSubmit:(j,pe)=>{pe.blockType=o.blockType,A.update(()=>{let K=Bt(r);K&&ut(K)&&K.setFields(pe,!0)}),C()},submitted:n,uuid:Ia(),children:z(zr,{baseClass:ue,BlockDrawer:Rr,Collapsible:ot,CustomBlock:w,EditButton:le,errorCount:L,formSchema:It,initialState:k,nodeKey:r,RemoveButton:De})}):null,[ot,Rr,w,It,De,le,A,L,C,G?.fields,k,r,X,n]);return G?Os:z(ot,{disableBlockName:!0,fieldHasErrors:!0,children:st("div",{className:"lexical-block-not-found",children:["Error: Block '",o.blockType,"' not found in the config but exists in the lexical data"]})})};var xe=class extends lt{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=Ht(e.fields);return o.setFormat(e.format),o}decorate(e,o){return ya(Qr,{cacheBuster:this.getCacheBuster(),formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Ht(t){return new xe({fields:{...t,id:t?.id||new va.default().toHexString()}})}function ut(t){return t instanceof xe}import{createCommand as en}from"lexical";var Ve=en("INSERT_BLOCK_COMMAND"),Ke=en("INSERT_INLINE_BLOCK_COMMAND");import{c as Ma}from"react/compiler-runtime";import{useLexicalComposerContext as Da}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Aa,$wrapNodeInElement as Oa,mergeRegister as Fa}from"@lexical/utils";import{formatDrawerSlug as $a,useEditDepth as Pa}from"@payloadcms/ui";import{$createParagraphNode as Ba,$getNodeByKey as Ha,$getPreviousSelection as ja,$getSelection as Ua,$insertNodes as Ga,$isParagraphNode as on,$isRangeSelection as Wa,$isRootOrShadowRoot as Va,COMMAND_PRIORITY_EDITOR as tn}from"lexical";import{useEffect as Ka,useState as Za}from"react";var rn=()=>{let t=Ma(12),[e]=Da(),[o,r]=Za(null),{setCreatedInlineBlock:n,uuid:i}=H(),l=Pa(),s="lexical-inlineBlocks-create-"+i,c;t[0]!==l||t[1]!==s?(c=$a({slug:s,depth:l}),t[0]=l,t[1]=s,t[2]=c):c=t[2];let u=c,{toggleDrawer:d}=ge(u,!0),a;t[3]!==e||t[4]!==n||t[5]!==o?(a=()=>{if(!e.hasNodes([xe]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return Fa(e.registerCommand(Ve,m=>(e.update(()=>{let f=Ua()||ja();if(Wa(f)){let h=Ht(m);Aa(h);let{focus:g}=f,b=g.getNode();on(b)&&b.getTextContentSize()===0&&b.getParentOrThrow().getChildren().filter(za).length>1&&b.remove()}}),!0),tn),e.registerCommand(Ke,m=>{if(o){let h=Ha(o);return!h||!Co(h)?!1:(h.setFields(m),r(null),!0)}let f=go(m);return n?.(f),Ga([f]),Va(f.getParentOrThrow())&&Oa(f,Ba).selectEnd(),!0},tn))},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],Ka(a,p),null};function za(t){return on(t)}var Ya=R(({config:t,featureClientSchemaMap:e,props:o,schemaPath:r})=>{let n=`${r}.lexical_internal_feature.blocks.lexical_blocks`,i=`${r}.lexical_internal_feature.blocks.lexical_inline_blocks`,l=e.blocks;if(!l)return{};let s=Object.entries(l).filter(([a])=>a.startsWith(n+".")&&!a.replace(n+".","").includes(".")).map(([,a])=>a[0]),c=Object.entries(l).filter(([a])=>a.startsWith(i+".")&&!a.replace(i+".","").includes(".")).map(([,a])=>a[0]),u=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=c.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:[xe,ho],plugins:[{Component:rn,position:"normal"}],sanitizedClientFeatureProps:o,slashMenu:{groups:[u?.length?{items:u.map(a=>({Icon:Ft(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(Ve,{blockName:"",blockType:a.slug})}})),key:"blocks",label:({i18n:a})=>a.t("lexical:blocks:label")}:null,d?.length?{items:d.map(a=>({Icon:Ot,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(Ke,{blockName:"",blockType:a.slug})}})),key:"inlineBlocks",label:({i18n:a})=>a.t("lexical:blocks:inlineBlocks:label")}:null].filter(Boolean)},toolbarFixed:{groups:[u.length?{type:"dropdown",ChildComponent:At,items:u.map((a,p)=>({ChildComponent:Ft(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(Ve,{blockName:"",blockType:a.slug})},order:p})),key:"blocks",order:20}:null,d?.length?{type:"dropdown",ChildComponent:Ot,items:d.map((a,p)=>({ChildComponent:a.imageURL?Ft(a.imageURL,a.imageAltText):Ot,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(Ke,{blockName:"",blockType:a.slug})},order:p})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}});import{c as qa}from"react/compiler-runtime";import{jsx as Fe,jsxs as vo}from"react/jsx-runtime";import{useLexicalComposerContext as Qa}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as ec,$createTextNode as tc,$getRoot as oc,getDOMSelection as Ro}from"lexical";import*as cn from"react";import{useCallback as Oe,useEffect as Io,useLayoutEffect as ln,useRef as yo,useState as Ut}from"react";var Ja=ae&&"documentMode"in document?document.documentMode:null,nn=ae&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Kx=ae&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Zx=ae&&"InputEvent"in window&&!Ja?"getTargetRanges"in new window.InputEvent("input"):!1,zx=ae&&/Version\/[\d.].*Safari/.test(navigator.userAgent),Yx=ae&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Jx=ae&&/Android/.test(navigator.userAgent),Xx=ae&&/Win/.test(navigator.platform),Xa=ae&&/^(?=.*Chrome).*/i.test(navigator.userAgent),qx=ae&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!Xa;var rc=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)},nc=(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)},ic=t=>{let o=((r,n)=>{switch(r){case"click":return` await page.mouse.click(${n.x}, ${n.y});`;case"keydown":return` await page.keyboard.keydown('${n}');`;case"keyup":return` await page.keyboard.keyup('${n}');`;case"press":return` await page.keyboard.press('${n}');`;case"selectAll":return" await selectAll(page);";case"snapshot":return` await assertHTMLSnapshot(page);
|
|
3
|
+
`)},regExp:/^>\s/,replace:(t,e,o,r)=>{if(r){let i=t.getPreviousSibling();if(Jr(i)){i.splice(i.getChildrenSize(),0,[...e]),i.select(0,0),t.remove();return}}let n=_a();n.append(...e),t.replace(n),n.select(0,0)}};var Zr=[ne([{ChildComponent:So,isActive:({selection:t})=>{if(!ka(t))return!1;for(let e of t.getNodes())if(!zr(e)&&!zr(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Qr();qr(e,()=>Yr())})},order:20}])],Ea=R({markdownTransformers:[Xr],nodes:[wa],slashMenu:{groups:[Q([{Icon:So,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Qr();qr(e,()=>Yr())})}}])]},toolbarFixed:{groups:Zr},toolbarInline:{groups:Zr}});import{getTranslation as Kt}from"@payloadcms/translations";import{jsx as Ro,jsxs as Na}from"react/jsx-runtime";import"react";var Bt=()=>Na("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:[Ro("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),Ro("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),Ro("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as en}from"react/jsx-runtime";import"react";var Ht=()=>en("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:en("path",{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 La}from"react/jsx-runtime";import"react";function jt(t,e){return t?()=>La("img",{alt:e??"Block Image",className:"lexical-block-custom-image",src:t,style:{maxHeight:20,maxWidth:20}}):Bt}import{jsx as oc}from"react/jsx-runtime";import rc from"bson-objectid";import"react";import{DecoratorBlockNode as Sa}from"@lexical/react/LexicalDecoratorBlockNode.js";import Ra from"bson-objectid";var ct=class extends Sa{__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=Ia(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 Ia(t){return new ct({fields:{...t,id:t?.id||new Ra.default().toHexString()}})}import{jsx as X,jsxs as ut,Fragment as Fa}from"react/jsx-runtime";import{Button as nn,Collapsible as $a,Drawer as Pa,EditDepthProvider as Ba,ErrorPill as Ha,Form as ja,formatDrawerSlug as Ua,FormSubmit as Ga,Pill as Wa,RenderFields as Va,SectionTitle as Ka,useConfig as Ja,useDocumentForm as Xa,useDocumentInfo as ln,useEditDepth as za,useFormSubmitted as Za,useServerFunctions as Ya,useTranslation as qa}from"@payloadcms/ui";import{abortAndIgnore as Io}from"@payloadcms/ui/shared";import{deepCopyObjectSimpleWithoutReactComponents as Gt,reduceFieldsToValues as sn}from"payload/shared";import dt,{useCallback as yo,useEffect as vo,useMemo as mt,useRef as Mo}from"react";import{useLexicalComposerContext as Qa}from"@lexical/react/LexicalComposerContext";import{getTranslation as ec}from"@payloadcms/translations";import{$getNodeByKey as Wt}from"lexical";import{v4 as tc}from"uuid";import{c as ya}from"react/compiler-runtime";import{jsx as Ut,jsxs as va}from"react/jsx-runtime";import{RenderFields as Ma,useFormSubmitted as Aa}from"@payloadcms/ui";import Da,{createContext as Oa}from"react";var tn=Oa({initialState:!1}),De=()=>Da.use(tn),on=t=>{let e=ya(13),{BlockDrawer:o,Collapsible:r,CustomBlock:n,EditButton:i,errorCount:l,formSchema:s,initialState:u,nodeKey:c,RemoveButton:d}=t,p=Aa()&&l>0,m,f;e[0]!==r||e[1]!==l||e[2]!==p?(f=b=>Ut(r,{editButton:b.editButton,errorCount:l,fieldHasErrors:p,Label:b.Label,removeButton:b.removeButton,children:b.children}),e[0]=r,e[1]=l,e[2]=p,e[3]=f):f=e[3],m=f;let h=m,g;return e[4]!==o||e[5]!==h||e[6]!==n||e[7]!==i||e[8]!==d||e[9]!==s||e[10]!==u||e[11]!==c?(g=n?va(tn,{value:{BlockCollapsible:h,EditButton:i,initialState:u,nodeKey:c,RemoveButton:d},children:[n,Ut(o,{})]}):Ut(h,{children:Ut(Ma,{fields:s,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0})}),e[4]=o,e[5]=h,e[6]=n,e[7]=i,e[8]=d,e[9]=s,e[10]=u,e[11]=c,e[12]=g):g=e[12],g};function rn({fields:t}){for(let e in t){let o=t[e];Array.isArray(o?.rows)&&"value"in o&&(o.disableFormData=!0)}return t}var ue="lexical-block",an=t=>{let{cacheBuster:e,formData:o,nodeKey:r}=t,n=Za(),{id:i,collectionSlug:l,globalSlug:s}=ln(),{fieldProps:{featureClientSchemaMap:u,field:c,initialLexicalFormState:d,permissions:a,readOnly:p,schemaPath:m},uuid:f}=H(),{fields:h}=Xa(),g=Mo(new AbortController),b=za(),[L,I]=dt.useState(0),{config:_}=Ja(),T=Ua({slug:`lexical-blocks-create-${f}-${o.id}`,depth:b}),{toggleDrawer:C}=ge(T),{getDocPreferences:w,setDocFieldPreferences:M}=ln(),[O]=Qa(),{getFormState:$}=Ya(),A=`${m}.lexical_internal_feature.blocks.lexical_blocks.${o.blockType}.fields`,[E,x]=dt.useState(()=>d?.[o.id]?.formState?{...d?.[o.id]?.formState,blockName:{initialValue:o.blockName,passesCondition:!0,valid:!0,value:o.blockName}}:!1),N=Mo(!1),y=Mo(e);vo(()=>{N.current?(y.current!==e&&x(!1),y.current=e):N.current=!0},[e]);let[S,v]=dt.useState(E?._components?.customComponents?.BlockLabel),[k,F]=dt.useState(E?._components?.customComponents?.Block);vo(()=>{let j=new AbortController;return o&&!E&&(async()=>{let{state:K}=await $({id:i,collectionSlug:l,data:o,docPermissions:{fields:!0},docPreferences:await w(),documentFormState:Gt(h),globalSlug:s,initialBlockData:o,operation:"update",renderAllFields:!0,schemaPath:A,signal:j.signal});if(K){K.blockName={initialValue:o.blockName,passesCondition:!0,valid:!0,value:o.blockName};let q=sn(Gt(K),!0);O.update(()=>{let J=Wt(r);if(J&&pt(J)){let se=q;se.blockType=o.blockType,J.setFields(se,!0)}}),x(K),v(K._components?.customComponents?.BlockLabel),F(K._components?.customComponents?.Block)}})(),()=>{Io(j)}},[$,A,i,o,O,r,E,l,s,w,h]);let[B,U]=dt.useState(d?.[o.id]?.collapsed??!1),Z=`${m}.lexical_internal_feature.blocks.lexical_blocks.${o.blockType}`,W=u.blocks?.[Z]?.[0],G=W.blockReferences?typeof W?.blockReferences?.[0]=="string"?_.blocksMap[W?.blockReferences?.[0]]:W?.blockReferences?.[0]:W?.blocks?.[0],{i18n:te,t:ce}=qa(),Y=yo(async({formState:j,submit:pe})=>{Io(g.current);let K=new AbortController;g.current=K;let{state:q}=await $({id:i,collectionSlug:l,docPermissions:{fields:!0},docPreferences:await w(),documentFormState:Gt(h),formState:j,globalSlug:s,initialBlockFormState:j,operation:"update",renderAllFields:!!pe,schemaPath:A,signal:K.signal});if(!q)return j;j.blockName&&(q.blockName=j.blockName);let J=sn(rn({fields:Gt(q)}),!0);if(setTimeout(()=>{O.update(()=>{let se=Wt(r);if(se&&pt(se)){let We=J;We.blockType=o.blockType,se.setFields(We,!0)}})},0),pe){v(q._components?.customComponents?.BlockLabel),F(q._components?.customComponents?.Block);let se=0;for(let We of Object.values(q))We?.valid===!1&&se++;I(se)}return q},[$,i,l,w,s,A,o.blockType,h,O,r]);vo(()=>()=>{Io(g.current)},[]);let V=yo(()=>{O.update(()=>{Wt(r)?.remove()})},[O,r]),oe=G?.labels?.singular?ec(G.labels.singular,te):G?.slug,re=yo(j=>{w().then(pe=>{let q=pe?.fields?.[c.name]?.collapsed,J=q&&q?.length?q:[];j?J.includes(o.id)||J.push(o.id):J.includes(o.id)&&J.splice(J.indexOf(o.id),1),M(c.name,{collapsed:J,hello:"hi"})})},[w,c.name,M,o.id]),le=mt(()=>()=>X(nn,{buttonStyle:"icon-label",className:`${ue}__editButton`,disabled:p,el:"button",icon:"edit",onClick:j=>(j.preventDefault(),j.stopPropagation(),C(),!1),onMouseDown:j=>{j.preventDefault()},round:!0,size:"small",tooltip:ce("lexical:blocks:inlineBlocks:edit",{label:oe})}),[oe,p,ce,C]),Ae=mt(()=>()=>X(nn,{buttonStyle:"icon-label",className:`${ue}__removeButton`,disabled:c?.admin?.readOnly||!1,icon:"x",onClick:j=>{j.preventDefault(),V()},round:!0,tooltip:"Remove Block"}),[c?.admin?.readOnly,V]),it=mt(()=>({children:j,disableBlockName:pe,editButton:K,errorCount:q,fieldHasErrors:J,Label:se,removeButton:We})=>X("div",{className:ue+" "+ue+"-"+o.blockType,children:X($a,{className:[`${ue}__row`,J?`${ue}__row--has-errors`:`${ue}__row--no-errors`].join(" "),collapsibleStyle:J?"error":"default",header:ut("div",{className:`${ue}__block-header`,children:[se??S?se??S:ut("div",{children:[X(Wa,{className:`${ue}__block-pill ${ue}__block-pill-${o?.blockType}`,pillStyle:"white",children:oe??o?.blockType}),!pe&&X(Ka,{path:"blockName",readOnly:c?.admin?.readOnly||!1}),J&&X(Ha,{count:q??0,i18n:te,withMessage:!0})]}),ut("div",{children:[k&&K!==!1||!k&&K?X(le,{}):null,We!==!1&&O.isEditable()?X(Ae,{}):null]})]}),isCollapsed:B,onToggle:$r=>{re($r),U($r)},children:j},0)}),[k,S,le,Ae,oe,O,o.blockType,te,B,re,c?.admin?.readOnly]),Dt=G?.fields??[],Fr=mt(()=>()=>X(Ba,{children:X(Pa,{className:"",slug:T,title:ce(`lexical:blocks:inlineBlocks:${o?.id?"edit":"create"}`,{label:oe??ce("lexical:blocks:inlineBlocks:label")}),children:E?ut(Fa,{children:[X(Va,{fields:Dt,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:A,permissions:!0,readOnly:!1}),X(Ga,{programmaticSubmit:!0,children:ce("fields:saveChanges")})]}):null})}),[E,T,oe,ce,G?.fields,A,a]),sa=mt(()=>E?X(ja,{beforeSubmit:[async({formState:j})=>await Y({formState:j,submit:!0})],el:"div",fields:Dt,initialState:E,onChange:[Y],onSubmit:(j,pe)=>{pe.blockType=o.blockType,O.update(()=>{let K=Wt(r);K&&pt(K)&&K.setFields(pe,!0)}),C()},submitted:n,uuid:tc(),children:X(on,{baseClass:ue,BlockDrawer:Fr,Collapsible:it,CustomBlock:k,EditButton:le,errorCount:L,formSchema:Dt,initialState:E,nodeKey:r,RemoveButton:Ae})}):null,[it,Fr,k,Dt,Ae,le,O,L,C,G?.fields,E,r,Y,n]);return G?sa:X(it,{disableBlockName:!0,fieldHasErrors:!0,children:ut("div",{className:"lexical-block-not-found",children:["Error: Block '",o.blockType,"' not found in the config but exists in the lexical data"]})})};var xe=class extends ct{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=Vt(e.fields);return o.setFormat(e.format),o}decorate(e,o){return oc(an,{cacheBuster:this.getCacheBuster(),formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Vt(t){return new xe({fields:{...t,id:t?.id||new rc.default().toHexString()}})}function pt(t){return t instanceof xe}import{createCommand as cn}from"lexical";var Ke=cn("INSERT_BLOCK_COMMAND"),Je=cn("INSERT_INLINE_BLOCK_COMMAND");import{c as nc}from"react/compiler-runtime";import{useLexicalComposerContext as ic}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as lc,$wrapNodeInElement as sc,mergeRegister as ac}from"@lexical/utils";import{formatDrawerSlug as cc,useEditDepth as uc}from"@payloadcms/ui";import{$createParagraphNode as dc,$getNodeByKey as mc,$getPreviousSelection as pc,$getSelection as fc,$insertNodes as hc,$isParagraphNode as dn,$isRangeSelection as gc,$isRootOrShadowRoot as Cc,COMMAND_PRIORITY_EDITOR as un}from"lexical";import{useEffect as xc,useState as bc}from"react";var mn=()=>{let t=nc(12),[e]=ic(),[o,r]=bc(null),{setCreatedInlineBlock:n,uuid:i}=H(),l=uc(),s="lexical-inlineBlocks-create-"+i,u;t[0]!==l||t[1]!==s?(u=cc({slug:s,depth:l}),t[0]=l,t[1]=s,t[2]=u):u=t[2];let c=u,{toggleDrawer:d}=ge(c,!0),a;t[3]!==e||t[4]!==n||t[5]!==o?(a=()=>{if(!e.hasNodes([xe]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return ac(e.registerCommand(Ke,m=>(e.update(()=>{let f=fc()||pc();if(gc(f)){let h=Vt(m);lc(h);let{focus:g}=f,b=g.getNode();dn(b)&&b.getTextContentSize()===0&&b.getParentOrThrow().getChildren().filter(_c).length>1&&b.remove()}}),!0),un),e.registerCommand(Je,m=>{if(o){let h=mc(o);return!h||!wo(h)?!1:(h.setFields(m),r(null),!0)}let f=To(m);return n?.(f),hc([f]),Cc(f.getParentOrThrow())&&sc(f,dc).selectEnd(),!0},un))},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],xc(a,p),null};function _c(t){return dn(t)}var Tc=R(({config:t,featureClientSchemaMap:e,props:o,schemaPath:r})=>{let n=`${r}.lexical_internal_feature.blocks.lexical_blocks`,i=`${r}.lexical_internal_feature.blocks.lexical_inline_blocks`,l=e.blocks;if(!l)return{};let s=Object.entries(l).filter(([a])=>a.startsWith(n+".")&&!a.replace(n+".","").includes(".")).map(([,a])=>a[0]),u=Object.entries(l).filter(([a])=>a.startsWith(i+".")&&!a.replace(i+".","").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:[xe,_o],plugins:[{Component:mn,position:"normal"}],sanitizedClientFeatureProps:o,slashMenu:{groups:[c?.length?{items:c.map(a=>({Icon:jt(a.imageURL,a.imageAltText),key:"block-"+a.slug,keywords:["block","blocks",a.slug],label:({i18n:p})=>a?.labels?.singular?Kt(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(Ke,{blockName:"",blockType:a.slug})}})),key:"blocks",label:({i18n:a})=>a.t("lexical:blocks:label")}:null,d?.length?{items:d.map(a=>({Icon:Ht,key:"inlineBlocks-"+a.slug,keywords:["inlineBlock","inline block",a.slug],label:({i18n:p})=>a?.labels?.singular?Kt(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(Je,{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:Bt,items:c.map((a,p)=>({ChildComponent:jt(a.imageURL,a.imageAltText),isActive:void 0,key:"block-"+a.slug,label:({i18n:m})=>a?.labels?.singular?Kt(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(Ke,{blockName:"",blockType:a.slug})},order:p})),key:"blocks",order:20}:null,d?.length?{type:"dropdown",ChildComponent:Ht,items:d.map((a,p)=>({ChildComponent:a.imageURL?jt(a.imageURL,a.imageAltText):Ht,isActive:void 0,key:"inlineBlock-"+a.slug,label:({i18n:m})=>a?.labels?.singular?Kt(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(Je,{blockName:"",blockType:a.slug})},order:p})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}});import{c as Ec}from"react/compiler-runtime";import{jsx as Fe,jsxs as Fo}from"react/jsx-runtime";import{useLexicalComposerContext as Nc}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as Lc,$createTextNode as Sc,$getRoot as Rc,getDOMSelection as Ao}from"lexical";import*as Cn from"react";import{useCallback as Oe,useEffect as Do,useLayoutEffect as fn,useRef as Oo,useState as Jt}from"react";var wc=ae&&"documentMode"in document?document.documentMode:null,pn=ae&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Ab=ae&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Db=ae&&"InputEvent"in window&&!wc?"getTargetRanges"in new window.InputEvent("input"):!1,Ob=ae&&/Version\/[\d.].*Safari/.test(navigator.userAgent),Fb=ae&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,$b=ae&&/Android/.test(navigator.userAgent),Pb=ae&&/Win/.test(navigator.platform),kc=ae&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Bb=ae&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!kc;var Ic=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)},yc=(t,e)=>{let o=document.createElement("a");o.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(e||"")),o.setAttribute("download",t),o.style.display="none",document.body?.appendChild(o),o.click(),document.body?.removeChild(o)},vc=t=>{let o=((r,n)=>{switch(r){case"click":return` await page.mouse.click(${n.x}, ${n.y});`;case"keydown":return` await page.keyboard.keydown('${n}');`;case"keyup":return` await page.keyboard.keyup('${n}');`;case"press":return` await page.keyboard.press('${n}');`;case"selectAll":return" await selectAll(page);";case"snapshot":return` await assertHTMLSnapshot(page);
|
|
4
4
|
await assertSelection(page, {
|
|
5
5
|
anchorPath: [${n.anchorPath.toString()}],
|
|
6
6
|
anchorOffset: ${n.anchorOffset},
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
`;case"type":return` await page.keyboard.type('${n}');`;default:return""}})(t.name,t.value);switch(t.count){case 1:return o;case 2:return[o,o].join(`
|
|
11
11
|
`);default:return` await repeat(${t.count}, async () => {
|
|
12
12
|
${o}
|
|
13
|
-
);`}};function
|
|
13
|
+
);`}};function Mc(t){return t.key.toLowerCase()==="a"&&(pn?t.metaKey:t.ctrlKey)}function Ac(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 hn(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 gn=new Set(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Backspace","Delete","Enter","Escape"]);function Dc(t){let[e,o]=Jt([]),[r,n]=Jt(!1),[,i]=Jt(""),[l,s]=Jt(""),u=Oo(null),c=Oo(!1),d=Oo(null),a=Oe(()=>t,[t]),p=Oe(()=>{let _=t.getRootElement(),T=Ao(t._window);return _==null||T==null||T.anchorNode==null||T.focusNode==null||!_.contains(T.anchorNode)||!_.contains(T.focusNode)?null:`
|
|
14
14
|
import {
|
|
15
15
|
initializeE2E,
|
|
16
16
|
assertHTMLSnapshot,
|
|
@@ -27,15 +27,15 @@ describe('Test case', () => {
|
|
|
27
27
|
const {page} = e2e;
|
|
28
28
|
|
|
29
29
|
await page.focus('div[contenteditable="true"]');
|
|
30
|
-
${e.map(
|
|
30
|
+
${e.map(vc).join(`
|
|
31
31
|
`)}
|
|
32
32
|
});
|
|
33
33
|
});
|
|
34
|
-
`},[t,e]),m=Oe((_,T)=>{o(C=>{let E=e.length-1,M=e[E];if(M&&M.name===_){if(_==="type")return[...e.slice(0,E),{...M,value:M.value+T}];if(M.value===T)return[...e.slice(0,E),{...M,count:M.count+1}]}return[...C,{name:_,count:1,value:T}]})},[e,o]);ln(()=>{let _=C=>{if(!r)return;let E=C.key;lc(C)?m("selectAll",""):an.has(E)?m("press",C.key):[...E].length>1?m("keydown",C.key):m("type",C.key)},T=C=>{if(!r)return;let E=C.key;!an.has(E)&&[...E].length>1&&m("keyup",C.key)};return t.registerRootListener((C,E)=>{E!==null&&(E.removeEventListener("keydown",_),E.removeEventListener("keyup",T)),C!==null&&(C.addEventListener("keydown",_),C.addEventListener("keyup",T))})},[t,r,m]),ln(()=>{d.current&&d.current.scrollTo(0,d.current.scrollHeight)},[p]),Io(()=>{if(e){let _=p();_!==null&&s(_),d.current&&d.current.scrollTo(0,d.current.scrollHeight)}},[p,e]),Io(()=>t.registerUpdateListener(({dirtyElements:T,dirtyLeaves:C,editorState:E})=>{if(!r)return;let M=E._selection,A=c.current,$=u.current;if(A!==M){if(C.size===0&&T.size===0&&!$){let k=Ro(t._window);if(k&&(k.anchorNode==null||k.focusNode==null))return}c.current=M}u.current=!1;let D=p();D!==null&&s(D)}),[t,p,r,m]),Io(()=>r?t.registerUpdateListener(()=>{let T=t.getRootElement();T!==null&&i(T?.innerHTML)}):void 0,[t,r]);let f=Oe(_=>{r||(_.update(()=>{let T=oc();T.clear();let C=tc();T.append(ec().append(C)),C.select()}),o([])),n(T=>!T)},[r]),h=Oe(()=>{if(!r)return;let _=Ro(t._window);if(_===null||_.anchorNode==null||_.focusNode==null)return;let{anchorNode:T,anchorOffset:C,focusNode:E,focusOffset:M}=sc(_),A=a().getRootElement(),$;T!==null&&($=sn(T,A));let D;E!==null&&(D=sn(E,A)),m("snapshot",{anchorNode:T,anchorOffset:C,anchorPath:$,focusNode:E,focusOffset:M,focusPath:D})},[m,r,a]),g=Oe(()=>{rc(p())},[p]),b=Oe(()=>{nc("test.js",p())},[p]);return[Fe("button",{className:`editor-dev-button ${r?"active":""}`,id:"test-recorder-button",onClick:_=>{f(a()),_.preventDefault()},title:r?"Disable test recorder":"Enable test recorder",type:"button",children:r?"Disable test recorder":"Enable test recorder"}),r?vo("div",{className:"test-recorder-output",children:[vo("div",{className:"test-recorder-toolbar",children:[Fe("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:_=>{h(),_.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),Fe("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:_=>{g(),_.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),Fe("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:_=>{b(),_.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),Fe("pre",{id:"test-recorder",ref:d,children:l})]}):null]}var un=()=>{let t=qa(3),[e]=Qa(),[o,r]=ac(e),n;return t[0]!==o||t[1]!==r?(n=vo(cn.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 cc=R({plugins:[{Component:un,position:"bottom"}]});import{c as uc}from"react/compiler-runtime";import{jsx as dc}from"react/jsx-runtime";import{useLexicalComposerContext as mc}from"@lexical/react/LexicalComposerContext.js";import{TreeView as pc}from"@lexical/react/LexicalTreeView.js";import"react";var dn=()=>{let t=uc(2),[e]=mc(),o;return t[0]!==e?(o=dc(pc,{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 fc=R({plugins:[{Component:dn,position:"bottom"}]});import{$isTableSelection as hc}from"@lexical/table";import{$isRangeSelection as gc,FORMAT_TEXT_COMMAND as Cc}from"lexical";import{jsx as mn}from"react/jsx-runtime";import"react";var pn=()=>mn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:mn("path",{d:"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 ee=t=>({type:"buttons",items:t,key:"format",order:40});var fn={type:"text-format",format:["bold","italic"],tag:"***"},hn={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},gn={type:"text-format",format:["bold"],tag:"**"},Cn={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var xn=[ee([{ChildComponent:pn,isActive:({selection:t})=>gc(t)||hc(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(Cc,"bold")},order:1}])],xc=R(({featureProviderMap:t})=>{let e=[gn,Cn];return t.get("italic")&&e.push(hn,fn),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:xn},toolbarInline:{groups:xn}}});import{$isTableSelection as _c}from"@lexical/table";import{$isRangeSelection as Tc,FORMAT_TEXT_COMMAND as Ec}from"lexical";import{jsx as bn,jsxs as bc}from"react/jsx-runtime";import"react";var _n=()=>bc("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[bn("path",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),bn("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var Tn={type:"text-format",format:["code"],tag:"`"};var En=[ee([{ChildComponent:_n,isActive:({selection:t})=>Tc(t)||_c(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(Ec,"code")},order:7}])],wc=R({enableFormats:["code"],markdownTransformers:[Tn],toolbarFixed:{groups:En},toolbarInline:{groups:En}});import{$isTableSelection as kc}from"@lexical/table";import{$isRangeSelection as Nc,FORMAT_TEXT_COMMAND as Lc}from"lexical";import{jsx as wn}from"react/jsx-runtime";import"react";var kn=()=>wn("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:wn("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 Nn={type:"text-format",format:["italic"],tag:"*"},Ln={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var Sn=[ee([{ChildComponent:kn,isActive:({selection:t})=>Nc(t)||kc(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(Lc,"italic")},order:2}])],Sc=R({enableFormats:["italic"],markdownTransformers:[Nn,Ln],toolbarFixed:{groups:Sn},toolbarInline:{groups:Sn}});import{$isTableSelection as Ic}from"@lexical/table";import{$isRangeSelection as yc,FORMAT_TEXT_COMMAND as vc}from"lexical";import{jsx as Rn,jsxs as Rc}from"react/jsx-runtime";import"react";var In=()=>Rc("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Rn("path",{d:"M5.50756 12.76H7.42756C7.56256 14.215 8.82256 14.71 10.1576 14.71C11.4326 14.71 12.4226 14.14 12.4226 13.06C12.4226 12.28 11.9576 11.845 10.6676 11.605L8.70256 11.245C7.12756 10.96 5.85256 10.21 5.85256 8.335C5.85256 6.43 7.53256 5.11 9.87256 5.11C12.4226 5.11 13.9526 6.22 14.1626 8.23H12.2876C12.1526 7.18 11.2226 6.595 9.88756 6.595C8.59756 6.595 7.78756 7.27 7.78756 8.215C7.78756 9.1 8.34256 9.385 9.49756 9.61L11.5676 10.015C13.3226 10.345 14.3726 11.215 14.3726 12.94C14.3726 14.89 12.5876 16.18 10.2176 16.18C7.66756 16.18 5.70256 15.115 5.50756 12.76Z",fill:"currentColor"}),Rn("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var yn={type:"text-format",format:["strikethrough"],tag:"~~"};var vn=[ee([{ChildComponent:In,isActive:({selection:t})=>yc(t)||Ic(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(vc,"strikethrough")},order:4}])],Mc=R({enableFormats:["strikethrough"],markdownTransformers:[yn],toolbarFixed:{groups:vn},toolbarInline:{groups:vn}});import{$isTableSelection as Dc}from"@lexical/table";import{$isRangeSelection as Ac,FORMAT_TEXT_COMMAND as Oc}from"lexical";import{jsx as Mn}from"react/jsx-runtime";import"react";var Dn=()=>Mn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Mn("path",{d:"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 An=[ee([{ChildComponent:Dn,isActive:({selection:t})=>Ac(t)||Dc(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(Oc,"subscript")},order:5}])],Fc=R({enableFormats:["subscript"],toolbarFixed:{groups:An},toolbarInline:{groups:An}});import{$isTableSelection as $c}from"@lexical/table";import{$isRangeSelection as Pc,FORMAT_TEXT_COMMAND as Bc}from"lexical";import{jsx as On}from"react/jsx-runtime";import"react";var Fn=()=>On("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:On("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 $n=[ee([{ChildComponent:Fn,isActive:({selection:t})=>Pc(t)||$c(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(Bc,"superscript")},order:6}])],Hc=R({enableFormats:["superscript"],toolbarFixed:{groups:$n},toolbarInline:{groups:$n}});import{$isTableSelection as Uc}from"@lexical/table";import{$isRangeSelection as Gc,FORMAT_TEXT_COMMAND as Wc}from"lexical";import{jsx as Pn,jsxs as jc}from"react/jsx-runtime";import"react";var Bn=()=>jc("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:"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"}),Pn("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var Hn=[ee([{ChildComponent:Bn,isActive:({selection:t})=>Gc(t)||Uc(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(Wc,"underline")},order:3}])],Vc=R({enableFormats:["underline"],toolbarFixed:{groups:Hn},toolbarInline:{groups:Hn}});import{$createHeadingNode as Yc,$isHeadingNode as ei,HeadingNode as Jc}from"@lexical/rich-text";import{$setBlocksType as Xc}from"@lexical/selection";import{$getSelection as qc,$isRangeSelection as Qc}from"lexical";import{jsx as jn}from"react/jsx-runtime";import"react";var Un=()=>jn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:jn("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 Gn}from"react/jsx-runtime";import"react";var Wn=()=>Gn("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:Gn("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 Vn}from"react/jsx-runtime";import"react";var Kn=()=>Vn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Vn("path",{d:"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 Zn}from"react/jsx-runtime";import"react";var zn=()=>Zn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Zn("path",{d:"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 Yn}from"react/jsx-runtime";import"react";var Jn=()=>Yn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Yn("path",{d:"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 Xn}from"react/jsx-runtime";import"react";var qn=()=>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",{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 Kc,$isHeadingNode as Zc,HeadingNode as zc}from"@lexical/rich-text";var Mo=t=>(e,o,r)=>{let n=t(r);n&&(n.append(...o),e.replace(n),n.select(0,0))};var Qn=t=>{let o=`^(${t.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`,r=new RegExp(o);return{type:"element",dependencies:[zc],export:(n,i)=>{if(!Zc(n))return null;let l=Number(n.getTag().slice(1));return"#".repeat(l)+" "+i(n)},regExp:r,replace:Mo(n=>{let i="h"+n[1]?.length;return Kc(i)})}};var ti=t=>{let e=qc();Xc(e,()=>Yc(t))},oi={h1:Un,h2:Wn,h3:Kn,h4:zn,h5:Jn,h6:qn},eu=R(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[ne(e.map((r,n)=>({ChildComponent:oi[r],isActive:({selection:i})=>{if(!Qc(i))return!1;for(let l of i.getNodes()){if(ei(l)&&l.getTag()===r)continue;let s=l.getParent();if(!(ei(s)&&s.getTag()===r))return!1}return!0},key:r,label:({i18n:i})=>i.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:i})=>{i.update(()=>{ti(r)})},order:n+2})))];return{markdownTransformers:[Qn(e)],nodes:[Jc],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[Q(e.map(r=>({Icon:oi[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(()=>{ti(r)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}});import{$isNodeSelection as gu}from"lexical";import{jsx as ri}from"react/jsx-runtime";import"react";var Do=()=>ri("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:ri("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as ni,jsxs as tu}from"react/jsx-runtime";import"react";var ii=()=>tu("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[ni("path",{d:"M5 10h10",stroke:"currentColor"}),ni("path",{d:"M10 15V5",stroke:"currentColor"})]});var be=t=>({type:"dropdown",ChildComponent:ii,items:t,key:"add",order:10});import{addClassNamesToElement as ou}from"@lexical/utils";import{$applyNodeReplacement as ru,createCommand as nu,DecoratorNode as iu}from"lexical";var mt=nu("INSERT_HORIZONTAL_RULE_COMMAND"),dt=class extends iu{static clone(e){return new this(e.__key)}static getType(){return"horizontalrule"}static importDOM(){return{hr:()=>({conversion:lu,priority:0})}}static importJSON(e){return li()}createDOM(e){let o=document.createElement("hr");return ou(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 lu(){return{node:li()}}function li(){return ru(new dt)}import{$applyNodeReplacement as su}from"lexical";import"react";var ye=class extends dt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return pt()}decorate(){return null}exportJSON(){return super.exportJSON()}};function pt(){return su(new ye)}function Gt(t){return t instanceof ye}var si={type:"element",dependencies:[ye],export:(t,e)=>Gt(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=pt();e&&t.replace(e)}};import{c as au}from"react/compiler-runtime";import{useLexicalComposerContext as cu}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as uu}from"@lexical/utils";import{$getSelection as du,$isRangeSelection as mu,COMMAND_PRIORITY_EDITOR as pu}from"lexical";import{useEffect as fu}from"react";var ai=()=>{let t=au(3),[e]=cu(),o,r;return t[0]!==e?(o=()=>e.registerCommand(mt,hu,pu),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),fu(o,r),null};function hu(t){let e=du();if(!mu(e))return!1;if(e.focus.getNode()!==null){let r=pt();uu(r)}return!0}var Cu=R({markdownTransformers:[si],nodes:[ye],plugins:[{Component:ai,position:"normal"}],slashMenu:{groups:[Q([{Icon:Do,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(mt,void 0)}}])]},toolbarFixed:{groups:[be([{ChildComponent:Do,isActive:({selection:t})=>{if(!gu(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Gt(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(mt,void 0)}}])]}});import{$findMatchingParent as gi}from"@lexical/utils";import{$isElementNode as Mu,$isRangeSelection as Du,INDENT_CONTENT_COMMAND as Au,OUTDENT_CONTENT_COMMAND as Ou}from"lexical";import{jsx as Wt,jsxs as xu}from"react/jsx-runtime";import"react";var ci=()=>xu("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Wt("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),Wt("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),Wt("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Wt("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as Vt,jsxs as bu}from"react/jsx-runtime";import"react";var ui=()=>bu("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Vt("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),Vt("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),Vt("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),Vt("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});import{jsx as _u}from"react/jsx-runtime";import{useLexicalComposerContext as Tu}from"@lexical/react/LexicalComposerContext";import{TabIndentationPlugin as Eu}from"@lexical/react/LexicalTabIndentationPlugin";import{$findMatchingParent as wu,mergeRegister as ku}from"@lexical/utils";import{$getSelection as Nu,$isElementNode as Lu,$isRangeSelection as Su,COMMAND_PRIORITY_LOW as di,INDENT_CONTENT_COMMAND as mi,KEY_TAB_COMMAND as Ru,OUTDENT_CONTENT_COMMAND as Iu,TabNode as yu}from"lexical";import{useEffect as pi}from"react";var fi=({clientProps:t})=>{let[e]=Tu(),{disabledNodes:o,disableTabNode:r}=t;return pi(()=>{if(!(!e||!o?.length))return e.registerCommand(mi,()=>vu(n=>{if(!o.includes(n.getType())){let i=n.getIndent();n.setIndent(i+1)}}),di)},[e,o]),pi(()=>{if(!(!e||!r))return ku(e.registerCommand(Ru,n=>(n.preventDefault(),e.dispatchCommand(n.shiftKey?Iu:mi,void 0)),di),e.registerNodeTransform(yu,n=>{n.remove()}))},[e,r]),_u(Eu,{})};function vu(t){let e=Nu();if(!Su(e))return!1;let o=new Set,r=e.getNodes();for(let n=0;n<r.length;n++){let i=r[n],l=i.getKey();if(o.has(l))continue;let s=wu(i,u=>Lu(u)&&!u.isInline());if(s===null)continue;let c=s.getKey();s.canIndent()&&!o.has(c)&&(o.add(c),t(s))}return o.size>0}var hi=t=>({type:"buttons",items:t,key:"indent",order:35});var Ci=({disabledNodes:t})=>[hi([{ChildComponent:ci,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes();if(!o?.length)return!1;let r=!1,n=i=>Mu(i)&&i.canIndent();for(let i of o)if(n(i)){if(i.getIndent()<=0)return!1;r=!0}return!r&&xi(e,i=>n(i)&&i.getIndent()>0)?!0:r},key:"indentDecrease",label:({i18n:e})=>e.t("lexical:indent:decreaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Ou,void 0)},order:1},{ChildComponent:ui,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes();return!o?.length||o.some(r=>t?.includes(r.getType()))?!1:!xi(e,r=>(t??[]).includes(r.getType()))},key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Au,void 0)},order:2}])],Fu=R(({props:t})=>{let e=t.disabledNodes??[];return{plugins:[{Component:fi,position:"normal"}],sanitizedClientFeatureProps:t,toolbarFixed:{groups:Ci({disabledNodes:e})},toolbarInline:{groups:Ci({disabledNodes:e})}}});function xi(t,e){return Du(t)&&(!!gi(t.anchor.getNode(),e)||!!gi(t.focus.getNode(),e))}import{$findMatchingParent as zd}from"@lexical/utils";import{$getSelection as Uo,$isRangeSelection as Yi}from"lexical";import{jsx as bi}from"react/jsx-runtime";import"react";var _i=()=>bi("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:bi("path",{d:"M8.5 11.5L11.5 8.5M8.5 7L9.625 5.875C10.868 4.633 12.882 4.633 14.125 5.875C15.368 7.118 15.368 9.133 14.125 10.375L13 11.5M7 8.5L5.746 9.754C4.56 10.94 4.519 12.85 5.652 14.087C6.814 15.354 8.78 15.449 10.058 14.298L11.5 13",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})});import{$isAtNodeEnd as Ti}from"@lexical/selection";function Ze(t){let{anchor:e}=t,{focus:o}=t,r=t.anchor.getNode(),n=t.focus.getNode();return r===n?r:t.isBackward()?Ti(o)?r:n:Ti(e)?r:n}var Ao=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as Zu}from"lexical";import{addClassNamesToElement as $u,isHTMLAnchorElement as Pu}from"@lexical/utils";import $o from"bson-objectid";import{$applyNodeReplacement as Bu,$createTextNode as Ei,$getSelection as Hu,$isElementNode as wi,$isRangeSelection as Fo,createCommand as ju,ElementNode as Uu}from"lexical";var Gu=new Set(["http:","https:","mailto:","sms:","tel:"]),ie=class t extends Uu{__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:Wu,priority:1})}}static importJSON(e){let o=_e({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),e.version===2&&!e.id&&(e.id=new $o.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=Oo(o.rel,"add","noopener")),$u(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(!Fo(o))return!1;let n=o.anchor.getNode(),i=o.focus.getNode();return this.isParentOf(n)&&this.isParentOf(i)&&o.getTextContent().length>0}getFields(){return this.getLatest().__fields}getID(){return this.getLatest().__id}insertNewAfter(e,o=!0){let r=this.getParentOrThrow().insertNewAfter(e,o);if(wi(r)){let n=_e({fields:this.__fields});return r.append(n),n}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!Gu.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,i=this.__fields?.newTab;return n!=null&&n!==e.__fields?.url&&this.__fields?.linkType==="custom"&&(o.href=n),this.__fields?.linkType==="internal"&&e.__fields?.linkType==="custom"&&o.removeAttribute("href"),o.rel==null&&(o.rel=""),i!==e.__fields?.newTab&&(i??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=Oo(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=Oo(o.rel,"remove","noopener"))),!1}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields).setID(e.id)}};function Wu(t){let e=null;if(Pu(t)){let o=t.textContent;o!==null&&o!==""&&(e=_e({id:new $o.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function _e({id:t,fields:e}){return Bu(new ie({id:t??new $o.default().toHexString(),fields:e}))}function Y(t){return t instanceof ie}var fe=ju("TOGGLE_LINK_COMMAND");function Po(t){let e=Hu();if(!Fo(e)&&(t===null||!t.selectedNodes?.length))return;let o=Fo(e)?e.extract():t===null?[]:t.selectedNodes;if(t===null){o?.forEach(i=>{let l=i.getParent();Y(l)&&(l.getChildren().forEach(c=>{l.insertBefore(c)}),l.remove())});return}if(o?.length===1){let i=o[0],l=Y(i)?i:Vu(i);if(l!==null){l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append(Ei(t.text)),l.getChildren().forEach(s=>{s!==l.getLastChild()&&s.remove()}));return}}let r=null,n=null;o?.forEach(i=>{let l=i.getParent();if(!(l===n||l===null||wi(i)&&!i.isInline())){if(Y(l)){n=l,l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append(Ei(t.text)),l.getChildren().forEach(s=>{s!==l.getLastChild()&&s.remove()}));return}if(l.is(r)||(r=l,n=_e({fields:t.fields}),Y(l)?i.getPreviousSibling()===null?l.insertBefore(n):l.insertAfter(n):i.insertBefore(n)),Y(i)){if(i.is(n))return;if(n!==null){let s=i.getChildren();n.append(...s)}i.remove();return}n!==null&&n.append(i)}})}function Vu(t){return Ku(t,e=>Y(e))}function Ku(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function Oo(t,e,o){let r,n=`${t}`;if(e==="add"){if(n.includes(o)){let i=new RegExp(o,"g");n=n.replace(i,"").trim()}n=n.trim(),r=n.length===0?`${o}`:`${n} ${o}`}else{let i=new RegExp(o,"g");r=n.replace(i,"").trim()}return r}var ki={type:"text-match",dependencies:[ie],export:(t,e)=>{if(!Y(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=_e({fields:{doc:null,linkType:"custom",newTab:!1,url:r}}),i=Zu(o);return i.setFormat(t.getFormat()),n.append(i),t.replace(n),i},trigger:")"};import{$applyNodeReplacement as zu,$isElementNode as Yu}from"lexical";var Te=class t extends ie{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=ft({}).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(Yu(r)){let n=ft({fields:this.__fields});return r.append(n),n}return null}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields)}};function ft({fields:t}){return zu(new Te({id:"",fields:t}))}function Ee(t){return t instanceof Te}import{c as Ju}from"react/compiler-runtime";import{useLexicalComposerContext as Xu}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as qu}from"@lexical/utils";import{$createTextNode as Ni,$getSelection as Qu,$isElementNode as Si,$isLineBreakNode as Ri,$isNodeSelection as ed,$isRangeSelection as td,$isTextNode as ht,TextNode as od}from"lexical";import{useEffect as rd}from"react";function Li(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 Ii(t,e){for(let o of e){let r=o(t);if(r!=null)return r}return null}var nd=/[.,;\s]/;function Zt(t){return t!==void 0&&nd.test(t)}function yi(t){return Zt(t[t.length-1])}function Ho(t){return Zt(t[0])}function id(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function vi(t){let e=t.getPreviousSibling();return Si(e)&&(e=e.getLastDescendant()),e===null||Ri(e)||ht(e)&&yi(e.getTextContent())}function Mi(t){let e=t.getNextSibling();return Si(e)&&(e=e.getFirstDescendant()),e===null||Ri(e)||ht(e)&&Ho(e.getTextContent())}function ld(t,e,o,r){return(t>0?Zt(o[t-1]):vi(r[0]))?e<o.length?Zt(o[e]):Mi(r[r.length-1]):!1}function sd(t,e,o){let r=[],n=[],i=[],l=0,s=0,c=[...t];for(;c.length>0;){let u=c[0],a=u.getTextContent().length,p=s;s+a<=e?(r.push(u),l+=a):p>=o?i.push(u):n.push(u),s+=a,c.shift()}return[l,r,n,i]}function ad(t,e,o,r){let n={linkType:"custom",url:r.url,...r.fields},i=ft({fields:n});if(t.length===1){let l=t[0],s;if(e===0?[s]=l.splitText(o):[,s]=l.splitText(e,o),s){let c=Ni(r.text);c.setFormat(s.getFormat()),c.setDetail(s.getDetail()),c.setStyle(s.getStyle()),i.append(c),s.replace(i)}return l}else if(t.length>1){let l=t[0],s=l.getTextContent().length,c;e===0?c=l:[,c]=l.splitText(e);let u=[],d;if(t.forEach(a=>{let m=a.getTextContent().length,f=s,h=s+m;if(f<o)if(h<=o)u.push(a);else{let[g,b]=a.splitText(o-f);g&&u.push(g),d=b}s+=m}),c){let a=Qu(),p=a?a.getNodes().find(ht):void 0,m=Ni(c.getTextContent());return m.setFormat(c.getFormat()),m.setDetail(c.getDetail()),m.setStyle(c.getStyle()),i.append(m,...u),p&&p===c&&(td(a)?m.select(a.anchor.offset,a.focus.offset):ed(a)&&m.select(0,m.getTextContent().length)),c.replace(i),d}}}function cd(t,e,o){let r=[...t],n=r.map(c=>c.getTextContent()).join(""),i=n,l,s=0;for(;(l=Ii(i,e))!=null&&l!==null;){let c=l.index,u=l.length,d=c+u;if(ld(s+c,s+d,n,r)){let[p,,m,f]=sd(r,s+c,s+d),h=s+c-p,g=s+d-p,b=ad(m,h,g,l);r=b?[b,...f]:f,o(l.url,null),s=0}else s+=d;i=i.substring(d)}}function Bo(t,e,o){let r=t.getChildren(),n=r.length;for(let c=0;c<n;c++){let u=r[c];if(!ht(u)||!u.isSimpleText()){Kt(t),o(null,t.getFields()?.url??null);return}}let i=t.getTextContent(),l=Ii(i,e);if(l===null||l.text!==i){Kt(t),o(null,t.getFields()?.url??null);return}if(!vi(t)||!Mi(t)){Kt(t),o(null,t.getFields()?.url??null);return}let s=t.getFields()?.url;if(s!==l?.url){let c=t.getFields();c.url=l?.url,t.setFields(c),o(l.url,s??null)}}function ud(t,e,o){let r=t.getPreviousSibling(),n=t.getNextSibling(),i=t.getTextContent();if(Ee(r)){let l=r.getFields()?.url?r.getFields()?.url?.startsWith("mailto:")??!1:!1;(!Ho(i)||id(i,l))&&(r.append(t),Bo(r,e,o),o(null,r.getFields()?.url??null))}Ee(n)&&!yi(i)&&(Kt(n),Bo(n,e,o),o(null,n.getFields()?.url??null))}function Kt(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 dd(t){let e=[t],o=t.getNextSibling();for(;o!==null&&ht(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function md(t,e,o){let r=Ju(5),n,i;r[0]!==t||r[1]!==e||r[2]!==o?(n=()=>{if(!t.hasNodes([Te]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let l=(s,c)=>{o?.(s,c)};return qu(t.registerNodeTransform(od,s=>{let c=s.getParentOrThrow(),u=s.getPreviousSibling();if(Ee(c))Bo(c,e,l);else if(!Y(c)){if(s.isSimpleText()&&(Ho(s.getTextContent())||!Ee(u))){let d=dd(s);cd(d,e,l)}ud(s,e,l)}}))},i=[t,e,o],r[0]=t,r[1]=e,r[2]=o,r[3]=n,r[4]=i):(n=r[3],i=r[4]),rd(n,i)}var pd=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,fd=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,hd=[Li(pd,t=>t.startsWith("http")?t:`https://${t}`),Li(fd,t=>`mailto:${t}`)],Di=()=>{let[t]=Xu();return md(t,hd),null};import{jsx as gd}from"react/jsx-runtime";import{ClickableLinkPlugin as Cd}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var Ai=()=>gd(Cd,{});import{jsx as Od}from"react/jsx-runtime";import"react";import{createPortal as Fd}from"react-dom";import{jsx as we,jsxs as gt,Fragment as bd}from"react/jsx-runtime";import{useLexicalComposerContext as _d}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as Oi,mergeRegister as Fi}from"@lexical/utils";import{getTranslation as jo}from"@payloadcms/translations";import{CloseMenuIcon as Td,EditIcon as Ed,ExternalLinkIcon as $i,formatDrawerSlug as wd,useConfig as kd,useEditDepth as Nd,useLocale as Ld,useTranslation as Sd}from"@payloadcms/ui";import{requests as Rd}from"@payloadcms/ui/shared";import{$getSelection as Pi,$isLineBreakNode as Id,$isRangeSelection as Bi,COMMAND_PRIORITY_HIGH as yd,COMMAND_PRIORITY_LOW as Hi,getDOMSelection as vd,KEY_ESCAPE_COMMAND as Md,SELECTION_CHANGE_COMMAND as Dd}from"lexical";import ji,{useCallback as Ui,useEffect as Jt,useRef as Ad,useState as $e}from"react";function zt(t,e,o,r=10,n=5){let i=o.parentElement;if(t===null||i==null){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let l=e.getBoundingClientRect(),s=o.getBoundingClientRect(),c=i.getBoundingClientRect(),u=t.top-r,d=t.left-n;u<c.top&&(u+=l.height+t.height+r*2),d+l.width>c.right&&(d=c.right-l.width-n),u-=s.top,d-=s.left,e.style.opacity="1",e.style.transform=`translate(${d}px, ${u}px)`}import{createCommand as xd}from"lexical";var Yt=xd("TOGGLE_LINK_WITH_MODAL_COMMAND");function Gi(t){t.preventDefault()}function Wi({anchorElem:t}){let[e]=_d(),[o,r]=$e(),n=Ad(null),[i,l]=$e(null),[s,c]=$e(null),{fieldProps:{schemaPath:u},uuid:d}=H(),{config:a,getEntityConfig:p}=kd(),{i18n:m,t:f}=Sd(),[h,g]=$e(),b=Nd(),[L,I]=$e(!1),[_,T]=$e([]),C=Ld(),[E,M]=$e(!1),A=wd({slug:"lexical-rich-text-link-"+d,depth:b}),{toggleDrawer:$}=ge(A),D=Ui(()=>{I(!1),n&&n.current&&(n.current.style.opacity="0",n.current.style.transform="translate(-10000px, -10000px)"),M(!1),l(null),c(null),T([]),g(void 0)},[I,l,c,T]),k=Ui(()=>{let x=Pi(),N;if(!Bi(x)||!x){D();return}let y=Ze(x);N=e.getElementByKey(y.getKey())?.getBoundingClientRect();let S=Oi(y,Y),v=x.getNodes().filter(W=>!Id(W)).find(W=>{let G=Oi(W,Y);return S&&!S.is(G)||G&&!G.is(S)});if(S==null||v){D();return}r(S);let w=S.getFields(),O={...w,id:S.getID(),text:S.getTextContent()};if(w?.linkType==="custom")l(w?.url??null),c(null);else{l(`${a.routes.admin==="/"?"":a.routes.admin}/collections/${w?.doc?.relationTo}/${w?.doc?.value}`);let W=w?.doc?.relationTo?p({collectionSlug:w?.doc?.relationTo}):void 0;if(!W)c(w?.label?String(w?.label):null),l(w?.url?String(w?.url):null);else{let G=typeof w.doc?.value=="object"?w.doc.value.id:w.doc?.value,te=w.doc?.relationTo;if(!G||!te)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let ce=f("fields:linkedTo",{label:`${jo(W.labels.singular,m)} - ${f("lexical:link:loadingWithEllipsis",m)}`}).replace(/<[^>]*>?/g,"");c(ce),Rd.get(`${a.serverURL}${a.routes.api}/${te}/${G}`,{headers:{"Accept-Language":m.language},params:{depth:0,locale:C?.code}}).then(async X=>{if(!X.ok)throw new Error(`HTTP error! Status: ${X.status}`);let V=await X.json(),oe=W?.admin?.useAsTitle||"id",re=V[oe],le=f("fields:linkedTo",{label:`${jo(W.labels.singular,m)} - ${re}`}).replace(/<[^>]*>?/g,"");c(le)}).catch(()=>{let X=f("fields:linkedTo",{label:`${jo(W.labels.singular,m)} - ${f("general:untitled",m)} - ID: ${G}`}).replace(/<[^>]*>?/g,"");c(X)})}}g(O),I(!0),T(x?x?.getNodes():[]),Ee(S)?M(!0):M(!1);let B=n.current,U=vd(e._window),{activeElement:J}=document;if(B===null)return;let Ue=e.getRootElement();return U!==null&&Ue!==null&&Ue.contains(U.anchorNode)?(N||(N=U.getRangeAt(0).getBoundingClientRect()),N!=null&&(N.y+=40,zt(N,B,t))):(J==null||J.className!=="link-input")&&(Ue!==null&&zt(null,B,t),l(null),c(null)),!0},[e,D,a.routes.admin,a.routes.api,a.serverURL,p,f,m,C?.code,t]);return Jt(()=>Fi(e.registerCommand(Yt,x=>(e.dispatchCommand(fe,x),k(),$(),!0),Hi)),[e,k,$,A]),Jt(()=>{let x=t.parentElement,N=()=>{e.getEditorState().read(()=>{k()})};return window.addEventListener("resize",N),x?.addEventListener("scroll",N),()=>{window.removeEventListener("resize",N),x?.removeEventListener("scroll",N)}},[t.parentElement,e,k]),Jt(()=>Fi(e.registerUpdateListener(({editorState:x})=>{x.read(()=>{k()})}),e.registerCommand(Dd,()=>(k(),!0),Hi),e.registerCommand(Md,()=>L?(D(),!0):!1,yd)),[e,k,L,D]),Jt(()=>{e.getEditorState().read(()=>{k()})},[e,k]),gt(ji.Fragment,{children:[we("div",{className:"link-editor",ref:n,children:gt("div",{className:"link-input",children:[i&&i.length>0?gt("a",{href:i,rel:"noopener noreferrer",target:"_blank",children:[o?.__fields.newTab?we($i,{}):null,s!=null&&s.length>0?s:i]}):s!=null&&s.length>0?gt(bd,{children:[o?.__fields.newTab?we($i,{}):null,we("span",{className:"link-input__label-pure",children:s})]}):null,e.isEditable()&>(ji.Fragment,{children:[we("button",{"aria-label":"Edit link",className:"link-edit",onClick:x=>{x.preventDefault(),$()},onMouseDown:Gi,tabIndex:0,type:"button",children:we(Ed,{})}),!E&&we("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(fe,null)},onMouseDown:Gi,tabIndex:0,type:"button",children:we(Td,{})})]})]})}),we(rt,{className:"lexical-link-edit-drawer",data:h,drawerSlug:A,drawerTitle:f("fields:editLink"),featureKey:"link",handleDrawerSubmit:(x,N)=>{let y=N,S={...y};delete S.text,e.update(()=>{let v=Pi(),w=null;if(Bi(v)?w=Ze(v).getParent():_.length&&(w=_[0]?.getParent()??null),w&&Ee(w)){let O=_e({fields:S});w.replace(O,!0)}}),e.dispatchCommand(fe,{fields:S,selectedNodes:_,text:y.text})},schemaPath:u,schemaPathSuffix:"fields"})]})}var Vi=t=>{let{anchorElem:e=document.body}=t;return Fd(Od(Wi,{anchorElem:e}),e)};import{c as Bd}from"react/compiler-runtime";import{useLexicalComposerContext as Hd}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as jd}from"@lexical/utils";import{$getSelection as Ud,$isElementNode as Gd,$isRangeSelection as Wd,COMMAND_PRIORITY_LOW as Zi,PASTE_COMMAND as Vd}from"lexical";import{useEffect as Kd}from"react";var $d=/^(?:[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+)?$/,Pd=/^(?:\/[\w\-./]*(?:#\w[\w-]*)?|#[\w\-]+)$/;function Ki(t){if(!t)return!1;if(t==="https://"||$d.test(t)||Pd.test(t))return!0;try{return new URL(t),!0}catch{}return!1}var zi=t=>{let e=Bd(5),{clientProps:o}=t,[r]=Hd(),n,i;return e[0]!==o.defaultLinkType||e[1]!==o.defaultLinkURL||e[2]!==r?(n=()=>{if(!r.hasNodes([ie]))throw new Error("LinkPlugin: LinkNode not registered on editor");return jd(r.registerCommand(fe,l=>l===null?(Po(null),!0):(l.fields?.linkType||(l.fields.linkType=o.defaultLinkType),l.fields?.url||(l.fields.url=o.defaultLinkURL),Po(l),!0),Zi),r.registerCommand(Vd,l=>{let s=Ud();if(!Wd(s)||s.isCollapsed()||!(l instanceof ClipboardEvent)||l.clipboardData==null)return!1;let c=l.clipboardData.getData("text");if(!Ki(c))return!1;if(!s.getNodes().some(Zd)){let u={doc:null,linkType:"custom",newTab:!1,url:c};return r.dispatchCommand(fe,{fields:u,text:null}),l.preventDefault(),!0}return!1},Zi))},i=[o.defaultLinkType,o.defaultLinkURL,r],e[0]=o.defaultLinkType,e[1]=o.defaultLinkURL,e[2]=r,e[3]=n,e[4]=i):(n=e[3],i=e[4]),Kd(n,i),null};function Zd(t){return Gd(t)}var Ji=[Ao([{ChildComponent:_i,isActive:({selection:t})=>{if(Yi(t)){let e=Ze(t);return zd(e,Y)!=null}return!1},isEnabled:({selection:t})=>!!(Yi(t)&&Uo()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(fe,null);else{let o,r=[];if(t.getEditorState().read(()=>{o=Uo()?.getTextContent(),r=Uo()?.getNodes()??[]}),!o?.length)return;let n={doc:null,newTab:!1};t.dispatchCommand(Yt,{fields:n,selectedNodes:r,text:o})}},order:1}])],Yd=R(({props:t})=>({markdownTransformers:[ki],nodes:[ie,t?.disableAutoLinks===!0?null:Te].filter(Boolean),plugins:[{Component:zi,position:"normal"},t?.disableAutoLinks===!0||t?.disableAutoLinks==="creationOnly"?null:{Component:Di,position:"normal"},{Component:Ai,position:"normal"},{Component:Vi,position:"floatingAnchorElem"}].filter(Boolean),sanitizedClientFeatureProps:t,toolbarFixed:{groups:Ji},toolbarInline:{groups:Ji}}));import{$isListNode as Vo,INSERT_CHECK_LIST_COMMAND as ol,ListItemNode as sm,ListNode as am}from"@lexical/list";import{$isRangeSelection as cm}from"lexical";import{jsx as Xi,jsxs as Jd}from"react/jsx-runtime";import"react";var Go=()=>Jd("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:[Xi("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),Xi("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Xd}from"react/jsx-runtime";import{ListPlugin as qd}from"@lexical/react/LexicalListPlugin.js";import"react";var ze=()=>Xd(qd,{});function Ye(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as om,ListItemNode as rm,ListNode as nm}from"@lexical/list";import{$createListItemNode as Qd,$createListNode as em,$isListItemNode as tm,$isListNode as Wo}from"@lexical/list";var qi=4,Je=t=>(e,o,r)=>{let n=e.getPreviousSibling(),i=e.getNextSibling(),l=Qd(t==="check"?r[3]==="x":void 0);if(Wo(i)&&i.getListType()===t){let c=i.getFirstChild();c!==null?c.insertBefore(l):i.append(l),e.remove()}else if(Wo(n)&&n.getListType()===t)n.append(l),e.remove();else{let c=em(t,t==="number"?Number(r[2]):void 0);c.append(l),e.replace(c)}l.append(...o),l.select(0,0);let s=Math.floor(r[1].length/qi);s&&l.setIndent(s)},Pe=(t,e,o)=>{let r=[],n=t.getChildren(),i=0;for(let l of n)if(tm(l)){if(l.getChildrenSize()===1){let d=l.getFirstChild();if(Wo(d)){r.push(Pe(d,e,o+1));continue}}let s=" ".repeat(o*qi),c=t.getListType(),u=c==="number"?`${t.getStart()+i}. `:c==="check"?`- [${l.getChecked()?"x":" "}] `:"- ";r.push(s+u+e(l)),i++}return r.join(`
|
|
36
|
-
`)};var Qi={type:"element",dependencies:[nm,rm],export:(t,e)=>om(t)?Pe(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:Je("check")};import{jsx as im}from"react/jsx-runtime";import{CheckListPlugin as lm}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var el=()=>im(lm,{});var tl=[ne([{ChildComponent:Go,isActive:({selection:t})=>{if(!cm(t))return!1;for(let e of t.getNodes()){if(Vo(e)&&e.getListType()==="check")continue;let o=e.getParent();if(Vo(o)&&o.getListType()==="check")continue;let r=o?.getParent();if(!(Vo(r)&&r.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(ol,void 0)},order:12}])],um=R(({featureProviderMap:t})=>{let e=[{Component:el,position:"normal"}];return!t.has("unorderedList")&&!t.has("orderedList")&&e.push({Component:ze,position:"normal"}),{markdownTransformers:[Qi],nodes:t.has("unorderedList")||t.has("orderedList")?[]:[am,sm],plugins:e,slashMenu:{groups:[Ye([{Icon:Go,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:o})=>o.t("lexical:checklist:label"),onSelect:({editor:o})=>{o.dispatchCommand(ol,void 0)}}])]},toolbarFixed:{groups:tl},toolbarInline:{groups:tl}}});import{$isListNode as Zo,INSERT_ORDERED_LIST_COMMAND as il,ListItemNode as hm,ListNode as gm}from"@lexical/list";import{$isRangeSelection as Cm}from"lexical";import{jsx as Ct,jsxs as dm}from"react/jsx-runtime";import"react";var Ko=()=>dm("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 mm,ListItemNode as pm,ListNode as fm}from"@lexical/list";var rl={type:"element",dependencies:[fm,pm],export:(t,e)=>mm(t)?Pe(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:Je("number")};var nl=[ne([{ChildComponent:Ko,isActive:({selection:t})=>{if(!Cm(t))return!1;for(let e of t.getNodes()){if(Zo(e)&&e.getListType()==="number")continue;let o=e.getParent();if(Zo(o)&&o.getListType()==="number")continue;let r=o?.getParent();if(!(Zo(r)&&r.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(il,void 0)},order:10}])],xm=R(({featureProviderMap:t})=>({markdownTransformers:[rl],nodes:t.has("orderedList")?[]:[gm,hm],plugins:t.has("orderedList")?[]:[{Component:ze,position:"normal"}],slashMenu:{groups:[Ye([{Icon:Ko,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:e})=>e.t("lexical:orderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(il,void 0)}}])]},toolbarFixed:{groups:nl},toolbarInline:{groups:nl}}));import{$isListNode as Yo,INSERT_UNORDERED_LIST_COMMAND as al,ListItemNode as wm,ListNode as km}from"@lexical/list";import{$isRangeSelection as Nm}from"lexical";import{jsx as Xe,jsxs as bm}from"react/jsx-runtime";import"react";var zo=()=>bm("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:[Xe("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Xe("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Xe("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Xe("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),Xe("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),Xe("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as _m,ListItemNode as Tm,ListNode as Em}from"@lexical/list";var ll={type:"element",dependencies:[Em,Tm],export:(t,e)=>_m(t)?Pe(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:Je("bullet")};var sl=[ne([{ChildComponent:zo,isActive:({selection:t})=>{if(!Nm(t))return!1;for(let e of t.getNodes()){if(Yo(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(Yo(o)&&o.getListType()==="bullet")continue;let r=o?.getParent();if(!(Yo(r)&&r.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(al,void 0)},order:11}])],Lm=R({markdownTransformers:[ll],nodes:[km,wm],plugins:[{Component:ze,position:"normal"}],slashMenu:{groups:[Ye([{Icon:zo,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(al,void 0)}}])]},toolbarFixed:{groups:sl},toolbarInline:{groups:sl}});import{jsx as Sm}from"react/jsx-runtime";import{addClassNamesToElement as Rm}from"@lexical/utils";import{DecoratorNode as Im}from"lexical";import*as cl from"react";var ym=cl.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),xt=class t extends Im{__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 vm({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return Rm(o,"unknownConverted"),o}decorate(){return Sm(ym,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function vm({data:t}){return new xt({data:t})}var Mm=R(()=>({nodes:[xt]}));import{jsx as Dm}from"react/jsx-runtime";import{addClassNamesToElement as Am}from"@lexical/utils";import{DecoratorNode as Om}from"lexical";import*as ul from"react";var Fm=ul.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),bt=class t extends Om{__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 $m({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return Am(o,"unknownConverted"),o}decorate(){return Dm(Fm,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function $m({data:t}){return new bt({data:t})}var Pm=R(()=>({nodes:[bt]}));import{$setBlocksType as pl}from"@lexical/selection";import{$createParagraphNode as fl,$getSelection as hl,$isParagraphNode as dl,$isRangeSelection as Bm}from"lexical";var ml=[ne([{ChildComponent:it,isActive:({selection:t})=>{if(!Bm(t))return!1;for(let e of t.getNodes())if(!dl(e)&&!dl(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=hl();pl(e,()=>fl())})},order:1}])],Hm=R({slashMenu:{groups:[Q([{Icon:it,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=hl();pl(e,()=>fl())})}}])]},toolbarFixed:{groups:ml},toolbarInline:{groups:ml}});import{$isNodeSelection as kp}from"lexical";import{jsx as _t,jsxs as jm}from"react/jsx-runtime";import"react";var Jo=()=>jm("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:[_t("g",{clipPath:"url(#clip0_4397_10817)",children:_t("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"})}),_t("defs",{children:_t("clipPath",{id:"clip0_4397_10817",children:_t("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{jsx as Wm}from"react/jsx-runtime";import*as Cl from"react";import{DecoratorBlockNode as Um}from"@lexical/react/LexicalDecoratorBlockNode.js";function Gm(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:gl({relationTo:o,value:e})}:null}var Tt=class extends Um{__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:Gm,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=gl(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 gl(t){return new Tt({data:t})}var Vm=Cl.lazy(()=>import("./RelationshipComponent-APF3CN47.js").then(t=>({default:t.RelationshipComponent})));function Km(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Be({relationTo:o,value:e})}:null}var ke=class extends Tt{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:Km,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=Be(o);return r.setFormat(e.format),r}decorate(e,o){return Wm(Vm,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Be(t){return new ke({data:t})}function Xo(t){return t instanceof ke}import{c as up}from"react/compiler-runtime";import{jsx as dp}from"react/jsx-runtime";import{useLexicalComposerContext as mp}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as pp}from"@lexical/utils";import{useConfig as fp}from"@payloadcms/ui";import{$getPreviousSelection as hp,$getSelection as gp,$isParagraphNode as wl,$isRangeSelection as Cp,COMMAND_PRIORITY_EDITOR as xp,createCommand as bp}from"lexical";import{useEffect as _p}from"react";import{c as np}from"react/compiler-runtime";import{jsx as Xt}from"react/jsx-runtime";import{useLexicalComposerContext as ip}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as lp,COMMAND_PRIORITY_EDITOR as sp}from"lexical";import{useEffect as ap,useState as _l}from"react";import{c as Zm}from"react/compiler-runtime";import{jsx as zm}from"react/jsx-runtime";import{useLexicalComposerContext as Ym}from"@lexical/react/LexicalComposerContext";import{useListDrawer as Jm,useModal as Xm}from"@payloadcms/ui";import{$getNodeByKey as xl,$getPreviousSelection as qm,$getRoot as Qm,$getSelection as ep,$isRangeSelection as tp,$setSelection as op}from"lexical";import{useEffect as rp,useState as bl}from"react";var Et=t=>{let e=Zm(23),[o]=Ym(),[r,n]=bl(null),[i,l]=bl(!1),[s,c,u]=Jm(t),{closeDrawer:d,drawerSlug:a,isDrawerOpen:p,openDrawer:m}=u,{modalState:f}=Xm(),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let $=ep()??qm();n($)},e[0]=h):h=e[0];let g=h,b;e[1]!==o||e[2]!==r?(b=()=>{r&&o.update(()=>{if(tp(r)){let{anchor:$,focus:D}=r;xl($.key)&&xl(D.key)&&op(r.clone())}else Qm().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=r,e[3]=b):b=e[3];let L=b,I;e[4]!==d?(I=()=>{d()},e[4]=d,e[5]=I):I=e[5];let _=I,T,C;e[6]!==a||e[7]!==f||e[8]!==L||e[9]!==i?(T=()=>{if(!i)return;let $=f[a];$&&!$?.isOpen&&(l(!1),setTimeout(()=>{L()},1))},C=[f,a,L,i],e[6]=a,e[7]=f,e[8]=L,e[9]=i,e[10]=T,e[11]=C):(T=e[10],C=e[11]),rp(T,C);let E;e[12]!==c?(E=$=>zm(c,{...$,onClick:()=>{g()}}),e[12]=c,e[13]=E):E=e[13];let M;e[14]!==m?(M=()=>{g(),m(),l(!0)},e[14]=m,e[15]=M):M=e[15];let A;return e[16]!==s||e[17]!==_||e[18]!==p||e[19]!==a||e[20]!==E||e[21]!==M?(A={closeListDrawer:_,isListDrawerOpen:p,ListDrawer:s,listDrawerSlug:a,ListDrawerToggler:E,openListDrawer:M},e[16]=s,e[17]=_,e[18]=p,e[19]=a,e[20]=E,e[21]=M,e[22]=A):A=e[22],A};var cp=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=lp(o);n&&n.replace(Be({relationTo:e,value:r}))}):t.dispatchCommand(qo,{relationTo:e,value:r})},Tl=t=>{let e=np(16),{enabledCollectionSlugs:o}=t,[r]=ip(),n;e[0]!==o?(n=()=>o?.[0],e[0]=o,e[1]=n):n=e[1];let[i]=_l(n),[l,s]=_l(null),c=o||void 0,u;e[2]!==i||e[3]!==c?(u={collectionSlugs:c,selectedCollection:i},e[2]=i,e[3]=c,e[4]=u):u=e[4];let{closeListDrawer:d,ListDrawer:a,openListDrawer:p}=Et(u),m,f;e[5]!==r||e[6]!==p?(m=()=>r.registerCommand(nt,L=>(s(L?.replace?L?.replace.nodeKey:null),p(),!0),sp),f=[r,p],e[5]=r,e[6]=p,e[7]=m,e[8]=f):(m=e[7],f=e[8]),ap(m,f);let h;e[9]!==d||e[10]!==r||e[11]!==l?(h=L=>{let{collectionSlug:I,doc:_}=L;cp({editor:r,relationTo:I,replaceNodeKey:l,value:_.id}),d()},e[9]=d,e[10]=r,e[11]=l,e[12]=h):h=e[12];let g=h,b;return e[13]!==a||e[14]!==g?(b=Xt(a,{onSelect:g}),e[13]=a,e[14]=g,e[15]=b):b=e[15],b},El=t=>(t?.enabledCollectionSlugs?.length??-1)>0?Xt(Tl,{...t}):Xt(yt,{...t,children:Xt(Tl,{...t})});var qo=bp("INSERT_RELATIONSHIP_COMMAND"),kl=t=>{let e=up(10),{clientProps:o}=t,[r]=mp(),{config:n}=fp(),{collections:i}=n,l=null;if(o?.enabledCollections)l=o?.enabledCollections;else if(o?.disabledCollections){let d;if(e[0]!==o?.disabledCollections||e[1]!==i){let a;e[3]!==o?.disabledCollections?(a=p=>{let{slug:m}=p;return!o?.disabledCollections?.includes(m)},e[3]=o?.disabledCollections,e[4]=a):a=e[4],d=i.filter(a).map(Tp),e[0]=o?.disabledCollections,e[1]=i,e[2]=d}else d=e[2];l=d}let s,c;e[5]!==r?(s=()=>{if(!r.hasNodes([ke]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return r.registerCommand(qo,wp,xp)},c=[r],e[5]=r,e[6]=s,e[7]=c):(s=e[6],c=e[7]),_p(s,c);let u;return e[8]!==l?(u=dp(El,{enabledCollectionSlugs:l}),e[8]=l,e[9]=u):u=e[9],u};function Tp(t){let{slug:e}=t;return e}function Ep(t){return wl(t)}function wp(t){let e=gp()||hp();if(Cp(e)){let o=Be(t);pp(o);let{focus:r}=e,n=r.getNode();wl(n)&&n.getTextContentSize()===0&&n.getParentOrThrow().getChildren().filter(Ep).length>1&&n.remove()}return!0}var Np=R({nodes:[ke],plugins:[{Component:kl,position:"normal"}],slashMenu:{groups:[Q([{Icon:Jo,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(nt,{replace:!1})}}])]},toolbarFixed:{groups:[be([{ChildComponent:Jo,isActive:({selection:t})=>{if(!kp(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Xo(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(nt,{replace:!1})}}])]}});import{c as yl}from"react/compiler-runtime";import{jsx as de,jsxs as Kp}from"react/jsx-runtime";import{useLexicalComposerContext as Zp}from"@lexical/react/LexicalComposerContext.js";import{useScrollInfo as zp,useThrottledEffect as Yp,useTranslation as Jp}from"@payloadcms/ui";import*as Ne from"react";import{useMemo as Xp}from"react";import{c as Lp}from"react/compiler-runtime";import{jsx as Sp}from"react/jsx-runtime";import{mergeRegister as Rp}from"@lexical/utils";import{$addUpdateTag as Ip,$getSelection as yp}from"lexical";import{useEffect as qt,useState as Qo}from"react";var er="toolbar-popup__button",wt=t=>{let e=Lp(34),{children:o,editor:r,item:n}=t,[i,l]=Qo(!0),[s,c]=Qo(!1),[u,d]=Qo(er),a=H(),p;e[0]!==s||e[1]!==r||e[2]!==a||e[3]!==i||e[4]!==n?(p=()=>{r.getEditorState().read(()=>{let M=yp();if(M){if(n.isActive){let A=n.isActive({editor:r,editorConfigContext:a,selection:M});s!==A&&c(A)}if(n.isEnabled){let A=n.isEnabled({editor:r,editorConfigContext:a,selection:M});i!==A&&l(A)}}})},e[0]=s,e[1]=r,e[2]=a,e[3]=i,e[4]=n,e[5]=p):p=e[5];let m=p,f,h;e[6]!==m?(f=()=>{m()},h=[m],e[6]=m,e[7]=f,e[8]=h):(f=e[7],h=e[8]),qt(f,h);let g,b;e[9]!==m?(g=()=>(document.addEventListener("mouseup",m),()=>{document.removeEventListener("mouseup",m)}),b=[m],e[9]=m,e[10]=g,e[11]=b):(g=e[10],b=e[11]),qt(g,b);let L,I;e[12]!==r||e[13]!==m?(L=()=>Rp(r.registerUpdateListener(()=>{m()})),I=[r,m],e[12]=r,e[13]=m,e[14]=L,e[15]=I):(L=e[14],I=e[15]),qt(L,I);let _;e[16]!==s||e[17]!==i||e[18]!==n.key?(_=()=>{d([er,i===!1?"disabled":"",s?"active":"",n?.key?`${er}-`+n.key:""].filter(Boolean).join(" "))},e[16]=s,e[17]=i,e[18]=n.key,e[19]=_):_=e[19];let T;e[20]!==s||e[21]!==u||e[22]!==i||e[23]!==n.key?(T=[i,s,u,n.key],e[20]=s,e[21]=u,e[22]=i,e[23]=n.key,e[24]=T):T=e[24],qt(_,T);let C;e[25]!==s||e[26]!==r||e[27]!==i||e[28]!==n?(C=()=>{if(i!==!1)return r.focus(()=>{r.update(vp),n.onSelect?.({editor:r,isActive:s})}),!0},e[25]=s,e[26]=r,e[27]=i,e[28]=n,e[29]=C):C=e[29];let E;return e[30]!==o||e[31]!==u||e[32]!==C?(E=Sp("button",{className:u,onClick:C,onMouseDown:Mp,type:"button",children:o}),e[30]=o,e[31]=u,e[32]=C,e[33]=E):E=e[33],E};function vp(){Ip("toolbar")}function Mp(t){t.preventDefault()}import{c as Hp}from"react/compiler-runtime";import{jsx as qe}from"react/jsx-runtime";import rr,{useCallback as jp,useEffect as Il}from"react";import{mergeRegister as Up}from"@lexical/utils";import{useTranslation as Gp}from"@payloadcms/ui";import{$getSelection as Wp}from"lexical";import{jsx as ve,jsxs as Nl}from"react/jsx-runtime";import{Button as Dp}from"@payloadcms/ui";import{$addUpdateTag as Ap,isDOMNode as Op}from"lexical";import Qt,{useCallback as Fp,useEffect as kt,useMemo as $p,useRef as or,useState as eo}from"react";import{createPortal as Pp}from"react-dom";var tr="toolbar-popup__dropdown-item",Ll=Qt.createContext(null);function Sl({active:t,children:e,editor:o,enabled:r,Icon:n,item:i,tooltip:l}){let[s,c]=eo(tr);kt(()=>{c([tr,r===!1?"disabled":"",t?"active":"",i?.key?`${tr}-${i.key}`:""].filter(Boolean).join(" "))},[r,t,s,i.key]);let u=or(null),d=Qt.use(Ll);if(d===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=d;return kt(()=>{u?.current!=null&&a(u)},[u,a]),ve(Dp,{"aria-label":l,buttonStyle:"none",className:s,disabled:r===!1,icon:n,iconPosition:"left",iconStyle:"none",onClick:()=>{r!==!1&&o.focus(()=>{o.update(()=>{Ap("toolbar")}),i.onSelect?.({editor:o,isActive:t})})},onMouseDown:p=>{p.preventDefault()},ref:u,tooltip:l,type:"button",children:e})}function Bp({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:r}){let[n,i]=eo(),[l,s]=eo(),c=Fp(a=>{i(p=>p!=null?[...p,a]:[a])},[i]),u=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=$p(()=>({registerItem:c}),[c]);return kt(()=>{n!=null&&l==null&&s(n[0]),l!=null&&l?.current!=null&&l.current.focus()},[n,l]),ve(Ll,{value:d,children:ve("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:u,ref:e,children:t})})}function Rl({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:r=!1,Icon:n,itemsContainerClassNames:i,label:l,stopCloseOnClickSelf:s}){let c=or(null),u=or(null),[d,a]=eo(!1),p=()=>{a(!1),u?.current!=null&&u.current.focus()};kt(()=>{let f=u.current,h=c.current;if(d&&f!==null&&h!==null){let{left:g,top:b}=f.getBoundingClientRect(),L=window.scrollY||document.documentElement.scrollTop;h.style.top=`${b+L+f.offsetHeight+5}px`,h.style.left=`${Math.min(g-5,window.innerWidth-h.offsetWidth-20)}px`}},[c,u,d]),kt(()=>{let f=u.current;if(f!==null&&d){let h=g=>{let b=g.target;Op(b)&&(s&&c.current&&c.current.contains(b)||f.contains(b)||a(!1))};return document.addEventListener("click",h),()=>{document.removeEventListener("click",h)}}},[c,u,d,s]);let m=Pp(ve(Bp,{dropDownRef:c,itemsContainerClassNames:i,onClose:p,children:o}),document.body);return Nl(Qt.Fragment,{children:[Nl("button",{"aria-label":t,className:e+(d?" active":""),disabled:r,onClick:f=>{f.preventDefault(),a(!d)},onMouseDown:f=>{f.preventDefault()},ref:u,type:"button",children:[n&&ve(n,{}),l&&ve("span",{className:"toolbar-popup__dropdown-label",children:l}),ve("i",{className:"toolbar-popup__dropdown-caret"})]}),d&&ve(Qt.Fragment,{children:m})]})}var nr="toolbar-popup__dropdown",Vp=t=>{let e=Hp(18),{active:o,anchorElem:r,editor:n,enabled:i,item:l}=t,{i18n:s}=Gp(),{fieldProps:c}=H(),{featureClientSchemaMap:u,schemaPath:d}=c;if(l.Component){let f;return e[0]!==o||e[1]!==r||e[2]!==n||e[3]!==i||e[4]!==l?(f=l?.Component&&qe(l.Component,{active:o,anchorElem:r,editor:n,enabled:i,item:l},l.key),e[0]=o,e[1]=r,e[2]=n,e[3]=i,e[4]=l,e[5]=f):f=e[5],f}let a=l.key,p;if(l.label){let f;e[6]!==u||e[7]!==s||e[8]!==l||e[9]!==d?(f=typeof l.label=="function"?l.label({featureClientSchemaMap:u,i18n:s,schemaPath:d}):l.label,e[6]=u,e[7]=s,e[8]=l,e[9]=d,e[10]=f):f=e[10],a=f}a.length>25?p=a.substring(0,25)+"...":p=a;let m;return e[11]!==o||e[12]!==p||e[13]!==n||e[14]!==i||e[15]!==l||e[16]!==a?(m=qe(Sl,{active:o,editor:n,enabled:i,Icon:l?.ChildComponent?qe(l.ChildComponent,{}):void 0,item:l,tooltip:a,children:qe("span",{className:"text",children:p})},l.key),e[11]=o,e[12]=p,e[13]=n,e[14]=i,e[15]=l,e[16]=a,e[17]=m):m=e[17],m},He=({anchorElem:t,classNames:e,editor:o,group:r,Icon:n,itemsContainerClassNames:i,label:l,maxActiveItems:s,onActiveChange:c})=>{let[u,d]=rr.useState([]),[a,p]=rr.useState([]),[m,f]=rr.useState(!0),h=H(),{items:g,key:b}=r,L=jp(()=>{o.getEditorState().read(()=>{let I=Wp();if(!I)return;let _=[],T=[],C=[];for(let E of g)E.isActive&&(!s||_.length<s)&&E.isActive({editor:o,editorConfigContext:h,selection:I})&&(_.push(E.key),T.push(E)),E.isEnabled?E.isEnabled({editor:o,editorConfigContext:h,selection:I})&&C.push(E.key):C.push(E.key);r.isEnabled&&f(r.isEnabled({editor:o,editorConfigContext:h,selection:I})),d(_),p(C),c&&c({activeItems:T})})},[o,h,r,g,s,c]);return Il(()=>{L()},[L]),Il(()=>Up(o.registerUpdateListener(()=>{L()})),[o,L]),qe(Rl,{buttonAriaLabel:`${b} dropdown`,buttonClassName:[nr,`${nr}-${b}`,...e||[]].filter(Boolean).join(" "),disabled:!m,Icon:n,itemsContainerClassNames:[`${nr}-items`,...i||[]],label:l,children:g.length?g.map(I=>qe(Vp,{active:u.includes(I.key),anchorElem:t,editor:o,enabled:a.includes(I.key),item:I},I.key)):null},b)};function qp({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&de(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?de(wt,{editor:e,item:o,children:de(o.ChildComponent,{})},o.key):null}function Qp(t){let e=yl(23),{anchorElem:o,editor:r,editorConfig:n,group:i,index:l}=t,{i18n:s}=Jp(),{fieldProps:c}=H(),{featureClientSchemaMap:u,schemaPath:d}=c,[a,p]=Ne.useState(void 0),[m,f]=Ne.useState(void 0),h;e[0]!==i.ChildComponent||e[1]!==i.items||e[2]!==i.type?(h=()=>{i?.type==="dropdown"&&i.items.length&&i.ChildComponent?f(()=>i.ChildComponent):f(void 0)},e[0]=i.ChildComponent,e[1]=i.items,e[2]=i.type,e[3]=h):h=e[3];let g;e[4]!==i?(g=[i],e[4]=i,e[5]=g):g=e[5],Ne.useEffect(h,g);let b;e[6]!==u||e[7]!==i.ChildComponent||e[8]!==i.items||e[9]!==i.type||e[10]!==s||e[11]!==d?(b=T=>{let{activeItems:C}=T;if(!C.length){i?.type==="dropdown"&&i.items.length&&i.ChildComponent?(f(()=>i.ChildComponent),p(void 0)):(f(void 0),p(void 0));return}let E=C[0],M=E.key;E.label&&(M=typeof E.label=="function"?E.label({featureClientSchemaMap:u,i18n:s,schemaPath:d}):E.label),M.length>25&&(M=M.substring(0,25)+"..."),C.length===1?(p(M),f(()=>E.ChildComponent)):(p(s.t("lexical:general:toolbarItemsActive",{count:C.length})),i?.type==="dropdown"&&i.items.length&&i.ChildComponent?f(()=>i.ChildComponent):f(void 0))},e[6]=u,e[7]=i.ChildComponent,e[8]=i.items,e[9]=i.type,e[10]=s,e[11]=d,e[12]=b):b=e[12];let L=b,I=`fixed-toolbar__group fixed-toolbar__group-${i.key}`,_;return e[13]!==m||e[14]!==o||e[15]!==a||e[16]!==r||e[17]!==n.features.toolbarFixed?.groups.length||e[18]!==i||e[19]!==l||e[20]!==L||e[21]!==I?(_=Kp("div",{className:I,children:[i.type==="dropdown"&&i.items.length?m?de(He,{anchorElem:o,editor:r,group:i,Icon:m,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:i.maxActiveItems??1,onActiveChange:L}):de(He,{anchorElem:o,editor:r,group:i,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:i.maxActiveItems??1,onActiveChange:L}):null,i.type==="buttons"&&i.items.length?i.items.map(T=>de(qp,{anchorElem:o,editor:r,item:T},T.key)):null,l<n.features.toolbarFixed?.groups.length-1&&de("div",{className:"divider"})]},i.key),e[13]=m,e[14]=o,e[15]=a,e[16]=r,e[17]=n.features.toolbarFixed?.groups.length,e[18]=i,e[19]=l,e[20]=L,e[21]=I,e[22]=_):_=e[22],_}function ef({anchorElem:t,clientProps:e,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let i=Ne.useRef(null),{y:l}=zp(),s=Xp(()=>{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 Yp(()=>{if(!s)return;let c=i.current;if(!c)return;let u=c.getBoundingClientRect(),d=s.getBoundingClientRect();if(!(u.bottom<d.top||u.top>d.bottom))c.classList.remove("fixed-toolbar"),c.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),s.classList.remove("fixed-toolbar"),s.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"),s.classList.remove("fixed-toolbar--hide"),s.classList.add("fixed-toolbar")}},50,[i,s,l]),de("div",{className:"fixed-toolbar",onFocus:c=>{c.stopPropagation()},ref:i,children:o.isEditable()&&de(Ne.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((c,u)=>de(Qp,{anchorElem:t,editor:o,editorConfig:r,group:c,index:u},c.key))})})}var vl=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return vl(t.parentEditor)}return!1},Ml=t=>{let e=yl(6),{clientProps:o}=t,[r]=Zp(),n=H(),{editorConfig:i}=n,l=o.applyToFocusedEditor&&n.focusedEditor?.editor||r,s=o.applyToFocusedEditor&&n.focusedEditor?.editorConfig||i,c,u;if(e[0]!==o.disableIfParentHasFixedToolbar||e[1]!==l||e[2]!==s||e[3]!==n){u=Symbol.for("react.early_return_sentinel");e:{let d=vl(n);if(o?.disableIfParentHasFixedToolbar&&d){u=null;break e}if(!s?.features?.toolbarFixed?.groups?.length){u=null;break e}c=de(ef,{anchorElem:document.body,editor:l,editorConfig:s,parentWithFixedToolbar:d})}e[0]=o.disableIfParentHasFixedToolbar,e[1]=l,e[2]=s,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 tf=R({plugins:[{Component:Ml,position:"aboveContainer"}]});import{c as Ol}from"react/compiler-runtime";import{jsx as he,jsxs as Fl}from"react/jsx-runtime";import{useLexicalComposerContext as of}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as $l}from"@lexical/utils";import{$getSelection as Pl,$isRangeSelection as Dl,$isTextNode as rf,COMMAND_PRIORITY_LOW as nf,getDOMSelection as Bl,SELECTION_CHANGE_COMMAND as lf}from"lexical";import{useCallback as oo,useEffect as Nt,useRef as Al,useState as sf}from"react";import*as ro from"react";import{createPortal as af}from"react-dom";function ir(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 to(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:r=0,floatingElem:n,horizontalOffset:i=32,horizontalPosition:l="left",specialHandlingForCaret:s=!1,targetRect:c,verticalGap:u=10}=t,d=o.parentElement;if(c===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=c.top-a.height-u,h=c.left-i;l==="center"&&(h=c.left+c.width/2-a.width/2);let g=0;return!e&&f<m.top&&!s&&(g=a.height+c.height+u*2,f+=g),l==="center"?h+a.width>m.right?h=m.right-a.width-i:h<m.left&&(h=m.left+i):h+a.width>m.right&&(h=m.right-a.width-i),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)`),g}function cf({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&he(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?he(wt,{editor:e,item:o,children:he(o.ChildComponent,{})},o.key):null}function uf(t){let e=Ol(19),{anchorElem:o,editor:r,group:n,index:i}=t,{editorConfig:l}=H(),[s,c]=ro.useState(),u;e[0]!==n.ChildComponent||e[1]!==n.items||e[2]!==n.type?(u=()=>{n?.type==="dropdown"&&n.items.length&&n.ChildComponent?c(()=>n.ChildComponent):c(void 0)},e[0]=n.ChildComponent,e[1]=n.items,e[2]=n.type,e[3]=u):u=e[3];let d;e[4]!==n?(d=[n],e[4]=n,e[5]=d):d=e[5],ro.useEffect(u,d);let a;e[6]!==n.ChildComponent||e[7]!==n.items||e[8]!==n.type?(a=h=>{let{activeItems:g}=h;if(!g.length){n?.type==="dropdown"&&n.items.length&&n.ChildComponent?c(()=>n.ChildComponent):c(void 0);return}let b=g[0];c(()=>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]!==l.features.toolbarInline?.groups.length||e[14]!==n||e[15]!==i||e[16]!==p||e[17]!==m?(f=Fl("div",{className:m,children:[n.type==="dropdown"&&n.items.length?s?he(He,{anchorElem:o,editor:r,group:n,Icon:s,maxActiveItems:n.maxActiveItems??1,onActiveChange:p}):he(He,{anchorElem:o,editor:r,group:n,maxActiveItems:n.maxActiveItems??1,onActiveChange:p}):null,n.type==="buttons"&&n.items.length?n.items.map(h=>he(cf,{anchorElem:o,editor:r,item:h},h.key)):null,i<l.features.toolbarInline?.groups.length-1&&he("div",{className:"divider"})]},n.key),e[10]=s,e[11]=o,e[12]=r,e[13]=l.features.toolbarInline?.groups.length,e[14]=n,e[15]=i,e[16]=p,e[17]=m,e[18]=f):f=e[18],f}function df({anchorElem:t,editor:e}){let o=Al(null),r=Al(null),{editorConfig:n}=H(),i=oo(()=>{if(o?.current){let u=o.current.style.opacity==="0",d=o.current.style.pointerEvents==="none";u||(o.current.style.opacity="0"),d||(o.current.style.pointerEvents="none")}},[o]),l=oo(u=>{if(o?.current&&(u.buttons===1||u.buttons===3)){let d=o.current.style.opacity==="0",a=o.current.style.pointerEvents==="none";if(!d||!a){let p=u.clientX,m=u.clientY,f=document.elementFromPoint(p,m);o.current.contains(f)||i()}}},[i]),s=oo(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);Nt(()=>(document.addEventListener("mousemove",l),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",s)}),[o,l,s]);let c=oo(()=>{let u=Pl(),d=Bl(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(u!==null&&d!==null&&!d.isCollapsed&&m!==null&&m.contains(d.anchorNode)){let f=ir(d,m),h=to({alwaysDisplayOnTop:p,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});r.current&&to({anchorElem:o.current,anchorFlippedOffset:h,floatingElem:r.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else i()},[e,i,t]);return Nt(()=>{let u=t.parentElement,d=()=>{e.getEditorState().read(()=>{c()})};return window.addEventListener("resize",d),u&&u.addEventListener("scroll",d),()=>{window.removeEventListener("resize",d),u&&u.removeEventListener("scroll",d)}},[e,c,t]),Nt(()=>(e.getEditorState().read(()=>{c()}),$l(e.registerUpdateListener(({editorState:u})=>{u.read(()=>{c()})}),e.registerCommand(lf,()=>(c(),!1),nf))),[e,c]),Fl("div",{className:"inline-toolbar-popup",ref:o,children:[he("div",{className:"caret",ref:r}),n?.features&&n.features?.toolbarInline?.groups.map((u,d)=>he(uf,{anchorElem:t,editor:e,group:u,index:d},u.key))]})}function mf(t,e){let o=Ol(12),[r,n]=sf(!1),i;o[0]!==t?(i=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let p=Pl(),m=Bl(t._window),f=t.getRootElement();if(m!==null&&(!Dl(p)||f===null||!f.contains(m.anchorNode))){n(!1);return}if(!Dl(p))return;if(p.getTextContent()!==""){let g=p.getNodes(),b=!1;for(let L of g)if(rf(L)){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]=i):i=o[1];let l=i,s,c;o[2]!==l?(s=()=>(document.addEventListener("selectionchange",l),document.addEventListener("mouseup",l),()=>{document.removeEventListener("selectionchange",l),document.removeEventListener("mouseup",l)}),c=[l],o[2]=l,o[3]=s,o[4]=c):(s=o[3],c=o[4]),Nt(s,c);let u,d;if(o[5]!==t||o[6]!==l?(u=()=>$l(t.registerUpdateListener(()=>{l()}),t.registerRootListener(()=>{t.getRootElement()===null&&n(!1)})),d=[t,l],o[5]=t,o[6]=l,o[7]=u,o[8]=d):(u=o[7],d=o[8]),Nt(u,d),!r||!t.isEditable())return null;let a;return o[9]!==e||o[10]!==t?(a=af(he(df,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=a):a=o[11],a}var Hl=t=>{let{anchorElem:e}=t,[o]=of();return mf(o,e)};var pf=R({plugins:[{Component:Hl,position:"floatingAnchorElem"}]});import{TableCellNode as rh,TableNode as nh,TableRowNode as ih}from"@lexical/table";import{jsx as jl}from"react/jsx-runtime";import"react";var lr=()=>jl("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:jl("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 ff,$createTableNode as hf,$createTableRowNode as gf,$isTableCellNode as Ul,$isTableNode as sr,$isTableRowNode as ar,TableCellHeaderStates as no,TableCellNode as Cf,TableNode as xf,TableRowNode as bf}from"@lexical/table";import{$isParagraphNode as _f,$isTextNode as Tf}from"lexical";var Wl=/^\|(.+)\|\s?$/,Ef=/^(\| ?:?-*:? ?)+\|\s?$/,Vl=({allTransformers:t})=>({type:"element",dependencies:[xf,bf,Cf],export:e=>{if(!sr(e))return null;let o=[];for(let r of e.getChildren()){let n=[];if(!ar(r))continue;let i=!1;for(let l of r.getChildren())Ul(l)&&(n.push(vr(t,l).replace(/\n/g,"\\n").trim()),l.__headerState===no.ROW&&(i=!0));o.push(`| ${n.join(" | ")} |`),i&&o.push(`| ${n.map(l=>"---").join(" | ")} |`)}return o.join(`
|
|
37
|
-
`)},regExp:Wl,replace:(e,o,r)=>{let n=r[0];if(!n)return;if(Ef.test(n)){let a=e.getPreviousSibling();if(!a||!sr(a))return;let p=a.getChildren(),m=p[p.length-1];if(!m||!ar(m))return;m.getChildren().forEach(f=>{Ul(f)&&f.setHeaderStyles(no.ROW,no.ROW)}),e.remove();return}let i=Gl(n,t);if(i==null)return;let l=[i],s=e.getPreviousSibling(),c=i.length;for(;s&&!(!_f(s)||s.getChildrenSize()!==1);){let a=s.getFirstChild();if(!Tf(a))break;let p=Gl(a.getTextContent(),t);if(p==null)break;c=Math.max(c,p.length),l.unshift(p);let m=s.getPreviousSibling();s.remove(),s=m}let u=hf();for(let a of l){let p=gf();u.append(p);for(let m=0;m<c;m++)p.append(m<a.length?a[m]:Kl("",t))}let d=e.getPreviousSibling();sr(d)&&wf(d)===c?(d.append(...u.getChildren()),e.remove()):e.replace(u),u.selectEnd()}});function wf(t){let e=t.getFirstChild();return ar(e)?e.getChildrenSize():0}var Kl=(t,e)=>{t=t.replace(/\\n/g,`
|
|
38
|
-
`);let o=ff(no.NO_STATUS);return yr(t,e,o),o},Gl=(t,e)=>{let o=t.match(Wl);return!o||!o[1]?null:o[1].split("|").map(r=>Kl(r,e))};import{c as Nf}from"react/compiler-runtime";import{jsx as P,jsxs as Le}from"react/jsx-runtime";import{useLexicalComposerContext as Jl}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Lf}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as ur,$deleteTableColumn__EXPERIMENTAL as Sf,$deleteTableRow__EXPERIMENTAL as Rf,$getNodeTriplet as If,$getTableCellNodeFromLexicalNode as zl,$getTableColumnIndexFromTableCellNode as yf,$getTableNodeFromLexicalNodeOrThrow as Se,$getTableRowIndexFromTableCellNode as vf,$insertTableColumn__EXPERIMENTAL as Mf,$insertTableRow__EXPERIMENTAL as Df,$isTableCellNode as Xl,$isTableSelection as Lt,$unmergeCell as Af,getTableElement as dr,getTableObserverFromTableElement as mr,TableCellHeaderStates as Me,TableCellNode as Of}from"@lexical/table";import{mergeRegister as Ff}from"@lexical/utils";import{useScrollInfo as $f}from"@payloadcms/ui";import{$createParagraphNode as Pf,$getSelection as lo,$isElementNode as Bf,$isParagraphNode as Hf,$isRangeSelection as pr,$isTextNode as jf,$setSelection as Uf,COMMAND_PRIORITY_CRITICAL as Gf,getDOMSelection as Wf,isDOMNode as Vf,SELECTION_CHANGE_COMMAND as Kf}from"lexical";import*as fr from"react";import{useCallback as me,useEffect as Qe,useRef as io,useState as et}from"react";import{createPortal as ql}from"react-dom";import{jsx as cr,jsxs as kf}from"react/jsx-runtime";import"react";var Zl=()=>kf("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[cr("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"}),cr("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"}),cr("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 Yl(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function Zf(){let t=lo();if(pr(t)&&!t.isCollapsed()||Lt(t)&&!t.anchor.is(t.focus)||!pr(t)&&!Lt(t))return!1;let[e]=If(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function zf(t){if(t.getChildrenSize()!==1)return!1;let e=t.getFirstChildOrThrow();return!(!Hf(e)||!e.isEmpty())}function Yf(t){let e=t.getLastDescendant();jf(e)?e.select():Bf(e)?e.selectEnd():e!==null&&e.selectNext()}function Jf({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[i]=Jl(),l=io(null),[s,c]=et(n),[u,d]=et({columns:1,rows:1}),[a,p]=et(!1),[m,f]=et(!1),{y:h}=$f();Qe(()=>i.registerMutationListener(Of,x=>{x.get(s.getKey())==="updated"&&i.getEditorState().read(()=>{c(s.getLatest())})},{skipInitialization:!0}),[i,s]),Qe(()=>{i.getEditorState().read(()=>{let x=lo();if(Lt(x)){let N=Yl(x);d(Yl(x)),p(N.columns>1||N.rows>1)}f(Zf())})},[i]),Qe(()=>{let x=e.current,N=l.current,y=i.getRootElement();if(x!=null&&N!=null&&y!=null){let S=y.getBoundingClientRect(),v=x.getBoundingClientRect();N.style.opacity="1";let w=N.getBoundingClientRect(),O=5,B=v.right+O;if(B+w.width>window.innerWidth||B+w.width>S.right){let J=v.left-w.width-O;B=(J<0?O:J)+window.pageXOffset}N.style.left=`${B+window.pageXOffset}px`;let U=v.top;if(U+w.height>window.innerHeight){let J=v.bottom-w.height;U=J<0?O:J}N.style.top=`${U}px`}},[e,l,i,h]),Qe(()=>{function x(N){l.current!=null&&e.current!=null&&Vf(N.target)&&!l.current.contains(N.target)&&!e.current.contains(N.target)&&r(!1)}return window.addEventListener("click",x),()=>window.removeEventListener("click",x)},[r,e]);let g=me(()=>{i.update(()=>{if(s.isAttached()){let x=Se(s),N=dr(x,i.getElementByKey(x.getKey()));if(N===null)throw new Error("Expected to find tableElement in DOM");let y=mr(N);y!==null&&y.$clearHighlight(),x.markDirty(),c(s.getLatest())}Uf(null)})},[i,s]),b=()=>{i.update(()=>{let x=lo();if(Lt(x)){let y=x.getNodes().filter(Xl);if(y.length===0)return;let S=Se(y[0]),[v]=ur(S,null,null),w=1/0,O=-1/0,B=1/0,U=-1/0,J=new Set;for(let X of v)for(let V of X){if(!V||!V.cell)continue;let oe=V.cell.getKey();if(!J.has(oe)&&y.some(re=>re.is(V.cell))){J.add(oe);let re=V.startRow,le=V.startColumn,De=V.cell.__rowSpan||1,ot=V.cell.__colSpan||1;w=Math.min(w,re),O=Math.max(O,re+De-1),B=Math.min(B,le),U=Math.max(U,le+ot-1)}}if(w===1/0||B===1/0)return;let Ue=O-w+1,W=U-B+1,G=v?.[w]?.[B];if(!G?.cell)return;let te=G.cell;te.setColSpan(W),te.setRowSpan(Ue);let ce=new Set([te.getKey()]);for(let X=w;X<=O;X++)for(let V=B;V<=U;V++){let oe=v?.[X]?.[V];if(!oe?.cell)continue;let re=oe.cell,le=re.getKey();ce.has(le)||(ce.add(le),zf(re)||te.append(...re.getChildren()),re.remove())}te.getChildrenSize()===0&&te.append(Pf()),Yf(te),o()}})},L=()=>{i.update(()=>{Af()})},I=me(x=>{i.update(()=>{for(let N=0;N<u.rows;N++)Df(x);o()})},[i,o,u.rows]),_=me(x=>{i.update(()=>{for(let N=0;N<u.columns;N++)Mf(x);o()})},[i,o,u.columns]),T=me(()=>{i.update(()=>{Rf(),o()})},[i,o]),C=me(()=>{i.update(()=>{Se(s).remove(),g(),o()})},[i,s,g,o]),E=me(()=>{i.update(()=>{Sf(),o()})},[i,o]),M=me(()=>{i.update(()=>{let x=Se(s),N=vf(s),[y]=ur(x,null,null),S=new Set,v=s.getHeaderStyles()^Me.ROW;if(y[N])for(let w=0;w<y[N].length;w++){let O=y[N][w];O?.cell&&(S.has(O.cell)||(S.add(O.cell),O.cell.setHeaderStyles(v,Me.ROW)))}g(),o()})},[i,s,g,o]),A=me(()=>{i.update(()=>{let x=Se(s),N=yf(s),[y]=ur(x,null,null),S=new Set,v=s.getHeaderStyles()^Me.COLUMN;if(y)for(let w=0;w<y.length;w++){let O=y?.[w]?.[N];O?.cell&&(S.has(O.cell)||(S.add(O.cell),O.cell.setHeaderStyles(v,Me.COLUMN)))}g(),o()})},[i,s,g,o]),$=me(()=>{i.update(()=>{if(s.isAttached()){let x=Se(s);x&&x.setRowStriping(!x.getRowStriping())}g(),o()})},[i,s,g,o]),D=me(()=>{i.update(()=>{if(s.isAttached()){let x=Se(s);x&&x.setFrozenColumns(x.getFrozenColumns()===0?1:0)}g(),o()})},[i,s,g,o]),k=null;return t&&(a?k=P("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>b(),type:"button",children:P("span",{className:"text",children:"Merge cells"})}):m&&(k=P("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>L(),type:"button",children:P("span",{className:"text",children:"Unmerge cells"})}))),ql(Le("div",{className:"table-action-menu-dropdown",onClick:x=>{x.stopPropagation()},ref:l,children:[k?Le(fr.Fragment,{children:[k,P("hr",{})]}):null,P("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>$(),type:"button",children:P("span",{className:"text",children:"Toggle Row Striping"})}),P("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>D(),type:"button",children:P("span",{className:"text",children:"Toggle First Column Freeze"})}),P("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>I(!1),type:"button",children:Le("span",{className:"text",children:["Insert ",u.rows===1?"row":`${u.rows} rows`," above"]})}),P("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>I(!0),type:"button",children:Le("span",{className:"text",children:["Insert ",u.rows===1?"row":`${u.rows} rows`," below"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>_(!1),type:"button",children:Le("span",{className:"text",children:["Insert ",u.columns===1?"column":`${u.columns} columns`," ","left"]})}),P("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>_(!0),type:"button",children:Le("span",{className:"text",children:["Insert ",u.columns===1?"column":`${u.columns} columns`," ","right"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>E(),type:"button",children:P("span",{className:"text",children:"Delete column"})}),P("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>T(),type:"button",children:P("span",{className:"text",children:"Delete row"})}),P("button",{className:"item","data-test-id":"table-delete",onClick:()=>C(),type:"button",children:P("span",{className:"text",children:"Delete table"})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-row-header",onClick:()=>M(),type:"button",children:Le("span",{className:"text",children:[(s.__headerState&Me.ROW)===Me.ROW?"Remove":"Add"," ","row header"]})}),P("button",{className:"item","data-test-id":"table-column-header",onClick:()=>A(),type:"button",children:Le("span",{className:"text",children:[(s.__headerState&Me.COLUMN)===Me.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function Xf({anchorElem:t,cellMerge:e}){let[o]=Jl(),r=io(null),n=io(null),[i,l]=et(!1),[s,c]=et(null),u=me(()=>{let a=r.current,p=lo(),m=Wf(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")),c(null)}if(p==null||a==null)return h();let g=o.getRootElement(),b=null,L=null;if(pr(p)&&g!==null&&m!==null&&g.contains(m.anchorNode)){let _=zl(p.anchor.getNode());if(_==null||(L=o.getElementByKey(_.getKey()),L==null||!_.isAttached()))return h();let T=Se(_),C=dr(T,o.getElementByKey(T.getKey()));if(C===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");b=mr(C),c(_)}else if(Lt(p)){let _=zl(p.anchor.getNode());if(!Xl(_))throw new Error("TableSelection anchorNode must be a TableCellNode");let T=Se(_),C=dr(T,o.getElementByKey(T.getKey()));if(C===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");b=mr(C),L=o.getElementByKey(_.getKey())}else if(!f)return h();if(b===null||L===null)return h();let I=!b||!b.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",I),a.classList.toggle("table-cell-action-button-container--inactive",!I),I){let _=L.getBoundingClientRect(),T=t.getBoundingClientRect(),C=_.top-T.top,E=_.right-T.left;a.style.transform=`translate(${E}px, ${C}px)`}},[o,t]);Qe(()=>{let a,p=()=>{a=void 0,o.getEditorState().read(u)},m=()=>(a===void 0&&(a=setTimeout(p,0)),!1);return Ff(o.registerUpdateListener(m),o.registerCommand(Kf,m,Gf),o.registerRootListener((f,h)=>{h&&h.removeEventListener("pointerup",m),f&&(f.addEventListener("pointerup",m),m())}),()=>clearTimeout(a))});let d=io(s);return Qe(()=>{d.current!==s&&l(!1),d.current=s},[d,s]),P("div",{className:"table-cell-action-button-container",ref:r,children:s!=null&&Le(fr.Fragment,{children:[P("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),l(!i)},ref:n,type:"button",children:P(Zl,{})}),i&&P(Jf,{cellMerge:e,contextRef:n,onClose:()=>l(!1),setIsMenuOpen:l,tableCellNode:s})]})})}var Ql=t=>{let e=Nf(3),{anchorElem:o}=t,r=Lf(),n;return e[0]!==o||e[1]!==r?(n=ql(r?P(Xf,{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 qf}from"react/compiler-runtime";import{jsx as ao,jsxs as Qf}from"react/jsx-runtime";import{useLexicalComposerContext as e1}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as t1}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as o1,$getTableNodeFromLexicalNodeOrThrow as hr,$getTableRowIndexFromTableCellNode as r1,$isTableCellNode as es,$isTableRowNode as n1,getDOMCellFromTarget as i1,getTableElement as l1,TableNode as ts}from"@lexical/table";import{calculateZoomLevel as os,mergeRegister as s1}from"@lexical/utils";import{$getNearestNodeFromDOMNode as gr,isHTMLElement as a1}from"lexical";import*as ns from"react";import{useCallback as St,useEffect as Cr,useRef as so,useState as tt}from"react";import{createPortal as c1}from"react-dom";var u1=33,rs=92;function d1({editor:t}){let e=so(null),o=so(null),r=so(null),[n,i]=tt(!1),l=H(),s=so(null),[c,u]=tt(null),[d,a]=tt(null),[p,m]=tt(!1),[f,h]=tt(null),g=St(()=>{a(null),e.current=null,h(null),s.current=null,r.current=null},[]),b=D=>(D.buttons&1)===1;Cr(()=>{let D=new Set;return s1(t.registerMutationListener(ts,k=>{for(let[x,N]of k)N==="destroyed"?D.delete(x):D.add(x);i(D.size>0)}),t.registerNodeTransform(ts,k=>{if(k.getColWidths())return k;let x=k.getColumnCount(),N=rs;return k.setColWidths(Array(x).fill(N)),k}))},[t]),Cr(()=>{if(!n)return;let D=y=>{let S=y.target;if(a1(S)){if(f){u({x:y.clientX,y:y.clientY});return}if(m(b(y)),!(o.current&&o.current.contains(S))&&e.current!==S){e.current=S;let v=i1(S);v&&d!==v?t.getEditorState().read(()=>{let w=gr(v.elem);if(!w)throw new Error("TableCellResizer: Table cell node not found.");let O=hr(w),B=l1(O,t.getElementByKey(O.getKey()));if(!B)throw new Error("TableCellResizer: Table element not found.");e.current=S,r.current=B.getBoundingClientRect(),a(v)},{editor:t}):v==null&&g()}}},k=y=>{m(!0)},x=y=>{m(!1)},N=t.registerRootListener((y,S)=>{S?.removeEventListener("mousemove",D),S?.removeEventListener("mousedown",k),S?.removeEventListener("mouseup",x),y?.addEventListener("mousemove",D),y?.addEventListener("mousedown",k),y?.addEventListener("mouseup",x)});return()=>{N()}},[d,f,t,n,g]);let L=D=>D==="bottom",I=St(D=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let k=gr(d.elem);if(!es(k))throw new Error("TableCellResizer: Table cell node not found.");let x=hr(k),N=r1(k),y=x.getChildren(),v=k.getColSpan()===x.getColumnCount()?N:N+k.getRowSpan()-1;if(v>=y.length||v<0)throw new Error("Expected table cell to be inside of table row.");let w=y[v];if(!n1(w))throw new Error("Expected table row");let O=w.getHeight();if(O===void 0){let U=w.getChildren();O=Math.min(...U.map(J=>_(J,t)??1/0))}let B=Math.max(O+D,u1);w.setHeight(B)},{tag:"skip-scroll-into-view"})},[d,t]),_=(D,k)=>k.getElementByKey(D.getKey())?.clientHeight,T=(D,k)=>{let x;return k.forEach(N=>{N.forEach((y,S)=>{y.cell===D&&(x=S)})}),x},C=St(D=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let k=gr(d.elem);if(!es(k))throw new Error("TableCellResizer: Table cell node not found.");let x=hr(k),[N]=o1(x,null,null),y=T(k,N);if(y===void 0)throw new Error("TableCellResizer: Table column not found.");let S=x.getColWidths();if(!S)return;let v=S[y];if(v===void 0)return;let w=[...S],O=Math.max(v+D,rs);w[y]=O,x.setColWidths(w)},{tag:"skip-scroll-into-view"})},[d,t]),E=St(D=>{let k=x=>{if(x.preventDefault(),x.stopPropagation(),!d)throw new Error("TableCellResizer: Expected active cell.");if(s.current){let{x:N,y}=s.current;if(d===null)return;let S=os(x.target);if(L(D)){let v=(x.clientY-y)/S;I(v)}else{let v=(x.clientX-N)/S;C(v)}g(),document.removeEventListener("mouseup",k)}};return k},[d,g,C,I]),M=St(D=>k=>{if(k.preventDefault(),k.stopPropagation(),!d)throw new Error("TableCellResizer: Expected active cell.");s.current={x:k.clientX,y:k.clientY},u(s.current),h(D),document.addEventListener("mouseup",E(D))},[d,E]),[A,$]=tt({bottom:null,left:null,right:null,top:null});return Cr(()=>{if(d){let{height:D,left:k,top:x,width:N}=d.elem.getBoundingClientRect(),y=os(d.elem),S=10,v={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${S}px`,left:`${window.scrollX+k}px`,top:`${window.scrollY+x+D-S/2}px`,width:`${N}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${D}px`,left:`${window.scrollX+k+N-S/2}px`,top:`${window.scrollY+x}px`,width:`${S}px`}},w=r.current;f&&c&&w&&(L(f)?(v[f].left=`${window.scrollX+w.left}px`,v[f].top=`${window.scrollY+c.y/y}px`,v[f].height="3px",v[f].width=`${w.width}px`):(v[f].top=`${window.scrollY+w.top}px`,v[f].left=`${window.scrollX+c.x/y}px`,v[f].width="3px",v[f].height=`${w.height}px`),v[f].backgroundColor="#adf"),$(v)}else $({bottom:null,left:null,right:null,top:null})},[d,f,c]),ao("div",{ref:o,children:d!=null&&!p&&Qf(ns.Fragment,{children:[ao("div",{className:`${l.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:M("right"),style:A.right||void 0}),ao("div",{className:`${l.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:M("bottom"),style:A.bottom||void 0})]})})}var is=()=>{let t=qf(3),[e]=e1(),o=t1(),r,n;return t[0]!==e||t[1]!==o?(n=o?c1(ao(d1,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=n):n=t[2],r=n,r};import{c as b1}from"react/compiler-runtime";import{jsx as xr,jsxs as _1,Fragment as T1}from"react/jsx-runtime";import{useLexicalComposerContext as ps}from"@lexical/react/LexicalComposerContext";import{$getTableAndElementByKey as E1,$getTableColumnIndexFromTableCellNode as w1,$getTableRowIndexFromTableCellNode as k1,$insertTableColumn__EXPERIMENTAL as N1,$insertTableRow__EXPERIMENTAL as L1,$isTableCellNode as S1,$isTableNode as as,getTableElement as R1,TableNode as I1}from"@lexical/table";import{$findMatchingParent as y1,mergeRegister as v1}from"@lexical/utils";import{$getNearestNodeFromDOMNode as cs,isHTMLElement as M1}from"lexical";import{useEffect as us,useMemo as D1,useRef as ds,useState as co}from"react";import"react";import{createPortal as A1}from"react-dom";import{c as g1}from"react/compiler-runtime";import{useEffect as C1,useRef as x1}from"react";var m1="Expected a function",p1=Math.max,f1=Math.min;function h1(t,e,o){let r,n,i=0,l,s=!1,c=!1,u,d,a,p=!0;if(typeof t!="function")throw new TypeError(m1);e=e||0,typeof o=="object"&&(s=!!o.leading,c="maxWait"in o,u=c?p1(o.maxWait||0,e):u,p="trailing"in o?!!o.trailing:p);function m(C){let E=r,M=l;return r=l=void 0,i=C,d=t.apply(M,E),d}function f(C){return i=C,a=setTimeout(b,e),s?m(C):d}function h(C){let E=C-n,M=C-i,A=e-E;return c?f1(A,u-M):A}function g(C){let E=C-n,M=C-i;return n===void 0||E>=e||E<0||c&&M>=u}function b(){let C=Date.now();if(g(C))return L(C);a=setTimeout(b,h(C))}function L(C){return a=void 0,p&&r?m(C):(r=l=void 0,d)}function I(){a!==void 0&&clearTimeout(a),i=0,r=n=l=a=void 0}function _(){return a===void 0?d:L(Date.now())}function T(){let C=Date.now(),E=g(C);if(r=arguments,l=this,n=C,E){if(a===void 0)return f(n);if(c)return clearTimeout(a),a=setTimeout(b,e),m(n)}return a===void 0&&(a=setTimeout(b,e)),d}return T.cancel=I,T.flush=_,T}var ls=h1;function ss(t,e,o){let r=g1(6),n=x1(null),i,l;r[0]!==t||r[1]!==o||r[2]!==e?(i=()=>(n.current=ls(t,e,{maxWait:o}),()=>{n.current?.cancel()}),l=[t,e,o],r[0]=t,r[1]=o,r[2]=e,r[3]=i,r[4]=l):(i=r[3],l=r[4]),C1(i,l);let s;return r[5]===Symbol.for("react.memo_cache_sentinel")?(s=(...u)=>{let d=u;n.current&&n.current(...d)},r[5]=s):s=r[5],s}var ms=20;function O1({anchorElem:t}){let[e]=ps(),o=H(),[r,n]=co(!1),[i,l]=co(!1),[s,c]=co(!1),[u,d]=co({}),a=ds(new Set),p=ds(null),m=ss(g=>{let{isOutside:b,tableDOMNode:L}=F1(g,o.editorConfig?.lexical);if(b){n(!1),l(!1);return}if(!L)return;p.current=L;let I=null,_=null,T=null;if(e.getEditorState().read(()=>{let S=cs(L);if(S1(S)){let v=y1(S,w=>as(w));if(!as(v))return;if(T=R1(v,e.getElementByKey(v.getKey())),T){let w=v.getChildrenSize(),O=v.getChildAtIndex(0)?.getChildrenSize(),B=k1(S),U=w1(S);B===w-1?I=S:U===O-1&&(_=S)}}},{editor:e}),!T)return;let C=T.parentElement;if(!C)return;let{bottom:E,height:M,left:A,right:$,width:D,y:k}=T.getBoundingClientRect(),x=!1;C&&C.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(x=C.scrollWidth>C.clientWidth);let{left:N,y}=t.getBoundingClientRect();I?(l(!1),n(!0),d({height:ms,left:x&&C?C.offsetLeft:A-N,top:E-y+5,width:x&&C?C.offsetWidth:D})):_&&(l(!0),n(!1),d({height:M,left:$-N+5,top:k-y,width:ms}))},50,250),f=D1(()=>new ResizeObserver(()=>{n(!1),l(!1)}),[]);us(()=>{if(s)return document.addEventListener("mousemove",m),()=>{n(!1),l(!1),document.removeEventListener("mousemove",m)}},[s,m]),us(()=>v1(e.registerMutationListener(I1,g=>{e.getEditorState().read(()=>{let b=!1;for(let[L,I]of g)switch(I){case"created":{a.current.add(L),b=!0;break}case"destroyed":{a.current.delete(L),b=!0;break}default:break}if(b){f.disconnect();for(let L of a.current){let{tableElement:I}=E1(L);f.observe(I)}c(a.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,f]);let h=g=>{e.update(()=>{p.current&&(cs(p.current)?.selectEnd(),g?(L1(),n(!1)):(N1(),l(!1)))})};return e?.isEditable()?_1(T1,{children:[r&&xr("button",{"aria-label":"Add Row",className:o.editorConfig.lexical.theme.tableAddRows,onClick:()=>h(!0),style:{...u},type:"button"}),i&&xr("button",{"aria-label":"Add Column",className:o.editorConfig.lexical.theme.tableAddColumns,onClick:()=>h(!1),style:{...u},type:"button"})]}):null}function F1(t,e){let o=t.target;if(M1(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 fs(t){let e=b1(2),{anchorElem:o}=t,r=o===void 0?document.body:o,[n]=ps();if(!n?.isEditable())return null;let i;return e[0]!==r?(i=A1(xr(O1,{anchorElem:r}),r),e[0]=r,e[1]=i):i=e[1],i}import{c as $1}from"react/compiler-runtime";import{jsx as br,jsxs as P1}from"react/jsx-runtime";import{useLexicalComposerContext as B1}from"@lexical/react/LexicalComposerContext";import{TablePlugin as H1}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as j1,TableCellNode as U1,TableNode as G1,TableRowNode as W1}from"@lexical/table";import{mergeRegister as V1}from"@lexical/utils";import{formatDrawerSlug as K1,useEditDepth as Z1}from"@payloadcms/ui";import{$getSelection as z1,$isRangeSelection as Y1,COMMAND_PRIORITY_EDITOR as J1,createCommand as X1}from"lexical";import{createContext as q1,use as Q1,useEffect as eh,useMemo as th,useState as oh}from"react";import*as hs from"react";var uo=X1("OPEN_EMBED_DRAWER_COMMAND"),gs=q1({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function Cs({children:t}){let[e,o]=oh({cellEditorConfig:null,cellEditorPlugins:null});return br(gs,{value:th(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var xs=()=>{let t=$1(16),[e]=B1(),o=Q1(gs),r=Z1(),{fieldProps:n,uuid:i}=H(),{schemaPath:l}=n,s="lexical-table-create-"+i,c;t[0]!==r||t[1]!==s?(c=K1({slug:s,depth:r}),t[0]=r,t[1]=s,t[2]=c):c=t[2];let u=c,{toggleDrawer:d}=ge(u,!0),a;t[3]!==e||t[4]!==d?(a=()=>{if(!e.hasNodes([G1,W1,U1]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return V1(e.registerCommand(uo,()=>{let h;return h=null,e.getEditorState().read(()=>{let g=z1();Y1(g)&&(h=g)}),h&&d(),!0},J1))},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],eh(a,p);let m;t[10]!==e?(m=(h,g)=>{!g.columns||!g.rows||e.dispatchCommand(j1,{columns:String(g.columns),rows:String(g.rows)})},t[10]=e,t[11]=m):m=t[11];let f;return t[12]!==u||t[13]!==l||t[14]!==m?(f=P1(hs.Fragment,{children:[br(rt,{drawerSlug:u,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:m,schemaPath:l,schemaPathSuffix:"fields"}),br(H1,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]}),t[12]=u,t[13]=l,t[14]=m,t[15]=f):f=t[15],f};var lh=R({markdownTransformers:[Vl],nodes:[nh,rh,ih],plugins:[{Component:xs,position:"normal"},{Component:is,position:"normal"},{Component:Ql,position:"floatingAnchorElem"},{Component:fs,position:"floatingAnchorElem"}],providers:[Cs],slashMenu:{groups:[Q([{Icon:lr,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(uo,{})}}])]},toolbarFixed:{groups:[be([{ChildComponent:lr,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(uo,{})}}])]}});import{$isNodeSelection as $h}from"lexical";import{jsx as _r,jsxs as sh}from"react/jsx-runtime";import"react";var Tr=()=>sh("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[_r("path",{d:"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"}),_r("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"}),_r("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 mh}from"react/jsx-runtime";import Ts from"bson-objectid";import{$applyNodeReplacement as ph}from"lexical";import*as Es from"react";import{jsx as ah}from"react/jsx-runtime";import{DecoratorBlockNode as ch}from"@lexical/react/LexicalDecoratorBlockNode.js";import bs from"bson-objectid";import{$applyNodeReplacement as uh}from"lexical";import"react";function Er(t){return t.parentElement!=null&&t.parentElement.tagName==="LI"&&t.previousSibling===null&&t.getAttribute("aria-roledescription")==="checkbox"}function dh(t){if(t.hasAttribute("data-lexical-upload-relation-to")&&t.hasAttribute("data-lexical-upload-id")){let o=t.getAttribute("data-lexical-upload-id"),r=t.getAttribute("data-lexical-upload-relation-to");if(o!=null&&r!=null)return{node:_s({data:{fields:{},relationTo:r,value:o}})}}let e=t;return e.src.startsWith("file:///")||Er(e),null}var Rt=class extends ch{__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:dh,priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new bs.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,relationTo:e.relationTo,value:e.value},r=_s({data:o});return r.setFormat(e.format),r}static isInline(){return!1}decorate(){return ah(RawUploadComponent,{data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportDOM(){let e=document.createElement("img");return e.setAttribute("data-lexical-upload-id",String(this.__data?.value)),e.setAttribute("data-lexical-upload-relation-to",this.__data?.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 _s({data:t}){return t?.id||(t.id=new bs.default().toHexString()),uh(new Rt({data:t}))}var fh=Es.lazy(()=>import("./component-NNKG7K3O.js").then(t=>({default:t.UploadComponent})));function hh(t){if(t.hasAttribute("data-lexical-upload-relation-to")&&t.hasAttribute("data-lexical-upload-id")){let o=t.getAttribute("data-lexical-upload-id"),r=t.getAttribute("data-lexical-upload-relation-to");if(o!=null&&r!=null)return{node:je({data:{fields:{},relationTo:r,value:o}})}}let e=t;return e.src.startsWith("file:///")||Er(e),null}var Re=class extends Rt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{img:e=>({conversion:hh,priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new Ts.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,relationTo:e.relationTo,value:e.value},r=je({data:o});return r.setFormat(e.format),r}decorate(){return mh(fh,{data:this.__data,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function je({data:t}){return t?.id||(t.id=new Ts.default().toHexString()),ph(new Re({data:t}))}function wr(t){return t instanceof Re}import{c as wh}from"react/compiler-runtime";import{jsx as kh}from"react/jsx-runtime";import{useLexicalComposerContext as Nh}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Lh,mergeRegister as Sh}from"@lexical/utils";import{useConfig as Rh}from"@payloadcms/ui";import{$getPreviousSelection as Ih,$getSelection as yh,$isParagraphNode as vh,$isRangeSelection as Mh,COMMAND_PRIORITY_EDITOR as Dh,createCommand as Ah}from"lexical";import{useEffect as Oh}from"react";import{c as ws}from"react/compiler-runtime";import{jsx as kr}from"react/jsx-runtime";import{useLexicalComposerContext as ks}from"@lexical/react/LexicalComposerContext.js";import{toast as gh}from"@payloadcms/ui";import{$getNodeByKey as Ch,COMMAND_PRIORITY_EDITOR as Ns}from"lexical";import{useEffect as Ls,useState as xh}from"react";var bh=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=Ch(o);n&&n.replace(je({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(Nr,{fields:null,relationTo:e,value:r})},_h=t=>{let e=ws(13),{enabledCollectionSlugs:o}=t,[r]=ks(),[n,i]=xh(null),l;e[0]!==o?(l={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=l):l=e[1];let{closeListDrawer:s,ListDrawer:c,openListDrawer:u}=Et(l),d,a;e[2]!==r||e[3]!==u?(d=()=>r.registerCommand(We,h=>(i(h?.replace?h?.replace.nodeKey:null),u(),!0),Ns),a=[r,u],e[2]=r,e[3]=u,e[4]=d,e[5]=a):(d=e[4],a=e[5]),Ls(d,a);let p;e[6]!==s||e[7]!==r||e[8]!==n?(p=h=>{let{collectionSlug:g,doc:b}=h;s(),bh({editor:r,relationTo:g,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]!==c||e[11]!==m?(f=kr(c,{onSelect:m}),e[10]=c,e[11]=m,e[12]=f):f=e[12],f},Th=()=>{let t=ws(3),[e]=ks(),o,r;return t[0]!==e?(o=()=>e.registerCommand(We,Eh,Ns),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Ls(o,r),null},Ss=t=>kr(yt,{...t,FallbackComponent:Th,uploads:!0,children:kr(_h,{...t})});function Eh(){return gh.error("No upload collections enabled"),!0}var Nr=Ah("INSERT_UPLOAD_COMMAND"),Rs=t=>{let e=wh(5),[o]=Nh(),{config:r}=Rh(),{collections:n}=r,i,l;e[0]!==o?(i=()=>{if(!o.hasNodes([Re]))throw new Error("UploadPlugin: UploadNode not registered on editor");return Sh(o.registerCommand(Nr,c=>(o.update(()=>{let u=yh()||Ih();if(Mh(u)){let d=je({data:{id:c.id,fields:c.fields,relationTo:c.relationTo,value:c.value}});Lh(d);let{focus:a}=u,p=a.getNode();vh(p)&&!p.__first&&(p.__prev||p.__next)&&p.remove()}}),!0),Dh))},l=[o],e[0]=o,e[1]=i,e[2]=l):(i=e[1],l=e[2]),Oh(i,l);let s;return e[3]!==n?(s=kh(Ss,{enabledCollectionSlugs:n.map(Fh)}),e[3]=n,e[4]=s):s=e[4],s};function Fh(t){let{slug:e}=t;return e}var Ph=R({nodes:[Re],plugins:[{Component:Rs,position:"normal"}],slashMenu:{groups:[Q([{Icon:Tr,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(We,{replace:!1})}}])]},toolbarFixed:{groups:[be([{ChildComponent:Tr,isActive:({selection:t})=>{if(!$h(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return wr(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(We,{replace:!1})}}])]}});import{c as Bh}from"react/compiler-runtime";import{jsx as Sr}from"react/jsx-runtime";import{ShimmerEffect as Hh,useConfig as jh}from"@payloadcms/ui";import{lazy as Uh,Suspense as Gh,useEffect as Wh,useState as Vh}from"react";var Is={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 mo={namespace:"lexical",theme:Is};function ys({config:t,featureClientImportMap:e,featureClientSchemaMap:o,field:r,schemaPath:n,unSanitizedEditorConfig:i}){for(let u of i.features)if(!u?.clientFeatureProps?.featureKey||u?.clientFeatureProps?.order===void 0||u?.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.");i.features=i.features.sort((u,d)=>u.clientFeatureProps.order-d.clientFeatureProps.order);let l=new Map;for(let u of i.features)l.set(u.clientFeatureProps.featureKey,u);let s=new Map,c=0;for(let u of i.features){let d=typeof u.feature=="function"?u.feature({config:t,featureClientImportMap:e,featureClientSchemaMap:o,featureProviderMap:l,field:r,resolvedFeatures:s,schemaPath:n,unSanitizedEditorConfig:i}):u.feature;d.key=u.clientFeatureProps.featureKey,d.order=c,s.set(u.clientFeatureProps.featureKey,d),c++}return s}var vs=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}};if(!t?.size)return e;t.forEach(o=>{if(o.providers?.length&&(e.providers=e.providers.concat(o.providers)),o.enableFormats?.length&&e.enabledFormats.push(...o.enableFormats),o.nodes?.length)for(let r of o.nodes)e.nodes.push(r);if(o.plugins?.length&&o.plugins.forEach((r,n)=>{e.plugins?.push({clientProps:o.sanitizedClientFeatureProps,Component:r.Component,key:o.key+n,position:r.position})}),o.toolbarInline?.groups?.length)for(let r of o.toolbarInline.groups){let n=e.toolbarInline.groups.find(i=>i.key===r.key);n?e.toolbarInline.groups=e.toolbarInline.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),e.toolbarInline?.groups.push(n)}if(o.toolbarFixed?.groups?.length)for(let r of o.toolbarFixed.groups){let n=e.toolbarFixed.groups.find(i=>i.key===r.key);n?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),e.toolbarFixed?.groups.push(n)}if(o.slashMenu?.groups){o.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(o.slashMenu.dynamicGroups));for(let r of o.slashMenu.groups){let n=e.slashMenu.groups.find(i=>i.key===r.key);n?e.slashMenu.groups=e.slashMenu.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),e.slashMenu.groups.push(n)}}if(o.markdownTransformers?.length)for(let r of o.markdownTransformers)typeof r=="function"?e.markdownTransformers.push(r({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(r);e.enabledFeatures.push(o.key)}),e.toolbarInline.groups.sort((o,r)=>o.order&&r.order?o.order-r.order:o.order?-1:r.order?1:0),e.toolbarFixed.groups.sort((o,r)=>o.order&&r.order?o.order-r.order:o.order?-1:r.order?1:0);for(let o of e.toolbarInline.groups)o.items.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);for(let o of e.toolbarFixed.groups)o.items.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);return e};function Lr(t,e,o){return{admin:o,features:vs(t),lexical:e,resolvedFeatureMap:t}}var Kh=Uh(()=>import("./Field-MAUKSOAP.js").then(t=>({default:t.RichText}))),Zh=t=>{let e=Bh(16),{admin:o,clientFeatures:r,featureClientImportMap:n,featureClientSchemaMap:i,field:l,lexicalEditorConfig:s,schemaPath:c}=t,u;e[0]!==o?(u=o===void 0?{}:o,e[0]=o,e[1]=u):u=e[1];let d=u,a=s===void 0?mo:s,{config:p}=jh(),[m,f]=Vh(null),h,g;e[2]!==d||e[3]!==r||e[4]!==p||e[5]!==n||e[6]!==i||e[7]!==l||e[8]!==m||e[9]!==a||e[10]!==c?(h=()=>{if(m)return;let L=[];for(let[T,C]of Object.entries(r))C.clientFeatureProvider&&L.push(C.clientFeatureProvider(C.clientFeatureProps));let I=a||mo,_=ys({config:p,featureClientImportMap:n,featureClientSchemaMap:i,field:l,schemaPath:c??l.name,unSanitizedEditorConfig:{features:L,lexical:I}});f(Lr(_,I,d))},g=[a,d,m,r,n,i,l,p,c],e[2]=d,e[3]=r,e[4]=p,e[5]=n,e[6]=i,e[7]=l,e[8]=m,e[9]=a,e[10]=c,e[11]=h,e[12]=g):(h=e[11],g=e[12]),Wh(h,g);let b;return e[13]!==m||e[14]!==t?(b=Sr(Gh,{fallback:Sr(Hh,{height:"35vh"}),children:m&&Sr(Kh,{...t,editorConfig:m})}),e[13]=m,e[14]=t,e[15]=b):b=e[15],b};function zh(t){return t instanceof HTMLElement}function Yh(...t){return t.filter(Boolean).join(" ")}var po=new WeakMap;function Ms(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function fo(t,e){let o=po.get(t);if(o===void 0){let r=new Set,n=l=>{o!==void 0&&(o.start=Ms(l))},i=l=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let c=Ms(l);for(let u of r)c!==null&&u([c[0]-s[0],c[1]-s[1]],l)};t.addEventListener("touchstart",n),t.addEventListener("touchend",i),o={handleTouchend:i,handleTouchstart:n,listeners:r,start:null},po.set(t,o)}return o.listeners.add(e),()=>{Jh(t,e)}}function Jh(t,e){let o=po.get(t);if(o===void 0)return;let{listeners:r}=o;r.delete(e),r.size===0&&(po.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function Xh(t,e){return fo(t,(o,r)=>{let[n,i]=o;n<0&&-n>Math.abs(i)&&e(n,r)})}function qh(t,e){return fo(t,(o,r)=>{let[n,i]=o;n>0&&n>Math.abs(i)&&e(n,r)})}function Qh(t,e){return fo(t,(o,r)=>{let[n,i]=o;i<0&&-i>Math.abs(n)&&e(n,r)})}function eg(t,e){return fo(t,(o,r)=>{let[n,i]=o;i>0&&i>Math.abs(n)&&e(n,r)})}var F={DOM_ELEMENT_TYPE:1,DOM_TEXT_TYPE:3,NO_DIRTY_NODES:0,HAS_DIRTY_NODES:1,FULL_RECONCILE:2,IS_NORMAL:0,IS_TOKEN:1,IS_SEGMENTED:2,IS_INERT:3,IS_BOLD:1,IS_ITALIC:2,IS_STRIKETHROUGH:4,IS_UNDERLINE:8,IS_CODE:16,IS_SUBSCRIPT:32,IS_SUPERSCRIPT:64,IS_HIGHLIGHT:128,IS_DIRECTIONLESS:1,IS_UNMERGEABLE:2,IS_ALIGN_LEFT:1,IS_ALIGN_CENTER:2,IS_ALIGN_RIGHT:3,IS_ALIGN_JUSTIFY:4,IS_ALIGN_START:5,IS_ALIGN_END:6},tg=F.IS_BOLD|F.IS_ITALIC|F.IS_STRIKETHROUGH|F.IS_UNDERLINE|F.IS_CODE|F.IS_SUBSCRIPT|F.IS_SUPERSCRIPT|F.IS_HIGHLIGHT,og="\xA0",rg=`
|
|
34
|
+
`},[t,e]),m=Oe((_,T)=>{o(C=>{let w=e.length-1,M=e[w];if(M&&M.name===_){if(_==="type")return[...e.slice(0,w),{...M,value:M.value+T}];if(M.value===T)return[...e.slice(0,w),{...M,count:M.count+1}]}return[...C,{name:_,count:1,value:T}]})},[e,o]);fn(()=>{let _=C=>{if(!r)return;let w=C.key;Mc(C)?m("selectAll",""):gn.has(w)?m("press",C.key):[...w].length>1?m("keydown",C.key):m("type",C.key)},T=C=>{if(!r)return;let w=C.key;!gn.has(w)&&[...w].length>1&&m("keyup",C.key)};return t.registerRootListener((C,w)=>{w!==null&&(w.removeEventListener("keydown",_),w.removeEventListener("keyup",T)),C!==null&&(C.addEventListener("keydown",_),C.addEventListener("keyup",T))})},[t,r,m]),fn(()=>{d.current&&d.current.scrollTo(0,d.current.scrollHeight)},[p]),Do(()=>{if(e){let _=p();_!==null&&s(_),d.current&&d.current.scrollTo(0,d.current.scrollHeight)}},[p,e]),Do(()=>t.registerUpdateListener(({dirtyElements:T,dirtyLeaves:C,editorState:w})=>{if(!r)return;let M=w._selection,O=u.current,$=c.current;if(O!==M){if(C.size===0&&T.size===0&&!$){let E=Ao(t._window);if(E&&(E.anchorNode==null||E.focusNode==null))return}u.current=M}c.current=!1;let A=p();A!==null&&s(A)}),[t,p,r,m]),Do(()=>r?t.registerUpdateListener(()=>{let T=t.getRootElement();T!==null&&i(T?.innerHTML)}):void 0,[t,r]);let f=Oe(_=>{r||(_.update(()=>{let T=Rc();T.clear();let C=Sc();T.append(Lc().append(C)),C.select()}),o([])),n(T=>!T)},[r]),h=Oe(()=>{if(!r)return;let _=Ao(t._window);if(_===null||_.anchorNode==null||_.focusNode==null)return;let{anchorNode:T,anchorOffset:C,focusNode:w,focusOffset:M}=Ac(_),O=a().getRootElement(),$;T!==null&&($=hn(T,O));let A;w!==null&&(A=hn(w,O)),m("snapshot",{anchorNode:T,anchorOffset:C,anchorPath:$,focusNode:w,focusOffset:M,focusPath:A})},[m,r,a]),g=Oe(()=>{Ic(p())},[p]),b=Oe(()=>{yc("test.js",p())},[p]);return[Fe("button",{className:`editor-dev-button ${r?"active":""}`,id:"test-recorder-button",onClick:_=>{f(a()),_.preventDefault()},title:r?"Disable test recorder":"Enable test recorder",type:"button",children:r?"Disable test recorder":"Enable test recorder"}),r?Fo("div",{className:"test-recorder-output",children:[Fo("div",{className:"test-recorder-toolbar",children:[Fe("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:_=>{h(),_.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),Fe("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:_=>{g(),_.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),Fe("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:_=>{b(),_.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),Fe("pre",{id:"test-recorder",ref:d,children:l})]}):null]}var xn=()=>{let t=Ec(3),[e]=Nc(),[o,r]=Dc(e),n;return t[0]!==o||t[1]!==r?(n=Fo(Cn.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 Oc=R({plugins:[{Component:xn,position:"bottom"}]});import{c as Fc}from"react/compiler-runtime";import{jsx as $c}from"react/jsx-runtime";import{useLexicalComposerContext as Pc}from"@lexical/react/LexicalComposerContext.js";import{TreeView as Bc}from"@lexical/react/LexicalTreeView.js";import"react";var bn=()=>{let t=Fc(2),[e]=Pc(),o;return t[0]!==e?(o=$c(Bc,{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 Hc=R({plugins:[{Component:bn,position:"bottom"}]});import{$isTableSelection as jc}from"@lexical/table";import{$isRangeSelection as Uc,FORMAT_TEXT_COMMAND as Gc}from"lexical";import{jsx as _n}from"react/jsx-runtime";import"react";var Tn=()=>_n("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:_n("path",{d:"M10.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 ee=t=>({type:"buttons",items:t,key:"format",order:40});var wn={type:"text-format",format:["bold","italic"],tag:"***"},kn={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},En={type:"text-format",format:["bold"],tag:"**"},Nn={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var Ln=[ee([{ChildComponent:Tn,isActive:({selection:t})=>Uc(t)||jc(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(Gc,"bold")},order:1}])],Wc=R(({featureProviderMap:t})=>{let e=[En,Nn];return t.get("italic")&&e.push(kn,wn),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:Ln},toolbarInline:{groups:Ln}}});import{$isTableSelection as Kc}from"@lexical/table";import{$isRangeSelection as Jc,FORMAT_TEXT_COMMAND as Xc}from"lexical";import{jsx as Sn,jsxs as Vc}from"react/jsx-runtime";import"react";var Rn=()=>Vc("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:[Sn("path",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),Sn("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var In={type:"text-format",format:["code"],tag:"`"};var yn=[ee([{ChildComponent:Rn,isActive:({selection:t})=>Jc(t)||Kc(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(Xc,"code")},order:7}])],zc=R({enableFormats:["code"],markdownTransformers:[In],toolbarFixed:{groups:yn},toolbarInline:{groups:yn}});import{$isTableSelection as Zc}from"@lexical/table";import{$isRangeSelection as Yc,FORMAT_TEXT_COMMAND as qc}from"lexical";import{jsx as vn}from"react/jsx-runtime";import"react";var Mn=()=>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:"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 An={type:"text-format",format:["italic"],tag:"*"},Dn={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var On=[ee([{ChildComponent:Mn,isActive:({selection:t})=>Yc(t)||Zc(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(qc,"italic")},order:2}])],Qc=R({enableFormats:["italic"],markdownTransformers:[An,Dn],toolbarFixed:{groups:On},toolbarInline:{groups:On}});import{$isTableSelection as tu}from"@lexical/table";import{$isRangeSelection as ou,FORMAT_TEXT_COMMAND as ru}from"lexical";import{jsx as Fn,jsxs as eu}from"react/jsx-runtime";import"react";var $n=()=>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:[Fn("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"}),Fn("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var Pn={type:"text-format",format:["strikethrough"],tag:"~~"};var Bn=[ee([{ChildComponent:$n,isActive:({selection:t})=>ou(t)||tu(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(ru,"strikethrough")},order:4}])],nu=R({enableFormats:["strikethrough"],markdownTransformers:[Pn],toolbarFixed:{groups:Bn},toolbarInline:{groups:Bn}});import{$isTableSelection as iu}from"@lexical/table";import{$isRangeSelection as lu,FORMAT_TEXT_COMMAND as su}from"lexical";import{jsx as Hn}from"react/jsx-runtime";import"react";var jn=()=>Hn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Hn("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 13.258C16.7768 14.155 16.1398 14.532 15.2038 15C14.5538 15.325 14.2808 15.546 14.2418 15.78H16.7898V16.82H12.7208V16.339C12.7208 15.286 13.5918 14.675 14.3588 14.233C15.0868 13.83 15.4378 13.635 15.4378 13.232C15.4378 12.894 15.2038 12.686 14.8268 12.686C14.3848 12.686 14.1248 13.024 14.1118 13.427H12.7468C12.8248 12.426 13.5528 11.633 14.8398 11.633C15.9448 11.633 16.7768 12.257 16.7768 13.258Z",fill:"currentColor"})});var Un=[ee([{ChildComponent:jn,isActive:({selection:t})=>lu(t)||iu(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(su,"subscript")},order:5}])],au=R({enableFormats:["subscript"],toolbarFixed:{groups:Un},toolbarInline:{groups:Un}});import{$isTableSelection as cu}from"@lexical/table";import{$isRangeSelection as uu,FORMAT_TEXT_COMMAND as du}from"lexical";import{jsx as Gn}from"react/jsx-runtime";import"react";var Wn=()=>Gn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Gn("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 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 Vn=[ee([{ChildComponent:Wn,isActive:({selection:t})=>uu(t)||cu(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(du,"superscript")},order:6}])],mu=R({enableFormats:["superscript"],toolbarFixed:{groups:Vn},toolbarInline:{groups:Vn}});import{$isTableSelection as fu}from"@lexical/table";import{$isRangeSelection as hu,FORMAT_TEXT_COMMAND as gu}from"lexical";import{jsx as Kn,jsxs as pu}from"react/jsx-runtime";import"react";var Jn=()=>pu("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:[Kn("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"}),Kn("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var Xn=[ee([{ChildComponent:Jn,isActive:({selection:t})=>hu(t)||fu(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(gu,"underline")},order:3}])],Cu=R({enableFormats:["underline"],toolbarFixed:{groups:Xn},toolbarInline:{groups:Xn}});import{$createHeadingNode as Tu,$isHeadingNode as ai,HeadingNode as wu}from"@lexical/rich-text";import{$setBlocksType as ku}from"@lexical/selection";import{$getSelection as Eu,$isRangeSelection as Nu}from"lexical";import{jsx as zn}from"react/jsx-runtime";import"react";var Zn=()=>zn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:zn("path",{d:"M4.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 Yn}from"react/jsx-runtime";import"react";var qn=()=>Yn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Yn("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.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 Qn}from"react/jsx-runtime";import"react";var ei=()=>Qn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Qn("path",{d:"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 ti}from"react/jsx-runtime";import"react";var oi=()=>ti("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:ti("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 ri}from"react/jsx-runtime";import"react";var ni=()=>ri("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:ri("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 ii}from"react/jsx-runtime";import"react";var li=()=>ii("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:ii("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 xu,$isHeadingNode as bu,HeadingNode as _u}from"@lexical/rich-text";var $o=t=>(e,o,r)=>{let n=t(r);n&&(n.append(...o),e.replace(n),n.select(0,0))};var si=t=>{let o=`^(${t.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`,r=new RegExp(o);return{type:"element",dependencies:[_u],export:(n,i)=>{if(!bu(n))return null;let l=Number(n.getTag().slice(1));return"#".repeat(l)+" "+i(n)},regExp:r,replace:$o(n=>{let i="h"+n[1]?.length;return xu(i)})}};var ci=t=>{let e=Eu();ku(e,()=>Tu(t))},ui={h1:Zn,h2:qn,h3:ei,h4:oi,h5:ni,h6:li},Lu=R(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[ne(e.map((r,n)=>({ChildComponent:ui[r],isActive:({selection:i})=>{if(!Nu(i))return!1;for(let l of i.getNodes()){if(ai(l)&&l.getTag()===r)continue;let s=l.getParent();if(!(ai(s)&&s.getTag()===r))return!1}return!0},key:r,label:({i18n:i})=>i.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:i})=>{i.update(()=>{ci(r)})},order:n+2})))];return{markdownTransformers:[si(e)],nodes:[wu],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[Q(e.map(r=>({Icon:ui[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(()=>{ci(r)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}});import{$isNodeSelection as Uu}from"lexical";import{jsx as di}from"react/jsx-runtime";import"react";var Po=()=>di("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:di("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as mi,jsxs as Su}from"react/jsx-runtime";import"react";var pi=()=>Su("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[mi("path",{d:"M5 10h10",stroke:"currentColor"}),mi("path",{d:"M10 15V5",stroke:"currentColor"})]});var be=t=>({type:"dropdown",ChildComponent:pi,items:t,key:"add",order:10});import{addClassNamesToElement as Ru}from"@lexical/utils";import{$applyNodeReplacement as Iu,createCommand as yu,DecoratorNode as vu}from"lexical";var ht=yu("INSERT_HORIZONTAL_RULE_COMMAND"),ft=class extends vu{static clone(e){return new this(e.__key)}static getType(){return"horizontalrule"}static importDOM(){return{hr:()=>({conversion:Mu,priority:0})}}static importJSON(e){return fi()}createDOM(e){let o=document.createElement("hr");return Ru(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 Mu(){return{node:fi()}}function fi(){return Iu(new ft)}import{$applyNodeReplacement as Au}from"lexical";import"react";var ye=class extends ft{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return gt()}decorate(){return null}exportJSON(){return super.exportJSON()}};function gt(){return Au(new ye)}function Xt(t){return t instanceof ye}var hi={type:"element",dependencies:[ye],export:(t,e)=>Xt(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=gt();e&&t.replace(e)}};import{c as Du}from"react/compiler-runtime";import{useLexicalComposerContext as Ou}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Fu}from"@lexical/utils";import{$getSelection as $u,$isRangeSelection as Pu,COMMAND_PRIORITY_EDITOR as Bu}from"lexical";import{useEffect as Hu}from"react";var gi=()=>{let t=Du(3),[e]=Ou(),o,r;return t[0]!==e?(o=()=>e.registerCommand(ht,ju,Bu),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Hu(o,r),null};function ju(t){let e=$u();if(!Pu(e))return!1;if(e.focus.getNode()!==null){let r=gt();Fu(r)}return!0}var Gu=R({markdownTransformers:[hi],nodes:[ye],plugins:[{Component:gi,position:"normal"}],slashMenu:{groups:[Q([{Icon:Po,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(ht,void 0)}}])]},toolbarFixed:{groups:[be([{ChildComponent:Po,isActive:({selection:t})=>{if(!Uu(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Xt(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(ht,void 0)}}])]}});import{$findMatchingParent as Ei}from"@lexical/utils";import{$isElementNode as nd,$isRangeSelection as id,INDENT_CONTENT_COMMAND as ld,OUTDENT_CONTENT_COMMAND as sd}from"lexical";import{jsx as zt,jsxs as Wu}from"react/jsx-runtime";import"react";var Ci=()=>Wu("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[zt("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),zt("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),zt("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),zt("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as Zt,jsxs as Vu}from"react/jsx-runtime";import"react";var xi=()=>Vu("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Zt("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),Zt("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),Zt("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),Zt("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});import{jsx as Ku}from"react/jsx-runtime";import{useLexicalComposerContext as Ju}from"@lexical/react/LexicalComposerContext";import{TabIndentationPlugin as Xu}from"@lexical/react/LexicalTabIndentationPlugin";import{$findMatchingParent as zu,mergeRegister as Zu}from"@lexical/utils";import{$getSelection as Yu,$isElementNode as qu,$isRangeSelection as Qu,COMMAND_PRIORITY_LOW as bi,INDENT_CONTENT_COMMAND as _i,KEY_TAB_COMMAND as ed,OUTDENT_CONTENT_COMMAND as td,TabNode as od}from"lexical";import{useEffect as Ti}from"react";var wi=({clientProps:t})=>{let[e]=Ju(),{disabledNodes:o,disableTabNode:r}=t;return Ti(()=>{if(!(!e||!o?.length))return e.registerCommand(_i,()=>rd(n=>{if(!o.includes(n.getType())){let i=n.getIndent();n.setIndent(i+1)}}),bi)},[e,o]),Ti(()=>{if(!(!e||!r))return Zu(e.registerCommand(ed,n=>(n.preventDefault(),e.dispatchCommand(n.shiftKey?td:_i,void 0)),bi),e.registerNodeTransform(od,n=>{n.remove()}))},[e,r]),Ku(Xu,{})};function rd(t){let e=Yu();if(!Qu(e))return!1;let o=new Set,r=e.getNodes();for(let n=0;n<r.length;n++){let i=r[n],l=i.getKey();if(o.has(l))continue;let s=zu(i,c=>qu(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 ki=t=>({type:"buttons",items:t,key:"indent",order:35});var Ni=({disabledNodes:t})=>[ki([{ChildComponent:Ci,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes();if(!o?.length)return!1;let r=!1,n=i=>nd(i)&&i.canIndent();for(let i of o)if(n(i)){if(i.getIndent()<=0)return!1;r=!0}return!r&&Li(e,i=>n(i)&&i.getIndent()>0)?!0:r},key:"indentDecrease",label:({i18n:e})=>e.t("lexical:indent:decreaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(sd,void 0)},order:1},{ChildComponent:xi,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes();return!o?.length||o.some(r=>t?.includes(r.getType()))?!1:!Li(e,r=>(t??[]).includes(r.getType()))},key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(ld,void 0)},order:2}])],ad=R(({props:t})=>{let e=t.disabledNodes??[];return{plugins:[{Component:wi,position:"normal"}],sanitizedClientFeatureProps:t,toolbarFixed:{groups:Ni({disabledNodes:e})},toolbarInline:{groups:Ni({disabledNodes:e})}}});function Li(t,e){return id(t)&&(!!Ei(t.anchor.getNode(),e)||!!Ei(t.focus.getNode(),e))}import{$findMatchingParent as _m}from"@lexical/utils";import{$getSelection as Jo,$isRangeSelection as rl}from"lexical";import{jsx as Si}from"react/jsx-runtime";import"react";var Ri=()=>Si("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:Si("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 Ii}from"@lexical/selection";function Xe(t){let{anchor:e}=t,{focus:o}=t,r=t.anchor.getNode(),n=t.focus.getNode();return r===n?r:t.isBackward()?Ii(o)?r:n:Ii(e)?r:n}var Bo=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as bd}from"lexical";import{addClassNamesToElement as cd,isHTMLAnchorElement as ud}from"@lexical/utils";import Uo from"bson-objectid";import{$applyNodeReplacement as dd,$createTextNode as yi,$getSelection as md,$isElementNode as vi,$isRangeSelection as jo,createCommand as pd,ElementNode as fd}from"lexical";var hd=new Set(["http:","https:","mailto:","sms:","tel:"]),ie=class t extends fd{__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:gd,priority:1})}}static importJSON(e){let o=_e({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),e.version===2&&!e.id&&(e.id=new Uo.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=Ho(o.rel,"add","noopener")),cd(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(),i=o.focus.getNode();return this.isParentOf(n)&&this.isParentOf(i)&&o.getTextContent().length>0}getFields(){return this.getLatest().__fields}getID(){return this.getLatest().__id}insertNewAfter(e,o=!0){let r=this.getParentOrThrow().insertNewAfter(e,o);if(vi(r)){let n=_e({fields:this.__fields});return r.append(n),n}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!hd.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,i=this.__fields?.newTab;return n!=null&&n!==e.__fields?.url&&this.__fields?.linkType==="custom"&&(o.href=n),this.__fields?.linkType==="internal"&&e.__fields?.linkType==="custom"&&o.removeAttribute("href"),o.rel==null&&(o.rel=""),i!==e.__fields?.newTab&&(i??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=Ho(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=Ho(o.rel,"remove","noopener"))),!1}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields).setID(e.id)}};function gd(t){let e=null;if(ud(t)){let o=t.textContent;o!==null&&o!==""&&(e=_e({id:new Uo.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function _e({id:t,fields:e}){return dd(new ie({id:t??new Uo.default().toHexString(),fields:e}))}function z(t){return t instanceof ie}var fe=pd("TOGGLE_LINK_COMMAND");function Go(t){let e=md();if(!jo(e)&&(t===null||!t.selectedNodes?.length))return;let o=jo(e)?e.extract():t===null?[]:t.selectedNodes;if(t===null){o?.forEach(i=>{let l=i.getParent();z(l)&&(l.getChildren().forEach(u=>{l.insertBefore(u)}),l.remove())});return}if(o?.length===1){let i=o[0],l=z(i)?i:Cd(i);if(l!==null){l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append(yi(t.text)),l.getChildren().forEach(s=>{s!==l.getLastChild()&&s.remove()}));return}}let r=null,n=null;o?.forEach(i=>{let l=i.getParent();if(!(l===n||l===null||vi(i)&&!i.isInline())){if(z(l)){n=l,l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append(yi(t.text)),l.getChildren().forEach(s=>{s!==l.getLastChild()&&s.remove()}));return}if(l.is(r)||(r=l,n=_e({fields:t.fields}),z(l)?i.getPreviousSibling()===null?l.insertBefore(n):l.insertAfter(n):i.insertBefore(n)),z(i)){if(i.is(n))return;if(n!==null){let s=i.getChildren();n.append(...s)}i.remove();return}n!==null&&n.append(i)}})}function Cd(t){return xd(t,e=>z(e))}function xd(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function Ho(t,e,o){let r,n=`${t}`;if(e==="add"){if(n.includes(o)){let i=new RegExp(o,"g");n=n.replace(i,"").trim()}n=n.trim(),r=n.length===0?`${o}`:`${n} ${o}`}else{let i=new RegExp(o,"g");r=n.replace(i,"").trim()}return r}var Mi={type:"text-match",dependencies:[ie],export:(t,e)=>{if(!z(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=_e({fields:{doc:null,linkType:"custom",newTab:!1,url:r}}),i=bd(o);return i.setFormat(t.getFormat()),n.append(i),t.replace(n),i},trigger:")"};import{$applyNodeReplacement as _d,$isElementNode as Td}from"lexical";var Te=class t extends ie{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=Ct({}).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(Td(r)){let n=Ct({fields:this.__fields});return r.append(n),n}return null}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields)}};function Ct({fields:t}){return _d(new Te({id:"",fields:t}))}function we(t){return t instanceof Te}import{c as wd}from"react/compiler-runtime";import{useLexicalComposerContext as kd}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Ed}from"@lexical/utils";import{$createTextNode as Ai,$getSelection as Nd,$isElementNode as Oi,$isLineBreakNode as Fi,$isNodeSelection as Ld,$isRangeSelection as Sd,$isTextNode as xt,TextNode as Rd}from"lexical";import{useEffect as Id}from"react";function Di(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 $i(t,e){for(let o of e){let r=o(t);if(r!=null)return r}return null}var yd=/[.,;\s]/;function qt(t){return t!==void 0&&yd.test(t)}function Pi(t){return qt(t[t.length-1])}function Vo(t){return qt(t[0])}function vd(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function Bi(t){let e=t.getPreviousSibling();return Oi(e)&&(e=e.getLastDescendant()),e===null||Fi(e)||xt(e)&&Pi(e.getTextContent())}function Hi(t){let e=t.getNextSibling();return Oi(e)&&(e=e.getFirstDescendant()),e===null||Fi(e)||xt(e)&&Vo(e.getTextContent())}function Md(t,e,o,r){return(t>0?qt(o[t-1]):Bi(r[0]))?e<o.length?qt(o[e]):Hi(r[r.length-1]):!1}function Ad(t,e,o){let r=[],n=[],i=[],l=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),l+=a):p>=o?i.push(c):n.push(c),s+=a,u.shift()}return[l,r,n,i]}function Dd(t,e,o,r){let n={linkType:"custom",url:r.url,...r.fields},i=Ct({fields:n});if(t.length===1){let l=t[0],s;if(e===0?[s]=l.splitText(o):[,s]=l.splitText(e,o),s){let u=Ai(r.text);u.setFormat(s.getFormat()),u.setDetail(s.getDetail()),u.setStyle(s.getStyle()),i.append(u),s.replace(i)}return l}else if(t.length>1){let l=t[0],s=l.getTextContent().length,u;e===0?u=l:[,u]=l.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[g,b]=a.splitText(o-f);g&&c.push(g),d=b}s+=m}),u){let a=Nd(),p=a?a.getNodes().find(xt):void 0,m=Ai(u.getTextContent());return m.setFormat(u.getFormat()),m.setDetail(u.getDetail()),m.setStyle(u.getStyle()),i.append(m,...c),p&&p===u&&(Sd(a)?m.select(a.anchor.offset,a.focus.offset):Ld(a)&&m.select(0,m.getTextContent().length)),u.replace(i),d}}}function Od(t,e,o){let r=[...t],n=r.map(u=>u.getTextContent()).join(""),i=n,l,s=0;for(;(l=$i(i,e))!=null&&l!==null;){let u=l.index,c=l.length,d=u+c;if(Md(s+u,s+d,n,r)){let[p,,m,f]=Ad(r,s+u,s+d),h=s+u-p,g=s+d-p,b=Dd(m,h,g,l);r=b?[b,...f]:f,o(l.url,null),s=0}else s+=d;i=i.substring(d)}}function Wo(t,e,o){let r=t.getChildren(),n=r.length;for(let u=0;u<n;u++){let c=r[u];if(!xt(c)||!c.isSimpleText()){Yt(t),o(null,t.getFields()?.url??null);return}}let i=t.getTextContent(),l=$i(i,e);if(l===null||l.text!==i){Yt(t),o(null,t.getFields()?.url??null);return}if(!Bi(t)||!Hi(t)){Yt(t),o(null,t.getFields()?.url??null);return}let s=t.getFields()?.url;if(s!==l?.url){let u=t.getFields();u.url=l?.url,t.setFields(u),o(l.url,s??null)}}function Fd(t,e,o){let r=t.getPreviousSibling(),n=t.getNextSibling(),i=t.getTextContent();if(we(r)){let l=r.getFields()?.url?r.getFields()?.url?.startsWith("mailto:")??!1:!1;(!Vo(i)||vd(i,l))&&(r.append(t),Wo(r,e,o),o(null,r.getFields()?.url??null))}we(n)&&!Pi(i)&&(Yt(n),Wo(n,e,o),o(null,n.getFields()?.url??null))}function Yt(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 $d(t){let e=[t],o=t.getNextSibling();for(;o!==null&&xt(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function Pd(t,e,o){let r=wd(5),n,i;r[0]!==t||r[1]!==e||r[2]!==o?(n=()=>{if(!t.hasNodes([Te]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let l=(s,u)=>{o?.(s,u)};return Ed(t.registerNodeTransform(Rd,s=>{let u=s.getParentOrThrow(),c=s.getPreviousSibling();if(we(u))Wo(u,e,l);else if(!z(u)){if(s.isSimpleText()&&(Vo(s.getTextContent())||!we(c))){let d=$d(s);Od(d,e,l)}Fd(s,e,l)}}))},i=[t,e,o],r[0]=t,r[1]=e,r[2]=o,r[3]=n,r[4]=i):(n=r[3],i=r[4]),Id(n,i)}var Bd=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,Hd=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,jd=[Di(Bd,t=>t.startsWith("http")?t:`https://${t}`),Di(Hd,t=>`mailto:${t}`)],ji=()=>{let[t]=kd();return Pd(t,jd),null};import{jsx as Ud}from"react/jsx-runtime";import{ClickableLinkPlugin as Gd}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var Ui=()=>Ud(Gd,{});import{jsx as sm}from"react/jsx-runtime";import"react";import{createPortal as am}from"react-dom";import{jsx as ke,jsxs as bt,Fragment as Vd}from"react/jsx-runtime";import{useLexicalComposerContext as Kd}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as Gi,mergeRegister as Wi}from"@lexical/utils";import{getTranslation as Ko}from"@payloadcms/translations";import{CloseMenuIcon as Jd,EditIcon as Xd,ExternalLinkIcon as Vi,formatDrawerSlug as zd,useConfig as Zd,useEditDepth as Yd,useLocale as qd,useTranslation as Qd}from"@payloadcms/ui";import{requests as em}from"@payloadcms/ui/shared";import{$getSelection as Ki,$isLineBreakNode as tm,$isRangeSelection as Ji,COMMAND_PRIORITY_HIGH as om,COMMAND_PRIORITY_LOW as Xi,getDOMSelection as rm,KEY_ESCAPE_COMMAND as nm,SELECTION_CHANGE_COMMAND as im}from"lexical";import zi,{useCallback as Zi,useEffect as to,useRef as lm,useState as $e}from"react";function Qt(t,e,o,r=10,n=5){let i=o.parentElement;if(t===null||i==null){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let l=e.getBoundingClientRect(),s=o.getBoundingClientRect(),u=i.getBoundingClientRect(),c=t.top-r,d=t.left-n;c<u.top&&(c+=l.height+t.height+r*2),d+l.width>u.right&&(d=u.right-l.width-n),c-=s.top,d-=s.left,e.style.opacity="1",e.style.transform=`translate(${d}px, ${c}px)`}import{createCommand as Wd}from"lexical";var eo=Wd("TOGGLE_LINK_WITH_MODAL_COMMAND");function Yi(t){t.preventDefault()}function qi({anchorElem:t}){let[e]=Kd(),[o,r]=$e(),n=lm(null),[i,l]=$e(null),[s,u]=$e(null),{fieldProps:{schemaPath:c},uuid:d}=H(),{config:a,getEntityConfig:p}=Zd(),{i18n:m,t:f}=Qd(),[h,g]=$e(),b=Yd(),[L,I]=$e(!1),[_,T]=$e([]),C=qd(),[w,M]=$e(!1),O=zd({slug:"lexical-rich-text-link-"+d,depth:b}),{toggleDrawer:$}=ge(O),A=Zi(()=>{I(!1),n&&n.current&&(n.current.style.opacity="0",n.current.style.transform="translate(-10000px, -10000px)"),M(!1),l(null),u(null),T([]),g(void 0)},[I,l,u,T]),E=Zi(()=>{let x=Ki(),N;if(!Ji(x)||!x){A();return}let y=Xe(x);N=e.getElementByKey(y.getKey())?.getBoundingClientRect();let S=Gi(y,z),v=x.getNodes().filter(W=>!tm(W)).find(W=>{let G=Gi(W,z);return S&&!S.is(G)||G&&!G.is(S)});if(S==null||v){A();return}r(S);let k=S.getFields(),F={...k,id:S.getID(),text:S.getTextContent()};if(k?.linkType==="custom")l(k?.url??null),u(null);else{l(`${a.routes.admin==="/"?"":a.routes.admin}/collections/${k?.doc?.relationTo}/${k?.doc?.value}`);let W=k?.doc?.relationTo?p({collectionSlug:k?.doc?.relationTo}):void 0;if(!W)u(k?.label?String(k?.label):null),l(k?.url?String(k?.url):null);else{let G=typeof k.doc?.value=="object"?k.doc.value.id:k.doc?.value,te=k.doc?.relationTo;if(!G||!te)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let ce=f("fields:linkedTo",{label:`${Ko(W.labels.singular,m)} - ${f("lexical:link:loadingWithEllipsis",m)}`}).replace(/<[^>]*>?/g,"");u(ce),em.get(`${a.serverURL}${a.routes.api}/${te}/${G}`,{headers:{"Accept-Language":m.language},params:{depth:0,locale:C?.code}}).then(async Y=>{if(!Y.ok)throw new Error(`HTTP error! Status: ${Y.status}`);let V=await Y.json(),oe=W?.admin?.useAsTitle||"id",re=V[oe],le=f("fields:linkedTo",{label:`${Ko(W.labels.singular,m)} - ${re}`}).replace(/<[^>]*>?/g,"");u(le)}).catch(()=>{let Y=f("fields:linkedTo",{label:`${Ko(W.labels.singular,m)} - ${f("general:untitled",m)} - ID: ${G}`}).replace(/<[^>]*>?/g,"");u(Y)})}}g(F),I(!0),T(x?x?.getNodes():[]),we(S)?M(!0):M(!1);let B=n.current,U=rm(e._window),{activeElement:Z}=document;if(B===null)return;let Ge=e.getRootElement();return U!==null&&Ge!==null&&Ge.contains(U.anchorNode)?(N||(N=U.getRangeAt(0).getBoundingClientRect()),N!=null&&(N.y+=40,Qt(N,B,t))):(Z==null||Z.className!=="link-input")&&(Ge!==null&&Qt(null,B,t),l(null),u(null)),!0},[e,A,a.routes.admin,a.routes.api,a.serverURL,p,f,m,C?.code,t]);return to(()=>Wi(e.registerCommand(eo,x=>(e.dispatchCommand(fe,x),E(),$(),!0),Xi)),[e,E,$,O]),to(()=>{let x=t.parentElement,N=()=>{e.getEditorState().read(()=>{E()})};return window.addEventListener("resize",N),x?.addEventListener("scroll",N),()=>{window.removeEventListener("resize",N),x?.removeEventListener("scroll",N)}},[t.parentElement,e,E]),to(()=>Wi(e.registerUpdateListener(({editorState:x})=>{x.read(()=>{E()})}),e.registerCommand(im,()=>(E(),!0),Xi),e.registerCommand(nm,()=>L?(A(),!0):!1,om)),[e,E,L,A]),to(()=>{e.getEditorState().read(()=>{E()})},[e,E]),bt(zi.Fragment,{children:[ke("div",{className:"link-editor",ref:n,children:bt("div",{className:"link-input",children:[i&&i.length>0?bt("a",{href:i,rel:"noopener noreferrer",target:"_blank",children:[o?.__fields.newTab?ke(Vi,{}):null,s!=null&&s.length>0?s:i]}):s!=null&&s.length>0?bt(Vd,{children:[o?.__fields.newTab?ke(Vi,{}):null,ke("span",{className:"link-input__label-pure",children:s})]}):null,e.isEditable()&&bt(zi.Fragment,{children:[ke("button",{"aria-label":"Edit link",className:"link-edit",onClick:x=>{x.preventDefault(),$()},onMouseDown:Yi,tabIndex:0,type:"button",children:ke(Xd,{})}),!w&&ke("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(fe,null)},onMouseDown:Yi,tabIndex:0,type:"button",children:ke(Jd,{})})]})]})}),ke(lt,{className:"lexical-link-edit-drawer",data:h,drawerSlug:O,drawerTitle:f("fields:editLink"),featureKey:"link",handleDrawerSubmit:(x,N)=>{let y=N,S={...y};delete S.text,e.update(()=>{let v=Ki(),k=null;if(Ji(v)?k=Xe(v).getParent():_.length&&(k=_[0]?.getParent()??null),k&&we(k)){let F=_e({fields:S});k.replace(F,!0)}}),e.dispatchCommand(fe,{fields:S,selectedNodes:_,text:y.text})},schemaPath:c,schemaPathSuffix:"fields"})]})}var Qi=t=>{let{anchorElem:e=document.body}=t;return am(sm(qi,{anchorElem:e}),e)};import{c as dm}from"react/compiler-runtime";import{useLexicalComposerContext as mm}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as pm}from"@lexical/utils";import{$getSelection as fm,$isElementNode as hm,$isRangeSelection as gm,COMMAND_PRIORITY_LOW as tl,PASTE_COMMAND as Cm}from"lexical";import{useEffect as xm}from"react";var cm=/^(?:[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+)?$/,um=/^(?:\/[\w\-./]*(?:#\w[\w-]*)?|#[\w\-]+)$/;function el(t){if(!t)return!1;if(t==="https://"||cm.test(t)||um.test(t))return!0;try{return new URL(t),!0}catch{}return!1}var ol=t=>{let e=dm(5),{clientProps:o}=t,[r]=mm(),n,i;return e[0]!==o.defaultLinkType||e[1]!==o.defaultLinkURL||e[2]!==r?(n=()=>{if(!r.hasNodes([ie]))throw new Error("LinkPlugin: LinkNode not registered on editor");return pm(r.registerCommand(fe,l=>l===null?(Go(null),!0):(l.fields?.linkType||(l.fields.linkType=o.defaultLinkType),l.fields?.url||(l.fields.url=o.defaultLinkURL),Go(l),!0),tl),r.registerCommand(Cm,l=>{let s=fm();if(!gm(s)||s.isCollapsed()||!(l instanceof ClipboardEvent)||l.clipboardData==null)return!1;let u=l.clipboardData.getData("text");if(!el(u))return!1;if(!s.getNodes().some(bm)){let c={doc:null,linkType:"custom",newTab:!1,url:u};return r.dispatchCommand(fe,{fields:c,text:null}),l.preventDefault(),!0}return!1},tl))},i=[o.defaultLinkType,o.defaultLinkURL,r],e[0]=o.defaultLinkType,e[1]=o.defaultLinkURL,e[2]=r,e[3]=n,e[4]=i):(n=e[3],i=e[4]),xm(n,i),null};function bm(t){return hm(t)}var nl=[Bo([{ChildComponent:Ri,isActive:({selection:t})=>{if(rl(t)){let e=Xe(t);return _m(e,z)!=null}return!1},isEnabled:({selection:t})=>!!(rl(t)&&Jo()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(fe,null);else{let o,r=[];if(t.getEditorState().read(()=>{o=Jo()?.getTextContent(),r=Jo()?.getNodes()??[]}),!o?.length)return;let n={doc:null,newTab:!1};t.dispatchCommand(eo,{fields:n,selectedNodes:r,text:o})}},order:1}])],Tm=R(({props:t})=>({markdownTransformers:[Mi],nodes:[ie,t?.disableAutoLinks===!0?null:Te].filter(Boolean),plugins:[{Component:ol,position:"normal"},t?.disableAutoLinks===!0||t?.disableAutoLinks==="creationOnly"?null:{Component:ji,position:"normal"},{Component:Ui,position:"normal"},{Component:Qi,position:"floatingAnchorElem"}].filter(Boolean),sanitizedClientFeatureProps:t,toolbarFixed:{groups:nl},toolbarInline:{groups:nl}}));import{$isListNode as Zo,INSERT_CHECK_LIST_COMMAND as ul,ListItemNode as Am,ListNode as Dm}from"@lexical/list";import{$isRangeSelection as Om}from"lexical";import{jsx as il,jsxs as wm}from"react/jsx-runtime";import"react";var Xo=()=>wm("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("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),il("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as km}from"react/jsx-runtime";import{ListPlugin as Em}from"@lexical/react/LexicalListPlugin.js";import"react";var ze=()=>km(Em,{});function Ze(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as Rm,ListItemNode as Im,ListNode as ym}from"@lexical/list";import{$createListItemNode as Nm,$createListNode as Lm,$isListItemNode as Sm,$isListNode as zo}from"@lexical/list";var ll=4,Ye=t=>(e,o,r)=>{let n=e.getPreviousSibling(),i=e.getNextSibling(),l=Nm(t==="check"?r[3]==="x":void 0);if(zo(i)&&i.getListType()===t){let u=i.getFirstChild();u!==null?u.insertBefore(l):i.append(l),e.remove()}else if(zo(n)&&n.getListType()===t)n.append(l),e.remove();else{let u=Lm(t,t==="number"?Number(r[2]):void 0);u.append(l),e.replace(u)}l.append(...o),l.select(0,0);let s=Math.floor(r[1].length/ll);s&&l.setIndent(s)},Pe=(t,e,o)=>{let r=[],n=t.getChildren(),i=0;for(let l of n)if(Sm(l)){if(l.getChildrenSize()===1){let d=l.getFirstChild();if(zo(d)){r.push(Pe(d,e,o+1));continue}}let s=" ".repeat(o*ll),u=t.getListType(),c=u==="number"?`${t.getStart()+i}. `:u==="check"?`- [${l.getChecked()?"x":" "}] `:"- ";r.push(s+c+e(l)),i++}return r.join(`
|
|
36
|
+
`)};var sl={type:"element",dependencies:[ym,Im],export:(t,e)=>Rm(t)?Pe(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:Ye("check")};import{jsx as vm}from"react/jsx-runtime";import{CheckListPlugin as Mm}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var al=()=>vm(Mm,{});var cl=[ne([{ChildComponent:Xo,isActive:({selection:t})=>{if(!Om(t))return!1;for(let e of t.getNodes()){if(Zo(e)&&e.getListType()==="check")continue;let o=e.getParent();if(Zo(o)&&o.getListType()==="check")continue;let r=o?.getParent();if(!(Zo(r)&&r.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(ul,void 0)},order:12}])],Fm=R(({featureProviderMap:t})=>{let e=[{Component:al,position:"normal"}];return!t.has("unorderedList")&&!t.has("orderedList")&&e.push({Component:ze,position:"normal"}),{markdownTransformers:[sl],nodes:t.has("unorderedList")||t.has("orderedList")?[]:[Dm,Am],plugins:e,slashMenu:{groups:[Ze([{Icon:Xo,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:o})=>o.t("lexical:checklist:label"),onSelect:({editor:o})=>{o.dispatchCommand(ul,void 0)}}])]},toolbarFixed:{groups:cl},toolbarInline:{groups:cl}}});import{$isListNode as qo,INSERT_ORDERED_LIST_COMMAND as pl,ListItemNode as jm,ListNode as Um}from"@lexical/list";import{$isRangeSelection as Gm}from"lexical";import{jsx as _t,jsxs as $m}from"react/jsx-runtime";import"react";var Yo=()=>$m("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[_t("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"}),_t("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"}),_t("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),_t("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),_t("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Pm,ListItemNode as Bm,ListNode as Hm}from"@lexical/list";var dl={type:"element",dependencies:[Hm,Bm],export:(t,e)=>Pm(t)?Pe(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:Ye("number")};var ml=[ne([{ChildComponent:Yo,isActive:({selection:t})=>{if(!Gm(t))return!1;for(let e of t.getNodes()){if(qo(e)&&e.getListType()==="number")continue;let o=e.getParent();if(qo(o)&&o.getListType()==="number")continue;let r=o?.getParent();if(!(qo(r)&&r.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(pl,void 0)},order:10}])],Wm=R(({featureProviderMap:t})=>({markdownTransformers:[dl],nodes:t.has("orderedList")?[]:[Um,jm],plugins:t.has("orderedList")?[]:[{Component:ze,position:"normal"}],slashMenu:{groups:[Ze([{Icon:Yo,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:e})=>e.t("lexical:orderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(pl,void 0)}}])]},toolbarFixed:{groups:ml},toolbarInline:{groups:ml}}));import{$isListNode as er,INSERT_UNORDERED_LIST_COMMAND as gl,ListItemNode as zm,ListNode as Zm}from"@lexical/list";import{$isRangeSelection as Ym}from"lexical";import{jsx as qe,jsxs as Vm}from"react/jsx-runtime";import"react";var Qo=()=>Vm("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[qe("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),qe("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),qe("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),qe("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),qe("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),qe("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Km,ListItemNode as Jm,ListNode as Xm}from"@lexical/list";var fl={type:"element",dependencies:[Xm,Jm],export:(t,e)=>Km(t)?Pe(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:Ye("bullet")};var hl=[ne([{ChildComponent:Qo,isActive:({selection:t})=>{if(!Ym(t))return!1;for(let e of t.getNodes()){if(er(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(er(o)&&o.getListType()==="bullet")continue;let r=o?.getParent();if(!(er(r)&&r.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(gl,void 0)},order:11}])],qm=R({markdownTransformers:[fl],nodes:[Zm,zm],plugins:[{Component:ze,position:"normal"}],slashMenu:{groups:[Ze([{Icon:Qo,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(gl,void 0)}}])]},toolbarFixed:{groups:hl},toolbarInline:{groups:hl}});import{jsx as Qm}from"react/jsx-runtime";import{addClassNamesToElement as ep}from"@lexical/utils";import{DecoratorNode as tp}from"lexical";import*as Cl from"react";var op=Cl.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),Tt=class t extends tp{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new t({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return rp({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return ep(o,"unknownConverted"),o}decorate(){return Qm(op,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function rp({data:t}){return new Tt({data:t})}var np=R(()=>({nodes:[Tt]}));import{jsx as ip}from"react/jsx-runtime";import{addClassNamesToElement as lp}from"@lexical/utils";import{DecoratorNode as sp}from"lexical";import*as xl from"react";var ap=xl.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),wt=class t extends sp{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new t({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return cp({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return lp(o,"unknownConverted"),o}decorate(){return ip(ap,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function cp({data:t}){return new wt({data:t})}var up=R(()=>({nodes:[wt]}));import{$setBlocksType as Tl}from"@lexical/selection";import{$createParagraphNode as wl,$getSelection as kl,$isParagraphNode as bl,$isRangeSelection as dp}from"lexical";var _l=[ne([{ChildComponent:at,isActive:({selection:t})=>{if(!dp(t))return!1;for(let e of t.getNodes())if(!bl(e)&&!bl(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=kl();Tl(e,()=>wl())})},order:1}])],mp=R({slashMenu:{groups:[Q([{Icon:at,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=kl();Tl(e,()=>wl())})}}])]},toolbarFixed:{groups:_l},toolbarInline:{groups:_l}});import{c as Ap}from"react/compiler-runtime";import{jsx as Dp}from"react/jsx-runtime";import{useLexicalComposerContext as Op}from"@lexical/react/LexicalComposerContext";import{useEffect as Fp,useState as $p}from"react";import{jsx as Ul,Fragment as Mp}from"react/jsx-runtime";import"react";import{jsx as pp}from"react/jsx-runtime";var El={quote:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return pp("blockquote",{children:o})}};import{jsx as fp}from"react/jsx-runtime";var Nl={heading:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.tag;return fp(r,{children:o})}};import{jsx as hp}from"react/jsx-runtime";var Ll={horizontalrule:hp("hr",{})};import{jsx as gp}from"react/jsx-runtime";var Sl={linebreak:gp("br",{})};import{jsx as Rl}from"react/jsx-runtime";var Il=({internalDocToHref:t})=>({autolink:({node:e,nodesToJSX:o})=>{let r=o({nodes:e.children}),n=e.fields.newTab?"noopener noreferrer":void 0,i=e.fields.newTab?"_blank":void 0;return Rl("a",{href:e.fields.url,rel:n,target:i,children:r})},link:({node:e,nodesToJSX:o})=>{let r=o({nodes:e.children}),n=e.fields.newTab?"noopener noreferrer":void 0,i=e.fields.newTab?"_blank":void 0,l=e.fields.url??"";return e.fields.linkType==="internal"&&(t?l=t({linkNode:e}):(console.error("Lexical => JSX converter: Link converter: found internal link, but internalDocToHref is not provided"),l="#")),Rl("a",{href:l,rel:n,target:i,children:r})}});import{jsx as Qe,jsxs as Cp,Fragment as xp}from"react/jsx-runtime";import{v4 as bp}from"uuid";var yl={list:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.tag;return Qe(r,{className:`list-${t?.listType}`,children:o})},listitem:({node:t,nodesToJSX:e,parent:o})=>{let r=t.children.some(i=>i.type==="list"),n=e({nodes:t.children});if("listType"in o&&o?.listType==="check"){let i=bp();return Qe("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:Cp(xp,{children:[Qe("input",{checked:t.checked,id:i,readOnly:!0,type:"checkbox"}),Qe("label",{htmlFor:i,children:n}),Qe("br",{})]})})}else return Qe("li",{className:`${r?"nestedListItem":""}`,style:r?{listStyleType:"none"}:void 0,value:t?.value,children:n})}};import{jsx as tr}from"react/jsx-runtime";var vl={paragraph:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return o?.length?tr("p",{children:o}):tr("p",{children:tr("br",{})})}};var Ml={tab:" "};import{jsx as kt}from"react/jsx-runtime";var Al={table:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return kt("div",{className:"lexical-table-container",children:kt("table",{className:"lexical-table",style:{borderCollapse:"collapse"},children:kt("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}`,i={backgroundColor:t.backgroundColor||void 0,border:"1px solid #ccc",padding:"8px"},l=t.colSpan&&t.colSpan>1?t.colSpan:void 0,s=t.rowSpan&&t.rowSpan>1?t.rowSpan:void 0;return kt(r,{className:`lexical-table-cell ${n}`,colSpan:l,rowSpan:s,style:i,children:o})},tablerow:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return kt("tr",{className:"lexical-table-row",children:o})}};import{jsx as Be}from"react/jsx-runtime";import"react";var D={DOM_ELEMENT_TYPE:1,DOM_TEXT_TYPE:3,NO_DIRTY_NODES:0,HAS_DIRTY_NODES:1,FULL_RECONCILE:2,IS_NORMAL:0,IS_TOKEN:1,IS_SEGMENTED:2,IS_INERT:3,IS_BOLD:1,IS_ITALIC:2,IS_STRIKETHROUGH:4,IS_UNDERLINE:8,IS_CODE:16,IS_SUBSCRIPT:32,IS_SUPERSCRIPT:64,IS_HIGHLIGHT:128,IS_DIRECTIONLESS:1,IS_UNMERGEABLE:2,IS_ALIGN_LEFT:1,IS_ALIGN_CENTER:2,IS_ALIGN_RIGHT:3,IS_ALIGN_JUSTIFY:4,IS_ALIGN_START:5,IS_ALIGN_END:6},_p=D.IS_BOLD|D.IS_ITALIC|D.IS_STRIKETHROUGH|D.IS_UNDERLINE|D.IS_CODE|D.IS_SUBSCRIPT|D.IS_SUPERSCRIPT|D.IS_HIGHLIGHT,Tp="\xA0",wp=`
|
|
39
37
|
|
|
40
|
-
`,Ds="\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",ng=new RegExp("^[^"+As+"]*["+Ds+"]"),ig=new RegExp("^[^"+Ds+"]*["+As+"]"),lg={bold:F.IS_BOLD,code:F.IS_CODE,highlight:F.IS_HIGHLIGHT,italic:F.IS_ITALIC,strikethrough:F.IS_STRIKETHROUGH,subscript:F.IS_SUBSCRIPT,superscript:F.IS_SUPERSCRIPT,underline:F.IS_UNDERLINE},sg={directionless:F.IS_DIRECTIONLESS,unmergeable:F.IS_UNMERGEABLE},ag={center:F.IS_ALIGN_CENTER,end:F.IS_ALIGN_END,justify:F.IS_ALIGN_JUSTIFY,left:F.IS_ALIGN_LEFT,right:F.IS_ALIGN_RIGHT,start:F.IS_ALIGN_START},cg={[F.IS_ALIGN_CENTER]:"center",[F.IS_ALIGN_END]:"end",[F.IS_ALIGN_JUSTIFY]:"justify",[F.IS_ALIGN_LEFT]:"left",[F.IS_ALIGN_RIGHT]:"right",[F.IS_ALIGN_START]:"start"},ug={normal:F.IS_NORMAL,segmented:F.IS_SEGMENTED,token:F.IS_TOKEN},dg={[F.IS_NORMAL]:"normal",[F.IS_SEGMENTED]:"segmented",[F.IS_TOKEN]:"token"};import{c as mg}from"react/compiler-runtime";import{jsx as pg}from"react/jsx-runtime";import"react";var fg=()=>{let t=mg(2),{EditButton:e}=Ce(),o;return t[0]!==e?(o=e?pg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as hg}from"react/compiler-runtime";import{jsx as gg}from"react/jsx-runtime";import"react";var Cg=()=>{let t=hg(2),{RemoveButton:e}=Ce(),o;return t[0]!==e?(o=e?gg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as xg}from"react/compiler-runtime";import{jsx as bg}from"react/jsx-runtime";import"react";var _g=()=>{let t=xg(2),{Label:e}=Ce(),o;return t[0]!==e?(o=e?bg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Tg}from"react/compiler-runtime";import{jsx as Eg}from"react/jsx-runtime";import"react";var wg=t=>{let e=Tg(3),{children:o}=t,{InlineBlockContainer:r}=Ce(),n;return e[0]!==r||e[1]!==o?(n=r?Eg(r,{children:o}):null,e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{c as kg}from"react/compiler-runtime";import{jsx as Ng}from"react/jsx-runtime";import"react";var Lg=t=>{let e=kg(6),{children:o,editButton:r,Label:n,removeButton:i}=t,{BlockCollapsible:l}=Ae(),s;return e[0]!==l||e[1]!==n||e[2]!==o||e[3]!==r||e[4]!==i?(s=l?Ng(l,{editButton:r,Label:n,removeButton:i,children:o}):null,e[0]=l,e[1]=n,e[2]=o,e[3]=r,e[4]=i,e[5]=s):s=e[5],s};import{c as Sg}from"react/compiler-runtime";import{jsx as Rg}from"react/jsx-runtime";import"react";var Ig=()=>{let t=Sg(2),{EditButton:e}=Ae(),o;return t[0]!==e?(o=e?Rg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as yg}from"react/compiler-runtime";import{jsx as vg}from"react/jsx-runtime";import"react";var Mg=()=>{let t=yg(2),{RemoveButton:e}=Ae(),o;return t[0]!==e?(o=e?vg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as Dg}from"qs-esm";var Ag=({apiURL:t,depth:e,draft:o,locale:r})=>async({id:i,collectionSlug:l,select:s})=>{let c=Dg({depth:e??0,draft:o??!1,locale:r,select:s},{addQueryPrefix:!0});return await fetch(`${t}/${l}/${i}${c}`,{credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json"},method:"GET"}).then(d=>d.json())};export{ft as $createAutoLinkNode,Ht as $createBlockNode,go as $createInlineBlockNode,_e as $createLinkNode,Be as $createRelationshipNode,je as $createUploadNode,Ee as $isAutoLinkNode,ut as $isBlockNode,Co as $isInlineBlockNode,Y as $isLinkNode,Xo as $isRelationshipNode,wr as $isUploadNode,Zs as AlignFeatureClient,Te as AutoLinkNode,Lg as BlockCollapsible,Ig as BlockEditButton,xe as BlockNode,Mg as BlockRemoveButton,qs as BlockquoteFeatureClient,Ya as BlocksFeatureClient,xc as BoldFeatureClient,ae as CAN_USE_DOM,um as ChecklistFeatureClient,sg as DETAIL_TYPE_TO_DETAIL,rg as DOUBLE_LINE_BREAK,cg as ELEMENT_FORMAT_TO_TYPE,ag as ELEMENT_TYPE_TO_FORMAT,Hs as ENABLE_SLASH_MENU_COMMAND,Fs as EditorConfigProvider,rt as FieldsDrawer,tf as FixedToolbarFeatureClient,eu as HeadingFeatureClient,Cu as HorizontalRuleFeatureClient,Ve as INSERT_BLOCK_COMMAND,Ke as INSERT_INLINE_BLOCK_COMMAND,tg as IS_ALL_FORMATTING,Fu as IndentFeatureClient,wg as InlineBlockContainer,fg as InlineBlockEditButton,_g as InlineBlockLabel,ho as InlineBlockNode,Cg as InlineBlockRemoveButton,wc as InlineCodeFeatureClient,pf as InlineToolbarFeatureClient,Sc as ItalicFeatureClient,ig as LTR_REGEX,Mm as LexicalPluginToLexicalFeatureClient,Yd as LinkFeatureClient,ie as LinkNode,og as NON_BREAKING_SPACE,F as NodeFormat,xm as OrderedListFeatureClient,Hm as ParagraphFeatureClient,Ps as Point,ng as RTL_REGEX,js as Rect,Np as RelationshipFeatureClient,ke as RelationshipNode,Zh as RichTextField,Pm as SlateToLexicalFeatureClient,Mc as StrikethroughFeatureClient,Fc as SubscriptFeatureClient,Hc as SuperscriptFeatureClient,ug as TEXT_MODE_TO_TYPE,lg as TEXT_TYPE_TO_FORMAT,dg as TEXT_TYPE_TO_MODE,fe as TOGGLE_LINK_COMMAND,lh as TableFeatureClient,cc as TestRecorderFeatureClient,wt as ToolbarButton,He as ToolbarDropdown,fc as TreeViewFeatureClient,Vc as UnderlineFeatureClient,Lm as UnorderedListFeatureClient,Ph as UploadFeatureClient,Re as UploadNode,eg as addSwipeDownListener,Xh as addSwipeLeftListener,qh as addSwipeRightListener,Qh as addSwipeUpListener,Mo as createBlockNode,R as createClientFeature,mo as defaultEditorLexicalConfig,ir as getDOMRangeRect,Us as getEnabledNodes,Ag as getRestPopulateFn,Ze as getSelectedNode,zh as isHTMLElement,Bs as isPoint,Yh as joinClasses,Lr as sanitizeClientEditorConfig,vs as sanitizeClientFeatures,to as setFloatingElemPosition,zt as setFloatingElemPositionForLinkEditor,Q as slashMenuBasicGroupWithItems,be as toolbarAddDropdownGroupWithItems,Ao as toolbarFeatureButtonsGroupWithItems,ee as toolbarFormatGroupWithItems,ne as toolbarTextDropdownGroupWithItems,Ae as useBlockComponentContext,H as useEditorConfigContext,Ce as useInlineBlockComponentContext,$s as useLexicalDocumentDrawer,ge as useLexicalDrawer,Et as useLexicalListDrawer};
|
|
38
|
+
`,Dl="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",Ol="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",kp=new RegExp("^[^"+Ol+"]*["+Dl+"]"),Ep=new RegExp("^[^"+Dl+"]*["+Ol+"]"),Np={bold:D.IS_BOLD,code:D.IS_CODE,highlight:D.IS_HIGHLIGHT,italic:D.IS_ITALIC,strikethrough:D.IS_STRIKETHROUGH,subscript:D.IS_SUBSCRIPT,superscript:D.IS_SUPERSCRIPT,underline:D.IS_UNDERLINE},Lp={directionless:D.IS_DIRECTIONLESS,unmergeable:D.IS_UNMERGEABLE},Sp={center:D.IS_ALIGN_CENTER,end:D.IS_ALIGN_END,justify:D.IS_ALIGN_JUSTIFY,left:D.IS_ALIGN_LEFT,right:D.IS_ALIGN_RIGHT,start:D.IS_ALIGN_START},Rp={[D.IS_ALIGN_CENTER]:"center",[D.IS_ALIGN_END]:"end",[D.IS_ALIGN_JUSTIFY]:"justify",[D.IS_ALIGN_LEFT]:"left",[D.IS_ALIGN_RIGHT]:"right",[D.IS_ALIGN_START]:"start"},Ip={normal:D.IS_NORMAL,segmented:D.IS_SEGMENTED,token:D.IS_TOKEN},yp={[D.IS_NORMAL]:"normal",[D.IS_SEGMENTED]:"segmented",[D.IS_TOKEN]:"token"};var Fl={text:({node:t})=>{let e=t.text;return t.format&D.IS_BOLD&&(e=Be("strong",{children:e})),t.format&D.IS_ITALIC&&(e=Be("em",{children:e})),t.format&D.IS_STRIKETHROUGH&&(e=Be("span",{style:{textDecoration:"line-through"},children:e})),t.format&D.IS_UNDERLINE&&(e=Be("span",{style:{textDecoration:"underline"},children:e})),t.format&D.IS_CODE&&(e=Be("code",{children:e})),t.format&D.IS_SUBSCRIPT&&(e=Be("sub",{children:e})),t.format&D.IS_SUPERSCRIPT&&(e=Be("sup",{children:e})),e}};import{jsx as Et}from"react/jsx-runtime";var $l={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 Et("a",{href:r,rel:"noopener noreferrer",children:o.filename});if(!o.sizes||!Object.keys(o.sizes).length)return Et("img",{alt:o.filename,height:o.height,src:r,width:o.width});let n=[];for(let i in o.sizes){let l=o.sizes[i];if(!l||!l.width||!l.height||!l.mimeType||!l.filesize||!l.filename||!l.url)continue;let s=l?.url;n.push(Et("source",{media:`(max-width: ${l.width}px)`,srcSet:s,type:l.mimeType},i))}return n.push(Et("img",{alt:o?.filename,height:o?.height,src:r,width:o?.width},"image")),Et("picture",{children:n})}};var et={...vl,...Fl,...Sl,...El,...Al,...Nl,...Ll,...yl,...Il({}),...$l,...Ml};import{jsx as Bl,Fragment as vp}from"react/jsx-runtime";import or from"react";function Pl(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 Hl({converters:t,data:e,disableIndent:o,disableTextAlign:r}){return Pl(e)?jl({converters:t,disableIndent:o,disableTextAlign:r,nodes:e?.root?.children,parent:e?.root}):Bl(vp,{})}function jl({converters:t,disableIndent:e,disableTextAlign:o,nodes:r,parent:n}){let i=t.unknown;return r.map((s,u)=>{let c;s.type==="block"?(c=t?.blocks?.[s?.fields?.blockType],!c&&!i&&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&&!i&&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&&i&&(c=i);let d;c?d=typeof c=="function"?c({childIndex:u,converters:t,node:s,nodesToJSX:m=>jl({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=Bl("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)*2}em`),or.isValidElement(d)){if(a.textAlign||a.paddingInlineStart){let p={...a,...d?.props?.style??{}};return or.cloneElement(d,{key:u,style:p})}return or.cloneElement(d,{key:u})}return d}catch(d){return console.error("Error converting lexical node to JSX:",d,"node:",s),null}}).filter(Boolean)}var rr=({className:t,converters:e,data:o,disableContainer:r,disableIndent:n,disableTextAlign:i})=>{if(!o)return null;let l={};e?typeof e=="function"?l=e({defaultConverters:et}):l=e:l=et;let s=o&&!Array.isArray(o)&&typeof o=="object"&&"root"in o&&Hl({converters:l,data:o,disableIndent:n,disableTextAlign:i});return r?Ul(Mp,{children:s}):Ul("div",{className:t??"payload-richtext",children:s})};function Gl(){let t=Ap(7),[e]=Op(),o;t[0]!==e?(o=e.getEditorState().toJSON(),t[0]=e,t[1]=o):o=t[1];let[r,n]=$p(o),i,l;t[2]!==e?(i=()=>e.registerUpdateListener(u=>{let{editorState:c}=u;n(c.toJSON())}),l=[e],t[2]=e,t[3]=i,t[4]=l):(i=t[3],l=t[4]),Fp(i,l);let s;return t[5]!==r?(s=Dp(rr,{converters:et,data:r}),t[5]=r,t[6]=s):s=t[6],s}var Pp=R({plugins:[{Component:Gl,position:"bottom"}]});import{$isNodeSelection as kf}from"lexical";import{jsx as Nt,jsxs as Bp}from"react/jsx-runtime";import"react";var nr=()=>Bp("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("g",{clipPath:"url(#clip0_4397_10817)",children:Nt("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"})}),Nt("defs",{children:Nt("clipPath",{id:"clip0_4397_10817",children:Nt("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{jsx as Up}from"react/jsx-runtime";import*as Vl from"react";import{DecoratorBlockNode as Hp}from"@lexical/react/LexicalDecoratorBlockNode.js";function jp(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Wl({relationTo:o,value:e})}:null}var Lt=class extends Hp{__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:jp,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=Wl(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 Wl(t){return new Lt({data:t})}var Gp=Vl.lazy(()=>import("./RelationshipComponent-APF3CN47.js").then(t=>({default:t.RelationshipComponent})));function Wp(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 Ee=class extends Lt{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:Wp,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 Up(Gp,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function He(t){return new Ee({data:t})}function ir(t){return t instanceof Ee}import{c as cf}from"react/compiler-runtime";import{jsx as uf}from"react/jsx-runtime";import{useLexicalComposerContext as df}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as mf}from"@lexical/utils";import{useConfig as pf}from"@payloadcms/ui";import{$getPreviousSelection as ff,$getSelection as hf,$isParagraphNode as Yl,$isRangeSelection as gf,COMMAND_PRIORITY_EDITOR as Cf,createCommand as xf}from"lexical";import{useEffect as bf}from"react";import{c as of}from"react/compiler-runtime";import{jsx as oo}from"react/jsx-runtime";import{useLexicalComposerContext as rf}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as nf,COMMAND_PRIORITY_EDITOR as lf}from"lexical";import{useEffect as sf,useState as Xl}from"react";import{c as Vp}from"react/compiler-runtime";import{jsx as Kp}from"react/jsx-runtime";import{useLexicalComposerContext as Jp}from"@lexical/react/LexicalComposerContext";import{useListDrawer as Xp,useModal as zp}from"@payloadcms/ui";import{$getNodeByKey as Kl,$getPreviousSelection as Zp,$getRoot as Yp,$getSelection as qp,$isRangeSelection as Qp,$setSelection as ef}from"lexical";import{useEffect as tf,useState as Jl}from"react";var St=t=>{let e=Vp(23),[o]=Jp(),[r,n]=Jl(null),[i,l]=Jl(!1),[s,u,c]=Xp(t),{closeDrawer:d,drawerSlug:a,isDrawerOpen:p,openDrawer:m}=c,{modalState:f}=zp(),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let $=qp()??Zp();n($)},e[0]=h):h=e[0];let g=h,b;e[1]!==o||e[2]!==r?(b=()=>{r&&o.update(()=>{if(Qp(r)){let{anchor:$,focus:A}=r;Kl($.key)&&Kl(A.key)&&ef(r.clone())}else Yp().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=r,e[3]=b):b=e[3];let L=b,I;e[4]!==d?(I=()=>{d()},e[4]=d,e[5]=I):I=e[5];let _=I,T,C;e[6]!==a||e[7]!==f||e[8]!==L||e[9]!==i?(T=()=>{if(!i)return;let $=f[a];$&&!$?.isOpen&&(l(!1),setTimeout(()=>{L()},1))},C=[f,a,L,i],e[6]=a,e[7]=f,e[8]=L,e[9]=i,e[10]=T,e[11]=C):(T=e[10],C=e[11]),tf(T,C);let w;e[12]!==u?(w=$=>Kp(u,{...$,onClick:()=>{g()}}),e[12]=u,e[13]=w):w=e[13];let M;e[14]!==m?(M=()=>{g(),m(),l(!0)},e[14]=m,e[15]=M):M=e[15];let O;return e[16]!==s||e[17]!==_||e[18]!==p||e[19]!==a||e[20]!==w||e[21]!==M?(O={closeListDrawer:_,isListDrawerOpen:p,ListDrawer:s,listDrawerSlug:a,ListDrawerToggler:w,openListDrawer:M},e[16]=s,e[17]=_,e[18]=p,e[19]=a,e[20]=w,e[21]=M,e[22]=O):O=e[22],O};var af=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=nf(o);n&&n.replace(He({relationTo:e,value:r}))}):t.dispatchCommand(lr,{relationTo:e,value:r})},zl=t=>{let e=of(16),{enabledCollectionSlugs:o}=t,[r]=rf(),n;e[0]!==o?(n=()=>o?.[0],e[0]=o,e[1]=n):n=e[1];let[i]=Xl(n),[l,s]=Xl(null),u=o||void 0,c;e[2]!==i||e[3]!==u?(c={collectionSlugs:u,selectedCollection:i},e[2]=i,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(st,L=>(s(L?.replace?L?.replace.nodeKey:null),p(),!0),lf),f=[r,p],e[5]=r,e[6]=p,e[7]=m,e[8]=f):(m=e[7],f=e[8]),sf(m,f);let h;e[9]!==d||e[10]!==r||e[11]!==l?(h=L=>{let{collectionSlug:I,doc:_}=L;af({editor:r,relationTo:I,replaceNodeKey:l,value:_.id}),d()},e[9]=d,e[10]=r,e[11]=l,e[12]=h):h=e[12];let g=h,b;return e[13]!==a||e[14]!==g?(b=oo(a,{onSelect:g}),e[13]=a,e[14]=g,e[15]=b):b=e[15],b},Zl=t=>(t?.enabledCollectionSlugs?.length??-1)>0?oo(zl,{...t}):oo(Ot,{...t,children:oo(zl,{...t})});var lr=xf("INSERT_RELATIONSHIP_COMMAND"),ql=t=>{let e=cf(10),{clientProps:o}=t,[r]=df(),{config:n}=pf(),{collections:i}=n,l=null;if(o?.enabledCollections)l=o?.enabledCollections;else if(o?.disabledCollections){let d;if(e[0]!==o?.disabledCollections||e[1]!==i){let a;e[3]!==o?.disabledCollections?(a=p=>{let{slug:m}=p;return!o?.disabledCollections?.includes(m)},e[3]=o?.disabledCollections,e[4]=a):a=e[4],d=i.filter(a).map(_f),e[0]=o?.disabledCollections,e[1]=i,e[2]=d}else d=e[2];l=d}let s,u;e[5]!==r?(s=()=>{if(!r.hasNodes([Ee]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return r.registerCommand(lr,wf,Cf)},u=[r],e[5]=r,e[6]=s,e[7]=u):(s=e[6],u=e[7]),bf(s,u);let c;return e[8]!==l?(c=uf(Zl,{enabledCollectionSlugs:l}),e[8]=l,e[9]=c):c=e[9],c};function _f(t){let{slug:e}=t;return e}function Tf(t){return Yl(t)}function wf(t){let e=hf()||ff();if(gf(e)){let o=He(t);mf(o);let{focus:r}=e,n=r.getNode();Yl(n)&&n.getTextContentSize()===0&&n.getParentOrThrow().getChildren().filter(Tf).length>1&&n.remove()}return!0}var Ef=R({nodes:[Ee],plugins:[{Component:ql,position:"normal"}],slashMenu:{groups:[Q([{Icon:nr,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(st,{replace:!1})}}])]},toolbarFixed:{groups:[be([{ChildComponent:nr,isActive:({selection:t})=>{if(!kf(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return ir(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(st,{replace:!1})}}])]}});import{c as ns}from"react/compiler-runtime";import{jsx as de,jsxs as Vf}from"react/jsx-runtime";import{useLexicalComposerContext as Kf}from"@lexical/react/LexicalComposerContext.js";import{useScrollInfo as Jf,useThrottledEffect as Xf,useTranslation as zf}from"@payloadcms/ui";import*as Ne from"react";import{useMemo as Zf}from"react";import{c as Nf}from"react/compiler-runtime";import{jsx as Lf}from"react/jsx-runtime";import{mergeRegister as Sf}from"@lexical/utils";import{$addUpdateTag as Rf,$getSelection as If}from"lexical";import{useEffect as ro,useState as sr}from"react";var ar="toolbar-popup__button",Rt=t=>{let e=Nf(34),{children:o,editor:r,item:n}=t,[i,l]=sr(!0),[s,u]=sr(!1),[c,d]=sr(ar),a=H(),p;e[0]!==s||e[1]!==r||e[2]!==a||e[3]!==i||e[4]!==n?(p=()=>{r.getEditorState().read(()=>{let M=If();if(M){if(n.isActive){let O=n.isActive({editor:r,editorConfigContext:a,selection:M});s!==O&&u(O)}if(n.isEnabled){let O=n.isEnabled({editor:r,editorConfigContext:a,selection:M});i!==O&&l(O)}}})},e[0]=s,e[1]=r,e[2]=a,e[3]=i,e[4]=n,e[5]=p):p=e[5];let m=p,f,h;e[6]!==m?(f=()=>{m()},h=[m],e[6]=m,e[7]=f,e[8]=h):(f=e[7],h=e[8]),ro(f,h);let g,b;e[9]!==m?(g=()=>(document.addEventListener("mouseup",m),()=>{document.removeEventListener("mouseup",m)}),b=[m],e[9]=m,e[10]=g,e[11]=b):(g=e[10],b=e[11]),ro(g,b);let L,I;e[12]!==r||e[13]!==m?(L=()=>Sf(r.registerUpdateListener(()=>{m()})),I=[r,m],e[12]=r,e[13]=m,e[14]=L,e[15]=I):(L=e[14],I=e[15]),ro(L,I);let _;e[16]!==s||e[17]!==i||e[18]!==n.key?(_=()=>{d([ar,i===!1?"disabled":"",s?"active":"",n?.key?`${ar}-`+n.key:""].filter(Boolean).join(" "))},e[16]=s,e[17]=i,e[18]=n.key,e[19]=_):_=e[19];let T;e[20]!==s||e[21]!==c||e[22]!==i||e[23]!==n.key?(T=[i,s,c,n.key],e[20]=s,e[21]=c,e[22]=i,e[23]=n.key,e[24]=T):T=e[24],ro(_,T);let C;e[25]!==s||e[26]!==r||e[27]!==i||e[28]!==n?(C=()=>{if(i!==!1)return r.focus(()=>{r.update(yf),n.onSelect?.({editor:r,isActive:s})}),!0},e[25]=s,e[26]=r,e[27]=i,e[28]=n,e[29]=C):C=e[29];let w;return e[30]!==o||e[31]!==c||e[32]!==C?(w=Lf("button",{className:c,onClick:C,onMouseDown:vf,type:"button",children:o}),e[30]=o,e[31]=c,e[32]=C,e[33]=w):w=e[33],w};function yf(){Rf("toolbar")}function vf(t){t.preventDefault()}import{c as Bf}from"react/compiler-runtime";import{jsx as tt}from"react/jsx-runtime";import dr,{useCallback as Hf,useEffect as rs}from"react";import{mergeRegister as jf}from"@lexical/utils";import{useTranslation as Uf}from"@payloadcms/ui";import{$getSelection as Gf}from"lexical";import{jsx as ve,jsxs as Ql}from"react/jsx-runtime";import{Button as Mf}from"@payloadcms/ui";import{$addUpdateTag as Af,isDOMNode as Df}from"lexical";import no,{useCallback as Of,useEffect as It,useMemo as Ff,useRef as ur,useState as io}from"react";import{createPortal as $f}from"react-dom";var cr="toolbar-popup__dropdown-item",es=no.createContext(null);function ts({active:t,children:e,editor:o,enabled:r,Icon:n,item:i,tooltip:l}){let[s,u]=io(cr);It(()=>{u([cr,r===!1?"disabled":"",t?"active":"",i?.key?`${cr}-${i.key}`:""].filter(Boolean).join(" "))},[r,t,s,i.key]);let c=ur(null),d=no.use(es);if(d===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=d;return It(()=>{c?.current!=null&&a(c)},[c,a]),ve(Mf,{"aria-label":l,buttonStyle:"none",className:s,disabled:r===!1,icon:n,iconPosition:"left",iconStyle:"none",onClick:()=>{r!==!1&&o.focus(()=>{o.update(()=>{Af("toolbar")}),i.onSelect?.({editor:o,isActive:t})})},onMouseDown:p=>{p.preventDefault()},ref:c,tooltip:l,type:"button",children:e})}function Pf({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:r}){let[n,i]=io(),[l,s]=io(),u=Of(a=>{i(p=>p!=null?[...p,a]:[a])},[i]),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=Ff(()=>({registerItem:u}),[u]);return It(()=>{n!=null&&l==null&&s(n[0]),l!=null&&l?.current!=null&&l.current.focus()},[n,l]),ve(es,{value:d,children:ve("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:c,ref:e,children:t})})}function os({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:r=!1,Icon:n,itemsContainerClassNames:i,label:l,stopCloseOnClickSelf:s}){let u=ur(null),c=ur(null),[d,a]=io(!1),p=()=>{a(!1),c?.current!=null&&c.current.focus()};It(()=>{let f=c.current,h=u.current;if(d&&f!==null&&h!==null){let{left:g,top:b}=f.getBoundingClientRect(),L=window.scrollY||document.documentElement.scrollTop;h.style.top=`${b+L+f.offsetHeight+5}px`,h.style.left=`${Math.min(g-5,window.innerWidth-h.offsetWidth-20)}px`}},[u,c,d]),It(()=>{let f=c.current;if(f!==null&&d){let h=g=>{let b=g.target;Df(b)&&(s&&u.current&&u.current.contains(b)||f.contains(b)||a(!1))};return document.addEventListener("click",h),()=>{document.removeEventListener("click",h)}}},[u,c,d,s]);let m=$f(ve(Pf,{dropDownRef:u,itemsContainerClassNames:i,onClose:p,children:o}),document.body);return Ql(no.Fragment,{children:[Ql("button",{"aria-label":t,className:e+(d?" active":""),disabled:r,onClick:f=>{f.preventDefault(),a(!d)},onMouseDown:f=>{f.preventDefault()},ref:c,type:"button",children:[n&&ve(n,{}),l&&ve("span",{className:"toolbar-popup__dropdown-label",children:l}),ve("i",{className:"toolbar-popup__dropdown-caret"})]}),d&&ve(no.Fragment,{children:m})]})}var mr="toolbar-popup__dropdown",Wf=t=>{let e=Bf(18),{active:o,anchorElem:r,editor:n,enabled:i,item:l}=t,{i18n:s}=Uf(),{fieldProps:u}=H(),{featureClientSchemaMap:c,schemaPath:d}=u;if(l.Component){let f;return e[0]!==o||e[1]!==r||e[2]!==n||e[3]!==i||e[4]!==l?(f=l?.Component&&tt(l.Component,{active:o,anchorElem:r,editor:n,enabled:i,item:l},l.key),e[0]=o,e[1]=r,e[2]=n,e[3]=i,e[4]=l,e[5]=f):f=e[5],f}let a=l.key,p;if(l.label){let f;e[6]!==c||e[7]!==s||e[8]!==l||e[9]!==d?(f=typeof l.label=="function"?l.label({featureClientSchemaMap:c,i18n:s,schemaPath:d}):l.label,e[6]=c,e[7]=s,e[8]=l,e[9]=d,e[10]=f):f=e[10],a=f}a.length>25?p=a.substring(0,25)+"...":p=a;let m;return e[11]!==o||e[12]!==p||e[13]!==n||e[14]!==i||e[15]!==l||e[16]!==a?(m=tt(ts,{active:o,editor:n,enabled:i,Icon:l?.ChildComponent?tt(l.ChildComponent,{}):void 0,item:l,tooltip:a,children:tt("span",{className:"text",children:p})},l.key),e[11]=o,e[12]=p,e[13]=n,e[14]=i,e[15]=l,e[16]=a,e[17]=m):m=e[17],m},je=({anchorElem:t,classNames:e,editor:o,group:r,Icon:n,itemsContainerClassNames:i,label:l,maxActiveItems:s,onActiveChange:u})=>{let[c,d]=dr.useState([]),[a,p]=dr.useState([]),[m,f]=dr.useState(!0),h=H(),{items:g,key:b}=r,L=Hf(()=>{o.getEditorState().read(()=>{let I=Gf();if(!I)return;let _=[],T=[],C=[];for(let w of g)w.isActive&&(!s||_.length<s)&&w.isActive({editor:o,editorConfigContext:h,selection:I})&&(_.push(w.key),T.push(w)),w.isEnabled?w.isEnabled({editor:o,editorConfigContext:h,selection:I})&&C.push(w.key):C.push(w.key);r.isEnabled&&f(r.isEnabled({editor:o,editorConfigContext:h,selection:I})),d(_),p(C),u&&u({activeItems:T})})},[o,h,r,g,s,u]);return rs(()=>{L()},[L]),rs(()=>jf(o.registerUpdateListener(()=>{L()})),[o,L]),tt(os,{buttonAriaLabel:`${b} dropdown`,buttonClassName:[mr,`${mr}-${b}`,...e||[]].filter(Boolean).join(" "),disabled:!m,Icon:n,itemsContainerClassNames:[`${mr}-items`,...i||[]],label:l,children:g.length?g.map(I=>tt(Wf,{active:c.includes(I.key),anchorElem:t,editor:o,enabled:a.includes(I.key),item:I},I.key)):null},b)};function Yf({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&de(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?de(Rt,{editor:e,item:o,children:de(o.ChildComponent,{})},o.key):null}function qf(t){let e=ns(23),{anchorElem:o,editor:r,editorConfig:n,group:i,index:l}=t,{i18n:s}=zf(),{fieldProps:u}=H(),{featureClientSchemaMap:c,schemaPath:d}=u,[a,p]=Ne.useState(void 0),[m,f]=Ne.useState(void 0),h;e[0]!==i.ChildComponent||e[1]!==i.items||e[2]!==i.type?(h=()=>{i?.type==="dropdown"&&i.items.length&&i.ChildComponent?f(()=>i.ChildComponent):f(void 0)},e[0]=i.ChildComponent,e[1]=i.items,e[2]=i.type,e[3]=h):h=e[3];let g;e[4]!==i?(g=[i],e[4]=i,e[5]=g):g=e[5],Ne.useEffect(h,g);let b;e[6]!==c||e[7]!==i.ChildComponent||e[8]!==i.items||e[9]!==i.type||e[10]!==s||e[11]!==d?(b=T=>{let{activeItems:C}=T;if(!C.length){i?.type==="dropdown"&&i.items.length&&i.ChildComponent?(f(()=>i.ChildComponent),p(void 0)):(f(void 0),p(void 0));return}let w=C[0],M=w.key;w.label&&(M=typeof w.label=="function"?w.label({featureClientSchemaMap:c,i18n:s,schemaPath:d}):w.label),M.length>25&&(M=M.substring(0,25)+"..."),C.length===1?(p(M),f(()=>w.ChildComponent)):(p(s.t("lexical:general:toolbarItemsActive",{count:C.length})),i?.type==="dropdown"&&i.items.length&&i.ChildComponent?f(()=>i.ChildComponent):f(void 0))},e[6]=c,e[7]=i.ChildComponent,e[8]=i.items,e[9]=i.type,e[10]=s,e[11]=d,e[12]=b):b=e[12];let L=b,I=`fixed-toolbar__group fixed-toolbar__group-${i.key}`,_;return e[13]!==m||e[14]!==o||e[15]!==a||e[16]!==r||e[17]!==n.features.toolbarFixed?.groups.length||e[18]!==i||e[19]!==l||e[20]!==L||e[21]!==I?(_=Vf("div",{className:I,children:[i.type==="dropdown"&&i.items.length?m?de(je,{anchorElem:o,editor:r,group:i,Icon:m,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:i.maxActiveItems??1,onActiveChange:L}):de(je,{anchorElem:o,editor:r,group:i,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:i.maxActiveItems??1,onActiveChange:L}):null,i.type==="buttons"&&i.items.length?i.items.map(T=>de(Yf,{anchorElem:o,editor:r,item:T},T.key)):null,l<n.features.toolbarFixed?.groups.length-1&&de("div",{className:"divider"})]},i.key),e[13]=m,e[14]=o,e[15]=a,e[16]=r,e[17]=n.features.toolbarFixed?.groups.length,e[18]=i,e[19]=l,e[20]=L,e[21]=I,e[22]=_):_=e[22],_}function Qf({anchorElem:t,clientProps:e,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let i=Ne.useRef(null),{y:l}=Jf(),s=Zf(()=>{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 Xf(()=>{if(!s)return;let u=i.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,[i,s,l]),de("div",{className:"fixed-toolbar",onFocus:u=>{u.stopPropagation()},ref:i,children:o.isEditable()&&de(Ne.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((u,c)=>de(qf,{anchorElem:t,editor:o,editorConfig:r,group:u,index:c},u.key))})})}var is=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return is(t.parentEditor)}return!1},ls=t=>{let e=ns(6),{clientProps:o}=t,[r]=Kf(),n=H(),{editorConfig:i}=n,l=o.applyToFocusedEditor&&n.focusedEditor?.editor||r,s=o.applyToFocusedEditor&&n.focusedEditor?.editorConfig||i,u,c;if(e[0]!==o.disableIfParentHasFixedToolbar||e[1]!==l||e[2]!==s||e[3]!==n){c=Symbol.for("react.early_return_sentinel");e:{let d=is(n);if(o?.disableIfParentHasFixedToolbar&&d){c=null;break e}if(!s?.features?.toolbarFixed?.groups?.length){c=null;break e}u=de(Qf,{anchorElem:document.body,editor:l,editorConfig:s,parentWithFixedToolbar:d})}e[0]=o.disableIfParentHasFixedToolbar,e[1]=l,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 e1=R({plugins:[{Component:ls,position:"aboveContainer"}]});import{c as cs}from"react/compiler-runtime";import{jsx as he,jsxs as us}from"react/jsx-runtime";import{useLexicalComposerContext as t1}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as ds}from"@lexical/utils";import{$getSelection as ms,$isRangeSelection as ss,$isTextNode as o1,COMMAND_PRIORITY_LOW as r1,getDOMSelection as ps,SELECTION_CHANGE_COMMAND as n1}from"lexical";import{useCallback as so,useEffect as yt,useRef as as,useState as i1}from"react";import*as ao from"react";import{createPortal as l1}from"react-dom";function pr(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 lo(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:r=0,floatingElem:n,horizontalOffset:i=32,horizontalPosition:l="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-i;l==="center"&&(h=u.left+u.width/2-a.width/2);let g=0;return!e&&f<m.top&&!s&&(g=a.height+u.height+c*2,f+=g),l==="center"?h+a.width>m.right?h=m.right-a.width-i:h<m.left&&(h=m.left+i):h+a.width>m.right&&(h=m.right-a.width-i),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)`),g}function s1({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&he(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?he(Rt,{editor:e,item:o,children:he(o.ChildComponent,{})},o.key):null}function a1(t){let e=cs(19),{anchorElem:o,editor:r,group:n,index:i}=t,{editorConfig:l}=H(),[s,u]=ao.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],ao.useEffect(c,d);let a;e[6]!==n.ChildComponent||e[7]!==n.items||e[8]!==n.type?(a=h=>{let{activeItems:g}=h;if(!g.length){n?.type==="dropdown"&&n.items.length&&n.ChildComponent?u(()=>n.ChildComponent):u(void 0);return}let b=g[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]!==l.features.toolbarInline?.groups.length||e[14]!==n||e[15]!==i||e[16]!==p||e[17]!==m?(f=us("div",{className:m,children:[n.type==="dropdown"&&n.items.length?s?he(je,{anchorElem:o,editor:r,group:n,Icon:s,maxActiveItems:n.maxActiveItems??1,onActiveChange:p}):he(je,{anchorElem:o,editor:r,group:n,maxActiveItems:n.maxActiveItems??1,onActiveChange:p}):null,n.type==="buttons"&&n.items.length?n.items.map(h=>he(s1,{anchorElem:o,editor:r,item:h},h.key)):null,i<l.features.toolbarInline?.groups.length-1&&he("div",{className:"divider"})]},n.key),e[10]=s,e[11]=o,e[12]=r,e[13]=l.features.toolbarInline?.groups.length,e[14]=n,e[15]=i,e[16]=p,e[17]=m,e[18]=f):f=e[18],f}function c1({anchorElem:t,editor:e}){let o=as(null),r=as(null),{editorConfig:n}=H(),i=so(()=>{if(o?.current){let c=o.current.style.opacity==="0",d=o.current.style.pointerEvents==="none";c||(o.current.style.opacity="0"),d||(o.current.style.pointerEvents="none")}},[o]),l=so(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)||i()}}},[i]),s=so(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);yt(()=>(document.addEventListener("mousemove",l),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",s)}),[o,l,s]);let u=so(()=>{let c=ms(),d=ps(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=pr(d,m),h=lo({alwaysDisplayOnTop:p,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});r.current&&lo({anchorElem:o.current,anchorFlippedOffset:h,floatingElem:r.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else i()},[e,i,t]);return yt(()=>{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]),yt(()=>(e.getEditorState().read(()=>{u()}),ds(e.registerUpdateListener(({editorState:c})=>{c.read(()=>{u()})}),e.registerCommand(n1,()=>(u(),!1),r1))),[e,u]),us("div",{className:"inline-toolbar-popup",ref:o,children:[he("div",{className:"caret",ref:r}),n?.features&&n.features?.toolbarInline?.groups.map((c,d)=>he(a1,{anchorElem:t,editor:e,group:c,index:d},c.key))]})}function u1(t,e){let o=cs(12),[r,n]=i1(!1),i;o[0]!==t?(i=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let p=ms(),m=ps(t._window),f=t.getRootElement();if(m!==null&&(!ss(p)||f===null||!f.contains(m.anchorNode))){n(!1);return}if(!ss(p))return;if(p.getTextContent()!==""){let g=p.getNodes(),b=!1;for(let L of g)if(o1(L)){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]=i):i=o[1];let l=i,s,u;o[2]!==l?(s=()=>(document.addEventListener("selectionchange",l),document.addEventListener("mouseup",l),()=>{document.removeEventListener("selectionchange",l),document.removeEventListener("mouseup",l)}),u=[l],o[2]=l,o[3]=s,o[4]=u):(s=o[3],u=o[4]),yt(s,u);let c,d;if(o[5]!==t||o[6]!==l?(c=()=>ds(t.registerUpdateListener(()=>{l()}),t.registerRootListener(()=>{t.getRootElement()===null&&n(!1)})),d=[t,l],o[5]=t,o[6]=l,o[7]=c,o[8]=d):(c=o[7],d=o[8]),yt(c,d),!r||!t.isEditable())return null;let a;return o[9]!==e||o[10]!==t?(a=l1(he(c1,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=a):a=o[11],a}var fs=t=>{let{anchorElem:e}=t,[o]=t1();return u1(o,e)};var d1=R({plugins:[{Component:fs,position:"floatingAnchorElem"}]});import{TableCellNode as tg,TableNode as og,TableRowNode as rg}from"@lexical/table";import{jsx as hs}from"react/jsx-runtime";import"react";var fr=()=>hs("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:hs("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 m1,$createTableNode as p1,$createTableRowNode as f1,$isTableCellNode as gs,$isTableNode as hr,$isTableRowNode as gr,TableCellHeaderStates as co,TableCellNode as h1,TableNode as g1,TableRowNode as C1}from"@lexical/table";import{$isParagraphNode as x1,$isTextNode as b1}from"lexical";var xs=/^\|(.+)\|\s?$/,_1=/^(\| ?:?-*:? ?)+\|\s?$/,bs=({allTransformers:t})=>({type:"element",dependencies:[g1,C1,h1],export:e=>{if(!hr(e))return null;let o=[];for(let r of e.getChildren()){let n=[];if(!gr(r))continue;let i=!1;for(let l of r.getChildren())gs(l)&&(n.push(Br(t,l).replace(/\n/g,"\\n").trim()),l.__headerState===co.ROW&&(i=!0));o.push(`| ${n.join(" | ")} |`),i&&o.push(`| ${n.map(l=>"---").join(" | ")} |`)}return o.join(`
|
|
39
|
+
`)},regExp:xs,replace:(e,o,r)=>{let n=r[0];if(!n)return;if(_1.test(n)){let a=e.getPreviousSibling();if(!a||!hr(a))return;let p=a.getChildren(),m=p[p.length-1];if(!m||!gr(m))return;m.getChildren().forEach(f=>{gs(f)&&f.setHeaderStyles(co.ROW,co.ROW)}),e.remove();return}let i=Cs(n,t);if(i==null)return;let l=[i],s=e.getPreviousSibling(),u=i.length;for(;s&&!(!x1(s)||s.getChildrenSize()!==1);){let a=s.getFirstChild();if(!b1(a))break;let p=Cs(a.getTextContent(),t);if(p==null)break;u=Math.max(u,p.length),l.unshift(p);let m=s.getPreviousSibling();s.remove(),s=m}let c=p1();for(let a of l){let p=f1();c.append(p);for(let m=0;m<u;m++)p.append(m<a.length?a[m]:_s("",t))}let d=e.getPreviousSibling();hr(d)&&T1(d)===u?(d.append(...c.getChildren()),e.remove()):e.replace(c),c.selectEnd()}});function T1(t){let e=t.getFirstChild();return gr(e)?e.getChildrenSize():0}var _s=(t,e)=>{t=t.replace(/\\n/g,`
|
|
40
|
+
`);let o=m1(co.NO_STATUS);return Pr(t,e,o),o},Cs=(t,e)=>{let o=t.match(xs);return!o||!o[1]?null:o[1].split("|").map(r=>_s(r,e))};import{c as k1}from"react/compiler-runtime";import{jsx as P,jsxs as Le}from"react/jsx-runtime";import{useLexicalComposerContext as Es}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as E1}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as xr,$deleteTableColumn__EXPERIMENTAL as N1,$deleteTableRow__EXPERIMENTAL as L1,$getNodeTriplet as S1,$getTableCellNodeFromLexicalNode as ws,$getTableColumnIndexFromTableCellNode as R1,$getTableNodeFromLexicalNodeOrThrow as Se,$getTableRowIndexFromTableCellNode as I1,$insertTableColumn__EXPERIMENTAL as y1,$insertTableRow__EXPERIMENTAL as v1,$isTableCellNode as Ns,$isTableSelection as vt,$unmergeCell as M1,getTableElement as br,getTableObserverFromTableElement as _r,TableCellHeaderStates as Me,TableCellNode as A1}from"@lexical/table";import{mergeRegister as D1}from"@lexical/utils";import{useScrollInfo as O1}from"@payloadcms/ui";import{$createParagraphNode as F1,$getSelection as mo,$isElementNode as $1,$isParagraphNode as P1,$isRangeSelection as Tr,$isTextNode as B1,$setSelection as H1,COMMAND_PRIORITY_CRITICAL as j1,getDOMSelection as U1,isDOMNode as G1,SELECTION_CHANGE_COMMAND as W1}from"lexical";import*as wr from"react";import{useCallback as me,useEffect as ot,useRef as uo,useState as rt}from"react";import{createPortal as Ls}from"react-dom";import{jsx as Cr,jsxs as w1}from"react/jsx-runtime";import"react";var Ts=()=>w1("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[Cr("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"}),Cr("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"}),Cr("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 ks(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function V1(){let t=mo();if(Tr(t)&&!t.isCollapsed()||vt(t)&&!t.anchor.is(t.focus)||!Tr(t)&&!vt(t))return!1;let[e]=S1(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function K1(t){if(t.getChildrenSize()!==1)return!1;let e=t.getFirstChildOrThrow();return!(!P1(e)||!e.isEmpty())}function J1(t){let e=t.getLastDescendant();B1(e)?e.select():$1(e)?e.selectEnd():e!==null&&e.selectNext()}function X1({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[i]=Es(),l=uo(null),[s,u]=rt(n),[c,d]=rt({columns:1,rows:1}),[a,p]=rt(!1),[m,f]=rt(!1),{y:h}=O1();ot(()=>i.registerMutationListener(A1,x=>{x.get(s.getKey())==="updated"&&i.getEditorState().read(()=>{u(s.getLatest())})},{skipInitialization:!0}),[i,s]),ot(()=>{i.getEditorState().read(()=>{let x=mo();if(vt(x)){let N=ks(x);d(ks(x)),p(N.columns>1||N.rows>1)}f(V1())})},[i]),ot(()=>{let x=e.current,N=l.current,y=i.getRootElement();if(x!=null&&N!=null&&y!=null){let S=y.getBoundingClientRect(),v=x.getBoundingClientRect();N.style.opacity="1";let k=N.getBoundingClientRect(),F=5,B=v.right+F;if(B+k.width>window.innerWidth||B+k.width>S.right){let Z=v.left-k.width-F;B=(Z<0?F:Z)+window.pageXOffset}N.style.left=`${B+window.pageXOffset}px`;let U=v.top;if(U+k.height>window.innerHeight){let Z=v.bottom-k.height;U=Z<0?F:Z}N.style.top=`${U}px`}},[e,l,i,h]),ot(()=>{function x(N){l.current!=null&&e.current!=null&&G1(N.target)&&!l.current.contains(N.target)&&!e.current.contains(N.target)&&r(!1)}return window.addEventListener("click",x),()=>window.removeEventListener("click",x)},[r,e]);let g=me(()=>{i.update(()=>{if(s.isAttached()){let x=Se(s),N=br(x,i.getElementByKey(x.getKey()));if(N===null)throw new Error("Expected to find tableElement in DOM");let y=_r(N);y!==null&&y.$clearHighlight(),x.markDirty(),u(s.getLatest())}H1(null)})},[i,s]),b=()=>{i.update(()=>{let x=mo();if(vt(x)){let y=x.getNodes().filter(Ns);if(y.length===0)return;let S=Se(y[0]),[v]=xr(S,null,null),k=1/0,F=-1/0,B=1/0,U=-1/0,Z=new Set;for(let Y of v)for(let V of Y){if(!V||!V.cell)continue;let oe=V.cell.getKey();if(!Z.has(oe)&&y.some(re=>re.is(V.cell))){Z.add(oe);let re=V.startRow,le=V.startColumn,Ae=V.cell.__rowSpan||1,it=V.cell.__colSpan||1;k=Math.min(k,re),F=Math.max(F,re+Ae-1),B=Math.min(B,le),U=Math.max(U,le+it-1)}}if(k===1/0||B===1/0)return;let Ge=F-k+1,W=U-B+1,G=v?.[k]?.[B];if(!G?.cell)return;let te=G.cell;te.setColSpan(W),te.setRowSpan(Ge);let ce=new Set([te.getKey()]);for(let Y=k;Y<=F;Y++)for(let V=B;V<=U;V++){let oe=v?.[Y]?.[V];if(!oe?.cell)continue;let re=oe.cell,le=re.getKey();ce.has(le)||(ce.add(le),K1(re)||te.append(...re.getChildren()),re.remove())}te.getChildrenSize()===0&&te.append(F1()),J1(te),o()}})},L=()=>{i.update(()=>{M1()})},I=me(x=>{i.update(()=>{for(let N=0;N<c.rows;N++)v1(x);o()})},[i,o,c.rows]),_=me(x=>{i.update(()=>{for(let N=0;N<c.columns;N++)y1(x);o()})},[i,o,c.columns]),T=me(()=>{i.update(()=>{L1(),o()})},[i,o]),C=me(()=>{i.update(()=>{Se(s).remove(),g(),o()})},[i,s,g,o]),w=me(()=>{i.update(()=>{N1(),o()})},[i,o]),M=me(()=>{i.update(()=>{let x=Se(s),N=I1(s),[y]=xr(x,null,null),S=new Set,v=s.getHeaderStyles()^Me.ROW;if(y[N])for(let k=0;k<y[N].length;k++){let F=y[N][k];F?.cell&&(S.has(F.cell)||(S.add(F.cell),F.cell.setHeaderStyles(v,Me.ROW)))}g(),o()})},[i,s,g,o]),O=me(()=>{i.update(()=>{let x=Se(s),N=R1(s),[y]=xr(x,null,null),S=new Set,v=s.getHeaderStyles()^Me.COLUMN;if(y)for(let k=0;k<y.length;k++){let F=y?.[k]?.[N];F?.cell&&(S.has(F.cell)||(S.add(F.cell),F.cell.setHeaderStyles(v,Me.COLUMN)))}g(),o()})},[i,s,g,o]),$=me(()=>{i.update(()=>{if(s.isAttached()){let x=Se(s);x&&x.setRowStriping(!x.getRowStriping())}g(),o()})},[i,s,g,o]),A=me(()=>{i.update(()=>{if(s.isAttached()){let x=Se(s);x&&x.setFrozenColumns(x.getFrozenColumns()===0?1:0)}g(),o()})},[i,s,g,o]),E=null;return t&&(a?E=P("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>b(),type:"button",children:P("span",{className:"text",children:"Merge cells"})}):m&&(E=P("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>L(),type:"button",children:P("span",{className:"text",children:"Unmerge cells"})}))),Ls(Le("div",{className:"table-action-menu-dropdown",onClick:x=>{x.stopPropagation()},ref:l,children:[E?Le(wr.Fragment,{children:[E,P("hr",{})]}):null,P("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>$(),type:"button",children:P("span",{className:"text",children:"Toggle Row Striping"})}),P("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>A(),type:"button",children:P("span",{className:"text",children:"Toggle First Column Freeze"})}),P("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>I(!1),type:"button",children:Le("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:()=>I(!0),type:"button",children:Le("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:()=>_(!1),type:"button",children:Le("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:()=>_(!0),type:"button",children:Le("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:()=>T(),type:"button",children:P("span",{className:"text",children:"Delete row"})}),P("button",{className:"item","data-test-id":"table-delete",onClick:()=>C(),type:"button",children:P("span",{className:"text",children:"Delete table"})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-row-header",onClick:()=>M(),type:"button",children:Le("span",{className:"text",children:[(s.__headerState&Me.ROW)===Me.ROW?"Remove":"Add"," ","row header"]})}),P("button",{className:"item","data-test-id":"table-column-header",onClick:()=>O(),type:"button",children:Le("span",{className:"text",children:[(s.__headerState&Me.COLUMN)===Me.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function z1({anchorElem:t,cellMerge:e}){let[o]=Es(),r=uo(null),n=uo(null),[i,l]=rt(!1),[s,u]=rt(null),c=me(()=>{let a=r.current,p=mo(),m=U1(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 g=o.getRootElement(),b=null,L=null;if(Tr(p)&&g!==null&&m!==null&&g.contains(m.anchorNode)){let _=ws(p.anchor.getNode());if(_==null||(L=o.getElementByKey(_.getKey()),L==null||!_.isAttached()))return h();let T=Se(_),C=br(T,o.getElementByKey(T.getKey()));if(C===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");b=_r(C),u(_)}else if(vt(p)){let _=ws(p.anchor.getNode());if(!Ns(_))throw new Error("TableSelection anchorNode must be a TableCellNode");let T=Se(_),C=br(T,o.getElementByKey(T.getKey()));if(C===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");b=_r(C),L=o.getElementByKey(_.getKey())}else if(!f)return h();if(b===null||L===null)return h();let I=!b||!b.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",I),a.classList.toggle("table-cell-action-button-container--inactive",!I),I){let _=L.getBoundingClientRect(),T=t.getBoundingClientRect(),C=_.top-T.top,w=_.right-T.left;a.style.transform=`translate(${w}px, ${C}px)`}},[o,t]);ot(()=>{let a,p=()=>{a=void 0,o.getEditorState().read(c)},m=()=>(a===void 0&&(a=setTimeout(p,0)),!1);return D1(o.registerUpdateListener(m),o.registerCommand(W1,m,j1),o.registerRootListener((f,h)=>{h&&h.removeEventListener("pointerup",m),f&&(f.addEventListener("pointerup",m),m())}),()=>clearTimeout(a))});let d=uo(s);return ot(()=>{d.current!==s&&l(!1),d.current=s},[d,s]),P("div",{className:"table-cell-action-button-container",ref:r,children:s!=null&&Le(wr.Fragment,{children:[P("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),l(!i)},ref:n,type:"button",children:P(Ts,{})}),i&&P(X1,{cellMerge:e,contextRef:n,onClose:()=>l(!1),setIsMenuOpen:l,tableCellNode:s})]})})}var Ss=t=>{let e=k1(3),{anchorElem:o}=t,r=E1(),n;return e[0]!==o||e[1]!==r?(n=Ls(r?P(z1,{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 Z1}from"react/compiler-runtime";import{jsx as fo,jsxs as Y1}from"react/jsx-runtime";import{useLexicalComposerContext as q1}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Q1}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as eh,$getTableNodeFromLexicalNodeOrThrow as kr,$getTableRowIndexFromTableCellNode as th,$isTableCellNode as Rs,$isTableRowNode as oh,getDOMCellFromTarget as rh,getTableElement as nh,TableNode as Is}from"@lexical/table";import{calculateZoomLevel as ys,mergeRegister as ih}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Er,isHTMLElement as lh}from"lexical";import*as Ms from"react";import{useCallback as Mt,useEffect as Nr,useRef as po,useState as nt}from"react";import{createPortal as sh}from"react-dom";var ah=33,vs=92;function ch({editor:t}){let e=po(null),o=po(null),r=po(null),[n,i]=nt(!1),l=H(),s=po(null),[u,c]=nt(null),[d,a]=nt(null),[p,m]=nt(!1),[f,h]=nt(null),g=Mt(()=>{a(null),e.current=null,h(null),s.current=null,r.current=null},[]),b=A=>(A.buttons&1)===1;Nr(()=>{let A=new Set;return ih(t.registerMutationListener(Is,E=>{for(let[x,N]of E)N==="destroyed"?A.delete(x):A.add(x);i(A.size>0)}),t.registerNodeTransform(Is,E=>{if(E.getColWidths())return E;let x=E.getColumnCount(),N=vs;return E.setColWidths(Array(x).fill(N)),E}))},[t]),Nr(()=>{if(!n)return;let A=y=>{let S=y.target;if(lh(S)){if(f){c({x:y.clientX,y:y.clientY});return}if(m(b(y)),!(o.current&&o.current.contains(S))&&e.current!==S){e.current=S;let v=rh(S);v&&d!==v?t.getEditorState().read(()=>{let k=Er(v.elem);if(!k)throw new Error("TableCellResizer: Table cell node not found.");let F=kr(k),B=nh(F,t.getElementByKey(F.getKey()));if(!B)throw new Error("TableCellResizer: Table element not found.");e.current=S,r.current=B.getBoundingClientRect(),a(v)},{editor:t}):v==null&&g()}}},E=y=>{m(!0)},x=y=>{m(!1)},N=t.registerRootListener((y,S)=>{S?.removeEventListener("mousemove",A),S?.removeEventListener("mousedown",E),S?.removeEventListener("mouseup",x),y?.addEventListener("mousemove",A),y?.addEventListener("mousedown",E),y?.addEventListener("mouseup",x)});return()=>{N()}},[d,f,t,n,g]);let L=A=>A==="bottom",I=Mt(A=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let E=Er(d.elem);if(!Rs(E))throw new Error("TableCellResizer: Table cell node not found.");let x=kr(E),N=th(E),y=x.getChildren(),v=E.getColSpan()===x.getColumnCount()?N:N+E.getRowSpan()-1;if(v>=y.length||v<0)throw new Error("Expected table cell to be inside of table row.");let k=y[v];if(!oh(k))throw new Error("Expected table row");let F=k.getHeight();if(F===void 0){let U=k.getChildren();F=Math.min(...U.map(Z=>_(Z,t)??1/0))}let B=Math.max(F+A,ah);k.setHeight(B)},{tag:"skip-scroll-into-view"})},[d,t]),_=(A,E)=>E.getElementByKey(A.getKey())?.clientHeight,T=(A,E)=>{let x;return E.forEach(N=>{N.forEach((y,S)=>{y.cell===A&&(x=S)})}),x},C=Mt(A=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let E=Er(d.elem);if(!Rs(E))throw new Error("TableCellResizer: Table cell node not found.");let x=kr(E),[N]=eh(x,null,null),y=T(E,N);if(y===void 0)throw new Error("TableCellResizer: Table column not found.");let S=x.getColWidths();if(!S)return;let v=S[y];if(v===void 0)return;let k=[...S],F=Math.max(v+A,vs);k[y]=F,x.setColWidths(k)},{tag:"skip-scroll-into-view"})},[d,t]),w=Mt(A=>{let E=x=>{if(x.preventDefault(),x.stopPropagation(),!d)throw new Error("TableCellResizer: Expected active cell.");if(s.current){let{x:N,y}=s.current;if(d===null)return;let S=ys(x.target);if(L(A)){let v=(x.clientY-y)/S;I(v)}else{let v=(x.clientX-N)/S;C(v)}g(),document.removeEventListener("mouseup",E)}};return E},[d,g,C,I]),M=Mt(A=>E=>{if(E.preventDefault(),E.stopPropagation(),!d)throw new Error("TableCellResizer: Expected active cell.");s.current={x:E.clientX,y:E.clientY},c(s.current),h(A),document.addEventListener("mouseup",w(A))},[d,w]),[O,$]=nt({bottom:null,left:null,right:null,top:null});return Nr(()=>{if(d){let{height:A,left:E,top:x,width:N}=d.elem.getBoundingClientRect(),y=ys(d.elem),S=10,v={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${S}px`,left:`${window.scrollX+E}px`,top:`${window.scrollY+x+A-S/2}px`,width:`${N}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${A}px`,left:`${window.scrollX+E+N-S/2}px`,top:`${window.scrollY+x}px`,width:`${S}px`}},k=r.current;f&&u&&k&&(L(f)?(v[f].left=`${window.scrollX+k.left}px`,v[f].top=`${window.scrollY+u.y/y}px`,v[f].height="3px",v[f].width=`${k.width}px`):(v[f].top=`${window.scrollY+k.top}px`,v[f].left=`${window.scrollX+u.x/y}px`,v[f].width="3px",v[f].height=`${k.height}px`),v[f].backgroundColor="#adf"),$(v)}else $({bottom:null,left:null,right:null,top:null})},[d,f,u]),fo("div",{ref:o,children:d!=null&&!p&&Y1(Ms.Fragment,{children:[fo("div",{className:`${l.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:M("right"),style:O.right||void 0}),fo("div",{className:`${l.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:M("bottom"),style:O.bottom||void 0})]})})}var As=()=>{let t=Z1(3),[e]=q1(),o=Q1(),r,n;return t[0]!==e||t[1]!==o?(n=o?sh(fo(ch,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=n):n=t[2],r=n,r};import{c as Ch}from"react/compiler-runtime";import{jsx as Lr,jsxs as xh,Fragment as bh}from"react/jsx-runtime";import{useLexicalComposerContext as js}from"@lexical/react/LexicalComposerContext";import{$getTableAndElementByKey as _h,$getTableColumnIndexFromTableCellNode as Th,$getTableRowIndexFromTableCellNode as wh,$insertTableColumn__EXPERIMENTAL as kh,$insertTableRow__EXPERIMENTAL as Eh,$isTableCellNode as Nh,$isTableNode as Fs,getTableElement as Lh,TableNode as Sh}from"@lexical/table";import{$findMatchingParent as Rh,mergeRegister as Ih}from"@lexical/utils";import{$getNearestNodeFromDOMNode as $s,isHTMLElement as yh}from"lexical";import{useEffect as Ps,useMemo as vh,useRef as Bs,useState as ho}from"react";import"react";import{createPortal as Mh}from"react-dom";import{c as fh}from"react/compiler-runtime";import{useEffect as hh,useRef as gh}from"react";var uh="Expected a function",dh=Math.max,mh=Math.min;function ph(t,e,o){let r,n,i=0,l,s=!1,u=!1,c,d,a,p=!0;if(typeof t!="function")throw new TypeError(uh);e=e||0,typeof o=="object"&&(s=!!o.leading,u="maxWait"in o,c=u?dh(o.maxWait||0,e):c,p="trailing"in o?!!o.trailing:p);function m(C){let w=r,M=l;return r=l=void 0,i=C,d=t.apply(M,w),d}function f(C){return i=C,a=setTimeout(b,e),s?m(C):d}function h(C){let w=C-n,M=C-i,O=e-w;return u?mh(O,c-M):O}function g(C){let w=C-n,M=C-i;return n===void 0||w>=e||w<0||u&&M>=c}function b(){let C=Date.now();if(g(C))return L(C);a=setTimeout(b,h(C))}function L(C){return a=void 0,p&&r?m(C):(r=l=void 0,d)}function I(){a!==void 0&&clearTimeout(a),i=0,r=n=l=a=void 0}function _(){return a===void 0?d:L(Date.now())}function T(){let C=Date.now(),w=g(C);if(r=arguments,l=this,n=C,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 T.cancel=I,T.flush=_,T}var Ds=ph;function Os(t,e,o){let r=fh(6),n=gh(null),i,l;r[0]!==t||r[1]!==o||r[2]!==e?(i=()=>(n.current=Ds(t,e,{maxWait:o}),()=>{n.current?.cancel()}),l=[t,e,o],r[0]=t,r[1]=o,r[2]=e,r[3]=i,r[4]=l):(i=r[3],l=r[4]),hh(i,l);let s;return r[5]===Symbol.for("react.memo_cache_sentinel")?(s=(...c)=>{let d=c;n.current&&n.current(...d)},r[5]=s):s=r[5],s}var Hs=20;function Ah({anchorElem:t}){let[e]=js(),o=H(),[r,n]=ho(!1),[i,l]=ho(!1),[s,u]=ho(!1),[c,d]=ho({}),a=Bs(new Set),p=Bs(null),m=Os(g=>{let{isOutside:b,tableDOMNode:L}=Dh(g,o.editorConfig?.lexical);if(b){n(!1),l(!1);return}if(!L)return;p.current=L;let I=null,_=null,T=null;if(e.getEditorState().read(()=>{let S=$s(L);if(Nh(S)){let v=Rh(S,k=>Fs(k));if(!Fs(v))return;if(T=Lh(v,e.getElementByKey(v.getKey())),T){let k=v.getChildrenSize(),F=v.getChildAtIndex(0)?.getChildrenSize(),B=wh(S),U=Th(S);B===k-1?I=S:U===F-1&&(_=S)}}},{editor:e}),!T)return;let C=T.parentElement;if(!C)return;let{bottom:w,height:M,left:O,right:$,width:A,y:E}=T.getBoundingClientRect(),x=!1;C&&C.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(x=C.scrollWidth>C.clientWidth);let{left:N,y}=t.getBoundingClientRect();I?(l(!1),n(!0),d({height:Hs,left:x&&C?C.offsetLeft:O-N,top:w-y+5,width:x&&C?C.offsetWidth:A})):_&&(l(!0),n(!1),d({height:M,left:$-N+5,top:E-y,width:Hs}))},50,250),f=vh(()=>new ResizeObserver(()=>{n(!1),l(!1)}),[]);Ps(()=>{if(s)return document.addEventListener("mousemove",m),()=>{n(!1),l(!1),document.removeEventListener("mousemove",m)}},[s,m]),Ps(()=>Ih(e.registerMutationListener(Sh,g=>{e.getEditorState().read(()=>{let b=!1;for(let[L,I]of g)switch(I){case"created":{a.current.add(L),b=!0;break}case"destroyed":{a.current.delete(L),b=!0;break}default:break}if(b){f.disconnect();for(let L of a.current){let{tableElement:I}=_h(L);f.observe(I)}u(a.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,f]);let h=g=>{e.update(()=>{p.current&&($s(p.current)?.selectEnd(),g?(Eh(),n(!1)):(kh(),l(!1)))})};return e?.isEditable()?xh(bh,{children:[r&&Lr("button",{"aria-label":"Add Row",className:o.editorConfig.lexical.theme.tableAddRows,onClick:()=>h(!0),style:{...c},type:"button"}),i&&Lr("button",{"aria-label":"Add Column",className:o.editorConfig.lexical.theme.tableAddColumns,onClick:()=>h(!1),style:{...c},type:"button"})]}):null}function Dh(t,e){let o=t.target;if(yh(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 Us(t){let e=Ch(2),{anchorElem:o}=t,r=o===void 0?document.body:o,[n]=js();if(!n?.isEditable())return null;let i;return e[0]!==r?(i=Mh(Lr(Ah,{anchorElem:r}),r),e[0]=r,e[1]=i):i=e[1],i}import{c as Oh}from"react/compiler-runtime";import{jsx as Sr,jsxs as Fh}from"react/jsx-runtime";import{useLexicalComposerContext as $h}from"@lexical/react/LexicalComposerContext";import{TablePlugin as Ph}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as Bh,TableCellNode as Hh,TableNode as jh,TableRowNode as Uh}from"@lexical/table";import{mergeRegister as Gh}from"@lexical/utils";import{formatDrawerSlug as Wh,useEditDepth as Vh}from"@payloadcms/ui";import{$getSelection as Kh,$isRangeSelection as Jh,COMMAND_PRIORITY_EDITOR as Xh,createCommand as zh}from"lexical";import{createContext as Zh,use as Yh,useEffect as qh,useMemo as Qh,useState as eg}from"react";import*as Gs from"react";var go=zh("OPEN_EMBED_DRAWER_COMMAND"),Ws=Zh({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function Vs({children:t}){let[e,o]=eg({cellEditorConfig:null,cellEditorPlugins:null});return Sr(Ws,{value:Qh(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var Ks=()=>{let t=Oh(16),[e]=$h(),o=Yh(Ws),r=Vh(),{fieldProps:n,uuid:i}=H(),{schemaPath:l}=n,s="lexical-table-create-"+i,u;t[0]!==r||t[1]!==s?(u=Wh({slug:s,depth:r}),t[0]=r,t[1]=s,t[2]=u):u=t[2];let c=u,{toggleDrawer:d}=ge(c,!0),a;t[3]!==e||t[4]!==d?(a=()=>{if(!e.hasNodes([jh,Uh,Hh]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return Gh(e.registerCommand(go,()=>{let h;return h=null,e.getEditorState().read(()=>{let g=Kh();Jh(g)&&(h=g)}),h&&d(),!0},Xh))},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],qh(a,p);let m;t[10]!==e?(m=(h,g)=>{!g.columns||!g.rows||e.dispatchCommand(Bh,{columns:String(g.columns),rows:String(g.rows)})},t[10]=e,t[11]=m):m=t[11];let f;return t[12]!==c||t[13]!==l||t[14]!==m?(f=Fh(Gs.Fragment,{children:[Sr(lt,{drawerSlug:c,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:m,schemaPath:l,schemaPathSuffix:"fields"}),Sr(Ph,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]}),t[12]=c,t[13]=l,t[14]=m,t[15]=f):f=t[15],f};var ng=R({markdownTransformers:[bs],nodes:[og,tg,rg],plugins:[{Component:Ks,position:"normal"},{Component:As,position:"normal"},{Component:Ss,position:"floatingAnchorElem"},{Component:Us,position:"floatingAnchorElem"}],providers:[Vs],slashMenu:{groups:[Q([{Icon:fr,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(go,{})}}])]},toolbarFixed:{groups:[be([{ChildComponent:fr,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(go,{})}}])]}});import{$isNodeSelection as Og}from"lexical";import{jsx as Rr,jsxs as ig}from"react/jsx-runtime";import"react";var Ir=()=>ig("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 ug}from"react/jsx-runtime";import zs from"bson-objectid";import{$applyNodeReplacement as dg}from"lexical";import*as Zs from"react";import{jsx as lg}from"react/jsx-runtime";import{DecoratorBlockNode as sg}from"@lexical/react/LexicalDecoratorBlockNode.js";import Js from"bson-objectid";import{$applyNodeReplacement as ag}from"lexical";import"react";function yr(t){return t.parentElement!=null&&t.parentElement.tagName==="LI"&&t.previousSibling===null&&t.getAttribute("aria-roledescription")==="checkbox"}function cg(t){if(t.hasAttribute("data-lexical-upload-relation-to")&&t.hasAttribute("data-lexical-upload-id")){let o=t.getAttribute("data-lexical-upload-id"),r=t.getAttribute("data-lexical-upload-relation-to");if(o!=null&&r!=null)return{node:Xs({data:{fields:{},relationTo:r,value:o}})}}let e=t;return e.src.startsWith("file:///")||yr(e),null}var At=class extends sg{__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:cg,priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new Js.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,relationTo:e.relationTo,value:e.value},r=Xs({data:o});return r.setFormat(e.format),r}static isInline(){return!1}decorate(){return lg(RawUploadComponent,{data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportDOM(){let e=document.createElement("img");return e.setAttribute("data-lexical-upload-id",String(this.__data?.value)),e.setAttribute("data-lexical-upload-relation-to",this.__data?.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 Xs({data:t}){return t?.id||(t.id=new Js.default().toHexString()),ag(new At({data:t}))}var mg=Zs.lazy(()=>import("./component-NNKG7K3O.js").then(t=>({default:t.UploadComponent})));function pg(t){if(t.hasAttribute("data-lexical-upload-relation-to")&&t.hasAttribute("data-lexical-upload-id")){let o=t.getAttribute("data-lexical-upload-id"),r=t.getAttribute("data-lexical-upload-relation-to");if(o!=null&&r!=null)return{node:Ue({data:{fields:{},relationTo:r,value:o}})}}let e=t;return e.src.startsWith("file:///")||yr(e),null}var Re=class extends At{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{img:e=>({conversion:pg,priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new zs.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,relationTo:e.relationTo,value:e.value},r=Ue({data:o});return r.setFormat(e.format),r}decorate(){return ug(mg,{data:this.__data,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Ue({data:t}){return t?.id||(t.id=new zs.default().toHexString()),dg(new Re({data:t}))}function vr(t){return t instanceof Re}import{c as Tg}from"react/compiler-runtime";import{jsx as wg}from"react/jsx-runtime";import{useLexicalComposerContext as kg}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Eg,mergeRegister as Ng}from"@lexical/utils";import{useConfig as Lg}from"@payloadcms/ui";import{$getPreviousSelection as Sg,$getSelection as Rg,$isParagraphNode as Ig,$isRangeSelection as yg,COMMAND_PRIORITY_EDITOR as vg,createCommand as Mg}from"lexical";import{useEffect as Ag}from"react";import{c as Ys}from"react/compiler-runtime";import{jsx as Mr}from"react/jsx-runtime";import{useLexicalComposerContext as qs}from"@lexical/react/LexicalComposerContext.js";import{toast as fg}from"@payloadcms/ui";import{$getNodeByKey as hg,COMMAND_PRIORITY_EDITOR as Qs}from"lexical";import{useEffect as ea,useState as gg}from"react";var Cg=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=hg(o);n&&n.replace(Ue({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(Ar,{fields:null,relationTo:e,value:r})},xg=t=>{let e=Ys(13),{enabledCollectionSlugs:o}=t,[r]=qs(),[n,i]=gg(null),l;e[0]!==o?(l={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=l):l=e[1];let{closeListDrawer:s,ListDrawer:u,openListDrawer:c}=St(l),d,a;e[2]!==r||e[3]!==c?(d=()=>r.registerCommand(Ve,h=>(i(h?.replace?h?.replace.nodeKey:null),c(),!0),Qs),a=[r,c],e[2]=r,e[3]=c,e[4]=d,e[5]=a):(d=e[4],a=e[5]),ea(d,a);let p;e[6]!==s||e[7]!==r||e[8]!==n?(p=h=>{let{collectionSlug:g,doc:b}=h;s(),Cg({editor:r,relationTo:g,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},bg=()=>{let t=Ys(3),[e]=qs(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Ve,_g,Qs),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),ea(o,r),null},ta=t=>Mr(Ot,{...t,FallbackComponent:bg,uploads:!0,children:Mr(xg,{...t})});function _g(){return fg.error("No upload collections enabled"),!0}var Ar=Mg("INSERT_UPLOAD_COMMAND"),oa=t=>{let e=Tg(5),[o]=kg(),{config:r}=Lg(),{collections:n}=r,i,l;e[0]!==o?(i=()=>{if(!o.hasNodes([Re]))throw new Error("UploadPlugin: UploadNode not registered on editor");return Ng(o.registerCommand(Ar,u=>(o.update(()=>{let c=Rg()||Sg();if(yg(c)){let d=Ue({data:{id:u.id,fields:u.fields,relationTo:u.relationTo,value:u.value}});Eg(d);let{focus:a}=c,p=a.getNode();Ig(p)&&!p.__first&&(p.__prev||p.__next)&&p.remove()}}),!0),vg))},l=[o],e[0]=o,e[1]=i,e[2]=l):(i=e[1],l=e[2]),Ag(i,l);let s;return e[3]!==n?(s=wg(ta,{enabledCollectionSlugs:n.map(Dg)}),e[3]=n,e[4]=s):s=e[4],s};function Dg(t){let{slug:e}=t;return e}var Fg=R({nodes:[Re],plugins:[{Component:oa,position:"normal"}],slashMenu:{groups:[Q([{Icon:Ir,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ve,{replace:!1})}}])]},toolbarFixed:{groups:[be([{ChildComponent:Ir,isActive:({selection:t})=>{if(!Og(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return vr(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ve,{replace:!1})}}])]}});import{c as $g}from"react/compiler-runtime";import{jsx as Or}from"react/jsx-runtime";import{ShimmerEffect as Pg,useConfig as Bg}from"@payloadcms/ui";import{lazy as Hg,Suspense as jg,useEffect as Ug,useState as Gg}from"react";var ra={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 Co={namespace:"lexical",theme:ra};function na({config:t,featureClientImportMap:e,featureClientSchemaMap:o,field:r,schemaPath:n,unSanitizedEditorConfig:i}){for(let c of i.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.");i.features=i.features.sort((c,d)=>c.clientFeatureProps.order-d.clientFeatureProps.order);let l=new Map;for(let c of i.features)l.set(c.clientFeatureProps.featureKey,c);let s=new Map,u=0;for(let c of i.features){let d=typeof c.feature=="function"?c.feature({config:t,featureClientImportMap:e,featureClientSchemaMap:o,featureProviderMap:l,field:r,resolvedFeatures:s,schemaPath:n,unSanitizedEditorConfig:i}):c.feature;d.key=c.clientFeatureProps.featureKey,d.order=u,s.set(c.clientFeatureProps.featureKey,d),u++}return s}var ia=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}};if(!t?.size)return e;t.forEach(o=>{if(o.providers?.length&&(e.providers=e.providers.concat(o.providers)),o.enableFormats?.length&&e.enabledFormats.push(...o.enableFormats),o.nodes?.length)for(let r of o.nodes)e.nodes.push(r);if(o.plugins?.length&&o.plugins.forEach((r,n)=>{e.plugins?.push({clientProps:o.sanitizedClientFeatureProps,Component:r.Component,key:o.key+n,position:r.position})}),o.toolbarInline?.groups?.length)for(let r of o.toolbarInline.groups){let n=e.toolbarInline.groups.find(i=>i.key===r.key);n?e.toolbarInline.groups=e.toolbarInline.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),e.toolbarInline?.groups.push(n)}if(o.toolbarFixed?.groups?.length)for(let r of o.toolbarFixed.groups){let n=e.toolbarFixed.groups.find(i=>i.key===r.key);n?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),e.toolbarFixed?.groups.push(n)}if(o.slashMenu?.groups){o.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(o.slashMenu.dynamicGroups));for(let r of o.slashMenu.groups){let n=e.slashMenu.groups.find(i=>i.key===r.key);n?e.slashMenu.groups=e.slashMenu.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),e.slashMenu.groups.push(n)}}if(o.markdownTransformers?.length)for(let r of o.markdownTransformers)typeof r=="function"?e.markdownTransformers.push(r({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(r);e.enabledFeatures.push(o.key)}),e.toolbarInline.groups.sort((o,r)=>o.order&&r.order?o.order-r.order:o.order?-1:r.order?1:0),e.toolbarFixed.groups.sort((o,r)=>o.order&&r.order?o.order-r.order:o.order?-1:r.order?1:0);for(let o of e.toolbarInline.groups)o.items.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);for(let o of e.toolbarFixed.groups)o.items.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);return e};function Dr(t,e,o){return{admin:o,features:ia(t),lexical:e,resolvedFeatureMap:t}}var Wg=Hg(()=>import("./Field-MAUKSOAP.js").then(t=>({default:t.RichText}))),Vg=t=>{let e=$g(16),{admin:o,clientFeatures:r,featureClientImportMap:n,featureClientSchemaMap:i,field:l,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?Co:s,{config:p}=Bg(),[m,f]=Gg(null),h,g;e[2]!==d||e[3]!==r||e[4]!==p||e[5]!==n||e[6]!==i||e[7]!==l||e[8]!==m||e[9]!==a||e[10]!==u?(h=()=>{if(m)return;let L=[];for(let[T,C]of Object.entries(r))C.clientFeatureProvider&&L.push(C.clientFeatureProvider(C.clientFeatureProps));let I=a||Co,_=na({config:p,featureClientImportMap:n,featureClientSchemaMap:i,field:l,schemaPath:u??l.name,unSanitizedEditorConfig:{features:L,lexical:I}});f(Dr(_,I,d))},g=[a,d,m,r,n,i,l,p,u],e[2]=d,e[3]=r,e[4]=p,e[5]=n,e[6]=i,e[7]=l,e[8]=m,e[9]=a,e[10]=u,e[11]=h,e[12]=g):(h=e[11],g=e[12]),Ug(h,g);let b;return e[13]!==m||e[14]!==t?(b=Or(jg,{fallback:Or(Pg,{height:"35vh"}),children:m&&Or(Wg,{...t,editorConfig:m})}),e[13]=m,e[14]=t,e[15]=b):b=e[15],b};function Kg(t){return t instanceof HTMLElement}function Jg(...t){return t.filter(Boolean).join(" ")}var xo=new WeakMap;function la(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function bo(t,e){let o=xo.get(t);if(o===void 0){let r=new Set,n=l=>{o!==void 0&&(o.start=la(l))},i=l=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let u=la(l);for(let c of r)u!==null&&c([u[0]-s[0],u[1]-s[1]],l)};t.addEventListener("touchstart",n),t.addEventListener("touchend",i),o={handleTouchend:i,handleTouchstart:n,listeners:r,start:null},xo.set(t,o)}return o.listeners.add(e),()=>{Xg(t,e)}}function Xg(t,e){let o=xo.get(t);if(o===void 0)return;let{listeners:r}=o;r.delete(e),r.size===0&&(xo.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function zg(t,e){return bo(t,(o,r)=>{let[n,i]=o;n<0&&-n>Math.abs(i)&&e(n,r)})}function Zg(t,e){return bo(t,(o,r)=>{let[n,i]=o;n>0&&n>Math.abs(i)&&e(n,r)})}function Yg(t,e){return bo(t,(o,r)=>{let[n,i]=o;i<0&&-i>Math.abs(n)&&e(n,r)})}function qg(t,e){return bo(t,(o,r)=>{let[n,i]=o;i>0&&i>Math.abs(n)&&e(n,r)})}import{c as Qg}from"react/compiler-runtime";import{jsx as eC}from"react/jsx-runtime";import"react";var tC=()=>{let t=Qg(2),{EditButton:e}=Ce(),o;return t[0]!==e?(o=e?eC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as oC}from"react/compiler-runtime";import{jsx as rC}from"react/jsx-runtime";import"react";var nC=()=>{let t=oC(2),{RemoveButton:e}=Ce(),o;return t[0]!==e?(o=e?rC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as iC}from"react/compiler-runtime";import{jsx as lC}from"react/jsx-runtime";import"react";var sC=()=>{let t=iC(2),{Label:e}=Ce(),o;return t[0]!==e?(o=e?lC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as aC}from"react/compiler-runtime";import{jsx as cC}from"react/jsx-runtime";import"react";var uC=t=>{let e=aC(3),{children:o}=t,{InlineBlockContainer:r}=Ce(),n;return e[0]!==r||e[1]!==o?(n=r?cC(r,{children:o}):null,e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{c as dC}from"react/compiler-runtime";import{jsx as mC}from"react/jsx-runtime";import"react";var pC=t=>{let e=dC(6),{children:o,editButton:r,Label:n,removeButton:i}=t,{BlockCollapsible:l}=De(),s;return e[0]!==l||e[1]!==n||e[2]!==o||e[3]!==r||e[4]!==i?(s=l?mC(l,{editButton:r,Label:n,removeButton:i,children:o}):null,e[0]=l,e[1]=n,e[2]=o,e[3]=r,e[4]=i,e[5]=s):s=e[5],s};import{c as fC}from"react/compiler-runtime";import{jsx as hC}from"react/jsx-runtime";import"react";var gC=()=>{let t=fC(2),{EditButton:e}=De(),o;return t[0]!==e?(o=e?hC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as CC}from"react/compiler-runtime";import{jsx as xC}from"react/jsx-runtime";import"react";var bC=()=>{let t=CC(2),{RemoveButton:e}=De(),o;return t[0]!==e?(o=e?xC(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as _C}from"qs-esm";var TC=({apiURL:t,depth:e,draft:o,locale:r})=>async({id:i,collectionSlug:l,select:s})=>{let u=_C({depth:e??0,draft:o??!1,locale:r,select:s},{addQueryPrefix:!0});return await fetch(`${t}/${l}/${i}${u}`,{credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json"},method:"GET"}).then(d=>d.json())};export{Ct as $createAutoLinkNode,Vt as $createBlockNode,To as $createInlineBlockNode,_e as $createLinkNode,He as $createRelationshipNode,Ue as $createUploadNode,we as $isAutoLinkNode,pt as $isBlockNode,wo as $isInlineBlockNode,z as $isLinkNode,ir as $isRelationshipNode,vr as $isUploadNode,ba as AlignFeatureClient,Te as AutoLinkNode,pC as BlockCollapsible,gC as BlockEditButton,xe as BlockNode,bC as BlockRemoveButton,Ea as BlockquoteFeatureClient,Tc as BlocksFeatureClient,Wc as BoldFeatureClient,ae as CAN_USE_DOM,Fm as ChecklistFeatureClient,Lp as DETAIL_TYPE_TO_DETAIL,wp as DOUBLE_LINE_BREAK,Pp as DebugJsxConverterFeatureClient,Rp as ELEMENT_FORMAT_TO_TYPE,Sp as ELEMENT_TYPE_TO_FORMAT,ma as ENABLE_SLASH_MENU_COMMAND,aa as EditorConfigProvider,lt as FieldsDrawer,e1 as FixedToolbarFeatureClient,Lu as HeadingFeatureClient,Gu as HorizontalRuleFeatureClient,Ke as INSERT_BLOCK_COMMAND,Je as INSERT_INLINE_BLOCK_COMMAND,_p as IS_ALL_FORMATTING,ad as IndentFeatureClient,uC as InlineBlockContainer,tC as InlineBlockEditButton,sC as InlineBlockLabel,_o as InlineBlockNode,nC as InlineBlockRemoveButton,zc as InlineCodeFeatureClient,d1 as InlineToolbarFeatureClient,Qc as ItalicFeatureClient,Ep as LTR_REGEX,np as LexicalPluginToLexicalFeatureClient,Tm as LinkFeatureClient,ie as LinkNode,Tp as NON_BREAKING_SPACE,D as NodeFormat,Wm as OrderedListFeatureClient,mp as ParagraphFeatureClient,ua as Point,kp as RTL_REGEX,pa as Rect,Ef as RelationshipFeatureClient,Ee as RelationshipNode,Vg as RichTextField,up as SlateToLexicalFeatureClient,nu as StrikethroughFeatureClient,au as SubscriptFeatureClient,mu as SuperscriptFeatureClient,Ip as TEXT_MODE_TO_TYPE,Np as TEXT_TYPE_TO_FORMAT,yp as TEXT_TYPE_TO_MODE,fe as TOGGLE_LINK_COMMAND,ng as TableFeatureClient,Oc as TestRecorderFeatureClient,Rt as ToolbarButton,je as ToolbarDropdown,Hc as TreeViewFeatureClient,Cu as UnderlineFeatureClient,qm as UnorderedListFeatureClient,Fg as UploadFeatureClient,Re as UploadNode,qg as addSwipeDownListener,zg as addSwipeLeftListener,Zg as addSwipeRightListener,Yg as addSwipeUpListener,$o as createBlockNode,R as createClientFeature,Co as defaultEditorLexicalConfig,pr as getDOMRangeRect,fa as getEnabledNodes,TC as getRestPopulateFn,Xe as getSelectedNode,Kg as isHTMLElement,da as isPoint,Jg as joinClasses,Dr as sanitizeClientEditorConfig,ia as sanitizeClientFeatures,lo as setFloatingElemPosition,Qt as setFloatingElemPositionForLinkEditor,Q as slashMenuBasicGroupWithItems,be as toolbarAddDropdownGroupWithItems,Bo as toolbarFeatureButtonsGroupWithItems,ee as toolbarFormatGroupWithItems,ne as toolbarTextDropdownGroupWithItems,De as useBlockComponentContext,H as useEditorConfigContext,Ce as useInlineBlockComponentContext,ca as useLexicalDocumentDrawer,ge as useLexicalDrawer,St as useLexicalListDrawer};
|
|
41
41
|
//# sourceMappingURL=index.js.map
|