@frontify/guideline-blocks-settings 2.1.2 → 2.1.4

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/index.umd.js CHANGED
@@ -6,5 +6,5 @@ ${a.getHotkeyByPlatform("Ctrl+Shift+K")}`:"Buttons can only be set for a single
6
6
  ${y?"tw-pl-7 ":"tw-pl-12 "}
7
7
  ${p?"tw-bg-highlight tw-text-highlight-on-highlight hover:tw-bg-highlight-hover:hover hover:tw-text-highlight-on-highlight:hover ":"hover:tw-bg-container-secondary-hover hover:tw-text-container-secondary-on-secondary-container "}`,onClick:()=>n(t.permanentLink),children:o.jsxs("div",{className:"tw-flex tw-flex-1 tw-space-x-1 tw-items-center tw-h-6",children:[y&&o.jsx("button",{type:"button",className:"tw-flex tw-items-center tw-justify-center -tw-mr-2 tw-pr-3.5 tw-pt-1.5 tw-pb-1.5 tw-pl-3.5 tw-cursor-pointer",onClick:()=>c(!l),onKeyDown:m=>m.key==="Enter"&&m.stopPropagation(),children:o.jsx("div",{className:`tw-transition-transform tw-w-0 tw-h-0 tw-font-normal tw-border-t-4 tw-border-t-transparent tw-border-b-4 tw-border-b-transparent tw-border-l-4 tw-border-l-x-strong
8
8
  ${l?"tw-rotate-90 ":""}`})}),o.jsx("span",{className:"tw-text-small",children:t.title}),o.jsx("span",{className:"tw-flex-auto tw-font-sans tw-text-x-small tw-text-right",children:"Page"})]},t.id)}),l&&u.length>0&&u.map(m=>o.jsx(bo,{section:m,selectedUrl:e,onSelectUrl:n},m.id))]})},Co=({documentId:t,selectedUrl:e,onSelectUrl:n,itemsToExpandInitially:s,getDocumentSectionsByDocumentPageId:r,getDocumentPagesByDocumentId:l})=>{const[c,u]=g.useState([]),[d,p]=g.useState(!0),y=[...c.values()],m=!d&&y.length>0;return g.useEffect(()=>{l(t).then(w=>{const k=w.filter(P=>!!P.category).sort((P,L)=>P.category.sort===L.category.sort?P.sort-L.sort:P.category.sort-L.category.sort),v=w.filter(P=>!P.category).sort((P,L)=>P.sort-L.sort);u([...k,...v])}).finally(()=>{p(!1)})},[]),d?o.jsx(ze,{}):m?o.jsx(o.Fragment,{children:y.map(w=>o.jsx(vo,{page:w,selectedUrl:e,onSelectUrl:n,itemsToExpandInitially:s,getDocumentSectionsByDocumentPageId:r},w.id))}):o.jsx("div",{className:"tw-h-10 tw-flex tw-items-center tw-pr-2.5 tw-pl-7 tw-leading-5 tw-text-small tw-text-secondary",children:"This document does not contain any pages."})},ko=({document:t,selectedUrl:e,onSelectUrl:n,itemsToExpandInitially:s,getDocumentSectionsByDocumentPageId:r,getDocumentPagesByDocumentId:l})=>{const[c,u]=g.useState(t.id===s.documentId),d=t.permanentLink===e;return g.useEffect(()=>{t.id===s.documentId&&u(!0)},[s,t.id]),o.jsxs(o.Fragment,{children:[o.jsxs("button",{type:"button","data-test-id":"internal-link-selector-document-link",className:`tw-flex tw-flex-1 tw-space-x-2 tw-items-center tw-py-2 tw-pr-2.5 tw-leading-5 tw-cursor-pointer tw-w-full ${d?"tw-bg-highlight tw-text-highlight-on-highlight hover:tw-bg-highlight-hover:hover hover:tw-text-highlight-on-highlight:hover":"hover:tw-bg-container-secondary-hover hover:tw-text-container-secondary-on-secondary-container"}`,onClick:()=>n(t.permanentLink),children:[o.jsx("button",{type:"button",tabIndex:0,"data-test-id":"tree-item-toggle",className:"tw-flex tw-items-center tw-justify-center -tw-mr-2 tw-pr-3.5 tw-pt-1.5 tw-pb-1.5 tw-pl-3.5 tw-cursor-pointer",onClick:()=>u(!c),onKeyDown:p=>p.key==="Enter"&&p.stopPropagation(),children:o.jsx("div",{className:`tw-transition-transform tw-w-0 tw-h-0 tw-font-normal tw-border-t-4 tw-border-t-transparent tw-border-b-4 tw-border-b-transparent tw-border-l-4 tw-border-l-x-strong ${c?"tw-rotate-90":""}`})}),o.jsx(x.IconColorFan,{size:16}),o.jsx("span",{className:"tw-text-small",children:t.title}),o.jsx("span",{className:"tw-flex-auto tw-font-sans tw-text-x-small tw-text-right",children:"Document"})]}),c&&o.jsx(Co,{documentId:t.id,selectedUrl:e,onSelectUrl:n,itemsToExpandInitially:s,getDocumentSectionsByDocumentPageId:r,getDocumentPagesByDocumentId:l})]})},To=({selectedUrl:t,onSelectUrl:e,getAllDocuments:n,getDocumentPagesByDocumentId:s,getDocumentSectionsByDocumentPageId:r})=>{const[l,c]=g.useState(!0),[u,d]=g.useState([]),[p,y]=g.useState({documentId:void 0,pageId:void 0});g.useEffect(()=>{t&&u.length>0&&m().then(w=>{y(w)})},[u.length]),g.useEffect(()=>{n().then(w=>{d(w)}).finally(()=>{c(!1)})},[]);const m=async()=>{const w={documentId:void 0,pageId:void 0};if(u.find(v=>v.permanentLink===t))return w;for(const v of u){const P=await s(v.id);if(!!P.find(D=>D.permanentLink===t))return w.documentId=v.id,w;for(const D of P){const M=await r(D.id);if(!!He(M).find(z=>z.permanentLink===t))return w.documentId=v.id,w.pageId=D.id,w}}return w};return l?o.jsx(ze,{}):o.jsx(o.Fragment,{children:u.map(w=>o.jsx(ko,{document:w,selectedUrl:t,onSelectUrl:e,itemsToExpandInitially:p,getDocumentSectionsByDocumentPageId:r,getDocumentPagesByDocumentId:s},w.id))})},Ve=({url:t,onUrlChange:e,buttonSize:n="medium",getAllDocuments:s,getDocumentPagesByDocumentId:r,getDocumentSectionsByDocumentPageId:l})=>{const[c,u]=g.useState(!1),[d,p]=g.useState(t),y=v=>{p(v)},m=v=>{v.key==="Enter"&&(v.preventDefault(),w())};g.useEffect(()=>{t&&!d&&p(t)},[t,d]);const w=()=>{e?.(d),u(!1)},k={onOpenAutoFocus:()=>{},showUnderlay:!0,"data-is-underlay":!0,minWidth:"800px"};return o.jsx("div",{onPointerDown:v=>{v.preventDefault()},"data-test-id":"internal-link-selector",onKeyDown:m,children:o.jsxs(f.Dialog.Root,{modal:!0,open:c,onOpenChange:u,children:[o.jsx(f.Dialog.Trigger,{asChild:!0,children:o.jsxs(f.Button,{size:n,emphasis:"default",children:[o.jsx(x.IconLink,{size:"20"}),"Internal link"]})}),o.jsxs(f.Dialog.Content,{...k,children:[o.jsx(f.Dialog.Header,{children:o.jsx(f.Dialog.Title,{children:"Select internal link"})}),o.jsx(f.Dialog.Body,{padding:"none",children:o.jsx(f.ScrollArea,{padding:"compact",children:o.jsx(To,{selectedUrl:d,onSelectUrl:y,getAllDocuments:s,getDocumentPagesByDocumentId:r,getDocumentSectionsByDocumentPageId:l})})}),o.jsxs(f.Dialog.Footer,{children:[o.jsx(f.Button,{size:n,emphasis:"default",onPress:()=>u(!1),children:"Cancel"}),o.jsx(f.Button,{size:n,disabled:!d,emphasis:"strong",onPress:()=>w(),children:"Choose"})]})]})]})})},$e=({onUrlChange:t,onToggleTab:e,isValidUrlOrEmpty:n,appBridge:s,placeholder:r,newTab:l,url:c="",required:u,info:d,label:p,buttonSize:y,hideInternalLinkButton:m})=>{const w=n?n(c):st(c);return o.jsxs("div",{"data-test-id":"link-input",children:[o.jsx(V.FormControl,{label:{children:p,htmlFor:"url",required:u,tooltip:d?{content:d,position:"top"}:void 0},children:o.jsx(f.TextInput,{"data-test-id":"text-input",id:"url",value:c,onChange:k=>t?.(k.target.value),placeholder:r??"https://example.com"})}),!w&&o.jsx("div",{className:"tw-text-error tw-mt-1 tw-text-small",children:"Please enter a valid URL."}),!m&&o.jsx("div",{className:"tw-mt-3",children:o.jsx(Ve,{url:c,onUrlChange:t,buttonSize:y??"medium",getAllDocuments:()=>s.getAllDocuments(),getDocumentPagesByDocumentId:k=>s.getDocumentPagesByDocumentId(k),getDocumentSectionsByDocumentPageId:k=>s.getDocumentSectionsByDocumentPageId(k)})}),o.jsxs("div",{className:"tw-mt-3 tw-flex tw-items-center tw-gap-1.5",children:[o.jsx(f.Checkbox,{id:"new-tab",value:l,onChange:()=>e?.(!l)}),o.jsx(f.Label,{id:"new-tab-label",htmlFor:"new-tab",className:"tw-whitespace-nowrap",children:"Open in new tab"})]})]})},We=({state:t,onTextChange:e,onUrlChange:n,onToggleTab:s,onCancel:r,onSave:l,isValidUrlOrEmpty:c,hasValues:u,testId:d,appBridge:p,children:y})=>o.jsxs(a.FloatingModalWrapper,{"data-test-id":d,padding:"28px",minWidth:"400px",children:[o.jsx(V.FormControl,{label:{children:"Text",htmlFor:"linkText",required:!0},children:o.jsx(f.TextInput,{id:"linkText",value:t.text,placeholder:"Link Text",onChange:m=>e(m.target.value)})}),y,o.jsx("div",{className:"tw-mt-5",children:o.jsx($e,{url:t.url,newTab:t.newTab,onUrlChange:n,onToggleTab:s,isValidUrlOrEmpty:c,appBridge:p})}),o.jsx("div",{className:"tw-mt-3",children:o.jsxs("div",{className:"tw-pt-5 tw-flex tw-gap-x-3 tw-justify-end tw-border-t tw-border-t-black-10",children:[o.jsx(f.Button,{"data-test-id":"button",onPress:r,size:"medium",emphasis:"default",children:"Cancel"}),o.jsxs(f.Button,{"data-test-id":"button",onPress:l,size:"medium",disabled:!c(t?.url)||!u,children:[o.jsx(x.IconCheckMark,{size:"20"}),"Save"]})]})})]}),Po=t=>{const e=a.getAboveNode(t,{match:{type:I}});return Array.isArray(e)&&e[0]?.buttonStyle||"primary"},xo={url:"",text:"",buttonStyle:"primary",newTab:!1},Io=()=>{const[t,e]=g.useReducer((n,s)=>{const{type:r,payload:l}=s;switch(r){case"NEW_TAB":return{...n,newTab:!0};case"SAME_TAB":return{...n,newTab:!1};case"URL":case"TEXT":case"BUTTON_STYLE":case"INIT":return{...n,...l};default:return n}},xo);return[t,e]},So=()=>{const t=a.useEditorRef(),[e,n]=Io();g.useEffect(()=>{const m=Po(t);n({type:"INIT",payload:{text:A.text()||A.url(),buttonStyle:m,newTab:!!A.newTab(),url:A.url()}})},[n,t]);const s=m=>{n({type:"TEXT",payload:{text:m}})},r=m=>{n({type:"BUTTON_STYLE",payload:{buttonStyle:m}})},l=m=>{n({type:"URL",payload:{url:m}})},c=m=>{n(m?{type:"NEW_TAB"}:{type:"SAME_TAB"})},u=()=>{B.reset()},d=m=>{if(!st(e.url)||!p)return;const w=wt(e.url);B.text(e.text),B.url(w),B.buttonStyle(e.buttonStyle),B.newTab(e.newTab),Ot(t)&&m?.preventDefault()},p=e.url!==""&&e.text!=="",{appBridge:y}=a.getPluginOptions(t,I);return a.useHotkeys("enter",d,{enableOnFormTags:["INPUT"]},[]),{state:e,onTextChange:s,onButtonStyleChange:r,onUrlChange:l,onToggleTab:c,onCancel:u,onSave:d,hasValues:p,isValidUrlOrEmpty:st,appBridge:y}},Eo=()=>{const t=So(),{state:e,onButtonStyleChange:n}=t;return o.jsx(We,{...t,testId:"floating-button-insert",children:o.jsx("div",{className:"tw-pt-5",children:o.jsxs(V.FormControl,{label:{children:"Button Style",htmlFor:"buttonStyle",required:!0},children:[o.jsx(zt,{id:"primary",styles:S.buttonPrimary,isActive:e.buttonStyle==="primary",onClick:()=>n("primary"),children:e.text||"Primary Button"}),o.jsx(zt,{id:"secondary",styles:S.buttonSecondary,isActive:e.buttonStyle==="secondary",onClick:()=>n("secondary"),children:e.text||"Secondary Button"}),o.jsx(zt,{id:"tertiary",styles:S.buttonTertiary,isActive:e.buttonStyle==="tertiary",onClick:()=>n("tertiary"),children:e.text||"Tertiary Button"})]})})})},zt=({id:t,styles:e,isActive:n,onClick:s,children:r})=>{const[l,c]=g.useState(!1),u=()=>e&&e.hover&&l?{...e,...e.hover}:e;return o.jsx("button",{"data-test-id":`floating-button-insert-${t}`,onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),onClick:s,style:{...u(),marginTop:0,marginBottom:0},className:n?"tw-outline tw-outline-1 tw-outline-violet-60 tw-outline-offset-2 tw-w-fit":"tw-w-fit",children:r})},qe={placement:"bottom-start",strategy:"absolute",middleware:[a.offset(12),a.flip({padding:12,fallbackPlacements:["bottom-end","top-start","top-end"]})]},Bo=()=>{const{ref:t,...e}=Lo(qe),{ref:n,...s}=No(qe),r=a.useEditorRef(),l=ut(),c=l.isOpen(r.id),u=l.isEditing(),d=l.mode(),p=o.jsx(Eo,{}),y=u?p:o.jsx(yo,{});return o.jsxs(o.Fragment,{children:[c&&d==="insert"&&mt.createPortal(o.jsx("div",{"data-is-underlay":!0,ref:t,...e,style:{...e.style,...S[a.TextStyles.p]},children:p}),document.body),c&&d==="edit"&&mt.createPortal(o.jsx("div",{"data-is-underlay":!0,ref:n,...s,style:{...s.style,...S[a.TextStyles.p]},children:y}),document.body)]})},I="button",Ge="button-plugin",Ke=t=>a.createPluginFactory({key:I,isElement:!0,isInline:!0,props:({element:e})=>({nodeProps:{href:e?.url,target:e?.target}}),withOverrides:Ae,renderAfterEditable:Bo,options:{isUrl:yt,rangeBeforeOptions:{matchString:" ",skipInvalid:!0,afterMatch:!0},triggerFloatingButtonHotkeys:"command+shift+k, ctrl+shift+k",appBridge:t},then:(e,{type:n})=>({deserializeHtml:{rules:[{validNodeName:"A",validClassName:"btn"}],getNode:s=>({type:n,url:s.getAttribute("href"),target:s.getAttribute("target")||"_blank"})}})})();class je extends a.Plugin{styles={};appBridge;constructor({styles:e=vt,...n}){super(Ge,{button:wo,markupElement:new po,...n}),this.styles=e,this.appBridge=n?.appBridge}plugins(){return[Ke(this.appBridge)]}}const No=t=>{const e=a.useEditorRef(),n=ut().mode(),s=ut().isOpen(e.id),r=a.useEditorVersion(),{triggerFloatingButtonHotkeys:l}=a.getPluginOptions(e,I),c=g.useCallback(()=>{const m=a.getAboveNode(e,{match:{type:a.getPluginType(e,I)}});if(m){const[,w]=m;return a.getRangeBoundingClientRect(e,{anchor:a.getStartPoint(e,w),focus:a.getEndPoint(e,w)})}return a.getDefaultBoundingClientRect()},[e]),u=s&&n==="edit",{update:d,style:p,floating:y}=Qe({open:u,getBoundingClientRect:c,...t});return g.useEffect(()=>{const m=Fe(e);if(m&&B.url(m),e.selection&&a.someNode(e,{match:{type:a.getPluginType(e,I)}})){B.show("edit",e.id),d();return}A.mode()==="edit"&&B.reset()},[e,r,d]),a.useHotkeys(l,m=>{m.preventDefault(),A.mode()==="edit"&&bt(e)},{enableOnContentEditable:!0},[]),Ao(),Ye(),{style:p,ref:a.useComposedRef(y)}},Ao=()=>{const t=a.useEditorRef();a.useHotkeys("*",e=>{e.key==="Enter"&&Ot(t)&&e.preventDefault()},{enableOnFormTags:["INPUT"]},[])},Ye=()=>{const t=a.useEditorRef();a.useHotkeys("escape",()=>{if(A.mode()==="edit"){if(A.isEditing()){B.show("edit",t.id),a.focusEditor(t,t.selection??void 0);return}B.reset()}},{enableOnFormTags:["INPUT"],enableOnContentEditable:!0},[])},Lo=t=>{const e=a.useEditorRef(),n=a.useFocused(),s=ut().mode(),r=ut().isOpen(e.id),{triggerFloatingButtonHotkeys:l}=a.getPluginOptions(e,I);a.useHotkeys(l,p=>{p.preventDefault(),Ut(e,{focused:n})},{enableOnContentEditable:!0},[n]);const{update:c,style:u,floating:d}=Qe({open:r&&s==="insert",getBoundingClientRect:a.getSelectionBoundingClientRect,whileElementsMounted:void 0,...t});return g.useEffect(()=>{r&&c(),B.updated(r)},[r,c]),Ye(),{style:u,ref:a.useComposedRef(d)}},Do=12,Mo=-22,Fo=96,Qe=t=>a.useVirtualFloating({placement:"bottom-start",middleware:[a.offset({mainAxis:Do,alignmentAxis:Mo}),a.flip({padding:Fo})],...t}),Vt="[&_.tw-break-after-column]:tw-break-after-auto [&_.tw-break-inside-avoid-column]:tw-break-inside-auto [&_.tw-break-after-column.tw-pb-5]:tw-pb-0 @md:[&_.tw-break-after-column.tw-pb-5]:!tw-pb-5 @md:[&_.tw-break-after-column]:!tw-break-after-column @md:[&_.tw-break-inside-avoid-column]:!tw-break-inside-avoid-column",Xe={1:"tw-columns-1",2:"tw-columns-1 @sm:!tw-columns-2 [&_.tw-break-after-column]:tw-break-after-auto [&_.tw-break-inside-avoid-column]:tw-break-inside-auto [&_.tw-break-after-column.tw-pb-5]:tw-pb-0 @sm:[&_.tw-break-after-column.tw-pb-5]:!tw-pb-5 @sm:[&_.tw-break-after-column]:!tw-break-after-column @sm:[&_.tw-break-inside-avoid-column]:!tw-break-inside-avoid-column",3:`tw-columns-1 @md:!tw-columns-3 ${Vt}`,4:`tw-columns-1 @md:!tw-columns-4 ${Vt}`,5:`tw-columns-1 @md:!tw-columns-5 ${Vt}`},Je=t=>t?Xe[t]||Xe[1]:"",Oo=t=>{A.isOpen(t)&&B.reset()},Ze=g.memo(({isEnabled:t,value:e,columns:n,gap:s,placeholder:r,plugins:l,onTextChange:c,showSerializedText:u})=>{const d=Je(n),[p,y]=g.useState(!1),m=g.useId(),w=g.useCallback(v=>{v!==e&&c?.(v),y(!1)},[c,e]),k=g.useCallback(()=>y(!0),[]);return g.useEffect(()=>{const v=P=>{P.preventDefault(),P.returnValue="Unprocessed changes"};return p&&window.addEventListener("beforeunload",v),()=>window.removeEventListener("beforeunload",v)},[p]),t?o.jsx(a.RichTextEditor,{id:m,value:e,border:!1,placeholder:r,plugins:l,onValueChanged:k,onTextChange:w,hideExternalFloatingModals:Oo,placeholderOpacity:"high"}):o.jsx(to,{value:e,gap:s,customClass:d,show:u,plugins:l})});Ze.displayName="InternalRichTextEditor";const _o=t=>{const e=g.useRef(null),[n,s]=g.useState(!1),{isEditing:r,...l}=t,c=g.useCallback(u=>{u&&s(!0)},[]);return Rn({ref:e,disabled:!r,onChange:c}),g.useEffect(()=>{r||s(!1)},[r]),o.jsx("div",{"data-test-id":"rich-text-editor-container",className:"tw-block tw-w-full tw-@container",ref:e,children:o.jsx(Ze,{...l,isEnabled:r&&n})})},Uo=({editButtonProps:t,unlinkButtonProps:e})=>{const{element:n}=a.useLinkOpenButtonState(),s=n?Mt(n):"";return o.jsx(a.FloatingModalWrapper,{"data-test-id":"floating-link-edit",padding:"16px",minWidth:"400px",children:o.jsxs("span",{"data-test-id":"preview-link-flyout",className:"tw-flex tw-justify-between tw-items-center tw-gap-2",children:[o.jsx("a",{"data-test-id":"floating-link-edit-url",href:s,target:"_blank",rel:"noopener noreferrer",style:S[it],className:"tw-break-all",children:s}),o.jsxs("span",{className:"tw-flex tw-gap-2",children:[o.jsx("button",{tabIndex:0,"data-test-id":"edit-link-button",className:"tw-transition tw-cursor-pointer tw-rounded-medium hover:tw-bg-black-10 tw-p-1",...t,children:o.jsx(x.IconPen,{size:16})}),o.jsx("button",{tabIndex:0,"data-test-id":"remove-link-button",className:"tw-transition tw-cursor-pointer tw-rounded-medium hover:tw-bg-black-10 tw-p-1",...e,children:o.jsx(x.IconTrashBin,{size:16})})]})]})})},Re=(t,e)=>{const n=a.getAboveNode(t,{match:{type:a.ELEMENT_LINK}});return Array.isArray(n)?e(n[0]):""},Ho=t=>Re(t,e=>e.chosenLink?.searchResult?.link||""),zo=t=>Re(t,e=>e.url||""),Vo={url:"",text:"",newTab:!1},$o=()=>{const[t,e]=g.useReducer((n,s)=>{const{type:r,payload:l}=s;switch(r){case"NEW_TAB":return{...n,newTab:!0};case"SAME_TAB":return{...n,newTab:!1};case"URL":case"TEXT":case"INIT":return{...n,...l};default:return n}},Vo);return[t,e]},Wo=()=>{const t=a.useEditorRef(),[e,n]=$o();g.useEffect(()=>{const y=Ho(t),m=zo(t),w=a.floatingLinkSelectors.newTab();n({type:"INIT",payload:{text:a.floatingLinkSelectors.text()||a.floatingLinkSelectors.url(),newTab:w,url:y&&m===""?y:a.floatingLinkSelectors.url()}})},[n,t]);const s=y=>{n({type:"TEXT",payload:{text:y}})},r=y=>{n({type:"URL",payload:{url:y}})},l=y=>{n(y?{type:"NEW_TAB"}:{type:"SAME_TAB"})},c=()=>{a.floatingLinkActions.reset()},u=y=>{!st(e.url)||!d||(a.floatingLinkActions.text(e.text),a.floatingLinkActions.url(wt(e.url)),a.floatingLinkActions.newTab(e.newTab),a.submitFloatingLink(t)&&y?.preventDefault())},d=e.url!==""&&e.text!=="",{appBridge:p}=a.getPluginOptions(t,a.ELEMENT_LINK);return a.useHotkeys("enter",u,{enableOnFormTags:["INPUT"]},[]),{state:e,onTextChange:s,onUrlChange:r,onToggleTab:l,onCancel:c,onSave:u,hasValues:d,isValidUrlOrEmpty:st,appBridge:p}},qo=()=>o.jsx(We,{...Wo(),testId:"floating-link-insert"}),tn={placement:"bottom-start",strategy:"absolute",middleware:[a.offset(12),a.flip({padding:12,fallbackPlacements:["bottom-end","top-start","top-end"]})]},Go=()=>{const t=a.useFloatingLinkInsertState({floatingOptions:tn}),{props:e,ref:n,hidden:s}=a.useFloatingLinkInsert(t),r=a.useFloatingLinkEditState({floatingOptions:tn}),{props:l,ref:c,editButtonProps:u,unlinkButtonProps:d}=a.useFloatingLinkEdit(r);if(s)return null;const p=o.jsx(qo,{}),y=r.isEditing?p:o.jsx(Uo,{editButtonProps:u,unlinkButtonProps:d});return o.jsxs(o.Fragment,{children:[t.isOpen&&!r.isOpen&&mt.createPortal(o.jsx("div",{"data-is-underlay":!0,ref:n,...e,style:{...e.style,...S[b.p]},children:p}),document.body),r.isOpen&&mt.createPortal(o.jsx("div",{"data-is-underlay":!0,ref:c,...l,style:{...l.style,...S[b.p]},children:y}),document.body)]})},en=g.forwardRef((t,e)=>{const n=a.useEditorRef(),s=a.useLinkToolbarButtonState(),{props:r}=a.useLinkToolbarButton(s);return o.jsx(a.ToolbarButton,{onMouseDown:l=>{l.preventDefault(),a.focusEditor(n,n.selection??n.prevSelection??void 0)},ref:e,...r,...t,children:o.jsx(a.IconStylingWrapper,{icon:o.jsx(x.IconLink,{size:16})})})});en.displayName="LinkToolbarButton";const Ko=({id:t,editorId:e})=>{const n=a.useEditorState(a.useEventPlateId(e)),s=!!a.isRangeInSameBlock(n,{at:n.selection});return o.jsx("div",{"data-plugin-id":t,children:o.jsx(en,{disabled:!s,tooltip:a.getTooltip(s?`Link
9
- ${a.getHotkeyByPlatform("Ctrl+K")}`:"Links can only be set for a single text block.")})})},jo=t=>{const{attributes:e,children:n}=t,{styles:s}=a.useRichTextEditorContext(),r=t.element.url||t.element.chosenLink?.searchResult?.link||"",l=t.element.target||"_self";return o.jsx("a",{...e,href:r,target:l,style:s[it],children:n})};class Yo extends a.MarkupElement{constructor(e=a.ELEMENT_LINK,n=jo){super(e,n)}}const nn=t=>a.createPluginFactory({...a.createLinkPlugin(),renderAfterEditable:Go,options:{isUrl:yt,rangeBeforeOptions:{matchString:" ",skipInvalid:!0,afterMatch:!0},triggerFloatingLinkHotkeys:"meta+k, ctrl+k",keepSelectedTextOnPaste:!0,appBridge:t}})();class on extends a.Plugin{styles={};appBridge;constructor({styles:e=S[it],...n}){super(it,{button:Ko,markupElement:new Yo,...n}),this.styles=e,this.appBridge=n.appBridge}plugins(){return[nn(this.appBridge)]}}const Qo="breakAfterColumn",an="normal";class Xo extends a.Plugin{columns;gap;customClass;constructor(e){super("break-after-plugin",{button:a.ColumnBreakButton,...e}),this.columns=e?.columns??1,this.gap=e?.gap??an,this.customClass=Je(this.columns)}plugins(){return[a.createColumnBreakPlugin(this.columns,this.gap,this.customClass)]}}const Jo="textstyle-custom1-plugin";class sn extends a.Plugin{styles={};constructor({styles:e=S.custom1,...n}={}){super(b.custom1,{label:"Custom 1",markupElement:new Zo,...n}),this.styles=e}plugins(){return[Ro(this.styles)]}}class Zo extends a.MarkupElement{constructor(e=Jo,n=rn){super(e,n)}}const rn=({element:t,attributes:e,children:n,styles:s})=>{const r=t.align;return o.jsx("p",{...e,style:s,className:a.merge([r&&a.alignmentClassnames[r],a.getColumnBreakClasses(t)]),children:n})},Ro=t=>a.createPluginFactory({key:b.custom1,isElement:!0,deserializeHtml:{rules:[{validClassName:b.custom1}]}})({component:e=>o.jsx(rn,{...e,styles:t})}),ta="textstyle-custom2-plugin";class ln extends a.Plugin{styles={};constructor({styles:e=S.custom2,...n}={}){super(b.custom2,{label:"Custom 2",markupElement:new ea,...n}),this.styles=e}plugins(){return[na(this.styles)]}}class ea extends a.MarkupElement{constructor(e=ta,n=dn){super(e,n)}}const dn=({element:t,attributes:e,children:n,styles:s})=>{const r=t.align;return o.jsx("p",{...e,className:a.merge([r&&a.alignmentClassnames[r],a.getColumnBreakClasses(t)]),style:s,children:n})},na=t=>a.createPluginFactory({key:b.custom2,isElement:!0,deserializeHtml:{rules:[{validClassName:b.custom2}]}})({component:e=>o.jsx(dn,{...e,styles:t})}),oa="textstyle-custom3-plugin";class cn extends a.Plugin{styles={};constructor({styles:e=S.custom3,...n}={}){super(a.TextStyles.custom3,{label:"Custom 3",markupElement:new aa,...n}),this.styles=e}plugins(){return[sa(this.styles)]}}class aa extends a.MarkupElement{constructor(e=oa,n=un){super(e,n)}}const un=({element:t,attributes:e,children:n,styles:s})=>{const r=t.align;return o.jsx("p",{...e,className:a.merge([r&&a.alignmentClassnames[r],a.getColumnBreakClasses(t)]),style:s,children:n})},sa=t=>a.createPluginFactory({key:a.TextStyles.custom3,isElement:!0,deserializeHtml:{rules:[{validClassName:a.TextStyles.custom3}]}})({component:e=>o.jsx(un,{...e,styles:t})}),ra="textstyle-heading1-plugin";class gn extends a.Plugin{styles={};constructor({styles:e=S.heading1,...n}={}){super(b.heading1,{label:"Heading 1",markupElement:new ia,...n}),this.styles=e}plugins(){return[la(this.styles)]}}class ia extends a.MarkupElement{constructor(e=ra,n=$t){super(e,n)}}const $t=({element:t,attributes:e,children:n,styles:s})=>{const r=t.align;return o.jsx("h1",{...e,className:a.merge([r&&a.alignmentClassnames[r],a.getColumnBreakClasses(t)]),style:s,children:n})},la=t=>a.createPluginFactory({key:b.heading1,isElement:!0,component:$t,deserializeHtml:{rules:[{validNodeName:["h1","H1"]}]}})({component:e=>o.jsx($t,{...e,styles:t})}),da="textstyle-heading2-plugin";class hn extends a.Plugin{styles={};constructor({styles:e=S.heading2,...n}={}){super(b.heading2,{label:"Heading 2",markupElement:new ca,...n}),this.styles=e}plugins(){return[ua(this.styles)]}}class ca extends a.MarkupElement{constructor(e=da,n=Wt){super(e,n)}}const Wt=({element:t,attributes:e,children:n,styles:s})=>{const r=t.align;return o.jsx("h2",{...e,className:a.merge([r&&a.alignmentClassnames[r],a.getColumnBreakClasses(t)]),style:s,children:n})},ua=t=>a.createPluginFactory({key:b.heading2,isElement:!0,component:Wt,deserializeHtml:{rules:[{validNodeName:["h2","H2"]}]}})({component:e=>o.jsx(Wt,{...e,styles:t})}),ga="textstyle-heading3-plugin";class mn extends a.Plugin{styles={};constructor({styles:e=S.heading3,...n}={}){super(b.heading3,{label:"Heading 3",markupElement:new ha,...n}),this.styles=e}plugins(){return[ma(this.styles)]}}class ha extends a.MarkupElement{constructor(e=ga,n=qt){super(e,n)}}const qt=({element:t,attributes:e,children:n,styles:s})=>{const r=t.align;return o.jsx("h3",{...e,className:a.merge([r&&a.alignmentClassnames[r],a.getColumnBreakClasses(t)]),style:s,children:n})},ma=t=>a.createPluginFactory({key:b.heading3,isElement:!0,component:qt,deserializeHtml:{rules:[{validNodeName:["h3","H3"]}]}})({component:e=>o.jsx(qt,{...e,styles:t})}),fa="textstyle-heading4-plugin";class fn extends a.Plugin{styles={};constructor({styles:e=S.heading4,...n}={}){super(b.heading4,{label:"Heading 4",markupElement:new pa,...n}),this.styles=e}plugins(){return[wa(this.styles)]}}class pa extends a.MarkupElement{constructor(e=fa,n=Gt){super(e,n)}}const Gt=({element:t,attributes:e,children:n,styles:s})=>{const r=t.align;return o.jsx("h4",{...e,className:a.merge([r&&a.alignmentClassnames[r],a.getColumnBreakClasses(t)]),style:s,children:n})},wa=t=>a.createPluginFactory({key:b.heading4,isElement:!0,component:Gt,deserializeHtml:{rules:[{validNodeName:["h4","H4"]}]}})({component:e=>o.jsx(Gt,{...e,styles:t})}),ya="textstyle-imageCaption-plugin";class pn extends a.Plugin{styles={};constructor({styles:e=S.imageCaption,...n}={}){super(b.imageCaption,{label:"Image Caption",markupElement:new ba,...n}),this.styles=e}plugins(){return[va(this.styles)]}}class ba extends a.MarkupElement{constructor(e=ya,n=Kt){super(e,n)}}const Kt=({element:t,attributes:e,children:n,styles:s})=>{const r=t.align;return o.jsx("p",{...e,className:a.merge([r&&a.alignmentClassnames[r],a.getColumnBreakClasses(t)]),style:s,children:n})},va=t=>a.createPluginFactory({key:b.imageCaption,isElement:!0,component:Kt,deserializeHtml:{rules:[{validClassName:b.imageCaption}]}})({component:e=>o.jsx(Kt,{...e,styles:t})}),Ca="textstyle-imageTitle-plugin";class wn extends a.Plugin{styles={};constructor({styles:e=S.imageTitle,...n}={}){super(b.imageTitle,{label:"Image Title",markupElement:new ka,...n}),this.styles=e}plugins(){return[Ta(this.styles)]}}class ka extends a.MarkupElement{constructor(e=Ca,n=jt){super(e,n)}}const jt=({element:t,attributes:e,children:n,styles:s})=>{const r=t.align;return o.jsx("p",{...e,className:a.merge([r&&a.alignmentClassnames[r],a.getColumnBreakClasses(t)]),style:s,children:n})},Ta=t=>a.createPluginFactory({key:b.imageTitle,isElement:!0,component:jt,deserializeHtml:{rules:[{validClassName:b.imageTitle}]}})({component:e=>o.jsx(jt,{...e,styles:t})});class yn extends a.Plugin{styles={};constructor({styles:e=S.p,...n}={}){super(b.p,{markupElement:new vn,label:"Body Text",...n}),this.styles=e}plugins(){return[Cn(this.styles)]}}const bn="tw-m-0 tw-px-0 tw-py-0",Ct=({element:t,attributes:e,children:n,styles:s})=>{const r=t.align,l=a.merge([r&&a.alignmentClassnames[r],bn,a.getColumnBreakClasses(t)]);return o.jsx("p",{...e,className:l,style:s,children:n})};class vn extends a.MarkupElement{constructor(e=b.p,n=Ct){super(e,n)}}const Cn=t=>a.createPluginFactory({...a.createParagraphPlugin(),key:b.p,isElement:!0,component:Ct})({component:e=>o.jsx(Ct,{...e,styles:t})}),Pa="textstyle-quote-plugin";class kn extends a.Plugin{styles={};constructor({styles:e=S.quote,...n}={}){super(b.quote,{label:"Quote",markupElement:new xa,...n}),this.styles=e}plugins(){return[Tn(this.styles)]}}class xa extends a.MarkupElement{constructor(e=Pa,n=kt){super(e,n)}}const kt=({element:t,attributes:e,children:n,styles:s})=>{const r=t.align;return o.jsx("blockquote",{...e,className:a.merge([r&&a.alignmentClassnames[r],a.getColumnBreakClasses(t)]),style:s,children:n})},Tn=t=>a.createPluginFactory({key:b.quote,isElement:!0,component:kt,deserializeHtml:{rules:[{validNodeName:["blockquote","BLOCKQUOTE"]}]}})({component:e=>o.jsx(kt,{...e,styles:t})}),Yt=[new gn,new hn,new mn,new fn,new sn,new ln,new cn,new kn,new yn],lt=[b.heading1,b.heading2,b.heading3,b.heading4,b.custom1,b.custom2,b.custom3,b.quote,b.p],Ia=[...Yt,new pn,new wn],Sa=[...lt,b.imageCaption,b.imageTitle],Ea=[{color:"var(--f-theme-settings-list-bullet1-color, currentColor)",shape:"var(--f-theme-settings-list-bullet1-shape, '•')",size:"var(--f-theme-settings-list-bullet1-size, 1em)"},{color:"var(--f-theme-settings-list-bullet2-color, currentColor)",shape:"var(--f-theme-settings-list-bullet2-shape, '•')",size:"var(--f-theme-settings-list-bullet2-size, 1em)"},{color:"var(--f-theme-settings-list-bullet3-color, currentColor)",shape:"var(--f-theme-settings-list-bullet3-shape, '•')",size:"var(--f-theme-settings-list-bullet3-size, 1em)"}];class Pn extends a.UnorderedListPlugin{constructor(e){super({listStyles:Ea,...e})}}const Ba=[{counterType:"var(--f-theme-settings-list-numbered1-counterType, decimal)",color:"var(--f-theme-settings-list-numbered1-color, currentColor)"},{counterType:"var(--f-theme-settings-list-numbered2-counterType, lower-alpha)",color:"var(--f-theme-settings-list-numbered2-color, currentColor)"},{counterType:"var(--f-theme-settings-list-numbered3-counterType, lower-roman)",color:"var(--f-theme-settings-list-numbered3-color, currentColor)"}];class xn extends a.OrderedListPlugin{constructor(e){super({listStyles:Ba,...e})}}const Na=t=>new a.PluginComposer().setPlugin(new a.SoftBreakPlugin,new a.TextStylePlugin({textStyles:Yt})).setPlugin([new a.BoldPlugin,new a.ItalicPlugin,new a.UnderlinePlugin,new a.StrikethroughPlugin,new on({appBridge:t}),new je({appBridge:t}),new a.CodePlugin],[new a.AlignLeftPlugin({validTypes:lt}),new a.AlignCenterPlugin({validTypes:lt}),new a.AlignRightPlugin({validTypes:lt}),new a.AlignJustifyPlugin({validTypes:lt}),new Pn,new a.CheckboxListPlugin,new xn,new a.ResetFormattingPlugin,new a.AutoformatPlugin]),Aa="--f-theme-settings-",La=t=>{const e=t?.id?`hasBackground${t.id}`:"hasBackground",n=t?.id?`backgroundColor${t.id}`:"backgroundColor",s=t?.preventDefaultColor?void 0:t?.defaultColor||Hn,r=t?.label?t.label:"Background",l=t?.switchLabel?t.switchLabel:void 0;return{id:e,label:r,type:"switch",switchLabel:l,defaultValue:!!t?.defaultValue,on:[{id:n,defaultValue:s,type:"colorInput"}]}},Da=t=>{const e=t?.id?`hasBorder_${t.id}`:"hasBorder",n=t?.id?`borderSelection_${t.id}`:"borderSelection",s=t?.id?`borderStyle_${t.id}`:"borderStyle",r=t?.id?`borderWidth_${t.id}`:"borderWidth",l=t?.id?`borderColor_${t.id}`:"borderColor",c=t?.defaultColor||se,u=t?.switchLabel?t.switchLabel:void 0;return{id:e,label:"Border",type:"switch",switchLabel:u,defaultValue:!!t?.defaultValue,on:[{id:n,type:"multiInput",layout:h.MultiInputLayout.Columns,lastItemFullWidth:!0,blocks:[{id:s,type:"dropdown",defaultValue:H.Solid,choices:[{value:H.Solid,label:H.Solid},{value:H.Dotted,label:H.Dotted},{value:H.Dashed,label:H.Dashed}]},{id:r,type:"input",defaultValue:zn,rules:[h.numericalOrPixelRule,h.minimumNumericalOrPixelRule(0),h.maximumNumericalOrPixelOrAutoRule(500)],placeholder:"e.g. 3px",onChange:d=>h.appendUnit(d,r)},{id:l,type:"colorInput",defaultValue:c}]}],off:[]}},Qt=(t,e=W.None)=>({id:t,type:"segmentedControls",defaultValue:e,choices:[{value:W.None,label:"None"},{value:W.Small,label:"S"},{value:W.Medium,label:"M"},{value:W.Large,label:"L"}]}),Ma=t=>{const e=t?.id?`hasRadius_${t.id}`:"hasRadius",n=t?.id?`radiusValue_${t.id}`:"radiusValue",s=t?.id?`radiusChoice_${t.id}`:"radiusChoice",r=t?.defaultRadius||W.None;return{id:e,label:"Corner radius",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"Determining how rounded the corners are.",show:l=>t?.dependentSettingId?!!l.getBlock(t.dependentSettingId)?.value:!0,onChange:l=>h.presetCustomValue(l,s,n,t?.radiusStyleMap||Y),on:[{id:n,type:"input",placeholder:"e.g. 10px",rules:[h.numericalOrPixelRule],onChange:l=>h.appendUnit(l,n)}],off:[Qt(s,r)]}},Fa=t=>{const e=t?.id?`hasExtendedCustomRadius_${t.id}`:"hasExtendedCustomRadius",n=t?.id?`extendedRadiusValue_${t.id}`:"extendedRadiusValue",s=t?.id?`extendedRadiusChoice_${t.id}`:"extendedRadiusChoice",r=t?.id?`extendedRadiusTopLeft_${t.id}`:"extendedRadiusTopLeft",l=t?.id?`extendedRadiusTopRight_${t.id}`:"extendedRadiusTopRight",c=t?.id?`extendedRadiusBottomLeft_${t.id}`:"extendedRadiusBottomLeft",u=t?.id?`extendedRadiusBottomRight_${t.id}`:"extendedRadiusBottomRight";return{id:e,label:"Corner radius",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"Determining how rounded the corners are.",show:d=>t?.dependentSettingId?!!d.getBlock(t.dependentSettingId)?.value:!0,onChange:d=>{h.presetCustomValue(d,s,r,Y),h.presetCustomValue(d,s,l,Y),h.presetCustomValue(d,s,c,Y),h.presetCustomValue(d,s,u,Y)},on:[{id:n,type:"multiInput",layout:h.MultiInputLayout.Columns,blocks:[{id:r,type:"input",label:"Top Left",rules:[h.numericalOrPixelRule],onChange:d=>h.appendUnit(d,r)},{id:l,type:"input",label:"Top Right",rules:[h.numericalOrPixelRule],onChange:d=>h.appendUnit(d,l)},{id:c,type:"input",label:"Bottom Left",rules:[h.numericalOrPixelRule],onChange:d=>h.appendUnit(d,c)},{id:u,type:"input",label:"Bottom Right",rules:[h.numericalOrPixelRule],onChange:d=>h.appendUnit(d,u)}]}],off:[Qt(s,t?.defaultValue)]}},Oa=t=>{const e=t?.id?t.id:"hasCustomSpacing",n=t?.dependentSettingId?t.dependentSettingId:"columns",s=t?.spacingChoiceId?t.spacingChoiceId:"spacingChoice",r=t?.spacingCustomId?t.spacingCustomId:"spacingCustom",l=t?.defaultValueChoices?t.defaultValueChoices:Z.M;return{id:e,type:"switch",defaultValue:!1,switchLabel:"Custom",label:"Gutter",info:"An official nerds term for ‘gap’",onChange:c=>h.presetCustomValue(c,s,r,ie),show:c=>c.getBlock(n)?.value!=="1",on:[{id:r,type:"input",rules:[h.numericalOrPixelRule],onChange:c=>h.appendUnit(c,r)}],off:[{id:s,type:"slider",defaultValue:l,choices:[{value:Z.Auto,label:"Auto"},{value:Z.S,label:"S"},{value:Z.M,label:"M"},{value:Z.L,label:"L"}]}]}},Xt=t=>({id:t,type:"segmentedControls",defaultValue:X.None,choices:[{value:X.None,label:"None"},{value:X.Small,label:"S"},{value:X.Medium,label:"M"},{value:X.Large,label:"L"}]}),_a=t=>{const e=t?.id?`hasCustomMarginValue_${t?.id}`:"hasCustomMarginValue",n=t?.id?`marginValue_${t?.id}`:"marginValue",s=t?.id?`marginChoice_${t?.id}`:"marginChoice";return{id:e,label:"Margin",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more space",onChange:r=>h.presetCustomValue(r,s,n,t?.marginStyleMap||nt),on:[{id:n,type:"input",placeholder:ct,rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)],onChange:r=>h.appendUnit(r,n)}],off:[Xt(s)]}},Ua=t=>{const e=t?.id?`hasExtendedCustomMargin_${t?.id}`:"hasExtendedCustomMargin",n=t?.id?`extendedMarginValues_${t?.id}`:"extendedMarginValues",s=t?.id?`extendedMarginChoice_${t?.id}`:"extendedMarginChoice",r=t?.id?`extendedMarginTop_${t?.id}`:"extendedMarginTop",l=t?.id?`extendedMarginLeft_${t?.id}`:"extendedMarginLeft",c=t?.id?`extendedMarginRight_${t?.id}`:"extendedMarginRight",u=t?.id?`extendedMarginBottom_${t?.id}`:"extendedMarginBottom";return{id:e,label:"Margin",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more negative space",onChange:d=>{h.presetCustomValue(d,s,r,nt),h.presetCustomValue(d,s,l,nt),h.presetCustomValue(d,s,c,nt),h.presetCustomValue(d,s,u,nt)},on:[{id:n,type:"multiInput",layout:h.MultiInputLayout.Spider,blocks:[{id:r,type:"input",label:"Top",placeholder:ct,onChange:d=>h.appendUnit(d,r),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:l,type:"input",label:"Left",placeholder:ct,onChange:d=>h.appendUnit(d,l),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:c,type:"input",label:"Right",placeholder:ct,onChange:d=>h.appendUnit(d,c),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:u,type:"input",label:"Bottom",placeholder:ct,onChange:d=>h.appendUnit(d,u),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]}]}],off:[Xt(s)]}},Jt=t=>({id:t,type:"segmentedControls",defaultValue:Q.Small,choices:[{value:Q.None,label:"None"},{value:Q.Small,label:"S"},{value:Q.Medium,label:"M"},{value:Q.Large,label:"L"}]}),Ha=t=>{const e=t?.id?`hasCustomPaddingValue_${t?.id}`:"hasCustomPaddingValue",n=t?.id?`paddingValue_${t?.id}`:"paddingValue",s=t?.id?`paddingChoice_${t?.id}`:"paddingChoice";return{id:e,label:"Padding",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more negative space",onChange:r=>h.presetCustomValue(r,s,n,t?.paddingStyleMap||et),on:[{id:n,type:"input",placeholder:dt,rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)],onChange:r=>h.appendUnit(r,n)}],off:[Jt(s)]}},za=t=>{const e=t?.id?`hasExtendedCustomPadding_${t?.id}`:"hasExtendedCustomPadding",n=t?.id?`extendedPaddingValues_${t?.id}`:"extendedPaddingValues",s=t?.id?`extendedPaddingChoice_${t?.id}`:"extendedPaddingChoice",r=t?.id?`extendedPaddingTop_${t?.id}`:"extendedPaddingTop",l=t?.id?`extendedPaddingLeft_${t?.id}`:"extendedPaddingLeft",c=t?.id?`extendedPaddingRight_${t?.id}`:"extendedPaddingRight",u=t?.id?`extendedPaddingBottom_${t?.id}`:"extendedPaddingBottom";return{id:e,label:"Padding",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more negative space",onChange:d=>{h.presetCustomValue(d,s,r,et),h.presetCustomValue(d,s,l,et),h.presetCustomValue(d,s,c,et),h.presetCustomValue(d,s,u,et)},on:[{id:n,type:"multiInput",layout:h.MultiInputLayout.Spider,blocks:[{id:r,type:"input",label:"Top",placeholder:dt,onChange:d=>h.appendUnit(d,r),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:l,type:"input",label:"Left",placeholder:dt,onChange:d=>h.appendUnit(d,l),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:c,type:"input",label:"Right",placeholder:dt,onChange:d=>h.appendUnit(d,c),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:u,type:"input",label:"Bottom",placeholder:dt,onChange:d=>h.appendUnit(d,u),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]}]}],off:[Jt(s)]}},Va=t=>{const e=Zt(t?.globalControlId);return{id:t?.id?t.id:"downloadable",type:"switch",defaultValue:!1,label:"Downloadable",show:n=>n.getBlock(e)?.value===J.Custom}},Zt=t=>t||"security",$a=t=>[{id:Zt(t),type:"segmentedControls",defaultValue:J.Global,choices:[{value:J.Global,label:"Global Settings"},{value:J.Custom,label:"Custom"}]},{id:"globalSettingsInfo",type:"notification",footer:h.createFooter({label:"Change global settings [here].",replace:{here:{event:"general-settings.open"}}})}];var In=(t=>(t.Main="main",t.Basics="basics",t.Layout="layout",t.Style="style",t.Security="security",t.Targets="targets",t))(In||{});const Wa=t=>t,qa=t=>t;i.AllTextStylePlugins=Ia,i.AllTextStyles=Sa,i.AttachmentOperationsProvider=Wn,i.Attachments=we,i.AttachmentsProvider=ge,i.AttachmentsToolbarButton=ve,i.BUTTON_PLUGIN=Ge,i.BlockButtonStyles=vt,i.BlockInjectButton=Bn,i.BlockItemWrapper=Ee,i.BlockStyles=S,i.BorderStyle=H,i.BreakAfterPlugin=Xo,i.ButtonPlugin=je,i.Custom1Plugin=sn,i.Custom2Plugin=ln,i.Custom3Plugin=cn,i.DEFAULT_ATTACHMENTS_BUTTON_ID=be,i.DEFAULT_DRAGGING_TOOLTIP=ke,i.DEFAULT_DRAG_TOOLTIP=Ce,i.DEFAULT_MENU_BUTTON_ID=At,i.DownloadButton=Zn,i.DragHandleToolbarButton=Te,i.DragPreviewContextProvider=le,i.ELEMENT_BUTTON=I,i.FlyoutToolbarButton=Pe,i.GAP_DEFAULT=an,i.GutterSpacing=Z,i.Heading1Plugin=gn,i.Heading2Plugin=hn,i.Heading3Plugin=mn,i.Heading4Plugin=fn,i.ImageCaptionPlugin=pn,i.ImageTitlePlugin=wn,i.KEY_ELEMENT_BREAK_AFTER_COLUMN=Qo,i.LinkInput=$e,i.LinkPlugin=on,i.LinkSelector=Ve,i.Margin=X,i.MenuToolbarButton=xe,i.MultiFlyoutContextProvider=de,i.OrderedListPlugin=xn,i.PARAGRAPH_CLASSES=bn,i.Padding=Q,i.ParagraphMarkupElement=vn,i.ParagraphMarkupElementNode=Ct,i.ParagraphPlugin=yn,i.QuoteMarkupElementNode=kt,i.QuotePlugin=kn,i.Radius=W,i.RichTextEditor=_o,i.Sections=In,i.Security=J,i.THEME_PREFIX=Aa,i.TextStylePluginsWithoutImage=Yt,i.TextStyles=b,i.TextStylesWithoutImage=lt,i.Toolbar=Se,i.UnorderedListPlugin=Pn,i.addHttps=wt,i.borderStyleMap=re,i.convertToRteValue=eo,i.createButtonNode=Oe,i.createButtonPlugin=Ke,i.createLinkPlugin=nn,i.createParagraphPlugin=Cn,i.createQuotePlugin=Tn,i.customCoordinatesGetterFactory=me,i.defineBlock=Wa,i.defineSettings=qa,i.getBackgroundColorStyles=Un,i.getBackgroundSettings=La,i.getBorderRadiusSettings=Ma,i.getBorderRadiusSlider=Qt,i.getBorderSettings=Da,i.getBorderStyles=Vn,i.getDefaultPluginsWithLinkChooser=Na,i.getExtendedBorderRadiusSettings=Fa,i.getGutterSettings=Oa,i.getLegacyUrl=ro,i.getLinkFromEditor=lo,i.getMarginExtendedSettings=Ua,i.getMarginSettings=_a,i.getMarginSlider=Xt,i.getPaddingExtendedSettings=za,i.getPaddingSettings=Ha,i.getPaddingSlider=Jt,i.getRadiusStyles=$n,i.getReadableColor=On,i.getSecurityDownloadableSetting=Va,i.getSecurityGlobalControlId=Zt,i.getSecurityGlobalControlSetting=$a,i.getUrl=io,i.getUrlFromEditor=Fe,i.getUrlFromLinkOrLegacyLink=Mt,i.gutterSpacingStyleMap=ie,i.hasRichTextValue=Be,i.insertButton=Le,i.isDark=An,i.isDownloadable=no,i.isValidUrl=yt,i.isValidUrlOrEmpty=st,i.joinClassNames=U,i.mapAppBridgeColorPaletteToFonduePalette=Ne,i.mapAppBridgeColorPalettesToFonduePalettes=oo,i.marginStyleMap=nt,i.moveItemInArray=_n,i.paddingStyleMap=et,i.radiusStyleMap=Y,i.relativeUrlRegex=Ft,i.setAlpha=Mn,i.submitFloatingButton=Ot,i.toColorObject=Fn,i.toHex8String=Ln,i.toHexString=Dn,i.toRgbaString=It,i.toShortRgba=j,i.triggerFloatingButton=_e,i.triggerFloatingButtonEdit=bt,i.triggerFloatingButtonInsert=Ut,i.unwrapButton=rt,i.upsertButton=De,i.upsertButtonText=_t,i.useAttachmentOperations=Bt,i.useAttachments=ue,i.useAttachmentsContext=he,i.useDndSensors=jn,i.useDragPreviewContext=ot,i.useMultiFlyoutContext=ce,i.useMultiFlyoutState=ft,i.withAttachmentsProvider=qn,i.withButton=Ae,i.wrapButton=Me,Object.keys(h).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(i,t)&&Object.defineProperty(i,t,{enumerable:!0,get:()=>h[t]})}),Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})}));
9
+ ${a.getHotkeyByPlatform("Ctrl+K")}`:"Links can only be set for a single text block.")})})},jo=t=>{const{attributes:e,children:n}=t,{styles:s}=a.useRichTextEditorContext(),r=t.element.url||t.element.chosenLink?.searchResult?.link||"",l=t.element.target||"_self";return o.jsx("a",{...e,href:r,target:l,style:s[it],children:n})};class Yo extends a.MarkupElement{constructor(e=a.ELEMENT_LINK,n=jo){super(e,n)}}const nn=t=>a.createPluginFactory({...a.createLinkPlugin(),renderAfterEditable:Go,options:{isUrl:yt,rangeBeforeOptions:{matchString:" ",skipInvalid:!0,afterMatch:!0},triggerFloatingLinkHotkeys:"meta+k, ctrl+k",keepSelectedTextOnPaste:!0,appBridge:t}})();class on extends a.Plugin{styles={};appBridge;constructor({styles:e=S[it],...n}){super(it,{button:Ko,markupElement:new Yo,...n}),this.styles=e,this.appBridge=n.appBridge}plugins(){return[nn(this.appBridge)]}}const Qo="breakAfterColumn",an="normal";class Xo extends a.Plugin{columns;gap;customClass;constructor(e){super("break-after-plugin",{button:a.ColumnBreakButton,...e}),this.columns=e?.columns??1,this.gap=e?.gap??an,this.customClass=Je(this.columns)}plugins(){return[a.createColumnBreakPlugin(this.columns,this.gap,this.customClass)]}}const Jo="textstyle-custom1-plugin";class sn extends a.Plugin{styles={};constructor({styles:e=S.custom1,...n}={}){super(b.custom1,{label:"Custom 1",markupElement:new Zo,...n}),this.styles=e}plugins(){return[Ro(this.styles)]}}class Zo extends a.MarkupElement{constructor(e=Jo,n=rn){super(e,n)}}const rn=({element:t,attributes:e,children:n,styles:s})=>{const r=t.align;return o.jsx("p",{...e,style:s,className:a.merge([r&&a.alignmentClassnames[r],a.getColumnBreakClasses(t)]),children:n})},Ro=t=>a.createPluginFactory({key:b.custom1,isElement:!0,deserializeHtml:{rules:[{validClassName:b.custom1}]}})({component:e=>o.jsx(rn,{...e,styles:t})}),ta="textstyle-custom2-plugin";class ln extends a.Plugin{styles={};constructor({styles:e=S.custom2,...n}={}){super(b.custom2,{label:"Custom 2",markupElement:new ea,...n}),this.styles=e}plugins(){return[na(this.styles)]}}class ea extends a.MarkupElement{constructor(e=ta,n=dn){super(e,n)}}const dn=({element:t,attributes:e,children:n,styles:s})=>{const r=t.align;return o.jsx("p",{...e,className:a.merge([r&&a.alignmentClassnames[r],a.getColumnBreakClasses(t)]),style:s,children:n})},na=t=>a.createPluginFactory({key:b.custom2,isElement:!0,deserializeHtml:{rules:[{validClassName:b.custom2}]}})({component:e=>o.jsx(dn,{...e,styles:t})}),oa="textstyle-custom3-plugin";class cn extends a.Plugin{styles={};constructor({styles:e=S.custom3,...n}={}){super(a.TextStyles.custom3,{label:"Custom 3",markupElement:new aa,...n}),this.styles=e}plugins(){return[sa(this.styles)]}}class aa extends a.MarkupElement{constructor(e=oa,n=un){super(e,n)}}const un=({element:t,attributes:e,children:n,styles:s})=>{const r=t.align;return o.jsx("p",{...e,className:a.merge([r&&a.alignmentClassnames[r],a.getColumnBreakClasses(t)]),style:s,children:n})},sa=t=>a.createPluginFactory({key:a.TextStyles.custom3,isElement:!0,deserializeHtml:{rules:[{validClassName:a.TextStyles.custom3}]}})({component:e=>o.jsx(un,{...e,styles:t})}),ra="textstyle-heading1-plugin";class gn extends a.Plugin{styles={};constructor({styles:e=S.heading1,...n}={}){super(b.heading1,{label:"Heading 1",markupElement:new ia,...n}),this.styles=e}plugins(){return[la(this.styles)]}}class ia extends a.MarkupElement{constructor(e=ra,n=$t){super(e,n)}}const $t=({element:t,attributes:e,children:n,styles:s})=>{const r=t.align;return o.jsx("h1",{...e,className:a.merge([r&&a.alignmentClassnames[r],a.getColumnBreakClasses(t)]),style:s,children:n})},la=t=>a.createPluginFactory({key:b.heading1,isElement:!0,component:$t,deserializeHtml:{rules:[{validNodeName:["h1","H1"]}]}})({component:e=>o.jsx($t,{...e,styles:t})}),da="textstyle-heading2-plugin";class hn extends a.Plugin{styles={};constructor({styles:e=S.heading2,...n}={}){super(b.heading2,{label:"Heading 2",markupElement:new ca,...n}),this.styles=e}plugins(){return[ua(this.styles)]}}class ca extends a.MarkupElement{constructor(e=da,n=Wt){super(e,n)}}const Wt=({element:t,attributes:e,children:n,styles:s})=>{const r=t.align;return o.jsx("h2",{...e,className:a.merge([r&&a.alignmentClassnames[r],a.getColumnBreakClasses(t)]),style:s,children:n})},ua=t=>a.createPluginFactory({key:b.heading2,isElement:!0,component:Wt,deserializeHtml:{rules:[{validNodeName:["h2","H2"]}]}})({component:e=>o.jsx(Wt,{...e,styles:t})}),ga="textstyle-heading3-plugin";class mn extends a.Plugin{styles={};constructor({styles:e=S.heading3,...n}={}){super(b.heading3,{label:"Heading 3",markupElement:new ha,...n}),this.styles=e}plugins(){return[ma(this.styles)]}}class ha extends a.MarkupElement{constructor(e=ga,n=qt){super(e,n)}}const qt=({element:t,attributes:e,children:n,styles:s})=>{const r=t.align;return o.jsx("h3",{...e,className:a.merge([r&&a.alignmentClassnames[r],a.getColumnBreakClasses(t)]),style:s,children:n})},ma=t=>a.createPluginFactory({key:b.heading3,isElement:!0,component:qt,deserializeHtml:{rules:[{validNodeName:["h3","H3"]}]}})({component:e=>o.jsx(qt,{...e,styles:t})}),fa="textstyle-heading4-plugin";class fn extends a.Plugin{styles={};constructor({styles:e=S.heading4,...n}={}){super(b.heading4,{label:"Heading 4",markupElement:new pa,...n}),this.styles=e}plugins(){return[wa(this.styles)]}}class pa extends a.MarkupElement{constructor(e=fa,n=Gt){super(e,n)}}const Gt=({element:t,attributes:e,children:n,styles:s})=>{const r=t.align;return o.jsx("h4",{...e,className:a.merge([r&&a.alignmentClassnames[r],a.getColumnBreakClasses(t)]),style:s,children:n})},wa=t=>a.createPluginFactory({key:b.heading4,isElement:!0,component:Gt,deserializeHtml:{rules:[{validNodeName:["h4","H4"]}]}})({component:e=>o.jsx(Gt,{...e,styles:t})}),ya="textstyle-imageCaption-plugin";class pn extends a.Plugin{styles={};constructor({styles:e=S.imageCaption,...n}={}){super(b.imageCaption,{label:"Image Caption",markupElement:new ba,...n}),this.styles=e}plugins(){return[va(this.styles)]}}class ba extends a.MarkupElement{constructor(e=ya,n=Kt){super(e,n)}}const Kt=({element:t,attributes:e,children:n,styles:s})=>{const r=t.align;return o.jsx("p",{...e,className:a.merge([r&&a.alignmentClassnames[r],a.getColumnBreakClasses(t)]),style:s,children:n})},va=t=>a.createPluginFactory({key:b.imageCaption,isElement:!0,component:Kt,deserializeHtml:{rules:[{validClassName:b.imageCaption}]}})({component:e=>o.jsx(Kt,{...e,styles:t})}),Ca="textstyle-imageTitle-plugin";class wn extends a.Plugin{styles={};constructor({styles:e=S.imageTitle,...n}={}){super(b.imageTitle,{label:"Image Title",markupElement:new ka,...n}),this.styles=e}plugins(){return[Ta(this.styles)]}}class ka extends a.MarkupElement{constructor(e=Ca,n=jt){super(e,n)}}const jt=({element:t,attributes:e,children:n,styles:s})=>{const r=t.align;return o.jsx("p",{...e,className:a.merge([r&&a.alignmentClassnames[r],a.getColumnBreakClasses(t)]),style:s,children:n})},Ta=t=>a.createPluginFactory({key:b.imageTitle,isElement:!0,component:jt,deserializeHtml:{rules:[{validClassName:b.imageTitle}]}})({component:e=>o.jsx(jt,{...e,styles:t})});class yn extends a.Plugin{styles={};constructor({styles:e=S.p,...n}={}){super(b.p,{markupElement:new vn,label:"Body Text",...n}),this.styles=e}plugins(){return[Cn(this.styles)]}}const bn="tw-m-0 tw-px-0 tw-py-0",Ct=({element:t,attributes:e,children:n,styles:s})=>{const r=t.align,l=a.merge([r&&a.alignmentClassnames[r],bn,a.getColumnBreakClasses(t)]);return o.jsx("p",{...e,className:l,style:s,children:n})};class vn extends a.MarkupElement{constructor(e=b.p,n=Ct){super(e,n)}}const Cn=t=>a.createPluginFactory({...a.createParagraphPlugin(),key:b.p,isElement:!0,component:Ct})({component:e=>o.jsx(Ct,{...e,styles:t})}),Pa="textstyle-quote-plugin";class kn extends a.Plugin{styles={};constructor({styles:e=S.quote,...n}={}){super(b.quote,{label:"Quote",markupElement:new xa,...n}),this.styles=e}plugins(){return[Tn(this.styles)]}}class xa extends a.MarkupElement{constructor(e=Pa,n=kt){super(e,n)}}const kt=({element:t,attributes:e,children:n,styles:s})=>{const r=t.align;return o.jsx("blockquote",{...e,className:a.merge([r&&a.alignmentClassnames[r],a.getColumnBreakClasses(t)]),style:s,children:n})},Tn=t=>a.createPluginFactory({key:b.quote,isElement:!0,component:kt,deserializeHtml:{rules:[{validNodeName:["blockquote","BLOCKQUOTE"]}]}})({component:e=>o.jsx(kt,{...e,styles:t})}),Yt=[new gn,new hn,new mn,new fn,new sn,new ln,new cn,new kn,new yn],lt=[b.heading1,b.heading2,b.heading3,b.heading4,b.custom1,b.custom2,b.custom3,b.quote,b.p],Ia=[...Yt,new pn,new wn],Sa=[...lt,b.imageCaption,b.imageTitle],Ea=[{color:"var(--f-theme-settings-list-bullet1-color, currentColor)",shape:"var(--f-theme-settings-list-bullet1-shape, '•')",size:"var(--f-theme-settings-list-bullet1-size, 1em)"},{color:"var(--f-theme-settings-list-bullet2-color, currentColor)",shape:"var(--f-theme-settings-list-bullet2-shape, '•')",size:"var(--f-theme-settings-list-bullet2-size, 1em)"},{color:"var(--f-theme-settings-list-bullet3-color, currentColor)",shape:"var(--f-theme-settings-list-bullet3-shape, '•')",size:"var(--f-theme-settings-list-bullet3-size, 1em)"}];class Pn extends a.UnorderedListPlugin{constructor(e){super({listStyles:Ea,...e})}}const Ba=[{counterType:"var(--f-theme-settings-list-numbered1-counter-type, decimal)",color:"var(--f-theme-settings-list-numbered1-color, currentColor)"},{counterType:"var(--f-theme-settings-list-numbered2-counter-type, lower-alpha)",color:"var(--f-theme-settings-list-numbered2-color, currentColor)"},{counterType:"var(--f-theme-settings-list-numbered3-counter-type, lower-roman)",color:"var(--f-theme-settings-list-numbered3-color, currentColor)"}];class xn extends a.OrderedListPlugin{constructor(e){super({listStyles:Ba,...e})}}const Na=t=>new a.PluginComposer().setPlugin(new a.SoftBreakPlugin,new a.TextStylePlugin({textStyles:Yt})).setPlugin([new a.BoldPlugin,new a.ItalicPlugin,new a.UnderlinePlugin,new a.StrikethroughPlugin,new on({appBridge:t}),new je({appBridge:t}),new a.CodePlugin],[new a.AlignLeftPlugin({validTypes:lt}),new a.AlignCenterPlugin({validTypes:lt}),new a.AlignRightPlugin({validTypes:lt}),new a.AlignJustifyPlugin({validTypes:lt}),new Pn,new a.CheckboxListPlugin,new xn,new a.ResetFormattingPlugin,new a.AutoformatPlugin]),Aa="--f-theme-settings-",La=t=>{const e=t?.id?`hasBackground${t.id}`:"hasBackground",n=t?.id?`backgroundColor${t.id}`:"backgroundColor",s=t?.preventDefaultColor?void 0:t?.defaultColor||Hn,r=t?.label?t.label:"Background",l=t?.switchLabel?t.switchLabel:void 0;return{id:e,label:r,type:"switch",switchLabel:l,defaultValue:!!t?.defaultValue,on:[{id:n,defaultValue:s,type:"colorInput"}]}},Da=t=>{const e=t?.id?`hasBorder_${t.id}`:"hasBorder",n=t?.id?`borderSelection_${t.id}`:"borderSelection",s=t?.id?`borderStyle_${t.id}`:"borderStyle",r=t?.id?`borderWidth_${t.id}`:"borderWidth",l=t?.id?`borderColor_${t.id}`:"borderColor",c=t?.defaultColor||se,u=t?.switchLabel?t.switchLabel:void 0;return{id:e,label:"Border",type:"switch",switchLabel:u,defaultValue:!!t?.defaultValue,on:[{id:n,type:"multiInput",layout:h.MultiInputLayout.Columns,lastItemFullWidth:!0,blocks:[{id:s,type:"dropdown",defaultValue:H.Solid,choices:[{value:H.Solid,label:H.Solid},{value:H.Dotted,label:H.Dotted},{value:H.Dashed,label:H.Dashed}]},{id:r,type:"input",defaultValue:zn,rules:[h.numericalOrPixelRule,h.minimumNumericalOrPixelRule(0),h.maximumNumericalOrPixelOrAutoRule(500)],placeholder:"e.g. 3px",onChange:d=>h.appendUnit(d,r)},{id:l,type:"colorInput",defaultValue:c}]}],off:[]}},Qt=(t,e=W.None)=>({id:t,type:"segmentedControls",defaultValue:e,choices:[{value:W.None,label:"None"},{value:W.Small,label:"S"},{value:W.Medium,label:"M"},{value:W.Large,label:"L"}]}),Ma=t=>{const e=t?.id?`hasRadius_${t.id}`:"hasRadius",n=t?.id?`radiusValue_${t.id}`:"radiusValue",s=t?.id?`radiusChoice_${t.id}`:"radiusChoice",r=t?.defaultRadius||W.None;return{id:e,label:"Corner radius",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"Determining how rounded the corners are.",show:l=>t?.dependentSettingId?!!l.getBlock(t.dependentSettingId)?.value:!0,onChange:l=>h.presetCustomValue(l,s,n,t?.radiusStyleMap||Y),on:[{id:n,type:"input",placeholder:"e.g. 10px",rules:[h.numericalOrPixelRule],onChange:l=>h.appendUnit(l,n)}],off:[Qt(s,r)]}},Fa=t=>{const e=t?.id?`hasExtendedCustomRadius_${t.id}`:"hasExtendedCustomRadius",n=t?.id?`extendedRadiusValue_${t.id}`:"extendedRadiusValue",s=t?.id?`extendedRadiusChoice_${t.id}`:"extendedRadiusChoice",r=t?.id?`extendedRadiusTopLeft_${t.id}`:"extendedRadiusTopLeft",l=t?.id?`extendedRadiusTopRight_${t.id}`:"extendedRadiusTopRight",c=t?.id?`extendedRadiusBottomLeft_${t.id}`:"extendedRadiusBottomLeft",u=t?.id?`extendedRadiusBottomRight_${t.id}`:"extendedRadiusBottomRight";return{id:e,label:"Corner radius",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"Determining how rounded the corners are.",show:d=>t?.dependentSettingId?!!d.getBlock(t.dependentSettingId)?.value:!0,onChange:d=>{h.presetCustomValue(d,s,r,Y),h.presetCustomValue(d,s,l,Y),h.presetCustomValue(d,s,c,Y),h.presetCustomValue(d,s,u,Y)},on:[{id:n,type:"multiInput",layout:h.MultiInputLayout.Columns,blocks:[{id:r,type:"input",label:"Top Left",rules:[h.numericalOrPixelRule],onChange:d=>h.appendUnit(d,r)},{id:l,type:"input",label:"Top Right",rules:[h.numericalOrPixelRule],onChange:d=>h.appendUnit(d,l)},{id:c,type:"input",label:"Bottom Left",rules:[h.numericalOrPixelRule],onChange:d=>h.appendUnit(d,c)},{id:u,type:"input",label:"Bottom Right",rules:[h.numericalOrPixelRule],onChange:d=>h.appendUnit(d,u)}]}],off:[Qt(s,t?.defaultValue)]}},Oa=t=>{const e=t?.id?t.id:"hasCustomSpacing",n=t?.dependentSettingId?t.dependentSettingId:"columns",s=t?.spacingChoiceId?t.spacingChoiceId:"spacingChoice",r=t?.spacingCustomId?t.spacingCustomId:"spacingCustom",l=t?.defaultValueChoices?t.defaultValueChoices:Z.M;return{id:e,type:"switch",defaultValue:!1,switchLabel:"Custom",label:"Gutter",info:"An official nerds term for ‘gap’",onChange:c=>h.presetCustomValue(c,s,r,ie),show:c=>c.getBlock(n)?.value!=="1",on:[{id:r,type:"input",rules:[h.numericalOrPixelRule],onChange:c=>h.appendUnit(c,r)}],off:[{id:s,type:"slider",defaultValue:l,choices:[{value:Z.Auto,label:"Auto"},{value:Z.S,label:"S"},{value:Z.M,label:"M"},{value:Z.L,label:"L"}]}]}},Xt=t=>({id:t,type:"segmentedControls",defaultValue:X.None,choices:[{value:X.None,label:"None"},{value:X.Small,label:"S"},{value:X.Medium,label:"M"},{value:X.Large,label:"L"}]}),_a=t=>{const e=t?.id?`hasCustomMarginValue_${t?.id}`:"hasCustomMarginValue",n=t?.id?`marginValue_${t?.id}`:"marginValue",s=t?.id?`marginChoice_${t?.id}`:"marginChoice";return{id:e,label:"Margin",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more space",onChange:r=>h.presetCustomValue(r,s,n,t?.marginStyleMap||nt),on:[{id:n,type:"input",placeholder:ct,rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)],onChange:r=>h.appendUnit(r,n)}],off:[Xt(s)]}},Ua=t=>{const e=t?.id?`hasExtendedCustomMargin_${t?.id}`:"hasExtendedCustomMargin",n=t?.id?`extendedMarginValues_${t?.id}`:"extendedMarginValues",s=t?.id?`extendedMarginChoice_${t?.id}`:"extendedMarginChoice",r=t?.id?`extendedMarginTop_${t?.id}`:"extendedMarginTop",l=t?.id?`extendedMarginLeft_${t?.id}`:"extendedMarginLeft",c=t?.id?`extendedMarginRight_${t?.id}`:"extendedMarginRight",u=t?.id?`extendedMarginBottom_${t?.id}`:"extendedMarginBottom";return{id:e,label:"Margin",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more negative space",onChange:d=>{h.presetCustomValue(d,s,r,nt),h.presetCustomValue(d,s,l,nt),h.presetCustomValue(d,s,c,nt),h.presetCustomValue(d,s,u,nt)},on:[{id:n,type:"multiInput",layout:h.MultiInputLayout.Spider,blocks:[{id:r,type:"input",label:"Top",placeholder:ct,onChange:d=>h.appendUnit(d,r),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:l,type:"input",label:"Left",placeholder:ct,onChange:d=>h.appendUnit(d,l),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:c,type:"input",label:"Right",placeholder:ct,onChange:d=>h.appendUnit(d,c),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:u,type:"input",label:"Bottom",placeholder:ct,onChange:d=>h.appendUnit(d,u),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]}]}],off:[Xt(s)]}},Jt=t=>({id:t,type:"segmentedControls",defaultValue:Q.Small,choices:[{value:Q.None,label:"None"},{value:Q.Small,label:"S"},{value:Q.Medium,label:"M"},{value:Q.Large,label:"L"}]}),Ha=t=>{const e=t?.id?`hasCustomPaddingValue_${t?.id}`:"hasCustomPaddingValue",n=t?.id?`paddingValue_${t?.id}`:"paddingValue",s=t?.id?`paddingChoice_${t?.id}`:"paddingChoice";return{id:e,label:"Padding",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more negative space",onChange:r=>h.presetCustomValue(r,s,n,t?.paddingStyleMap||et),on:[{id:n,type:"input",placeholder:dt,rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)],onChange:r=>h.appendUnit(r,n)}],off:[Jt(s)]}},za=t=>{const e=t?.id?`hasExtendedCustomPadding_${t?.id}`:"hasExtendedCustomPadding",n=t?.id?`extendedPaddingValues_${t?.id}`:"extendedPaddingValues",s=t?.id?`extendedPaddingChoice_${t?.id}`:"extendedPaddingChoice",r=t?.id?`extendedPaddingTop_${t?.id}`:"extendedPaddingTop",l=t?.id?`extendedPaddingLeft_${t?.id}`:"extendedPaddingLeft",c=t?.id?`extendedPaddingRight_${t?.id}`:"extendedPaddingRight",u=t?.id?`extendedPaddingBottom_${t?.id}`:"extendedPaddingBottom";return{id:e,label:"Padding",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more negative space",onChange:d=>{h.presetCustomValue(d,s,r,et),h.presetCustomValue(d,s,l,et),h.presetCustomValue(d,s,c,et),h.presetCustomValue(d,s,u,et)},on:[{id:n,type:"multiInput",layout:h.MultiInputLayout.Spider,blocks:[{id:r,type:"input",label:"Top",placeholder:dt,onChange:d=>h.appendUnit(d,r),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:l,type:"input",label:"Left",placeholder:dt,onChange:d=>h.appendUnit(d,l),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:c,type:"input",label:"Right",placeholder:dt,onChange:d=>h.appendUnit(d,c),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:u,type:"input",label:"Bottom",placeholder:dt,onChange:d=>h.appendUnit(d,u),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]}]}],off:[Jt(s)]}},Va=t=>{const e=Zt(t?.globalControlId);return{id:t?.id?t.id:"downloadable",type:"switch",defaultValue:!1,label:"Downloadable",show:n=>n.getBlock(e)?.value===J.Custom}},Zt=t=>t||"security",$a=t=>[{id:Zt(t),type:"segmentedControls",defaultValue:J.Global,choices:[{value:J.Global,label:"Global Settings"},{value:J.Custom,label:"Custom"}]},{id:"globalSettingsInfo",type:"notification",footer:h.createFooter({label:"Change global settings [here].",replace:{here:{event:"general-settings.open"}}})}];var In=(t=>(t.Main="main",t.Basics="basics",t.Layout="layout",t.Style="style",t.Security="security",t.Targets="targets",t))(In||{});const Wa=t=>t,qa=t=>t;i.AllTextStylePlugins=Ia,i.AllTextStyles=Sa,i.AttachmentOperationsProvider=Wn,i.Attachments=we,i.AttachmentsProvider=ge,i.AttachmentsToolbarButton=ve,i.BUTTON_PLUGIN=Ge,i.BlockButtonStyles=vt,i.BlockInjectButton=Bn,i.BlockItemWrapper=Ee,i.BlockStyles=S,i.BorderStyle=H,i.BreakAfterPlugin=Xo,i.ButtonPlugin=je,i.Custom1Plugin=sn,i.Custom2Plugin=ln,i.Custom3Plugin=cn,i.DEFAULT_ATTACHMENTS_BUTTON_ID=be,i.DEFAULT_DRAGGING_TOOLTIP=ke,i.DEFAULT_DRAG_TOOLTIP=Ce,i.DEFAULT_MENU_BUTTON_ID=At,i.DownloadButton=Zn,i.DragHandleToolbarButton=Te,i.DragPreviewContextProvider=le,i.ELEMENT_BUTTON=I,i.FlyoutToolbarButton=Pe,i.GAP_DEFAULT=an,i.GutterSpacing=Z,i.Heading1Plugin=gn,i.Heading2Plugin=hn,i.Heading3Plugin=mn,i.Heading4Plugin=fn,i.ImageCaptionPlugin=pn,i.ImageTitlePlugin=wn,i.KEY_ELEMENT_BREAK_AFTER_COLUMN=Qo,i.LinkInput=$e,i.LinkPlugin=on,i.LinkSelector=Ve,i.Margin=X,i.MenuToolbarButton=xe,i.MultiFlyoutContextProvider=de,i.OrderedListPlugin=xn,i.PARAGRAPH_CLASSES=bn,i.Padding=Q,i.ParagraphMarkupElement=vn,i.ParagraphMarkupElementNode=Ct,i.ParagraphPlugin=yn,i.QuoteMarkupElementNode=kt,i.QuotePlugin=kn,i.Radius=W,i.RichTextEditor=_o,i.Sections=In,i.Security=J,i.THEME_PREFIX=Aa,i.TextStylePluginsWithoutImage=Yt,i.TextStyles=b,i.TextStylesWithoutImage=lt,i.Toolbar=Se,i.UnorderedListPlugin=Pn,i.addHttps=wt,i.borderStyleMap=re,i.convertToRteValue=eo,i.createButtonNode=Oe,i.createButtonPlugin=Ke,i.createLinkPlugin=nn,i.createParagraphPlugin=Cn,i.createQuotePlugin=Tn,i.customCoordinatesGetterFactory=me,i.defineBlock=Wa,i.defineSettings=qa,i.getBackgroundColorStyles=Un,i.getBackgroundSettings=La,i.getBorderRadiusSettings=Ma,i.getBorderRadiusSlider=Qt,i.getBorderSettings=Da,i.getBorderStyles=Vn,i.getDefaultPluginsWithLinkChooser=Na,i.getExtendedBorderRadiusSettings=Fa,i.getGutterSettings=Oa,i.getLegacyUrl=ro,i.getLinkFromEditor=lo,i.getMarginExtendedSettings=Ua,i.getMarginSettings=_a,i.getMarginSlider=Xt,i.getPaddingExtendedSettings=za,i.getPaddingSettings=Ha,i.getPaddingSlider=Jt,i.getRadiusStyles=$n,i.getReadableColor=On,i.getSecurityDownloadableSetting=Va,i.getSecurityGlobalControlId=Zt,i.getSecurityGlobalControlSetting=$a,i.getUrl=io,i.getUrlFromEditor=Fe,i.getUrlFromLinkOrLegacyLink=Mt,i.gutterSpacingStyleMap=ie,i.hasRichTextValue=Be,i.insertButton=Le,i.isDark=An,i.isDownloadable=no,i.isValidUrl=yt,i.isValidUrlOrEmpty=st,i.joinClassNames=U,i.mapAppBridgeColorPaletteToFonduePalette=Ne,i.mapAppBridgeColorPalettesToFonduePalettes=oo,i.marginStyleMap=nt,i.moveItemInArray=_n,i.paddingStyleMap=et,i.radiusStyleMap=Y,i.relativeUrlRegex=Ft,i.setAlpha=Mn,i.submitFloatingButton=Ot,i.toColorObject=Fn,i.toHex8String=Ln,i.toHexString=Dn,i.toRgbaString=It,i.toShortRgba=j,i.triggerFloatingButton=_e,i.triggerFloatingButtonEdit=bt,i.triggerFloatingButtonInsert=Ut,i.unwrapButton=rt,i.upsertButton=De,i.upsertButtonText=_t,i.useAttachmentOperations=Bt,i.useAttachments=ue,i.useAttachmentsContext=he,i.useDndSensors=jn,i.useDragPreviewContext=ot,i.useMultiFlyoutContext=ce,i.useMultiFlyoutState=ft,i.withAttachmentsProvider=qn,i.withButton=Ae,i.wrapButton=Me,Object.keys(h).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(i,t)&&Object.defineProperty(i,t,{enumerable:!0,get:()=>h[t]})}),Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})}));
10
10
  //# sourceMappingURL=index.umd.js.map