@frontify/guideline-blocks-settings 3.0.4 → 4.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Link/LinkInput.es.js +38 -31
- package/dist/components/Link/LinkInput.es.js.map +1 -1
- package/dist/index.cjs.js +1 -7
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +8 -27
- package/dist/index.es.js +92 -94
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -7
- package/dist/index.umd.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +2 -2
- package/dist/components/Link/LinkSelector/DocumentLink.es.js +0 -47
- package/dist/components/Link/LinkSelector/DocumentLink.es.js.map +0 -1
- package/dist/components/Link/LinkSelector/DocumentLinks.es.js +0 -51
- package/dist/components/Link/LinkSelector/DocumentLinks.es.js.map +0 -1
- package/dist/components/Link/LinkSelector/LinkSelector2.es.js +0 -77
- package/dist/components/Link/LinkSelector/LinkSelector2.es.js.map +0 -1
- package/dist/components/Link/LinkSelector/LoadingIndicator.es.js +0 -11
- package/dist/components/Link/LinkSelector/LoadingIndicator.es.js.map +0 -1
- package/dist/components/Link/LinkSelector/PageLink.es.js +0 -55
- package/dist/components/Link/LinkSelector/PageLink.es.js.map +0 -1
- package/dist/components/Link/LinkSelector/PageLinks.es.js +0 -29
- package/dist/components/Link/LinkSelector/PageLinks.es.js.map +0 -1
- package/dist/components/Link/LinkSelector/SectionLink.es.js +0 -33
- package/dist/components/Link/LinkSelector/SectionLink.es.js.map +0 -1
- package/dist/components/Link/helpers/filterDocumentSectionsWithUnreadableTitles.es.js +0 -6
- package/dist/components/Link/helpers/filterDocumentSectionsWithUnreadableTitles.es.js.map +0 -1
|
@@ -1,54 +1,61 @@
|
|
|
1
1
|
import { isValidUrlOrEmpty as e } from "./utils/url.es.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { useLinkChooser as t } from "@frontify/app-bridge";
|
|
3
|
+
import { Button as n, Checkbox as r, Label as i, TextInput as a } from "@frontify/fondue/components";
|
|
4
|
+
import { IconLink as o } from "@frontify/fondue/icons";
|
|
5
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
6
|
+
import { FormControl as l } from "@frontify/fondue";
|
|
6
7
|
//#region src/components/Link/LinkInput.tsx
|
|
7
|
-
var
|
|
8
|
-
let
|
|
9
|
-
return /* @__PURE__ */
|
|
8
|
+
var u = ({ onUrlChange: u, onToggleTab: d, isValidUrlOrEmpty: f, appBridge: p, placeholder: m, newTab: h, url: g = "", required: _, info: v, label: y, buttonSize: b, hideInternalLinkButton: x }) => {
|
|
9
|
+
let S = f ? f(g) : e(g), { openLinkChooser: C, closeLinkChooser: w } = t(p);
|
|
10
|
+
return /* @__PURE__ */ c("div", {
|
|
10
11
|
"data-test-id": "link-input",
|
|
11
12
|
children: [
|
|
12
|
-
/* @__PURE__ */
|
|
13
|
+
/* @__PURE__ */ s(l, {
|
|
13
14
|
label: {
|
|
14
|
-
children:
|
|
15
|
+
children: y,
|
|
15
16
|
htmlFor: "url",
|
|
16
|
-
required:
|
|
17
|
-
tooltip:
|
|
18
|
-
content:
|
|
17
|
+
required: _,
|
|
18
|
+
tooltip: v ? {
|
|
19
|
+
content: v,
|
|
19
20
|
position: "top"
|
|
20
21
|
} : void 0
|
|
21
22
|
},
|
|
22
|
-
children: /* @__PURE__ */ a
|
|
23
|
+
children: /* @__PURE__ */ s(a, {
|
|
23
24
|
"data-test-id": "text-input",
|
|
24
25
|
id: "url",
|
|
25
|
-
value:
|
|
26
|
-
onChange: (e) =>
|
|
27
|
-
placeholder:
|
|
26
|
+
value: g,
|
|
27
|
+
onChange: (e) => u?.(e.target.value),
|
|
28
|
+
placeholder: m ?? "https://example.com"
|
|
28
29
|
})
|
|
29
30
|
}),
|
|
30
|
-
!
|
|
31
|
+
!S && /* @__PURE__ */ s("div", {
|
|
31
32
|
className: "tw-text-error tw-mt-1 tw-text-small",
|
|
32
33
|
children: "Please enter a valid URL."
|
|
33
34
|
}),
|
|
34
|
-
!
|
|
35
|
+
!x && /* @__PURE__ */ s("div", {
|
|
35
36
|
className: "tw-mt-3",
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
onPointerDown: (e) => {
|
|
38
|
+
e.preventDefault();
|
|
39
|
+
},
|
|
40
|
+
children: /* @__PURE__ */ c(n, {
|
|
41
|
+
"data-test-id": "internal-link-chooser-button",
|
|
42
|
+
size: b ?? "medium",
|
|
43
|
+
emphasis: "default",
|
|
44
|
+
onPress: async () => {
|
|
45
|
+
await C((e) => {
|
|
46
|
+
u?.(e), w().catch(console.error);
|
|
47
|
+
}, { selectedUrl: g });
|
|
48
|
+
},
|
|
49
|
+
children: [/* @__PURE__ */ s(o, { size: "20" }), "Internal link"]
|
|
43
50
|
})
|
|
44
51
|
}),
|
|
45
|
-
/* @__PURE__ */
|
|
52
|
+
/* @__PURE__ */ c("div", {
|
|
46
53
|
className: "tw-mt-3 tw-flex tw-items-center tw-gap-1.5",
|
|
47
|
-
children: [/* @__PURE__ */
|
|
54
|
+
children: [/* @__PURE__ */ s(r, {
|
|
48
55
|
id: "new-tab",
|
|
49
|
-
value:
|
|
50
|
-
onChange: () =>
|
|
51
|
-
}), /* @__PURE__ */
|
|
56
|
+
value: h,
|
|
57
|
+
onChange: () => d?.(!h)
|
|
58
|
+
}), /* @__PURE__ */ s(i, {
|
|
52
59
|
id: "new-tab-label",
|
|
53
60
|
htmlFor: "new-tab",
|
|
54
61
|
className: "tw-whitespace-nowrap",
|
|
@@ -59,6 +66,6 @@ var c = ({ onUrlChange: c, onToggleTab: l, isValidUrlOrEmpty: u, appBridge: d, p
|
|
|
59
66
|
});
|
|
60
67
|
};
|
|
61
68
|
//#endregion
|
|
62
|
-
export {
|
|
69
|
+
export { u as LinkInput };
|
|
63
70
|
|
|
64
71
|
//# sourceMappingURL=LinkInput.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LinkInput.es.js","names":[],"sources":["../../../src/components/Link/LinkInput.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type AppBridgeBlock } from '@frontify/app-bridge';\nimport { FormControl } from '@frontify/fondue';\nimport { TextInput, Checkbox, Label } from '@frontify/fondue/components';\
|
|
1
|
+
{"version":3,"file":"LinkInput.es.js","names":[],"sources":["../../../src/components/Link/LinkInput.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { type AppBridgeBlock, useLinkChooser } from '@frontify/app-bridge';\nimport { FormControl } from '@frontify/fondue';\nimport { TextInput, Checkbox, Label, Button } from '@frontify/fondue/components';\nimport { IconLink } from '@frontify/fondue/icons';\n\nimport { isValidUrlOrEmpty as internalIsValidUrlOrEmpty } from './utils';\n\ntype LinkInputProps = {\n url?: string;\n info?: string;\n label?: string;\n required?: boolean;\n newTab?: boolean;\n onUrlChange?: (value: string) => void;\n onToggleTab?: (checked: boolean) => void;\n isValidUrlOrEmpty?: (url: string) => boolean;\n appBridge: AppBridgeBlock;\n placeholder?: string;\n buttonSize?: 'small' | 'medium' | 'large';\n hideInternalLinkButton?: boolean;\n};\n\nexport const LinkInput = ({\n onUrlChange,\n onToggleTab,\n isValidUrlOrEmpty,\n appBridge,\n placeholder,\n newTab,\n url = '',\n required,\n info,\n label,\n buttonSize,\n hideInternalLinkButton,\n}: LinkInputProps) => {\n const isUrlValid = isValidUrlOrEmpty ? isValidUrlOrEmpty(url) : internalIsValidUrlOrEmpty(url);\n const { openLinkChooser, closeLinkChooser } = useLinkChooser(appBridge);\n\n const onOpenLinkChooser = async () => {\n await openLinkChooser(\n (chosenUrl: string) => {\n onUrlChange?.(chosenUrl);\n closeLinkChooser().catch(console.error);\n },\n { selectedUrl: url },\n );\n };\n\n return (\n <div data-test-id=\"link-input\">\n <FormControl\n label={{\n children: label,\n htmlFor: 'url',\n required,\n tooltip: info ? { content: info, position: 'top' } : undefined,\n }}\n >\n <TextInput\n data-test-id=\"text-input\"\n id=\"url\"\n value={url}\n onChange={(event) => onUrlChange?.(event.target.value)}\n placeholder={placeholder ?? 'https://example.com'}\n />\n </FormControl>\n {!isUrlValid && <div className=\"tw-text-error tw-mt-1 tw-text-small\">Please enter a valid URL.</div>}\n\n {!hideInternalLinkButton && (\n // oxlint-disable-next-line jsx-a11y-x/no-static-element-interactions\n <div\n className=\"tw-mt-3\"\n onPointerDown={(event) => {\n event.preventDefault();\n }}\n >\n <Button\n data-test-id=\"internal-link-chooser-button\"\n size={buttonSize ?? 'medium'}\n emphasis=\"default\"\n onPress={onOpenLinkChooser}\n >\n <IconLink size=\"20\" />\n Internal link\n </Button>\n </div>\n )}\n\n <div className=\"tw-mt-3 tw-flex tw-items-center tw-gap-1.5\">\n <Checkbox id=\"new-tab\" value={newTab} onChange={() => onToggleTab?.(!newTab)} />\n <Label id=\"new-tab-label\" htmlFor=\"new-tab\" className=\"tw-whitespace-nowrap\">\n Open in new tab\n </Label>\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;;;AAwBA,IAAa,KAAa,EACtB,gBACA,gBACA,mBAAA,GACA,cACA,gBACA,WACA,SAAM,IACN,aACA,SACA,UACA,eACA,gCACkB;CAClB,IAAM,IAAa,IAAoB,EAAkB,CAAG,IAAI,EAA0B,CAAG,GACvF,EAAE,oBAAiB,wBAAqB,EAAe,CAAS;CAYtE,OACI,kBAAC,OAAD;EAAK,gBAAa;EAAlB,UAAA;GACI,kBAAC,GAAD;IACI,OAAO;KACH,UAAU;KACV,SAAS;KACT;KACA,SAAS,IAAO;MAAE,SAAS;MAAM,UAAU;KAAM,IAAI,KAAA;IACzD;IAEA,UAAA,kBAAC,GAAD;KACI,gBAAa;KACb,IAAG;KACH,OAAO;KACP,WAAW,MAAU,IAAc,EAAM,OAAO,KAAK;KACrD,aAAa,KAAe;IAC/B,CAAA;GACQ,CAAA;GACZ,CAAC,KAAc,kBAAC,OAAD;IAAK,WAAU;IAAsC,UAAA;GAA8B,CAAA;GAElG,CAAC,KAEE,kBAAC,OAAD;IACI,WAAU;IACV,gBAAgB,MAAU;KACtB,EAAM,eAAe;IACzB;IAEA,UAAA,kBAAC,GAAD;KACI,gBAAa;KACb,MAAM,KAAc;KACpB,UAAS;KACT,SAAS,YA1CS;MAClC,MAAM,GACD,MAAsB;OAEnB,AADA,IAAc,CAAS,GACvB,EAAiB,CAAC,CAAC,MAAM,QAAQ,KAAK;MAC1C,GACA,EAAE,aAAa,EAAI,CACvB;KACJ;KA8BgB,UAAA,CAMI,kBAAC,GAAD,EAAU,MAAK,KAAM,CAAA,GAAC,eAElB;;GACP,CAAA;GAGT,kBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACI,kBAAC,GAAD;KAAU,IAAG;KAAU,OAAO;KAAQ,gBAAgB,IAAc,CAAC,CAAM;IAAI,CAAA,GAC/E,kBAAC,GAAD;KAAO,IAAG;KAAgB,SAAQ;KAAU,WAAU;KAAuB,UAAA;IAEtE,CAAA,CACN;;EACJ;;AAEb"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -1,8 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,i=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r},a=(i,a,o,s)=>{if(a&&typeof a==`object`||typeof a==`function`)for(var c=n(a),l=0,u=c.length,d;l<u;l++)d=c[l],!r.call(i,d)&&d!==o&&e(i,d,{get:(e=>a[e]).bind(null,d),enumerable:!(s=t(a,d))||s.enumerable});return i},o=(e,t,n)=>(a(e,t,`default`),n&&a(n,t,`default`));let s=require("@frontify/app-bridge"),c=require("@frontify/fondue/components"),l=require("@frontify/fondue/icons"),u=require("react"),d=require("react/jsx-runtime"),f=require("@ctrl/tinycolor"),p=require("@dnd-kit/core"),m=require("@dnd-kit/modifiers"),h=require("@dnd-kit/sortable"),g=require("@frontify/fondue"),_=require("@frontify/fondue/rte"),v=require("react-dom");var y=e=>e.filter(Boolean).join(` `),b=({onDrop:e,label:t,icon:n,secondaryLabel:r,isLoading:i,fillParentContainer:a,onAssetChooseClick:o,onUploadClick:f,withMenu:p=!0,onClick:m,validFileType:h,verticalLayout:g})=>{let[_,v]=(0,u.useState)(!1),[b,x]=(0,u.useState)(),S=(0,u.useRef)(null),[C,w]=(0,u.useState)(void 0),T=t=>{if(t.preventDefault(),v(!1),!E(t.dataTransfer.files)){w(`Invalid`),setTimeout(()=>{w(void 0)},1e3);return}e?.(t.dataTransfer.files)},E=e=>{if(!h)return!0;for(let t=0;t<e.length;t++){let n=e[t].name.split(`.`).pop()??``;if(!s.FileExtensionSets[h].includes(n))return!1}return!0},D=e=>{if(!S.current||i)return;let{clientX:t,clientY:n}=e,r=t===0&&n===0,{left:a,top:o,width:s,height:c}=S.current.getBoundingClientRect(),l=r?s/2:t-a,u=r?c/2:n-o;x([l,u])},O=(0,u.useCallback)(e=>{e(),x(void 0)},[]),ee=(0,u.useMemo)(()=>{let e=[];return f&&e.push({onSelect:()=>O(f),title:`Upload asset`,icon:(0,d.jsx)(l.IconArrowCircleUp,{size:`20`})}),o&&e.push({onSelect:()=>O(o),title:`Browse asset`,icon:(0,d.jsx)(l.IconImageStack,{size:`20`})}),e},[o,f,O]);return(0,d.jsxs)(`button`,{type:`button`,ref:S,"data-test-id":`block-inject-button`,className:y([`tw-body-medium tw-relative tw-border tw-flex tw-items-center tw-justify-center tw-cursor-pointer tw-gap-3 tw-w-full first:tw-rounded-tl last:tw-rounded-br`,g?`[&:not(:first-child)]:tw-border-t-0 first:tw-rounded-tr last:tw-rounded-bl`:`[&:not(:first-child)]:tw-border-l-0 first:tw-rounded-bl last:tw-rounded-tr`,a?`tw-h-full`:`tw-h-[72px]`,_&&!i?`tw-border-dashed`:`tw-border-solid`,b&&`tw-bg-surface-hover`,_&&`tw-bg-surface`,C?`!tw-border-red-50 !tw-cursor-not-allowed`:` tw-border-line-mid`,i||b||_||C?``:`tw-text-secondary hover:tw-text-primary hover:tw-bg-surface hover:tw-border-line-strong active:tw-text-primary active:tw-bg-surface-hover active:tw-border-line-strong`,(_||b)&&!C?`[&>*]:tw-pointer-events-none tw-border-line-strong`:`tw-bg-surface-dim tw-text-secondary`]),onDragEnter:e?e=>{if(v(!0),h===`Images`)for(let t of Array.from(e.dataTransfer.items))t?.type?.startsWith(`image/`)?w(void 0):w(`Invalid`)}:void 0,onDragOver:e?e=>{e.preventDefault()}:void 0,onDragLeave:e?()=>{v(!1),w(void 0)}:void 0,onDrop:e?T:void 0,onClick:e=>{p&&!b&&D(e),m?.()},children:[i?(0,d.jsx)(c.LoadingCircle,{}):C?(0,d.jsxs)(`div`,{className:` tw-flex tw-items-center tw-justify-center tw-text-red-60 tw-font-medium`,children:[(0,d.jsx)(l.IconExclamationMarkTriangle,{size:`16`}),C]}):(0,d.jsxs)(d.Fragment,{children:[n&&(0,d.jsx)(`div`,{children:n}),(t||r)&&(0,d.jsxs)(`div`,{className:`tw-flex tw-flex-col tw-items-start`,children:[t&&(0,d.jsx)(`div`,{className:`tw-font-medium`,children:t}),r&&(0,d.jsx)(`div`,{className:`tw-font-normal`,children:r})]})]}),b&&(0,d.jsx)(`div`,{className:`tw-absolute tw-left-0 tw-top-full tw-z-20`,style:{left:b[0],top:b[1]},children:(0,d.jsxs)(c.Flyout.Root,{open:!0,onOpenChange:e=>!e&&x(void 0),children:[(0,d.jsx)(c.Flyout.Trigger,{children:(0,d.jsx)(`div`,{})}),(0,d.jsx)(c.Flyout.Content,{triggerOffset:`compact`,children:(0,d.jsxs)(c.Dropdown.Root,{open:!0,children:[(0,d.jsx)(c.Dropdown.Trigger,{children:(0,d.jsx)(`div`,{})}),(0,d.jsx)(c.Dropdown.Content,{triggerOffset:`compact`,children:ee.map(e=>(0,d.jsxs)(c.Dropdown.Item,{onSelect:e.onSelect,children:[e.icon,e.title]},e.title))})]})})]})})]})},x=e=>(e=>typeof e==`object`&&[`red`,`green`,`blue`].every(t=>e.hasOwnProperty(t)))(e)?(e=>{let t=typeof e.alpha==`number`?e.alpha:1;return{r:e.red,g:e.green,b:e.blue,a:t}})(e):e,S=e=>typeof e==`object`&&[`red`,`green`,`blue`].every(t=>e?.hasOwnProperty(t)),C=(e,t)=>{let n=S(e)?x(e):e,r=new f.TinyColor(n);return t?r.getBrightness()<t:r.isDark()||r.getAlpha()>.25&&r.getAlpha()<1},w=e=>new f.TinyColor(x(e)).toHex8String(),T=e=>new f.TinyColor(x(e)).toHexString(),E=e=>new f.TinyColor(x(e)).toRgbString(),D=(e,t)=>new f.TinyColor(t).setAlpha(e).toRgbString(),O=e=>{let{r:t,g:n,b:r,a:i}=new f.TinyColor(e);return{red:t,green:n,blue:r,alpha:i}},ee=e=>typeof e==`object`&&[`red`,`green`,`blue`].every(t=>e?.hasOwnProperty(t)),k=(e,t)=>{let n=ee(e)?x(e):e,r=ee(t)?x(t):t,i=new f.TinyColor(n),a=new f.TinyColor(r);for(;(0,f.readability)(i,a)<4.5;)i=i.darken(1);return i.toRgbString()},A=e=>({backgroundColor:E(e)}),te={red:241,green:241,blue:241,alpha:1},ne={red:234,green:235,blue:235,alpha:1},j=`24px`,M=`24px`,N=function(e){return e.Solid=`Solid`,e.Dashed=`Dashed`,e.Dotted=`Dotted`,e}({}),re={Solid:`solid`,Dotted:`dotted`,Dashed:`dashed`},P=function(e){return e.None=`None`,e.Small=`Small`,e.Medium=`Medium`,e.Large=`Large`,e}({}),F={None:`0px`,Small:`2px`,Medium:`4px`,Large:`12px`},I=function(e){return e.None=`None`,e.Small=`Small`,e.Medium=`Medium`,e.Large=`Large`,e}({}),L={None:`0px`,Small:`24px`,Medium:`36px`,Large:`60px`},R=function(e){return e.None=`None`,e.Small=`Small`,e.Medium=`Medium`,e.Large=`Large`,e}({}),z={None:`0px`,Small:`24px`,Medium:`36px`,Large:`60px`},B=function(e){return e.Global=`Global`,e.Custom=`Custom`,e}({}),V=function(e){return e.Auto=`Auto`,e.S=`S`,e.M=`M`,e.L=`L`,e}({}),ie={Auto:`4px`,S:`10px`,M:`30px`,L:`50px`},ae=(e=N.Solid,t=`1px`,n=ne)=>({borderStyle:re[e],borderWidth:t,borderColor:E(n)}),oe=(e,t=!1,n)=>({borderRadius:t?n:F[e]}),se=(0,u.createContext)(!1);se.displayName=`DragPreviewContext`;var ce=({children:e,isDragPreview:t})=>(0,d.jsx)(se.Provider,{value:t,children:e}),H=()=>(0,u.useContext)(se),le=(0,u.createContext)({openFlyoutIds:[],setOpenFlyoutIds:()=>console.error(`No MultiFlyoutContext Provider found`)});le.displayName=`MultiFlyoutContext`;var ue=({children:e,openFlyoutIds:t,setOpenFlyoutIds:n})=>{let r=(0,u.useMemo)(()=>({openFlyoutIds:t,setOpenFlyoutIds:n}),[t,n]);return(0,d.jsx)(le.Provider,{value:r,children:e})},de=()=>(0,u.useContext)(le),fe=e=>{let{openFlyoutIds:t,setOpenFlyoutIds:n}=de(),r=(0,u.useCallback)(t=>{n(n=>{let r=n.filter(t=>t!==e);return t?[...r,e]:r})},[e,n]);return{isOpen:t.includes(e),onOpenChange:r}},pe=(e,t)=>{let{blockAssets:n,addAssetIdsToKey:r,deleteAssetIdsFromKey:i,updateAssetIdsFromKey:a}=t,o=n?.[e]||[];return{onAttachmentsAdd:async t=>{await r(e,t.map(e=>e.id))},onAttachmentDelete:async t=>{await i(e,[t.id])},onAttachmentReplace:async(t,n)=>{let r=o.map(e=>e.id===t.id?n.id:e.id);await a(e,r)},onAttachmentsSorted:async t=>{let n=t.map(e=>e.id);await a(e,n)},attachments:o}},me=(e,t)=>{let{onAttachmentsAdd:n,onAttachmentDelete:r,onAttachmentReplace:i,onAttachmentsSorted:a,attachments:o}=pe(t,(0,s.useBlockAssets)(e));return{onAttachmentsAdd:n,onAttachmentDelete:r,onAttachmentReplace:i,onAttachmentsSorted:a,attachments:o,appBridge:e}},he=(0,u.createContext)(null);he.displayName=`AttachmentsContext`;var ge=({appBridge:e,children:t,assetId:n})=>{let r=me(e,n);return(0,d.jsx)(he.Provider,{value:r,children:t})},_e=({blockAssetBundle:e,appBridge:t,children:n,assetId:r})=>{let i=pe(r,e);return(0,d.jsx)(he.Provider,{value:{...i,appBridge:t},children:n})},ve=()=>{let e=(0,u.useContext)(he);if(!e)throw Error(`No AttachmentsContext Provided. Component must be wrapped in an 'AttachmentsProvider' or the 'withAttachmentsProvider' HOC`);return e},ye=(e,t)=>{let n=n=>(0,d.jsx)(ge,{appBridge:n.appBridge,assetId:t,children:(0,d.jsx)(e,{...n})});return n.displayName=`withAttachmentsProvider`,n},be=e=>e===`IMAGE`?(0,d.jsx)(l.IconImage,{size:`24`}):e===`VIDEO`?(0,d.jsx)(l.IconPlayFrame,{size:`24`}):e===`AUDIO`?(0,d.jsx)(l.IconMusicNote,{size:`24`}):(0,d.jsx)(l.IconDocument,{size:`24`}),xe=(0,u.forwardRef)(({item:e,isEditing:t,draggableProps:n,transformStyle:r,isDragging:i,isOverlay:a,isLoading:o,onDelete:f,onReplaceWithBrowse:p,onReplaceWithUpload:m,onDownload:h},g)=>{let[_,v]=(0,u.useState)(),[b,{selectedFiles:x}]=(0,s.useFileInput)({multiple:!0,accept:`image/*`}),[S,{results:C,doneAll:w}]=(0,s.useAssetUpload)();(0,u.useEffect)(()=>{x&&S(x[0])},[x]),(0,u.useEffect)(()=>{w&&m(C[0])},[w,C]);let T=o||x&&!w;return(0,d.jsxs)(`button`,{type:`button`,"aria-label":`Download attachment`,"data-test-id":`attachments-item`,onClick:()=>!_&&h?.(),ref:g,style:{...r,opacity:i&&!a?.3:1,fontFamily:`var(-f-theme-settings-body-font-family)`},className:y([`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-surface-hover focus-visible:tw-outline focus-visible:!-tw-outline-offset-4`,i?`tw-bg-surface-hover`:``]),children:[(0,d.jsx)(`div`,{className:`tw-text-secondary group-hover:tw-text-container-secondary-on-secondary-container`,children:T?(0,d.jsx)(c.LoadingCircle,{size:`small`}):be(e.objectType)}),(0,d.jsxs)(`div`,{className:`tw-text-small tw-flex-1 tw-min-w-0`,children:[(0,d.jsx)(`div`,{className:`tw-whitespace-nowrap tw-overflow-hidden tw-text-ellipsis tw-font-bold tw-text-secondary group-hover:tw-text-container-secondary-on-secondary-container`,children:e.title}),(0,d.jsx)(`div`,{className:`tw-text-secondary`,children:`${e.fileSizeHumanReadable} - ${e.extension}`})]}),t&&(0,d.jsxs)(`div`,{"data-test-id":`attachments-actionbar`,className:y([`tw-flex tw-gap-0.5 group-hover:tw-opacity-100 group-focus-visible:tw-opacity-100 has-[:focus-visible]:tw-opacity-100`,a||_?.id===e.id?`tw-opacity-100`:`tw-opacity-0`]),children:[(0,d.jsx)(c.Button,{aspect:`square`,emphasis:`weak`,"aria-label":`Drag attachment`,className:y([i||a?`tw-cursor-grabbing`:`tw-cursor-grab`,`focus-visible:tw-z-[2]`]),...n,children:(0,d.jsx)(l.IconGrabHandle,{})}),(0,d.jsx)(`div`,{"data-test-id":`attachments-actionbar-flyout`,children:(0,d.jsxs)(c.Dropdown.Root,{open:_?.id===e.id,onOpenChange:t=>v(t?e:void 0),children:[(0,d.jsx)(c.Dropdown.Trigger,{children:(0,d.jsx)(c.Button,{aspect:`square`,emphasis:_?.id===e.id?`default`:`weak`,onPress:e=>{e?.stopPropagation(),e?.preventDefault()},children:(0,d.jsx)(l.IconPen,{size:`20`})})}),(0,d.jsxs)(c.Dropdown.Content,{side:`right`,children:[(0,d.jsxs)(c.Dropdown.Group,{children:[(0,d.jsxs)(c.Dropdown.Item,{"data-test-id":`menu-item`,onSelect:e=>{e?.stopPropagation(),b(),v(void 0)},children:[(0,d.jsx)(l.IconArrowCircleUp,{size:`20`}),`Replace with upload`]}),(0,d.jsxs)(c.Dropdown.Item,{onSelect:e=>{e?.stopPropagation(),p(),v(void 0)},children:[(0,d.jsx)(l.IconImageStack,{size:`20`}),`Replace with asset`]})]}),(0,d.jsx)(c.Dropdown.Group,{children:(0,d.jsxs)(c.Dropdown.Item,{emphasis:`danger`,onSelect:e=>{e?.stopPropagation(),f(),v(void 0)},children:[(0,d.jsx)(l.IconTrashBin,{size:`20`}),`Delete`]})})]})]})})]})]})});xe.displayName=`AttachmentItem`;var Se=e=>{let{attributes:t,listeners:n,setNodeRef:r,transform:i,transition:a,isDragging:o}=(0,h.useSortable)({id:e.item.id}),s={transform:i?`translate(${i.x}px, ${i.y}px)`:``,transition:a,zIndex:o?2:1},c={...t,...n};return(0,d.jsx)(xe,{ref:r,isDragging:o,transformStyle:s,draggableProps:c,...e})},Ce=(0,u.forwardRef)(({children:e,...t},n)=>(0,d.jsxs)(c.Button,{ref:n,size:`small`,rounding:`full`,emphasis:`default`,"data-test-id":`attachments-button-trigger`,className:`tw-body-medium`,...t,"aria-haspopup":`menu`,children:[(0,d.jsx)(l.IconPaperclip,{size:`16`}),e,(0,d.jsx)(l.IconCaretDown,{size:`12`})]}));Ce.displayName=`AttachmentsButtonTrigger`;var we=({items:e=[],onDelete:t,onReplaceWithBrowse:n,onReplaceWithUpload:r,onBrowse:i,onUpload:a,onSorted:o,appBridge:f,triggerComponent:g=Ce,isOpen:_,onOpenChange:v})=>{let[y,b]=(0,u.useState)(e),[x,S]=(0,u.useState)(!1),C=(0,p.useSensors)((0,p.useSensor)(p.PointerSensor),(0,p.useSensor)(p.KeyboardSensor)),[w,T]=(0,u.useState)(void 0),[E,D]=(0,u.useState)(!1),[O,ee]=(0,u.useState)(!1),[k,A]=(0,u.useState)([]),[te,ne]=(0,u.useState)(null),j=(0,s.useEditorState)(f),{openAssetChooser:M,closeAssetChooser:N}=(0,s.useAssetChooser)(f),re=_!==void 0,P=re?_:x,F=y?.find(e=>e.id===w),I=e.length,L=I>0?`Open attachments, ${I} ${I===1?`attachment`:`attachments`}`:`Add attachments`,[R,{results:z,doneAll:B}]=(0,s.useAssetUpload)({onUploadProgress:()=>!E&&D(!0)}),V=e=>{(re?v:S)?.(e)};(0,u.useEffect)(()=>{b(e)},[e]),(0,u.useEffect)(()=>{te&&(D(!0),R(te))},[te]),(0,u.useEffect)(()=>{(async()=>{B&&(await a(z),D(!1))})()},[B,z]);let ie=()=>{V(!1),M(async e=>{N(),V(!0),ee(!0),await i(e),ee(!1)},{multiSelection:!0,selectedValueIds:y.map(e=>e.id)})},ae=e=>{V(!1),M(async t=>{V(!0),N(),A([...k,e.id]),await n(e,t[0]),A(k.filter(t=>t!==e.id))},{multiSelection:!1,selectedValueIds:y.map(e=>e.id)})},oe=async(e,t)=>{A([...k,e.id]),await r(e,t),A(k.filter(t=>t!==e.id))};return j||(y?.length??0)>0?(0,d.jsx)(`div`,{"data-test-id":`attachments-flyout-button`,children:(0,d.jsx)(c.Flyout.Root,{open:P,onOpenChange:e=>V(F?!0:e),children:(0,d.jsxs)(c.Tooltip.Root,{enterDelay:500,children:[(0,d.jsx)(c.Tooltip.Trigger,{asChild:!0,children:(0,d.jsx)(c.Flyout.Trigger,{asChild:!0,"data-test-id":`attachments-button-trigger`,children:(0,d.jsx)(g,{isFlyoutOpen:P,"aria-label":L,children:(0,d.jsx)(`div`,{"aria-hidden":`true`,children:I>0?I:`Add`})})})}),(0,d.jsx)(c.Flyout.Content,{side:`bottom`,align:`end`,width:`300px`,onEscapeKeyDown:e=>{e.stopPropagation(),V(!1)},children:(0,d.jsxs)(`div`,{className:`tw-w-full`,"data-test-id":`attachments-flyout-content`,children:[y.length>0&&(0,d.jsx)(p.DndContext,{sensors:C,collisionDetection:p.closestCenter,onDragStart:e=>{let{active:t}=e;T(t.id)},onDragEnd:e=>{let{active:t,over:n}=e;if(n&&t.id!==n.id&&y){let e=y.findIndex(e=>e.id===t.id),r=y.findIndex(e=>e.id===n.id),i=(0,h.arrayMove)(y,e,r);b(i),o(i)}T(void 0)},modifiers:[m.restrictToParentElement],children:(0,d.jsx)(h.SortableContext,{items:y,strategy:h.rectSortingStrategy,children:(0,d.jsx)(`div`,{className:`tw-border-b tw-border-b-line tw-relative`,children:y.map(e=>(0,d.jsx)(Se,{isEditing:j,isLoading:k.includes(e.id),item:e,onDelete:()=>t(e),onReplaceWithBrowse:()=>ae(e),onReplaceWithUpload:t=>oe(e,t),onDownload:()=>f.dispatch({name:`downloadAsset`,payload:e})},e.id))})})}),j&&(0,d.jsxs)(`div`,{className:`tw-px-5 tw-py-3`,"data-test-id":`asset-input-placeholder`,children:[(0,d.jsx)(`div`,{className:`tw-font-primary tw-font-medium tw-text-primary tw-text-small tw-my-4`,children:`Add attachments`}),E||O?(0,d.jsxs)(c.AssetInput.Root,{orientation:`horizontal`,children:[(0,d.jsx)(c.AssetInput.Preview,{children:(0,d.jsx)(c.AssetInput.PreviewLoading,{})}),(0,d.jsx)(c.AssetInput.Title,{children:`Asset`}),(0,d.jsx)(c.AssetInput.Metadata,{children:(0,d.jsx)(c.AssetInput.MetadataItem,{children:(0,d.jsxs)(c.Flex,{align:`center`,gap:.5,children:[O?(0,d.jsx)(l.IconImageStack,{size:16}):(0,d.jsx)(l.IconArrowCircleUp,{size:16}),O?`Loading`:`Uploading`]})})})]}):(0,d.jsxs)(c.AssetInput.Placeholder,{children:[(0,d.jsx)(c.AssetInput.UploadInput,{allowMultiple:!0,onSelect:e=>ne(e.target.files)}),(0,d.jsx)(c.AssetInput.BrowseInput,{onBrowse:ie})]})]})]})}),(0,d.jsx)(c.Tooltip.Content,{side:`top`,children:`Attachments`})]})})}):null},Te=(e,t)=>{let n=[g.FOCUS_VISIBLE_STYLE,`tw-relative tw-inline-flex tw-items-center tw-justify-center`,`tw-h-6 tw-p-1`,`tw-rounded-medium`,`tw-body-medium`,`tw-gap-0.5`,`focus-visible:tw-z-10`];return t?n.push(`tw-bg-container-secondary-active`,`tw-text-container-secondary-on-secondary-container`,e===`grab`?`tw-cursor-grabbing`:`tw-cursor-pointer`):n.push(`hover:tw-bg-container-secondary-hover active:tw-bg-container-secondary-active`,`tw-text-secondary hover:tw-text-container-secondary-on-secondary-container active:tw-text-container-secondary-on-secondary-container`,e===`grab`?`!tw-cursor-grab active:tw-cursor-grabbing`:`tw-cursor-pointer`),y(n)},U=(0,u.forwardRef)(({onClick:e,children:t,forceActiveStyle:n,cursor:r=`pointer`,"data-test-id":i=`base-toolbar-button`,...a},o)=>(0,d.jsx)(`button`,{onClick:e,className:Te(r,n),"data-test-id":i,...a,ref:o,children:t}));U.displayName=`BaseToolbarButton`;var Ee=(0,u.forwardRef)(({children:e,isFlyoutOpen:t,...n},r)=>(0,d.jsxs)(U,{forceActiveStyle:t,"data-test-id":`attachments-toolbar-button-trigger`,ref:r,...n,"aria-haspopup":`menu`,children:[(0,d.jsx)(l.IconPaperclip,{size:`16`}),e,(0,d.jsx)(l.IconCaretDown,{size:`12`})]}));Ee.displayName=`AttachmentsToolbarButtonTrigger`;var De=`attachments`,Oe=({flyoutId:e=De})=>{let{appBridge:t,attachments:n,onAttachmentsAdd:r,onAttachmentDelete:i,onAttachmentReplace:a,onAttachmentsSorted:o}=ve(),{isOpen:s,onOpenChange:c}=fe(e),l=H();return(0,d.jsx)(we,{onUpload:r,onDelete:i,onReplaceWithBrowse:a,onReplaceWithUpload:a,onSorted:o,onBrowse:r,items:n,appBridge:t,triggerComponent:Ee,isOpen:s&&!l,onOpenChange:c})},ke=`Drag or press ↵ to move`,Ae=`Move with ↑↓←→ and confirm with ↵`,je=({content:e,children:t,open:n,disabled:r})=>r?t:(0,d.jsxs)(c.Tooltip.Root,{enterDelay:300,open:n,children:[(0,d.jsx)(c.Tooltip.Trigger,{asChild:!0,children:t}),(0,d.jsx)(c.Tooltip.Content,{side:`top`,children:(0,d.jsx)(`div`,{children:e})})]}),Me=({tooltip:e,icon:t,setActivatorNodeRef:n,draggableProps:r})=>{let i=H(),{activatorEvent:a}=(0,p.useDndContext)(),o=a instanceof KeyboardEvent;return(0,d.jsx)(je,{...i&&{open:o},content:(0,d.jsx)(`div`,{children:i?Ae:e??`Drag or press ↵ to move`}),children:(0,d.jsx)(U,{ref:n,"data-test-id":`block-item-wrapper-toolbar-btn`,forceActiveStyle:i,cursor:`grab`,...r,children:t})})},Ne=({content:e,icon:t,tooltip:n,flyoutId:r,flyoutFooter:i,flyoutHeader:a})=>{let{isOpen:o,onOpenChange:s}=fe(r),l=H();return(0,d.jsx)(je,{disabled:l||o,content:n,children:(0,d.jsx)(`div`,{className:`tw-flex tw-flex-shrink-0 tw-flex-1 tw-h-6 tw-relative`,children:(0,d.jsxs)(c.Flyout.Root,{open:o&&!l,onOpenChange:s,children:[(0,d.jsx)(c.Flyout.Trigger,{asChild:!0,children:(0,d.jsx)(U,{"data-test-id":`block-item-wrapper-toolbar-flyout`,forceActiveStyle:o&&!l,children:t})}),(0,d.jsxs)(c.Flyout.Content,{side:`bottom`,align:`end`,padding:`comfortable`,children:[a?(0,d.jsx)(c.Flyout.Header,{children:a}):null,(0,d.jsx)(c.Flyout.Body,{children:e}),i?(0,d.jsx)(c.Flyout.Footer,{children:i}):null]})]})})})},Pe=`menu`,Fe=({items:e,flyoutId:t=Pe,tooltip:n=`Options`})=>{let{isOpen:r,onOpenChange:i}=fe(t),a=H();return(0,d.jsx)(c.Dropdown.Root,{open:r&&!a,onOpenChange:i,children:(0,d.jsxs)(c.Tooltip.Root,{children:[(0,d.jsx)(c.Tooltip.Trigger,{asChild:!0,children:(0,d.jsx)(c.Dropdown.Trigger,{asChild:!0,children:(0,d.jsx)(U,{"data-test-id":`block-item-wrapper-toolbar-flyout`,children:(0,d.jsx)(l.IconDotsHorizontal,{size:`16`})})})}),(0,d.jsx)(c.Dropdown.Content,{children:e.map((e,t)=>(0,d.jsx)(c.Dropdown.Group,{children:e.map((e,n)=>(0,d.jsxs)(c.Dropdown.Item,{"data-test-id":`menu-item`,onSelect:()=>{i(!1),e.onClick()},emphasis:e.style||`default`,children:[(0,d.jsx)(`div`,{className:`tw-mr-2`,children:e.icon}),(0,d.jsx)(`span`,{children:e.title})]},`${t}-${n}`))},t))}),(0,d.jsx)(c.Tooltip.Content,{children:n})]})})},Ie=({tooltip:e,icon:t,onClick:n})=>{let r=H();return(0,d.jsx)(je,{disabled:r,content:e??``,children:(0,d.jsx)(U,{"data-test-id":`block-item-wrapper-toolbar-btn`,onClick:n,children:t})})},Le=({children:e})=>(0,d.jsx)(`div`,{"data-test-id":`block-item-wrapper-toolbar-segment`,className:`tw-pointer-events-auto tw-flex tw-flex-shrink-0 tw-gap-px tw-px-px tw-h-[26px] tw-items-center tw-self-start tw-leading-none`,children:e}),Re=({items:e,attachments:t})=>(0,d.jsxs)(`div`,{"data-test-id":`block-item-wrapper-toolbar`,className:`tw-rounded-md tw-bg-surface tw-border tw-border-line-mid tw-divide-x tw-divide-line-mid tw-shadow-lg tw-flex tw-flex-none tw-items-center tw-isolate`,children:[t.isEnabled&&(0,d.jsx)(Le,{children:(0,d.jsx)(Oe,{})}),e.length>0&&(0,d.jsx)(Le,{children:e.map(e=>{switch(e.type){case`dragHandle`:return(0,d.jsx)(Me,{...e},e.tooltip+e.type);case`menu`:return(0,d.jsx)(Fe,{...e},e.tooltip+e.type);case`flyout`:return(0,d.jsx)(Ne,{...e},e.tooltip+e.type);default:return(0,d.jsx)(Ie,{...e},e.tooltip+e.type)}})})]}),ze=(0,u.memo)(({children:e,toolbarItems:t,shouldHideWrapper:n,shouldHideComponent:r=!1,isDragging:i=!1,shouldFillContainer:a,outlineOffset:o=0,shouldBeShown:s=!1,showAttachments:c=!1})=>{let[l,f]=(0,u.useState)(s?[Pe]:[]),p=(0,u.useRef)(null);if(n)return(0,d.jsx)(d.Fragment,{children:e});let m=t?.filter(e=>e!==void 0),h=l.length>0||s;return(0,d.jsx)(ce,{isDragPreview:i,children:(0,d.jsx)(ue,{openFlyoutIds:l,setOpenFlyoutIds:f,children:(0,d.jsxs)(`div`,{ref:p,"data-test-id":`block-item-wrapper`,style:{outlineOffset:o},className:y([`tw-relative tw-group`,a&&`tw-flex-1 tw-h-full tw-w-full`,`hover:tw-outline hover:tw-outline-1 hover:tw-outline-container-highlight-on-highlight-container focus-within:tw-outline focus-within:tw-outline-1 focus-within:tw-outline-container-highlight-on-highlight-container`,h&&`tw-outline tw-outline-1 tw-outline-container-highlight-on-highlight-container`,r&&`tw-opacity-0`]),children:[(0,d.jsx)(`div`,{style:{right:-1-o,bottom:`calc(100% - ${2+o}px)`},className:y([`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`,h&&`tw-opacity-100`]),children:(0,d.jsx)(Re,{attachments:{isEnabled:c},items:m})}),e]})})})});ze.displayName=`BlockItemWrapper`;var Be=({ref:e,disabled:t,onChange:n})=>{(0,u.useEffect)(()=>{if(t||!e.current)return;let r=!1,i=new IntersectionObserver(([e])=>{e.isIntersecting!==r&&(r=e.isIntersecting,n(e.isIntersecting))});return i.observe(e.current),()=>{i.disconnect()}},[e,t,n])},Ve=(0,_.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})),W=Ve.set,G=Ve.get,He=()=>Ve.use,Ue=e=>{if(!e)return!1;let t=e=>e.some(e=>e.text?e.text!==``:e.children?t(e.children):!1);try{return t(JSON.parse(e))}catch{return!1}},We=(e=`p`,t=``,n)=>Ue(t)?t:JSON.stringify([{type:e,children:[{text:t,textStyle:e}],align:n}]),Ge=(e,t,n)=>e===B.Custom?t:n,Ke=(e,t)=>{let n=(0,_.getAboveNode)(e,{match:{type:_.ELEMENT_LINK}});return Array.isArray(n)?t(n[0]):``},qe=e=>Ke(e,e=>e.chosenLink?.searchResult?.link||``),Je=e=>Ke(e,e=>e.url||``),Ye=e=>e.url||e.chosenLink?.searchResult?.link||``,Xe=e=>Ke(e,Ye),Ze=/^\/(document|r)\/\S+$/i,Qe=e=>{if(Ze.test(e))return e;try{return new URL(e),e}catch{return`https://${e}`}},$e=e=>{if(Ze.test(e))return!0;try{let t=new URL(e);return[`http:`,`https:`,`mailto:`,`tel:`].includes(t.protocol)&&t.pathname!==``}catch{return!1}},K=e=>$e(Qe(e))||e===``,et=(e,{type:t})=>{let{apply:n,normalizeNode:r}=e;return e.apply=t=>{if(t.type!==`set_selection`){n(t);return}let r=t.newProperties;if(!r?.focus||!r.anchor||!(0,_.isCollapsed)(r)){n(t);return}let i=(0,_.getAboveNode)(e,{at:r,match:{type:(0,_.getPluginType)(e,Z)}});if(i){let[,n]=i,a;(0,_.isStartPoint)(e,r.focus,n)&&(a=(0,_.getPreviousNodeEndPoint)(e,n)),(0,_.isEndPoint)(e,r.focus,n)&&(a=(0,_.getNextNodeStartPoint)(e,n)),a&&(t.newProperties={anchor:a,focus:a})}n(t)},e.normalizeNode=([t,n])=>{if(t.type===(0,_.getPluginType)(e,`button`)){let t=e.selection;if(t&&(0,_.isCollapsed)(t)&&(0,_.isEndPoint)(e,t.focus,n)){let t=(0,_.getNextNodeStartPoint)(e,n);if(t)(0,_.select)(e,t);else{let t=_.Path.next(n);(0,_.insertNodes)(e,{text:``},{at:t}),(0,_.select)(e,t)}}}r([t,n])},(0,_.withRemoveEmptyNodes)(e,(0,_.mockPlugin)({options:{types:t}}))},tt=(e,t,n)=>{(0,_.insertNodes)(e,[dt(e,t)],n)},nt=e=>{if(!e.selection)return;let{isUrl:t,forceSubmit:n}=(0,_.getPluginOptions)(e,Z),r=G.url();if(!(t?.(r)||n))return;let i=G.text(),a=G.buttonStyle(),o=G.newTab()?void 0:`_self`;return W.reset(),rt(e,{url:r,text:i,buttonStyle:a,target:o,isUrl:e=>n||!t?!0:t(e)}),setTimeout(()=>{(0,_.focusEditor)(e,e.selection??void 0)},0),!0},q=(e,t)=>(0,_.withoutNormalizing)(e,()=>{if(t?.split){if((0,_.getAboveNode)(e,{at:e.selection?.anchor,match:{type:(0,_.getPluginType)(e,`button`)}}))return(0,_.splitNodes)(e,{at:e.selection?.anchor,match:t=>(0,_.isElement)(t)&&t.type===(0,_.getPluginType)(e,`button`)}),q(e,{at:e.selection?.anchor}),!0;if((0,_.getAboveNode)(e,{at:e.selection?.focus,match:{type:(0,_.getPluginType)(e,`button`)}}))return(0,_.splitNodes)(e,{at:e.selection?.focus,match:t=>(0,_.isElement)(t)&&t.type===(0,_.getPluginType)(e,`button`)}),q(e,{at:e.selection?.focus}),!0}(0,_.unwrapNodes)(e,{match:{type:(0,_.getPluginType)(e,Z)},...t})}),rt=(e,{url:t,text:n,buttonStyle:r,target:i,insertTextInButton:a,insertNodesOptions:o,isUrl:s=(0,_.getPluginOptions)(e,Z).isUrl})=>{let c=e.selection;if(!c)return;let l=(0,_.getAboveNode)(e,{at:c,match:{type:(0,_.getPluginType)(e,Z)}});if(a&&l)return e.insertText(t),!0;if(!s?.(t))return;if((0,_.isDefined)(n)&&n.length===0&&(n=t),l)return ot(t,e,l,i,r,n),!0;let[u,d]=(0,_.findNode)(e,{at:c,match:{type:(0,_.getPluginType)(e,`button`)}})??[],f=it(e,d,n);if((0,_.isExpanded)(c))return at(l,e,t,r,i,n),!0;f&&(0,_.removeNodes)(e,{at:d});let p=(0,_.getNodeProps)(u??{}),m=e.selection?.focus.path;if(!m)return;let h=(0,_.getNodeLeaf)(e,m);return n?.length||(n=t),tt(e,{...p,url:t,target:i,children:[{...h,text:n}]},o),!0};function it(e,t,n){return t&&n?.length&&n!==(0,_.getEditorString)(e,t)}function at(e,t,n,r,i,a){e?q(t,{at:e[1]}):q(t,{split:!0}),ct(t,{url:n,buttonStyle:r,target:i}),st(t,{url:n,target:i,text:a})}function ot(e,t,n,r,i,a){(e!==n[0]?.url||r!==n[0]?.target||i!==n[0]?.buttonStyle)&&(0,_.setNodes)(t,{url:e,target:r,buttonStyle:i},{at:n[1]}),st(t,{url:e,text:a,target:r})}var st=(e,{text:t})=>{let n=(0,_.getAboveNode)(e,{match:{type:(0,_.getPluginType)(e,Z)}});if(n){let[r,i]=n;if(t?.length&&t!==(0,_.getEditorString)(e,i)){let n=r.children[0];(0,_.replaceNodeChildren)(e,{at:i,nodes:{...n,text:t},insertOptions:{select:!0}})}}},ct=(e,{url:t,buttonStyle:n,target:r,...i})=>{(0,_.wrapNodes)(e,{type:(0,_.getPluginType)(e,Z),url:t,buttonStyle:n,target:r,children:[]},{split:!0,...i})},lt=(e,t)=>{let n=(0,_.getAboveNode)(e,{match:{type:Z}});return Array.isArray(n)?t(n[0]):``},ut=e=>lt(e,e=>e.url??``),dt=(e,{url:t,text:n=``,buttonStyle:r=`primary`,target:i,children:a})=>({type:(0,_.getPluginType)(e,Z),url:t,target:i,buttonStyle:r,children:a??[{text:n}]}),ft=(e,{focused:t}={})=>{if(G.mode()===`edit`){pt(e);return}mt(e,{focused:t})},pt=e=>{let t=(0,_.findNode)(e,{match:{type:(0,_.getPluginType)(e,Z)}});if(!t)return;let[n,r]=t,i=(0,_.getEditorString)(e,r);W.url(n.url),W.newTab(n.target===void 0),i===n.url&&(i=``),W.text(i),W.isEditing(!0)},mt=(e,{focused:t}={})=>{G.mode()||t&&((0,_.isRangeAcrossBlocks)(e,{at:e.selection})||(0,_.someNode)(e,{match:{type:(0,_.getPluginType)(e,`button`)}})||(W.text((0,_.getEditorString)(e,e.selection)),W.show(`insert`,e.id)))},ht={marginTop:`10px`,marginBottom:`10px`,display:`inline-block`,overflow:`hidden`,textOverflow:`ellipsis`,maxWidth:`100%`,verticalAlign:`middle`,boxSizing:`border-box`,overflowWrap:`normal`},gt={buttonPrimary:{...ht,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)`,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:{...ht,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)`,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:{...ht,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)`,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)`}}},_t=e=>{let{attributes:t,children:n}=e,r=e.element.url||e.element.chosenLink?.searchResult?.link||``,i=e.element.target||`_self`,a=String(e.element.buttonStyle)||`primary`;return(0,d.jsx)(vt,{attributes:t,href:r,target:i,styles:gt[`button${a.charAt(0).toUpperCase()+a.slice(1)}`],children:n})},vt=({attributes:e,styles:t={hover:{}},children:n,href:r=`#`,target:i})=>{let[a,o]=(0,u.useState)(!1);return(0,d.jsx)(`a`,{...e,onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),href:r,target:i,style:a?{...t,...t.hover}:t,children:n})},yt=class extends _.MarkupElement{constructor(e=Z,t=_t){super(e,t)}},bt=(0,u.forwardRef)((e,t)=>{let n=(0,_.useEditorRef)();return(0,d.jsx)(_.ToolbarButton,{ref:t,...e,onMouseDown:e=>{e.preventDefault(),(0,_.focusEditor)(n,n.selection??n.prevSelection??void 0)},onClick:()=>{ft(n,{focused:!0})},children:(0,d.jsx)(_.IconStylingWrapper,{icon:(0,d.jsx)(l.IconButton,{size:16})})})});bt.displayName=`ButtonToolbarButton`;var xt=({editorId:e,id:t})=>{let n=(0,_.useEditorState)((0,_.useEventPlateId)(e)),r=!!(0,_.isRangeInSameBlock)(n,{at:n.selection}),i=(0,_.getPluginType)(n,Z),a=!!n?.selection&&(0,_.someNode)(n,{match:{type:i}});return(0,d.jsx)(`div`,{"data-plugin-id":t,children:(0,d.jsx)(bt,{pressed:a,disabled:!r,tooltip:(0,_.getTooltip)(r?`Button\n${(0,_.getHotkeyByPlatform)(`Ctrl+Shift+K`)}`:`Buttons can only be set for a single text block.`)})})},J=`link-plugin`,Y=function(e){return e.heading1=`heading1`,e.heading2=`heading2`,e.heading3=`heading3`,e.heading4=`heading4`,e.custom1=`custom1`,e.custom2=`custom2`,e.custom3=`custom3`,e.quote=`quote`,e.imageCaption=`imageCaption`,e.imageTitle=`imageTitle`,e.p=`p`,e}({}),X={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)`},[J]:{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)`},...gt},St=()=>{let e=(0,_.useEditorRef)();return(0,d.jsx)(_.FloatingModalWrapper,{padding:`16px`,minWidth:`400px`,"data-test-id":`floating-button-edit`,children:(0,d.jsxs)(`span`,{"data-test-id":`preview-button-flyout`,className:`tw-flex tw-justify-between tw-items-center tw-gap-2`,children:[(0,d.jsx)(`a`,{"data-test-id":`floating-button-edit-url`,href:G.url(),target:`_blank`,rel:`noopener noreferrer`,style:X[J],className:`tw-break-all`,children:G.url()}),(0,d.jsxs)(`span`,{className:`tw-flex tw-gap-2`,children:[(0,d.jsx)(`button`,{onClick:()=>{pt(e)},tabIndex:0,"data-test-id":`edit-button-button`,className:`tw-transition tw-cursor-pointer tw-rounded-medium hover:tw-bg-black-10 tw-p-1`,children:(0,d.jsx)(l.IconPen,{size:16})}),(0,d.jsx)(`button`,{onClick:()=>{q(e),(0,_.focusEditor)(e,e.selection??void 0)},tabIndex:0,"data-test-id":`remove-button-button`,className:`tw-transition tw-cursor-pointer tw-rounded-medium hover:tw-bg-black-10 tw-p-1`,children:(0,d.jsx)(l.IconTrashBin,{size:16})})]})]})})},Ct=e=>e.filter(e=>!!e.title?.trim()),wt=()=>(0,d.jsx)(`div`,{className:`tw-flex tw-justify-center tw-h-10 tw-items-center`,children:(0,d.jsx)(c.LoadingCircle,{size:`small`})}),Tt=({section:e,selectedUrl:t,onSelectUrl:n})=>{let r=e.permanentLink===t;return(0,d.jsx)(`button`,{"data-test-id":`internal-link-selector-section-link`,type:`button`,"data-is-active":r,className:`
|
|
2
|
-
tw-py-2 tw-pr-2.5 tw-pl-14 tw-leading-5 tw-cursor-pointer tw-w-full
|
|
3
|
-
${r?`tw-bg-highlight tw-text-highlight-on-highlight hover:tw-bg-highlight-hover:hover hover:tw-text-highlight-on-highlight:hover`:`hover:tw-bg-container-secondary-hover hover:tw-text-container-secondary-on-secondary-container`}`,onClick:()=>n(e.permanentLink),children:(0,d.jsxs)(`div`,{className:`tw-flex tw-flex-1 tw-space-x-2 tw-items-center tw-h-6`,children:[(0,d.jsx)(l.IconDocumentText,{size:16}),(0,d.jsx)(`span`,{className:`tw-text-small`,children:e.title}),(0,d.jsx)(`span`,{className:`tw-flex-auto tw-font-sans tw-text-x-small tw-text-right`,children:`Section`})]})})},Et=({page:e,selectedUrl:t,onSelectUrl:n,itemsToExpandInitially:r,getDocumentSectionsByDocumentPageId:i})=>{let[a,o]=(0,u.useState)(e.id===r.documentId),[s,c]=(0,u.useState)([]),l=e.permanentLink===t;(0,u.useEffect)(()=>{(async()=>{let t=Ct(await i(e.id));c(t)})()},[e.id,i]),(0,u.useEffect)(()=>{e.id===r.pageId&&o(!0)},[r,e.id]);let f=s.length>0;return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(`button`,{type:`button`,"data-test-id":`internal-link-selector-page-link`,className:`
|
|
4
|
-
tw-py-2 tw-pr-2.5 tw-leading-5 tw-cursor-pointer tw-flex tw-w-full
|
|
5
|
-
${f?`tw-pl-7 `:`tw-pl-12 `}
|
|
6
|
-
${l?`tw-bg-highlight tw-text-highlight-on-highlight hover:tw-bg-highlight-hover:hover hover:tw-text-highlight-on-highlight:hover `:`hover:tw-bg-container-secondary-hover hover:tw-text-container-secondary-on-secondary-container `}`,onClick:()=>n(e.permanentLink),children:(0,d.jsxs)(`div`,{className:`tw-flex tw-flex-1 tw-space-x-1 tw-items-center tw-h-6`,children:[f&&(0,d.jsx)(`button`,{type:`button`,className:`tw-flex tw-items-center tw-justify-center -tw-mr-2 tw-pr-3.5 tw-pt-1.5 tw-pb-1.5 tw-pl-3.5 tw-cursor-pointer`,onClick:()=>o(!a),onKeyDown:e=>e.key===`Enter`&&e.stopPropagation(),children:(0,d.jsx)(`div`,{className:`tw-transition-transform tw-w-0 tw-h-0 tw-font-normal tw-border-t-4 tw-border-t-transparent tw-border-b-4 tw-border-b-transparent tw-border-l-4 tw-border-l-x-strong
|
|
7
|
-
${a?`tw-rotate-90 `:``}`})}),(0,d.jsx)(`span`,{className:`tw-text-small`,children:e.title}),(0,d.jsx)(`span`,{className:`tw-flex-auto tw-font-sans tw-text-x-small tw-text-right`,children:`Page`})]},e.id)}),a&&s.length>0&&s.map(e=>(0,d.jsx)(Tt,{section:e,selectedUrl:t,onSelectUrl:n},e.id))]})},Dt=({documentId:e,selectedUrl:t,onSelectUrl:n,itemsToExpandInitially:r,getDocumentSectionsByDocumentPageId:i,getDocumentPagesByDocumentId:a})=>{let[o,s]=(0,u.useState)([]),[c,l]=(0,u.useState)(!0),f=[...o.values()],p=!c&&f.length>0;return(0,u.useEffect)(()=>{a(e).then(e=>{let t=e.filter(e=>!!e.category).sort((e,t)=>e.category.sort===t.category.sort?e.sort-t.sort:e.category.sort-t.category.sort),n=e.filter(e=>!e.category).sort((e,t)=>e.sort-t.sort);s([...t,...n])}).finally(()=>{l(!1)})},[]),c?(0,d.jsx)(wt,{}):p?(0,d.jsx)(d.Fragment,{children:f.map(e=>(0,d.jsx)(Et,{page:e,selectedUrl:t,onSelectUrl:n,itemsToExpandInitially:r,getDocumentSectionsByDocumentPageId:i},e.id))}):(0,d.jsx)(`div`,{className:`tw-h-10 tw-flex tw-items-center tw-pr-2.5 tw-pl-7 tw-leading-5 tw-text-small tw-text-secondary`,children:`This document does not contain any pages.`})},Ot=({document:e,selectedUrl:t,onSelectUrl:n,itemsToExpandInitially:r,getDocumentSectionsByDocumentPageId:i,getDocumentPagesByDocumentId:a})=>{let[o,s]=(0,u.useState)(e.id===r.documentId),c=e.permanentLink===t;return(0,u.useEffect)(()=>{e.id===r.documentId&&s(!0)},[r,e.id]),(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(`button`,{type:`button`,"data-test-id":`internal-link-selector-document-link`,className:`tw-flex tw-flex-1 tw-space-x-2 tw-items-center tw-py-2 tw-pr-2.5 tw-leading-5 tw-cursor-pointer tw-w-full ${c?`tw-bg-highlight tw-text-highlight-on-highlight hover:tw-bg-highlight-hover:hover hover:tw-text-highlight-on-highlight:hover`:`hover:tw-bg-container-secondary-hover hover:tw-text-container-secondary-on-secondary-container`}`,onClick:()=>n(e.permanentLink),children:[(0,d.jsx)(`button`,{type:`button`,tabIndex:0,"data-test-id":`tree-item-toggle`,className:`tw-flex tw-items-center tw-justify-center -tw-mr-2 tw-pr-3.5 tw-pt-1.5 tw-pb-1.5 tw-pl-3.5 tw-cursor-pointer`,onClick:()=>s(!o),onKeyDown:e=>e.key===`Enter`&&e.stopPropagation(),children:(0,d.jsx)(`div`,{className:`tw-transition-transform tw-w-0 tw-h-0 tw-font-normal tw-border-t-4 tw-border-t-transparent tw-border-b-4 tw-border-b-transparent tw-border-l-4 tw-border-l-x-strong ${o?`tw-rotate-90`:``}`})}),(0,d.jsx)(l.IconColorFan,{size:16}),(0,d.jsx)(`span`,{className:`tw-text-small`,children:e.title}),(0,d.jsx)(`span`,{className:`tw-flex-auto tw-font-sans tw-text-x-small tw-text-right`,children:`Document`})]}),o&&(0,d.jsx)(Dt,{documentId:e.id,selectedUrl:t,onSelectUrl:n,itemsToExpandInitially:r,getDocumentSectionsByDocumentPageId:i,getDocumentPagesByDocumentId:a})]})},kt=({selectedUrl:e,onSelectUrl:t,getAllDocuments:n,getDocumentPagesByDocumentId:r,getDocumentSectionsByDocumentPageId:i})=>{let[a,o]=(0,u.useState)(!0),[s,c]=(0,u.useState)([]),[l,f]=(0,u.useState)({documentId:void 0,pageId:void 0});(0,u.useEffect)(()=>{e&&s.length>0&&p().then(e=>{f(e)})},[s.length]),(0,u.useEffect)(()=>{n().then(e=>{c(e)}).finally(()=>{o(!1)})},[]);let p=async()=>{let t={documentId:void 0,pageId:void 0};if(s.find(t=>t.permanentLink===e))return t;for(let n of s){let a=await r(n.id);if(a.find(t=>t.permanentLink===e))return t.documentId=n.id,t;for(let r of a)if(Ct(await i(r.id)).find(t=>t.permanentLink===e))return t.documentId=n.id,t.pageId=r.id,t}return t};return a?(0,d.jsx)(wt,{}):(0,d.jsx)(d.Fragment,{children:s.map(n=>(0,d.jsx)(Ot,{document:n,selectedUrl:e,onSelectUrl:t,itemsToExpandInitially:l,getDocumentSectionsByDocumentPageId:i,getDocumentPagesByDocumentId:r},n.id))})},At=({url:e,onUrlChange:t,buttonSize:n=`medium`,getAllDocuments:r,getDocumentPagesByDocumentId:i,getDocumentSectionsByDocumentPageId:a})=>{let[o,s]=(0,u.useState)(!1),[f,p]=(0,u.useState)(e),m=e=>{p(e)},h=e=>{e.key===`Enter`&&(e.preventDefault(),g())};(0,u.useEffect)(()=>{e&&!f&&p(e)},[e,f]);let g=()=>{t?.(f),s(!1)};return(0,d.jsx)(`div`,{onPointerDown:e=>{e.preventDefault()},"data-test-id":`internal-link-selector`,onKeyDown:h,children:(0,d.jsxs)(c.Dialog.Root,{modal:!0,open:o,onOpenChange:s,children:[(0,d.jsx)(c.Dialog.Trigger,{asChild:!0,children:(0,d.jsxs)(c.Button,{size:n,emphasis:`default`,children:[(0,d.jsx)(l.IconLink,{size:`20`}),`Internal link`]})}),(0,d.jsxs)(c.Dialog.Content,{onOpenAutoFocus:()=>{},showUnderlay:!0,"data-is-underlay":!0,minWidth:`800px`,children:[(0,d.jsx)(c.Dialog.Header,{children:(0,d.jsx)(c.Dialog.Title,{children:`Select internal link`})}),(0,d.jsx)(c.Dialog.Body,{padding:`none`,children:(0,d.jsx)(c.ScrollArea,{padding:`compact`,children:(0,d.jsx)(kt,{selectedUrl:f,onSelectUrl:m,getAllDocuments:r,getDocumentPagesByDocumentId:i,getDocumentSectionsByDocumentPageId:a})})}),(0,d.jsxs)(c.Dialog.Footer,{children:[(0,d.jsx)(c.Button,{size:n,emphasis:`default`,onPress:()=>s(!1),children:`Cancel`}),(0,d.jsx)(c.Button,{size:n,disabled:!f,emphasis:`strong`,onPress:()=>g(),children:`Choose`})]})]})]})})},jt=({onUrlChange:e,onToggleTab:t,isValidUrlOrEmpty:n,appBridge:r,placeholder:i,newTab:a,url:o=``,required:s,info:l,label:u,buttonSize:f,hideInternalLinkButton:p})=>{let m=n?n(o):K(o);return(0,d.jsxs)(`div`,{"data-test-id":`link-input`,children:[(0,d.jsx)(g.FormControl,{label:{children:u,htmlFor:`url`,required:s,tooltip:l?{content:l,position:`top`}:void 0},children:(0,d.jsx)(c.TextInput,{"data-test-id":`text-input`,id:`url`,value:o,onChange:t=>e?.(t.target.value),placeholder:i??`https://example.com`})}),!m&&(0,d.jsx)(`div`,{className:`tw-text-error tw-mt-1 tw-text-small`,children:`Please enter a valid URL.`}),!p&&(0,d.jsx)(`div`,{className:`tw-mt-3`,children:(0,d.jsx)(At,{url:o,onUrlChange:e,buttonSize:f??`medium`,getAllDocuments:()=>r.getAllDocuments(),getDocumentPagesByDocumentId:e=>r.getDocumentPagesByDocumentId(e),getDocumentSectionsByDocumentPageId:e=>r.getDocumentSectionsByDocumentPageId(e)})}),(0,d.jsxs)(`div`,{className:`tw-mt-3 tw-flex tw-items-center tw-gap-1.5`,children:[(0,d.jsx)(c.Checkbox,{id:`new-tab`,value:a,onChange:()=>t?.(!a)}),(0,d.jsx)(c.Label,{id:`new-tab-label`,htmlFor:`new-tab`,className:`tw-whitespace-nowrap`,children:`Open in new tab`})]})]})},Mt=({state:e,onTextChange:t,onUrlChange:n,onToggleTab:r,onCancel:i,onSave:a,isValidUrlOrEmpty:o,hasValues:s,testId:u,appBridge:f,children:p})=>(0,d.jsxs)(_.FloatingModalWrapper,{"data-test-id":u,padding:`28px`,minWidth:`400px`,children:[(0,d.jsx)(g.FormControl,{label:{children:`Text`,htmlFor:`linkText`,required:!0},children:(0,d.jsx)(c.TextInput,{id:`linkText`,value:e.text,placeholder:`Link Text`,onChange:e=>t(e.target.value)})}),p,(0,d.jsx)(`div`,{className:`tw-mt-5`,children:(0,d.jsx)(jt,{url:e.url,newTab:e.newTab,onUrlChange:n,onToggleTab:r,isValidUrlOrEmpty:o,appBridge:f})}),(0,d.jsx)(`div`,{className:`tw-mt-3`,children:(0,d.jsxs)(`div`,{className:`tw-pt-5 tw-flex tw-gap-x-3 tw-justify-end tw-border-t tw-border-t-black-10`,children:[(0,d.jsx)(c.Button,{"data-test-id":`button`,onPress:i,size:`medium`,emphasis:`default`,children:`Cancel`}),(0,d.jsxs)(c.Button,{"data-test-id":`button`,onPress:a,size:`medium`,disabled:!o(e?.url)||!s,children:[(0,d.jsx)(l.IconCheckMark,{size:`20`}),`Save`]})]})})]}),Nt=e=>{let t=(0,_.getAboveNode)(e,{match:{type:Z}});return Array.isArray(t)&&t[0]?.buttonStyle||`primary`},Pt={url:``,text:``,buttonStyle:`primary`,newTab:!1},Ft=()=>{let[e,t]=(0,u.useReducer)((e,t)=>{let{type:n,payload:r}=t;switch(n){case`NEW_TAB`:return{...e,newTab:!0};case`SAME_TAB`:return{...e,newTab:!1};case`URL`:case`TEXT`:case`BUTTON_STYLE`:case`INIT`:return{...e,...r};default:return e}},Pt);return[e,t]},It=()=>{let e=(0,_.useEditorRef)(),[t,n]=Ft();(0,u.useEffect)(()=>{let t=Nt(e);n({type:`INIT`,payload:{text:G.text()||G.url(),buttonStyle:t,newTab:!!G.newTab(),url:G.url()}})},[n,e]);let r=e=>{n({type:`TEXT`,payload:{text:e}})},i=e=>{n({type:`BUTTON_STYLE`,payload:{buttonStyle:e}})},a=e=>{n({type:`URL`,payload:{url:e}})},o=e=>{n(e?{type:`NEW_TAB`}:{type:`SAME_TAB`})},s=()=>{W.reset()},c=n=>{if(!K(t.url)||!l)return;let r=Qe(t.url);W.text(t.text),W.url(r),W.buttonStyle(t.buttonStyle),W.newTab(t.newTab),nt(e)&&n?.preventDefault()},l=t.url!==``&&t.text!==``,{appBridge:d}=(0,_.getPluginOptions)(e,Z);return(0,_.useHotkeys)(`enter`,c,{enableOnFormTags:[`INPUT`]},[]),{state:t,onTextChange:r,onButtonStyleChange:i,onUrlChange:a,onToggleTab:o,onCancel:s,onSave:c,hasValues:l,isValidUrlOrEmpty:K,appBridge:d}},Lt=()=>{let e=It(),{state:t,onButtonStyleChange:n}=e;return(0,d.jsx)(Mt,{...e,testId:`floating-button-insert`,children:(0,d.jsx)(`div`,{className:`tw-pt-5`,children:(0,d.jsxs)(g.FormControl,{label:{children:`Button Style`,htmlFor:`buttonStyle`,required:!0},children:[(0,d.jsx)(Rt,{id:`primary`,styles:X.buttonPrimary,isActive:t.buttonStyle===`primary`,onClick:()=>n(`primary`),children:t.text||`Primary Button`}),(0,d.jsx)(Rt,{id:`secondary`,styles:X.buttonSecondary,isActive:t.buttonStyle===`secondary`,onClick:()=>n(`secondary`),children:t.text||`Secondary Button`}),(0,d.jsx)(Rt,{id:`tertiary`,styles:X.buttonTertiary,isActive:t.buttonStyle===`tertiary`,onClick:()=>n(`tertiary`),children:t.text||`Tertiary Button`})]})})})},Rt=({id:e,styles:t,isActive:n,onClick:r,children:i})=>{let[a,o]=(0,u.useState)(!1);return(0,d.jsx)(`button`,{"data-test-id":`floating-button-insert-${e}`,onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),onClick:r,style:{...t&&t.hover&&a?{...t,...t.hover}:t,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:i})},zt={placement:`bottom-start`,strategy:`absolute`,middleware:[(0,_.offset)(12),(0,_.flip)({padding:12,fallbackPlacements:[`bottom-end`,`top-start`,`top-end`]})]},Bt=()=>{let{ref:e,...t}=qt(zt),{ref:n,...r}=Wt(zt),i=(0,_.useEditorRef)(),a=He(),o=a.isOpen(i.id),s=a.isEditing(),c=a.mode(),l=(0,d.jsx)(Lt,{}),u=s?l:(0,d.jsx)(St,{});return(0,d.jsxs)(d.Fragment,{children:[o&&c===`insert`&&(0,v.createPortal)((0,d.jsx)(`div`,{"data-is-underlay":!0,ref:e,...t,style:{...t.style,...X[_.TextStyles.p]},children:l}),document.body),o&&c===`edit`&&(0,v.createPortal)((0,d.jsx)(`div`,{"data-is-underlay":!0,ref:n,...r,style:{...r.style,...X[_.TextStyles.p]},children:u}),document.body)]})},Z=`button`,Vt=`button-plugin`,Ht=e=>(0,_.createPluginFactory)({key:Z,isElement:!0,isInline:!0,props:({element:e})=>({nodeProps:{href:e?.url,target:e?.target}}),withOverrides:et,renderAfterEditable:Bt,options:{isUrl:$e,rangeBeforeOptions:{matchString:` `,skipInvalid:!0,afterMatch:!0},triggerFloatingButtonHotkeys:`command+shift+k, ctrl+shift+k`,appBridge:e},then:(e,{type:t})=>({deserializeHtml:{rules:[{validNodeName:`A`,validClassName:`btn`}],getNode:e=>({type:t,url:e.getAttribute(`href`),target:e.getAttribute(`target`)||`_blank`})}})})(),Ut=class extends _.Plugin{styles={};appBridge;constructor({styles:e=gt,...t}){super(Vt,{button:xt,markupElement:new yt,...t}),this.styles=e,this.appBridge=t?.appBridge}plugins(){return[Ht(this.appBridge)]}},Wt=e=>{let t=(0,_.useEditorRef)(),n=He().mode(),r=He().isOpen(t.id),i=(0,_.useEditorVersion)(),{triggerFloatingButtonHotkeys:a}=(0,_.getPluginOptions)(t,Z),o=(0,u.useCallback)(()=>{let e=(0,_.getAboveNode)(t,{match:{type:(0,_.getPluginType)(t,Z)}});if(e){let[,n]=e;return(0,_.getRangeBoundingClientRect)(t,{anchor:(0,_.getStartPoint)(t,n),focus:(0,_.getEndPoint)(t,n)})}return(0,_.getDefaultBoundingClientRect)()},[t]),{update:s,style:c,floating:l}=Zt({open:r&&n===`edit`,getBoundingClientRect:o,...e});return(0,u.useEffect)(()=>{let e=ut(t);if(e&&W.url(e),t.selection&&(0,_.someNode)(t,{match:{type:(0,_.getPluginType)(t,`button`)}})){W.show(`edit`,t.id),s();return}G.mode()===`edit`&&W.reset()},[t,i,s]),(0,_.useHotkeys)(a,e=>{e.preventDefault(),G.mode()===`edit`&&pt(t)},{enableOnContentEditable:!0},[]),Gt(),Kt(),{style:c,ref:(0,_.useComposedRef)(l)}},Gt=()=>{let e=(0,_.useEditorRef)();(0,_.useHotkeys)(`*`,t=>{t.key===`Enter`&&nt(e)&&t.preventDefault()},{enableOnFormTags:[`INPUT`]},[])},Kt=()=>{let e=(0,_.useEditorRef)();(0,_.useHotkeys)(`escape`,()=>{if(G.mode()===`edit`){if(G.isEditing()){W.show(`edit`,e.id),(0,_.focusEditor)(e,e.selection??void 0);return}W.reset()}},{enableOnFormTags:[`INPUT`],enableOnContentEditable:!0},[])},qt=e=>{let t=(0,_.useEditorRef)(),n=(0,_.useFocused)(),r=He().mode(),i=He().isOpen(t.id),{triggerFloatingButtonHotkeys:a}=(0,_.getPluginOptions)(t,Z);(0,_.useHotkeys)(a,e=>{e.preventDefault(),mt(t,{focused:n})},{enableOnContentEditable:!0},[n]);let{update:o,style:s,floating:c}=Zt({open:i&&r===`insert`,getBoundingClientRect:_.getSelectionBoundingClientRect,whileElementsMounted:void 0,...e});return(0,u.useEffect)(()=>{i&&o(),W.updated(i)},[i,o]),Kt(),{style:s,ref:(0,_.useComposedRef)(c)}},Jt=12,Yt=-22,Xt=96,Zt=e=>(0,_.useVirtualFloating)({placement:`bottom-start`,middleware:[(0,_.offset)({mainAxis:Jt,alignmentAxis:Yt}),(0,_.flip)({padding:Xt})],...e}),Qt=`[&_.tw-break-after-column]:tw-break-after-auto [&_.tw-break-inside-avoid-column]:tw-break-inside-auto [&_.tw-break-after-column.tw-pb-5]:tw-pb-0 @md:[&_.tw-break-after-column.tw-pb-5]:!tw-pb-5 @md:[&_.tw-break-after-column]:!tw-break-after-column @md:[&_.tw-break-inside-avoid-column]:!tw-break-inside-avoid-column`,$t={1:`tw-columns-1`,2:`tw-columns-1 @sm:!tw-columns-2 [&_.tw-break-after-column]:tw-break-after-auto [&_.tw-break-inside-avoid-column]:tw-break-inside-auto [&_.tw-break-after-column.tw-pb-5]:tw-pb-0 @sm:[&_.tw-break-after-column.tw-pb-5]:!tw-pb-5 @sm:[&_.tw-break-after-column]:!tw-break-after-column @sm:[&_.tw-break-inside-avoid-column]:!tw-break-inside-avoid-column`,3:`tw-columns-1 @md:!tw-columns-3 ${Qt}`,4:`tw-columns-1 @md:!tw-columns-4 ${Qt}`,5:`tw-columns-1 @md:!tw-columns-5 ${Qt}`},en=e=>e?$t[e]||$t[1]:``,tn=({value:e=``,gap:t,customClass:n,show:r=!0,plugins:i})=>{let[a,o]=(0,u.useState)(null);return(0,u.useEffect)(()=>{(async()=>{let r=await(0,_.serializeRawToHtmlAsync)(e,i,void 0,t,n);o(r)})().catch(console.error)},[e,t,i,n]),!r||a===`<br />`||a===null?null:(0,d.jsx)(`div`,{className:`tw-w-full tw-whitespace-pre-wrap`,"data-test-id":`rte-content-html`,dangerouslySetInnerHTML:{__html:a}})},nn=e=>{G.isOpen(e)&&W.reset()},rn=(0,u.memo)(({isEnabled:e,value:t,columns:n,gap:r,placeholder:i,plugins:a,onTextChange:o,showSerializedText:s})=>{let c=en(n),[l,f]=(0,u.useState)(!1),p=(0,u.useId)(),m=(0,u.useCallback)(e=>{e!==t&&o?.(e),f(!1)},[o,t]),h=(0,u.useCallback)(()=>f(!0),[]);return(0,u.useEffect)(()=>{let e=e=>{e.preventDefault(),e.returnValue=`Unprocessed changes`};return l&&window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[l]),e?(0,d.jsx)(_.RichTextEditor,{id:p,value:t,border:!1,placeholder:i,plugins:a,onValueChanged:h,onTextChange:m,hideExternalFloatingModals:nn,placeholderOpacity:`high`}):(0,d.jsx)(tn,{value:t,gap:r,customClass:c,show:s,plugins:a})});rn.displayName=`InternalRichTextEditor`;var an=e=>{let t=(0,u.useRef)(null),[n,r]=(0,u.useState)(!1),{isEditing:i,...a}=e,o=(0,u.useCallback)(e=>{e&&r(!0)},[]);return Be({ref:t,disabled:!i,onChange:o}),(0,u.useEffect)(()=>{i||r(!1)},[i]),(0,d.jsx)(`div`,{"data-test-id":`rich-text-editor-container`,className:`tw-block tw-w-full tw-@container`,ref:t,children:(0,d.jsx)(rn,{...a,isEnabled:i&&n})})},on=({editButtonProps:e,unlinkButtonProps:t})=>{let{element:n}=(0,_.useLinkOpenButtonState)(),r=n?Ye(n):``;return(0,d.jsx)(_.FloatingModalWrapper,{"data-test-id":`floating-link-edit`,padding:`16px`,minWidth:`400px`,children:(0,d.jsxs)(`span`,{"data-test-id":`preview-link-flyout`,className:`tw-flex tw-justify-between tw-items-center tw-gap-2`,children:[(0,d.jsx)(`a`,{"data-test-id":`floating-link-edit-url`,href:r,target:`_blank`,rel:`noopener noreferrer`,style:X[J],className:`tw-break-all`,children:r}),(0,d.jsxs)(`span`,{className:`tw-flex tw-gap-2`,children:[(0,d.jsx)(`button`,{tabIndex:0,"data-test-id":`edit-link-button`,className:`tw-transition tw-cursor-pointer tw-rounded-medium hover:tw-bg-black-10 tw-p-1`,...e,children:(0,d.jsx)(l.IconPen,{size:16})}),(0,d.jsx)(`button`,{tabIndex:0,"data-test-id":`remove-link-button`,className:`tw-transition tw-cursor-pointer tw-rounded-medium hover:tw-bg-black-10 tw-p-1`,...t,children:(0,d.jsx)(l.IconTrashBin,{size:16})})]})]})})},sn=(e,t)=>{let n=(0,_.getAboveNode)(e,{match:{type:_.ELEMENT_LINK}});return Array.isArray(n)?t(n[0]):``},cn=e=>sn(e,e=>e.chosenLink?.searchResult?.link||``),ln=e=>sn(e,e=>e.url||``),un={url:``,text:``,newTab:!1},dn=()=>{let[e,t]=(0,u.useReducer)((e,t)=>{let{type:n,payload:r}=t;switch(n){case`NEW_TAB`:return{...e,newTab:!0};case`SAME_TAB`:return{...e,newTab:!1};case`URL`:case`TEXT`:case`INIT`:return{...e,...r};default:return e}},un);return[e,t]},fn=()=>{let e=(0,_.useEditorRef)(),[t,n]=dn();(0,u.useEffect)(()=>{let t=cn(e),r=ln(e),i=_.floatingLinkSelectors.newTab();n({type:`INIT`,payload:{text:_.floatingLinkSelectors.text()||_.floatingLinkSelectors.url(),newTab:i,url:t&&r===``?t:_.floatingLinkSelectors.url()}})},[n,e]);let r=e=>{n({type:`TEXT`,payload:{text:e}})},i=e=>{n({type:`URL`,payload:{url:e}})},a=e=>{n(e?{type:`NEW_TAB`}:{type:`SAME_TAB`})},o=()=>{_.floatingLinkActions.reset()},s=n=>{!K(t.url)||!c||(_.floatingLinkActions.text(t.text),_.floatingLinkActions.url(Qe(t.url)),_.floatingLinkActions.newTab(t.newTab),(0,_.submitFloatingLink)(e)&&n?.preventDefault())},c=t.url!==``&&t.text!==``,{appBridge:l}=(0,_.getPluginOptions)(e,_.ELEMENT_LINK);return(0,_.useHotkeys)(`enter`,s,{enableOnFormTags:[`INPUT`]},[]),{state:t,onTextChange:r,onUrlChange:i,onToggleTab:a,onCancel:o,onSave:s,hasValues:c,isValidUrlOrEmpty:K,appBridge:l}},pn=()=>(0,d.jsx)(Mt,{...fn(),testId:`floating-link-insert`}),mn={placement:`bottom-start`,strategy:`absolute`,middleware:[(0,_.offset)(12),(0,_.flip)({padding:12,fallbackPlacements:[`bottom-end`,`top-start`,`top-end`]})]},hn=()=>{let e=(0,_.useFloatingLinkInsertState)({floatingOptions:mn}),{props:t,ref:n,hidden:r}=(0,_.useFloatingLinkInsert)(e),i=(0,_.useFloatingLinkEditState)({floatingOptions:mn}),{props:a,ref:o,editButtonProps:s,unlinkButtonProps:c}=(0,_.useFloatingLinkEdit)(i);if(r)return null;let l=(0,d.jsx)(pn,{}),u=i.isEditing?l:(0,d.jsx)(on,{editButtonProps:s,unlinkButtonProps:c});return(0,d.jsxs)(d.Fragment,{children:[e.isOpen&&!i.isOpen&&(0,v.createPortal)((0,d.jsx)(`div`,{"data-is-underlay":!0,ref:n,...t,style:{...t.style,...X[Y.p]},children:l}),document.body),i.isOpen&&(0,v.createPortal)((0,d.jsx)(`div`,{"data-is-underlay":!0,ref:o,...a,style:{...a.style,...X[Y.p]},children:u}),document.body)]})},gn=(0,u.forwardRef)((e,t)=>{let n=(0,_.useEditorRef)(),r=(0,_.useLinkToolbarButtonState)(),{props:i}=(0,_.useLinkToolbarButton)(r);return(0,d.jsx)(_.ToolbarButton,{onMouseDown:e=>{e.preventDefault(),(0,_.focusEditor)(n,n.selection??n.prevSelection??void 0)},ref:t,...i,...e,children:(0,d.jsx)(_.IconStylingWrapper,{icon:(0,d.jsx)(l.IconLink,{size:16})})})});gn.displayName=`LinkToolbarButton`;var _n=({id:e,editorId:t})=>{let n=(0,_.useEditorState)((0,_.useEventPlateId)(t)),r=!!(0,_.isRangeInSameBlock)(n,{at:n.selection});return(0,d.jsx)(`div`,{"data-plugin-id":e,children:(0,d.jsx)(gn,{disabled:!r,tooltip:(0,_.getTooltip)(r?`Link\n${(0,_.getHotkeyByPlatform)(`Ctrl+K`)}`:`Links can only be set for a single text block.`)})})},vn=e=>{let{attributes:t,children:n}=e,{styles:r}=(0,_.useRichTextEditorContext)(),i=e.element.url||e.element.chosenLink?.searchResult?.link||``,a=e.element.target||`_self`;return(0,d.jsx)(`a`,{...t,href:i,target:a,style:r[J],children:n})},yn=class extends _.MarkupElement{constructor(e=_.ELEMENT_LINK,t=vn){super(e,t)}},bn=e=>(0,_.createPluginFactory)({...(0,_.createLinkPlugin)(),renderAfterEditable:hn,options:{isUrl:$e,rangeBeforeOptions:{matchString:` `,skipInvalid:!0,afterMatch:!0},triggerFloatingLinkHotkeys:`meta+k, ctrl+k`,keepSelectedTextOnPaste:!0,appBridge:e}})(),xn=class extends _.Plugin{styles={};appBridge;constructor({styles:e=X[J],...t}){super(J,{button:_n,markupElement:new yn,...t}),this.styles=e,this.appBridge=t.appBridge}plugins(){return[bn(this.appBridge)]}},Sn=`breakAfterColumn`,Cn=`normal`,wn=class extends _.Plugin{columns;gap;customClass;constructor(e){super(`break-after-plugin`,{button:_.ColumnBreakButton,...e}),this.columns=e?.columns??1,this.gap=e?.gap??`normal`,this.customClass=en(this.columns)}plugins(){return[(0,_.createColumnBreakPlugin)(this.columns,this.gap,this.customClass)]}},Tn=`textstyle-custom1-plugin`,En=class extends _.Plugin{styles={};constructor({styles:e=X.custom1,...t}={}){super(Y.custom1,{label:`Custom 1`,markupElement:new Dn,...t}),this.styles=e}plugins(){return[kn(this.styles)]}},Dn=class extends _.MarkupElement{constructor(e=Tn,t=On){super(e,t)}},On=({element:e,attributes:t,children:n,styles:r})=>{let i=e.align;return(0,d.jsx)(`p`,{...t,style:r,className:(0,_.merge)([i&&_.alignmentClassnames[i],(0,_.getColumnBreakClasses)(e)]),children:n})},kn=e=>(0,_.createPluginFactory)({key:Y.custom1,isElement:!0,deserializeHtml:{rules:[{validClassName:Y.custom1}]}})({component:t=>(0,d.jsx)(On,{...t,styles:e})}),An=`textstyle-custom2-plugin`,jn=class extends _.Plugin{styles={};constructor({styles:e=X.custom2,...t}={}){super(Y.custom2,{label:`Custom 2`,markupElement:new Mn,...t}),this.styles=e}plugins(){return[Pn(this.styles)]}},Mn=class extends _.MarkupElement{constructor(e=An,t=Nn){super(e,t)}},Nn=({element:e,attributes:t,children:n,styles:r})=>{let i=e.align;return(0,d.jsx)(`p`,{...t,className:(0,_.merge)([i&&_.alignmentClassnames[i],(0,_.getColumnBreakClasses)(e)]),style:r,children:n})},Pn=e=>(0,_.createPluginFactory)({key:Y.custom2,isElement:!0,deserializeHtml:{rules:[{validClassName:Y.custom2}]}})({component:t=>(0,d.jsx)(Nn,{...t,styles:e})}),Fn=`textstyle-custom3-plugin`,In=class extends _.Plugin{styles={};constructor({styles:e=X.custom3,...t}={}){super(_.TextStyles.custom3,{label:`Custom 3`,markupElement:new Ln,...t}),this.styles=e}plugins(){return[zn(this.styles)]}},Ln=class extends _.MarkupElement{constructor(e=Fn,t=Rn){super(e,t)}},Rn=({element:e,attributes:t,children:n,styles:r})=>{let i=e.align;return(0,d.jsx)(`p`,{...t,className:(0,_.merge)([i&&_.alignmentClassnames[i],(0,_.getColumnBreakClasses)(e)]),style:r,children:n})},zn=e=>(0,_.createPluginFactory)({key:_.TextStyles.custom3,isElement:!0,deserializeHtml:{rules:[{validClassName:_.TextStyles.custom3}]}})({component:t=>(0,d.jsx)(Rn,{...t,styles:e})}),Bn=`textstyle-heading1-plugin`,Vn=class extends _.Plugin{styles={};constructor({styles:e=X.heading1,...t}={}){super(Y.heading1,{label:`Heading 1`,markupElement:new Hn,...t}),this.styles=e}plugins(){return[Wn(this.styles)]}},Hn=class extends _.MarkupElement{constructor(e=Bn,t=Un){super(e,t)}},Un=({element:e,attributes:t,children:n,styles:r})=>{let i=e.align;return(0,d.jsx)(`h1`,{...t,className:(0,_.merge)([i&&_.alignmentClassnames[i],(0,_.getColumnBreakClasses)(e)]),style:r,children:n})},Wn=e=>(0,_.createPluginFactory)({key:Y.heading1,isElement:!0,component:Un,deserializeHtml:{rules:[{validNodeName:[`h1`,`H1`]}]}})({component:t=>(0,d.jsx)(Un,{...t,styles:e})}),Gn=`textstyle-heading2-plugin`,Kn=class extends _.Plugin{styles={};constructor({styles:e=X.heading2,...t}={}){super(Y.heading2,{label:`Heading 2`,markupElement:new qn,...t}),this.styles=e}plugins(){return[Yn(this.styles)]}},qn=class extends _.MarkupElement{constructor(e=Gn,t=Jn){super(e,t)}},Jn=({element:e,attributes:t,children:n,styles:r})=>{let i=e.align;return(0,d.jsx)(`h2`,{...t,className:(0,_.merge)([i&&_.alignmentClassnames[i],(0,_.getColumnBreakClasses)(e)]),style:r,children:n})},Yn=e=>(0,_.createPluginFactory)({key:Y.heading2,isElement:!0,component:Jn,deserializeHtml:{rules:[{validNodeName:[`h2`,`H2`]}]}})({component:t=>(0,d.jsx)(Jn,{...t,styles:e})}),Xn=`textstyle-heading3-plugin`,Zn=class extends _.Plugin{styles={};constructor({styles:e=X.heading3,...t}={}){super(Y.heading3,{label:`Heading 3`,markupElement:new Qn,...t}),this.styles=e}plugins(){return[er(this.styles)]}},Qn=class extends _.MarkupElement{constructor(e=Xn,t=$n){super(e,t)}},$n=({element:e,attributes:t,children:n,styles:r})=>{let i=e.align;return(0,d.jsx)(`h3`,{...t,className:(0,_.merge)([i&&_.alignmentClassnames[i],(0,_.getColumnBreakClasses)(e)]),style:r,children:n})},er=e=>(0,_.createPluginFactory)({key:Y.heading3,isElement:!0,component:$n,deserializeHtml:{rules:[{validNodeName:[`h3`,`H3`]}]}})({component:t=>(0,d.jsx)($n,{...t,styles:e})}),tr=`textstyle-heading4-plugin`,nr=class extends _.Plugin{styles={};constructor({styles:e=X.heading4,...t}={}){super(Y.heading4,{label:`Heading 4`,markupElement:new rr,...t}),this.styles=e}plugins(){return[ar(this.styles)]}},rr=class extends _.MarkupElement{constructor(e=tr,t=ir){super(e,t)}},ir=({element:e,attributes:t,children:n,styles:r})=>{let i=e.align;return(0,d.jsx)(`h4`,{...t,className:(0,_.merge)([i&&_.alignmentClassnames[i],(0,_.getColumnBreakClasses)(e)]),style:r,children:n})},ar=e=>(0,_.createPluginFactory)({key:Y.heading4,isElement:!0,component:ir,deserializeHtml:{rules:[{validNodeName:[`h4`,`H4`]}]}})({component:t=>(0,d.jsx)(ir,{...t,styles:e})}),or=`textstyle-imageCaption-plugin`,sr=class extends _.Plugin{styles={};constructor({styles:e=X.imageCaption,...t}={}){super(Y.imageCaption,{label:`Image Caption`,markupElement:new cr,...t}),this.styles=e}plugins(){return[ur(this.styles)]}},cr=class extends _.MarkupElement{constructor(e=or,t=lr){super(e,t)}},lr=({element:e,attributes:t,children:n,styles:r})=>{let i=e.align;return(0,d.jsx)(`p`,{...t,className:(0,_.merge)([i&&_.alignmentClassnames[i],(0,_.getColumnBreakClasses)(e)]),style:r,children:n})},ur=e=>(0,_.createPluginFactory)({key:Y.imageCaption,isElement:!0,component:lr,deserializeHtml:{rules:[{validClassName:Y.imageCaption}]}})({component:t=>(0,d.jsx)(lr,{...t,styles:e})}),dr=`textstyle-imageTitle-plugin`,fr=class extends _.Plugin{styles={};constructor({styles:e=X.imageTitle,...t}={}){super(Y.imageTitle,{label:`Image Title`,markupElement:new pr,...t}),this.styles=e}plugins(){return[hr(this.styles)]}},pr=class extends _.MarkupElement{constructor(e=dr,t=mr){super(e,t)}},mr=({element:e,attributes:t,children:n,styles:r})=>{let i=e.align;return(0,d.jsx)(`p`,{...t,className:(0,_.merge)([i&&_.alignmentClassnames[i],(0,_.getColumnBreakClasses)(e)]),style:r,children:n})},hr=e=>(0,_.createPluginFactory)({key:Y.imageTitle,isElement:!0,component:mr,deserializeHtml:{rules:[{validClassName:Y.imageTitle}]}})({component:t=>(0,d.jsx)(mr,{...t,styles:e})}),gr=class extends _.Plugin{styles={};constructor({styles:e=X.p,...t}={}){super(Y.p,{markupElement:new yr,label:`Body Text`,...t}),this.styles=e}plugins(){return[br(this.styles)]}},_r=`tw-m-0 tw-px-0 tw-py-0`,vr=({element:e,attributes:t,children:n,styles:r})=>{let i=e.align,a=(0,_.merge)([i&&_.alignmentClassnames[i],_r,(0,_.getColumnBreakClasses)(e)]);return(0,d.jsx)(`p`,{...t,className:a,style:r,children:n})},yr=class extends _.MarkupElement{constructor(e=Y.p,t=vr){super(e,t)}},br=e=>(0,_.createPluginFactory)({...(0,_.createParagraphPlugin)(),key:Y.p,isElement:!0,component:vr})({component:t=>(0,d.jsx)(vr,{...t,styles:e})}),xr=`textstyle-quote-plugin`,Sr=class extends _.Plugin{styles={};constructor({styles:e=X.quote,...t}={}){super(Y.quote,{label:`Quote`,markupElement:new Cr,...t}),this.styles=e}plugins(){return[Tr(this.styles)]}},Cr=class extends _.MarkupElement{constructor(e=xr,t=wr){super(e,t)}},wr=({element:e,attributes:t,children:n,styles:r})=>{let i=e.align;return(0,d.jsx)(`blockquote`,{...t,className:(0,_.merge)([i&&_.alignmentClassnames[i],(0,_.getColumnBreakClasses)(e)]),style:r,children:n})},Tr=e=>(0,_.createPluginFactory)({key:Y.quote,isElement:!0,component:wr,deserializeHtml:{rules:[{validNodeName:[`blockquote`,`BLOCKQUOTE`]}]}})({component:t=>(0,d.jsx)(wr,{...t,styles:e})}),Er=[new Vn,new Kn,new Zn,new nr,new En,new jn,new In,new Sr,new gr],Q=[Y.heading1,Y.heading2,Y.heading3,Y.heading4,Y.custom1,Y.custom2,Y.custom3,Y.quote,Y.p],Dr=[...Er,new sr,new fr],Or=[...Q,Y.imageCaption,Y.imageTitle],kr=[{color:`var(--f-theme-settings-list-bullet1-color, currentColor)`,shape:`var(--f-theme-settings-list-bullet1-shape, '•')`,size:`var(--f-theme-settings-list-bullet1-size, 1em)`},{color:`var(--f-theme-settings-list-bullet2-color, currentColor)`,shape:`var(--f-theme-settings-list-bullet2-shape, '•')`,size:`var(--f-theme-settings-list-bullet2-size, 1em)`},{color:`var(--f-theme-settings-list-bullet3-color, currentColor)`,shape:`var(--f-theme-settings-list-bullet3-shape, '•')`,size:`var(--f-theme-settings-list-bullet3-size, 1em)`}],Ar=class extends _.UnorderedListPlugin{constructor(e){super({listStyles:kr,...e})}},jr=[{counterType:`var(--f-theme-settings-list-numbered1-counter-type, decimal)`,color:`var(--f-theme-settings-list-numbered1-color, currentColor)`},{counterType:`var(--f-theme-settings-list-numbered2-counter-type, lower-alpha)`,color:`var(--f-theme-settings-list-numbered2-color, currentColor)`},{counterType:`var(--f-theme-settings-list-numbered3-counter-type, lower-roman)`,color:`var(--f-theme-settings-list-numbered3-color, currentColor)`}],Mr=class extends _.OrderedListPlugin{constructor(e){super({listStyles:jr,...e})}},Nr=e=>new _.PluginComposer().setPlugin(new _.SoftBreakPlugin,new _.TextStylePlugin({textStyles:Er})).setPlugin([new _.BoldPlugin,new _.ItalicPlugin,new _.UnderlinePlugin,new _.StrikethroughPlugin,new xn({appBridge:e}),new Ut({appBridge:e}),new _.CodePlugin],[new _.AlignLeftPlugin({validTypes:Q}),new _.AlignCenterPlugin({validTypes:Q}),new _.AlignRightPlugin({validTypes:Q}),new _.AlignJustifyPlugin({validTypes:Q}),new Ar,new _.CheckboxListPlugin,new Mr,new _.ResetFormattingPlugin,new _.AutoformatPlugin]),Pr=`--f-theme-settings-`,Fr=e=>{let t=e?.id?`hasBackground${e.id}`:`hasBackground`,n=e?.id?`backgroundColor${e.id}`:`backgroundColor`,r=e?.preventDefaultColor?void 0:e?.defaultColor||te;return{id:t,label:e?.label?e.label:`Background`,type:`switch`,switchLabel:e?.switchLabel?e.switchLabel:void 0,defaultValue:!!e?.defaultValue,on:[{id:n,defaultValue:r,type:`colorInput`}]}},Ir=e=>{let t=e?.id?`hasBorder_${e.id}`:`hasBorder`,n=e?.id?`borderSelection_${e.id}`:`borderSelection`,r=e?.id?`borderStyle_${e.id}`:`borderStyle`,i=e?.id?`borderWidth_${e.id}`:`borderWidth`,a=e?.id?`borderColor_${e.id}`:`borderColor`,o=e?.defaultColor||ne;return{id:t,label:`Border`,type:`switch`,switchLabel:e?.switchLabel?e.switchLabel:void 0,defaultValue:!!e?.defaultValue,on:[{id:n,type:`multiInput`,layout:$.MultiInputLayout.Columns,lastItemFullWidth:!0,blocks:[{id:r,type:`dropdown`,defaultValue:N.Solid,choices:[{value:N.Solid,label:N.Solid},{value:N.Dotted,label:N.Dotted},{value:N.Dashed,label:N.Dashed}]},{id:i,type:`input`,defaultValue:`1px`,rules:[$.numericalOrPixelRule,(0,$.minimumNumericalOrPixelRule)(0),(0,$.maximumNumericalOrPixelOrAutoRule)(500)],placeholder:`e.g. 3px`,onChange:e=>(0,$.appendUnit)(e,i)},{id:a,type:`colorInput`,defaultValue:o}]}],off:[]}},Lr=(e,t=P.None)=>({id:e,type:`segmentedControls`,defaultValue:t,choices:[{value:P.None,label:`None`},{value:P.Small,label:`S`},{value:P.Medium,label:`M`},{value:P.Large,label:`L`}]}),Rr=e=>{let t=e?.id?`hasRadius_${e.id}`:`hasRadius`,n=e?.id?`radiusValue_${e.id}`:`radiusValue`,r=e?.id?`radiusChoice_${e.id}`:`radiusChoice`,i=e?.defaultRadius||P.None;return{id:t,label:`Corner radius`,type:`switch`,switchLabel:`Custom`,defaultValue:!1,info:`Determining how rounded the corners are.`,show:t=>!e?.dependentSettingId||!!t.getBlock(e.dependentSettingId)?.value,onChange:t=>(0,$.presetCustomValue)(t,r,n,e?.radiusStyleMap||F),on:[{id:n,type:`input`,placeholder:`e.g. 10px`,rules:[$.numericalOrPixelRule,(0,$.minimumNumericalOrPixelRule)(0)],onChange:e=>(0,$.appendUnit)(e,n)}],off:[Lr(r,i)]}},zr=e=>{let t=e?.id?`hasExtendedCustomRadius_${e.id}`:`hasExtendedCustomRadius`,n=e?.id?`extendedRadiusValue_${e.id}`:`extendedRadiusValue`,r=e?.id?`extendedRadiusChoice_${e.id}`:`extendedRadiusChoice`,i=e?.id?`extendedRadiusTopLeft_${e.id}`:`extendedRadiusTopLeft`,a=e?.id?`extendedRadiusTopRight_${e.id}`:`extendedRadiusTopRight`,o=e?.id?`extendedRadiusBottomLeft_${e.id}`:`extendedRadiusBottomLeft`,s=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:t=>!e?.dependentSettingId||!!t.getBlock(e.dependentSettingId)?.value,onChange:e=>{(0,$.presetCustomValue)(e,r,i,F),(0,$.presetCustomValue)(e,r,a,F),(0,$.presetCustomValue)(e,r,o,F),(0,$.presetCustomValue)(e,r,s,F)},on:[{id:n,type:`multiInput`,layout:$.MultiInputLayout.Columns,blocks:[{id:i,type:`input`,label:`Top Left`,rules:[$.numericalOrPixelRule],onChange:e=>(0,$.appendUnit)(e,i)},{id:a,type:`input`,label:`Top Right`,rules:[$.numericalOrPixelRule],onChange:e=>(0,$.appendUnit)(e,a)},{id:o,type:`input`,label:`Bottom Left`,rules:[$.numericalOrPixelRule],onChange:e=>(0,$.appendUnit)(e,o)},{id:s,type:`input`,label:`Bottom Right`,rules:[$.numericalOrPixelRule],onChange:e=>(0,$.appendUnit)(e,s)}]}],off:[Lr(r,e?.defaultValue)]}},Br=e=>{let t=e?.id?e.id:`hasCustomSpacing`,n=e?.dependentSettingId?e.dependentSettingId:`columns`,r=e?.spacingChoiceId?e.spacingChoiceId:`spacingChoice`,i=e?.spacingCustomId?e.spacingCustomId:`spacingCustom`,a=e?.defaultValueChoices?e.defaultValueChoices:V.M;return{id:t,type:`switch`,defaultValue:!1,switchLabel:`Custom`,label:`Gutter`,info:`An official nerds term for ‘gap’`,onChange:e=>(0,$.presetCustomValue)(e,r,i,ie),show:e=>e.getBlock(n)?.value!==`1`,on:[{id:i,type:`input`,rules:[$.numericalOrPixelRule],onChange:e=>(0,$.appendUnit)(e,i)}],off:[{id:r,type:`slider`,defaultValue:a,choices:[{value:V.Auto,label:`Auto`},{value:V.S,label:`S`},{value:V.M,label:`M`},{value:V.L,label:`L`}]}]}},Vr=e=>({id:e,type:`segmentedControls`,defaultValue:R.None,choices:[{value:R.None,label:`None`},{value:R.Small,label:`S`},{value:R.Medium,label:`M`},{value:R.Large,label:`L`}]}),Hr=e=>{let t=e?.id?`hasCustomMarginValue_${e?.id}`:`hasCustomMarginValue`,n=e?.id?`marginValue_${e?.id}`:`marginValue`,r=e?.id?`marginChoice_${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:t=>(0,$.presetCustomValue)(t,r,n,e?.marginStyleMap||z),on:[{id:n,type:`input`,placeholder:M,rules:[$.numericalOrPixelRule,(0,$.maximumNumericalOrPixelOrAutoRule)(500)],onChange:e=>(0,$.appendUnit)(e,n)}],off:[Vr(r)]}},Ur=e=>{let t=e?.id?`hasExtendedCustomMargin_${e?.id}`:`hasExtendedCustomMargin`,n=e?.id?`extendedMarginValues_${e?.id}`:`extendedMarginValues`,r=e?.id?`extendedMarginChoice_${e?.id}`:`extendedMarginChoice`,i=e?.id?`extendedMarginTop_${e?.id}`:`extendedMarginTop`,a=e?.id?`extendedMarginLeft_${e?.id}`:`extendedMarginLeft`,o=e?.id?`extendedMarginRight_${e?.id}`:`extendedMarginRight`,s=e?.id?`extendedMarginBottom_${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:e=>{(0,$.presetCustomValue)(e,r,i,z),(0,$.presetCustomValue)(e,r,a,z),(0,$.presetCustomValue)(e,r,o,z),(0,$.presetCustomValue)(e,r,s,z)},on:[{id:n,type:`multiInput`,layout:$.MultiInputLayout.Spider,blocks:[{id:i,type:`input`,label:`Top`,placeholder:M,onChange:e=>(0,$.appendUnit)(e,i),rules:[$.numericalOrPixelRule,(0,$.maximumNumericalOrPixelOrAutoRule)(500)]},{id:a,type:`input`,label:`Left`,placeholder:M,onChange:e=>(0,$.appendUnit)(e,a),rules:[$.numericalOrPixelRule,(0,$.maximumNumericalOrPixelOrAutoRule)(500)]},{id:o,type:`input`,label:`Right`,placeholder:M,onChange:e=>(0,$.appendUnit)(e,o),rules:[$.numericalOrPixelRule,(0,$.maximumNumericalOrPixelOrAutoRule)(500)]},{id:s,type:`input`,label:`Bottom`,placeholder:M,onChange:e=>(0,$.appendUnit)(e,s),rules:[$.numericalOrPixelRule,(0,$.maximumNumericalOrPixelOrAutoRule)(500)]}]}],off:[Vr(r)]}},Wr=e=>({id:e,type:`segmentedControls`,defaultValue:I.Small,choices:[{value:I.None,label:`None`},{value:I.Small,label:`S`},{value:I.Medium,label:`M`},{value:I.Large,label:`L`}]}),Gr=e=>{let t=e?.id?`hasCustomPaddingValue_${e?.id}`:`hasCustomPaddingValue`,n=e?.id?`paddingValue_${e?.id}`:`paddingValue`,r=e?.id?`paddingChoice_${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:t=>(0,$.presetCustomValue)(t,r,n,e?.paddingStyleMap||L),on:[{id:n,type:`input`,placeholder:j,rules:[$.numericalOrPixelRule,(0,$.maximumNumericalOrPixelOrAutoRule)(500)],onChange:e=>(0,$.appendUnit)(e,n)}],off:[Wr(r)]}},Kr=e=>{let t=e?.id?`hasExtendedCustomPadding_${e?.id}`:`hasExtendedCustomPadding`,n=e?.id?`extendedPaddingValues_${e?.id}`:`extendedPaddingValues`,r=e?.id?`extendedPaddingChoice_${e?.id}`:`extendedPaddingChoice`,i=e?.id?`extendedPaddingTop_${e?.id}`:`extendedPaddingTop`,a=e?.id?`extendedPaddingLeft_${e?.id}`:`extendedPaddingLeft`,o=e?.id?`extendedPaddingRight_${e?.id}`:`extendedPaddingRight`,s=e?.id?`extendedPaddingBottom_${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:e=>{(0,$.presetCustomValue)(e,r,i,L),(0,$.presetCustomValue)(e,r,a,L),(0,$.presetCustomValue)(e,r,o,L),(0,$.presetCustomValue)(e,r,s,L)},on:[{id:n,type:`multiInput`,layout:$.MultiInputLayout.Spider,blocks:[{id:i,type:`input`,label:`Top`,placeholder:j,onChange:e=>(0,$.appendUnit)(e,i),rules:[$.numericalOrPixelRule,(0,$.maximumNumericalOrPixelOrAutoRule)(500)]},{id:a,type:`input`,label:`Left`,placeholder:j,onChange:e=>(0,$.appendUnit)(e,a),rules:[$.numericalOrPixelRule,(0,$.maximumNumericalOrPixelOrAutoRule)(500)]},{id:o,type:`input`,label:`Right`,placeholder:j,onChange:e=>(0,$.appendUnit)(e,o),rules:[$.numericalOrPixelRule,(0,$.maximumNumericalOrPixelOrAutoRule)(500)]},{id:s,type:`input`,label:`Bottom`,placeholder:j,onChange:e=>(0,$.appendUnit)(e,s),rules:[$.numericalOrPixelRule,(0,$.maximumNumericalOrPixelOrAutoRule)(500)]}]}],off:[Wr(r)]}},qr=e=>{let t=Jr(e?.globalControlId);return{id:e?.id?e.id:`downloadable`,type:`switch`,defaultValue:!1,label:`Downloadable`,show:e=>e.getBlock(t)?.value===B.Custom}},Jr=e=>e||`security`,Yr=e=>[{id:Jr(e),type:`segmentedControls`,defaultValue:B.Global,choices:[{value:B.Global,label:`Global Settings`},{value:B.Custom,label:`Custom`}]},{id:`globalSettingsInfo`,type:`notification`,footer:(0,$.createFooter)({label:`Change global settings [here].`,replace:{here:{event:`general-settings.open`}}})}],$=i({AllTextStylePlugins:()=>Dr,AllTextStyles:()=>Or,AttachmentOperationsProvider:()=>_e,Attachments:()=>we,AttachmentsProvider:()=>ge,AttachmentsToolbarButton:()=>Oe,BUTTON_PLUGIN:()=>Vt,BlockButtonStyles:()=>gt,BlockInjectButton:()=>b,BlockItemWrapper:()=>ze,BlockStyles:()=>X,BorderStyle:()=>N,BreakAfterPlugin:()=>wn,ButtonPlugin:()=>Ut,Custom1Plugin:()=>En,Custom2Plugin:()=>jn,Custom3Plugin:()=>In,DEFAULT_ATTACHMENTS_BUTTON_ID:()=>De,DEFAULT_DRAGGING_TOOLTIP:()=>Ae,DEFAULT_DRAG_TOOLTIP:()=>ke,DEFAULT_MENU_BUTTON_ID:()=>Pe,DragHandleToolbarButton:()=>Me,DragPreviewContextProvider:()=>ce,ELEMENT_BUTTON:()=>Z,FlyoutToolbarButton:()=>Ne,GAP_DEFAULT:()=>Cn,GutterSpacing:()=>V,Heading1Plugin:()=>Vn,Heading2Plugin:()=>Kn,Heading3Plugin:()=>Zn,Heading4Plugin:()=>nr,ImageCaptionPlugin:()=>sr,ImageTitlePlugin:()=>fr,KEY_ELEMENT_BREAK_AFTER_COLUMN:()=>Sn,LinkInput:()=>jt,LinkPlugin:()=>xn,LinkSelector:()=>At,Margin:()=>R,MenuToolbarButton:()=>Fe,MultiFlyoutContextProvider:()=>ue,OrderedListPlugin:()=>Mr,PARAGRAPH_CLASSES:()=>_r,Padding:()=>I,ParagraphMarkupElement:()=>yr,ParagraphMarkupElementNode:()=>vr,ParagraphPlugin:()=>gr,QuoteMarkupElementNode:()=>wr,QuotePlugin:()=>Sr,Radius:()=>P,RichTextEditor:()=>an,Sections:()=>Xr,Security:()=>B,THEME_PREFIX:()=>Pr,TextStylePluginsWithoutImage:()=>Er,TextStyles:()=>Y,TextStylesWithoutImage:()=>Q,Toolbar:()=>Re,UnorderedListPlugin:()=>Ar,addHttps:()=>Qe,borderStyleMap:()=>re,convertToRteValue:()=>We,createButtonNode:()=>dt,createButtonPlugin:()=>Ht,createLinkPlugin:()=>bn,createParagraphPlugin:()=>br,createQuotePlugin:()=>Tr,defineBlock:()=>Zr,defineSettings:()=>Qr,getBackgroundColorStyles:()=>A,getBackgroundSettings:()=>Fr,getBorderRadiusSettings:()=>Rr,getBorderRadiusSlider:()=>Lr,getBorderSettings:()=>Ir,getBorderStyles:()=>ae,getDefaultPluginsWithLinkChooser:()=>Nr,getExtendedBorderRadiusSettings:()=>zr,getGutterSettings:()=>Br,getLegacyUrl:()=>qe,getLinkFromEditor:()=>Xe,getMarginExtendedSettings:()=>Ur,getMarginSettings:()=>Hr,getMarginSlider:()=>Vr,getPaddingExtendedSettings:()=>Kr,getPaddingSettings:()=>Gr,getPaddingSlider:()=>Wr,getRadiusStyles:()=>oe,getReadableColor:()=>k,getSecurityDownloadableSetting:()=>qr,getSecurityGlobalControlId:()=>Jr,getSecurityGlobalControlSetting:()=>Yr,getUrl:()=>Je,getUrlFromEditor:()=>ut,getUrlFromLinkOrLegacyLink:()=>Ye,gutterSpacingStyleMap:()=>ie,hasRichTextValue:()=>Ue,insertButton:()=>tt,isDark:()=>C,isDownloadable:()=>Ge,isValidUrl:()=>$e,isValidUrlOrEmpty:()=>K,joinClassNames:()=>y,marginStyleMap:()=>z,paddingStyleMap:()=>L,radiusStyleMap:()=>F,relativeUrlRegex:()=>Ze,setAlpha:()=>D,submitFloatingButton:()=>nt,toColorObject:()=>O,toHex8String:()=>w,toHexString:()=>T,toRgbaString:()=>E,toShortRgba:()=>x,triggerFloatingButton:()=>ft,triggerFloatingButtonEdit:()=>pt,triggerFloatingButtonInsert:()=>mt,unwrapButton:()=>q,upsertButton:()=>rt,upsertButtonText:()=>st,useAttachmentOperations:()=>pe,useAttachments:()=>me,useAttachmentsContext:()=>ve,useDragPreviewContext:()=>H,useMultiFlyoutContext:()=>de,useMultiFlyoutState:()=>fe,withAttachmentsProvider:()=>ye,withButton:()=>et,wrapButton:()=>ct});o($,require("@frontify/sidebar-settings"));var Xr=function(e){return e.Main=`main`,e.Basics=`basics`,e.Layout=`layout`,e.Style=`style`,e.Security=`security`,e.Targets=`targets`,e}({}),Zr=e=>e,Qr=e=>e;exports.AllTextStylePlugins=Dr,exports.AllTextStyles=Or,exports.AttachmentOperationsProvider=_e,exports.Attachments=we,exports.AttachmentsProvider=ge,exports.AttachmentsToolbarButton=Oe,exports.BUTTON_PLUGIN=Vt,exports.BlockButtonStyles=gt,exports.BlockInjectButton=b,exports.BlockItemWrapper=ze,exports.BlockStyles=X,exports.BorderStyle=N,exports.BreakAfterPlugin=wn,exports.ButtonPlugin=Ut,exports.Custom1Plugin=En,exports.Custom2Plugin=jn,exports.Custom3Plugin=In,exports.DEFAULT_ATTACHMENTS_BUTTON_ID=De,exports.DEFAULT_DRAGGING_TOOLTIP=Ae,exports.DEFAULT_DRAG_TOOLTIP=ke,exports.DEFAULT_MENU_BUTTON_ID=Pe,exports.DragHandleToolbarButton=Me,exports.DragPreviewContextProvider=ce,exports.ELEMENT_BUTTON=Z,exports.FlyoutToolbarButton=Ne,exports.GAP_DEFAULT=Cn,exports.GutterSpacing=V,exports.Heading1Plugin=Vn,exports.Heading2Plugin=Kn,exports.Heading3Plugin=Zn,exports.Heading4Plugin=nr,exports.ImageCaptionPlugin=sr,exports.ImageTitlePlugin=fr,exports.KEY_ELEMENT_BREAK_AFTER_COLUMN=Sn,exports.LinkInput=jt,exports.LinkPlugin=xn,exports.LinkSelector=At,exports.Margin=R,exports.MenuToolbarButton=Fe,exports.MultiFlyoutContextProvider=ue,exports.OrderedListPlugin=Mr,exports.PARAGRAPH_CLASSES=_r,exports.Padding=I,exports.ParagraphMarkupElement=yr,exports.ParagraphMarkupElementNode=vr,exports.ParagraphPlugin=gr,exports.QuoteMarkupElementNode=wr,exports.QuotePlugin=Sr,exports.Radius=P,exports.RichTextEditor=an,exports.Sections=Xr,exports.Security=B,exports.THEME_PREFIX=Pr,exports.TextStylePluginsWithoutImage=Er,exports.TextStyles=Y,exports.TextStylesWithoutImage=Q,exports.Toolbar=Re,exports.UnorderedListPlugin=Ar,exports.addHttps=Qe,exports.borderStyleMap=re,exports.convertToRteValue=We,exports.createButtonNode=dt,exports.createButtonPlugin=Ht,exports.createLinkPlugin=bn,exports.createParagraphPlugin=br,exports.createQuotePlugin=Tr,exports.defineBlock=Zr,exports.defineSettings=Qr,exports.getBackgroundColorStyles=A,exports.getBackgroundSettings=Fr,exports.getBorderRadiusSettings=Rr,exports.getBorderRadiusSlider=Lr,exports.getBorderSettings=Ir,exports.getBorderStyles=ae,exports.getDefaultPluginsWithLinkChooser=Nr,exports.getExtendedBorderRadiusSettings=zr,exports.getGutterSettings=Br,exports.getLegacyUrl=qe,exports.getLinkFromEditor=Xe,exports.getMarginExtendedSettings=Ur,exports.getMarginSettings=Hr,exports.getMarginSlider=Vr,exports.getPaddingExtendedSettings=Kr,exports.getPaddingSettings=Gr,exports.getPaddingSlider=Wr,exports.getRadiusStyles=oe,exports.getReadableColor=k,exports.getSecurityDownloadableSetting=qr,exports.getSecurityGlobalControlId=Jr,exports.getSecurityGlobalControlSetting=Yr,exports.getUrl=Je,exports.getUrlFromEditor=ut,exports.getUrlFromLinkOrLegacyLink=Ye,exports.gutterSpacingStyleMap=ie,exports.hasRichTextValue=Ue,exports.insertButton=tt,exports.isDark=C,exports.isDownloadable=Ge,exports.isValidUrl=$e,exports.isValidUrlOrEmpty=K,exports.joinClassNames=y,exports.marginStyleMap=z,exports.paddingStyleMap=L,exports.radiusStyleMap=F,exports.relativeUrlRegex=Ze,exports.setAlpha=D,exports.submitFloatingButton=nt,exports.toColorObject=O,exports.toHex8String=w,exports.toHexString=T,exports.toRgbaString=E,exports.toShortRgba=x,exports.triggerFloatingButton=ft,exports.triggerFloatingButtonEdit=pt,exports.triggerFloatingButtonInsert=mt,exports.unwrapButton=q,exports.upsertButton=rt,exports.upsertButtonText=st,exports.useAttachmentOperations=pe,exports.useAttachments=me,exports.useAttachmentsContext=ve,exports.useDragPreviewContext=H,exports.useMultiFlyoutContext=de,exports.useMultiFlyoutState=fe,exports.withAttachmentsProvider=ye,exports.withButton=et,exports.wrapButton=ct;var $r=require("@frontify/sidebar-settings");Object.keys($r).forEach(function(e){e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return $r[e]}})});
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.defineProperty,t=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,r=Object.prototype.hasOwnProperty,i=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r},a=(i,a,o,s)=>{if(a&&typeof a==`object`||typeof a==`function`)for(var c=n(a),l=0,u=c.length,d;l<u;l++)d=c[l],!r.call(i,d)&&d!==o&&e(i,d,{get:(e=>a[e]).bind(null,d),enumerable:!(s=t(a,d))||s.enumerable});return i},o=(e,t,n)=>(a(e,t,`default`),n&&a(n,t,`default`));let s=require("@frontify/app-bridge"),c=require("@frontify/fondue/components"),l=require("@frontify/fondue/icons"),u=require("react"),d=require("react/jsx-runtime"),f=require("@ctrl/tinycolor"),p=require("@dnd-kit/core"),m=require("@dnd-kit/modifiers"),h=require("@dnd-kit/sortable"),g=require("@frontify/fondue"),_=require("@frontify/fondue/rte"),v=require("react-dom");var y=e=>e.filter(Boolean).join(` `),b=({onDrop:e,label:t,icon:n,secondaryLabel:r,isLoading:i,fillParentContainer:a,onAssetChooseClick:o,onUploadClick:f,withMenu:p=!0,onClick:m,validFileType:h,verticalLayout:g})=>{let[_,v]=(0,u.useState)(!1),[b,x]=(0,u.useState)(),S=(0,u.useRef)(null),[C,w]=(0,u.useState)(void 0),T=t=>{if(t.preventDefault(),v(!1),!E(t.dataTransfer.files)){w(`Invalid`),setTimeout(()=>{w(void 0)},1e3);return}e?.(t.dataTransfer.files)},E=e=>{if(!h)return!0;for(let t=0;t<e.length;t++){let n=e[t].name.split(`.`).pop()??``;if(!s.FileExtensionSets[h].includes(n))return!1}return!0},D=e=>{if(!S.current||i)return;let{clientX:t,clientY:n}=e,r=t===0&&n===0,{left:a,top:o,width:s,height:c}=S.current.getBoundingClientRect(),l=r?s/2:t-a,u=r?c/2:n-o;x([l,u])},O=(0,u.useCallback)(e=>{e(),x(void 0)},[]),ee=(0,u.useMemo)(()=>{let e=[];return f&&e.push({onSelect:()=>O(f),title:`Upload asset`,icon:(0,d.jsx)(l.IconArrowCircleUp,{size:`20`})}),o&&e.push({onSelect:()=>O(o),title:`Browse asset`,icon:(0,d.jsx)(l.IconImageStack,{size:`20`})}),e},[o,f,O]);return(0,d.jsxs)(`button`,{type:`button`,ref:S,"data-test-id":`block-inject-button`,className:y([`tw-body-medium tw-relative tw-border tw-flex tw-items-center tw-justify-center tw-cursor-pointer tw-gap-3 tw-w-full first:tw-rounded-tl last:tw-rounded-br`,g?`[&:not(:first-child)]:tw-border-t-0 first:tw-rounded-tr last:tw-rounded-bl`:`[&:not(:first-child)]:tw-border-l-0 first:tw-rounded-bl last:tw-rounded-tr`,a?`tw-h-full`:`tw-h-[72px]`,_&&!i?`tw-border-dashed`:`tw-border-solid`,b&&`tw-bg-surface-hover`,_&&`tw-bg-surface`,C?`!tw-border-red-50 !tw-cursor-not-allowed`:` tw-border-line-mid`,i||b||_||C?``:`tw-text-secondary hover:tw-text-primary hover:tw-bg-surface hover:tw-border-line-strong active:tw-text-primary active:tw-bg-surface-hover active:tw-border-line-strong`,(_||b)&&!C?`[&>*]:tw-pointer-events-none tw-border-line-strong`:`tw-bg-surface-dim tw-text-secondary`]),onDragEnter:e?e=>{if(v(!0),h===`Images`)for(let t of Array.from(e.dataTransfer.items))t?.type?.startsWith(`image/`)?w(void 0):w(`Invalid`)}:void 0,onDragOver:e?e=>{e.preventDefault()}:void 0,onDragLeave:e?()=>{v(!1),w(void 0)}:void 0,onDrop:e?T:void 0,onClick:e=>{p&&!b&&D(e),m?.()},children:[i?(0,d.jsx)(c.LoadingCircle,{}):C?(0,d.jsxs)(`div`,{className:` tw-flex tw-items-center tw-justify-center tw-text-red-60 tw-font-medium`,children:[(0,d.jsx)(l.IconExclamationMarkTriangle,{size:`16`}),C]}):(0,d.jsxs)(d.Fragment,{children:[n&&(0,d.jsx)(`div`,{children:n}),(t||r)&&(0,d.jsxs)(`div`,{className:`tw-flex tw-flex-col tw-items-start`,children:[t&&(0,d.jsx)(`div`,{className:`tw-font-medium`,children:t}),r&&(0,d.jsx)(`div`,{className:`tw-font-normal`,children:r})]})]}),b&&(0,d.jsx)(`div`,{className:`tw-absolute tw-left-0 tw-top-full tw-z-20`,style:{left:b[0],top:b[1]},children:(0,d.jsxs)(c.Flyout.Root,{open:!0,onOpenChange:e=>!e&&x(void 0),children:[(0,d.jsx)(c.Flyout.Trigger,{children:(0,d.jsx)(`div`,{})}),(0,d.jsx)(c.Flyout.Content,{triggerOffset:`compact`,children:(0,d.jsxs)(c.Dropdown.Root,{open:!0,children:[(0,d.jsx)(c.Dropdown.Trigger,{children:(0,d.jsx)(`div`,{})}),(0,d.jsx)(c.Dropdown.Content,{triggerOffset:`compact`,children:ee.map(e=>(0,d.jsxs)(c.Dropdown.Item,{onSelect:e.onSelect,children:[e.icon,e.title]},e.title))})]})})]})})]})},x=e=>(e=>typeof e==`object`&&[`red`,`green`,`blue`].every(t=>e.hasOwnProperty(t)))(e)?(e=>{let t=typeof e.alpha==`number`?e.alpha:1;return{r:e.red,g:e.green,b:e.blue,a:t}})(e):e,S=e=>typeof e==`object`&&[`red`,`green`,`blue`].every(t=>e?.hasOwnProperty(t)),C=(e,t)=>{let n=S(e)?x(e):e,r=new f.TinyColor(n);return t?r.getBrightness()<t:r.isDark()||r.getAlpha()>.25&&r.getAlpha()<1},w=e=>new f.TinyColor(x(e)).toHex8String(),T=e=>new f.TinyColor(x(e)).toHexString(),E=e=>new f.TinyColor(x(e)).toRgbString(),D=(e,t)=>new f.TinyColor(t).setAlpha(e).toRgbString(),O=e=>{let{r:t,g:n,b:r,a:i}=new f.TinyColor(e);return{red:t,green:n,blue:r,alpha:i}},ee=e=>typeof e==`object`&&[`red`,`green`,`blue`].every(t=>e?.hasOwnProperty(t)),k=(e,t)=>{let n=ee(e)?x(e):e,r=ee(t)?x(t):t,i=new f.TinyColor(n),a=new f.TinyColor(r);for(;(0,f.readability)(i,a)<4.5;)i=i.darken(1);return i.toRgbString()},A=e=>({backgroundColor:E(e)}),te={red:241,green:241,blue:241,alpha:1},ne={red:234,green:235,blue:235,alpha:1},j=`24px`,M=`24px`,N=function(e){return e.Solid=`Solid`,e.Dashed=`Dashed`,e.Dotted=`Dotted`,e}({}),re={Solid:`solid`,Dotted:`dotted`,Dashed:`dashed`},P=function(e){return e.None=`None`,e.Small=`Small`,e.Medium=`Medium`,e.Large=`Large`,e}({}),F={None:`0px`,Small:`2px`,Medium:`4px`,Large:`12px`},I=function(e){return e.None=`None`,e.Small=`Small`,e.Medium=`Medium`,e.Large=`Large`,e}({}),L={None:`0px`,Small:`24px`,Medium:`36px`,Large:`60px`},R=function(e){return e.None=`None`,e.Small=`Small`,e.Medium=`Medium`,e.Large=`Large`,e}({}),z={None:`0px`,Small:`24px`,Medium:`36px`,Large:`60px`},B=function(e){return e.Global=`Global`,e.Custom=`Custom`,e}({}),V=function(e){return e.Auto=`Auto`,e.S=`S`,e.M=`M`,e.L=`L`,e}({}),ie={Auto:`4px`,S:`10px`,M:`30px`,L:`50px`},ae=(e=N.Solid,t=`1px`,n=ne)=>({borderStyle:re[e],borderWidth:t,borderColor:E(n)}),oe=(e,t=!1,n)=>({borderRadius:t?n:F[e]}),se=(0,u.createContext)(!1);se.displayName=`DragPreviewContext`;var ce=({children:e,isDragPreview:t})=>(0,d.jsx)(se.Provider,{value:t,children:e}),H=()=>(0,u.useContext)(se),le=(0,u.createContext)({openFlyoutIds:[],setOpenFlyoutIds:()=>console.error(`No MultiFlyoutContext Provider found`)});le.displayName=`MultiFlyoutContext`;var ue=({children:e,openFlyoutIds:t,setOpenFlyoutIds:n})=>{let r=(0,u.useMemo)(()=>({openFlyoutIds:t,setOpenFlyoutIds:n}),[t,n]);return(0,d.jsx)(le.Provider,{value:r,children:e})},de=()=>(0,u.useContext)(le),fe=e=>{let{openFlyoutIds:t,setOpenFlyoutIds:n}=de(),r=(0,u.useCallback)(t=>{n(n=>{let r=n.filter(t=>t!==e);return t?[...r,e]:r})},[e,n]);return{isOpen:t.includes(e),onOpenChange:r}},pe=(e,t)=>{let{blockAssets:n,addAssetIdsToKey:r,deleteAssetIdsFromKey:i,updateAssetIdsFromKey:a}=t,o=n?.[e]||[];return{onAttachmentsAdd:async t=>{await r(e,t.map(e=>e.id))},onAttachmentDelete:async t=>{await i(e,[t.id])},onAttachmentReplace:async(t,n)=>{let r=o.map(e=>e.id===t.id?n.id:e.id);await a(e,r)},onAttachmentsSorted:async t=>{let n=t.map(e=>e.id);await a(e,n)},attachments:o}},me=(e,t)=>{let{onAttachmentsAdd:n,onAttachmentDelete:r,onAttachmentReplace:i,onAttachmentsSorted:a,attachments:o}=pe(t,(0,s.useBlockAssets)(e));return{onAttachmentsAdd:n,onAttachmentDelete:r,onAttachmentReplace:i,onAttachmentsSorted:a,attachments:o,appBridge:e}},he=(0,u.createContext)(null);he.displayName=`AttachmentsContext`;var ge=({appBridge:e,children:t,assetId:n})=>{let r=me(e,n);return(0,d.jsx)(he.Provider,{value:r,children:t})},_e=({blockAssetBundle:e,appBridge:t,children:n,assetId:r})=>{let i=pe(r,e);return(0,d.jsx)(he.Provider,{value:{...i,appBridge:t},children:n})},ve=()=>{let e=(0,u.useContext)(he);if(!e)throw Error(`No AttachmentsContext Provided. Component must be wrapped in an 'AttachmentsProvider' or the 'withAttachmentsProvider' HOC`);return e},ye=(e,t)=>{let n=n=>(0,d.jsx)(ge,{appBridge:n.appBridge,assetId:t,children:(0,d.jsx)(e,{...n})});return n.displayName=`withAttachmentsProvider`,n},be=e=>e===`IMAGE`?(0,d.jsx)(l.IconImage,{size:`24`}):e===`VIDEO`?(0,d.jsx)(l.IconPlayFrame,{size:`24`}):e===`AUDIO`?(0,d.jsx)(l.IconMusicNote,{size:`24`}):(0,d.jsx)(l.IconDocument,{size:`24`}),xe=(0,u.forwardRef)(({item:e,isEditing:t,draggableProps:n,transformStyle:r,isDragging:i,isOverlay:a,isLoading:o,onDelete:f,onReplaceWithBrowse:p,onReplaceWithUpload:m,onDownload:h},g)=>{let[_,v]=(0,u.useState)(),[b,{selectedFiles:x}]=(0,s.useFileInput)({multiple:!0,accept:`image/*`}),[S,{results:C,doneAll:w}]=(0,s.useAssetUpload)();(0,u.useEffect)(()=>{x&&S(x[0])},[x]),(0,u.useEffect)(()=>{w&&m(C[0])},[w,C]);let T=o||x&&!w;return(0,d.jsxs)(`button`,{type:`button`,"aria-label":`Download attachment`,"data-test-id":`attachments-item`,onClick:()=>!_&&h?.(),ref:g,style:{...r,opacity:i&&!a?.3:1,fontFamily:`var(-f-theme-settings-body-font-family)`},className:y([`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-surface-hover focus-visible:tw-outline focus-visible:!-tw-outline-offset-4`,i?`tw-bg-surface-hover`:``]),children:[(0,d.jsx)(`div`,{className:`tw-text-secondary group-hover:tw-text-container-secondary-on-secondary-container`,children:T?(0,d.jsx)(c.LoadingCircle,{size:`small`}):be(e.objectType)}),(0,d.jsxs)(`div`,{className:`tw-text-small tw-flex-1 tw-min-w-0`,children:[(0,d.jsx)(`div`,{className:`tw-whitespace-nowrap tw-overflow-hidden tw-text-ellipsis tw-font-bold tw-text-secondary group-hover:tw-text-container-secondary-on-secondary-container`,children:e.title}),(0,d.jsx)(`div`,{className:`tw-text-secondary`,children:`${e.fileSizeHumanReadable} - ${e.extension}`})]}),t&&(0,d.jsxs)(`div`,{"data-test-id":`attachments-actionbar`,className:y([`tw-flex tw-gap-0.5 group-hover:tw-opacity-100 group-focus-visible:tw-opacity-100 has-[:focus-visible]:tw-opacity-100`,a||_?.id===e.id?`tw-opacity-100`:`tw-opacity-0`]),children:[(0,d.jsx)(c.Button,{aspect:`square`,emphasis:`weak`,"aria-label":`Drag attachment`,className:y([i||a?`tw-cursor-grabbing`:`tw-cursor-grab`,`focus-visible:tw-z-[2]`]),...n,children:(0,d.jsx)(l.IconGrabHandle,{})}),(0,d.jsx)(`div`,{"data-test-id":`attachments-actionbar-flyout`,children:(0,d.jsxs)(c.Dropdown.Root,{open:_?.id===e.id,onOpenChange:t=>v(t?e:void 0),children:[(0,d.jsx)(c.Dropdown.Trigger,{children:(0,d.jsx)(c.Button,{aspect:`square`,emphasis:_?.id===e.id?`default`:`weak`,onPress:e=>{e?.stopPropagation(),e?.preventDefault()},children:(0,d.jsx)(l.IconPen,{size:`20`})})}),(0,d.jsxs)(c.Dropdown.Content,{side:`right`,children:[(0,d.jsxs)(c.Dropdown.Group,{children:[(0,d.jsxs)(c.Dropdown.Item,{"data-test-id":`menu-item`,onSelect:e=>{e?.stopPropagation(),b(),v(void 0)},children:[(0,d.jsx)(l.IconArrowCircleUp,{size:`20`}),`Replace with upload`]}),(0,d.jsxs)(c.Dropdown.Item,{onSelect:e=>{e?.stopPropagation(),p(),v(void 0)},children:[(0,d.jsx)(l.IconImageStack,{size:`20`}),`Replace with asset`]})]}),(0,d.jsx)(c.Dropdown.Group,{children:(0,d.jsxs)(c.Dropdown.Item,{emphasis:`danger`,onSelect:e=>{e?.stopPropagation(),f(),v(void 0)},children:[(0,d.jsx)(l.IconTrashBin,{size:`20`}),`Delete`]})})]})]})})]})]})});xe.displayName=`AttachmentItem`;var Se=e=>{let{attributes:t,listeners:n,setNodeRef:r,transform:i,transition:a,isDragging:o}=(0,h.useSortable)({id:e.item.id}),s={transform:i?`translate(${i.x}px, ${i.y}px)`:``,transition:a,zIndex:o?2:1},c={...t,...n};return(0,d.jsx)(xe,{ref:r,isDragging:o,transformStyle:s,draggableProps:c,...e})},Ce=(0,u.forwardRef)(({children:e,...t},n)=>(0,d.jsxs)(c.Button,{ref:n,size:`small`,rounding:`full`,emphasis:`default`,"data-test-id":`attachments-button-trigger`,className:`tw-body-medium`,...t,"aria-haspopup":`menu`,children:[(0,d.jsx)(l.IconPaperclip,{size:`16`}),e,(0,d.jsx)(l.IconCaretDown,{size:`12`})]}));Ce.displayName=`AttachmentsButtonTrigger`;var we=({items:e=[],onDelete:t,onReplaceWithBrowse:n,onReplaceWithUpload:r,onBrowse:i,onUpload:a,onSorted:o,appBridge:f,triggerComponent:g=Ce,isOpen:_,onOpenChange:v})=>{let[y,b]=(0,u.useState)(e),[x,S]=(0,u.useState)(!1),C=(0,p.useSensors)((0,p.useSensor)(p.PointerSensor),(0,p.useSensor)(p.KeyboardSensor)),[w,T]=(0,u.useState)(void 0),[E,D]=(0,u.useState)(!1),[O,ee]=(0,u.useState)(!1),[k,A]=(0,u.useState)([]),[te,ne]=(0,u.useState)(null),j=(0,s.useEditorState)(f),{openAssetChooser:M,closeAssetChooser:N}=(0,s.useAssetChooser)(f),re=_!==void 0,P=re?_:x,F=y?.find(e=>e.id===w),I=e.length,L=I>0?`Open attachments, ${I} ${I===1?`attachment`:`attachments`}`:`Add attachments`,[R,{results:z,doneAll:B}]=(0,s.useAssetUpload)({onUploadProgress:()=>!E&&D(!0)}),V=e=>{(re?v:S)?.(e)};(0,u.useEffect)(()=>{b(e)},[e]),(0,u.useEffect)(()=>{te&&(D(!0),R(te))},[te]),(0,u.useEffect)(()=>{(async()=>{B&&(await a(z),D(!1))})()},[B,z]);let ie=()=>{V(!1),M(async e=>{N(),V(!0),ee(!0),await i(e),ee(!1)},{multiSelection:!0,selectedValueIds:y.map(e=>e.id)})},ae=e=>{V(!1),M(async t=>{V(!0),N(),A([...k,e.id]),await n(e,t[0]),A(k.filter(t=>t!==e.id))},{multiSelection:!1,selectedValueIds:y.map(e=>e.id)})},oe=async(e,t)=>{A([...k,e.id]),await r(e,t),A(k.filter(t=>t!==e.id))};return j||(y?.length??0)>0?(0,d.jsx)(`div`,{"data-test-id":`attachments-flyout-button`,children:(0,d.jsx)(c.Flyout.Root,{open:P,onOpenChange:e=>V(F?!0:e),children:(0,d.jsxs)(c.Tooltip.Root,{enterDelay:500,children:[(0,d.jsx)(c.Tooltip.Trigger,{asChild:!0,children:(0,d.jsx)(c.Flyout.Trigger,{asChild:!0,"data-test-id":`attachments-button-trigger`,children:(0,d.jsx)(g,{isFlyoutOpen:P,"aria-label":L,children:(0,d.jsx)(`div`,{"aria-hidden":`true`,children:I>0?I:`Add`})})})}),(0,d.jsx)(c.Flyout.Content,{side:`bottom`,align:`end`,width:`300px`,onEscapeKeyDown:e=>{e.stopPropagation(),V(!1)},children:(0,d.jsxs)(`div`,{className:`tw-w-full`,"data-test-id":`attachments-flyout-content`,children:[y.length>0&&(0,d.jsx)(p.DndContext,{sensors:C,collisionDetection:p.closestCenter,onDragStart:e=>{let{active:t}=e;T(t.id)},onDragEnd:e=>{let{active:t,over:n}=e;if(n&&t.id!==n.id&&y){let e=y.findIndex(e=>e.id===t.id),r=y.findIndex(e=>e.id===n.id),i=(0,h.arrayMove)(y,e,r);b(i),o(i)}T(void 0)},modifiers:[m.restrictToParentElement],children:(0,d.jsx)(h.SortableContext,{items:y,strategy:h.rectSortingStrategy,children:(0,d.jsx)(`div`,{className:`tw-border-b tw-border-b-line tw-relative`,children:y.map(e=>(0,d.jsx)(Se,{isEditing:j,isLoading:k.includes(e.id),item:e,onDelete:()=>t(e),onReplaceWithBrowse:()=>ae(e),onReplaceWithUpload:t=>oe(e,t),onDownload:()=>f.dispatch({name:`downloadAsset`,payload:e})},e.id))})})}),j&&(0,d.jsxs)(`div`,{className:`tw-px-5 tw-py-3`,"data-test-id":`asset-input-placeholder`,children:[(0,d.jsx)(`div`,{className:`tw-font-primary tw-font-medium tw-text-primary tw-text-small tw-my-4`,children:`Add attachments`}),E||O?(0,d.jsxs)(c.AssetInput.Root,{orientation:`horizontal`,children:[(0,d.jsx)(c.AssetInput.Preview,{children:(0,d.jsx)(c.AssetInput.PreviewLoading,{})}),(0,d.jsx)(c.AssetInput.Title,{children:`Asset`}),(0,d.jsx)(c.AssetInput.Metadata,{children:(0,d.jsx)(c.AssetInput.MetadataItem,{children:(0,d.jsxs)(c.Flex,{align:`center`,gap:.5,children:[O?(0,d.jsx)(l.IconImageStack,{size:16}):(0,d.jsx)(l.IconArrowCircleUp,{size:16}),O?`Loading`:`Uploading`]})})})]}):(0,d.jsxs)(c.AssetInput.Placeholder,{children:[(0,d.jsx)(c.AssetInput.UploadInput,{allowMultiple:!0,onSelect:e=>ne(e.target.files)}),(0,d.jsx)(c.AssetInput.BrowseInput,{onBrowse:ie})]})]})]})}),(0,d.jsx)(c.Tooltip.Content,{side:`top`,children:`Attachments`})]})})}):null},Te=(e,t)=>{let n=[g.FOCUS_VISIBLE_STYLE,`tw-relative tw-inline-flex tw-items-center tw-justify-center`,`tw-h-6 tw-p-1`,`tw-rounded-medium`,`tw-body-medium`,`tw-gap-0.5`,`focus-visible:tw-z-10`];return t?n.push(`tw-bg-container-secondary-active`,`tw-text-container-secondary-on-secondary-container`,e===`grab`?`tw-cursor-grabbing`:`tw-cursor-pointer`):n.push(`hover:tw-bg-container-secondary-hover active:tw-bg-container-secondary-active`,`tw-text-secondary hover:tw-text-container-secondary-on-secondary-container active:tw-text-container-secondary-on-secondary-container`,e===`grab`?`!tw-cursor-grab active:tw-cursor-grabbing`:`tw-cursor-pointer`),y(n)},U=(0,u.forwardRef)(({onClick:e,children:t,forceActiveStyle:n,cursor:r=`pointer`,"data-test-id":i=`base-toolbar-button`,...a},o)=>(0,d.jsx)(`button`,{onClick:e,className:Te(r,n),"data-test-id":i,...a,ref:o,children:t}));U.displayName=`BaseToolbarButton`;var Ee=(0,u.forwardRef)(({children:e,isFlyoutOpen:t,...n},r)=>(0,d.jsxs)(U,{forceActiveStyle:t,"data-test-id":`attachments-toolbar-button-trigger`,ref:r,...n,"aria-haspopup":`menu`,children:[(0,d.jsx)(l.IconPaperclip,{size:`16`}),e,(0,d.jsx)(l.IconCaretDown,{size:`12`})]}));Ee.displayName=`AttachmentsToolbarButtonTrigger`;var De=`attachments`,Oe=({flyoutId:e=De})=>{let{appBridge:t,attachments:n,onAttachmentsAdd:r,onAttachmentDelete:i,onAttachmentReplace:a,onAttachmentsSorted:o}=ve(),{isOpen:s,onOpenChange:c}=fe(e),l=H();return(0,d.jsx)(we,{onUpload:r,onDelete:i,onReplaceWithBrowse:a,onReplaceWithUpload:a,onSorted:o,onBrowse:r,items:n,appBridge:t,triggerComponent:Ee,isOpen:s&&!l,onOpenChange:c})},ke=`Drag or press ↵ to move`,Ae=`Move with ↑↓←→ and confirm with ↵`,je=({content:e,children:t,open:n,disabled:r})=>r?t:(0,d.jsxs)(c.Tooltip.Root,{enterDelay:300,open:n,children:[(0,d.jsx)(c.Tooltip.Trigger,{asChild:!0,children:t}),(0,d.jsx)(c.Tooltip.Content,{side:`top`,children:(0,d.jsx)(`div`,{children:e})})]}),Me=({tooltip:e,icon:t,setActivatorNodeRef:n,draggableProps:r})=>{let i=H(),{activatorEvent:a}=(0,p.useDndContext)(),o=a instanceof KeyboardEvent;return(0,d.jsx)(je,{...i&&{open:o},content:(0,d.jsx)(`div`,{children:i?Ae:e??`Drag or press ↵ to move`}),children:(0,d.jsx)(U,{ref:n,"data-test-id":`block-item-wrapper-toolbar-btn`,forceActiveStyle:i,cursor:`grab`,...r,children:t})})},Ne=({content:e,icon:t,tooltip:n,flyoutId:r,flyoutFooter:i,flyoutHeader:a})=>{let{isOpen:o,onOpenChange:s}=fe(r),l=H();return(0,d.jsx)(je,{disabled:l||o,content:n,children:(0,d.jsx)(`div`,{className:`tw-flex tw-flex-shrink-0 tw-flex-1 tw-h-6 tw-relative`,children:(0,d.jsxs)(c.Flyout.Root,{open:o&&!l,onOpenChange:s,children:[(0,d.jsx)(c.Flyout.Trigger,{asChild:!0,children:(0,d.jsx)(U,{"data-test-id":`block-item-wrapper-toolbar-flyout`,forceActiveStyle:o&&!l,children:t})}),(0,d.jsxs)(c.Flyout.Content,{side:`bottom`,align:`end`,padding:`comfortable`,children:[a?(0,d.jsx)(c.Flyout.Header,{children:a}):null,(0,d.jsx)(c.Flyout.Body,{children:e}),i?(0,d.jsx)(c.Flyout.Footer,{children:i}):null]})]})})})},Pe=`menu`,Fe=({items:e,flyoutId:t=Pe,tooltip:n=`Options`})=>{let{isOpen:r,onOpenChange:i}=fe(t),a=H();return(0,d.jsx)(c.Dropdown.Root,{open:r&&!a,onOpenChange:i,children:(0,d.jsxs)(c.Tooltip.Root,{children:[(0,d.jsx)(c.Tooltip.Trigger,{asChild:!0,children:(0,d.jsx)(c.Dropdown.Trigger,{asChild:!0,children:(0,d.jsx)(U,{"data-test-id":`block-item-wrapper-toolbar-flyout`,children:(0,d.jsx)(l.IconDotsHorizontal,{size:`16`})})})}),(0,d.jsx)(c.Dropdown.Content,{children:e.map((e,t)=>(0,d.jsx)(c.Dropdown.Group,{children:e.map((e,n)=>(0,d.jsxs)(c.Dropdown.Item,{"data-test-id":`menu-item`,onSelect:()=>{i(!1),e.onClick()},emphasis:e.style||`default`,children:[(0,d.jsx)(`div`,{className:`tw-mr-2`,children:e.icon}),(0,d.jsx)(`span`,{children:e.title})]},`${t}-${n}`))},t))}),(0,d.jsx)(c.Tooltip.Content,{children:n})]})})},Ie=({tooltip:e,icon:t,onClick:n})=>{let r=H();return(0,d.jsx)(je,{disabled:r,content:e??``,children:(0,d.jsx)(U,{"data-test-id":`block-item-wrapper-toolbar-btn`,onClick:n,children:t})})},Le=({children:e})=>(0,d.jsx)(`div`,{"data-test-id":`block-item-wrapper-toolbar-segment`,className:`tw-pointer-events-auto tw-flex tw-flex-shrink-0 tw-gap-px tw-px-px tw-h-[26px] tw-items-center tw-self-start tw-leading-none`,children:e}),Re=({items:e,attachments:t})=>(0,d.jsxs)(`div`,{"data-test-id":`block-item-wrapper-toolbar`,className:`tw-rounded-md tw-bg-surface tw-border tw-border-line-mid tw-divide-x tw-divide-line-mid tw-shadow-lg tw-flex tw-flex-none tw-items-center tw-isolate`,children:[t.isEnabled&&(0,d.jsx)(Le,{children:(0,d.jsx)(Oe,{})}),e.length>0&&(0,d.jsx)(Le,{children:e.map(e=>{switch(e.type){case`dragHandle`:return(0,d.jsx)(Me,{...e},e.tooltip+e.type);case`menu`:return(0,d.jsx)(Fe,{...e},e.tooltip+e.type);case`flyout`:return(0,d.jsx)(Ne,{...e},e.tooltip+e.type);default:return(0,d.jsx)(Ie,{...e},e.tooltip+e.type)}})})]}),ze=(0,u.memo)(({children:e,toolbarItems:t,shouldHideWrapper:n,shouldHideComponent:r=!1,isDragging:i=!1,shouldFillContainer:a,outlineOffset:o=0,shouldBeShown:s=!1,showAttachments:c=!1})=>{let[l,f]=(0,u.useState)(s?[Pe]:[]),p=(0,u.useRef)(null);if(n)return(0,d.jsx)(d.Fragment,{children:e});let m=t?.filter(e=>e!==void 0),h=l.length>0||s;return(0,d.jsx)(ce,{isDragPreview:i,children:(0,d.jsx)(ue,{openFlyoutIds:l,setOpenFlyoutIds:f,children:(0,d.jsxs)(`div`,{ref:p,"data-test-id":`block-item-wrapper`,style:{outlineOffset:o},className:y([`tw-relative tw-group`,a&&`tw-flex-1 tw-h-full tw-w-full`,`hover:tw-outline hover:tw-outline-1 hover:tw-outline-container-highlight-on-highlight-container focus-within:tw-outline focus-within:tw-outline-1 focus-within:tw-outline-container-highlight-on-highlight-container`,h&&`tw-outline tw-outline-1 tw-outline-container-highlight-on-highlight-container`,r&&`tw-opacity-0`]),children:[(0,d.jsx)(`div`,{style:{right:-1-o,bottom:`calc(100% - ${2+o}px)`},className:y([`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`,h&&`tw-opacity-100`]),children:(0,d.jsx)(Re,{attachments:{isEnabled:c},items:m})}),e]})})})});ze.displayName=`BlockItemWrapper`;var Be=({ref:e,disabled:t,onChange:n})=>{(0,u.useEffect)(()=>{if(t||!e.current)return;let r=!1,i=new IntersectionObserver(([e])=>{e.isIntersecting!==r&&(r=e.isIntersecting,n(e.isIntersecting))});return i.observe(e.current),()=>{i.disconnect()}},[e,t,n])},Ve=(0,_.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})),W=Ve.set,G=Ve.get,He=()=>Ve.use,Ue=e=>{if(!e)return!1;let t=e=>e.some(e=>e.text?e.text!==``:e.children?t(e.children):!1);try{return t(JSON.parse(e))}catch{return!1}},We=(e=`p`,t=``,n)=>Ue(t)?t:JSON.stringify([{type:e,children:[{text:t,textStyle:e}],align:n}]),Ge=(e,t,n)=>e===B.Custom?t:n,Ke=(e,t)=>{let n=(0,_.getAboveNode)(e,{match:{type:_.ELEMENT_LINK}});return Array.isArray(n)?t(n[0]):``},qe=e=>Ke(e,e=>e.chosenLink?.searchResult?.link||``),Je=e=>Ke(e,e=>e.url||``),Ye=e=>e.url||e.chosenLink?.searchResult?.link||``,Xe=e=>Ke(e,Ye),Ze=/^\/(document|r)\/\S+$/i,Qe=e=>{if(Ze.test(e))return e;try{return new URL(e),e}catch{return`https://${e}`}},$e=e=>{if(Ze.test(e))return!0;try{let t=new URL(e);return[`http:`,`https:`,`mailto:`,`tel:`].includes(t.protocol)&&t.pathname!==``}catch{return!1}},K=e=>$e(Qe(e))||e===``,et=(e,{type:t})=>{let{apply:n,normalizeNode:r}=e;return e.apply=t=>{if(t.type!==`set_selection`){n(t);return}let r=t.newProperties;if(!r?.focus||!r.anchor||!(0,_.isCollapsed)(r)){n(t);return}let i=(0,_.getAboveNode)(e,{at:r,match:{type:(0,_.getPluginType)(e,Z)}});if(i){let[,n]=i,a;(0,_.isStartPoint)(e,r.focus,n)&&(a=(0,_.getPreviousNodeEndPoint)(e,n)),(0,_.isEndPoint)(e,r.focus,n)&&(a=(0,_.getNextNodeStartPoint)(e,n)),a&&(t.newProperties={anchor:a,focus:a})}n(t)},e.normalizeNode=([t,n])=>{if(t.type===(0,_.getPluginType)(e,`button`)){let t=e.selection;if(t&&(0,_.isCollapsed)(t)&&(0,_.isEndPoint)(e,t.focus,n)){let t=(0,_.getNextNodeStartPoint)(e,n);if(t)(0,_.select)(e,t);else{let t=_.Path.next(n);(0,_.insertNodes)(e,{text:``},{at:t}),(0,_.select)(e,t)}}}r([t,n])},(0,_.withRemoveEmptyNodes)(e,(0,_.mockPlugin)({options:{types:t}}))},tt=(e,t,n)=>{(0,_.insertNodes)(e,[dt(e,t)],n)},nt=e=>{if(!e.selection)return;let{isUrl:t,forceSubmit:n}=(0,_.getPluginOptions)(e,Z),r=G.url();if(!(t?.(r)||n))return;let i=G.text(),a=G.buttonStyle(),o=G.newTab()?void 0:`_self`;return W.reset(),rt(e,{url:r,text:i,buttonStyle:a,target:o,isUrl:e=>n||!t?!0:t(e)}),setTimeout(()=>{(0,_.focusEditor)(e,e.selection??void 0)},0),!0},q=(e,t)=>(0,_.withoutNormalizing)(e,()=>{if(t?.split){if((0,_.getAboveNode)(e,{at:e.selection?.anchor,match:{type:(0,_.getPluginType)(e,`button`)}}))return(0,_.splitNodes)(e,{at:e.selection?.anchor,match:t=>(0,_.isElement)(t)&&t.type===(0,_.getPluginType)(e,`button`)}),q(e,{at:e.selection?.anchor}),!0;if((0,_.getAboveNode)(e,{at:e.selection?.focus,match:{type:(0,_.getPluginType)(e,`button`)}}))return(0,_.splitNodes)(e,{at:e.selection?.focus,match:t=>(0,_.isElement)(t)&&t.type===(0,_.getPluginType)(e,`button`)}),q(e,{at:e.selection?.focus}),!0}(0,_.unwrapNodes)(e,{match:{type:(0,_.getPluginType)(e,Z)},...t})}),rt=(e,{url:t,text:n,buttonStyle:r,target:i,insertTextInButton:a,insertNodesOptions:o,isUrl:s=(0,_.getPluginOptions)(e,Z).isUrl})=>{let c=e.selection;if(!c)return;let l=(0,_.getAboveNode)(e,{at:c,match:{type:(0,_.getPluginType)(e,Z)}});if(a&&l)return e.insertText(t),!0;if(!s?.(t))return;if((0,_.isDefined)(n)&&n.length===0&&(n=t),l)return ot(t,e,l,i,r,n),!0;let[u,d]=(0,_.findNode)(e,{at:c,match:{type:(0,_.getPluginType)(e,`button`)}})??[],f=it(e,d,n);if((0,_.isExpanded)(c))return at(l,e,t,r,i,n),!0;f&&(0,_.removeNodes)(e,{at:d});let p=(0,_.getNodeProps)(u??{}),m=e.selection?.focus.path;if(!m)return;let h=(0,_.getNodeLeaf)(e,m);return n?.length||(n=t),tt(e,{...p,url:t,target:i,children:[{...h,text:n}]},o),!0};function it(e,t,n){return t&&n?.length&&n!==(0,_.getEditorString)(e,t)}function at(e,t,n,r,i,a){e?q(t,{at:e[1]}):q(t,{split:!0}),ct(t,{url:n,buttonStyle:r,target:i}),st(t,{url:n,target:i,text:a})}function ot(e,t,n,r,i,a){(e!==n[0]?.url||r!==n[0]?.target||i!==n[0]?.buttonStyle)&&(0,_.setNodes)(t,{url:e,target:r,buttonStyle:i},{at:n[1]}),st(t,{url:e,text:a,target:r})}var st=(e,{text:t})=>{let n=(0,_.getAboveNode)(e,{match:{type:(0,_.getPluginType)(e,Z)}});if(n){let[r,i]=n;if(t?.length&&t!==(0,_.getEditorString)(e,i)){let n=r.children[0];(0,_.replaceNodeChildren)(e,{at:i,nodes:{...n,text:t},insertOptions:{select:!0}})}}},ct=(e,{url:t,buttonStyle:n,target:r,...i})=>{(0,_.wrapNodes)(e,{type:(0,_.getPluginType)(e,Z),url:t,buttonStyle:n,target:r,children:[]},{split:!0,...i})},lt=(e,t)=>{let n=(0,_.getAboveNode)(e,{match:{type:Z}});return Array.isArray(n)?t(n[0]):``},ut=e=>lt(e,e=>e.url??``),dt=(e,{url:t,text:n=``,buttonStyle:r=`primary`,target:i,children:a})=>({type:(0,_.getPluginType)(e,Z),url:t,target:i,buttonStyle:r,children:a??[{text:n}]}),ft=(e,{focused:t}={})=>{if(G.mode()===`edit`){pt(e);return}mt(e,{focused:t})},pt=e=>{let t=(0,_.findNode)(e,{match:{type:(0,_.getPluginType)(e,Z)}});if(!t)return;let[n,r]=t,i=(0,_.getEditorString)(e,r);W.url(n.url),W.newTab(n.target===void 0),i===n.url&&(i=``),W.text(i),W.isEditing(!0)},mt=(e,{focused:t}={})=>{G.mode()||t&&((0,_.isRangeAcrossBlocks)(e,{at:e.selection})||(0,_.someNode)(e,{match:{type:(0,_.getPluginType)(e,`button`)}})||(W.text((0,_.getEditorString)(e,e.selection)),W.show(`insert`,e.id)))},ht={marginTop:`10px`,marginBottom:`10px`,display:`inline-block`,overflow:`hidden`,textOverflow:`ellipsis`,maxWidth:`100%`,verticalAlign:`middle`,boxSizing:`border-box`,overflowWrap:`normal`},gt={buttonPrimary:{...ht,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)`,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:{...ht,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)`,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:{...ht,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)`,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)`}}},_t=e=>{let{attributes:t,children:n}=e,r=e.element.url||e.element.chosenLink?.searchResult?.link||``,i=e.element.target||`_self`,a=String(e.element.buttonStyle)||`primary`;return(0,d.jsx)(vt,{attributes:t,href:r,target:i,styles:gt[`button${a.charAt(0).toUpperCase()+a.slice(1)}`],children:n})},vt=({attributes:e,styles:t={hover:{}},children:n,href:r=`#`,target:i})=>{let[a,o]=(0,u.useState)(!1);return(0,d.jsx)(`a`,{...e,onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),href:r,target:i,style:a?{...t,...t.hover}:t,children:n})},yt=class extends _.MarkupElement{constructor(e=Z,t=_t){super(e,t)}},bt=(0,u.forwardRef)((e,t)=>{let n=(0,_.useEditorRef)();return(0,d.jsx)(_.ToolbarButton,{ref:t,...e,onMouseDown:e=>{e.preventDefault(),(0,_.focusEditor)(n,n.selection??n.prevSelection??void 0)},onClick:()=>{ft(n,{focused:!0})},children:(0,d.jsx)(_.IconStylingWrapper,{icon:(0,d.jsx)(l.IconButton,{size:16})})})});bt.displayName=`ButtonToolbarButton`;var xt=({editorId:e,id:t})=>{let n=(0,_.useEditorState)((0,_.useEventPlateId)(e)),r=!!(0,_.isRangeInSameBlock)(n,{at:n.selection}),i=(0,_.getPluginType)(n,Z),a=!!n?.selection&&(0,_.someNode)(n,{match:{type:i}});return(0,d.jsx)(`div`,{"data-plugin-id":t,children:(0,d.jsx)(bt,{pressed:a,disabled:!r,tooltip:(0,_.getTooltip)(r?`Button\n${(0,_.getHotkeyByPlatform)(`Ctrl+Shift+K`)}`:`Buttons can only be set for a single text block.`)})})},J=`link-plugin`,Y=function(e){return e.heading1=`heading1`,e.heading2=`heading2`,e.heading3=`heading3`,e.heading4=`heading4`,e.custom1=`custom1`,e.custom2=`custom2`,e.custom3=`custom3`,e.quote=`quote`,e.imageCaption=`imageCaption`,e.imageTitle=`imageTitle`,e.p=`p`,e}({}),X={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)`},[J]:{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)`},...gt},St=()=>{let e=(0,_.useEditorRef)();return(0,d.jsx)(_.FloatingModalWrapper,{padding:`16px`,minWidth:`400px`,"data-test-id":`floating-button-edit`,children:(0,d.jsxs)(`span`,{"data-test-id":`preview-button-flyout`,className:`tw-flex tw-justify-between tw-items-center tw-gap-2`,children:[(0,d.jsx)(`a`,{"data-test-id":`floating-button-edit-url`,href:G.url(),target:`_blank`,rel:`noopener noreferrer`,style:X[J],className:`tw-break-all`,children:G.url()}),(0,d.jsxs)(`span`,{className:`tw-flex tw-gap-2`,children:[(0,d.jsx)(`button`,{onClick:()=>{pt(e)},tabIndex:0,"data-test-id":`edit-button-button`,className:`tw-transition tw-cursor-pointer tw-rounded-medium hover:tw-bg-black-10 tw-p-1`,children:(0,d.jsx)(l.IconPen,{size:16})}),(0,d.jsx)(`button`,{onClick:()=>{q(e),(0,_.focusEditor)(e,e.selection??void 0)},tabIndex:0,"data-test-id":`remove-button-button`,className:`tw-transition tw-cursor-pointer tw-rounded-medium hover:tw-bg-black-10 tw-p-1`,children:(0,d.jsx)(l.IconTrashBin,{size:16})})]})]})})},Ct=({onUrlChange:e,onToggleTab:t,isValidUrlOrEmpty:n,appBridge:r,placeholder:i,newTab:a,url:o=``,required:u,info:f,label:p,buttonSize:m,hideInternalLinkButton:h})=>{let _=n?n(o):K(o),{openLinkChooser:v,closeLinkChooser:y}=(0,s.useLinkChooser)(r);return(0,d.jsxs)(`div`,{"data-test-id":`link-input`,children:[(0,d.jsx)(g.FormControl,{label:{children:p,htmlFor:`url`,required:u,tooltip:f?{content:f,position:`top`}:void 0},children:(0,d.jsx)(c.TextInput,{"data-test-id":`text-input`,id:`url`,value:o,onChange:t=>e?.(t.target.value),placeholder:i??`https://example.com`})}),!_&&(0,d.jsx)(`div`,{className:`tw-text-error tw-mt-1 tw-text-small`,children:`Please enter a valid URL.`}),!h&&(0,d.jsx)(`div`,{className:`tw-mt-3`,onPointerDown:e=>{e.preventDefault()},children:(0,d.jsxs)(c.Button,{"data-test-id":`internal-link-chooser-button`,size:m??`medium`,emphasis:`default`,onPress:async()=>{await v(t=>{e?.(t),y().catch(console.error)},{selectedUrl:o})},children:[(0,d.jsx)(l.IconLink,{size:`20`}),`Internal link`]})}),(0,d.jsxs)(`div`,{className:`tw-mt-3 tw-flex tw-items-center tw-gap-1.5`,children:[(0,d.jsx)(c.Checkbox,{id:`new-tab`,value:a,onChange:()=>t?.(!a)}),(0,d.jsx)(c.Label,{id:`new-tab-label`,htmlFor:`new-tab`,className:`tw-whitespace-nowrap`,children:`Open in new tab`})]})]})},wt=({state:e,onTextChange:t,onUrlChange:n,onToggleTab:r,onCancel:i,onSave:a,isValidUrlOrEmpty:o,hasValues:s,testId:u,appBridge:f,children:p})=>(0,d.jsxs)(_.FloatingModalWrapper,{"data-test-id":u,padding:`28px`,minWidth:`400px`,children:[(0,d.jsx)(g.FormControl,{label:{children:`Text`,htmlFor:`linkText`,required:!0},children:(0,d.jsx)(c.TextInput,{id:`linkText`,value:e.text,placeholder:`Link Text`,onChange:e=>t(e.target.value)})}),p,(0,d.jsx)(`div`,{className:`tw-mt-5`,children:(0,d.jsx)(Ct,{url:e.url,newTab:e.newTab,onUrlChange:n,onToggleTab:r,isValidUrlOrEmpty:o,appBridge:f})}),(0,d.jsx)(`div`,{className:`tw-mt-3`,children:(0,d.jsxs)(`div`,{className:`tw-pt-5 tw-flex tw-gap-x-3 tw-justify-end tw-border-t tw-border-t-black-10`,children:[(0,d.jsx)(c.Button,{"data-test-id":`button`,onPress:i,size:`medium`,emphasis:`default`,children:`Cancel`}),(0,d.jsxs)(c.Button,{"data-test-id":`button`,onPress:a,size:`medium`,disabled:!o(e?.url)||!s,children:[(0,d.jsx)(l.IconCheckMark,{size:`20`}),`Save`]})]})})]}),Tt=e=>{let t=(0,_.getAboveNode)(e,{match:{type:Z}});return Array.isArray(t)&&t[0]?.buttonStyle||`primary`},Et={url:``,text:``,buttonStyle:`primary`,newTab:!1},Dt=()=>{let[e,t]=(0,u.useReducer)((e,t)=>{let{type:n,payload:r}=t;switch(n){case`NEW_TAB`:return{...e,newTab:!0};case`SAME_TAB`:return{...e,newTab:!1};case`URL`:case`TEXT`:case`BUTTON_STYLE`:case`INIT`:return{...e,...r};default:return e}},Et);return[e,t]},Ot=()=>{let e=(0,_.useEditorRef)(),[t,n]=Dt();(0,u.useEffect)(()=>{let t=Tt(e);n({type:`INIT`,payload:{text:G.text()||G.url(),buttonStyle:t,newTab:!!G.newTab(),url:G.url()}})},[n,e]);let r=e=>{n({type:`TEXT`,payload:{text:e}})},i=e=>{n({type:`BUTTON_STYLE`,payload:{buttonStyle:e}})},a=e=>{n({type:`URL`,payload:{url:e}})},o=e=>{n(e?{type:`NEW_TAB`}:{type:`SAME_TAB`})},s=()=>{W.reset()},c=n=>{if(!K(t.url)||!l)return;let r=Qe(t.url);W.text(t.text),W.url(r),W.buttonStyle(t.buttonStyle),W.newTab(t.newTab),nt(e)&&n?.preventDefault()},l=t.url!==``&&t.text!==``,{appBridge:d}=(0,_.getPluginOptions)(e,Z);return(0,_.useHotkeys)(`enter`,c,{enableOnFormTags:[`INPUT`]},[]),{state:t,onTextChange:r,onButtonStyleChange:i,onUrlChange:a,onToggleTab:o,onCancel:s,onSave:c,hasValues:l,isValidUrlOrEmpty:K,appBridge:d}},kt=()=>{let e=Ot(),{state:t,onButtonStyleChange:n}=e;return(0,d.jsx)(wt,{...e,testId:`floating-button-insert`,children:(0,d.jsx)(`div`,{className:`tw-pt-5`,children:(0,d.jsxs)(g.FormControl,{label:{children:`Button Style`,htmlFor:`buttonStyle`,required:!0},children:[(0,d.jsx)(At,{id:`primary`,styles:X.buttonPrimary,isActive:t.buttonStyle===`primary`,onClick:()=>n(`primary`),children:t.text||`Primary Button`}),(0,d.jsx)(At,{id:`secondary`,styles:X.buttonSecondary,isActive:t.buttonStyle===`secondary`,onClick:()=>n(`secondary`),children:t.text||`Secondary Button`}),(0,d.jsx)(At,{id:`tertiary`,styles:X.buttonTertiary,isActive:t.buttonStyle===`tertiary`,onClick:()=>n(`tertiary`),children:t.text||`Tertiary Button`})]})})})},At=({id:e,styles:t,isActive:n,onClick:r,children:i})=>{let[a,o]=(0,u.useState)(!1);return(0,d.jsx)(`button`,{"data-test-id":`floating-button-insert-${e}`,onMouseEnter:()=>o(!0),onMouseLeave:()=>o(!1),onClick:r,style:{...t&&t.hover&&a?{...t,...t.hover}:t,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:i})},jt={placement:`bottom-start`,strategy:`absolute`,middleware:[(0,_.offset)(12),(0,_.flip)({padding:12,fallbackPlacements:[`bottom-end`,`top-start`,`top-end`]})]},Mt=()=>{let{ref:e,...t}=zt(jt),{ref:n,...r}=It(jt),i=(0,_.useEditorRef)(),a=He(),o=a.isOpen(i.id),s=a.isEditing(),c=a.mode(),l=(0,d.jsx)(kt,{}),u=s?l:(0,d.jsx)(St,{});return(0,d.jsxs)(d.Fragment,{children:[o&&c===`insert`&&(0,v.createPortal)((0,d.jsx)(`div`,{"data-is-underlay":!0,ref:e,...t,style:{...t.style,...X[_.TextStyles.p]},children:l}),document.body),o&&c===`edit`&&(0,v.createPortal)((0,d.jsx)(`div`,{"data-is-underlay":!0,ref:n,...r,style:{...r.style,...X[_.TextStyles.p]},children:u}),document.body)]})},Z=`button`,Nt=`button-plugin`,Pt=e=>(0,_.createPluginFactory)({key:Z,isElement:!0,isInline:!0,props:({element:e})=>({nodeProps:{href:e?.url,target:e?.target}}),withOverrides:et,renderAfterEditable:Mt,options:{isUrl:$e,rangeBeforeOptions:{matchString:` `,skipInvalid:!0,afterMatch:!0},triggerFloatingButtonHotkeys:`command+shift+k, ctrl+shift+k`,appBridge:e},then:(e,{type:t})=>({deserializeHtml:{rules:[{validNodeName:`A`,validClassName:`btn`}],getNode:e=>({type:t,url:e.getAttribute(`href`),target:e.getAttribute(`target`)||`_blank`})}})})(),Ft=class extends _.Plugin{styles={};appBridge;constructor({styles:e=gt,...t}){super(Nt,{button:xt,markupElement:new yt,...t}),this.styles=e,this.appBridge=t?.appBridge}plugins(){return[Pt(this.appBridge)]}},It=e=>{let t=(0,_.useEditorRef)(),n=He().mode(),r=He().isOpen(t.id),i=(0,_.useEditorVersion)(),{triggerFloatingButtonHotkeys:a}=(0,_.getPluginOptions)(t,Z),o=(0,u.useCallback)(()=>{let e=(0,_.getAboveNode)(t,{match:{type:(0,_.getPluginType)(t,Z)}});if(e){let[,n]=e;return(0,_.getRangeBoundingClientRect)(t,{anchor:(0,_.getStartPoint)(t,n),focus:(0,_.getEndPoint)(t,n)})}return(0,_.getDefaultBoundingClientRect)()},[t]),{update:s,style:c,floating:l}=Ut({open:r&&n===`edit`,getBoundingClientRect:o,...e});return(0,u.useEffect)(()=>{let e=ut(t);if(e&&W.url(e),t.selection&&(0,_.someNode)(t,{match:{type:(0,_.getPluginType)(t,`button`)}})){W.show(`edit`,t.id),s();return}G.mode()===`edit`&&W.reset()},[t,i,s]),(0,_.useHotkeys)(a,e=>{e.preventDefault(),G.mode()===`edit`&&pt(t)},{enableOnContentEditable:!0},[]),Lt(),Rt(),{style:c,ref:(0,_.useComposedRef)(l)}},Lt=()=>{let e=(0,_.useEditorRef)();(0,_.useHotkeys)(`*`,t=>{t.key===`Enter`&&nt(e)&&t.preventDefault()},{enableOnFormTags:[`INPUT`]},[])},Rt=()=>{let e=(0,_.useEditorRef)();(0,_.useHotkeys)(`escape`,()=>{if(G.mode()===`edit`){if(G.isEditing()){W.show(`edit`,e.id),(0,_.focusEditor)(e,e.selection??void 0);return}W.reset()}},{enableOnFormTags:[`INPUT`],enableOnContentEditable:!0},[])},zt=e=>{let t=(0,_.useEditorRef)(),n=(0,_.useFocused)(),r=He().mode(),i=He().isOpen(t.id),{triggerFloatingButtonHotkeys:a}=(0,_.getPluginOptions)(t,Z);(0,_.useHotkeys)(a,e=>{e.preventDefault(),mt(t,{focused:n})},{enableOnContentEditable:!0},[n]);let{update:o,style:s,floating:c}=Ut({open:i&&r===`insert`,getBoundingClientRect:_.getSelectionBoundingClientRect,whileElementsMounted:void 0,...e});return(0,u.useEffect)(()=>{i&&o(),W.updated(i)},[i,o]),Rt(),{style:s,ref:(0,_.useComposedRef)(c)}},Bt=12,Vt=-22,Ht=96,Ut=e=>(0,_.useVirtualFloating)({placement:`bottom-start`,middleware:[(0,_.offset)({mainAxis:Bt,alignmentAxis:Vt}),(0,_.flip)({padding:Ht})],...e}),Wt=`[&_.tw-break-after-column]:tw-break-after-auto [&_.tw-break-inside-avoid-column]:tw-break-inside-auto [&_.tw-break-after-column.tw-pb-5]:tw-pb-0 @md:[&_.tw-break-after-column.tw-pb-5]:!tw-pb-5 @md:[&_.tw-break-after-column]:!tw-break-after-column @md:[&_.tw-break-inside-avoid-column]:!tw-break-inside-avoid-column`,Gt={1:`tw-columns-1`,2:`tw-columns-1 @sm:!tw-columns-2 [&_.tw-break-after-column]:tw-break-after-auto [&_.tw-break-inside-avoid-column]:tw-break-inside-auto [&_.tw-break-after-column.tw-pb-5]:tw-pb-0 @sm:[&_.tw-break-after-column.tw-pb-5]:!tw-pb-5 @sm:[&_.tw-break-after-column]:!tw-break-after-column @sm:[&_.tw-break-inside-avoid-column]:!tw-break-inside-avoid-column`,3:`tw-columns-1 @md:!tw-columns-3 ${Wt}`,4:`tw-columns-1 @md:!tw-columns-4 ${Wt}`,5:`tw-columns-1 @md:!tw-columns-5 ${Wt}`},Kt=e=>e?Gt[e]||Gt[1]:``,qt=({value:e=``,gap:t,customClass:n,show:r=!0,plugins:i})=>{let[a,o]=(0,u.useState)(null);return(0,u.useEffect)(()=>{(async()=>{let r=await(0,_.serializeRawToHtmlAsync)(e,i,void 0,t,n);o(r)})().catch(console.error)},[e,t,i,n]),!r||a===`<br />`||a===null?null:(0,d.jsx)(`div`,{className:`tw-w-full tw-whitespace-pre-wrap`,"data-test-id":`rte-content-html`,dangerouslySetInnerHTML:{__html:a}})},Jt=e=>{G.isOpen(e)&&W.reset()},Yt=(0,u.memo)(({isEnabled:e,value:t,columns:n,gap:r,placeholder:i,plugins:a,onTextChange:o,showSerializedText:s})=>{let c=Kt(n),[l,f]=(0,u.useState)(!1),p=(0,u.useId)(),m=(0,u.useCallback)(e=>{e!==t&&o?.(e),f(!1)},[o,t]),h=(0,u.useCallback)(()=>f(!0),[]);return(0,u.useEffect)(()=>{let e=e=>{e.preventDefault(),e.returnValue=`Unprocessed changes`};return l&&window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[l]),e?(0,d.jsx)(_.RichTextEditor,{id:p,value:t,border:!1,placeholder:i,plugins:a,onValueChanged:h,onTextChange:m,hideExternalFloatingModals:Jt,placeholderOpacity:`high`}):(0,d.jsx)(qt,{value:t,gap:r,customClass:c,show:s,plugins:a})});Yt.displayName=`InternalRichTextEditor`;var Xt=e=>{let t=(0,u.useRef)(null),[n,r]=(0,u.useState)(!1),{isEditing:i,...a}=e,o=(0,u.useCallback)(e=>{e&&r(!0)},[]);return Be({ref:t,disabled:!i,onChange:o}),(0,u.useEffect)(()=>{i||r(!1)},[i]),(0,d.jsx)(`div`,{"data-test-id":`rich-text-editor-container`,className:`tw-block tw-w-full tw-@container`,ref:t,children:(0,d.jsx)(Yt,{...a,isEnabled:i&&n})})},Zt=({editButtonProps:e,unlinkButtonProps:t})=>{let{element:n}=(0,_.useLinkOpenButtonState)(),r=n?Ye(n):``;return(0,d.jsx)(_.FloatingModalWrapper,{"data-test-id":`floating-link-edit`,padding:`16px`,minWidth:`400px`,children:(0,d.jsxs)(`span`,{"data-test-id":`preview-link-flyout`,className:`tw-flex tw-justify-between tw-items-center tw-gap-2`,children:[(0,d.jsx)(`a`,{"data-test-id":`floating-link-edit-url`,href:r,target:`_blank`,rel:`noopener noreferrer`,style:X[J],className:`tw-break-all`,children:r}),(0,d.jsxs)(`span`,{className:`tw-flex tw-gap-2`,children:[(0,d.jsx)(`button`,{tabIndex:0,"data-test-id":`edit-link-button`,className:`tw-transition tw-cursor-pointer tw-rounded-medium hover:tw-bg-black-10 tw-p-1`,...e,children:(0,d.jsx)(l.IconPen,{size:16})}),(0,d.jsx)(`button`,{tabIndex:0,"data-test-id":`remove-link-button`,className:`tw-transition tw-cursor-pointer tw-rounded-medium hover:tw-bg-black-10 tw-p-1`,...t,children:(0,d.jsx)(l.IconTrashBin,{size:16})})]})]})})},Qt=(e,t)=>{let n=(0,_.getAboveNode)(e,{match:{type:_.ELEMENT_LINK}});return Array.isArray(n)?t(n[0]):``},$t=e=>Qt(e,e=>e.chosenLink?.searchResult?.link||``),en=e=>Qt(e,e=>e.url||``),tn={url:``,text:``,newTab:!1},nn=()=>{let[e,t]=(0,u.useReducer)((e,t)=>{let{type:n,payload:r}=t;switch(n){case`NEW_TAB`:return{...e,newTab:!0};case`SAME_TAB`:return{...e,newTab:!1};case`URL`:case`TEXT`:case`INIT`:return{...e,...r};default:return e}},tn);return[e,t]},rn=()=>{let e=(0,_.useEditorRef)(),[t,n]=nn();(0,u.useEffect)(()=>{let t=$t(e),r=en(e),i=_.floatingLinkSelectors.newTab();n({type:`INIT`,payload:{text:_.floatingLinkSelectors.text()||_.floatingLinkSelectors.url(),newTab:i,url:t&&r===``?t:_.floatingLinkSelectors.url()}})},[n,e]);let r=e=>{n({type:`TEXT`,payload:{text:e}})},i=e=>{n({type:`URL`,payload:{url:e}})},a=e=>{n(e?{type:`NEW_TAB`}:{type:`SAME_TAB`})},o=()=>{_.floatingLinkActions.reset()},s=n=>{!K(t.url)||!c||(_.floatingLinkActions.text(t.text),_.floatingLinkActions.url(Qe(t.url)),_.floatingLinkActions.newTab(t.newTab),(0,_.submitFloatingLink)(e)&&n?.preventDefault())},c=t.url!==``&&t.text!==``,{appBridge:l}=(0,_.getPluginOptions)(e,_.ELEMENT_LINK);return(0,_.useHotkeys)(`enter`,s,{enableOnFormTags:[`INPUT`]},[]),{state:t,onTextChange:r,onUrlChange:i,onToggleTab:a,onCancel:o,onSave:s,hasValues:c,isValidUrlOrEmpty:K,appBridge:l}},an=()=>(0,d.jsx)(wt,{...rn(),testId:`floating-link-insert`}),on={placement:`bottom-start`,strategy:`absolute`,middleware:[(0,_.offset)(12),(0,_.flip)({padding:12,fallbackPlacements:[`bottom-end`,`top-start`,`top-end`]})]},sn=()=>{let e=(0,_.useFloatingLinkInsertState)({floatingOptions:on}),{props:t,ref:n,hidden:r}=(0,_.useFloatingLinkInsert)(e),i=(0,_.useFloatingLinkEditState)({floatingOptions:on}),{props:a,ref:o,editButtonProps:s,unlinkButtonProps:c}=(0,_.useFloatingLinkEdit)(i);if(r)return null;let l=(0,d.jsx)(an,{}),u=i.isEditing?l:(0,d.jsx)(Zt,{editButtonProps:s,unlinkButtonProps:c});return(0,d.jsxs)(d.Fragment,{children:[e.isOpen&&!i.isOpen&&(0,v.createPortal)((0,d.jsx)(`div`,{"data-is-underlay":!0,ref:n,...t,style:{...t.style,...X[Y.p]},children:l}),document.body),i.isOpen&&(0,v.createPortal)((0,d.jsx)(`div`,{"data-is-underlay":!0,ref:o,...a,style:{...a.style,...X[Y.p]},children:u}),document.body)]})},cn=(0,u.forwardRef)((e,t)=>{let n=(0,_.useEditorRef)(),r=(0,_.useLinkToolbarButtonState)(),{props:i}=(0,_.useLinkToolbarButton)(r);return(0,d.jsx)(_.ToolbarButton,{onMouseDown:e=>{e.preventDefault(),(0,_.focusEditor)(n,n.selection??n.prevSelection??void 0)},ref:t,...i,...e,children:(0,d.jsx)(_.IconStylingWrapper,{icon:(0,d.jsx)(l.IconLink,{size:16})})})});cn.displayName=`LinkToolbarButton`;var ln=({id:e,editorId:t})=>{let n=(0,_.useEditorState)((0,_.useEventPlateId)(t)),r=!!(0,_.isRangeInSameBlock)(n,{at:n.selection});return(0,d.jsx)(`div`,{"data-plugin-id":e,children:(0,d.jsx)(cn,{disabled:!r,tooltip:(0,_.getTooltip)(r?`Link\n${(0,_.getHotkeyByPlatform)(`Ctrl+K`)}`:`Links can only be set for a single text block.`)})})},un=e=>{let{attributes:t,children:n}=e,{styles:r}=(0,_.useRichTextEditorContext)(),i=e.element.url||e.element.chosenLink?.searchResult?.link||``,a=e.element.target||`_self`;return(0,d.jsx)(`a`,{...t,href:i,target:a,style:r[J],children:n})},dn=class extends _.MarkupElement{constructor(e=_.ELEMENT_LINK,t=un){super(e,t)}},fn=e=>(0,_.createPluginFactory)({...(0,_.createLinkPlugin)(),renderAfterEditable:sn,options:{isUrl:$e,rangeBeforeOptions:{matchString:` `,skipInvalid:!0,afterMatch:!0},triggerFloatingLinkHotkeys:`meta+k, ctrl+k`,keepSelectedTextOnPaste:!0,appBridge:e}})(),pn=class extends _.Plugin{styles={};appBridge;constructor({styles:e=X[J],...t}){super(J,{button:ln,markupElement:new dn,...t}),this.styles=e,this.appBridge=t.appBridge}plugins(){return[fn(this.appBridge)]}},mn=`breakAfterColumn`,hn=`normal`,gn=class extends _.Plugin{columns;gap;customClass;constructor(e){super(`break-after-plugin`,{button:_.ColumnBreakButton,...e}),this.columns=e?.columns??1,this.gap=e?.gap??`normal`,this.customClass=Kt(this.columns)}plugins(){return[(0,_.createColumnBreakPlugin)(this.columns,this.gap,this.customClass)]}},_n=`textstyle-custom1-plugin`,vn=class extends _.Plugin{styles={};constructor({styles:e=X.custom1,...t}={}){super(Y.custom1,{label:`Custom 1`,markupElement:new yn,...t}),this.styles=e}plugins(){return[xn(this.styles)]}},yn=class extends _.MarkupElement{constructor(e=_n,t=bn){super(e,t)}},bn=({element:e,attributes:t,children:n,styles:r})=>{let i=e.align;return(0,d.jsx)(`p`,{...t,style:r,className:(0,_.merge)([i&&_.alignmentClassnames[i],(0,_.getColumnBreakClasses)(e)]),children:n})},xn=e=>(0,_.createPluginFactory)({key:Y.custom1,isElement:!0,deserializeHtml:{rules:[{validClassName:Y.custom1}]}})({component:t=>(0,d.jsx)(bn,{...t,styles:e})}),Sn=`textstyle-custom2-plugin`,Cn=class extends _.Plugin{styles={};constructor({styles:e=X.custom2,...t}={}){super(Y.custom2,{label:`Custom 2`,markupElement:new wn,...t}),this.styles=e}plugins(){return[En(this.styles)]}},wn=class extends _.MarkupElement{constructor(e=Sn,t=Tn){super(e,t)}},Tn=({element:e,attributes:t,children:n,styles:r})=>{let i=e.align;return(0,d.jsx)(`p`,{...t,className:(0,_.merge)([i&&_.alignmentClassnames[i],(0,_.getColumnBreakClasses)(e)]),style:r,children:n})},En=e=>(0,_.createPluginFactory)({key:Y.custom2,isElement:!0,deserializeHtml:{rules:[{validClassName:Y.custom2}]}})({component:t=>(0,d.jsx)(Tn,{...t,styles:e})}),Dn=`textstyle-custom3-plugin`,On=class extends _.Plugin{styles={};constructor({styles:e=X.custom3,...t}={}){super(_.TextStyles.custom3,{label:`Custom 3`,markupElement:new kn,...t}),this.styles=e}plugins(){return[jn(this.styles)]}},kn=class extends _.MarkupElement{constructor(e=Dn,t=An){super(e,t)}},An=({element:e,attributes:t,children:n,styles:r})=>{let i=e.align;return(0,d.jsx)(`p`,{...t,className:(0,_.merge)([i&&_.alignmentClassnames[i],(0,_.getColumnBreakClasses)(e)]),style:r,children:n})},jn=e=>(0,_.createPluginFactory)({key:_.TextStyles.custom3,isElement:!0,deserializeHtml:{rules:[{validClassName:_.TextStyles.custom3}]}})({component:t=>(0,d.jsx)(An,{...t,styles:e})}),Mn=`textstyle-heading1-plugin`,Nn=class extends _.Plugin{styles={};constructor({styles:e=X.heading1,...t}={}){super(Y.heading1,{label:`Heading 1`,markupElement:new Pn,...t}),this.styles=e}plugins(){return[In(this.styles)]}},Pn=class extends _.MarkupElement{constructor(e=Mn,t=Fn){super(e,t)}},Fn=({element:e,attributes:t,children:n,styles:r})=>{let i=e.align;return(0,d.jsx)(`h1`,{...t,className:(0,_.merge)([i&&_.alignmentClassnames[i],(0,_.getColumnBreakClasses)(e)]),style:r,children:n})},In=e=>(0,_.createPluginFactory)({key:Y.heading1,isElement:!0,component:Fn,deserializeHtml:{rules:[{validNodeName:[`h1`,`H1`]}]}})({component:t=>(0,d.jsx)(Fn,{...t,styles:e})}),Ln=`textstyle-heading2-plugin`,Rn=class extends _.Plugin{styles={};constructor({styles:e=X.heading2,...t}={}){super(Y.heading2,{label:`Heading 2`,markupElement:new zn,...t}),this.styles=e}plugins(){return[Vn(this.styles)]}},zn=class extends _.MarkupElement{constructor(e=Ln,t=Bn){super(e,t)}},Bn=({element:e,attributes:t,children:n,styles:r})=>{let i=e.align;return(0,d.jsx)(`h2`,{...t,className:(0,_.merge)([i&&_.alignmentClassnames[i],(0,_.getColumnBreakClasses)(e)]),style:r,children:n})},Vn=e=>(0,_.createPluginFactory)({key:Y.heading2,isElement:!0,component:Bn,deserializeHtml:{rules:[{validNodeName:[`h2`,`H2`]}]}})({component:t=>(0,d.jsx)(Bn,{...t,styles:e})}),Hn=`textstyle-heading3-plugin`,Un=class extends _.Plugin{styles={};constructor({styles:e=X.heading3,...t}={}){super(Y.heading3,{label:`Heading 3`,markupElement:new Wn,...t}),this.styles=e}plugins(){return[Kn(this.styles)]}},Wn=class extends _.MarkupElement{constructor(e=Hn,t=Gn){super(e,t)}},Gn=({element:e,attributes:t,children:n,styles:r})=>{let i=e.align;return(0,d.jsx)(`h3`,{...t,className:(0,_.merge)([i&&_.alignmentClassnames[i],(0,_.getColumnBreakClasses)(e)]),style:r,children:n})},Kn=e=>(0,_.createPluginFactory)({key:Y.heading3,isElement:!0,component:Gn,deserializeHtml:{rules:[{validNodeName:[`h3`,`H3`]}]}})({component:t=>(0,d.jsx)(Gn,{...t,styles:e})}),qn=`textstyle-heading4-plugin`,Jn=class extends _.Plugin{styles={};constructor({styles:e=X.heading4,...t}={}){super(Y.heading4,{label:`Heading 4`,markupElement:new Yn,...t}),this.styles=e}plugins(){return[Zn(this.styles)]}},Yn=class extends _.MarkupElement{constructor(e=qn,t=Xn){super(e,t)}},Xn=({element:e,attributes:t,children:n,styles:r})=>{let i=e.align;return(0,d.jsx)(`h4`,{...t,className:(0,_.merge)([i&&_.alignmentClassnames[i],(0,_.getColumnBreakClasses)(e)]),style:r,children:n})},Zn=e=>(0,_.createPluginFactory)({key:Y.heading4,isElement:!0,component:Xn,deserializeHtml:{rules:[{validNodeName:[`h4`,`H4`]}]}})({component:t=>(0,d.jsx)(Xn,{...t,styles:e})}),Qn=`textstyle-imageCaption-plugin`,$n=class extends _.Plugin{styles={};constructor({styles:e=X.imageCaption,...t}={}){super(Y.imageCaption,{label:`Image Caption`,markupElement:new er,...t}),this.styles=e}plugins(){return[nr(this.styles)]}},er=class extends _.MarkupElement{constructor(e=Qn,t=tr){super(e,t)}},tr=({element:e,attributes:t,children:n,styles:r})=>{let i=e.align;return(0,d.jsx)(`p`,{...t,className:(0,_.merge)([i&&_.alignmentClassnames[i],(0,_.getColumnBreakClasses)(e)]),style:r,children:n})},nr=e=>(0,_.createPluginFactory)({key:Y.imageCaption,isElement:!0,component:tr,deserializeHtml:{rules:[{validClassName:Y.imageCaption}]}})({component:t=>(0,d.jsx)(tr,{...t,styles:e})}),rr=`textstyle-imageTitle-plugin`,ir=class extends _.Plugin{styles={};constructor({styles:e=X.imageTitle,...t}={}){super(Y.imageTitle,{label:`Image Title`,markupElement:new ar,...t}),this.styles=e}plugins(){return[sr(this.styles)]}},ar=class extends _.MarkupElement{constructor(e=rr,t=or){super(e,t)}},or=({element:e,attributes:t,children:n,styles:r})=>{let i=e.align;return(0,d.jsx)(`p`,{...t,className:(0,_.merge)([i&&_.alignmentClassnames[i],(0,_.getColumnBreakClasses)(e)]),style:r,children:n})},sr=e=>(0,_.createPluginFactory)({key:Y.imageTitle,isElement:!0,component:or,deserializeHtml:{rules:[{validClassName:Y.imageTitle}]}})({component:t=>(0,d.jsx)(or,{...t,styles:e})}),cr=class extends _.Plugin{styles={};constructor({styles:e=X.p,...t}={}){super(Y.p,{markupElement:new dr,label:`Body Text`,...t}),this.styles=e}plugins(){return[fr(this.styles)]}},lr=`tw-m-0 tw-px-0 tw-py-0`,ur=({element:e,attributes:t,children:n,styles:r})=>{let i=e.align,a=(0,_.merge)([i&&_.alignmentClassnames[i],lr,(0,_.getColumnBreakClasses)(e)]);return(0,d.jsx)(`p`,{...t,className:a,style:r,children:n})},dr=class extends _.MarkupElement{constructor(e=Y.p,t=ur){super(e,t)}},fr=e=>(0,_.createPluginFactory)({...(0,_.createParagraphPlugin)(),key:Y.p,isElement:!0,component:ur})({component:t=>(0,d.jsx)(ur,{...t,styles:e})}),pr=`textstyle-quote-plugin`,mr=class extends _.Plugin{styles={};constructor({styles:e=X.quote,...t}={}){super(Y.quote,{label:`Quote`,markupElement:new hr,...t}),this.styles=e}plugins(){return[_r(this.styles)]}},hr=class extends _.MarkupElement{constructor(e=pr,t=gr){super(e,t)}},gr=({element:e,attributes:t,children:n,styles:r})=>{let i=e.align;return(0,d.jsx)(`blockquote`,{...t,className:(0,_.merge)([i&&_.alignmentClassnames[i],(0,_.getColumnBreakClasses)(e)]),style:r,children:n})},_r=e=>(0,_.createPluginFactory)({key:Y.quote,isElement:!0,component:gr,deserializeHtml:{rules:[{validNodeName:[`blockquote`,`BLOCKQUOTE`]}]}})({component:t=>(0,d.jsx)(gr,{...t,styles:e})}),vr=[new Nn,new Rn,new Un,new Jn,new vn,new Cn,new On,new mr,new cr],Q=[Y.heading1,Y.heading2,Y.heading3,Y.heading4,Y.custom1,Y.custom2,Y.custom3,Y.quote,Y.p],yr=[...vr,new $n,new ir],br=[...Q,Y.imageCaption,Y.imageTitle],xr=[{color:`var(--f-theme-settings-list-bullet1-color, currentColor)`,shape:`var(--f-theme-settings-list-bullet1-shape, '•')`,size:`var(--f-theme-settings-list-bullet1-size, 1em)`},{color:`var(--f-theme-settings-list-bullet2-color, currentColor)`,shape:`var(--f-theme-settings-list-bullet2-shape, '•')`,size:`var(--f-theme-settings-list-bullet2-size, 1em)`},{color:`var(--f-theme-settings-list-bullet3-color, currentColor)`,shape:`var(--f-theme-settings-list-bullet3-shape, '•')`,size:`var(--f-theme-settings-list-bullet3-size, 1em)`}],Sr=class extends _.UnorderedListPlugin{constructor(e){super({listStyles:xr,...e})}},Cr=[{counterType:`var(--f-theme-settings-list-numbered1-counter-type, decimal)`,color:`var(--f-theme-settings-list-numbered1-color, currentColor)`},{counterType:`var(--f-theme-settings-list-numbered2-counter-type, lower-alpha)`,color:`var(--f-theme-settings-list-numbered2-color, currentColor)`},{counterType:`var(--f-theme-settings-list-numbered3-counter-type, lower-roman)`,color:`var(--f-theme-settings-list-numbered3-color, currentColor)`}],wr=class extends _.OrderedListPlugin{constructor(e){super({listStyles:Cr,...e})}},Tr=e=>new _.PluginComposer().setPlugin(new _.SoftBreakPlugin,new _.TextStylePlugin({textStyles:vr})).setPlugin([new _.BoldPlugin,new _.ItalicPlugin,new _.UnderlinePlugin,new _.StrikethroughPlugin,new pn({appBridge:e}),new Ft({appBridge:e}),new _.CodePlugin],[new _.AlignLeftPlugin({validTypes:Q}),new _.AlignCenterPlugin({validTypes:Q}),new _.AlignRightPlugin({validTypes:Q}),new _.AlignJustifyPlugin({validTypes:Q}),new Sr,new _.CheckboxListPlugin,new wr,new _.ResetFormattingPlugin,new _.AutoformatPlugin]),Er=`--f-theme-settings-`,Dr=e=>{let t=e?.id?`hasBackground${e.id}`:`hasBackground`,n=e?.id?`backgroundColor${e.id}`:`backgroundColor`,r=e?.preventDefaultColor?void 0:e?.defaultColor||te;return{id:t,label:e?.label?e.label:`Background`,type:`switch`,switchLabel:e?.switchLabel?e.switchLabel:void 0,defaultValue:!!e?.defaultValue,on:[{id:n,defaultValue:r,type:`colorInput`}]}},Or=e=>{let t=e?.id?`hasBorder_${e.id}`:`hasBorder`,n=e?.id?`borderSelection_${e.id}`:`borderSelection`,r=e?.id?`borderStyle_${e.id}`:`borderStyle`,i=e?.id?`borderWidth_${e.id}`:`borderWidth`,a=e?.id?`borderColor_${e.id}`:`borderColor`,o=e?.defaultColor||ne;return{id:t,label:`Border`,type:`switch`,switchLabel:e?.switchLabel?e.switchLabel:void 0,defaultValue:!!e?.defaultValue,on:[{id:n,type:`multiInput`,layout:$.MultiInputLayout.Columns,lastItemFullWidth:!0,blocks:[{id:r,type:`dropdown`,defaultValue:N.Solid,choices:[{value:N.Solid,label:N.Solid},{value:N.Dotted,label:N.Dotted},{value:N.Dashed,label:N.Dashed}]},{id:i,type:`input`,defaultValue:`1px`,rules:[$.numericalOrPixelRule,(0,$.minimumNumericalOrPixelRule)(0),(0,$.maximumNumericalOrPixelOrAutoRule)(500)],placeholder:`e.g. 3px`,onChange:e=>(0,$.appendUnit)(e,i)},{id:a,type:`colorInput`,defaultValue:o}]}],off:[]}},kr=(e,t=P.None)=>({id:e,type:`segmentedControls`,defaultValue:t,choices:[{value:P.None,label:`None`},{value:P.Small,label:`S`},{value:P.Medium,label:`M`},{value:P.Large,label:`L`}]}),Ar=e=>{let t=e?.id?`hasRadius_${e.id}`:`hasRadius`,n=e?.id?`radiusValue_${e.id}`:`radiusValue`,r=e?.id?`radiusChoice_${e.id}`:`radiusChoice`,i=e?.defaultRadius||P.None;return{id:t,label:`Corner radius`,type:`switch`,switchLabel:`Custom`,defaultValue:!1,info:`Determining how rounded the corners are.`,show:t=>!e?.dependentSettingId||!!t.getBlock(e.dependentSettingId)?.value,onChange:t=>(0,$.presetCustomValue)(t,r,n,e?.radiusStyleMap||F),on:[{id:n,type:`input`,placeholder:`e.g. 10px`,rules:[$.numericalOrPixelRule,(0,$.minimumNumericalOrPixelRule)(0)],onChange:e=>(0,$.appendUnit)(e,n)}],off:[kr(r,i)]}},jr=e=>{let t=e?.id?`hasExtendedCustomRadius_${e.id}`:`hasExtendedCustomRadius`,n=e?.id?`extendedRadiusValue_${e.id}`:`extendedRadiusValue`,r=e?.id?`extendedRadiusChoice_${e.id}`:`extendedRadiusChoice`,i=e?.id?`extendedRadiusTopLeft_${e.id}`:`extendedRadiusTopLeft`,a=e?.id?`extendedRadiusTopRight_${e.id}`:`extendedRadiusTopRight`,o=e?.id?`extendedRadiusBottomLeft_${e.id}`:`extendedRadiusBottomLeft`,s=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:t=>!e?.dependentSettingId||!!t.getBlock(e.dependentSettingId)?.value,onChange:e=>{(0,$.presetCustomValue)(e,r,i,F),(0,$.presetCustomValue)(e,r,a,F),(0,$.presetCustomValue)(e,r,o,F),(0,$.presetCustomValue)(e,r,s,F)},on:[{id:n,type:`multiInput`,layout:$.MultiInputLayout.Columns,blocks:[{id:i,type:`input`,label:`Top Left`,rules:[$.numericalOrPixelRule],onChange:e=>(0,$.appendUnit)(e,i)},{id:a,type:`input`,label:`Top Right`,rules:[$.numericalOrPixelRule],onChange:e=>(0,$.appendUnit)(e,a)},{id:o,type:`input`,label:`Bottom Left`,rules:[$.numericalOrPixelRule],onChange:e=>(0,$.appendUnit)(e,o)},{id:s,type:`input`,label:`Bottom Right`,rules:[$.numericalOrPixelRule],onChange:e=>(0,$.appendUnit)(e,s)}]}],off:[kr(r,e?.defaultValue)]}},Mr=e=>{let t=e?.id?e.id:`hasCustomSpacing`,n=e?.dependentSettingId?e.dependentSettingId:`columns`,r=e?.spacingChoiceId?e.spacingChoiceId:`spacingChoice`,i=e?.spacingCustomId?e.spacingCustomId:`spacingCustom`,a=e?.defaultValueChoices?e.defaultValueChoices:V.M;return{id:t,type:`switch`,defaultValue:!1,switchLabel:`Custom`,label:`Gutter`,info:`An official nerds term for ‘gap’`,onChange:e=>(0,$.presetCustomValue)(e,r,i,ie),show:e=>e.getBlock(n)?.value!==`1`,on:[{id:i,type:`input`,rules:[$.numericalOrPixelRule],onChange:e=>(0,$.appendUnit)(e,i)}],off:[{id:r,type:`slider`,defaultValue:a,choices:[{value:V.Auto,label:`Auto`},{value:V.S,label:`S`},{value:V.M,label:`M`},{value:V.L,label:`L`}]}]}},Nr=e=>({id:e,type:`segmentedControls`,defaultValue:R.None,choices:[{value:R.None,label:`None`},{value:R.Small,label:`S`},{value:R.Medium,label:`M`},{value:R.Large,label:`L`}]}),Pr=e=>{let t=e?.id?`hasCustomMarginValue_${e?.id}`:`hasCustomMarginValue`,n=e?.id?`marginValue_${e?.id}`:`marginValue`,r=e?.id?`marginChoice_${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:t=>(0,$.presetCustomValue)(t,r,n,e?.marginStyleMap||z),on:[{id:n,type:`input`,placeholder:M,rules:[$.numericalOrPixelRule,(0,$.maximumNumericalOrPixelOrAutoRule)(500)],onChange:e=>(0,$.appendUnit)(e,n)}],off:[Nr(r)]}},Fr=e=>{let t=e?.id?`hasExtendedCustomMargin_${e?.id}`:`hasExtendedCustomMargin`,n=e?.id?`extendedMarginValues_${e?.id}`:`extendedMarginValues`,r=e?.id?`extendedMarginChoice_${e?.id}`:`extendedMarginChoice`,i=e?.id?`extendedMarginTop_${e?.id}`:`extendedMarginTop`,a=e?.id?`extendedMarginLeft_${e?.id}`:`extendedMarginLeft`,o=e?.id?`extendedMarginRight_${e?.id}`:`extendedMarginRight`,s=e?.id?`extendedMarginBottom_${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:e=>{(0,$.presetCustomValue)(e,r,i,z),(0,$.presetCustomValue)(e,r,a,z),(0,$.presetCustomValue)(e,r,o,z),(0,$.presetCustomValue)(e,r,s,z)},on:[{id:n,type:`multiInput`,layout:$.MultiInputLayout.Spider,blocks:[{id:i,type:`input`,label:`Top`,placeholder:M,onChange:e=>(0,$.appendUnit)(e,i),rules:[$.numericalOrPixelRule,(0,$.maximumNumericalOrPixelOrAutoRule)(500)]},{id:a,type:`input`,label:`Left`,placeholder:M,onChange:e=>(0,$.appendUnit)(e,a),rules:[$.numericalOrPixelRule,(0,$.maximumNumericalOrPixelOrAutoRule)(500)]},{id:o,type:`input`,label:`Right`,placeholder:M,onChange:e=>(0,$.appendUnit)(e,o),rules:[$.numericalOrPixelRule,(0,$.maximumNumericalOrPixelOrAutoRule)(500)]},{id:s,type:`input`,label:`Bottom`,placeholder:M,onChange:e=>(0,$.appendUnit)(e,s),rules:[$.numericalOrPixelRule,(0,$.maximumNumericalOrPixelOrAutoRule)(500)]}]}],off:[Nr(r)]}},Ir=e=>({id:e,type:`segmentedControls`,defaultValue:I.Small,choices:[{value:I.None,label:`None`},{value:I.Small,label:`S`},{value:I.Medium,label:`M`},{value:I.Large,label:`L`}]}),Lr=e=>{let t=e?.id?`hasCustomPaddingValue_${e?.id}`:`hasCustomPaddingValue`,n=e?.id?`paddingValue_${e?.id}`:`paddingValue`,r=e?.id?`paddingChoice_${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:t=>(0,$.presetCustomValue)(t,r,n,e?.paddingStyleMap||L),on:[{id:n,type:`input`,placeholder:j,rules:[$.numericalOrPixelRule,(0,$.maximumNumericalOrPixelOrAutoRule)(500)],onChange:e=>(0,$.appendUnit)(e,n)}],off:[Ir(r)]}},Rr=e=>{let t=e?.id?`hasExtendedCustomPadding_${e?.id}`:`hasExtendedCustomPadding`,n=e?.id?`extendedPaddingValues_${e?.id}`:`extendedPaddingValues`,r=e?.id?`extendedPaddingChoice_${e?.id}`:`extendedPaddingChoice`,i=e?.id?`extendedPaddingTop_${e?.id}`:`extendedPaddingTop`,a=e?.id?`extendedPaddingLeft_${e?.id}`:`extendedPaddingLeft`,o=e?.id?`extendedPaddingRight_${e?.id}`:`extendedPaddingRight`,s=e?.id?`extendedPaddingBottom_${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:e=>{(0,$.presetCustomValue)(e,r,i,L),(0,$.presetCustomValue)(e,r,a,L),(0,$.presetCustomValue)(e,r,o,L),(0,$.presetCustomValue)(e,r,s,L)},on:[{id:n,type:`multiInput`,layout:$.MultiInputLayout.Spider,blocks:[{id:i,type:`input`,label:`Top`,placeholder:j,onChange:e=>(0,$.appendUnit)(e,i),rules:[$.numericalOrPixelRule,(0,$.maximumNumericalOrPixelOrAutoRule)(500)]},{id:a,type:`input`,label:`Left`,placeholder:j,onChange:e=>(0,$.appendUnit)(e,a),rules:[$.numericalOrPixelRule,(0,$.maximumNumericalOrPixelOrAutoRule)(500)]},{id:o,type:`input`,label:`Right`,placeholder:j,onChange:e=>(0,$.appendUnit)(e,o),rules:[$.numericalOrPixelRule,(0,$.maximumNumericalOrPixelOrAutoRule)(500)]},{id:s,type:`input`,label:`Bottom`,placeholder:j,onChange:e=>(0,$.appendUnit)(e,s),rules:[$.numericalOrPixelRule,(0,$.maximumNumericalOrPixelOrAutoRule)(500)]}]}],off:[Ir(r)]}},zr=e=>{let t=Br(e?.globalControlId);return{id:e?.id?e.id:`downloadable`,type:`switch`,defaultValue:!1,label:`Downloadable`,show:e=>e.getBlock(t)?.value===B.Custom}},Br=e=>e||`security`,Vr=e=>[{id:Br(e),type:`segmentedControls`,defaultValue:B.Global,choices:[{value:B.Global,label:`Global Settings`},{value:B.Custom,label:`Custom`}]},{id:`globalSettingsInfo`,type:`notification`,footer:(0,$.createFooter)({label:`Change global settings [here].`,replace:{here:{event:`general-settings.open`}}})}],$=i({AllTextStylePlugins:()=>yr,AllTextStyles:()=>br,AttachmentOperationsProvider:()=>_e,Attachments:()=>we,AttachmentsProvider:()=>ge,AttachmentsToolbarButton:()=>Oe,BUTTON_PLUGIN:()=>Nt,BlockButtonStyles:()=>gt,BlockInjectButton:()=>b,BlockItemWrapper:()=>ze,BlockStyles:()=>X,BorderStyle:()=>N,BreakAfterPlugin:()=>gn,ButtonPlugin:()=>Ft,Custom1Plugin:()=>vn,Custom2Plugin:()=>Cn,Custom3Plugin:()=>On,DEFAULT_ATTACHMENTS_BUTTON_ID:()=>De,DEFAULT_DRAGGING_TOOLTIP:()=>Ae,DEFAULT_DRAG_TOOLTIP:()=>ke,DEFAULT_MENU_BUTTON_ID:()=>Pe,DragHandleToolbarButton:()=>Me,DragPreviewContextProvider:()=>ce,ELEMENT_BUTTON:()=>Z,FlyoutToolbarButton:()=>Ne,GAP_DEFAULT:()=>hn,GutterSpacing:()=>V,Heading1Plugin:()=>Nn,Heading2Plugin:()=>Rn,Heading3Plugin:()=>Un,Heading4Plugin:()=>Jn,ImageCaptionPlugin:()=>$n,ImageTitlePlugin:()=>ir,KEY_ELEMENT_BREAK_AFTER_COLUMN:()=>mn,LinkInput:()=>Ct,LinkPlugin:()=>pn,Margin:()=>R,MenuToolbarButton:()=>Fe,MultiFlyoutContextProvider:()=>ue,OrderedListPlugin:()=>wr,PARAGRAPH_CLASSES:()=>lr,Padding:()=>I,ParagraphMarkupElement:()=>dr,ParagraphMarkupElementNode:()=>ur,ParagraphPlugin:()=>cr,QuoteMarkupElementNode:()=>gr,QuotePlugin:()=>mr,Radius:()=>P,RichTextEditor:()=>Xt,Sections:()=>Hr,Security:()=>B,THEME_PREFIX:()=>Er,TextStylePluginsWithoutImage:()=>vr,TextStyles:()=>Y,TextStylesWithoutImage:()=>Q,Toolbar:()=>Re,UnorderedListPlugin:()=>Sr,addHttps:()=>Qe,borderStyleMap:()=>re,convertToRteValue:()=>We,createButtonNode:()=>dt,createButtonPlugin:()=>Pt,createLinkPlugin:()=>fn,createParagraphPlugin:()=>fr,createQuotePlugin:()=>_r,defineBlock:()=>Ur,defineSettings:()=>Wr,getBackgroundColorStyles:()=>A,getBackgroundSettings:()=>Dr,getBorderRadiusSettings:()=>Ar,getBorderRadiusSlider:()=>kr,getBorderSettings:()=>Or,getBorderStyles:()=>ae,getDefaultPluginsWithLinkChooser:()=>Tr,getExtendedBorderRadiusSettings:()=>jr,getGutterSettings:()=>Mr,getLegacyUrl:()=>qe,getLinkFromEditor:()=>Xe,getMarginExtendedSettings:()=>Fr,getMarginSettings:()=>Pr,getMarginSlider:()=>Nr,getPaddingExtendedSettings:()=>Rr,getPaddingSettings:()=>Lr,getPaddingSlider:()=>Ir,getRadiusStyles:()=>oe,getReadableColor:()=>k,getSecurityDownloadableSetting:()=>zr,getSecurityGlobalControlId:()=>Br,getSecurityGlobalControlSetting:()=>Vr,getUrl:()=>Je,getUrlFromEditor:()=>ut,getUrlFromLinkOrLegacyLink:()=>Ye,gutterSpacingStyleMap:()=>ie,hasRichTextValue:()=>Ue,insertButton:()=>tt,isDark:()=>C,isDownloadable:()=>Ge,isValidUrl:()=>$e,isValidUrlOrEmpty:()=>K,joinClassNames:()=>y,marginStyleMap:()=>z,paddingStyleMap:()=>L,radiusStyleMap:()=>F,relativeUrlRegex:()=>Ze,setAlpha:()=>D,submitFloatingButton:()=>nt,toColorObject:()=>O,toHex8String:()=>w,toHexString:()=>T,toRgbaString:()=>E,toShortRgba:()=>x,triggerFloatingButton:()=>ft,triggerFloatingButtonEdit:()=>pt,triggerFloatingButtonInsert:()=>mt,unwrapButton:()=>q,upsertButton:()=>rt,upsertButtonText:()=>st,useAttachmentOperations:()=>pe,useAttachments:()=>me,useAttachmentsContext:()=>ve,useDragPreviewContext:()=>H,useMultiFlyoutContext:()=>de,useMultiFlyoutState:()=>fe,withAttachmentsProvider:()=>ye,withButton:()=>et,wrapButton:()=>ct});o($,require("@frontify/sidebar-settings"));var Hr=function(e){return e.Main=`main`,e.Basics=`basics`,e.Layout=`layout`,e.Style=`style`,e.Security=`security`,e.Targets=`targets`,e}({}),Ur=e=>e,Wr=e=>e;exports.AllTextStylePlugins=yr,exports.AllTextStyles=br,exports.AttachmentOperationsProvider=_e,exports.Attachments=we,exports.AttachmentsProvider=ge,exports.AttachmentsToolbarButton=Oe,exports.BUTTON_PLUGIN=Nt,exports.BlockButtonStyles=gt,exports.BlockInjectButton=b,exports.BlockItemWrapper=ze,exports.BlockStyles=X,exports.BorderStyle=N,exports.BreakAfterPlugin=gn,exports.ButtonPlugin=Ft,exports.Custom1Plugin=vn,exports.Custom2Plugin=Cn,exports.Custom3Plugin=On,exports.DEFAULT_ATTACHMENTS_BUTTON_ID=De,exports.DEFAULT_DRAGGING_TOOLTIP=Ae,exports.DEFAULT_DRAG_TOOLTIP=ke,exports.DEFAULT_MENU_BUTTON_ID=Pe,exports.DragHandleToolbarButton=Me,exports.DragPreviewContextProvider=ce,exports.ELEMENT_BUTTON=Z,exports.FlyoutToolbarButton=Ne,exports.GAP_DEFAULT=hn,exports.GutterSpacing=V,exports.Heading1Plugin=Nn,exports.Heading2Plugin=Rn,exports.Heading3Plugin=Un,exports.Heading4Plugin=Jn,exports.ImageCaptionPlugin=$n,exports.ImageTitlePlugin=ir,exports.KEY_ELEMENT_BREAK_AFTER_COLUMN=mn,exports.LinkInput=Ct,exports.LinkPlugin=pn,exports.Margin=R,exports.MenuToolbarButton=Fe,exports.MultiFlyoutContextProvider=ue,exports.OrderedListPlugin=wr,exports.PARAGRAPH_CLASSES=lr,exports.Padding=I,exports.ParagraphMarkupElement=dr,exports.ParagraphMarkupElementNode=ur,exports.ParagraphPlugin=cr,exports.QuoteMarkupElementNode=gr,exports.QuotePlugin=mr,exports.Radius=P,exports.RichTextEditor=Xt,exports.Sections=Hr,exports.Security=B,exports.THEME_PREFIX=Er,exports.TextStylePluginsWithoutImage=vr,exports.TextStyles=Y,exports.TextStylesWithoutImage=Q,exports.Toolbar=Re,exports.UnorderedListPlugin=Sr,exports.addHttps=Qe,exports.borderStyleMap=re,exports.convertToRteValue=We,exports.createButtonNode=dt,exports.createButtonPlugin=Pt,exports.createLinkPlugin=fn,exports.createParagraphPlugin=fr,exports.createQuotePlugin=_r,exports.defineBlock=Ur,exports.defineSettings=Wr,exports.getBackgroundColorStyles=A,exports.getBackgroundSettings=Dr,exports.getBorderRadiusSettings=Ar,exports.getBorderRadiusSlider=kr,exports.getBorderSettings=Or,exports.getBorderStyles=ae,exports.getDefaultPluginsWithLinkChooser=Tr,exports.getExtendedBorderRadiusSettings=jr,exports.getGutterSettings=Mr,exports.getLegacyUrl=qe,exports.getLinkFromEditor=Xe,exports.getMarginExtendedSettings=Fr,exports.getMarginSettings=Pr,exports.getMarginSlider=Nr,exports.getPaddingExtendedSettings=Rr,exports.getPaddingSettings=Lr,exports.getPaddingSlider=Ir,exports.getRadiusStyles=oe,exports.getReadableColor=k,exports.getSecurityDownloadableSetting=zr,exports.getSecurityGlobalControlId=Br,exports.getSecurityGlobalControlSetting=Vr,exports.getUrl=Je,exports.getUrlFromEditor=ut,exports.getUrlFromLinkOrLegacyLink=Ye,exports.gutterSpacingStyleMap=ie,exports.hasRichTextValue=Ue,exports.insertButton=tt,exports.isDark=C,exports.isDownloadable=Ge,exports.isValidUrl=$e,exports.isValidUrlOrEmpty=K,exports.joinClassNames=y,exports.marginStyleMap=z,exports.paddingStyleMap=L,exports.radiusStyleMap=F,exports.relativeUrlRegex=Ze,exports.setAlpha=D,exports.submitFloatingButton=nt,exports.toColorObject=O,exports.toHex8String=w,exports.toHexString=T,exports.toRgbaString=E,exports.toShortRgba=x,exports.triggerFloatingButton=ft,exports.triggerFloatingButtonEdit=pt,exports.triggerFloatingButtonInsert=mt,exports.unwrapButton=q,exports.upsertButton=rt,exports.upsertButtonText=st,exports.useAttachmentOperations=pe,exports.useAttachments=me,exports.useAttachmentsContext=ve,exports.useDragPreviewContext=H,exports.useMultiFlyoutContext=de,exports.useMultiFlyoutState=fe,exports.withAttachmentsProvider=ye,exports.withButton=et,exports.wrapButton=ct;var Gr=require("@frontify/sidebar-settings");Object.keys(Gr).forEach(function(e){e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return Gr[e]}})});
|
|
8
2
|
//# sourceMappingURL=index.cjs.js.map
|