@frontify/guideline-blocks-settings 0.34.3 → 0.34.5

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.d.ts CHANGED
@@ -851,7 +851,7 @@ export declare const relativeUrlRegex: RegExp;
851
851
 
852
852
  export declare type RichTextButtonStyle = 'primary' | 'secondary' | 'tertiary';
853
853
 
854
- export declare const RichTextEditor: ({ id, isEditing, value, columns, gap, placeholder, plugins, onTextChange, showSerializedText, }: RichTextEditorProps) => JSX_2.Element;
854
+ export declare const RichTextEditor: (props: RichTextEditorProps) => JSX_2.Element;
855
855
 
856
856
  declare type RichTextEditorProps = {
857
857
  id?: string;
package/dist/index.umd.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(i,u){typeof exports=="object"&&typeof module<"u"?u(exports,require("@frontify/sidebar-settings"),require("react/jsx-runtime"),require("@frontify/fondue"),require("react"),require("@frontify/app-bridge"),require("@dnd-kit/core"),require("@dnd-kit/modifiers"),require("@dnd-kit/sortable"),require("@react-aria/focus"),require("@react-stately/overlays"),require("@ctrl/tinycolor")):typeof define=="function"&&define.amd?define(["exports","@frontify/sidebar-settings","react/jsx-runtime","@frontify/fondue","react","@frontify/app-bridge","@dnd-kit/core","@dnd-kit/modifiers","@dnd-kit/sortable","@react-aria/focus","@react-stately/overlays","@ctrl/tinycolor"],u):(i=typeof globalThis<"u"?globalThis:i||self,u(i.GuidelineBlocksSettings={},i.sidebarSettings,i.jsxRuntime,i.fondue,i.React,i.appBridge,i.core,i.modifiers,i.sortable,i.focus,i.overlays,i.tinycolor))})(this,function(i,u,s,a,w,W,T,mn,ct,jt,wn,V){"use strict";var Mr=Object.defineProperty;var Fr=(i,u,s)=>u in i?Mr(i,u,{enumerable:!0,configurable:!0,writable:!0,value:s}):i[u]=s;var L=(i,u,s)=>(Fr(i,typeof u!="symbol"?u+"":u,s),s);const _=t=>t.filter(Boolean).join(" "),yn=({onDrop:t,label:e,icon:n,secondaryLabel:r,isLoading:l,fillParentContainer:o,onAssetChooseClick:c,onUploadClick:g,withMenu:d=!0,onClick:y,validFileType:m,verticalLayout:h})=>{const[f,b]=w.useState(!1),[p,k]=w.useState(),P=w.useRef(null),[B,F]=w.useState(void 0),D=S=>{if(S.preventDefault(),b(!1),!U(S.dataTransfer.files)){F("Invalid"),setTimeout(()=>{F(void 0)},1e3);return}t==null||t(S.dataTransfer.files)},U=S=>{if(!m)return!0;for(let M=0;M<S.length;M++){const O=S[M].name.split(".").pop()??"";if(!W.FileExtensionSets[m].includes(O))return!1}return!0},z=S=>{if(!P.current||l)return;const{left:M,top:O}=P.current.getBoundingClientRect(),bt=S.clientX-M,pt=S.clientY-O;k([bt,pt])};return s.jsxs("button",{ref:P,"data-test-id":"block-inject-button",className:_(["tw-font-body tw-relative tw-text-sm tw-leading-4 tw-border tw-flex tw-items-center tw-justify-center tw-cursor-pointer tw-gap-3 tw-w-full first:tw-rounded-tl last:tw-rounded-br",h?"[&:not(:first-child)]:tw-border-t-0 first:tw-rounded-tr last:tw-rounded-bl":"[&:not(:first-child)]:tw-border-l-0 first:tw-rounded-bl last:tw-rounded-tr",o?"tw-h-full":"tw-h-[72px]",f&&!l?"tw-border-dashed":"tw-border-solid",p&&"tw-bg-blank-state-pressed-inverse",f&&"tw-bg-blank-state-weak-inverse",B?"!tw-border-red-50 !tw-cursor-not-allowed":" tw-border-blank-state-line",l||p||f||B?"":"tw-text-text-weak hover:tw-text-blank-state-hover hover:tw-bg-blank-state-hover-inverse hover:tw-border-blank-state-line-hover active:tw-text-blank-state-pressed active:tw-bg-blank-state-pressed-inverse active:tw-border-blank-state-line-hover",(f||p)&&!B?"[&>*]:tw-pointer-events-none tw-border-blank-state-line-hover":"tw-bg-blank-state-shaded-inverse tw-text-blank-state-shaded"]),onDragEnter:t?S=>{var M;if(b(!0),m==="Images")for(const O of Array.from(S.dataTransfer.items))(M=O==null?void 0:O.type)!=null&&M.startsWith("image/")?F(void 0):F("Invalid")}:void 0,onDragLeave:t?()=>{b(!1),F(void 0)}:void 0,onDrop:t?D:void 0,onClick:S=>{d&&z(S),y==null||y()},children:[l?s.jsx(a.LoadingCircle,{}):B?s.jsxs("div",{className:" tw-flex tw-items-center tw-justify-center tw-text-red-60 tw-font-medium",children:[s.jsx(a.IconExclamationMarkTriangle,{}),B]}):s.jsxs(s.Fragment,{children:[n&&s.jsx("div",{children:n}),(e||r)&&s.jsxs("div",{className:"tw-flex tw-flex-col tw-items-start",children:[e&&s.jsx("div",{className:"tw-font-medium",children:e}),r&&s.jsx("div",{className:"tw-font-normal",children:r})]})]}),p&&s.jsx("div",{className:"tw-absolute tw-left-0 tw-top-full tw-z-20",style:{left:p[0],top:p[1]},children:s.jsx(a.Flyout,{onOpenChange:S=>!S&&k(void 0),isOpen:!0,fitContent:!0,hug:!1,legacyFooter:!1,trigger:s.jsx("div",{}),children:s.jsx(a.ActionMenu,{menuBlocks:[{id:"menu",menuItems:[...g?[{id:"upload",size:a.MenuItemContentSize.XSmall,title:"Upload asset",onClick:()=>{g(),k(void 0)},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:s.jsx(a.IconArrowCircleUp20,{})})}]:[],...c?[{id:"asset",size:a.MenuItemContentSize.XSmall,title:"Browse asset",onClick:()=>{c(),k(void 0)},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:s.jsx(a.IconImageStack20,{})})}]:[]]}]})})})]})},q=t=>{const e=r=>typeof r=="object"&&["red","green","blue"].every(o=>r.hasOwnProperty(o)),n=r=>{const l=typeof r.alpha=="number"?r.alpha:1;return{r:r.red,g:r.green,b:r.blue,a:l}};return e(t)?n(t):t},fn=t=>typeof t=="object"&&["red","green","blue"].every(n=>t==null?void 0:t.hasOwnProperty(n)),bn=(t,e)=>{const n=fn(t)?q(t):t,r=new V.TinyColor(n);return e?r.getBrightness()<e:r.isDark()||r.getAlpha()>.25&&r.getAlpha()<1},pn=t=>new V.TinyColor(q(t)).toHex8String(),vn=t=>new V.TinyColor(q(t)).toHexString(),vt=t=>new V.TinyColor(q(t)).toRgbString(),Cn=(t,e)=>new V.TinyColor(e).setAlpha(t).toRgbString(),kn=t=>{const{r:e,g:n,b:r,a:l}=new V.TinyColor(t);return{red:e,green:n,blue:r,alpha:l}},Kt=t=>typeof t=="object"&&["red","green","blue"].every(n=>t==null?void 0:t.hasOwnProperty(n)),xn=(t,e)=>{const n=Kt(t)?q(t):t,r=Kt(e)?q(e):e;let l=new V.TinyColor(n);const o=new V.TinyColor(r);for(;V.readability(l,o)<4.5;)l=l.darken(1);return l.toRgbString()},Sn=(t,e,n)=>{const r=[...t],l=n<0?r.length+n:n;if(l>=0&&l<r.length){const o=r.splice(e,1)[0];r.splice(l,0,o)}return r},Tn=t=>({backgroundColor:vt(t)});var H=(t=>(t.Solid="Solid",t.Dashed="Dashed",t.Dotted="Dotted",t))(H||{});const Xt={Solid:"solid",Dotted:"dotted",Dashed:"dashed"};var $=(t=>(t.None="None",t.Small="Small",t.Medium="Medium",t.Large="Large",t))($||{});const G={None:"0px",Small:"2px",Medium:"4px",Large:"12px"};var j=(t=>(t.None="None",t.Small="Small",t.Medium="Medium",t.Large="Large",t))(j||{});const J={None:"0px",Small:"24px",Medium:"36px",Large:"60px"};var K=(t=>(t.None="None",t.Small="Small",t.Medium="Medium",t.Large="Large",t))(K||{});const Z={None:"0px",Small:"24px",Medium:"36px",Large:"60px"};var X=(t=>(t.Global="Global",t.Custom="Custom",t))(X||{}),Q=(t=>(t.Auto="Auto",t.S="S",t.M="M",t.L="L",t))(Q||{});const Qt={Auto:"4px",S:"10px",M:"30px",L:"50px"},Pn={red:241,green:241,blue:241,alpha:1},Yt={red:234,green:235,blue:235,alpha:1},In="1px",at="24px",rt="24px",En=(t=H.Solid,e="1px",n=Yt)=>({borderStyle:Xt[t],borderWidth:e,borderColor:vt(n)}),Bn=(t,e=!1,n)=>({borderRadius:e?n:G[t]}),Jt=w.createContext(!1),Zt=({children:t,isDragPreview:e})=>s.jsx(Jt.Provider,{value:e,children:t}),st=()=>w.useContext(Jt),Rt=w.createContext({openFlyoutIds:[],setOpenFlyoutIds:()=>console.error("No MultiFlyoutContext Provider found")}),te=({children:t,openFlyoutIds:e,setOpenFlyoutIds:n})=>{const r=w.useMemo(()=>({openFlyoutIds:e,setOpenFlyoutIds:n}),[e,n]);return s.jsx(Rt.Provider,{value:r,children:t})},ee=()=>w.useContext(Rt),dt=t=>{const{openFlyoutIds:e,setOpenFlyoutIds:n}=ee(),r=w.useCallback(l=>{n(o=>{const c=o.filter(g=>g!==t);return l?[...c,t]:c})},[t,n]);return{isOpen:e.includes(t),onOpenChange:r}},ne=({children:t})=>s.jsx("div",{className:"tw-pointer-events-auto tw-flex tw-flex-shrink-0 tw-gap-px tw-px-px tw-h-[26px] tw-items-center tw-self-start tw-leading-none",children:t}),ae=(t,e)=>{const{blockAssets:n,addAssetIdsToKey:r,deleteAssetIdsFromKey:l,updateAssetIdsFromKey:o}=W.useBlockAssets(t),c=(n==null?void 0:n[e])||[];return{onAttachmentsAdd:async h=>{await r(e,h.map(f=>f.id))},onAttachmentDelete:async h=>{await l(e,[h.id])},onAttachmentReplace:async(h,f)=>{const b=c.map(p=>p.id===h.id?f.id:p.id);await o(e,b)},onAttachmentsSorted:async h=>{const f=h.map(b=>b.id);await o(e,f)},attachments:c,appBridge:t}},re=w.createContext(null),se=({appBridge:t,children:e,assetId:n})=>{const r=ae(t,n);return s.jsx(re.Provider,{value:r,children:e})},le=()=>{const t=w.useContext(re);if(!t)throw new Error("No AttachmentsContext Provided. Component must be wrapped in an 'AttachmentsProvider' or the 'withAttachmentsProvider' HOC");return t},Nn=(t,e)=>{const n=r=>s.jsx(se,{appBridge:r.appBridge,assetId:e,children:s.jsx(t,{...r})});return n.displayName="withAttachmentsProvider",n},Ln=[T.KeyboardCode.Down,T.KeyboardCode.Right,T.KeyboardCode.Up,T.KeyboardCode.Left],ie=(t,e)=>(n,{currentCoordinates:r,context:{activeNode:l}})=>{if(n.preventDefault(),Ln.includes(n.code)){const o=(l==null?void 0:l.offsetWidth)??0,c=(l==null?void 0:l.offsetHeight)??0;switch(n.code){case T.KeyboardCode.Right:return{...r,x:r.x+o+t};case T.KeyboardCode.Left:return{...r,x:r.x-o-t};case T.KeyboardCode.Down:return{...r,y:r.y+c+e};case T.KeyboardCode.Up:return{...r,y:r.y-c-e}}}},An={start:["Space","Enter"],cancel:[],end:["Space","Enter","Escape"]},Mn=(t=0,e=0)=>{const n=ie(t,e);return T.useSensors(T.useSensor(T.PointerSensor),T.useSensor(T.KeyboardSensor,{coordinateGetter:n,keyboardCodes:An}))},Fn=t=>t==="IMAGE"?s.jsx(a.IconImage24,{}):t==="VIDEO"?s.jsx(a.IconPlayFrame24,{}):t==="AUDIO"?s.jsx(a.IconMusicNote24,{}):s.jsx(a.IconDocument24,{}),Ct=w.forwardRef(({item:t,isEditing:e,draggableProps:n,transformStyle:r,isDragging:l,isOverlay:o,isLoading:c,onDelete:g,onReplaceWithBrowse:d,onReplaceWithUpload:y,onDownload:m},h)=>{const[f,b]=w.useState(),[p,{selectedFiles:k}]=W.useFileInput({multiple:!0,accept:"image/*"}),[P,{results:B,doneAll:F}]=W.useAssetUpload(),{focusProps:D,isFocusVisible:U}=jt.useFocusRing();w.useEffect(()=>{k&&P(k[0])},[k]),w.useEffect(()=>{F&&y(B[0])},[F,B]);const z=c||k&&!F;return s.jsxs("button",{"aria-label":"Download attachment","data-test-id":"attachments-item",onClick:()=>m==null?void 0:m(),ref:h,style:{...r,opacity:l&&!o?.3:1,fontFamily:"var(-f-theme-settings-body-font-family)"},className:_(["tw-cursor-pointer tw-text-left tw-w-full tw-relative tw-flex tw-gap-3 tw-px-5 tw-py-3 tw-items-center tw-group hover:tw-bg-box-neutral-hover",l?"tw-bg-box-neutral-hover":""]),children:[s.jsx("div",{className:"tw-text-text-weak group-hover:tw-text-box-neutral-inverse-hover",children:z?s.jsx(a.LoadingCircle,{size:a.LoadingCircleSize.Small}):Fn(t.objectType)}),s.jsxs("div",{className:"tw-text-s tw-flex-1 tw-min-w-0",children:[s.jsx("div",{className:"tw-whitespace-nowrap tw-overflow-hidden tw-text-ellipsis tw-font-bold tw-text-text-weak group-hover:tw-text-box-neutral-inverse-hover",children:t.title}),s.jsx("div",{className:"tw-text-text-weak",children:`${t.fileSizeHumanReadable} - ${t.extension}`})]}),e&&s.jsxs("div",{"data-test-id":"attachments-actionbar",className:_(["tw-flex tw-gap-0.5 group-focus:tw-opacity-100 focus-visible:tw-opacity-100 focus-within:tw-opacity-100 group-hover:tw-opacity-100",o||(f==null?void 0:f.id)===t.id?"tw-opacity-100":"tw-opacity-0"]),children:[s.jsx("button",{...D,...n,"aria-label":"Drag attachment",className:_([" tw-border-button-border tw-bg-button-background active:tw-bg-button-background-pressed tw-group tw-border tw-box-box tw-relative tw-flex tw-items-center tw-justify-center tw-outline-none tw-font-medium tw-rounded tw-h-9 tw-w-9 ",l||o?"tw-cursor-grabbing tw-bg-button-background-pressed hover:tw-bg-button-background-pressed":"tw-cursor-grab hover:tw-bg-button-background-hover",U&&a.FOCUS_STYLE,U&&"tw-z-[2]"]),children:s.jsx(a.IconGrabHandle20,{})}),s.jsx("div",{"data-test-id":"attachments-actionbar-flyout",children:s.jsx(a.Flyout,{placement:a.FlyoutPlacement.Right,isOpen:(f==null?void 0:f.id)===t.id,fitContent:!0,legacyFooter:!1,onOpenChange:S=>b(S?t:void 0),trigger:(S,M)=>s.jsx(a.Button,{ref:M,icon:s.jsx(a.IconPen20,{}),emphasis:a.ButtonEmphasis.Default,onClick:()=>b(t)}),children:s.jsx(a.ActionMenu,{menuBlocks:[{id:"menu",menuItems:[{id:"upload",size:a.MenuItemContentSize.XSmall,title:"Replace with upload",onClick:()=>{p(),b(void 0)},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:s.jsx(a.IconArrowCircleUp20,{})})},{id:"asset",size:a.MenuItemContentSize.XSmall,title:"Replace with asset",onClick:()=>{d(),b(void 0)},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:s.jsx(a.IconImageStack20,{})})}]},{id:"menu-delete",menuItems:[{id:"delete",size:a.MenuItemContentSize.XSmall,title:"Delete",style:a.MenuItemStyle.Danger,onClick:()=>{g(),b(void 0)},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:s.jsx(a.IconTrashBin20,{})})}]}]})})})]})]})});Ct.displayName="AttachmentItem";const Dn=t=>{const{attributes:e,listeners:n,setNodeRef:r,transform:l,transition:o,isDragging:c}=ct.useSortable({id:t.item.id}),g={transform:l?`translate(${l.x}px, ${l.y}px)`:"",transition:o,zIndex:c?2:1},d={...e,...n};return s.jsx(Ct,{ref:r,isDragging:c,transformStyle:g,draggableProps:d,...t})},On=({children:t,isFlyoutOpen:e,triggerProps:n,triggerRef:r})=>s.jsxs("button",{className:_(["tw-flex tw-text-xs tw-font-body tw-items-center tw-gap-1 tw-rounded-full tw-outline tw-outline-1 tw-outline-offset-1 tw-p-1.5 tw-outline-line",e?"tw-bg-box-neutral-pressed tw-text-box-neutral-inverse-pressed":"tw-bg-base hover:tw-bg-box-neutral-hover active:tw-bg-box-neutral-pressed tw-text-box-neutral-inverse hover:tw-text-box-neutral-inverse-hover active:tw-text-box-neutral-inverse-pressed"]),...n,ref:r,"data-test-id":"attachments-button-trigger",children:[s.jsx(a.IconPaperclip16,{}),t,s.jsx(a.IconCaretDown12,{})]}),oe=({items:t=[],onDelete:e,onReplaceWithBrowse:n,onReplaceWithUpload:r,onBrowse:l,onUpload:o,onSorted:c,appBridge:g,triggerComponent:d=On,isOpen:y,onOpenChange:m})=>{const[h,f]=w.useState(t),[b,p]=w.useState(!1),k=T.useSensors(T.useSensor(T.PointerSensor),T.useSensor(T.KeyboardSensor)),[P,B]=w.useState(void 0),[F,D]=w.useState(!1),[U,z]=w.useState([]),[S,M]=w.useState(null),O=W.useEditorState(g),{openAssetChooser:bt,closeAssetChooser:pt}=W.useAssetChooser(g),on=y!==void 0,qt=on?y:b,nt=h==null?void 0:h.find(C=>C.id===P),[Ir,{results:cn,doneAll:dn}]=W.useAssetUpload({onUploadProgress:()=>!F&&D(!0)}),ot=C=>{const E=on?m:p;E==null||E(C)};w.useEffect(()=>{f(t)},[t]),w.useEffect(()=>{S&&(D(!0),Ir(S))},[S]),w.useEffect(()=>{(async()=>{dn&&(await o(cn),D(!1))})()},[dn,cn]);const Er=()=>{ot(!1),bt(C=>{l(C),pt(),ot(!0)},{multiSelection:!0,selectedValueIds:h.map(C=>C.id)})},gn=C=>{ot(!1),bt(async E=>{ot(!0),pt(),z([...U,C.id]),await n(C,E[0]),z(U.filter(Y=>Y!==C.id))},{multiSelection:!1,selectedValueIds:h.map(E=>E.id)})},un=async(C,E)=>{z([...U,C.id]),await r(C,E),z(U.filter(Y=>Y!==C.id))},Br=C=>{const{active:E}=C;B(E.id)},Nr=C=>{const{active:E,over:Y}=C;if(Y&&E.id!==Y.id&&h){const Lr=h.findIndex(Gt=>Gt.id===E.id),Ar=h.findIndex(Gt=>Gt.id===Y.id),hn=ct.arrayMove(h,Lr,Ar);f(hn),c(hn)}B(void 0)};return O||((h==null?void 0:h.length)??0)>0?s.jsx(a.LegacyTooltip,{withArrow:!0,position:a.TooltipPosition.Top,content:"Attachments",disabled:qt,enterDelay:500,triggerElement:s.jsx("div",{"data-test-id":"attachments-flyout-button",children:s.jsx(a.Flyout,{placement:a.FlyoutPlacement.BottomRight,onOpenChange:C=>ot(nt?!0:C),isOpen:qt,hug:!1,fitContent:!0,legacyFooter:!1,trigger:(C,E)=>s.jsx(d,{isFlyoutOpen:qt,triggerProps:C,triggerRef:E,children:s.jsx("div",{children:t.length>0?t.length:"Add"})}),children:s.jsxs("div",{className:"tw-w-[300px]","data-test-id":"attachments-flyout-content",children:[h.length>0&&s.jsxs(T.DndContext,{sensors:k,collisionDetection:T.closestCenter,onDragStart:Br,onDragEnd:Nr,modifiers:[mn.restrictToWindowEdges],children:[s.jsx(ct.SortableContext,{items:h,strategy:ct.rectSortingStrategy,children:s.jsx("div",{className:"tw-border-b tw-border-b-line",children:h.map(C=>s.jsx(Dn,{isEditing:O,isLoading:U.includes(C.id),item:C,onDelete:()=>e(C),onReplaceWithBrowse:()=>gn(C),onReplaceWithUpload:E=>un(C,E),onDownload:()=>g.dispatch({name:"downloadAsset",payload:C})},C.id))})}),s.jsx(T.DragOverlay,{children:nt&&s.jsx(Ct,{isOverlay:!0,isEditing:O,item:nt,isDragging:!0,onDelete:()=>e(nt),onReplaceWithBrowse:()=>gn(nt),onReplaceWithUpload:C=>un(nt,C)},P)})]}),O&&s.jsxs("div",{className:"tw-px-5 tw-py-3",children:[s.jsx("div",{className:"tw-font-body tw-font-medium tw-text-text tw-text-s tw-my-4",children:"Add attachments"}),s.jsx(a.AssetInput,{isLoading:F,size:a.AssetInputSize.Small,onUploadClick:C=>M(C),onLibraryClick:Er})]})]})})})}):null},Un=(t,e)=>{const n=[a.FOCUS_VISIBLE_STYLE,"tw-relative tw-inline-flex tw-items-center tw-justify-center","tw-h-6 tw-p-1","tw-rounded","tw-text-xs tw-font-medium","tw-gap-0.5","focus-visible:tw-z-10"];return e?n.push("tw-bg-box-neutral-pressed","tw-text-box-neutral-inverse-pressed",t==="grab"?"tw-cursor-grabbing":"tw-cursor-pointer"):n.push("hover:tw-bg-box-neutral-hover active:tw-bg-box-neutral-pressed","tw-text-text-weak hover:tw-text-box-neutral-inverse-hover active:tw-text-box-neutral-inverse-pressed",t==="grab"?"!tw-cursor-grab active:tw-cursor-grabbing":"tw-cursor-pointer"),_(n)},lt=w.forwardRef(({onClick:t,children:e,forceActiveStyle:n,cursor:r="pointer","data-test-id":l="base-toolbar-button",...o},c)=>s.jsx("button",{onClick:t,className:Un(r,n),"data-test-id":l,...o,ref:c,children:e}));lt.displayName="BaseToolbarButton";const _n=({children:t,isFlyoutOpen:e,triggerProps:n,triggerRef:r})=>s.jsxs(lt,{forceActiveStyle:e,"data-test-id":"attachments-toolbar-button-trigger",...n,ref:r,children:[s.jsx(a.IconPaperclip16,{}),t,s.jsx(a.IconCaretDown12,{})]}),ce="attachments",de=({flyoutId:t=ce})=>{const e=a.useMemoizedId(t),{appBridge:n,attachments:r,onAttachmentsAdd:l,onAttachmentDelete:o,onAttachmentReplace:c,onAttachmentsSorted:g}=le(),{isOpen:d,onOpenChange:y}=dt(e),m=st();return s.jsx(oe,{onUpload:l,onDelete:o,onReplaceWithBrowse:c,onReplaceWithUpload:c,onSorted:g,onBrowse:l,items:r,appBridge:n,triggerComponent:_n,isOpen:d&&!m,onOpenChange:y})},kt=({open:t,content:e,children:n,disabled:r})=>s.jsx(a.LegacyTooltip,{withArrow:!0,hoverDelay:0,enterDelay:300,open:t,disabled:r,position:a.TooltipPosition.Top,content:s.jsx("div",{children:e}),triggerElement:n,"data-test-id":"toolbar-button-tooltip"}),Hn=({tooltip:t,icon:e,onClick:n})=>{const r=st();return s.jsx(kt,{disabled:r,content:t??"",children:s.jsx(lt,{"data-test-id":"block-item-wrapper-toolbar-btn",onClick:n,children:e})})},ge="Drag or press ↵ to move",ue="Move with ↑↓←→ and confirm with ↵",he=({tooltip:t,icon:e,setActivatorNodeRef:n,draggableProps:r})=>{const l=st();return s.jsx(kt,{open:l,content:s.jsx("div",{children:l?ue:t??ge}),children:s.jsx(lt,{ref:n,"data-test-id":"block-item-wrapper-toolbar-btn",forceActiveStyle:l,cursor:"grab",...r,children:e})})},xt=({content:t,icon:e,tooltip:n,flyoutId:r,flyoutFooter:l,flyoutHeader:o})=>{const c=a.useMemoizedId(r),{isOpen:g,onOpenChange:d}=dt(c),y=st();return s.jsx(kt,{disabled:y||g,content:n,children:s.jsx("div",{className:"tw-flex tw-flex-shrink-0 tw-flex-1 tw-h-6 tw-relative",children:s.jsx(a.Flyout,{isOpen:g&&!y,legacyFooter:!1,fixedFooter:l,fixedHeader:o,fitContent:!0,hug:!1,placement:a.FlyoutPlacement.BottomRight,onOpenChange:d,trigger:(m,h)=>s.jsx(lt,{"data-test-id":"block-item-wrapper-toolbar-flyout",forceActiveStyle:g&&!y,...m,ref:h,children:e}),children:t})})})},me=({items:t,flyoutId:e})=>{const{onOpenChange:n}=dt(e);return s.jsx(a.ActionMenu,{menuBlocks:t.map((r,l)=>({id:l.toString(),menuItems:r.map((o,c)=>({id:l.toString()+c.toString(),size:a.MenuItemContentSize.XSmall,title:o.title,style:o.style,onClick:()=>{n(!1),o.onClick()},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:o.icon})}))}))})},St="menu",we=({items:t,flyoutId:e=St,tooltip:n="Options"})=>{const r=a.useMemoizedId(e);return s.jsx(xt,{icon:s.jsx(a.IconDotsHorizontal16,{}),tooltip:n,flyoutId:r,content:s.jsx(me,{items:t,flyoutId:r})})},ye=({items:t,attachments:e})=>s.jsxs("div",{"data-test-id":"block-item-wrapper-toolbar",className:"tw-rounded-md tw-bg-base tw-border tw-border-line-strong tw-divide-x tw-divide-line-strong tw-shadow-lg tw-flex tw-flex-none tw-items-center tw-isolate",children:[e.isEnabled&&s.jsx(ne,{children:s.jsx(de,{})}),s.jsx(ne,{children:t.map(n=>n.type==="dragHandle"?s.jsx(he,{...n},n.tooltip+n.type):n.type==="menu"?s.jsx(we,{...n},n.tooltip+n.type):n.type==="flyout"?s.jsx(xt,{...n},n.tooltip+n.type):s.jsx(Hn,{...n},n.tooltip+n.type))})]}),Vn=({children:t,toolbarItems:e,shouldHideWrapper:n,shouldHideComponent:r=!1,isDragging:l=!1,shouldFillContainer:o,outlineOffset:c=2,shouldBeShown:g=!1,showAttachments:d=!1})=>{const[y,m]=w.useState(g?[St]:[]),h=w.useRef(null);if(n)return s.jsx(s.Fragment,{children:t});const f=e==null?void 0:e.filter(p=>p!==void 0),b=y.length>0||g;return s.jsx(Zt,{isDragPreview:l,children:s.jsx(te,{openFlyoutIds:y,setOpenFlyoutIds:m,children:s.jsxs("div",{ref:h,"data-test-id":"block-item-wrapper",style:{outlineOffset:c},className:_(["tw-relative tw-group tw-outline-1 tw-outline-box-selected-inverse",o&&"tw-flex-1 tw-h-full tw-w-full","hover:tw-outline focus-within:tw-outline",b&&"tw-outline",r&&"tw-opacity-0"]),children:[s.jsx("div",{style:{right:-1-c,bottom:`calc(100% - ${2+c}px)`},className:_(["tw-pointer-events-none tw-absolute tw-bottom-[calc(100%-4px)] tw-right-[-3px] tw-w-full tw-opacity-0 tw-z-[60]","group-hover:tw-opacity-100 group-focus:tw-opacity-100 focus-within:tw-opacity-100","tw-flex tw-justify-end",b&&"tw-opacity-100"]),children:s.jsx(ye,{attachments:{isEnabled:d},items:f})}),t]})})})},zn=({onDownload:t})=>{const{isFocused:e,focusProps:n}=jt.useFocusRing();return s.jsx(a.LegacyTooltip,{withArrow:!0,position:a.TooltipPosition.Top,content:"Download",enterDelay:500,triggerElement:s.jsx("button",{tabIndex:0,"aria-label":"Download",...n,className:_(["tw-outline-none tw-rounded",e&&a.FOCUS_STYLE]),onClick:t,onPointerDown:r=>r.preventDefault(),children:s.jsx("span",{"data-test-id":"download-button",className:"tw-flex tw-text-xs tw-font-body tw-items-center tw-gap-1 tw-rounded-full tw-bg-box-neutral-strong-inverse hover:tw-bg-box-neutral-strong-inverse-hover active:tw-bg-box-neutral-strong-inverse-pressed tw-text-box-neutral-strong tw-outline tw-outline-1 tw-outline-offset-1 tw-p-1.5 tw-outline-line",children:s.jsx(a.IconArrowCircleDown16,{})})})})},$n=({value:t="",gap:e,columns:n,show:r=!0,plugins:l})=>{const[o,c]=w.useState(null);return w.useEffect(()=>{(async()=>c(await a.serializeRawToHtmlAsync(t,l,n,e)))()},[t,n,e,l]),!r||o==="<br />"?null:o!==null?s.jsx("div",{className:"tw-w-full tw-whitespace-pre-wrap","data-test-id":"rte-content-html",dangerouslySetInnerHTML:{__html:o}}):s.jsx("div",{className:"tw-rounded-sm tw-bg-base-alt tw-animate-pulse tw-h-full tw-min-h-[10px] tw-w-full"})},Tt=a.createStore("floatingButton")({openEditorId:null,mouseDown:!1,updated:!1,url:"",text:"",buttonStyle:"primary",newTab:!1,mode:"",isEditing:!1}).extendActions(t=>({reset:()=>{t.url(""),t.text(""),t.buttonStyle("primary"),t.newTab(!1),t.mode(""),t.isEditing(!1)}})).extendActions(t=>({show:(e,n)=>{t.mode(e),t.isEditing(!1),t.openEditorId(n)},hide:()=>{t.reset(),t.openEditorId(null)}})).extendSelectors(t=>({isOpen:e=>t.openEditorId===e})),I=Tt.set,A=Tt.get,it=()=>Tt.use,fe=t=>{if(!t)return!1;const e=n=>n.some(r=>r.text?r.text!=="":r.children?e(r.children):!1);try{const n=JSON.parse(t);return e(n)}catch{return!1}},Wn=(t="p",e="",n)=>fe(e)?e:JSON.stringify([{type:t,children:[{text:e,textStyle:t}],align:n}]),qn=(t,e,n)=>t===X.Custom?e:n,Gn=t=>t.map(be),be=t=>({id:t.id,title:t.name,colors:t.colors.map(Kn)}),jn=t=>"revision"in t,Kn=t=>{if(jn(t)){const{title:e,revision:n}=t;return{alpha:n.rgba.alpha?n.rgba.alpha/255:1,red:n.rgba.red??0,green:n.rgba.green??0,blue:n.rgba.blue??0,name:e??""}}return{alpha:t.alpha?t.alpha/255:1,red:t.red??0,green:t.green??0,blue:t.blue??0,name:t.name??""}},Pt=(t,e)=>{const n=a.getAboveNode(t,{match:{type:a.ELEMENT_LINK}});return Array.isArray(n)?e(n[0]):""},Xn=t=>Pt(t,e=>{var n,r;return((r=(n=e.chosenLink)==null?void 0:n.searchResult)==null?void 0:r.link)||""}),Qn=t=>Pt(t,e=>e.url||""),It=t=>{var e,n;return t.url||((n=(e=t.chosenLink)==null?void 0:e.searchResult)==null?void 0:n.link)||""},Yn=t=>Pt(t,It),Et=/^\/(document|r)\/\S+$/i,gt=t=>{if(Et.test(t))return t;try{return new URL(t),t}catch{return`https://${t}`}},ut=t=>{if(Et.test(t))return!0;try{const e=new URL(t);return["http:","https:","mailto:","tel:"].includes(e.protocol)&&e.pathname!==""}catch{return!1}},R=t=>ut(gt(t))||t==="",pe=(t,{type:e})=>{const{apply:n,normalizeNode:r}=t;return t.apply=l=>{if(l.type!=="set_selection"){n(l);return}const o=l.newProperties;if(!(o!=null&&o.focus)||!o.anchor||!a.isCollapsed(o)){n(l);return}const c=a.getAboveNode(t,{at:o,match:{type:a.getPluginType(t,x)}});if(c){const[,g]=c;let d;a.isStartPoint(t,o.focus,g)&&(d=a.getPreviousNodeEndPoint(t,g)),a.isEndPoint(t,o.focus,g)&&(d=a.getNextNodeStartPoint(t,g)),d&&(l.newProperties={anchor:d,focus:d})}n(l)},t.normalizeNode=([l,o])=>{if(l.type===a.getPluginType(t,x)){const c=t.selection;if(c&&a.isCollapsed(c)&&a.isEndPoint(t,c.focus,o)){const g=a.getNextNodeStartPoint(t,o);if(g)a.select(t,g);else{const d=a.Path.next(o);a.insertNodes(t,{text:""},{at:d}),a.select(t,d)}}}r([l,o])},a.withRemoveEmptyNodes(t,a.mockPlugin({options:{types:e}}))},ve=(t,e,n)=>{a.insertNodes(t,[Se(t,e)],n)},Bt=t=>{if(!t.selection)return;const{isUrl:e,forceSubmit:n}=a.getPluginOptions(t,x),r=A.url();if(!((e==null?void 0:e(r))||n))return;const o=A.text(),c=A.buttonStyle(),g=A.newTab()?void 0:"_self";return I.reset(),Ce(t,{url:r,text:o,buttonStyle:c,target:g,isUrl:d=>n||!e?!0:e(d)}),setTimeout(()=>{a.focusEditor(t,t.selection??void 0)},0),!0},tt=(t,e)=>a.withoutNormalizing(t,()=>{var n,r,l,o,c,g;if(e!=null&&e.split){if(a.getAboveNode(t,{at:(n=t.selection)==null?void 0:n.anchor,match:{type:a.getPluginType(t,x)}}))return a.splitNodes(t,{at:(r=t.selection)==null?void 0:r.anchor,match:m=>a.isElement(m)&&m.type===a.getPluginType(t,x)}),tt(t,{at:(l=t.selection)==null?void 0:l.anchor}),!0;if(a.getAboveNode(t,{at:(o=t.selection)==null?void 0:o.focus,match:{type:a.getPluginType(t,x)}}))return a.splitNodes(t,{at:(c=t.selection)==null?void 0:c.focus,match:m=>a.isElement(m)&&m.type===a.getPluginType(t,x)}),tt(t,{at:(g=t.selection)==null?void 0:g.focus}),!0}a.unwrapNodes(t,{match:{type:a.getPluginType(t,x)},...e})}),Ce=(t,{url:e,text:n,buttonStyle:r,target:l,insertTextInButton:o,insertNodesOptions:c,isUrl:g=a.getPluginOptions(t,x).isUrl})=>{var B;const d=t.selection;if(!d)return;const y=a.getAboveNode(t,{at:d,match:{type:a.getPluginType(t,x)}});if(o&&y)return t.insertText(e),!0;if(!(g!=null&&g(e)))return;if(a.isDefined(n)&&n.length===0&&(n=e),y)return Rn(e,t,y,l,r,n),!0;const m=a.findNode(t,{at:d,match:{type:a.getPluginType(t,x)}}),[h,f]=m??[],b=Jn(t,f,n);if(a.isExpanded(d))return Zn(y,t,e,r,l,n),!0;b&&a.removeNodes(t,{at:f});const p=a.getNodeProps(h??{}),k=(B=t.selection)==null?void 0:B.focus.path;if(!k)return;const P=a.getNodeLeaf(t,k);return n!=null&&n.length||(n=e),ve(t,{...p,url:e,target:l,children:[{...P,text:n}]},c),!0};function Jn(t,e,n){return e&&(n==null?void 0:n.length)&&n!==a.getEditorString(t,e)}function Zn(t,e,n,r,l,o){t?tt(e,{at:t[1]}):tt(e,{split:!0}),ke(e,{url:n,buttonStyle:r,target:l}),Nt(e,{url:n,target:l,text:o})}function Rn(t,e,n,r,l,o){var c,g,d;(t!==((c=n[0])==null?void 0:c.url)||r!==((g=n[0])==null?void 0:g.target)||l!==((d=n[0])==null?void 0:d.buttonStyle))&&a.setNodes(e,{url:t,target:r,buttonStyle:l},{at:n[1]}),Nt(e,{url:t,text:o,target:r})}const Nt=(t,{text:e})=>{const n=a.getAboveNode(t,{match:{type:a.getPluginType(t,x)}});if(n){const[r,l]=n;if(e!=null&&e.length&&e!==a.getEditorString(t,l)){const o=r.children[0];a.replaceNodeChildren(t,{at:l,nodes:{...o,text:e},insertOptions:{select:!0}})}}},ke=(t,{url:e,buttonStyle:n,target:r,...l})=>{a.wrapNodes(t,{type:a.getPluginType(t,x),url:e,buttonStyle:n,target:r,children:[]},{split:!0,...l})},ta=(t,e)=>{const n=a.getAboveNode(t,{match:{type:x}});return Array.isArray(n)?e(n[0]):""},xe=t=>ta(t,e=>e.url??""),Se=(t,{url:e,text:n="",buttonStyle:r="primary",target:l,children:o})=>({type:a.getPluginType(t,x),url:e,target:l,buttonStyle:r,children:o??[{text:n}]}),Te=(t,{focused:e}={})=>{if(A.mode()==="edit"){ht(t);return}Lt(t,{focused:e})},ht=t=>{const e=a.findNode(t,{match:{type:a.getPluginType(t,x)}});if(!e)return;const[n,r]=e;let l=a.getEditorString(t,r);I.url(n.url),I.newTab(n.target===void 0),l===n.url&&(l=""),I.text(l),I.isEditing(!0)},Lt=(t,{focused:e}={})=>{A.mode()||!e||a.isRangeAcrossBlocks(t,{at:t.selection})||a.someNode(t,{match:{type:a.getPluginType(t,x)}})||(I.text(a.getEditorString(t,t.selection)),I.show("insert",t.id))},mt={buttonPrimary:{fontFamily:"var(--f-theme-settings-button-primary-font-family)",fontSize:"var(--f-theme-settings-button-primary-font-size)",fontWeight:"var(--f-theme-settings-button-primary-font-weight)",lineHeight:"var(--f-theme-settings-button-primary-line-height)",paddingTop:"var(--f-theme-settings-button-primary-padding-top)",paddingRight:"var(--f-theme-settings-button-primary-padding-right)",paddingBottom:"var(--f-theme-settings-button-primary-padding-bottom)",paddingLeft:"var(--f-theme-settings-button-primary-padding-left)",fontStyle:"var(--f-theme-settings-button-primary-font-style)",textTransform:"var(--f-theme-settings-button-primary-text-transform)",backgroundColor:"var(--f-theme-settings-button-primary-background-color)",borderColor:"var(--f-theme-settings-button-primary-border-color)",borderRadius:"var(--f-theme-settings-button-primary-border-radius)",borderWidth:"var(--f-theme-settings-button-primary-border-width)",color:"var(--f-theme-settings-button-primary-color)",marginTop:"10px",marginBottom:"10px",display:"inline-block",hover:{backgroundColor:"var(--f-theme-settings-button-primary-background-color-hover)",borderColor:"var(--f-theme-settings-button-primary-border-color-hover)",color:"var(--f-theme-settings-button-primary-color-hover)"}},buttonSecondary:{fontFamily:"var(--f-theme-settings-button-secondary-font-family)",fontSize:"var(--f-theme-settings-button-secondary-font-size)",fontWeight:"var(--f-theme-settings-button-secondary-font-weight)",lineHeight:"var(--f-theme-settings-button-secondary-line-height)",paddingTop:"var(--f-theme-settings-button-secondary-padding-top)",paddingRight:"var(--f-theme-settings-button-secondary-padding-right)",paddingBottom:"var(--f-theme-settings-button-secondary-padding-bottom)",paddingLeft:"var(--f-theme-settings-button-secondary-padding-left)",fontStyle:"var(--f-theme-settings-button-secondary-font-style)",textTransform:"var(--f-theme-settings-button-secondary-text-transform)",backgroundColor:"var(--f-theme-settings-button-secondary-background-color)",borderColor:"var(--f-theme-settings-button-secondary-border-color)",borderRadius:"var(--f-theme-settings-button-secondary-border-radius)",borderWidth:"var(--f-theme-settings-button-secondary-border-width)",color:"var(--f-theme-settings-button-secondary-color)",display:"inline-block",marginTop:"10px",marginBottom:"10px",hover:{backgroundColor:"var(--f-theme-settings-button-secondary-background-color-hover)",borderColor:"var(--f-theme-settings-button-secondary-border-color-hover)",color:"var(--f-theme-settings-button-secondary-color-hover)"}},buttonTertiary:{fontFamily:"var(--f-theme-settings-button-tertiary-font-family)",fontSize:"var(--f-theme-settings-button-tertiary-font-size)",fontWeight:"var(--f-theme-settings-button-tertiary-font-weight)",lineHeight:"var(--f-theme-settings-button-tertiary-line-height)",paddingTop:"var(--f-theme-settings-button-tertiary-padding-top)",paddingRight:"var(--f-theme-settings-button-tertiary-padding-right)",paddingBottom:"var(--f-theme-settings-button-tertiary-padding-bottom)",paddingLeft:"var(--f-theme-settings-button-tertiary-padding-left)",fontStyle:"var(--f-theme-settings-button-tertiary-font-style)",textTransform:"var(--f-theme-settings-button-tertiary-text-transform)",backgroundColor:"var(--f-theme-settings-button-tertiary-background-color)",borderColor:"var(--f-theme-settings-button-tertiary-border-color)",borderRadius:"var(--f-theme-settings-button-tertiary-border-radius)",borderWidth:"var(--f-theme-settings-button-tertiary-border-width)",color:"var(--f-theme-settings-button-tertiary-color)",display:"inline-block",marginTop:"10px",marginBottom:"10px",hover:{backgroundColor:"var(--f-theme-settings-button-tertiary-background-color-hover)",borderColor:"var(--f-theme-settings-button-tertiary-border-color-hover)",color:"var(--f-theme-settings-button-tertiary-color-hover)"}}},ea=t=>{var c,g;const{attributes:e,children:n}=t,r=t.element.url||((g=(c=t.element.chosenLink)==null?void 0:c.searchResult)==null?void 0:g.link)||"",l=t.element.target||"_self",o=String(t.element.buttonStyle)||"primary";return s.jsx(na,{attributes:e,href:r,target:l,styles:mt[`button${o.charAt(0).toUpperCase()+o.slice(1)}`],children:n})},na=({attributes:t,styles:e={hover:{}},children:n,href:r="#",target:l})=>{const[o,c]=w.useState(!1);return s.jsx("a",{...t,onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),href:r,target:l,style:o?{...e,...e.hover}:e,children:n})};class aa extends a.MarkupElement{constructor(e=x,n=ea){super(e,n)}}const Pe=w.forwardRef((t,e)=>{const n=a.useEditorRef();return s.jsx(a.ToolbarButton,{ref:e,...t,onMouseDown:()=>{a.focusEditor(n,n.selection??n.prevSelection??void 0)},onClick:()=>{Te(n,{focused:!0})},children:s.jsx(a.IconStylingWrapper,{icon:s.jsx(a.IconButton16,{})})})});Pe.displayName="ButtonToolbarButton";const ra=({editorId:t,id:e})=>{const n=a.useEditorState(a.useEventPlateId(t)),r=!!a.isRangeInSameBlock(n,{at:n.selection}),l=a.getPluginType(n,x),o=!!(n!=null&&n.selection)&&a.someNode(n,{match:{type:l}});return s.jsx("div",{"data-plugin-id":e,children:s.jsx(Pe,{pressed:o,disabled:!r,tooltip:a.getTooltip(r?`Button
2
- ${a.getHotkeyByPlatform("Ctrl+Shift+K")}`:"Buttons can only be set for a single text block.")})})},sa=()=>{const t=a.useEditorRef();return s.jsx(a.FloatingModalWrapper,{padding:"16px",minWidth:"400px","data-test-id":"floating-button-edit",children:s.jsxs("span",{"data-test-id":"preview-button-flyout",className:"tw-flex tw-justify-between tw-items-center",children:[s.jsx("span",{className:"tw-pointer-events-none",children:A.url()}),s.jsxs("span",{className:"tw-flex tw-gap-2",children:[s.jsx("button",{onClick:()=>{ht(t)},tabIndex:0,"data-test-id":"edit-button-button",className:"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1",children:s.jsx(a.IconPen16,{})}),s.jsx("button",{onClick:()=>{tt(t),a.focusEditor(t,t.selection??void 0)},tabIndex:0,"data-test-id":"remove-button-button",className:"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1",children:s.jsx(a.IconTrashBin16,{})})]})]})})},la=({section:t,selectedUrl:e,onSelectUrl:n})=>{const r=t.permanentLink===e;return s.jsx("button",{"data-test-id":"internal-link-selector-section-link",className:a.merge(["tw-py-2 tw-pr-2.5 tw-pl-14 tw-leading-5 tw-cursor-pointer tw-w-full",r?"tw-bg-box-selected-strong tw-text-box-selected-strong-inverse hover:tw-bg-box-selected-strong-hover:hover hover:tw-text-box-selected-strong-inverse-hover:hover":"hover:tw-bg-box-neutral-hover hover:tw-text-box-neutral-inverse-hover"]),onClick:()=>n(t.permanentLink),children:s.jsxs("div",{className:"tw-flex tw-flex-1 tw-space-x-2 tw-items-center tw-h-6",children:[s.jsx(a.IconDocumentText16,{}),s.jsx("span",{className:"tw-text-s",children:t.title}),s.jsx("span",{className:"tw-flex-auto tw-font-sans tw-text-xs tw-text-right",children:"Section"})]})})},ia=({page:t,selectedUrl:e,onSelectUrl:n,itemsToExpandInitially:r,getDocumentSectionsByDocumentPageId:l})=>{const[o,c]=w.useState(t.id===r.documentId),[g,d]=w.useState([]),y=t.permanentLink===e;w.useEffect(()=>{(async()=>{const b=await l(t.id);d(b)})()},[t.id,l]),w.useEffect(()=>{t.id===r.pageId&&c(!0)},[r,t.id]);const m=[...g.values()],h=m.length>0;return s.jsxs(s.Fragment,{children:[s.jsx("button",{"data-test-id":"internal-link-selector-page-link",className:a.merge(["tw-py-2 tw-pr-2.5 tw-leading-5 tw-cursor-pointer tw-flex tw-w-full",h?"tw-pl-7":"tw-pl-12",y?"tw-bg-box-selected-strong tw-text-box-selected-strong-inverse hover:tw-bg-box-selected-strong-hover:hover hover:tw-text-box-selected-strong-inverse-hover:hover":"hover:tw-bg-box-neutral-hover hover:tw-text-box-neutral-inverse-hover"]),onClick:()=>n(t.permanentLink),children:s.jsxs("div",{className:"tw-flex tw-flex-1 tw-space-x-1 tw-items-center tw-h-6",children:[h&&s.jsx("button",{"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:()=>c(!o),children:s.jsx("div",{className:a.merge(["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",o?"tw-rotate-90":""])})}),s.jsx("span",{className:"tw-text-s",children:t.title}),s.jsx("span",{className:"tw-flex-auto tw-font-sans tw-text-xs tw-text-right",children:"Page"})]},t.id)}),o&&m.length>0&&m.map(f=>s.jsx(la,{section:f,selectedUrl:e,onSelectUrl:n},f.id))]})},Ie=()=>s.jsx("div",{className:"tw-flex tw-justify-center tw-h-10 tw-items-center",children:s.jsx(a.LoadingCircle,{size:a.LoadingCircleSize.Small})}),oa=({documentId:t,selectedUrl:e,onSelectUrl:n,itemsToExpandInitially:r,getDocumentSectionsByDocumentPageId:l,getDocumentPagesByDocumentId:o})=>{const[c,g]=w.useState([]),[d,y]=w.useState(!0),m=[...c.values()],h=!d&&m.length>0;return w.useEffect(()=>{o(t).then(f=>{const b=f.filter(k=>!!k.category).sort((k,P)=>k.category.sort===P.category.sort?k.sort-P.sort:k.category.sort-P.category.sort),p=f.filter(k=>!k.category).sort((k,P)=>k.sort-P.sort);g([...b,...p])}).finally(()=>{y(!1)})},[]),d?s.jsx(Ie,{}):h?s.jsx(s.Fragment,{children:m.map(f=>s.jsx(ia,{page:f,selectedUrl:e,onSelectUrl:n,itemsToExpandInitially:r,getDocumentSectionsByDocumentPageId:l},f.id))}):s.jsx("div",{className:"tw-h-10 tw-flex tw-items-center tw-pr-2.5 tw-pl-7 tw-leading-5 tw-text-s tw-text-text-weak",children:"This document does not contain any pages."})},ca=({document:t,selectedUrl:e,onSelectUrl:n,itemsToExpandInitially:r,getDocumentSectionsByDocumentPageId:l,getDocumentPagesByDocumentId:o})=>{const[c,g]=w.useState(t.id===r.documentId),d=t.permanentLink===e;return w.useEffect(()=>{t.id===r.documentId&&g(!0)},[r,t.id]),s.jsxs(s.Fragment,{children:[s.jsxs("button",{"data-test-id":"internal-link-selector-document-link",className:a.merge(["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-box-selected-strong tw-text-box-selected-strong-inverse hover:tw-bg-box-selected-strong-hover:hover hover:tw-text-box-selected-strong-inverse-hover:hover":"hover:tw-bg-box-neutral-hover hover:tw-text-box-neutral-inverse-hover"]),onClick:()=>n(t.permanentLink),children:[s.jsx("button",{role:"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:()=>g(!c),children:s.jsx("div",{className:a.merge(["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":""])})}),s.jsx(a.IconColorFan16,{}),s.jsx("span",{className:"tw-text-s",children:t.title}),s.jsx("span",{className:"tw-flex-auto tw-font-sans tw-text-xs tw-text-right",children:"Document"})]}),c&&s.jsx(oa,{documentId:t.id,selectedUrl:e,onSelectUrl:n,itemsToExpandInitially:r,getDocumentSectionsByDocumentPageId:l,getDocumentPagesByDocumentId:o})]})},da=({selectedUrl:t,onSelectUrl:e,getAllDocuments:n,getDocumentPagesByDocumentId:r,getDocumentSectionsByDocumentPageId:l})=>{const[o,c]=w.useState(!0),[g,d]=w.useState([]),[y,m]=w.useState({documentId:void 0,pageId:void 0}),h=[...g.values()];w.useEffect(()=>{t&&h.length>0&&f().then(b=>{m(b)})},[h.length]),w.useEffect(()=>{n().then(b=>{d(b)}).finally(()=>{c(!1)})},[]);const f=async()=>{const b={documentId:void 0,pageId:void 0};if(h.find(k=>k.permanentLink===t))return b;for(const k of h){const B=[...(await r(k.id)).values()];if(!!B.find(D=>D.permanentLink===t))return b.documentId=k.id,b;for(const D of B)if(!![...(await l(D.id)).values()].find(M=>M.permanentLink===t))return b.documentId=k.id,b.pageId=D.id,b}return b};return o?s.jsx(Ie,{}):s.jsx(s.Fragment,{children:h.map(b=>s.jsx(ca,{document:b,selectedUrl:t,onSelectUrl:e,itemsToExpandInitially:y,getDocumentSectionsByDocumentPageId:l,getDocumentPagesByDocumentId:r},b.id))})},Ee=({url:t,onUrlChange:e,buttonSize:n=a.ButtonSize.Medium,getAllDocuments:r,getDocumentPagesByDocumentId:l,getDocumentSectionsByDocumentPageId:o})=>{const{open:c,isOpen:g,close:d}=wn.useOverlayTriggerState({}),[y,m]=w.useState(t),h=p=>{m(p)},f=p=>{p.key==="Enter"&&b()};w.useEffect(()=>{t&&!y&&m(t)},[t,y]);const b=()=>{e==null||e(y),d()};return s.jsxs("div",{onPointerDown:p=>p.preventDefault(),"data-test-id":"internal-link-selector",onKeyDown:f,children:[s.jsx(a.Button,{icon:s.jsx(a.IconLink,{}),size:n,type:a.ButtonType.Button,style:a.ButtonStyle.Default,emphasis:a.ButtonEmphasis.Default,onClick:()=>c(),children:"Internal link"}),s.jsxs(a.Modal,{zIndex:1001,onClose:()=>d(),isOpen:g,isDismissable:!0,children:[s.jsx(a.Modal.Header,{title:"Select internal link"}),s.jsx(a.Modal.Body,{children:s.jsx(da,{selectedUrl:y,onSelectUrl:h,getAllDocuments:r,getDocumentPagesByDocumentId:l,getDocumentSectionsByDocumentPageId:o})}),s.jsx(a.Modal.Footer,{buttons:[{children:"Cancel",onClick:()=>d(),style:a.ButtonStyle.Default,emphasis:a.ButtonEmphasis.Default},{children:"Choose",onClick:p=>{p==null||p.preventDefault(),b()},style:a.ButtonStyle.Default,emphasis:a.ButtonEmphasis.Strong,disabled:!y}]})]})]})},Be=({onUrlChange:t,onToggleTab:e,isValidUrlOrEmpty:n,appBridge:r,clearable:l,placeholder:o,newTab:c,openInNewTab:g,url:d="",required:y,info:m,label:h,buttonSize:f,hideInternalLinkButton:b})=>{const p=n?n(d):R(d),k=c??(g?a.CheckboxState.Checked:a.CheckboxState.Unchecked);return s.jsxs("div",{"data-test-id":"link-input",children:[s.jsx(a.FormControl,{label:{children:h,htmlFor:"url",required:y,tooltip:m?{content:m,position:a.TooltipPosition.Top}:void 0},children:s.jsx(a.TextInput,{id:"url",value:d,clearable:l,onChange:t,placeholder:o??"https://example.com",focusOnMount:!0})}),!p&&s.jsx("div",{className:"tw-text-text-negative tw-mt-1 tw-text-s",children:"Please enter a valid URL."}),!b&&s.jsx("div",{className:"tw-mt-3",children:s.jsx(Ee,{url:d,onUrlChange:t,buttonSize:f??a.ButtonSize.Medium,getAllDocuments:()=>r.getAllDocuments(),getDocumentPagesByDocumentId:P=>r.getDocumentPagesByDocumentId(P),getDocumentSectionsByDocumentPageId:P=>r.getDocumentSectionsByDocumentPageId(P)})}),s.jsx("div",{className:"tw-mt-3",children:s.jsx(a.Checkbox,{value:"new-tab",label:"Open in new tab",state:k,onChange:e})})]})},Ne=({state:t,onTextChange:e,onUrlChange:n,onToggleTab:r,onCancel:l,onSave:o,isValidUrlOrEmpty:c,hasValues:g,testId:d,appBridge:y,children:m})=>s.jsxs(a.FloatingModalWrapper,{"data-test-id":d,padding:"28px",minWidth:"400px",children:[s.jsx(a.FormControl,{label:{children:"Text",htmlFor:"linkText",required:!0},children:s.jsx(a.TextInput,{id:"linkText",value:t.text,placeholder:"Link Text",onChange:e})}),m,s.jsx("div",{className:"tw-mt-5",children:s.jsx(Be,{url:t.url,newTab:t.newTab,onUrlChange:n,onToggleTab:r,isValidUrlOrEmpty:c,appBridge:y})}),s.jsx("div",{className:"tw-mt-3",children:s.jsxs("div",{className:"tw-pt-5 tw-flex tw-gap-x-3 tw-justify-end tw-border-t tw-border-t-black-10",children:[s.jsx(a.Button,{onClick:l,size:a.ButtonSize.Medium,style:a.ButtonStyle.Default,emphasis:a.ButtonEmphasis.Default,children:"Cancel"}),s.jsx(a.Button,{onClick:o,size:a.ButtonSize.Medium,icon:s.jsx(a.IconCheckMark20,{}),disabled:!c(t==null?void 0:t.url)||!g,children:"Save"})]})})]}),ga=t=>{var n;const e=a.getAboveNode(t,{match:{type:x}});return Array.isArray(e)&&((n=e[0])==null?void 0:n.buttonStyle)||"primary"},ua={url:"",text:"",buttonStyle:"primary",newTab:a.CheckboxState.Unchecked},ha=()=>{const[t,e]=w.useReducer((n,r)=>{const{type:l,payload:o}=r;switch(l){case"NEW_TAB":return{...n,newTab:a.CheckboxState.Checked};case"SAME_TAB":return{...n,newTab:a.CheckboxState.Unchecked};case"URL":case"TEXT":case"BUTTON_STYLE":case"INIT":return{...n,...o};default:return n}},ua);return[t,e]},ma=()=>{const t=a.useEditorRef(),[e,n]=ha();w.useEffect(()=>{const h=ga(t);n({type:"INIT",payload:{text:A.text(),buttonStyle:h,newTab:A.newTab()?a.CheckboxState.Checked:a.CheckboxState.Unchecked,url:A.url()}})},[n,t]);const r=h=>{n({type:"TEXT",payload:{text:h}})},l=h=>{n({type:"BUTTON_STYLE",payload:{buttonStyle:h}})},o=h=>{n({type:"URL",payload:{url:h}})},c=h=>{n(h?{type:"NEW_TAB"}:{type:"SAME_TAB"})},g=()=>{I.reset()},d=h=>{if(!R(e.url)||!y)return;const f=gt(e.url);I.text(e.text),I.url(f),I.buttonStyle(e.buttonStyle),I.newTab(e.newTab===a.CheckboxState.Checked),Bt(t)&&(h==null||h.preventDefault())},y=e.url!==""&&e.text!=="",{appBridge:m}=a.getPluginOptions(t,x);return a.useHotkeys("enter",d,{enableOnFormTags:["INPUT"]},[]),{state:e,onTextChange:r,onButtonStyleChange:l,onUrlChange:o,onToggleTab:c,onCancel:g,onSave:d,hasValues:y,isValidUrlOrEmpty:R,appBridge:m}},wt="link-plugin";var v=(t=>(t.heading1="heading1",t.heading2="heading2",t.heading3="heading3",t.heading4="heading4",t.custom1="custom1",t.custom2="custom2",t.custom3="custom3",t.quote="quote",t.imageCaption="imageCaption",t.imageTitle="imageTitle",t.p="p",t))(v||{});const N={heading1:{fontSize:"var(--f-theme-settings-heading1-font-size)",lineHeight:"var(--f-theme-settings-heading1-line-height)",marginTop:"var(--f-theme-settings-heading1-margin-top)",marginBottom:"var(--f-theme-settings-heading1-margin-bottom)",textDecoration:"var(--f-theme-settings-heading1-text-decoration)",fontStyle:"var(--f-theme-settings-heading1-font-style)",textTransform:"var(--f-theme-settings-heading1-text-transform)",letterSpacing:"var(--f-theme-settings-heading1-letter-spacing)",fontWeight:"var(--f-theme-settings-heading1-font-weight)",fontFamily:"var(--f-theme-settings-heading1-font-family)",color:"var(--f-theme-settings-heading1-color)"},heading2:{fontSize:"var(--f-theme-settings-heading2-font-size)",lineHeight:"var(--f-theme-settings-heading2-line-height)",marginTop:"var(--f-theme-settings-heading2-margin-top)",marginBottom:"var(--f-theme-settings-heading2-margin-bottom)",textDecoration:"var(--f-theme-settings-heading2-text-decoration)",fontStyle:"var(--f-theme-settings-heading2-font-style)",textTransform:"var(--f-theme-settings-heading2-text-transform)",letterSpacing:"var(--f-theme-settings-heading2-letter-spacing)",fontWeight:"var(--f-theme-settings-heading2-font-weight)",fontFamily:"var(--f-theme-settings-heading2-font-family)",color:"var(--f-theme-settings-heading2-color)"},heading3:{fontSize:"var(--f-theme-settings-heading3-font-size)",lineHeight:"var(--f-theme-settings-heading3-line-height)",marginTop:"var(--f-theme-settings-heading3-margin-top)",marginBottom:"var(--f-theme-settings-heading3-margin-bottom)",textDecoration:"var(--f-theme-settings-heading3-text-decoration)",fontStyle:"var(--f-theme-settings-heading3-font-style)",textTransform:"var(--f-theme-settings-heading3-text-transform)",letterSpacing:"var(--f-theme-settings-heading3-letter-spacing)",fontWeight:"var(--f-theme-settings-heading3-font-weight)",fontFamily:"var(--f-theme-settings-heading3-font-family)",color:"var(--f-theme-settings-heading3-color)"},heading4:{fontSize:"var(--f-theme-settings-heading4-font-size)",lineHeight:"var(--f-theme-settings-heading4-line-height)",marginTop:"var(--f-theme-settings-heading4-margin-top)",marginBottom:"var(--f-theme-settings-heading4-margin-bottom)",textDecoration:"var(--f-theme-settings-heading4-text-decoration)",fontStyle:"var(--f-theme-settings-heading4-font-style)",textTransform:"var(--f-theme-settings-heading4-text-transform)",letterSpacing:"var(--f-theme-settings-heading4-letter-spacing)",fontWeight:"var(--f-theme-settings-heading4-font-weight)",fontFamily:"var(--f-theme-settings-heading4-font-family)",color:"var(--f-theme-settings-heading4-color)"},custom1:{fontSize:"var(--f-theme-settings-custom1-font-size)",lineHeight:"var(--f-theme-settings-custom1-line-height)",marginTop:"var(--f-theme-settings-custom1-margin-top)",marginBottom:"var(--f-theme-settings-custom1-margin-bottom)",textDecoration:"var(--f-theme-settings-custom1-text-decoration)",fontStyle:"var(--f-theme-settings-custom1-font-style)",textTransform:"var(--f-theme-settings-custom1-text-transform)",letterSpacing:"var(--f-theme-settings-custom1-letter-spacing)",fontWeight:"var(--f-theme-settings-custom1-font-weight)",fontFamily:"var(--f-theme-settings-custom1-font-family)",color:"var(--f-theme-settings-custom1-color)"},custom2:{fontSize:"var(--f-theme-settings-custom2-font-size)",lineHeight:"var(--f-theme-settings-custom2-line-height)",marginTop:"var(--f-theme-settings-custom2-margin-top)",marginBottom:"var(--f-theme-settings-custom2-margin-bottom)",textDecoration:"var(--f-theme-settings-custom2-text-decoration)",fontStyle:"var(--f-theme-settings-custom2-font-style)",textTransform:"var(--f-theme-settings-custom2-text-transform)",letterSpacing:"var(--f-theme-settings-custom2-letter-spacing)",fontWeight:"var(--f-theme-settings-custom2-font-weight)",fontFamily:"var(--f-theme-settings-custom2-font-family)",color:"var(--f-theme-settings-custom2-color)"},custom3:{fontSize:"var(--f-theme-settings-custom3-font-size)",lineHeight:"var(--f-theme-settings-custom3-line-height)",marginTop:"var(--f-theme-settings-custom3-margin-top)",marginBottom:"var(--f-theme-settings-custom3-margin-bottom)",textDecoration:"var(--f-theme-settings-custom3-text-decoration)",fontStyle:"var(--f-theme-settings-custom3-font-style)",textTransform:"var(--f-theme-settings-custom3-text-transform)",letterSpacing:"var(--f-theme-settings-custom3-letter-spacing)",fontWeight:"var(--f-theme-settings-custom3-font-weight)",fontFamily:"var(--f-theme-settings-custom3-font-family)",color:"var(--f-theme-settings-custom3-color)"},p:{fontSize:"var(--f-theme-settings-body-font-size)",lineHeight:"var(--f-theme-settings-body-line-height)",marginTop:"var(--f-theme-settings-body-margin-top)",marginBottom:"var(--f-theme-settings-body-margin-bottom)",textDecoration:"var(--f-theme-settings-body-text-decoration)",fontStyle:"var(--f-theme-settings-body-font-style)",textTransform:"var(--f-theme-settings-body-text-transform)",letterSpacing:"var(--f-theme-settings-body-letter-spacing)",fontWeight:"var(--f-theme-settings-body-font-weight)",fontFamily:"var(--f-theme-settings-body-font-family)",color:"var(--f-theme-settings-body-color)"},quote:{fontSize:"var(--f-theme-settings-quote-font-size)",lineHeight:"var(--f-theme-settings-quote-line-height)",marginTop:"var(--f-theme-settings-quote-margin-top)",marginBottom:"var(--f-theme-settings-quote-margin-bottom)",textDecoration:"var(--f-theme-settings-quote-text-decoration)",fontStyle:"var(--f-theme-settings-quote-font-style)",textTransform:"var(--f-theme-settings-quote-text-transform)",letterSpacing:"var(--f-theme-settings-quote-letter-spacing)",fontWeight:"var(--f-theme-settings-quote-font-weight)",fontFamily:"var(--f-theme-settings-quote-font-family)",color:"var(--f-theme-settings-quote-color)"},imageCaption:{fontSize:"var(--f-theme-settings-image-caption-font-size)",lineHeight:"var(--f-theme-settings-image-caption-line-height)",marginTop:"var(--f-theme-settings-image-caption-margin-top)",marginBottom:"var(--f-theme-settings-image-caption-margin-bottom)",textDecoration:"var(--f-theme-settings-image-caption-text-decoration)",fontStyle:"var(--f-theme-settings-image-caption-font-style)",textTransform:"var(--f-theme-settings-image-caption-text-transform)",letterSpacing:"var(--f-theme-settings-image-caption-letter-spacing)",fontWeight:"var(--f-theme-settings-image-caption-font-weight)",fontFamily:"var(--f-theme-settings-image-caption-font-family)",color:"var(--f-theme-settings-image-caption-color)"},imageTitle:{fontSize:"var(--f-theme-settings-image-title-font-size)",lineHeight:"var(--f-theme-settings-image-title-line-height)",marginTop:"var(--f-theme-settings-image-title-margin-top)",marginBottom:"var(--f-theme-settings-image-title-margin-bottom)",textDecoration:"var(--f-theme-settings-image-title-text-decoration)",fontStyle:"var(--f-theme-settings-image-title-font-style)",textTransform:"var(--f-theme-settings-image-title-text-transform)",letterSpacing:"var(--f-theme-settings-image-title-letter-spacing)",fontWeight:"var(--f-theme-settings-image-title-font-weight)",fontFamily:"var(--f-theme-settings-image-title-font-family)",color:"var(--f-theme-settings-image-title-color)"},[wt]:{fontSize:"var(--f-theme-settings-link-font-size)",lineHeight:"var(--f-theme-settings-link-line-height)",marginTop:"var(--f-theme-settings-link-margin-top)",marginBottom:"var(--f-theme-settings-link-margin-bottom)",textDecoration:"var(--f-theme-settings-link-text-decoration)",fontStyle:"var(--f-theme-settings-link-font-style)",textTransform:"var(--f-theme-settings-link-text-transform)",letterSpacing:"var(--f-theme-settings-link-letter-spacing)",fontWeight:"var(--f-theme-settings-link-font-weight)",fontFamily:"var(--f-theme-settings-link-font-family)",color:"var(--f-theme-settings-link-color)"},...mt},wa=()=>{const t=ma(),{state:e,onButtonStyleChange:n}=t;return s.jsx(Ne,{...t,testId:"floating-button-insert",children:s.jsx("div",{className:"tw-pt-5",children:s.jsxs(a.FormControl,{label:{children:"Button Style",htmlFor:"buttonStyle",required:!0},children:[s.jsx(At,{id:"primary",styles:N.buttonPrimary,isActive:e.buttonStyle==="primary",onClick:()=>n("primary"),children:e.text||"Primary Button"}),s.jsx(At,{id:"secondary",styles:N.buttonSecondary,isActive:e.buttonStyle==="secondary",onClick:()=>n("secondary"),children:e.text||"Secondary Button"}),s.jsx(At,{id:"tertiary",styles:N.buttonTertiary,isActive:e.buttonStyle==="tertiary",onClick:()=>n("tertiary"),children:e.text||"Tertiary Button"})]})})})},At=({id:t,styles:e,isActive:n,onClick:r,children:l})=>{const[o,c]=w.useState(!1),g=()=>e&&e.hover&&o?{...e,...e.hover}:e;return s.jsx("button",{"data-test-id":`floating-button-insert-${t}`,onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),onClick:r,style:{...g(),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:l})},Le={placement:"bottom-start",strategy:"absolute",middleware:[a.offset(12),a.flip({padding:12,fallbackPlacements:["bottom-end","top-start","top-end"]})]},ya=()=>{const{ref:t,...e}=pa(Le),{ref:n,...r}=fa(Le),l=a.useEditorRef(),o=it(),c=o.isOpen(l.id),g=o.isEditing(),d=o.mode(),y=s.jsx(wa,{}),m=g?y:s.jsx(sa,{});return s.jsxs(s.Fragment,{children:[c&&d==="insert"&&s.jsx("div",{ref:t,...e,children:y}),c&&d==="edit"&&s.jsx("div",{ref:n,...r,children:m})]})},x="button",Ae="button-plugin",Me=t=>a.createPluginFactory({key:x,isElement:!0,isInline:!0,props:({element:e})=>({nodeProps:{href:e==null?void 0:e.url,target:e==null?void 0:e.target}}),withOverrides:pe,renderAfterEditable:ya,options:{isUrl:ut,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:r=>({type:n,url:r.getAttribute("href"),target:r.getAttribute("target")||"_blank"})}})})();class Fe extends a.Plugin{constructor({styles:n=mt,...r}){super(Ae,{button:ra,markupElement:new aa,...r});L(this,"styles",{});L(this,"appBridge");this.styles=n,this.appBridge=r==null?void 0:r.appBridge}plugins(){return[Me(this.appBridge)]}}const fa=t=>{const e=a.useEditorRef(),n=it().mode(),r=it().isOpen(e.id),l=a.useEditorVersion(),{triggerFloatingButtonHotkeys:o}=a.getPluginOptions(e,x),c=w.useCallback(()=>{const h=a.getAboveNode(e,{match:{type:a.getPluginType(e,x)}});if(h){const[,f]=h;return a.getRangeBoundingClientRect(e,{anchor:a.getStartPoint(e,f),focus:a.getEndPoint(e,f)})}return a.getDefaultBoundingClientRect()},[e]),g=r&&n==="edit",{update:d,style:y,floating:m}=Oe({open:g,getBoundingClientRect:c,...t});return w.useEffect(()=>{const h=xe(e);if(h&&I.url(h),e.selection&&a.someNode(e,{match:{type:a.getPluginType(e,x)}})){I.show("edit",e.id),d();return}A.mode()==="edit"&&I.reset()},[e,l,d]),a.useHotkeys(o,h=>{h.preventDefault(),A.mode()==="edit"&&ht(e)},{enableOnContentEditable:!0},[]),ba(),De(),{style:{...y,zIndex:1e3},ref:a.useComposedRef(m)}},ba=()=>{const t=a.useEditorRef();a.useHotkeys("*",e=>{e.key==="Enter"&&Bt(t)&&e.preventDefault()},{enableOnFormTags:["INPUT"]},[])},De=()=>{const t=a.useEditorRef();a.useHotkeys("escape",()=>{if(A.mode()==="edit"){if(A.isEditing()){I.show("edit",t.id),a.focusEditor(t,t.selection??void 0);return}I.reset()}},{enableOnFormTags:["INPUT"],enableOnContentEditable:!0},[])},pa=t=>{const e=a.useEditorRef(),n=a.useFocused(),r=it().mode(),l=it().isOpen(e.id),{triggerFloatingButtonHotkeys:o}=a.getPluginOptions(e,x);a.useHotkeys(o,y=>{y.preventDefault(),Lt(e,{focused:n})},{enableOnContentEditable:!0},[n]);const{update:c,style:g,floating:d}=Oe({open:l&&r==="insert",getBoundingClientRect:a.getSelectionBoundingClientRect,whileElementsMounted:void 0,...t});return w.useEffect(()=>{l&&c(),I.updated(l)},[l,c]),De(),{style:{...g,zIndex:1e3},ref:a.useComposedRef(d)}},va=12,Ca=-22,ka=96,Oe=t=>a.useVirtualFloating({placement:"bottom-start",middleware:[a.offset({mainAxis:va,alignmentAxis:Ca}),a.flip({padding:ka})],...t}),xa=({id:t="rte",isEditing:e,value:n,columns:r,gap:l,placeholder:o,plugins:c,onTextChange:g,showSerializedText:d})=>{const[y,m]=w.useState(!1),h=w.useCallback(p=>{g&&p!==n&&g(p),m(!1)},[g,n]),f=w.useCallback(()=>m(!0),[]),b=w.useCallback(p=>{A.isOpen(p)&&I.reset()},[]);return w.useEffect(()=>{const p=k=>(k.preventDefault(),k.returnValue="Unprocessed changes");return y&&window.addEventListener("beforeunload",p),()=>window.removeEventListener("beforeunload",p)},[y]),e?s.jsx(a.RichTextEditor,{id:t,value:n,border:!1,placeholder:o,plugins:c,onValueChanged:f,onTextChange:h,hideExternalFloatingModals:b}):s.jsx($n,{value:n,columns:r,gap:l,show:d,plugins:c})},Sa=({editButtonProps:t,unlinkButtonProps:e})=>{const{element:n}=a.useLinkOpenButtonState(),r=n?It(n):"";return s.jsx(a.FloatingModalWrapper,{"data-test-id":"floating-link-edit",padding:"16px",minWidth:"400px",children:s.jsxs("span",{"data-test-id":"preview-link-flyout",className:"tw-flex tw-justify-between tw-items-center",children:[s.jsx("span",{className:"tw-pointer-events-none",children:r}),s.jsxs("span",{className:"tw-flex tw-gap-2",children:[s.jsx("button",{tabIndex:0,"data-test-id":"edit-link-button",className:"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1",...t,children:s.jsx(a.IconPen16,{})}),s.jsx("button",{tabIndex:0,"data-test-id":"remove-link-button",className:"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1",...e,children:s.jsx(a.IconTrashBin16,{})})]})]})})},Ue=(t,e)=>{const n=a.getAboveNode(t,{match:{type:a.ELEMENT_LINK}});return Array.isArray(n)?e(n[0]):""},Ta=t=>Ue(t,e=>{var n,r;return((r=(n=e.chosenLink)==null?void 0:n.searchResult)==null?void 0:r.link)||""}),Pa=t=>Ue(t,e=>e.url||""),Ia={url:"",text:"",newTab:a.CheckboxState.Unchecked},Ea=()=>{const[t,e]=w.useReducer((n,r)=>{const{type:l,payload:o}=r;switch(l){case"NEW_TAB":return{...n,newTab:a.CheckboxState.Checked};case"SAME_TAB":return{...n,newTab:a.CheckboxState.Unchecked};case"URL":case"TEXT":case"INIT":return{...n,...o};default:return n}},Ia);return[t,e]},Ba=()=>{const t=a.useEditorRef(),[e,n]=Ea();w.useEffect(()=>{const m=Ta(t),h=Pa(t),f=a.floatingLinkSelectors.newTab();n({type:"INIT",payload:{text:a.floatingLinkSelectors.text(),newTab:f?a.CheckboxState.Checked:a.CheckboxState.Unchecked,url:m&&h===""?m:a.floatingLinkSelectors.url()}})},[n,t]);const r=m=>{n({type:"TEXT",payload:{text:m}})},l=m=>{n({type:"URL",payload:{url:m}})},o=m=>{n(m?{type:"NEW_TAB"}:{type:"SAME_TAB"})},c=()=>{a.floatingLinkActions.reset()},g=m=>{!R(e.url)||!d||(a.floatingLinkActions.text(e.text),a.floatingLinkActions.url(gt(e.url)),a.floatingLinkActions.newTab(e.newTab===a.CheckboxState.Checked),a.submitFloatingLink(t)&&(m==null||m.preventDefault()))},d=e.url!==""&&e.text!=="",{appBridge:y}=a.getPluginOptions(t,a.ELEMENT_LINK);return a.useHotkeys("enter",g,{enableOnFormTags:["INPUT"]},[]),{state:e,onTextChange:r,onUrlChange:l,onToggleTab:o,onCancel:c,onSave:g,hasValues:d,isValidUrlOrEmpty:R,appBridge:y}},Na=()=>s.jsx(Ne,{...Ba(),testId:"floating-link-insert"}),_e={placement:"bottom-start",strategy:"absolute",middleware:[a.offset(12),a.flip({padding:12,fallbackPlacements:["bottom-end","top-start","top-end"]})]},La=()=>{const t=a.useFloatingLinkInsertState({floatingOptions:_e}),{props:e,ref:n,hidden:r}=a.useFloatingLinkInsert(t),l=a.useFloatingLinkEditState({floatingOptions:_e}),{props:o,ref:c,editButtonProps:g,unlinkButtonProps:d}=a.useFloatingLinkEdit(l);if(r)return null;const y=s.jsx(Na,{}),m=l.isEditing?y:s.jsx(Sa,{editButtonProps:g,unlinkButtonProps:d});return s.jsxs(s.Fragment,{children:[t.isOpen&&!l.isOpen&&s.jsx("div",{ref:n,...e,style:{...e.style,zIndex:1e3},children:y}),l.isOpen&&s.jsx("div",{ref:c,...o,style:{...o.style,zIndex:1e3},children:m})]})},He=w.forwardRef((t,e)=>{const n=a.useEditorRef(),r=a.useLinkToolbarButtonState(),{props:l}=a.useLinkToolbarButton(r);return s.jsx(a.ToolbarButton,{onMouseDown:()=>{a.focusEditor(n,n.selection??n.prevSelection??void 0)},ref:e,...l,...t,children:s.jsx(a.IconStylingWrapper,{icon:s.jsx(a.IconLink16,{})})})});He.displayName="LinkToolbarButton";const Aa=({id:t,editorId:e})=>{const n=a.useEditorState(a.useEventPlateId(e)),r=!!a.isRangeInSameBlock(n,{at:n.selection});return s.jsx("div",{"data-plugin-id":t,children:s.jsx(He,{disabled:!r,tooltip:a.getTooltip(r?`Link
3
- ${a.getHotkeyByPlatform("Ctrl+K")}`:"Links can only be set for a single text block.")})})},Ma=t=>{var c,g;const{attributes:e,children:n}=t,{styles:r}=a.useRichTextEditorContext(),l=t.element.url||((g=(c=t.element.chosenLink)==null?void 0:c.searchResult)==null?void 0:g.link)||"",o=t.element.target||"_self";return s.jsx("a",{...e,href:l,target:o,style:r[wt],children:n})};class Fa extends a.MarkupElement{constructor(e=a.ELEMENT_LINK,n=Ma){super(e,n)}}const Ve=t=>a.createPluginFactory({...a.createLinkPlugin(),renderAfterEditable:La,options:{isUrl:ut,rangeBeforeOptions:{matchString:" ",skipInvalid:!0,afterMatch:!0},triggerFloatingLinkHotkeys:"meta+k, ctrl+k",keepSelectedTextOnPaste:!0,appBridge:t}})();class ze extends a.Plugin{constructor({styles:n=N[wt],...r}){super(wt,{button:Aa,markupElement:new Fa,...r});L(this,"styles",{});L(this,"appBridge");this.styles=n,this.appBridge=r.appBridge}plugins(){return[Ve(this.appBridge)]}}const Da="textstyle-custom1-plugin";class $e extends a.Plugin{constructor({styles:n=N.custom1,...r}={}){super(v.custom1,{label:"Custom 1",markupElement:new Oa,...r});L(this,"styles",{});this.styles=n}plugins(){return[Ua(this.styles)]}}class Oa extends a.MarkupElement{constructor(e=Da,n=We){super(e,n)}}const We=({element:t,attributes:e,children:n,styles:r})=>{const l=t.align;return s.jsx("p",{...e,style:r,className:a.merge([l&&a.alignmentClassnames[l],a.getColumnBreakClasses(t)]),children:n})},Ua=t=>a.createPluginFactory({key:v.custom1,isElement:!0,deserializeHtml:{rules:[{validClassName:v.custom1}]}})({component:e=>s.jsx(We,{...e,styles:t})}),_a="textstyle-custom2-plugin";class qe extends a.Plugin{constructor({styles:n=N.custom2,...r}={}){super(v.custom2,{label:"Custom 2",markupElement:new Ha,...r});L(this,"styles",{});this.styles=n}plugins(){return[Va(this.styles)]}}class Ha extends a.MarkupElement{constructor(e=_a,n=Ge){super(e,n)}}const Ge=({element:t,attributes:e,children:n,styles:r})=>{const l=t.align;return s.jsx("p",{...e,className:a.merge([l&&a.alignmentClassnames[l],a.getColumnBreakClasses(t)]),style:r,children:n})},Va=t=>a.createPluginFactory({key:v.custom2,isElement:!0,deserializeHtml:{rules:[{validClassName:v.custom2}]}})({component:e=>s.jsx(Ge,{...e,styles:t})}),za="textstyle-custom3-plugin";class je extends a.Plugin{constructor({styles:n=N.custom3,...r}={}){super(a.TextStyles.custom3,{label:"Custom 3",markupElement:new $a,...r});L(this,"styles",{});this.styles=n}plugins(){return[Wa(this.styles)]}}class $a extends a.MarkupElement{constructor(e=za,n=Ke){super(e,n)}}const Ke=({element:t,attributes:e,children:n,styles:r})=>{const l=t.align;return s.jsx("p",{...e,className:a.merge([l&&a.alignmentClassnames[l],a.getColumnBreakClasses(t)]),style:r,children:n})},Wa=t=>a.createPluginFactory({key:a.TextStyles.custom3,isElement:!0,deserializeHtml:{rules:[{validClassName:a.TextStyles.custom3}]}})({component:e=>s.jsx(Ke,{...e,styles:t})}),qa="textstyle-heading1-plugin";class Xe extends a.Plugin{constructor({styles:n=N.heading1,...r}={}){super(v.heading1,{label:"Heading 1",markupElement:new Ga,...r});L(this,"styles",{});this.styles=n}plugins(){return[ja(this.styles)]}}class Ga extends a.MarkupElement{constructor(e=qa,n=Mt){super(e,n)}}const Mt=({element:t,attributes:e,children:n,styles:r})=>{const l=t.align;return s.jsx("h1",{...e,className:a.merge([l&&a.alignmentClassnames[l],a.getColumnBreakClasses(t)]),style:r,children:n})},ja=t=>a.createPluginFactory({key:v.heading1,isElement:!0,component:Mt,deserializeHtml:{rules:[{validNodeName:["h1","H1"]}]}})({component:e=>s.jsx(Mt,{...e,styles:t})}),Ka="textstyle-heading2-plugin";class Qe extends a.Plugin{constructor({styles:n=N.heading2,...r}={}){super(v.heading2,{label:"Heading 2",markupElement:new Xa,...r});L(this,"styles",{});this.styles=n}plugins(){return[Qa(this.styles)]}}class Xa extends a.MarkupElement{constructor(e=Ka,n=Ft){super(e,n)}}const Ft=({element:t,attributes:e,children:n,styles:r})=>{const l=t.align;return s.jsx("h2",{...e,className:a.merge([l&&a.alignmentClassnames[l],a.getColumnBreakClasses(t)]),style:r,children:n})},Qa=t=>a.createPluginFactory({key:v.heading2,isElement:!0,component:Ft,deserializeHtml:{rules:[{validNodeName:["h2","H2"]}]}})({component:e=>s.jsx(Ft,{...e,styles:t})}),Ya="textstyle-heading3-plugin";class Ye extends a.Plugin{constructor({styles:n=N.heading3,...r}={}){super(v.heading3,{label:"Heading 3",markupElement:new Ja,...r});L(this,"styles",{});this.styles=n}plugins(){return[Za(this.styles)]}}class Ja extends a.MarkupElement{constructor(e=Ya,n=Dt){super(e,n)}}const Dt=({element:t,attributes:e,children:n,styles:r})=>{const l=t.align;return s.jsx("h3",{...e,className:a.merge([l&&a.alignmentClassnames[l],a.getColumnBreakClasses(t)]),style:r,children:n})},Za=t=>a.createPluginFactory({key:v.heading3,isElement:!0,component:Dt,deserializeHtml:{rules:[{validNodeName:["h3","H3"]}]}})({component:e=>s.jsx(Dt,{...e,styles:t})}),Ra="textstyle-heading4-plugin";class Je extends a.Plugin{constructor({styles:n=N.heading4,...r}={}){super(v.heading4,{label:"Heading 4",markupElement:new tr,...r});L(this,"styles",{});this.styles=n}plugins(){return[er(this.styles)]}}class tr extends a.MarkupElement{constructor(e=Ra,n=Ot){super(e,n)}}const Ot=({element:t,attributes:e,children:n,styles:r})=>{const l=t.align;return s.jsx("h4",{...e,className:a.merge([l&&a.alignmentClassnames[l],a.getColumnBreakClasses(t)]),style:r,children:n})},er=t=>a.createPluginFactory({key:v.heading4,isElement:!0,component:Ot,deserializeHtml:{rules:[{validNodeName:["h4","H4"]}]}})({component:e=>s.jsx(Ot,{...e,styles:t})}),nr="textstyle-imageCaption-plugin";class Ze extends a.Plugin{constructor({styles:n=N.imageCaption,...r}={}){super(v.imageCaption,{label:"Image Caption",markupElement:new ar,...r});L(this,"styles",{});this.styles=n}plugins(){return[rr(this.styles)]}}class ar extends a.MarkupElement{constructor(e=nr,n=Ut){super(e,n)}}const Ut=({element:t,attributes:e,children:n,styles:r})=>{const l=t.align;return s.jsx("p",{...e,className:a.merge([l&&a.alignmentClassnames[l],a.getColumnBreakClasses(t)]),style:r,children:n})},rr=t=>a.createPluginFactory({key:v.imageCaption,isElement:!0,component:Ut,deserializeHtml:{rules:[{validClassName:v.imageCaption}]}})({component:e=>s.jsx(Ut,{...e,styles:t})}),sr="textstyle-imageTitle-plugin";class Re extends a.Plugin{constructor({styles:n=N.imageTitle,...r}={}){super(v.imageTitle,{label:"Image Title",markupElement:new lr,...r});L(this,"styles",{});this.styles=n}plugins(){return[ir(this.styles)]}}class lr extends a.MarkupElement{constructor(e=sr,n=_t){super(e,n)}}const _t=({element:t,attributes:e,children:n,styles:r})=>{const l=t.align;return s.jsx("p",{...e,className:a.merge([l&&a.alignmentClassnames[l],a.getColumnBreakClasses(t)]),style:r,children:n})},ir=t=>a.createPluginFactory({key:v.imageTitle,isElement:!0,component:_t,deserializeHtml:{rules:[{validClassName:v.imageTitle}]}})({component:e=>s.jsx(_t,{...e,styles:t})});class tn extends a.Plugin{constructor({styles:n=N.p,...r}={}){super(v.p,{markupElement:new nn,label:"Body Text",...r});L(this,"styles",{});this.styles=n}plugins(){return[an(this.styles)]}}const en="tw-m-0 tw-px-0 tw-py-0",yt=({element:t,attributes:e,children:n,styles:r})=>{const l=t.align,o=a.merge([l&&a.alignmentClassnames[l],en,a.getColumnBreakClasses(t)]);return s.jsx("p",{...e,className:o,style:r,children:n})};class nn extends a.MarkupElement{constructor(e=v.p,n=yt){super(e,n)}}const an=t=>a.createPluginFactory({...a.createParagraphPlugin(),key:v.p,isElement:!0,component:yt})({component:e=>s.jsx(yt,{...e,styles:t})}),or="textstyle-quote-plugin";class rn extends a.Plugin{constructor({styles:n=N.quote,...r}={}){super(v.quote,{label:"Quote",markupElement:new cr,...r});L(this,"styles",{});this.styles=n}plugins(){return[sn(this.styles)]}}class cr extends a.MarkupElement{constructor(e=or,n=ft){super(e,n)}}const ft=({element:t,attributes:e,children:n,styles:r})=>{const l=t.align;return s.jsx("blockquote",{...e,className:a.merge([l&&a.alignmentClassnames[l],a.getColumnBreakClasses(t)]),style:r,children:n})},sn=t=>a.createPluginFactory({key:v.quote,isElement:!0,component:ft,deserializeHtml:{rules:[{validNodeName:["blockquote","BLOCKQUOTE"]}]}})({component:e=>s.jsx(ft,{...e,styles:t})}),Ht=[new Xe,new Qe,new Ye,new Je,new $e,new qe,new je,new rn,new tn],et=[v.heading1,v.heading2,v.heading3,v.heading4,v.custom1,v.custom2,v.custom3,v.quote,v.p],dr=[...Ht,new Ze,new Re],gr=[...et,v.imageCaption,v.imageTitle],ur=t=>new a.PluginComposer().setPlugin(new a.SoftBreakPlugin,new a.TextStylePlugin({textStyles:Ht})).setPlugin([new a.BoldPlugin,new a.ItalicPlugin,new a.UnderlinePlugin,new a.StrikethroughPlugin,new ze({appBridge:t}),new Fe({appBridge:t}),new a.CodePlugin],[new a.AlignLeftPlugin({validTypes:et}),new a.AlignCenterPlugin({validTypes:et}),new a.AlignRightPlugin({validTypes:et}),new a.AlignJustifyPlugin({validTypes:et}),new a.UnorderedListPlugin,new a.CheckboxListPlugin,new a.OrderedListPlugin,new a.ResetFormattingPlugin,new a.AutoformatPlugin]),hr="--f-theme-settings-",mr=t=>{const e=t!=null&&t.id?`hasBackground${t.id}`:"hasBackground",n=t!=null&&t.id?`backgroundColor${t.id}`:"backgroundColor",r=t!=null&&t.preventDefaultColor?void 0:(t==null?void 0:t.defaultColor)||Pn,l=t!=null&&t.label?t.label:"Background",o=t!=null&&t.switchLabel?t.switchLabel:void 0;return{id:e,label:l,type:"switch",switchLabel:o,defaultValue:!!(t!=null&&t.defaultValue),on:[{id:n,defaultValue:r,type:"colorInput"}]}},wr=t=>{const e=t!=null&&t.id?`hasBorder_${t.id}`:"hasBorder",n=t!=null&&t.id?`borderSelection_${t.id}`:"borderSelection",r=t!=null&&t.id?`borderStyle_${t.id}`:"borderStyle",l=t!=null&&t.id?`borderWidth_${t.id}`:"borderWidth",o=t!=null&&t.id?`borderColor_${t.id}`:"borderColor",c=(t==null?void 0:t.defaultColor)||Yt,g=t!=null&&t.switchLabel?t.switchLabel:void 0;return{id:e,label:"Border",type:"switch",switchLabel:g,defaultValue:!!(t!=null&&t.defaultValue),on:[{id:n,type:"multiInput",onChange:d=>u.appendUnit(d,l),layout:u.MultiInputLayout.Columns,lastItemFullWidth:!0,blocks:[{id:r,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:l,type:"input",defaultValue:In,rules:[u.numericalOrPixelRule,u.maximumNumericalOrPixelOrAutoRule(500)],placeholder:"e.g. 3px"},{id:o,type:"colorInput",defaultValue:c}]}],off:[]}},Vt=(t,e=$.None)=>({id:t,type:"segmentedControls",defaultValue:e,choices:[{value:$.None,label:"None"},{value:$.Small,label:"S"},{value:$.Medium,label:"M"},{value:$.Large,label:"L"}]}),yr=t=>{const e=t!=null&&t.id?`hasRadius_${t.id}`:"hasRadius",n=t!=null&&t.id?`radiusValue_${t.id}`:"radiusValue",r=t!=null&&t.id?`radiusChoice_${t.id}`:"radiusChoice",l=(t==null?void 0:t.defaultRadius)||$.None;return{id:e,label:"Corner radius",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"Determining how rounded the corners are.",show:o=>{var c;return t!=null&&t.dependentSettingId?!!((c=o.getBlock(t.dependentSettingId))!=null&&c.value):!0},onChange:o=>u.presetCustomValue(o,r,n,(t==null?void 0:t.radiusStyleMap)||G),on:[{id:n,type:"input",placeholder:"e.g. 10px",rules:[u.numericalOrPixelRule],onChange:o=>u.appendUnit(o,n)}],off:[Vt(r,l)]}},fr=t=>{const e=t!=null&&t.id?`hasExtendedCustomRadius_${t.id}`:"hasExtendedCustomRadius",n=t!=null&&t.id?`extendedRadiusValue_${t.id}`:"extendedRadiusValue",r=t!=null&&t.id?`extendedRadiusChoice_${t.id}`:"extendedRadiusChoice",l=t!=null&&t.id?`extendedRadiusTopLeft_${t.id}`:"extendedRadiusTopLeft",o=t!=null&&t.id?`extendedRadiusTopRight_${t.id}`:"extendedRadiusTopRight",c=t!=null&&t.id?`extendedRadiusBottomLeft_${t.id}`:"extendedRadiusBottomLeft",g=t!=null&&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=>{var y;return t!=null&&t.dependentSettingId?!!((y=d.getBlock(t.dependentSettingId))!=null&&y.value):!0},onChange:d=>{u.presetCustomValue(d,r,l,G),u.presetCustomValue(d,r,o,G),u.presetCustomValue(d,r,c,G),u.presetCustomValue(d,r,g,G)},on:[{id:n,type:"multiInput",layout:u.MultiInputLayout.Columns,blocks:[{id:l,type:"input",label:"Top Left",rules:[u.numericalOrPixelRule],onChange:d=>u.appendUnit(d,l)},{id:o,type:"input",label:"Top Right",rules:[u.numericalOrPixelRule],onChange:d=>u.appendUnit(d,o)},{id:c,type:"input",label:"Bottom Left",rules:[u.numericalOrPixelRule],onChange:d=>u.appendUnit(d,c)},{id:g,type:"input",label:"Bottom Right",rules:[u.numericalOrPixelRule],onChange:d=>u.appendUnit(d,g)}]}],off:[Vt(r,t==null?void 0:t.defaultValue)]}},br=t=>{const e=t!=null&&t.id?t.id:"hasCustomSpacing",n=t!=null&&t.dependentSettingId?t.dependentSettingId:"columns",r=t!=null&&t.spacingChoiceId?t.spacingChoiceId:"spacingChoice",l=t!=null&&t.spacingCustomId?t.spacingCustomId:"spacingCustom",o=t!=null&&t.defaultValueChoices?t.defaultValueChoices:Q.M;return{id:e,type:"switch",defaultValue:!1,switchLabel:"Custom",label:"Gutter",info:"An official nerds term for ‘gap’",onChange:c=>u.presetCustomValue(c,r,l,Qt),show:c=>{var g;return((g=c.getBlock(n))==null?void 0:g.value)!=="1"},on:[{id:l,type:"input",rules:[u.numericalOrPixelRule],onChange:c=>u.appendUnit(c,l)}],off:[{id:r,type:"slider",defaultValue:o,choices:[{value:Q.Auto,label:"Auto"},{value:Q.S,label:"S"},{value:Q.M,label:"M"},{value:Q.L,label:"L"}]}]}},zt=t=>({id:t,type:"segmentedControls",defaultValue:K.None,choices:[{value:K.None,label:"None"},{value:K.Small,label:"S"},{value:K.Medium,label:"M"},{value:K.Large,label:"L"}]}),pr=t=>{const e=t!=null&&t.id?`hasCustomMarginValue_${t==null?void 0:t.id}`:"hasCustomMarginValue",n=t!=null&&t.id?`marginValue_${t==null?void 0:t.id}`:"marginValue",r=t!=null&&t.id?`marginChoice_${t==null?void 0: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:l=>u.presetCustomValue(l,r,n,(t==null?void 0:t.marginStyleMap)||Z),on:[{id:n,type:"input",placeholder:rt,rules:[u.numericalOrPixelRule,u.maximumNumericalOrPixelOrAutoRule(500)],onChange:l=>u.appendUnit(l,n)}],off:[zt(r)]}},vr=t=>{const e=t!=null&&t.id?`hasExtendedCustomMargin_${t==null?void 0:t.id}`:"hasExtendedCustomMargin",n=t!=null&&t.id?`extendedMarginValues_${t==null?void 0:t.id}`:"extendedMarginValues",r=t!=null&&t.id?`extendedMarginChoice_${t==null?void 0:t.id}`:"extendedMarginChoice",l=t!=null&&t.id?`extendedMarginTop_${t==null?void 0:t.id}`:"extendedMarginTop",o=t!=null&&t.id?`extendedMarginLeft_${t==null?void 0:t.id}`:"extendedMarginLeft",c=t!=null&&t.id?`extendedMarginRight_${t==null?void 0:t.id}`:"extendedMarginRight",g=t!=null&&t.id?`extendedMarginBottom_${t==null?void 0: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=>{u.presetCustomValue(d,r,l,Z),u.presetCustomValue(d,r,o,Z),u.presetCustomValue(d,r,c,Z),u.presetCustomValue(d,r,g,Z)},on:[{id:n,type:"multiInput",layout:u.MultiInputLayout.Spider,blocks:[{id:l,type:"input",label:"Top",placeholder:rt,onChange:d=>u.appendUnit(d,l),rules:[u.numericalOrPixelRule,u.maximumNumericalOrPixelOrAutoRule(500)]},{id:o,type:"input",label:"Left",placeholder:rt,onChange:d=>u.appendUnit(d,o),rules:[u.numericalOrPixelRule,u.maximumNumericalOrPixelOrAutoRule(500)]},{id:c,type:"input",label:"Right",placeholder:rt,onChange:d=>u.appendUnit(d,c),rules:[u.numericalOrPixelRule,u.maximumNumericalOrPixelOrAutoRule(500)]},{id:g,type:"input",label:"Bottom",placeholder:rt,onChange:d=>u.appendUnit(d,g),rules:[u.numericalOrPixelRule,u.maximumNumericalOrPixelOrAutoRule(500)]}]}],off:[zt(r)]}},$t=t=>({id:t,type:"segmentedControls",defaultValue:j.Small,choices:[{value:j.None,label:"None"},{value:j.Small,label:"S"},{value:j.Medium,label:"M"},{value:j.Large,label:"L"}]}),Cr=t=>{const e=t!=null&&t.id?`hasCustomPaddingValue_${t==null?void 0:t.id}`:"hasCustomPaddingValue",n=t!=null&&t.id?`paddingValue_${t==null?void 0:t.id}`:"paddingValue",r=t!=null&&t.id?`paddingChoice_${t==null?void 0: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:l=>u.presetCustomValue(l,r,n,(t==null?void 0:t.paddingStyleMap)||J),on:[{id:n,type:"input",placeholder:at,rules:[u.numericalOrPixelRule,u.maximumNumericalOrPixelOrAutoRule(500)],onChange:l=>u.appendUnit(l,n)}],off:[$t(r)]}},kr=t=>{const e=t!=null&&t.id?`hasExtendedCustomPadding_${t==null?void 0:t.id}`:"hasExtendedCustomPadding",n=t!=null&&t.id?`extendedPaddingValues_${t==null?void 0:t.id}`:"extendedPaddingValues",r=t!=null&&t.id?`extendedPaddingChoice_${t==null?void 0:t.id}`:"extendedPaddingChoice",l=t!=null&&t.id?`extendedPaddingTop_${t==null?void 0:t.id}`:"extendedPaddingTop",o=t!=null&&t.id?`extendedPaddingLeft_${t==null?void 0:t.id}`:"extendedPaddingLeft",c=t!=null&&t.id?`extendedPaddingRight_${t==null?void 0:t.id}`:"extendedPaddingRight",g=t!=null&&t.id?`extendedPaddingBottom_${t==null?void 0: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=>{u.presetCustomValue(d,r,l,J),u.presetCustomValue(d,r,o,J),u.presetCustomValue(d,r,c,J),u.presetCustomValue(d,r,g,J)},on:[{id:n,type:"multiInput",layout:u.MultiInputLayout.Spider,blocks:[{id:l,type:"input",label:"Top",placeholder:at,onChange:d=>u.appendUnit(d,l),rules:[u.numericalOrPixelRule,u.maximumNumericalOrPixelOrAutoRule(500)]},{id:o,type:"input",label:"Left",placeholder:at,onChange:d=>u.appendUnit(d,o),rules:[u.numericalOrPixelRule,u.maximumNumericalOrPixelOrAutoRule(500)]},{id:c,type:"input",label:"Right",placeholder:at,onChange:d=>u.appendUnit(d,c),rules:[u.numericalOrPixelRule,u.maximumNumericalOrPixelOrAutoRule(500)]},{id:g,type:"input",label:"Bottom",placeholder:at,onChange:d=>u.appendUnit(d,g),rules:[u.numericalOrPixelRule,u.maximumNumericalOrPixelOrAutoRule(500)]}]}],off:[$t(r)]}},xr=t=>{const e=Wt(t==null?void 0:t.globalControlId);return{id:t!=null&&t.id?t.id:"downloadable",type:"switch",defaultValue:!1,label:"Downloadable",show:n=>{var r;return((r=n.getBlock(e))==null?void 0:r.value)===X.Custom}}},Wt=t=>t||"security",Sr=t=>[{id:Wt(t),type:"segmentedControls",defaultValue:X.Global,choices:[{value:X.Global,label:"Global Settings"},{value:X.Custom,label:"Custom"}]},{id:"globalSettingsInfo",type:"notification",footer:u.createFooter({label:"Change global settings [here].",replace:{here:{event:"general-settings.open"}}})}];var ln=(t=>(t.Main="main",t.Basics="basics",t.Layout="layout",t.Style="style",t.Security="security",t.Targets="targets",t))(ln||{});const Tr=t=>t,Pr=t=>t;i.AllTextStylePlugins=dr,i.AllTextStyles=gr,i.Attachments=oe,i.AttachmentsProvider=se,i.AttachmentsToolbarButton=de,i.BUTTON_PLUGIN=Ae,i.BlockButtonStyles=mt,i.BlockInjectButton=yn,i.BlockItemWrapper=Vn,i.BlockStyles=N,i.BorderStyle=H,i.ButtonPlugin=Fe,i.Custom1Plugin=$e,i.Custom2Plugin=qe,i.Custom3Plugin=je,i.DEFAULT_ATTACHMENTS_BUTTON_ID=ce,i.DEFAULT_DRAGGING_TOOLTIP=ue,i.DEFAULT_DRAG_TOOLTIP=ge,i.DEFAULT_MENU_BUTTON_ID=St,i.DownloadButton=zn,i.DragHandleToolbarButton=he,i.DragPreviewContextProvider=Zt,i.ELEMENT_BUTTON=x,i.FlyoutToolbarButton=xt,i.GutterSpacing=Q,i.Heading1Plugin=Xe,i.Heading2Plugin=Qe,i.Heading3Plugin=Ye,i.Heading4Plugin=Je,i.ImageCaptionPlugin=Ze,i.ImageTitlePlugin=Re,i.LinkInput=Be,i.LinkPlugin=ze,i.LinkSelector=Ee,i.Margin=K,i.MenuToolbarButton=we,i.MultiFlyoutContextProvider=te,i.PARAGRAPH_CLASSES=en,i.Padding=j,i.ParagraphMarkupElement=nn,i.ParagraphMarkupElementNode=yt,i.ParagraphPlugin=tn,i.QuoteMarkupElementNode=ft,i.QuotePlugin=rn,i.Radius=$,i.RichTextEditor=xa,i.Sections=ln,i.Security=X,i.THEME_PREFIX=hr,i.TextStylePluginsWithoutImage=Ht,i.TextStyles=v,i.TextStylesWithoutImage=et,i.Toolbar=ye,i.ToolbarFlyoutMenu=me,i.addHttps=gt,i.borderStyleMap=Xt,i.convertToRteValue=Wn,i.createButtonNode=Se,i.createButtonPlugin=Me,i.createLinkPlugin=Ve,i.createParagraphPlugin=an,i.createQuotePlugin=sn,i.customCoordinatesGetterFactory=ie,i.defineBlock=Tr,i.defineSettings=Pr,i.getBackgroundColorStyles=Tn,i.getBackgroundSettings=mr,i.getBorderRadiusSettings=yr,i.getBorderRadiusSlider=Vt,i.getBorderSettings=wr,i.getBorderStyles=En,i.getDefaultPluginsWithLinkChooser=ur,i.getExtendedBorderRadiusSettings=fr,i.getGutterSettings=br,i.getLegacyUrl=Xn,i.getLinkFromEditor=Yn,i.getMarginExtendedSettings=vr,i.getMarginSettings=pr,i.getMarginSlider=zt,i.getPaddingExtendedSettings=kr,i.getPaddingSettings=Cr,i.getPaddingSlider=$t,i.getRadiusStyles=Bn,i.getReadableColor=xn,i.getSecurityDownloadableSetting=xr,i.getSecurityGlobalControlId=Wt,i.getSecurityGlobalControlSetting=Sr,i.getUrl=Qn,i.getUrlFromEditor=xe,i.getUrlFromLinkOrLegacyLink=It,i.gutterSpacingStyleMap=Qt,i.hasRichTextValue=fe,i.insertButton=ve,i.isDark=bn,i.isDownloadable=qn,i.isValidUrl=ut,i.isValidUrlOrEmpty=R,i.joinClassNames=_,i.mapAppBridgeColorPaletteToFonduePalette=be,i.mapAppBridgeColorPalettesToFonduePalettes=Gn,i.marginStyleMap=Z,i.moveItemInArray=Sn,i.paddingStyleMap=J,i.radiusStyleMap=G,i.relativeUrlRegex=Et,i.setAlpha=Cn,i.submitFloatingButton=Bt,i.toColorObject=kn,i.toHex8String=pn,i.toHexString=vn,i.toRgbaString=vt,i.toShortRgba=q,i.triggerFloatingButton=Te,i.triggerFloatingButtonEdit=ht,i.triggerFloatingButtonInsert=Lt,i.unwrapButton=tt,i.upsertButton=Ce,i.upsertButtonText=Nt,i.useAttachments=ae,i.useAttachmentsContext=le,i.useDndSensors=Mn,i.useDragPreviewContext=st,i.useMultiFlyoutContext=ee,i.useMultiFlyoutState=dt,i.withAttachmentsProvider=Nn,i.withButton=pe,i.wrapButton=ke,Object.keys(u).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(i,t)&&Object.defineProperty(i,t,{enumerable:!0,get:()=>u[t]})}),Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});
1
+ (function(i,u){typeof exports=="object"&&typeof module<"u"?u(exports,require("@frontify/sidebar-settings"),require("react/jsx-runtime"),require("@frontify/fondue"),require("react"),require("@frontify/app-bridge"),require("@dnd-kit/core"),require("@dnd-kit/modifiers"),require("@dnd-kit/sortable"),require("@react-aria/focus"),require("@react-stately/overlays"),require("@ctrl/tinycolor")):typeof define=="function"&&define.amd?define(["exports","@frontify/sidebar-settings","react/jsx-runtime","@frontify/fondue","react","@frontify/app-bridge","@dnd-kit/core","@dnd-kit/modifiers","@dnd-kit/sortable","@react-aria/focus","@react-stately/overlays","@ctrl/tinycolor"],u):(i=typeof globalThis<"u"?globalThis:i||self,u(i.GuidelineBlocksSettings={},i.sidebarSettings,i.jsxRuntime,i.fondue,i.React,i.appBridge,i.core,i.modifiers,i.sortable,i.focus,i.overlays,i.tinycolor))})(this,function(i,u,s,r,m,W,T,wn,ct,jt,yn,V){"use strict";var Da=Object.defineProperty;var Oa=(i,u,s)=>u in i?Da(i,u,{enumerable:!0,configurable:!0,writable:!0,value:s}):i[u]=s;var L=(i,u,s)=>(Oa(i,typeof u!="symbol"?u+"":u,s),s);const _=t=>t.filter(Boolean).join(" "),fn=({onDrop:t,label:e,icon:n,secondaryLabel:a,isLoading:l,fillParentContainer:o,onAssetChooseClick:c,onUploadClick:g,withMenu:d=!0,onClick:y,validFileType:w,verticalLayout:h})=>{const[f,b]=m.useState(!1),[p,k]=m.useState(),P=m.useRef(null),[B,F]=m.useState(void 0),D=S=>{if(S.preventDefault(),b(!1),!U(S.dataTransfer.files)){F("Invalid"),setTimeout(()=>{F(void 0)},1e3);return}t==null||t(S.dataTransfer.files)},U=S=>{if(!w)return!0;for(let M=0;M<S.length;M++){const O=S[M].name.split(".").pop()??"";if(!W.FileExtensionSets[w].includes(O))return!1}return!0},z=S=>{if(!P.current||l)return;const{left:M,top:O}=P.current.getBoundingClientRect(),bt=S.clientX-M,pt=S.clientY-O;k([bt,pt])};return s.jsxs("button",{ref:P,"data-test-id":"block-inject-button",className:_(["tw-font-body tw-relative tw-text-sm tw-leading-4 tw-border tw-flex tw-items-center tw-justify-center tw-cursor-pointer tw-gap-3 tw-w-full first:tw-rounded-tl last:tw-rounded-br",h?"[&:not(:first-child)]:tw-border-t-0 first:tw-rounded-tr last:tw-rounded-bl":"[&:not(:first-child)]:tw-border-l-0 first:tw-rounded-bl last:tw-rounded-tr",o?"tw-h-full":"tw-h-[72px]",f&&!l?"tw-border-dashed":"tw-border-solid",p&&"tw-bg-blank-state-pressed-inverse",f&&"tw-bg-blank-state-weak-inverse",B?"!tw-border-red-50 !tw-cursor-not-allowed":" tw-border-blank-state-line",l||p||f||B?"":"tw-text-text-weak hover:tw-text-blank-state-hover hover:tw-bg-blank-state-hover-inverse hover:tw-border-blank-state-line-hover active:tw-text-blank-state-pressed active:tw-bg-blank-state-pressed-inverse active:tw-border-blank-state-line-hover",(f||p)&&!B?"[&>*]:tw-pointer-events-none tw-border-blank-state-line-hover":"tw-bg-blank-state-shaded-inverse tw-text-blank-state-shaded"]),onDragEnter:t?S=>{var M;if(b(!0),w==="Images")for(const O of Array.from(S.dataTransfer.items))(M=O==null?void 0:O.type)!=null&&M.startsWith("image/")?F(void 0):F("Invalid")}:void 0,onDragLeave:t?()=>{b(!1),F(void 0)}:void 0,onDrop:t?D:void 0,onClick:S=>{d&&z(S),y==null||y()},children:[l?s.jsx(r.LoadingCircle,{}):B?s.jsxs("div",{className:" tw-flex tw-items-center tw-justify-center tw-text-red-60 tw-font-medium",children:[s.jsx(r.IconExclamationMarkTriangle,{}),B]}):s.jsxs(s.Fragment,{children:[n&&s.jsx("div",{children:n}),(e||a)&&s.jsxs("div",{className:"tw-flex tw-flex-col tw-items-start",children:[e&&s.jsx("div",{className:"tw-font-medium",children:e}),a&&s.jsx("div",{className:"tw-font-normal",children:a})]})]}),p&&s.jsx("div",{className:"tw-absolute tw-left-0 tw-top-full tw-z-20",style:{left:p[0],top:p[1]},children:s.jsx(r.Flyout,{onOpenChange:S=>!S&&k(void 0),isOpen:!0,fitContent:!0,hug:!1,legacyFooter:!1,trigger:s.jsx("div",{}),children:s.jsx(r.ActionMenu,{menuBlocks:[{id:"menu",menuItems:[...g?[{id:"upload",size:r.MenuItemContentSize.XSmall,title:"Upload asset",onClick:()=>{g(),k(void 0)},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:s.jsx(r.IconArrowCircleUp20,{})})}]:[],...c?[{id:"asset",size:r.MenuItemContentSize.XSmall,title:"Browse asset",onClick:()=>{c(),k(void 0)},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:s.jsx(r.IconImageStack20,{})})}]:[]]}]})})})]})},q=t=>{const e=a=>typeof a=="object"&&["red","green","blue"].every(o=>a.hasOwnProperty(o)),n=a=>{const l=typeof a.alpha=="number"?a.alpha:1;return{r:a.red,g:a.green,b:a.blue,a:l}};return e(t)?n(t):t},bn=t=>typeof t=="object"&&["red","green","blue"].every(n=>t==null?void 0:t.hasOwnProperty(n)),pn=(t,e)=>{const n=bn(t)?q(t):t,a=new V.TinyColor(n);return e?a.getBrightness()<e:a.isDark()||a.getAlpha()>.25&&a.getAlpha()<1},vn=t=>new V.TinyColor(q(t)).toHex8String(),Cn=t=>new V.TinyColor(q(t)).toHexString(),vt=t=>new V.TinyColor(q(t)).toRgbString(),kn=(t,e)=>new V.TinyColor(e).setAlpha(t).toRgbString(),xn=t=>{const{r:e,g:n,b:a,a:l}=new V.TinyColor(t);return{red:e,green:n,blue:a,alpha:l}},Kt=t=>typeof t=="object"&&["red","green","blue"].every(n=>t==null?void 0:t.hasOwnProperty(n)),Sn=(t,e)=>{const n=Kt(t)?q(t):t,a=Kt(e)?q(e):e;let l=new V.TinyColor(n);const o=new V.TinyColor(a);for(;V.readability(l,o)<4.5;)l=l.darken(1);return l.toRgbString()},Tn=(t,e,n)=>{const a=[...t],l=n<0?a.length+n:n;if(l>=0&&l<a.length){const o=a.splice(e,1)[0];a.splice(l,0,o)}return a},Pn=t=>({backgroundColor:vt(t)});var H=(t=>(t.Solid="Solid",t.Dashed="Dashed",t.Dotted="Dotted",t))(H||{});const Xt={Solid:"solid",Dotted:"dotted",Dashed:"dashed"};var $=(t=>(t.None="None",t.Small="Small",t.Medium="Medium",t.Large="Large",t))($||{});const G={None:"0px",Small:"2px",Medium:"4px",Large:"12px"};var j=(t=>(t.None="None",t.Small="Small",t.Medium="Medium",t.Large="Large",t))(j||{});const J={None:"0px",Small:"24px",Medium:"36px",Large:"60px"};var K=(t=>(t.None="None",t.Small="Small",t.Medium="Medium",t.Large="Large",t))(K||{});const Z={None:"0px",Small:"24px",Medium:"36px",Large:"60px"};var X=(t=>(t.Global="Global",t.Custom="Custom",t))(X||{}),Q=(t=>(t.Auto="Auto",t.S="S",t.M="M",t.L="L",t))(Q||{});const Qt={Auto:"4px",S:"10px",M:"30px",L:"50px"},In={red:241,green:241,blue:241,alpha:1},Yt={red:234,green:235,blue:235,alpha:1},En="1px",rt="24px",at="24px",Bn=(t=H.Solid,e="1px",n=Yt)=>({borderStyle:Xt[t],borderWidth:e,borderColor:vt(n)}),Nn=(t,e=!1,n)=>({borderRadius:e?n:G[t]}),Jt=m.createContext(!1),Zt=({children:t,isDragPreview:e})=>s.jsx(Jt.Provider,{value:e,children:t}),st=()=>m.useContext(Jt),Rt=m.createContext({openFlyoutIds:[],setOpenFlyoutIds:()=>console.error("No MultiFlyoutContext Provider found")}),te=({children:t,openFlyoutIds:e,setOpenFlyoutIds:n})=>{const a=m.useMemo(()=>({openFlyoutIds:e,setOpenFlyoutIds:n}),[e,n]);return s.jsx(Rt.Provider,{value:a,children:t})},ee=()=>m.useContext(Rt),dt=t=>{const{openFlyoutIds:e,setOpenFlyoutIds:n}=ee(),a=m.useCallback(l=>{n(o=>{const c=o.filter(g=>g!==t);return l?[...c,t]:c})},[t,n]);return{isOpen:e.includes(t),onOpenChange:a}},ne=({children:t})=>s.jsx("div",{className:"tw-pointer-events-auto tw-flex tw-flex-shrink-0 tw-gap-px tw-px-px tw-h-[26px] tw-items-center tw-self-start tw-leading-none",children:t}),re=(t,e)=>{const{blockAssets:n,addAssetIdsToKey:a,deleteAssetIdsFromKey:l,updateAssetIdsFromKey:o}=W.useBlockAssets(t),c=(n==null?void 0:n[e])||[];return{onAttachmentsAdd:async h=>{await a(e,h.map(f=>f.id))},onAttachmentDelete:async h=>{await l(e,[h.id])},onAttachmentReplace:async(h,f)=>{const b=c.map(p=>p.id===h.id?f.id:p.id);await o(e,b)},onAttachmentsSorted:async h=>{const f=h.map(b=>b.id);await o(e,f)},attachments:c,appBridge:t}},ae=m.createContext(null),se=({appBridge:t,children:e,assetId:n})=>{const a=re(t,n);return s.jsx(ae.Provider,{value:a,children:e})},le=()=>{const t=m.useContext(ae);if(!t)throw new Error("No AttachmentsContext Provided. Component must be wrapped in an 'AttachmentsProvider' or the 'withAttachmentsProvider' HOC");return t},Ln=(t,e)=>{const n=a=>s.jsx(se,{appBridge:a.appBridge,assetId:e,children:s.jsx(t,{...a})});return n.displayName="withAttachmentsProvider",n},An=[T.KeyboardCode.Down,T.KeyboardCode.Right,T.KeyboardCode.Up,T.KeyboardCode.Left],ie=(t,e)=>(n,{currentCoordinates:a,context:{activeNode:l}})=>{if(n.preventDefault(),An.includes(n.code)){const o=(l==null?void 0:l.offsetWidth)??0,c=(l==null?void 0:l.offsetHeight)??0;switch(n.code){case T.KeyboardCode.Right:return{...a,x:a.x+o+t};case T.KeyboardCode.Left:return{...a,x:a.x-o-t};case T.KeyboardCode.Down:return{...a,y:a.y+c+e};case T.KeyboardCode.Up:return{...a,y:a.y-c-e}}}},Mn={start:["Space","Enter"],cancel:[],end:["Space","Enter","Escape"]},Fn=(t=0,e=0)=>{const n=ie(t,e);return T.useSensors(T.useSensor(T.PointerSensor),T.useSensor(T.KeyboardSensor,{coordinateGetter:n,keyboardCodes:Mn}))},Dn=t=>t==="IMAGE"?s.jsx(r.IconImage24,{}):t==="VIDEO"?s.jsx(r.IconPlayFrame24,{}):t==="AUDIO"?s.jsx(r.IconMusicNote24,{}):s.jsx(r.IconDocument24,{}),Ct=m.forwardRef(({item:t,isEditing:e,draggableProps:n,transformStyle:a,isDragging:l,isOverlay:o,isLoading:c,onDelete:g,onReplaceWithBrowse:d,onReplaceWithUpload:y,onDownload:w},h)=>{const[f,b]=m.useState(),[p,{selectedFiles:k}]=W.useFileInput({multiple:!0,accept:"image/*"}),[P,{results:B,doneAll:F}]=W.useAssetUpload(),{focusProps:D,isFocusVisible:U}=jt.useFocusRing();m.useEffect(()=>{k&&P(k[0])},[k]),m.useEffect(()=>{F&&y(B[0])},[F,B]);const z=c||k&&!F;return s.jsxs("button",{"aria-label":"Download attachment","data-test-id":"attachments-item",onClick:()=>w==null?void 0:w(),ref:h,style:{...a,opacity:l&&!o?.3:1,fontFamily:"var(-f-theme-settings-body-font-family)"},className:_(["tw-cursor-pointer tw-text-left tw-w-full tw-relative tw-flex tw-gap-3 tw-px-5 tw-py-3 tw-items-center tw-group hover:tw-bg-box-neutral-hover",l?"tw-bg-box-neutral-hover":""]),children:[s.jsx("div",{className:"tw-text-text-weak group-hover:tw-text-box-neutral-inverse-hover",children:z?s.jsx(r.LoadingCircle,{size:r.LoadingCircleSize.Small}):Dn(t.objectType)}),s.jsxs("div",{className:"tw-text-s tw-flex-1 tw-min-w-0",children:[s.jsx("div",{className:"tw-whitespace-nowrap tw-overflow-hidden tw-text-ellipsis tw-font-bold tw-text-text-weak group-hover:tw-text-box-neutral-inverse-hover",children:t.title}),s.jsx("div",{className:"tw-text-text-weak",children:`${t.fileSizeHumanReadable} - ${t.extension}`})]}),e&&s.jsxs("div",{"data-test-id":"attachments-actionbar",className:_(["tw-flex tw-gap-0.5 group-focus:tw-opacity-100 focus-visible:tw-opacity-100 focus-within:tw-opacity-100 group-hover:tw-opacity-100",o||(f==null?void 0:f.id)===t.id?"tw-opacity-100":"tw-opacity-0"]),children:[s.jsx("button",{...D,...n,"aria-label":"Drag attachment",className:_([" tw-border-button-border tw-bg-button-background active:tw-bg-button-background-pressed tw-group tw-border tw-box-box tw-relative tw-flex tw-items-center tw-justify-center tw-outline-none tw-font-medium tw-rounded tw-h-9 tw-w-9 ",l||o?"tw-cursor-grabbing tw-bg-button-background-pressed hover:tw-bg-button-background-pressed":"tw-cursor-grab hover:tw-bg-button-background-hover",U&&r.FOCUS_STYLE,U&&"tw-z-[2]"]),children:s.jsx(r.IconGrabHandle20,{})}),s.jsx("div",{"data-test-id":"attachments-actionbar-flyout",children:s.jsx(r.Flyout,{placement:r.FlyoutPlacement.Right,isOpen:(f==null?void 0:f.id)===t.id,fitContent:!0,legacyFooter:!1,onOpenChange:S=>b(S?t:void 0),trigger:(S,M)=>s.jsx(r.Button,{ref:M,icon:s.jsx(r.IconPen20,{}),emphasis:r.ButtonEmphasis.Default,onClick:()=>b(t)}),children:s.jsx(r.ActionMenu,{menuBlocks:[{id:"menu",menuItems:[{id:"upload",size:r.MenuItemContentSize.XSmall,title:"Replace with upload",onClick:()=>{p(),b(void 0)},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:s.jsx(r.IconArrowCircleUp20,{})})},{id:"asset",size:r.MenuItemContentSize.XSmall,title:"Replace with asset",onClick:()=>{d(),b(void 0)},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:s.jsx(r.IconImageStack20,{})})}]},{id:"menu-delete",menuItems:[{id:"delete",size:r.MenuItemContentSize.XSmall,title:"Delete",style:r.MenuItemStyle.Danger,onClick:()=>{g(),b(void 0)},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:s.jsx(r.IconTrashBin20,{})})}]}]})})})]})]})});Ct.displayName="AttachmentItem";const On=t=>{const{attributes:e,listeners:n,setNodeRef:a,transform:l,transition:o,isDragging:c}=ct.useSortable({id:t.item.id}),g={transform:l?`translate(${l.x}px, ${l.y}px)`:"",transition:o,zIndex:c?2:1},d={...e,...n};return s.jsx(Ct,{ref:a,isDragging:c,transformStyle:g,draggableProps:d,...t})},Un=({children:t,isFlyoutOpen:e,triggerProps:n,triggerRef:a})=>s.jsxs("button",{className:_(["tw-flex tw-text-xs tw-font-body tw-items-center tw-gap-1 tw-rounded-full tw-outline tw-outline-1 tw-outline-offset-1 tw-p-1.5 tw-outline-line",e?"tw-bg-box-neutral-pressed tw-text-box-neutral-inverse-pressed":"tw-bg-base hover:tw-bg-box-neutral-hover active:tw-bg-box-neutral-pressed tw-text-box-neutral-inverse hover:tw-text-box-neutral-inverse-hover active:tw-text-box-neutral-inverse-pressed"]),...n,ref:a,"data-test-id":"attachments-button-trigger",children:[s.jsx(r.IconPaperclip16,{}),t,s.jsx(r.IconCaretDown12,{})]}),oe=({items:t=[],onDelete:e,onReplaceWithBrowse:n,onReplaceWithUpload:a,onBrowse:l,onUpload:o,onSorted:c,appBridge:g,triggerComponent:d=Un,isOpen:y,onOpenChange:w})=>{const[h,f]=m.useState(t),[b,p]=m.useState(!1),k=T.useSensors(T.useSensor(T.PointerSensor),T.useSensor(T.KeyboardSensor)),[P,B]=m.useState(void 0),[F,D]=m.useState(!1),[U,z]=m.useState([]),[S,M]=m.useState(null),O=W.useEditorState(g),{openAssetChooser:bt,closeAssetChooser:pt}=W.useAssetChooser(g),cn=y!==void 0,qt=cn?y:b,nt=h==null?void 0:h.find(C=>C.id===P),[Ba,{results:dn,doneAll:gn}]=W.useAssetUpload({onUploadProgress:()=>!F&&D(!0)}),ot=C=>{const E=cn?w:p;E==null||E(C)};m.useEffect(()=>{f(t)},[t]),m.useEffect(()=>{S&&(D(!0),Ba(S))},[S]),m.useEffect(()=>{(async()=>{gn&&(await o(dn),D(!1))})()},[gn,dn]);const Na=()=>{ot(!1),bt(C=>{l(C),pt(),ot(!0)},{multiSelection:!0,selectedValueIds:h.map(C=>C.id)})},un=C=>{ot(!1),bt(async E=>{ot(!0),pt(),z([...U,C.id]),await n(C,E[0]),z(U.filter(Y=>Y!==C.id))},{multiSelection:!1,selectedValueIds:h.map(E=>E.id)})},hn=async(C,E)=>{z([...U,C.id]),await a(C,E),z(U.filter(Y=>Y!==C.id))},La=C=>{const{active:E}=C;B(E.id)},Aa=C=>{const{active:E,over:Y}=C;if(Y&&E.id!==Y.id&&h){const Ma=h.findIndex(Gt=>Gt.id===E.id),Fa=h.findIndex(Gt=>Gt.id===Y.id),mn=ct.arrayMove(h,Ma,Fa);f(mn),c(mn)}B(void 0)};return O||((h==null?void 0:h.length)??0)>0?s.jsx(r.LegacyTooltip,{withArrow:!0,position:r.TooltipPosition.Top,content:"Attachments",disabled:qt,enterDelay:500,triggerElement:s.jsx("div",{"data-test-id":"attachments-flyout-button",children:s.jsx(r.Flyout,{placement:r.FlyoutPlacement.BottomRight,onOpenChange:C=>ot(nt?!0:C),isOpen:qt,hug:!1,fitContent:!0,legacyFooter:!1,trigger:(C,E)=>s.jsx(d,{isFlyoutOpen:qt,triggerProps:C,triggerRef:E,children:s.jsx("div",{children:t.length>0?t.length:"Add"})}),children:s.jsxs("div",{className:"tw-w-[300px]","data-test-id":"attachments-flyout-content",children:[h.length>0&&s.jsxs(T.DndContext,{sensors:k,collisionDetection:T.closestCenter,onDragStart:La,onDragEnd:Aa,modifiers:[wn.restrictToWindowEdges],children:[s.jsx(ct.SortableContext,{items:h,strategy:ct.rectSortingStrategy,children:s.jsx("div",{className:"tw-border-b tw-border-b-line",children:h.map(C=>s.jsx(On,{isEditing:O,isLoading:U.includes(C.id),item:C,onDelete:()=>e(C),onReplaceWithBrowse:()=>un(C),onReplaceWithUpload:E=>hn(C,E),onDownload:()=>g.dispatch({name:"downloadAsset",payload:C})},C.id))})}),s.jsx(T.DragOverlay,{children:nt&&s.jsx(Ct,{isOverlay:!0,isEditing:O,item:nt,isDragging:!0,onDelete:()=>e(nt),onReplaceWithBrowse:()=>un(nt),onReplaceWithUpload:C=>hn(nt,C)},P)})]}),O&&s.jsxs("div",{className:"tw-px-5 tw-py-3",children:[s.jsx("div",{className:"tw-font-body tw-font-medium tw-text-text tw-text-s tw-my-4",children:"Add attachments"}),s.jsx(r.AssetInput,{isLoading:F,size:r.AssetInputSize.Small,onUploadClick:C=>M(C),onLibraryClick:Na})]})]})})})}):null},_n=(t,e)=>{const n=[r.FOCUS_VISIBLE_STYLE,"tw-relative tw-inline-flex tw-items-center tw-justify-center","tw-h-6 tw-p-1","tw-rounded","tw-text-xs tw-font-medium","tw-gap-0.5","focus-visible:tw-z-10"];return e?n.push("tw-bg-box-neutral-pressed","tw-text-box-neutral-inverse-pressed",t==="grab"?"tw-cursor-grabbing":"tw-cursor-pointer"):n.push("hover:tw-bg-box-neutral-hover active:tw-bg-box-neutral-pressed","tw-text-text-weak hover:tw-text-box-neutral-inverse-hover active:tw-text-box-neutral-inverse-pressed",t==="grab"?"!tw-cursor-grab active:tw-cursor-grabbing":"tw-cursor-pointer"),_(n)},lt=m.forwardRef(({onClick:t,children:e,forceActiveStyle:n,cursor:a="pointer","data-test-id":l="base-toolbar-button",...o},c)=>s.jsx("button",{onClick:t,className:_n(a,n),"data-test-id":l,...o,ref:c,children:e}));lt.displayName="BaseToolbarButton";const Hn=({children:t,isFlyoutOpen:e,triggerProps:n,triggerRef:a})=>s.jsxs(lt,{forceActiveStyle:e,"data-test-id":"attachments-toolbar-button-trigger",...n,ref:a,children:[s.jsx(r.IconPaperclip16,{}),t,s.jsx(r.IconCaretDown12,{})]}),ce="attachments",de=({flyoutId:t=ce})=>{const e=r.useMemoizedId(t),{appBridge:n,attachments:a,onAttachmentsAdd:l,onAttachmentDelete:o,onAttachmentReplace:c,onAttachmentsSorted:g}=le(),{isOpen:d,onOpenChange:y}=dt(e),w=st();return s.jsx(oe,{onUpload:l,onDelete:o,onReplaceWithBrowse:c,onReplaceWithUpload:c,onSorted:g,onBrowse:l,items:a,appBridge:n,triggerComponent:Hn,isOpen:d&&!w,onOpenChange:y})},kt=({open:t,content:e,children:n,disabled:a})=>s.jsx(r.LegacyTooltip,{withArrow:!0,hoverDelay:0,enterDelay:300,open:t,disabled:a,position:r.TooltipPosition.Top,content:s.jsx("div",{children:e}),triggerElement:n,"data-test-id":"toolbar-button-tooltip"}),Vn=({tooltip:t,icon:e,onClick:n})=>{const a=st();return s.jsx(kt,{disabled:a,content:t??"",children:s.jsx(lt,{"data-test-id":"block-item-wrapper-toolbar-btn",onClick:n,children:e})})},ge="Drag or press ↵ to move",ue="Move with ↑↓←→ and confirm with ↵",he=({tooltip:t,icon:e,setActivatorNodeRef:n,draggableProps:a})=>{const l=st();return s.jsx(kt,{open:l,content:s.jsx("div",{children:l?ue:t??ge}),children:s.jsx(lt,{ref:n,"data-test-id":"block-item-wrapper-toolbar-btn",forceActiveStyle:l,cursor:"grab",...a,children:e})})},xt=({content:t,icon:e,tooltip:n,flyoutId:a,flyoutFooter:l,flyoutHeader:o})=>{const c=r.useMemoizedId(a),{isOpen:g,onOpenChange:d}=dt(c),y=st();return s.jsx(kt,{disabled:y||g,content:n,children:s.jsx("div",{className:"tw-flex tw-flex-shrink-0 tw-flex-1 tw-h-6 tw-relative",children:s.jsx(r.Flyout,{isOpen:g&&!y,legacyFooter:!1,fixedFooter:l,fixedHeader:o,fitContent:!0,hug:!1,placement:r.FlyoutPlacement.BottomRight,onOpenChange:d,trigger:(w,h)=>s.jsx(lt,{"data-test-id":"block-item-wrapper-toolbar-flyout",forceActiveStyle:g&&!y,...w,ref:h,children:e}),children:t})})})},me=({items:t,flyoutId:e})=>{const{onOpenChange:n}=dt(e);return s.jsx(r.ActionMenu,{menuBlocks:t.map((a,l)=>({id:l.toString(),menuItems:a.map((o,c)=>({id:l.toString()+c.toString(),size:r.MenuItemContentSize.XSmall,title:o.title,style:o.style,onClick:()=>{n(!1),o.onClick()},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:o.icon})}))}))})},St="menu",we=({items:t,flyoutId:e=St,tooltip:n="Options"})=>{const a=r.useMemoizedId(e);return s.jsx(xt,{icon:s.jsx(r.IconDotsHorizontal16,{}),tooltip:n,flyoutId:a,content:s.jsx(me,{items:t,flyoutId:a})})},ye=({items:t,attachments:e})=>s.jsxs("div",{"data-test-id":"block-item-wrapper-toolbar",className:"tw-rounded-md tw-bg-base tw-border tw-border-line-strong tw-divide-x tw-divide-line-strong tw-shadow-lg tw-flex tw-flex-none tw-items-center tw-isolate",children:[e.isEnabled&&s.jsx(ne,{children:s.jsx(de,{})}),s.jsx(ne,{children:t.map(n=>n.type==="dragHandle"?s.jsx(he,{...n},n.tooltip+n.type):n.type==="menu"?s.jsx(we,{...n},n.tooltip+n.type):n.type==="flyout"?s.jsx(xt,{...n},n.tooltip+n.type):s.jsx(Vn,{...n},n.tooltip+n.type))})]}),zn=({children:t,toolbarItems:e,shouldHideWrapper:n,shouldHideComponent:a=!1,isDragging:l=!1,shouldFillContainer:o,outlineOffset:c=2,shouldBeShown:g=!1,showAttachments:d=!1})=>{const[y,w]=m.useState(g?[St]:[]),h=m.useRef(null);if(n)return s.jsx(s.Fragment,{children:t});const f=e==null?void 0:e.filter(p=>p!==void 0),b=y.length>0||g;return s.jsx(Zt,{isDragPreview:l,children:s.jsx(te,{openFlyoutIds:y,setOpenFlyoutIds:w,children:s.jsxs("div",{ref:h,"data-test-id":"block-item-wrapper",style:{outlineOffset:c},className:_(["tw-relative tw-group tw-outline-1 tw-outline-box-selected-inverse",o&&"tw-flex-1 tw-h-full tw-w-full","hover:tw-outline focus-within:tw-outline",b&&"tw-outline",a&&"tw-opacity-0"]),children:[s.jsx("div",{style:{right:-1-c,bottom:`calc(100% - ${2+c}px)`},className:_(["tw-pointer-events-none tw-absolute tw-bottom-[calc(100%-4px)] tw-right-[-3px] tw-w-full tw-opacity-0 tw-z-[60]","group-hover:tw-opacity-100 group-focus:tw-opacity-100 focus-within:tw-opacity-100","tw-flex tw-justify-end",b&&"tw-opacity-100"]),children:s.jsx(ye,{attachments:{isEnabled:d},items:f})}),t]})})})},$n=({onDownload:t})=>{const{isFocused:e,focusProps:n}=jt.useFocusRing();return s.jsx(r.LegacyTooltip,{withArrow:!0,position:r.TooltipPosition.Top,content:"Download",enterDelay:500,triggerElement:s.jsx("button",{tabIndex:0,"aria-label":"Download",...n,className:_(["tw-outline-none tw-rounded",e&&r.FOCUS_STYLE]),onClick:t,onPointerDown:a=>a.preventDefault(),children:s.jsx("span",{"data-test-id":"download-button",className:"tw-flex tw-text-xs tw-font-body tw-items-center tw-gap-1 tw-rounded-full tw-bg-box-neutral-strong-inverse hover:tw-bg-box-neutral-strong-inverse-hover active:tw-bg-box-neutral-strong-inverse-pressed tw-text-box-neutral-strong tw-outline tw-outline-1 tw-outline-offset-1 tw-p-1.5 tw-outline-line",children:s.jsx(r.IconArrowCircleDown16,{})})})})},Wn=({value:t="",gap:e,columns:n,show:a=!0,plugins:l})=>{const[o,c]=m.useState(null);return m.useEffect(()=>{(async()=>c(await r.serializeRawToHtmlAsync(t,l,n,e)))()},[t,n,e,l]),!a||o==="<br />"?null:o!==null?s.jsx("div",{className:"tw-w-full tw-whitespace-pre-wrap","data-test-id":"rte-content-html",dangerouslySetInnerHTML:{__html:o}}):s.jsx("div",{className:"tw-rounded-sm tw-bg-base-alt tw-animate-pulse tw-h-full tw-min-h-[10px] tw-w-full"})},Tt=r.createStore("floatingButton")({openEditorId:null,mouseDown:!1,updated:!1,url:"",text:"",buttonStyle:"primary",newTab:!1,mode:"",isEditing:!1}).extendActions(t=>({reset:()=>{t.url(""),t.text(""),t.buttonStyle("primary"),t.newTab(!1),t.mode(""),t.isEditing(!1)}})).extendActions(t=>({show:(e,n)=>{t.mode(e),t.isEditing(!1),t.openEditorId(n)},hide:()=>{t.reset(),t.openEditorId(null)}})).extendSelectors(t=>({isOpen:e=>t.openEditorId===e})),I=Tt.set,A=Tt.get,it=()=>Tt.use,fe=t=>{if(!t)return!1;const e=n=>n.some(a=>a.text?a.text!=="":a.children?e(a.children):!1);try{const n=JSON.parse(t);return e(n)}catch{return!1}},qn=(t="p",e="",n)=>fe(e)?e:JSON.stringify([{type:t,children:[{text:e,textStyle:t}],align:n}]),Gn=(t,e,n)=>t===X.Custom?e:n,jn=t=>t.map(be),be=t=>({id:t.id,title:t.name,colors:t.colors.map(Xn)}),Kn=t=>"revision"in t,Xn=t=>{if(Kn(t)){const{title:e,revision:n}=t;return{alpha:n.rgba.alpha?n.rgba.alpha/255:1,red:n.rgba.red??0,green:n.rgba.green??0,blue:n.rgba.blue??0,name:e??""}}return{alpha:t.alpha?t.alpha/255:1,red:t.red??0,green:t.green??0,blue:t.blue??0,name:t.name??""}},Pt=(t,e)=>{const n=r.getAboveNode(t,{match:{type:r.ELEMENT_LINK}});return Array.isArray(n)?e(n[0]):""},Qn=t=>Pt(t,e=>{var n,a;return((a=(n=e.chosenLink)==null?void 0:n.searchResult)==null?void 0:a.link)||""}),Yn=t=>Pt(t,e=>e.url||""),It=t=>{var e,n;return t.url||((n=(e=t.chosenLink)==null?void 0:e.searchResult)==null?void 0:n.link)||""},Jn=t=>Pt(t,It),Et=/^\/(document|r)\/\S+$/i,gt=t=>{if(Et.test(t))return t;try{return new URL(t),t}catch{return`https://${t}`}},ut=t=>{if(Et.test(t))return!0;try{const e=new URL(t);return["http:","https:","mailto:","tel:"].includes(e.protocol)&&e.pathname!==""}catch{return!1}},R=t=>ut(gt(t))||t==="",pe=(t,{type:e})=>{const{apply:n,normalizeNode:a}=t;return t.apply=l=>{if(l.type!=="set_selection"){n(l);return}const o=l.newProperties;if(!(o!=null&&o.focus)||!o.anchor||!r.isCollapsed(o)){n(l);return}const c=r.getAboveNode(t,{at:o,match:{type:r.getPluginType(t,x)}});if(c){const[,g]=c;let d;r.isStartPoint(t,o.focus,g)&&(d=r.getPreviousNodeEndPoint(t,g)),r.isEndPoint(t,o.focus,g)&&(d=r.getNextNodeStartPoint(t,g)),d&&(l.newProperties={anchor:d,focus:d})}n(l)},t.normalizeNode=([l,o])=>{if(l.type===r.getPluginType(t,x)){const c=t.selection;if(c&&r.isCollapsed(c)&&r.isEndPoint(t,c.focus,o)){const g=r.getNextNodeStartPoint(t,o);if(g)r.select(t,g);else{const d=r.Path.next(o);r.insertNodes(t,{text:""},{at:d}),r.select(t,d)}}}a([l,o])},r.withRemoveEmptyNodes(t,r.mockPlugin({options:{types:e}}))},ve=(t,e,n)=>{r.insertNodes(t,[Se(t,e)],n)},Bt=t=>{if(!t.selection)return;const{isUrl:e,forceSubmit:n}=r.getPluginOptions(t,x),a=A.url();if(!((e==null?void 0:e(a))||n))return;const o=A.text(),c=A.buttonStyle(),g=A.newTab()?void 0:"_self";return I.reset(),Ce(t,{url:a,text:o,buttonStyle:c,target:g,isUrl:d=>n||!e?!0:e(d)}),setTimeout(()=>{r.focusEditor(t,t.selection??void 0)},0),!0},tt=(t,e)=>r.withoutNormalizing(t,()=>{var n,a,l,o,c,g;if(e!=null&&e.split){if(r.getAboveNode(t,{at:(n=t.selection)==null?void 0:n.anchor,match:{type:r.getPluginType(t,x)}}))return r.splitNodes(t,{at:(a=t.selection)==null?void 0:a.anchor,match:w=>r.isElement(w)&&w.type===r.getPluginType(t,x)}),tt(t,{at:(l=t.selection)==null?void 0:l.anchor}),!0;if(r.getAboveNode(t,{at:(o=t.selection)==null?void 0:o.focus,match:{type:r.getPluginType(t,x)}}))return r.splitNodes(t,{at:(c=t.selection)==null?void 0:c.focus,match:w=>r.isElement(w)&&w.type===r.getPluginType(t,x)}),tt(t,{at:(g=t.selection)==null?void 0:g.focus}),!0}r.unwrapNodes(t,{match:{type:r.getPluginType(t,x)},...e})}),Ce=(t,{url:e,text:n,buttonStyle:a,target:l,insertTextInButton:o,insertNodesOptions:c,isUrl:g=r.getPluginOptions(t,x).isUrl})=>{var B;const d=t.selection;if(!d)return;const y=r.getAboveNode(t,{at:d,match:{type:r.getPluginType(t,x)}});if(o&&y)return t.insertText(e),!0;if(!(g!=null&&g(e)))return;if(r.isDefined(n)&&n.length===0&&(n=e),y)return tr(e,t,y,l,a,n),!0;const w=r.findNode(t,{at:d,match:{type:r.getPluginType(t,x)}}),[h,f]=w??[],b=Zn(t,f,n);if(r.isExpanded(d))return Rn(y,t,e,a,l,n),!0;b&&r.removeNodes(t,{at:f});const p=r.getNodeProps(h??{}),k=(B=t.selection)==null?void 0:B.focus.path;if(!k)return;const P=r.getNodeLeaf(t,k);return n!=null&&n.length||(n=e),ve(t,{...p,url:e,target:l,children:[{...P,text:n}]},c),!0};function Zn(t,e,n){return e&&(n==null?void 0:n.length)&&n!==r.getEditorString(t,e)}function Rn(t,e,n,a,l,o){t?tt(e,{at:t[1]}):tt(e,{split:!0}),ke(e,{url:n,buttonStyle:a,target:l}),Nt(e,{url:n,target:l,text:o})}function tr(t,e,n,a,l,o){var c,g,d;(t!==((c=n[0])==null?void 0:c.url)||a!==((g=n[0])==null?void 0:g.target)||l!==((d=n[0])==null?void 0:d.buttonStyle))&&r.setNodes(e,{url:t,target:a,buttonStyle:l},{at:n[1]}),Nt(e,{url:t,text:o,target:a})}const Nt=(t,{text:e})=>{const n=r.getAboveNode(t,{match:{type:r.getPluginType(t,x)}});if(n){const[a,l]=n;if(e!=null&&e.length&&e!==r.getEditorString(t,l)){const o=a.children[0];r.replaceNodeChildren(t,{at:l,nodes:{...o,text:e},insertOptions:{select:!0}})}}},ke=(t,{url:e,buttonStyle:n,target:a,...l})=>{r.wrapNodes(t,{type:r.getPluginType(t,x),url:e,buttonStyle:n,target:a,children:[]},{split:!0,...l})},er=(t,e)=>{const n=r.getAboveNode(t,{match:{type:x}});return Array.isArray(n)?e(n[0]):""},xe=t=>er(t,e=>e.url??""),Se=(t,{url:e,text:n="",buttonStyle:a="primary",target:l,children:o})=>({type:r.getPluginType(t,x),url:e,target:l,buttonStyle:a,children:o??[{text:n}]}),Te=(t,{focused:e}={})=>{if(A.mode()==="edit"){ht(t);return}Lt(t,{focused:e})},ht=t=>{const e=r.findNode(t,{match:{type:r.getPluginType(t,x)}});if(!e)return;const[n,a]=e;let l=r.getEditorString(t,a);I.url(n.url),I.newTab(n.target===void 0),l===n.url&&(l=""),I.text(l),I.isEditing(!0)},Lt=(t,{focused:e}={})=>{A.mode()||!e||r.isRangeAcrossBlocks(t,{at:t.selection})||r.someNode(t,{match:{type:r.getPluginType(t,x)}})||(I.text(r.getEditorString(t,t.selection)),I.show("insert",t.id))},mt={buttonPrimary:{fontFamily:"var(--f-theme-settings-button-primary-font-family)",fontSize:"var(--f-theme-settings-button-primary-font-size)",fontWeight:"var(--f-theme-settings-button-primary-font-weight)",lineHeight:"var(--f-theme-settings-button-primary-line-height)",paddingTop:"var(--f-theme-settings-button-primary-padding-top)",paddingRight:"var(--f-theme-settings-button-primary-padding-right)",paddingBottom:"var(--f-theme-settings-button-primary-padding-bottom)",paddingLeft:"var(--f-theme-settings-button-primary-padding-left)",fontStyle:"var(--f-theme-settings-button-primary-font-style)",textTransform:"var(--f-theme-settings-button-primary-text-transform)",backgroundColor:"var(--f-theme-settings-button-primary-background-color)",borderColor:"var(--f-theme-settings-button-primary-border-color)",borderRadius:"var(--f-theme-settings-button-primary-border-radius)",borderWidth:"var(--f-theme-settings-button-primary-border-width)",color:"var(--f-theme-settings-button-primary-color)",marginTop:"10px",marginBottom:"10px",display:"inline-block",hover:{backgroundColor:"var(--f-theme-settings-button-primary-background-color-hover)",borderColor:"var(--f-theme-settings-button-primary-border-color-hover)",color:"var(--f-theme-settings-button-primary-color-hover)"}},buttonSecondary:{fontFamily:"var(--f-theme-settings-button-secondary-font-family)",fontSize:"var(--f-theme-settings-button-secondary-font-size)",fontWeight:"var(--f-theme-settings-button-secondary-font-weight)",lineHeight:"var(--f-theme-settings-button-secondary-line-height)",paddingTop:"var(--f-theme-settings-button-secondary-padding-top)",paddingRight:"var(--f-theme-settings-button-secondary-padding-right)",paddingBottom:"var(--f-theme-settings-button-secondary-padding-bottom)",paddingLeft:"var(--f-theme-settings-button-secondary-padding-left)",fontStyle:"var(--f-theme-settings-button-secondary-font-style)",textTransform:"var(--f-theme-settings-button-secondary-text-transform)",backgroundColor:"var(--f-theme-settings-button-secondary-background-color)",borderColor:"var(--f-theme-settings-button-secondary-border-color)",borderRadius:"var(--f-theme-settings-button-secondary-border-radius)",borderWidth:"var(--f-theme-settings-button-secondary-border-width)",color:"var(--f-theme-settings-button-secondary-color)",display:"inline-block",marginTop:"10px",marginBottom:"10px",hover:{backgroundColor:"var(--f-theme-settings-button-secondary-background-color-hover)",borderColor:"var(--f-theme-settings-button-secondary-border-color-hover)",color:"var(--f-theme-settings-button-secondary-color-hover)"}},buttonTertiary:{fontFamily:"var(--f-theme-settings-button-tertiary-font-family)",fontSize:"var(--f-theme-settings-button-tertiary-font-size)",fontWeight:"var(--f-theme-settings-button-tertiary-font-weight)",lineHeight:"var(--f-theme-settings-button-tertiary-line-height)",paddingTop:"var(--f-theme-settings-button-tertiary-padding-top)",paddingRight:"var(--f-theme-settings-button-tertiary-padding-right)",paddingBottom:"var(--f-theme-settings-button-tertiary-padding-bottom)",paddingLeft:"var(--f-theme-settings-button-tertiary-padding-left)",fontStyle:"var(--f-theme-settings-button-tertiary-font-style)",textTransform:"var(--f-theme-settings-button-tertiary-text-transform)",backgroundColor:"var(--f-theme-settings-button-tertiary-background-color)",borderColor:"var(--f-theme-settings-button-tertiary-border-color)",borderRadius:"var(--f-theme-settings-button-tertiary-border-radius)",borderWidth:"var(--f-theme-settings-button-tertiary-border-width)",color:"var(--f-theme-settings-button-tertiary-color)",display:"inline-block",marginTop:"10px",marginBottom:"10px",hover:{backgroundColor:"var(--f-theme-settings-button-tertiary-background-color-hover)",borderColor:"var(--f-theme-settings-button-tertiary-border-color-hover)",color:"var(--f-theme-settings-button-tertiary-color-hover)"}}},nr=t=>{var c,g;const{attributes:e,children:n}=t,a=t.element.url||((g=(c=t.element.chosenLink)==null?void 0:c.searchResult)==null?void 0:g.link)||"",l=t.element.target||"_self",o=String(t.element.buttonStyle)||"primary";return s.jsx(rr,{attributes:e,href:a,target:l,styles:mt[`button${o.charAt(0).toUpperCase()+o.slice(1)}`],children:n})},rr=({attributes:t,styles:e={hover:{}},children:n,href:a="#",target:l})=>{const[o,c]=m.useState(!1);return s.jsx("a",{...t,onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),href:a,target:l,style:o?{...e,...e.hover}:e,children:n})};class ar extends r.MarkupElement{constructor(e=x,n=nr){super(e,n)}}const Pe=m.forwardRef((t,e)=>{const n=r.useEditorRef();return s.jsx(r.ToolbarButton,{ref:e,...t,onMouseDown:()=>{r.focusEditor(n,n.selection??n.prevSelection??void 0)},onClick:()=>{Te(n,{focused:!0})},children:s.jsx(r.IconStylingWrapper,{icon:s.jsx(r.IconButton16,{})})})});Pe.displayName="ButtonToolbarButton";const sr=({editorId:t,id:e})=>{const n=r.useEditorState(r.useEventPlateId(t)),a=!!r.isRangeInSameBlock(n,{at:n.selection}),l=r.getPluginType(n,x),o=!!(n!=null&&n.selection)&&r.someNode(n,{match:{type:l}});return s.jsx("div",{"data-plugin-id":e,children:s.jsx(Pe,{pressed:o,disabled:!a,tooltip:r.getTooltip(a?`Button
2
+ ${r.getHotkeyByPlatform("Ctrl+Shift+K")}`:"Buttons can only be set for a single text block.")})})},lr=()=>{const t=r.useEditorRef();return s.jsx(r.FloatingModalWrapper,{padding:"16px",minWidth:"400px","data-test-id":"floating-button-edit",children:s.jsxs("span",{"data-test-id":"preview-button-flyout",className:"tw-flex tw-justify-between tw-items-center",children:[s.jsx("span",{className:"tw-pointer-events-none",children:A.url()}),s.jsxs("span",{className:"tw-flex tw-gap-2",children:[s.jsx("button",{onClick:()=>{ht(t)},tabIndex:0,"data-test-id":"edit-button-button",className:"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1",children:s.jsx(r.IconPen16,{})}),s.jsx("button",{onClick:()=>{tt(t),r.focusEditor(t,t.selection??void 0)},tabIndex:0,"data-test-id":"remove-button-button",className:"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1",children:s.jsx(r.IconTrashBin16,{})})]})]})})},ir=({section:t,selectedUrl:e,onSelectUrl:n})=>{const a=t.permanentLink===e;return s.jsx("button",{"data-test-id":"internal-link-selector-section-link",className:r.merge(["tw-py-2 tw-pr-2.5 tw-pl-14 tw-leading-5 tw-cursor-pointer tw-w-full",a?"tw-bg-box-selected-strong tw-text-box-selected-strong-inverse hover:tw-bg-box-selected-strong-hover:hover hover:tw-text-box-selected-strong-inverse-hover:hover":"hover:tw-bg-box-neutral-hover hover:tw-text-box-neutral-inverse-hover"]),onClick:()=>n(t.permanentLink),children:s.jsxs("div",{className:"tw-flex tw-flex-1 tw-space-x-2 tw-items-center tw-h-6",children:[s.jsx(r.IconDocumentText16,{}),s.jsx("span",{className:"tw-text-s",children:t.title}),s.jsx("span",{className:"tw-flex-auto tw-font-sans tw-text-xs tw-text-right",children:"Section"})]})})},or=({page:t,selectedUrl:e,onSelectUrl:n,itemsToExpandInitially:a,getDocumentSectionsByDocumentPageId:l})=>{const[o,c]=m.useState(t.id===a.documentId),[g,d]=m.useState([]),y=t.permanentLink===e;m.useEffect(()=>{(async()=>{const b=await l(t.id);d(b)})()},[t.id,l]),m.useEffect(()=>{t.id===a.pageId&&c(!0)},[a,t.id]);const w=[...g.values()],h=w.length>0;return s.jsxs(s.Fragment,{children:[s.jsx("button",{"data-test-id":"internal-link-selector-page-link",className:r.merge(["tw-py-2 tw-pr-2.5 tw-leading-5 tw-cursor-pointer tw-flex tw-w-full",h?"tw-pl-7":"tw-pl-12",y?"tw-bg-box-selected-strong tw-text-box-selected-strong-inverse hover:tw-bg-box-selected-strong-hover:hover hover:tw-text-box-selected-strong-inverse-hover:hover":"hover:tw-bg-box-neutral-hover hover:tw-text-box-neutral-inverse-hover"]),onClick:()=>n(t.permanentLink),children:s.jsxs("div",{className:"tw-flex tw-flex-1 tw-space-x-1 tw-items-center tw-h-6",children:[h&&s.jsx("button",{"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:()=>c(!o),children:s.jsx("div",{className:r.merge(["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",o?"tw-rotate-90":""])})}),s.jsx("span",{className:"tw-text-s",children:t.title}),s.jsx("span",{className:"tw-flex-auto tw-font-sans tw-text-xs tw-text-right",children:"Page"})]},t.id)}),o&&w.length>0&&w.map(f=>s.jsx(ir,{section:f,selectedUrl:e,onSelectUrl:n},f.id))]})},Ie=()=>s.jsx("div",{className:"tw-flex tw-justify-center tw-h-10 tw-items-center",children:s.jsx(r.LoadingCircle,{size:r.LoadingCircleSize.Small})}),cr=({documentId:t,selectedUrl:e,onSelectUrl:n,itemsToExpandInitially:a,getDocumentSectionsByDocumentPageId:l,getDocumentPagesByDocumentId:o})=>{const[c,g]=m.useState([]),[d,y]=m.useState(!0),w=[...c.values()],h=!d&&w.length>0;return m.useEffect(()=>{o(t).then(f=>{const b=f.filter(k=>!!k.category).sort((k,P)=>k.category.sort===P.category.sort?k.sort-P.sort:k.category.sort-P.category.sort),p=f.filter(k=>!k.category).sort((k,P)=>k.sort-P.sort);g([...b,...p])}).finally(()=>{y(!1)})},[]),d?s.jsx(Ie,{}):h?s.jsx(s.Fragment,{children:w.map(f=>s.jsx(or,{page:f,selectedUrl:e,onSelectUrl:n,itemsToExpandInitially:a,getDocumentSectionsByDocumentPageId:l},f.id))}):s.jsx("div",{className:"tw-h-10 tw-flex tw-items-center tw-pr-2.5 tw-pl-7 tw-leading-5 tw-text-s tw-text-text-weak",children:"This document does not contain any pages."})},dr=({document:t,selectedUrl:e,onSelectUrl:n,itemsToExpandInitially:a,getDocumentSectionsByDocumentPageId:l,getDocumentPagesByDocumentId:o})=>{const[c,g]=m.useState(t.id===a.documentId),d=t.permanentLink===e;return m.useEffect(()=>{t.id===a.documentId&&g(!0)},[a,t.id]),s.jsxs(s.Fragment,{children:[s.jsxs("button",{"data-test-id":"internal-link-selector-document-link",className:r.merge(["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-box-selected-strong tw-text-box-selected-strong-inverse hover:tw-bg-box-selected-strong-hover:hover hover:tw-text-box-selected-strong-inverse-hover:hover":"hover:tw-bg-box-neutral-hover hover:tw-text-box-neutral-inverse-hover"]),onClick:()=>n(t.permanentLink),children:[s.jsx("button",{role:"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:()=>g(!c),children:s.jsx("div",{className:r.merge(["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":""])})}),s.jsx(r.IconColorFan16,{}),s.jsx("span",{className:"tw-text-s",children:t.title}),s.jsx("span",{className:"tw-flex-auto tw-font-sans tw-text-xs tw-text-right",children:"Document"})]}),c&&s.jsx(cr,{documentId:t.id,selectedUrl:e,onSelectUrl:n,itemsToExpandInitially:a,getDocumentSectionsByDocumentPageId:l,getDocumentPagesByDocumentId:o})]})},gr=({selectedUrl:t,onSelectUrl:e,getAllDocuments:n,getDocumentPagesByDocumentId:a,getDocumentSectionsByDocumentPageId:l})=>{const[o,c]=m.useState(!0),[g,d]=m.useState([]),[y,w]=m.useState({documentId:void 0,pageId:void 0}),h=[...g.values()];m.useEffect(()=>{t&&h.length>0&&f().then(b=>{w(b)})},[h.length]),m.useEffect(()=>{n().then(b=>{d(b)}).finally(()=>{c(!1)})},[]);const f=async()=>{const b={documentId:void 0,pageId:void 0};if(h.find(k=>k.permanentLink===t))return b;for(const k of h){const B=[...(await a(k.id)).values()];if(!!B.find(D=>D.permanentLink===t))return b.documentId=k.id,b;for(const D of B)if(!![...(await l(D.id)).values()].find(M=>M.permanentLink===t))return b.documentId=k.id,b.pageId=D.id,b}return b};return o?s.jsx(Ie,{}):s.jsx(s.Fragment,{children:h.map(b=>s.jsx(dr,{document:b,selectedUrl:t,onSelectUrl:e,itemsToExpandInitially:y,getDocumentSectionsByDocumentPageId:l,getDocumentPagesByDocumentId:a},b.id))})},Ee=({url:t,onUrlChange:e,buttonSize:n=r.ButtonSize.Medium,getAllDocuments:a,getDocumentPagesByDocumentId:l,getDocumentSectionsByDocumentPageId:o})=>{const{open:c,isOpen:g,close:d}=yn.useOverlayTriggerState({}),[y,w]=m.useState(t),h=p=>{w(p)},f=p=>{p.key==="Enter"&&b()};m.useEffect(()=>{t&&!y&&w(t)},[t,y]);const b=()=>{e==null||e(y),d()};return s.jsxs("div",{onPointerDown:p=>p.preventDefault(),"data-test-id":"internal-link-selector",onKeyDown:f,children:[s.jsx(r.Button,{icon:s.jsx(r.IconLink,{}),size:n,type:r.ButtonType.Button,style:r.ButtonStyle.Default,emphasis:r.ButtonEmphasis.Default,onClick:()=>c(),children:"Internal link"}),s.jsxs(r.Modal,{zIndex:1001,onClose:()=>d(),isOpen:g,isDismissable:!0,children:[s.jsx(r.Modal.Header,{title:"Select internal link"}),s.jsx(r.Modal.Body,{children:s.jsx(gr,{selectedUrl:y,onSelectUrl:h,getAllDocuments:a,getDocumentPagesByDocumentId:l,getDocumentSectionsByDocumentPageId:o})}),s.jsx(r.Modal.Footer,{buttons:[{children:"Cancel",onClick:()=>d(),style:r.ButtonStyle.Default,emphasis:r.ButtonEmphasis.Default},{children:"Choose",onClick:p=>{p==null||p.preventDefault(),b()},style:r.ButtonStyle.Default,emphasis:r.ButtonEmphasis.Strong,disabled:!y}]})]})]})},Be=({onUrlChange:t,onToggleTab:e,isValidUrlOrEmpty:n,appBridge:a,clearable:l,placeholder:o,newTab:c,openInNewTab:g,url:d="",required:y,info:w,label:h,buttonSize:f,hideInternalLinkButton:b})=>{const p=n?n(d):R(d),k=c??(g?r.CheckboxState.Checked:r.CheckboxState.Unchecked);return s.jsxs("div",{"data-test-id":"link-input",children:[s.jsx(r.FormControl,{label:{children:h,htmlFor:"url",required:y,tooltip:w?{content:w,position:r.TooltipPosition.Top}:void 0},children:s.jsx(r.TextInput,{id:"url",value:d,clearable:l,onChange:t,placeholder:o??"https://example.com",focusOnMount:!0})}),!p&&s.jsx("div",{className:"tw-text-text-negative tw-mt-1 tw-text-s",children:"Please enter a valid URL."}),!b&&s.jsx("div",{className:"tw-mt-3",children:s.jsx(Ee,{url:d,onUrlChange:t,buttonSize:f??r.ButtonSize.Medium,getAllDocuments:()=>a.getAllDocuments(),getDocumentPagesByDocumentId:P=>a.getDocumentPagesByDocumentId(P),getDocumentSectionsByDocumentPageId:P=>a.getDocumentSectionsByDocumentPageId(P)})}),s.jsx("div",{className:"tw-mt-3",children:s.jsx(r.Checkbox,{value:"new-tab",label:"Open in new tab",state:k,onChange:e})})]})},Ne=({state:t,onTextChange:e,onUrlChange:n,onToggleTab:a,onCancel:l,onSave:o,isValidUrlOrEmpty:c,hasValues:g,testId:d,appBridge:y,children:w})=>s.jsxs(r.FloatingModalWrapper,{"data-test-id":d,padding:"28px",minWidth:"400px",children:[s.jsx(r.FormControl,{label:{children:"Text",htmlFor:"linkText",required:!0},children:s.jsx(r.TextInput,{id:"linkText",value:t.text,placeholder:"Link Text",onChange:e})}),w,s.jsx("div",{className:"tw-mt-5",children:s.jsx(Be,{url:t.url,newTab:t.newTab,onUrlChange:n,onToggleTab:a,isValidUrlOrEmpty:c,appBridge:y})}),s.jsx("div",{className:"tw-mt-3",children:s.jsxs("div",{className:"tw-pt-5 tw-flex tw-gap-x-3 tw-justify-end tw-border-t tw-border-t-black-10",children:[s.jsx(r.Button,{onClick:l,size:r.ButtonSize.Medium,style:r.ButtonStyle.Default,emphasis:r.ButtonEmphasis.Default,children:"Cancel"}),s.jsx(r.Button,{onClick:o,size:r.ButtonSize.Medium,icon:s.jsx(r.IconCheckMark20,{}),disabled:!c(t==null?void 0:t.url)||!g,children:"Save"})]})})]}),ur=t=>{var n;const e=r.getAboveNode(t,{match:{type:x}});return Array.isArray(e)&&((n=e[0])==null?void 0:n.buttonStyle)||"primary"},hr={url:"",text:"",buttonStyle:"primary",newTab:r.CheckboxState.Unchecked},mr=()=>{const[t,e]=m.useReducer((n,a)=>{const{type:l,payload:o}=a;switch(l){case"NEW_TAB":return{...n,newTab:r.CheckboxState.Checked};case"SAME_TAB":return{...n,newTab:r.CheckboxState.Unchecked};case"URL":case"TEXT":case"BUTTON_STYLE":case"INIT":return{...n,...o};default:return n}},hr);return[t,e]},wr=()=>{const t=r.useEditorRef(),[e,n]=mr();m.useEffect(()=>{const h=ur(t);n({type:"INIT",payload:{text:A.text(),buttonStyle:h,newTab:A.newTab()?r.CheckboxState.Checked:r.CheckboxState.Unchecked,url:A.url()}})},[n,t]);const a=h=>{n({type:"TEXT",payload:{text:h}})},l=h=>{n({type:"BUTTON_STYLE",payload:{buttonStyle:h}})},o=h=>{n({type:"URL",payload:{url:h}})},c=h=>{n(h?{type:"NEW_TAB"}:{type:"SAME_TAB"})},g=()=>{I.reset()},d=h=>{if(!R(e.url)||!y)return;const f=gt(e.url);I.text(e.text),I.url(f),I.buttonStyle(e.buttonStyle),I.newTab(e.newTab===r.CheckboxState.Checked),Bt(t)&&(h==null||h.preventDefault())},y=e.url!==""&&e.text!=="",{appBridge:w}=r.getPluginOptions(t,x);return r.useHotkeys("enter",d,{enableOnFormTags:["INPUT"]},[]),{state:e,onTextChange:a,onButtonStyleChange:l,onUrlChange:o,onToggleTab:c,onCancel:g,onSave:d,hasValues:y,isValidUrlOrEmpty:R,appBridge:w}},wt="link-plugin";var v=(t=>(t.heading1="heading1",t.heading2="heading2",t.heading3="heading3",t.heading4="heading4",t.custom1="custom1",t.custom2="custom2",t.custom3="custom3",t.quote="quote",t.imageCaption="imageCaption",t.imageTitle="imageTitle",t.p="p",t))(v||{});const N={heading1:{fontSize:"var(--f-theme-settings-heading1-font-size)",lineHeight:"var(--f-theme-settings-heading1-line-height)",marginTop:"var(--f-theme-settings-heading1-margin-top)",marginBottom:"var(--f-theme-settings-heading1-margin-bottom)",textDecoration:"var(--f-theme-settings-heading1-text-decoration)",fontStyle:"var(--f-theme-settings-heading1-font-style)",textTransform:"var(--f-theme-settings-heading1-text-transform)",letterSpacing:"var(--f-theme-settings-heading1-letter-spacing)",fontWeight:"var(--f-theme-settings-heading1-font-weight)",fontFamily:"var(--f-theme-settings-heading1-font-family)",color:"var(--f-theme-settings-heading1-color)"},heading2:{fontSize:"var(--f-theme-settings-heading2-font-size)",lineHeight:"var(--f-theme-settings-heading2-line-height)",marginTop:"var(--f-theme-settings-heading2-margin-top)",marginBottom:"var(--f-theme-settings-heading2-margin-bottom)",textDecoration:"var(--f-theme-settings-heading2-text-decoration)",fontStyle:"var(--f-theme-settings-heading2-font-style)",textTransform:"var(--f-theme-settings-heading2-text-transform)",letterSpacing:"var(--f-theme-settings-heading2-letter-spacing)",fontWeight:"var(--f-theme-settings-heading2-font-weight)",fontFamily:"var(--f-theme-settings-heading2-font-family)",color:"var(--f-theme-settings-heading2-color)"},heading3:{fontSize:"var(--f-theme-settings-heading3-font-size)",lineHeight:"var(--f-theme-settings-heading3-line-height)",marginTop:"var(--f-theme-settings-heading3-margin-top)",marginBottom:"var(--f-theme-settings-heading3-margin-bottom)",textDecoration:"var(--f-theme-settings-heading3-text-decoration)",fontStyle:"var(--f-theme-settings-heading3-font-style)",textTransform:"var(--f-theme-settings-heading3-text-transform)",letterSpacing:"var(--f-theme-settings-heading3-letter-spacing)",fontWeight:"var(--f-theme-settings-heading3-font-weight)",fontFamily:"var(--f-theme-settings-heading3-font-family)",color:"var(--f-theme-settings-heading3-color)"},heading4:{fontSize:"var(--f-theme-settings-heading4-font-size)",lineHeight:"var(--f-theme-settings-heading4-line-height)",marginTop:"var(--f-theme-settings-heading4-margin-top)",marginBottom:"var(--f-theme-settings-heading4-margin-bottom)",textDecoration:"var(--f-theme-settings-heading4-text-decoration)",fontStyle:"var(--f-theme-settings-heading4-font-style)",textTransform:"var(--f-theme-settings-heading4-text-transform)",letterSpacing:"var(--f-theme-settings-heading4-letter-spacing)",fontWeight:"var(--f-theme-settings-heading4-font-weight)",fontFamily:"var(--f-theme-settings-heading4-font-family)",color:"var(--f-theme-settings-heading4-color)"},custom1:{fontSize:"var(--f-theme-settings-custom1-font-size)",lineHeight:"var(--f-theme-settings-custom1-line-height)",marginTop:"var(--f-theme-settings-custom1-margin-top)",marginBottom:"var(--f-theme-settings-custom1-margin-bottom)",textDecoration:"var(--f-theme-settings-custom1-text-decoration)",fontStyle:"var(--f-theme-settings-custom1-font-style)",textTransform:"var(--f-theme-settings-custom1-text-transform)",letterSpacing:"var(--f-theme-settings-custom1-letter-spacing)",fontWeight:"var(--f-theme-settings-custom1-font-weight)",fontFamily:"var(--f-theme-settings-custom1-font-family)",color:"var(--f-theme-settings-custom1-color)"},custom2:{fontSize:"var(--f-theme-settings-custom2-font-size)",lineHeight:"var(--f-theme-settings-custom2-line-height)",marginTop:"var(--f-theme-settings-custom2-margin-top)",marginBottom:"var(--f-theme-settings-custom2-margin-bottom)",textDecoration:"var(--f-theme-settings-custom2-text-decoration)",fontStyle:"var(--f-theme-settings-custom2-font-style)",textTransform:"var(--f-theme-settings-custom2-text-transform)",letterSpacing:"var(--f-theme-settings-custom2-letter-spacing)",fontWeight:"var(--f-theme-settings-custom2-font-weight)",fontFamily:"var(--f-theme-settings-custom2-font-family)",color:"var(--f-theme-settings-custom2-color)"},custom3:{fontSize:"var(--f-theme-settings-custom3-font-size)",lineHeight:"var(--f-theme-settings-custom3-line-height)",marginTop:"var(--f-theme-settings-custom3-margin-top)",marginBottom:"var(--f-theme-settings-custom3-margin-bottom)",textDecoration:"var(--f-theme-settings-custom3-text-decoration)",fontStyle:"var(--f-theme-settings-custom3-font-style)",textTransform:"var(--f-theme-settings-custom3-text-transform)",letterSpacing:"var(--f-theme-settings-custom3-letter-spacing)",fontWeight:"var(--f-theme-settings-custom3-font-weight)",fontFamily:"var(--f-theme-settings-custom3-font-family)",color:"var(--f-theme-settings-custom3-color)"},p:{fontSize:"var(--f-theme-settings-body-font-size)",lineHeight:"var(--f-theme-settings-body-line-height)",marginTop:"var(--f-theme-settings-body-margin-top)",marginBottom:"var(--f-theme-settings-body-margin-bottom)",textDecoration:"var(--f-theme-settings-body-text-decoration)",fontStyle:"var(--f-theme-settings-body-font-style)",textTransform:"var(--f-theme-settings-body-text-transform)",letterSpacing:"var(--f-theme-settings-body-letter-spacing)",fontWeight:"var(--f-theme-settings-body-font-weight)",fontFamily:"var(--f-theme-settings-body-font-family)",color:"var(--f-theme-settings-body-color)"},quote:{fontSize:"var(--f-theme-settings-quote-font-size)",lineHeight:"var(--f-theme-settings-quote-line-height)",marginTop:"var(--f-theme-settings-quote-margin-top)",marginBottom:"var(--f-theme-settings-quote-margin-bottom)",textDecoration:"var(--f-theme-settings-quote-text-decoration)",fontStyle:"var(--f-theme-settings-quote-font-style)",textTransform:"var(--f-theme-settings-quote-text-transform)",letterSpacing:"var(--f-theme-settings-quote-letter-spacing)",fontWeight:"var(--f-theme-settings-quote-font-weight)",fontFamily:"var(--f-theme-settings-quote-font-family)",color:"var(--f-theme-settings-quote-color)"},imageCaption:{fontSize:"var(--f-theme-settings-image-caption-font-size)",lineHeight:"var(--f-theme-settings-image-caption-line-height)",marginTop:"var(--f-theme-settings-image-caption-margin-top)",marginBottom:"var(--f-theme-settings-image-caption-margin-bottom)",textDecoration:"var(--f-theme-settings-image-caption-text-decoration)",fontStyle:"var(--f-theme-settings-image-caption-font-style)",textTransform:"var(--f-theme-settings-image-caption-text-transform)",letterSpacing:"var(--f-theme-settings-image-caption-letter-spacing)",fontWeight:"var(--f-theme-settings-image-caption-font-weight)",fontFamily:"var(--f-theme-settings-image-caption-font-family)",color:"var(--f-theme-settings-image-caption-color)"},imageTitle:{fontSize:"var(--f-theme-settings-image-title-font-size)",lineHeight:"var(--f-theme-settings-image-title-line-height)",marginTop:"var(--f-theme-settings-image-title-margin-top)",marginBottom:"var(--f-theme-settings-image-title-margin-bottom)",textDecoration:"var(--f-theme-settings-image-title-text-decoration)",fontStyle:"var(--f-theme-settings-image-title-font-style)",textTransform:"var(--f-theme-settings-image-title-text-transform)",letterSpacing:"var(--f-theme-settings-image-title-letter-spacing)",fontWeight:"var(--f-theme-settings-image-title-font-weight)",fontFamily:"var(--f-theme-settings-image-title-font-family)",color:"var(--f-theme-settings-image-title-color)"},[wt]:{fontSize:"var(--f-theme-settings-link-font-size)",lineHeight:"var(--f-theme-settings-link-line-height)",marginTop:"var(--f-theme-settings-link-margin-top)",marginBottom:"var(--f-theme-settings-link-margin-bottom)",textDecoration:"var(--f-theme-settings-link-text-decoration)",fontStyle:"var(--f-theme-settings-link-font-style)",textTransform:"var(--f-theme-settings-link-text-transform)",letterSpacing:"var(--f-theme-settings-link-letter-spacing)",fontWeight:"var(--f-theme-settings-link-font-weight)",fontFamily:"var(--f-theme-settings-link-font-family)",color:"var(--f-theme-settings-link-color)"},...mt},yr=()=>{const t=wr(),{state:e,onButtonStyleChange:n}=t;return s.jsx(Ne,{...t,testId:"floating-button-insert",children:s.jsx("div",{className:"tw-pt-5",children:s.jsxs(r.FormControl,{label:{children:"Button Style",htmlFor:"buttonStyle",required:!0},children:[s.jsx(At,{id:"primary",styles:N.buttonPrimary,isActive:e.buttonStyle==="primary",onClick:()=>n("primary"),children:e.text||"Primary Button"}),s.jsx(At,{id:"secondary",styles:N.buttonSecondary,isActive:e.buttonStyle==="secondary",onClick:()=>n("secondary"),children:e.text||"Secondary Button"}),s.jsx(At,{id:"tertiary",styles:N.buttonTertiary,isActive:e.buttonStyle==="tertiary",onClick:()=>n("tertiary"),children:e.text||"Tertiary Button"})]})})})},At=({id:t,styles:e,isActive:n,onClick:a,children:l})=>{const[o,c]=m.useState(!1),g=()=>e&&e.hover&&o?{...e,...e.hover}:e;return s.jsx("button",{"data-test-id":`floating-button-insert-${t}`,onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),onClick:a,style:{...g(),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:l})},Le={placement:"bottom-start",strategy:"absolute",middleware:[r.offset(12),r.flip({padding:12,fallbackPlacements:["bottom-end","top-start","top-end"]})]},fr=()=>{const{ref:t,...e}=vr(Le),{ref:n,...a}=br(Le),l=r.useEditorRef(),o=it(),c=o.isOpen(l.id),g=o.isEditing(),d=o.mode(),y=s.jsx(yr,{}),w=g?y:s.jsx(lr,{});return s.jsxs(s.Fragment,{children:[c&&d==="insert"&&s.jsx("div",{ref:t,...e,children:y}),c&&d==="edit"&&s.jsx("div",{ref:n,...a,children:w})]})},x="button",Ae="button-plugin",Me=t=>r.createPluginFactory({key:x,isElement:!0,isInline:!0,props:({element:e})=>({nodeProps:{href:e==null?void 0:e.url,target:e==null?void 0:e.target}}),withOverrides:pe,renderAfterEditable:fr,options:{isUrl:ut,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:a=>({type:n,url:a.getAttribute("href"),target:a.getAttribute("target")||"_blank"})}})})();class Fe extends r.Plugin{constructor({styles:n=mt,...a}){super(Ae,{button:sr,markupElement:new ar,...a});L(this,"styles",{});L(this,"appBridge");this.styles=n,this.appBridge=a==null?void 0:a.appBridge}plugins(){return[Me(this.appBridge)]}}const br=t=>{const e=r.useEditorRef(),n=it().mode(),a=it().isOpen(e.id),l=r.useEditorVersion(),{triggerFloatingButtonHotkeys:o}=r.getPluginOptions(e,x),c=m.useCallback(()=>{const h=r.getAboveNode(e,{match:{type:r.getPluginType(e,x)}});if(h){const[,f]=h;return r.getRangeBoundingClientRect(e,{anchor:r.getStartPoint(e,f),focus:r.getEndPoint(e,f)})}return r.getDefaultBoundingClientRect()},[e]),g=a&&n==="edit",{update:d,style:y,floating:w}=Oe({open:g,getBoundingClientRect:c,...t});return m.useEffect(()=>{const h=xe(e);if(h&&I.url(h),e.selection&&r.someNode(e,{match:{type:r.getPluginType(e,x)}})){I.show("edit",e.id),d();return}A.mode()==="edit"&&I.reset()},[e,l,d]),r.useHotkeys(o,h=>{h.preventDefault(),A.mode()==="edit"&&ht(e)},{enableOnContentEditable:!0},[]),pr(),De(),{style:{...y,zIndex:1e3},ref:r.useComposedRef(w)}},pr=()=>{const t=r.useEditorRef();r.useHotkeys("*",e=>{e.key==="Enter"&&Bt(t)&&e.preventDefault()},{enableOnFormTags:["INPUT"]},[])},De=()=>{const t=r.useEditorRef();r.useHotkeys("escape",()=>{if(A.mode()==="edit"){if(A.isEditing()){I.show("edit",t.id),r.focusEditor(t,t.selection??void 0);return}I.reset()}},{enableOnFormTags:["INPUT"],enableOnContentEditable:!0},[])},vr=t=>{const e=r.useEditorRef(),n=r.useFocused(),a=it().mode(),l=it().isOpen(e.id),{triggerFloatingButtonHotkeys:o}=r.getPluginOptions(e,x);r.useHotkeys(o,y=>{y.preventDefault(),Lt(e,{focused:n})},{enableOnContentEditable:!0},[n]);const{update:c,style:g,floating:d}=Oe({open:l&&a==="insert",getBoundingClientRect:r.getSelectionBoundingClientRect,whileElementsMounted:void 0,...t});return m.useEffect(()=>{l&&c(),I.updated(l)},[l,c]),De(),{style:{...g,zIndex:1e3},ref:r.useComposedRef(d)}},Cr=12,kr=-22,xr=96,Oe=t=>r.useVirtualFloating({placement:"bottom-start",middleware:[r.offset({mainAxis:Cr,alignmentAxis:kr}),r.flip({padding:xr})],...t}),Sr=({ref:t,disabled:e,onChange:n})=>{m.useEffect(()=>{if(e||!t.current)return;let a=!1;const l=new IntersectionObserver(([o])=>{o.isIntersecting!==a&&(a=o.isIntersecting,n(o.isIntersecting))});return l.observe(t.current),()=>{l.disconnect()}},[t,e,n])},Ue=m.memo(({id:t="rte",isEnabled:e,value:n,columns:a,gap:l,placeholder:o,plugins:c,onTextChange:g,showSerializedText:d})=>{const[y,w]=m.useState(!1),h=m.useCallback(p=>{p!==n&&(g==null||g(p),w(!1))},[g,n]),f=m.useCallback(()=>w(!0),[]),b=m.useCallback(p=>{A.isOpen(p)&&I.reset()},[]);return m.useEffect(()=>{const p=k=>{k.preventDefault(),k.returnValue="Unprocessed changes"};return y&&window.addEventListener("beforeunload",p),()=>window.removeEventListener("beforeunload",p)},[y]),e?s.jsx(r.RichTextEditor,{id:t,value:n,border:!1,placeholder:o,plugins:c,onValueChanged:f,onTextChange:h,hideExternalFloatingModals:b}):s.jsx(Wn,{value:n,columns:a,gap:l,show:d,plugins:c})});Ue.displayName="InternalRichTextEditor";const Tr=t=>{const e=m.useRef(null),[n,a]=m.useState(!1),{isEditing:l,...o}=t,c=m.useCallback(g=>{g&&a(!0)},[]);return Sr({ref:e,disabled:!l,onChange:c}),m.useEffect(()=>{a(!1)},[]),s.jsx("div",{className:"tw-block tw-w-full",ref:e,children:s.jsx(Ue,{...o,isEnabled:l&&n})})},Pr=({editButtonProps:t,unlinkButtonProps:e})=>{const{element:n}=r.useLinkOpenButtonState(),a=n?It(n):"";return s.jsx(r.FloatingModalWrapper,{"data-test-id":"floating-link-edit",padding:"16px",minWidth:"400px",children:s.jsxs("span",{"data-test-id":"preview-link-flyout",className:"tw-flex tw-justify-between tw-items-center",children:[s.jsx("span",{className:"tw-pointer-events-none",children:a}),s.jsxs("span",{className:"tw-flex tw-gap-2",children:[s.jsx("button",{tabIndex:0,"data-test-id":"edit-link-button",className:"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1",...t,children:s.jsx(r.IconPen16,{})}),s.jsx("button",{tabIndex:0,"data-test-id":"remove-link-button",className:"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1",...e,children:s.jsx(r.IconTrashBin16,{})})]})]})})},_e=(t,e)=>{const n=r.getAboveNode(t,{match:{type:r.ELEMENT_LINK}});return Array.isArray(n)?e(n[0]):""},Ir=t=>_e(t,e=>{var n,a;return((a=(n=e.chosenLink)==null?void 0:n.searchResult)==null?void 0:a.link)||""}),Er=t=>_e(t,e=>e.url||""),Br={url:"",text:"",newTab:r.CheckboxState.Unchecked},Nr=()=>{const[t,e]=m.useReducer((n,a)=>{const{type:l,payload:o}=a;switch(l){case"NEW_TAB":return{...n,newTab:r.CheckboxState.Checked};case"SAME_TAB":return{...n,newTab:r.CheckboxState.Unchecked};case"URL":case"TEXT":case"INIT":return{...n,...o};default:return n}},Br);return[t,e]},Lr=()=>{const t=r.useEditorRef(),[e,n]=Nr();m.useEffect(()=>{const w=Ir(t),h=Er(t),f=r.floatingLinkSelectors.newTab();n({type:"INIT",payload:{text:r.floatingLinkSelectors.text(),newTab:f?r.CheckboxState.Checked:r.CheckboxState.Unchecked,url:w&&h===""?w:r.floatingLinkSelectors.url()}})},[n,t]);const a=w=>{n({type:"TEXT",payload:{text:w}})},l=w=>{n({type:"URL",payload:{url:w}})},o=w=>{n(w?{type:"NEW_TAB"}:{type:"SAME_TAB"})},c=()=>{r.floatingLinkActions.reset()},g=w=>{!R(e.url)||!d||(r.floatingLinkActions.text(e.text),r.floatingLinkActions.url(gt(e.url)),r.floatingLinkActions.newTab(e.newTab===r.CheckboxState.Checked),r.submitFloatingLink(t)&&(w==null||w.preventDefault()))},d=e.url!==""&&e.text!=="",{appBridge:y}=r.getPluginOptions(t,r.ELEMENT_LINK);return r.useHotkeys("enter",g,{enableOnFormTags:["INPUT"]},[]),{state:e,onTextChange:a,onUrlChange:l,onToggleTab:o,onCancel:c,onSave:g,hasValues:d,isValidUrlOrEmpty:R,appBridge:y}},Ar=()=>s.jsx(Ne,{...Lr(),testId:"floating-link-insert"}),He={placement:"bottom-start",strategy:"absolute",middleware:[r.offset(12),r.flip({padding:12,fallbackPlacements:["bottom-end","top-start","top-end"]})]},Mr=()=>{const t=r.useFloatingLinkInsertState({floatingOptions:He}),{props:e,ref:n,hidden:a}=r.useFloatingLinkInsert(t),l=r.useFloatingLinkEditState({floatingOptions:He}),{props:o,ref:c,editButtonProps:g,unlinkButtonProps:d}=r.useFloatingLinkEdit(l);if(a)return null;const y=s.jsx(Ar,{}),w=l.isEditing?y:s.jsx(Pr,{editButtonProps:g,unlinkButtonProps:d});return s.jsxs(s.Fragment,{children:[t.isOpen&&!l.isOpen&&s.jsx("div",{ref:n,...e,style:{...e.style,zIndex:1e3},children:y}),l.isOpen&&s.jsx("div",{ref:c,...o,style:{...o.style,zIndex:1e3},children:w})]})},Ve=m.forwardRef((t,e)=>{const n=r.useEditorRef(),a=r.useLinkToolbarButtonState(),{props:l}=r.useLinkToolbarButton(a);return s.jsx(r.ToolbarButton,{onMouseDown:()=>{r.focusEditor(n,n.selection??n.prevSelection??void 0)},ref:e,...l,...t,children:s.jsx(r.IconStylingWrapper,{icon:s.jsx(r.IconLink16,{})})})});Ve.displayName="LinkToolbarButton";const Fr=({id:t,editorId:e})=>{const n=r.useEditorState(r.useEventPlateId(e)),a=!!r.isRangeInSameBlock(n,{at:n.selection});return s.jsx("div",{"data-plugin-id":t,children:s.jsx(Ve,{disabled:!a,tooltip:r.getTooltip(a?`Link
3
+ ${r.getHotkeyByPlatform("Ctrl+K")}`:"Links can only be set for a single text block.")})})},Dr=t=>{var c,g;const{attributes:e,children:n}=t,{styles:a}=r.useRichTextEditorContext(),l=t.element.url||((g=(c=t.element.chosenLink)==null?void 0:c.searchResult)==null?void 0:g.link)||"",o=t.element.target||"_self";return s.jsx("a",{...e,href:l,target:o,style:a[wt],children:n})};class Or extends r.MarkupElement{constructor(e=r.ELEMENT_LINK,n=Dr){super(e,n)}}const ze=t=>r.createPluginFactory({...r.createLinkPlugin(),renderAfterEditable:Mr,options:{isUrl:ut,rangeBeforeOptions:{matchString:" ",skipInvalid:!0,afterMatch:!0},triggerFloatingLinkHotkeys:"meta+k, ctrl+k",keepSelectedTextOnPaste:!0,appBridge:t}})();class $e extends r.Plugin{constructor({styles:n=N[wt],...a}){super(wt,{button:Fr,markupElement:new Or,...a});L(this,"styles",{});L(this,"appBridge");this.styles=n,this.appBridge=a.appBridge}plugins(){return[ze(this.appBridge)]}}const Ur="textstyle-custom1-plugin";class We extends r.Plugin{constructor({styles:n=N.custom1,...a}={}){super(v.custom1,{label:"Custom 1",markupElement:new _r,...a});L(this,"styles",{});this.styles=n}plugins(){return[Hr(this.styles)]}}class _r extends r.MarkupElement{constructor(e=Ur,n=qe){super(e,n)}}const qe=({element:t,attributes:e,children:n,styles:a})=>{const l=t.align;return s.jsx("p",{...e,style:a,className:r.merge([l&&r.alignmentClassnames[l],r.getColumnBreakClasses(t)]),children:n})},Hr=t=>r.createPluginFactory({key:v.custom1,isElement:!0,deserializeHtml:{rules:[{validClassName:v.custom1}]}})({component:e=>s.jsx(qe,{...e,styles:t})}),Vr="textstyle-custom2-plugin";class Ge extends r.Plugin{constructor({styles:n=N.custom2,...a}={}){super(v.custom2,{label:"Custom 2",markupElement:new zr,...a});L(this,"styles",{});this.styles=n}plugins(){return[$r(this.styles)]}}class zr extends r.MarkupElement{constructor(e=Vr,n=je){super(e,n)}}const je=({element:t,attributes:e,children:n,styles:a})=>{const l=t.align;return s.jsx("p",{...e,className:r.merge([l&&r.alignmentClassnames[l],r.getColumnBreakClasses(t)]),style:a,children:n})},$r=t=>r.createPluginFactory({key:v.custom2,isElement:!0,deserializeHtml:{rules:[{validClassName:v.custom2}]}})({component:e=>s.jsx(je,{...e,styles:t})}),Wr="textstyle-custom3-plugin";class Ke extends r.Plugin{constructor({styles:n=N.custom3,...a}={}){super(r.TextStyles.custom3,{label:"Custom 3",markupElement:new qr,...a});L(this,"styles",{});this.styles=n}plugins(){return[Gr(this.styles)]}}class qr extends r.MarkupElement{constructor(e=Wr,n=Xe){super(e,n)}}const Xe=({element:t,attributes:e,children:n,styles:a})=>{const l=t.align;return s.jsx("p",{...e,className:r.merge([l&&r.alignmentClassnames[l],r.getColumnBreakClasses(t)]),style:a,children:n})},Gr=t=>r.createPluginFactory({key:r.TextStyles.custom3,isElement:!0,deserializeHtml:{rules:[{validClassName:r.TextStyles.custom3}]}})({component:e=>s.jsx(Xe,{...e,styles:t})}),jr="textstyle-heading1-plugin";class Qe extends r.Plugin{constructor({styles:n=N.heading1,...a}={}){super(v.heading1,{label:"Heading 1",markupElement:new Kr,...a});L(this,"styles",{});this.styles=n}plugins(){return[Xr(this.styles)]}}class Kr extends r.MarkupElement{constructor(e=jr,n=Mt){super(e,n)}}const Mt=({element:t,attributes:e,children:n,styles:a})=>{const l=t.align;return s.jsx("h1",{...e,className:r.merge([l&&r.alignmentClassnames[l],r.getColumnBreakClasses(t)]),style:a,children:n})},Xr=t=>r.createPluginFactory({key:v.heading1,isElement:!0,component:Mt,deserializeHtml:{rules:[{validNodeName:["h1","H1"]}]}})({component:e=>s.jsx(Mt,{...e,styles:t})}),Qr="textstyle-heading2-plugin";class Ye extends r.Plugin{constructor({styles:n=N.heading2,...a}={}){super(v.heading2,{label:"Heading 2",markupElement:new Yr,...a});L(this,"styles",{});this.styles=n}plugins(){return[Jr(this.styles)]}}class Yr extends r.MarkupElement{constructor(e=Qr,n=Ft){super(e,n)}}const Ft=({element:t,attributes:e,children:n,styles:a})=>{const l=t.align;return s.jsx("h2",{...e,className:r.merge([l&&r.alignmentClassnames[l],r.getColumnBreakClasses(t)]),style:a,children:n})},Jr=t=>r.createPluginFactory({key:v.heading2,isElement:!0,component:Ft,deserializeHtml:{rules:[{validNodeName:["h2","H2"]}]}})({component:e=>s.jsx(Ft,{...e,styles:t})}),Zr="textstyle-heading3-plugin";class Je extends r.Plugin{constructor({styles:n=N.heading3,...a}={}){super(v.heading3,{label:"Heading 3",markupElement:new Rr,...a});L(this,"styles",{});this.styles=n}plugins(){return[ta(this.styles)]}}class Rr extends r.MarkupElement{constructor(e=Zr,n=Dt){super(e,n)}}const Dt=({element:t,attributes:e,children:n,styles:a})=>{const l=t.align;return s.jsx("h3",{...e,className:r.merge([l&&r.alignmentClassnames[l],r.getColumnBreakClasses(t)]),style:a,children:n})},ta=t=>r.createPluginFactory({key:v.heading3,isElement:!0,component:Dt,deserializeHtml:{rules:[{validNodeName:["h3","H3"]}]}})({component:e=>s.jsx(Dt,{...e,styles:t})}),ea="textstyle-heading4-plugin";class Ze extends r.Plugin{constructor({styles:n=N.heading4,...a}={}){super(v.heading4,{label:"Heading 4",markupElement:new na,...a});L(this,"styles",{});this.styles=n}plugins(){return[ra(this.styles)]}}class na extends r.MarkupElement{constructor(e=ea,n=Ot){super(e,n)}}const Ot=({element:t,attributes:e,children:n,styles:a})=>{const l=t.align;return s.jsx("h4",{...e,className:r.merge([l&&r.alignmentClassnames[l],r.getColumnBreakClasses(t)]),style:a,children:n})},ra=t=>r.createPluginFactory({key:v.heading4,isElement:!0,component:Ot,deserializeHtml:{rules:[{validNodeName:["h4","H4"]}]}})({component:e=>s.jsx(Ot,{...e,styles:t})}),aa="textstyle-imageCaption-plugin";class Re extends r.Plugin{constructor({styles:n=N.imageCaption,...a}={}){super(v.imageCaption,{label:"Image Caption",markupElement:new sa,...a});L(this,"styles",{});this.styles=n}plugins(){return[la(this.styles)]}}class sa extends r.MarkupElement{constructor(e=aa,n=Ut){super(e,n)}}const Ut=({element:t,attributes:e,children:n,styles:a})=>{const l=t.align;return s.jsx("p",{...e,className:r.merge([l&&r.alignmentClassnames[l],r.getColumnBreakClasses(t)]),style:a,children:n})},la=t=>r.createPluginFactory({key:v.imageCaption,isElement:!0,component:Ut,deserializeHtml:{rules:[{validClassName:v.imageCaption}]}})({component:e=>s.jsx(Ut,{...e,styles:t})}),ia="textstyle-imageTitle-plugin";class tn extends r.Plugin{constructor({styles:n=N.imageTitle,...a}={}){super(v.imageTitle,{label:"Image Title",markupElement:new oa,...a});L(this,"styles",{});this.styles=n}plugins(){return[ca(this.styles)]}}class oa extends r.MarkupElement{constructor(e=ia,n=_t){super(e,n)}}const _t=({element:t,attributes:e,children:n,styles:a})=>{const l=t.align;return s.jsx("p",{...e,className:r.merge([l&&r.alignmentClassnames[l],r.getColumnBreakClasses(t)]),style:a,children:n})},ca=t=>r.createPluginFactory({key:v.imageTitle,isElement:!0,component:_t,deserializeHtml:{rules:[{validClassName:v.imageTitle}]}})({component:e=>s.jsx(_t,{...e,styles:t})});class en extends r.Plugin{constructor({styles:n=N.p,...a}={}){super(v.p,{markupElement:new rn,label:"Body Text",...a});L(this,"styles",{});this.styles=n}plugins(){return[an(this.styles)]}}const nn="tw-m-0 tw-px-0 tw-py-0",yt=({element:t,attributes:e,children:n,styles:a})=>{const l=t.align,o=r.merge([l&&r.alignmentClassnames[l],nn,r.getColumnBreakClasses(t)]);return s.jsx("p",{...e,className:o,style:a,children:n})};class rn extends r.MarkupElement{constructor(e=v.p,n=yt){super(e,n)}}const an=t=>r.createPluginFactory({...r.createParagraphPlugin(),key:v.p,isElement:!0,component:yt})({component:e=>s.jsx(yt,{...e,styles:t})}),da="textstyle-quote-plugin";class sn extends r.Plugin{constructor({styles:n=N.quote,...a}={}){super(v.quote,{label:"Quote",markupElement:new ga,...a});L(this,"styles",{});this.styles=n}plugins(){return[ln(this.styles)]}}class ga extends r.MarkupElement{constructor(e=da,n=ft){super(e,n)}}const ft=({element:t,attributes:e,children:n,styles:a})=>{const l=t.align;return s.jsx("blockquote",{...e,className:r.merge([l&&r.alignmentClassnames[l],r.getColumnBreakClasses(t)]),style:a,children:n})},ln=t=>r.createPluginFactory({key:v.quote,isElement:!0,component:ft,deserializeHtml:{rules:[{validNodeName:["blockquote","BLOCKQUOTE"]}]}})({component:e=>s.jsx(ft,{...e,styles:t})}),Ht=[new Qe,new Ye,new Je,new Ze,new We,new Ge,new Ke,new sn,new en],et=[v.heading1,v.heading2,v.heading3,v.heading4,v.custom1,v.custom2,v.custom3,v.quote,v.p],ua=[...Ht,new Re,new tn],ha=[...et,v.imageCaption,v.imageTitle],ma=t=>new r.PluginComposer().setPlugin(new r.SoftBreakPlugin,new r.TextStylePlugin({textStyles:Ht})).setPlugin([new r.BoldPlugin,new r.ItalicPlugin,new r.UnderlinePlugin,new r.StrikethroughPlugin,new $e({appBridge:t}),new Fe({appBridge:t}),new r.CodePlugin],[new r.AlignLeftPlugin({validTypes:et}),new r.AlignCenterPlugin({validTypes:et}),new r.AlignRightPlugin({validTypes:et}),new r.AlignJustifyPlugin({validTypes:et}),new r.UnorderedListPlugin,new r.CheckboxListPlugin,new r.OrderedListPlugin,new r.ResetFormattingPlugin,new r.AutoformatPlugin]),wa="--f-theme-settings-",ya=t=>{const e=t!=null&&t.id?`hasBackground${t.id}`:"hasBackground",n=t!=null&&t.id?`backgroundColor${t.id}`:"backgroundColor",a=t!=null&&t.preventDefaultColor?void 0:(t==null?void 0:t.defaultColor)||In,l=t!=null&&t.label?t.label:"Background",o=t!=null&&t.switchLabel?t.switchLabel:void 0;return{id:e,label:l,type:"switch",switchLabel:o,defaultValue:!!(t!=null&&t.defaultValue),on:[{id:n,defaultValue:a,type:"colorInput"}]}},fa=t=>{const e=t!=null&&t.id?`hasBorder_${t.id}`:"hasBorder",n=t!=null&&t.id?`borderSelection_${t.id}`:"borderSelection",a=t!=null&&t.id?`borderStyle_${t.id}`:"borderStyle",l=t!=null&&t.id?`borderWidth_${t.id}`:"borderWidth",o=t!=null&&t.id?`borderColor_${t.id}`:"borderColor",c=(t==null?void 0:t.defaultColor)||Yt,g=t!=null&&t.switchLabel?t.switchLabel:void 0;return{id:e,label:"Border",type:"switch",switchLabel:g,defaultValue:!!(t!=null&&t.defaultValue),on:[{id:n,type:"multiInput",onChange:d=>u.appendUnit(d,l),layout:u.MultiInputLayout.Columns,lastItemFullWidth:!0,blocks:[{id:a,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:l,type:"input",defaultValue:En,rules:[u.numericalOrPixelRule,u.maximumNumericalOrPixelOrAutoRule(500)],placeholder:"e.g. 3px"},{id:o,type:"colorInput",defaultValue:c}]}],off:[]}},Vt=(t,e=$.None)=>({id:t,type:"segmentedControls",defaultValue:e,choices:[{value:$.None,label:"None"},{value:$.Small,label:"S"},{value:$.Medium,label:"M"},{value:$.Large,label:"L"}]}),ba=t=>{const e=t!=null&&t.id?`hasRadius_${t.id}`:"hasRadius",n=t!=null&&t.id?`radiusValue_${t.id}`:"radiusValue",a=t!=null&&t.id?`radiusChoice_${t.id}`:"radiusChoice",l=(t==null?void 0:t.defaultRadius)||$.None;return{id:e,label:"Corner radius",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"Determining how rounded the corners are.",show:o=>{var c;return t!=null&&t.dependentSettingId?!!((c=o.getBlock(t.dependentSettingId))!=null&&c.value):!0},onChange:o=>u.presetCustomValue(o,a,n,(t==null?void 0:t.radiusStyleMap)||G),on:[{id:n,type:"input",placeholder:"e.g. 10px",rules:[u.numericalOrPixelRule],onChange:o=>u.appendUnit(o,n)}],off:[Vt(a,l)]}},pa=t=>{const e=t!=null&&t.id?`hasExtendedCustomRadius_${t.id}`:"hasExtendedCustomRadius",n=t!=null&&t.id?`extendedRadiusValue_${t.id}`:"extendedRadiusValue",a=t!=null&&t.id?`extendedRadiusChoice_${t.id}`:"extendedRadiusChoice",l=t!=null&&t.id?`extendedRadiusTopLeft_${t.id}`:"extendedRadiusTopLeft",o=t!=null&&t.id?`extendedRadiusTopRight_${t.id}`:"extendedRadiusTopRight",c=t!=null&&t.id?`extendedRadiusBottomLeft_${t.id}`:"extendedRadiusBottomLeft",g=t!=null&&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=>{var y;return t!=null&&t.dependentSettingId?!!((y=d.getBlock(t.dependentSettingId))!=null&&y.value):!0},onChange:d=>{u.presetCustomValue(d,a,l,G),u.presetCustomValue(d,a,o,G),u.presetCustomValue(d,a,c,G),u.presetCustomValue(d,a,g,G)},on:[{id:n,type:"multiInput",layout:u.MultiInputLayout.Columns,blocks:[{id:l,type:"input",label:"Top Left",rules:[u.numericalOrPixelRule],onChange:d=>u.appendUnit(d,l)},{id:o,type:"input",label:"Top Right",rules:[u.numericalOrPixelRule],onChange:d=>u.appendUnit(d,o)},{id:c,type:"input",label:"Bottom Left",rules:[u.numericalOrPixelRule],onChange:d=>u.appendUnit(d,c)},{id:g,type:"input",label:"Bottom Right",rules:[u.numericalOrPixelRule],onChange:d=>u.appendUnit(d,g)}]}],off:[Vt(a,t==null?void 0:t.defaultValue)]}},va=t=>{const e=t!=null&&t.id?t.id:"hasCustomSpacing",n=t!=null&&t.dependentSettingId?t.dependentSettingId:"columns",a=t!=null&&t.spacingChoiceId?t.spacingChoiceId:"spacingChoice",l=t!=null&&t.spacingCustomId?t.spacingCustomId:"spacingCustom",o=t!=null&&t.defaultValueChoices?t.defaultValueChoices:Q.M;return{id:e,type:"switch",defaultValue:!1,switchLabel:"Custom",label:"Gutter",info:"An official nerds term for ‘gap’",onChange:c=>u.presetCustomValue(c,a,l,Qt),show:c=>{var g;return((g=c.getBlock(n))==null?void 0:g.value)!=="1"},on:[{id:l,type:"input",rules:[u.numericalOrPixelRule],onChange:c=>u.appendUnit(c,l)}],off:[{id:a,type:"slider",defaultValue:o,choices:[{value:Q.Auto,label:"Auto"},{value:Q.S,label:"S"},{value:Q.M,label:"M"},{value:Q.L,label:"L"}]}]}},zt=t=>({id:t,type:"segmentedControls",defaultValue:K.None,choices:[{value:K.None,label:"None"},{value:K.Small,label:"S"},{value:K.Medium,label:"M"},{value:K.Large,label:"L"}]}),Ca=t=>{const e=t!=null&&t.id?`hasCustomMarginValue_${t==null?void 0:t.id}`:"hasCustomMarginValue",n=t!=null&&t.id?`marginValue_${t==null?void 0:t.id}`:"marginValue",a=t!=null&&t.id?`marginChoice_${t==null?void 0: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:l=>u.presetCustomValue(l,a,n,(t==null?void 0:t.marginStyleMap)||Z),on:[{id:n,type:"input",placeholder:at,rules:[u.numericalOrPixelRule,u.maximumNumericalOrPixelOrAutoRule(500)],onChange:l=>u.appendUnit(l,n)}],off:[zt(a)]}},ka=t=>{const e=t!=null&&t.id?`hasExtendedCustomMargin_${t==null?void 0:t.id}`:"hasExtendedCustomMargin",n=t!=null&&t.id?`extendedMarginValues_${t==null?void 0:t.id}`:"extendedMarginValues",a=t!=null&&t.id?`extendedMarginChoice_${t==null?void 0:t.id}`:"extendedMarginChoice",l=t!=null&&t.id?`extendedMarginTop_${t==null?void 0:t.id}`:"extendedMarginTop",o=t!=null&&t.id?`extendedMarginLeft_${t==null?void 0:t.id}`:"extendedMarginLeft",c=t!=null&&t.id?`extendedMarginRight_${t==null?void 0:t.id}`:"extendedMarginRight",g=t!=null&&t.id?`extendedMarginBottom_${t==null?void 0: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=>{u.presetCustomValue(d,a,l,Z),u.presetCustomValue(d,a,o,Z),u.presetCustomValue(d,a,c,Z),u.presetCustomValue(d,a,g,Z)},on:[{id:n,type:"multiInput",layout:u.MultiInputLayout.Spider,blocks:[{id:l,type:"input",label:"Top",placeholder:at,onChange:d=>u.appendUnit(d,l),rules:[u.numericalOrPixelRule,u.maximumNumericalOrPixelOrAutoRule(500)]},{id:o,type:"input",label:"Left",placeholder:at,onChange:d=>u.appendUnit(d,o),rules:[u.numericalOrPixelRule,u.maximumNumericalOrPixelOrAutoRule(500)]},{id:c,type:"input",label:"Right",placeholder:at,onChange:d=>u.appendUnit(d,c),rules:[u.numericalOrPixelRule,u.maximumNumericalOrPixelOrAutoRule(500)]},{id:g,type:"input",label:"Bottom",placeholder:at,onChange:d=>u.appendUnit(d,g),rules:[u.numericalOrPixelRule,u.maximumNumericalOrPixelOrAutoRule(500)]}]}],off:[zt(a)]}},$t=t=>({id:t,type:"segmentedControls",defaultValue:j.Small,choices:[{value:j.None,label:"None"},{value:j.Small,label:"S"},{value:j.Medium,label:"M"},{value:j.Large,label:"L"}]}),xa=t=>{const e=t!=null&&t.id?`hasCustomPaddingValue_${t==null?void 0:t.id}`:"hasCustomPaddingValue",n=t!=null&&t.id?`paddingValue_${t==null?void 0:t.id}`:"paddingValue",a=t!=null&&t.id?`paddingChoice_${t==null?void 0: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:l=>u.presetCustomValue(l,a,n,(t==null?void 0:t.paddingStyleMap)||J),on:[{id:n,type:"input",placeholder:rt,rules:[u.numericalOrPixelRule,u.maximumNumericalOrPixelOrAutoRule(500)],onChange:l=>u.appendUnit(l,n)}],off:[$t(a)]}},Sa=t=>{const e=t!=null&&t.id?`hasExtendedCustomPadding_${t==null?void 0:t.id}`:"hasExtendedCustomPadding",n=t!=null&&t.id?`extendedPaddingValues_${t==null?void 0:t.id}`:"extendedPaddingValues",a=t!=null&&t.id?`extendedPaddingChoice_${t==null?void 0:t.id}`:"extendedPaddingChoice",l=t!=null&&t.id?`extendedPaddingTop_${t==null?void 0:t.id}`:"extendedPaddingTop",o=t!=null&&t.id?`extendedPaddingLeft_${t==null?void 0:t.id}`:"extendedPaddingLeft",c=t!=null&&t.id?`extendedPaddingRight_${t==null?void 0:t.id}`:"extendedPaddingRight",g=t!=null&&t.id?`extendedPaddingBottom_${t==null?void 0: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=>{u.presetCustomValue(d,a,l,J),u.presetCustomValue(d,a,o,J),u.presetCustomValue(d,a,c,J),u.presetCustomValue(d,a,g,J)},on:[{id:n,type:"multiInput",layout:u.MultiInputLayout.Spider,blocks:[{id:l,type:"input",label:"Top",placeholder:rt,onChange:d=>u.appendUnit(d,l),rules:[u.numericalOrPixelRule,u.maximumNumericalOrPixelOrAutoRule(500)]},{id:o,type:"input",label:"Left",placeholder:rt,onChange:d=>u.appendUnit(d,o),rules:[u.numericalOrPixelRule,u.maximumNumericalOrPixelOrAutoRule(500)]},{id:c,type:"input",label:"Right",placeholder:rt,onChange:d=>u.appendUnit(d,c),rules:[u.numericalOrPixelRule,u.maximumNumericalOrPixelOrAutoRule(500)]},{id:g,type:"input",label:"Bottom",placeholder:rt,onChange:d=>u.appendUnit(d,g),rules:[u.numericalOrPixelRule,u.maximumNumericalOrPixelOrAutoRule(500)]}]}],off:[$t(a)]}},Ta=t=>{const e=Wt(t==null?void 0:t.globalControlId);return{id:t!=null&&t.id?t.id:"downloadable",type:"switch",defaultValue:!1,label:"Downloadable",show:n=>{var a;return((a=n.getBlock(e))==null?void 0:a.value)===X.Custom}}},Wt=t=>t||"security",Pa=t=>[{id:Wt(t),type:"segmentedControls",defaultValue:X.Global,choices:[{value:X.Global,label:"Global Settings"},{value:X.Custom,label:"Custom"}]},{id:"globalSettingsInfo",type:"notification",footer:u.createFooter({label:"Change global settings [here].",replace:{here:{event:"general-settings.open"}}})}];var on=(t=>(t.Main="main",t.Basics="basics",t.Layout="layout",t.Style="style",t.Security="security",t.Targets="targets",t))(on||{});const Ia=t=>t,Ea=t=>t;i.AllTextStylePlugins=ua,i.AllTextStyles=ha,i.Attachments=oe,i.AttachmentsProvider=se,i.AttachmentsToolbarButton=de,i.BUTTON_PLUGIN=Ae,i.BlockButtonStyles=mt,i.BlockInjectButton=fn,i.BlockItemWrapper=zn,i.BlockStyles=N,i.BorderStyle=H,i.ButtonPlugin=Fe,i.Custom1Plugin=We,i.Custom2Plugin=Ge,i.Custom3Plugin=Ke,i.DEFAULT_ATTACHMENTS_BUTTON_ID=ce,i.DEFAULT_DRAGGING_TOOLTIP=ue,i.DEFAULT_DRAG_TOOLTIP=ge,i.DEFAULT_MENU_BUTTON_ID=St,i.DownloadButton=$n,i.DragHandleToolbarButton=he,i.DragPreviewContextProvider=Zt,i.ELEMENT_BUTTON=x,i.FlyoutToolbarButton=xt,i.GutterSpacing=Q,i.Heading1Plugin=Qe,i.Heading2Plugin=Ye,i.Heading3Plugin=Je,i.Heading4Plugin=Ze,i.ImageCaptionPlugin=Re,i.ImageTitlePlugin=tn,i.LinkInput=Be,i.LinkPlugin=$e,i.LinkSelector=Ee,i.Margin=K,i.MenuToolbarButton=we,i.MultiFlyoutContextProvider=te,i.PARAGRAPH_CLASSES=nn,i.Padding=j,i.ParagraphMarkupElement=rn,i.ParagraphMarkupElementNode=yt,i.ParagraphPlugin=en,i.QuoteMarkupElementNode=ft,i.QuotePlugin=sn,i.Radius=$,i.RichTextEditor=Tr,i.Sections=on,i.Security=X,i.THEME_PREFIX=wa,i.TextStylePluginsWithoutImage=Ht,i.TextStyles=v,i.TextStylesWithoutImage=et,i.Toolbar=ye,i.ToolbarFlyoutMenu=me,i.addHttps=gt,i.borderStyleMap=Xt,i.convertToRteValue=qn,i.createButtonNode=Se,i.createButtonPlugin=Me,i.createLinkPlugin=ze,i.createParagraphPlugin=an,i.createQuotePlugin=ln,i.customCoordinatesGetterFactory=ie,i.defineBlock=Ia,i.defineSettings=Ea,i.getBackgroundColorStyles=Pn,i.getBackgroundSettings=ya,i.getBorderRadiusSettings=ba,i.getBorderRadiusSlider=Vt,i.getBorderSettings=fa,i.getBorderStyles=Bn,i.getDefaultPluginsWithLinkChooser=ma,i.getExtendedBorderRadiusSettings=pa,i.getGutterSettings=va,i.getLegacyUrl=Qn,i.getLinkFromEditor=Jn,i.getMarginExtendedSettings=ka,i.getMarginSettings=Ca,i.getMarginSlider=zt,i.getPaddingExtendedSettings=Sa,i.getPaddingSettings=xa,i.getPaddingSlider=$t,i.getRadiusStyles=Nn,i.getReadableColor=Sn,i.getSecurityDownloadableSetting=Ta,i.getSecurityGlobalControlId=Wt,i.getSecurityGlobalControlSetting=Pa,i.getUrl=Yn,i.getUrlFromEditor=xe,i.getUrlFromLinkOrLegacyLink=It,i.gutterSpacingStyleMap=Qt,i.hasRichTextValue=fe,i.insertButton=ve,i.isDark=pn,i.isDownloadable=Gn,i.isValidUrl=ut,i.isValidUrlOrEmpty=R,i.joinClassNames=_,i.mapAppBridgeColorPaletteToFonduePalette=be,i.mapAppBridgeColorPalettesToFonduePalettes=jn,i.marginStyleMap=Z,i.moveItemInArray=Tn,i.paddingStyleMap=J,i.radiusStyleMap=G,i.relativeUrlRegex=Et,i.setAlpha=kn,i.submitFloatingButton=Bt,i.toColorObject=xn,i.toHex8String=vn,i.toHexString=Cn,i.toRgbaString=vt,i.toShortRgba=q,i.triggerFloatingButton=Te,i.triggerFloatingButtonEdit=ht,i.triggerFloatingButtonInsert=Lt,i.unwrapButton=tt,i.upsertButton=Ce,i.upsertButtonText=Nt,i.useAttachments=re,i.useAttachmentsContext=le,i.useDndSensors=Fn,i.useDragPreviewContext=st,i.useMultiFlyoutContext=ee,i.useMultiFlyoutState=dt,i.withAttachmentsProvider=Ln,i.withButton=pe,i.wrapButton=ke,Object.keys(u).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(i,t)&&Object.defineProperty(i,t,{enumerable:!0,get:()=>u[t]})}),Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});
4
4
  //# sourceMappingURL=index.umd.js.map