@frontify/guideline-blocks-settings 0.29.17 → 0.30.0

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