@payloadcms/richtext-lexical 3.41.0-internal.8617025 → 3.41.0-internal.c079756
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/exports/client/Field-6GAC5Y2D.js +2 -0
- package/dist/exports/client/Field-6GAC5Y2D.js.map +7 -0
- package/dist/exports/client/bundled.css +1 -1
- package/dist/exports/client/{chunk-DOZWITPU.js → chunk-LUNX5J6B.js} +2 -2
- package/dist/exports/client/{chunk-DOZWITPU.js.map → chunk-LUNX5J6B.js.map} +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/blockquote/server/i18n.js +1 -1
- package/dist/features/blockquote/server/i18n.js.map +1 -1
- package/dist/features/blocks/client/plugin/index.js +1 -1
- package/dist/features/blocks/server/i18n.js +1 -1
- package/dist/features/blocks/server/i18n.js.map +1 -1
- package/dist/features/experimental_table/client/plugins/TablePlugin/index.js +1 -2
- package/dist/features/experimental_table/client/plugins/TablePlugin/index.js.map +1 -1
- package/dist/field/bundled.css +1 -1
- package/dist/lexical/LexicalEditor.d.ts.map +1 -1
- package/dist/lexical/LexicalEditor.js +2 -1
- package/dist/lexical/LexicalEditor.js.map +1 -1
- package/dist/lexical/plugins/SelectAllPlugin/index.d.ts +7 -0
- package/dist/lexical/plugins/SelectAllPlugin/index.d.ts.map +1 -0
- package/dist/lexical/plugins/SelectAllPlugin/index.js +26 -0
- package/dist/lexical/plugins/SelectAllPlugin/index.js.map +1 -0
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js +2 -4
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/LexicalMenu.js.map +1 -1
- package/dist/utilities/generateImportMap.d.ts.map +1 -1
- package/dist/utilities/generateImportMap.js +1 -3
- package/dist/utilities/generateImportMap.js.map +1 -1
- package/package.json +18 -15
- package/dist/exports/client/Field-DGC4DDYL.js +0 -2
- package/dist/exports/client/Field-DGC4DDYL.js.map +0 -7
- package/dist/scss/custom.css +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use client";import{a as
|
|
1
|
+
"use client";import{a as be,c as _o,d as To,e as wo}from"./chunk-3BY5IZJD.js";import{a as at}from"./chunk-DBWINSQN.js";import{a as st,b as Ot,c as Ke}from"./chunk-FSKAVN4P.js";import{a as Ce}from"./chunk-INBEEENE.js";import{a as xa}from"./chunk-F26IQ5RE.js";import{a as ce,c as Ur,d as Gr,e as Ca,f as ba,h as ka,j as _a,k as Ta}from"./chunk-LUNX5J6B.js";import{a as ga,b as G}from"./chunk-BZZVLW4U.js";function ee(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{$isElementNode as ve,$isRangeSelection as Ft,FORMAT_ELEMENT_COMMAND as Pt}from"lexical";import{jsx as Eo,jsxs as wa}from"react/jsx-runtime";import"react";var Wr=()=>wa("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:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as No,jsxs as Ea}from"react/jsx-runtime";import"react";var Vr=()=>Ea("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 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as So,jsxs as Na}from"react/jsx-runtime";import"react";var $t=()=>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:[So("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),So("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),So("path",{d:"M2.5 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Lo,jsxs as Sa}from"react/jsx-runtime";import"react";var Kr=()=>Sa("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 y=t=>o=>{let r={clientFeatureProps:o};if(typeof t=="function")r.feature=({config:n,featureClientImportMap:l,featureClientSchemaMap:i,featureProviderMap:s,field:u,resolvedFeatures:c,schemaPath:d,unSanitizedEditorConfig:a})=>{let p=t({config:n,featureClientImportMap:l,featureClientSchemaMap:i,featureProviderMap:s,field:u,props:o,resolvedFeatures:c,schemaPath:d,unSanitizedEditorConfig:a});return p.sanitizedClientFeatureProps===null&&(p.sanitizedClientFeatureProps=o),p};else{let n={...t};n.sanitizedClientFeatureProps=o,r.feature=n}return r};var Jr=t=>({type:"dropdown",ChildComponent:$t,items:t,key:"align",order:30});var Xr=[Jr([{ChildComponent:$t,isActive:({selection:t})=>{if(!Ft(t))return!1;for(let e of t.getNodes()){if(ve(e)&&e.getFormatType()==="left")continue;let o=e.getParent();if(!(ve(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:Wr,isActive:({selection:t})=>{if(!Ft(t))return!1;for(let e of t.getNodes()){if(ve(e)&&e.getFormatType()==="center")continue;let o=e.getParent();if(!(ve(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:Kr,isActive:({selection:t})=>{if(!Ft(t))return!1;for(let e of t.getNodes()){if(ve(e)&&e.getFormatType()==="right")continue;let o=e.getParent();if(!(ve(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:Vr,isActive:({selection:t})=>{if(!Ft(t))return!1;for(let e of t.getNodes()){if(ve(e)&&e.getFormatType()==="justify")continue;let o=e.getParent();if(!(ve(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}])],La=y({toolbarFixed:{groups:Xr},toolbarInline:{groups:Xr}});import{$createQuoteNode as tn,$isQuoteNode as Qr,QuoteNode as Ra}from"@lexical/rich-text";import{$setBlocksType as on}from"@lexical/selection";import{$getSelection as rn,$isRangeSelection as va}from"lexical";import{jsx as zr}from"react/jsx-runtime";import"react";var yo=()=>zr("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:zr("path",{d:"M13.5353 10.5725C13.5353 9.47709 11.0456 9.99991 11.0456 7.85883C11.0456 6.46464 12.1162 5.61816 13.361 5.61816C14.805 5.61816 16 6.86298 16 8.92937C16 11.2945 14.4564 13.7841 11.1203 14.3816L10.8216 13.1368C12.888 12.4895 13.5353 11.4937 13.5353 10.5725ZM6.71369 10.5725C6.71369 9.47709 4.22407 9.99991 4.22407 7.85883C4.22407 6.46464 5.29461 5.61816 6.53942 5.61816C7.9834 5.61816 9.17842 6.86298 9.17842 8.92937C9.17842 11.2945 7.63485 13.7841 4.29876 14.3816L4 13.1368C6.06639 12.4895 6.71369 11.4937 6.71369 10.5725Z",fill:"currentColor"})});import{jsx as Zr}from"react/jsx-runtime";import"react";var ct=()=>Zr("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Zr("path",{d:"M11.708 14.5H7.79785V13.9414H8.01367C9.00391 13.9414 9.15625 13.9033 9.15625 13.6113V6.70508H8.07715C6.82031 6.70508 6.73145 7.08594 6.28711 8.67285H5.80469L5.91895 6.12109H13.5869L13.7012 8.67285H13.2188C12.7744 7.08594 12.6855 6.70508 11.4287 6.70508H10.3496V13.6113C10.3496 13.9033 10.502 13.9414 11.4922 13.9414H11.708V14.5Z",fill:"currentColor"})});var le=t=>({type:"dropdown",ChildComponent:ct,items:t,key:"text",order:25});import{$createQuoteNode as ya,$isQuoteNode as Yr,QuoteNode as Ia}from"@lexical/rich-text";var qr={type:"element",dependencies:[Ia],export:(t,e)=>{if(!Yr(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(Zr(i)){i.splice(i.getChildrenSize(),0,[...e]),i.select(0,0),t.remove();return}}let n=La();n.append(...e),t.replace(n),n.select(0,0)}};var Qr=[ne([{ChildComponent:Lo,isActive:({selection:t})=>{if(!Ra(t))return!1;for(let e of t.getNodes())if(!qr(e)&&!qr(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=on();tn(e,()=>en())})},order:20}])],va=y({markdownTransformers:[Yr],nodes:[Ia],slashMenu:{groups:[Q([{Icon:Lo,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=on();tn(e,()=>en())})}}])]},toolbarFixed:{groups:Qr},toolbarInline:{groups:Qr}});import{getTranslation as Vt}from"@payloadcms/translations";import{jsx as yo,jsxs as Ma}from"react/jsx-runtime";import"react";var Pt=()=>Ma("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[yo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),yo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),yo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as rn}from"react/jsx-runtime";import"react";var Bt=()=>rn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:rn("path",{clipRule:"evenodd",d:"M5.33333 6.5C5.11232 6.5 4.90036 6.5878 4.74408 6.74408C4.5878 6.90036 4.5 7.11232 4.5 7.33333V12.1667C4.5 12.3877 4.5878 12.5996 4.74408 12.7559C4.90036 12.9122 5.11232 13 5.33333 13H14.6667C14.8877 13 15.0996 12.9122 15.2559 12.7559C15.4122 12.5996 15.5 12.3877 15.5 12.1667V11.6667C15.5 11.3905 15.7239 11.1667 16 11.1667C16.2761 11.1667 16.5 11.3905 16.5 11.6667V12.1667C16.5 12.6529 16.3068 13.1192 15.963 13.463C15.6192 13.8068 15.1529 14 14.6667 14H5.33333C4.8471 14 4.38079 13.8068 4.03697 13.463C3.69315 13.1192 3.5 12.6529 3.5 12.1667V7.33333C3.5 6.8471 3.69315 6.38079 4.03697 6.03697C4.38079 5.69315 4.8471 5.5 5.33333 5.5H10.3333C10.6095 5.5 10.8333 5.72386 10.8333 6C10.8333 6.27614 10.6095 6.5 10.3333 6.5H5.33333ZM13 6.5C12.7239 6.5 12.5 6.27614 12.5 6C12.5 5.72386 12.7239 5.5 13 5.5H16C16.2761 5.5 16.5 5.72386 16.5 6V9C16.5 9.27614 16.2761 9.5 16 9.5C15.7239 9.5 15.5 9.27614 15.5 9V7.20711L13.3536 9.35355C13.1583 9.54882 12.8417 9.54882 12.6464 9.35355C12.4512 9.15829 12.4512 8.84171 12.6464 8.64645L14.7929 6.5H13ZM6.16699 8.33325C6.16699 8.05711 6.39085 7.83325 6.66699 7.83325H11.0003C11.2765 7.83325 11.5003 8.05711 11.5003 8.33325C11.5003 8.60939 11.2765 8.83325 11.0003 8.83325H6.66699C6.39085 8.83325 6.16699 8.60939 6.16699 8.33325ZM6.16699 10.9999C6.16699 10.7238 6.39085 10.4999 6.66699 10.4999H13.3337C13.6098 10.4999 13.8337 10.7238 13.8337 10.9999C13.8337 11.2761 13.6098 11.4999 13.3337 11.4999H6.66699C6.39085 11.4999 6.16699 11.2761 6.16699 10.9999Z",fill:"currentColor",fillRule:"evenodd"})});import{jsx as Aa}from"react/jsx-runtime";import"react";function Ht(t,e){return t?()=>Aa("img",{alt:e??"Block Image",className:"lexical-block-custom-image",src:t,style:{maxHeight:20,maxWidth:20}}):Pt}import{jsx as cc}from"react/jsx-runtime";import uc from"bson-objectid";import"react";import{DecoratorBlockNode as Da}from"@lexical/react/LexicalDecoratorBlockNode.js";import Oa from"bson-objectid";var ct=class extends Da{__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=Fa(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 Fa(t){return new ct({fields:{...t,id:t?.id||new Oa.default().toHexString()}})}import{jsx as z,jsxs as ut,Fragment as Ga}from"react/jsx-runtime";import{Button as an,Collapsible as Wa,Drawer as Va,EditDepthProvider as Ka,ErrorPill as Ja,Form as Xa,formatDrawerSlug as za,FormSubmit as Za,Pill as Ya,RenderFields as qa,SectionTitle as Qa,useConfig as ec,useDocumentForm as tc,useDocumentInfo as cn,useEditDepth as oc,useFormSubmitted as rc,useServerFunctions as nc,useTranslation as ic}from"@payloadcms/ui";import{abortAndIgnore as Io}from"@payloadcms/ui/shared";import{deepCopyObjectSimpleWithoutReactComponents as Ut,reduceFieldsToValues as un}from"payload/shared";import dt,{useCallback as Ro,useEffect as vo,useMemo as mt,useRef as Mo}from"react";import{useLexicalComposerContext as lc}from"@lexical/react/LexicalComposerContext";import{getTranslation as sc}from"@payloadcms/translations";import{$getNodeByKey as Gt}from"lexical";import{v4 as ac}from"uuid";import{c as $a}from"react/compiler-runtime";import{jsx as jt,jsxs as Pa}from"react/jsx-runtime";import{RenderFields as Ba,useFormSubmitted as Ha}from"@payloadcms/ui";import ja,{createContext as Ua}from"react";var nn=Ua({initialState:!1}),Oe=()=>ja.use(nn),ln=t=>{let e=$a(13),{BlockDrawer:o,Collapsible:r,CustomBlock:n,EditButton:i,errorCount:l,formSchema:s,initialState:u,nodeKey:c,RemoveButton:d}=t,p=Ha()&&l>0,m,f;e[0]!==r||e[1]!==l||e[2]!==p?(f=_=>jt(r,{editButton:_.editButton,errorCount:l,fieldHasErrors:p,Label:_.Label,removeButton:_.removeButton,children:_.children}),e[0]=r,e[1]=l,e[2]=p,e[3]=f):f=e[3],m=f;let h=m,x;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?(x=n?Pa(nn,{value:{BlockCollapsible:h,EditButton:i,initialState:u,nodeKey:c,RemoveButton:d},children:[n,jt(o,{})]}):jt(h,{children:jt(Ba,{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]=x):x=e[12],x};function sn({fields:t}){for(let e in t){let o=t[e];Array.isArray(o?.rows)&&"value"in o&&(o.disableFormData=!0)}return t}var ue="lexical-block",dn=t=>{let{cacheBuster:e,formData:o,nodeKey:r}=t,n=rc(),{id:i,collectionSlug:l,globalSlug:s}=cn(),{fieldProps:{featureClientSchemaMap:u,field:c,initialLexicalFormState:d,permissions:a,readOnly:p,schemaPath:m},uuid:f}=U(),{fields:h}=tc(),x=Mo(new AbortController),_=oc(),[I,A]=dt.useState(0),{config:b}=ec(),T=za({slug:`lexical-blocks-create-${f}-${o.id}`,depth:_}),{toggleDrawer:g}=xe(T),{getDocPreferences:E,setDocFieldPreferences:M}=cn(),[D]=lc(),{getFormState:P}=nc(),v=`${m}.lexical_internal_feature.blocks.lexical_blocks.${o.blockType}.fields`,[N,C]=dt.useState(()=>d?.[o.id]?.formState?{...d?.[o.id]?.formState,blockName:{initialValue:o.blockName,passesCondition:!0,valid:!0,value:o.blockName}}:!1),w=Mo(!1),L=Mo(e);vo(()=>{w.current?(L.current!==e&&C(!1),L.current=e):w.current=!0},[e]);let[S,R]=dt.useState(N?._components?.customComponents?.BlockLabel),[k,F]=dt.useState(N?._components?.customComponents?.Block);vo(()=>{let W=new AbortController;return o&&!N&&(async()=>{let{state:J}=await P({id:i,collectionSlug:l,data:o,docPermissions:{fields:!0},docPreferences:await E(),documentFormState:Ut(h),globalSlug:s,initialBlockData:o,operation:"update",renderAllFields:!0,schemaPath:v,signal:W.signal});if(J){J.blockName={initialValue:o.blockName,passesCondition:!0,valid:!0,value:o.blockName};let q=un(Ut(J),!0);D.update(()=>{let X=Gt(r);if(X&&pt(X)){let se=q;se.blockType=o.blockType,X.setFields(se,!0)}}),C(J),R(J._components?.customComponents?.BlockLabel),F(J._components?.customComponents?.Block)}})(),()=>{Io(W)}},[P,v,i,o,D,r,N,l,s,E,h]);let[$,G]=dt.useState(d?.[o.id]?.collapsed??!1),V=`${m}.lexical_internal_feature.blocks.lexical_blocks.${o.blockType}`,H=u.blocks?.[V]?.[0],j=H.blockReferences?typeof H?.blockReferences?.[0]=="string"?b.blocksMap[H?.blockReferences?.[0]]:H?.blockReferences?.[0]:H?.blocks?.[0],{i18n:te,t:ce}=ic(),Y=Ro(async({formState:W,submit:fe})=>{Io(x.current);let J=new AbortController;x.current=J;let{state:q}=await P({id:i,collectionSlug:l,docPermissions:{fields:!0},docPreferences:await E(),documentFormState:Ut(h),formState:W,globalSlug:s,initialBlockFormState:W,operation:"update",renderAllFields:!!fe,schemaPath:v,signal:J.signal});if(!q)return W;W.blockName&&(q.blockName=W.blockName);let X=un(sn({fields:Ut(q)}),!0);if(setTimeout(()=>{D.update(()=>{let se=Gt(r);if(se&&pt(se)){let We=X;We.blockType=o.blockType,se.setFields(We,!0)}})},0),fe){R(q._components?.customComponents?.BlockLabel),F(q._components?.customComponents?.Block);let se=0;for(let We of Object.values(q))We?.valid===!1&&se++;A(se)}return q},[P,i,l,E,s,v,o.blockType,h,D,r]);vo(()=>()=>{Io(x.current)},[]);let K=Ro(()=>{D.update(()=>{Gt(r)?.remove()})},[D,r]),oe=j?.labels?.singular?sc(j.labels.singular,te):j?.slug,re=Ro(W=>{E().then(fe=>{let q=fe?.fields?.[c.name]?.collapsed,X=q&&q?.length?q:[];W?X.includes(o.id)||X.push(o.id):X.includes(o.id)&&X.splice(X.indexOf(o.id),1),M(c.name,{collapsed:X,hello:"hi"})})},[E,c.name,M,o.id]),le=mt(()=>()=>z(an,{buttonStyle:"icon-label",className:`${ue}__editButton`,disabled:p,el:"button",icon:"edit",onClick:W=>(W.preventDefault(),W.stopPropagation(),g(),!1),onMouseDown:W=>{W.preventDefault()},round:!0,size:"small",tooltip:ce("lexical:blocks:inlineBlocks:edit",{label:oe})}),[oe,p,ce,g]),De=mt(()=>()=>z(an,{buttonStyle:"icon-label",className:`${ue}__removeButton`,disabled:c?.admin?.readOnly||!1,icon:"x",onClick:W=>{W.preventDefault(),K()},round:!0,tooltip:"Remove Block"}),[c?.admin?.readOnly,K]),it=mt(()=>({children:W,disableBlockName:fe,editButton:J,errorCount:q,fieldHasErrors:X,Label:se,removeButton:We})=>z("div",{className:ue+" "+ue+"-"+o.blockType,children:z(Wa,{className:[`${ue}__row`,X?`${ue}__row--has-errors`:`${ue}__row--no-errors`].join(" "),collapsibleStyle:X?"error":"default",header:ut("div",{className:`${ue}__block-header`,children:[se??S?se??S:ut("div",{children:[z(Ya,{className:`${ue}__block-pill ${ue}__block-pill-${o?.blockType}`,pillStyle:"white",size:"small",children:oe??o?.blockType}),!fe&&!j?.admin?.disableBlockName&&z(Qa,{path:"blockName",readOnly:c?.admin?.readOnly||!1}),X&&z(Ja,{count:q??0,i18n:te,withMessage:!0})]}),ut("div",{children:[k&&J!==!1||!k&&J?z(le,{}):null,We!==!1&&D.isEditable()?z(De,{}):null]})]}),isCollapsed:$,onToggle:Hr=>{re(Hr),G(Hr)},children:W},0)}),[k,S,le,De,oe,j?.admin?.disableBlockName,D,o.blockType,te,$,re,c?.admin?.readOnly]),Br=mt(()=>()=>z(Ka,{children:z(Va,{className:"",slug:T,title:ce(`lexical:blocks:inlineBlocks:${o?.id?"edit":"create"}`,{label:oe??ce("lexical:blocks:inlineBlocks:label")}),children:N?ut(Ga,{children:[z(qa,{fields:j?.fields??[],forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:v,permissions:!0,readOnly:!1}),z(Za,{programmaticSubmit:!0,children:ce("fields:saveChanges")})]}):null})}),[N,T,oe,ce,j?.fields,v,a]),fa=mt(()=>N?z(Xa,{beforeSubmit:[async({formState:W})=>await Y({formState:W,submit:!0})],el:"div",fields:j?.fields??[],initialState:N,onChange:[Y],onSubmit:(W,fe)=>{fe.blockType=o.blockType,D.update(()=>{let J=Gt(r);J&&pt(J)&&J.setFields(fe,!0)}),g()},submitted:n,uuid:ac(),children:z(ln,{baseClass:ue,BlockDrawer:Br,Collapsible:it,CustomBlock:k,EditButton:le,errorCount:I,formSchema:j?.fields??[],initialState:N,nodeKey:r,RemoveButton:De})}):null,[it,Br,k,j?.fields,De,le,D,I,g,j?.fields,N,r,Y,n]);return j?fa:z(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 be=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=Wt(e.fields);return o.setFormat(e.format),o}decorate(e,o){return cc(dn,{cacheBuster:this.getCacheBuster(),formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Wt(t){return new be({fields:{...t,id:t?.id||new uc.default().toHexString()}})}function pt(t){return t instanceof be}import{createCommand as mn}from"lexical";var Ke=mn("INSERT_BLOCK_COMMAND"),Je=mn("INSERT_INLINE_BLOCK_COMMAND");import{c as dc}from"react/compiler-runtime";import{useLexicalComposerContext as mc}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as pc,$wrapNodeInElement as fc,mergeRegister as hc}from"@lexical/utils";import{formatDrawerSlug as gc,useEditDepth as xc}from"@payloadcms/ui";import{$createParagraphNode as Cc,$getNodeByKey as bc,$getPreviousSelection as _c,$getSelection as Tc,$insertNodes as kc,$isParagraphNode as Ec,$isRangeSelection as wc,$isRootOrShadowRoot as Nc,COMMAND_PRIORITY_EDITOR as pn}from"lexical";import{useEffect as Sc,useState as Lc}from"react";var fn=()=>{let t=dc(12),[e]=mc(),[o,r]=Lc(null),{setCreatedInlineBlock:n,uuid:i}=U(),l=xc(),s="lexical-inlineBlocks-create-"+i,u;t[0]!==l||t[1]!==s?(u=gc({slug:s,depth:l}),t[0]=l,t[1]=s,t[2]=u):u=t[2];let c=u,{toggleDrawer:d}=xe(c,!0),a;t[3]!==e||t[4]!==n||t[5]!==o?(a=()=>{if(!e.hasNodes([be]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return hc(e.registerCommand(Ke,m=>(e.update(()=>{let f=Tc()||_c();if(wc(f)){let h=Wt(m),{focus:x}=f,_=x.getNode();pc(h),Ec(_)&&!_.__first&&_.remove()}}),!0),pn),e.registerCommand(Je,m=>{if(o){let h=bc(o);return!h||!ko(h)?!1:(h.setFields(m),r(null),!0)}let f=To(m);return n?.(f),kc([f]),Nc(f.getParentOrThrow())&&fc(f,Cc).selectEnd(),!0},pn))},t[3]=e,t[4]=n,t[5]=o,t[6]=a):a=t[6];let p;return t[7]!==e||t[8]!==n||t[9]!==o||t[10]!==d?(p=[e,n,o,d],t[7]=e,t[8]=n,t[9]=o,t[10]=d,t[11]=p):p=t[11],Sc(a,p),null};var yc=y(({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:[be,_o],plugins:[{Component:fn,position:"normal"}],sanitizedClientFeatureProps:o,slashMenu:{groups:[c?.length?{items:c.map(a=>({Icon:Ht(a.imageURL,a.imageAltText),key:"block-"+a.slug,keywords:["block","blocks",a.slug],label:({i18n:p})=>a?.labels?.singular?Vt(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:Bt,key:"inlineBlocks-"+a.slug,keywords:["inlineBlock","inline block",a.slug],label:({i18n:p})=>a?.labels?.singular?Vt(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:Pt,items:c.map((a,p)=>({ChildComponent:Ht(a.imageURL,a.imageAltText),isActive:void 0,key:"block-"+a.slug,label:({i18n:m})=>a?.labels?.singular?Vt(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:Bt,items:d.map((a,p)=>({ChildComponent:a.imageURL?Ht(a.imageURL,a.imageAltText):Bt,isActive:void 0,key:"inlineBlock-"+a.slug,label:({i18n:m})=>a?.labels?.singular?Vt(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 vc}from"react/compiler-runtime";import{jsx as $e,jsxs as Fo}from"react/jsx-runtime";import{useLexicalComposerContext as Mc}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as Ac,$createTextNode as Dc,$getRoot as Oc,getDOMSelection as Ao}from"lexical";import*as bn from"react";import{useCallback as Fe,useEffect as Do,useLayoutEffect as gn,useRef as Oo,useState as Kt}from"react";var Ic=ae&&"documentMode"in document?document.documentMode:null,hn=ae&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Jb=ae&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Xb=ae&&"InputEvent"in window&&!Ic?"getTargetRanges"in new window.InputEvent("input"):!1,zb=ae&&/Version\/[\d.].*Safari/.test(navigator.userAgent),Zb=ae&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Yb=ae&&/Android/.test(navigator.userAgent),qb=ae&&/Win/.test(navigator.platform),Rc=ae&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Qb=ae&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!Rc;var Fc=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)},$c=(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)},Pc=t=>{let o=((r,n)=>{switch(r){case"click":return` await page.mouse.click(${n.x}, ${n.y});`;case"keydown":return` await page.keyboard.keydown('${n}');`;case"keyup":return` await page.keyboard.keyup('${n}');`;case"press":return` await page.keyboard.press('${n}');`;case"selectAll":return" await selectAll(page);";case"snapshot":return` await assertHTMLSnapshot(page);
|
|
3
|
+
`)},regExp:/^>\s/,replace:(t,e,o,r)=>{if(r){let l=t.getPreviousSibling();if(Yr(l)){l.splice(l.getChildrenSize(),0,[...e]),l.select(0,0),t.remove();return}}let n=ya();n.append(...e),t.replace(n),n.select(0,0)}};var en=[le([{ChildComponent:yo,isActive:({selection:t})=>{if(!va(t))return!1;for(let e of t.getNodes())if(!Qr(e)&&!Qr(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=rn();on(e,()=>tn())})},order:20}])],Ma=y({markdownTransformers:[qr],nodes:[Ra],slashMenu:{groups:[ee([{Icon:yo,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=rn();on(e,()=>tn())})}}])]},toolbarFixed:{groups:en},toolbarInline:{groups:en}});import{getTranslation as Kt}from"@payloadcms/translations";import{jsx as Io,jsxs as Aa}from"react/jsx-runtime";import"react";var Bt=()=>Aa("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Io("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),Io("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),Io("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as nn}from"react/jsx-runtime";import"react";var Ht=()=>nn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:nn("path",{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 Da}from"react/jsx-runtime";import"react";function jt(t,e){return t?()=>Da("img",{alt:e??"Block Image",className:"lexical-block-custom-image",src:t,style:{maxHeight:20,maxWidth:20}}):Bt}import{jsx as uc}from"react/jsx-runtime";import dc from"bson-objectid";import"react";import{DecoratorBlockNode as Oa}from"@lexical/react/LexicalDecoratorBlockNode.js";import $a from"bson-objectid";var ut=class extends Oa{__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=Fa(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 Fa(t){return new ut({fields:{...t,id:t?.id||new $a.default().toHexString()}})}import{jsx as Z,jsxs as dt,Fragment as Wa}from"react/jsx-runtime";import{Button as cn,Collapsible as Va,Drawer as Ka,EditDepthProvider as Ja,ErrorPill as Xa,Form as za,formatDrawerSlug as Za,FormSubmit as Ya,Pill as qa,RenderFields as Qa,SectionTitle as ec,useConfig as tc,useDocumentForm as oc,useDocumentInfo as un,useEditDepth as rc,useFormSubmitted as nc,useServerFunctions as lc,useTranslation as ic}from"@payloadcms/ui";import{abortAndIgnore as Ro}from"@payloadcms/ui/shared";import{deepCopyObjectSimpleWithoutReactComponents as Gt,reduceFieldsToValues as dn}from"payload/shared";import mt,{useCallback as vo,useEffect as Mo,useMemo as pt,useRef as Ao}from"react";import{useLexicalComposerContext as sc}from"@lexical/react/LexicalComposerContext";import{getTranslation as ac}from"@payloadcms/translations";import{$getNodeByKey as Wt}from"lexical";import{v4 as cc}from"uuid";import{c as Pa}from"react/compiler-runtime";import{jsx as Ut,jsxs as Ba}from"react/jsx-runtime";import{RenderFields as Ha,useFormSubmitted as ja}from"@payloadcms/ui";import Ua,{createContext as Ga}from"react";var ln=Ga({initialState:!1}),$e=()=>Ua.use(ln),sn=t=>{let e=Pa(13),{BlockDrawer:o,Collapsible:r,CustomBlock:n,EditButton:l,errorCount:i,formSchema:s,initialState:u,nodeKey:c,RemoveButton:d}=t,p=ja()&&i>0,m,f;e[0]!==r||e[1]!==i||e[2]!==p?(f=k=>Ut(r,{editButton:k.editButton,errorCount:i,fieldHasErrors:p,Label:k.Label,removeButton:k.removeButton,children:k.children}),e[0]=r,e[1]=i,e[2]=p,e[3]=f):f=e[3],m=f;let h=m,x;return e[4]!==o||e[5]!==h||e[6]!==n||e[7]!==l||e[8]!==d||e[9]!==s||e[10]!==u||e[11]!==c?(x=n?Ba(ln,{value:{BlockCollapsible:h,EditButton:l,initialState:u,nodeKey:c,RemoveButton:d},children:[n,Ut(o,{})]}):Ut(h,{children:Ut(Ha,{fields:s,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0})}),e[4]=o,e[5]=h,e[6]=n,e[7]=l,e[8]=d,e[9]=s,e[10]=u,e[11]=c,e[12]=x):x=e[12],x};function an({fields:t}){for(let e in t){let o=t[e];Array.isArray(o?.rows)&&"value"in o&&(o.disableFormData=!0)}return t}var de="lexical-block",mn=t=>{let{cacheBuster:e,formData:o,nodeKey:r}=t,n=nc(),{id:l,collectionSlug:i,globalSlug:s}=un(),{fieldProps:{featureClientSchemaMap:u,field:c,initialLexicalFormState:d,permissions:a,readOnly:p,schemaPath:m},uuid:f}=G(),{fields:h}=oc(),x=Ao(new AbortController),k=rc(),[I,A]=mt.useState(0),{config:b}=tc(),_=Za({slug:`lexical-blocks-create-${f}-${o.id}`,depth:k}),{toggleDrawer:g}=Ce(_),{getDocPreferences:w,setDocFieldPreferences:M}=un(),[D]=sc(),{getFormState:P}=lc(),v=`${m}.lexical_internal_feature.blocks.lexical_blocks.${o.blockType}.fields`,[N,C]=mt.useState(()=>d?.[o.id]?.formState?{...d?.[o.id]?.formState,blockName:{initialValue:o.blockName,passesCondition:!0,valid:!0,value:o.blockName}}:!1),E=Ao(!1),L=Ao(e);Mo(()=>{E.current?(L.current!==e&&C(!1),L.current=e):E.current=!0},[e]);let[S,R]=mt.useState(N?._components?.customComponents?.BlockLabel),[T,$]=mt.useState(N?._components?.customComponents?.Block);Mo(()=>{let V=new AbortController;return o&&!N&&(async()=>{let{state:X}=await P({id:l,collectionSlug:i,data:o,docPermissions:{fields:!0},docPreferences:await w(),documentFormState:Gt(h),globalSlug:s,initialBlockData:o,operation:"update",renderAllFields:!0,schemaPath:v,signal:V.signal});if(X){X.blockName={initialValue:o.blockName,passesCondition:!0,valid:!0,value:o.blockName};let Q=dn(Gt(X),!0);D.update(()=>{let z=Wt(r);if(z&&ft(z)){let ae=Q;ae.blockType=o.blockType,z.setFields(ae,!0)}}),C(X),R(X._components?.customComponents?.BlockLabel),$(X._components?.customComponents?.Block)}})(),()=>{Ro(V)}},[P,v,l,o,D,r,N,i,s,w,h]);let[F,W]=mt.useState(d?.[o.id]?.collapsed??!1),K=`${m}.lexical_internal_feature.blocks.lexical_blocks.${o.blockType}`,j=u.blocks?.[K]?.[0],U=j.blockReferences?typeof j?.blockReferences?.[0]=="string"?b.blocksMap[j?.blockReferences?.[0]]:j?.blockReferences?.[0]:j?.blocks?.[0],{i18n:oe,t:ue}=ic(),q=vo(async({formState:V,submit:he})=>{Ro(x.current);let X=new AbortController;x.current=X;let{state:Q}=await P({id:l,collectionSlug:i,docPermissions:{fields:!0},docPreferences:await w(),documentFormState:Gt(h),formState:V,globalSlug:s,initialBlockFormState:V,operation:"update",renderAllFields:!!he,schemaPath:v,signal:X.signal});if(!Q)return V;V.blockName&&(Q.blockName=V.blockName);let z=dn(an({fields:Gt(Q)}),!0);if(setTimeout(()=>{D.update(()=>{let ae=Wt(r);if(ae&&ft(ae)){let Ve=z;Ve.blockType=o.blockType,ae.setFields(Ve,!0)}})},0),he){R(Q._components?.customComponents?.BlockLabel),$(Q._components?.customComponents?.Block);let ae=0;for(let Ve of Object.values(Q))Ve?.valid===!1&&ae++;A(ae)}return Q},[P,l,i,w,s,v,o.blockType,h,D,r]);Mo(()=>()=>{Ro(x.current)},[]);let J=vo(()=>{D.update(()=>{Wt(r)?.remove()})},[D,r]),re=U?.labels?.singular?ac(U.labels.singular,oe):U?.slug,ne=vo(V=>{w().then(he=>{let Q=he?.fields?.[c.name]?.collapsed,z=Q&&Q?.length?Q:[];V?z.includes(o.id)||z.push(o.id):z.includes(o.id)&&z.splice(z.indexOf(o.id),1),M(c.name,{collapsed:z,hello:"hi"})})},[w,c.name,M,o.id]),se=pt(()=>()=>Z(cn,{buttonStyle:"icon-label",className:`${de}__editButton`,disabled:p,el:"button",icon:"edit",onClick:V=>(V.preventDefault(),V.stopPropagation(),g(),!1),onMouseDown:V=>{V.preventDefault()},round:!0,size:"small",tooltip:ue("lexical:blocks:inlineBlocks:edit",{label:re})}),[re,p,ue,g]),Oe=pt(()=>()=>Z(cn,{buttonStyle:"icon-label",className:`${de}__removeButton`,disabled:c?.admin?.readOnly||!1,icon:"x",onClick:V=>{V.preventDefault(),J()},round:!0,tooltip:"Remove Block"}),[c?.admin?.readOnly,J]),it=pt(()=>({children:V,disableBlockName:he,editButton:X,errorCount:Q,fieldHasErrors:z,Label:ae,removeButton:Ve})=>Z("div",{className:de+" "+de+"-"+o.blockType,children:Z(Va,{className:[`${de}__row`,z?`${de}__row--has-errors`:`${de}__row--no-errors`].join(" "),collapsibleStyle:z?"error":"default",header:dt("div",{className:`${de}__block-header`,children:[ae??S?ae??S:dt("div",{children:[Z(qa,{className:`${de}__block-pill ${de}__block-pill-${o?.blockType}`,pillStyle:"white",size:"small",children:re??o?.blockType}),!he&&!U?.admin?.disableBlockName&&Z(ec,{path:"blockName",readOnly:c?.admin?.readOnly||!1}),z&&Z(Xa,{count:Q??0,i18n:oe,withMessage:!0})]}),dt("div",{children:[T&&X!==!1||!T&&X?Z(se,{}):null,Ve!==!1&&D.isEditable()?Z(Oe,{}):null]})]}),isCollapsed:F,onToggle:jr=>{ne(jr),W(jr)},children:V},0)}),[T,S,se,Oe,re,U?.admin?.disableBlockName,D,o.blockType,oe,F,ne,c?.admin?.readOnly]),Hr=pt(()=>()=>Z(Ja,{children:Z(Ka,{className:"",slug:_,title:ue(`lexical:blocks:inlineBlocks:${o?.id?"edit":"create"}`,{label:re??ue("lexical:blocks:inlineBlocks:label")}),children:N?dt(Wa,{children:[Z(Qa,{fields:U?.fields??[],forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:v,permissions:!0,readOnly:!1}),Z(Ya,{programmaticSubmit:!0,children:ue("fields:saveChanges")})]}):null})}),[N,_,re,ue,U?.fields,v,a]),ha=pt(()=>N?Z(za,{beforeSubmit:[async({formState:V})=>await q({formState:V,submit:!0})],el:"div",fields:U?.fields??[],initialState:N,onChange:[q],onSubmit:(V,he)=>{he.blockType=o.blockType,D.update(()=>{let X=Wt(r);X&&ft(X)&&X.setFields(he,!0)}),g()},submitted:n,uuid:cc(),children:Z(sn,{baseClass:de,BlockDrawer:Hr,Collapsible:it,CustomBlock:T,EditButton:se,errorCount:I,formSchema:U?.fields??[],initialState:N,nodeKey:r,RemoveButton:Oe})}):null,[it,Hr,T,U?.fields,Oe,se,D,I,g,U?.fields,N,r,q,n]);return U?ha:Z(it,{disableBlockName:!0,fieldHasErrors:!0,children:dt("div",{className:"lexical-block-not-found",children:["Error: Block '",o.blockType,"' not found in the config but exists in the lexical data"]})})};var ke=class extends ut{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 uc(mn,{cacheBuster:this.getCacheBuster(),formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Vt(t){return new ke({fields:{...t,id:t?.id||new dc.default().toHexString()}})}function ft(t){return t instanceof ke}import{createCommand as pn}from"lexical";var Je=pn("INSERT_BLOCK_COMMAND"),Xe=pn("INSERT_INLINE_BLOCK_COMMAND");import{c as mc}from"react/compiler-runtime";import{useLexicalComposerContext as pc}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as fc,$wrapNodeInElement as hc,mergeRegister as gc}from"@lexical/utils";import{formatDrawerSlug as xc,useEditDepth as Cc}from"@payloadcms/ui";import{$createParagraphNode as bc,$getNodeByKey as kc,$getPreviousSelection as _c,$getSelection as Tc,$insertNodes as wc,$isParagraphNode as Ec,$isRangeSelection as Nc,$isRootOrShadowRoot as Sc,COMMAND_PRIORITY_EDITOR as fn}from"lexical";import{useEffect as Lc,useState as yc}from"react";var hn=()=>{let t=mc(12),[e]=pc(),[o,r]=yc(null),{setCreatedInlineBlock:n,uuid:l}=G(),i=Cc(),s="lexical-inlineBlocks-create-"+l,u;t[0]!==i||t[1]!==s?(u=xc({slug:s,depth:i}),t[0]=i,t[1]=s,t[2]=u):u=t[2];let c=u,{toggleDrawer:d}=Ce(c,!0),a;t[3]!==e||t[4]!==n||t[5]!==o?(a=()=>{if(!e.hasNodes([ke]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return gc(e.registerCommand(Je,m=>(e.update(()=>{let f=Tc()||_c();if(Nc(f)){let h=Vt(m),{focus:x}=f,k=x.getNode();fc(h),Ec(k)&&!k.__first&&k.remove()}}),!0),fn),e.registerCommand(Xe,m=>{if(o){let h=kc(o);return!h||!wo(h)?!1:(h.setFields(m),r(null),!0)}let f=To(m);return n?.(f),wc([f]),Sc(f.getParentOrThrow())&&hc(f,bc).selectEnd(),!0},fn))},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],Lc(a,p),null};var Ic=y(({config:t,featureClientSchemaMap:e,props:o,schemaPath:r})=>{let n=`${r}.lexical_internal_feature.blocks.lexical_blocks`,l=`${r}.lexical_internal_feature.blocks.lexical_inline_blocks`,i=e.blocks;if(!i)return{};let s=Object.entries(i).filter(([a])=>a.startsWith(n+".")&&!a.replace(n+".","").includes(".")).map(([,a])=>a[0]),u=Object.entries(i).filter(([a])=>a.startsWith(l+".")&&!a.replace(l+".","").includes(".")).map(([,a])=>a[0]),c=s.map(a=>a.blockReferences?typeof a.blockReferences[0]=="string"?t.blocksMap[a.blockReferences[0]]:a.blockReferences[0]:a.blocks[0]).filter(a=>a!==void 0),d=u.map(a=>a.blockReferences?typeof a.blockReferences[0]=="string"?t.blocksMap[a.blockReferences[0]]:a.blockReferences[0]:a.blocks[0]).filter(a=>a!==void 0);return{nodes:[ke,_o],plugins:[{Component:hn,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(Je,{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(Xe,{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(Je,{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(Xe,{blockName:"",blockType:a.slug})},order:p})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}});import{c as Mc}from"react/compiler-runtime";import{jsx as Pe,jsxs as Fo}from"react/jsx-runtime";import{useLexicalComposerContext as Ac}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as Dc,$createTextNode as Oc,$getRoot as $c,getDOMSelection as Do}from"lexical";import*as kn from"react";import{useCallback as Fe,useEffect as Oo,useLayoutEffect as xn,useRef as $o,useState as Jt}from"react";var Rc=ce&&"documentMode"in document?document.documentMode:null,gn=ce&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),zx=ce&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Zx=ce&&"InputEvent"in window&&!Rc?"getTargetRanges"in new window.InputEvent("input"):!1,Yx=ce&&/Version\/[\d.].*Safari/.test(navigator.userAgent),qx=ce&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Qx=ce&&/Android/.test(navigator.userAgent),eC=ce&&/Win/.test(navigator.platform),vc=ce&&/^(?=.*Chrome).*/i.test(navigator.userAgent),tC=ce&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!vc;var Fc=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)},Pc=(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)},Bc=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 Hc(t){return t.key.toLowerCase()==="a"&&(gn?t.metaKey:t.ctrlKey)}function jc(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 Cn(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 bn=new Set(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Backspace","Delete","Enter","Escape"]);function Uc(t){let[e,o]=Jt([]),[r,n]=Jt(!1),[,l]=Jt(""),[i,s]=Jt(""),u=$o(null),c=$o(!1),d=$o(null),a=Fe(()=>t,[t]),p=Fe(()=>{let b=t.getRootElement(),_=Do(t._window);return b==null||_==null||_.anchorNode==null||_.focusNode==null||!b.contains(_.anchorNode)||!b.contains(_.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(Bc).join(`
|
|
31
31
|
`)}
|
|
32
32
|
});
|
|
33
33
|
});
|
|
34
|
-
`},[t,e]),m=Fe((b,T)=>{o(g=>{let E=e.length-1,M=e[E];if(M&&M.name===b){if(b==="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[...g,{name:b,count:1,value:T}]})},[e,o]);gn(()=>{let b=g=>{if(!r)return;let E=g.key;Bc(g)?m("selectAll",""):Cn.has(E)?m("press",g.key):[...E].length>1?m("keydown",g.key):m("type",g.key)},T=g=>{if(!r)return;let E=g.key;!Cn.has(E)&&[...E].length>1&&m("keyup",g.key)};return t.registerRootListener((g,E)=>{E!==null&&(E.removeEventListener("keydown",b),E.removeEventListener("keyup",T)),g!==null&&(g.addEventListener("keydown",b),g.addEventListener("keyup",T))})},[t,r,m]),gn(()=>{d.current&&d.current.scrollTo(0,d.current.scrollHeight)},[p]),Do(()=>{if(e){let b=p();b!==null&&s(b),d.current&&d.current.scrollTo(0,d.current.scrollHeight)}},[p,e]),Do(()=>t.registerUpdateListener(({dirtyElements:T,dirtyLeaves:g,editorState:E})=>{if(!r)return;let M=E._selection,D=u.current,P=c.current;if(D!==M){if(g.size===0&&T.size===0&&!P){let N=Ao(t._window);if(N&&(N.anchorNode==null||N.focusNode==null))return}u.current=M}c.current=!1;let v=p();v!==null&&s(v)}),[t,p,r,m]),Do(()=>r?t.registerUpdateListener(()=>{let T=t.getRootElement();T!==null&&i(T?.innerHTML)}):void 0,[t,r]);let f=Fe(b=>{r||(b.update(()=>{let T=Oc();T.clear();let g=Dc();T.append(Ac().append(g)),g.select()}),o([])),n(T=>!T)},[r]),h=Fe(()=>{if(!r)return;let b=Ao(t._window);if(b===null||b.anchorNode==null||b.focusNode==null)return;let{anchorNode:T,anchorOffset:g,focusNode:E,focusOffset:M}=Hc(b),D=a().getRootElement(),P;T!==null&&(P=xn(T,D));let v;E!==null&&(v=xn(E,D)),m("snapshot",{anchorNode:T,anchorOffset:g,anchorPath:P,focusNode:E,focusOffset:M,focusPath:v})},[m,r,a]),x=Fe(()=>{Fc(p())},[p]),_=Fe(()=>{$c("test.js",p())},[p]);return[$e("button",{className:`editor-dev-button ${r?"active":""}`,id:"test-recorder-button",onClick:b=>{f(a()),b.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:[$e("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:b=>{h(),b.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),$e("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:b=>{x(),b.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),$e("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:b=>{_(),b.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),$e("pre",{id:"test-recorder",ref:d,children:l})]}):null]}var _n=()=>{let t=vc(3),[e]=Mc(),[o,r]=jc(e),n;return t[0]!==o||t[1]!==r?(n=Fo(bn.Fragment,{children:[$e("p",{children:"HI"}),o,r,$e("p",{children:"DONE"})]}),t[0]=o,t[1]=r,t[2]=n):n=t[2],n};var Uc=y({plugins:[{Component:_n,position:"bottom"}]});import{c as Gc}from"react/compiler-runtime";import{jsx as Wc}from"react/jsx-runtime";import{useLexicalComposerContext as Vc}from"@lexical/react/LexicalComposerContext.js";import{TreeView as Kc}from"@lexical/react/LexicalTreeView.js";import"react";var Tn=()=>{let t=Gc(2),[e]=Vc(),o;return t[0]!==e?(o=Wc(Kc,{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 Jc=y({plugins:[{Component:Tn,position:"bottom"}]});import{$isTableSelection as Xc}from"@lexical/table";import{$isRangeSelection as zc,FORMAT_TEXT_COMMAND as Zc}from"lexical";import{jsx as kn}from"react/jsx-runtime";import"react";var En=()=>kn("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:"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:"***"},Nn={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},Sn={type:"text-format",format:["bold"],tag:"**"},Ln={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var yn=[ee([{ChildComponent:En,isActive:({selection:t})=>zc(t)||Xc(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(Zc,"bold")},order:1}])],Yc=y(({featureProviderMap:t})=>{let e=[Sn,Ln];return t.get("italic")&&e.push(Nn,wn),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:yn},toolbarInline:{groups:yn}}});import{$isTableSelection as Qc}from"@lexical/table";import{$isRangeSelection as eu,FORMAT_TEXT_COMMAND as tu}from"lexical";import{jsx as In,jsxs as qc}from"react/jsx-runtime";import"react";var Rn=()=>qc("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[In("path",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),In("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var vn={type:"text-format",format:["code"],tag:"`"};var Mn=[ee([{ChildComponent:Rn,isActive:({selection:t})=>eu(t)||Qc(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(tu,"code")},order:7}])],ou=y({enableFormats:["code"],markdownTransformers:[vn],toolbarFixed:{groups:Mn},toolbarInline:{groups:Mn}});import{$isTableSelection as ru}from"@lexical/table";import{$isRangeSelection as nu,FORMAT_TEXT_COMMAND as iu}from"lexical";import{jsx as An}from"react/jsx-runtime";import"react";var Dn=()=>An("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:An("path",{d:"M11.311 14.2969L11.0327 15H6.18408L6.4624 14.2969C7.54639 14.2969 7.70752 14.209 7.83936 13.8721L10.8423 6.45996C10.8716 6.38672 10.8862 6.32812 10.8862 6.26953C10.8862 6.09375 10.6519 6.03516 9.80225 6.03516L10.0952 5.33203H14.9438L14.6509 6.03516C13.5669 6.03516 13.4204 6.12305 13.2886 6.45996L10.2856 13.8721C10.2563 13.9453 10.2271 14.0039 10.2271 14.0625C10.2271 14.2383 10.4614 14.2969 11.311 14.2969Z",fill:"currentColor"})});var On={type:"text-format",format:["italic"],tag:"*"},Fn={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var $n=[ee([{ChildComponent:Dn,isActive:({selection:t})=>nu(t)||ru(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(iu,"italic")},order:2}])],lu=y({enableFormats:["italic"],markdownTransformers:[On,Fn],toolbarFixed:{groups:$n},toolbarInline:{groups:$n}});import{$isTableSelection as au}from"@lexical/table";import{$isRangeSelection as cu,FORMAT_TEXT_COMMAND as uu}from"lexical";import{jsx as Pn,jsxs as su}from"react/jsx-runtime";import"react";var Bn=()=>su("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Pn("path",{d:"M5.50756 12.76H7.42756C7.56256 14.215 8.82256 14.71 10.1576 14.71C11.4326 14.71 12.4226 14.14 12.4226 13.06C12.4226 12.28 11.9576 11.845 10.6676 11.605L8.70256 11.245C7.12756 10.96 5.85256 10.21 5.85256 8.335C5.85256 6.43 7.53256 5.11 9.87256 5.11C12.4226 5.11 13.9526 6.22 14.1626 8.23H12.2876C12.1526 7.18 11.2226 6.595 9.88756 6.595C8.59756 6.595 7.78756 7.27 7.78756 8.215C7.78756 9.1 8.34256 9.385 9.49756 9.61L11.5676 10.015C13.3226 10.345 14.3726 11.215 14.3726 12.94C14.3726 14.89 12.5876 16.18 10.2176 16.18C7.66756 16.18 5.70256 15.115 5.50756 12.76Z",fill:"currentColor"}),Pn("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var Hn={type:"text-format",format:["strikethrough"],tag:"~~"};var jn=[ee([{ChildComponent:Bn,isActive:({selection:t})=>cu(t)||au(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(uu,"strikethrough")},order:4}])],du=y({enableFormats:["strikethrough"],markdownTransformers:[Hn],toolbarFixed:{groups:jn},toolbarInline:{groups:jn}});import{$isTableSelection as mu}from"@lexical/table";import{$isRangeSelection as pu,FORMAT_TEXT_COMMAND as fu}from"lexical";import{jsx as Un}from"react/jsx-runtime";import"react";var Gn=()=>Un("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Un("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 13.258C16.7768 14.155 16.1398 14.532 15.2038 15C14.5538 15.325 14.2808 15.546 14.2418 15.78H16.7898V16.82H12.7208V16.339C12.7208 15.286 13.5918 14.675 14.3588 14.233C15.0868 13.83 15.4378 13.635 15.4378 13.232C15.4378 12.894 15.2038 12.686 14.8268 12.686C14.3848 12.686 14.1248 13.024 14.1118 13.427H12.7468C12.8248 12.426 13.5528 11.633 14.8398 11.633C15.9448 11.633 16.7768 12.257 16.7768 13.258Z",fill:"currentColor"})});var Wn=[ee([{ChildComponent:Gn,isActive:({selection:t})=>pu(t)||mu(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(fu,"subscript")},order:5}])],hu=y({enableFormats:["subscript"],toolbarFixed:{groups:Wn},toolbarInline:{groups:Wn}});import{$isTableSelection as gu}from"@lexical/table";import{$isRangeSelection as xu,FORMAT_TEXT_COMMAND as Cu}from"lexical";import{jsx as Vn}from"react/jsx-runtime";import"react";var Kn=()=>Vn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Vn("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 7.252C16.7768 8.149 16.1398 8.526 15.2038 8.994C14.5538 9.319 14.2808 9.54 14.2418 9.774H16.7898V10.814H12.7208V10.333C12.7208 9.28 13.5918 8.669 14.3588 8.227C15.0868 7.824 15.4378 7.629 15.4378 7.226C15.4378 6.888 15.2038 6.68 14.8268 6.68C14.3848 6.68 14.1248 7.018 14.1118 7.421H12.7468C12.8248 6.42 13.5528 5.627 14.8398 5.627C15.9448 5.627 16.7768 6.251 16.7768 7.252Z",fill:"currentColor"})});var Jn=[ee([{ChildComponent:Kn,isActive:({selection:t})=>xu(t)||gu(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(Cu,"superscript")},order:6}])],bu=y({enableFormats:["superscript"],toolbarFixed:{groups:Jn},toolbarInline:{groups:Jn}});import{$isTableSelection as Tu}from"@lexical/table";import{$isRangeSelection as ku,FORMAT_TEXT_COMMAND as Eu}from"lexical";import{jsx as Xn,jsxs as _u}from"react/jsx-runtime";import"react";var zn=()=>_u("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Xn("path",{d:"M13.9656 11.256C13.9656 13.791 12.5096 15.156 10.0006 15.156C7.50461 15.156 6.03561 13.791 6.03561 11.23V5.718H7.76461V11.243C7.76461 12.868 8.50561 13.778 10.0006 13.778C11.4956 13.778 12.2496 12.868 12.2496 11.243V5.718H13.9656V11.256Z",fill:"currentColor"}),Xn("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var Zn=[ee([{ChildComponent:zn,isActive:({selection:t})=>ku(t)||Tu(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(Eu,"underline")},order:3}])],wu=y({enableFormats:["underline"],toolbarFixed:{groups:Zn},toolbarInline:{groups:Zn}});import{jsx as Bo}from"react/jsx-runtime";import{jsx as Nu}from"react/jsx-runtime";function Su(t){return t.replace(/-([a-z])/g,(e,o)=>o.toUpperCase())}var Jt=({css:t})=>{let e=t?Object.fromEntries(Object.entries(t).map(([o,r])=>[Su(o),r])):{};return Nu("span",{style:{...e,alignItems:"center",borderRadius:"4px",display:"flex",fontSize:"16px",height:"20px",justifyContent:"center",width:"20px"},children:"A"})};import{useLexicalComposerContext as Lu}from"@lexical/react/LexicalComposerContext";import{$forEachSelectedTextNode as yu}from"@lexical/selection";import{$getNodeByKey as Iu,$getState as Ru,$setState as vu,createState as Mu,TextNode as Au}from"lexical";import{useEffect as Du}from"react";var $o=new Map;function Yn(t){for(let e in t){let o=t[e],r=Mu(e,{parse:n=>typeof n=="string"&&Object.keys(o).includes(n)?n:void 0});$o.set(e,{stateConfig:r,stateValues:o})}}function Po(t,e,o){t.update(()=>{yu(r=>{let n=$o.get(e);if(!n)throw new Error(`State config for ${e} not found`);vu(r,n.stateConfig,o)})})}function qn(){let[t]=Lu();return Du(()=>t.registerMutationListener(Au,e=>{t.getEditorState().read(()=>{for(let[o,r]of e){if(r==="destroyed")continue;let n=Iu(o),i=t.getElementByKey(o);!n||!i||$o.forEach((l,s)=>{let u=Ru(n,l.stateConfig);if(!u){delete i.dataset[s],i.style.cssText="";return}i.dataset[s]=u;let c=l.stateValues[u]?.css;c&&Object.entries(c).forEach(([d,a])=>{i.style.setProperty(d,a)})})}})}),[t]),null}var Qn=t=>{let e=[];for(let r in t.state){let n=t.state[r];for(let i in n){let l=n[i];e.push({ChildComponent:()=>Bo(Jt,{css:l.css}),key:i,label:l.label,onSelect:({editor:s})=>{Po(s,r,i)}})}}return[{type:"dropdown",ChildComponent:()=>Bo(Jt,{css:{color:"var(--theme-elevation-600)"}}),items:[...[{ChildComponent:()=>Bo(Jt,{}),key:"clear-style",label:"Default style",onSelect:({editor:r})=>{for(let n in t.state)Po(r,n,void 0)},order:1}],...e],key:"textState",order:30}]},Ou=y(({props:t})=>(Yn(t.state),{plugins:[{Component:qn,position:"normal"}],toolbarFixed:{groups:Qn(t)},toolbarInline:{groups:Qn(t)}}));import{$createHeadingNode as Bu,$isHeadingNode as pi,HeadingNode as Hu}from"@lexical/rich-text";import{$setBlocksType as ju}from"@lexical/selection";import{$getSelection as Uu,$isRangeSelection as Gu}from"lexical";import{jsx as ei}from"react/jsx-runtime";import"react";var ti=()=>ei("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:ei("path",{d:"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 oi}from"react/jsx-runtime";import"react";var ri=()=>oi("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:oi("path",{d:"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 ni}from"react/jsx-runtime";import"react";var ii=()=>ni("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:ni("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 li}from"react/jsx-runtime";import"react";var si=()=>li("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:li("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 ai}from"react/jsx-runtime";import"react";var ci=()=>ai("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:ai("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 ui}from"react/jsx-runtime";import"react";var di=()=>ui("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:ui("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 Fu,$isHeadingNode as $u,HeadingNode as Pu}from"@lexical/rich-text";var Ho=t=>(e,o,r)=>{let n=t(r);n&&(n.append(...o),e.replace(n),n.select(0,0))};var mi=t=>{let o=`^(${t.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`,r=new RegExp(o);return{type:"element",dependencies:[Pu],export:(n,i)=>{if(!$u(n))return null;let l=Number(n.getTag().slice(1));return"#".repeat(l)+" "+i(n)},regExp:r,replace:Ho(n=>{let i="h"+n[1]?.length;return Fu(i)})}};var fi=t=>{let e=Uu();ju(e,()=>Bu(t))},hi={h1:ti,h2:ri,h3:ii,h4:si,h5:ci,h6:di},Wu=y(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[ne(e.map((r,n)=>({ChildComponent:hi[r],isActive:({selection:i})=>{if(!Gu(i))return!1;for(let l of i.getNodes()){if(pi(l)&&l.getTag()===r)continue;let s=l.getParent();if(!(pi(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(()=>{fi(r)})},order:n+2})))];return{markdownTransformers:[mi(e)],nodes:[Hu],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[Q(e.map(r=>({Icon:hi[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(()=>{fi(r)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}});import{$isNodeSelection as ld}from"lexical";import{jsx as gi}from"react/jsx-runtime";import"react";var jo=()=>gi("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:gi("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as xi,jsxs as Vu}from"react/jsx-runtime";import"react";var Ci=()=>Vu("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[xi("path",{d:"M5 10h10",stroke:"currentColor"}),xi("path",{d:"M10 15V5",stroke:"currentColor"})]});var _e=t=>({type:"dropdown",ChildComponent:Ci,items:t,key:"add",order:10});import{addClassNamesToElement as Ku}from"@lexical/utils";import{$applyNodeReplacement as Ju,createCommand as Xu,DecoratorNode as zu}from"lexical";var ht=Xu("INSERT_HORIZONTAL_RULE_COMMAND"),ft=class extends zu{static clone(e){return new this(e.__key)}static getType(){return"horizontalrule"}static importDOM(){return{hr:()=>({conversion:Zu,priority:0})}}static importJSON(e){return bi()}createDOM(e){let o=document.createElement("hr");return Ku(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 Zu(){return{node:bi()}}function bi(){return Ju(new ft)}import{$applyNodeReplacement as Yu}from"lexical";import"react";var ve=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 Yu(new ve)}function Xt(t){return t instanceof ve}var _i={type:"element",dependencies:[ve],export:(t,e)=>Xt(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=gt();e&&t.replace(e)}};import{c as qu}from"react/compiler-runtime";import{useLexicalComposerContext as Qu}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as ed}from"@lexical/utils";import{$getSelection as td,$isRangeSelection as od,COMMAND_PRIORITY_EDITOR as rd}from"lexical";import{useEffect as nd}from"react";var Ti=()=>{let t=qu(3),[e]=Qu(),o,r;return t[0]!==e?(o=()=>e.registerCommand(ht,id,rd),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),nd(o,r),null};function id(t){let e=td();if(!od(e))return!1;if(e.focus.getNode()!==null){let r=gt();ed(r)}return!0}var sd=y({markdownTransformers:[_i],nodes:[ve],plugins:[{Component:Ti,position:"normal"}],slashMenu:{groups:[Q([{Icon:jo,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:[_e([{ChildComponent:jo,isActive:({selection:t})=>{if(!ld(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 vi}from"@lexical/utils";import{$isElementNode as _d,INDENT_CONTENT_COMMAND as Td,OUTDENT_CONTENT_COMMAND as kd}from"lexical";import{jsx as zt,jsxs as ad}from"react/jsx-runtime";import"react";var ki=()=>ad("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[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 cd}from"react/jsx-runtime";import"react";var Ei=()=>cd("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 ud}from"react/jsx-runtime";import{useLexicalComposerContext as dd}from"@lexical/react/LexicalComposerContext";import{TabIndentationPlugin as md}from"@lexical/react/LexicalTabIndentationPlugin";import{$findMatchingParent as pd,mergeRegister as wi}from"@lexical/utils";import{$getSelection as fd,$isElementNode as yi,$isRangeSelection as hd,COMMAND_PRIORITY_LOW as Ni,INDENT_CONTENT_COMMAND as Si,KEY_TAB_COMMAND as gd,OUTDENT_CONTENT_COMMAND as xd,TabNode as Cd}from"lexical";import{useEffect as Li}from"react";var Ii=({clientProps:t})=>{let[e]=dd(),{disabledNodes:o,disableTabNode:r}=t;return Li(()=>{if(!(!e||!o?.length))return wi(e.registerCommand(Si,()=>bd(n=>{if(!o.includes(n.getType())){let i=n.getIndent();n.setIndent(i+1)}}),Ni),e.registerUpdateListener(({dirtyElements:n,editorState:i})=>{e.update(()=>{for(let[l]of n){let s=i._nodeMap.get(l);yi(s)&&o.includes(s.getType())&&s.getIndent()>0&&s.setIndent(0)}})}))},[e,o]),Li(()=>{if(!(!e||!r))return wi(e.registerCommand(gd,n=>(n.preventDefault(),e.dispatchCommand(n.shiftKey?xd:Si,void 0)),Ni),e.registerNodeTransform(Cd,n=>{n.remove()}))},[e,r]),ud(md,{})};function bd(t){let e=fd();if(!hd(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=pd(i,c=>yi(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 Ri=t=>({type:"buttons",items:t,key:"indent",order:35});var Mi=({disabledNodes:t})=>[Ri([{ChildComponent:ki,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>Ai(n)&&n.getIndent()>0;return o.some(n=>r(n)||!!vi(n,r))},key:"indentDecrease",label:({i18n:e})=>e.t("lexical:indent:decreaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(kd,void 0)},order:1},{ChildComponent:Ei,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>Ai(n)&&!(t??[]).includes(n.getType());return o.some(n=>r(n)||!!vi(n,r))},key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Td,void 0)},order:2}])],Ed=y(({props:t})=>{let e=t.disabledNodes??[];return{plugins:[{Component:Ii,position:"normal"}],sanitizedClientFeatureProps:t,toolbarFixed:{groups:Mi({disabledNodes:e})},toolbarInline:{groups:Mi({disabledNodes:e})}}}),Ai=t=>_d(t)&&t.canIndent();import{$findMatchingParent as Om}from"@lexical/utils";import{$getSelection as Zo,$isRangeSelection as ul}from"lexical";import{jsx as Di}from"react/jsx-runtime";import"react";var Oi=()=>Di("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:Di("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 Fi}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()?Fi(o)?r:n:Fi(e)?r:n}var Uo=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as Dd}from"lexical";import{addClassNamesToElement as wd,isHTMLAnchorElement as Nd}from"@lexical/utils";import Vo from"bson-objectid";import{$applyNodeReplacement as Sd,$createTextNode as $i,$getSelection as Ld,$isElementNode as Pi,$isRangeSelection as Wo,createCommand as yd,ElementNode as Id}from"lexical";var Rd=new Set(["http:","https:","mailto:","sms:","tel:"]),ie=class t extends Id{__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:vd,priority:1})}}static importJSON(e){let o=Te({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),e.version===2&&!e.id&&(e.id=new Vo.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=Go(o.rel,"add","noopener")),wd(o,e.theme.link),o}exportJSON(){let e=this.getFields();e?.linkType==="internal"?delete e.url:e?.linkType==="custom"&&delete e.doc;let o={...super.exportJSON(),type:"link",fields:e,version:3},r=this.getID();return r&&(o.id=r),o}extractWithChild(e,o,r){if(!Wo(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(Pi(r)){let n=Te({fields:this.__fields});return r.append(n),n}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!Rd.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=Go(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=Go(o.rel,"remove","noopener"))),!1}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields).setID(e.id)}};function vd(t){let e=null;if(Nd(t)){let o=t.textContent;o!==null&&o!==""&&(e=Te({id:new Vo.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function Te({id:t,fields:e}){return Sd(new ie({id:t??new Vo.default().toHexString(),fields:e}))}function Z(t){return t instanceof ie}var he=yd("TOGGLE_LINK_COMMAND");function Ko(t){let e=Ld();if(!Wo(e)&&(t===null||!t.selectedNodes?.length))return;let o=Wo(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:Md(i);if(l!==null){l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append($i(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||Pi(i)&&!i.isInline())){if(Z(l)){n=l,l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append($i(t.text)),l.getChildren().forEach(s=>{s!==l.getLastChild()&&s.remove()}));return}if(l.is(r)||(r=l,n=Te({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 Md(t){return Ad(t,e=>Z(e))}function Ad(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function Go(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 Bi={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=Te({fields:{doc:null,linkType:"custom",newTab:!1,url:r}}),i=Dd(o);return i.setFormat(t.getFormat()),n.append(i),t.replace(n),i},trigger:")"};import{$applyNodeReplacement as Od,$isElementNode as Fd}from"lexical";var ke=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=xt({}).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(Fd(r)){let n=xt({fields:this.__fields});return r.append(n),n}return null}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields)}};function xt({fields:t}){return Od(new ke({id:"",fields:t}))}function Ee(t){return t instanceof ke}import{c as $d}from"react/compiler-runtime";import{useLexicalComposerContext as Pd}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Bd}from"@lexical/utils";import{$createTextNode as Hi,$getSelection as Hd,$isElementNode as Ui,$isLineBreakNode as Gi,$isNodeSelection as jd,$isRangeSelection as Ud,$isTextNode as Ct,TextNode as Gd}from"lexical";import{useEffect as Wd}from"react";function ji(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 Wi(t,e){for(let o of e){let r=o(t);if(r!=null)return r}return null}var Vd=/[.,;\s]/;function qt(t){return t!==void 0&&Vd.test(t)}function Vi(t){return qt(t[t.length-1])}function Xo(t){return qt(t[0])}function Kd(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function Ki(t){let e=t.getPreviousSibling();return Ui(e)&&(e=e.getLastDescendant()),e===null||Gi(e)||Ct(e)&&Vi(e.getTextContent())}function Ji(t){let e=t.getNextSibling();return Ui(e)&&(e=e.getFirstDescendant()),e===null||Gi(e)||Ct(e)&&Xo(e.getTextContent())}function Jd(t,e,o,r){return(t>0?qt(o[t-1]):Ki(r[0]))?e<o.length?qt(o[e]):Ji(r[r.length-1]):!1}function Xd(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 zd(t,e,o,r){let n={linkType:"custom",url:r.url,...r.fields},i=xt({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=Hi(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[x,_]=a.splitText(o-f);x&&c.push(x),d=_}s+=m}),u){let a=Hd(),p=a?a.getNodes().find(Ct):void 0,m=Hi(u.getTextContent());return m.setFormat(u.getFormat()),m.setDetail(u.getDetail()),m.setStyle(u.getStyle()),i.append(m,...c),p&&p===u&&(Ud(a)?m.select(a.anchor.offset,a.focus.offset):jd(a)&&m.select(0,m.getTextContent().length)),u.replace(i),d}}}function Zd(t,e,o){let r=[...t],n=r.map(u=>u.getTextContent()).join(""),i=n,l,s=0;for(;(l=Wi(i,e))!=null&&l!==null;){let u=l.index,c=l.length,d=u+c;if(Jd(s+u,s+d,n,r)){let[p,,m,f]=Xd(r,s+u,s+d),h=s+u-p,x=s+d-p,_=zd(m,h,x,l);r=_?[_,...f]:f,o(l.url,null),s=0}else s+=d;i=i.substring(d)}}function Jo(t,e,o){let r=t.getChildren(),n=r.length;for(let u=0;u<n;u++){let c=r[u];if(!Ct(c)||!c.isSimpleText()){Yt(t),o(null,t.getFields()?.url??null);return}}let i=t.getTextContent(),l=Wi(i,e);if(l===null||l.text!==i){Yt(t),o(null,t.getFields()?.url??null);return}if(!Ki(t)||!Ji(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 Yd(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;(!Xo(i)||Kd(i,l))&&(r.append(t),Jo(r,e,o),o(null,r.getFields()?.url??null))}Ee(n)&&!Vi(i)&&(Yt(n),Jo(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 qd(t){let e=[t],o=t.getNextSibling();for(;o!==null&&Ct(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function Qd(t,e,o){let r=$d(5),n,i;r[0]!==t||r[1]!==e||r[2]!==o?(n=()=>{if(!t.hasNodes([ke]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let l=(s,u)=>{o?.(s,u)};return Bd(t.registerNodeTransform(Gd,s=>{let u=s.getParentOrThrow(),c=s.getPreviousSibling();if(Ee(u))Jo(u,e,l);else if(!Z(u)){if(s.isSimpleText()&&(Xo(s.getTextContent())||!Ee(c))){let d=qd(s);Zd(d,e,l)}Yd(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]),Wd(n,i)}var em=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,tm=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,om=[ji(em,t=>t.startsWith("http")?t:`https://${t}`),ji(tm,t=>`mailto:${t}`)],Xi=()=>{let[t]=Pd();return Qd(t,om),null};import{jsx as rm}from"react/jsx-runtime";import{ClickableLinkPlugin as nm}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var zi=()=>rm(nm,{});import{jsx as km}from"react/jsx-runtime";import"react";import{createPortal as Em}from"react-dom";import{jsx as we,jsxs as bt,Fragment as lm}from"react/jsx-runtime";import{useLexicalComposerContext as sm}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as Zi,mergeRegister as Yi}from"@lexical/utils";import{getTranslation as zo}from"@payloadcms/translations";import{CloseMenuIcon as am,EditIcon as cm,ExternalLinkIcon as qi,formatDrawerSlug as um,useConfig as dm,useEditDepth as mm,useLocale as pm,useTranslation as fm}from"@payloadcms/ui";import{requests as hm}from"@payloadcms/ui/shared";import{$getSelection as Qi,$isLineBreakNode as gm,$isRangeSelection as el,COMMAND_PRIORITY_HIGH as xm,COMMAND_PRIORITY_LOW as tl,getDOMSelection as Cm,KEY_ESCAPE_COMMAND as bm,SELECTION_CHANGE_COMMAND as _m}from"lexical";import ol,{useCallback as rl,useEffect as to,useRef as Tm,useState as Pe}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 im}from"lexical";var eo=im("TOGGLE_LINK_WITH_MODAL_COMMAND");function nl(t){t.preventDefault()}function il({anchorElem:t}){let[e]=sm(),[o,r]=Pe(),n=Tm(null),[i,l]=Pe(null),[s,u]=Pe(null),{fieldProps:{schemaPath:c},uuid:d}=U(),{config:a,getEntityConfig:p}=dm(),{i18n:m,t:f}=fm(),[h,x]=Pe(),_=mm(),[I,A]=Pe(!1),[b,T]=Pe([]),g=pm(),[E,M]=Pe(!1),D=um({slug:"lexical-rich-text-link-"+d,depth:_}),{toggleDrawer:P}=xe(D),v=rl(()=>{A(!1),n&&n.current&&(n.current.style.opacity="0",n.current.style.transform="translate(-10000px, -10000px)"),M(!1),l(null),u(null),T([]),x(void 0)},[A,l,u,T]),N=rl(()=>{let C=Qi(),w;if(!el(C)||!C){v();return}let L=Xe(C);w=e.getElementByKey(L.getKey())?.getBoundingClientRect();let S=Zi(L,Z),R=C.getNodes().filter(H=>!gm(H)).find(H=>{let j=Zi(H,Z);return S&&!S.is(j)||j&&!j.is(S)});if(S==null||R){v();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 H=k?.doc?.relationTo?p({collectionSlug:k?.doc?.relationTo}):void 0;if(!H)u(k?.label?String(k?.label):null),l(k?.url?String(k?.url):null);else{let j=typeof k.doc?.value=="object"?k.doc.value.id:k.doc?.value,te=k.doc?.relationTo;if(!j||!te)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let ce=f("fields:linkedTo",{label:`${zo(H.labels.singular,m)} - ${f("lexical:link:loadingWithEllipsis",m)}`}).replace(/<[^>]*>?/g,"");u(ce),hm.get(`${a.serverURL}${a.routes.api}/${te}/${j}`,{headers:{"Accept-Language":m.language},params:{depth:0,locale:g?.code}}).then(async Y=>{if(!Y.ok)throw new Error(`HTTP error! Status: ${Y.status}`);let K=await Y.json(),oe=H?.admin?.useAsTitle||"id",re=K[oe],le=f("fields:linkedTo",{label:`${zo(H.labels.singular,m)} - ${re}`}).replace(/<[^>]*>?/g,"");u(le)}).catch(()=>{let Y=f("fields:linkedTo",{label:`${zo(H.labels.singular,m)} - ${f("general:untitled",m)} - ID: ${j}`}).replace(/<[^>]*>?/g,"");u(Y)})}}x(F),A(!0),T(C?C?.getNodes():[]),Ee(S)?M(!0):M(!1);let $=n.current,G=Cm(e._window),{activeElement:V}=document;if($===null)return;let pe=e.getRootElement();return G!==null&&pe!==null&&pe.contains(G.anchorNode)?(w||(w=G.getRangeAt(0).getBoundingClientRect()),w!=null&&(w.y+=40,Qt(w,$,t))):(V==null||V.className!=="link-input")&&(pe!==null&&Qt(null,$,t),l(null),u(null)),!0},[e,v,a.routes.admin,a.routes.api,a.serverURL,p,f,m,g?.code,t]);return to(()=>Yi(e.registerCommand(eo,C=>(e.dispatchCommand(he,C),N(),P(),!0),tl)),[e,N,P,D]),to(()=>{let C=t.parentElement,w=()=>{e.getEditorState().read(()=>{N()})};return window.addEventListener("resize",w),C?.addEventListener("scroll",w),()=>{window.removeEventListener("resize",w),C?.removeEventListener("scroll",w)}},[t.parentElement,e,N]),to(()=>Yi(e.registerUpdateListener(({editorState:C})=>{C.read(()=>{N()})}),e.registerCommand(_m,()=>(N(),!0),tl),e.registerCommand(bm,()=>I?(v(),!0):!1,xm)),[e,N,I,v]),to(()=>{e.getEditorState().read(()=>{N()})},[e,N]),bt(ol.Fragment,{children:[we("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?we(qi,{}):null,s!=null&&s.length>0?s:i]}):s!=null&&s.length>0?bt(lm,{children:[o?.__fields.newTab?we(qi,{}):null,we("span",{className:"link-input__label-pure",children:s})]}):null,e.isEditable()&&bt(ol.Fragment,{children:[we("button",{"aria-label":"Edit link",className:"link-edit",onClick:C=>{C.preventDefault(),P()},onMouseDown:nl,tabIndex:0,type:"button",children:we(cm,{})}),!E&&we("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(he,null)},onMouseDown:nl,tabIndex:0,type:"button",children:we(am,{})})]})]})}),we(lt,{className:"lexical-link-edit-drawer",data:h,drawerSlug:D,drawerTitle:f("fields:editLink"),featureKey:"link",handleDrawerSubmit:(C,w)=>{let L=w,S={...L};delete S.text,e.update(()=>{let R=Qi(),k=null;if(el(R)?k=Xe(R).getParent():b.length&&(k=b[0]?.getParent()??null),k&&Ee(k)){let F=Te({fields:S});k.replace(F,!0)}}),e.dispatchCommand(he,{fields:S,selectedNodes:b,text:L.text})},schemaPath:c,schemaPathSuffix:"fields"})]})}var ll=t=>{let{anchorElem:e=document.body}=t;return Em(km(il,{anchorElem:e}),e)};import{c as Sm}from"react/compiler-runtime";import{useLexicalComposerContext as Lm}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as ym}from"@lexical/utils";import{$getSelection as Im,$isElementNode as Rm,$isRangeSelection as vm,COMMAND_PRIORITY_LOW as al,PASTE_COMMAND as Mm}from"lexical";import{useEffect as Am}from"react";var wm=/^(?:[a-zA-Z][a-zA-Z\d+.-]*:(?:\/\/)?(?:[-;:&=+$,\w]+@)?[A-Za-z\d]+(?:\.[A-Za-z\d]+)+|www\.[A-Za-z\d]+(?:\.[A-Za-z\d]+)+|(?:tel|mailto):[\w+.-]+)(?:\/[+~%/\w-]*)?(?:\?[-;&=%\w]*)?(?:#\w+)?$/,Nm=/^(?:\/[\w\-./]*(?:#\w[\w-]*)?|#[\w\-]+)$/;function sl(t){if(!t)return!1;if(t==="https://"||wm.test(t)||Nm.test(t))return!0;try{return new URL(t),!0}catch{}return!1}var cl=t=>{let e=Sm(5),{clientProps:o}=t,[r]=Lm(),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 ym(r.registerCommand(he,l=>l===null?(Ko(null),!0):(l.fields?.linkType||(l.fields.linkType=o.defaultLinkType),l.fields?.url||(l.fields.url=o.defaultLinkURL),Ko(l),!0),al),r.registerCommand(Mm,l=>{let s=Im();if(!vm(s)||s.isCollapsed()||!(l instanceof ClipboardEvent)||l.clipboardData==null)return!1;let u=l.clipboardData.getData("text");if(!sl(u))return!1;if(!s.getNodes().some(Dm)){let c={doc:null,linkType:"custom",newTab:!1,url:u};return r.dispatchCommand(he,{fields:c,text:null}),l.preventDefault(),!0}return!1},al))},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]),Am(n,i),null};function Dm(t){return Rm(t)}var dl=[Uo([{ChildComponent:Oi,isActive:({selection:t})=>{if(ul(t)){let e=Xe(t);return Om(e,Z)!=null}return!1},isEnabled:({selection:t})=>!!(ul(t)&&Zo()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(he,null);else{let o,r=[];if(t.getEditorState().read(()=>{o=Zo()?.getTextContent(),r=Zo()?.getNodes()??[]}),!o?.length)return;let n={doc:null};t.dispatchCommand(eo,{fields:n,selectedNodes:r,text:o})}},order:1}])],Fm=y(({props:t})=>({markdownTransformers:[Bi],nodes:[ie,t?.disableAutoLinks===!0?null:ke].filter(Boolean),plugins:[{Component:cl,position:"normal"},t?.disableAutoLinks===!0||t?.disableAutoLinks==="creationOnly"?null:{Component:Xi,position:"normal"},{Component:zi,position:"normal"},{Component:ll,position:"floatingAnchorElem"}].filter(Boolean),sanitizedClientFeatureProps:t,toolbarFixed:{groups:dl},toolbarInline:{groups:dl}}));import{$isListNode as Qo,INSERT_CHECK_LIST_COMMAND as xl,ListItemNode as Xm,ListNode as zm}from"@lexical/list";import{$isRangeSelection as Zm}from"lexical";import{jsx as ml,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:[ml("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),ml("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Pm}from"react/jsx-runtime";import{ListPlugin as Bm}from"@lexical/react/LexicalListPlugin.js";import"react";var ze=()=>Pm(Bm,{});function Ze(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as Gm,ListItemNode as Wm,ListNode as Vm}from"@lexical/list";import{$createListItemNode as Hm,$createListNode as jm,$isListItemNode as Um,$isListNode as qo}from"@lexical/list";var pl=4,Ye=t=>(e,o,r)=>{let n=e.getPreviousSibling(),i=e.getNextSibling(),l=Hm(t==="check"?r[3]==="x":void 0);if(qo(i)&&i.getListType()===t){let u=i.getFirstChild();u!==null?u.insertBefore(l):i.append(l),e.remove()}else if(qo(n)&&n.getListType()===t)n.append(l),e.remove();else{let u=jm(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/pl);s&&l.setIndent(s)},Be=(t,e,o)=>{let r=[],n=t.getChildren(),i=0;for(let l of n)if(Um(l)){if(l.getChildrenSize()===1){let d=l.getFirstChild();if(qo(d)){r.push(Be(d,e,o+1));continue}}let s=" ".repeat(o*pl),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 fl={type:"element",dependencies:[Vm,Wm],export:(t,e)=>Gm(t)?Be(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:Ye("check")};import{jsx as Km}from"react/jsx-runtime";import{CheckListPlugin as Jm}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var hl=()=>Km(Jm,{});var gl=[ne([{ChildComponent:Yo,isActive:({selection:t})=>{if(!Zm(t))return!1;for(let e of t.getNodes()){if(Qo(e)&&e.getListType()==="check")continue;let o=e.getParent();if(Qo(o)&&o.getListType()==="check")continue;let r=o?.getParent();if(!(Qo(r)&&r.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(xl,void 0)},order:12}])],Ym=y(({featureProviderMap:t})=>{let e=[{Component:hl,position:"normal"}];return!t.has("unorderedList")&&!t.has("orderedList")&&e.push({Component:ze,position:"normal"}),{markdownTransformers:[fl],nodes:t.has("unorderedList")||t.has("orderedList")?[]:[zm,Xm],plugins:e,slashMenu:{groups:[Ze([{Icon:Yo,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:o})=>o.t("lexical:checklist:label"),onSelect:({editor:o})=>{o.dispatchCommand(xl,void 0)}}])]},toolbarFixed:{groups:gl},toolbarInline:{groups:gl}}});import{$isListNode as tr,INSERT_ORDERED_LIST_COMMAND as _l,ListItemNode as op,ListNode as rp}from"@lexical/list";import{$isRangeSelection as np}from"lexical";import{jsx as _t,jsxs as qm}from"react/jsx-runtime";import"react";var er=()=>qm("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 Qm,ListItemNode as ep,ListNode as tp}from"@lexical/list";var Cl={type:"element",dependencies:[tp,ep],export:(t,e)=>Qm(t)?Be(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:Ye("number")};var bl=[ne([{ChildComponent:er,isActive:({selection:t})=>{if(!np(t))return!1;for(let e of t.getNodes()){if(tr(e)&&e.getListType()==="number")continue;let o=e.getParent();if(tr(o)&&o.getListType()==="number")continue;let r=o?.getParent();if(!(tr(r)&&r.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(_l,void 0)},order:10}])],ip=y(({featureProviderMap:t})=>({markdownTransformers:[Cl],nodes:t.has("orderedList")?[]:[rp,op],plugins:t.has("orderedList")?[]:[{Component:ze,position:"normal"}],slashMenu:{groups:[Ze([{Icon:er,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:e})=>e.t("lexical:orderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(_l,void 0)}}])]},toolbarFixed:{groups:bl},toolbarInline:{groups:bl}}));import{$isListNode as rr,INSERT_UNORDERED_LIST_COMMAND as El,ListItemNode as up,ListNode as dp}from"@lexical/list";import{$isRangeSelection as mp}from"lexical";import{jsx as qe,jsxs as lp}from"react/jsx-runtime";import"react";var or=()=>lp("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[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 sp,ListItemNode as ap,ListNode as cp}from"@lexical/list";var Tl={type:"element",dependencies:[cp,ap],export:(t,e)=>sp(t)?Be(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:Ye("bullet")};var kl=[ne([{ChildComponent:or,isActive:({selection:t})=>{if(!mp(t))return!1;for(let e of t.getNodes()){if(rr(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(rr(o)&&o.getListType()==="bullet")continue;let r=o?.getParent();if(!(rr(r)&&r.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(El,void 0)},order:11}])],pp=y({markdownTransformers:[Tl],nodes:[dp,up],plugins:[{Component:ze,position:"normal"}],slashMenu:{groups:[Ze([{Icon:or,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(El,void 0)}}])]},toolbarFixed:{groups:kl},toolbarInline:{groups:kl}});import{jsx as fp}from"react/jsx-runtime";import{addClassNamesToElement as hp}from"@lexical/utils";import{DecoratorNode as gp}from"lexical";import*as wl from"react";var xp=wl.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),Tt=class t extends gp{__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 hp(o,"unknownConverted"),o}decorate(){return fp(xp,{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 Tt({data:t})}var bp=y(()=>({nodes:[Tt]}));import{jsx as _p}from"react/jsx-runtime";import{addClassNamesToElement as Tp}from"@lexical/utils";import{DecoratorNode as kp}from"lexical";import*as Nl from"react";var Ep=Nl.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),kt=class t extends kp{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new t({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return wp({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return Tp(o,"unknownConverted"),o}decorate(){return _p(Ep,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function wp({data:t}){return new kt({data:t})}var Np=y(()=>({nodes:[kt]}));import{$setBlocksType as yl}from"@lexical/selection";import{$createParagraphNode as Il,$getSelection as Rl,$isParagraphNode as Sl,$isRangeSelection as Sp}from"lexical";var Ll=[ne([{ChildComponent:at,isActive:({selection:t})=>{if(!Sp(t))return!1;for(let e of t.getNodes())if(!Sl(e)&&!Sl(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=Rl();yl(e,()=>Il())})},order:1}])],Lp=y({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=Rl();yl(e,()=>Il())})}}])]},toolbarFixed:{groups:Ll},toolbarInline:{groups:Ll}});import{c as Xp}from"react/compiler-runtime";import{jsx as zp}from"react/jsx-runtime";import{useLexicalComposerContext as Zp}from"@lexical/react/LexicalComposerContext";import{useEffect as Yp,useState as qp}from"react";import{jsx as zl,Fragment as Jp}from"react/jsx-runtime";import"react";import{jsx as yp}from"react/jsx-runtime";var vl={quote:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return yp("blockquote",{children:o})}};import{jsx as Ip}from"react/jsx-runtime";var Ml={heading:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.tag;return Ip(r,{children:o})}};import{jsx as Rp}from"react/jsx-runtime";var Al={horizontalrule:Rp("hr",{})};import{jsx as vp}from"react/jsx-runtime";var Dl={linebreak:vp("br",{})};import{jsx as Ol}from"react/jsx-runtime";var Fl=({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 Ol("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="#")),Ol("a",{href:l,rel:n,target:i,children:r})}});import{jsx as Qe,jsxs as Mp,Fragment as Ap}from"react/jsx-runtime";import{v4 as Dp}from"uuid";var $l={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=Dp();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:Mp(Ap,{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 nr}from"react/jsx-runtime";var Pl={paragraph:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return o?.length?nr("p",{children:o}):nr("p",{children:nr("br",{})})}};var Bl={tab:" "};import{jsx as Et}from"react/jsx-runtime";var Hl={table:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return Et("div",{className:"lexical-table-container",children:Et("table",{className:"lexical-table",style:{borderCollapse:"collapse"},children:Et("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 Et(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 Et("tr",{className:"lexical-table-row",children:o})}};import{jsx as He}from"react/jsx-runtime";import"react";var O={DOM_ELEMENT_TYPE:1,DOM_TEXT_TYPE:3,NO_DIRTY_NODES:0,HAS_DIRTY_NODES:1,FULL_RECONCILE:2,IS_NORMAL:0,IS_TOKEN:1,IS_SEGMENTED:2,IS_INERT:3,IS_BOLD:1,IS_ITALIC:2,IS_STRIKETHROUGH:4,IS_UNDERLINE:8,IS_CODE:16,IS_SUBSCRIPT:32,IS_SUPERSCRIPT:64,IS_HIGHLIGHT:128,IS_DIRECTIONLESS:1,IS_UNMERGEABLE:2,IS_ALIGN_LEFT:1,IS_ALIGN_CENTER:2,IS_ALIGN_RIGHT:3,IS_ALIGN_JUSTIFY:4,IS_ALIGN_START:5,IS_ALIGN_END:6},Op=O.IS_BOLD|O.IS_ITALIC|O.IS_STRIKETHROUGH|O.IS_UNDERLINE|O.IS_CODE|O.IS_SUBSCRIPT|O.IS_SUPERSCRIPT|O.IS_HIGHLIGHT,Fp="\xA0",$p=`
|
|
34
|
+
`},[t,e]),m=Fe((b,_)=>{o(g=>{let w=e.length-1,M=e[w];if(M&&M.name===b){if(b==="type")return[...e.slice(0,w),{...M,value:M.value+_}];if(M.value===_)return[...e.slice(0,w),{...M,count:M.count+1}]}return[...g,{name:b,count:1,value:_}]})},[e,o]);xn(()=>{let b=g=>{if(!r)return;let w=g.key;Hc(g)?m("selectAll",""):bn.has(w)?m("press",g.key):[...w].length>1?m("keydown",g.key):m("type",g.key)},_=g=>{if(!r)return;let w=g.key;!bn.has(w)&&[...w].length>1&&m("keyup",g.key)};return t.registerRootListener((g,w)=>{w!==null&&(w.removeEventListener("keydown",b),w.removeEventListener("keyup",_)),g!==null&&(g.addEventListener("keydown",b),g.addEventListener("keyup",_))})},[t,r,m]),xn(()=>{d.current&&d.current.scrollTo(0,d.current.scrollHeight)},[p]),Oo(()=>{if(e){let b=p();b!==null&&s(b),d.current&&d.current.scrollTo(0,d.current.scrollHeight)}},[p,e]),Oo(()=>t.registerUpdateListener(({dirtyElements:_,dirtyLeaves:g,editorState:w})=>{if(!r)return;let M=w._selection,D=u.current,P=c.current;if(D!==M){if(g.size===0&&_.size===0&&!P){let N=Do(t._window);if(N&&(N.anchorNode==null||N.focusNode==null))return}u.current=M}c.current=!1;let v=p();v!==null&&s(v)}),[t,p,r,m]),Oo(()=>r?t.registerUpdateListener(()=>{let _=t.getRootElement();_!==null&&l(_?.innerHTML)}):void 0,[t,r]);let f=Fe(b=>{r||(b.update(()=>{let _=$c();_.clear();let g=Oc();_.append(Dc().append(g)),g.select()}),o([])),n(_=>!_)},[r]),h=Fe(()=>{if(!r)return;let b=Do(t._window);if(b===null||b.anchorNode==null||b.focusNode==null)return;let{anchorNode:_,anchorOffset:g,focusNode:w,focusOffset:M}=jc(b),D=a().getRootElement(),P;_!==null&&(P=Cn(_,D));let v;w!==null&&(v=Cn(w,D)),m("snapshot",{anchorNode:_,anchorOffset:g,anchorPath:P,focusNode:w,focusOffset:M,focusPath:v})},[m,r,a]),x=Fe(()=>{Fc(p())},[p]),k=Fe(()=>{Pc("test.js",p())},[p]);return[Pe("button",{className:`editor-dev-button ${r?"active":""}`,id:"test-recorder-button",onClick:b=>{f(a()),b.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:[Pe("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:b=>{h(),b.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),Pe("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:b=>{x(),b.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),Pe("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:b=>{k(),b.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),Pe("pre",{id:"test-recorder",ref:d,children:i})]}):null]}var _n=()=>{let t=Mc(3),[e]=Ac(),[o,r]=Uc(e),n;return t[0]!==o||t[1]!==r?(n=Fo(kn.Fragment,{children:[Pe("p",{children:"HI"}),o,r,Pe("p",{children:"DONE"})]}),t[0]=o,t[1]=r,t[2]=n):n=t[2],n};var Gc=y({plugins:[{Component:_n,position:"bottom"}]});import{c as Wc}from"react/compiler-runtime";import{jsx as Vc}from"react/jsx-runtime";import{useLexicalComposerContext as Kc}from"@lexical/react/LexicalComposerContext.js";import{TreeView as Jc}from"@lexical/react/LexicalTreeView.js";import"react";var Tn=()=>{let t=Wc(2),[e]=Kc(),o;return t[0]!==e?(o=Vc(Jc,{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 Xc=y({plugins:[{Component:Tn,position:"bottom"}]});import{$isTableSelection as zc}from"@lexical/table";import{$isRangeSelection as Zc,FORMAT_TEXT_COMMAND as Yc}from"lexical";import{jsx as wn}from"react/jsx-runtime";import"react";var En=()=>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:"M10.6772 15H6.27017V5.718H10.4172C12.6792 5.718 13.8492 6.602 13.8492 8.292C13.8492 9.098 13.1992 9.982 12.4712 10.216C13.3812 10.476 14.1742 11.256 14.1742 12.322C14.1742 14.09 12.9002 15 10.6772 15ZM8.46717 9.501H10.3262C11.3012 9.501 11.7042 9.046 11.7042 8.409C11.7042 7.72 11.2362 7.317 10.3392 7.317H8.46717V9.501ZM8.46717 11.061V13.401H10.4822C11.4702 13.401 11.9642 12.959 11.9642 12.218C11.9642 11.49 11.4702 11.061 10.4822 11.061H8.46717Z",fill:"currentColor"})});var te=t=>({type:"buttons",items:t,key:"format",order:40});var Nn={type:"text-format",format:["bold","italic"],tag:"***"},Sn={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},Ln={type:"text-format",format:["bold"],tag:"**"},yn={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var In=[te([{ChildComponent:En,isActive:({selection:t})=>Zc(t)||zc(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(Yc,"bold")},order:1}])],qc=y(({featureProviderMap:t})=>{let e=[Ln,yn];return t.get("italic")&&e.push(Sn,Nn),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:In},toolbarInline:{groups:In}}});import{$isTableSelection as eu}from"@lexical/table";import{$isRangeSelection as tu,FORMAT_TEXT_COMMAND as ou}from"lexical";import{jsx as Rn,jsxs as Qc}from"react/jsx-runtime";import"react";var vn=()=>Qc("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Rn("path",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),Rn("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var Mn={type:"text-format",format:["code"],tag:"`"};var An=[te([{ChildComponent:vn,isActive:({selection:t})=>tu(t)||eu(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(ou,"code")},order:7}])],ru=y({enableFormats:["code"],markdownTransformers:[Mn],toolbarFixed:{groups:An},toolbarInline:{groups:An}});import{$isTableSelection as nu}from"@lexical/table";import{$isRangeSelection as lu,FORMAT_TEXT_COMMAND as iu}from"lexical";import{jsx as Dn}from"react/jsx-runtime";import"react";var On=()=>Dn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Dn("path",{d:"M11.311 14.2969L11.0327 15H6.18408L6.4624 14.2969C7.54639 14.2969 7.70752 14.209 7.83936 13.8721L10.8423 6.45996C10.8716 6.38672 10.8862 6.32812 10.8862 6.26953C10.8862 6.09375 10.6519 6.03516 9.80225 6.03516L10.0952 5.33203H14.9438L14.6509 6.03516C13.5669 6.03516 13.4204 6.12305 13.2886 6.45996L10.2856 13.8721C10.2563 13.9453 10.2271 14.0039 10.2271 14.0625C10.2271 14.2383 10.4614 14.2969 11.311 14.2969Z",fill:"currentColor"})});var $n={type:"text-format",format:["italic"],tag:"*"},Fn={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var Pn=[te([{ChildComponent:On,isActive:({selection:t})=>lu(t)||nu(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(iu,"italic")},order:2}])],su=y({enableFormats:["italic"],markdownTransformers:[$n,Fn],toolbarFixed:{groups:Pn},toolbarInline:{groups:Pn}});import{$isTableSelection as cu}from"@lexical/table";import{$isRangeSelection as uu,FORMAT_TEXT_COMMAND as du}from"lexical";import{jsx as Bn,jsxs as au}from"react/jsx-runtime";import"react";var Hn=()=>au("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Bn("path",{d:"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"}),Bn("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var jn={type:"text-format",format:["strikethrough"],tag:"~~"};var Un=[te([{ChildComponent:Hn,isActive:({selection:t})=>uu(t)||cu(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(du,"strikethrough")},order:4}])],mu=y({enableFormats:["strikethrough"],markdownTransformers:[jn],toolbarFixed:{groups:Un},toolbarInline:{groups:Un}});import{$isTableSelection as pu}from"@lexical/table";import{$isRangeSelection as fu,FORMAT_TEXT_COMMAND as hu}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 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 Vn=[te([{ChildComponent:Wn,isActive:({selection:t})=>fu(t)||pu(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(hu,"subscript")},order:5}])],gu=y({enableFormats:["subscript"],toolbarFixed:{groups:Vn},toolbarInline:{groups:Vn}});import{$isTableSelection as xu}from"@lexical/table";import{$isRangeSelection as Cu,FORMAT_TEXT_COMMAND as bu}from"lexical";import{jsx as Kn}from"react/jsx-runtime";import"react";var Jn=()=>Kn("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:"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 Xn=[te([{ChildComponent:Jn,isActive:({selection:t})=>Cu(t)||xu(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(bu,"superscript")},order:6}])],ku=y({enableFormats:["superscript"],toolbarFixed:{groups:Xn},toolbarInline:{groups:Xn}});import{$isTableSelection as Tu}from"@lexical/table";import{$isRangeSelection as wu,FORMAT_TEXT_COMMAND as Eu}from"lexical";import{jsx as zn,jsxs as _u}from"react/jsx-runtime";import"react";var Zn=()=>_u("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[zn("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"}),zn("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var Yn=[te([{ChildComponent:Zn,isActive:({selection:t})=>wu(t)||Tu(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(Eu,"underline")},order:3}])],Nu=y({enableFormats:["underline"],toolbarFixed:{groups:Yn},toolbarInline:{groups:Yn}});import{jsx as Ho}from"react/jsx-runtime";import{jsx as Su}from"react/jsx-runtime";function Lu(t){return t.replace(/-([a-z])/g,(e,o)=>o.toUpperCase())}var Xt=({css:t})=>{let e=t?Object.fromEntries(Object.entries(t).map(([o,r])=>[Lu(o),r])):{};return Su("span",{style:{...e,alignItems:"center",borderRadius:"4px",display:"flex",fontSize:"16px",height:"20px",justifyContent:"center",width:"20px"},children:"A"})};import{useLexicalComposerContext as yu}from"@lexical/react/LexicalComposerContext";import{$forEachSelectedTextNode as Iu}from"@lexical/selection";import{$getNodeByKey as Ru,$getState as vu,$setState as Mu,createState as Au,TextNode as Du}from"lexical";import{useEffect as Ou}from"react";var Po=new Map;function qn(t){for(let e in t){let o=t[e],r=Au(e,{parse:n=>typeof n=="string"&&Object.keys(o).includes(n)?n:void 0});Po.set(e,{stateConfig:r,stateValues:o})}}function Bo(t,e,o){t.update(()=>{Iu(r=>{let n=Po.get(e);if(!n)throw new Error(`State config for ${e} not found`);Mu(r,n.stateConfig,o)})})}function Qn(){let[t]=yu();return Ou(()=>t.registerMutationListener(Du,e=>{t.getEditorState().read(()=>{for(let[o,r]of e){if(r==="destroyed")continue;let n=Ru(o),l=t.getElementByKey(o);!n||!l||Po.forEach((i,s)=>{let u=vu(n,i.stateConfig);if(!u){delete l.dataset[s],l.style.cssText="";return}l.dataset[s]=u;let c=i.stateValues[u]?.css;c&&Object.entries(c).forEach(([d,a])=>{l.style.setProperty(d,a)})})}})}),[t]),null}var el=t=>{let e=[];for(let r in t.state){let n=t.state[r];for(let l in n){let i=n[l];e.push({ChildComponent:()=>Ho(Xt,{css:i.css}),key:l,label:i.label,onSelect:({editor:s})=>{Bo(s,r,l)}})}}return[{type:"dropdown",ChildComponent:()=>Ho(Xt,{css:{color:"var(--theme-elevation-600)"}}),items:[...[{ChildComponent:()=>Ho(Xt,{}),key:"clear-style",label:"Default style",onSelect:({editor:r})=>{for(let n in t.state)Bo(r,n,void 0)},order:1}],...e],key:"textState",order:30}]},$u=y(({props:t})=>(qn(t.state),{plugins:[{Component:Qn,position:"normal"}],toolbarFixed:{groups:el(t)},toolbarInline:{groups:el(t)}}));import{$createHeadingNode as Hu,$isHeadingNode as fl,HeadingNode as ju}from"@lexical/rich-text";import{$setBlocksType as Uu}from"@lexical/selection";import{$getSelection as Gu,$isRangeSelection as Wu}from"lexical";import{jsx as tl}from"react/jsx-runtime";import"react";var ol=()=>tl("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:tl("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 rl}from"react/jsx-runtime";import"react";var nl=()=>rl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:rl("path",{d:"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 ll}from"react/jsx-runtime";import"react";var il=()=>ll("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:ll("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM16.1146 11.745C16.1146 12.744 15.2236 13.608 13.6126 13.608C12.0736 13.608 11.0926 12.762 10.9846 11.547H12.4696C12.5146 12.114 13.0006 12.456 13.6126 12.456C14.2876 12.456 14.6746 12.132 14.6746 11.619C14.6746 11.061 14.2426 10.836 13.6216 10.836H12.9826V9.738H13.6036C14.1526 9.738 14.5486 9.486 14.5486 8.937C14.5486 8.46 14.2156 8.127 13.6486 8.127C13.0366 8.127 12.6586 8.514 12.6226 9.045H11.1916C11.2726 7.929 12.1276 6.966 13.6666 6.966C15.1876 6.966 15.9706 7.848 15.9706 8.865C15.9706 9.603 15.5026 10.143 14.8186 10.269C15.6196 10.404 16.1146 10.971 16.1146 11.745Z",fill:"currentColor"})});import{jsx as sl}from"react/jsx-runtime";import"react";var al=()=>sl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:sl("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM15.1736 7.074V10.854H16.3706V12.033H15.1736V13.5H13.6796V12.033H10.5116V10.845L13.4996 7.074H15.1736ZM13.6796 8.46L11.8256 10.854H13.6796V8.46Z",fill:"currentColor"})});import{jsx as cl}from"react/jsx-runtime";import"react";var ul=()=>cl("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:cl("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 dl}from"react/jsx-runtime";import"react";var ml=()=>dl("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:dl("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 Fu,$isHeadingNode as Pu,HeadingNode as Bu}from"@lexical/rich-text";var jo=t=>(e,o,r)=>{let n=t(r);n&&(n.append(...o),e.replace(n),n.select(0,0))};var pl=t=>{let o=`^(${t.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`,r=new RegExp(o);return{type:"element",dependencies:[Bu],export:(n,l)=>{if(!Pu(n))return null;let i=Number(n.getTag().slice(1));return"#".repeat(i)+" "+l(n)},regExp:r,replace:jo(n=>{let l="h"+n[1]?.length;return Fu(l)})}};var hl=t=>{let e=Gu();Uu(e,()=>Hu(t))},gl={h1:ol,h2:nl,h3:il,h4:al,h5:ul,h6:ml},Vu=y(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[le(e.map((r,n)=>({ChildComponent:gl[r],isActive:({selection:l})=>{if(!Wu(l))return!1;for(let i of l.getNodes()){if(fl(i)&&i.getTag()===r)continue;let s=i.getParent();if(!(fl(s)&&s.getTag()===r))return!1}return!0},key:r,label:({i18n:l})=>l.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:l})=>{l.update(()=>{hl(r)})},order:n+2})))];return{markdownTransformers:[pl(e)],nodes:[ju],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[ee(e.map(r=>({Icon:gl[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(()=>{hl(r)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}});import{$isNodeSelection as sd}from"lexical";import{jsx as xl}from"react/jsx-runtime";import"react";var Uo=()=>xl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:xl("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as Cl,jsxs as Ku}from"react/jsx-runtime";import"react";var bl=()=>Ku("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Cl("path",{d:"M5 10h10",stroke:"currentColor"}),Cl("path",{d:"M10 15V5",stroke:"currentColor"})]});var _e=t=>({type:"dropdown",ChildComponent:bl,items:t,key:"add",order:10});import{addClassNamesToElement as Ju}from"@lexical/utils";import{$applyNodeReplacement as Xu,createCommand as zu,DecoratorNode as Zu}from"lexical";var gt=zu("INSERT_HORIZONTAL_RULE_COMMAND"),ht=class extends Zu{static clone(e){return new this(e.__key)}static getType(){return"horizontalrule"}static importDOM(){return{hr:()=>({conversion:Yu,priority:0})}}static importJSON(e){return kl()}createDOM(e){let o=document.createElement("hr");return Ju(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 Yu(){return{node:kl()}}function kl(){return Xu(new ht)}import{$applyNodeReplacement as qu}from"lexical";import"react";var Me=class extends ht{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return xt()}decorate(){return null}exportJSON(){return super.exportJSON()}};function xt(){return qu(new Me)}function zt(t){return t instanceof Me}var _l={type:"element",dependencies:[Me],export:(t,e)=>zt(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=xt();e&&t.replace(e)}};import{c as Qu}from"react/compiler-runtime";import{useLexicalComposerContext as ed}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as td}from"@lexical/utils";import{$getSelection as od,$isRangeSelection as rd,COMMAND_PRIORITY_EDITOR as nd}from"lexical";import{useEffect as ld}from"react";var Tl=()=>{let t=Qu(3),[e]=ed(),o,r;return t[0]!==e?(o=()=>e.registerCommand(gt,id,nd),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),ld(o,r),null};function id(t){let e=od();if(!rd(e))return!1;if(e.focus.getNode()!==null){let r=xt();td(r)}return!0}var ad=y({markdownTransformers:[_l],nodes:[Me],plugins:[{Component:Tl,position:"normal"}],slashMenu:{groups:[ee([{Icon:Uo,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(gt,void 0)}}])]},toolbarFixed:{groups:[_e([{ChildComponent:Uo,isActive:({selection:t})=>{if(!sd(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return zt(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(gt,void 0)}}])]}});import{$findMatchingParent as Ml}from"@lexical/utils";import{$isElementNode as _d,INDENT_CONTENT_COMMAND as Td,OUTDENT_CONTENT_COMMAND as wd}from"lexical";import{jsx as Zt,jsxs as cd}from"react/jsx-runtime";import"react";var wl=()=>cd("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 Yt,jsxs as ud}from"react/jsx-runtime";import"react";var El=()=>ud("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Yt("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),Yt("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),Yt("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),Yt("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});import{jsx as dd}from"react/jsx-runtime";import{useLexicalComposerContext as md}from"@lexical/react/LexicalComposerContext";import{TabIndentationPlugin as pd}from"@lexical/react/LexicalTabIndentationPlugin";import{$findMatchingParent as fd,mergeRegister as Nl}from"@lexical/utils";import{$getSelection as hd,$isElementNode as Il,$isRangeSelection as gd,COMMAND_PRIORITY_LOW as Sl,INDENT_CONTENT_COMMAND as Ll,KEY_TAB_COMMAND as xd,OUTDENT_CONTENT_COMMAND as Cd,TabNode as bd}from"lexical";import{useEffect as yl}from"react";var Rl=({clientProps:t})=>{let[e]=md(),{disabledNodes:o,disableTabNode:r}=t;return yl(()=>{if(!(!e||!o?.length))return Nl(e.registerCommand(Ll,()=>kd(n=>{if(!o.includes(n.getType())){let l=n.getIndent();n.setIndent(l+1)}}),Sl),e.registerUpdateListener(({dirtyElements:n,editorState:l})=>{e.update(()=>{for(let[i]of n){let s=l._nodeMap.get(i);Il(s)&&o.includes(s.getType())&&s.getIndent()>0&&s.setIndent(0)}})}))},[e,o]),yl(()=>{if(!(!e||!r))return Nl(e.registerCommand(xd,n=>(n.preventDefault(),e.dispatchCommand(n.shiftKey?Cd:Ll,void 0)),Sl),e.registerNodeTransform(bd,n=>{n.remove()}))},[e,r]),dd(pd,{})};function kd(t){let e=hd();if(!gd(e))return!1;let o=new Set,r=e.getNodes();for(let n=0;n<r.length;n++){let l=r[n],i=l.getKey();if(o.has(i))continue;let s=fd(l,c=>Il(c)&&!c.isInline());if(s===null)continue;let u=s.getKey();s.canIndent()&&!o.has(u)&&(o.add(u),t(s))}return o.size>0}var vl=t=>({type:"buttons",items:t,key:"indent",order:35});var Al=({disabledNodes:t})=>[vl([{ChildComponent:wl,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>Dl(n)&&n.getIndent()>0;return o.some(n=>r(n)||!!Ml(n,r))},key:"indentDecrease",label:({i18n:e})=>e.t("lexical:indent:decreaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(wd,void 0)},order:1},{ChildComponent:El,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>Dl(n)&&!(t??[]).includes(n.getType());return o.some(n=>r(n)||!!Ml(n,r))},key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Td,void 0)},order:2}])],Ed=y(({props:t})=>{let e=t.disabledNodes??[];return{plugins:[{Component:Rl,position:"normal"}],sanitizedClientFeatureProps:t,toolbarFixed:{groups:Al({disabledNodes:e})},toolbarInline:{groups:Al({disabledNodes:e})}}}),Dl=t=>_d(t)&&t.canIndent();import{$findMatchingParent as $m}from"@lexical/utils";import{$getSelection as Yo,$isRangeSelection as di}from"lexical";import{jsx as Ol}from"react/jsx-runtime";import"react";var $l=()=>Ol("svg",{"aria-hidden":"true",className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Ol("path",{d:"M8.5 11.5L11.5 8.5M8.5 7L9.625 5.875C10.868 4.633 12.882 4.633 14.125 5.875C15.368 7.118 15.368 9.133 14.125 10.375L13 11.5M7 8.5L5.746 9.754C4.56 10.94 4.519 12.85 5.652 14.087C6.814 15.354 8.78 15.449 10.058 14.298L11.5 13",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})});import{$isAtNodeEnd as Fl}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()?Fl(o)?r:n:Fl(e)?r:n}var Go=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as Od}from"lexical";import{addClassNamesToElement as Nd,isHTMLAnchorElement as Sd}from"@lexical/utils";import Ko from"bson-objectid";import{$applyNodeReplacement as Ld,$createTextNode as Pl,$getSelection as yd,$isElementNode as Bl,$isRangeSelection as Vo,createCommand as Id,ElementNode as Rd}from"lexical";var vd=new Set(["http:","https:","mailto:","sms:","tel:"]),ie=class t extends Rd{__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:Md,priority:1})}}static importJSON(e){let o=Te({}).updateFromJSON(e);return e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),e.version===2&&!e.id&&(e.id=new Ko.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=Wo(o.rel,"add","noopener")),Nd(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(!Vo(o))return!1;let n=o.anchor.getNode(),l=o.focus.getNode();return this.isParentOf(n)&&this.isParentOf(l)&&o.getTextContent().length>0}getFields(){return this.getLatest().__fields}getID(){return this.getLatest().__id}insertNewAfter(e,o=!0){let r=this.getParentOrThrow().insertNewAfter(e,o);if(Bl(r)){let n=Te({fields:this.__fields});return r.append(n),n}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!vd.has(o.protocol))return"about:blank"}catch{return"https://"}return e}setFields(e){let o=this.getWritable();return o.__fields=e,o}setID(e){let o=this.getWritable();return o.__id=e,o}updateDOM(e,o,r){let n=this.__fields?.url,l=this.__fields?.newTab;return n!=null&&n!==e.__fields?.url&&this.__fields?.linkType==="custom"&&(o.href=n),this.__fields?.linkType==="internal"&&e.__fields?.linkType==="custom"&&o.removeAttribute("href"),o.rel==null&&(o.rel=""),l!==e.__fields?.newTab&&(l??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=Wo(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=Wo(o.rel,"remove","noopener"))),!1}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields).setID(e.id)}};function Md(t){let e=null;if(Sd(t)){let o=t.textContent;o!==null&&o!==""&&(e=Te({id:new Ko.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function Te({id:t,fields:e}){return Ld(new ie({id:t??new Ko.default().toHexString(),fields:e}))}function Y(t){return t instanceof ie}var ge=Id("TOGGLE_LINK_COMMAND");function Jo(t){let e=yd();if(!Vo(e)&&(t===null||!t.selectedNodes?.length))return;let o=Vo(e)?e.extract():t===null?[]:t.selectedNodes;if(t===null){o?.forEach(l=>{let i=l.getParent();Y(i)&&(i.getChildren().forEach(u=>{i.insertBefore(u)}),i.remove())});return}if(o?.length===1){let l=o[0],i=Y(l)?l:Ad(l);if(i!==null){i.setFields(t.fields),t.text!=null&&t.text!==i.getTextContent()&&(i.append(Pl(t.text)),i.getChildren().forEach(s=>{s!==i.getLastChild()&&s.remove()}));return}}let r=null,n=null;o?.forEach(l=>{let i=l.getParent();if(!(i===n||i===null||Bl(l)&&!l.isInline())){if(Y(i)){n=i,i.setFields(t.fields),t.text!=null&&t.text!==i.getTextContent()&&(i.append(Pl(t.text)),i.getChildren().forEach(s=>{s!==i.getLastChild()&&s.remove()}));return}if(i.is(r)||(r=i,n=Te({fields:t.fields}),Y(i)?l.getPreviousSibling()===null?i.insertBefore(n):i.insertAfter(n):l.insertBefore(n)),Y(l)){if(l.is(n))return;if(n!==null){let s=l.getChildren();n.append(...s)}l.remove();return}n!==null&&n.append(l)}})}function Ad(t){return Dd(t,e=>Y(e))}function Dd(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function Wo(t,e,o){let r,n=`${t}`;if(e==="add"){if(n.includes(o)){let l=new RegExp(o,"g");n=n.replace(l,"").trim()}n=n.trim(),r=n.length===0?`${o}`:`${n} ${o}`}else{let l=new RegExp(o,"g");r=n.replace(l,"").trim()}return r}var Hl={type:"text-match",dependencies:[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=Te({fields:{doc:null,linkType:"custom",newTab:!1,url:r}}),l=Od(o);return l.setFormat(t.getFormat()),n.append(l),t.replace(n),l},trigger:")"};import{$applyNodeReplacement as $d,$isElementNode as Fd}from"lexical";var we=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(Fd(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 we({id:"",fields:t}))}function Ee(t){return t instanceof we}import{c as Pd}from"react/compiler-runtime";import{useLexicalComposerContext as Bd}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Hd}from"@lexical/utils";import{$createTextNode as jl,$getSelection as jd,$isElementNode as Gl,$isLineBreakNode as Wl,$isNodeSelection as Ud,$isRangeSelection as Gd,$isTextNode as bt,TextNode as Wd}from"lexical";import{useEffect as Vd}from"react";function Ul(t,e=o=>o){return o=>{let r=t.exec(o);return r===null?null:{index:r.index,length:r[0].length,text:r[0],url:e(r[0])}}}function Vl(t,e){for(let o of e){let r=o(t);if(r!=null)return r}return null}var Kd=/[.,;\s]/;function Qt(t){return t!==void 0&&Kd.test(t)}function Kl(t){return Qt(t[t.length-1])}function zo(t){return Qt(t[0])}function Jd(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function Jl(t){let e=t.getPreviousSibling();return Gl(e)&&(e=e.getLastDescendant()),e===null||Wl(e)||bt(e)&&Kl(e.getTextContent())}function Xl(t){let e=t.getNextSibling();return Gl(e)&&(e=e.getFirstDescendant()),e===null||Wl(e)||bt(e)&&zo(e.getTextContent())}function Xd(t,e,o,r){return(t>0?Qt(o[t-1]):Jl(r[0]))?e<o.length?Qt(o[e]):Xl(r[r.length-1]):!1}function zd(t,e,o){let r=[],n=[],l=[],i=0,s=0,u=[...t];for(;u.length>0;){let c=u[0],a=c.getTextContent().length,p=s;s+a<=e?(r.push(c),i+=a):p>=o?l.push(c):n.push(c),s+=a,u.shift()}return[i,r,n,l]}function Zd(t,e,o,r){let n={linkType:"custom",url:r.url,...r.fields},l=Ct({fields:n});if(t.length===1){let i=t[0],s;if(e===0?[s]=i.splitText(o):[,s]=i.splitText(e,o),s){let u=jl(r.text);u.setFormat(s.getFormat()),u.setDetail(s.getDetail()),u.setStyle(s.getStyle()),l.append(u),s.replace(l)}return i}else if(t.length>1){let i=t[0],s=i.getTextContent().length,u;e===0?u=i:[,u]=i.splitText(e);let c=[],d;if(t.forEach(a=>{let m=a.getTextContent().length,f=s,h=s+m;if(f<o)if(h<=o)c.push(a);else{let[x,k]=a.splitText(o-f);x&&c.push(x),d=k}s+=m}),u){let a=jd(),p=a?a.getNodes().find(bt):void 0,m=jl(u.getTextContent());return m.setFormat(u.getFormat()),m.setDetail(u.getDetail()),m.setStyle(u.getStyle()),l.append(m,...c),p&&p===u&&(Gd(a)?m.select(a.anchor.offset,a.focus.offset):Ud(a)&&m.select(0,m.getTextContent().length)),u.replace(l),d}}}function Yd(t,e,o){let r=[...t],n=r.map(u=>u.getTextContent()).join(""),l=n,i,s=0;for(;(i=Vl(l,e))!=null&&i!==null;){let u=i.index,c=i.length,d=u+c;if(Xd(s+u,s+d,n,r)){let[p,,m,f]=zd(r,s+u,s+d),h=s+u-p,x=s+d-p,k=Zd(m,h,x,i);r=k?[k,...f]:f,o(i.url,null),s=0}else s+=d;l=l.substring(d)}}function Xo(t,e,o){let r=t.getChildren(),n=r.length;for(let u=0;u<n;u++){let c=r[u];if(!bt(c)||!c.isSimpleText()){qt(t),o(null,t.getFields()?.url??null);return}}let l=t.getTextContent(),i=Vl(l,e);if(i===null||i.text!==l){qt(t),o(null,t.getFields()?.url??null);return}if(!Jl(t)||!Xl(t)){qt(t),o(null,t.getFields()?.url??null);return}let s=t.getFields()?.url;if(s!==i?.url){let u=t.getFields();u.url=i?.url,t.setFields(u),o(i.url,s??null)}}function qd(t,e,o){let r=t.getPreviousSibling(),n=t.getNextSibling(),l=t.getTextContent();if(Ee(r)){let i=r.getFields()?.url?r.getFields()?.url?.startsWith("mailto:")??!1:!1;(!zo(l)||Jd(l,i))&&(r.append(t),Xo(r,e,o),o(null,r.getFields()?.url??null))}Ee(n)&&!Kl(l)&&(qt(n),Xo(n,e,o),o(null,n.getFields()?.url??null))}function qt(t){let e=t.getChildren(),o=e.length;for(let r=o-1;r>=0;r--)t.insertAfter(e[r]);return t.remove(),e.map(r=>r.getLatest())}function Qd(t){let e=[t],o=t.getNextSibling();for(;o!==null&&bt(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function em(t,e,o){let r=Pd(5),n,l;r[0]!==t||r[1]!==e||r[2]!==o?(n=()=>{if(!t.hasNodes([we]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let i=(s,u)=>{o?.(s,u)};return Hd(t.registerNodeTransform(Wd,s=>{let u=s.getParentOrThrow(),c=s.getPreviousSibling();if(Ee(u))Xo(u,e,i);else if(!Y(u)){if(s.isSimpleText()&&(zo(s.getTextContent())||!Ee(c))){let d=Qd(s);Yd(d,e,i)}qd(s,e,i)}}))},l=[t,e,o],r[0]=t,r[1]=e,r[2]=o,r[3]=n,r[4]=l):(n=r[3],l=r[4]),Vd(n,l)}var tm=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,om=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,rm=[Ul(tm,t=>t.startsWith("http")?t:`https://${t}`),Ul(om,t=>`mailto:${t}`)],zl=()=>{let[t]=Bd();return em(t,rm),null};import{jsx as nm}from"react/jsx-runtime";import{ClickableLinkPlugin as lm}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var Zl=()=>nm(lm,{});import{jsx as wm}from"react/jsx-runtime";import"react";import{createPortal as Em}from"react-dom";import{jsx as Ne,jsxs as kt,Fragment as sm}from"react/jsx-runtime";import{useLexicalComposerContext as am}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as Yl,mergeRegister as ql}from"@lexical/utils";import{getTranslation as Zo}from"@payloadcms/translations";import{CloseMenuIcon as cm,EditIcon as um,ExternalLinkIcon as Ql,formatDrawerSlug as dm,useConfig as mm,useEditDepth as pm,useLocale as fm,useTranslation as hm}from"@payloadcms/ui";import{requests as gm}from"@payloadcms/ui/shared";import{$getSelection as ei,$isLineBreakNode as xm,$isRangeSelection as ti,COMMAND_PRIORITY_HIGH as Cm,COMMAND_PRIORITY_LOW as oi,getDOMSelection as bm,KEY_ESCAPE_COMMAND as km,SELECTION_CHANGE_COMMAND as _m}from"lexical";import ri,{useCallback as ni,useEffect as oo,useRef as Tm,useState as Be}from"react";function eo(t,e,o,r=10,n=5){let l=o.parentElement;if(t===null||l==null){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let i=e.getBoundingClientRect(),s=o.getBoundingClientRect(),u=l.getBoundingClientRect(),c=t.top-r,d=t.left-n;c<u.top&&(c+=i.height+t.height+r*2),d+i.width>u.right&&(d=u.right-i.width-n),c-=s.top,d-=s.left,e.style.opacity="1",e.style.transform=`translate(${d}px, ${c}px)`}import{createCommand as im}from"lexical";var to=im("TOGGLE_LINK_WITH_MODAL_COMMAND");function li(t){t.preventDefault()}function ii({anchorElem:t}){let[e]=am(),[o,r]=Be(),n=Tm(null),[l,i]=Be(null),[s,u]=Be(null),{fieldProps:{schemaPath:c},uuid:d}=G(),{config:a,getEntityConfig:p}=mm(),{i18n:m,t:f}=hm(),[h,x]=Be(),k=pm(),[I,A]=Be(!1),[b,_]=Be([]),g=fm(),[w,M]=Be(!1),D=dm({slug:"lexical-rich-text-link-"+d,depth:k}),{toggleDrawer:P}=Ce(D),v=ni(()=>{A(!1),n&&n.current&&(n.current.style.opacity="0",n.current.style.transform="translate(-10000px, -10000px)"),M(!1),i(null),u(null),_([]),x(void 0)},[A,i,u,_]),N=ni(()=>{let C=ei(),E;if(!ti(C)||!C){v();return}let L=ze(C);E=e.getElementByKey(L.getKey())?.getBoundingClientRect();let S=Yl(L,Y),R=C.getNodes().filter(j=>!xm(j)).find(j=>{let U=Yl(j,Y);return S&&!S.is(U)||U&&!U.is(S)});if(S==null||R){v();return}r(S);let T=S.getFields(),$={...T,id:S.getID(),text:S.getTextContent()};if(T?.linkType==="custom")i(T?.url??null),u(null);else{i(`${a.routes.admin==="/"?"":a.routes.admin}/collections/${T?.doc?.relationTo}/${T?.doc?.value}`);let j=T?.doc?.relationTo?p({collectionSlug:T?.doc?.relationTo}):void 0;if(!j)u(T?.label?String(T?.label):null),i(T?.url?String(T?.url):null);else{let U=typeof T.doc?.value=="object"?T.doc.value.id:T.doc?.value,oe=T.doc?.relationTo;if(!U||!oe)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let ue=f("fields:linkedTo",{label:`${Zo(j.labels.singular,m)} - ${f("lexical:link:loadingWithEllipsis",m)}`}).replace(/<[^>]*>?/g,"");u(ue),gm.get(`${a.serverURL}${a.routes.api}/${oe}/${U}`,{headers:{"Accept-Language":m.language},params:{depth:0,locale:g?.code}}).then(async q=>{if(!q.ok)throw new Error(`HTTP error! Status: ${q.status}`);let J=await q.json(),re=j?.admin?.useAsTitle||"id",ne=J[re],se=f("fields:linkedTo",{label:`${Zo(j.labels.singular,m)} - ${ne}`}).replace(/<[^>]*>?/g,"");u(se)}).catch(()=>{let q=f("fields:linkedTo",{label:`${Zo(j.labels.singular,m)} - ${f("general:untitled",m)} - ID: ${U}`}).replace(/<[^>]*>?/g,"");u(q)})}}x($),A(!0),_(C?C?.getNodes():[]),Ee(S)?M(!0):M(!1);let F=n.current,W=bm(e._window),{activeElement:K}=document;if(F===null)return;let fe=e.getRootElement();return W!==null&&fe!==null&&fe.contains(W.anchorNode)?(E||(E=W.getRangeAt(0).getBoundingClientRect()),E!=null&&(E.y+=40,eo(E,F,t))):(K==null||K.className!=="link-input")&&(fe!==null&&eo(null,F,t),i(null),u(null)),!0},[e,v,a.routes.admin,a.routes.api,a.serverURL,p,f,m,g?.code,t]);return oo(()=>ql(e.registerCommand(to,C=>(e.dispatchCommand(ge,C),N(),P(),!0),oi)),[e,N,P,D]),oo(()=>{let C=t.parentElement,E=()=>{e.getEditorState().read(()=>{N()})};return window.addEventListener("resize",E),C?.addEventListener("scroll",E),()=>{window.removeEventListener("resize",E),C?.removeEventListener("scroll",E)}},[t.parentElement,e,N]),oo(()=>ql(e.registerUpdateListener(({editorState:C})=>{C.read(()=>{N()})}),e.registerCommand(_m,()=>(N(),!0),oi),e.registerCommand(km,()=>I?(v(),!0):!1,Cm)),[e,N,I,v]),oo(()=>{e.getEditorState().read(()=>{N()})},[e,N]),kt(ri.Fragment,{children:[Ne("div",{className:"link-editor",ref:n,children:kt("div",{className:"link-input",children:[l&&l.length>0?kt("a",{href:l,rel:"noopener noreferrer",target:"_blank",children:[o?.__fields.newTab?Ne(Ql,{}):null,s!=null&&s.length>0?s:l]}):s!=null&&s.length>0?kt(sm,{children:[o?.__fields.newTab?Ne(Ql,{}):null,Ne("span",{className:"link-input__label-pure",children:s})]}):null,e.isEditable()&&kt(ri.Fragment,{children:[Ne("button",{"aria-label":"Edit link",className:"link-edit",onClick:C=>{C.preventDefault(),P()},onMouseDown:li,tabIndex:0,type:"button",children:Ne(um,{})}),!w&&Ne("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(ge,null)},onMouseDown:li,tabIndex:0,type:"button",children:Ne(cm,{})})]})]})}),Ne(st,{className:"lexical-link-edit-drawer",data:h,drawerSlug:D,drawerTitle:f("fields:editLink"),featureKey:"link",handleDrawerSubmit:(C,E)=>{let L=E,S={...L};delete S.text,e.update(()=>{let R=ei(),T=null;if(ti(R)?T=ze(R).getParent():b.length&&(T=b[0]?.getParent()??null),T&&Ee(T)){let $=Te({fields:S});T.replace($,!0)}}),e.dispatchCommand(ge,{fields:S,selectedNodes:b,text:L.text})},schemaPath:c,schemaPathSuffix:"fields"})]})}var si=t=>{let{anchorElem:e=document.body}=t;return Em(wm(ii,{anchorElem:e}),e)};import{c as Lm}from"react/compiler-runtime";import{useLexicalComposerContext as ym}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Im}from"@lexical/utils";import{$getSelection as Rm,$isElementNode as vm,$isRangeSelection as Mm,COMMAND_PRIORITY_LOW as ci,PASTE_COMMAND as Am}from"lexical";import{useEffect as Dm}from"react";var Nm=/^(?:[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+)?$/,Sm=/^(?:\/[\w\-./]*(?:#\w[\w-]*)?|#[\w\-]+)$/;function ai(t){if(!t)return!1;if(t==="https://"||Nm.test(t)||Sm.test(t))return!0;try{return new URL(t),!0}catch{}return!1}var ui=t=>{let e=Lm(5),{clientProps:o}=t,[r]=ym(),n,l;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 Im(r.registerCommand(ge,i=>i===null?(Jo(null),!0):(i.fields?.linkType||(i.fields.linkType=o.defaultLinkType),i.fields?.url||(i.fields.url=o.defaultLinkURL),Jo(i),!0),ci),r.registerCommand(Am,i=>{let s=Rm();if(!Mm(s)||s.isCollapsed()||!(i instanceof ClipboardEvent)||i.clipboardData==null)return!1;let u=i.clipboardData.getData("text");if(!ai(u))return!1;if(!s.getNodes().some(Om)){let c={doc:null,linkType:"custom",newTab:!1,url:u};return r.dispatchCommand(ge,{fields:c,text:null}),i.preventDefault(),!0}return!1},ci))},l=[o.defaultLinkType,o.defaultLinkURL,r],e[0]=o.defaultLinkType,e[1]=o.defaultLinkURL,e[2]=r,e[3]=n,e[4]=l):(n=e[3],l=e[4]),Dm(n,l),null};function Om(t){return vm(t)}var mi=[Go([{ChildComponent:$l,isActive:({selection:t})=>{if(di(t)){let e=ze(t);return $m(e,Y)!=null}return!1},isEnabled:({selection:t})=>!!(di(t)&&Yo()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(ge,null);else{let o,r=[];if(t.getEditorState().read(()=>{o=Yo()?.getTextContent(),r=Yo()?.getNodes()??[]}),!o?.length)return;let n={doc:null};t.dispatchCommand(to,{fields:n,selectedNodes:r,text:o})}},order:1}])],Fm=y(({props:t})=>({markdownTransformers:[Hl],nodes:[ie,t?.disableAutoLinks===!0?null:we].filter(Boolean),plugins:[{Component:ui,position:"normal"},t?.disableAutoLinks===!0||t?.disableAutoLinks==="creationOnly"?null:{Component:zl,position:"normal"},{Component:Zl,position:"normal"},{Component:si,position:"floatingAnchorElem"}].filter(Boolean),sanitizedClientFeatureProps:t,toolbarFixed:{groups:mi},toolbarInline:{groups:mi}}));import{$isListNode as er,INSERT_CHECK_LIST_COMMAND as Ci,ListItemNode as zm,ListNode as Zm}from"@lexical/list";import{$isRangeSelection as Ym}from"lexical";import{jsx as pi,jsxs as Pm}from"react/jsx-runtime";import"react";var qo=()=>Pm("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[pi("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),pi("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Bm}from"react/jsx-runtime";import{ListPlugin as Hm}from"@lexical/react/LexicalListPlugin.js";import"react";var Ze=()=>Bm(Hm,{});function Ye(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as Wm,ListItemNode as Vm,ListNode as Km}from"@lexical/list";import{$createListItemNode as jm,$createListNode as Um,$isListItemNode as Gm,$isListNode as Qo}from"@lexical/list";var fi=4,qe=t=>(e,o,r)=>{let n=e.getPreviousSibling(),l=e.getNextSibling(),i=jm(t==="check"?r[3]==="x":void 0);if(Qo(l)&&l.getListType()===t){let u=l.getFirstChild();u!==null?u.insertBefore(i):l.append(i),e.remove()}else if(Qo(n)&&n.getListType()===t)n.append(i),e.remove();else{let u=Um(t,t==="number"?Number(r[2]):void 0);u.append(i),e.replace(u)}i.append(...o),i.select(0,0);let s=Math.floor(r[1].length/fi);s&&i.setIndent(s)},He=(t,e,o)=>{let r=[],n=t.getChildren(),l=0;for(let i of n)if(Gm(i)){if(i.getChildrenSize()===1){let d=i.getFirstChild();if(Qo(d)){r.push(He(d,e,o+1));continue}}let s=" ".repeat(o*fi),u=t.getListType(),c=u==="number"?`${t.getStart()+l}. `:u==="check"?`- [${i.getChecked()?"x":" "}] `:"- ";r.push(s+c+e(i)),l++}return r.join(`
|
|
36
|
+
`)};var hi={type:"element",dependencies:[Km,Vm],export:(t,e)=>Wm(t)?He(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:qe("check")};import{jsx as Jm}from"react/jsx-runtime";import{CheckListPlugin as Xm}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var gi=()=>Jm(Xm,{});var xi=[le([{ChildComponent:qo,isActive:({selection:t})=>{if(!Ym(t))return!1;for(let e of t.getNodes()){if(er(e)&&e.getListType()==="check")continue;let o=e.getParent();if(er(o)&&o.getListType()==="check")continue;let r=o?.getParent();if(!(er(r)&&r.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ci,void 0)},order:12}])],qm=y(({featureProviderMap:t})=>{let e=[{Component:gi,position:"normal"}];return!t.has("unorderedList")&&!t.has("orderedList")&&e.push({Component:Ze,position:"normal"}),{markdownTransformers:[hi],nodes:t.has("unorderedList")||t.has("orderedList")?[]:[Zm,zm],plugins:e,slashMenu:{groups:[Ye([{Icon:qo,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:o})=>o.t("lexical:checklist:label"),onSelect:({editor:o})=>{o.dispatchCommand(Ci,void 0)}}])]},toolbarFixed:{groups:xi},toolbarInline:{groups:xi}}});import{$isListNode as or,INSERT_ORDERED_LIST_COMMAND as _i,ListItemNode as rp,ListNode as np}from"@lexical/list";import{$isRangeSelection as lp}from"lexical";import{jsx as _t,jsxs as Qm}from"react/jsx-runtime";import"react";var tr=()=>Qm("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 ep,ListItemNode as tp,ListNode as op}from"@lexical/list";var bi={type:"element",dependencies:[op,tp],export:(t,e)=>ep(t)?He(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:qe("number")};var ki=[le([{ChildComponent:tr,isActive:({selection:t})=>{if(!lp(t))return!1;for(let e of t.getNodes()){if(or(e)&&e.getListType()==="number")continue;let o=e.getParent();if(or(o)&&o.getListType()==="number")continue;let r=o?.getParent();if(!(or(r)&&r.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(_i,void 0)},order:10}])],ip=y(({featureProviderMap:t})=>({markdownTransformers:[bi],nodes:t.has("orderedList")?[]:[np,rp],plugins:t.has("orderedList")?[]:[{Component:Ze,position:"normal"}],slashMenu:{groups:[Ye([{Icon:tr,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:e})=>e.t("lexical:orderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(_i,void 0)}}])]},toolbarFixed:{groups:ki},toolbarInline:{groups:ki}}));import{$isListNode as nr,INSERT_UNORDERED_LIST_COMMAND as Ei,ListItemNode as dp,ListNode as mp}from"@lexical/list";import{$isRangeSelection as pp}from"lexical";import{jsx as Qe,jsxs as sp}from"react/jsx-runtime";import"react";var rr=()=>sp("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 ap,ListItemNode as cp,ListNode as up}from"@lexical/list";var Ti={type:"element",dependencies:[up,cp],export:(t,e)=>ap(t)?He(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:qe("bullet")};var wi=[le([{ChildComponent:rr,isActive:({selection:t})=>{if(!pp(t))return!1;for(let e of t.getNodes()){if(nr(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(nr(o)&&o.getListType()==="bullet")continue;let r=o?.getParent();if(!(nr(r)&&r.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ei,void 0)},order:11}])],fp=y({markdownTransformers:[Ti],nodes:[mp,dp],plugins:[{Component:Ze,position:"normal"}],slashMenu:{groups:[Ye([{Icon:rr,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ei,void 0)}}])]},toolbarFixed:{groups:wi},toolbarInline:{groups:wi}});import{jsx as hp}from"react/jsx-runtime";import{addClassNamesToElement as gp}from"@lexical/utils";import{DecoratorNode as xp}from"lexical";import*as Ni from"react";var Cp=Ni.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),Tt=class t extends xp{__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 bp({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return gp(o,"unknownConverted"),o}decorate(){return hp(Cp,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function bp({data:t}){return new Tt({data:t})}var kp=y(()=>({nodes:[Tt]}));import{jsx as _p}from"react/jsx-runtime";import{addClassNamesToElement as Tp}from"@lexical/utils";import{DecoratorNode as wp}from"lexical";import*as Si from"react";var Ep=Si.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),wt=class t extends wp{__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 Np({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return Tp(o,"unknownConverted"),o}decorate(){return _p(Ep,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function Np({data:t}){return new wt({data:t})}var Sp=y(()=>({nodes:[wt]}));import{$setBlocksType as Ii}from"@lexical/selection";import{$createParagraphNode as Ri,$getSelection as vi,$isParagraphNode as Li,$isRangeSelection as Lp}from"lexical";var yi=[le([{ChildComponent:ct,isActive:({selection:t})=>{if(!Lp(t))return!1;for(let e of t.getNodes())if(!Li(e)&&!Li(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=vi();Ii(e,()=>Ri())})},order:1}])],yp=y({slashMenu:{groups:[ee([{Icon:ct,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=vi();Ii(e,()=>Ri())})}}])]},toolbarFixed:{groups:yi},toolbarInline:{groups:yi}});import{c as zp}from"react/compiler-runtime";import{jsx as Zp}from"react/jsx-runtime";import{useLexicalComposerContext as Yp}from"@lexical/react/LexicalComposerContext";import{useEffect as qp,useState as Qp}from"react";import{jsx as Zi,Fragment as Xp}from"react/jsx-runtime";import"react";import{jsx as Ip}from"react/jsx-runtime";var Mi={quote:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return Ip("blockquote",{children:o})}};import{jsx as Rp}from"react/jsx-runtime";var Ai={heading:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.tag;return Rp(r,{children:o})}};import{jsx as vp}from"react/jsx-runtime";var Di={horizontalrule:vp("hr",{})};import{jsx as Mp}from"react/jsx-runtime";var Oi={linebreak:Mp("br",{})};import{jsx as $i}from"react/jsx-runtime";var Fi=({internalDocToHref:t})=>({autolink:({node:e,nodesToJSX:o})=>{let r=o({nodes:e.children}),n=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0;return $i("a",{href:e.fields.url,rel:n,target:l,children:r})},link:({node:e,nodesToJSX:o})=>{let r=o({nodes:e.children}),n=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0,i=e.fields.url??"";return e.fields.linkType==="internal"&&(t?i=t({linkNode:e}):(console.error("Lexical => JSX converter: Link converter: found internal link, but internalDocToHref is not provided"),i="#")),$i("a",{href:i,rel:n,target:l,children:r})}});import{jsx as et,jsxs as Ap,Fragment as Dp}from"react/jsx-runtime";import{v4 as Op}from"uuid";var Pi={list:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.tag;return et(r,{className:`list-${t?.listType}`,children:o})},listitem:({node:t,nodesToJSX:e,parent:o})=>{let r=t.children.some(l=>l.type==="list"),n=e({nodes:t.children});if("listType"in o&&o?.listType==="check"){let l=Op();return et("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:Ap(Dp,{children:[et("input",{checked:t.checked,id:l,readOnly:!0,type:"checkbox"}),et("label",{htmlFor:l,children:n}),et("br",{})]})})}else return et("li",{className:`${r?"nestedListItem":""}`,style:r?{listStyleType:"none"}:void 0,value:t?.value,children:n})}};import{jsx as lr}from"react/jsx-runtime";var Bi={paragraph:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return o?.length?lr("p",{children:o}):lr("p",{children:lr("br",{})})}};var Hi={tab:" "};import{jsx as Et}from"react/jsx-runtime";var ji={table:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return Et("div",{className:"lexical-table-container",children:Et("table",{className:"lexical-table",style:{borderCollapse:"collapse"},children:Et("tbody",{children:o})})})},tablecell:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.headerState>0?"th":"td",n=`lexical-table-cell-header-${t.headerState}`,l={backgroundColor:t.backgroundColor||void 0,border:"1px solid #ccc",padding:"8px"},i=t.colSpan&&t.colSpan>1?t.colSpan:void 0,s=t.rowSpan&&t.rowSpan>1?t.rowSpan:void 0;return Et(r,{className:`lexical-table-cell ${n}`,colSpan:i,rowSpan:s,style:l,children:o})},tablerow:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return Et("tr",{className:"lexical-table-row",children:o})}};import{jsx as je}from"react/jsx-runtime";import"react";var O={DOM_ELEMENT_TYPE:1,DOM_TEXT_TYPE:3,NO_DIRTY_NODES:0,HAS_DIRTY_NODES:1,FULL_RECONCILE:2,IS_NORMAL:0,IS_TOKEN:1,IS_SEGMENTED:2,IS_INERT:3,IS_BOLD:1,IS_ITALIC:2,IS_STRIKETHROUGH:4,IS_UNDERLINE:8,IS_CODE:16,IS_SUBSCRIPT:32,IS_SUPERSCRIPT:64,IS_HIGHLIGHT:128,IS_DIRECTIONLESS:1,IS_UNMERGEABLE:2,IS_ALIGN_LEFT:1,IS_ALIGN_CENTER:2,IS_ALIGN_RIGHT:3,IS_ALIGN_JUSTIFY:4,IS_ALIGN_START:5,IS_ALIGN_END:6},$p=O.IS_BOLD|O.IS_ITALIC|O.IS_STRIKETHROUGH|O.IS_UNDERLINE|O.IS_CODE|O.IS_SUBSCRIPT|O.IS_SUPERSCRIPT|O.IS_HIGHLIGHT,Fp="\xA0",Pp=`
|
|
37
37
|
|
|
38
|
-
`,jl="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",Ul="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",Pp=new RegExp("^[^"+Ul+"]*["+jl+"]"),Bp=new RegExp("^[^"+jl+"]*["+Ul+"]"),Hp={bold:O.IS_BOLD,code:O.IS_CODE,highlight:O.IS_HIGHLIGHT,italic:O.IS_ITALIC,strikethrough:O.IS_STRIKETHROUGH,subscript:O.IS_SUBSCRIPT,superscript:O.IS_SUPERSCRIPT,underline:O.IS_UNDERLINE},jp={directionless:O.IS_DIRECTIONLESS,unmergeable:O.IS_UNMERGEABLE},Up={center:O.IS_ALIGN_CENTER,end:O.IS_ALIGN_END,justify:O.IS_ALIGN_JUSTIFY,left:O.IS_ALIGN_LEFT,right:O.IS_ALIGN_RIGHT,start:O.IS_ALIGN_START},Gp={[O.IS_ALIGN_CENTER]:"center",[O.IS_ALIGN_END]:"end",[O.IS_ALIGN_JUSTIFY]:"justify",[O.IS_ALIGN_LEFT]:"left",[O.IS_ALIGN_RIGHT]:"right",[O.IS_ALIGN_START]:"start"},Wp={normal:O.IS_NORMAL,segmented:O.IS_SEGMENTED,token:O.IS_TOKEN},Vp={[O.IS_NORMAL]:"normal",[O.IS_SEGMENTED]:"segmented",[O.IS_TOKEN]:"token"};var Gl={text:({node:t})=>{let e=t.text;return t.format&O.IS_BOLD&&(e=He("strong",{children:e})),t.format&O.IS_ITALIC&&(e=He("em",{children:e})),t.format&O.IS_STRIKETHROUGH&&(e=He("span",{style:{textDecoration:"line-through"},children:e})),t.format&O.IS_UNDERLINE&&(e=He("span",{style:{textDecoration:"underline"},children:e})),t.format&O.IS_CODE&&(e=He("code",{children:e})),t.format&O.IS_SUBSCRIPT&&(e=He("sub",{children:e})),t.format&O.IS_SUPERSCRIPT&&(e=He("sup",{children:e})),e}};import{jsx as wt}from"react/jsx-runtime";var Wl={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 wt("a",{href:r,rel:"noopener noreferrer",children:o.filename});if(!o.sizes||!Object.keys(o.sizes).length)return wt("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(wt("source",{media:`(max-width: ${l.width}px)`,srcSet:s,type:l.mimeType},i))}return n.push(wt("img",{alt:o?.filename,height:o?.height,src:r,width:o?.width},"image")),wt("picture",{children:n})}};var et={...Pl,...Gl,...Dl,...vl,...Hl,...Ml,...Al,...$l,...Fl({}),...Wl,...Bl};import{jsx as Kl,Fragment as Kp}from"react/jsx-runtime";import ir from"react";function Vl(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 Jl({converters:t,data:e,disableIndent:o,disableTextAlign:r}){return Vl(e)?Xl({converters:t,disableIndent:o,disableTextAlign:r,nodes:e?.root?.children,parent:e?.root}):Kl(Kp,{})}function Xl({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=>Xl({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=Kl("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`),ir.isValidElement(d)){if(a.textAlign||a.paddingInlineStart){let p={...a,...d?.props?.style??{}};return ir.cloneElement(d,{key:u,style:p})}return ir.cloneElement(d,{key:u})}return d}catch(d){return console.error("Error converting lexical node to JSX:",d,"node:",s),null}}).filter(Boolean)}var lr=({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&&Jl({converters:l,data:o,disableIndent:n,disableTextAlign:i});return r?zl(Jp,{children:s}):zl("div",{className:t??"payload-richtext",children:s})};function Zl(){let t=Xp(7),[e]=Zp(),o;t[0]!==e?(o=e.getEditorState().toJSON(),t[0]=e,t[1]=o):o=t[1];let[r,n]=qp(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]),Yp(i,l);let s;return t[5]!==r?(s=zp(lr,{converters:et,data:r}),t[5]=r,t[6]=s):s=t[6],s}var Qp=y({plugins:[{Component:Zl,position:"bottom"}]});import{$isNodeSelection as Pf}from"lexical";import{jsx as Nt,jsxs as ef}from"react/jsx-runtime";import"react";var sr=()=>ef("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 rf}from"react/jsx-runtime";import*as ql from"react";import{DecoratorBlockNode as tf}from"@lexical/react/LexicalDecoratorBlockNode.js";function of(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Yl({relationTo:o,value:e})}:null}var St=class extends tf{__data;constructor({data:e,format:o,key:r}){super(o,r),this.__data=e}static clone(e){return new this({data:e.__data,format:e.__format,key:e.__key})}static getType(){return"relationship"}static importDOM(){return{div:e=>!e.hasAttribute("data-lexical-relationship-relationTo")||!e.hasAttribute("data-lexical-relationship-id")?null:{conversion:of,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=Yl(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 Yl(t){return new St({data:t})}var nf=ql.lazy(()=>import("./RelationshipComponent-APF3CN47.js").then(t=>({default:t.RelationshipComponent})));function lf(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:je({relationTo:o,value:e})}:null}var Ne=class extends St{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:lf,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=je(o);return r.setFormat(e.format),r}decorate(e,o){return rf(nf,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function je(t){return new Ne({data:t})}function ar(t){return t instanceof Ne}import{c as wf}from"react/compiler-runtime";import{jsx as Nf}from"react/jsx-runtime";import{useLexicalComposerContext as Sf}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Lf}from"@lexical/utils";import{useConfig as yf}from"@payloadcms/ui";import{$getPreviousSelection as If,$getSelection as Rf,$isParagraphNode as vf,$isRangeSelection as Mf,COMMAND_PRIORITY_EDITOR as Af,createCommand as Df}from"lexical";import{useEffect as Of}from"react";import{c as Cf}from"react/compiler-runtime";import{jsx as oo}from"react/jsx-runtime";import{useLexicalComposerContext as bf}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as _f,COMMAND_PRIORITY_EDITOR as Tf}from"lexical";import{useEffect as kf,useState as ts}from"react";import{c as sf}from"react/compiler-runtime";import{jsx as af}from"react/jsx-runtime";import{useLexicalComposerContext as cf}from"@lexical/react/LexicalComposerContext";import{useListDrawer as uf,useModal as df}from"@payloadcms/ui";import{$getNodeByKey as Ql,$getPreviousSelection as mf,$getRoot as pf,$getSelection as ff,$isRangeSelection as hf,$setSelection as gf}from"lexical";import{useEffect as xf,useState as es}from"react";var Lt=t=>{let e=sf(23),[o]=cf(),[r,n]=es(null),[i,l]=es(!1),[s,u,c]=uf(t),{closeDrawer:d,drawerSlug:a,isDrawerOpen:p,openDrawer:m}=c,{modalState:f}=df(),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let P=ff()??mf();n(P)},e[0]=h):h=e[0];let x=h,_;e[1]!==o||e[2]!==r?(_=()=>{r&&o.update(()=>{if(hf(r)){let{anchor:P,focus:v}=r;Ql(P.key)&&Ql(v.key)&&gf(r.clone())}else pf().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=r,e[3]=_):_=e[3];let I=_,A;e[4]!==d?(A=()=>{d()},e[4]=d,e[5]=A):A=e[5];let b=A,T,g;e[6]!==a||e[7]!==f||e[8]!==I||e[9]!==i?(T=()=>{if(!i)return;let P=f[a];P&&!P?.isOpen&&(l(!1),setTimeout(()=>{I()},1))},g=[f,a,I,i],e[6]=a,e[7]=f,e[8]=I,e[9]=i,e[10]=T,e[11]=g):(T=e[10],g=e[11]),xf(T,g);let E;e[12]!==u?(E=P=>af(u,{...P,onClick:()=>{x()}}),e[12]=u,e[13]=E):E=e[13];let M;e[14]!==m?(M=()=>{x(),m(),l(!0)},e[14]=m,e[15]=M):M=e[15];let D;return e[16]!==s||e[17]!==b||e[18]!==p||e[19]!==a||e[20]!==E||e[21]!==M?(D={closeListDrawer:b,isListDrawerOpen:p,ListDrawer:s,listDrawerSlug:a,ListDrawerToggler:E,openListDrawer:M},e[16]=s,e[17]=b,e[18]=p,e[19]=a,e[20]=E,e[21]=M,e[22]=D):D=e[22],D};var Ef=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=_f(o);n&&n.replace(je({relationTo:e,value:r}))}):t.dispatchCommand(cr,{relationTo:e,value:r})},os=t=>{let e=Cf(16),{enabledCollectionSlugs:o}=t,[r]=bf(),n;e[0]!==o?.[0]?(n=()=>o?.[0],e[0]=o?.[0],e[1]=n):n=e[1];let[i]=ts(n),[l,s]=ts(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}=Lt(c),m,f;e[5]!==r||e[6]!==p?(m=()=>r.registerCommand(st,I=>(s(I?.replace?I?.replace.nodeKey:null),p(),!0),Tf),f=[r,p],e[5]=r,e[6]=p,e[7]=m,e[8]=f):(m=e[7],f=e[8]),kf(m,f);let h;e[9]!==d||e[10]!==r||e[11]!==l?(h=I=>{let{collectionSlug:A,doc:b}=I;Ef({editor:r,relationTo:A,replaceNodeKey:l,value:b.id}),d()},e[9]=d,e[10]=r,e[11]=l,e[12]=h):h=e[12];let x=h,_;return e[13]!==a||e[14]!==x?(_=oo(a,{onSelect:x}),e[13]=a,e[14]=x,e[15]=_):_=e[15],_},rs=t=>(t?.enabledCollectionSlugs?.length??-1)>0?oo(os,{...t}):oo(Dt,{...t,children:oo(os,{...t})});var cr=Df("INSERT_RELATIONSHIP_COMMAND"),ns=t=>{let e=wf(10),{clientProps:o}=t,[r]=Sf(),{config:n}=yf(),{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(Ff),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([Ne]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return r.registerCommand(cr,$f,Af)},u=[r],e[5]=r,e[6]=s,e[7]=u):(s=e[6],u=e[7]),Of(s,u);let c;return e[8]!==l?(c=Nf(rs,{enabledCollectionSlugs:l}),e[8]=l,e[9]=c):c=e[9],c};function Ff(t){let{slug:e}=t;return e}function $f(t){let e=Rf()||If();if(Mf(e)){let o=je(t),{focus:r}=e,n=r.getNode();Lf(o),vf(n)&&!n.__first&&n.remove()}return!0}var Bf=y({nodes:[Ne],plugins:[{Component:ns,position:"normal"}],slashMenu:{groups:[Q([{Icon:sr,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(st,{replace:!1})}}])]},toolbarFixed:{groups:[_e([{ChildComponent:sr,isActive:({selection:t})=>{if(!Pf(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return ar(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(st,{replace:!1})}}])]}});import{c as ds}from"react/compiler-runtime";import{jsx as de,jsxs as n1}from"react/jsx-runtime";import{useLexicalComposerContext as i1}from"@lexical/react/LexicalComposerContext.js";import{useScrollInfo as l1,useThrottledEffect as s1,useTranslation as a1}from"@payloadcms/ui";import*as Se from"react";import{useMemo as c1}from"react";import{c as Hf}from"react/compiler-runtime";import{jsx as jf}from"react/jsx-runtime";import{mergeRegister as Uf}from"@lexical/utils";import{$addUpdateTag as Gf,$getSelection as Wf}from"lexical";import{useEffect as ro,useState as ur}from"react";var dr="toolbar-popup__button",yt=t=>{let e=Hf(34),{children:o,editor:r,item:n}=t,[i,l]=ur(!0),[s,u]=ur(!1),[c,d]=ur(dr),a=U(),p;e[0]!==s||e[1]!==r||e[2]!==a||e[3]!==i||e[4]!==n?(p=()=>{r.getEditorState().read(()=>{let M=Wf();if(M){if(n.isActive){let D=n.isActive({editor:r,editorConfigContext:a,selection:M});s!==D&&u(D)}if(n.isEnabled){let D=n.isEnabled({editor:r,editorConfigContext:a,selection:M});i!==D&&l(D)}}})},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 x,_;e[9]!==m?(x=()=>(document.addEventListener("mouseup",m),()=>{document.removeEventListener("mouseup",m)}),_=[m],e[9]=m,e[10]=x,e[11]=_):(x=e[10],_=e[11]),ro(x,_);let I,A;e[12]!==r||e[13]!==m?(I=()=>Uf(r.registerUpdateListener(()=>{m()})),A=[r,m],e[12]=r,e[13]=m,e[14]=I,e[15]=A):(I=e[14],A=e[15]),ro(I,A);let b;e[16]!==s||e[17]!==i||e[18]!==n.key?(b=()=>{d([dr,i===!1?"disabled":"",s?"active":"",n?.key?`${dr}-`+n.key:""].filter(Boolean).join(" "))},e[16]=s,e[17]=i,e[18]=n.key,e[19]=b):b=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(b,T);let g;e[25]!==s||e[26]!==r||e[27]!==i||e[28]!==n?(g=()=>{if(i!==!1)return r.focus(()=>{r.update(Vf),n.onSelect?.({editor:r,isActive:s})}),!0},e[25]=s,e[26]=r,e[27]=i,e[28]=n,e[29]=g):g=e[29];let E;return e[30]!==o||e[31]!==c||e[32]!==g?(E=jf("button",{className:c,onClick:g,onMouseDown:Kf,type:"button",children:o}),e[30]=o,e[31]=c,e[32]=g,e[33]=E):E=e[33],E};function Vf(){Gf("toolbar")}function Kf(t){t.preventDefault()}import{c as us}from"react/compiler-runtime";import{jsx as tt}from"react/jsx-runtime";import fr,{useEffect as cs}from"react";import{mergeRegister as e1}from"@lexical/utils";import{useTranslation as t1}from"@payloadcms/ui";import{$getSelection as o1}from"lexical";import{jsx as Me,jsxs as is}from"react/jsx-runtime";import{Button as Jf}from"@payloadcms/ui";import{$addUpdateTag as Xf,isDOMNode as zf}from"lexical";import no,{useCallback as Zf,useEffect as It,useMemo as Yf,useRef as pr,useState as io}from"react";import{createPortal as qf}from"react-dom";var mr="toolbar-popup__dropdown-item",ls=no.createContext(null);function ss({active:t,children:e,editor:o,enabled:r,Icon:n,item:i,tooltip:l}){let[s,u]=io(mr);It(()=>{u([mr,r===!1?"disabled":"",t?"active":"",i?.key?`${mr}-${i.key}`:""].filter(Boolean).join(" "))},[r,t,s,i.key]);let c=pr(null),d=no.use(ls);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]),Me(Jf,{"aria-label":l,buttonStyle:"none",className:s,disabled:r===!1,icon:n,iconPosition:"left",iconStyle:"none",onClick:()=>{r!==!1&&o.focus(()=>{o.update(()=>{Xf("toolbar")}),i.onSelect?.({editor:o,isActive:t})})},onMouseDown:p=>{p.preventDefault()},ref:c,tooltip:l,type:"button",children:e})}function Qf({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:r}){let[n,i]=io(),[l,s]=io(),u=Zf(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=Yf(()=>({registerItem:u}),[u]);return It(()=>{n!=null&&l==null&&s(n[0]),l!=null&&l?.current!=null&&l.current.focus()},[n,l]),Me(ls,{value:d,children:Me("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:c,ref:e,children:t})})}function as({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:r=!1,Icon:n,itemsContainerClassNames:i,label:l,stopCloseOnClickSelf:s}){let u=pr(null),c=pr(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:x,top:_}=f.getBoundingClientRect(),I=window.scrollY||document.documentElement.scrollTop;h.style.top=`${_+I+f.offsetHeight+5}px`,h.style.left=`${Math.min(x-5,window.innerWidth-h.offsetWidth-20)}px`}},[u,c,d]),It(()=>{let f=c.current;if(f!==null&&d){let h=x=>{let _=x.target;zf(_)&&(s&&u.current&&u.current.contains(_)||f.contains(_)||a(!1))};return document.addEventListener("click",h),()=>{document.removeEventListener("click",h)}}},[u,c,d,s]);let m=qf(Me(Qf,{dropDownRef:u,itemsContainerClassNames:i,onClose:p,children:o}),document.body);return is(no.Fragment,{children:[is("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&&Me(n,{}),l&&Me("span",{className:"toolbar-popup__dropdown-label",children:l}),Me("i",{className:"toolbar-popup__dropdown-caret"})]}),d&&Me(no.Fragment,{children:m})]})}var hr="toolbar-popup__dropdown",r1=t=>{let e=us(18),{active:o,anchorElem:r,editor:n,enabled:i,item:l}=t,{i18n:s}=t1(),{fieldProps:u}=U(),{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(ss,{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},Ue=t=>{let e=us(36),{anchorElem:o,classNames:r,editor:n,group:i,Icon:l,itemsContainerClassNames:s,label:u,maxActiveItems:c,onActiveChange:d}=t,a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=[],e[0]=a):a=e[0];let[p,m]=fr.useState(a),f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f=[],e[1]=f):f=e[1];let[h,x]=fr.useState(f),[_,I]=fr.useState(!0),A=U(),{items:b,key:T}=i,g;e[2]!==n||e[3]!==A||e[4]!==i||e[5]!==b||e[6]!==c||e[7]!==d?(g=()=>{n.getEditorState().read(()=>{let $=o1();if(!$)return;let G=[],V=[],pe=[];for(let H of b)H.isActive&&(!c||G.length<c)&&H.isActive({editor:n,editorConfigContext:A,selection:$})&&(G.push(H.key),V.push(H)),H.isEnabled?H.isEnabled({editor:n,editorConfigContext:A,selection:$})&&pe.push(H.key):pe.push(H.key);i.isEnabled&&I(i.isEnabled({editor:n,editorConfigContext:A,selection:$})),m(G),x(pe),d&&d({activeItems:V})})},e[2]=n,e[3]=A,e[4]=i,e[5]=b,e[6]=c,e[7]=d,e[8]=g):g=e[8];let E=g,M,D;e[9]!==E?(M=()=>{E()},D=[E],e[9]=E,e[10]=M,e[11]=D):(M=e[10],D=e[11]),cs(M,D);let P,v;e[12]!==n||e[13]!==E?(P=()=>e1(n.registerUpdateListener(()=>{E()})),v=[n,E],e[12]=n,e[13]=E,e[14]=P,e[15]=v):(P=e[14],v=e[15]),cs(P,v);let N=`${T} dropdown`,C=`${hr}-${T}`,w;e[16]!==r?(w=r||[],e[16]=r,e[17]=w):w=e[17];let L;e[18]!==w||e[19]!==C?(L=[hr,C,...w].filter(Boolean),e[18]=w,e[19]=C,e[20]=L):L=e[20];let S=L.join(" "),R=!_,k;e[21]!==s?(k=s||[],e[21]=s,e[22]=k):k=e[22];let F;return e[23]!==l||e[24]!==p||e[25]!==o||e[26]!==n||e[27]!==h||e[28]!==T||e[29]!==b||e[30]!==u||e[31]!==S||e[32]!==R||e[33]!==k||e[34]!==N?(F=tt(as,{buttonAriaLabel:N,buttonClassName:S,disabled:R,Icon:l,itemsContainerClassNames:[`${hr}-items`,...k],label:u,children:b.length?b.map($=>tt(r1,{active:p.includes($.key),anchorElem:o,editor:n,enabled:h.includes($.key),item:$},$.key)):null},T),e[23]=l,e[24]=p,e[25]=o,e[26]=n,e[27]=h,e[28]=T,e[29]=b,e[30]=u,e[31]=S,e[32]=R,e[33]=k,e[34]=N,e[35]=F):F=e[35],F};function u1({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(yt,{editor:e,item:o,children:de(o.ChildComponent,{})},o.key):null}function d1(t){let e=ds(23),{anchorElem:o,editor:r,editorConfig:n,group:i,index:l}=t,{i18n:s}=a1(),{fieldProps:u}=U(),{featureClientSchemaMap:c,schemaPath:d}=u,[a,p]=Se.useState(void 0),[m,f]=Se.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 x;e[4]!==i?(x=[i],e[4]=i,e[5]=x):x=e[5],Se.useEffect(h,x);let _;e[6]!==c||e[7]!==i.ChildComponent||e[8]!==i.items||e[9]!==i.type||e[10]!==s||e[11]!==d?(_=T=>{let{activeItems:g}=T;if(!g.length){i?.type==="dropdown"&&i.items.length&&i.ChildComponent?(f(()=>i.ChildComponent),p(void 0)):(f(void 0),p(void 0));return}let E=g[0],M=E.key;E.label&&(M=typeof E.label=="function"?E.label({featureClientSchemaMap:c,i18n:s,schemaPath:d}):E.label),M.length>25&&(M=M.substring(0,25)+"..."),g.length===1?(p(M),f(()=>E.ChildComponent)):(p(s.t("lexical:general:toolbarItemsActive",{count:g.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]=_):_=e[12];let I=_,A=`fixed-toolbar__group fixed-toolbar__group-${i.key}`,b;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]!==I||e[21]!==A?(b=n1("div",{className:A,children:[i.type==="dropdown"&&i.items.length?m?de(Ue,{anchorElem:o,editor:r,group:i,Icon:m,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:i.maxActiveItems??1,onActiveChange:I}):de(Ue,{anchorElem:o,editor:r,group:i,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:i.maxActiveItems??1,onActiveChange:I}):null,i.type==="buttons"&&i.items.length?i.items.map(T=>de(u1,{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]=I,e[21]=A,e[22]=b):b=e[22],b}function m1({anchorElem:t,clientProps:e,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let i=Se.useRef(null),{y:l}=l1(),s=c1(()=>{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 s1(()=>{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(Se.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((u,c)=>de(d1,{anchorElem:t,editor:o,editorConfig:r,group:u,index:c},u.key))})})}var ms=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return ms(t.parentEditor)}return!1},ps=t=>{let e=ds(6),{clientProps:o}=t,[r]=i1(),n=U(),{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=ms(n);if(o?.disableIfParentHasFixedToolbar&&d){c=null;break e}if(!s?.features?.toolbarFixed?.groups?.length){c=null;break e}u=de(m1,{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 p1=y({plugins:[{Component:ps,position:"aboveContainer"}]});import{c as gs}from"react/compiler-runtime";import{jsx as ge,jsxs as xs}from"react/jsx-runtime";import{useLexicalComposerContext as f1}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Cs}from"@lexical/utils";import{$getSelection as bs,$isRangeSelection as fs,$isTextNode as h1,COMMAND_PRIORITY_LOW as g1,getDOMSelection as _s,SELECTION_CHANGE_COMMAND as x1}from"lexical";import{useCallback as so,useEffect as Rt,useRef as hs,useState as C1}from"react";import*as ao from"react";import{createPortal as b1}from"react-dom";function gr(t,e){let o=t.getRangeAt(0),r;if(t.anchorNode===e){let n=e;for(;n.firstElementChild!=null;)n=n.firstElementChild;r=n.getBoundingClientRect()}else r=o.getBoundingClientRect();return r}function 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 x=0;return!e&&f<m.top&&!s&&(x=a.height+u.height+c*2,f+=x),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)`),x}function _1({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&ge(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?ge(yt,{editor:e,item:o,children:ge(o.ChildComponent,{})},o.key):null}function T1(t){let e=gs(19),{anchorElem:o,editor:r,group:n,index:i}=t,{editorConfig:l}=U(),[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:x}=h;if(!x.length){n?.type==="dropdown"&&n.items.length&&n.ChildComponent?u(()=>n.ChildComponent):u(void 0);return}let _=x[0];u(()=>_?.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=xs("div",{className:m,children:[n.type==="dropdown"&&n.items.length?s?ge(Ue,{anchorElem:o,editor:r,group:n,Icon:s,maxActiveItems:n.maxActiveItems??1,onActiveChange:p}):ge(Ue,{anchorElem:o,editor:r,group:n,maxActiveItems:n.maxActiveItems??1,onActiveChange:p}):null,n.type==="buttons"&&n.items.length?n.items.map(h=>ge(_1,{anchorElem:o,editor:r,item:h},h.key)):null,i<l.features.toolbarInline?.groups.length-1&&ge("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 k1({anchorElem:t,editor:e}){let o=hs(null),r=hs(null),{editorConfig:n}=U(),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"))},[]);Rt(()=>(document.addEventListener("mousemove",l),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",s)}),[o,l,s]);let u=so(()=>{let c=bs(),d=_s(e._window);if(o.current===null)return;let a=t.querySelector(":scope > .link-editor"),p=a!==null&&"style"in a&&a?.style?.opacity==="1",m=e.getRootElement();if(c!==null&&d!==null&&!d.isCollapsed&&m!==null&&m.contains(d.anchorNode)){let f=gr(d,m),h=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 Rt(()=>{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]),Rt(()=>(e.getEditorState().read(()=>{u()}),Cs(e.registerUpdateListener(({editorState:c})=>{c.read(()=>{u()})}),e.registerCommand(x1,()=>(u(),!1),g1))),[e,u]),xs("div",{className:"inline-toolbar-popup",ref:o,children:[ge("div",{className:"caret",ref:r}),n?.features&&n.features?.toolbarInline?.groups.map((c,d)=>ge(T1,{anchorElem:t,editor:e,group:c,index:d},c.key))]})}function E1(t,e){let o=gs(12),[r,n]=C1(!1),i;o[0]!==t?(i=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let p=bs(),m=_s(t._window),f=t.getRootElement();if(m!==null&&(!fs(p)||f===null||!f.contains(m.anchorNode))){n(!1);return}if(!fs(p))return;if(p.getTextContent()!==""){let x=p.getNodes(),_=!1;for(let I of x)if(h1(I)){n(!0),_=!0;break}_||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]),Rt(s,u);let c,d;if(o[5]!==t||o[6]!==l?(c=()=>Cs(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]),Rt(c,d),!r||!t.isEditable())return null;let a;return o[9]!==e||o[10]!==t?(a=b1(ge(k1,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=a):a=o[11],a}var Ts=t=>{let{anchorElem:e}=t,[o]=f1();return E1(o,e)};var w1=y({plugins:[{Component:Ts,position:"floatingAnchorElem"}]});import{TableCellNode as fg,TableNode as hg,TableRowNode as gg}from"@lexical/table";import{jsx as ks}from"react/jsx-runtime";import"react";var xr=()=>ks("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:ks("path",{clipRule:"evenodd",d:"M5.33333 4.5C4.8731 4.5 4.5 4.8731 4.5 5.33333V7.5H9.5V4.5H5.33333ZM5.33333 3.5C4.32081 3.5 3.5 4.32081 3.5 5.33333V14.6667C3.5 15.6792 4.32081 16.5 5.33333 16.5H14.6667C15.6792 16.5 16.5 15.6792 16.5 14.6667V5.33333C16.5 4.32081 15.6792 3.5 14.6667 3.5H5.33333ZM10.5 4.5V7.5H15.5V5.33333C15.5 4.8731 15.1269 4.5 14.6667 4.5H10.5ZM15.5 8.5H10.5V11.5H15.5V8.5ZM15.5 12.5H10.5V15.5H14.6667C15.1269 15.5 15.5 15.1269 15.5 14.6667V12.5ZM9.5 15.5V12.5H4.5V14.6667C4.5 15.1269 4.8731 15.5 5.33333 15.5H9.5ZM4.5 11.5H9.5V8.5H4.5V11.5Z",fill:"currentColor",fillRule:"evenodd"})});import{$createTableCellNode as N1,$createTableNode as S1,$createTableRowNode as L1,$isTableCellNode as Es,$isTableNode as Cr,$isTableRowNode as br,TableCellHeaderStates as co,TableCellNode as y1,TableNode as I1,TableRowNode as R1}from"@lexical/table";import{$isParagraphNode as v1,$isTextNode as M1}from"lexical";var Ns=/^\|(.+)\|\s?$/,A1=/^(\| ?:?-*:? ?)+\|\s?$/,Ss=({allTransformers:t})=>({type:"element",dependencies:[I1,R1,y1],export:e=>{if(!Cr(e))return null;let o=[];for(let r of e.getChildren()){let n=[];if(!br(r))continue;let i=!1;for(let l of r.getChildren())Es(l)&&(n.push(Ur(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:
|
|
40
|
-
`);let o=N1(co.NO_STATUS);return jr(t,e,o),o},ws=(t,e)=>{let o=t.match(Ns);return!o||!o[1]?null:o[1].split("|").map(r=>Ls(r,e))};import{c as F1}from"react/compiler-runtime";import{jsx as B,jsxs as Le}from"react/jsx-runtime";import{useLexicalComposerContext as vs}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as $1}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as Tr,$deleteTableColumn__EXPERIMENTAL as P1,$deleteTableRow__EXPERIMENTAL as B1,$getNodeTriplet as H1,$getTableCellNodeFromLexicalNode as Is,$getTableColumnIndexFromTableCellNode as j1,$getTableNodeFromLexicalNodeOrThrow as ye,$getTableRowIndexFromTableCellNode as U1,$insertTableColumn__EXPERIMENTAL as G1,$insertTableRow__EXPERIMENTAL as W1,$isTableCellNode as Ms,$isTableSelection as vt,$unmergeCell as V1,getTableElement as kr,getTableObserverFromTableElement as Er,TableCellHeaderStates as Ae,TableCellNode as K1}from"@lexical/table";import{mergeRegister as J1}from"@lexical/utils";import{useScrollInfo as X1}from"@payloadcms/ui";import{$createParagraphNode as z1,$getSelection as mo,$isElementNode as Z1,$isParagraphNode as Y1,$isRangeSelection as wr,$isTextNode as q1,$setSelection as Q1,COMMAND_PRIORITY_CRITICAL as eh,getDOMSelection as th,isDOMNode as oh,SELECTION_CHANGE_COMMAND as rh}from"lexical";import*as Nr from"react";import{useCallback as me,useEffect as ot,useRef as uo,useState as rt}from"react";import{createPortal as As}from"react-dom";import{jsx as _r,jsxs as O1}from"react/jsx-runtime";import"react";var ys=()=>O1("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[_r("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"}),_r("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"}),_r("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 Rs(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function nh(){let t=mo();if(wr(t)&&!t.isCollapsed()||vt(t)&&!t.anchor.is(t.focus)||!wr(t)&&!vt(t))return!1;let[e]=H1(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function ih(t){if(t.getChildrenSize()!==1)return!1;let e=t.getFirstChildOrThrow();return!(!Y1(e)||!e.isEmpty())}function lh(t){let e=t.getLastDescendant();q1(e)?e.select():Z1(e)?e.selectEnd():e!==null&&e.selectNext()}function sh({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[i]=vs(),l=uo(null),[s,u]=rt(n),[c,d]=rt({columns:1,rows:1}),[a,p]=rt(!1),[m,f]=rt(!1),{y:h}=X1();ot(()=>i.registerMutationListener(K1,C=>{C.get(s.getKey())==="updated"&&i.getEditorState().read(()=>{u(s.getLatest())})},{skipInitialization:!0}),[i,s]),ot(()=>{i.getEditorState().read(()=>{let C=mo();if(vt(C)){let w=Rs(C);d(Rs(C)),p(w.columns>1||w.rows>1)}f(nh())})},[i]),ot(()=>{let C=e.current,w=l.current,L=i.getRootElement();if(C!=null&&w!=null&&L!=null){let S=L.getBoundingClientRect(),R=C.getBoundingClientRect();w.style.opacity="1";let k=w.getBoundingClientRect(),F=5,$=R.right+F;if($+k.width>window.innerWidth||$+k.width>S.right){let V=R.left-k.width-F;$=(V<0?F:V)+window.pageXOffset}w.style.left=`${$+window.pageXOffset}px`;let G=R.top;if(G+k.height>window.innerHeight){let V=R.bottom-k.height;G=V<0?F:V}w.style.top=`${G}px`}},[e,l,i,h]),ot(()=>{function C(w){l.current!=null&&e.current!=null&&oh(w.target)&&!l.current.contains(w.target)&&!e.current.contains(w.target)&&r(!1)}return window.addEventListener("click",C),()=>window.removeEventListener("click",C)},[r,e]);let x=me(()=>{i.update(()=>{if(s.isAttached()){let C=ye(s),w=kr(C,i.getElementByKey(C.getKey()));if(w===null)throw new Error("Expected to find tableElement in DOM");let L=Er(w);L!==null&&L.$clearHighlight(),C.markDirty(),u(s.getLatest())}Q1(null)})},[i,s]),_=()=>{i.update(()=>{let C=mo();if(vt(C)){let L=C.getNodes().filter(Ms);if(L.length===0)return;let S=ye(L[0]),[R]=Tr(S,null,null),k=1/0,F=-1/0,$=1/0,G=-1/0,V=new Set;for(let Y of R)for(let K of Y){if(!K||!K.cell)continue;let oe=K.cell.getKey();if(!V.has(oe)&&L.some(re=>re.is(K.cell))){V.add(oe);let re=K.startRow,le=K.startColumn,De=K.cell.__rowSpan||1,it=K.cell.__colSpan||1;k=Math.min(k,re),F=Math.max(F,re+De-1),$=Math.min($,le),G=Math.max(G,le+it-1)}}if(k===1/0||$===1/0)return;let pe=F-k+1,H=G-$+1,j=R?.[k]?.[$];if(!j?.cell)return;let te=j.cell;te.setColSpan(H),te.setRowSpan(pe);let ce=new Set([te.getKey()]);for(let Y=k;Y<=F;Y++)for(let K=$;K<=G;K++){let oe=R?.[Y]?.[K];if(!oe?.cell)continue;let re=oe.cell,le=re.getKey();ce.has(le)||(ce.add(le),ih(re)||te.append(...re.getChildren()),re.remove())}te.getChildrenSize()===0&&te.append(z1()),lh(te),o()}})},I=()=>{i.update(()=>{V1()})},A=me(C=>{i.update(()=>{for(let w=0;w<c.rows;w++)W1(C);o()})},[i,o,c.rows]),b=me(C=>{i.update(()=>{for(let w=0;w<c.columns;w++)G1(C);o()})},[i,o,c.columns]),T=me(()=>{i.update(()=>{B1(),o()})},[i,o]),g=me(()=>{i.update(()=>{ye(s).remove(),x(),o()})},[i,s,x,o]),E=me(()=>{i.update(()=>{P1(),o()})},[i,o]),M=me(()=>{i.update(()=>{let C=ye(s),w=U1(s),[L]=Tr(C,null,null),S=new Set,R=s.getHeaderStyles()^Ae.ROW;if(L[w])for(let k=0;k<L[w].length;k++){let F=L[w][k];F?.cell&&(S.has(F.cell)||(S.add(F.cell),F.cell.setHeaderStyles(R,Ae.ROW)))}x(),o()})},[i,s,x,o]),D=me(()=>{i.update(()=>{let C=ye(s),w=j1(s),[L]=Tr(C,null,null),S=new Set,R=s.getHeaderStyles()^Ae.COLUMN;if(L)for(let k=0;k<L.length;k++){let F=L?.[k]?.[w];F?.cell&&(S.has(F.cell)||(S.add(F.cell),F.cell.setHeaderStyles(R,Ae.COLUMN)))}x(),o()})},[i,s,x,o]),P=me(()=>{i.update(()=>{if(s.isAttached()){let C=ye(s);C&&C.setRowStriping(!C.getRowStriping())}x(),o()})},[i,s,x,o]),v=me(()=>{i.update(()=>{if(s.isAttached()){let C=ye(s);C&&C.setFrozenColumns(C.getFrozenColumns()===0?1:0)}x(),o()})},[i,s,x,o]),N=null;return t&&(a?N=B("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>_(),type:"button",children:B("span",{className:"text",children:"Merge cells"})}):m&&(N=B("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>I(),type:"button",children:B("span",{className:"text",children:"Unmerge cells"})}))),As(Le("div",{className:"table-action-menu-dropdown",onClick:C=>{C.stopPropagation()},ref:l,children:[N?Le(Nr.Fragment,{children:[N,B("hr",{})]}):null,B("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>P(),type:"button",children:B("span",{className:"text",children:"Toggle Row Striping"})}),B("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>v(),type:"button",children:B("span",{className:"text",children:"Toggle First Column Freeze"})}),B("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>A(!1),type:"button",children:Le("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," above"]})}),B("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>A(!0),type:"button",children:Le("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," below"]})}),B("hr",{}),B("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>b(!1),type:"button",children:Le("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","left"]})}),B("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>b(!0),type:"button",children:Le("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","right"]})}),B("hr",{}),B("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>E(),type:"button",children:B("span",{className:"text",children:"Delete column"})}),B("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>T(),type:"button",children:B("span",{className:"text",children:"Delete row"})}),B("button",{className:"item","data-test-id":"table-delete",onClick:()=>g(),type:"button",children:B("span",{className:"text",children:"Delete table"})}),B("hr",{}),B("button",{className:"item","data-test-id":"table-row-header",onClick:()=>M(),type:"button",children:Le("span",{className:"text",children:[(s.__headerState&Ae.ROW)===Ae.ROW?"Remove":"Add"," ","row header"]})}),B("button",{className:"item","data-test-id":"table-column-header",onClick:()=>D(),type:"button",children:Le("span",{className:"text",children:[(s.__headerState&Ae.COLUMN)===Ae.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function ah({anchorElem:t,cellMerge:e}){let[o]=vs(),r=uo(null),n=uo(null),[i,l]=rt(!1),[s,u]=rt(null),c=me(()=>{let a=r.current,p=mo(),m=th(o._window),f=document.activeElement;function h(){a&&(a.classList.remove("table-cell-action-button-container--active"),a.classList.add("table-cell-action-button-container--inactive")),u(null)}if(p==null||a==null)return h();let x=o.getRootElement(),_=null,I=null;if(wr(p)&&x!==null&&m!==null&&x.contains(m.anchorNode)){let b=Is(p.anchor.getNode());if(b==null||(I=o.getElementByKey(b.getKey()),I==null||!b.isAttached()))return h();let T=ye(b),g=kr(T,o.getElementByKey(T.getKey()));if(g===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");_=Er(g),u(b)}else if(vt(p)){let b=Is(p.anchor.getNode());if(!Ms(b))throw new Error("TableSelection anchorNode must be a TableCellNode");let T=ye(b),g=kr(T,o.getElementByKey(T.getKey()));if(g===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");_=Er(g),I=o.getElementByKey(b.getKey())}else if(!f)return h();if(_===null||I===null)return h();let A=!_||!_.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",A),a.classList.toggle("table-cell-action-button-container--inactive",!A),A){let b=I.getBoundingClientRect(),T=t.getBoundingClientRect(),g=b.top-T.top,E=b.right-T.left;a.style.transform=`translate(${E}px, ${g}px)`}},[o,t]);ot(()=>{let a,p=()=>{a=void 0,o.getEditorState().read(c)},m=()=>(a===void 0&&(a=setTimeout(p,0)),!1);return J1(o.registerUpdateListener(m),o.registerCommand(rh,m,eh),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]),B("div",{className:"table-cell-action-button-container",ref:r,children:s!=null&&Le(Nr.Fragment,{children:[B("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),l(!i)},ref:n,type:"button",children:B(ys,{})}),i&&B(sh,{cellMerge:e,contextRef:n,onClose:()=>l(!1),setIsMenuOpen:l,tableCellNode:s})]})})}var Ds=t=>{let e=F1(3),{anchorElem:o}=t,r=$1(),n;return e[0]!==o||e[1]!==r?(n=As(r?B(ah,{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 ch}from"react/compiler-runtime";import{jsx as fo,jsxs as uh}from"react/jsx-runtime";import{useLexicalComposerContext as dh}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as mh}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as ph,$getTableNodeFromLexicalNodeOrThrow as Sr,$getTableRowIndexFromTableCellNode as fh,$isTableCellNode as Os,$isTableRowNode as hh,getDOMCellFromTarget as gh,getTableElement as xh,TableNode as Fs}from"@lexical/table";import{calculateZoomLevel as $s,mergeRegister as Ch}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Lr,isHTMLElement as bh}from"lexical";import*as Bs from"react";import{useCallback as Mt,useEffect as yr,useRef as po,useState as nt}from"react";import{createPortal as _h}from"react-dom";var Th=33,Ps=92;function kh({editor:t}){let e=po(null),o=po(null),r=po(null),[n,i]=nt(!1),l=U(),s=po(null),[u,c]=nt(null),[d,a]=nt(null),[p,m]=nt(!1),[f,h]=nt(null),x=Mt(()=>{a(null),e.current=null,h(null),s.current=null,r.current=null},[]),_=v=>(v.buttons&1)===1;yr(()=>{let v=new Set;return Ch(t.registerMutationListener(Fs,N=>{for(let[C,w]of N)w==="destroyed"?v.delete(C):v.add(C);i(v.size>0)}),t.registerNodeTransform(Fs,N=>{if(N.getColWidths())return N;let C=N.getColumnCount(),w=Ps;return N.setColWidths(Array(C).fill(w)),N}))},[t]),yr(()=>{if(!n)return;let v=L=>{let S=L.target;if(bh(S)){if(f){c({x:L.clientX,y:L.clientY});return}if(m(_(L)),!(o.current&&o.current.contains(S))&&e.current!==S){e.current=S;let R=gh(S);R&&d!==R?t.getEditorState().read(()=>{let k=Lr(R.elem);if(!k)throw new Error("TableCellResizer: Table cell node not found.");let F=Sr(k),$=xh(F,t.getElementByKey(F.getKey()));if(!$)throw new Error("TableCellResizer: Table element not found.");e.current=S,r.current=$.getBoundingClientRect(),a(R)},{editor:t}):R==null&&x()}}},N=L=>{m(!0)},C=L=>{m(!1)},w=t.registerRootListener((L,S)=>{S?.removeEventListener("mousemove",v),S?.removeEventListener("mousedown",N),S?.removeEventListener("mouseup",C),L?.addEventListener("mousemove",v),L?.addEventListener("mousedown",N),L?.addEventListener("mouseup",C)});return()=>{w()}},[d,f,t,n,x]);let I=v=>v==="bottom",A=Mt(v=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let N=Lr(d.elem);if(!Os(N))throw new Error("TableCellResizer: Table cell node not found.");let C=Sr(N),w=fh(N),L=C.getChildren(),R=N.getColSpan()===C.getColumnCount()?w:w+N.getRowSpan()-1;if(R>=L.length||R<0)throw new Error("Expected table cell to be inside of table row.");let k=L[R];if(!hh(k))throw new Error("Expected table row");let F=k.getHeight();if(F===void 0){let G=k.getChildren();F=Math.min(...G.map(V=>b(V,t)??1/0))}let $=Math.max(F+v,Th);k.setHeight($)},{tag:"skip-scroll-into-view"})},[d,t]),b=(v,N)=>N.getElementByKey(v.getKey())?.clientHeight,T=(v,N)=>{let C;return N.forEach(w=>{w.forEach((L,S)=>{L.cell===v&&(C=S)})}),C},g=Mt(v=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let N=Lr(d.elem);if(!Os(N))throw new Error("TableCellResizer: Table cell node not found.");let C=Sr(N),[w]=ph(C,null,null),L=T(N,w);if(L===void 0)throw new Error("TableCellResizer: Table column not found.");let S=C.getColWidths();if(!S)return;let R=S[L];if(R===void 0)return;let k=[...S],F=Math.max(R+v,Ps);k[L]=F,C.setColWidths(k)},{tag:"skip-scroll-into-view"})},[d,t]),E=Mt(v=>{let N=C=>{if(C.preventDefault(),C.stopPropagation(),!d)throw new Error("TableCellResizer: Expected active cell.");if(s.current){let{x:w,y:L}=s.current;if(d===null)return;let S=$s(C.target);if(I(v)){let R=(C.clientY-L)/S;A(R)}else{let R=(C.clientX-w)/S;g(R)}x(),document.removeEventListener("mouseup",N)}};return N},[d,x,g,A]),M=Mt(v=>N=>{if(N.preventDefault(),N.stopPropagation(),!d)throw new Error("TableCellResizer: Expected active cell.");s.current={x:N.clientX,y:N.clientY},c(s.current),h(v),document.addEventListener("mouseup",E(v))},[d,E]),[D,P]=nt({bottom:null,left:null,right:null,top:null});return yr(()=>{if(d){let{height:v,left:N,top:C,width:w}=d.elem.getBoundingClientRect(),L=$s(d.elem),S=10,R={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${S}px`,left:`${window.scrollX+N}px`,top:`${window.scrollY+C+v-S/2}px`,width:`${w}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${v}px`,left:`${window.scrollX+N+w-S/2}px`,top:`${window.scrollY+C}px`,width:`${S}px`}},k=r.current;f&&u&&k&&(I(f)?(R[f].left=`${window.scrollX+k.left}px`,R[f].top=`${window.scrollY+u.y/L}px`,R[f].height="3px",R[f].width=`${k.width}px`):(R[f].top=`${window.scrollY+k.top}px`,R[f].left=`${window.scrollX+u.x/L}px`,R[f].width="3px",R[f].height=`${k.height}px`),R[f].backgroundColor="#adf"),P(R)}else P({bottom:null,left:null,right:null,top:null})},[d,f,u]),fo("div",{ref:o,children:d!=null&&!p&&uh(Bs.Fragment,{children:[fo("div",{className:`${l.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:M("right"),style:D.right||void 0}),fo("div",{className:`${l.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:M("bottom"),style:D.bottom||void 0})]})})}var Hs=()=>{let t=ch(3),[e]=dh(),o=mh(),r,n;return t[0]!==e||t[1]!==o?(n=o?_h(fo(kh,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=n):n=t[2],r=n,r};import{c as Rh}from"react/compiler-runtime";import{jsx as Ir,jsxs as vh,Fragment as Mh}from"react/jsx-runtime";import{useLexicalComposerContext as Xs}from"@lexical/react/LexicalComposerContext";import{$getTableAndElementByKey as Ah,$getTableColumnIndexFromTableCellNode as Dh,$getTableRowIndexFromTableCellNode as Oh,$insertTableColumn__EXPERIMENTAL as Fh,$insertTableRow__EXPERIMENTAL as $h,$isTableCellNode as Ph,$isTableNode as Gs,getTableElement as Bh,TableNode as Hh}from"@lexical/table";import{$findMatchingParent as jh,mergeRegister as Uh}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Ws,isHTMLElement as Gh}from"lexical";import{useEffect as Vs,useMemo as Wh,useRef as Ks,useState as ho}from"react";import"react";import{createPortal as Vh}from"react-dom";import{c as Lh}from"react/compiler-runtime";import{useEffect as yh,useRef as Ih}from"react";var Eh="Expected a function",wh=Math.max,Nh=Math.min;function Sh(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(Eh);e=e||0,typeof o=="object"&&(s=!!o.leading,u="maxWait"in o,c=u?wh(o.maxWait||0,e):c,p="trailing"in o?!!o.trailing:p);function m(g){let E=r,M=l;return r=l=void 0,i=g,d=t.apply(M,E),d}function f(g){return i=g,a=setTimeout(_,e),s?m(g):d}function h(g){let E=g-n,M=g-i,D=e-E;return u?Nh(D,c-M):D}function x(g){let E=g-n,M=g-i;return n===void 0||E>=e||E<0||u&&M>=c}function _(){let g=Date.now();if(x(g))return I(g);a=setTimeout(_,h(g))}function I(g){return a=void 0,p&&r?m(g):(r=l=void 0,d)}function A(){a!==void 0&&clearTimeout(a),i=0,r=n=l=a=void 0}function b(){return a===void 0?d:I(Date.now())}function T(){let g=Date.now(),E=x(g);if(r=arguments,l=this,n=g,E){if(a===void 0)return f(n);if(u)return clearTimeout(a),a=setTimeout(_,e),m(n)}return a===void 0&&(a=setTimeout(_,e)),d}return T.cancel=A,T.flush=b,T}var js=Sh;function Us(t,e,o){let r=Lh(6),n=Ih(null),i,l;r[0]!==t||r[1]!==o||r[2]!==e?(i=()=>(n.current=js(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]),yh(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 Js=20;function Kh({anchorElem:t}){let[e]=Xs(),o=U(),[r,n]=ho(!1),[i,l]=ho(!1),[s,u]=ho(!1),[c,d]=ho({}),a=Ks(new Set),p=Ks(null),m=Us(x=>{let{isOutside:_,tableDOMNode:I}=Jh(x,o.editorConfig?.lexical);if(_){n(!1),l(!1);return}if(!I)return;p.current=I;let A=null,b=null,T=null;if(e.getEditorState().read(()=>{let S=Ws(I);if(Ph(S)){let R=jh(S,k=>Gs(k));if(!Gs(R))return;if(T=Bh(R,e.getElementByKey(R.getKey())),T){let k=R.getChildrenSize(),F=R.getChildAtIndex(0)?.getChildrenSize(),$=Oh(S),G=Dh(S);$===k-1?A=S:G===F-1&&(b=S)}}},{editor:e}),!T)return;let g=T.parentElement;if(!g)return;let{bottom:E,height:M,left:D,right:P,width:v,y:N}=T.getBoundingClientRect(),C=!1;g&&g.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(C=g.scrollWidth>g.clientWidth);let{left:w,y:L}=t.getBoundingClientRect();A?(l(!1),n(!0),d({height:Js,left:C&&g?g.offsetLeft:D-w,top:E-L+5,width:C&&g?g.offsetWidth:v})):b&&(l(!0),n(!1),d({height:M,left:P-w+5,top:N-L,width:Js}))},50,250),f=Wh(()=>new ResizeObserver(()=>{n(!1),l(!1)}),[]);Vs(()=>{if(s)return document.addEventListener("mousemove",m),()=>{n(!1),l(!1),document.removeEventListener("mousemove",m)}},[s,m]),Vs(()=>Uh(e.registerMutationListener(Hh,x=>{e.getEditorState().read(()=>{let _=!1;for(let[I,A]of x)switch(A){case"created":{a.current.add(I),_=!0;break}case"destroyed":{a.current.delete(I),_=!0;break}default:break}if(_){f.disconnect();for(let I of a.current){let{tableElement:A}=Ah(I);f.observe(A)}u(a.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,f]);let h=x=>{e.update(()=>{p.current&&(Ws(p.current)?.selectEnd(),x?($h(),n(!1)):(Fh(),l(!1)))})};return e?.isEditable()?vh(Mh,{children:[r&&Ir("button",{"aria-label":"Add Row",className:o.editorConfig.lexical.theme.tableAddRows,onClick:()=>h(!0),style:{...c},type:"button"}),i&&Ir("button",{"aria-label":"Add Column",className:o.editorConfig.lexical.theme.tableAddColumns,onClick:()=>h(!1),style:{...c},type:"button"})]}):null}function Jh(t,e){let o=t.target;if(Gh(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 zs(t){let e=Rh(2),{anchorElem:o}=t,r=o===void 0?document.body:o,[n]=Xs();if(!n?.isEditable())return null;let i;return e[0]!==r?(i=Vh(Ir(Kh,{anchorElem:r}),r),e[0]=r,e[1]=i):i=e[1],i}import{c as Xh}from"react/compiler-runtime";import{jsx as Rr,jsxs as zh}from"react/jsx-runtime";import{useLexicalComposerContext as Zh}from"@lexical/react/LexicalComposerContext";import{TablePlugin as Yh}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as qh,TableCellNode as Qh,TableNode as eg,TableRowNode as tg}from"@lexical/table";import{mergeRegister as og}from"@lexical/utils";import{formatDrawerSlug as rg,useEditDepth as ng}from"@payloadcms/ui";import{$getSelection as ig,$isRangeSelection as lg,COMMAND_PRIORITY_EDITOR as sg,createCommand as ag}from"lexical";import{createContext as cg,use as ug,useEffect as dg,useMemo as mg,useState as pg}from"react";import*as Zs from"react";var go=ag("OPEN_EMBED_DRAWER_COMMAND"),Ys=cg({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function qs({children:t}){let[e,o]=pg({cellEditorConfig:null,cellEditorPlugins:null});return Rr(Ys,{value:mg(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var Qs=()=>{let t=Xh(16),[e]=Zh(),o=ug(Ys),r=ng(),{fieldProps:n,uuid:i}=U(),{schemaPath:l}=n,s="lexical-table-create-"+i,u;t[0]!==r||t[1]!==s?(u=rg({slug:s,depth:r}),t[0]=r,t[1]=s,t[2]=u):u=t[2];let c=u,{toggleDrawer:d}=xe(c,!0),a;t[3]!==e||t[4]!==d?(a=()=>{if(!e.hasNodes([eg,tg,Qh]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return og(e.registerCommand(go,()=>{let h;return h=null,e.getEditorState().read(()=>{let x=ig();lg(x)&&(h=x)}),h&&d(),!0},sg))},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],dg(a,p);let m;t[10]!==e?(m=(h,x)=>{!x.columns||!x.rows||e.dispatchCommand(qh,{columns:String(x.columns),rows:String(x.rows)})},t[10]=e,t[11]=m):m=t[11];let f;return t[12]!==c||t[13]!==l||t[14]!==m?(f=zh(Zs.Fragment,{children:[Rr(lt,{drawerSlug:c,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:m,schemaPath:l,schemaPathSuffix:"fields"}),Rr(Yh,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]}),t[12]=c,t[13]=l,t[14]=m,t[15]=f):f=t[15],f};var xg=y({markdownTransformers:[Ss],nodes:[hg,fg,gg],plugins:[{Component:Qs,position:"normal"},{Component:Hs,position:"normal"},{Component:Ds,position:"floatingAnchorElem"},{Component:zs,position:"floatingAnchorElem"}],providers:[qs],slashMenu:{groups:[Q([{Icon:xr,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(go,{})}}])]},toolbarFixed:{groups:[_e([{ChildComponent:xr,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(go,{})}}])]}});import{$isNodeSelection as Xg}from"lexical";import{jsx as vr,jsxs as Cg}from"react/jsx-runtime";import"react";var Mr=()=>Cg("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:"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"}),vr("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"}),vr("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 Eg}from"react/jsx-runtime";import oa from"bson-objectid";import{$applyNodeReplacement as wg}from"lexical";import*as ra from"react";import{jsx as bg}from"react/jsx-runtime";import{DecoratorBlockNode as _g}from"@lexical/react/LexicalDecoratorBlockNode.js";import ea from"bson-objectid";import{$applyNodeReplacement as Tg}from"lexical";import"react";function Ar(t){return t.parentElement!=null&&t.parentElement.tagName==="LI"&&t.previousSibling===null&&t.getAttribute("aria-roledescription")==="checkbox"}function kg(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:ta({data:{fields:{},relationTo:r,value:o}})}}let e=t;return e.src.startsWith("file:///")||Ar(e),null}var At=class extends _g{__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:kg,priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new ea.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,relationTo:e.relationTo,value:e.value},r=ta({data:o});return r.setFormat(e.format),r}static isInline(){return!1}decorate(){return bg(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 ta({data:t}){return t?.id||(t.id=new ea.default().toHexString()),Tg(new At({data:t}))}var Ng=ra.lazy(()=>import("./component-NNKG7K3O.js").then(t=>({default:t.UploadComponent})));function Sg(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:Ge({data:{fields:{},relationTo:r,value:o}})}}let e=t;return e.src.startsWith("file:///")||Ar(e),null}var Ie=class extends At{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{img:e=>({conversion:Sg,priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new oa.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,relationTo:e.relationTo,value:e.value},r=Ge({data:o});return r.setFormat(e.format),r}decorate(){return Eg(Ng,{data:this.__data,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Ge({data:t}){return t?.id||(t.id=new oa.default().toHexString()),wg(new Ie({data:t}))}function Dr(t){return t instanceof Ie}import{c as Dg}from"react/compiler-runtime";import{jsx as Og}from"react/jsx-runtime";import{useLexicalComposerContext as Fg}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as $g,mergeRegister as Pg}from"@lexical/utils";import{useConfig as Bg}from"@payloadcms/ui";import{$getPreviousSelection as Hg,$getSelection as jg,$isParagraphNode as Ug,$isRangeSelection as Gg,COMMAND_PRIORITY_EDITOR as Wg,createCommand as Vg}from"lexical";import{useEffect as Kg}from"react";import{c as na}from"react/compiler-runtime";import{jsx as Or}from"react/jsx-runtime";import{useLexicalComposerContext as ia}from"@lexical/react/LexicalComposerContext.js";import{toast as Lg}from"@payloadcms/ui";import{$getNodeByKey as yg,COMMAND_PRIORITY_EDITOR as la}from"lexical";import{useEffect as sa,useState as Ig}from"react";var Rg=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=yg(o);n&&n.replace(Ge({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(Fr,{fields:null,relationTo:e,value:r})},vg=t=>{let e=na(13),{enabledCollectionSlugs:o}=t,[r]=ia(),[n,i]=Ig(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}=Lt(l),d,a;e[2]!==r||e[3]!==c?(d=()=>r.registerCommand(Ve,h=>(i(h?.replace?h?.replace.nodeKey:null),c(),!0),la),a=[r,c],e[2]=r,e[3]=c,e[4]=d,e[5]=a):(d=e[4],a=e[5]),sa(d,a);let p;e[6]!==s||e[7]!==r||e[8]!==n?(p=h=>{let{collectionSlug:x,doc:_}=h;s(),Rg({editor:r,relationTo:x,replaceNodeKey:n,value:_.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=Or(u,{onSelect:m}),e[10]=u,e[11]=m,e[12]=f):f=e[12],f},Mg=()=>{let t=na(3),[e]=ia(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Ve,Ag,la),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),sa(o,r),null},aa=t=>Or(Dt,{...t,FallbackComponent:Mg,uploads:!0,children:Or(vg,{...t})});function Ag(){return Lg.error("No upload collections enabled"),!0}var Fr=Vg("INSERT_UPLOAD_COMMAND"),ca=t=>{let e=Dg(5),[o]=Fg(),{config:r}=Bg(),{collections:n}=r,i,l;e[0]!==o?(i=()=>{if(!o.hasNodes([Ie]))throw new Error("UploadPlugin: UploadNode not registered on editor");return Pg(o.registerCommand(Fr,u=>(o.update(()=>{let c=jg()||Hg();if(Gg(c)){let d=Ge({data:{id:u.id,fields:u.fields,relationTo:u.relationTo,value:u.value}}),{focus:a}=c,p=a.getNode();$g(d),Ug(p)&&!p.__first&&p.remove()}}),!0),Wg))},l=[o],e[0]=o,e[1]=i,e[2]=l):(i=e[1],l=e[2]),Kg(i,l);let s;return e[3]!==n?(s=Og(aa,{enabledCollectionSlugs:n.map(Jg)}),e[3]=n,e[4]=s):s=e[4],s};function Jg(t){let{slug:e}=t;return e}var zg=y({nodes:[Ie],plugins:[{Component:ca,position:"normal"}],slashMenu:{groups:[Q([{Icon:Mr,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:[_e([{ChildComponent:Mr,isActive:({selection:t})=>{if(!Xg(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Dr(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ve,{replace:!1})}}])]}});import{c as Yg}from"react/compiler-runtime";import{jsx as Pr}from"react/jsx-runtime";import{ShimmerEffect as qg,useConfig as Qg}from"@payloadcms/ui";import{lazy as ex,Suspense as tx,useEffect as ox,useState as rx}from"react";var ua={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 xo={namespace:"lexical",theme:ua};function da({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}import{deepMerge as Zg}from"payload/shared";var ma=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}},o={};if(t.forEach(r=>{r.key==="toolbarFixed"&&r.sanitizedClientFeatureProps?.customGroups&&(o={...o,...r.sanitizedClientFeatureProps.customGroups})}),!t?.size)return e;t.forEach(r=>{if(r.providers?.length&&(e.providers=e.providers.concat(r.providers)),r.enableFormats?.length&&e.enabledFormats.push(...r.enableFormats),r.nodes?.length)for(let n of r.nodes)e.nodes.push(n);if(r.plugins?.length&&r.plugins.forEach((n,i)=>{e.plugins?.push({clientProps:r.sanitizedClientFeatureProps,Component:n.Component,key:r.key+i,position:n.position})}),r.toolbarInline?.groups?.length)for(let n of r.toolbarInline.groups){let i=e.toolbarInline.groups.find(l=>l.key===n.key);i?e.toolbarInline.groups=e.toolbarInline.groups.filter(l=>l.key!==n.key):i={...n,items:[]},n?.items?.length&&(i.items=i.items.concat(n.items)),e.toolbarInline?.groups.push(i)}if(r.toolbarFixed?.groups?.length)for(let n of r.toolbarFixed.groups){let i=e.toolbarFixed.groups.find(l=>l.key===n.key);i?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(l=>l.key!==n.key):i={...n,items:[]},n?.items?.length&&(i.items=i.items.concat(n.items)),e.toolbarFixed?.groups.push(i)}if(r.slashMenu?.groups){r.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(r.slashMenu.dynamicGroups));for(let n of r.slashMenu.groups){let i=e.slashMenu.groups.find(l=>l.key===n.key);i?e.slashMenu.groups=e.slashMenu.groups.filter(l=>l.key!==n.key):i={...n,items:[]},n?.items?.length&&(i.items=i.items.concat(n.items)),e.slashMenu.groups.push(i)}}if(r.markdownTransformers?.length)for(let n of r.markdownTransformers)typeof n=="function"?e.markdownTransformers.push(n({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(n);e.enabledFeatures.push(r.key)}),Object.keys(o).length>0&&(e.toolbarFixed.groups=e.toolbarFixed.groups.map(r=>{let n=o[r.key];return n?Zg(r,n):r})),e.toolbarInline.groups.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0),e.toolbarFixed.groups.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);for(let r of e.toolbarInline.groups)r.items.sort((n,i)=>n.order&&i.order?n.order-i.order:n.order?-1:i.order?1:0);for(let r of e.toolbarFixed.groups)r.items.sort((n,i)=>n.order&&i.order?n.order-i.order:n.order?-1:i.order?1:0);return e};function $r(t,e,o){return{admin:o,features:ma(t),lexical:e,resolvedFeatureMap:t}}var nx=ex(()=>import("./Field-DGC4DDYL.js").then(t=>({default:t.RichText}))),ix=t=>{let e=Yg(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?xo:s,{config:p}=Qg(),[m,f]=rx(null),h,x;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 I=[];for(let[T,g]of Object.entries(r))g.clientFeatureProvider&&I.push(g.clientFeatureProvider(g.clientFeatureProps));let A=a||xo,b=da({config:p,featureClientImportMap:n,featureClientSchemaMap:i,field:l,schemaPath:u??l.name,unSanitizedEditorConfig:{features:I,lexical:A}});f($r(b,A,d))},x=[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]=x):(h=e[11],x=e[12]),ox(h,x);let _;return e[13]!==m||e[14]!==t?(_=Pr(tx,{fallback:Pr(qg,{height:"35vh"}),children:m&&Pr(nx,{...t,editorConfig:m})}),e[13]=m,e[14]=t,e[15]=_):_=e[15],_};function lx(t){return t instanceof HTMLElement}function sx(...t){return t.filter(Boolean).join(" ")}var Co=new WeakMap;function pa(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function bo(t,e){let o=Co.get(t);if(o===void 0){let r=new Set,n=l=>{o!==void 0&&(o.start=pa(l))},i=l=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let u=pa(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},Co.set(t,o)}return o.listeners.add(e),()=>{ax(t,e)}}function ax(t,e){let o=Co.get(t);if(o===void 0)return;let{listeners:r}=o;r.delete(e),r.size===0&&(Co.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function cx(t,e){return bo(t,(o,r)=>{let[n,i]=o;n<0&&-n>Math.abs(i)&&e(n,r)})}function ux(t,e){return bo(t,(o,r)=>{let[n,i]=o;n>0&&n>Math.abs(i)&&e(n,r)})}function dx(t,e){return bo(t,(o,r)=>{let[n,i]=o;i<0&&-i>Math.abs(n)&&e(n,r)})}function mx(t,e){return bo(t,(o,r)=>{let[n,i]=o;i>0&&i>Math.abs(n)&&e(n,r)})}import{c as px}from"react/compiler-runtime";import{jsx as fx}from"react/jsx-runtime";import"react";var hx=()=>{let t=px(2),{EditButton:e}=Ce(),o;return t[0]!==e?(o=e?fx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as gx}from"react/compiler-runtime";import{jsx as xx}from"react/jsx-runtime";import"react";var Cx=()=>{let t=gx(2),{RemoveButton:e}=Ce(),o;return t[0]!==e?(o=e?xx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as bx}from"react/compiler-runtime";import{jsx as _x}from"react/jsx-runtime";import"react";var Tx=()=>{let t=bx(2),{Label:e}=Ce(),o;return t[0]!==e?(o=e?_x(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as kx}from"react/compiler-runtime";import{jsx as Ex}from"react/jsx-runtime";import"react";var wx=t=>{let e=kx(3),{children:o}=t,{InlineBlockContainer:r}=Ce(),n;return e[0]!==r||e[1]!==o?(n=r?Ex(r,{children:o}):null,e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{c as Nx}from"react/compiler-runtime";import{jsx as Sx}from"react/jsx-runtime";import"react";var Lx=t=>{let e=Nx(6),{children:o,editButton:r,Label:n,removeButton:i}=t,{BlockCollapsible:l}=Oe(),s;return e[0]!==l||e[1]!==n||e[2]!==o||e[3]!==r||e[4]!==i?(s=l?Sx(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 yx}from"react/compiler-runtime";import{jsx as Ix}from"react/jsx-runtime";import"react";var Rx=()=>{let t=yx(2),{EditButton:e}=Oe(),o;return t[0]!==e?(o=e?Ix(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as vx}from"react/compiler-runtime";import{jsx as Mx}from"react/jsx-runtime";import"react";var Ax=()=>{let t=vx(2),{RemoveButton:e}=Oe(),o;return t[0]!==e?(o=e?Mx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as Dx}from"qs-esm";var Ox=({apiURL:t,depth:e,draft:o,locale:r})=>async({id:i,collectionSlug:l,select:s})=>{let u=Dx({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{xt as $createAutoLinkNode,Wt as $createBlockNode,To as $createInlineBlockNode,Te as $createLinkNode,je as $createRelationshipNode,Ge as $createUploadNode,Ee as $isAutoLinkNode,pt as $isBlockNode,ko as $isInlineBlockNode,Z as $isLinkNode,ar as $isRelationshipNode,Dr as $isUploadNode,Sa as AlignFeatureClient,ke as AutoLinkNode,Lx as BlockCollapsible,Rx as BlockEditButton,be as BlockNode,Ax as BlockRemoveButton,va as BlockquoteFeatureClient,yc as BlocksFeatureClient,Yc as BoldFeatureClient,ae as CAN_USE_DOM,Ym as ChecklistFeatureClient,jp as DETAIL_TYPE_TO_DETAIL,$p as DOUBLE_LINE_BREAK,Qp as DebugJsxConverterFeatureClient,Gp as ELEMENT_FORMAT_TO_TYPE,Up as ELEMENT_TYPE_TO_FORMAT,ba as ENABLE_SLASH_MENU_COMMAND,ha as EditorConfigProvider,lt as FieldsDrawer,p1 as FixedToolbarFeatureClient,Wu as HeadingFeatureClient,sd as HorizontalRuleFeatureClient,Ke as INSERT_BLOCK_COMMAND,Je as INSERT_INLINE_BLOCK_COMMAND,Op as IS_ALL_FORMATTING,Ed as IndentFeatureClient,wx as InlineBlockContainer,hx as InlineBlockEditButton,Tx as InlineBlockLabel,_o as InlineBlockNode,Cx as InlineBlockRemoveButton,ou as InlineCodeFeatureClient,w1 as InlineToolbarFeatureClient,lu as ItalicFeatureClient,Bp as LTR_REGEX,bp as LexicalPluginToLexicalFeatureClient,Fm as LinkFeatureClient,ie as LinkNode,Fp as NON_BREAKING_SPACE,O as NodeFormat,ip as OrderedListFeatureClient,Lp as ParagraphFeatureClient,xa as Point,Pp as RTL_REGEX,_a as Rect,Bf as RelationshipFeatureClient,Ne as RelationshipNode,ix as RichTextField,Np as SlateToLexicalFeatureClient,du as StrikethroughFeatureClient,hu as SubscriptFeatureClient,bu as SuperscriptFeatureClient,Wp as TEXT_MODE_TO_TYPE,Hp as TEXT_TYPE_TO_FORMAT,Vp as TEXT_TYPE_TO_MODE,he as TOGGLE_LINK_COMMAND,xg as TableFeatureClient,Uc as TestRecorderFeatureClient,Ou as TextStateFeatureClient,yt as ToolbarButton,Ue as ToolbarDropdown,Jc as TreeViewFeatureClient,wu as UnderlineFeatureClient,pp as UnorderedListFeatureClient,zg as UploadFeatureClient,Ie as UploadNode,mx as addSwipeDownListener,cx as addSwipeLeftListener,ux as addSwipeRightListener,dx as addSwipeUpListener,Ho as createBlockNode,y as createClientFeature,xo as defaultEditorLexicalConfig,gr as getDOMRangeRect,Ta as getEnabledNodes,Ox as getRestPopulateFn,Xe as getSelectedNode,lx as isHTMLElement,Ca as isPoint,sx as joinClasses,$r as sanitizeClientEditorConfig,ma as sanitizeClientFeatures,lo as setFloatingElemPosition,Qt as setFloatingElemPositionForLinkEditor,Q as slashMenuBasicGroupWithItems,_e as toolbarAddDropdownGroupWithItems,Uo as toolbarFeatureButtonsGroupWithItems,ee as toolbarFormatGroupWithItems,ne as toolbarTextDropdownGroupWithItems,Oe as useBlockComponentContext,U as useEditorConfigContext,Ce as useInlineBlockComponentContext,ga as useLexicalDocumentDrawer,xe as useLexicalDrawer,Lt as useLexicalListDrawer};
|
|
38
|
+
`,Ui="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",Gi="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",Bp=new RegExp("^[^"+Gi+"]*["+Ui+"]"),Hp=new RegExp("^[^"+Ui+"]*["+Gi+"]"),jp={bold:O.IS_BOLD,code:O.IS_CODE,highlight:O.IS_HIGHLIGHT,italic:O.IS_ITALIC,strikethrough:O.IS_STRIKETHROUGH,subscript:O.IS_SUBSCRIPT,superscript:O.IS_SUPERSCRIPT,underline:O.IS_UNDERLINE},Up={directionless:O.IS_DIRECTIONLESS,unmergeable:O.IS_UNMERGEABLE},Gp={center:O.IS_ALIGN_CENTER,end:O.IS_ALIGN_END,justify:O.IS_ALIGN_JUSTIFY,left:O.IS_ALIGN_LEFT,right:O.IS_ALIGN_RIGHT,start:O.IS_ALIGN_START},Wp={[O.IS_ALIGN_CENTER]:"center",[O.IS_ALIGN_END]:"end",[O.IS_ALIGN_JUSTIFY]:"justify",[O.IS_ALIGN_LEFT]:"left",[O.IS_ALIGN_RIGHT]:"right",[O.IS_ALIGN_START]:"start"},Vp={normal:O.IS_NORMAL,segmented:O.IS_SEGMENTED,token:O.IS_TOKEN},Kp={[O.IS_NORMAL]:"normal",[O.IS_SEGMENTED]:"segmented",[O.IS_TOKEN]:"token"};var Wi={text:({node:t})=>{let e=t.text;return t.format&O.IS_BOLD&&(e=je("strong",{children:e})),t.format&O.IS_ITALIC&&(e=je("em",{children:e})),t.format&O.IS_STRIKETHROUGH&&(e=je("span",{style:{textDecoration:"line-through"},children:e})),t.format&O.IS_UNDERLINE&&(e=je("span",{style:{textDecoration:"underline"},children:e})),t.format&O.IS_CODE&&(e=je("code",{children:e})),t.format&O.IS_SUBSCRIPT&&(e=je("sub",{children:e})),t.format&O.IS_SUPERSCRIPT&&(e=je("sup",{children:e})),e}};import{jsx as Nt}from"react/jsx-runtime";var Vi={upload:({node:t})=>{let e=t;if(typeof e.value!="object")return null;let o=e.value,r=o.url;if(!o.mimeType.startsWith("image"))return Nt("a",{href:r,rel:"noopener noreferrer",children:o.filename});if(!o.sizes||!Object.keys(o.sizes).length)return Nt("img",{alt:o.filename,height:o.height,src:r,width:o.width});let n=[];for(let l in o.sizes){let i=o.sizes[l];if(!i||!i.width||!i.height||!i.mimeType||!i.filesize||!i.filename||!i.url)continue;let s=i?.url;n.push(Nt("source",{media:`(max-width: ${i.width}px)`,srcSet:s,type:i.mimeType},l))}return n.push(Nt("img",{alt:o?.filename,height:o?.height,src:r,width:o?.width},"image")),Nt("picture",{children:n})}};var tt={...Bi,...Wi,...Oi,...Mi,...ji,...Ai,...Di,...Pi,...Fi({}),...Vi,...Hi};import{jsx as Ji,Fragment as Jp}from"react/jsx-runtime";import ir from"react";function Ki(t){let e=!!t?.root?.children?.length,o=!1;if(t?.root?.children?.length===1&&t?.root?.children[0]?.type==="paragraph"){let r=t?.root?.children[0];if(!r?.children||r?.children?.length===0)o=!0;else if(r?.children?.length===1){let n=r?.children[0];n?.type==="text"&&(n?.text?.length||(o=!0))}}return!(!e||o)}function Xi({converters:t,data:e,disableIndent:o,disableTextAlign:r}){return Ki(e)?zi({converters:t,disableIndent:o,disableTextAlign:r,nodes:e?.root?.children,parent:e?.root}):Ji(Jp,{})}function zi({converters:t,disableIndent:e,disableTextAlign:o,nodes:r,parent:n}){let l=t.unknown;return r.map((s,u)=>{let c;s.type==="block"?(c=t?.blocks?.[s?.fields?.blockType],!c&&!l&&console.error(`Lexical => JSX converter: Blocks converter: found ${s?.fields?.blockType} block, but no converter is provided`)):s.type==="inlineBlock"?(c=t?.inlineBlocks?.[s?.fields?.blockType],!c&&!l&&console.error(`Lexical => JSX converter: Inline Blocks converter: found ${s?.fields?.blockType} inline block, but no converter is provided`)):c=t[s.type];try{!c&&l&&(c=l);let d;c?d=typeof c=="function"?c({childIndex:u,converters:t,node:s,nodesToJSX:m=>zi({converters:m.converters??t,disableIndent:m.disableIndent??e,disableTextAlign:m.disableTextAlign??o,nodes:m.nodes,parent:m.parent??{...s,parent:n}}),parent:n}):c:d=Ji("span",{children:"unknown node"},u);let a={};if(!o&&(!Array.isArray(o)||!o?.includes(s.type))&&"format"in s&&s.format)switch(s.format){case"center":a.textAlign="center";break;case"end":a.textAlign="right";break;case"justify":a.textAlign="justify";break;case"left":break;case"right":a.textAlign="right";break;case"start":a.textAlign="left";break}if(!e&&(!Array.isArray(e)||!e?.includes(s.type))&&"indent"in s&&s.indent&&s.type!=="listitem"&&(a.paddingInlineStart=`${Number(s.indent)*2}em`),ir.isValidElement(d)){if(a.textAlign||a.paddingInlineStart){let p={...a,...d?.props?.style??{}};return ir.cloneElement(d,{key:u,style:p})}return ir.cloneElement(d,{key:u})}return d}catch(d){return console.error("Error converting lexical node to JSX:",d,"node:",s),null}}).filter(Boolean)}var sr=({className:t,converters:e,data:o,disableContainer:r,disableIndent:n,disableTextAlign:l})=>{if(!o)return null;let i={};e?typeof e=="function"?i=e({defaultConverters:tt}):i=e:i=tt;let s=o&&!Array.isArray(o)&&typeof o=="object"&&"root"in o&&Xi({converters:i,data:o,disableIndent:n,disableTextAlign:l});return r?Zi(Xp,{children:s}):Zi("div",{className:t??"payload-richtext",children:s})};function Yi(){let t=zp(7),[e]=Yp(),o;t[0]!==e?(o=e.getEditorState().toJSON(),t[0]=e,t[1]=o):o=t[1];let[r,n]=Qp(o),l,i;t[2]!==e?(l=()=>e.registerUpdateListener(u=>{let{editorState:c}=u;n(c.toJSON())}),i=[e],t[2]=e,t[3]=l,t[4]=i):(l=t[3],i=t[4]),qp(l,i);let s;return t[5]!==r?(s=Zp(sr,{converters:tt,data:r}),t[5]=r,t[6]=s):s=t[6],s}var ef=y({plugins:[{Component:Yi,position:"bottom"}]});var H={amber:{50:"oklch(0.987 0.022 95.277)",100:"oklch(0.962 0.059 95.617)",200:"oklch(0.924 0.12 95.746)",300:"oklch(0.879 0.169 91.605)",400:"oklch(0.828 0.189 84.429)",500:"oklch(0.769 0.188 70.08)",600:"oklch(0.666 0.179 58.318)",700:"oklch(0.555 0.163 48.998)",800:"oklch(0.473 0.137 46.201)",900:"oklch(0.414 0.112 45.904)",950:"oklch(0.279 0.077 45.635)"},black:"#000",blue:{50:"oklch(0.97 0.014 254.604)",100:"oklch(0.932 0.032 255.585)",200:"oklch(0.882 0.059 254.128)",300:"oklch(0.809 0.105 251.813)",400:"oklch(0.707 0.165 254.624)",500:"oklch(0.623 0.214 259.815)",600:"oklch(0.546 0.245 262.881)",700:"oklch(0.488 0.243 264.376)",800:"oklch(0.424 0.199 265.638)",900:"oklch(0.379 0.146 265.522)",950:"oklch(0.282 0.091 267.935)"},current:"currentColor",cyan:{50:"oklch(0.984 0.019 200.873)",100:"oklch(0.956 0.045 203.388)",200:"oklch(0.917 0.08 205.041)",300:"oklch(0.865 0.127 207.078)",400:"oklch(0.789 0.154 211.53)",500:"oklch(0.715 0.143 215.221)",600:"oklch(0.609 0.126 221.723)",700:"oklch(0.52 0.105 223.128)",800:"oklch(0.45 0.085 224.283)",900:"oklch(0.398 0.07 227.392)",950:"oklch(0.302 0.056 229.695)"},emerald:{50:"oklch(0.979 0.021 166.113)",100:"oklch(0.95 0.052 163.051)",200:"oklch(0.905 0.093 164.15)",300:"oklch(0.845 0.143 164.978)",400:"oklch(0.765 0.177 163.223)",500:"oklch(0.696 0.17 162.48)",600:"oklch(0.596 0.145 163.225)",700:"oklch(0.508 0.118 165.612)",800:"oklch(0.432 0.095 166.913)",900:"oklch(0.378 0.077 168.94)",950:"oklch(0.262 0.051 172.552)"},fuchsia:{50:"oklch(0.977 0.017 320.058)",100:"oklch(0.952 0.037 318.852)",200:"oklch(0.903 0.076 319.62)",300:"oklch(0.833 0.145 321.434)",400:"oklch(0.74 0.238 322.16)",500:"oklch(0.667 0.295 322.15)",600:"oklch(0.591 0.293 322.896)",700:"oklch(0.518 0.253 323.949)",800:"oklch(0.452 0.211 324.591)",900:"oklch(0.401 0.17 325.612)",950:"oklch(0.293 0.136 325.661)"},gray:{50:"oklch(0.985 0.002 247.839)",100:"oklch(0.967 0.003 264.542)",200:"oklch(0.928 0.006 264.531)",300:"oklch(0.872 0.01 258.338)",400:"oklch(0.707 0.022 261.325)",500:"oklch(0.551 0.027 264.364)",600:"oklch(0.446 0.03 256.802)",700:"oklch(0.373 0.034 259.733)",800:"oklch(0.278 0.033 256.848)",900:"oklch(0.21 0.034 264.665)",950:"oklch(0.13 0.028 261.692)"},green:{50:"oklch(0.982 0.018 155.826)",100:"oklch(0.962 0.044 156.743)",200:"oklch(0.925 0.084 155.995)",300:"oklch(0.871 0.15 154.449)",400:"oklch(0.792 0.209 151.711)",500:"oklch(0.723 0.219 149.579)",600:"oklch(0.627 0.194 149.214)",700:"oklch(0.527 0.154 150.069)",800:"oklch(0.448 0.119 151.328)",900:"oklch(0.393 0.095 152.535)",950:"oklch(0.266 0.065 152.934)"},indigo:{50:"oklch(0.962 0.018 272.314)",100:"oklch(0.93 0.034 272.788)",200:"oklch(0.87 0.065 274.039)",300:"oklch(0.785 0.115 274.713)",400:"oklch(0.673 0.182 276.935)",500:"oklch(0.585 0.233 277.117)",600:"oklch(0.511 0.262 276.966)",700:"oklch(0.457 0.24 277.023)",800:"oklch(0.398 0.195 277.366)",900:"oklch(0.359 0.144 278.697)",950:"oklch(0.257 0.09 281.288)"},inherit:"inherit",lime:{50:"oklch(0.986 0.031 120.757)",100:"oklch(0.967 0.067 122.328)",200:"oklch(0.938 0.127 124.321)",300:"oklch(0.897 0.196 126.665)",400:"oklch(0.841 0.238 128.85)",500:"oklch(0.768 0.233 130.85)",600:"oklch(0.648 0.2 131.684)",700:"oklch(0.532 0.157 131.589)",800:"oklch(0.453 0.124 130.933)",900:"oklch(0.405 0.101 131.063)",950:"oklch(0.274 0.072 132.109)"},neutral:{50:"oklch(0.985 0 0)",100:"oklch(0.97 0 0)",200:"oklch(0.922 0 0)",300:"oklch(0.87 0 0)",400:"oklch(0.708 0 0)",500:"oklch(0.556 0 0)",600:"oklch(0.439 0 0)",700:"oklch(0.371 0 0)",800:"oklch(0.269 0 0)",900:"oklch(0.205 0 0)",950:"oklch(0.145 0 0)"},orange:{50:"oklch(0.98 0.016 73.684)",100:"oklch(0.954 0.038 75.164)",200:"oklch(0.901 0.076 70.697)",300:"oklch(0.837 0.128 66.29)",400:"oklch(0.75 0.183 55.934)",500:"oklch(0.705 0.213 47.604)",600:"oklch(0.646 0.222 41.116)",700:"oklch(0.553 0.195 38.402)",800:"oklch(0.47 0.157 37.304)",900:"oklch(0.408 0.123 38.172)",950:"oklch(0.266 0.079 36.259)"},pink:{50:"oklch(0.971 0.014 343.198)",100:"oklch(0.948 0.028 342.258)",200:"oklch(0.899 0.061 343.231)",300:"oklch(0.823 0.12 346.018)",400:"oklch(0.718 0.202 349.761)",500:"oklch(0.656 0.241 354.308)",600:"oklch(0.592 0.249 0.584)",700:"oklch(0.525 0.223 3.958)",800:"oklch(0.459 0.187 3.815)",900:"oklch(0.408 0.153 2.432)",950:"oklch(0.284 0.109 3.907)"},purple:{50:"oklch(0.977 0.014 308.299)",100:"oklch(0.946 0.033 307.174)",200:"oklch(0.902 0.063 306.703)",300:"oklch(0.827 0.119 306.383)",400:"oklch(0.714 0.203 305.504)",500:"oklch(0.627 0.265 303.9)",600:"oklch(0.558 0.288 302.321)",700:"oklch(0.496 0.265 301.924)",800:"oklch(0.438 0.218 303.724)",900:"oklch(0.381 0.176 304.987)",950:"oklch(0.291 0.149 302.717)"},red:{50:"oklch(0.971 0.013 17.38)",100:"oklch(0.936 0.032 17.717)",200:"oklch(0.885 0.062 18.334)",300:"oklch(0.808 0.114 19.571)",400:"oklch(0.704 0.191 22.216)",500:"oklch(0.637 0.237 25.331)",600:"oklch(0.577 0.245 27.325)",700:"oklch(0.505 0.213 27.518)",800:"oklch(0.444 0.177 26.899)",900:"oklch(0.396 0.141 25.723)",950:"oklch(0.258 0.092 26.042)"},rose:{50:"oklch(0.969 0.015 12.422)",100:"oklch(0.941 0.03 12.58)",200:"oklch(0.892 0.058 10.001)",300:"oklch(0.81 0.117 11.638)",400:"oklch(0.712 0.194 13.428)",500:"oklch(0.645 0.246 16.439)",600:"oklch(0.586 0.253 17.585)",700:"oklch(0.514 0.222 16.935)",800:"oklch(0.455 0.188 13.697)",900:"oklch(0.41 0.159 10.272)",950:"oklch(0.271 0.105 12.094)"},sky:{50:"oklch(0.977 0.013 236.62)",100:"oklch(0.951 0.026 236.824)",200:"oklch(0.901 0.058 230.902)",300:"oklch(0.828 0.111 230.318)",400:"oklch(0.746 0.16 232.661)",500:"oklch(0.685 0.169 237.323)",600:"oklch(0.588 0.158 241.966)",700:"oklch(0.5 0.134 242.749)",800:"oklch(0.443 0.11 240.79)",900:"oklch(0.391 0.09 240.876)",950:"oklch(0.293 0.066 243.157)"},slate:{50:"oklch(0.984 0.003 247.858)",100:"oklch(0.968 0.007 247.896)",200:"oklch(0.929 0.013 255.508)",300:"oklch(0.869 0.022 252.894)",400:"oklch(0.704 0.04 256.788)",500:"oklch(0.554 0.046 257.417)",600:"oklch(0.446 0.043 257.281)",700:"oklch(0.372 0.044 257.287)",800:"oklch(0.279 0.041 260.031)",900:"oklch(0.208 0.042 265.755)",950:"oklch(0.129 0.042 264.695)"},stone:{50:"oklch(0.985 0.001 106.423)",100:"oklch(0.97 0.001 106.424)",200:"oklch(0.923 0.003 48.717)",300:"oklch(0.869 0.005 56.366)",400:"oklch(0.709 0.01 56.259)",500:"oklch(0.553 0.013 58.071)",600:"oklch(0.444 0.011 73.639)",700:"oklch(0.374 0.01 67.558)",800:"oklch(0.268 0.007 34.298)",900:"oklch(0.216 0.006 56.043)",950:"oklch(0.147 0.004 49.25)"},teal:{50:"oklch(0.984 0.014 180.72)",100:"oklch(0.953 0.051 180.801)",200:"oklch(0.91 0.096 180.426)",300:"oklch(0.855 0.138 181.071)",400:"oklch(0.777 0.152 181.912)",500:"oklch(0.704 0.14 182.503)",600:"oklch(0.6 0.118 184.704)",700:"oklch(0.511 0.096 186.391)",800:"oklch(0.437 0.078 188.216)",900:"oklch(0.386 0.063 188.416)",950:"oklch(0.277 0.046 192.524)"},transparent:"transparent",violet:{50:"oklch(0.969 0.016 293.756)",100:"oklch(0.943 0.029 294.588)",200:"oklch(0.894 0.057 293.283)",300:"oklch(0.811 0.111 293.571)",400:"oklch(0.702 0.183 293.541)",500:"oklch(0.606 0.25 292.717)",600:"oklch(0.541 0.281 293.009)",700:"oklch(0.491 0.27 292.581)",800:"oklch(0.432 0.232 292.759)",900:"oklch(0.38 0.189 293.745)",950:"oklch(0.283 0.141 291.089)"},white:"#fff",yellow:{50:"oklch(0.987 0.026 102.212)",100:"oklch(0.973 0.071 103.193)",200:"oklch(0.945 0.129 101.54)",300:"oklch(0.905 0.182 98.111)",400:"oklch(0.852 0.199 91.936)",500:"oklch(0.795 0.184 86.047)",600:"oklch(0.681 0.162 75.834)",700:"oklch(0.554 0.135 66.442)",800:"oklch(0.476 0.114 61.907)",900:"oklch(0.421 0.095 57.708)",950:"oklch(0.286 0.066 53.813)"},zinc:{50:"oklch(0.985 0 0)",100:"oklch(0.967 0.001 286.375)",200:"oklch(0.92 0.004 286.32)",300:"oklch(0.871 0.006 286.286)",400:"oklch(0.705 0.015 286.067)",500:"oklch(0.552 0.016 285.938)",600:"oklch(0.442 0.017 285.786)",700:"oklch(0.37 0.013 285.805)",800:"oklch(0.274 0.006 286.033)",900:"oklch(0.21 0.006 285.885)",950:"oklch(0.141 0.005 285.823)"}},tf={text:{"text-red":{css:{color:`light-dark(${H.red[600]}, ${H.red[400]})`},label:"Red"},"text-orange":{css:{color:`light-dark(${H.orange[600]}, ${H.orange[400]})`},label:"Orange"},"text-yellow":{css:{color:`light-dark(${H.yellow[700]}, ${H.yellow[300]})`},label:"Yellow"},"text-green":{css:{color:`light-dark(${H.green[700]}, ${H.green[400]})`},label:"Green"},"text-blue":{css:{color:`light-dark(${H.blue[600]}, ${H.blue[400]})`},label:"Blue"},"text-purple":{css:{color:`light-dark(${H.purple[600]}, ${H.purple[400]})`},label:"Purple"},"text-pink":{css:{color:`light-dark(${H.pink[600]}, ${H.pink[400]})`},label:"Pink"}},background:{"bg-red":{css:{"background-color":`light-dark(${H.red[400]}, ${H.red[600]})`},label:"Red"},"bg-orange":{css:{"background-color":`light-dark(${H.orange[400]}, ${H.orange[600]})`},label:"Orange"},"bg-yellow":{css:{"background-color":`light-dark(${H.yellow[300]}, ${H.yellow[700]})`},label:"Yellow"},"bg-green":{css:{"background-color":`light-dark(${H.green[400]}, ${H.green[700]})`},label:"Green"},"bg-blue":{css:{"background-color":`light-dark(${H.blue[400]}, ${H.blue[600]})`},label:"Blue"},"bg-purple":{css:{"background-color":`light-dark(${H.purple[400]}, ${H.purple[600]})`},label:"Purple"},"bg-pink":{css:{"background-color":`light-dark(${H.pink[400]}, ${H.pink[600]})`},label:"Pink"}}};import{$isNodeSelection as Hf}from"lexical";import{jsx as St,jsxs as of}from"react/jsx-runtime";import"react";var ar=()=>of("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[St("g",{clipPath:"url(#clip0_4397_10817)",children:St("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"})}),St("defs",{children:St("clipPath",{id:"clip0_4397_10817",children:St("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{jsx as lf}from"react/jsx-runtime";import*as Qi from"react";import{DecoratorBlockNode as rf}from"@lexical/react/LexicalDecoratorBlockNode.js";function nf(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:qi({relationTo:o,value:e})}:null}var Lt=class extends rf{__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:nf,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},r=qi(o);return r.setFormat(e.format),r}static isInline(){return!1}decorate(e,o){return null}exportDOM(){let e=document.createElement("div");e.setAttribute("data-lexical-relationship-id",String(typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value)),e.setAttribute("data-lexical-relationship-relationTo",this.__data?.relationTo);let o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"relationship",version:2}}getData(){return this.getLatest().__data}getTextContent(){return`${this.__data?.relationTo} relation to ${typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value}`}setData(e){let o=this.getWritable();o.__data=e}};function qi(t){return new Lt({data:t})}var sf=Qi.lazy(()=>import("./RelationshipComponent-APF3CN47.js").then(t=>({default:t.RelationshipComponent})));function af(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Ue({relationTo:o,value:e})}:null}var Se=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:af,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=Ue(o);return r.setFormat(e.format),r}decorate(e,o){return lf(sf,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Ue(t){return new Se({data:t})}function cr(t){return t instanceof Se}import{c as Sf}from"react/compiler-runtime";import{jsx as Lf}from"react/jsx-runtime";import{useLexicalComposerContext as yf}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as If}from"@lexical/utils";import{useConfig as Rf}from"@payloadcms/ui";import{$getPreviousSelection as vf,$getSelection as Mf,$isParagraphNode as Af,$isRangeSelection as Df,COMMAND_PRIORITY_EDITOR as Of,createCommand as $f}from"lexical";import{useEffect as Ff}from"react";import{c as kf}from"react/compiler-runtime";import{jsx as ro}from"react/jsx-runtime";import{useLexicalComposerContext as _f}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as Tf,COMMAND_PRIORITY_EDITOR as wf}from"lexical";import{useEffect as Ef,useState as os}from"react";import{c as cf}from"react/compiler-runtime";import{jsx as uf}from"react/jsx-runtime";import{useLexicalComposerContext as df}from"@lexical/react/LexicalComposerContext";import{useListDrawer as mf,useModal as pf}from"@payloadcms/ui";import{$getNodeByKey as es,$getPreviousSelection as ff,$getRoot as hf,$getSelection as gf,$isRangeSelection as xf,$setSelection as Cf}from"lexical";import{useEffect as bf,useState as ts}from"react";var yt=t=>{let e=cf(23),[o]=df(),[r,n]=ts(null),[l,i]=ts(!1),[s,u,c]=mf(t),{closeDrawer:d,drawerSlug:a,isDrawerOpen:p,openDrawer:m}=c,{modalState:f}=pf(),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let P=gf()??ff();n(P)},e[0]=h):h=e[0];let x=h,k;e[1]!==o||e[2]!==r?(k=()=>{r&&o.update(()=>{if(xf(r)){let{anchor:P,focus:v}=r;es(P.key)&&es(v.key)&&Cf(r.clone())}else hf().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=r,e[3]=k):k=e[3];let I=k,A;e[4]!==d?(A=()=>{d()},e[4]=d,e[5]=A):A=e[5];let b=A,_,g;e[6]!==a||e[7]!==f||e[8]!==I||e[9]!==l?(_=()=>{if(!l)return;let P=f[a];P&&!P?.isOpen&&(i(!1),setTimeout(()=>{I()},1))},g=[f,a,I,l],e[6]=a,e[7]=f,e[8]=I,e[9]=l,e[10]=_,e[11]=g):(_=e[10],g=e[11]),bf(_,g);let w;e[12]!==u?(w=P=>uf(u,{...P,onClick:()=>{x()}}),e[12]=u,e[13]=w):w=e[13];let M;e[14]!==m?(M=()=>{x(),m(),i(!0)},e[14]=m,e[15]=M):M=e[15];let D;return e[16]!==s||e[17]!==b||e[18]!==p||e[19]!==a||e[20]!==w||e[21]!==M?(D={closeListDrawer:b,isListDrawerOpen:p,ListDrawer:s,listDrawerSlug:a,ListDrawerToggler:w,openListDrawer:M},e[16]=s,e[17]=b,e[18]=p,e[19]=a,e[20]=w,e[21]=M,e[22]=D):D=e[22],D};var Nf=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=Tf(o);n&&n.replace(Ue({relationTo:e,value:r}))}):t.dispatchCommand(ur,{relationTo:e,value:r})},rs=t=>{let e=kf(16),{enabledCollectionSlugs:o}=t,[r]=_f(),n;e[0]!==o?.[0]?(n=()=>o?.[0],e[0]=o?.[0],e[1]=n):n=e[1];let[l]=os(n),[i,s]=os(null),u=o||void 0,c;e[2]!==l||e[3]!==u?(c={collectionSlugs:u,selectedCollection:l},e[2]=l,e[3]=u,e[4]=c):c=e[4];let{closeListDrawer:d,ListDrawer:a,openListDrawer:p}=yt(c),m,f;e[5]!==r||e[6]!==p?(m=()=>r.registerCommand(at,I=>(s(I?.replace?I?.replace.nodeKey:null),p(),!0),wf),f=[r,p],e[5]=r,e[6]=p,e[7]=m,e[8]=f):(m=e[7],f=e[8]),Ef(m,f);let h;e[9]!==d||e[10]!==r||e[11]!==i?(h=I=>{let{collectionSlug:A,doc:b}=I;Nf({editor:r,relationTo:A,replaceNodeKey:i,value:b.id}),d()},e[9]=d,e[10]=r,e[11]=i,e[12]=h):h=e[12];let x=h,k;return e[13]!==a||e[14]!==x?(k=ro(a,{onSelect:x}),e[13]=a,e[14]=x,e[15]=k):k=e[15],k},ns=t=>(t?.enabledCollectionSlugs?.length??-1)>0?ro(rs,{...t}):ro(Ot,{...t,children:ro(rs,{...t})});var ur=$f("INSERT_RELATIONSHIP_COMMAND"),ls=t=>{let e=Sf(10),{clientProps:o}=t,[r]=yf(),{config:n}=Rf(),{collections:l}=n,i=null;if(o?.enabledCollections)i=o?.enabledCollections;else if(o?.disabledCollections){let d;if(e[0]!==o?.disabledCollections||e[1]!==l){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=l.filter(a).map(Pf),e[0]=o?.disabledCollections,e[1]=l,e[2]=d}else d=e[2];i=d}let s,u;e[5]!==r?(s=()=>{if(!r.hasNodes([Se]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return r.registerCommand(ur,Bf,Of)},u=[r],e[5]=r,e[6]=s,e[7]=u):(s=e[6],u=e[7]),Ff(s,u);let c;return e[8]!==i?(c=Lf(ns,{enabledCollectionSlugs:i}),e[8]=i,e[9]=c):c=e[9],c};function Pf(t){let{slug:e}=t;return e}function Bf(t){let e=Mf()||vf();if(Df(e)){let o=Ue(t),{focus:r}=e,n=r.getNode();If(o),Af(n)&&!n.__first&&n.remove()}return!0}var jf=y({nodes:[Se],plugins:[{Component:ls,position:"normal"}],slashMenu:{groups:[ee([{Icon:ar,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(at,{replace:!1})}}])]},toolbarFixed:{groups:[_e([{ChildComponent:ar,isActive:({selection:t})=>{if(!Hf(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return cr(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(at,{replace:!1})}}])]}});import{c as ms}from"react/compiler-runtime";import{jsx as me,jsxs as i0}from"react/jsx-runtime";import{useLexicalComposerContext as s0}from"@lexical/react/LexicalComposerContext.js";import{useScrollInfo as a0,useThrottledEffect as c0,useTranslation as u0}from"@payloadcms/ui";import*as Le from"react";import{useMemo as d0}from"react";import{c as Uf}from"react/compiler-runtime";import{jsx as Gf}from"react/jsx-runtime";import{mergeRegister as Wf}from"@lexical/utils";import{$addUpdateTag as Vf,$getSelection as Kf}from"lexical";import{useEffect as no,useState as dr}from"react";var mr="toolbar-popup__button",It=t=>{let e=Uf(34),{children:o,editor:r,item:n}=t,[l,i]=dr(!0),[s,u]=dr(!1),[c,d]=dr(mr),a=G(),p;e[0]!==s||e[1]!==r||e[2]!==a||e[3]!==l||e[4]!==n?(p=()=>{r.getEditorState().read(()=>{let M=Kf();if(M){if(n.isActive){let D=n.isActive({editor:r,editorConfigContext:a,selection:M});s!==D&&u(D)}if(n.isEnabled){let D=n.isEnabled({editor:r,editorConfigContext:a,selection:M});l!==D&&i(D)}}})},e[0]=s,e[1]=r,e[2]=a,e[3]=l,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]),no(f,h);let x,k;e[9]!==m?(x=()=>(document.addEventListener("mouseup",m),()=>{document.removeEventListener("mouseup",m)}),k=[m],e[9]=m,e[10]=x,e[11]=k):(x=e[10],k=e[11]),no(x,k);let I,A;e[12]!==r||e[13]!==m?(I=()=>Wf(r.registerUpdateListener(()=>{m()})),A=[r,m],e[12]=r,e[13]=m,e[14]=I,e[15]=A):(I=e[14],A=e[15]),no(I,A);let b;e[16]!==s||e[17]!==l||e[18]!==n.key?(b=()=>{d([mr,l===!1?"disabled":"",s?"active":"",n?.key?`${mr}-`+n.key:""].filter(Boolean).join(" "))},e[16]=s,e[17]=l,e[18]=n.key,e[19]=b):b=e[19];let _;e[20]!==s||e[21]!==c||e[22]!==l||e[23]!==n.key?(_=[l,s,c,n.key],e[20]=s,e[21]=c,e[22]=l,e[23]=n.key,e[24]=_):_=e[24],no(b,_);let g;e[25]!==s||e[26]!==r||e[27]!==l||e[28]!==n?(g=()=>{if(l!==!1)return r.focus(()=>{r.update(Jf),n.onSelect?.({editor:r,isActive:s})}),!0},e[25]=s,e[26]=r,e[27]=l,e[28]=n,e[29]=g):g=e[29];let w;return e[30]!==o||e[31]!==c||e[32]!==g?(w=Gf("button",{className:c,onClick:g,onMouseDown:Xf,type:"button",children:o}),e[30]=o,e[31]=c,e[32]=g,e[33]=w):w=e[33],w};function Jf(){Vf("toolbar")}function Xf(t){t.preventDefault()}import{c as ds}from"react/compiler-runtime";import{jsx as ot}from"react/jsx-runtime";import hr,{useEffect as us}from"react";import{mergeRegister as o0}from"@lexical/utils";import{useTranslation as r0}from"@payloadcms/ui";import{$getSelection as n0}from"lexical";import{jsx as Ae,jsxs as is}from"react/jsx-runtime";import{Button as zf}from"@payloadcms/ui";import{$addUpdateTag as Zf,isDOMNode as Yf}from"lexical";import lo,{useCallback as qf,useEffect as Rt,useMemo as Qf,useRef as fr,useState as io}from"react";import{createPortal as e0}from"react-dom";var pr="toolbar-popup__dropdown-item",ss=lo.createContext(null);function as({active:t,children:e,editor:o,enabled:r,Icon:n,item:l,tooltip:i}){let[s,u]=io(pr);Rt(()=>{u([pr,r===!1?"disabled":"",t?"active":"",l?.key?`${pr}-${l.key}`:""].filter(Boolean).join(" "))},[r,t,s,l.key]);let c=fr(null),d=lo.use(ss);if(d===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=d;return Rt(()=>{c?.current!=null&&a(c)},[c,a]),Ae(zf,{"aria-label":i,buttonStyle:"none",className:s,disabled:r===!1,icon:n,iconPosition:"left",iconStyle:"none",onClick:()=>{r!==!1&&o.focus(()=>{o.update(()=>{Zf("toolbar")}),l.onSelect?.({editor:o,isActive:t})})},onMouseDown:p=>{p.preventDefault()},ref:c,tooltip:i,type:"button",children:e})}function t0({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:r}){let[n,l]=io(),[i,s]=io(),u=qf(a=>{l(p=>p!=null?[...p,a]:[a])},[l]),c=a=>{if(n==null)return;let{key:p}=a;["ArrowDown","ArrowUp","Escape","Tab"].includes(p)&&a.preventDefault(),p==="Escape"||p==="Tab"?r():p==="ArrowUp"?s(m=>{if(m==null)return n[0];let f=n.indexOf(m)-1;return n[f===-1?n.length-1:f]}):p==="ArrowDown"&&s(m=>m==null?n[0]:n[n.indexOf(m)+1])},d=Qf(()=>({registerItem:u}),[u]);return Rt(()=>{n!=null&&i==null&&s(n[0]),i!=null&&i?.current!=null&&i.current.focus()},[n,i]),Ae(ss,{value:d,children:Ae("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:c,ref:e,children:t})})}function cs({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:r=!1,Icon:n,itemsContainerClassNames:l,label:i,stopCloseOnClickSelf:s}){let u=fr(null),c=fr(null),[d,a]=io(!1),p=()=>{a(!1),c?.current!=null&&c.current.focus()};Rt(()=>{let f=c.current,h=u.current;if(d&&f!==null&&h!==null){let{left:x,top:k}=f.getBoundingClientRect(),I=window.scrollY||document.documentElement.scrollTop;h.style.top=`${k+I+f.offsetHeight+5}px`,h.style.left=`${Math.min(x-5,window.innerWidth-h.offsetWidth-20)}px`}},[u,c,d]),Rt(()=>{let f=c.current;if(f!==null&&d){let h=x=>{let k=x.target;Yf(k)&&(s&&u.current&&u.current.contains(k)||f.contains(k)||a(!1))};return document.addEventListener("click",h),()=>{document.removeEventListener("click",h)}}},[u,c,d,s]);let m=e0(Ae(t0,{dropDownRef:u,itemsContainerClassNames:l,onClose:p,children:o}),document.body);return is(lo.Fragment,{children:[is("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&&Ae(n,{}),i&&Ae("span",{className:"toolbar-popup__dropdown-label",children:i}),Ae("i",{className:"toolbar-popup__dropdown-caret"})]}),d&&Ae(lo.Fragment,{children:m})]})}var gr="toolbar-popup__dropdown",l0=t=>{let e=ds(18),{active:o,anchorElem:r,editor:n,enabled:l,item:i}=t,{i18n:s}=r0(),{fieldProps:u}=G(),{featureClientSchemaMap:c,schemaPath:d}=u;if(i.Component){let f;return e[0]!==o||e[1]!==r||e[2]!==n||e[3]!==l||e[4]!==i?(f=i?.Component&&ot(i.Component,{active:o,anchorElem:r,editor:n,enabled:l,item:i},i.key),e[0]=o,e[1]=r,e[2]=n,e[3]=l,e[4]=i,e[5]=f):f=e[5],f}let a=i.key,p;if(i.label){let f;e[6]!==c||e[7]!==s||e[8]!==i||e[9]!==d?(f=typeof i.label=="function"?i.label({featureClientSchemaMap:c,i18n:s,schemaPath:d}):i.label,e[6]=c,e[7]=s,e[8]=i,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]!==l||e[15]!==i||e[16]!==a?(m=ot(as,{active:o,editor:n,enabled:l,Icon:i?.ChildComponent?ot(i.ChildComponent,{}):void 0,item:i,tooltip:a,children:ot("span",{className:"text",children:p})},i.key),e[11]=o,e[12]=p,e[13]=n,e[14]=l,e[15]=i,e[16]=a,e[17]=m):m=e[17],m},Ge=t=>{let e=ds(36),{anchorElem:o,classNames:r,editor:n,group:l,Icon:i,itemsContainerClassNames:s,label:u,maxActiveItems:c,onActiveChange:d}=t,a;e[0]===Symbol.for("react.memo_cache_sentinel")?(a=[],e[0]=a):a=e[0];let[p,m]=hr.useState(a),f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f=[],e[1]=f):f=e[1];let[h,x]=hr.useState(f),[k,I]=hr.useState(!0),A=G(),{items:b,key:_}=l,g;e[2]!==n||e[3]!==A||e[4]!==l||e[5]!==b||e[6]!==c||e[7]!==d?(g=()=>{n.getEditorState().read(()=>{let F=n0();if(!F)return;let W=[],K=[],fe=[];for(let j of b)j.isActive&&(!c||W.length<c)&&j.isActive({editor:n,editorConfigContext:A,selection:F})&&(W.push(j.key),K.push(j)),j.isEnabled?j.isEnabled({editor:n,editorConfigContext:A,selection:F})&&fe.push(j.key):fe.push(j.key);l.isEnabled&&I(l.isEnabled({editor:n,editorConfigContext:A,selection:F})),m(W),x(fe),d&&d({activeItems:K})})},e[2]=n,e[3]=A,e[4]=l,e[5]=b,e[6]=c,e[7]=d,e[8]=g):g=e[8];let w=g,M,D;e[9]!==w?(M=()=>{w()},D=[w],e[9]=w,e[10]=M,e[11]=D):(M=e[10],D=e[11]),us(M,D);let P,v;e[12]!==n||e[13]!==w?(P=()=>o0(n.registerUpdateListener(()=>{w()})),v=[n,w],e[12]=n,e[13]=w,e[14]=P,e[15]=v):(P=e[14],v=e[15]),us(P,v);let N=`${_} dropdown`,C=`${gr}-${_}`,E;e[16]!==r?(E=r||[],e[16]=r,e[17]=E):E=e[17];let L;e[18]!==E||e[19]!==C?(L=[gr,C,...E].filter(Boolean),e[18]=E,e[19]=C,e[20]=L):L=e[20];let S=L.join(" "),R=!k,T;e[21]!==s?(T=s||[],e[21]=s,e[22]=T):T=e[22];let $;return e[23]!==i||e[24]!==p||e[25]!==o||e[26]!==n||e[27]!==h||e[28]!==_||e[29]!==b||e[30]!==u||e[31]!==S||e[32]!==R||e[33]!==T||e[34]!==N?($=ot(cs,{buttonAriaLabel:N,buttonClassName:S,disabled:R,Icon:i,itemsContainerClassNames:[`${gr}-items`,...T],label:u,children:b.length?b.map(F=>ot(l0,{active:p.includes(F.key),anchorElem:o,editor:n,enabled:h.includes(F.key),item:F},F.key)):null},_),e[23]=i,e[24]=p,e[25]=o,e[26]=n,e[27]=h,e[28]=_,e[29]=b,e[30]=u,e[31]=S,e[32]=R,e[33]=T,e[34]=N,e[35]=$):$=e[35],$};function m0({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&me(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?me(It,{editor:e,item:o,children:me(o.ChildComponent,{})},o.key):null}function p0(t){let e=ms(23),{anchorElem:o,editor:r,editorConfig:n,group:l,index:i}=t,{i18n:s}=u0(),{fieldProps:u}=G(),{featureClientSchemaMap:c,schemaPath:d}=u,[a,p]=Le.useState(void 0),[m,f]=Le.useState(void 0),h;e[0]!==l.ChildComponent||e[1]!==l.items||e[2]!==l.type?(h=()=>{l?.type==="dropdown"&&l.items.length&&l.ChildComponent?f(()=>l.ChildComponent):f(void 0)},e[0]=l.ChildComponent,e[1]=l.items,e[2]=l.type,e[3]=h):h=e[3];let x;e[4]!==l?(x=[l],e[4]=l,e[5]=x):x=e[5],Le.useEffect(h,x);let k;e[6]!==c||e[7]!==l.ChildComponent||e[8]!==l.items||e[9]!==l.type||e[10]!==s||e[11]!==d?(k=_=>{let{activeItems:g}=_;if(!g.length){l?.type==="dropdown"&&l.items.length&&l.ChildComponent?(f(()=>l.ChildComponent),p(void 0)):(f(void 0),p(void 0));return}let w=g[0],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)+"..."),g.length===1?(p(M),f(()=>w.ChildComponent)):(p(s.t("lexical:general:toolbarItemsActive",{count:g.length})),l?.type==="dropdown"&&l.items.length&&l.ChildComponent?f(()=>l.ChildComponent):f(void 0))},e[6]=c,e[7]=l.ChildComponent,e[8]=l.items,e[9]=l.type,e[10]=s,e[11]=d,e[12]=k):k=e[12];let I=k,A=`fixed-toolbar__group fixed-toolbar__group-${l.key}`,b;return e[13]!==m||e[14]!==o||e[15]!==a||e[16]!==r||e[17]!==n.features.toolbarFixed?.groups.length||e[18]!==l||e[19]!==i||e[20]!==I||e[21]!==A?(b=i0("div",{className:A,children:[l.type==="dropdown"&&l.items.length?m?me(Ge,{anchorElem:o,editor:r,group:l,Icon:m,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:l.maxActiveItems??1,onActiveChange:I}):me(Ge,{anchorElem:o,editor:r,group:l,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:l.maxActiveItems??1,onActiveChange:I}):null,l.type==="buttons"&&l.items.length?l.items.map(_=>me(m0,{anchorElem:o,editor:r,item:_},_.key)):null,i<n.features.toolbarFixed?.groups.length-1&&me("div",{className:"divider"})]},l.key),e[13]=m,e[14]=o,e[15]=a,e[16]=r,e[17]=n.features.toolbarFixed?.groups.length,e[18]=l,e[19]=i,e[20]=I,e[21]=A,e[22]=b):b=e[22],b}function f0({anchorElem:t,clientProps:e,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let l=Le.useRef(null),{y:i}=a0(),s=d0(()=>{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 c0(()=>{if(!s)return;let u=l.current;if(!u)return;let c=u.getBoundingClientRect(),d=s.getBoundingClientRect();if(!(c.bottom<d.top||c.top>d.bottom))u.classList.remove("fixed-toolbar"),u.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),s.classList.remove("fixed-toolbar"),s.classList.add("fixed-toolbar","fixed-toolbar--hide");else{if(!u.classList.contains("fixed-toolbar--overlapping"))return;u.classList.remove("fixed-toolbar--overlapping"),u.classList.add("fixed-toolbar"),s.classList.remove("fixed-toolbar--hide"),s.classList.add("fixed-toolbar")}},50,[l,s,i]),me("div",{className:"fixed-toolbar",onFocus:u=>{u.stopPropagation()},ref:l,children:o.isEditable()&&me(Le.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((u,c)=>me(p0,{anchorElem:t,editor:o,editorConfig:r,group:u,index:c},u.key))})})}var ps=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return ps(t.parentEditor)}return!1},fs=t=>{let e=ms(6),{clientProps:o}=t,[r]=s0(),n=G(),{editorConfig:l}=n,i=o.applyToFocusedEditor&&n.focusedEditor?.editor||r,s=o.applyToFocusedEditor&&n.focusedEditor?.editorConfig||l,u,c;if(e[0]!==o.disableIfParentHasFixedToolbar||e[1]!==i||e[2]!==s||e[3]!==n){c=Symbol.for("react.early_return_sentinel");e:{let d=ps(n);if(o?.disableIfParentHasFixedToolbar&&d){c=null;break e}if(!s?.features?.toolbarFixed?.groups?.length){c=null;break e}u=me(f0,{anchorElem:document.body,editor:i,editorConfig:s,parentWithFixedToolbar:d})}e[0]=o.disableIfParentHasFixedToolbar,e[1]=i,e[2]=s,e[3]=n,e[4]=u,e[5]=c}else u=e[4],c=e[5];return c!==Symbol.for("react.early_return_sentinel")?c:u};var h0=y({plugins:[{Component:fs,position:"aboveContainer"}]});import{c as xs}from"react/compiler-runtime";import{jsx as xe,jsxs as Cs}from"react/jsx-runtime";import{useLexicalComposerContext as g0}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as bs}from"@lexical/utils";import{$getSelection as ks,$isRangeSelection as hs,$isTextNode as x0,COMMAND_PRIORITY_LOW as C0,getDOMSelection as _s,SELECTION_CHANGE_COMMAND as b0}from"lexical";import{useCallback as ao,useEffect as vt,useRef as gs,useState as k0}from"react";import*as co from"react";import{createPortal as _0}from"react-dom";function xr(t,e){let o=t.getRangeAt(0),r;if(t.anchorNode===e){let n=e;for(;n.firstElementChild!=null;)n=n.firstElementChild;r=n.getBoundingClientRect()}else r=o.getBoundingClientRect();return r}function so(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:r=0,floatingElem:n,horizontalOffset:l=32,horizontalPosition:i="left",specialHandlingForCaret:s=!1,targetRect:u,verticalGap:c=10}=t,d=o.parentElement;if(u===null||d==null){n.style.opacity="0",n.style.transform="translate(-10000px, -10000px)";return}let a=n.getBoundingClientRect(),p=o.getBoundingClientRect(),m=d.getBoundingClientRect(),f=u.top-a.height-c,h=u.left-l;i==="center"&&(h=u.left+u.width/2-a.width/2);let x=0;return!e&&f<m.top&&!s&&(x=a.height+u.height+c*2,f+=x),i==="center"?h+a.width>m.right?h=m.right-a.width-l:h<m.left&&(h=m.left+l):h+a.width>m.right&&(h=m.right-a.width-l),h-=p.left,n.style.opacity="1",s&&r!==0?(f-=p.bottom-r+a.height-3,n.style.transform=`translate(${h}px, ${f}px) rotate(180deg)`):(f-=p.top,n.style.transform=`translate(${h}px, ${f}px)`),x}function T0({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&xe(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?xe(It,{editor:e,item:o,children:xe(o.ChildComponent,{})},o.key):null}function w0(t){let e=xs(19),{anchorElem:o,editor:r,group:n,index:l}=t,{editorConfig:i}=G(),[s,u]=co.useState(),c;e[0]!==n.ChildComponent||e[1]!==n.items||e[2]!==n.type?(c=()=>{n?.type==="dropdown"&&n.items.length&&n.ChildComponent?u(()=>n.ChildComponent):u(void 0)},e[0]=n.ChildComponent,e[1]=n.items,e[2]=n.type,e[3]=c):c=e[3];let d;e[4]!==n?(d=[n],e[4]=n,e[5]=d):d=e[5],co.useEffect(c,d);let a;e[6]!==n.ChildComponent||e[7]!==n.items||e[8]!==n.type?(a=h=>{let{activeItems:x}=h;if(!x.length){n?.type==="dropdown"&&n.items.length&&n.ChildComponent?u(()=>n.ChildComponent):u(void 0);return}let k=x[0];u(()=>k?.ChildComponent)},e[6]=n.ChildComponent,e[7]=n.items,e[8]=n.type,e[9]=a):a=e[9];let p=a,m=`inline-toolbar-popup__group inline-toolbar-popup__group-${n.key}`,f;return e[10]!==s||e[11]!==o||e[12]!==r||e[13]!==i.features.toolbarInline?.groups.length||e[14]!==n||e[15]!==l||e[16]!==p||e[17]!==m?(f=Cs("div",{className:m,children:[n.type==="dropdown"&&n.items.length?s?xe(Ge,{anchorElem:o,editor:r,group:n,Icon:s,maxActiveItems:n.maxActiveItems??1,onActiveChange:p}):xe(Ge,{anchorElem:o,editor:r,group:n,maxActiveItems:n.maxActiveItems??1,onActiveChange:p}):null,n.type==="buttons"&&n.items.length?n.items.map(h=>xe(T0,{anchorElem:o,editor:r,item:h},h.key)):null,l<i.features.toolbarInline?.groups.length-1&&xe("div",{className:"divider"})]},n.key),e[10]=s,e[11]=o,e[12]=r,e[13]=i.features.toolbarInline?.groups.length,e[14]=n,e[15]=l,e[16]=p,e[17]=m,e[18]=f):f=e[18],f}function E0({anchorElem:t,editor:e}){let o=gs(null),r=gs(null),{editorConfig:n}=G(),l=ao(()=>{if(o?.current){let c=o.current.style.opacity==="0",d=o.current.style.pointerEvents==="none";c||(o.current.style.opacity="0"),d||(o.current.style.pointerEvents="none")}},[o]),i=ao(c=>{if(o?.current&&(c.buttons===1||c.buttons===3)){let d=o.current.style.opacity==="0",a=o.current.style.pointerEvents==="none";if(!d||!a){let p=c.clientX,m=c.clientY,f=document.elementFromPoint(p,m);o.current.contains(f)||l()}}},[l]),s=ao(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);vt(()=>(document.addEventListener("mousemove",i),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",s)}),[o,i,s]);let u=ao(()=>{let c=ks(),d=_s(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=xr(d,m),h=so({alwaysDisplayOnTop:p,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});r.current&&so({anchorElem:o.current,anchorFlippedOffset:h,floatingElem:r.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else l()},[e,l,t]);return vt(()=>{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]),vt(()=>(e.getEditorState().read(()=>{u()}),bs(e.registerUpdateListener(({editorState:c})=>{c.read(()=>{u()})}),e.registerCommand(b0,()=>(u(),!1),C0))),[e,u]),Cs("div",{className:"inline-toolbar-popup",ref:o,children:[xe("div",{className:"caret",ref:r}),n?.features&&n.features?.toolbarInline?.groups.map((c,d)=>xe(w0,{anchorElem:t,editor:e,group:c,index:d},c.key))]})}function N0(t,e){let o=xs(12),[r,n]=k0(!1),l;o[0]!==t?(l=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let p=ks(),m=_s(t._window),f=t.getRootElement();if(m!==null&&(!hs(p)||f===null||!f.contains(m.anchorNode))){n(!1);return}if(!hs(p))return;if(p.getTextContent()!==""){let x=p.getNodes(),k=!1;for(let I of x)if(x0(I)){n(!0),k=!0;break}k||n(!1)}else n(!1);let h=p.getTextContent().replace(/\n/g,"");if(!p.isCollapsed()&&h===""){n(!1);return}})},o[0]=t,o[1]=l):l=o[1];let i=l,s,u;o[2]!==i?(s=()=>(document.addEventListener("selectionchange",i),document.addEventListener("mouseup",i),()=>{document.removeEventListener("selectionchange",i),document.removeEventListener("mouseup",i)}),u=[i],o[2]=i,o[3]=s,o[4]=u):(s=o[3],u=o[4]),vt(s,u);let c,d;if(o[5]!==t||o[6]!==i?(c=()=>bs(t.registerUpdateListener(()=>{i()}),t.registerRootListener(()=>{t.getRootElement()===null&&n(!1)})),d=[t,i],o[5]=t,o[6]=i,o[7]=c,o[8]=d):(c=o[7],d=o[8]),vt(c,d),!r||!t.isEditable())return null;let a;return o[9]!==e||o[10]!==t?(a=_0(xe(E0,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=a):a=o[11],a}var Ts=t=>{let{anchorElem:e}=t,[o]=g0();return N0(o,e)};var S0=y({plugins:[{Component:Ts,position:"floatingAnchorElem"}]});import{TableCellNode as gh,TableNode as xh,TableRowNode as Ch}from"@lexical/table";import{jsx as ws}from"react/jsx-runtime";import"react";var Cr=()=>ws("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:ws("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 L0,$createTableNode as y0,$createTableRowNode as I0,$isTableCellNode as Es,$isTableNode as br,$isTableRowNode as kr,TableCellHeaderStates as uo,TableCellNode as R0,TableNode as v0,TableRowNode as M0}from"@lexical/table";import{$isParagraphNode as A0,$isTextNode as D0}from"lexical";var Ss=/^\|(.+)\|\s?$/,O0=/^(\| ?:?-*:? ?)+\|\s?$/,Ls=({allTransformers:t})=>({type:"element",dependencies:[v0,M0,R0],export:e=>{if(!br(e))return null;let o=[];for(let r of e.getChildren()){let n=[];if(!kr(r))continue;let l=!1;for(let i of r.getChildren())Es(i)&&(n.push(Gr(t,i).replace(/\n/g,"\\n").trim()),i.__headerState===uo.ROW&&(l=!0));o.push(`| ${n.join(" | ")} |`),l&&o.push(`| ${n.map(i=>"---").join(" | ")} |`)}return o.join(`
|
|
39
|
+
`)},regExp:Ss,replace:(e,o,r)=>{let n=r[0];if(!n)return;if(O0.test(n)){let a=e.getPreviousSibling();if(!a||!br(a))return;let p=a.getChildren(),m=p[p.length-1];if(!m||!kr(m))return;m.getChildren().forEach(f=>{Es(f)&&f.setHeaderStyles(uo.ROW,uo.ROW)}),e.remove();return}let l=Ns(n,t);if(l==null)return;let i=[l],s=e.getPreviousSibling(),u=l.length;for(;s&&!(!A0(s)||s.getChildrenSize()!==1);){let a=s.getFirstChild();if(!D0(a))break;let p=Ns(a.getTextContent(),t);if(p==null)break;u=Math.max(u,p.length),i.unshift(p);let m=s.getPreviousSibling();s.remove(),s=m}let c=y0();for(let a of i){let p=I0();c.append(p);for(let m=0;m<u;m++)p.append(m<a.length?a[m]:ys("",t))}let d=e.getPreviousSibling();br(d)&&$0(d)===u?(d.append(...c.getChildren()),e.remove()):e.replace(c),c.selectEnd()}});function $0(t){let e=t.getFirstChild();return kr(e)?e.getChildrenSize():0}var ys=(t,e)=>{t=t.replace(/\\n/g,`
|
|
40
|
+
`);let o=L0(uo.NO_STATUS);return Ur(t,e,o),o},Ns=(t,e)=>{let o=t.match(Ss);return!o||!o[1]?null:o[1].split("|").map(r=>ys(r,e))};import{c as P0}from"react/compiler-runtime";import{jsx as B,jsxs as ye}from"react/jsx-runtime";import{useLexicalComposerContext as Ms}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as B0}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as Tr,$deleteTableColumn__EXPERIMENTAL as H0,$deleteTableRow__EXPERIMENTAL as j0,$getNodeTriplet as U0,$getTableCellNodeFromLexicalNode as Rs,$getTableColumnIndexFromTableCellNode as G0,$getTableNodeFromLexicalNodeOrThrow as Ie,$getTableRowIndexFromTableCellNode as W0,$insertTableColumn__EXPERIMENTAL as V0,$insertTableRow__EXPERIMENTAL as K0,$isTableCellNode as As,$isTableSelection as Mt,$unmergeCell as J0,getTableElement as wr,getTableObserverFromTableElement as Er,TableCellHeaderStates as De,TableCellNode as X0}from"@lexical/table";import{mergeRegister as z0}from"@lexical/utils";import{useScrollInfo as Z0}from"@payloadcms/ui";import{$createParagraphNode as Y0,$getSelection as po,$isElementNode as q0,$isParagraphNode as Q0,$isRangeSelection as Nr,$isTextNode as e1,$setSelection as t1,COMMAND_PRIORITY_CRITICAL as o1,getDOMSelection as r1,isDOMNode as n1,SELECTION_CHANGE_COMMAND as l1}from"lexical";import*as Sr from"react";import{useCallback as pe,useEffect as rt,useRef as mo,useState as nt}from"react";import{createPortal as Ds}from"react-dom";import{jsx as _r,jsxs as F0}from"react/jsx-runtime";import"react";var Is=()=>F0("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[_r("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"}),_r("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"}),_r("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 vs(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function i1(){let t=po();if(Nr(t)&&!t.isCollapsed()||Mt(t)&&!t.anchor.is(t.focus)||!Nr(t)&&!Mt(t))return!1;let[e]=U0(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function s1(t){if(t.getChildrenSize()!==1)return!1;let e=t.getFirstChildOrThrow();return!(!Q0(e)||!e.isEmpty())}function a1(t){let e=t.getLastDescendant();e1(e)?e.select():q0(e)?e.selectEnd():e!==null&&e.selectNext()}function c1({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[l]=Ms(),i=mo(null),[s,u]=nt(n),[c,d]=nt({columns:1,rows:1}),[a,p]=nt(!1),[m,f]=nt(!1),{y:h}=Z0();rt(()=>l.registerMutationListener(X0,C=>{C.get(s.getKey())==="updated"&&l.getEditorState().read(()=>{u(s.getLatest())})},{skipInitialization:!0}),[l,s]),rt(()=>{l.getEditorState().read(()=>{let C=po();if(Mt(C)){let E=vs(C);d(vs(C)),p(E.columns>1||E.rows>1)}f(i1())})},[l]),rt(()=>{let C=e.current,E=i.current,L=l.getRootElement();if(C!=null&&E!=null&&L!=null){let S=L.getBoundingClientRect(),R=C.getBoundingClientRect();E.style.opacity="1";let T=E.getBoundingClientRect(),$=5,F=R.right+$;if(F+T.width>window.innerWidth||F+T.width>S.right){let K=R.left-T.width-$;F=(K<0?$:K)+window.pageXOffset}E.style.left=`${F+window.pageXOffset}px`;let W=R.top;if(W+T.height>window.innerHeight){let K=R.bottom-T.height;W=K<0?$:K}E.style.top=`${W}px`}},[e,i,l,h]),rt(()=>{function C(E){i.current!=null&&e.current!=null&&n1(E.target)&&!i.current.contains(E.target)&&!e.current.contains(E.target)&&r(!1)}return window.addEventListener("click",C),()=>window.removeEventListener("click",C)},[r,e]);let x=pe(()=>{l.update(()=>{if(s.isAttached()){let C=Ie(s),E=wr(C,l.getElementByKey(C.getKey()));if(E===null)throw new Error("Expected to find tableElement in DOM");let L=Er(E);L!==null&&L.$clearHighlight(),C.markDirty(),u(s.getLatest())}t1(null)})},[l,s]),k=()=>{l.update(()=>{let C=po();if(Mt(C)){let L=C.getNodes().filter(As);if(L.length===0)return;let S=Ie(L[0]),[R]=Tr(S,null,null),T=1/0,$=-1/0,F=1/0,W=-1/0,K=new Set;for(let q of R)for(let J of q){if(!J||!J.cell)continue;let re=J.cell.getKey();if(!K.has(re)&&L.some(ne=>ne.is(J.cell))){K.add(re);let ne=J.startRow,se=J.startColumn,Oe=J.cell.__rowSpan||1,it=J.cell.__colSpan||1;T=Math.min(T,ne),$=Math.max($,ne+Oe-1),F=Math.min(F,se),W=Math.max(W,se+it-1)}}if(T===1/0||F===1/0)return;let fe=$-T+1,j=W-F+1,U=R?.[T]?.[F];if(!U?.cell)return;let oe=U.cell;oe.setColSpan(j),oe.setRowSpan(fe);let ue=new Set([oe.getKey()]);for(let q=T;q<=$;q++)for(let J=F;J<=W;J++){let re=R?.[q]?.[J];if(!re?.cell)continue;let ne=re.cell,se=ne.getKey();ue.has(se)||(ue.add(se),s1(ne)||oe.append(...ne.getChildren()),ne.remove())}oe.getChildrenSize()===0&&oe.append(Y0()),a1(oe),o()}})},I=()=>{l.update(()=>{J0()})},A=pe(C=>{l.update(()=>{for(let E=0;E<c.rows;E++)K0(C);o()})},[l,o,c.rows]),b=pe(C=>{l.update(()=>{for(let E=0;E<c.columns;E++)V0(C);o()})},[l,o,c.columns]),_=pe(()=>{l.update(()=>{j0(),o()})},[l,o]),g=pe(()=>{l.update(()=>{Ie(s).remove(),x(),o()})},[l,s,x,o]),w=pe(()=>{l.update(()=>{H0(),o()})},[l,o]),M=pe(()=>{l.update(()=>{let C=Ie(s),E=W0(s),[L]=Tr(C,null,null),S=new Set,R=s.getHeaderStyles()^De.ROW;if(L[E])for(let T=0;T<L[E].length;T++){let $=L[E][T];$?.cell&&(S.has($.cell)||(S.add($.cell),$.cell.setHeaderStyles(R,De.ROW)))}x(),o()})},[l,s,x,o]),D=pe(()=>{l.update(()=>{let C=Ie(s),E=G0(s),[L]=Tr(C,null,null),S=new Set,R=s.getHeaderStyles()^De.COLUMN;if(L)for(let T=0;T<L.length;T++){let $=L?.[T]?.[E];$?.cell&&(S.has($.cell)||(S.add($.cell),$.cell.setHeaderStyles(R,De.COLUMN)))}x(),o()})},[l,s,x,o]),P=pe(()=>{l.update(()=>{if(s.isAttached()){let C=Ie(s);C&&C.setRowStriping(!C.getRowStriping())}x(),o()})},[l,s,x,o]),v=pe(()=>{l.update(()=>{if(s.isAttached()){let C=Ie(s);C&&C.setFrozenColumns(C.getFrozenColumns()===0?1:0)}x(),o()})},[l,s,x,o]),N=null;return t&&(a?N=B("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>k(),type:"button",children:B("span",{className:"text",children:"Merge cells"})}):m&&(N=B("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>I(),type:"button",children:B("span",{className:"text",children:"Unmerge cells"})}))),Ds(ye("div",{className:"table-action-menu-dropdown",onClick:C=>{C.stopPropagation()},ref:i,children:[N?ye(Sr.Fragment,{children:[N,B("hr",{})]}):null,B("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>P(),type:"button",children:B("span",{className:"text",children:"Toggle Row Striping"})}),B("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>v(),type:"button",children:B("span",{className:"text",children:"Toggle First Column Freeze"})}),B("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>A(!1),type:"button",children:ye("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," above"]})}),B("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>A(!0),type:"button",children:ye("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," below"]})}),B("hr",{}),B("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>b(!1),type:"button",children:ye("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","left"]})}),B("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>b(!0),type:"button",children:ye("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","right"]})}),B("hr",{}),B("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>w(),type:"button",children:B("span",{className:"text",children:"Delete column"})}),B("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>_(),type:"button",children:B("span",{className:"text",children:"Delete row"})}),B("button",{className:"item","data-test-id":"table-delete",onClick:()=>g(),type:"button",children:B("span",{className:"text",children:"Delete table"})}),B("hr",{}),B("button",{className:"item","data-test-id":"table-row-header",onClick:()=>M(),type:"button",children:ye("span",{className:"text",children:[(s.__headerState&De.ROW)===De.ROW?"Remove":"Add"," ","row header"]})}),B("button",{className:"item","data-test-id":"table-column-header",onClick:()=>D(),type:"button",children:ye("span",{className:"text",children:[(s.__headerState&De.COLUMN)===De.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function u1({anchorElem:t,cellMerge:e}){let[o]=Ms(),r=mo(null),n=mo(null),[l,i]=nt(!1),[s,u]=nt(null),c=pe(()=>{let a=r.current,p=po(),m=r1(o._window),f=document.activeElement;function h(){a&&(a.classList.remove("table-cell-action-button-container--active"),a.classList.add("table-cell-action-button-container--inactive")),u(null)}if(p==null||a==null)return h();let x=o.getRootElement(),k=null,I=null;if(Nr(p)&&x!==null&&m!==null&&x.contains(m.anchorNode)){let b=Rs(p.anchor.getNode());if(b==null||(I=o.getElementByKey(b.getKey()),I==null||!b.isAttached()))return h();let _=Ie(b),g=wr(_,o.getElementByKey(_.getKey()));if(g===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");k=Er(g),u(b)}else if(Mt(p)){let b=Rs(p.anchor.getNode());if(!As(b))throw new Error("TableSelection anchorNode must be a TableCellNode");let _=Ie(b),g=wr(_,o.getElementByKey(_.getKey()));if(g===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");k=Er(g),I=o.getElementByKey(b.getKey())}else if(!f)return h();if(k===null||I===null)return h();let A=!k||!k.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",A),a.classList.toggle("table-cell-action-button-container--inactive",!A),A){let b=I.getBoundingClientRect(),_=t.getBoundingClientRect(),g=b.top-_.top,w=b.right-_.left;a.style.transform=`translate(${w}px, ${g}px)`}},[o,t]);rt(()=>{let a,p=()=>{a=void 0,o.getEditorState().read(c)},m=()=>(a===void 0&&(a=setTimeout(p,0)),!1);return z0(o.registerUpdateListener(m),o.registerCommand(l1,m,o1),o.registerRootListener((f,h)=>{h&&h.removeEventListener("pointerup",m),f&&(f.addEventListener("pointerup",m),m())}),()=>clearTimeout(a))});let d=mo(s);return rt(()=>{d.current!==s&&i(!1),d.current=s},[d,s]),B("div",{className:"table-cell-action-button-container",ref:r,children:s!=null&&ye(Sr.Fragment,{children:[B("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),i(!l)},ref:n,type:"button",children:B(Is,{})}),l&&B(c1,{cellMerge:e,contextRef:n,onClose:()=>i(!1),setIsMenuOpen:i,tableCellNode:s})]})})}var Os=t=>{let e=P0(3),{anchorElem:o}=t,r=B0(),n;return e[0]!==o||e[1]!==r?(n=Ds(r?B(u1,{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 d1}from"react/compiler-runtime";import{jsx as ho,jsxs as m1}from"react/jsx-runtime";import{useLexicalComposerContext as p1}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as f1}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as h1,$getTableNodeFromLexicalNodeOrThrow as Lr,$getTableRowIndexFromTableCellNode as g1,$isTableCellNode as $s,$isTableRowNode as x1,getDOMCellFromTarget as C1,getTableElement as b1,TableNode as Fs}from"@lexical/table";import{calculateZoomLevel as Ps,mergeRegister as k1}from"@lexical/utils";import{$getNearestNodeFromDOMNode as yr,isHTMLElement as _1}from"lexical";import*as Hs from"react";import{useCallback as At,useEffect as Ir,useRef as fo,useState as lt}from"react";import{createPortal as T1}from"react-dom";var w1=33,Bs=92;function E1({editor:t}){let e=fo(null),o=fo(null),r=fo(null),[n,l]=lt(!1),i=G(),s=fo(null),[u,c]=lt(null),[d,a]=lt(null),[p,m]=lt(!1),[f,h]=lt(null),x=At(()=>{a(null),e.current=null,h(null),s.current=null,r.current=null},[]),k=v=>(v.buttons&1)===1;Ir(()=>{let v=new Set;return k1(t.registerMutationListener(Fs,N=>{for(let[C,E]of N)E==="destroyed"?v.delete(C):v.add(C);l(v.size>0)}),t.registerNodeTransform(Fs,N=>{if(N.getColWidths())return N;let C=N.getColumnCount(),E=Bs;return N.setColWidths(Array(C).fill(E)),N}))},[t]),Ir(()=>{if(!n)return;let v=L=>{let S=L.target;if(_1(S)){if(f){c({x:L.clientX,y:L.clientY});return}if(m(k(L)),!(o.current&&o.current.contains(S))&&e.current!==S){e.current=S;let R=C1(S);R&&d!==R?t.getEditorState().read(()=>{let T=yr(R.elem);if(!T)throw new Error("TableCellResizer: Table cell node not found.");let $=Lr(T),F=b1($,t.getElementByKey($.getKey()));if(!F)throw new Error("TableCellResizer: Table element not found.");e.current=S,r.current=F.getBoundingClientRect(),a(R)},{editor:t}):R==null&&x()}}},N=L=>{m(!0)},C=L=>{m(!1)},E=t.registerRootListener((L,S)=>{S?.removeEventListener("mousemove",v),S?.removeEventListener("mousedown",N),S?.removeEventListener("mouseup",C),L?.addEventListener("mousemove",v),L?.addEventListener("mousedown",N),L?.addEventListener("mouseup",C)});return()=>{E()}},[d,f,t,n,x]);let I=v=>v==="bottom",A=At(v=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let N=yr(d.elem);if(!$s(N))throw new Error("TableCellResizer: Table cell node not found.");let C=Lr(N),E=g1(N),L=C.getChildren(),R=N.getColSpan()===C.getColumnCount()?E:E+N.getRowSpan()-1;if(R>=L.length||R<0)throw new Error("Expected table cell to be inside of table row.");let T=L[R];if(!x1(T))throw new Error("Expected table row");let $=T.getHeight();if($===void 0){let W=T.getChildren();$=Math.min(...W.map(K=>b(K,t)??1/0))}let F=Math.max($+v,w1);T.setHeight(F)},{tag:"skip-scroll-into-view"})},[d,t]),b=(v,N)=>N.getElementByKey(v.getKey())?.clientHeight,_=(v,N)=>{let C;return N.forEach(E=>{E.forEach((L,S)=>{L.cell===v&&(C=S)})}),C},g=At(v=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let N=yr(d.elem);if(!$s(N))throw new Error("TableCellResizer: Table cell node not found.");let C=Lr(N),[E]=h1(C,null,null),L=_(N,E);if(L===void 0)throw new Error("TableCellResizer: Table column not found.");let S=C.getColWidths();if(!S)return;let R=S[L];if(R===void 0)return;let T=[...S],$=Math.max(R+v,Bs);T[L]=$,C.setColWidths(T)},{tag:"skip-scroll-into-view"})},[d,t]),w=At(v=>{let N=C=>{if(C.preventDefault(),C.stopPropagation(),!d)throw new Error("TableCellResizer: Expected active cell.");if(s.current){let{x:E,y:L}=s.current;if(d===null)return;let S=Ps(C.target);if(I(v)){let R=(C.clientY-L)/S;A(R)}else{let R=(C.clientX-E)/S;g(R)}x(),document.removeEventListener("mouseup",N)}};return N},[d,x,g,A]),M=At(v=>N=>{if(N.preventDefault(),N.stopPropagation(),!d)throw new Error("TableCellResizer: Expected active cell.");s.current={x:N.clientX,y:N.clientY},c(s.current),h(v),document.addEventListener("mouseup",w(v))},[d,w]),[D,P]=lt({bottom:null,left:null,right:null,top:null});return Ir(()=>{if(d){let{height:v,left:N,top:C,width:E}=d.elem.getBoundingClientRect(),L=Ps(d.elem),S=10,R={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${S}px`,left:`${window.scrollX+N}px`,top:`${window.scrollY+C+v-S/2}px`,width:`${E}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${v}px`,left:`${window.scrollX+N+E-S/2}px`,top:`${window.scrollY+C}px`,width:`${S}px`}},T=r.current;f&&u&&T&&(I(f)?(R[f].left=`${window.scrollX+T.left}px`,R[f].top=`${window.scrollY+u.y/L}px`,R[f].height="3px",R[f].width=`${T.width}px`):(R[f].top=`${window.scrollY+T.top}px`,R[f].left=`${window.scrollX+u.x/L}px`,R[f].width="3px",R[f].height=`${T.height}px`),R[f].backgroundColor="#adf"),P(R)}else P({bottom:null,left:null,right:null,top:null})},[d,f,u]),ho("div",{ref:o,children:d!=null&&!p&&m1(Hs.Fragment,{children:[ho("div",{className:`${i.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:M("right"),style:D.right||void 0}),ho("div",{className:`${i.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:M("bottom"),style:D.bottom||void 0})]})})}var js=()=>{let t=d1(3),[e]=p1(),o=f1(),r,n;return t[0]!==e||t[1]!==o?(n=o?T1(ho(E1,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=n):n=t[2],r=n,r};import{c as M1}from"react/compiler-runtime";import{jsx as Rr,jsxs as A1,Fragment as D1}from"react/jsx-runtime";import{useLexicalComposerContext as zs}from"@lexical/react/LexicalComposerContext";import{$getTableAndElementByKey as O1,$getTableColumnIndexFromTableCellNode as $1,$getTableRowIndexFromTableCellNode as F1,$insertTableColumn__EXPERIMENTAL as P1,$insertTableRow__EXPERIMENTAL as B1,$isTableCellNode as H1,$isTableNode as Ws,getTableElement as j1,TableNode as U1}from"@lexical/table";import{$findMatchingParent as G1,mergeRegister as W1}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Vs,isHTMLElement as V1}from"lexical";import{useEffect as Ks,useMemo as K1,useRef as Js,useState as go}from"react";import"react";import{createPortal as J1}from"react-dom";import{c as I1}from"react/compiler-runtime";import{useEffect as R1,useRef as v1}from"react";var N1="Expected a function",S1=Math.max,L1=Math.min;function y1(t,e,o){let r,n,l=0,i,s=!1,u=!1,c,d,a,p=!0;if(typeof t!="function")throw new TypeError(N1);e=e||0,typeof o=="object"&&(s=!!o.leading,u="maxWait"in o,c=u?S1(o.maxWait||0,e):c,p="trailing"in o?!!o.trailing:p);function m(g){let w=r,M=i;return r=i=void 0,l=g,d=t.apply(M,w),d}function f(g){return l=g,a=setTimeout(k,e),s?m(g):d}function h(g){let w=g-n,M=g-l,D=e-w;return u?L1(D,c-M):D}function x(g){let w=g-n,M=g-l;return n===void 0||w>=e||w<0||u&&M>=c}function k(){let g=Date.now();if(x(g))return I(g);a=setTimeout(k,h(g))}function I(g){return a=void 0,p&&r?m(g):(r=i=void 0,d)}function A(){a!==void 0&&clearTimeout(a),l=0,r=n=i=a=void 0}function b(){return a===void 0?d:I(Date.now())}function _(){let g=Date.now(),w=x(g);if(r=arguments,i=this,n=g,w){if(a===void 0)return f(n);if(u)return clearTimeout(a),a=setTimeout(k,e),m(n)}return a===void 0&&(a=setTimeout(k,e)),d}return _.cancel=A,_.flush=b,_}var Us=y1;function Gs(t,e,o){let r=I1(6),n=v1(null),l,i;r[0]!==t||r[1]!==o||r[2]!==e?(l=()=>(n.current=Us(t,e,{maxWait:o}),()=>{n.current?.cancel()}),i=[t,e,o],r[0]=t,r[1]=o,r[2]=e,r[3]=l,r[4]=i):(l=r[3],i=r[4]),R1(l,i);let s;return r[5]===Symbol.for("react.memo_cache_sentinel")?(s=(...c)=>{let d=c;n.current&&n.current(...d)},r[5]=s):s=r[5],s}var Xs=20;function X1({anchorElem:t}){let[e]=zs(),o=G(),[r,n]=go(!1),[l,i]=go(!1),[s,u]=go(!1),[c,d]=go({}),a=Js(new Set),p=Js(null),m=Gs(x=>{let{isOutside:k,tableDOMNode:I}=z1(x,o.editorConfig?.lexical);if(k){n(!1),i(!1);return}if(!I)return;p.current=I;let A=null,b=null,_=null;if(e.getEditorState().read(()=>{let S=Vs(I);if(H1(S)){let R=G1(S,T=>Ws(T));if(!Ws(R))return;if(_=j1(R,e.getElementByKey(R.getKey())),_){let T=R.getChildrenSize(),$=R.getChildAtIndex(0)?.getChildrenSize(),F=F1(S),W=$1(S);F===T-1?A=S:W===$-1&&(b=S)}}},{editor:e}),!_)return;let g=_.parentElement;if(!g)return;let{bottom:w,height:M,left:D,right:P,width:v,y:N}=_.getBoundingClientRect(),C=!1;g&&g.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(C=g.scrollWidth>g.clientWidth);let{left:E,y:L}=t.getBoundingClientRect();A?(i(!1),n(!0),d({height:Xs,left:C&&g?g.offsetLeft:D-E,top:w-L+5,width:C&&g?g.offsetWidth:v})):b&&(i(!0),n(!1),d({height:M,left:P-E+5,top:N-L,width:Xs}))},50,250),f=K1(()=>new ResizeObserver(()=>{n(!1),i(!1)}),[]);Ks(()=>{if(s)return document.addEventListener("mousemove",m),()=>{n(!1),i(!1),document.removeEventListener("mousemove",m)}},[s,m]),Ks(()=>W1(e.registerMutationListener(U1,x=>{e.getEditorState().read(()=>{let k=!1;for(let[I,A]of x)switch(A){case"created":{a.current.add(I),k=!0;break}case"destroyed":{a.current.delete(I),k=!0;break}default:break}if(k){f.disconnect();for(let I of a.current){let{tableElement:A}=O1(I);f.observe(A)}u(a.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,f]);let h=x=>{e.update(()=>{p.current&&(Vs(p.current)?.selectEnd(),x?(B1(),n(!1)):(P1(),i(!1)))})};return e?.isEditable()?A1(D1,{children:[r&&Rr("button",{"aria-label":"Add Row",className:o.editorConfig.lexical.theme.tableAddRows,onClick:()=>h(!0),style:{...c},type:"button"}),l&&Rr("button",{"aria-label":"Add Column",className:o.editorConfig.lexical.theme.tableAddColumns,onClick:()=>h(!1),style:{...c},type:"button"})]}):null}function z1(t,e){let o=t.target;if(V1(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 Zs(t){let e=M1(2),{anchorElem:o}=t,r=o===void 0?document.body:o,[n]=zs();if(!n?.isEditable())return null;let l;return e[0]!==r?(l=J1(Rr(X1,{anchorElem:r}),r),e[0]=r,e[1]=l):l=e[1],l}import{c as Z1}from"react/compiler-runtime";import{jsx as vr,jsxs as Y1}from"react/jsx-runtime";import{useLexicalComposerContext as q1}from"@lexical/react/LexicalComposerContext";import{TablePlugin as Q1}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as eh,TableCellNode as th,TableNode as oh,TableRowNode as rh}from"@lexical/table";import{mergeRegister as nh}from"@lexical/utils";import{formatDrawerSlug as lh,useEditDepth as ih}from"@payloadcms/ui";import{$getSelection as sh,$isRangeSelection as ah,COMMAND_PRIORITY_EDITOR as ch,createCommand as uh}from"lexical";import{createContext as dh,use as mh,useEffect as ph,useMemo as fh,useState as hh}from"react";import*as Ys from"react";var xo=uh("OPEN_EMBED_DRAWER_COMMAND"),qs=dh({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function Qs({children:t}){let[e,o]=hh({cellEditorConfig:null,cellEditorPlugins:null});return vr(qs,{value:fh(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var ea=()=>{let t=Z1(16),[e]=q1(),o=mh(qs),r=ih(),{fieldProps:n,uuid:l}=G(),{schemaPath:i}=n,s="lexical-table-create-"+l,u;t[0]!==r||t[1]!==s?(u=lh({slug:s,depth:r}),t[0]=r,t[1]=s,t[2]=u):u=t[2];let c=u,{toggleDrawer:d}=Ce(c,!0),a;t[3]!==e||t[4]!==d?(a=()=>{if(!e.hasNodes([oh,rh,th]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return nh(e.registerCommand(xo,()=>{let h=null;return e.getEditorState().read(()=>{let x=sh();ah(x)&&(h=x)}),h&&d(),!0},ch))},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],ph(a,p);let m;t[10]!==e?(m=(h,x)=>{!x.columns||!x.rows||e.dispatchCommand(eh,{columns:String(x.columns),rows:String(x.rows)})},t[10]=e,t[11]=m):m=t[11];let f;return t[12]!==c||t[13]!==i||t[14]!==m?(f=Y1(Ys.Fragment,{children:[vr(st,{drawerSlug:c,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:m,schemaPath:i,schemaPathSuffix:"fields"}),vr(Q1,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]}),t[12]=c,t[13]=i,t[14]=m,t[15]=f):f=t[15],f};var bh=y({markdownTransformers:[Ls],nodes:[xh,gh,Ch],plugins:[{Component:ea,position:"normal"},{Component:js,position:"normal"},{Component:Os,position:"floatingAnchorElem"},{Component:Zs,position:"floatingAnchorElem"}],providers:[Qs],slashMenu:{groups:[ee([{Icon:Cr,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(xo,{})}}])]},toolbarFixed:{groups:[_e([{ChildComponent:Cr,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(xo,{})}}])]}});import{$isNodeSelection as Zh}from"lexical";import{jsx as Mr,jsxs as kh}from"react/jsx-runtime";import"react";var Ar=()=>kh("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Mr("path",{d:"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"}),Mr("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"}),Mr("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 Nh}from"react/jsx-runtime";import ra from"bson-objectid";import{$applyNodeReplacement as Sh}from"lexical";import*as na from"react";import{jsx as _h}from"react/jsx-runtime";import{DecoratorBlockNode as Th}from"@lexical/react/LexicalDecoratorBlockNode.js";import ta from"bson-objectid";import{$applyNodeReplacement as wh}from"lexical";import"react";function Dr(t){return t.parentElement!=null&&t.parentElement.tagName==="LI"&&t.previousSibling===null&&t.getAttribute("aria-roledescription")==="checkbox"}function Eh(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:oa({data:{fields:{},relationTo:r,value:o}})}}let e=t;return e.src.startsWith("file:///")||Dr(e),null}var Dt=class extends Th{__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:Eh,priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new ta.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,relationTo:e.relationTo,value:e.value},r=oa({data:o});return r.setFormat(e.format),r}static isInline(){return!1}decorate(){return _h(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 oa({data:t}){return t?.id||(t.id=new ta.default().toHexString()),wh(new Dt({data:t}))}var Lh=na.lazy(()=>import("./component-NNKG7K3O.js").then(t=>({default:t.UploadComponent})));function yh(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:We({data:{fields:{},relationTo:r,value:o}})}}let e=t;return e.src.startsWith("file:///")||Dr(e),null}var Re=class extends Dt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{img:e=>({conversion:yh,priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new ra.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,relationTo:e.relationTo,value:e.value},r=We({data:o});return r.setFormat(e.format),r}decorate(){return Nh(Lh,{data:this.__data,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function We({data:t}){return t?.id||(t.id=new ra.default().toHexString()),Sh(new Re({data:t}))}function Or(t){return t instanceof Re}import{c as $h}from"react/compiler-runtime";import{jsx as Fh}from"react/jsx-runtime";import{useLexicalComposerContext as Ph}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Bh,mergeRegister as Hh}from"@lexical/utils";import{useConfig as jh}from"@payloadcms/ui";import{$getPreviousSelection as Uh,$getSelection as Gh,$isParagraphNode as Wh,$isRangeSelection as Vh,COMMAND_PRIORITY_EDITOR as Kh,createCommand as Jh}from"lexical";import{useEffect as Xh}from"react";import{c as la}from"react/compiler-runtime";import{jsx as $r}from"react/jsx-runtime";import{useLexicalComposerContext as ia}from"@lexical/react/LexicalComposerContext.js";import{toast as Ih}from"@payloadcms/ui";import{$getNodeByKey as Rh,COMMAND_PRIORITY_EDITOR as sa}from"lexical";import{useEffect as aa,useState as vh}from"react";var Mh=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=Rh(o);n&&n.replace(We({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(Fr,{fields:null,relationTo:e,value:r})},Ah=t=>{let e=la(13),{enabledCollectionSlugs:o}=t,[r]=ia(),[n,l]=vh(null),i;e[0]!==o?(i={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=i):i=e[1];let{closeListDrawer:s,ListDrawer:u,openListDrawer:c}=yt(i),d,a;e[2]!==r||e[3]!==c?(d=()=>r.registerCommand(Ke,h=>(l(h?.replace?h?.replace.nodeKey:null),c(),!0),sa),a=[r,c],e[2]=r,e[3]=c,e[4]=d,e[5]=a):(d=e[4],a=e[5]),aa(d,a);let p;e[6]!==s||e[7]!==r||e[8]!==n?(p=h=>{let{collectionSlug:x,doc:k}=h;s(),Mh({editor:r,relationTo:x,replaceNodeKey:n,value:k.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=$r(u,{onSelect:m}),e[10]=u,e[11]=m,e[12]=f):f=e[12],f},Dh=()=>{let t=la(3),[e]=ia(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Ke,Oh,sa),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),aa(o,r),null},ca=t=>$r(Ot,{...t,FallbackComponent:Dh,uploads:!0,children:$r(Ah,{...t})});function Oh(){return Ih.error("No upload collections enabled"),!0}var Fr=Jh("INSERT_UPLOAD_COMMAND"),ua=t=>{let e=$h(5),[o]=Ph(),{config:r}=jh(),{collections:n}=r,l,i;e[0]!==o?(l=()=>{if(!o.hasNodes([Re]))throw new Error("UploadPlugin: UploadNode not registered on editor");return Hh(o.registerCommand(Fr,u=>(o.update(()=>{let c=Gh()||Uh();if(Vh(c)){let d=We({data:{id:u.id,fields:u.fields,relationTo:u.relationTo,value:u.value}}),{focus:a}=c,p=a.getNode();Bh(d),Wh(p)&&!p.__first&&p.remove()}}),!0),Kh))},i=[o],e[0]=o,e[1]=l,e[2]=i):(l=e[1],i=e[2]),Xh(l,i);let s;return e[3]!==n?(s=Fh(ca,{enabledCollectionSlugs:n.map(zh)}),e[3]=n,e[4]=s):s=e[4],s};function zh(t){let{slug:e}=t;return e}var Yh=y({nodes:[Re],plugins:[{Component:ua,position:"normal"}],slashMenu:{groups:[ee([{Icon:Ar,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ke,{replace:!1})}}])]},toolbarFixed:{groups:[_e([{ChildComponent:Ar,isActive:({selection:t})=>{if(!Zh(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Or(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ke,{replace:!1})}}])]}});import{c as Qh}from"react/compiler-runtime";import{jsx as Br}from"react/jsx-runtime";import{ShimmerEffect as eg,useConfig as tg}from"@payloadcms/ui";import{lazy as og,Suspense as rg,useEffect as ng,useState as lg}from"react";var da={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:da};function ma({config:t,featureClientImportMap:e,featureClientSchemaMap:o,field:r,schemaPath:n,unSanitizedEditorConfig:l}){for(let c of l.features)if(!c?.clientFeatureProps?.featureKey||c?.clientFeatureProps?.order===void 0||c?.clientFeatureProps?.order===null)throw new Error("A Feature you have installed does not return the client props as clientFeatureProps. Please make sure to always return those props, even if they are null, as other important props like order and featureKey are later on injected.");l.features=l.features.sort((c,d)=>c.clientFeatureProps.order-d.clientFeatureProps.order);let i=new Map;for(let c of l.features)i.set(c.clientFeatureProps.featureKey,c);let s=new Map,u=0;for(let c of l.features){let d=typeof c.feature=="function"?c.feature({config:t,featureClientImportMap:e,featureClientSchemaMap:o,featureProviderMap:i,field:r,resolvedFeatures:s,schemaPath:n,unSanitizedEditorConfig:l}):c.feature;d.key=c.clientFeatureProps.featureKey,d.order=u,s.set(c.clientFeatureProps.featureKey,d),u++}return s}import{deepMerge as qh}from"payload/shared";var pa=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}},o={};if(t.forEach(r=>{r.key==="toolbarFixed"&&r.sanitizedClientFeatureProps?.customGroups&&(o={...o,...r.sanitizedClientFeatureProps.customGroups})}),!t?.size)return e;t.forEach(r=>{if(r.providers?.length&&(e.providers=e.providers.concat(r.providers)),r.enableFormats?.length&&e.enabledFormats.push(...r.enableFormats),r.nodes?.length)for(let n of r.nodes)e.nodes.push(n);if(r.plugins?.length&&r.plugins.forEach((n,l)=>{e.plugins?.push({clientProps:r.sanitizedClientFeatureProps,Component:n.Component,key:r.key+l,position:n.position})}),r.toolbarInline?.groups?.length)for(let n of r.toolbarInline.groups){let l=e.toolbarInline.groups.find(i=>i.key===n.key);l?e.toolbarInline.groups=e.toolbarInline.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.toolbarInline?.groups.push(l)}if(r.toolbarFixed?.groups?.length)for(let n of r.toolbarFixed.groups){let l=e.toolbarFixed.groups.find(i=>i.key===n.key);l?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.toolbarFixed?.groups.push(l)}if(r.slashMenu?.groups){r.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(r.slashMenu.dynamicGroups));for(let n of r.slashMenu.groups){let l=e.slashMenu.groups.find(i=>i.key===n.key);l?e.slashMenu.groups=e.slashMenu.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.slashMenu.groups.push(l)}}if(r.markdownTransformers?.length)for(let n of r.markdownTransformers)typeof n=="function"?e.markdownTransformers.push(n({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(n);e.enabledFeatures.push(r.key)}),Object.keys(o).length>0&&(e.toolbarFixed.groups=e.toolbarFixed.groups.map(r=>{let n=o[r.key];return n?qh(r,n):r})),e.toolbarInline.groups.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0),e.toolbarFixed.groups.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);for(let r of e.toolbarInline.groups)r.items.sort((n,l)=>n.order&&l.order?n.order-l.order:n.order?-1:l.order?1:0);for(let r of e.toolbarFixed.groups)r.items.sort((n,l)=>n.order&&l.order?n.order-l.order:n.order?-1:l.order?1:0);return e};function Pr(t,e,o){return{admin:o,features:pa(t),lexical:e,resolvedFeatureMap:t}}var ig=og(()=>import("./Field-6GAC5Y2D.js").then(t=>({default:t.RichText}))),sg=t=>{let e=Qh(16),{admin:o,clientFeatures:r,featureClientImportMap:n,featureClientSchemaMap:l,field:i,lexicalEditorConfig:s,schemaPath:u}=t,c;e[0]!==o?(c=o===void 0?{}:o,e[0]=o,e[1]=c):c=e[1];let d=c,a=s===void 0?Co:s,{config:p}=tg(),[m,f]=lg(null),h,x;e[2]!==d||e[3]!==r||e[4]!==p||e[5]!==n||e[6]!==l||e[7]!==i||e[8]!==m||e[9]!==a||e[10]!==u?(h=()=>{if(m)return;let I=[];for(let[_,g]of Object.entries(r))g.clientFeatureProvider&&I.push(g.clientFeatureProvider(g.clientFeatureProps));let A=a||Co,b=ma({config:p,featureClientImportMap:n,featureClientSchemaMap:l,field:i,schemaPath:u??i.name,unSanitizedEditorConfig:{features:I,lexical:A}});f(Pr(b,A,d))},x=[a,d,m,r,n,l,i,p,u],e[2]=d,e[3]=r,e[4]=p,e[5]=n,e[6]=l,e[7]=i,e[8]=m,e[9]=a,e[10]=u,e[11]=h,e[12]=x):(h=e[11],x=e[12]),ng(h,x);let k;return e[13]!==m||e[14]!==t?(k=Br(rg,{fallback:Br(eg,{height:"35vh"}),children:m&&Br(ig,{...t,editorConfig:m})}),e[13]=m,e[14]=t,e[15]=k):k=e[15],k};function ag(t){return t instanceof HTMLElement}function cg(...t){return t.filter(Boolean).join(" ")}var bo=new WeakMap;function fa(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function ko(t,e){let o=bo.get(t);if(o===void 0){let r=new Set,n=i=>{o!==void 0&&(o.start=fa(i))},l=i=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let u=fa(i);for(let c of r)u!==null&&c([u[0]-s[0],u[1]-s[1]],i)};t.addEventListener("touchstart",n),t.addEventListener("touchend",l),o={handleTouchend:l,handleTouchstart:n,listeners:r,start:null},bo.set(t,o)}return o.listeners.add(e),()=>{ug(t,e)}}function ug(t,e){let o=bo.get(t);if(o===void 0)return;let{listeners:r}=o;r.delete(e),r.size===0&&(bo.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function dg(t,e){return ko(t,(o,r)=>{let[n,l]=o;n<0&&-n>Math.abs(l)&&e(n,r)})}function mg(t,e){return ko(t,(o,r)=>{let[n,l]=o;n>0&&n>Math.abs(l)&&e(n,r)})}function pg(t,e){return ko(t,(o,r)=>{let[n,l]=o;l<0&&-l>Math.abs(n)&&e(n,r)})}function fg(t,e){return ko(t,(o,r)=>{let[n,l]=o;l>0&&l>Math.abs(n)&&e(n,r)})}import{c as hg}from"react/compiler-runtime";import{jsx as gg}from"react/jsx-runtime";import"react";var xg=()=>{let t=hg(2),{EditButton:e}=be(),o;return t[0]!==e?(o=e?gg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Cg}from"react/compiler-runtime";import{jsx as bg}from"react/jsx-runtime";import"react";var kg=()=>{let t=Cg(2),{RemoveButton:e}=be(),o;return t[0]!==e?(o=e?bg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as _g}from"react/compiler-runtime";import{jsx as Tg}from"react/jsx-runtime";import"react";var wg=()=>{let t=_g(2),{Label:e}=be(),o;return t[0]!==e?(o=e?Tg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Eg}from"react/compiler-runtime";import{jsx as Ng}from"react/jsx-runtime";import"react";var Sg=t=>{let e=Eg(3),{children:o}=t,{InlineBlockContainer:r}=be(),n;return e[0]!==r||e[1]!==o?(n=r?Ng(r,{children:o}):null,e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{c as Lg}from"react/compiler-runtime";import{jsx as yg}from"react/jsx-runtime";import"react";var Ig=t=>{let e=Lg(6),{children:o,editButton:r,Label:n,removeButton:l}=t,{BlockCollapsible:i}=$e(),s;return e[0]!==i||e[1]!==n||e[2]!==o||e[3]!==r||e[4]!==l?(s=i?yg(i,{editButton:r,Label:n,removeButton:l,children:o}):null,e[0]=i,e[1]=n,e[2]=o,e[3]=r,e[4]=l,e[5]=s):s=e[5],s};import{c as Rg}from"react/compiler-runtime";import{jsx as vg}from"react/jsx-runtime";import"react";var Mg=()=>{let t=Rg(2),{EditButton:e}=$e(),o;return t[0]!==e?(o=e?vg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Ag}from"react/compiler-runtime";import{jsx as Dg}from"react/jsx-runtime";import"react";var Og=()=>{let t=Ag(2),{RemoveButton:e}=$e(),o;return t[0]!==e?(o=e?Dg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as $g}from"qs-esm";var Fg=({apiURL:t,depth:e,draft:o,locale:r})=>async({id:l,collectionSlug:i,select:s})=>{let u=$g({depth:e??0,draft:o??!1,locale:r,select:s},{addQueryPrefix:!0});return await fetch(`${t}/${i}/${l}${u}`,{credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json"},method:"GET"}).then(d=>d.json())};export{Ct as $createAutoLinkNode,Vt as $createBlockNode,To as $createInlineBlockNode,Te as $createLinkNode,Ue as $createRelationshipNode,We as $createUploadNode,Ee as $isAutoLinkNode,ft as $isBlockNode,wo as $isInlineBlockNode,Y as $isLinkNode,cr as $isRelationshipNode,Or as $isUploadNode,La as AlignFeatureClient,we as AutoLinkNode,Ig as BlockCollapsible,Mg as BlockEditButton,ke as BlockNode,Og as BlockRemoveButton,Ma as BlockquoteFeatureClient,Ic as BlocksFeatureClient,qc as BoldFeatureClient,ce as CAN_USE_DOM,qm as ChecklistFeatureClient,Up as DETAIL_TYPE_TO_DETAIL,Pp as DOUBLE_LINE_BREAK,ef as DebugJsxConverterFeatureClient,Wp as ELEMENT_FORMAT_TO_TYPE,Gp as ELEMENT_TYPE_TO_FORMAT,ka as ENABLE_SLASH_MENU_COMMAND,ga as EditorConfigProvider,st as FieldsDrawer,h0 as FixedToolbarFeatureClient,Vu as HeadingFeatureClient,ad as HorizontalRuleFeatureClient,Je as INSERT_BLOCK_COMMAND,Xe as INSERT_INLINE_BLOCK_COMMAND,$p as IS_ALL_FORMATTING,Ed as IndentFeatureClient,Sg as InlineBlockContainer,xg as InlineBlockEditButton,wg as InlineBlockLabel,_o as InlineBlockNode,kg as InlineBlockRemoveButton,ru as InlineCodeFeatureClient,S0 as InlineToolbarFeatureClient,su as ItalicFeatureClient,Hp as LTR_REGEX,kp as LexicalPluginToLexicalFeatureClient,Fm as LinkFeatureClient,ie as LinkNode,Fp as NON_BREAKING_SPACE,O as NodeFormat,ip as OrderedListFeatureClient,yp as ParagraphFeatureClient,Ca as Point,Bp as RTL_REGEX,_a as Rect,jf as RelationshipFeatureClient,Se as RelationshipNode,sg as RichTextField,Sp as SlateToLexicalFeatureClient,mu as StrikethroughFeatureClient,gu as SubscriptFeatureClient,ku as SuperscriptFeatureClient,Vp as TEXT_MODE_TO_TYPE,jp as TEXT_TYPE_TO_FORMAT,Kp as TEXT_TYPE_TO_MODE,ge as TOGGLE_LINK_COMMAND,bh as TableFeatureClient,Gc as TestRecorderFeatureClient,$u as TextStateFeatureClient,It as ToolbarButton,Ge as ToolbarDropdown,Xc as TreeViewFeatureClient,Nu as UnderlineFeatureClient,fp as UnorderedListFeatureClient,Yh as UploadFeatureClient,Re as UploadNode,fg as addSwipeDownListener,dg as addSwipeLeftListener,mg as addSwipeRightListener,pg as addSwipeUpListener,jo as createBlockNode,y as createClientFeature,tf as defaultColors,Co as defaultEditorLexicalConfig,xr as getDOMRangeRect,Ta as getEnabledNodes,Fg as getRestPopulateFn,ze as getSelectedNode,ag as isHTMLElement,ba as isPoint,cg as joinClasses,Pr as sanitizeClientEditorConfig,pa as sanitizeClientFeatures,so as setFloatingElemPosition,eo as setFloatingElemPositionForLinkEditor,ee as slashMenuBasicGroupWithItems,_e as toolbarAddDropdownGroupWithItems,Go as toolbarFeatureButtonsGroupWithItems,te as toolbarFormatGroupWithItems,le as toolbarTextDropdownGroupWithItems,$e as useBlockComponentContext,G as useEditorConfigContext,be as useInlineBlockComponentContext,xa as useLexicalDocumentDrawer,Ce as useLexicalDrawer,yt as useLexicalListDrawer};
|
|
41
41
|
//# sourceMappingURL=index.js.map
|