@frontify/guideline-blocks-settings 0.30.0 → 0.30.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @frontify/guideline-blocks-settings
2
2
 
3
+ ## 0.30.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#691](https://github.com/Frontify/brand-sdk/pull/691) [`2a2f106`](https://github.com/Frontify/brand-sdk/commit/2a2f106c0f79c7d43dfddf3d0193fa9eeb7835a3) Thanks [@SamCreasey](https://github.com/SamCreasey)! - Toolbar components and types have been made available in build
8
+
9
+ - [#692](https://github.com/Frontify/brand-sdk/pull/692) [`43866c2`](https://github.com/Frontify/brand-sdk/commit/43866c28fa470d5dbf4e61a7d42796904629fead) Thanks [@SamCreasey](https://github.com/SamCreasey)! - BlockItemToolbar: Force line-height to be 1 on toolbar items to prevent wrapping element height from being miscalculated.
10
+
11
+ - Updated dependencies [[`3fa74ba`](https://github.com/Frontify/brand-sdk/commit/3fa74badfedd8c52661f23e0528dc35d8a10062d)]:
12
+ - @frontify/app-bridge@3.0.2
13
+ - @frontify/sidebar-settings@0.8.3
14
+
3
15
  ## 0.30.0
4
16
 
5
17
  ### Minor Changes
@@ -1,5 +1,5 @@
1
1
  import { jsx as e } from "react/jsx-runtime";
2
- const o = ({ children: t }) => /* @__PURE__ */ e("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", children: t });
2
+ const o = ({ children: t }) => /* @__PURE__ */ e("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 });
3
3
  export {
4
4
  o as ToolbarSegment
5
5
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ToolbarSegment.es.js","sources":["../../../../src/components/BlockItemWrapper/Toolbar/ToolbarSegment.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type ReactNode } from 'react';\n\nexport const ToolbarSegment = ({ children }: { children: ReactNode }) => (\n <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\">\n {children}\n </div>\n);\n"],"names":["ToolbarSegment","children","jsx"],"mappings":";AAIa,MAAAA,IAAiB,CAAC,EAAE,UAAAC,QAC5B,gBAAAC,EAAA,OAAA,EAAI,WAAU,gHACV,UAAAD,EACL,CAAA;"}
1
+ {"version":3,"file":"ToolbarSegment.es.js","sources":["../../../../src/components/BlockItemWrapper/Toolbar/ToolbarSegment.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type ReactNode } from 'react';\n\nexport const ToolbarSegment = ({ children }: { children: ReactNode }) => (\n <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\">\n {children}\n </div>\n);\n"],"names":["ToolbarSegment","children","jsx"],"mappings":";AAIa,MAAAA,IAAiB,CAAC,EAAE,UAAAC,QAC5B,gBAAAC,EAAA,OAAA,EAAI,WAAU,gIACV,UAAAD,EACL,CAAA;"}
package/dist/index.cjs.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("@frontify/sidebar-settings"),s=require("react/jsx-runtime"),i=require("@frontify/fondue"),p=require("react"),K=require("@frontify/app-bridge"),E=require("@dnd-kit/core"),tn=require("@dnd-kit/modifiers"),le=require("@dnd-kit/sortable"),Ge=require("@react-aria/focus"),o=require("@udecode/plate"),Ke=require("slate-react"),nn=require("@react-stately/overlays"),sn=require("slate"),U=require("@ctrl/tinycolor");const D=e=>e.filter(Boolean).join(" "),rn=({onDrop:e,label:t,icon:n,secondaryLabel:r,isLoading:a,fillParentContainer:l,onAssetChooseClick:c,onUploadClick:d,withMenu:u=!0,onClick:f,validFileType:m,verticalLayout:g})=>{const[w,y]=p.useState(!1),[v,C]=p.useState(),L=p.useRef(null),[P,N]=p.useState(void 0),H=S=>{if(S.preventDefault(),y(!1),!F(S.dataTransfer.files)){N("Invalid"),setTimeout(()=>{N(void 0)},1e3);return}e==null||e(S.dataTransfer.files)},F=S=>{if(!m)return!0;for(let A=0;A<S.length;A++){const R=S[A].name.split(".").pop()??"";if(!K.FileExtensionSets[m].includes(R))return!1}return!0},M=S=>{if(!L.current||a)return;const{left:A,top:R}=L.current.getBoundingClientRect(),oe=S.clientX-A,se=S.clientY-R;C([oe,se])};return s.jsxs("button",{ref:L,"data-test-id":"block-inject-button",className:D(["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",g?"[&: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",l?"tw-h-full":"tw-h-[72px]",w&&!a?"tw-border-dashed":"tw-border-solid",v&&"tw-bg-blank-state-pressed-inverse",w&&"tw-bg-blank-state-weak-inverse",P?"!tw-border-red-50 !tw-cursor-not-allowed":" tw-border-blank-state-line",a||v||w||P?"":"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",(w||v)&&!P?"[&>*]:tw-pointer-events-none tw-border-blank-state-line-hover":"tw-bg-blank-state-shaded-inverse tw-text-blank-state-shaded"]),onDragEnter:e?S=>{var A;if(y(!0),m==="Images")for(const R of Array.from(S.dataTransfer.items))(A=R==null?void 0:R.type)!=null&&A.startsWith("image/")?N(void 0):N("Invalid")}:void 0,onDragLeave:e?()=>{y(!1),N(void 0)}:void 0,onDrop:e?H:void 0,onClick:S=>{u&&M(S),f==null||f()},children:[a?s.jsx(i.LoadingCircle,{}):P?s.jsxs("div",{className:" tw-flex tw-items-center tw-justify-center tw-text-red-60 tw-font-medium",children:[s.jsx(i.IconExclamationMarkTriangle,{}),P]}):s.jsxs(s.Fragment,{children:[n&&s.jsx("div",{children:n}),(t||r)&&s.jsxs("div",{className:"tw-flex tw-flex-col tw-items-start",children:[t&&s.jsx("div",{className:"tw-font-medium",children:t}),r&&s.jsx("div",{className:"tw-font-normal",children:r})]})]}),v&&s.jsx("div",{className:"tw-absolute tw-left-0 tw-top-full tw-z-20",style:{left:v[0],top:v[1]},children:s.jsx(i.Flyout,{onOpenChange:S=>!S&&C(void 0),isOpen:!0,fitContent:!0,hug:!1,legacyFooter:!1,trigger:s.jsx("div",{}),children:s.jsx(i.ActionMenu,{menuBlocks:[{id:"menu",menuItems:[...d?[{id:"upload",size:i.MenuItemContentSize.XSmall,title:"Upload asset",onClick:()=>{d(),C(void 0)},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:s.jsx(i.IconArrowCircleUp20,{})})}]:[],...c?[{id:"asset",size:i.MenuItemContentSize.XSmall,title:"Browse asset",onClick:()=>{c(),C(void 0)},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:s.jsx(i.IconImageStack20,{})})}]:[]]}]})})})]})},X=e=>{const t=r=>typeof r=="object"&&["red","green","blue"].every(l=>r.hasOwnProperty(l)),n=r=>{const a=typeof r.alpha=="number"?r.alpha:1;return{r:r.red,g:r.green,b:r.blue,a}};return t(e)?n(e):e},an=e=>typeof e=="object"&&["red","green","blue"].every(n=>e==null?void 0:e.hasOwnProperty(n)),on=(e,t)=>{const n=an(e)?X(e):e,r=new U.TinyColor(n);return t?r.getBrightness()<t:r.isDark()||r.getAlpha()>.25&&r.getAlpha()<1},ln=e=>new U.TinyColor(X(e)).toHex8String(),cn=e=>new U.TinyColor(X(e)).toHexString(),Ie=e=>new U.TinyColor(X(e)).toRgbString(),un=(e,t)=>new U.TinyColor(t).setAlpha(e).toRgbString(),dn=e=>{const{r:t,g:n,b:r,a}=new U.TinyColor(e);return{red:t,green:n,blue:r,alpha:a}},We=e=>typeof e=="object"&&["red","green","blue"].every(n=>e==null?void 0:e.hasOwnProperty(n)),gn=(e,t)=>{const n=We(e)?X(e):e,r=We(t)?X(t):t;let a=new U.TinyColor(n);const l=new U.TinyColor(r);for(;U.readability(a,l)<4.5;)a=a.darken(1);return a.toRgbString()},mn=(e,t,n)=>{const r=[...e],a=n<0?r.length+n:n;if(a>=0&&a<r.length){const l=r.splice(t,1)[0];r.splice(a,0,l)}return r},hn=e=>({backgroundColor:Ie(e)});var O=(e=>(e.Solid="Solid",e.Dashed="Dashed",e.Dotted="Dotted",e))(O||{});const Xe={Solid:"solid",Dotted:"dotted",Dashed:"dashed"};var _=(e=>(e.None="None",e.Small="Small",e.Medium="Medium",e.Large="Large",e))(_||{});const q={None:"0px",Small:"2px",Medium:"4px",Large:"12px"};var z=(e=>(e.None="None",e.Small="Small",e.Medium="Medium",e.Large="Large",e))(z||{});const Y={None:"0px",Small:"24px",Medium:"36px",Large:"60px"};var $=(e=>(e.None="None",e.Small="Small",e.Medium="Medium",e.Large="Large",e))($||{});const J={None:"0px",Small:"24px",Medium:"36px",Large:"60px"};var G=(e=>(e.Global="Global",e.Custom="Custom",e))(G||{}),W=(e=>(e.Auto="Auto",e.S="S",e.M="M",e.L="L",e))(W||{});const Qe={Auto:"4px",S:"10px",M:"30px",L:"50px"},fn={red:241,green:241,blue:241,alpha:1},Ye={red:234,green:235,blue:235,alpha:1},wn="1px",ae="24px",ie="24px",pn=(e=O.Solid,t="1px",n=Ye)=>({borderStyle:Xe[e],borderWidth:t,borderColor:Ie(n)}),xn=(e,t=!1,n)=>({borderRadius:t?n:q[e]}),Je="Drag or press ↵ to move",Ze="Move with ↑↓←→ and confirm with ↵",qe=({children:e})=>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",children:e}),yn=e=>e==="IMAGE"?s.jsx(i.IconImage24,{}):e==="VIDEO"?s.jsx(i.IconPlayFrame24,{}):e==="AUDIO"?s.jsx(i.IconMusicNote24,{}):s.jsx(i.IconDocument24,{}),Te=p.forwardRef(({item:e,isEditing:t,draggableProps:n,transformStyle:r,isDragging:a,isOverlay:l,isLoading:c,onDelete:d,onReplaceWithBrowse:u,onReplaceWithUpload:f,onDownload:m},g)=>{const[w,y]=p.useState(),[v,{selectedFiles:C}]=K.useFileInput({multiple:!0,accept:"image/*"}),[L,{results:P,doneAll:N}]=K.useAssetUpload(),{focusProps:H,isFocusVisible:F}=Ge.useFocusRing();p.useEffect(()=>{C&&L(C[0])},[C]),p.useEffect(()=>{N&&f(P[0])},[N,P]);const M=c||C&&!N;return s.jsxs("button",{"aria-label":"Download attachment","data-test-id":"attachments-item",onClick:()=>m==null?void 0:m(),ref:g,style:{...r,opacity:a&&!l?.3:1,fontFamily:"var(-f-theme-settings-body-font-family)"},className:D(["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",a?"tw-bg-box-neutral-hover":""]),children:[s.jsx("div",{className:"tw-text-text-weak group-hover:tw-text-box-neutral-inverse-hover",children:M?s.jsx(i.LoadingCircle,{size:i.LoadingCircleSize.Small}):yn(e.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:e.title}),s.jsx("div",{className:"tw-text-text-weak",children:`${e.fileSizeHumanReadable} - ${e.extension}`})]}),t&&s.jsxs("div",{"data-test-id":"attachments-actionbar",className:D(["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",l||(w==null?void 0:w.id)===e.id?"tw-opacity-100":"tw-opacity-0"]),children:[s.jsx("button",{...H,...n,"aria-label":"Drag attachment",className:D([" 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 ",a||l?"tw-cursor-grabbing tw-bg-button-background-pressed hover:tw-bg-button-background-pressed":"tw-cursor-grab hover:tw-bg-button-background-hover",F&&i.FOCUS_STYLE,F&&"tw-z-[2]"]),children:s.jsx(i.IconGrabHandle20,{})}),s.jsx("div",{"data-test-id":"attachments-actionbar-flyout",children:s.jsx(i.Flyout,{placement:i.FlyoutPlacement.Right,isOpen:(w==null?void 0:w.id)===e.id,fitContent:!0,legacyFooter:!1,onOpenChange:S=>y(S?e:void 0),trigger:(S,A)=>s.jsx(i.Button,{ref:A,icon:s.jsx(i.IconPen20,{}),emphasis:i.ButtonEmphasis.Default,onClick:()=>y(e)}),children:s.jsx(i.ActionMenu,{menuBlocks:[{id:"menu",menuItems:[{id:"upload",size:i.MenuItemContentSize.XSmall,title:"Replace with upload",onClick:()=>{v(),y(void 0)},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:s.jsx(i.IconArrowCircleUp20,{})})},{id:"asset",size:i.MenuItemContentSize.XSmall,title:"Replace with asset",onClick:()=>{u(),y(void 0)},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:s.jsx(i.IconImageStack20,{})})}]},{id:"menu-delete",menuItems:[{id:"delete",size:i.MenuItemContentSize.XSmall,title:"Delete",style:i.MenuItemStyle.Danger,onClick:()=>{d(),y(void 0)},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:s.jsx(i.IconTrashBin20,{})})}]}]})})})]})]})});Te.displayName="AttachmentItem";const bn=e=>{const{attributes:t,listeners:n,setNodeRef:r,transform:a,transition:l,isDragging:c}=le.useSortable({id:e.item.id}),d={transform:a?`translate(${a.x}px, ${a.y}px)`:"",transition:l,zIndex:c?2:1},u={...t,...n};return s.jsx(Te,{ref:r,isDragging:c,transformStyle:d,draggableProps:u,...e})},vn=({children:e,isFlyoutOpen:t})=>s.jsxs("div",{className:D(["tw-flex tw-text-[13px] 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",t?"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"]),children:[s.jsx(i.IconPaperclip16,{}),e,s.jsx(i.IconCaretDown12,{})]}),et=({items:e=[],onDelete:t,onReplaceWithBrowse:n,onReplaceWithUpload:r,onBrowse:a,onUpload:l,onSorted:c,appBridge:d,triggerComponent:u=vn,isOpen:f,onOpenChange:m})=>{const[g,w]=p.useState(e),[y,v]=p.useState(!1),C=E.useSensors(E.useSensor(E.PointerSensor),E.useSensor(E.KeyboardSensor)),[L,P]=p.useState(void 0),[N,H]=p.useState(!1),[F,M]=p.useState([]),[S,A]=p.useState(null),R=K.useEditorState(d),oe=f!==void 0,se=oe?f:y,Q=g==null?void 0:g.find(b=>b.id===L),[Xt,{results:He,doneAll:_e}]=K.useAssetUpload({onUploadProgress:()=>!N&&H(!0)}),re=b=>{const B=oe?m:v;B==null||B(b)};p.useEffect(()=>{w(e)},[e]),p.useEffect(()=>{S&&(H(!0),Xt(S))},[S]),p.useEffect(()=>{(async()=>{_e&&(await l(He),H(!1))})()},[_e,He]);const Qt=()=>{re(!1),d.openAssetChooser(b=>{a(b),d.closeAssetChooser(),re(!0)},{multiSelection:!0,selectedValueIds:g.map(b=>b.id)})},Ve=b=>{re(!1),d.openAssetChooser(async B=>{re(!0),d.closeAssetChooser(),M([...F,b.id]),await n(b,B[0]),M(F.filter(V=>V!==b.id))},{multiSelection:!1,selectedValueIds:g.map(B=>B.id)})},ze=async(b,B)=>{M([...F,b.id]),await r(b,B),M(F.filter(V=>V!==b.id))},Yt=b=>{const{active:B}=b;P(B.id)},Jt=b=>{const{active:B,over:V}=b;if(V&&B.id!==V.id&&g){const Zt=g.findIndex(ye=>ye.id===B.id),en=g.findIndex(ye=>ye.id===V.id),$e=le.arrayMove(g,Zt,en);w($e),c($e)}P(void 0)};return R||((g==null?void 0:g.length)??0)>0?s.jsx(i.LegacyTooltip,{withArrow:!0,position:i.TooltipPosition.Top,content:"Attachments",disabled:se,enterDelay:500,triggerElement:s.jsx("div",{"data-test-id":"attachments-flyout-button",children:s.jsx(i.Flyout,{placement:i.FlyoutPlacement.BottomRight,onOpenChange:b=>re(Q?!0:b),isOpen:se,hug:!1,fitContent:!0,legacyFooter:!1,trigger:s.jsx(u,{isFlyoutOpen:se,children:s.jsx("div",{children:e.length>0?e.length:"Add"})}),children:s.jsxs("div",{className:"tw-w-[300px]","data-test-id":"attachments-flyout-content",children:[g.length>0&&s.jsxs(E.DndContext,{sensors:C,collisionDetection:E.closestCenter,onDragStart:Yt,onDragEnd:Jt,modifiers:[tn.restrictToWindowEdges],children:[s.jsx(le.SortableContext,{items:g,strategy:le.rectSortingStrategy,children:s.jsx("div",{className:"tw-border-b tw-border-b-line",children:g.map(b=>s.jsx(bn,{isEditing:R,isLoading:F.includes(b.id),item:b,onDelete:()=>t(b),onReplaceWithBrowse:()=>Ve(b),onReplaceWithUpload:B=>ze(b,B),onDownload:()=>d.dispatch({name:"downloadAsset",payload:b})},b.id))})}),s.jsx(E.DragOverlay,{children:Q&&s.jsx(Te,{isOverlay:!0,isEditing:R,item:Q,isDragging:!0,onDelete:()=>t(Q),onReplaceWithBrowse:()=>Ve(Q),onReplaceWithUpload:b=>ze(Q,b)},L)})]}),R&&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(i.AssetInput,{isLoading:N,size:i.AssetInputSize.Small,onUploadClick:b=>A(b),onLibraryClick:Qt})]})]})})})}):null},tt=(e,t)=>{const{blockAssets:n,updateAssetIdsFromKey:r}=K.useBlockAssets(e),a=(n==null?void 0:n[t])||[];return{onAttachmentsAdd:async f=>{const m=a.map(g=>g.id);for(const g of f)m.push(g.id);await r(t,m)},onAttachmentDelete:async f=>{const m=a.filter(g=>g.id!==f.id).map(g=>g.id);await r(t,m)},onAttachmentReplace:async(f,m)=>{const g=a.map(w=>w.id===f.id?m.id:w.id);await r(t,g)},onAttachmentsSorted:async f=>{const m=f.map(g=>g.id);await r(t,m)},attachments:a,appBridge:e}},nt=p.createContext(null),st=({appBridge:e,children:t,assetId:n})=>{const r=tt(e,n);return s.jsx(nt.Provider,{value:r,children:t})},rt=()=>{const e=p.useContext(nt);if(!e)throw new Error("No AttachmentsContext Provided. Component must be wrapped in an 'AttachmentsProvider' or the 'withAttachmentsProvider' HOC");return e},Cn=(e,t)=>{const n=r=>s.jsx(st,{appBridge:r.appBridge,assetId:t,children:s.jsx(e,{...r})});return n.displayName="withAttachmentsProvider",n},kn=[E.KeyboardCode.Down,E.KeyboardCode.Right,E.KeyboardCode.Up,E.KeyboardCode.Left],at=(e,t)=>(n,{currentCoordinates:r,context:{activeNode:a}})=>{if(n.preventDefault(),kn.includes(n.code)){const l=(a==null?void 0:a.offsetWidth)??0,c=(a==null?void 0:a.offsetHeight)??0;switch(n.code){case E.KeyboardCode.Right:return{...r,x:r.x+l+e};case E.KeyboardCode.Left:return{...r,x:r.x-l-e};case E.KeyboardCode.Down:return{...r,y:r.y+c+t};case E.KeyboardCode.Up:return{...r,y:r.y-c-t}}}},Sn={start:["Space","Enter"],cancel:[],end:["Space","Enter","Escape"]},Pn=(e=0,t=0)=>{const n=at(e,t);return E.useSensors(E.useSensor(E.PointerSensor),E.useSensor(E.KeyboardSensor,{coordinateGetter:n,keyboardCodes:Sn}))},ce=(e,t)=>{const n=[i.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 t?n.push("tw-bg-box-neutral-pressed","tw-text-box-neutral-inverse-pressed",e==="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",e==="grab"?"tw-cursor-grab active:tw-cursor-grabbing":"tw-cursor-pointer"),D(n)},En=({children:e,isFlyoutOpen:t})=>s.jsxs("div",{className:ce("pointer",t),children:[s.jsx(i.IconPaperclip16,{}),e,s.jsx(i.IconCaretDown12,{})]}),In=({isOpen:e,onOpenChange:t})=>{const{appBridge:n,attachments:r,onAttachmentsAdd:a,onAttachmentDelete:l,onAttachmentReplace:c,onAttachmentsSorted:d}=rt();return s.jsx(et,{onUpload:a,onDelete:l,onReplaceWithBrowse:c,onReplaceWithUpload:c,onSorted:d,onBrowse:a,items:r,appBridge:n,triggerComponent:En,isOpen:e,onOpenChange:t})},Tn=({items:e,flyoutMenu:t,attachments:n,isDragging:r})=>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:[n.isEnabled&&s.jsx(qe,{children:s.jsx(In,{isOpen:n.isOpen&&!r,onOpenChange:n.onOpenChange})}),s.jsxs(qe,{children:[e.map((a,l)=>"draggableProps"in a?s.jsx(i.LegacyTooltip,{withArrow:!0,hoverDelay:0,enterDelay:300,open:r,position:i.TooltipPosition.Top,content:s.jsx("div",{children:r?Ze:a.tooltip??Je}),triggerElement:s.jsx("button",{ref:a.setActivatorNodeRef,"data-test-id":"block-item-wrapper-toolbar-btn",...a.draggableProps,className:ce("grab",r),children:a.icon})},l):s.jsx(i.LegacyTooltip,{withArrow:!0,enterDelay:300,hoverDelay:0,disabled:r,position:i.TooltipPosition.Top,content:s.jsx("div",{children:a.tooltip??""}),triggerElement:s.jsx("button",{"data-test-id":"block-item-wrapper-toolbar-btn",onClick:a.onClick,className:ce("pointer"),children:a.icon})},l)),t.items.length>0&&s.jsx(i.LegacyTooltip,{withArrow:!0,hoverDelay:0,enterDelay:300,disabled:r||t.isOpen,position:i.TooltipPosition.Top,content:s.jsx("div",{children:"Options"}),triggerElement:s.jsx("div",{className:"tw-flex tw-flex-shrink-0 tw-flex-1 tw-h-6 tw-relative",children:s.jsx(i.Flyout,{isOpen:t.isOpen&&!r,legacyFooter:!1,fitContent:!0,hug:!1,onOpenChange:t.onOpenChange,trigger:s.jsx("div",{"data-test-id":"block-item-wrapper-toolbar-flyout",className:ce("pointer",t.isOpen&&!r),children:s.jsx(i.IconDotsHorizontal16,{})}),children:s.jsx(i.ActionMenu,{menuBlocks:t.items.map((a,l)=>({id:l.toString(),menuItems:a.map((c,d)=>({id:l.toString()+d.toString(),size:i.MenuItemContentSize.XSmall,title:c.title,style:c.style,onClick:()=>{t.onOpenChange(!1),c.onClick()},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:c.icon})}))}))})})})})]})]}),Bn=({children:e,toolbarFlyoutItems:t,toolbarItems:n,shouldHideWrapper:r,shouldHideComponent:a=!1,isDragging:l,shouldFillContainer:c,outlineOffset:d=2,shouldBeShown:u=!1,showAttachments:f=!1})=>{const[m,g]=p.useState(u),[w,y]=p.useState(!1),v=p.useRef(null);if(r)return s.jsx(s.Fragment,{children:e});const C=n==null?void 0:n.filter(P=>P!==void 0),L=m||w||u;return s.jsxs("div",{ref:v,"data-test-id":"block-item-wrapper",style:{outlineOffset:d},className:D(["tw-relative tw-group tw-outline-1 tw-outline-box-selected-inverse",c&&"tw-flex-1 tw-h-full tw-w-full","hover:tw-outline focus-within:tw-outline",L&&"tw-outline",a&&"tw-opacity-0"]),children:[s.jsx("div",{style:{right:-1-d,bottom:`calc(100% - ${2+d}px)`},className:D(["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",L&&"tw-opacity-100"]),children:s.jsx(Tn,{flyoutMenu:{items:t,isOpen:m,onOpenChange:g},attachments:{isEnabled:f,isOpen:w,onOpenChange:y},items:C,isDragging:l})}),e]})},jn=({onDownload:e})=>{const{isFocused:t,focusProps:n}=Ge.useFocusRing();return s.jsx(i.LegacyTooltip,{withArrow:!0,position:i.TooltipPosition.Top,content:"Download",enterDelay:500,triggerElement:s.jsx("button",{tabIndex:0,"aria-label":"Download",...n,className:D(["tw-outline-none tw-rounded",t&&i.FOCUS_STYLE]),onClick:e,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(i.IconArrowCircleDown16,{})})})})},Ln=({value:e="",gap:t,columns:n,show:r=!0,plugins:a})=>{const[l,c]=p.useState(null);return p.useEffect(()=>{(async()=>c(await i.serializeRawToHtmlAsync(e,a,n,t)))()},[e,n,t,a]),!r||l==="<br />"?null:l!==null?s.jsx("div",{className:"tw-w-full tw-whitespace-pre-wrap","data-test-id":"rte-content-html",dangerouslySetInnerHTML:{__html:l}}):s.jsx("div",{className:"tw-rounded-sm tw-bg-base-alt tw-animate-pulse tw-h-full tw-min-h-[10px] tw-w-full"})},it=e=>{if(!e)return!1;const t=n=>n.some(r=>r.text?r.text!=="":r.children?t(r.children):!1);try{const n=JSON.parse(e);return t(n)}catch{return!1}},Nn=(e="p",t="",n)=>it(t)?t:JSON.stringify([{type:e,children:[{text:t,textStyle:e}],align:n}]),An=(e,t,n)=>e===G.Custom?t:n,Rn=e=>e.map(ot),ot=e=>({id:e.id,title:e.name,colors:e.colors.map(t=>({alpha:t.alpha?t.alpha/255:1,red:t.red??0,green:t.green??0,blue:t.blue??0,name:t.name??""}))}),Be=(e,t)=>{const n=o.getAboveNode(e,{match:{type:o.ELEMENT_LINK}});return Array.isArray(n)?t(n[0]):""},lt=e=>Be(e,t=>{var n,r;return((r=(n=t.chosenLink)==null?void 0:n.searchResult)==null?void 0:r.link)||""}),ct=e=>Be(e,t=>t.url||""),ut=e=>{var t,n;return e.url||((n=(t=e.chosenLink)==null?void 0:t.searchResult)==null?void 0:n.link)||""},dt=e=>Be(e,ut),je=/^\/(document|r)\/\S+$/i,fe=e=>{if(je.test(e))return e;try{return new URL(e),e}catch{return`https://${e}`}},we=e=>{if(je.test(e))return!0;try{const t=new URL(e);return["http:","https:","mailto:","tel:"].includes(t.protocol)&&t.pathname!==""}catch{return!1}},ee=e=>we(fe(e))||e==="",gt=(e,{type:t})=>{const{apply:n,normalizeNode:r}=e;return e.apply=a=>{if(a.type!=="set_selection"){n(a);return}const l=a.newProperties;if(!(l!=null&&l.focus)||!l.anchor||!o.isCollapsed(l)){n(a);return}const c=o.getAboveNode(e,{at:l,match:{type:o.getPluginType(e,k)}});if(c){const[,d]=c;let u;o.isStartPoint(e,l.focus,d)&&(u=o.getPreviousNodeEndPoint(e,d)),o.isEndPoint(e,l.focus,d)&&(u=o.getNextNodeStartPoint(e,d)),u&&(a.newProperties={anchor:u,focus:u})}n(a)},e.normalizeNode=([a,l])=>{if(a.type===o.getPluginType(e,k)){const c=e.selection;if(c&&o.isCollapsed(c)&&o.isEndPoint(e,c.focus,l)){const d=o.getNextNodeStartPoint(e,l);if(d)o.select(e,d);else{const u=sn.Path.next(l);o.insertNodes(e,{text:""},{at:u}),o.select(e,u)}}}r([a,l])},o.withRemoveEmptyNodes(e,o.mockPlugin({options:{types:t}}))},mt=(e,t,n)=>{o.insertNodes(e,[pt(e,t)],n)},Le=o.createStore("floatingButton")({openEditorId:null,mouseDown:!1,updated:!1,url:"",text:"",buttonStyle:"primary",newTab:!1,mode:"",isEditing:!1}).extendActions(e=>({reset:()=>{e.url(""),e.text(""),e.buttonStyle("primary"),e.newTab(!1),e.mode(""),e.isEditing(!1)}})).extendActions(e=>({show:(t,n)=>{e.mode(t),e.isEditing(!1),e.openEditorId(n)},hide:()=>{e.reset(),e.openEditorId(null)}})).extendSelectors(e=>({isOpen:t=>e.openEditorId===t})),I=Le.set,j=Le.get,te=()=>Le.use,Ne=e=>{if(!e.selection)return;const{isUrl:t,forceSubmit:n}=o.getPluginOptions(e,k),r=j.url();if(!((t==null?void 0:t(r))||n))return;const l=j.text(),c=j.buttonStyle(),d=j.newTab()?void 0:"_self";return I.hide(),ht(e,{url:r,text:l,buttonStyle:c,target:d,isUrl:u=>n||!t?!0:t(u)}),setTimeout(()=>{o.focusEditor(e,e.selection??void 0)},0),!0},ne=(e,t)=>o.withoutNormalizing(e,()=>{var n,r,a,l,c,d;if(t!=null&&t.split){if(o.getAboveNode(e,{at:(n=e.selection)==null?void 0:n.anchor,match:{type:o.getPluginType(e,k)}}))return o.splitNodes(e,{at:(r=e.selection)==null?void 0:r.anchor,match:m=>o.isElement(m)&&m.type===o.getPluginType(e,k)}),ne(e,{at:(a=e.selection)==null?void 0:a.anchor}),!0;if(o.getAboveNode(e,{at:(l=e.selection)==null?void 0:l.focus,match:{type:o.getPluginType(e,k)}}))return o.splitNodes(e,{at:(c=e.selection)==null?void 0:c.focus,match:m=>o.isElement(m)&&m.type===o.getPluginType(e,k)}),ne(e,{at:(d=e.selection)==null?void 0:d.focus}),!0}o.unwrapNodes(e,{match:{type:o.getPluginType(e,k)},...t})}),ht=(e,{url:t,text:n,buttonStyle:r,target:a,insertTextInButton:l,insertNodesOptions:c,isUrl:d=o.getPluginOptions(e,k).isUrl})=>{var P;const u=e.selection;if(!u)return;const f=o.getAboveNode(e,{at:u,match:{type:o.getPluginType(e,k)}});if(l&&f)return e.insertText(t),!0;if(!(d!=null&&d(t)))return;if(o.isDefined(n)&&n.length===0&&(n=t),f)return On(t,e,f,a,r,n),!0;const m=o.findNode(e,{at:u,match:{type:o.getPluginType(e,k)}}),[g,w]=m??[],y=Fn(e,w,n);if(o.isExpanded(u))return Mn(f,e,t,r,a,n),!0;y&&o.removeNodes(e,{at:w});const v=o.getNodeProps(g??{}),C=(P=e.selection)==null?void 0:P.focus.path;if(!C)return;const L=o.getNodeLeaf(e,C);return n!=null&&n.length||(n=t),mt(e,{...v,url:t,target:a,children:[{...L,text:n}]},c),!0};function Fn(e,t,n){return t&&(n==null?void 0:n.length)&&n!==o.getEditorString(e,t)}function Mn(e,t,n,r,a,l){e?ne(t,{at:e[1]}):ne(t,{split:!0}),ft(t,{url:n,buttonStyle:r,target:a}),Ae(t,{url:n,target:a,text:l})}function On(e,t,n,r,a,l){var c,d,u;(e!==((c=n[0])==null?void 0:c.url)||r!==((d=n[0])==null?void 0:d.target)||a!==((u=n[0])==null?void 0:u.buttonStyle))&&o.setNodes(t,{url:e,target:r,buttonStyle:a},{at:n[1]}),Ae(t,{url:e,text:l,target:r})}const Ae=(e,{text:t})=>{const n=o.getAboveNode(e,{match:{type:o.getPluginType(e,k)}});if(n){const[r,a]=n;if(t!=null&&t.length&&t!==o.getEditorString(e,a)){const l=r.children[0];o.replaceNodeChildren(e,{at:a,nodes:{...l,text:t},insertOptions:{select:!0}})}}},ft=(e,{url:t,buttonStyle:n,target:r,...a})=>{o.wrapNodes(e,{type:o.getPluginType(e,k),url:t,buttonStyle:n,target:r,children:[]},{split:!0,...a})},Dn=(e,t)=>{const n=o.getAboveNode(e,{match:{type:k}});return Array.isArray(n)?t(n[0]):""},wt=e=>Dn(e,t=>t.url??""),pt=(e,{url:t,text:n="",buttonStyle:r="primary",target:a,children:l})=>({type:o.getPluginType(e,k),url:t,target:a,buttonStyle:r,children:l??[{text:n}]}),xt=(e,{focused:t}={})=>{if(j.mode()==="edit"){pe(e);return}Re(e,{focused:t})},pe=e=>{const t=o.findNode(e,{match:{type:o.getPluginType(e,k)}});if(!t)return;const[n,r]=t;let a=o.getEditorString(e,r);I.url(n.url),I.newTab(n.target===void 0),a===n.url&&(a=""),I.text(a),I.isEditing(!0)},Re=(e,{focused:t}={})=>{j.mode()||!t||o.isRangeAcrossBlocks(e,{at:e.selection})||o.someNode(e,{match:{type:o.getPluginType(e,k)}})||(I.text(o.getEditorString(e,e.selection)),I.show("insert",e.id))},xe={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)"}}},Un=e=>({...o.useElementProps({...e,elementToAttributes:n=>({url:n.href,buttonStyle:n.buttonStyle||"primary",target:n.target||"_blank"})}),onMouseOver:n=>{n.stopPropagation()}}),Hn=e=>{const{href:t,target:n,buttonStyle:r}=Un(e),{attributes:a,children:l}=e;return s.jsx(_n,{attributes:a,href:t,target:n,styles:xe[`button${r.charAt(0).toUpperCase()+r.slice(1)}`],children:l})},_n=({attributes:e,styles:t={hover:{}},children:n,href:r="#",target:a})=>{const[l,c]=p.useState(!1);return s.jsx("a",{...e,onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),href:r,target:a,style:l?{...t,...t.hover}:t,children:n})};class Vn extends i.MarkupElement{constructor(t=k,n=Hn){super(t,n)}}const zn=({type:e,...t})=>{const n=o.useEditorRef(),r=!!o.isRangeInSameBlock(n,{at:n.selection}),a=!!(n!=null&&n.selection)&&o.someNode(n,{match:{type:e}});return s.jsx(o.ToolbarButton,{tooltip:i.getTooltip(r?`Button
2
- ${i.getHotkeyByPlatform("Ctrl+Shift+K")}`:"Buttons can only be set for a single text block."),classNames:i.getButtonClassNames(r),active:a,onMouseDown:async l=>{n&&(l.preventDefault(),l.stopPropagation(),o.focusEditor(n,n.selection??n.prevSelection??void 0),setTimeout(()=>{xt(n,{focused:!0})},0))},...t})},$n=({editor:e,id:t})=>s.jsx("div",{"data-plugin-id":t,children:s.jsx(zn,{type:o.getPluginType(e,k),icon:s.jsx("span",{className:"tw-p-2 tw-h-8 tw-justify-center tw-items-center tw-flex",children:s.jsx(i.IconButton16,{})}),styles:i.buttonStyles})}),Wn=()=>{const e=ds({});return s.jsx("div",{"data-test-id":"floating-button-edit",className:"tw-bg-white tw-text-text tw-rounded tw-shadow tw-p-4 tw-min-w-[400px]",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:e.defaultValue}),s.jsxs("span",{className:"tw-flex tw-gap-2",children:[s.jsx("span",{role:"button",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(de.EditButton,{children:s.jsx(i.IconPen16,{})})}),s.jsx("span",{role:"button",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(de.UnlinkButton,{children:s.jsx(i.IconTrashBin16,{})})})]})]})})},qn=({section:e,selectedUrl:t,onSelectUrl:n})=>{const r=e.permanentLink===t;return s.jsx("button",{"data-test-id":"internal-link-selector-section-link",className:i.merge(["tw-py-2 tw-px-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(e.permanentLink),children:s.jsxs("div",{className:"tw-flex tw-flex-1 tw-space-x-2 tw-items-center tw-h-6",children:[s.jsx(i.IconDocumentText16,{}),s.jsx("span",{className:"tw-text-s",children:e.title}),s.jsx("span",{className:"tw-flex-auto tw-font-sans tw-text-xs tw-text-right",children:"Section"})]})})},Gn=({page:e,selectedUrl:t,onSelectUrl:n,itemsToExpandInitially:r,appBridge:a})=>{const[l,c]=p.useState(e.id===r.documentId),d=e.permanentLink===t,{documentSections:u}=K.useDocumentSection(a,e.id),f=[...u.values()],m=f.length>0;return p.useEffect(()=>{e.id===r.pageId&&c(!0)},[r,e.id]),s.jsxs(s.Fragment,{children:[s.jsx("button",{"data-test-id":"internal-link-selector-page-link",className:i.merge(["tw-py-2 tw-pr-2.5 tw-leading-5 tw-cursor-pointer tw-flex tw-w-full",m?"tw-pl-7":"tw-pl-12",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(e.permanentLink),children:s.jsxs("div",{className:"tw-flex tw-flex-1 tw-space-x-1 tw-items-center tw-h-6",children:[m&&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(!l),children:s.jsx("div",{className:i.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",l?"tw-rotate-90":""])})}),s.jsx("span",{className:"tw-text-s",children:e.title}),s.jsx("span",{className:"tw-flex-auto tw-font-sans tw-text-xs tw-text-right",children:"Page"})]},e.id)}),l&&f.length>0&&f.map(g=>s.jsx(qn,{section:g,selectedUrl:t,onSelectUrl:n},g.id))]})},yt=()=>s.jsx("div",{className:"tw-flex tw-justify-center tw-h-10 tw-items-center",children:s.jsx(i.LoadingCircle,{size:i.LoadingCircleSize.Small})}),Kn=({appBridge:e,documentId:t,selectedUrl:n,onSelectUrl:r,itemsToExpandInitially:a})=>{const[l,c]=p.useState([]),[d,u]=p.useState(!0),f=[...l.values()],m=!d&&f.length>0;return p.useEffect(()=>{e.getDocumentPagesByDocumentId(t).then(g=>{const w=g.filter(v=>!!v.category).sort((v,C)=>v.category.sort===C.category.sort?v.sort-C.sort:v.category.sort-C.category.sort),y=g.filter(v=>!v.category).sort((v,C)=>v.sort-C.sort);c([...w,...y])}).finally(()=>{u(!1)})},[]),d?s.jsx(yt,{}):m?s.jsx(s.Fragment,{children:f.map(g=>s.jsx(Gn,{page:g,appBridge:e,selectedUrl:n,onSelectUrl:r,itemsToExpandInitially:a},g.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."})},Xn=({document:e,appBridge:t,selectedUrl:n,onSelectUrl:r,itemsToExpandInitially:a})=>{const[l,c]=p.useState(e.id===a.documentId),d=e.permanentLink===n;return p.useEffect(()=>{e.id===a.documentId&&c(!0)},[a,e.id]),s.jsxs(s.Fragment,{children:[s.jsxs("button",{"data-test-id":"internal-link-selector-document-link",className:i.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:()=>r(e.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:()=>c(!l),children:s.jsx("div",{className:i.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",l?"tw-rotate-90":""])})}),s.jsx(i.IconColorFan16,{}),s.jsx("span",{className:"tw-text-s",children:e.title}),s.jsx("span",{className:"tw-flex-auto tw-font-sans tw-text-xs tw-text-right",children:"Document"})]}),l&&s.jsx(Kn,{appBridge:t,documentId:e.id,selectedUrl:n,onSelectUrl:r,itemsToExpandInitially:a})]})},Qn=({appBridge:e,selectedUrl:t,onSelectUrl:n})=>{const[r,a]=p.useState(!0),[l,c]=p.useState([]),[d,u]=p.useState({documentId:void 0,pageId:void 0}),f=[...l.values()];p.useEffect(()=>{t&&f.length>0&&m().then(g=>{u(g)})},[f.length]),p.useEffect(()=>{e.getAllDocuments().then(g=>{c(g)}).finally(()=>{a(!1)})},[]);const m=async()=>{const g={documentId:void 0,pageId:void 0};if(f.find(y=>y.permanentLink===t))return g;for(const y of f){const v=await e.getDocumentPagesByDocumentId(y.id);e.getAllDocuments();const C=[...v.values()];if(!!C.find(P=>P.permanentLink===t))return g.documentId=y.id,g;for(const P of C)if(!![...(await e.getDocumentSectionsByDocumentPageId(P.id)).values()].find(M=>M.permanentLink===t))return g.documentId=y.id,g.pageId=P.id,g}return g};return r?s.jsx(yt,{}):s.jsx(s.Fragment,{children:f.map(g=>s.jsx(Xn,{document:g,appBridge:e,selectedUrl:t,onSelectUrl:n,itemsToExpandInitially:d},g.id))})},bt=({appBridge:e,url:t,onUrlChange:n,buttonSize:r=i.ButtonSize.Medium})=>{const{open:a,isOpen:l,close:c}=nn.useOverlayTriggerState({}),[d,u]=p.useState(t),f=w=>{u(w)},m=w=>{w.key==="Enter"&&g()};p.useEffect(()=>{t&&!d&&u(t)},[t,d]);const g=()=>{n==null||n(d),c()};return s.jsxs("div",{"data-test-id":"internal-link-selector",onKeyDown:m,children:[s.jsx(i.Button,{icon:s.jsx(i.IconLink,{}),size:r,type:i.ButtonType.Button,style:i.ButtonStyle.Default,emphasis:i.ButtonEmphasis.Default,onClick:()=>a(),children:"Internal link"}),s.jsxs(i.Modal,{zIndex:1001,onClose:()=>c(),isOpen:l,isDismissable:!0,children:[s.jsx(i.Modal.Header,{title:"Select internal link"}),s.jsx(i.Modal.Body,{children:s.jsx(Qn,{appBridge:e,selectedUrl:d,onSelectUrl:f})}),s.jsx(i.Modal.Footer,{buttons:[{children:"Cancel",onClick:()=>c(),style:i.ButtonStyle.Default,emphasis:i.ButtonEmphasis.Default},{children:"Choose",onClick:w=>{w==null||w.preventDefault(),g()},style:i.ButtonStyle.Default,emphasis:i.ButtonEmphasis.Strong,disabled:!d}]})]})]})},vt=({onUrlChange:e,onToggleTab:t,isValidUrlOrEmpty:n,appBridge:r,clearable:a,placeholder:l,newTab:c,openInNewTab:d,url:u="",required:f,info:m,label:g,buttonSize:w,hideInternalLinkButton:y})=>{const v=n?n(u):ee(u),C=c??(d?i.CheckboxState.Checked:i.CheckboxState.Unchecked);return s.jsxs("div",{"data-test-id":"link-input",children:[s.jsx(i.FormControl,{label:{children:g,htmlFor:"url",required:f,tooltip:m?{content:m,position:i.TooltipPosition.Top}:void 0},children:s.jsx(i.TextInput,{id:"url",value:u,clearable:a,onChange:e,placeholder:l??"https://example.com",focusOnMount:!0})}),!v&&s.jsx("div",{className:"tw-text-text-negative tw-mt-1 tw-text-s",children:"Please enter a valid URL."}),!y&&s.jsx("div",{className:"tw-mt-3",children:s.jsx(bt,{url:u,appBridge:r,onUrlChange:e,buttonSize:w??i.ButtonSize.Medium})}),s.jsx("div",{className:"tw-mt-3",children:s.jsx(i.Checkbox,{value:"new-tab",label:"Open in new tab",state:C,onChange:t})})]})},Ct=({state:e,onTextChange:t,onUrlChange:n,onToggleTab:r,onCancel:a,onSave:l,isValidUrlOrEmpty:c,hasValues:d,testId:u,appBridge:f,children:m})=>s.jsxs("div",{"data-test-id":u,className:"tw-bg-white tw-rounded tw-shadow tw-p-7 tw-min-w-[400px] tw-overflow-y-auto",children:[s.jsx(i.FormControl,{label:{children:"Text",htmlFor:"linkText",required:!0},children:s.jsx(i.TextInput,{id:"linkText",value:e.text,placeholder:"Link Text",onChange:t})}),m,s.jsx("div",{className:"tw-mt-5",children:s.jsx(vt,{url:e.url,newTab:e.newTab,onUrlChange:n,onToggleTab:r,isValidUrlOrEmpty:c,appBridge:f})}),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(i.Button,{onClick:a,size:i.ButtonSize.Medium,style:i.ButtonStyle.Default,emphasis:i.ButtonEmphasis.Default,children:"Cancel"}),s.jsx(i.Button,{onClick:l,size:i.ButtonSize.Medium,icon:s.jsx(i.IconCheckMark20,{}),disabled:!d||!c(e==null?void 0:e.url),children:"Save"})]})})]}),Yn=e=>{var n;const t=o.getAboveNode(e,{match:{type:k}});return Array.isArray(t)&&((n=t[0])==null?void 0:n.buttonStyle)||"primary"},Jn={url:"",text:"",buttonStyle:"primary",newTab:i.CheckboxState.Unchecked},Zn=()=>{const[e,t]=p.useReducer((n,r)=>{const{type:a,payload:l}=r;switch(a){case"NEW_TAB":return{...n,newTab:i.CheckboxState.Checked};case"SAME_TAB":return{...n,newTab:i.CheckboxState.Unchecked};case"URL":case"TEXT":case"BUTTON_STYLE":case"INIT":return{...n,...l};default:return n}},Jn);return[e,t]},es=()=>{const e=o.useEditorRef(),[t,n]=Zn();p.useEffect(()=>{const g=Yn(e);n({type:"INIT",payload:{text:j.text(),buttonStyle:g,newTab:j.newTab()?i.CheckboxState.Checked:i.CheckboxState.Unchecked,url:j.url()}})},[n,e]);const r=g=>{n({type:"TEXT",payload:{text:g}})},a=g=>{n({type:"BUTTON_STYLE",payload:{buttonStyle:g}})},l=g=>{n({type:"URL",payload:{url:g}})},c=g=>{n(g?{type:"NEW_TAB"}:{type:"SAME_TAB"})},d=()=>{I.hide()},u=g=>{if(!ee(t.url)||!f)return;const w=fe(t.url);I.text(t.text),I.url(w),I.buttonStyle(t.buttonStyle),I.newTab(t.newTab===i.CheckboxState.Checked),Ne(e)&&(g==null||g.preventDefault())},f=t.url!==""&&t.text!=="",{appBridge:m}=o.getPluginOptions(e,k);return o.useHotkeys("enter",u,{enableOnFormTags:["INPUT"]},[]),{state:t,onTextChange:r,onButtonStyleChange:a,onUrlChange:l,onToggleTab:c,onCancel:d,onSave:u,hasValues:f,isValidUrlOrEmpty:ee,appBridge:m}},ue="link-plugin";var x=(e=>(e.heading1="heading1",e.heading2="heading2",e.heading3="heading3",e.heading4="heading4",e.custom1="custom1",e.custom2="custom2",e.custom3="custom3",e.quote="quote",e.imageCaption="imageCaption",e.imageTitle="imageTitle",e.p="p",e))(x||{});const T={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)"},[ue]:{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)"},...xe},ts=()=>{const e=es(),{state:t,onButtonStyleChange:n}=e;return s.jsx(Ct,{...e,testId:"floating-button-insert",children:s.jsx("div",{className:"tw-pt-5",children:s.jsxs(i.FormControl,{label:{children:"Button Style",htmlFor:"buttonStyle",required:!0},children:[s.jsx(be,{id:"primary",styles:T.buttonPrimary,isActive:t.buttonStyle==="primary",onClick:()=>n("primary"),children:t.text||"Primary Button"}),s.jsx(be,{id:"secondary",styles:T.buttonSecondary,isActive:t.buttonStyle==="secondary",onClick:()=>n("secondary"),children:t.text||"Secondary Button"}),s.jsx(be,{id:"tertiary",styles:T.buttonTertiary,isActive:t.buttonStyle==="tertiary",onClick:()=>n("tertiary"),children:t.text||"Tertiary Button"})]})})})},be=({id:e,styles:t,isActive:n,onClick:r,children:a})=>{const[l,c]=p.useState(!1),d=()=>t&&t.hover&&l?{...t,...t.hover}:t;return s.jsx("button",{"data-test-id":`floating-button-insert-${e}`,onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),onClick:r,style:{...d(),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:a})},ns=()=>{const e=te().isEditing(),t=s.jsx(ts,{}),n=e?t:s.jsx(Wn,{});return s.jsxs(s.Fragment,{children:[s.jsx(de.InsertRoot,{children:t}),s.jsx(de.EditRoot,{children:n})]})},k="button",kt="button-plugin",St=e=>o.createPluginFactory({key:k,isElement:!0,isInline:!0,props:({element:t})=>({nodeProps:{href:t==null?void 0:t.url,target:t==null?void 0:t.target}}),withOverrides:gt,renderAfterEditable:ns,options:{isUrl:we,rangeBeforeOptions:{matchString:" ",skipInvalid:!0,afterMatch:!0},triggerFloatingButtonHotkeys:"command+shift+k, ctrl+shift+k",appBridge:e},then:(t,{type:n})=>({deserializeHtml:{rules:[{validNodeName:"A",validClassName:"btn"}],getNode:r=>({type:n,url:r.getAttribute("href"),target:r.getAttribute("target")||"_blank"})}})})();class Pt extends i.Plugin{constructor({styles:t=xe,...n}){super(kt,{button:$n,markupElement:new Vn,...n}),this.styles={},this.styles=t,this.appBridge=n==null?void 0:n.appBridge}plugins(){return[St(this.appBridge)]}}const ss=({floatingOptions:e,...t})=>{const n=o.useEditorRef(),r=o.usePlateSelectors(n.id).keyEditor(),a=te().mode(),l=te().isOpen(n.id),{triggerFloatingButtonHotkeys:c}=o.getPluginOptions(n,k),d=p.useCallback(()=>{const w=o.getAboveNode(n,{match:{type:o.getPluginType(n,k)}});if(w){const[,y]=w;return o.getRangeBoundingClientRect(n,{anchor:o.getStartPoint(n,y),focus:o.getEndPoint(n,y)})}return o.getDefaultBoundingClientRect()},[n]),u=l&&a==="edit",{update:f,style:m,floating:g}=It({open:u,getBoundingClientRect:d,...e});return p.useEffect(()=>{const w=wt(n);if(w&&I.url(w),n.selection&&o.someNode(n,{match:{type:o.getPluginType(n,k)}})){I.show("edit",n.id),f();return}j.mode()==="edit"&&I.hide()},[n,r,f]),o.useHotkeys(c,w=>{w.preventDefault(),j.mode()==="edit"&&pe(n)},{enableOnContentEditable:!0},[]),gs(),Et(),{style:{...m,zIndex:1e3},...t,ref:o.useComposedRef(t.ref,g)}},rs=({floatingOptions:e,...t})=>{const n=o.useEditorRef(),r=Ke.useFocused(),a=te().mode(),l=te().isOpen(n.id),{triggerFloatingButtonHotkeys:c}=o.getPluginOptions(n,k);o.useHotkeys(c,m=>{m.preventDefault(),Re(n,{focused:r})},{enableOnContentEditable:!0},[r]);const{update:d,style:u,floating:f}=It({open:l&&a==="insert",getBoundingClientRect:o.getSelectionBoundingClientRect,whileElementsMounted:void 0,...e});return p.useEffect(()=>{l&&d(),I.updated(l)},[l,d]),Et(),{style:{...u,zIndex:1e3},...t,ref:o.useComposedRef(t.ref,f)}},as=e=>{const t=o.useEditorRef();return{onClick:p.useCallback(()=>{pe(t)},[t]),...e}},is=o.createComponentAs(e=>{const t=as(e);return o.createElementAs("button",t)}),os=e=>{const t=o.useEditorRef();return{onClick:p.useCallback(()=>{ne(t),o.focusEditor(t,t.selection??void 0)},[t]),...e}},ls=o.createComponentAs(e=>{const t=os(e);return o.createElementAs(o.Button,t)}),cs=o.createComponentAs(e=>{var n;const t=ss(e);return((n=t.style)==null?void 0:n.display)==="none"?null:o.createElementAs("div",t)}),us=o.createComponentAs(e=>{var n;const t=rs(e);return((n=t.style)==null?void 0:n.display)==="none"?null:o.createElementAs("div",t)}),de={EditRoot:cs,InsertRoot:us,EditButton:is,UnlinkButton:ls},ds=e=>{const t=te().updated(),n=p.useRef(null);p.useEffect(()=>{n.current&&t&&setTimeout(()=>{var a;(a=n.current)==null||a.focus()},0)},[t]);const r=p.useCallback(a=>{I.url(a.target.value)},[]);return o.mergeProps({onChange:r,defaultValue:j.url()},{...e,ref:o.useComposedRef(e.ref,n)})},gs=()=>{const e=o.useEditorRef();o.useHotkeys("*",t=>{t.key==="Enter"&&Ne(e)&&t.preventDefault()},{enableOnFormTags:["INPUT"]},[])},Et=()=>{const e=o.useEditorRef();o.useHotkeys("escape",()=>{if(j.mode()==="edit"){if(j.isEditing()){I.show("edit",e.id),o.focusEditor(e,e.selection??void 0);return}I.hide()}},{enableOnFormTags:["INPUT"],enableOnContentEditable:!0},[])},ms=12,hs=-22,fs=96,It=e=>o.useVirtualFloating({placement:"bottom-start",middleware:[o.offset({mainAxis:ms,alignmentAxis:hs}),o.flip({padding:fs})],...e}),ws=({id:e="rte",isEditing:t,value:n,columns:r,gap:a,placeholder:l,plugins:c,onTextChange:d,showSerializedText:u})=>{const[f,m]=p.useState(!1),g=w=>{d&&w!==n&&d(w),m(!1)};return p.useEffect(()=>{const w=y=>(y.preventDefault(),y.returnValue="Unprocessed changes");return f&&window.addEventListener("beforeunload",w),()=>window.removeEventListener("beforeunload",w)},[f]),t?s.jsx(i.RichTextEditor,{id:e,value:n,border:!1,placeholder:l,plugins:c,onValueChanged:()=>m(!0),onTextChange:g,hideExternalFloatingModals:w=>{j.isOpen(w)&&I.reset()}}):s.jsx(Ln,{value:n,columns:r,gap:a,show:u,plugins:c})},ps=({floatingOptions:e,...t})=>{const n=o.useEditorRef(),r=Ke.useFocused(),a=o.useFloatingLinkSelectors().mode(),l=o.useFloatingLinkSelectors().isOpen(n.id),{triggerFloatingLinkHotkeys:c}=o.getPluginOptions(n,o.ELEMENT_LINK);o.useHotkeys(c,m=>{o.triggerFloatingLinkInsert(n,{focused:r})&&m.preventDefault()},{enableOnContentEditable:!0},[r]);const{update:d,style:u,floating:f}=o.useVirtualFloatingLink({editorId:n.id,open:l&&a==="insert",getBoundingClientRect:o.getSelectionBoundingClientRect,whileElementsMounted:()=>{},...e});return p.useEffect(()=>{l?(d(),o.floatingLinkActions.updated(!0)):o.floatingLinkActions.updated(!1)},[l,d]),o.useFloatingLinkEscape(),{style:{...u,zIndex:1e3},...t,ref:o.useComposedRef(t.ref,f)}},xs=o.createComponentAs(e=>{var n;const t=ps({...e,floatingOptions:{strategy:"absolute"}});return((n=t.style)==null?void 0:n.display)==="none"?null:o.createElementAs("div",t)}),ys=o.createComponentAs(e=>{var n;const t=vs({...e,floatingOptions:{strategy:"absolute"}});return((n=t.style)==null?void 0:n.display)==="none"?null:o.createElementAs("div",t)});o.FloatingLink.EditRoot=ys;o.FloatingLink.InsertRoot=xs;const ge=o.FloatingLink,bs=()=>{const e=o.useFloatingLinkUrlInput({});return s.jsx("div",{"data-test-id":"floating-link-edit",className:"tw-bg-white tw-text-text tw-rounded tw-shadow tw-p-4 tw-min-w-[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:e.defaultValue}),s.jsxs("span",{className:"tw-flex tw-gap-2",children:[s.jsx("span",{role:"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",children:s.jsx(ge.EditButton,{children:s.jsx(i.IconPen16,{})})}),s.jsx("span",{role:"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",children:s.jsx(ge.UnlinkButton,{children:s.jsx(i.IconTrashBin16,{})})})]})]})})},vs=({floatingOptions:e,...t})=>{const n=o.useEditorRef(),r=o.usePlateSelectors().keyEditor(),a=o.useFloatingLinkSelectors().mode(),l=o.useFloatingLinkSelectors().isOpen(n.id),{triggerFloatingLinkHotkeys:c="command+k, ctrl+k"}=o.getPluginOptions(n,o.ELEMENT_LINK),d=p.useCallback(()=>{const w=o.getAboveNode(n,{match:{type:o.getPluginType(n,o.ELEMENT_LINK)}});if(w){const[,y]=w;return o.getRangeBoundingClientRect(n,{anchor:o.getStartPoint(n,y),focus:o.getEndPoint(n,y)})}return o.getDefaultBoundingClientRect()},[n]),u=l&&a==="edit",{update:f,style:m,floating:g}=o.useVirtualFloatingLink({editorId:n.id,open:u,getBoundingClientRect:d,...e});return p.useEffect(()=>{const w=dt(n);if(w&&o.floatingLinkActions.url(w),n.selection&&o.someNode(n,{match:{type:o.getPluginType(n,o.ELEMENT_LINK)}})){o.floatingLinkActions.show("edit",n.id),f();return}o.floatingLinkSelectors.mode()==="edit"&&o.floatingLinkActions.hide()},[n,r,f]),o.useHotkeys(c,w=>{w.preventDefault(),o.floatingLinkSelectors.mode()==="edit"&&o.triggerFloatingLinkEdit(n)},{enableOnContentEditable:!0},[]),o.useFloatingLinkEnter(),o.useFloatingLinkEscape(),{style:{...m,zIndex:1e3},...t,ref:o.useComposedRef(t.ref,g)}},Cs={url:"",text:"",newTab:i.CheckboxState.Unchecked},ks=()=>{const[e,t]=p.useReducer((n,r)=>{const{type:a,payload:l}=r;switch(a){case"NEW_TAB":return{...n,newTab:i.CheckboxState.Checked};case"SAME_TAB":return{...n,newTab:i.CheckboxState.Unchecked};case"URL":case"TEXT":case"INIT":return{...n,...l};default:return n}},Cs);return[e,t]},Ss=()=>{const e=o.useEditorRef(),[t,n]=ks();p.useEffect(()=>{const m=lt(e),g=ct(e);n({type:"INIT",payload:{text:o.floatingLinkSelectors.text(),newTab:o.floatingLinkSelectors.newTab()?i.CheckboxState.Checked:i.CheckboxState.Unchecked,url:m&&g===""?m:o.floatingLinkSelectors.url()}})},[n,e]);const r=m=>{n({type:"TEXT",payload:{text:m}})},a=m=>{n({type:"URL",payload:{url:m}})},l=m=>{n(m?{type:"NEW_TAB"}:{type:"SAME_TAB"})},c=()=>{o.floatingLinkActions.hide()},d=m=>{if(!ee(t.url)||!u)return;const g=fe(t.url);o.floatingLinkActions.text(t.text),o.floatingLinkActions.url(g),o.floatingLinkActions.newTab(t.newTab===i.CheckboxState.Checked),o.submitFloatingLink(e)&&(m==null||m.preventDefault())},u=t.url!==""&&t.text!=="",{appBridge:f}=o.getPluginOptions(e,o.ELEMENT_LINK);return o.useHotkeys("enter",d,{enableOnFormTags:["INPUT"]},[]),{state:t,onTextChange:r,onUrlChange:a,onToggleTab:l,onCancel:c,onSave:d,hasValues:u,isValidUrlOrEmpty:ee,appBridge:f}},Ps=()=>s.jsx(Ct,{...Ss(),testId:"floating-link-insert"}),Es=({readOnly:e})=>{const t=o.useFloatingLinkSelectors().isEditing();if(e)return null;const n=s.jsx(Ps,{}),r=t?n:s.jsx(bs,{});return s.jsxs(s.Fragment,{children:[s.jsx(ge.InsertRoot,{children:n}),s.jsx(ge.EditRoot,{children:r})]})},Is=({id:e,editorId:t})=>{const n=o.usePlateEditorState(o.useEventPlateId(t)),r=!!o.isRangeInSameBlock(n,{at:n.selection});return s.jsx("div",{"data-plugin-id":e,children:s.jsx(o.LinkToolbarButton,{tooltip:i.getTooltip(r?`Link
3
- ${i.getHotkeyByPlatform("Ctrl+K")}`:"Links can only be set for a single text block."),icon:s.jsx("span",{className:"tw-p-2 tw-h-8 tw-justify-center tw-items-center tw-flex",children:s.jsx(i.IconLink,{size:i.IconSize.Size16})}),classNames:i.getButtonClassNames(r),styles:{root:{width:"24px",height:"24px"}},actionHandler:"onMouseDown"})})},Ts=e=>({...o.useElementProps({...e,elementToAttributes:n=>{var r,a;return{href:n.url||((a=(r=n.chosenLink)==null?void 0:r.searchResult)==null?void 0:a.link)||"",target:n.target||"_self"}}}),onMouseOver:n=>{n.stopPropagation()}}),Bs=e=>{const t=Ts(e),{attributes:n,children:r}=e;return s.jsx("a",{...n,href:t.href,target:t.target,style:T[ue],children:r})};class js extends i.MarkupElement{constructor(t=o.ELEMENT_LINK,n=Bs){super(t,n)}}const Tt=e=>o.createPluginFactory({...o.createLinkPlugin(),renderAfterEditable:Es,options:{isUrl:we,rangeBeforeOptions:{matchString:" ",skipInvalid:!0,afterMatch:!0},triggerFloatingLinkHotkeys:"command+k, ctrl+k",appBridge:e}})();class Bt extends i.Plugin{constructor(t,n=T[ue]){super(ue,{button:Is,markupElement:new js,...t}),this.styles={},this.styles=n,this.appBridge=t==null?void 0:t.appBridge}plugins(){return[Tt(this.appBridge)]}}const Ls="textstyle-custom1-plugin";class jt extends i.Plugin{constructor({styles:t=T.custom1,...n}={}){super(x.custom1,{label:"Custom 1",markupElement:new Ns,...n}),this.styles={},this.styles=t}plugins(){return[As(this.styles)]}}class Ns extends i.MarkupElement{constructor(t=Ls,n=Lt){super(t,n)}}const Lt=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("p",{...t,style:r,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),children:n})},As=e=>o.createPluginFactory({key:x.custom1,isElement:!0,deserializeHtml:{rules:[{validClassName:x.custom1}]}})({component:t=>s.jsx(Lt,{...t,styles:e})}),Rs="textstyle-custom2-plugin";class Nt extends i.Plugin{constructor({styles:t=T.custom2,...n}={}){super(x.custom2,{label:"Custom 2",markupElement:new Fs,...n}),this.styles={},this.styles=t}plugins(){return[Ms(this.styles)]}}class Fs extends i.MarkupElement{constructor(t=Rs,n=At){super(t,n)}}const At=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("p",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},Ms=e=>o.createPluginFactory({key:x.custom2,isElement:!0,deserializeHtml:{rules:[{validClassName:x.custom2}]}})({component:t=>s.jsx(At,{...t,styles:e})}),Os="textstyle-custom3-plugin";class Rt extends i.Plugin{constructor({styles:t=T.custom3,...n}={}){super(i.TextStyles.custom3,{label:"Custom 3",markupElement:new Ds,...n}),this.styles={},this.styles=t}plugins(){return[Us(this.styles)]}}class Ds extends i.MarkupElement{constructor(t=Os,n=Ft){super(t,n)}}const Ft=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("p",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},Us=e=>o.createPluginFactory({key:i.TextStyles.custom3,isElement:!0,deserializeHtml:{rules:[{validClassName:i.TextStyles.custom3}]}})({component:t=>s.jsx(Ft,{...t,styles:e})}),Hs="textstyle-heading1-plugin";class Mt extends i.Plugin{constructor({styles:t=T.heading1,...n}={}){super(x.heading1,{label:"Heading 1",markupElement:new _s,...n}),this.styles={},this.styles=t}plugins(){return[Vs(this.styles)]}}class _s extends i.MarkupElement{constructor(t=Hs,n=ve){super(t,n)}}const ve=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("h1",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},Vs=e=>o.createPluginFactory({key:x.heading1,isElement:!0,component:ve,deserializeHtml:{rules:[{validNodeName:["h1","H1"]}]}})({component:t=>s.jsx(ve,{...t,styles:e})}),zs="textstyle-heading2-plugin";class Ot extends i.Plugin{constructor({styles:t=T.heading2,...n}={}){super(x.heading2,{label:"Heading 2",markupElement:new $s,...n}),this.styles={},this.styles=t}plugins(){return[Ws(this.styles)]}}class $s extends i.MarkupElement{constructor(t=zs,n=Ce){super(t,n)}}const Ce=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("h2",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},Ws=e=>o.createPluginFactory({key:x.heading2,isElement:!0,component:Ce,deserializeHtml:{rules:[{validNodeName:["h2","H2"]}]}})({component:t=>s.jsx(Ce,{...t,styles:e})}),qs="textstyle-heading3-plugin";class Dt extends i.Plugin{constructor({styles:t=T.heading3,...n}={}){super(x.heading3,{label:"Heading 3",markupElement:new Gs,...n}),this.styles={},this.styles=t}plugins(){return[Ks(this.styles)]}}class Gs extends i.MarkupElement{constructor(t=qs,n=ke){super(t,n)}}const ke=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("h3",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},Ks=e=>o.createPluginFactory({key:x.heading3,isElement:!0,component:ke,deserializeHtml:{rules:[{validNodeName:["h3","H3"]}]}})({component:t=>s.jsx(ke,{...t,styles:e})}),Xs="textstyle-heading4-plugin";class Ut extends i.Plugin{constructor({styles:t=T.heading4,...n}={}){super(x.heading4,{label:"Heading 4",markupElement:new Qs,...n}),this.styles={},this.styles=t}plugins(){return[Ys(this.styles)]}}class Qs extends i.MarkupElement{constructor(t=Xs,n=Se){super(t,n)}}const Se=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("h4",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},Ys=e=>o.createPluginFactory({key:x.heading4,isElement:!0,component:Se,deserializeHtml:{rules:[{validNodeName:["h4","H4"]}]}})({component:t=>s.jsx(Se,{...t,styles:e})}),Js="textstyle-imageCaption-plugin";class Ht extends i.Plugin{constructor({styles:t=T.imageCaption,...n}={}){super(x.imageCaption,{label:"Image Caption",markupElement:new Zs,...n}),this.styles={},this.styles=t}plugins(){return[er(this.styles)]}}class Zs extends i.MarkupElement{constructor(t=Js,n=Pe){super(t,n)}}const Pe=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("p",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},er=e=>o.createPluginFactory({key:x.imageCaption,isElement:!0,component:Pe,deserializeHtml:{rules:[{validClassName:x.imageCaption}]}})({component:t=>s.jsx(Pe,{...t,styles:e})}),tr="textstyle-imageTitle-plugin";class _t extends i.Plugin{constructor({styles:t=T.imageTitle,...n}={}){super(x.imageTitle,{label:"Image Title",markupElement:new nr,...n}),this.styles={},this.styles=t}plugins(){return[sr(this.styles)]}}class nr extends i.MarkupElement{constructor(t=tr,n=Ee){super(t,n)}}const Ee=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("p",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},sr=e=>o.createPluginFactory({key:x.imageTitle,isElement:!0,component:Ee,deserializeHtml:{rules:[{validClassName:x.imageTitle}]}})({component:t=>s.jsx(Ee,{...t,styles:e})});class Vt extends i.Plugin{constructor({styles:t=T.p,...n}={}){super(x.p,{markupElement:new $t,label:"Body Text",...n}),this.styles={},this.styles=t}plugins(){return[Wt(this.styles)]}}const zt="tw-m-0 tw-px-0 tw-py-0",me=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align,l=i.merge([a&&i.alignmentClassnames[a],zt,i.getColumnBreakClasses(e)]);return s.jsx("p",{...t,className:l,style:r,children:n})};class $t extends i.MarkupElement{constructor(t=x.p,n=me){super(t,n)}}const Wt=e=>o.createPluginFactory({...o.createParagraphPlugin(),key:x.p,isElement:!0,component:me})({component:t=>s.jsx(me,{...t,styles:e})}),rr="textstyle-quote-plugin";class qt extends i.Plugin{constructor({styles:t=T.quote,...n}={}){super(x.quote,{label:"Quote",markupElement:new ar,...n}),this.styles={},this.styles=t}plugins(){return[Gt(this.styles)]}}class ar extends i.MarkupElement{constructor(t=rr,n=he){super(t,n)}}const he=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("blockquote",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},Gt=e=>o.createPluginFactory({key:x.quote,isElement:!0,component:he,deserializeHtml:{rules:[{validNodeName:["blockquote","BLOCKQUOTE"]}]}})({component:t=>s.jsx(he,{...t,styles:e})}),Fe=[new Mt,new Ot,new Dt,new Ut,new jt,new Nt,new Rt,new qt,new Vt],Z=[x.heading1,x.heading2,x.heading3,x.heading4,x.custom1,x.custom2,x.custom3,x.quote,x.p],ir=[...Fe,new Ht,new _t],or=[...Z,x.imageCaption,x.imageTitle],lr=e=>new i.PluginComposer().setPlugin(new i.SoftBreakPlugin,new i.TextStylePlugin({textStyles:Fe})).setPlugin([new i.BoldPlugin,new i.ItalicPlugin,new i.UnderlinePlugin,new i.StrikethroughPlugin,new Bt({appBridge:e}),new Pt({appBridge:e}),new i.CodePlugin],[new i.AlignLeftPlugin({validTypes:Z}),new i.AlignCenterPlugin({validTypes:Z}),new i.AlignRightPlugin({validTypes:Z}),new i.AlignJustifyPlugin({validTypes:Z}),new i.UnorderedListPlugin,new i.CheckboxListPlugin,new i.OrderedListPlugin,new i.ResetFormattingPlugin,new i.AutoformatPlugin]),cr="--f-theme-settings-",ur=e=>{const t=e!=null&&e.id?`hasBackground${e.id}`:"hasBackground",n=e!=null&&e.id?`backgroundColor${e.id}`:"backgroundColor",r=e!=null&&e.preventDefaultColor?void 0:(e==null?void 0:e.defaultColor)||fn,a=e!=null&&e.switchLabel?e.switchLabel:void 0;return{id:t,label:"Background",type:"switch",switchLabel:a,defaultValue:!!(e!=null&&e.defaultValue),on:[{id:n,defaultValue:r,type:"colorInput"}]}},dr=e=>{const t=e!=null&&e.id?`hasBorder_${e.id}`:"hasBorder",n=e!=null&&e.id?`borderSelection_${e.id}`:"borderSelection",r=e!=null&&e.id?`borderStyle_${e.id}`:"borderStyle",a=e!=null&&e.id?`borderWidth_${e.id}`:"borderWidth",l=e!=null&&e.id?`borderColor_${e.id}`:"borderColor",c=(e==null?void 0:e.defaultColor)||Ye,d=e!=null&&e.switchLabel?e.switchLabel:void 0;return{id:t,label:"Border",type:"switch",switchLabel:d,defaultValue:!!(e!=null&&e.defaultValue),on:[{id:n,type:"multiInput",onChange:u=>h.appendUnit(u,a),layout:h.MultiInputLayout.Columns,lastItemFullWidth:!0,blocks:[{id:r,type:"dropdown",defaultValue:O.Solid,choices:[{value:O.Solid,label:O.Solid},{value:O.Dotted,label:O.Dotted},{value:O.Dashed,label:O.Dashed}]},{id:a,type:"input",defaultValue:wn,rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)],placeholder:"e.g. 3px"},{id:l,type:"colorInput",defaultValue:c}]}],off:[]}},Me=(e,t=_.None)=>({id:e,type:"segmentedControls",defaultValue:t,choices:[{value:_.None,label:"None"},{value:_.Small,label:"S"},{value:_.Medium,label:"M"},{value:_.Large,label:"L"}]}),gr=e=>{const t=e!=null&&e.id?`hasRadius_${e.id}`:"hasRadius",n=e!=null&&e.id?`radiusValue_${e.id}`:"radiusValue",r=e!=null&&e.id?`radiusChoice_${e.id}`:"radiusChoice",a=(e==null?void 0:e.defaultRadius)||_.None;return{id:t,label:"Corner radius",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"Determining how rounded the corners are.",show:l=>{var c;return e!=null&&e.dependentSettingId?!!((c=l.getBlock(e.dependentSettingId))!=null&&c.value):!0},onChange:l=>h.presetCustomValue(l,r,n,(e==null?void 0:e.radiusStyleMap)||q),on:[{id:n,type:"input",placeholder:"e.g. 10px",rules:[h.numericalOrPixelRule],onChange:l=>h.appendUnit(l,n)}],off:[Me(r,a)]}},mr=e=>{const t=e!=null&&e.id?`hasExtendedCustomRadius_${e.id}`:"hasExtendedCustomRadius",n=e!=null&&e.id?`extendedRadiusValue_${e.id}`:"extendedRadiusValue",r=e!=null&&e.id?`extendedRadiusChoice_${e.id}`:"extendedRadiusChoice",a=e!=null&&e.id?`extendedRadiusTopLeft_${e.id}`:"extendedRadiusTopLeft",l=e!=null&&e.id?`extendedRadiusTopRight_${e.id}`:"extendedRadiusTopRight",c=e!=null&&e.id?`extendedRadiusBottomLeft_${e.id}`:"extendedRadiusBottomLeft",d=e!=null&&e.id?`extendedRadiusBottomRight_${e.id}`:"extendedRadiusBottomRight";return{id:t,label:"Corner radius",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"Determining how rounded the corners are.",show:u=>{var f;return e!=null&&e.dependentSettingId?!!((f=u.getBlock(e.dependentSettingId))!=null&&f.value):!0},onChange:u=>{h.presetCustomValue(u,r,a,q),h.presetCustomValue(u,r,l,q),h.presetCustomValue(u,r,c,q),h.presetCustomValue(u,r,d,q)},on:[{id:n,type:"multiInput",layout:h.MultiInputLayout.Columns,blocks:[{id:a,type:"input",label:"Top Left",rules:[h.numericalOrPixelRule],onChange:u=>h.appendUnit(u,a)},{id:l,type:"input",label:"Top Right",rules:[h.numericalOrPixelRule],onChange:u=>h.appendUnit(u,l)},{id:c,type:"input",label:"Bottom Left",rules:[h.numericalOrPixelRule],onChange:u=>h.appendUnit(u,c)},{id:d,type:"input",label:"Bottom Right",rules:[h.numericalOrPixelRule],onChange:u=>h.appendUnit(u,d)}]}],off:[Me(r,e==null?void 0:e.defaultValue)]}},hr=e=>{const t=e!=null&&e.id?e.id:"hasCustomSpacing",n=e!=null&&e.dependentSettingId?e.dependentSettingId:"columns",r=e!=null&&e.spacingChoiceId?e.spacingChoiceId:"spacingChoice",a=e!=null&&e.spacingCustomId?e.spacingCustomId:"spacingCustom",l=e!=null&&e.defaultValueChoices?e.defaultValueChoices:W.M;return{id:t,type:"switch",defaultValue:!1,switchLabel:"Custom",label:"Gutter",info:"An official nerds term for ‘gap’",onChange:c=>h.presetCustomValue(c,r,a,Qe),show:c=>{var d;return((d=c.getBlock(n))==null?void 0:d.value)!=="1"},on:[{id:a,type:"input",rules:[h.numericalOrPixelRule],onChange:c=>h.appendUnit(c,a)}],off:[{id:r,type:"slider",defaultValue:l,choices:[{value:W.Auto,label:"Auto"},{value:W.S,label:"S"},{value:W.M,label:"M"},{value:W.L,label:"L"}]}]}},Oe=e=>({id:e,type:"segmentedControls",defaultValue:$.None,choices:[{value:$.None,label:"None"},{value:$.Small,label:"S"},{value:$.Medium,label:"M"},{value:$.Large,label:"L"}]}),fr=e=>{const t=e!=null&&e.id?`hasCustomMarginValue_${e==null?void 0:e.id}`:"hasCustomMarginValue",n=e!=null&&e.id?`marginValue_${e==null?void 0:e.id}`:"marginValue",r=e!=null&&e.id?`marginChoice_${e==null?void 0:e.id}`:"marginChoice";return{id:t,label:"Margin",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more space",onChange:a=>h.presetCustomValue(a,r,n,(e==null?void 0:e.marginStyleMap)||J),on:[{id:n,type:"input",placeholder:ie,rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)],onChange:a=>h.appendUnit(a,n)}],off:[Oe(r)]}},wr=e=>{const t=e!=null&&e.id?`hasExtendedCustomMargin_${e==null?void 0:e.id}`:"hasExtendedCustomMargin",n=e!=null&&e.id?`extendedMarginValues_${e==null?void 0:e.id}`:"extendedMarginValues",r=e!=null&&e.id?`extendedMarginChoice_${e==null?void 0:e.id}`:"extendedMarginChoice",a=e!=null&&e.id?`extendedMarginTop_${e==null?void 0:e.id}`:"extendedMarginTop",l=e!=null&&e.id?`extendedMarginLeft_${e==null?void 0:e.id}`:"extendedMarginLeft",c=e!=null&&e.id?`extendedMarginRight_${e==null?void 0:e.id}`:"extendedMarginRight",d=e!=null&&e.id?`extendedMarginBottom_${e==null?void 0:e.id}`:"extendedMarginBottom";return{id:t,label:"Margin",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more negative space",onChange:u=>{h.presetCustomValue(u,r,a,J),h.presetCustomValue(u,r,l,J),h.presetCustomValue(u,r,c,J),h.presetCustomValue(u,r,d,J)},on:[{id:n,type:"multiInput",layout:h.MultiInputLayout.Spider,blocks:[{id:a,type:"input",label:"Top",placeholder:ie,onChange:u=>h.appendUnit(u,a),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:l,type:"input",label:"Left",placeholder:ie,onChange:u=>h.appendUnit(u,l),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:c,type:"input",label:"Right",placeholder:ie,onChange:u=>h.appendUnit(u,c),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:d,type:"input",label:"Bottom",placeholder:ie,onChange:u=>h.appendUnit(u,d),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]}]}],off:[Oe(r)]}},De=e=>({id:e,type:"segmentedControls",defaultValue:z.Small,choices:[{value:z.None,label:"None"},{value:z.Small,label:"S"},{value:z.Medium,label:"M"},{value:z.Large,label:"L"}]}),pr=e=>{const t=e!=null&&e.id?`hasCustomPaddingValue_${e==null?void 0:e.id}`:"hasCustomPaddingValue",n=e!=null&&e.id?`paddingValue_${e==null?void 0:e.id}`:"paddingValue",r=e!=null&&e.id?`paddingChoice_${e==null?void 0:e.id}`:"paddingChoice";return{id:t,label:"Padding",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more negative space",onChange:a=>h.presetCustomValue(a,r,n,(e==null?void 0:e.paddingStyleMap)||Y),on:[{id:n,type:"input",placeholder:ae,rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)],onChange:a=>h.appendUnit(a,n)}],off:[De(r)]}},xr=e=>{const t=e!=null&&e.id?`hasExtendedCustomPadding_${e==null?void 0:e.id}`:"hasExtendedCustomPadding",n=e!=null&&e.id?`extendedPaddingValues_${e==null?void 0:e.id}`:"extendedPaddingValues",r=e!=null&&e.id?`extendedPaddingChoice_${e==null?void 0:e.id}`:"extendedPaddingChoice",a=e!=null&&e.id?`extendedPaddingTop_${e==null?void 0:e.id}`:"extendedPaddingTop",l=e!=null&&e.id?`extendedPaddingLeft_${e==null?void 0:e.id}`:"extendedPaddingLeft",c=e!=null&&e.id?`extendedPaddingRight_${e==null?void 0:e.id}`:"extendedPaddingRight",d=e!=null&&e.id?`extendedPaddingBottom_${e==null?void 0:e.id}`:"extendedPaddingBottom";return{id:t,label:"Padding",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more negative space",onChange:u=>{h.presetCustomValue(u,r,a,Y),h.presetCustomValue(u,r,l,Y),h.presetCustomValue(u,r,c,Y),h.presetCustomValue(u,r,d,Y)},on:[{id:n,type:"multiInput",layout:h.MultiInputLayout.Spider,blocks:[{id:a,type:"input",label:"Top",placeholder:ae,onChange:u=>h.appendUnit(u,a),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:l,type:"input",label:"Left",placeholder:ae,onChange:u=>h.appendUnit(u,l),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:c,type:"input",label:"Right",placeholder:ae,onChange:u=>h.appendUnit(u,c),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:d,type:"input",label:"Bottom",placeholder:ae,onChange:u=>h.appendUnit(u,d),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]}]}],off:[De(r)]}},yr=e=>{const t=Ue(e==null?void 0:e.globalControlId);return{id:e!=null&&e.id?e.id:"downloadable",type:"switch",defaultValue:!1,label:"Downloadable",show:n=>{var r;return((r=n.getBlock(t))==null?void 0:r.value)===G.Custom}}},Ue=e=>e||"security",br=e=>[{id:Ue(e),type:"segmentedControls",defaultValue:G.Global,choices:[{value:G.Global,label:"Global Settings"},{value:G.Custom,label:"Custom"}]},{id:"globalSettingsInfo",type:"notification",footer:h.createFooter({label:"Change global settings [here].",replace:{here:{event:"general-settings.open"}}})}];var Kt=(e=>(e.Main="main",e.Basics="basics",e.Layout="layout",e.Style="style",e.Security="security",e.Targets="targets",e))(Kt||{});const vr=e=>e,Cr=e=>e;exports.AllTextStylePlugins=ir;exports.AllTextStyles=or;exports.Attachments=et;exports.AttachmentsProvider=st;exports.BUTTON_PLUGIN=kt;exports.BlockButtonStyles=xe;exports.BlockInjectButton=rn;exports.BlockItemWrapper=Bn;exports.BlockStyles=T;exports.BorderStyle=O;exports.ButtonPlugin=Pt;exports.Custom1Plugin=jt;exports.Custom2Plugin=Nt;exports.Custom3Plugin=Rt;exports.DEFAULT_DRAGGING_TOOLTIP=Ze;exports.DEFAULT_DRAG_TOOLTIP=Je;exports.DownloadButton=jn;exports.ELEMENT_BUTTON=k;exports.GutterSpacing=W;exports.Heading1Plugin=Mt;exports.Heading2Plugin=Ot;exports.Heading3Plugin=Dt;exports.Heading4Plugin=Ut;exports.ImageCaptionPlugin=Ht;exports.ImageTitlePlugin=_t;exports.LinkInput=vt;exports.LinkPlugin=Bt;exports.LinkSelector=bt;exports.Margin=$;exports.PARAGRAPH_CLASSES=zt;exports.Padding=z;exports.ParagraphMarkupElement=$t;exports.ParagraphMarkupElementNode=me;exports.ParagraphPlugin=Vt;exports.QuoteMarkupElementNode=he;exports.QuotePlugin=qt;exports.Radius=_;exports.RichTextEditor=ws;exports.Sections=Kt;exports.Security=G;exports.THEME_PREFIX=cr;exports.TextStylePluginsWithoutImage=Fe;exports.TextStyles=x;exports.TextStylesWithoutImage=Z;exports.addHttps=fe;exports.borderStyleMap=Xe;exports.convertToRteValue=Nn;exports.createButtonNode=pt;exports.createButtonPlugin=St;exports.createLinkPlugin=Tt;exports.createParagraphPlugin=Wt;exports.createQuotePlugin=Gt;exports.customCoordinatesGetterFactory=at;exports.defineBlock=vr;exports.defineSettings=Cr;exports.getBackgroundColorStyles=hn;exports.getBackgroundSettings=ur;exports.getBorderRadiusSettings=gr;exports.getBorderRadiusSlider=Me;exports.getBorderSettings=dr;exports.getBorderStyles=pn;exports.getDefaultPluginsWithLinkChooser=lr;exports.getExtendedBorderRadiusSettings=mr;exports.getGutterSettings=hr;exports.getLegacyUrl=lt;exports.getLinkFromEditor=dt;exports.getMarginExtendedSettings=wr;exports.getMarginSettings=fr;exports.getMarginSlider=Oe;exports.getPaddingExtendedSettings=xr;exports.getPaddingSettings=pr;exports.getPaddingSlider=De;exports.getRadiusStyles=xn;exports.getReadableColor=gn;exports.getSecurityDownloadableSetting=yr;exports.getSecurityGlobalControlId=Ue;exports.getSecurityGlobalControlSetting=br;exports.getUrl=ct;exports.getUrlFromEditor=wt;exports.getUrlFromLinkOrLegacyLink=ut;exports.gutterSpacingStyleMap=Qe;exports.hasRichTextValue=it;exports.insertButton=mt;exports.isDark=on;exports.isDownloadable=An;exports.isValidUrl=we;exports.isValidUrlOrEmpty=ee;exports.joinClassNames=D;exports.mapAppBridgeColorPaletteToFonduePalette=ot;exports.mapAppBridgeColorPalettesToFonduePalettes=Rn;exports.marginStyleMap=J;exports.moveItemInArray=mn;exports.paddingStyleMap=Y;exports.radiusStyleMap=q;exports.relativeUrlRegex=je;exports.setAlpha=un;exports.submitFloatingButton=Ne;exports.toColorObject=dn;exports.toHex8String=ln;exports.toHexString=cn;exports.toRgbaString=Ie;exports.toShortRgba=X;exports.triggerFloatingButton=xt;exports.triggerFloatingButtonEdit=pe;exports.triggerFloatingButtonInsert=Re;exports.unwrapButton=ne;exports.upsertButton=ht;exports.upsertButtonText=Ae;exports.useAttachments=tt;exports.useAttachmentsContext=rt;exports.useDndSensors=Pn;exports.withAttachmentsProvider=Cn;exports.withButton=gt;exports.wrapButton=ft;Object.keys(h).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>h[e]})});
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("@frontify/sidebar-settings"),s=require("react/jsx-runtime"),i=require("@frontify/fondue"),p=require("react"),K=require("@frontify/app-bridge"),E=require("@dnd-kit/core"),nn=require("@dnd-kit/modifiers"),le=require("@dnd-kit/sortable"),Ge=require("@react-aria/focus"),o=require("@udecode/plate"),Ke=require("slate-react"),sn=require("@react-stately/overlays"),rn=require("slate"),U=require("@ctrl/tinycolor");const D=e=>e.filter(Boolean).join(" "),an=({onDrop:e,label:t,icon:n,secondaryLabel:r,isLoading:a,fillParentContainer:l,onAssetChooseClick:c,onUploadClick:d,withMenu:u=!0,onClick:f,validFileType:m,verticalLayout:g})=>{const[w,y]=p.useState(!1),[v,C]=p.useState(),L=p.useRef(null),[P,N]=p.useState(void 0),H=S=>{if(S.preventDefault(),y(!1),!F(S.dataTransfer.files)){N("Invalid"),setTimeout(()=>{N(void 0)},1e3);return}e==null||e(S.dataTransfer.files)},F=S=>{if(!m)return!0;for(let A=0;A<S.length;A++){const R=S[A].name.split(".").pop()??"";if(!K.FileExtensionSets[m].includes(R))return!1}return!0},M=S=>{if(!L.current||a)return;const{left:A,top:R}=L.current.getBoundingClientRect(),oe=S.clientX-A,se=S.clientY-R;C([oe,se])};return s.jsxs("button",{ref:L,"data-test-id":"block-inject-button",className:D(["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",g?"[&: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",l?"tw-h-full":"tw-h-[72px]",w&&!a?"tw-border-dashed":"tw-border-solid",v&&"tw-bg-blank-state-pressed-inverse",w&&"tw-bg-blank-state-weak-inverse",P?"!tw-border-red-50 !tw-cursor-not-allowed":" tw-border-blank-state-line",a||v||w||P?"":"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",(w||v)&&!P?"[&>*]:tw-pointer-events-none tw-border-blank-state-line-hover":"tw-bg-blank-state-shaded-inverse tw-text-blank-state-shaded"]),onDragEnter:e?S=>{var A;if(y(!0),m==="Images")for(const R of Array.from(S.dataTransfer.items))(A=R==null?void 0:R.type)!=null&&A.startsWith("image/")?N(void 0):N("Invalid")}:void 0,onDragLeave:e?()=>{y(!1),N(void 0)}:void 0,onDrop:e?H:void 0,onClick:S=>{u&&M(S),f==null||f()},children:[a?s.jsx(i.LoadingCircle,{}):P?s.jsxs("div",{className:" tw-flex tw-items-center tw-justify-center tw-text-red-60 tw-font-medium",children:[s.jsx(i.IconExclamationMarkTriangle,{}),P]}):s.jsxs(s.Fragment,{children:[n&&s.jsx("div",{children:n}),(t||r)&&s.jsxs("div",{className:"tw-flex tw-flex-col tw-items-start",children:[t&&s.jsx("div",{className:"tw-font-medium",children:t}),r&&s.jsx("div",{className:"tw-font-normal",children:r})]})]}),v&&s.jsx("div",{className:"tw-absolute tw-left-0 tw-top-full tw-z-20",style:{left:v[0],top:v[1]},children:s.jsx(i.Flyout,{onOpenChange:S=>!S&&C(void 0),isOpen:!0,fitContent:!0,hug:!1,legacyFooter:!1,trigger:s.jsx("div",{}),children:s.jsx(i.ActionMenu,{menuBlocks:[{id:"menu",menuItems:[...d?[{id:"upload",size:i.MenuItemContentSize.XSmall,title:"Upload asset",onClick:()=>{d(),C(void 0)},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:s.jsx(i.IconArrowCircleUp20,{})})}]:[],...c?[{id:"asset",size:i.MenuItemContentSize.XSmall,title:"Browse asset",onClick:()=>{c(),C(void 0)},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:s.jsx(i.IconImageStack20,{})})}]:[]]}]})})})]})},X=e=>{const t=r=>typeof r=="object"&&["red","green","blue"].every(l=>r.hasOwnProperty(l)),n=r=>{const a=typeof r.alpha=="number"?r.alpha:1;return{r:r.red,g:r.green,b:r.blue,a}};return t(e)?n(e):e},on=e=>typeof e=="object"&&["red","green","blue"].every(n=>e==null?void 0:e.hasOwnProperty(n)),ln=(e,t)=>{const n=on(e)?X(e):e,r=new U.TinyColor(n);return t?r.getBrightness()<t:r.isDark()||r.getAlpha()>.25&&r.getAlpha()<1},cn=e=>new U.TinyColor(X(e)).toHex8String(),un=e=>new U.TinyColor(X(e)).toHexString(),Ie=e=>new U.TinyColor(X(e)).toRgbString(),dn=(e,t)=>new U.TinyColor(t).setAlpha(e).toRgbString(),gn=e=>{const{r:t,g:n,b:r,a}=new U.TinyColor(e);return{red:t,green:n,blue:r,alpha:a}},We=e=>typeof e=="object"&&["red","green","blue"].every(n=>e==null?void 0:e.hasOwnProperty(n)),mn=(e,t)=>{const n=We(e)?X(e):e,r=We(t)?X(t):t;let a=new U.TinyColor(n);const l=new U.TinyColor(r);for(;U.readability(a,l)<4.5;)a=a.darken(1);return a.toRgbString()},hn=(e,t,n)=>{const r=[...e],a=n<0?r.length+n:n;if(a>=0&&a<r.length){const l=r.splice(t,1)[0];r.splice(a,0,l)}return r},fn=e=>({backgroundColor:Ie(e)});var O=(e=>(e.Solid="Solid",e.Dashed="Dashed",e.Dotted="Dotted",e))(O||{});const Xe={Solid:"solid",Dotted:"dotted",Dashed:"dashed"};var _=(e=>(e.None="None",e.Small="Small",e.Medium="Medium",e.Large="Large",e))(_||{});const q={None:"0px",Small:"2px",Medium:"4px",Large:"12px"};var z=(e=>(e.None="None",e.Small="Small",e.Medium="Medium",e.Large="Large",e))(z||{});const Y={None:"0px",Small:"24px",Medium:"36px",Large:"60px"};var $=(e=>(e.None="None",e.Small="Small",e.Medium="Medium",e.Large="Large",e))($||{});const J={None:"0px",Small:"24px",Medium:"36px",Large:"60px"};var G=(e=>(e.Global="Global",e.Custom="Custom",e))(G||{}),W=(e=>(e.Auto="Auto",e.S="S",e.M="M",e.L="L",e))(W||{});const Qe={Auto:"4px",S:"10px",M:"30px",L:"50px"},wn={red:241,green:241,blue:241,alpha:1},Ye={red:234,green:235,blue:235,alpha:1},pn="1px",ae="24px",ie="24px",xn=(e=O.Solid,t="1px",n=Ye)=>({borderStyle:Xe[e],borderWidth:t,borderColor:Ie(n)}),yn=(e,t=!1,n)=>({borderRadius:t?n:q[e]}),Je="Drag or press ↵ to move",Ze="Move with ↑↓←→ and confirm with ↵",qe=({children:e})=>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:e}),bn=e=>e==="IMAGE"?s.jsx(i.IconImage24,{}):e==="VIDEO"?s.jsx(i.IconPlayFrame24,{}):e==="AUDIO"?s.jsx(i.IconMusicNote24,{}):s.jsx(i.IconDocument24,{}),Te=p.forwardRef(({item:e,isEditing:t,draggableProps:n,transformStyle:r,isDragging:a,isOverlay:l,isLoading:c,onDelete:d,onReplaceWithBrowse:u,onReplaceWithUpload:f,onDownload:m},g)=>{const[w,y]=p.useState(),[v,{selectedFiles:C}]=K.useFileInput({multiple:!0,accept:"image/*"}),[L,{results:P,doneAll:N}]=K.useAssetUpload(),{focusProps:H,isFocusVisible:F}=Ge.useFocusRing();p.useEffect(()=>{C&&L(C[0])},[C]),p.useEffect(()=>{N&&f(P[0])},[N,P]);const M=c||C&&!N;return s.jsxs("button",{"aria-label":"Download attachment","data-test-id":"attachments-item",onClick:()=>m==null?void 0:m(),ref:g,style:{...r,opacity:a&&!l?.3:1,fontFamily:"var(-f-theme-settings-body-font-family)"},className:D(["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",a?"tw-bg-box-neutral-hover":""]),children:[s.jsx("div",{className:"tw-text-text-weak group-hover:tw-text-box-neutral-inverse-hover",children:M?s.jsx(i.LoadingCircle,{size:i.LoadingCircleSize.Small}):bn(e.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:e.title}),s.jsx("div",{className:"tw-text-text-weak",children:`${e.fileSizeHumanReadable} - ${e.extension}`})]}),t&&s.jsxs("div",{"data-test-id":"attachments-actionbar",className:D(["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",l||(w==null?void 0:w.id)===e.id?"tw-opacity-100":"tw-opacity-0"]),children:[s.jsx("button",{...H,...n,"aria-label":"Drag attachment",className:D([" 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 ",a||l?"tw-cursor-grabbing tw-bg-button-background-pressed hover:tw-bg-button-background-pressed":"tw-cursor-grab hover:tw-bg-button-background-hover",F&&i.FOCUS_STYLE,F&&"tw-z-[2]"]),children:s.jsx(i.IconGrabHandle20,{})}),s.jsx("div",{"data-test-id":"attachments-actionbar-flyout",children:s.jsx(i.Flyout,{placement:i.FlyoutPlacement.Right,isOpen:(w==null?void 0:w.id)===e.id,fitContent:!0,legacyFooter:!1,onOpenChange:S=>y(S?e:void 0),trigger:(S,A)=>s.jsx(i.Button,{ref:A,icon:s.jsx(i.IconPen20,{}),emphasis:i.ButtonEmphasis.Default,onClick:()=>y(e)}),children:s.jsx(i.ActionMenu,{menuBlocks:[{id:"menu",menuItems:[{id:"upload",size:i.MenuItemContentSize.XSmall,title:"Replace with upload",onClick:()=>{v(),y(void 0)},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:s.jsx(i.IconArrowCircleUp20,{})})},{id:"asset",size:i.MenuItemContentSize.XSmall,title:"Replace with asset",onClick:()=>{u(),y(void 0)},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:s.jsx(i.IconImageStack20,{})})}]},{id:"menu-delete",menuItems:[{id:"delete",size:i.MenuItemContentSize.XSmall,title:"Delete",style:i.MenuItemStyle.Danger,onClick:()=>{d(),y(void 0)},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:s.jsx(i.IconTrashBin20,{})})}]}]})})})]})]})});Te.displayName="AttachmentItem";const vn=e=>{const{attributes:t,listeners:n,setNodeRef:r,transform:a,transition:l,isDragging:c}=le.useSortable({id:e.item.id}),d={transform:a?`translate(${a.x}px, ${a.y}px)`:"",transition:l,zIndex:c?2:1},u={...t,...n};return s.jsx(Te,{ref:r,isDragging:c,transformStyle:d,draggableProps:u,...e})},Cn=({children:e,isFlyoutOpen:t})=>s.jsxs("div",{className:D(["tw-flex tw-text-[13px] 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",t?"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"]),children:[s.jsx(i.IconPaperclip16,{}),e,s.jsx(i.IconCaretDown12,{})]}),et=({items:e=[],onDelete:t,onReplaceWithBrowse:n,onReplaceWithUpload:r,onBrowse:a,onUpload:l,onSorted:c,appBridge:d,triggerComponent:u=Cn,isOpen:f,onOpenChange:m})=>{const[g,w]=p.useState(e),[y,v]=p.useState(!1),C=E.useSensors(E.useSensor(E.PointerSensor),E.useSensor(E.KeyboardSensor)),[L,P]=p.useState(void 0),[N,H]=p.useState(!1),[F,M]=p.useState([]),[S,A]=p.useState(null),R=K.useEditorState(d),oe=f!==void 0,se=oe?f:y,Q=g==null?void 0:g.find(b=>b.id===L),[Qt,{results:He,doneAll:_e}]=K.useAssetUpload({onUploadProgress:()=>!N&&H(!0)}),re=b=>{const B=oe?m:v;B==null||B(b)};p.useEffect(()=>{w(e)},[e]),p.useEffect(()=>{S&&(H(!0),Qt(S))},[S]),p.useEffect(()=>{(async()=>{_e&&(await l(He),H(!1))})()},[_e,He]);const Yt=()=>{re(!1),d.openAssetChooser(b=>{a(b),d.closeAssetChooser(),re(!0)},{multiSelection:!0,selectedValueIds:g.map(b=>b.id)})},Ve=b=>{re(!1),d.openAssetChooser(async B=>{re(!0),d.closeAssetChooser(),M([...F,b.id]),await n(b,B[0]),M(F.filter(V=>V!==b.id))},{multiSelection:!1,selectedValueIds:g.map(B=>B.id)})},ze=async(b,B)=>{M([...F,b.id]),await r(b,B),M(F.filter(V=>V!==b.id))},Jt=b=>{const{active:B}=b;P(B.id)},Zt=b=>{const{active:B,over:V}=b;if(V&&B.id!==V.id&&g){const en=g.findIndex(ye=>ye.id===B.id),tn=g.findIndex(ye=>ye.id===V.id),$e=le.arrayMove(g,en,tn);w($e),c($e)}P(void 0)};return R||((g==null?void 0:g.length)??0)>0?s.jsx(i.LegacyTooltip,{withArrow:!0,position:i.TooltipPosition.Top,content:"Attachments",disabled:se,enterDelay:500,triggerElement:s.jsx("div",{"data-test-id":"attachments-flyout-button",children:s.jsx(i.Flyout,{placement:i.FlyoutPlacement.BottomRight,onOpenChange:b=>re(Q?!0:b),isOpen:se,hug:!1,fitContent:!0,legacyFooter:!1,trigger:s.jsx(u,{isFlyoutOpen:se,children:s.jsx("div",{children:e.length>0?e.length:"Add"})}),children:s.jsxs("div",{className:"tw-w-[300px]","data-test-id":"attachments-flyout-content",children:[g.length>0&&s.jsxs(E.DndContext,{sensors:C,collisionDetection:E.closestCenter,onDragStart:Jt,onDragEnd:Zt,modifiers:[nn.restrictToWindowEdges],children:[s.jsx(le.SortableContext,{items:g,strategy:le.rectSortingStrategy,children:s.jsx("div",{className:"tw-border-b tw-border-b-line",children:g.map(b=>s.jsx(vn,{isEditing:R,isLoading:F.includes(b.id),item:b,onDelete:()=>t(b),onReplaceWithBrowse:()=>Ve(b),onReplaceWithUpload:B=>ze(b,B),onDownload:()=>d.dispatch({name:"downloadAsset",payload:b})},b.id))})}),s.jsx(E.DragOverlay,{children:Q&&s.jsx(Te,{isOverlay:!0,isEditing:R,item:Q,isDragging:!0,onDelete:()=>t(Q),onReplaceWithBrowse:()=>Ve(Q),onReplaceWithUpload:b=>ze(Q,b)},L)})]}),R&&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(i.AssetInput,{isLoading:N,size:i.AssetInputSize.Small,onUploadClick:b=>A(b),onLibraryClick:Yt})]})]})})})}):null},tt=(e,t)=>{const{blockAssets:n,updateAssetIdsFromKey:r}=K.useBlockAssets(e),a=(n==null?void 0:n[t])||[];return{onAttachmentsAdd:async f=>{const m=a.map(g=>g.id);for(const g of f)m.push(g.id);await r(t,m)},onAttachmentDelete:async f=>{const m=a.filter(g=>g.id!==f.id).map(g=>g.id);await r(t,m)},onAttachmentReplace:async(f,m)=>{const g=a.map(w=>w.id===f.id?m.id:w.id);await r(t,g)},onAttachmentsSorted:async f=>{const m=f.map(g=>g.id);await r(t,m)},attachments:a,appBridge:e}},nt=p.createContext(null),st=({appBridge:e,children:t,assetId:n})=>{const r=tt(e,n);return s.jsx(nt.Provider,{value:r,children:t})},rt=()=>{const e=p.useContext(nt);if(!e)throw new Error("No AttachmentsContext Provided. Component must be wrapped in an 'AttachmentsProvider' or the 'withAttachmentsProvider' HOC");return e},kn=(e,t)=>{const n=r=>s.jsx(st,{appBridge:r.appBridge,assetId:t,children:s.jsx(e,{...r})});return n.displayName="withAttachmentsProvider",n},Sn=[E.KeyboardCode.Down,E.KeyboardCode.Right,E.KeyboardCode.Up,E.KeyboardCode.Left],at=(e,t)=>(n,{currentCoordinates:r,context:{activeNode:a}})=>{if(n.preventDefault(),Sn.includes(n.code)){const l=(a==null?void 0:a.offsetWidth)??0,c=(a==null?void 0:a.offsetHeight)??0;switch(n.code){case E.KeyboardCode.Right:return{...r,x:r.x+l+e};case E.KeyboardCode.Left:return{...r,x:r.x-l-e};case E.KeyboardCode.Down:return{...r,y:r.y+c+t};case E.KeyboardCode.Up:return{...r,y:r.y-c-t}}}},Pn={start:["Space","Enter"],cancel:[],end:["Space","Enter","Escape"]},En=(e=0,t=0)=>{const n=at(e,t);return E.useSensors(E.useSensor(E.PointerSensor),E.useSensor(E.KeyboardSensor,{coordinateGetter:n,keyboardCodes:Pn}))},ce=(e,t)=>{const n=[i.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 t?n.push("tw-bg-box-neutral-pressed","tw-text-box-neutral-inverse-pressed",e==="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",e==="grab"?"tw-cursor-grab active:tw-cursor-grabbing":"tw-cursor-pointer"),D(n)},In=({children:e,isFlyoutOpen:t})=>s.jsxs("div",{className:ce("pointer",t),children:[s.jsx(i.IconPaperclip16,{}),e,s.jsx(i.IconCaretDown12,{})]}),Tn=({isOpen:e,onOpenChange:t})=>{const{appBridge:n,attachments:r,onAttachmentsAdd:a,onAttachmentDelete:l,onAttachmentReplace:c,onAttachmentsSorted:d}=rt();return s.jsx(et,{onUpload:a,onDelete:l,onReplaceWithBrowse:c,onReplaceWithUpload:c,onSorted:d,onBrowse:a,items:r,appBridge:n,triggerComponent:In,isOpen:e,onOpenChange:t})},it=({items:e,flyoutMenu:t,attachments:n,isDragging:r})=>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:[n.isEnabled&&s.jsx(qe,{children:s.jsx(Tn,{isOpen:n.isOpen&&!r,onOpenChange:n.onOpenChange})}),s.jsxs(qe,{children:[e.map((a,l)=>"draggableProps"in a?s.jsx(i.LegacyTooltip,{withArrow:!0,hoverDelay:0,enterDelay:300,open:r,position:i.TooltipPosition.Top,content:s.jsx("div",{children:r?Ze:a.tooltip??Je}),triggerElement:s.jsx("button",{ref:a.setActivatorNodeRef,"data-test-id":"block-item-wrapper-toolbar-btn",...a.draggableProps,className:ce("grab",r),children:a.icon})},l):s.jsx(i.LegacyTooltip,{withArrow:!0,enterDelay:300,hoverDelay:0,disabled:r,position:i.TooltipPosition.Top,content:s.jsx("div",{children:a.tooltip??""}),triggerElement:s.jsx("button",{"data-test-id":"block-item-wrapper-toolbar-btn",onClick:a.onClick,className:ce("pointer"),children:a.icon})},l)),t.items.length>0&&s.jsx(i.LegacyTooltip,{withArrow:!0,hoverDelay:0,enterDelay:300,disabled:r||t.isOpen,position:i.TooltipPosition.Top,content:s.jsx("div",{children:"Options"}),triggerElement:s.jsx("div",{className:"tw-flex tw-flex-shrink-0 tw-flex-1 tw-h-6 tw-relative",children:s.jsx(i.Flyout,{isOpen:t.isOpen&&!r,legacyFooter:!1,fitContent:!0,hug:!1,onOpenChange:t.onOpenChange,trigger:s.jsx("div",{"data-test-id":"block-item-wrapper-toolbar-flyout",className:ce("pointer",t.isOpen&&!r),children:s.jsx(i.IconDotsHorizontal16,{})}),children:s.jsx(i.ActionMenu,{menuBlocks:t.items.map((a,l)=>({id:l.toString(),menuItems:a.map((c,d)=>({id:l.toString()+d.toString(),size:i.MenuItemContentSize.XSmall,title:c.title,style:c.style,onClick:()=>{t.onOpenChange(!1),c.onClick()},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:c.icon})}))}))})})})})]})]}),Bn=({children:e,toolbarFlyoutItems:t,toolbarItems:n,shouldHideWrapper:r,shouldHideComponent:a=!1,isDragging:l,shouldFillContainer:c,outlineOffset:d=2,shouldBeShown:u=!1,showAttachments:f=!1})=>{const[m,g]=p.useState(u),[w,y]=p.useState(!1),v=p.useRef(null);if(r)return s.jsx(s.Fragment,{children:e});const C=n==null?void 0:n.filter(P=>P!==void 0),L=m||w||u;return s.jsxs("div",{ref:v,"data-test-id":"block-item-wrapper",style:{outlineOffset:d},className:D(["tw-relative tw-group tw-outline-1 tw-outline-box-selected-inverse",c&&"tw-flex-1 tw-h-full tw-w-full","hover:tw-outline focus-within:tw-outline",L&&"tw-outline",a&&"tw-opacity-0"]),children:[s.jsx("div",{style:{right:-1-d,bottom:`calc(100% - ${2+d}px)`},className:D(["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",L&&"tw-opacity-100"]),children:s.jsx(it,{flyoutMenu:{items:t,isOpen:m,onOpenChange:g},attachments:{isEnabled:f,isOpen:w,onOpenChange:y},items:C,isDragging:l})}),e]})},jn=({onDownload:e})=>{const{isFocused:t,focusProps:n}=Ge.useFocusRing();return s.jsx(i.LegacyTooltip,{withArrow:!0,position:i.TooltipPosition.Top,content:"Download",enterDelay:500,triggerElement:s.jsx("button",{tabIndex:0,"aria-label":"Download",...n,className:D(["tw-outline-none tw-rounded",t&&i.FOCUS_STYLE]),onClick:e,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(i.IconArrowCircleDown16,{})})})})},Ln=({value:e="",gap:t,columns:n,show:r=!0,plugins:a})=>{const[l,c]=p.useState(null);return p.useEffect(()=>{(async()=>c(await i.serializeRawToHtmlAsync(e,a,n,t)))()},[e,n,t,a]),!r||l==="<br />"?null:l!==null?s.jsx("div",{className:"tw-w-full tw-whitespace-pre-wrap","data-test-id":"rte-content-html",dangerouslySetInnerHTML:{__html:l}}):s.jsx("div",{className:"tw-rounded-sm tw-bg-base-alt tw-animate-pulse tw-h-full tw-min-h-[10px] tw-w-full"})},ot=e=>{if(!e)return!1;const t=n=>n.some(r=>r.text?r.text!=="":r.children?t(r.children):!1);try{const n=JSON.parse(e);return t(n)}catch{return!1}},Nn=(e="p",t="",n)=>ot(t)?t:JSON.stringify([{type:e,children:[{text:t,textStyle:e}],align:n}]),An=(e,t,n)=>e===G.Custom?t:n,Rn=e=>e.map(lt),lt=e=>({id:e.id,title:e.name,colors:e.colors.map(t=>({alpha:t.alpha?t.alpha/255:1,red:t.red??0,green:t.green??0,blue:t.blue??0,name:t.name??""}))}),Be=(e,t)=>{const n=o.getAboveNode(e,{match:{type:o.ELEMENT_LINK}});return Array.isArray(n)?t(n[0]):""},ct=e=>Be(e,t=>{var n,r;return((r=(n=t.chosenLink)==null?void 0:n.searchResult)==null?void 0:r.link)||""}),ut=e=>Be(e,t=>t.url||""),dt=e=>{var t,n;return e.url||((n=(t=e.chosenLink)==null?void 0:t.searchResult)==null?void 0:n.link)||""},gt=e=>Be(e,dt),je=/^\/(document|r)\/\S+$/i,fe=e=>{if(je.test(e))return e;try{return new URL(e),e}catch{return`https://${e}`}},we=e=>{if(je.test(e))return!0;try{const t=new URL(e);return["http:","https:","mailto:","tel:"].includes(t.protocol)&&t.pathname!==""}catch{return!1}},ee=e=>we(fe(e))||e==="",mt=(e,{type:t})=>{const{apply:n,normalizeNode:r}=e;return e.apply=a=>{if(a.type!=="set_selection"){n(a);return}const l=a.newProperties;if(!(l!=null&&l.focus)||!l.anchor||!o.isCollapsed(l)){n(a);return}const c=o.getAboveNode(e,{at:l,match:{type:o.getPluginType(e,k)}});if(c){const[,d]=c;let u;o.isStartPoint(e,l.focus,d)&&(u=o.getPreviousNodeEndPoint(e,d)),o.isEndPoint(e,l.focus,d)&&(u=o.getNextNodeStartPoint(e,d)),u&&(a.newProperties={anchor:u,focus:u})}n(a)},e.normalizeNode=([a,l])=>{if(a.type===o.getPluginType(e,k)){const c=e.selection;if(c&&o.isCollapsed(c)&&o.isEndPoint(e,c.focus,l)){const d=o.getNextNodeStartPoint(e,l);if(d)o.select(e,d);else{const u=rn.Path.next(l);o.insertNodes(e,{text:""},{at:u}),o.select(e,u)}}}r([a,l])},o.withRemoveEmptyNodes(e,o.mockPlugin({options:{types:t}}))},ht=(e,t,n)=>{o.insertNodes(e,[xt(e,t)],n)},Le=o.createStore("floatingButton")({openEditorId:null,mouseDown:!1,updated:!1,url:"",text:"",buttonStyle:"primary",newTab:!1,mode:"",isEditing:!1}).extendActions(e=>({reset:()=>{e.url(""),e.text(""),e.buttonStyle("primary"),e.newTab(!1),e.mode(""),e.isEditing(!1)}})).extendActions(e=>({show:(t,n)=>{e.mode(t),e.isEditing(!1),e.openEditorId(n)},hide:()=>{e.reset(),e.openEditorId(null)}})).extendSelectors(e=>({isOpen:t=>e.openEditorId===t})),I=Le.set,j=Le.get,te=()=>Le.use,Ne=e=>{if(!e.selection)return;const{isUrl:t,forceSubmit:n}=o.getPluginOptions(e,k),r=j.url();if(!((t==null?void 0:t(r))||n))return;const l=j.text(),c=j.buttonStyle(),d=j.newTab()?void 0:"_self";return I.hide(),ft(e,{url:r,text:l,buttonStyle:c,target:d,isUrl:u=>n||!t?!0:t(u)}),setTimeout(()=>{o.focusEditor(e,e.selection??void 0)},0),!0},ne=(e,t)=>o.withoutNormalizing(e,()=>{var n,r,a,l,c,d;if(t!=null&&t.split){if(o.getAboveNode(e,{at:(n=e.selection)==null?void 0:n.anchor,match:{type:o.getPluginType(e,k)}}))return o.splitNodes(e,{at:(r=e.selection)==null?void 0:r.anchor,match:m=>o.isElement(m)&&m.type===o.getPluginType(e,k)}),ne(e,{at:(a=e.selection)==null?void 0:a.anchor}),!0;if(o.getAboveNode(e,{at:(l=e.selection)==null?void 0:l.focus,match:{type:o.getPluginType(e,k)}}))return o.splitNodes(e,{at:(c=e.selection)==null?void 0:c.focus,match:m=>o.isElement(m)&&m.type===o.getPluginType(e,k)}),ne(e,{at:(d=e.selection)==null?void 0:d.focus}),!0}o.unwrapNodes(e,{match:{type:o.getPluginType(e,k)},...t})}),ft=(e,{url:t,text:n,buttonStyle:r,target:a,insertTextInButton:l,insertNodesOptions:c,isUrl:d=o.getPluginOptions(e,k).isUrl})=>{var P;const u=e.selection;if(!u)return;const f=o.getAboveNode(e,{at:u,match:{type:o.getPluginType(e,k)}});if(l&&f)return e.insertText(t),!0;if(!(d!=null&&d(t)))return;if(o.isDefined(n)&&n.length===0&&(n=t),f)return On(t,e,f,a,r,n),!0;const m=o.findNode(e,{at:u,match:{type:o.getPluginType(e,k)}}),[g,w]=m??[],y=Fn(e,w,n);if(o.isExpanded(u))return Mn(f,e,t,r,a,n),!0;y&&o.removeNodes(e,{at:w});const v=o.getNodeProps(g??{}),C=(P=e.selection)==null?void 0:P.focus.path;if(!C)return;const L=o.getNodeLeaf(e,C);return n!=null&&n.length||(n=t),ht(e,{...v,url:t,target:a,children:[{...L,text:n}]},c),!0};function Fn(e,t,n){return t&&(n==null?void 0:n.length)&&n!==o.getEditorString(e,t)}function Mn(e,t,n,r,a,l){e?ne(t,{at:e[1]}):ne(t,{split:!0}),wt(t,{url:n,buttonStyle:r,target:a}),Ae(t,{url:n,target:a,text:l})}function On(e,t,n,r,a,l){var c,d,u;(e!==((c=n[0])==null?void 0:c.url)||r!==((d=n[0])==null?void 0:d.target)||a!==((u=n[0])==null?void 0:u.buttonStyle))&&o.setNodes(t,{url:e,target:r,buttonStyle:a},{at:n[1]}),Ae(t,{url:e,text:l,target:r})}const Ae=(e,{text:t})=>{const n=o.getAboveNode(e,{match:{type:o.getPluginType(e,k)}});if(n){const[r,a]=n;if(t!=null&&t.length&&t!==o.getEditorString(e,a)){const l=r.children[0];o.replaceNodeChildren(e,{at:a,nodes:{...l,text:t},insertOptions:{select:!0}})}}},wt=(e,{url:t,buttonStyle:n,target:r,...a})=>{o.wrapNodes(e,{type:o.getPluginType(e,k),url:t,buttonStyle:n,target:r,children:[]},{split:!0,...a})},Dn=(e,t)=>{const n=o.getAboveNode(e,{match:{type:k}});return Array.isArray(n)?t(n[0]):""},pt=e=>Dn(e,t=>t.url??""),xt=(e,{url:t,text:n="",buttonStyle:r="primary",target:a,children:l})=>({type:o.getPluginType(e,k),url:t,target:a,buttonStyle:r,children:l??[{text:n}]}),yt=(e,{focused:t}={})=>{if(j.mode()==="edit"){pe(e);return}Re(e,{focused:t})},pe=e=>{const t=o.findNode(e,{match:{type:o.getPluginType(e,k)}});if(!t)return;const[n,r]=t;let a=o.getEditorString(e,r);I.url(n.url),I.newTab(n.target===void 0),a===n.url&&(a=""),I.text(a),I.isEditing(!0)},Re=(e,{focused:t}={})=>{j.mode()||!t||o.isRangeAcrossBlocks(e,{at:e.selection})||o.someNode(e,{match:{type:o.getPluginType(e,k)}})||(I.text(o.getEditorString(e,e.selection)),I.show("insert",e.id))},xe={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)"}}},Un=e=>({...o.useElementProps({...e,elementToAttributes:n=>({url:n.href,buttonStyle:n.buttonStyle||"primary",target:n.target||"_blank"})}),onMouseOver:n=>{n.stopPropagation()}}),Hn=e=>{const{href:t,target:n,buttonStyle:r}=Un(e),{attributes:a,children:l}=e;return s.jsx(_n,{attributes:a,href:t,target:n,styles:xe[`button${r.charAt(0).toUpperCase()+r.slice(1)}`],children:l})},_n=({attributes:e,styles:t={hover:{}},children:n,href:r="#",target:a})=>{const[l,c]=p.useState(!1);return s.jsx("a",{...e,onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),href:r,target:a,style:l?{...t,...t.hover}:t,children:n})};class Vn extends i.MarkupElement{constructor(t=k,n=Hn){super(t,n)}}const zn=({type:e,...t})=>{const n=o.useEditorRef(),r=!!o.isRangeInSameBlock(n,{at:n.selection}),a=!!(n!=null&&n.selection)&&o.someNode(n,{match:{type:e}});return s.jsx(o.ToolbarButton,{tooltip:i.getTooltip(r?`Button
2
+ ${i.getHotkeyByPlatform("Ctrl+Shift+K")}`:"Buttons can only be set for a single text block."),classNames:i.getButtonClassNames(r),active:a,onMouseDown:async l=>{n&&(l.preventDefault(),l.stopPropagation(),o.focusEditor(n,n.selection??n.prevSelection??void 0),setTimeout(()=>{yt(n,{focused:!0})},0))},...t})},$n=({editor:e,id:t})=>s.jsx("div",{"data-plugin-id":t,children:s.jsx(zn,{type:o.getPluginType(e,k),icon:s.jsx("span",{className:"tw-p-2 tw-h-8 tw-justify-center tw-items-center tw-flex",children:s.jsx(i.IconButton16,{})}),styles:i.buttonStyles})}),Wn=()=>{const e=ds({});return s.jsx("div",{"data-test-id":"floating-button-edit",className:"tw-bg-white tw-text-text tw-rounded tw-shadow tw-p-4 tw-min-w-[400px]",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:e.defaultValue}),s.jsxs("span",{className:"tw-flex tw-gap-2",children:[s.jsx("span",{role:"button",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(de.EditButton,{children:s.jsx(i.IconPen16,{})})}),s.jsx("span",{role:"button",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(de.UnlinkButton,{children:s.jsx(i.IconTrashBin16,{})})})]})]})})},qn=({section:e,selectedUrl:t,onSelectUrl:n})=>{const r=e.permanentLink===t;return s.jsx("button",{"data-test-id":"internal-link-selector-section-link",className:i.merge(["tw-py-2 tw-px-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(e.permanentLink),children:s.jsxs("div",{className:"tw-flex tw-flex-1 tw-space-x-2 tw-items-center tw-h-6",children:[s.jsx(i.IconDocumentText16,{}),s.jsx("span",{className:"tw-text-s",children:e.title}),s.jsx("span",{className:"tw-flex-auto tw-font-sans tw-text-xs tw-text-right",children:"Section"})]})})},Gn=({page:e,selectedUrl:t,onSelectUrl:n,itemsToExpandInitially:r,appBridge:a})=>{const[l,c]=p.useState(e.id===r.documentId),d=e.permanentLink===t,{documentSections:u}=K.useDocumentSection(a,e.id),f=[...u.values()],m=f.length>0;return p.useEffect(()=>{e.id===r.pageId&&c(!0)},[r,e.id]),s.jsxs(s.Fragment,{children:[s.jsx("button",{"data-test-id":"internal-link-selector-page-link",className:i.merge(["tw-py-2 tw-pr-2.5 tw-leading-5 tw-cursor-pointer tw-flex tw-w-full",m?"tw-pl-7":"tw-pl-12",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(e.permanentLink),children:s.jsxs("div",{className:"tw-flex tw-flex-1 tw-space-x-1 tw-items-center tw-h-6",children:[m&&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(!l),children:s.jsx("div",{className:i.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",l?"tw-rotate-90":""])})}),s.jsx("span",{className:"tw-text-s",children:e.title}),s.jsx("span",{className:"tw-flex-auto tw-font-sans tw-text-xs tw-text-right",children:"Page"})]},e.id)}),l&&f.length>0&&f.map(g=>s.jsx(qn,{section:g,selectedUrl:t,onSelectUrl:n},g.id))]})},bt=()=>s.jsx("div",{className:"tw-flex tw-justify-center tw-h-10 tw-items-center",children:s.jsx(i.LoadingCircle,{size:i.LoadingCircleSize.Small})}),Kn=({appBridge:e,documentId:t,selectedUrl:n,onSelectUrl:r,itemsToExpandInitially:a})=>{const[l,c]=p.useState([]),[d,u]=p.useState(!0),f=[...l.values()],m=!d&&f.length>0;return p.useEffect(()=>{e.getDocumentPagesByDocumentId(t).then(g=>{const w=g.filter(v=>!!v.category).sort((v,C)=>v.category.sort===C.category.sort?v.sort-C.sort:v.category.sort-C.category.sort),y=g.filter(v=>!v.category).sort((v,C)=>v.sort-C.sort);c([...w,...y])}).finally(()=>{u(!1)})},[]),d?s.jsx(bt,{}):m?s.jsx(s.Fragment,{children:f.map(g=>s.jsx(Gn,{page:g,appBridge:e,selectedUrl:n,onSelectUrl:r,itemsToExpandInitially:a},g.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."})},Xn=({document:e,appBridge:t,selectedUrl:n,onSelectUrl:r,itemsToExpandInitially:a})=>{const[l,c]=p.useState(e.id===a.documentId),d=e.permanentLink===n;return p.useEffect(()=>{e.id===a.documentId&&c(!0)},[a,e.id]),s.jsxs(s.Fragment,{children:[s.jsxs("button",{"data-test-id":"internal-link-selector-document-link",className:i.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:()=>r(e.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:()=>c(!l),children:s.jsx("div",{className:i.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",l?"tw-rotate-90":""])})}),s.jsx(i.IconColorFan16,{}),s.jsx("span",{className:"tw-text-s",children:e.title}),s.jsx("span",{className:"tw-flex-auto tw-font-sans tw-text-xs tw-text-right",children:"Document"})]}),l&&s.jsx(Kn,{appBridge:t,documentId:e.id,selectedUrl:n,onSelectUrl:r,itemsToExpandInitially:a})]})},Qn=({appBridge:e,selectedUrl:t,onSelectUrl:n})=>{const[r,a]=p.useState(!0),[l,c]=p.useState([]),[d,u]=p.useState({documentId:void 0,pageId:void 0}),f=[...l.values()];p.useEffect(()=>{t&&f.length>0&&m().then(g=>{u(g)})},[f.length]),p.useEffect(()=>{e.getAllDocuments().then(g=>{c(g)}).finally(()=>{a(!1)})},[]);const m=async()=>{const g={documentId:void 0,pageId:void 0};if(f.find(y=>y.permanentLink===t))return g;for(const y of f){const v=await e.getDocumentPagesByDocumentId(y.id);e.getAllDocuments();const C=[...v.values()];if(!!C.find(P=>P.permanentLink===t))return g.documentId=y.id,g;for(const P of C)if(!![...(await e.getDocumentSectionsByDocumentPageId(P.id)).values()].find(M=>M.permanentLink===t))return g.documentId=y.id,g.pageId=P.id,g}return g};return r?s.jsx(bt,{}):s.jsx(s.Fragment,{children:f.map(g=>s.jsx(Xn,{document:g,appBridge:e,selectedUrl:t,onSelectUrl:n,itemsToExpandInitially:d},g.id))})},vt=({appBridge:e,url:t,onUrlChange:n,buttonSize:r=i.ButtonSize.Medium})=>{const{open:a,isOpen:l,close:c}=sn.useOverlayTriggerState({}),[d,u]=p.useState(t),f=w=>{u(w)},m=w=>{w.key==="Enter"&&g()};p.useEffect(()=>{t&&!d&&u(t)},[t,d]);const g=()=>{n==null||n(d),c()};return s.jsxs("div",{"data-test-id":"internal-link-selector",onKeyDown:m,children:[s.jsx(i.Button,{icon:s.jsx(i.IconLink,{}),size:r,type:i.ButtonType.Button,style:i.ButtonStyle.Default,emphasis:i.ButtonEmphasis.Default,onClick:()=>a(),children:"Internal link"}),s.jsxs(i.Modal,{zIndex:1001,onClose:()=>c(),isOpen:l,isDismissable:!0,children:[s.jsx(i.Modal.Header,{title:"Select internal link"}),s.jsx(i.Modal.Body,{children:s.jsx(Qn,{appBridge:e,selectedUrl:d,onSelectUrl:f})}),s.jsx(i.Modal.Footer,{buttons:[{children:"Cancel",onClick:()=>c(),style:i.ButtonStyle.Default,emphasis:i.ButtonEmphasis.Default},{children:"Choose",onClick:w=>{w==null||w.preventDefault(),g()},style:i.ButtonStyle.Default,emphasis:i.ButtonEmphasis.Strong,disabled:!d}]})]})]})},Ct=({onUrlChange:e,onToggleTab:t,isValidUrlOrEmpty:n,appBridge:r,clearable:a,placeholder:l,newTab:c,openInNewTab:d,url:u="",required:f,info:m,label:g,buttonSize:w,hideInternalLinkButton:y})=>{const v=n?n(u):ee(u),C=c??(d?i.CheckboxState.Checked:i.CheckboxState.Unchecked);return s.jsxs("div",{"data-test-id":"link-input",children:[s.jsx(i.FormControl,{label:{children:g,htmlFor:"url",required:f,tooltip:m?{content:m,position:i.TooltipPosition.Top}:void 0},children:s.jsx(i.TextInput,{id:"url",value:u,clearable:a,onChange:e,placeholder:l??"https://example.com",focusOnMount:!0})}),!v&&s.jsx("div",{className:"tw-text-text-negative tw-mt-1 tw-text-s",children:"Please enter a valid URL."}),!y&&s.jsx("div",{className:"tw-mt-3",children:s.jsx(vt,{url:u,appBridge:r,onUrlChange:e,buttonSize:w??i.ButtonSize.Medium})}),s.jsx("div",{className:"tw-mt-3",children:s.jsx(i.Checkbox,{value:"new-tab",label:"Open in new tab",state:C,onChange:t})})]})},kt=({state:e,onTextChange:t,onUrlChange:n,onToggleTab:r,onCancel:a,onSave:l,isValidUrlOrEmpty:c,hasValues:d,testId:u,appBridge:f,children:m})=>s.jsxs("div",{"data-test-id":u,className:"tw-bg-white tw-rounded tw-shadow tw-p-7 tw-min-w-[400px] tw-overflow-y-auto",children:[s.jsx(i.FormControl,{label:{children:"Text",htmlFor:"linkText",required:!0},children:s.jsx(i.TextInput,{id:"linkText",value:e.text,placeholder:"Link Text",onChange:t})}),m,s.jsx("div",{className:"tw-mt-5",children:s.jsx(Ct,{url:e.url,newTab:e.newTab,onUrlChange:n,onToggleTab:r,isValidUrlOrEmpty:c,appBridge:f})}),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(i.Button,{onClick:a,size:i.ButtonSize.Medium,style:i.ButtonStyle.Default,emphasis:i.ButtonEmphasis.Default,children:"Cancel"}),s.jsx(i.Button,{onClick:l,size:i.ButtonSize.Medium,icon:s.jsx(i.IconCheckMark20,{}),disabled:!d||!c(e==null?void 0:e.url),children:"Save"})]})})]}),Yn=e=>{var n;const t=o.getAboveNode(e,{match:{type:k}});return Array.isArray(t)&&((n=t[0])==null?void 0:n.buttonStyle)||"primary"},Jn={url:"",text:"",buttonStyle:"primary",newTab:i.CheckboxState.Unchecked},Zn=()=>{const[e,t]=p.useReducer((n,r)=>{const{type:a,payload:l}=r;switch(a){case"NEW_TAB":return{...n,newTab:i.CheckboxState.Checked};case"SAME_TAB":return{...n,newTab:i.CheckboxState.Unchecked};case"URL":case"TEXT":case"BUTTON_STYLE":case"INIT":return{...n,...l};default:return n}},Jn);return[e,t]},es=()=>{const e=o.useEditorRef(),[t,n]=Zn();p.useEffect(()=>{const g=Yn(e);n({type:"INIT",payload:{text:j.text(),buttonStyle:g,newTab:j.newTab()?i.CheckboxState.Checked:i.CheckboxState.Unchecked,url:j.url()}})},[n,e]);const r=g=>{n({type:"TEXT",payload:{text:g}})},a=g=>{n({type:"BUTTON_STYLE",payload:{buttonStyle:g}})},l=g=>{n({type:"URL",payload:{url:g}})},c=g=>{n(g?{type:"NEW_TAB"}:{type:"SAME_TAB"})},d=()=>{I.hide()},u=g=>{if(!ee(t.url)||!f)return;const w=fe(t.url);I.text(t.text),I.url(w),I.buttonStyle(t.buttonStyle),I.newTab(t.newTab===i.CheckboxState.Checked),Ne(e)&&(g==null||g.preventDefault())},f=t.url!==""&&t.text!=="",{appBridge:m}=o.getPluginOptions(e,k);return o.useHotkeys("enter",u,{enableOnFormTags:["INPUT"]},[]),{state:t,onTextChange:r,onButtonStyleChange:a,onUrlChange:l,onToggleTab:c,onCancel:d,onSave:u,hasValues:f,isValidUrlOrEmpty:ee,appBridge:m}},ue="link-plugin";var x=(e=>(e.heading1="heading1",e.heading2="heading2",e.heading3="heading3",e.heading4="heading4",e.custom1="custom1",e.custom2="custom2",e.custom3="custom3",e.quote="quote",e.imageCaption="imageCaption",e.imageTitle="imageTitle",e.p="p",e))(x||{});const T={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)"},[ue]:{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)"},...xe},ts=()=>{const e=es(),{state:t,onButtonStyleChange:n}=e;return s.jsx(kt,{...e,testId:"floating-button-insert",children:s.jsx("div",{className:"tw-pt-5",children:s.jsxs(i.FormControl,{label:{children:"Button Style",htmlFor:"buttonStyle",required:!0},children:[s.jsx(be,{id:"primary",styles:T.buttonPrimary,isActive:t.buttonStyle==="primary",onClick:()=>n("primary"),children:t.text||"Primary Button"}),s.jsx(be,{id:"secondary",styles:T.buttonSecondary,isActive:t.buttonStyle==="secondary",onClick:()=>n("secondary"),children:t.text||"Secondary Button"}),s.jsx(be,{id:"tertiary",styles:T.buttonTertiary,isActive:t.buttonStyle==="tertiary",onClick:()=>n("tertiary"),children:t.text||"Tertiary Button"})]})})})},be=({id:e,styles:t,isActive:n,onClick:r,children:a})=>{const[l,c]=p.useState(!1),d=()=>t&&t.hover&&l?{...t,...t.hover}:t;return s.jsx("button",{"data-test-id":`floating-button-insert-${e}`,onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),onClick:r,style:{...d(),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:a})},ns=()=>{const e=te().isEditing(),t=s.jsx(ts,{}),n=e?t:s.jsx(Wn,{});return s.jsxs(s.Fragment,{children:[s.jsx(de.InsertRoot,{children:t}),s.jsx(de.EditRoot,{children:n})]})},k="button",St="button-plugin",Pt=e=>o.createPluginFactory({key:k,isElement:!0,isInline:!0,props:({element:t})=>({nodeProps:{href:t==null?void 0:t.url,target:t==null?void 0:t.target}}),withOverrides:mt,renderAfterEditable:ns,options:{isUrl:we,rangeBeforeOptions:{matchString:" ",skipInvalid:!0,afterMatch:!0},triggerFloatingButtonHotkeys:"command+shift+k, ctrl+shift+k",appBridge:e},then:(t,{type:n})=>({deserializeHtml:{rules:[{validNodeName:"A",validClassName:"btn"}],getNode:r=>({type:n,url:r.getAttribute("href"),target:r.getAttribute("target")||"_blank"})}})})();class Et extends i.Plugin{constructor({styles:t=xe,...n}){super(St,{button:$n,markupElement:new Vn,...n}),this.styles={},this.styles=t,this.appBridge=n==null?void 0:n.appBridge}plugins(){return[Pt(this.appBridge)]}}const ss=({floatingOptions:e,...t})=>{const n=o.useEditorRef(),r=o.usePlateSelectors(n.id).keyEditor(),a=te().mode(),l=te().isOpen(n.id),{triggerFloatingButtonHotkeys:c}=o.getPluginOptions(n,k),d=p.useCallback(()=>{const w=o.getAboveNode(n,{match:{type:o.getPluginType(n,k)}});if(w){const[,y]=w;return o.getRangeBoundingClientRect(n,{anchor:o.getStartPoint(n,y),focus:o.getEndPoint(n,y)})}return o.getDefaultBoundingClientRect()},[n]),u=l&&a==="edit",{update:f,style:m,floating:g}=Tt({open:u,getBoundingClientRect:d,...e});return p.useEffect(()=>{const w=pt(n);if(w&&I.url(w),n.selection&&o.someNode(n,{match:{type:o.getPluginType(n,k)}})){I.show("edit",n.id),f();return}j.mode()==="edit"&&I.hide()},[n,r,f]),o.useHotkeys(c,w=>{w.preventDefault(),j.mode()==="edit"&&pe(n)},{enableOnContentEditable:!0},[]),gs(),It(),{style:{...m,zIndex:1e3},...t,ref:o.useComposedRef(t.ref,g)}},rs=({floatingOptions:e,...t})=>{const n=o.useEditorRef(),r=Ke.useFocused(),a=te().mode(),l=te().isOpen(n.id),{triggerFloatingButtonHotkeys:c}=o.getPluginOptions(n,k);o.useHotkeys(c,m=>{m.preventDefault(),Re(n,{focused:r})},{enableOnContentEditable:!0},[r]);const{update:d,style:u,floating:f}=Tt({open:l&&a==="insert",getBoundingClientRect:o.getSelectionBoundingClientRect,whileElementsMounted:void 0,...e});return p.useEffect(()=>{l&&d(),I.updated(l)},[l,d]),It(),{style:{...u,zIndex:1e3},...t,ref:o.useComposedRef(t.ref,f)}},as=e=>{const t=o.useEditorRef();return{onClick:p.useCallback(()=>{pe(t)},[t]),...e}},is=o.createComponentAs(e=>{const t=as(e);return o.createElementAs("button",t)}),os=e=>{const t=o.useEditorRef();return{onClick:p.useCallback(()=>{ne(t),o.focusEditor(t,t.selection??void 0)},[t]),...e}},ls=o.createComponentAs(e=>{const t=os(e);return o.createElementAs(o.Button,t)}),cs=o.createComponentAs(e=>{var n;const t=ss(e);return((n=t.style)==null?void 0:n.display)==="none"?null:o.createElementAs("div",t)}),us=o.createComponentAs(e=>{var n;const t=rs(e);return((n=t.style)==null?void 0:n.display)==="none"?null:o.createElementAs("div",t)}),de={EditRoot:cs,InsertRoot:us,EditButton:is,UnlinkButton:ls},ds=e=>{const t=te().updated(),n=p.useRef(null);p.useEffect(()=>{n.current&&t&&setTimeout(()=>{var a;(a=n.current)==null||a.focus()},0)},[t]);const r=p.useCallback(a=>{I.url(a.target.value)},[]);return o.mergeProps({onChange:r,defaultValue:j.url()},{...e,ref:o.useComposedRef(e.ref,n)})},gs=()=>{const e=o.useEditorRef();o.useHotkeys("*",t=>{t.key==="Enter"&&Ne(e)&&t.preventDefault()},{enableOnFormTags:["INPUT"]},[])},It=()=>{const e=o.useEditorRef();o.useHotkeys("escape",()=>{if(j.mode()==="edit"){if(j.isEditing()){I.show("edit",e.id),o.focusEditor(e,e.selection??void 0);return}I.hide()}},{enableOnFormTags:["INPUT"],enableOnContentEditable:!0},[])},ms=12,hs=-22,fs=96,Tt=e=>o.useVirtualFloating({placement:"bottom-start",middleware:[o.offset({mainAxis:ms,alignmentAxis:hs}),o.flip({padding:fs})],...e}),ws=({id:e="rte",isEditing:t,value:n,columns:r,gap:a,placeholder:l,plugins:c,onTextChange:d,showSerializedText:u})=>{const[f,m]=p.useState(!1),g=w=>{d&&w!==n&&d(w),m(!1)};return p.useEffect(()=>{const w=y=>(y.preventDefault(),y.returnValue="Unprocessed changes");return f&&window.addEventListener("beforeunload",w),()=>window.removeEventListener("beforeunload",w)},[f]),t?s.jsx(i.RichTextEditor,{id:e,value:n,border:!1,placeholder:l,plugins:c,onValueChanged:()=>m(!0),onTextChange:g,hideExternalFloatingModals:w=>{j.isOpen(w)&&I.reset()}}):s.jsx(Ln,{value:n,columns:r,gap:a,show:u,plugins:c})},ps=({floatingOptions:e,...t})=>{const n=o.useEditorRef(),r=Ke.useFocused(),a=o.useFloatingLinkSelectors().mode(),l=o.useFloatingLinkSelectors().isOpen(n.id),{triggerFloatingLinkHotkeys:c}=o.getPluginOptions(n,o.ELEMENT_LINK);o.useHotkeys(c,m=>{o.triggerFloatingLinkInsert(n,{focused:r})&&m.preventDefault()},{enableOnContentEditable:!0},[r]);const{update:d,style:u,floating:f}=o.useVirtualFloatingLink({editorId:n.id,open:l&&a==="insert",getBoundingClientRect:o.getSelectionBoundingClientRect,whileElementsMounted:()=>{},...e});return p.useEffect(()=>{l?(d(),o.floatingLinkActions.updated(!0)):o.floatingLinkActions.updated(!1)},[l,d]),o.useFloatingLinkEscape(),{style:{...u,zIndex:1e3},...t,ref:o.useComposedRef(t.ref,f)}},xs=o.createComponentAs(e=>{var n;const t=ps({...e,floatingOptions:{strategy:"absolute"}});return((n=t.style)==null?void 0:n.display)==="none"?null:o.createElementAs("div",t)}),ys=o.createComponentAs(e=>{var n;const t=vs({...e,floatingOptions:{strategy:"absolute"}});return((n=t.style)==null?void 0:n.display)==="none"?null:o.createElementAs("div",t)});o.FloatingLink.EditRoot=ys;o.FloatingLink.InsertRoot=xs;const ge=o.FloatingLink,bs=()=>{const e=o.useFloatingLinkUrlInput({});return s.jsx("div",{"data-test-id":"floating-link-edit",className:"tw-bg-white tw-text-text tw-rounded tw-shadow tw-p-4 tw-min-w-[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:e.defaultValue}),s.jsxs("span",{className:"tw-flex tw-gap-2",children:[s.jsx("span",{role:"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",children:s.jsx(ge.EditButton,{children:s.jsx(i.IconPen16,{})})}),s.jsx("span",{role:"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",children:s.jsx(ge.UnlinkButton,{children:s.jsx(i.IconTrashBin16,{})})})]})]})})},vs=({floatingOptions:e,...t})=>{const n=o.useEditorRef(),r=o.usePlateSelectors().keyEditor(),a=o.useFloatingLinkSelectors().mode(),l=o.useFloatingLinkSelectors().isOpen(n.id),{triggerFloatingLinkHotkeys:c="command+k, ctrl+k"}=o.getPluginOptions(n,o.ELEMENT_LINK),d=p.useCallback(()=>{const w=o.getAboveNode(n,{match:{type:o.getPluginType(n,o.ELEMENT_LINK)}});if(w){const[,y]=w;return o.getRangeBoundingClientRect(n,{anchor:o.getStartPoint(n,y),focus:o.getEndPoint(n,y)})}return o.getDefaultBoundingClientRect()},[n]),u=l&&a==="edit",{update:f,style:m,floating:g}=o.useVirtualFloatingLink({editorId:n.id,open:u,getBoundingClientRect:d,...e});return p.useEffect(()=>{const w=gt(n);if(w&&o.floatingLinkActions.url(w),n.selection&&o.someNode(n,{match:{type:o.getPluginType(n,o.ELEMENT_LINK)}})){o.floatingLinkActions.show("edit",n.id),f();return}o.floatingLinkSelectors.mode()==="edit"&&o.floatingLinkActions.hide()},[n,r,f]),o.useHotkeys(c,w=>{w.preventDefault(),o.floatingLinkSelectors.mode()==="edit"&&o.triggerFloatingLinkEdit(n)},{enableOnContentEditable:!0},[]),o.useFloatingLinkEnter(),o.useFloatingLinkEscape(),{style:{...m,zIndex:1e3},...t,ref:o.useComposedRef(t.ref,g)}},Cs={url:"",text:"",newTab:i.CheckboxState.Unchecked},ks=()=>{const[e,t]=p.useReducer((n,r)=>{const{type:a,payload:l}=r;switch(a){case"NEW_TAB":return{...n,newTab:i.CheckboxState.Checked};case"SAME_TAB":return{...n,newTab:i.CheckboxState.Unchecked};case"URL":case"TEXT":case"INIT":return{...n,...l};default:return n}},Cs);return[e,t]},Ss=()=>{const e=o.useEditorRef(),[t,n]=ks();p.useEffect(()=>{const m=ct(e),g=ut(e);n({type:"INIT",payload:{text:o.floatingLinkSelectors.text(),newTab:o.floatingLinkSelectors.newTab()?i.CheckboxState.Checked:i.CheckboxState.Unchecked,url:m&&g===""?m:o.floatingLinkSelectors.url()}})},[n,e]);const r=m=>{n({type:"TEXT",payload:{text:m}})},a=m=>{n({type:"URL",payload:{url:m}})},l=m=>{n(m?{type:"NEW_TAB"}:{type:"SAME_TAB"})},c=()=>{o.floatingLinkActions.hide()},d=m=>{if(!ee(t.url)||!u)return;const g=fe(t.url);o.floatingLinkActions.text(t.text),o.floatingLinkActions.url(g),o.floatingLinkActions.newTab(t.newTab===i.CheckboxState.Checked),o.submitFloatingLink(e)&&(m==null||m.preventDefault())},u=t.url!==""&&t.text!=="",{appBridge:f}=o.getPluginOptions(e,o.ELEMENT_LINK);return o.useHotkeys("enter",d,{enableOnFormTags:["INPUT"]},[]),{state:t,onTextChange:r,onUrlChange:a,onToggleTab:l,onCancel:c,onSave:d,hasValues:u,isValidUrlOrEmpty:ee,appBridge:f}},Ps=()=>s.jsx(kt,{...Ss(),testId:"floating-link-insert"}),Es=({readOnly:e})=>{const t=o.useFloatingLinkSelectors().isEditing();if(e)return null;const n=s.jsx(Ps,{}),r=t?n:s.jsx(bs,{});return s.jsxs(s.Fragment,{children:[s.jsx(ge.InsertRoot,{children:n}),s.jsx(ge.EditRoot,{children:r})]})},Is=({id:e,editorId:t})=>{const n=o.usePlateEditorState(o.useEventPlateId(t)),r=!!o.isRangeInSameBlock(n,{at:n.selection});return s.jsx("div",{"data-plugin-id":e,children:s.jsx(o.LinkToolbarButton,{tooltip:i.getTooltip(r?`Link
3
+ ${i.getHotkeyByPlatform("Ctrl+K")}`:"Links can only be set for a single text block."),icon:s.jsx("span",{className:"tw-p-2 tw-h-8 tw-justify-center tw-items-center tw-flex",children:s.jsx(i.IconLink,{size:i.IconSize.Size16})}),classNames:i.getButtonClassNames(r),styles:{root:{width:"24px",height:"24px"}},actionHandler:"onMouseDown"})})},Ts=e=>({...o.useElementProps({...e,elementToAttributes:n=>{var r,a;return{href:n.url||((a=(r=n.chosenLink)==null?void 0:r.searchResult)==null?void 0:a.link)||"",target:n.target||"_self"}}}),onMouseOver:n=>{n.stopPropagation()}}),Bs=e=>{const t=Ts(e),{attributes:n,children:r}=e;return s.jsx("a",{...n,href:t.href,target:t.target,style:T[ue],children:r})};class js extends i.MarkupElement{constructor(t=o.ELEMENT_LINK,n=Bs){super(t,n)}}const Bt=e=>o.createPluginFactory({...o.createLinkPlugin(),renderAfterEditable:Es,options:{isUrl:we,rangeBeforeOptions:{matchString:" ",skipInvalid:!0,afterMatch:!0},triggerFloatingLinkHotkeys:"command+k, ctrl+k",appBridge:e}})();class jt extends i.Plugin{constructor(t,n=T[ue]){super(ue,{button:Is,markupElement:new js,...t}),this.styles={},this.styles=n,this.appBridge=t==null?void 0:t.appBridge}plugins(){return[Bt(this.appBridge)]}}const Ls="textstyle-custom1-plugin";class Lt extends i.Plugin{constructor({styles:t=T.custom1,...n}={}){super(x.custom1,{label:"Custom 1",markupElement:new Ns,...n}),this.styles={},this.styles=t}plugins(){return[As(this.styles)]}}class Ns extends i.MarkupElement{constructor(t=Ls,n=Nt){super(t,n)}}const Nt=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("p",{...t,style:r,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),children:n})},As=e=>o.createPluginFactory({key:x.custom1,isElement:!0,deserializeHtml:{rules:[{validClassName:x.custom1}]}})({component:t=>s.jsx(Nt,{...t,styles:e})}),Rs="textstyle-custom2-plugin";class At extends i.Plugin{constructor({styles:t=T.custom2,...n}={}){super(x.custom2,{label:"Custom 2",markupElement:new Fs,...n}),this.styles={},this.styles=t}plugins(){return[Ms(this.styles)]}}class Fs extends i.MarkupElement{constructor(t=Rs,n=Rt){super(t,n)}}const Rt=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("p",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},Ms=e=>o.createPluginFactory({key:x.custom2,isElement:!0,deserializeHtml:{rules:[{validClassName:x.custom2}]}})({component:t=>s.jsx(Rt,{...t,styles:e})}),Os="textstyle-custom3-plugin";class Ft extends i.Plugin{constructor({styles:t=T.custom3,...n}={}){super(i.TextStyles.custom3,{label:"Custom 3",markupElement:new Ds,...n}),this.styles={},this.styles=t}plugins(){return[Us(this.styles)]}}class Ds extends i.MarkupElement{constructor(t=Os,n=Mt){super(t,n)}}const Mt=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("p",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},Us=e=>o.createPluginFactory({key:i.TextStyles.custom3,isElement:!0,deserializeHtml:{rules:[{validClassName:i.TextStyles.custom3}]}})({component:t=>s.jsx(Mt,{...t,styles:e})}),Hs="textstyle-heading1-plugin";class Ot extends i.Plugin{constructor({styles:t=T.heading1,...n}={}){super(x.heading1,{label:"Heading 1",markupElement:new _s,...n}),this.styles={},this.styles=t}plugins(){return[Vs(this.styles)]}}class _s extends i.MarkupElement{constructor(t=Hs,n=ve){super(t,n)}}const ve=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("h1",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},Vs=e=>o.createPluginFactory({key:x.heading1,isElement:!0,component:ve,deserializeHtml:{rules:[{validNodeName:["h1","H1"]}]}})({component:t=>s.jsx(ve,{...t,styles:e})}),zs="textstyle-heading2-plugin";class Dt extends i.Plugin{constructor({styles:t=T.heading2,...n}={}){super(x.heading2,{label:"Heading 2",markupElement:new $s,...n}),this.styles={},this.styles=t}plugins(){return[Ws(this.styles)]}}class $s extends i.MarkupElement{constructor(t=zs,n=Ce){super(t,n)}}const Ce=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("h2",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},Ws=e=>o.createPluginFactory({key:x.heading2,isElement:!0,component:Ce,deserializeHtml:{rules:[{validNodeName:["h2","H2"]}]}})({component:t=>s.jsx(Ce,{...t,styles:e})}),qs="textstyle-heading3-plugin";class Ut extends i.Plugin{constructor({styles:t=T.heading3,...n}={}){super(x.heading3,{label:"Heading 3",markupElement:new Gs,...n}),this.styles={},this.styles=t}plugins(){return[Ks(this.styles)]}}class Gs extends i.MarkupElement{constructor(t=qs,n=ke){super(t,n)}}const ke=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("h3",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},Ks=e=>o.createPluginFactory({key:x.heading3,isElement:!0,component:ke,deserializeHtml:{rules:[{validNodeName:["h3","H3"]}]}})({component:t=>s.jsx(ke,{...t,styles:e})}),Xs="textstyle-heading4-plugin";class Ht extends i.Plugin{constructor({styles:t=T.heading4,...n}={}){super(x.heading4,{label:"Heading 4",markupElement:new Qs,...n}),this.styles={},this.styles=t}plugins(){return[Ys(this.styles)]}}class Qs extends i.MarkupElement{constructor(t=Xs,n=Se){super(t,n)}}const Se=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("h4",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},Ys=e=>o.createPluginFactory({key:x.heading4,isElement:!0,component:Se,deserializeHtml:{rules:[{validNodeName:["h4","H4"]}]}})({component:t=>s.jsx(Se,{...t,styles:e})}),Js="textstyle-imageCaption-plugin";class _t extends i.Plugin{constructor({styles:t=T.imageCaption,...n}={}){super(x.imageCaption,{label:"Image Caption",markupElement:new Zs,...n}),this.styles={},this.styles=t}plugins(){return[er(this.styles)]}}class Zs extends i.MarkupElement{constructor(t=Js,n=Pe){super(t,n)}}const Pe=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("p",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},er=e=>o.createPluginFactory({key:x.imageCaption,isElement:!0,component:Pe,deserializeHtml:{rules:[{validClassName:x.imageCaption}]}})({component:t=>s.jsx(Pe,{...t,styles:e})}),tr="textstyle-imageTitle-plugin";class Vt extends i.Plugin{constructor({styles:t=T.imageTitle,...n}={}){super(x.imageTitle,{label:"Image Title",markupElement:new nr,...n}),this.styles={},this.styles=t}plugins(){return[sr(this.styles)]}}class nr extends i.MarkupElement{constructor(t=tr,n=Ee){super(t,n)}}const Ee=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("p",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},sr=e=>o.createPluginFactory({key:x.imageTitle,isElement:!0,component:Ee,deserializeHtml:{rules:[{validClassName:x.imageTitle}]}})({component:t=>s.jsx(Ee,{...t,styles:e})});class zt extends i.Plugin{constructor({styles:t=T.p,...n}={}){super(x.p,{markupElement:new Wt,label:"Body Text",...n}),this.styles={},this.styles=t}plugins(){return[qt(this.styles)]}}const $t="tw-m-0 tw-px-0 tw-py-0",me=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align,l=i.merge([a&&i.alignmentClassnames[a],$t,i.getColumnBreakClasses(e)]);return s.jsx("p",{...t,className:l,style:r,children:n})};class Wt extends i.MarkupElement{constructor(t=x.p,n=me){super(t,n)}}const qt=e=>o.createPluginFactory({...o.createParagraphPlugin(),key:x.p,isElement:!0,component:me})({component:t=>s.jsx(me,{...t,styles:e})}),rr="textstyle-quote-plugin";class Gt extends i.Plugin{constructor({styles:t=T.quote,...n}={}){super(x.quote,{label:"Quote",markupElement:new ar,...n}),this.styles={},this.styles=t}plugins(){return[Kt(this.styles)]}}class ar extends i.MarkupElement{constructor(t=rr,n=he){super(t,n)}}const he=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("blockquote",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},Kt=e=>o.createPluginFactory({key:x.quote,isElement:!0,component:he,deserializeHtml:{rules:[{validNodeName:["blockquote","BLOCKQUOTE"]}]}})({component:t=>s.jsx(he,{...t,styles:e})}),Fe=[new Ot,new Dt,new Ut,new Ht,new Lt,new At,new Ft,new Gt,new zt],Z=[x.heading1,x.heading2,x.heading3,x.heading4,x.custom1,x.custom2,x.custom3,x.quote,x.p],ir=[...Fe,new _t,new Vt],or=[...Z,x.imageCaption,x.imageTitle],lr=e=>new i.PluginComposer().setPlugin(new i.SoftBreakPlugin,new i.TextStylePlugin({textStyles:Fe})).setPlugin([new i.BoldPlugin,new i.ItalicPlugin,new i.UnderlinePlugin,new i.StrikethroughPlugin,new jt({appBridge:e}),new Et({appBridge:e}),new i.CodePlugin],[new i.AlignLeftPlugin({validTypes:Z}),new i.AlignCenterPlugin({validTypes:Z}),new i.AlignRightPlugin({validTypes:Z}),new i.AlignJustifyPlugin({validTypes:Z}),new i.UnorderedListPlugin,new i.CheckboxListPlugin,new i.OrderedListPlugin,new i.ResetFormattingPlugin,new i.AutoformatPlugin]),cr="--f-theme-settings-",ur=e=>{const t=e!=null&&e.id?`hasBackground${e.id}`:"hasBackground",n=e!=null&&e.id?`backgroundColor${e.id}`:"backgroundColor",r=e!=null&&e.preventDefaultColor?void 0:(e==null?void 0:e.defaultColor)||wn,a=e!=null&&e.switchLabel?e.switchLabel:void 0;return{id:t,label:"Background",type:"switch",switchLabel:a,defaultValue:!!(e!=null&&e.defaultValue),on:[{id:n,defaultValue:r,type:"colorInput"}]}},dr=e=>{const t=e!=null&&e.id?`hasBorder_${e.id}`:"hasBorder",n=e!=null&&e.id?`borderSelection_${e.id}`:"borderSelection",r=e!=null&&e.id?`borderStyle_${e.id}`:"borderStyle",a=e!=null&&e.id?`borderWidth_${e.id}`:"borderWidth",l=e!=null&&e.id?`borderColor_${e.id}`:"borderColor",c=(e==null?void 0:e.defaultColor)||Ye,d=e!=null&&e.switchLabel?e.switchLabel:void 0;return{id:t,label:"Border",type:"switch",switchLabel:d,defaultValue:!!(e!=null&&e.defaultValue),on:[{id:n,type:"multiInput",onChange:u=>h.appendUnit(u,a),layout:h.MultiInputLayout.Columns,lastItemFullWidth:!0,blocks:[{id:r,type:"dropdown",defaultValue:O.Solid,choices:[{value:O.Solid,label:O.Solid},{value:O.Dotted,label:O.Dotted},{value:O.Dashed,label:O.Dashed}]},{id:a,type:"input",defaultValue:pn,rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)],placeholder:"e.g. 3px"},{id:l,type:"colorInput",defaultValue:c}]}],off:[]}},Me=(e,t=_.None)=>({id:e,type:"segmentedControls",defaultValue:t,choices:[{value:_.None,label:"None"},{value:_.Small,label:"S"},{value:_.Medium,label:"M"},{value:_.Large,label:"L"}]}),gr=e=>{const t=e!=null&&e.id?`hasRadius_${e.id}`:"hasRadius",n=e!=null&&e.id?`radiusValue_${e.id}`:"radiusValue",r=e!=null&&e.id?`radiusChoice_${e.id}`:"radiusChoice",a=(e==null?void 0:e.defaultRadius)||_.None;return{id:t,label:"Corner radius",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"Determining how rounded the corners are.",show:l=>{var c;return e!=null&&e.dependentSettingId?!!((c=l.getBlock(e.dependentSettingId))!=null&&c.value):!0},onChange:l=>h.presetCustomValue(l,r,n,(e==null?void 0:e.radiusStyleMap)||q),on:[{id:n,type:"input",placeholder:"e.g. 10px",rules:[h.numericalOrPixelRule],onChange:l=>h.appendUnit(l,n)}],off:[Me(r,a)]}},mr=e=>{const t=e!=null&&e.id?`hasExtendedCustomRadius_${e.id}`:"hasExtendedCustomRadius",n=e!=null&&e.id?`extendedRadiusValue_${e.id}`:"extendedRadiusValue",r=e!=null&&e.id?`extendedRadiusChoice_${e.id}`:"extendedRadiusChoice",a=e!=null&&e.id?`extendedRadiusTopLeft_${e.id}`:"extendedRadiusTopLeft",l=e!=null&&e.id?`extendedRadiusTopRight_${e.id}`:"extendedRadiusTopRight",c=e!=null&&e.id?`extendedRadiusBottomLeft_${e.id}`:"extendedRadiusBottomLeft",d=e!=null&&e.id?`extendedRadiusBottomRight_${e.id}`:"extendedRadiusBottomRight";return{id:t,label:"Corner radius",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"Determining how rounded the corners are.",show:u=>{var f;return e!=null&&e.dependentSettingId?!!((f=u.getBlock(e.dependentSettingId))!=null&&f.value):!0},onChange:u=>{h.presetCustomValue(u,r,a,q),h.presetCustomValue(u,r,l,q),h.presetCustomValue(u,r,c,q),h.presetCustomValue(u,r,d,q)},on:[{id:n,type:"multiInput",layout:h.MultiInputLayout.Columns,blocks:[{id:a,type:"input",label:"Top Left",rules:[h.numericalOrPixelRule],onChange:u=>h.appendUnit(u,a)},{id:l,type:"input",label:"Top Right",rules:[h.numericalOrPixelRule],onChange:u=>h.appendUnit(u,l)},{id:c,type:"input",label:"Bottom Left",rules:[h.numericalOrPixelRule],onChange:u=>h.appendUnit(u,c)},{id:d,type:"input",label:"Bottom Right",rules:[h.numericalOrPixelRule],onChange:u=>h.appendUnit(u,d)}]}],off:[Me(r,e==null?void 0:e.defaultValue)]}},hr=e=>{const t=e!=null&&e.id?e.id:"hasCustomSpacing",n=e!=null&&e.dependentSettingId?e.dependentSettingId:"columns",r=e!=null&&e.spacingChoiceId?e.spacingChoiceId:"spacingChoice",a=e!=null&&e.spacingCustomId?e.spacingCustomId:"spacingCustom",l=e!=null&&e.defaultValueChoices?e.defaultValueChoices:W.M;return{id:t,type:"switch",defaultValue:!1,switchLabel:"Custom",label:"Gutter",info:"An official nerds term for ‘gap’",onChange:c=>h.presetCustomValue(c,r,a,Qe),show:c=>{var d;return((d=c.getBlock(n))==null?void 0:d.value)!=="1"},on:[{id:a,type:"input",rules:[h.numericalOrPixelRule],onChange:c=>h.appendUnit(c,a)}],off:[{id:r,type:"slider",defaultValue:l,choices:[{value:W.Auto,label:"Auto"},{value:W.S,label:"S"},{value:W.M,label:"M"},{value:W.L,label:"L"}]}]}},Oe=e=>({id:e,type:"segmentedControls",defaultValue:$.None,choices:[{value:$.None,label:"None"},{value:$.Small,label:"S"},{value:$.Medium,label:"M"},{value:$.Large,label:"L"}]}),fr=e=>{const t=e!=null&&e.id?`hasCustomMarginValue_${e==null?void 0:e.id}`:"hasCustomMarginValue",n=e!=null&&e.id?`marginValue_${e==null?void 0:e.id}`:"marginValue",r=e!=null&&e.id?`marginChoice_${e==null?void 0:e.id}`:"marginChoice";return{id:t,label:"Margin",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more space",onChange:a=>h.presetCustomValue(a,r,n,(e==null?void 0:e.marginStyleMap)||J),on:[{id:n,type:"input",placeholder:ie,rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)],onChange:a=>h.appendUnit(a,n)}],off:[Oe(r)]}},wr=e=>{const t=e!=null&&e.id?`hasExtendedCustomMargin_${e==null?void 0:e.id}`:"hasExtendedCustomMargin",n=e!=null&&e.id?`extendedMarginValues_${e==null?void 0:e.id}`:"extendedMarginValues",r=e!=null&&e.id?`extendedMarginChoice_${e==null?void 0:e.id}`:"extendedMarginChoice",a=e!=null&&e.id?`extendedMarginTop_${e==null?void 0:e.id}`:"extendedMarginTop",l=e!=null&&e.id?`extendedMarginLeft_${e==null?void 0:e.id}`:"extendedMarginLeft",c=e!=null&&e.id?`extendedMarginRight_${e==null?void 0:e.id}`:"extendedMarginRight",d=e!=null&&e.id?`extendedMarginBottom_${e==null?void 0:e.id}`:"extendedMarginBottom";return{id:t,label:"Margin",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more negative space",onChange:u=>{h.presetCustomValue(u,r,a,J),h.presetCustomValue(u,r,l,J),h.presetCustomValue(u,r,c,J),h.presetCustomValue(u,r,d,J)},on:[{id:n,type:"multiInput",layout:h.MultiInputLayout.Spider,blocks:[{id:a,type:"input",label:"Top",placeholder:ie,onChange:u=>h.appendUnit(u,a),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:l,type:"input",label:"Left",placeholder:ie,onChange:u=>h.appendUnit(u,l),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:c,type:"input",label:"Right",placeholder:ie,onChange:u=>h.appendUnit(u,c),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:d,type:"input",label:"Bottom",placeholder:ie,onChange:u=>h.appendUnit(u,d),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]}]}],off:[Oe(r)]}},De=e=>({id:e,type:"segmentedControls",defaultValue:z.Small,choices:[{value:z.None,label:"None"},{value:z.Small,label:"S"},{value:z.Medium,label:"M"},{value:z.Large,label:"L"}]}),pr=e=>{const t=e!=null&&e.id?`hasCustomPaddingValue_${e==null?void 0:e.id}`:"hasCustomPaddingValue",n=e!=null&&e.id?`paddingValue_${e==null?void 0:e.id}`:"paddingValue",r=e!=null&&e.id?`paddingChoice_${e==null?void 0:e.id}`:"paddingChoice";return{id:t,label:"Padding",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more negative space",onChange:a=>h.presetCustomValue(a,r,n,(e==null?void 0:e.paddingStyleMap)||Y),on:[{id:n,type:"input",placeholder:ae,rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)],onChange:a=>h.appendUnit(a,n)}],off:[De(r)]}},xr=e=>{const t=e!=null&&e.id?`hasExtendedCustomPadding_${e==null?void 0:e.id}`:"hasExtendedCustomPadding",n=e!=null&&e.id?`extendedPaddingValues_${e==null?void 0:e.id}`:"extendedPaddingValues",r=e!=null&&e.id?`extendedPaddingChoice_${e==null?void 0:e.id}`:"extendedPaddingChoice",a=e!=null&&e.id?`extendedPaddingTop_${e==null?void 0:e.id}`:"extendedPaddingTop",l=e!=null&&e.id?`extendedPaddingLeft_${e==null?void 0:e.id}`:"extendedPaddingLeft",c=e!=null&&e.id?`extendedPaddingRight_${e==null?void 0:e.id}`:"extendedPaddingRight",d=e!=null&&e.id?`extendedPaddingBottom_${e==null?void 0:e.id}`:"extendedPaddingBottom";return{id:t,label:"Padding",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more negative space",onChange:u=>{h.presetCustomValue(u,r,a,Y),h.presetCustomValue(u,r,l,Y),h.presetCustomValue(u,r,c,Y),h.presetCustomValue(u,r,d,Y)},on:[{id:n,type:"multiInput",layout:h.MultiInputLayout.Spider,blocks:[{id:a,type:"input",label:"Top",placeholder:ae,onChange:u=>h.appendUnit(u,a),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:l,type:"input",label:"Left",placeholder:ae,onChange:u=>h.appendUnit(u,l),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:c,type:"input",label:"Right",placeholder:ae,onChange:u=>h.appendUnit(u,c),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:d,type:"input",label:"Bottom",placeholder:ae,onChange:u=>h.appendUnit(u,d),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]}]}],off:[De(r)]}},yr=e=>{const t=Ue(e==null?void 0:e.globalControlId);return{id:e!=null&&e.id?e.id:"downloadable",type:"switch",defaultValue:!1,label:"Downloadable",show:n=>{var r;return((r=n.getBlock(t))==null?void 0:r.value)===G.Custom}}},Ue=e=>e||"security",br=e=>[{id:Ue(e),type:"segmentedControls",defaultValue:G.Global,choices:[{value:G.Global,label:"Global Settings"},{value:G.Custom,label:"Custom"}]},{id:"globalSettingsInfo",type:"notification",footer:h.createFooter({label:"Change global settings [here].",replace:{here:{event:"general-settings.open"}}})}];var Xt=(e=>(e.Main="main",e.Basics="basics",e.Layout="layout",e.Style="style",e.Security="security",e.Targets="targets",e))(Xt||{});const vr=e=>e,Cr=e=>e;exports.AllTextStylePlugins=ir;exports.AllTextStyles=or;exports.Attachments=et;exports.AttachmentsProvider=st;exports.BUTTON_PLUGIN=St;exports.BlockButtonStyles=xe;exports.BlockInjectButton=an;exports.BlockItemWrapper=Bn;exports.BlockStyles=T;exports.BorderStyle=O;exports.ButtonPlugin=Et;exports.Custom1Plugin=Lt;exports.Custom2Plugin=At;exports.Custom3Plugin=Ft;exports.DEFAULT_DRAGGING_TOOLTIP=Ze;exports.DEFAULT_DRAG_TOOLTIP=Je;exports.DownloadButton=jn;exports.ELEMENT_BUTTON=k;exports.GutterSpacing=W;exports.Heading1Plugin=Ot;exports.Heading2Plugin=Dt;exports.Heading3Plugin=Ut;exports.Heading4Plugin=Ht;exports.ImageCaptionPlugin=_t;exports.ImageTitlePlugin=Vt;exports.LinkInput=Ct;exports.LinkPlugin=jt;exports.LinkSelector=vt;exports.Margin=$;exports.PARAGRAPH_CLASSES=$t;exports.Padding=z;exports.ParagraphMarkupElement=Wt;exports.ParagraphMarkupElementNode=me;exports.ParagraphPlugin=zt;exports.QuoteMarkupElementNode=he;exports.QuotePlugin=Gt;exports.Radius=_;exports.RichTextEditor=ws;exports.Sections=Xt;exports.Security=G;exports.THEME_PREFIX=cr;exports.TextStylePluginsWithoutImage=Fe;exports.TextStyles=x;exports.TextStylesWithoutImage=Z;exports.Toolbar=it;exports.addHttps=fe;exports.borderStyleMap=Xe;exports.convertToRteValue=Nn;exports.createButtonNode=xt;exports.createButtonPlugin=Pt;exports.createLinkPlugin=Bt;exports.createParagraphPlugin=qt;exports.createQuotePlugin=Kt;exports.customCoordinatesGetterFactory=at;exports.defineBlock=vr;exports.defineSettings=Cr;exports.getBackgroundColorStyles=fn;exports.getBackgroundSettings=ur;exports.getBorderRadiusSettings=gr;exports.getBorderRadiusSlider=Me;exports.getBorderSettings=dr;exports.getBorderStyles=xn;exports.getDefaultPluginsWithLinkChooser=lr;exports.getExtendedBorderRadiusSettings=mr;exports.getGutterSettings=hr;exports.getLegacyUrl=ct;exports.getLinkFromEditor=gt;exports.getMarginExtendedSettings=wr;exports.getMarginSettings=fr;exports.getMarginSlider=Oe;exports.getPaddingExtendedSettings=xr;exports.getPaddingSettings=pr;exports.getPaddingSlider=De;exports.getRadiusStyles=yn;exports.getReadableColor=mn;exports.getSecurityDownloadableSetting=yr;exports.getSecurityGlobalControlId=Ue;exports.getSecurityGlobalControlSetting=br;exports.getUrl=ut;exports.getUrlFromEditor=pt;exports.getUrlFromLinkOrLegacyLink=dt;exports.gutterSpacingStyleMap=Qe;exports.hasRichTextValue=ot;exports.insertButton=ht;exports.isDark=ln;exports.isDownloadable=An;exports.isValidUrl=we;exports.isValidUrlOrEmpty=ee;exports.joinClassNames=D;exports.mapAppBridgeColorPaletteToFonduePalette=lt;exports.mapAppBridgeColorPalettesToFonduePalettes=Rn;exports.marginStyleMap=J;exports.moveItemInArray=hn;exports.paddingStyleMap=Y;exports.radiusStyleMap=q;exports.relativeUrlRegex=je;exports.setAlpha=dn;exports.submitFloatingButton=Ne;exports.toColorObject=gn;exports.toHex8String=cn;exports.toHexString=un;exports.toRgbaString=Ie;exports.toShortRgba=X;exports.triggerFloatingButton=yt;exports.triggerFloatingButtonEdit=pe;exports.triggerFloatingButtonInsert=Re;exports.unwrapButton=ne;exports.upsertButton=ft;exports.upsertButtonText=Ae;exports.useAttachments=tt;exports.useAttachmentsContext=rt;exports.useDndSensors=En;exports.withAttachmentsProvider=kn;exports.withButton=mt;exports.wrapButton=wt;Object.keys(h).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>h[e]})});
4
4
  //# sourceMappingURL=index.cjs.js.map