@frontify/guideline-blocks-settings 0.29.0 → 0.29.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.
Files changed (37) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/components/BlockItemWrapper/BlockItemWrapper.es.js.map +1 -1
  3. package/dist/components/RichTextEditor/plugins/styles.es.js.map +1 -1
  4. package/dist/index.cjs.js +3 -3
  5. package/dist/index.cjs.js.map +1 -1
  6. package/dist/index.d.ts +5 -3
  7. package/dist/index.umd.js +1 -1
  8. package/dist/index.umd.js.map +1 -1
  9. package/dist/utilities/color/getReadableColor.es.js +8 -8
  10. package/dist/utilities/color/getReadableColor.es.js.map +1 -1
  11. package/dist/utilities/color/isDark.es.js +2 -2
  12. package/dist/utilities/color/isDark.es.js.map +1 -1
  13. package/dist/utilities/color/setAlpha.es.js +2 -2
  14. package/dist/utilities/color/setAlpha.es.js.map +1 -1
  15. package/dist/utilities/color/toColorObject.es.js +5 -5
  16. package/dist/utilities/color/toColorObject.es.js.map +1 -1
  17. package/dist/utilities/color/toHex8String.es.js +3 -3
  18. package/dist/utilities/color/toHex8String.es.js.map +1 -1
  19. package/dist/utilities/color/toHexString.es.js +3 -3
  20. package/dist/utilities/color/toHexString.es.js.map +1 -1
  21. package/dist/utilities/color/toRgbaString.es.js +3 -3
  22. package/dist/utilities/color/toRgbaString.es.js.map +1 -1
  23. package/package.json +11 -11
  24. package/src/components/Attachments/Attachments.spec.ct.tsx +1 -1
  25. package/src/components/BlockItemWrapper/BlockItemWrapper.tsx +2 -2
  26. package/src/components/BlockItemWrapper/types.ts +2 -0
  27. package/src/components/Link/LinkSelector/LinkSelector.spec.ct.tsx +1 -1
  28. package/src/components/RichTextEditor/RichTextEditor.spec.ct.tsx +1 -1
  29. package/src/components/RichTextEditor/plugins/styles.ts +1 -1
  30. package/src/utilities/color/getReadableColor.ts +3 -3
  31. package/src/utilities/color/isDark.ts +2 -2
  32. package/src/utilities/color/setAlpha.ts +2 -2
  33. package/src/utilities/color/toColorObject.ts +2 -2
  34. package/src/utilities/color/toHex8String.ts +2 -2
  35. package/src/utilities/color/toHexString.ts +2 -2
  36. package/src/utilities/color/toRgbaString.ts +2 -2
  37. package/tsconfig.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @frontify/guideline-blocks-settings
2
2
 
3
+ ## 0.29.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`2df4a2e`](https://github.com/Frontify/brand-sdk/commit/2df4a2ef0830c7d4a72a5b77e86d0645e33ad757) Thanks [@ragi96](https://github.com/ragi96)! - fix: export TextStyles enum correctly
8
+
9
+ - [`3c1e752`](https://github.com/Frontify/brand-sdk/commit/3c1e7520967c5055c944a0f1afe6b41e046dcdd8) Thanks [@SamuelAlev](https://github.com/SamuelAlev)! - Update dependencies
10
+
11
+ - [`9199d24`](https://github.com/Frontify/brand-sdk/commit/9199d24dd1221640687d6d157897eedc40ed3d43) Thanks [@ragi96](https://github.com/ragi96)! - fix: BlockItemWrapper typing issue
12
+
13
+ - Updated dependencies [[`3c1e752`](https://github.com/Frontify/brand-sdk/commit/3c1e7520967c5055c944a0f1afe6b41e046dcdd8)]:
14
+ - @frontify/sidebar-settings@0.6.6
15
+
3
16
  ## 0.29.0
4
17
 
5
18
  ### Minor Changes
@@ -1 +1 @@
1
- {"version":3,"file":"BlockItemWrapper.es.js","sources":["../../../src/components/BlockItemWrapper/BlockItemWrapper.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { PropsWithChildren, useEffect, useRef, useState } from 'react';\nimport { joinClassNames } from '../../utilities';\nimport { Toolbar } from './Toolbar';\nimport { BlockItemWrapperProps, ToolbarItem } from './types';\n\nexport const BlockItemWrapper = ({\n children,\n toolbarFlyoutItems,\n toolbarItems,\n shouldHideWrapper,\n shouldHideComponent = false,\n isDragging,\n shouldFillContainer,\n outlineOffset = 2,\n shouldBeShown = false,\n}: PropsWithChildren<BlockItemWrapperProps>) => {\n const [isFlyoutOpen, setIsFlyoutOpen] = useState(shouldBeShown);\n const [isFlyoutDisabled, setIsFlyoutDisabled] = useState(false);\n const wrapperRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (!isFlyoutOpen) {\n // This prevents automatic refocusing of the trigger element\n setIsFlyoutDisabled(true);\n }\n }, [isFlyoutOpen]);\n\n if (shouldHideWrapper) {\n return children;\n }\n\n const items = toolbarItems?.filter((item): item is ToolbarItem => item !== undefined);\n\n return (\n <div\n ref={wrapperRef}\n onFocus={() => setIsFlyoutDisabled(false)}\n onPointerEnter={() => setIsFlyoutDisabled(false)}\n data-test-id=\"block-item-wrapper\"\n style={{\n outlineOffset,\n }}\n className={joinClassNames([\n 'tw-relative tw-group tw-outline-1 tw-outline-box-selected-inverse',\n shouldFillContainer && 'tw-flex-1 tw-h-full tw-w-full',\n 'hover:tw-outline focus-within:tw-outline',\n (isFlyoutOpen || shouldBeShown) && 'tw-outline',\n shouldHideComponent && 'tw-opacity-0',\n ])}\n >\n <div\n style={{\n right: -1 - outlineOffset,\n bottom: `calc(100% - ${2 + outlineOffset}px)`,\n }}\n className={joinClassNames([\n 'tw-pointer-events-none tw-absolute tw-bottom-[calc(100%-4px)] tw-right-[-3px] tw-w-full tw-opacity-0 tw-z-10',\n 'group-hover:tw-opacity-100 group-focus:tw-opacity-100 focus-within:tw-opacity-100',\n (isFlyoutOpen || shouldBeShown) && 'tw-opacity-100',\n ])}\n >\n <Toolbar\n isFlyoutOpen={isFlyoutOpen}\n isFlyoutDisabled={isFlyoutDisabled}\n setIsFlyoutOpen={setIsFlyoutOpen}\n flyoutItems={toolbarFlyoutItems}\n items={items}\n isDragging={isDragging}\n />\n </div>\n {children}\n </div>\n );\n};\n"],"names":["BlockItemWrapper","children","toolbarFlyoutItems","toolbarItems","shouldHideWrapper","shouldHideComponent","isDragging","shouldFillContainer","outlineOffset","shouldBeShown","isFlyoutOpen","setIsFlyoutOpen","useState","isFlyoutDisabled","setIsFlyoutDisabled","wrapperRef","useRef","useEffect","items","item","jsxs","joinClassNames","jsx","Toolbar"],"mappings":";;;;AAOO,MAAMA,IAAmB,CAAC;AAAA,EAC7B,UAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,cAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,qBAAAC,IAAsB;AAAA,EACtB,YAAAC;AAAA,EACA,qBAAAC;AAAA,EACA,eAAAC,IAAgB;AAAA,EAChB,eAAAC,IAAgB;AACpB,MAAgD;AAC5C,QAAM,CAACC,GAAcC,CAAe,IAAIC,EAASH,CAAa,GACxD,CAACI,GAAkBC,CAAmB,IAAIF,EAAS,EAAK,GACxDG,IAAaC,EAAuB,IAAI;AAS9C,MAPAC,EAAU,MAAM;AACZ,IAAKP,KAEDI,EAAoB,EAAI;AAAA,EAC5B,GACD,CAACJ,CAAY,CAAC,GAEbN;AACO,WAAAH;AAGX,QAAMiB,IAAQf,KAAA,gBAAAA,EAAc,OAAO,CAACgB,MAA8BA,MAAS;AAGvE,SAAA,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,KAAKL;AAAA,MACL,SAAS,MAAMD,EAAoB,EAAK;AAAA,MACxC,gBAAgB,MAAMA,EAAoB,EAAK;AAAA,MAC/C,gBAAa;AAAA,MACb,OAAO;AAAA,QACH,eAAAN;AAAA,MACJ;AAAA,MACA,WAAWa,EAAe;AAAA,QACtB;AAAA,QACAd,KAAuB;AAAA,QACvB;AAAA,SACCG,KAAgBD,MAAkB;AAAA,QACnCJ,KAAuB;AAAA,MAAA,CAC1B;AAAA,MAED,UAAA;AAAA,QAAA,gBAAAiB;AAAA,UAAC;AAAA,UAAA;AAAA,YACG,OAAO;AAAA,cACH,OAAO,KAAKd;AAAA,cACZ,QAAQ,eAAe,IAAIA,CAAa;AAAA,YAC5C;AAAA,YACA,WAAWa,EAAe;AAAA,cACtB;AAAA,cACA;AAAA,eACCX,KAAgBD,MAAkB;AAAA,YAAA,CACtC;AAAA,YAED,UAAA,gBAAAa;AAAA,cAACC;AAAA,cAAA;AAAA,gBACG,cAAAb;AAAA,gBACA,kBAAAG;AAAA,gBACA,iBAAAF;AAAA,gBACA,aAAaT;AAAA,gBACb,OAAAgB;AAAA,gBACA,YAAAZ;AAAA,cAAA;AAAA,YACJ;AAAA,UAAA;AAAA,QACJ;AAAA,QACCL;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGb;"}
1
+ {"version":3,"file":"BlockItemWrapper.es.js","sources":["../../../src/components/BlockItemWrapper/BlockItemWrapper.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { useEffect, useRef, useState } from 'react';\nimport { joinClassNames } from '../../utilities';\nimport { Toolbar } from './Toolbar';\nimport { BlockItemWrapperProps, ToolbarItem } from './types';\n\nexport const BlockItemWrapper = ({\n children,\n toolbarFlyoutItems,\n toolbarItems,\n shouldHideWrapper,\n shouldHideComponent = false,\n isDragging,\n shouldFillContainer,\n outlineOffset = 2,\n shouldBeShown = false,\n}: BlockItemWrapperProps) => {\n const [isFlyoutOpen, setIsFlyoutOpen] = useState(shouldBeShown);\n const [isFlyoutDisabled, setIsFlyoutDisabled] = useState(false);\n const wrapperRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n if (!isFlyoutOpen) {\n // This prevents automatic refocusing of the trigger element\n setIsFlyoutDisabled(true);\n }\n }, [isFlyoutOpen]);\n\n if (shouldHideWrapper) {\n return children;\n }\n\n const items = toolbarItems?.filter((item): item is ToolbarItem => item !== undefined);\n\n return (\n <div\n ref={wrapperRef}\n onFocus={() => setIsFlyoutDisabled(false)}\n onPointerEnter={() => setIsFlyoutDisabled(false)}\n data-test-id=\"block-item-wrapper\"\n style={{\n outlineOffset,\n }}\n className={joinClassNames([\n 'tw-relative tw-group tw-outline-1 tw-outline-box-selected-inverse',\n shouldFillContainer && 'tw-flex-1 tw-h-full tw-w-full',\n 'hover:tw-outline focus-within:tw-outline',\n (isFlyoutOpen || shouldBeShown) && 'tw-outline',\n shouldHideComponent && 'tw-opacity-0',\n ])}\n >\n <div\n style={{\n right: -1 - outlineOffset,\n bottom: `calc(100% - ${2 + outlineOffset}px)`,\n }}\n className={joinClassNames([\n 'tw-pointer-events-none tw-absolute tw-bottom-[calc(100%-4px)] tw-right-[-3px] tw-w-full tw-opacity-0 tw-z-10',\n 'group-hover:tw-opacity-100 group-focus:tw-opacity-100 focus-within:tw-opacity-100',\n (isFlyoutOpen || shouldBeShown) && 'tw-opacity-100',\n ])}\n >\n <Toolbar\n isFlyoutOpen={isFlyoutOpen}\n isFlyoutDisabled={isFlyoutDisabled}\n setIsFlyoutOpen={setIsFlyoutOpen}\n flyoutItems={toolbarFlyoutItems}\n items={items}\n isDragging={isDragging}\n />\n </div>\n {children}\n </div>\n );\n};\n"],"names":["BlockItemWrapper","children","toolbarFlyoutItems","toolbarItems","shouldHideWrapper","shouldHideComponent","isDragging","shouldFillContainer","outlineOffset","shouldBeShown","isFlyoutOpen","setIsFlyoutOpen","useState","isFlyoutDisabled","setIsFlyoutDisabled","wrapperRef","useRef","useEffect","items","item","jsxs","joinClassNames","jsx","Toolbar"],"mappings":";;;;AAOO,MAAMA,IAAmB,CAAC;AAAA,EAC7B,UAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,cAAAC;AAAA,EACA,mBAAAC;AAAA,EACA,qBAAAC,IAAsB;AAAA,EACtB,YAAAC;AAAA,EACA,qBAAAC;AAAA,EACA,eAAAC,IAAgB;AAAA,EAChB,eAAAC,IAAgB;AACpB,MAA6B;AACzB,QAAM,CAACC,GAAcC,CAAe,IAAIC,EAASH,CAAa,GACxD,CAACI,GAAkBC,CAAmB,IAAIF,EAAS,EAAK,GACxDG,IAAaC,EAAuB,IAAI;AAS9C,MAPAC,EAAU,MAAM;AACZ,IAAKP,KAEDI,EAAoB,EAAI;AAAA,EAC5B,GACD,CAACJ,CAAY,CAAC,GAEbN;AACO,WAAAH;AAGX,QAAMiB,IAAQf,KAAA,gBAAAA,EAAc,OAAO,CAACgB,MAA8BA,MAAS;AAGvE,SAAA,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,KAAKL;AAAA,MACL,SAAS,MAAMD,EAAoB,EAAK;AAAA,MACxC,gBAAgB,MAAMA,EAAoB,EAAK;AAAA,MAC/C,gBAAa;AAAA,MACb,OAAO;AAAA,QACH,eAAAN;AAAA,MACJ;AAAA,MACA,WAAWa,EAAe;AAAA,QACtB;AAAA,QACAd,KAAuB;AAAA,QACvB;AAAA,SACCG,KAAgBD,MAAkB;AAAA,QACnCJ,KAAuB;AAAA,MAAA,CAC1B;AAAA,MAED,UAAA;AAAA,QAAA,gBAAAiB;AAAA,UAAC;AAAA,UAAA;AAAA,YACG,OAAO;AAAA,cACH,OAAO,KAAKd;AAAA,cACZ,QAAQ,eAAe,IAAIA,CAAa;AAAA,YAC5C;AAAA,YACA,WAAWa,EAAe;AAAA,cACtB;AAAA,cACA;AAAA,eACCX,KAAgBD,MAAkB;AAAA,YAAA,CACtC;AAAA,YAED,UAAA,gBAAAa;AAAA,cAACC;AAAA,cAAA;AAAA,gBACG,cAAAb;AAAA,gBACA,kBAAAG;AAAA,gBACA,iBAAAF;AAAA,gBACA,aAAaT;AAAA,gBACb,OAAAgB;AAAA,gBACA,YAAAZ;AAAA,cAAA;AAAA,YACJ;AAAA,UAAA;AAAA,QACJ;AAAA,QACCL;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGb;"}
@@ -1 +1 @@
1
- {"version":3,"file":"styles.es.js","sources":["../../../../src/components/RichTextEditor/plugins/styles.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport type { CSSProperties } from 'react';\nimport { LINK_PLUGIN } from './LinkPlugin/id';\nimport { BlockButtonStyles } from './ButtonPlugin';\n\nexport const enum TextStyles {\n heading1 = 'heading1',\n heading2 = 'heading2',\n heading3 = 'heading3',\n heading4 = 'heading4',\n custom1 = 'custom1',\n custom2 = 'custom2',\n custom3 = 'custom3',\n quote = 'quote',\n imageCaption = 'imageCaption',\n imageTitle = 'imageTitle',\n p = 'p',\n}\nexport const BlockStyles: Record<string, CSSProperties & { hover?: CSSProperties }> = {\n [TextStyles.heading1]: {\n fontSize: 'var(--f-theme-settings-heading1-font-size)',\n lineHeight: 'var(--f-theme-settings-heading1-line-height)',\n marginTop: 'var(--f-theme-settings-heading1-margin-top)',\n marginBottom: 'var(--f-theme-settings-heading1-margin-bottom)',\n textDecoration: 'var(--f-theme-settings-heading1-text-decoration)',\n fontStyle: 'var(--f-theme-settings-heading1-font-style)',\n textTransform: 'var(--f-theme-settings-heading1-text-transform)' as CSSProperties['textTransform'],\n letterSpacing: 'var(--f-theme-settings-heading1-letter-spacing)',\n fontWeight: 'var(--f-theme-settings-heading1-font-weight)',\n fontFamily: 'var(--f-theme-settings-heading1-font-family)',\n color: 'var(--f-theme-settings-heading1-color)',\n },\n [TextStyles.heading2]: {\n fontSize: 'var(--f-theme-settings-heading2-font-size)',\n lineHeight: 'var(--f-theme-settings-heading2-line-height)',\n marginTop: 'var(--f-theme-settings-heading2-margin-top)',\n marginBottom: 'var(--f-theme-settings-heading2-margin-bottom)',\n textDecoration: 'var(--f-theme-settings-heading2-text-decoration)',\n fontStyle: 'var(--f-theme-settings-heading2-font-style)',\n textTransform: 'var(--f-theme-settings-heading2-text-transform)' as CSSProperties['textTransform'],\n letterSpacing: 'var(--f-theme-settings-heading2-letter-spacing)',\n fontWeight: 'var(--f-theme-settings-heading2-font-weight)',\n fontFamily: 'var(--f-theme-settings-heading2-font-family)',\n color: 'var(--f-theme-settings-heading2-color)',\n },\n [TextStyles.heading3]: {\n fontSize: 'var(--f-theme-settings-heading3-font-size)',\n lineHeight: 'var(--f-theme-settings-heading3-line-height)',\n marginTop: 'var(--f-theme-settings-heading3-margin-top)',\n marginBottom: 'var(--f-theme-settings-heading3-margin-bottom)',\n textDecoration: 'var(--f-theme-settings-heading3-text-decoration)',\n fontStyle: 'var(--f-theme-settings-heading3-font-style)',\n textTransform: 'var(--f-theme-settings-heading3-text-transform)' as CSSProperties['textTransform'],\n letterSpacing: 'var(--f-theme-settings-heading3-letter-spacing)',\n fontWeight: 'var(--f-theme-settings-heading3-font-weight)',\n fontFamily: 'var(--f-theme-settings-heading3-font-family)',\n color: 'var(--f-theme-settings-heading3-color)',\n },\n [TextStyles.heading4]: {\n fontSize: 'var(--f-theme-settings-heading4-font-size)',\n lineHeight: 'var(--f-theme-settings-heading4-line-height)',\n marginTop: 'var(--f-theme-settings-heading4-margin-top)',\n marginBottom: 'var(--f-theme-settings-heading4-margin-bottom)',\n textDecoration: 'var(--f-theme-settings-heading4-text-decoration)',\n fontStyle: 'var(--f-theme-settings-heading4-font-style)',\n textTransform: 'var(--f-theme-settings-heading4-text-transform)' as CSSProperties['textTransform'],\n letterSpacing: 'var(--f-theme-settings-heading4-letter-spacing)',\n fontWeight: 'var(--f-theme-settings-heading4-font-weight)',\n fontFamily: 'var(--f-theme-settings-heading4-font-family)',\n color: 'var(--f-theme-settings-heading4-color)',\n },\n [TextStyles.custom1]: {\n fontSize: 'var(--f-theme-settings-custom1-font-size)',\n lineHeight: 'var(--f-theme-settings-custom1-line-height)',\n marginTop: 'var(--f-theme-settings-custom1-margin-top)',\n marginBottom: 'var(--f-theme-settings-custom1-margin-bottom)',\n textDecoration: 'var(--f-theme-settings-custom1-text-decoration)',\n fontStyle: 'var(--f-theme-settings-custom1-font-style)',\n textTransform: 'var(--f-theme-settings-custom1-text-transform)' as CSSProperties['textTransform'],\n letterSpacing: 'var(--f-theme-settings-custom1-letter-spacing)',\n fontWeight: 'var(--f-theme-settings-custom1-font-weight)',\n fontFamily: 'var(--f-theme-settings-custom1-font-family)',\n color: 'var(--f-theme-settings-custom1-color)',\n },\n [TextStyles.custom2]: {\n fontSize: 'var(--f-theme-settings-custom2-font-size)',\n lineHeight: 'var(--f-theme-settings-custom2-line-height)',\n marginTop: 'var(--f-theme-settings-custom2-margin-top)',\n marginBottom: 'var(--f-theme-settings-custom2-margin-bottom)',\n textDecoration: 'var(--f-theme-settings-custom2-text-decoration)',\n fontStyle: 'var(--f-theme-settings-custom2-font-style)',\n textTransform: 'var(--f-theme-settings-custom2-text-transform)' as CSSProperties['textTransform'],\n letterSpacing: 'var(--f-theme-settings-custom2-letter-spacing)',\n fontWeight: 'var(--f-theme-settings-custom2-font-weight)',\n fontFamily: 'var(--f-theme-settings-custom2-font-family)',\n color: 'var(--f-theme-settings-custom2-color)',\n },\n [TextStyles.custom3]: {\n fontSize: 'var(--f-theme-settings-custom3-font-size)',\n lineHeight: 'var(--f-theme-settings-custom3-line-height)',\n marginTop: 'var(--f-theme-settings-custom3-margin-top)',\n marginBottom: 'var(--f-theme-settings-custom3-margin-bottom)',\n textDecoration: 'var(--f-theme-settings-custom3-text-decoration)',\n fontStyle: 'var(--f-theme-settings-custom3-font-style)',\n textTransform: 'var(--f-theme-settings-custom3-text-transform)' as CSSProperties['textTransform'],\n letterSpacing: 'var(--f-theme-settings-custom3-letter-spacing)',\n fontWeight: 'var(--f-theme-settings-custom3-font-weight)',\n fontFamily: 'var(--f-theme-settings-custom3-font-family)',\n color: 'var(--f-theme-settings-custom3-color)',\n },\n [TextStyles.p]: {\n fontSize: 'var(--f-theme-settings-body-font-size)',\n lineHeight: 'var(--f-theme-settings-body-line-height)',\n marginTop: 'var(--f-theme-settings-body-margin-top)',\n marginBottom: 'var(--f-theme-settings-body-margin-bottom)',\n textDecoration: 'var(--f-theme-settings-body-text-decoration)',\n fontStyle: 'var(--f-theme-settings-body-font-style)',\n textTransform: 'var(--f-theme-settings-body-text-transform)' as CSSProperties['textTransform'],\n letterSpacing: 'var(--f-theme-settings-body-letter-spacing)',\n fontWeight: 'var(--f-theme-settings-body-font-weight)',\n fontFamily: 'var(--f-theme-settings-body-font-family)',\n color: 'var(--f-theme-settings-body-color)',\n },\n [TextStyles.quote]: {\n fontSize: 'var(--f-theme-settings-quote-font-size)',\n lineHeight: 'var(--f-theme-settings-quote-line-height)',\n marginTop: 'var(--f-theme-settings-quote-margin-top)',\n marginBottom: 'var(--f-theme-settings-quote-margin-bottom)',\n textDecoration: 'var(--f-theme-settings-quote-text-decoration)',\n fontStyle: 'var(--f-theme-settings-quote-font-style)',\n textTransform: 'var(--f-theme-settings-quote-text-transform)' as CSSProperties['textTransform'],\n letterSpacing: 'var(--f-theme-settings-quote-letter-spacing)',\n fontWeight: 'var(--f-theme-settings-quote-font-weight)',\n fontFamily: 'var(--f-theme-settings-quote-font-family)',\n color: 'var(--f-theme-settings-quote-color)',\n },\n [TextStyles.imageCaption]: {\n fontSize: 'var(--f-theme-settings-image-caption-font-size)',\n lineHeight: 'var(--f-theme-settings-image-caption-line-height)',\n marginTop: 'var(--f-theme-settings-image-caption-margin-top)',\n marginBottom: 'var(--f-theme-settings-image-caption-margin-bottom)',\n textDecoration: 'var(--f-theme-settings-image-caption-text-decoration)',\n fontStyle: 'var(--f-theme-settings-image-caption-font-style)',\n textTransform: 'var(--f-theme-settings-image-caption-text-transform)' as CSSProperties['textTransform'],\n letterSpacing: 'var(--f-theme-settings-image-caption-letter-spacing)',\n fontWeight: 'var(--f-theme-settings-image-caption-font-weight)',\n fontFamily: 'var(--f-theme-settings-image-caption-font-family)',\n color: 'var(--f-theme-settings-image-caption-color)',\n },\n [TextStyles.imageTitle]: {\n fontSize: 'var(--f-theme-settings-image-title-font-size)',\n lineHeight: 'var(--f-theme-settings-image-title-line-height)',\n marginTop: 'var(--f-theme-settings-image-title-margin-top)',\n marginBottom: 'var(--f-theme-settings-image-title-margin-bottom)',\n textDecoration: 'var(--f-theme-settings-image-title-text-decoration)',\n fontStyle: 'var(--f-theme-settings-image-title-font-style)',\n textTransform: 'var(--f-theme-settings-image-title-text-transform)' as CSSProperties['textTransform'],\n letterSpacing: 'var(--f-theme-settings-image-title-letter-spacing)',\n fontWeight: 'var(--f-theme-settings-image-title-font-weight)',\n fontFamily: 'var(--f-theme-settings-image-title-font-family)',\n color: 'var(--f-theme-settings-image-title-color)',\n },\n [LINK_PLUGIN]: {\n fontSize: 'var(--f-theme-settings-link-font-size)',\n lineHeight: 'var(--f-theme-settings-link-line-height)',\n marginTop: 'var(--f-theme-settings-link-margin-top)',\n marginBottom: 'var(--f-theme-settings-link-margin-bottom)',\n textDecoration: 'var(--f-theme-settings-link-text-decoration)',\n fontStyle: 'var(--f-theme-settings-link-font-style)',\n textTransform: 'var(--f-theme-settings-link-text-transform)' as CSSProperties['textTransform'],\n letterSpacing: 'var(--f-theme-settings-link-letter-spacing)',\n fontWeight: 'var(--f-theme-settings-link-font-weight)',\n fontFamily: 'var(--f-theme-settings-link-font-family)',\n color: 'var(--f-theme-settings-link-color)',\n },\n ...BlockButtonStyles,\n};\n"],"names":["TextStyles","BlockStyles","LINK_PLUGIN","BlockButtonStyles"],"mappings":";;AAMkB,IAAAA,sBAAAA,OACdA,EAAA,WAAW,YACXA,EAAA,WAAW,YACXA,EAAA,WAAW,YACXA,EAAA,WAAW,YACXA,EAAA,UAAU,WACVA,EAAA,UAAU,WACVA,EAAA,UAAU,WACVA,EAAA,QAAQ,SACRA,EAAA,eAAe,gBACfA,EAAA,aAAa,cACbA,EAAA,IAAI,KAXUA,IAAAA,KAAA,CAAA,CAAA;AAaX,MAAMC,IAAyE;AAAA,EACjF,UAAsB;AAAA,IACnB,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,cAAc;AAAA,IACd,gBAAgB;AAAA,IAChB,WAAW;AAAA,IACX,eAAe;AAAA,IACf,eAAe;AAAA,IACf,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,OAAO;AAAA,EACX;AAAA,EACC,UAAsB;AAAA,IACnB,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,cAAc;AAAA,IACd,gBAAgB;AAAA,IAChB,WAAW;AAAA,IACX,eAAe;AAAA,IACf,eAAe;AAAA,IACf,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,OAAO;AAAA,EACX;AAAA,EACC,UAAsB;AAAA,IACnB,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,cAAc;AAAA,IACd,gBAAgB;AAAA,IAChB,WAAW;AAAA,IACX,eAAe;AAAA,IACf,eAAe;AAAA,IACf,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,OAAO;AAAA,EACX;AAAA,EACC,UAAsB;AAAA,IACnB,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,cAAc;AAAA,IACd,gBAAgB;AAAA,IAChB,WAAW;AAAA,IACX,eAAe;AAAA,IACf,eAAe;AAAA,IACf,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,OAAO;AAAA,EACX;AAAA,EACC,SAAqB;AAAA,IAClB,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,cAAc;AAAA,IACd,gBAAgB;AAAA,IAChB,WAAW;AAAA,IACX,eAAe;AAAA,IACf,eAAe;AAAA,IACf,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,OAAO;AAAA,EACX;AAAA,EACC,SAAqB;AAAA,IAClB,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,cAAc;AAAA,IACd,gBAAgB;AAAA,IAChB,WAAW;AAAA,IACX,eAAe;AAAA,IACf,eAAe;AAAA,IACf,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,OAAO;AAAA,EACX;AAAA,EACC,SAAqB;AAAA,IAClB,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,cAAc;AAAA,IACd,gBAAgB;AAAA,IAChB,WAAW;AAAA,IACX,eAAe;AAAA,IACf,eAAe;AAAA,IACf,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,OAAO;AAAA,EACX;AAAA,EACC,GAAe;AAAA,IACZ,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,cAAc;AAAA,IACd,gBAAgB;AAAA,IAChB,WAAW;AAAA,IACX,eAAe;AAAA,IACf,eAAe;AAAA,IACf,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,OAAO;AAAA,EACX;AAAA,EACC,OAAmB;AAAA,IAChB,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,cAAc;AAAA,IACd,gBAAgB;AAAA,IAChB,WAAW;AAAA,IACX,eAAe;AAAA,IACf,eAAe;AAAA,IACf,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,OAAO;AAAA,EACX;AAAA,EACC,cAA0B;AAAA,IACvB,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,cAAc;AAAA,IACd,gBAAgB;AAAA,IAChB,WAAW;AAAA,IACX,eAAe;AAAA,IACf,eAAe;AAAA,IACf,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,OAAO;AAAA,EACX;AAAA,EACC,YAAwB;AAAA,IACrB,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,cAAc;AAAA,IACd,gBAAgB;AAAA,IAChB,WAAW;AAAA,IACX,eAAe;AAAA,IACf,eAAe;AAAA,IACf,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,OAAO;AAAA,EACX;AAAA,EACA,CAACC,CAAW,GAAG;AAAA,IACX,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,cAAc;AAAA,IACd,gBAAgB;AAAA,IAChB,WAAW;AAAA,IACX,eAAe;AAAA,IACf,eAAe;AAAA,IACf,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,OAAO;AAAA,EACX;AAAA,EACA,GAAGC;AACP;"}
1
+ {"version":3,"file":"styles.es.js","sources":["../../../../src/components/RichTextEditor/plugins/styles.ts"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport type { CSSProperties } from 'react';\nimport { LINK_PLUGIN } from './LinkPlugin/id';\nimport { BlockButtonStyles } from './ButtonPlugin';\n\nexport enum TextStyles {\n heading1 = 'heading1',\n heading2 = 'heading2',\n heading3 = 'heading3',\n heading4 = 'heading4',\n custom1 = 'custom1',\n custom2 = 'custom2',\n custom3 = 'custom3',\n quote = 'quote',\n imageCaption = 'imageCaption',\n imageTitle = 'imageTitle',\n p = 'p',\n}\nexport const BlockStyles: Record<string, CSSProperties & { hover?: CSSProperties }> = {\n [TextStyles.heading1]: {\n fontSize: 'var(--f-theme-settings-heading1-font-size)',\n lineHeight: 'var(--f-theme-settings-heading1-line-height)',\n marginTop: 'var(--f-theme-settings-heading1-margin-top)',\n marginBottom: 'var(--f-theme-settings-heading1-margin-bottom)',\n textDecoration: 'var(--f-theme-settings-heading1-text-decoration)',\n fontStyle: 'var(--f-theme-settings-heading1-font-style)',\n textTransform: 'var(--f-theme-settings-heading1-text-transform)' as CSSProperties['textTransform'],\n letterSpacing: 'var(--f-theme-settings-heading1-letter-spacing)',\n fontWeight: 'var(--f-theme-settings-heading1-font-weight)',\n fontFamily: 'var(--f-theme-settings-heading1-font-family)',\n color: 'var(--f-theme-settings-heading1-color)',\n },\n [TextStyles.heading2]: {\n fontSize: 'var(--f-theme-settings-heading2-font-size)',\n lineHeight: 'var(--f-theme-settings-heading2-line-height)',\n marginTop: 'var(--f-theme-settings-heading2-margin-top)',\n marginBottom: 'var(--f-theme-settings-heading2-margin-bottom)',\n textDecoration: 'var(--f-theme-settings-heading2-text-decoration)',\n fontStyle: 'var(--f-theme-settings-heading2-font-style)',\n textTransform: 'var(--f-theme-settings-heading2-text-transform)' as CSSProperties['textTransform'],\n letterSpacing: 'var(--f-theme-settings-heading2-letter-spacing)',\n fontWeight: 'var(--f-theme-settings-heading2-font-weight)',\n fontFamily: 'var(--f-theme-settings-heading2-font-family)',\n color: 'var(--f-theme-settings-heading2-color)',\n },\n [TextStyles.heading3]: {\n fontSize: 'var(--f-theme-settings-heading3-font-size)',\n lineHeight: 'var(--f-theme-settings-heading3-line-height)',\n marginTop: 'var(--f-theme-settings-heading3-margin-top)',\n marginBottom: 'var(--f-theme-settings-heading3-margin-bottom)',\n textDecoration: 'var(--f-theme-settings-heading3-text-decoration)',\n fontStyle: 'var(--f-theme-settings-heading3-font-style)',\n textTransform: 'var(--f-theme-settings-heading3-text-transform)' as CSSProperties['textTransform'],\n letterSpacing: 'var(--f-theme-settings-heading3-letter-spacing)',\n fontWeight: 'var(--f-theme-settings-heading3-font-weight)',\n fontFamily: 'var(--f-theme-settings-heading3-font-family)',\n color: 'var(--f-theme-settings-heading3-color)',\n },\n [TextStyles.heading4]: {\n fontSize: 'var(--f-theme-settings-heading4-font-size)',\n lineHeight: 'var(--f-theme-settings-heading4-line-height)',\n marginTop: 'var(--f-theme-settings-heading4-margin-top)',\n marginBottom: 'var(--f-theme-settings-heading4-margin-bottom)',\n textDecoration: 'var(--f-theme-settings-heading4-text-decoration)',\n fontStyle: 'var(--f-theme-settings-heading4-font-style)',\n textTransform: 'var(--f-theme-settings-heading4-text-transform)' as CSSProperties['textTransform'],\n letterSpacing: 'var(--f-theme-settings-heading4-letter-spacing)',\n fontWeight: 'var(--f-theme-settings-heading4-font-weight)',\n fontFamily: 'var(--f-theme-settings-heading4-font-family)',\n color: 'var(--f-theme-settings-heading4-color)',\n },\n [TextStyles.custom1]: {\n fontSize: 'var(--f-theme-settings-custom1-font-size)',\n lineHeight: 'var(--f-theme-settings-custom1-line-height)',\n marginTop: 'var(--f-theme-settings-custom1-margin-top)',\n marginBottom: 'var(--f-theme-settings-custom1-margin-bottom)',\n textDecoration: 'var(--f-theme-settings-custom1-text-decoration)',\n fontStyle: 'var(--f-theme-settings-custom1-font-style)',\n textTransform: 'var(--f-theme-settings-custom1-text-transform)' as CSSProperties['textTransform'],\n letterSpacing: 'var(--f-theme-settings-custom1-letter-spacing)',\n fontWeight: 'var(--f-theme-settings-custom1-font-weight)',\n fontFamily: 'var(--f-theme-settings-custom1-font-family)',\n color: 'var(--f-theme-settings-custom1-color)',\n },\n [TextStyles.custom2]: {\n fontSize: 'var(--f-theme-settings-custom2-font-size)',\n lineHeight: 'var(--f-theme-settings-custom2-line-height)',\n marginTop: 'var(--f-theme-settings-custom2-margin-top)',\n marginBottom: 'var(--f-theme-settings-custom2-margin-bottom)',\n textDecoration: 'var(--f-theme-settings-custom2-text-decoration)',\n fontStyle: 'var(--f-theme-settings-custom2-font-style)',\n textTransform: 'var(--f-theme-settings-custom2-text-transform)' as CSSProperties['textTransform'],\n letterSpacing: 'var(--f-theme-settings-custom2-letter-spacing)',\n fontWeight: 'var(--f-theme-settings-custom2-font-weight)',\n fontFamily: 'var(--f-theme-settings-custom2-font-family)',\n color: 'var(--f-theme-settings-custom2-color)',\n },\n [TextStyles.custom3]: {\n fontSize: 'var(--f-theme-settings-custom3-font-size)',\n lineHeight: 'var(--f-theme-settings-custom3-line-height)',\n marginTop: 'var(--f-theme-settings-custom3-margin-top)',\n marginBottom: 'var(--f-theme-settings-custom3-margin-bottom)',\n textDecoration: 'var(--f-theme-settings-custom3-text-decoration)',\n fontStyle: 'var(--f-theme-settings-custom3-font-style)',\n textTransform: 'var(--f-theme-settings-custom3-text-transform)' as CSSProperties['textTransform'],\n letterSpacing: 'var(--f-theme-settings-custom3-letter-spacing)',\n fontWeight: 'var(--f-theme-settings-custom3-font-weight)',\n fontFamily: 'var(--f-theme-settings-custom3-font-family)',\n color: 'var(--f-theme-settings-custom3-color)',\n },\n [TextStyles.p]: {\n fontSize: 'var(--f-theme-settings-body-font-size)',\n lineHeight: 'var(--f-theme-settings-body-line-height)',\n marginTop: 'var(--f-theme-settings-body-margin-top)',\n marginBottom: 'var(--f-theme-settings-body-margin-bottom)',\n textDecoration: 'var(--f-theme-settings-body-text-decoration)',\n fontStyle: 'var(--f-theme-settings-body-font-style)',\n textTransform: 'var(--f-theme-settings-body-text-transform)' as CSSProperties['textTransform'],\n letterSpacing: 'var(--f-theme-settings-body-letter-spacing)',\n fontWeight: 'var(--f-theme-settings-body-font-weight)',\n fontFamily: 'var(--f-theme-settings-body-font-family)',\n color: 'var(--f-theme-settings-body-color)',\n },\n [TextStyles.quote]: {\n fontSize: 'var(--f-theme-settings-quote-font-size)',\n lineHeight: 'var(--f-theme-settings-quote-line-height)',\n marginTop: 'var(--f-theme-settings-quote-margin-top)',\n marginBottom: 'var(--f-theme-settings-quote-margin-bottom)',\n textDecoration: 'var(--f-theme-settings-quote-text-decoration)',\n fontStyle: 'var(--f-theme-settings-quote-font-style)',\n textTransform: 'var(--f-theme-settings-quote-text-transform)' as CSSProperties['textTransform'],\n letterSpacing: 'var(--f-theme-settings-quote-letter-spacing)',\n fontWeight: 'var(--f-theme-settings-quote-font-weight)',\n fontFamily: 'var(--f-theme-settings-quote-font-family)',\n color: 'var(--f-theme-settings-quote-color)',\n },\n [TextStyles.imageCaption]: {\n fontSize: 'var(--f-theme-settings-image-caption-font-size)',\n lineHeight: 'var(--f-theme-settings-image-caption-line-height)',\n marginTop: 'var(--f-theme-settings-image-caption-margin-top)',\n marginBottom: 'var(--f-theme-settings-image-caption-margin-bottom)',\n textDecoration: 'var(--f-theme-settings-image-caption-text-decoration)',\n fontStyle: 'var(--f-theme-settings-image-caption-font-style)',\n textTransform: 'var(--f-theme-settings-image-caption-text-transform)' as CSSProperties['textTransform'],\n letterSpacing: 'var(--f-theme-settings-image-caption-letter-spacing)',\n fontWeight: 'var(--f-theme-settings-image-caption-font-weight)',\n fontFamily: 'var(--f-theme-settings-image-caption-font-family)',\n color: 'var(--f-theme-settings-image-caption-color)',\n },\n [TextStyles.imageTitle]: {\n fontSize: 'var(--f-theme-settings-image-title-font-size)',\n lineHeight: 'var(--f-theme-settings-image-title-line-height)',\n marginTop: 'var(--f-theme-settings-image-title-margin-top)',\n marginBottom: 'var(--f-theme-settings-image-title-margin-bottom)',\n textDecoration: 'var(--f-theme-settings-image-title-text-decoration)',\n fontStyle: 'var(--f-theme-settings-image-title-font-style)',\n textTransform: 'var(--f-theme-settings-image-title-text-transform)' as CSSProperties['textTransform'],\n letterSpacing: 'var(--f-theme-settings-image-title-letter-spacing)',\n fontWeight: 'var(--f-theme-settings-image-title-font-weight)',\n fontFamily: 'var(--f-theme-settings-image-title-font-family)',\n color: 'var(--f-theme-settings-image-title-color)',\n },\n [LINK_PLUGIN]: {\n fontSize: 'var(--f-theme-settings-link-font-size)',\n lineHeight: 'var(--f-theme-settings-link-line-height)',\n marginTop: 'var(--f-theme-settings-link-margin-top)',\n marginBottom: 'var(--f-theme-settings-link-margin-bottom)',\n textDecoration: 'var(--f-theme-settings-link-text-decoration)',\n fontStyle: 'var(--f-theme-settings-link-font-style)',\n textTransform: 'var(--f-theme-settings-link-text-transform)' as CSSProperties['textTransform'],\n letterSpacing: 'var(--f-theme-settings-link-letter-spacing)',\n fontWeight: 'var(--f-theme-settings-link-font-weight)',\n fontFamily: 'var(--f-theme-settings-link-font-family)',\n color: 'var(--f-theme-settings-link-color)',\n },\n ...BlockButtonStyles,\n};\n"],"names":["TextStyles","BlockStyles","LINK_PLUGIN","BlockButtonStyles"],"mappings":";;AAMY,IAAAA,sBAAAA,OACRA,EAAA,WAAW,YACXA,EAAA,WAAW,YACXA,EAAA,WAAW,YACXA,EAAA,WAAW,YACXA,EAAA,UAAU,WACVA,EAAA,UAAU,WACVA,EAAA,UAAU,WACVA,EAAA,QAAQ,SACRA,EAAA,eAAe,gBACfA,EAAA,aAAa,cACbA,EAAA,IAAI,KAXIA,IAAAA,KAAA,CAAA,CAAA;AAaL,MAAMC,IAAyE;AAAA,EACjF,UAAsB;AAAA,IACnB,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,cAAc;AAAA,IACd,gBAAgB;AAAA,IAChB,WAAW;AAAA,IACX,eAAe;AAAA,IACf,eAAe;AAAA,IACf,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,OAAO;AAAA,EACX;AAAA,EACC,UAAsB;AAAA,IACnB,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,cAAc;AAAA,IACd,gBAAgB;AAAA,IAChB,WAAW;AAAA,IACX,eAAe;AAAA,IACf,eAAe;AAAA,IACf,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,OAAO;AAAA,EACX;AAAA,EACC,UAAsB;AAAA,IACnB,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,cAAc;AAAA,IACd,gBAAgB;AAAA,IAChB,WAAW;AAAA,IACX,eAAe;AAAA,IACf,eAAe;AAAA,IACf,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,OAAO;AAAA,EACX;AAAA,EACC,UAAsB;AAAA,IACnB,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,cAAc;AAAA,IACd,gBAAgB;AAAA,IAChB,WAAW;AAAA,IACX,eAAe;AAAA,IACf,eAAe;AAAA,IACf,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,OAAO;AAAA,EACX;AAAA,EACC,SAAqB;AAAA,IAClB,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,cAAc;AAAA,IACd,gBAAgB;AAAA,IAChB,WAAW;AAAA,IACX,eAAe;AAAA,IACf,eAAe;AAAA,IACf,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,OAAO;AAAA,EACX;AAAA,EACC,SAAqB;AAAA,IAClB,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,cAAc;AAAA,IACd,gBAAgB;AAAA,IAChB,WAAW;AAAA,IACX,eAAe;AAAA,IACf,eAAe;AAAA,IACf,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,OAAO;AAAA,EACX;AAAA,EACC,SAAqB;AAAA,IAClB,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,cAAc;AAAA,IACd,gBAAgB;AAAA,IAChB,WAAW;AAAA,IACX,eAAe;AAAA,IACf,eAAe;AAAA,IACf,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,OAAO;AAAA,EACX;AAAA,EACC,GAAe;AAAA,IACZ,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,cAAc;AAAA,IACd,gBAAgB;AAAA,IAChB,WAAW;AAAA,IACX,eAAe;AAAA,IACf,eAAe;AAAA,IACf,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,OAAO;AAAA,EACX;AAAA,EACC,OAAmB;AAAA,IAChB,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,cAAc;AAAA,IACd,gBAAgB;AAAA,IAChB,WAAW;AAAA,IACX,eAAe;AAAA,IACf,eAAe;AAAA,IACf,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,OAAO;AAAA,EACX;AAAA,EACC,cAA0B;AAAA,IACvB,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,cAAc;AAAA,IACd,gBAAgB;AAAA,IAChB,WAAW;AAAA,IACX,eAAe;AAAA,IACf,eAAe;AAAA,IACf,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,OAAO;AAAA,EACX;AAAA,EACC,YAAwB;AAAA,IACrB,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,cAAc;AAAA,IACd,gBAAgB;AAAA,IAChB,WAAW;AAAA,IACX,eAAe;AAAA,IACf,eAAe;AAAA,IACf,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,OAAO;AAAA,EACX;AAAA,EACA,CAACC,CAAW,GAAG;AAAA,IACX,UAAU;AAAA,IACV,YAAY;AAAA,IACZ,WAAW;AAAA,IACX,cAAc;AAAA,IACd,gBAAgB;AAAA,IAChB,WAAW;AAAA,IACX,eAAe;AAAA,IACf,eAAe;AAAA,IACf,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,OAAO;AAAA,EACX;AAAA,EACA,GAAGC;AACP;"}
package/dist/index.cjs.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("@frontify/sidebar-settings"),s=require("react/jsx-runtime"),i=require("@frontify/fondue"),x=require("react"),G=require("@frontify/app-bridge"),P=require("@dnd-kit/core"),oe=require("@dnd-kit/sortable"),_e=require("@react-aria/focus"),Ut=require("@dnd-kit/modifiers"),o=require("@udecode/plate"),Ve=require("slate-react"),Ht=require("@react-stately/overlays"),_t=require("slate"),O=require("@ctrl/tinycolor");const U=e=>e.filter(Boolean).join(" "),Vt=({onDrop:e,label:t,icon:n,secondaryLabel:r,isLoading:a,fillParentContainer:l,onAssetChooseClick:u,onUploadClick:d,withMenu:c=!0,onClick:m,validFileType:f,verticalLayout:g})=>{const[w,b]=x.useState(!1),[p,S]=x.useState(),L=x.useRef(null),[E,N]=x.useState(void 0),D=k=>{if(k.preventDefault(),b(!1),!X(k.dataTransfer.files)){N("Invalid"),setTimeout(()=>{N(void 0)},1e3);return}e==null||e(k.dataTransfer.files)},X=k=>{if(!f)return!0;for(let B=0;B<k.length;B++){const A=k[B].name.split(".").pop()??"";if(!G.FileExtensionSets[f].includes(A))return!1}return!0},F=k=>{if(!L.current||a)return;const{left:B,top:A}=L.current.getBoundingClientRect(),Q=k.clientX-B,re=k.clientY-A;S([Q,re])};return s.jsxs("button",{ref:L,"data-test-id":"block-inject-button",className:U(["tw-font-body tw-relative tw-text-sm tw-leading-4 tw-border tw-flex tw-items-center tw-justify-center tw-cursor-pointer tw-gap-3 tw-w-full first:tw-rounded-tl last:tw-rounded-br",g?"[&:not(:first-child)]:tw-border-t-0 first:tw-rounded-tr last:tw-rounded-bl":"[&:not(:first-child)]:tw-border-l-0 first:tw-rounded-bl last:tw-rounded-tr",l?"tw-h-full":"tw-h-[72px]",w&&!a?"tw-border-dashed":"tw-border-solid",p&&"tw-bg-blank-state-pressed-inverse",w&&"tw-bg-blank-state-weak-inverse",E?"!tw-border-red-50 !tw-cursor-not-allowed":" tw-border-blank-state-line",a||p||w||E?"":"tw-text-text-weak hover:tw-text-blank-state-hover hover:tw-bg-blank-state-hover-inverse hover:tw-border-blank-state-line-hover active:tw-text-blank-state-pressed active:tw-bg-blank-state-pressed-inverse active:tw-border-blank-state-line-hover",(w||p)&&!E?"[&>*]:tw-pointer-events-none tw-border-blank-state-line-hover":"tw-bg-blank-state-shaded-inverse tw-text-blank-state-shaded"]),onDragEnter:e?k=>{var B;if(b(!0),f==="Images")for(const A of Array.from(k.dataTransfer.items))(B=A==null?void 0:A.type)!=null&&B.startsWith("image/")?N(void 0):N("Invalid")}:void 0,onDragLeave:e?()=>{b(!1),N(void 0)}:void 0,onDrop:e?D:void 0,onClick:k=>{c&&F(k),m==null||m()},children:[a?s.jsx(i.LoadingCircle,{}):E?s.jsxs("div",{className:" tw-flex tw-items-center tw-justify-center tw-text-red-60 tw-font-medium",children:[s.jsx(i.IconExclamationMarkTriangle,{}),E]}):s.jsxs(s.Fragment,{children:[n&&s.jsx("div",{children:n}),(t||r)&&s.jsxs("div",{className:"tw-flex tw-flex-col tw-items-start",children:[t&&s.jsx("div",{className:"tw-font-medium",children:t}),r&&s.jsx("div",{className:"tw-font-normal",children:r})]})]}),p&&s.jsx("div",{className:"tw-absolute tw-left-0 tw-top-full tw-z-20",style:{left:p[0],top:p[1]},children:s.jsx(i.Flyout,{onOpenChange:k=>!k&&S(void 0),isOpen:!0,fitContent:!0,hug:!1,legacyFooter:!1,trigger:s.jsx("div",{}),children:s.jsx(i.ActionMenu,{menuBlocks:[{id:"menu",menuItems:[...d?[{id:"upload",size:i.MenuItemContentSize.XSmall,title:"Upload asset",onClick:()=>{d(),S(void 0)},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:s.jsx(i.IconArrowCircleUp20,{})})}]:[],...u?[{id:"asset",size:i.MenuItemContentSize.XSmall,title:"Browse asset",onClick:()=>{u(),S(void 0)},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:s.jsx(i.IconImageStack20,{})})}]:[]]}]})})})]})},K=e=>{const t=r=>typeof r=="object"&&["red","green","blue"].every(l=>r.hasOwnProperty(l)),n=r=>{const a=typeof r.alpha=="number"?r.alpha:1;return{r:r.red,g:r.green,b:r.blue,a}};return t(e)?n(e):e},zt=e=>typeof e=="object"&&["red","green","blue"].every(n=>e==null?void 0:e.hasOwnProperty(n)),$t=(e,t)=>{const n=zt(e)?K(e):e,r=O(n);return t?r.getBrightness()<t:r.isDark()||r.getAlpha()>.25&&r.getAlpha()<1},Wt=e=>O(K(e)).toHex8String(),qt=e=>O(K(e)).toHexString(),Ee=e=>O(K(e)).toRgbString(),Gt=(e,t)=>O(t).setAlpha(e).toRgbString(),Kt=e=>{const{r:t,g:n,b:r,a}=O(e);return{red:t,green:n,blue:r,alpha:a}},He=e=>typeof e=="object"&&["red","green","blue"].every(n=>e==null?void 0:e.hasOwnProperty(n)),Xt=(e,t)=>{const n=He(e)?K(e):e,r=He(t)?K(t):t;let a=O(n);const l=O(r);for(;O.readability(a,l)<4.5;)a=a.darken(1);return a.toRgbString()},Qt=(e,t,n)=>{const r=[...e],a=n<0?r.length+n:n;if(a>=0&&a<r.length){const l=r.splice(t,1)[0];r.splice(a,0,l)}return r},Yt=e=>({backgroundColor:Ee(e)});var M=(e=>(e.Solid="Solid",e.Dashed="Dashed",e.Dotted="Dotted",e))(M||{});const ze={Solid:"solid",Dotted:"dotted",Dashed:"dashed"};var H=(e=>(e.None="None",e.Small="Small",e.Medium="Medium",e.Large="Large",e))(H||{});const W={None:"0px",Small:"2px",Medium:"4px",Large:"12px"};var V=(e=>(e.None="None",e.Small="Small",e.Medium="Medium",e.Large="Large",e))(V||{});const J={None:"0px",Small:"24px",Medium:"36px",Large:"60px"};var z=(e=>(e.None="None",e.Small="Small",e.Medium="Medium",e.Large="Large",e))(z||{});const Z={None:"0px",Small:"24px",Medium:"36px",Large:"60px"};var q=(e=>(e.Global="Global",e.Custom="Custom",e))(q||{}),$=(e=>(e.Auto="Auto",e.S="S",e.M="M",e.L="L",e))($||{});const $e={Auto:"4px",S:"10px",M:"30px",L:"50px"},Jt={red:241,green:241,blue:241,alpha:1},We={red:234,green:235,blue:235,alpha:1},Zt="1px",ae="24px",ie="24px",en=(e=M.Solid,t="1px",n=We)=>({borderStyle:ze[e],borderWidth:t,borderColor:Ee(n)}),tn=(e,t=!1,n)=>({borderRadius:t?n:W[e]}),qe="Drag or press ↵ to move",Ge="Move with ↑↓←→ and confirm with ↵",nn=({items:e,flyoutItems:t,isFlyoutOpen:n,setIsFlyoutOpen:r,isDragging:a,isFlyoutDisabled:l})=>s.jsx("div",{"data-test-id":"block-item-wrapper-toolbar",className:"tw-flex tw-justify-end",children:s.jsxs("div",{className:"tw-bg-white tw-text-box-selected-inverse tw-pointer-events-auto tw-flex tw-flex-shrink-0 tw-gap-[2px] tw-px-[1px] tw-spacing tw-items-center tw-h-7 tw-self-start tw-border tw-border-box-selected-inverse tw-rounded",children:[e.map((u,d)=>"draggableProps"in u?s.jsx(i.LegacyTooltip,{withArrow:!0,hoverDelay:0,enterDelay:300,open:a,position:i.TooltipPosition.Top,content:s.jsx("div",{children:a?Ge:u.tooltip??qe}),triggerElement:s.jsx("button",{ref:u.setActivatorNodeRef,"data-test-id":"block-item-wrapper-toolbar-btn",...u.draggableProps,className:U(["tw-bg-base tw-inline-flex tw-items-center tw-justify-center tw-w-6 tw-h-6 tw-rounded-sm",a?"tw-cursor-grabbing tw-bg-box-selected-pressed":"tw-cursor-grab hover:tw-bg-box-selected-hover"]),children:u.icon})},d):s.jsx(i.LegacyTooltip,{withArrow:!0,enterDelay:300,hoverDelay:0,disabled:a,position:i.TooltipPosition.Top,content:s.jsx("div",{children:u.tooltip??""}),triggerElement:s.jsx("button",{"data-test-id":"block-item-wrapper-toolbar-btn",onClick:u.onClick,className:"tw-bg-base hover:tw-bg-box-selected-hover active:tw-bg-box-selected-pressed tw-cursor-pointer tw-inline-flex tw-items-center tw-justify-center tw-w-6 tw-h-6 tw-rounded-sm",children:u.icon})},d)),t.length>0&&s.jsx("div",{className:"tw-flex tw-flex-shrink-0 tw-flex-1 tw-h-6",children:s.jsx(i.Flyout,{isOpen:n&&!a,isTriggerDisabled:l,legacyFooter:!1,fitContent:!0,hug:!1,onOpenChange:r,trigger:s.jsx(i.LegacyTooltip,{withArrow:!0,hoverDelay:0,enterDelay:300,disabled:a,position:i.TooltipPosition.Top,content:s.jsx("div",{children:"Options"}),triggerElement:s.jsx("div",{"data-test-id":"block-item-wrapper-toolbar-flyout",className:"tw-bg-base hover:tw-bg-box-selected-hover active:tw-bg-box-selected-pressed tw-cursor-pointer tw-inline-flex tw-items-center tw-justify-center tw-w-6 tw-h-6 tw-rounded-sm",children:s.jsx(i.IconDotsHorizontal16,{})})}),children:s.jsx(i.ActionMenu,{menuBlocks:t.map((u,d)=>({id:d.toString(),menuItems:u.map((c,m)=>({id:d.toString()+m.toString(),size:i.MenuItemContentSize.XSmall,title:c.title,style:c.style,onClick:()=>{r(!1),c.onClick()},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:c.icon})}))}))})})})]})}),sn=({children:e,toolbarFlyoutItems:t,toolbarItems:n,shouldHideWrapper:r,shouldHideComponent:a=!1,isDragging:l,shouldFillContainer:u,outlineOffset:d=2,shouldBeShown:c=!1})=>{const[m,f]=x.useState(c),[g,w]=x.useState(!1),b=x.useRef(null);if(x.useEffect(()=>{m||w(!0)},[m]),r)return e;const p=n==null?void 0:n.filter(S=>S!==void 0);return s.jsxs("div",{ref:b,onFocus:()=>w(!1),onPointerEnter:()=>w(!1),"data-test-id":"block-item-wrapper",style:{outlineOffset:d},className:U(["tw-relative tw-group tw-outline-1 tw-outline-box-selected-inverse",u&&"tw-flex-1 tw-h-full tw-w-full","hover:tw-outline focus-within:tw-outline",(m||c)&&"tw-outline",a&&"tw-opacity-0"]),children:[s.jsx("div",{style:{right:-1-d,bottom:`calc(100% - ${2+d}px)`},className:U(["tw-pointer-events-none tw-absolute tw-bottom-[calc(100%-4px)] tw-right-[-3px] tw-w-full tw-opacity-0 tw-z-10","group-hover:tw-opacity-100 group-focus:tw-opacity-100 focus-within:tw-opacity-100",(m||c)&&"tw-opacity-100"]),children:s.jsx(nn,{isFlyoutOpen:m,isFlyoutDisabled:g,setIsFlyoutOpen:f,flyoutItems:t,items:p,isDragging:l})}),e]})},rn=e=>e==="IMAGE"?s.jsx(i.IconImage24,{}):e==="VIDEO"?s.jsx(i.IconPlayFrame24,{}):e==="AUDIO"?s.jsx(i.IconMusicNote24,{}):s.jsx(i.IconDocument24,{}),Pe=x.forwardRef(({item:e,isEditing:t,draggableProps:n,transformStyle:r,isDragging:a,isOverlay:l,isLoading:u,onDelete:d,onReplaceWithBrowse:c,onReplaceWithUpload:m},f)=>{const[g,w]=x.useState(),[b,{selectedFiles:p}]=G.useFileInput({multiple:!0,accept:"image/*"}),[S,{results:L,doneAll:E}]=G.useAssetUpload(),{focusProps:N,isFocusVisible:D}=_e.useFocusRing();x.useEffect(()=>{p&&S(p[0])},[p]),x.useEffect(()=>{E&&m(L[0])},[E,L]);const X=(k,B)=>{fetch(k).then(A=>{A.blob().then(Q=>{const re=URL.createObjectURL(Q),Y=document.createElement("a");Y.href=re,Y.download=B,Y.click()})})},F=u||p&&!E;return s.jsxs("button",{"aria-label":"Download attachment","data-test-id":"attachments-item",onClick:()=>X(e.genericUrl,e.fileName),ref:f,style:{...r,opacity:a&&!l?.3:1,fontFamily:"var(-f-theme-settings-body-font-family)"},className:U(["tw-cursor-pointer tw-text-left tw-w-full tw-relative tw-flex tw-gap-3 tw-px-5 tw-py-3 tw-items-center tw-group hover:tw-bg-box-neutral-hover",a?"tw-bg-box-neutral-hover":""]),children:[s.jsx("div",{className:"tw-text-text-weak group-hover:tw-text-box-neutral-inverse-hover",children:F?s.jsx(i.LoadingCircle,{size:i.LoadingCircleSize.Small}):rn(e.objectType)}),s.jsxs("div",{className:"tw-text-s tw-flex-1 tw-min-w-0",children:[s.jsx("div",{className:"tw-whitespace-nowrap tw-overflow-hidden tw-text-ellipsis tw-font-bold tw-text-text-weak group-hover:tw-text-box-neutral-inverse-hover",children:e.title}),s.jsx("div",{className:"tw-text-text-weak",children:`${e.fileSizeHumanReadable} - ${e.extension}`})]}),t&&s.jsxs("div",{"data-test-id":"attachments-actionbar",className:U(["tw-flex tw-gap-0.5 group-focus:tw-opacity-100 focus-visible:tw-opacity-100 focus-within:tw-opacity-100 group-hover:tw-opacity-100",l||(g==null?void 0:g.id)===e.id?"tw-opacity-100":"tw-opacity-0"]),children:[s.jsx("button",{...N,...n,"aria-label":"Drag attachment",className:U([" tw-border-button-border tw-bg-button-background active:tw-bg-button-background-pressed tw-group tw-border tw-box-box tw-relative tw-flex tw-items-center tw-justify-center tw-outline-none tw-font-medium tw-rounded tw-h-9 tw-w-9 ",a||l?"tw-cursor-grabbing tw-bg-button-background-pressed hover:tw-bg-button-background-pressed":"tw-cursor-grab hover:tw-bg-button-background-hover",D&&i.FOCUS_STYLE,D&&"tw-z-[2]"]),children:s.jsx(i.IconGrabHandle20,{})}),s.jsx("div",{"data-test-id":"attachments-actionbar-flyout",children:s.jsx(i.Flyout,{placement:i.FlyoutPlacement.Right,isOpen:(g==null?void 0:g.id)===e.id,fitContent:!0,legacyFooter:!1,onOpenChange:k=>w(k?e:void 0),trigger:(k,B)=>s.jsx(i.Button,{ref:B,icon:s.jsx(i.IconPen20,{}),emphasis:i.ButtonEmphasis.Default,onClick:()=>w(e)}),children:s.jsx(i.ActionMenu,{menuBlocks:[{id:"menu",menuItems:[{id:"upload",size:i.MenuItemContentSize.XSmall,title:"Replace with upload",onClick:()=>{b(),w(void 0)},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:s.jsx(i.IconArrowCircleUp20,{})})},{id:"asset",size:i.MenuItemContentSize.XSmall,title:"Replace with asset",onClick:()=>{c(),w(void 0)},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:s.jsx(i.IconImageStack20,{})})}]},{id:"menu-delete",menuItems:[{id:"delete",size:i.MenuItemContentSize.XSmall,title:"Delete",style:i.MenuItemStyle.Danger,onClick:()=>{d(),w(void 0)},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:s.jsx(i.IconTrashBin20,{})})}]}]})})})]})]})});Pe.displayName="AttachmentItem";const an=e=>{const{attributes:t,listeners:n,setNodeRef:r,transform:a,transition:l,isDragging:u}=oe.useSortable({id:e.item.id}),d={transform:a?`translate(${a.x}px, ${a.y}px)`:"",transition:l,zIndex:u?2:1},c={...t,...n};return s.jsx(Pe,{ref:r,isDragging:u,transformStyle:d,draggableProps:c,...e})},on=({items:e=[],onDelete:t,onReplaceWithBrowse:n,onReplaceWithUpload:r,onBrowse:a,onUpload:l,onSorted:u,appBridge:d})=>{const[c,m]=x.useState(e),[f,g]=x.useState(!1),w=P.useSensors(P.useSensor(P.PointerSensor),P.useSensor(P.KeyboardSensor)),[b,p]=x.useState(void 0),[S,L]=x.useState(!1),[E,N]=x.useState([]),[D,X]=x.useState(null),F=G.useEditorState(d),k=c==null?void 0:c.find(v=>v.id===b),[B,{results:A,doneAll:Q}]=G.useAssetUpload({onUploadProgress:()=>!S&&L(!0)});x.useEffect(()=>{m(e)},[e]),x.useEffect(()=>{D&&(L(!0),B(D))},[D]),x.useEffect(()=>{(async()=>{Q&&(await l(A),L(!1))})()},[Q,A]);const re=()=>{g(!1),d.openAssetChooser(v=>{a(v),d.closeAssetChooser(),g(!0)},{multiSelection:!0,selectedValueIds:c.map(v=>v.id)})},Y=v=>{g(!1),d.openAssetChooser(async R=>{g(!0),d.closeAssetChooser(),N([...E,v.id]),await n(v,R[0]),N(E.filter(_=>_!==v.id))},{multiSelection:!1,selectedValueIds:c.map(R=>R.id)})},Oe=async(v,R)=>{N([...E,v.id]),await r(v,R),N(E.filter(_=>_!==v.id))},Ft=v=>{const{active:R}=v;p(R.id)},Mt=v=>{const{active:R,over:_}=v;if(_&&R.id!==_.id&&c){const Dt=c.findIndex(xe=>xe.id===R.id),Ot=c.findIndex(xe=>xe.id===_.id),Ue=oe.arrayMove(c,Dt,Ot);m(Ue),u(Ue)}p(void 0)};return F||((c==null?void 0:c.length)??0)>0?s.jsx(i.LegacyTooltip,{withArrow:!0,position:i.TooltipPosition.Top,content:"Attachments",disabled:f,enterDelay:500,triggerElement:s.jsx("div",{"data-test-id":"attachments-flyout-button",children:s.jsx(i.Flyout,{placement:i.FlyoutPlacement.BottomRight,onOpenChange:v=>g(k?!0:v),isOpen:f,hug:!1,fitContent:!0,legacyFooter:!1,trigger:s.jsxs("div",{className:"tw-flex tw-text-[13px] tw-font-body tw-items-center tw-gap-1 tw-rounded-full tw-bg-box-neutral-strong-inverse hover:tw-bg-box-neutral-strong-inverse-hover active:tw-bg-box-neutral-strong-inverse-pressed tw-text-box-neutral-strong tw-outline tw-outline-1 tw-outline-offset-[1px] tw-p-[6px] tw-outline-line",children:[s.jsx(i.IconPaperclip16,{}),s.jsx("div",{children:e.length>0?e.length:"Add"}),s.jsx(i.IconCaretDown12,{})]}),children:s.jsxs("div",{className:"tw-w-[300px]",children:[c.length>0&&s.jsxs(P.DndContext,{sensors:w,collisionDetection:P.closestCenter,onDragStart:Ft,onDragEnd:Mt,modifiers:[Ut.restrictToWindowEdges],children:[s.jsx(oe.SortableContext,{items:c,strategy:oe.rectSortingStrategy,children:s.jsx("div",{className:"tw-border-b tw-border-b-line",children:c.map(v=>s.jsx(an,{isEditing:F,isLoading:E.includes(v.id),item:v,onDelete:()=>t(v),onReplaceWithBrowse:()=>Y(v),onReplaceWithUpload:R=>Oe(v,R)},v.id))})}),s.jsx(P.DragOverlay,{children:k&&s.jsx(Pe,{isOverlay:!0,isEditing:F,item:k,isDragging:!0,onDelete:()=>t(k),onReplaceWithBrowse:()=>Y(k),onReplaceWithUpload:v=>Oe(k,v)},b)})]}),F&&s.jsxs("div",{className:"tw-px-5 tw-py-3",children:[s.jsx("div",{className:"tw-font-body tw-font-medium tw-text-text tw-text-s tw-my-4",children:"Add attachments"}),s.jsx(i.AssetInput,{isLoading:S,size:i.AssetInputSize.Small,onUploadClick:v=>X(v),onLibraryClick:re})]})]})})})}):null},ln=({onDownload:e})=>{const{isFocused:t,focusProps:n}=_e.useFocusRing();return s.jsx(i.LegacyTooltip,{withArrow:!0,position:i.TooltipPosition.Top,content:"Download",enterDelay:500,triggerElement:s.jsx("button",{tabIndex:0,"aria-label":"Download",...n,className:U(["tw-outline-none tw-rounded",t&&i.FOCUS_STYLE]),onClick:e,onPointerDown:r=>r.preventDefault(),children:s.jsx("span",{"data-test-id":"download-button",className:"tw-flex tw-text-xs tw-font-body tw-items-center tw-gap-1 tw-rounded-full tw-bg-box-neutral-strong-inverse hover:tw-bg-box-neutral-strong-inverse-hover active:tw-bg-box-neutral-strong-inverse-pressed tw-text-box-neutral-strong tw-outline tw-outline-1 tw-outline-offset-1 tw-p-1.5 tw-outline-line",children:s.jsx(i.IconArrowCircleDown16,{})})})})},cn=({value:e="",gap:t,columns:n,show:r=!0,plugins:a})=>{const[l,u]=x.useState(null);return x.useEffect(()=>{(async()=>u(await i.serializeRawToHtmlAsync(e,a,n,t)))()},[e,n,t,a]),!r||l==="<br />"?null:l!==null?s.jsx("div",{className:"tw-w-full","data-test-id":"rte-content-html",dangerouslySetInnerHTML:{__html:l}}):s.jsx("div",{className:"tw-rounded-sm tw-bg-base-alt tw-animate-pulse tw-h-full tw-min-h-[10px] tw-w-full"})},Ke=e=>{if(!e)return!1;const t=n=>n.some(r=>r.text?r.text!=="":r.children?t(r.children):!1);try{const n=JSON.parse(e);return t(n)}catch{return!1}},un=(e="p",t="",n)=>Ke(t)?t:JSON.stringify([{type:e,children:[{text:t,textStyle:e}],align:n}]),dn=[P.KeyboardCode.Down,P.KeyboardCode.Right,P.KeyboardCode.Up,P.KeyboardCode.Left],Xe=(e,t)=>(n,{currentCoordinates:r,context:{activeNode:a}})=>{if(n.preventDefault(),dn.includes(n.code)){const l=(a==null?void 0:a.offsetWidth)??0,u=(a==null?void 0:a.offsetHeight)??0;switch(n.code){case P.KeyboardCode.Right:return{...r,x:r.x+l+e};case P.KeyboardCode.Left:return{...r,x:r.x-l-e};case P.KeyboardCode.Down:return{...r,y:r.y+u+t};case P.KeyboardCode.Up:return{...r,y:r.y-u-t}}}},gn=(e,t,n)=>e===q.Custom?t:n,mn=e=>e.map(Qe),Qe=e=>({id:e.id,title:e.name,colors:e.colors.map(t=>({alpha:t.alpha?t.alpha/255:1,red:t.red??0,green:t.green??0,blue:t.blue??0,name:t.name??""}))}),Ye=(e,t)=>{const n=o.getAboveNode(e,{match:{type:o.ELEMENT_LINK}});return Array.isArray(n)?t(n[0]):""},Je=e=>Ye(e,t=>{var n,r;return((r=(n=t.chosenLink)==null?void 0:n.searchResult)==null?void 0:r.link)||""}),Ze=e=>Ye(e,t=>t.url||""),hn=e=>{var t,n;return e.url||((n=(t=e.chosenLink)==null?void 0:t.searchResult)==null?void 0:n.link)||""},Ie=/^\/(document|r)\/\S+$/i,me=e=>{if(Ie.test(e))return e;try{return new URL(e),e}catch{return`https://${e}`}},he=e=>{if(Ie.test(e))return!0;try{const t=new URL(e);return["http:","https:","mailto:","tel:"].includes(t.protocol)&&t.pathname!==""}catch{return!1}},te=e=>he(me(e))||e==="",et=(e,{type:t})=>{const{apply:n,normalizeNode:r}=e;return e.apply=a=>{if(a.type!=="set_selection"){n(a);return}const l=a.newProperties;if(!(l!=null&&l.focus)||!l.anchor||!o.isCollapsed(l)){n(a);return}const u=o.getAboveNode(e,{at:l,match:{type:o.getPluginType(e,C)}});if(u){const[,d]=u;let c;o.isStartPoint(e,l.focus,d)&&(c=o.getPreviousNodeEndPoint(e,d)),o.isEndPoint(e,l.focus,d)&&(c=o.getNextNodeStartPoint(e,d)),c&&(a.newProperties={anchor:c,focus:c})}n(a)},e.normalizeNode=([a,l])=>{if(a.type===o.getPluginType(e,C)){const u=e.selection;if(u&&o.isCollapsed(u)&&o.isEndPoint(e,u.focus,l)){const d=o.getNextNodeStartPoint(e,l);if(d)o.select(e,d);else{const c=_t.Path.next(l);o.insertNodes(e,{text:""},{at:c}),o.select(e,c)}}}r([a,l])},o.withRemoveEmptyNodes(e,o.mockPlugin({options:{types:t}}))},tt=(e,t,n)=>{o.insertNodes(e,[rt(e,t)],n)},Te=o.createStore("floatingButton")({openEditorId:null,mouseDown:!1,updated:!1,url:"",text:"",buttonStyle:"primary",newTab:!1,mode:"",isEditing:!1}).extendActions(e=>({reset:()=>{e.url(""),e.text(""),e.buttonStyle("primary"),e.newTab(!1),e.mode(""),e.isEditing(!1)}})).extendActions(e=>({show:(t,n)=>{e.mode(t),e.isEditing(!1),e.openEditorId(n)},hide:()=>{e.reset(),e.openEditorId(null)}})).extendSelectors(e=>({isOpen:t=>e.openEditorId===t})),I=Te.set,j=Te.get,ne=()=>Te.use,je=e=>{if(!e.selection)return;const{isUrl:t,forceSubmit:n}=o.getPluginOptions(e,C),r=j.url();if(!((t==null?void 0:t(r))||n))return;const l=j.text(),u=j.buttonStyle(),d=j.newTab()?void 0:"_self";return I.hide(),nt(e,{url:r,text:l,buttonStyle:u,target:d,isUrl:c=>n||!t?!0:t(c)}),setTimeout(()=>{o.focusEditor(e,e.selection??void 0)},0),!0},se=(e,t)=>o.withoutNormalizing(e,()=>{var n,r,a,l,u,d;if(t!=null&&t.split){if(o.getAboveNode(e,{at:(n=e.selection)==null?void 0:n.anchor,match:{type:o.getPluginType(e,C)}}))return o.splitNodes(e,{at:(r=e.selection)==null?void 0:r.anchor,match:f=>o.isElement(f)&&f.type===o.getPluginType(e,C)}),se(e,{at:(a=e.selection)==null?void 0:a.anchor}),!0;if(o.getAboveNode(e,{at:(l=e.selection)==null?void 0:l.focus,match:{type:o.getPluginType(e,C)}}))return o.splitNodes(e,{at:(u=e.selection)==null?void 0:u.focus,match:f=>o.isElement(f)&&f.type===o.getPluginType(e,C)}),se(e,{at:(d=e.selection)==null?void 0:d.focus}),!0}o.unwrapNodes(e,{match:{type:o.getPluginType(e,C)},...t})}),nt=(e,{url:t,text:n,buttonStyle:r,target:a,insertTextInButton:l,insertNodesOptions:u,isUrl:d=o.getPluginOptions(e,C).isUrl})=>{var E;const c=e.selection;if(!c)return;const m=o.getAboveNode(e,{at:c,match:{type:o.getPluginType(e,C)}});if(l&&m)return e.insertText(t),!0;if(!(d!=null&&d(t)))return;if(o.isDefined(n)&&n.length===0&&(n=t),m)return xn(t,e,m,a,r,n),!0;const f=o.findNode(e,{at:c,match:{type:o.getPluginType(e,C)}}),[g,w]=f??[],b=fn(e,w,n);if(o.isExpanded(c))return wn(m,e,t,r,a,n),!0;b&&o.removeNodes(e,{at:w});const p=o.getNodeProps(g??{}),S=(E=e.selection)==null?void 0:E.focus.path;if(!S)return;const L=o.getNodeLeaf(e,S);return n!=null&&n.length||(n=t),tt(e,{...p,url:t,target:a,children:[{...L,text:n}]},u),!0};function fn(e,t,n){return t&&(n==null?void 0:n.length)&&n!==o.getEditorString(e,t)}function wn(e,t,n,r,a,l){e?se(t,{at:e[1]}):se(t,{split:!0}),st(t,{url:n,buttonStyle:r,target:a}),Be(t,{url:n,target:a,text:l})}function xn(e,t,n,r,a,l){var u,d,c;(e!==((u=n[0])==null?void 0:u.url)||r!==((d=n[0])==null?void 0:d.target)||a!==((c=n[0])==null?void 0:c.buttonStyle))&&o.setNodes(t,{url:e,target:r,buttonStyle:a},{at:n[1]}),Be(t,{url:e,text:l,target:r})}const Be=(e,{text:t})=>{const n=o.getAboveNode(e,{match:{type:o.getPluginType(e,C)}});if(n){const[r,a]=n;if(t!=null&&t.length&&t!==o.getEditorString(e,a)){const l=r.children[0];o.replaceNodeChildren(e,{at:a,nodes:{...l,text:t},insertOptions:{select:!0}})}}},st=(e,{url:t,buttonStyle:n,target:r,...a})=>{o.wrapNodes(e,{type:o.getPluginType(e,C),url:t,buttonStyle:n,target:r,children:[]},{split:!0,...a})},yn=(e,t)=>{const n=o.getAboveNode(e,{match:{type:C}});return Array.isArray(n)?t(n[0]):""},Le=e=>yn(e,t=>t.url??""),rt=(e,{url:t,text:n="",buttonStyle:r="primary",target:a,children:l})=>({type:o.getPluginType(e,C),url:t,target:a,buttonStyle:r,children:l??[{text:n}]}),at=(e,{focused:t}={})=>{if(j.mode()==="edit"){fe(e);return}Ne(e,{focused:t})},fe=e=>{const t=o.findNode(e,{match:{type:o.getPluginType(e,C)}});if(!t)return;const[n,r]=t;let a=o.getEditorString(e,r);I.url(n.url),I.newTab(n.target===void 0),a===n.url&&(a=""),I.text(a),I.isEditing(!0)},Ne=(e,{focused:t}={})=>{j.mode()||!t||o.isRangeAcrossBlocks(e,{at:e.selection})||o.someNode(e,{match:{type:o.getPluginType(e,C)}})||(I.text(o.getEditorString(e,e.selection)),I.show("insert",e.id))},we={buttonPrimary:{fontFamily:"var(--f-theme-settings-button-primary-font-family)",fontSize:"var(--f-theme-settings-button-primary-font-size)",fontWeight:"var(--f-theme-settings-button-primary-font-weight)",lineHeight:"var(--f-theme-settings-button-primary-line-height)",paddingTop:"var(--f-theme-settings-button-primary-padding-top)",paddingRight:"var(--f-theme-settings-button-primary-padding-right)",paddingBottom:"var(--f-theme-settings-button-primary-padding-bottom)",paddingLeft:"var(--f-theme-settings-button-primary-padding-left)",fontStyle:"var(--f-theme-settings-button-primary-font-style)",textTransform:"var(--f-theme-settings-button-primary-text-transform)",backgroundColor:"var(--f-theme-settings-button-primary-background-color)",borderColor:"var(--f-theme-settings-button-primary-border-color)",borderRadius:"var(--f-theme-settings-button-primary-border-radius)",borderWidth:"var(--f-theme-settings-button-primary-border-width)",color:"var(--f-theme-settings-button-primary-color)",display:"inline-block",hover:{backgroundColor:"var(--f-theme-settings-button-primary-background-color-hover)",borderColor:"var(--f-theme-settings-button-primary-border-color-hover)",color:"var(--f-theme-settings-button-primary-color-hover)"}},buttonSecondary:{fontFamily:"var(--f-theme-settings-button-secondary-font-family)",fontSize:"var(--f-theme-settings-button-secondary-font-size)",fontWeight:"var(--f-theme-settings-button-secondary-font-weight)",lineHeight:"var(--f-theme-settings-button-secondary-line-height)",paddingTop:"var(--f-theme-settings-button-secondary-padding-top)",paddingRight:"var(--f-theme-settings-button-secondary-padding-right)",paddingBottom:"var(--f-theme-settings-button-secondary-padding-bottom)",paddingLeft:"var(--f-theme-settings-button-secondary-padding-left)",fontStyle:"var(--f-theme-settings-button-secondary-font-style)",textTransform:"var(--f-theme-settings-button-secondary-text-transform)",backgroundColor:"var(--f-theme-settings-button-secondary-background-color)",borderColor:"var(--f-theme-settings-button-secondary-border-color)",borderRadius:"var(--f-theme-settings-button-secondary-border-radius)",borderWidth:"var(--f-theme-settings-button-secondary-border-width)",color:"var(--f-theme-settings-button-secondary-color)",display:"inline-block",hover:{backgroundColor:"var(--f-theme-settings-button-secondary-background-color-hover)",borderColor:"var(--f-theme-settings-button-secondary-border-color-hover)",color:"var(--f-theme-settings-button-secondary-color-hover)"}},buttonTertiary:{fontFamily:"var(--f-theme-settings-button-tertiary-font-family)",fontSize:"var(--f-theme-settings-button-tertiary-font-size)",fontWeight:"var(--f-theme-settings-button-tertiary-font-weight)",lineHeight:"var(--f-theme-settings-button-tertiary-line-height)",paddingTop:"var(--f-theme-settings-button-tertiary-padding-top)",paddingRight:"var(--f-theme-settings-button-tertiary-padding-right)",paddingBottom:"var(--f-theme-settings-button-tertiary-padding-bottom)",paddingLeft:"var(--f-theme-settings-button-tertiary-padding-left)",fontStyle:"var(--f-theme-settings-button-tertiary-font-style)",textTransform:"var(--f-theme-settings-button-tertiary-text-transform)",backgroundColor:"var(--f-theme-settings-button-tertiary-background-color)",borderColor:"var(--f-theme-settings-button-tertiary-border-color)",borderRadius:"var(--f-theme-settings-button-tertiary-border-radius)",borderWidth:"var(--f-theme-settings-button-tertiary-border-width)",color:"var(--f-theme-settings-button-tertiary-color)",display:"inline-block",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)"}}},pn=e=>({...o.useElementProps({...e,elementToAttributes:n=>({url:n.href,buttonStyle:n.buttonStyle||"primary",target:n.target||"_blank"})}),onMouseOver:n=>{n.stopPropagation()}}),bn=e=>{const{href:t,target:n,buttonStyle:r}=pn(e),{attributes:a,children:l}=e;return s.jsx(vn,{attributes:a,href:t,target:n,styles:we[`button${r.charAt(0).toUpperCase()+r.slice(1)}`],children:l})},vn=({attributes:e,styles:t={hover:{}},children:n,href:r="#",target:a})=>{const[l,u]=x.useState(!1);return s.jsx("a",{...e,onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),href:r,target:a,style:l?{...t,...t.hover}:t,children:n})};class kn extends i.MarkupElement{constructor(t=C,n=bn){super(t,n)}}const Cn=({type:e,...t})=>{const n=o.useEditorRef(),r=!!o.isRangeInSameBlock(n,{at:n.selection}),a=!!(n!=null&&n.selection)&&o.someNode(n,{match:{type:e}});return s.jsx(o.ToolbarButton,{tooltip:i.getTooltip(r?`Button
2
- ${i.getHotkeyByPlatform("Ctrl+Shift+K")}`:"Buttons can only be set for a single text block."),classNames:i.getButtonClassNames(r),active:a,onMouseDown:async l=>{n&&(l.preventDefault(),l.stopPropagation(),o.focusEditor(n,n.selection??n.prevSelection??void 0),setTimeout(()=>{at(n,{focused:!0})},0))},...t})},Sn=({editor:e,id:t})=>s.jsx("div",{"data-plugin-id":t,children:s.jsx(Cn,{type:o.getPluginType(e,C),icon:s.jsx("span",{className:"tw-p-2 tw-h-8 tw-justify-center tw-items-center tw-flex",children:s.jsx(i.IconButton16,{})}),styles:i.buttonStyles})}),En=({floatingOptions:e,...t})=>{const n=o.useEditorRef(),r=Ve.useFocused(),a=o.useFloatingLinkSelectors().mode(),l=o.useFloatingLinkSelectors().isOpen(n.id),{triggerFloatingLinkHotkeys:u}=o.getPluginOptions(n,o.ELEMENT_LINK);o.useHotkeys(u,f=>{o.triggerFloatingLinkInsert(n,{focused:r})&&f.preventDefault()},{enableOnContentEditable:!0},[r]);const{update:d,style:c,floating:m}=o.useVirtualFloatingLink({editorId:n.id,open:l&&a==="insert",getBoundingClientRect:o.getSelectionBoundingClientRect,whileElementsMounted:()=>{},...e});return x.useEffect(()=>{l?(d(),o.floatingLinkActions.updated(!0)):o.floatingLinkActions.updated(!1)},[l,d]),o.useFloatingLinkEscape(),{style:{...c,zIndex:1e3},...t,ref:o.useComposedRef(t.ref,m)}},Pn=o.createComponentAs(e=>{var n;const t=En({...e,floatingOptions:{strategy:"absolute"}});return((n=t.style)==null?void 0:n.display)==="none"?null:o.createElementAs("div",t)}),In=o.createComponentAs(e=>{var n;const t=jn({...e,floatingOptions:{strategy:"absolute"}});return((n=t.style)==null?void 0:n.display)==="none"?null:o.createElementAs("div",t)});o.FloatingLink.EditRoot=In;o.FloatingLink.InsertRoot=Pn;const le=o.FloatingLink,ce="link-plugin";var y=(e=>(e.heading1="heading1",e.heading2="heading2",e.heading3="heading3",e.heading4="heading4",e.custom1="custom1",e.custom2="custom2",e.custom3="custom3",e.quote="quote",e.imageCaption="imageCaption",e.imageTitle="imageTitle",e.p="p",e))(y||{});const T={heading1:{fontSize:"var(--f-theme-settings-heading1-font-size)",lineHeight:"var(--f-theme-settings-heading1-line-height)",marginTop:"var(--f-theme-settings-heading1-margin-top)",marginBottom:"var(--f-theme-settings-heading1-margin-bottom)",textDecoration:"var(--f-theme-settings-heading1-text-decoration)",fontStyle:"var(--f-theme-settings-heading1-font-style)",textTransform:"var(--f-theme-settings-heading1-text-transform)",letterSpacing:"var(--f-theme-settings-heading1-letter-spacing)",fontWeight:"var(--f-theme-settings-heading1-font-weight)",fontFamily:"var(--f-theme-settings-heading1-font-family)",color:"var(--f-theme-settings-heading1-color)"},heading2:{fontSize:"var(--f-theme-settings-heading2-font-size)",lineHeight:"var(--f-theme-settings-heading2-line-height)",marginTop:"var(--f-theme-settings-heading2-margin-top)",marginBottom:"var(--f-theme-settings-heading2-margin-bottom)",textDecoration:"var(--f-theme-settings-heading2-text-decoration)",fontStyle:"var(--f-theme-settings-heading2-font-style)",textTransform:"var(--f-theme-settings-heading2-text-transform)",letterSpacing:"var(--f-theme-settings-heading2-letter-spacing)",fontWeight:"var(--f-theme-settings-heading2-font-weight)",fontFamily:"var(--f-theme-settings-heading2-font-family)",color:"var(--f-theme-settings-heading2-color)"},heading3:{fontSize:"var(--f-theme-settings-heading3-font-size)",lineHeight:"var(--f-theme-settings-heading3-line-height)",marginTop:"var(--f-theme-settings-heading3-margin-top)",marginBottom:"var(--f-theme-settings-heading3-margin-bottom)",textDecoration:"var(--f-theme-settings-heading3-text-decoration)",fontStyle:"var(--f-theme-settings-heading3-font-style)",textTransform:"var(--f-theme-settings-heading3-text-transform)",letterSpacing:"var(--f-theme-settings-heading3-letter-spacing)",fontWeight:"var(--f-theme-settings-heading3-font-weight)",fontFamily:"var(--f-theme-settings-heading3-font-family)",color:"var(--f-theme-settings-heading3-color)"},heading4:{fontSize:"var(--f-theme-settings-heading4-font-size)",lineHeight:"var(--f-theme-settings-heading4-line-height)",marginTop:"var(--f-theme-settings-heading4-margin-top)",marginBottom:"var(--f-theme-settings-heading4-margin-bottom)",textDecoration:"var(--f-theme-settings-heading4-text-decoration)",fontStyle:"var(--f-theme-settings-heading4-font-style)",textTransform:"var(--f-theme-settings-heading4-text-transform)",letterSpacing:"var(--f-theme-settings-heading4-letter-spacing)",fontWeight:"var(--f-theme-settings-heading4-font-weight)",fontFamily:"var(--f-theme-settings-heading4-font-family)",color:"var(--f-theme-settings-heading4-color)"},custom1:{fontSize:"var(--f-theme-settings-custom1-font-size)",lineHeight:"var(--f-theme-settings-custom1-line-height)",marginTop:"var(--f-theme-settings-custom1-margin-top)",marginBottom:"var(--f-theme-settings-custom1-margin-bottom)",textDecoration:"var(--f-theme-settings-custom1-text-decoration)",fontStyle:"var(--f-theme-settings-custom1-font-style)",textTransform:"var(--f-theme-settings-custom1-text-transform)",letterSpacing:"var(--f-theme-settings-custom1-letter-spacing)",fontWeight:"var(--f-theme-settings-custom1-font-weight)",fontFamily:"var(--f-theme-settings-custom1-font-family)",color:"var(--f-theme-settings-custom1-color)"},custom2:{fontSize:"var(--f-theme-settings-custom2-font-size)",lineHeight:"var(--f-theme-settings-custom2-line-height)",marginTop:"var(--f-theme-settings-custom2-margin-top)",marginBottom:"var(--f-theme-settings-custom2-margin-bottom)",textDecoration:"var(--f-theme-settings-custom2-text-decoration)",fontStyle:"var(--f-theme-settings-custom2-font-style)",textTransform:"var(--f-theme-settings-custom2-text-transform)",letterSpacing:"var(--f-theme-settings-custom2-letter-spacing)",fontWeight:"var(--f-theme-settings-custom2-font-weight)",fontFamily:"var(--f-theme-settings-custom2-font-family)",color:"var(--f-theme-settings-custom2-color)"},custom3:{fontSize:"var(--f-theme-settings-custom3-font-size)",lineHeight:"var(--f-theme-settings-custom3-line-height)",marginTop:"var(--f-theme-settings-custom3-margin-top)",marginBottom:"var(--f-theme-settings-custom3-margin-bottom)",textDecoration:"var(--f-theme-settings-custom3-text-decoration)",fontStyle:"var(--f-theme-settings-custom3-font-style)",textTransform:"var(--f-theme-settings-custom3-text-transform)",letterSpacing:"var(--f-theme-settings-custom3-letter-spacing)",fontWeight:"var(--f-theme-settings-custom3-font-weight)",fontFamily:"var(--f-theme-settings-custom3-font-family)",color:"var(--f-theme-settings-custom3-color)"},p:{fontSize:"var(--f-theme-settings-body-font-size)",lineHeight:"var(--f-theme-settings-body-line-height)",marginTop:"var(--f-theme-settings-body-margin-top)",marginBottom:"var(--f-theme-settings-body-margin-bottom)",textDecoration:"var(--f-theme-settings-body-text-decoration)",fontStyle:"var(--f-theme-settings-body-font-style)",textTransform:"var(--f-theme-settings-body-text-transform)",letterSpacing:"var(--f-theme-settings-body-letter-spacing)",fontWeight:"var(--f-theme-settings-body-font-weight)",fontFamily:"var(--f-theme-settings-body-font-family)",color:"var(--f-theme-settings-body-color)"},quote:{fontSize:"var(--f-theme-settings-quote-font-size)",lineHeight:"var(--f-theme-settings-quote-line-height)",marginTop:"var(--f-theme-settings-quote-margin-top)",marginBottom:"var(--f-theme-settings-quote-margin-bottom)",textDecoration:"var(--f-theme-settings-quote-text-decoration)",fontStyle:"var(--f-theme-settings-quote-font-style)",textTransform:"var(--f-theme-settings-quote-text-transform)",letterSpacing:"var(--f-theme-settings-quote-letter-spacing)",fontWeight:"var(--f-theme-settings-quote-font-weight)",fontFamily:"var(--f-theme-settings-quote-font-family)",color:"var(--f-theme-settings-quote-color)"},imageCaption:{fontSize:"var(--f-theme-settings-image-caption-font-size)",lineHeight:"var(--f-theme-settings-image-caption-line-height)",marginTop:"var(--f-theme-settings-image-caption-margin-top)",marginBottom:"var(--f-theme-settings-image-caption-margin-bottom)",textDecoration:"var(--f-theme-settings-image-caption-text-decoration)",fontStyle:"var(--f-theme-settings-image-caption-font-style)",textTransform:"var(--f-theme-settings-image-caption-text-transform)",letterSpacing:"var(--f-theme-settings-image-caption-letter-spacing)",fontWeight:"var(--f-theme-settings-image-caption-font-weight)",fontFamily:"var(--f-theme-settings-image-caption-font-family)",color:"var(--f-theme-settings-image-caption-color)"},imageTitle:{fontSize:"var(--f-theme-settings-image-title-font-size)",lineHeight:"var(--f-theme-settings-image-title-line-height)",marginTop:"var(--f-theme-settings-image-title-margin-top)",marginBottom:"var(--f-theme-settings-image-title-margin-bottom)",textDecoration:"var(--f-theme-settings-image-title-text-decoration)",fontStyle:"var(--f-theme-settings-image-title-font-style)",textTransform:"var(--f-theme-settings-image-title-text-transform)",letterSpacing:"var(--f-theme-settings-image-title-letter-spacing)",fontWeight:"var(--f-theme-settings-image-title-font-weight)",fontFamily:"var(--f-theme-settings-image-title-font-family)",color:"var(--f-theme-settings-image-title-color)"},[ce]:{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)"},...we},Tn=()=>{const e=o.useFloatingLinkUrlInput({});return s.jsx("div",{"data-test-id":"floating-link-edit",className:"tw-bg-white tw-rounded tw-shadow tw-p-4 tw-min-w-[400px]",children:s.jsxs("span",{"data-test-id":"preview-link-flyout",className:"tw-flex tw-justify-between",children:[s.jsx("span",{className:"tw-pointer-events-none",style:T.p,children:e.defaultValue}),s.jsxs("span",{className:"tw-flex tw-gap-2",children:[s.jsx("span",{role:"button",tabIndex:0,"data-test-id":"edit-link-button",className:"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1",children:s.jsx(le.EditButton,{children:s.jsx(i.IconPen16,{})})}),s.jsx("span",{role:"button",tabIndex:0,"data-test-id":"remove-link-button",className:"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1",children:s.jsx(le.UnlinkButton,{children:s.jsx(i.IconTrashBin16,{})})})]})]})})},jn=({floatingOptions:e,...t})=>{const n=o.useEditorRef(),r=o.usePlateSelectors().keyEditor(),a=o.useFloatingLinkSelectors().mode(),l=o.useFloatingLinkSelectors().isOpen(n.id),{triggerFloatingLinkHotkeys:u="command+k, ctrl+k"}=o.getPluginOptions(n,o.ELEMENT_LINK),d=x.useCallback(()=>{const w=o.getAboveNode(n,{match:{type:o.getPluginType(n,o.ELEMENT_LINK)}});if(w){const[,b]=w;return o.getRangeBoundingClientRect(n,{anchor:o.getStartPoint(n,b),focus:o.getEndPoint(n,b)})}return o.getDefaultBoundingClientRect()},[n]),c=l&&a==="edit",{update:m,style:f,floating:g}=o.useVirtualFloatingLink({editorId:n.id,open:c,getBoundingClientRect:d,...e});return x.useEffect(()=>{const w=Le(n);if(w&&o.floatingLinkActions.url(w),n.selection&&o.someNode(n,{match:{type:o.getPluginType(n,o.ELEMENT_LINK)}})){o.floatingLinkActions.show("edit",n.id),m();return}o.floatingLinkSelectors.mode()==="edit"&&o.floatingLinkActions.hide()},[n,r,m]),o.useHotkeys(u,w=>{w.preventDefault(),o.floatingLinkSelectors.mode()==="edit"&&o.triggerFloatingLinkEdit(n)},{enableOnContentEditable:!0},[]),o.useFloatingLinkEnter(),o.useFloatingLinkEscape(),{style:{...f,zIndex:1e3},...t,ref:o.useComposedRef(t.ref,g)}},Bn=({section:e,selectedUrl:t,onSelectUrl:n})=>{const r=e.permanentLink===t;return s.jsx("button",{"data-test-id":"internal-link-selector-section-link",className:i.merge(["tw-py-2 tw-px-2.5 tw-pl-14 tw-leading-5 tw-cursor-pointer tw-w-full",r?"tw-bg-box-selected-strong tw-text-box-selected-strong-inverse hover:tw-bg-box-selected-strong-hover:hover hover:tw-text-box-selected-strong-inverse-hover:hover":"hover:tw-bg-box-neutral-hover hover:tw-text-box-neutral-inverse-hover"]),onClick:()=>n(e.permanentLink),onFocus:()=>n(e.permanentLink),children:s.jsxs("div",{className:"tw-flex tw-flex-1 tw-space-x-2 tw-items-center tw-h-6",children:[s.jsx(i.IconDocumentText16,{}),s.jsx("span",{className:"tw-text-s",children:e.title}),s.jsx("span",{className:"tw-flex-auto tw-font-sans tw-text-xs tw-text-right",children:"Section"})]})})},Ln=({page:e,selectedUrl:t,onSelectUrl:n,itemsToExpandInitially:r,appBridge:a})=>{const[l,u]=x.useState(e.id===r.documentId),d=e.permanentLink===t,{documentSections:c}=G.useDocumentSection(a,e.id),m=[...c.values()],f=m.length>0;return x.useEffect(()=>{e.id===r.pageId&&u(!0)},[r,e.id]),s.jsxs(s.Fragment,{children:[s.jsx("div",{tabIndex:0,"data-test-id":"internal-link-selector-page-link",className:i.merge(["tw-py-2 tw-px-2.5 tw-leading-5 tw-cursor-pointer",f?"tw-pl-7":"tw-pl-12",d?"tw-bg-box-selected-strong tw-text-box-selected-strong-inverse hover:tw-bg-box-selected-strong-hover:hover hover:tw-text-box-selected-strong-inverse-hover:hover":"hover:tw-bg-box-neutral-hover hover:tw-text-box-neutral-inverse-hover"]),onClick:()=>n(e.permanentLink),onFocus:()=>n(e.permanentLink),children:s.jsxs("div",{className:"tw-flex tw-flex-1 tw-space-x-1 tw-items-center tw-h-6",children:[f&&s.jsx("button",{"data-test-id":"tree-item-toggle",className:"tw-flex tw-items-center tw-justify-center tw-p-1.5 tw-cursor-pointer",onClick:()=>u(!l),onFocus:()=>u(!l),children:s.jsx("div",{className:i.merge(["tw-transition-transform tw-w-0 tw-h-0 tw-font-normal tw-border-t-4 tw-border-t-transparent tw-border-b-4 tw-border-b-transparent tw-border-l-4 tw-border-l-x-strong",l?"tw-rotate-90":""])})}),s.jsx("span",{className:"tw-text-s",children:e.title}),s.jsx("span",{className:"tw-flex-auto tw-font-sans tw-text-xs tw-text-right",children:"Page"})]},e.id)}),l&&m.length>0&&m.map(g=>s.jsx(Bn,{section:g,selectedUrl:t,onSelectUrl:n},g.id))]})},Nn=({appBridge:e,documentId:t,selectedUrl:n,onSelectUrl:r,itemsToExpandInitially:a})=>{const[l,u]=x.useState([]),[d,c]=x.useState(!0),m=[...l.values()],f=!d&&m.length>0;return x.useEffect(()=>{e.getDocumentPagesByDocumentId(t).then(g=>{const w=g.filter(p=>!!p.category).sort((p,S)=>p.category.sort===S.category.sort?p.sort-S.sort:p.category.sort-S.category.sort),b=g.filter(p=>!p.category).sort((p,S)=>p.sort-S.sort);u([...w,...b])}).finally(()=>{c(!1)})},[]),d?s.jsx("div",{className:"tw-flex tw-justify-center tw-p-4",children:s.jsx(i.LoadingCircle,{})}):f?s.jsx(s.Fragment,{children:m.map(g=>s.jsx(Ln,{page:g,appBridge:e,selectedUrl:n,onSelectUrl:r,itemsToExpandInitially:a},g.id))}):s.jsx("div",{className:"tw-py-2 tw-px-2.5 tw-pl-7 tw-leading-5 tw-text-s tw-text-text-weak",children:"This document does not contain any pages."})},An=({document:e,appBridge:t,selectedUrl:n,onSelectUrl:r,itemsToExpandInitially:a})=>{const[l,u]=x.useState(e.id===a.documentId),d=e.permanentLink===n;return x.useEffect(()=>{e.id===a.documentId&&u(!0)},[a,e.id]),s.jsxs(s.Fragment,{children:[s.jsxs("button",{"data-test-id":"internal-link-selector-document-link",className:i.merge(["tw-flex tw-flex-1 tw-space-x-2 tw-items-center tw-py-2 tw-px-2.5 tw-leading-5 tw-cursor-pointer tw-w-full",d?"tw-bg-box-selected-strong tw-text-box-selected-strong-inverse hover:tw-bg-box-selected-strong-hover:hover hover:tw-text-box-selected-strong-inverse-hover:hover":"hover:tw-bg-box-neutral-hover hover:tw-text-box-neutral-inverse-hover"]),onClick:()=>r(e.permanentLink),onFocus:()=>r(e.permanentLink),children:[s.jsx("div",{role:"button",tabIndex:0,"data-test-id":"tree-item-toggle",className:"tw-flex tw-items-center tw-justify-center tw-p-1.5 tw-cursor-pointer",onClick:()=>u(!l),onFocus:()=>u(!l),children:s.jsx("div",{className:i.merge(["tw-transition-transform tw-w-0 tw-h-0 tw-font-normal tw-border-t-4 tw-border-t-transparent tw-border-b-4 tw-border-b-transparent tw-border-l-4 tw-border-l-x-strong",l?"tw-rotate-90":""])})}),s.jsx(i.IconColorFan16,{}),s.jsx("span",{className:"tw-text-s",children:e.title}),s.jsx("span",{className:"tw-flex-auto tw-font-sans tw-text-xs tw-text-right",children:"Document"})]}),l&&s.jsx(Nn,{appBridge:t,documentId:e.id,selectedUrl:n,onSelectUrl:r,itemsToExpandInitially:a})]})},Rn=({appBridge:e,selectedUrl:t,onSelectUrl:n})=>{const[r,a]=x.useState(!0),[l,u]=x.useState([]),[d,c]=x.useState({documentId:void 0,pageId:void 0}),m=[...l.values()];x.useEffect(()=>{t&&m.length>0&&f().then(g=>{c(g)})},[m.length]),x.useEffect(()=>{e.getAllDocuments().then(g=>{u(g)}).finally(()=>{a(!1)})},[]);const f=async()=>{const g={documentId:void 0,pageId:void 0};if(m.find(b=>b.permanentLink===t))return g;for(const b of m){const p=await e.getDocumentPagesByDocumentId(b.id);e.getAllDocuments();const S=[...p.values()];if(!!S.find(E=>E.permanentLink===t))return g.documentId=b.id,g;for(const E of S)if(!![...(await e.getDocumentSectionsByDocumentPageId(E.id)).values()].find(F=>F.permanentLink===t))return g.documentId=b.id,g.pageId=E.id,g}return g};return r?s.jsx("div",{className:"tw-flex tw-justify-center tw-p-4",children:s.jsx(i.LoadingCircle,{})}):s.jsx(s.Fragment,{children:m.map(g=>s.jsx(An,{document:g,appBridge:e,selectedUrl:t,onSelectUrl:n,itemsToExpandInitially:d},g.id))})},it=({appBridge:e,url:t,onUrlChange:n,buttonSize:r=i.ButtonSize.Medium})=>{const{open:a,isOpen:l,close:u}=Ht.useOverlayTriggerState({}),[d,c]=x.useState(t),m=w=>{c(w)},f=w=>{w.key==="Enter"&&g()};x.useEffect(()=>{t&&!d&&c(t)},[t,d]);const g=()=>{n==null||n(d),u()};return s.jsxs("div",{"data-test-id":"internal-link-selector",onKeyDown:f,children:[s.jsx(i.Button,{icon:s.jsx(i.IconLink,{}),size:r,type:i.ButtonType.Button,style:i.ButtonStyle.Default,emphasis:i.ButtonEmphasis.Default,onClick:()=>a(),children:"Internal link"}),s.jsxs(i.Modal,{zIndex:1001,onClose:()=>u(),isOpen:l,isDismissable:!0,children:[s.jsx(i.Modal.Header,{title:"Select internal link"}),s.jsx(i.Modal.Body,{children:s.jsx(Rn,{appBridge:e,selectedUrl:d,onSelectUrl:m})}),s.jsx(i.Modal.Footer,{buttons:[{children:"Cancel",onClick:()=>u(),style:i.ButtonStyle.Default,emphasis:i.ButtonEmphasis.Default},{children:"Choose",onClick:w=>{w==null||w.preventDefault(),g()},style:i.ButtonStyle.Default,emphasis:i.ButtonEmphasis.Strong,disabled:!d}]})]})]})},ot=({onUrlChange:e,onToggleTab:t,isValidUrlOrEmpty:n,appBridge:r,clearable:a,placeholder:l,newTab:u,openInNewTab:d,url:c="",required:m,info:f,label:g,buttonSize:w,hideInternalLinkButton:b})=>{const p=n?n(c):te(c),S=u??(d?i.CheckboxState.Checked:i.CheckboxState.Unchecked);return s.jsxs("div",{"data-test-id":"link-input",children:[s.jsx(i.FormControl,{label:{children:g,htmlFor:"url",required:m,tooltip:f?{content:f,position:i.TooltipPosition.Top}:void 0},children:s.jsx(i.TextInput,{id:"url",value:c,clearable:a,onChange:e,placeholder:l??"https://example.com",focusOnMount:!0})}),!p&&s.jsx("div",{className:"tw-text-text-negative tw-mt-1 tw-text-s",children:"Please enter a valid URL."}),!b&&s.jsx("div",{className:"tw-mt-3",children:s.jsx(it,{url:c,appBridge:r,onUrlChange:e,buttonSize:w??i.ButtonSize.Medium})}),s.jsx("div",{className:"tw-mt-3",children:s.jsx(i.Checkbox,{value:"new-tab",label:"Open in new tab",state:S,onChange:t})})]})},lt=({state:e,onTextChange:t,onUrlChange:n,onToggleTab:r,onCancel:a,onSave:l,isValidUrlOrEmpty:u,hasValues:d,testId:c,appBridge:m,children:f})=>s.jsxs("div",{"data-test-id":c,className:"tw-bg-white tw-rounded tw-shadow tw-p-7 tw-min-w-[400px] tw-overflow-y-auto",children:[s.jsx(i.FormControl,{label:{children:"Text",htmlFor:"linkText",required:!0},children:s.jsx(i.TextInput,{id:"linkText",value:e.text,placeholder:"Link Text",onChange:t})}),f,s.jsx("div",{className:"tw-mt-5",children:s.jsx(ot,{url:e.url,newTab:e.newTab,onUrlChange:n,onToggleTab:r,isValidUrlOrEmpty:u,appBridge:m})}),s.jsx("div",{className:"tw-mt-3",children:s.jsxs("div",{className:"tw-pt-5 tw-flex tw-gap-x-3 tw-justify-end tw-border-t tw-border-t-black-10",children:[s.jsx(i.Button,{onClick:a,size:i.ButtonSize.Medium,style:i.ButtonStyle.Default,emphasis:i.ButtonEmphasis.Default,children:"Cancel"}),s.jsx(i.Button,{onClick:l,size:i.ButtonSize.Medium,icon:s.jsx(i.IconCheckMark20,{}),disabled:!d||!u(e==null?void 0:e.url),children:"Save"})]})})]}),Fn={url:"",text:"",newTab:i.CheckboxState.Unchecked},Mn=()=>{const[e,t]=x.useReducer((n,r)=>{const{type:a,payload:l}=r;switch(a){case"NEW_TAB":return{...n,newTab:i.CheckboxState.Checked};case"SAME_TAB":return{...n,newTab:i.CheckboxState.Unchecked};case"URL":case"TEXT":case"INIT":return{...n,...l};default:return n}},Fn);return[e,t]},Dn=()=>{const e=o.useEditorRef(),[t,n]=Mn();x.useEffect(()=>{const f=Je(e),g=Ze(e);n({type:"INIT",payload:{text:o.floatingLinkSelectors.text(),newTab:o.floatingLinkSelectors.newTab()?i.CheckboxState.Checked:i.CheckboxState.Unchecked,url:f&&g===""?f:o.floatingLinkSelectors.url()}})},[n,e]);const r=f=>{n({type:"TEXT",payload:{text:f}})},a=f=>{n({type:"URL",payload:{url:f}})},l=f=>{n(f?{type:"NEW_TAB"}:{type:"SAME_TAB"})},u=()=>{o.floatingLinkActions.hide()},d=f=>{if(!te(t.url)||!c)return;const g=me(t.url);o.floatingLinkActions.text(t.text),o.floatingLinkActions.url(g),o.floatingLinkActions.newTab(t.newTab===i.CheckboxState.Checked),o.submitFloatingLink(e)&&(f==null||f.preventDefault())},c=t.url!==""&&t.text!=="",{appBridge:m}=o.getPluginOptions(e,o.ELEMENT_LINK);return o.useHotkeys("enter",d,{enableOnFormTags:["INPUT"]},[]),{state:t,onTextChange:r,onUrlChange:a,onToggleTab:l,onCancel:u,onSave:d,hasValues:c,isValidUrlOrEmpty:te,appBridge:m}},On=()=>s.jsx(lt,{...Dn(),testId:"floating-link-insert"}),Un=({readOnly:e})=>{const t=o.useFloatingLinkSelectors().isEditing();if(e)return null;const n=s.jsx(On,{}),r=t?n:s.jsx(Tn,{});return s.jsxs(s.Fragment,{children:[s.jsx(le.InsertRoot,{children:n}),s.jsx(le.EditRoot,{children:r})]})},Hn=({id:e,editorId:t})=>{const n=o.usePlateEditorState(o.useEventPlateId(t)),r=!!o.isRangeInSameBlock(n,{at:n.selection});return s.jsx("div",{"data-plugin-id":e,children:s.jsx(o.LinkToolbarButton,{tooltip:i.getTooltip(r?`Link
3
- ${i.getHotkeyByPlatform("Ctrl+K")}`:"Links can only be set for a single text block."),icon:s.jsx("span",{className:"tw-p-2 tw-h-8 tw-justify-center tw-items-center tw-flex",children:s.jsx(i.IconLink,{size:i.IconSize.Size16})}),classNames:i.getButtonClassNames(r),styles:{root:{width:"24px",height:"24px"}},actionHandler:"onMouseDown"})})},_n=e=>({...o.useElementProps({...e,elementToAttributes:n=>{var r,a;return{href:n.url||((a=(r=n.chosenLink)==null?void 0:r.searchResult)==null?void 0:a.link)||"",target:n.target||"_blank"}}}),onMouseOver:n=>{n.stopPropagation()}}),Vn=e=>{const t=_n(e),{attributes:n,children:r}=e;return s.jsx("a",{...n,href:t.href,target:t.target,style:T[ce],children:r})};class zn extends i.MarkupElement{constructor(t=o.ELEMENT_LINK,n=Vn){super(t,n)}}const ct=e=>o.createPluginFactory({...o.createLinkPlugin(),renderAfterEditable:Un,options:{isUrl:he,rangeBeforeOptions:{matchString:" ",skipInvalid:!0,afterMatch:!0},triggerFloatingLinkHotkeys:"command+k, ctrl+k",appBridge:e}})();class ut extends i.Plugin{constructor(t,n=T[ce]){super(ce,{button:Hn,markupElement:new zn,...t}),this.styles={},this.styles=n,this.appBridge=t==null?void 0:t.appBridge}plugins(){return[ct(this.appBridge)]}}const $n="textstyle-custom1-plugin";class dt extends i.Plugin{constructor({styles:t=T.custom1,...n}={}){super(y.custom1,{label:"Custom 1",markupElement:new Wn,...n}),this.styles={},this.styles=t}plugins(){return[qn(this.styles)]}}class Wn extends i.MarkupElement{constructor(t=$n,n=gt){super(t,n)}}const gt=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("p",{...t,style:r,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),children:n})},qn=e=>o.createPluginFactory({key:y.custom1,isElement:!0,deserializeHtml:{rules:[{validClassName:y.custom1}]}})({component:t=>s.jsx(gt,{...t,styles:e})}),Gn="textstyle-custom2-plugin";class mt extends i.Plugin{constructor({styles:t=T.custom2,...n}={}){super(y.custom2,{label:"Custom 2",markupElement:new Kn,...n}),this.styles={},this.styles=t}plugins(){return[Xn(this.styles)]}}class Kn extends i.MarkupElement{constructor(t=Gn,n=ht){super(t,n)}}const ht=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("p",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},Xn=e=>o.createPluginFactory({key:y.custom2,isElement:!0,deserializeHtml:{rules:[{validClassName:y.custom2}]}})({component:t=>s.jsx(ht,{...t,styles:e})}),Qn="textstyle-custom3-plugin";class ft extends i.Plugin{constructor({styles:t=T.custom3,...n}={}){super(i.TextStyles.custom3,{label:"Custom 3",markupElement:new Yn,...n}),this.styles={},this.styles=t}plugins(){return[Jn(this.styles)]}}class Yn extends i.MarkupElement{constructor(t=Qn,n=wt){super(t,n)}}const wt=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("p",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},Jn=e=>o.createPluginFactory({key:i.TextStyles.custom3,isElement:!0,deserializeHtml:{rules:[{validClassName:i.TextStyles.custom3}]}})({component:t=>s.jsx(wt,{...t,styles:e})}),Zn="textstyle-heading1-plugin";class xt extends i.Plugin{constructor({styles:t=T.heading1,...n}={}){super(y.heading1,{label:"Heading 1",markupElement:new es,...n}),this.styles={},this.styles=t}plugins(){return[ts(this.styles)]}}class es extends i.MarkupElement{constructor(t=Zn,n=pe){super(t,n)}}const pe=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("h1",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},ts=e=>o.createPluginFactory({key:y.heading1,isElement:!0,component:pe,deserializeHtml:{rules:[{validNodeName:["h1","H1"]}]}})({component:t=>s.jsx(pe,{...t,styles:e})}),ns="textstyle-heading2-plugin";class yt extends i.Plugin{constructor({styles:t=T.heading2,...n}={}){super(y.heading2,{label:"Heading 2",markupElement:new ss,...n}),this.styles={},this.styles=t}plugins(){return[rs(this.styles)]}}class ss extends i.MarkupElement{constructor(t=ns,n=be){super(t,n)}}const be=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("h2",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},rs=e=>o.createPluginFactory({key:y.heading2,isElement:!0,component:be,deserializeHtml:{rules:[{validNodeName:["h2","H2"]}]}})({component:t=>s.jsx(be,{...t,styles:e})}),as="textstyle-heading3-plugin";class pt extends i.Plugin{constructor({styles:t=T.heading3,...n}={}){super(y.heading3,{label:"Heading 3",markupElement:new is,...n}),this.styles={},this.styles=t}plugins(){return[os(this.styles)]}}class is extends i.MarkupElement{constructor(t=as,n=ve){super(t,n)}}const ve=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("h3",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},os=e=>o.createPluginFactory({key:y.heading3,isElement:!0,component:ve,deserializeHtml:{rules:[{validNodeName:["h3","H3"]}]}})({component:t=>s.jsx(ve,{...t,styles:e})}),ls="textstyle-heading4-plugin";class bt extends i.Plugin{constructor({styles:t=T.heading4,...n}={}){super(y.heading4,{label:"Heading 4",markupElement:new cs,...n}),this.styles={},this.styles=t}plugins(){return[us(this.styles)]}}class cs extends i.MarkupElement{constructor(t=ls,n=ke){super(t,n)}}const ke=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("h4",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},us=e=>o.createPluginFactory({key:y.heading4,isElement:!0,component:ke,deserializeHtml:{rules:[{validNodeName:["h4","H4"]}]}})({component:t=>s.jsx(ke,{...t,styles:e})}),ds="textstyle-imageCaption-plugin";class vt extends i.Plugin{constructor({styles:t=T.imageCaption,...n}={}){super(y.imageCaption,{label:"Image Caption",markupElement:new gs,...n}),this.styles={},this.styles=t}plugins(){return[ms(this.styles)]}}class gs extends i.MarkupElement{constructor(t=ds,n=Ce){super(t,n)}}const Ce=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("p",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},ms=e=>o.createPluginFactory({key:y.imageCaption,isElement:!0,component:Ce,deserializeHtml:{rules:[{validClassName:y.imageCaption}]}})({component:t=>s.jsx(Ce,{...t,styles:e})}),hs="textstyle-imageTitle-plugin";class kt extends i.Plugin{constructor({styles:t=T.imageTitle,...n}={}){super(y.imageTitle,{label:"Image Title",markupElement:new fs,...n}),this.styles={},this.styles=t}plugins(){return[ws(this.styles)]}}class fs extends i.MarkupElement{constructor(t=hs,n=Se){super(t,n)}}const Se=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("p",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},ws=e=>o.createPluginFactory({key:y.imageTitle,isElement:!0,component:Se,deserializeHtml:{rules:[{validClassName:y.imageTitle}]}})({component:t=>s.jsx(Se,{...t,styles:e})});class Ct extends i.Plugin{constructor({styles:t=T.p,...n}={}){super(y.p,{markupElement:new Et,label:"Body Text",...n}),this.styles={},this.styles=t}plugins(){return[Pt(this.styles)]}}const St="tw-m-0 tw-px-0 tw-py-0",ue=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align,l=i.merge([a&&i.alignmentClassnames[a],St,i.getColumnBreakClasses(e)]);return s.jsx("p",{...t,className:l,style:r,children:n})};class Et extends i.MarkupElement{constructor(t=y.p,n=ue){super(t,n)}}const Pt=e=>o.createPluginFactory({...o.createParagraphPlugin(),key:y.p,isElement:!0,component:ue})({component:t=>s.jsx(ue,{...t,styles:e})}),xs="textstyle-quote-plugin";class It extends i.Plugin{constructor({styles:t=T.quote,...n}={}){super(y.quote,{label:"Quote",markupElement:new ys,...n}),this.styles={},this.styles=t}plugins(){return[Tt(this.styles)]}}class ys extends i.MarkupElement{constructor(t=xs,n=de){super(t,n)}}const de=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("blockquote",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},Tt=e=>o.createPluginFactory({key:y.quote,isElement:!0,component:de,deserializeHtml:{rules:[{validNodeName:["blockquote","BLOCKQUOTE"]}]}})({component:t=>s.jsx(de,{...t,styles:e})}),Ae=[new xt,new yt,new pt,new bt,new dt,new mt,new ft,new It,new Ct],ee=[y.heading1,y.heading2,y.heading3,y.heading4,y.custom1,y.custom2,y.custom3,y.quote,y.p],ps=[...Ae,new vt,new kt],bs=[...ee,y.imageCaption,y.imageTitle],vs=()=>{const e=Ms({});return s.jsx("div",{"data-test-id":"floating-button-edit",className:"tw-bg-white tw-rounded tw-shadow tw-p-4 tw-min-w-[400px]",children:s.jsxs("span",{"data-test-id":"preview-button-flyout",className:"tw-flex tw-justify-between",children:[s.jsx("span",{className:"tw-pointer-events-none",style:T.p,children:e.defaultValue}),s.jsxs("span",{className:"tw-flex tw-gap-2",children:[s.jsx("span",{role:"button",tabIndex:0,"data-test-id":"edit-button-button",className:"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1",children:s.jsx(ge.EditButton,{children:s.jsx(i.IconPen16,{})})}),s.jsx("span",{role:"button",tabIndex:0,"data-test-id":"remove-button-button",className:"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1",children:s.jsx(ge.UnlinkButton,{children:s.jsx(i.IconTrashBin16,{})})})]})]})})},ks=e=>{var n;const t=o.getAboveNode(e,{match:{type:C}});return Array.isArray(t)&&((n=t[0])==null?void 0:n.buttonStyle)||"primary"},Cs={url:"",text:"",buttonStyle:"primary",newTab:i.CheckboxState.Unchecked},Ss=()=>{const[e,t]=x.useReducer((n,r)=>{const{type:a,payload:l}=r;switch(a){case"NEW_TAB":return{...n,newTab:i.CheckboxState.Checked};case"SAME_TAB":return{...n,newTab:i.CheckboxState.Unchecked};case"URL":case"TEXT":case"BUTTON_STYLE":case"INIT":return{...n,...l};default:return n}},Cs);return[e,t]},Es=()=>{const e=o.useEditorRef(),[t,n]=Ss();x.useEffect(()=>{const g=ks(e);n({type:"INIT",payload:{text:j.text(),buttonStyle:g,newTab:j.newTab()?i.CheckboxState.Checked:i.CheckboxState.Unchecked,url:j.url()}})},[n,e]);const r=g=>{n({type:"TEXT",payload:{text:g}})},a=g=>{n({type:"BUTTON_STYLE",payload:{buttonStyle:g}})},l=g=>{n({type:"URL",payload:{url:g}})},u=g=>{n(g?{type:"NEW_TAB"}:{type:"SAME_TAB"})},d=()=>{I.hide()},c=g=>{if(!te(t.url)||!m)return;const w=me(t.url);I.text(t.text),I.url(w),I.buttonStyle(t.buttonStyle),I.newTab(t.newTab===i.CheckboxState.Checked),je(e)&&(g==null||g.preventDefault())},m=t.url!==""&&t.text!=="",{appBridge:f}=o.getPluginOptions(e,C);return o.useHotkeys("enter",c,{enableOnFormTags:["INPUT"]},[]),{state:t,onTextChange:r,onButtonStyleChange:a,onUrlChange:l,onToggleTab:u,onCancel:d,onSave:c,hasValues:m,isValidUrlOrEmpty:te,appBridge:f}},Ps=()=>{const e=Es(),{state:t,onButtonStyleChange:n}=e;return s.jsx(lt,{...e,testId:"floating-button-insert",children:s.jsx("div",{className:"tw-pt-5",children:s.jsxs(i.FormControl,{label:{children:"Button Style",htmlFor:"buttonStyle",required:!0},children:[s.jsx(ye,{id:"primary",styles:T.buttonPrimary,isActive:t.buttonStyle==="primary",onClick:()=>n("primary"),children:t.text||"Primary Button"}),s.jsx(ye,{id:"secondary",styles:T.buttonSecondary,isActive:t.buttonStyle==="secondary",onClick:()=>n("secondary"),children:t.text||"Secondary Button"}),s.jsx(ye,{id:"tertiary",styles:T.buttonTertiary,isActive:t.buttonStyle==="tertiary",onClick:()=>n("tertiary"),children:t.text||"Tertiary Button"})]})})})},ye=({id:e,styles:t,isActive:n,onClick:r,children:a})=>{const[l,u]=x.useState(!1),d=()=>t&&t.hover&&l?{...t,...t.hover}:t;return s.jsx("button",{"data-test-id":`floating-button-insert-${e}`,onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),onClick:r,style:d(),className:n?"tw-outline tw-outline-1 tw-outline-violet-60 tw-outline-offset-2 tw-w-fit":"tw-w-fit",children:a})},Is=()=>{const e=ne().isEditing(),t=s.jsx(Ps,{}),n=e?t:s.jsx(vs,{});return s.jsxs(s.Fragment,{children:[s.jsx(ge.InsertRoot,{children:t}),s.jsx(ge.EditRoot,{children:n})]})},C="button",jt="button-plugin",Bt=e=>o.createPluginFactory({key:C,isElement:!0,isInline:!0,props:({element:t})=>({nodeProps:{href:t==null?void 0:t.url,target:t==null?void 0:t.target}}),withOverrides:et,renderAfterEditable:Is,options:{isUrl:he,rangeBeforeOptions:{matchString:" ",skipInvalid:!0,afterMatch:!0},triggerFloatingButtonHotkeys:"command+shift+k, ctrl+shift+k",appBridge:e},then:(t,{type:n})=>({deserializeHtml:{rules:[{validNodeName:"A",validClassName:"btn"}],getNode:r=>({type:n,url:r.getAttribute("href"),target:r.getAttribute("target")||"_blank"})}})})();class Lt extends i.Plugin{constructor({styles:t=we,...n}){super(jt,{button:Sn,markupElement:new kn,...n}),this.styles={},this.styles=t,this.appBridge=n==null?void 0:n.appBridge}plugins(){return[Bt(this.appBridge)]}}const Ts=({floatingOptions:e,...t})=>{const n=o.useEditorRef(),r=o.usePlateSelectors(n.id).keyEditor(),a=ne().mode(),l=ne().isOpen(n.id),{triggerFloatingButtonHotkeys:u}=o.getPluginOptions(n,C),d=x.useCallback(()=>{const w=o.getAboveNode(n,{match:{type:o.getPluginType(n,C)}});if(w){const[,b]=w;return o.getRangeBoundingClientRect(n,{anchor:o.getStartPoint(n,b),focus:o.getEndPoint(n,b)})}return o.getDefaultBoundingClientRect()},[n]),c=l&&a==="edit",{update:m,style:f,floating:g}=At({open:c,getBoundingClientRect:d,...e});return x.useEffect(()=>{const w=Le(n);if(w&&I.url(w),n.selection&&o.someNode(n,{match:{type:o.getPluginType(n,C)}})){I.show("edit",n.id),m();return}j.mode()==="edit"&&I.hide()},[n,r,m]),o.useHotkeys(u,w=>{w.preventDefault(),j.mode()==="edit"&&fe(n)},{enableOnContentEditable:!0},[]),Ds(),Nt(),{style:{...f,zIndex:1e3},...t,ref:o.useComposedRef(t.ref,g)}},js=({floatingOptions:e,...t})=>{const n=o.useEditorRef(),r=Ve.useFocused(),a=ne().mode(),l=ne().isOpen(n.id),{triggerFloatingButtonHotkeys:u}=o.getPluginOptions(n,C);o.useHotkeys(u,f=>{f.preventDefault(),Ne(n,{focused:r})},{enableOnContentEditable:!0},[r]);const{update:d,style:c,floating:m}=At({open:l&&a==="insert",getBoundingClientRect:o.getSelectionBoundingClientRect,whileElementsMounted:void 0,...e});return x.useEffect(()=>{l&&d(),I.updated(l)},[l,d]),Nt(),{style:{...c,zIndex:1e3},...t,ref:o.useComposedRef(t.ref,m)}},Bs=e=>{const t=o.useEditorRef();return{onClick:x.useCallback(()=>{fe(t)},[t]),...e}},Ls=o.createComponentAs(e=>{const t=Bs(e);return o.createElementAs("button",t)}),Ns=e=>{const t=o.useEditorRef();return{onClick:x.useCallback(()=>{se(t),o.focusEditor(t,t.selection??void 0)},[t]),...e}},As=o.createComponentAs(e=>{const t=Ns(e);return o.createElementAs(o.Button,t)}),Rs=o.createComponentAs(e=>{var n;const t=Ts(e);return((n=t.style)==null?void 0:n.display)==="none"?null:o.createElementAs("div",t)}),Fs=o.createComponentAs(e=>{var n;const t=js(e);return((n=t.style)==null?void 0:n.display)==="none"?null:o.createElementAs("div",t)}),ge={EditRoot:Rs,InsertRoot:Fs,EditButton:Ls,UnlinkButton:As},Ms=e=>{const t=ne().updated(),n=x.useRef(null);x.useEffect(()=>{n.current&&t&&setTimeout(()=>{var a;(a=n.current)==null||a.focus()},0)},[t]);const r=x.useCallback(a=>{I.url(a.target.value)},[]);return o.mergeProps({onChange:r,defaultValue:j.url()},{...e,ref:o.useComposedRef(e.ref,n)})},Ds=()=>{const e=o.useEditorRef();o.useHotkeys("*",t=>{t.key==="Enter"&&je(e)&&t.preventDefault()},{enableOnFormTags:["INPUT"]},[])},Nt=()=>{const e=o.useEditorRef();o.useHotkeys("escape",()=>{if(j.mode()==="edit"){if(j.isEditing()){I.show("edit",e.id),o.focusEditor(e,e.selection??void 0);return}I.hide()}},{enableOnFormTags:["INPUT"],enableOnContentEditable:!0},[])},Os=12,Us=-22,Hs=96,At=e=>o.useVirtualFloating({placement:"bottom-start",middleware:[o.offset({mainAxis:Os,alignmentAxis:Us}),o.flip({padding:Hs})],...e}),_s=({id:e="rte",isEditing:t,value:n,columns:r,gap:a,placeholder:l,plugins:u,onTextChange:d,showSerializedText:c})=>{const[m,f]=x.useState(!1),g=w=>{d&&w!==n&&d(w),f(!1)};return x.useEffect(()=>{const w=b=>(b.preventDefault(),b.returnValue="Unprocessed changes");return m&&window.addEventListener("beforeunload",w),()=>window.removeEventListener("beforeunload",w)},[m]),t?s.jsx(i.RichTextEditor,{id:e,value:n,border:!1,placeholder:l,plugins:u,onValueChanged:()=>f(!0),onTextChange:g,hideExternalFloatingModals:w=>{j.isOpen(w)&&I.reset()}}):s.jsx(cn,{value:n,columns:r,gap:a,show:c,plugins:u})},Vs=e=>new i.PluginComposer().setPlugin(new i.SoftBreakPlugin,new i.TextStylePlugin({textStyles:Ae})).setPlugin([new i.BoldPlugin,new i.ItalicPlugin,new i.UnderlinePlugin,new i.StrikethroughPlugin,new ut({appBridge:e}),new Lt({appBridge:e}),new i.CodePlugin],[new i.AlignLeftPlugin({validTypes:ee}),new i.AlignCenterPlugin({validTypes:ee}),new i.AlignRightPlugin({validTypes:ee}),new i.AlignJustifyPlugin({validTypes:ee}),new i.UnorderedListPlugin,new i.CheckboxListPlugin,new i.OrderedListPlugin,new i.ResetFormattingPlugin]),zs="--f-theme-settings-",$s=(e,t)=>{const{blockAssets:n,updateAssetIdsFromKey:r}=G.useBlockAssets(e),a=(n==null?void 0:n[t])||[];return{onAddAttachments:async m=>{const f=a.map(g=>g.id);for(const g of m)f.push(g.id);await r(t,f)},onAttachmentDelete:async m=>{const f=a.filter(g=>g.id!==m.id).map(g=>g.id);await r(t,f)},onAttachmentReplace:async(m,f)=>{const g=a.map(w=>w.id===m.id?f.id:w.id);await r(t,g)},onAttachmentsSorted:async m=>{const f=m.map(g=>g.id);await r(t,f)},attachments:a}},Ws={start:["Space","Enter"],cancel:[],end:["Space","Enter","Escape"]},qs=(e=0,t=0)=>{const n=Xe(e,t);return P.useSensors(P.useSensor(P.PointerSensor),P.useSensor(P.KeyboardSensor,{coordinateGetter:n,keyboardCodes:Ws}))},Gs=e=>{const t=e!=null&&e.id?`hasBackground${e.id}`:"hasBackground",n=e!=null&&e.id?`backgroundColor${e.id}`:"backgroundColor",r=e!=null&&e.preventDefaultColor?void 0:(e==null?void 0:e.defaultColor)||Jt,a=e!=null&&e.switchLabel?e.switchLabel:void 0;return{id:t,label:"Background",type:"switch",switchLabel:a,defaultValue:!!(e!=null&&e.defaultValue),on:[{id:n,defaultValue:r,type:"colorInput"}]}},Ks=e=>{const t=e!=null&&e.id?`hasBorder_${e.id}`:"hasBorder",n=e!=null&&e.id?`borderSelection_${e.id}`:"borderSelection",r=e!=null&&e.id?`borderStyle_${e.id}`:"borderStyle",a=e!=null&&e.id?`borderWidth_${e.id}`:"borderWidth",l=e!=null&&e.id?`borderColor_${e.id}`:"borderColor",u=(e==null?void 0:e.defaultColor)||We,d=e!=null&&e.switchLabel?e.switchLabel:void 0;return{id:t,label:"Border",type:"switch",switchLabel:d,defaultValue:!!(e!=null&&e.defaultValue),on:[{id:n,type:"multiInput",onChange:c=>h.appendUnit(c,a),layout:h.MultiInputLayout.Columns,lastItemFullWidth:!0,blocks:[{id:r,type:"dropdown",defaultValue:M.Solid,choices:[{value:M.Solid,label:M.Solid},{value:M.Dotted,label:M.Dotted},{value:M.Dashed,label:M.Dashed}]},{id:a,type:"input",defaultValue:Zt,rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)],placeholder:"e.g. 3px"},{id:l,type:"colorInput",defaultValue:u}]}],off:[]}},Re=(e,t=H.None)=>({id:e,type:"segmentedControls",defaultValue:t,choices:[{value:H.None,label:"None"},{value:H.Small,label:"S"},{value:H.Medium,label:"M"},{value:H.Large,label:"L"}]}),Xs=e=>{const t=e!=null&&e.id?`hasRadius_${e.id}`:"hasRadius",n=e!=null&&e.id?`radiusValue_${e.id}`:"radiusValue",r=e!=null&&e.id?`radiusChoice_${e.id}`:"radiusChoice",a=(e==null?void 0:e.defaultRadius)||H.None;return{id:t,label:"Corner radius",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"Determining how rounded the corners are.",show:l=>{var u;return e!=null&&e.dependentSettingId?!!((u=l.getBlock(e.dependentSettingId))!=null&&u.value):!0},onChange:l=>h.presetCustomValue(l,r,n,(e==null?void 0:e.radiusStyleMap)||W),on:[{id:n,type:"input",placeholder:"e.g. 10px",rules:[h.numericalOrPixelRule],onChange:l=>h.appendUnit(l,n)}],off:[Re(r,a)]}},Qs=e=>{const t=e!=null&&e.id?`hasExtendedCustomRadius_${e.id}`:"hasExtendedCustomRadius",n=e!=null&&e.id?`extendedRadiusValue_${e.id}`:"extendedRadiusValue",r=e!=null&&e.id?`extendedRadiusChoice_${e.id}`:"extendedRadiusChoice",a=e!=null&&e.id?`extendedRadiusTopLeft_${e.id}`:"extendedRadiusTopLeft",l=e!=null&&e.id?`extendedRadiusTopRight_${e.id}`:"extendedRadiusTopRight",u=e!=null&&e.id?`extendedRadiusBottomLeft_${e.id}`:"extendedRadiusBottomLeft",d=e!=null&&e.id?`extendedRadiusBottomRight_${e.id}`:"extendedRadiusBottomRight";return{id:t,label:"Corner radius",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"Determining how rounded the corners are.",show:c=>{var m;return e!=null&&e.dependentSettingId?!!((m=c.getBlock(e.dependentSettingId))!=null&&m.value):!0},onChange:c=>{h.presetCustomValue(c,r,a,W),h.presetCustomValue(c,r,l,W),h.presetCustomValue(c,r,u,W),h.presetCustomValue(c,r,d,W)},on:[{id:n,type:"multiInput",layout:h.MultiInputLayout.Columns,blocks:[{id:a,type:"input",label:"Top Left",rules:[h.numericalOrPixelRule],onChange:c=>h.appendUnit(c,a)},{id:l,type:"input",label:"Top Right",rules:[h.numericalOrPixelRule],onChange:c=>h.appendUnit(c,l)},{id:u,type:"input",label:"Bottom Left",rules:[h.numericalOrPixelRule],onChange:c=>h.appendUnit(c,u)},{id:d,type:"input",label:"Bottom Right",rules:[h.numericalOrPixelRule],onChange:c=>h.appendUnit(c,d)}]}],off:[Re(r,e==null?void 0:e.defaultValue)]}},Ys=e=>{const t=e!=null&&e.id?e.id:"hasCustomSpacing",n=e!=null&&e.dependentSettingId?e.dependentSettingId:"columns",r=e!=null&&e.spacingChoiceId?e.spacingChoiceId:"spacingChoice",a=e!=null&&e.spacingCustomId?e.spacingCustomId:"spacingCustom",l=e!=null&&e.defaultValueChoices?e.defaultValueChoices:$.M;return{id:t,type:"switch",defaultValue:!1,switchLabel:"Custom",label:"Gutter",info:"An official nerds term for ‘gap’",onChange:u=>h.presetCustomValue(u,r,a,$e),show:u=>{var d;return((d=u.getBlock(n))==null?void 0:d.value)!=="1"},on:[{id:a,type:"input",rules:[h.numericalOrPixelRule],onChange:u=>h.appendUnit(u,a)}],off:[{id:r,type:"slider",defaultValue:l,choices:[{value:$.Auto,label:"Auto"},{value:$.S,label:"S"},{value:$.M,label:"M"},{value:$.L,label:"L"}]}]}},Fe=e=>({id:e,type:"segmentedControls",defaultValue:z.None,choices:[{value:z.None,label:"None"},{value:z.Small,label:"S"},{value:z.Medium,label:"M"},{value:z.Large,label:"L"}]}),Js=e=>{const t=e!=null&&e.id?`hasCustomMarginValue_${e==null?void 0:e.id}`:"hasCustomMarginValue",n=e!=null&&e.id?`marginValue_${e==null?void 0:e.id}`:"marginValue",r=e!=null&&e.id?`marginChoice_${e==null?void 0:e.id}`:"marginChoice";return{id:t,label:"Margin",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more space",onChange:a=>h.presetCustomValue(a,r,n,(e==null?void 0:e.marginStyleMap)||Z),on:[{id:n,type:"input",placeholder:ie,rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)],onChange:a=>h.appendUnit(a,n)}],off:[Fe(r)]}},Zs=e=>{const t=e!=null&&e.id?`hasExtendedCustomMargin_${e==null?void 0:e.id}`:"hasExtendedCustomMargin",n=e!=null&&e.id?`extendedMarginValues_${e==null?void 0:e.id}`:"extendedMarginValues",r=e!=null&&e.id?`extendedMarginChoice_${e==null?void 0:e.id}`:"extendedMarginChoice",a=e!=null&&e.id?`extendedMarginTop_${e==null?void 0:e.id}`:"extendedMarginTop",l=e!=null&&e.id?`extendedMarginLeft_${e==null?void 0:e.id}`:"extendedMarginLeft",u=e!=null&&e.id?`extendedMarginRight_${e==null?void 0:e.id}`:"extendedMarginRight",d=e!=null&&e.id?`extendedMarginBottom_${e==null?void 0:e.id}`:"extendedMarginBottom";return{id:t,label:"Margin",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more negative space",onChange:c=>{h.presetCustomValue(c,r,a,Z),h.presetCustomValue(c,r,l,Z),h.presetCustomValue(c,r,u,Z),h.presetCustomValue(c,r,d,Z)},on:[{id:n,type:"multiInput",layout:h.MultiInputLayout.Spider,blocks:[{id:a,type:"input",label:"Top",placeholder:ie,onChange:c=>h.appendUnit(c,a),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:l,type:"input",label:"Left",placeholder:ie,onChange:c=>h.appendUnit(c,l),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:u,type:"input",label:"Right",placeholder:ie,onChange:c=>h.appendUnit(c,u),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:d,type:"input",label:"Bottom",placeholder:ie,onChange:c=>h.appendUnit(c,d),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]}]}],off:[Fe(r)]}},Me=e=>({id:e,type:"segmentedControls",defaultValue:V.Small,choices:[{value:V.None,label:"None"},{value:V.Small,label:"S"},{value:V.Medium,label:"M"},{value:V.Large,label:"L"}]}),er=e=>{const t=e!=null&&e.id?`hasCustomPaddingValue_${e==null?void 0:e.id}`:"hasCustomPaddingValue",n=e!=null&&e.id?`paddingValue_${e==null?void 0:e.id}`:"paddingValue",r=e!=null&&e.id?`paddingChoice_${e==null?void 0:e.id}`:"paddingChoice";return{id:t,label:"Padding",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more negative space",onChange:a=>h.presetCustomValue(a,r,n,(e==null?void 0:e.paddingStyleMap)||J),on:[{id:n,type:"input",placeholder:ae,rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)],onChange:a=>h.appendUnit(a,n)}],off:[Me(r)]}},tr=e=>{const t=e!=null&&e.id?`hasExtendedCustomPadding_${e==null?void 0:e.id}`:"hasExtendedCustomPadding",n=e!=null&&e.id?`extendedPaddingValues_${e==null?void 0:e.id}`:"extendedPaddingValues",r=e!=null&&e.id?`extendedPaddingChoice_${e==null?void 0:e.id}`:"extendedPaddingChoice",a=e!=null&&e.id?`extendedPaddingTop_${e==null?void 0:e.id}`:"extendedPaddingTop",l=e!=null&&e.id?`extendedPaddingLeft_${e==null?void 0:e.id}`:"extendedPaddingLeft",u=e!=null&&e.id?`extendedPaddingRight_${e==null?void 0:e.id}`:"extendedPaddingRight",d=e!=null&&e.id?`extendedPaddingBottom_${e==null?void 0:e.id}`:"extendedPaddingBottom";return{id:t,label:"Padding",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more negative space",onChange:c=>{h.presetCustomValue(c,r,a,J),h.presetCustomValue(c,r,l,J),h.presetCustomValue(c,r,u,J),h.presetCustomValue(c,r,d,J)},on:[{id:n,type:"multiInput",layout:h.MultiInputLayout.Spider,blocks:[{id:a,type:"input",label:"Top",placeholder:ae,onChange:c=>h.appendUnit(c,a),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:l,type:"input",label:"Left",placeholder:ae,onChange:c=>h.appendUnit(c,l),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:u,type:"input",label:"Right",placeholder:ae,onChange:c=>h.appendUnit(c,u),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:d,type:"input",label:"Bottom",placeholder:ae,onChange:c=>h.appendUnit(c,d),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]}]}],off:[Me(r)]}},nr=e=>{const t=De(e==null?void 0:e.globalControlId);return{id:e!=null&&e.id?e.id:"downloadable",type:"switch",defaultValue:!1,label:"Downloadable",show:n=>{var r;return((r=n.getBlock(t))==null?void 0:r.value)===q.Custom}}},De=e=>e||"security",sr=e=>[{id:De(e),type:"segmentedControls",defaultValue:q.Global,choices:[{value:q.Global,label:"Global Settings"},{value:q.Custom,label:"Custom"}]},{id:"globalSettingsInfo",type:"notification",footer:h.createFooter({label:"Change global settings [here].",replace:{here:{event:"general-settings.open"}}})}];var Rt=(e=>(e.Main="main",e.Basics="basics",e.Layout="layout",e.Style="style",e.Security="security",e.Targets="targets",e))(Rt||{});const rr=e=>e,ar=e=>e;exports.AllTextStylePlugins=ps;exports.AllTextStyles=bs;exports.Attachments=on;exports.BUTTON_PLUGIN=jt;exports.BlockButtonStyles=we;exports.BlockInjectButton=Vt;exports.BlockItemWrapper=sn;exports.BlockStyles=T;exports.BorderStyle=M;exports.ButtonPlugin=Lt;exports.Custom1Plugin=dt;exports.Custom2Plugin=mt;exports.Custom3Plugin=ft;exports.DEFAULT_DRAGGING_TOOLTIP=Ge;exports.DEFAULT_DRAG_TOOLTIP=qe;exports.DownloadButton=ln;exports.ELEMENT_BUTTON=C;exports.GutterSpacing=$;exports.Heading1Plugin=xt;exports.Heading2Plugin=yt;exports.Heading3Plugin=pt;exports.Heading4Plugin=bt;exports.ImageCaptionPlugin=vt;exports.ImageTitlePlugin=kt;exports.LinkInput=ot;exports.LinkPlugin=ut;exports.LinkSelector=it;exports.Margin=z;exports.PARAGRAPH_CLASSES=St;exports.Padding=V;exports.ParagraphMarkupElement=Et;exports.ParagraphMarkupElementNode=ue;exports.ParagraphPlugin=Ct;exports.QuoteMarkupElementNode=de;exports.QuotePlugin=It;exports.Radius=H;exports.RichTextEditor=_s;exports.Sections=Rt;exports.Security=q;exports.THEME_PREFIX=zs;exports.TextStylePluginsWithoutImage=Ae;exports.TextStyles=y;exports.TextStylesWithoutImage=ee;exports.addHttps=me;exports.borderStyleMap=ze;exports.convertToRteValue=un;exports.createButtonNode=rt;exports.createButtonPlugin=Bt;exports.createLinkPlugin=ct;exports.createParagraphPlugin=Pt;exports.createQuotePlugin=Tt;exports.customCoordinatesGetterFactory=Xe;exports.defineBlock=rr;exports.defineSettings=ar;exports.getBackgroundColorStyles=Yt;exports.getBackgroundSettings=Gs;exports.getBorderRadiusSettings=Xs;exports.getBorderRadiusSlider=Re;exports.getBorderSettings=Ks;exports.getBorderStyles=en;exports.getDefaultPluginsWithLinkChooser=Vs;exports.getExtendedBorderRadiusSettings=Qs;exports.getGutterSettings=Ys;exports.getLegacyUrl=Je;exports.getMarginExtendedSettings=Zs;exports.getMarginSettings=Js;exports.getMarginSlider=Fe;exports.getPaddingExtendedSettings=tr;exports.getPaddingSettings=er;exports.getPaddingSlider=Me;exports.getRadiusStyles=tn;exports.getReadableColor=Xt;exports.getSecurityDownloadableSetting=nr;exports.getSecurityGlobalControlId=De;exports.getSecurityGlobalControlSetting=sr;exports.getUrl=Ze;exports.getUrlFromEditor=Le;exports.getUrlFromLinkOrLegacyLink=hn;exports.gutterSpacingStyleMap=$e;exports.hasRichTextValue=Ke;exports.insertButton=tt;exports.isDark=$t;exports.isDownloadable=gn;exports.isValidUrl=he;exports.isValidUrlOrEmpty=te;exports.joinClassNames=U;exports.mapAppBridgeColorPaletteToFonduePalette=Qe;exports.mapAppBridgeColorPalettesToFonduePalettes=mn;exports.marginStyleMap=Z;exports.moveItemInArray=Qt;exports.paddingStyleMap=J;exports.radiusStyleMap=W;exports.relativeUrlRegex=Ie;exports.setAlpha=Gt;exports.submitFloatingButton=je;exports.toColorObject=Kt;exports.toHex8String=Wt;exports.toHexString=qt;exports.toRgbaString=Ee;exports.toShortRgba=K;exports.triggerFloatingButton=at;exports.triggerFloatingButtonEdit=fe;exports.triggerFloatingButtonInsert=Ne;exports.unwrapButton=se;exports.upsertButton=nt;exports.upsertButtonText=Be;exports.useAttachments=$s;exports.useDndSensors=qs;exports.withButton=et;exports.wrapButton=st;Object.keys(h).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>h[e]})});
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("@frontify/sidebar-settings"),s=require("react/jsx-runtime"),i=require("@frontify/fondue"),y=require("react"),G=require("@frontify/app-bridge"),P=require("@dnd-kit/core"),oe=require("@dnd-kit/sortable"),_e=require("@react-aria/focus"),Ut=require("@dnd-kit/modifiers"),o=require("@udecode/plate"),Ve=require("slate-react"),Ht=require("@react-stately/overlays"),_t=require("slate"),O=require("@ctrl/tinycolor");const U=e=>e.filter(Boolean).join(" "),Vt=({onDrop:e,label:t,icon:n,secondaryLabel:r,isLoading:a,fillParentContainer:l,onAssetChooseClick:u,onUploadClick:d,withMenu:c=!0,onClick:m,validFileType:f,verticalLayout:g})=>{const[w,b]=y.useState(!1),[p,S]=y.useState(),L=y.useRef(null),[E,N]=y.useState(void 0),D=k=>{if(k.preventDefault(),b(!1),!X(k.dataTransfer.files)){N("Invalid"),setTimeout(()=>{N(void 0)},1e3);return}e==null||e(k.dataTransfer.files)},X=k=>{if(!f)return!0;for(let B=0;B<k.length;B++){const A=k[B].name.split(".").pop()??"";if(!G.FileExtensionSets[f].includes(A))return!1}return!0},F=k=>{if(!L.current||a)return;const{left:B,top:A}=L.current.getBoundingClientRect(),Q=k.clientX-B,re=k.clientY-A;S([Q,re])};return s.jsxs("button",{ref:L,"data-test-id":"block-inject-button",className:U(["tw-font-body tw-relative tw-text-sm tw-leading-4 tw-border tw-flex tw-items-center tw-justify-center tw-cursor-pointer tw-gap-3 tw-w-full first:tw-rounded-tl last:tw-rounded-br",g?"[&:not(:first-child)]:tw-border-t-0 first:tw-rounded-tr last:tw-rounded-bl":"[&:not(:first-child)]:tw-border-l-0 first:tw-rounded-bl last:tw-rounded-tr",l?"tw-h-full":"tw-h-[72px]",w&&!a?"tw-border-dashed":"tw-border-solid",p&&"tw-bg-blank-state-pressed-inverse",w&&"tw-bg-blank-state-weak-inverse",E?"!tw-border-red-50 !tw-cursor-not-allowed":" tw-border-blank-state-line",a||p||w||E?"":"tw-text-text-weak hover:tw-text-blank-state-hover hover:tw-bg-blank-state-hover-inverse hover:tw-border-blank-state-line-hover active:tw-text-blank-state-pressed active:tw-bg-blank-state-pressed-inverse active:tw-border-blank-state-line-hover",(w||p)&&!E?"[&>*]:tw-pointer-events-none tw-border-blank-state-line-hover":"tw-bg-blank-state-shaded-inverse tw-text-blank-state-shaded"]),onDragEnter:e?k=>{var B;if(b(!0),f==="Images")for(const A of Array.from(k.dataTransfer.items))(B=A==null?void 0:A.type)!=null&&B.startsWith("image/")?N(void 0):N("Invalid")}:void 0,onDragLeave:e?()=>{b(!1),N(void 0)}:void 0,onDrop:e?D:void 0,onClick:k=>{c&&F(k),m==null||m()},children:[a?s.jsx(i.LoadingCircle,{}):E?s.jsxs("div",{className:" tw-flex tw-items-center tw-justify-center tw-text-red-60 tw-font-medium",children:[s.jsx(i.IconExclamationMarkTriangle,{}),E]}):s.jsxs(s.Fragment,{children:[n&&s.jsx("div",{children:n}),(t||r)&&s.jsxs("div",{className:"tw-flex tw-flex-col tw-items-start",children:[t&&s.jsx("div",{className:"tw-font-medium",children:t}),r&&s.jsx("div",{className:"tw-font-normal",children:r})]})]}),p&&s.jsx("div",{className:"tw-absolute tw-left-0 tw-top-full tw-z-20",style:{left:p[0],top:p[1]},children:s.jsx(i.Flyout,{onOpenChange:k=>!k&&S(void 0),isOpen:!0,fitContent:!0,hug:!1,legacyFooter:!1,trigger:s.jsx("div",{}),children:s.jsx(i.ActionMenu,{menuBlocks:[{id:"menu",menuItems:[...d?[{id:"upload",size:i.MenuItemContentSize.XSmall,title:"Upload asset",onClick:()=>{d(),S(void 0)},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:s.jsx(i.IconArrowCircleUp20,{})})}]:[],...u?[{id:"asset",size:i.MenuItemContentSize.XSmall,title:"Browse asset",onClick:()=>{u(),S(void 0)},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:s.jsx(i.IconImageStack20,{})})}]:[]]}]})})})]})},K=e=>{const t=r=>typeof r=="object"&&["red","green","blue"].every(l=>r.hasOwnProperty(l)),n=r=>{const a=typeof r.alpha=="number"?r.alpha:1;return{r:r.red,g:r.green,b:r.blue,a}};return t(e)?n(e):e},zt=e=>typeof e=="object"&&["red","green","blue"].every(n=>e==null?void 0:e.hasOwnProperty(n)),$t=(e,t)=>{const n=zt(e)?K(e):e,r=new O.TinyColor(n);return t?r.getBrightness()<t:r.isDark()||r.getAlpha()>.25&&r.getAlpha()<1},Wt=e=>new O.TinyColor(K(e)).toHex8String(),qt=e=>new O.TinyColor(K(e)).toHexString(),Ee=e=>new O.TinyColor(K(e)).toRgbString(),Gt=(e,t)=>new O.TinyColor(t).setAlpha(e).toRgbString(),Kt=e=>{const{r:t,g:n,b:r,a}=new O.TinyColor(e);return{red:t,green:n,blue:r,alpha:a}},He=e=>typeof e=="object"&&["red","green","blue"].every(n=>e==null?void 0:e.hasOwnProperty(n)),Xt=(e,t)=>{const n=He(e)?K(e):e,r=He(t)?K(t):t;let a=new O.TinyColor(n);const l=new O.TinyColor(r);for(;O.readability(a,l)<4.5;)a=a.darken(1);return a.toRgbString()},Qt=(e,t,n)=>{const r=[...e],a=n<0?r.length+n:n;if(a>=0&&a<r.length){const l=r.splice(t,1)[0];r.splice(a,0,l)}return r},Yt=e=>({backgroundColor:Ee(e)});var M=(e=>(e.Solid="Solid",e.Dashed="Dashed",e.Dotted="Dotted",e))(M||{});const ze={Solid:"solid",Dotted:"dotted",Dashed:"dashed"};var H=(e=>(e.None="None",e.Small="Small",e.Medium="Medium",e.Large="Large",e))(H||{});const W={None:"0px",Small:"2px",Medium:"4px",Large:"12px"};var V=(e=>(e.None="None",e.Small="Small",e.Medium="Medium",e.Large="Large",e))(V||{});const J={None:"0px",Small:"24px",Medium:"36px",Large:"60px"};var z=(e=>(e.None="None",e.Small="Small",e.Medium="Medium",e.Large="Large",e))(z||{});const Z={None:"0px",Small:"24px",Medium:"36px",Large:"60px"};var q=(e=>(e.Global="Global",e.Custom="Custom",e))(q||{}),$=(e=>(e.Auto="Auto",e.S="S",e.M="M",e.L="L",e))($||{});const $e={Auto:"4px",S:"10px",M:"30px",L:"50px"},Jt={red:241,green:241,blue:241,alpha:1},We={red:234,green:235,blue:235,alpha:1},Zt="1px",ae="24px",ie="24px",en=(e=M.Solid,t="1px",n=We)=>({borderStyle:ze[e],borderWidth:t,borderColor:Ee(n)}),tn=(e,t=!1,n)=>({borderRadius:t?n:W[e]}),qe="Drag or press ↵ to move",Ge="Move with ↑↓←→ and confirm with ↵",nn=({items:e,flyoutItems:t,isFlyoutOpen:n,setIsFlyoutOpen:r,isDragging:a,isFlyoutDisabled:l})=>s.jsx("div",{"data-test-id":"block-item-wrapper-toolbar",className:"tw-flex tw-justify-end",children:s.jsxs("div",{className:"tw-bg-white tw-text-box-selected-inverse tw-pointer-events-auto tw-flex tw-flex-shrink-0 tw-gap-[2px] tw-px-[1px] tw-spacing tw-items-center tw-h-7 tw-self-start tw-border tw-border-box-selected-inverse tw-rounded",children:[e.map((u,d)=>"draggableProps"in u?s.jsx(i.LegacyTooltip,{withArrow:!0,hoverDelay:0,enterDelay:300,open:a,position:i.TooltipPosition.Top,content:s.jsx("div",{children:a?Ge:u.tooltip??qe}),triggerElement:s.jsx("button",{ref:u.setActivatorNodeRef,"data-test-id":"block-item-wrapper-toolbar-btn",...u.draggableProps,className:U(["tw-bg-base tw-inline-flex tw-items-center tw-justify-center tw-w-6 tw-h-6 tw-rounded-sm",a?"tw-cursor-grabbing tw-bg-box-selected-pressed":"tw-cursor-grab hover:tw-bg-box-selected-hover"]),children:u.icon})},d):s.jsx(i.LegacyTooltip,{withArrow:!0,enterDelay:300,hoverDelay:0,disabled:a,position:i.TooltipPosition.Top,content:s.jsx("div",{children:u.tooltip??""}),triggerElement:s.jsx("button",{"data-test-id":"block-item-wrapper-toolbar-btn",onClick:u.onClick,className:"tw-bg-base hover:tw-bg-box-selected-hover active:tw-bg-box-selected-pressed tw-cursor-pointer tw-inline-flex tw-items-center tw-justify-center tw-w-6 tw-h-6 tw-rounded-sm",children:u.icon})},d)),t.length>0&&s.jsx("div",{className:"tw-flex tw-flex-shrink-0 tw-flex-1 tw-h-6",children:s.jsx(i.Flyout,{isOpen:n&&!a,isTriggerDisabled:l,legacyFooter:!1,fitContent:!0,hug:!1,onOpenChange:r,trigger:s.jsx(i.LegacyTooltip,{withArrow:!0,hoverDelay:0,enterDelay:300,disabled:a,position:i.TooltipPosition.Top,content:s.jsx("div",{children:"Options"}),triggerElement:s.jsx("div",{"data-test-id":"block-item-wrapper-toolbar-flyout",className:"tw-bg-base hover:tw-bg-box-selected-hover active:tw-bg-box-selected-pressed tw-cursor-pointer tw-inline-flex tw-items-center tw-justify-center tw-w-6 tw-h-6 tw-rounded-sm",children:s.jsx(i.IconDotsHorizontal16,{})})}),children:s.jsx(i.ActionMenu,{menuBlocks:t.map((u,d)=>({id:d.toString(),menuItems:u.map((c,m)=>({id:d.toString()+m.toString(),size:i.MenuItemContentSize.XSmall,title:c.title,style:c.style,onClick:()=>{r(!1),c.onClick()},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:c.icon})}))}))})})})]})}),sn=({children:e,toolbarFlyoutItems:t,toolbarItems:n,shouldHideWrapper:r,shouldHideComponent:a=!1,isDragging:l,shouldFillContainer:u,outlineOffset:d=2,shouldBeShown:c=!1})=>{const[m,f]=y.useState(c),[g,w]=y.useState(!1),b=y.useRef(null);if(y.useEffect(()=>{m||w(!0)},[m]),r)return e;const p=n==null?void 0:n.filter(S=>S!==void 0);return s.jsxs("div",{ref:b,onFocus:()=>w(!1),onPointerEnter:()=>w(!1),"data-test-id":"block-item-wrapper",style:{outlineOffset:d},className:U(["tw-relative tw-group tw-outline-1 tw-outline-box-selected-inverse",u&&"tw-flex-1 tw-h-full tw-w-full","hover:tw-outline focus-within:tw-outline",(m||c)&&"tw-outline",a&&"tw-opacity-0"]),children:[s.jsx("div",{style:{right:-1-d,bottom:`calc(100% - ${2+d}px)`},className:U(["tw-pointer-events-none tw-absolute tw-bottom-[calc(100%-4px)] tw-right-[-3px] tw-w-full tw-opacity-0 tw-z-10","group-hover:tw-opacity-100 group-focus:tw-opacity-100 focus-within:tw-opacity-100",(m||c)&&"tw-opacity-100"]),children:s.jsx(nn,{isFlyoutOpen:m,isFlyoutDisabled:g,setIsFlyoutOpen:f,flyoutItems:t,items:p,isDragging:l})}),e]})},rn=e=>e==="IMAGE"?s.jsx(i.IconImage24,{}):e==="VIDEO"?s.jsx(i.IconPlayFrame24,{}):e==="AUDIO"?s.jsx(i.IconMusicNote24,{}):s.jsx(i.IconDocument24,{}),Pe=y.forwardRef(({item:e,isEditing:t,draggableProps:n,transformStyle:r,isDragging:a,isOverlay:l,isLoading:u,onDelete:d,onReplaceWithBrowse:c,onReplaceWithUpload:m},f)=>{const[g,w]=y.useState(),[b,{selectedFiles:p}]=G.useFileInput({multiple:!0,accept:"image/*"}),[S,{results:L,doneAll:E}]=G.useAssetUpload(),{focusProps:N,isFocusVisible:D}=_e.useFocusRing();y.useEffect(()=>{p&&S(p[0])},[p]),y.useEffect(()=>{E&&m(L[0])},[E,L]);const X=(k,B)=>{fetch(k).then(A=>{A.blob().then(Q=>{const re=URL.createObjectURL(Q),Y=document.createElement("a");Y.href=re,Y.download=B,Y.click()})})},F=u||p&&!E;return s.jsxs("button",{"aria-label":"Download attachment","data-test-id":"attachments-item",onClick:()=>X(e.genericUrl,e.fileName),ref:f,style:{...r,opacity:a&&!l?.3:1,fontFamily:"var(-f-theme-settings-body-font-family)"},className:U(["tw-cursor-pointer tw-text-left tw-w-full tw-relative tw-flex tw-gap-3 tw-px-5 tw-py-3 tw-items-center tw-group hover:tw-bg-box-neutral-hover",a?"tw-bg-box-neutral-hover":""]),children:[s.jsx("div",{className:"tw-text-text-weak group-hover:tw-text-box-neutral-inverse-hover",children:F?s.jsx(i.LoadingCircle,{size:i.LoadingCircleSize.Small}):rn(e.objectType)}),s.jsxs("div",{className:"tw-text-s tw-flex-1 tw-min-w-0",children:[s.jsx("div",{className:"tw-whitespace-nowrap tw-overflow-hidden tw-text-ellipsis tw-font-bold tw-text-text-weak group-hover:tw-text-box-neutral-inverse-hover",children:e.title}),s.jsx("div",{className:"tw-text-text-weak",children:`${e.fileSizeHumanReadable} - ${e.extension}`})]}),t&&s.jsxs("div",{"data-test-id":"attachments-actionbar",className:U(["tw-flex tw-gap-0.5 group-focus:tw-opacity-100 focus-visible:tw-opacity-100 focus-within:tw-opacity-100 group-hover:tw-opacity-100",l||(g==null?void 0:g.id)===e.id?"tw-opacity-100":"tw-opacity-0"]),children:[s.jsx("button",{...N,...n,"aria-label":"Drag attachment",className:U([" tw-border-button-border tw-bg-button-background active:tw-bg-button-background-pressed tw-group tw-border tw-box-box tw-relative tw-flex tw-items-center tw-justify-center tw-outline-none tw-font-medium tw-rounded tw-h-9 tw-w-9 ",a||l?"tw-cursor-grabbing tw-bg-button-background-pressed hover:tw-bg-button-background-pressed":"tw-cursor-grab hover:tw-bg-button-background-hover",D&&i.FOCUS_STYLE,D&&"tw-z-[2]"]),children:s.jsx(i.IconGrabHandle20,{})}),s.jsx("div",{"data-test-id":"attachments-actionbar-flyout",children:s.jsx(i.Flyout,{placement:i.FlyoutPlacement.Right,isOpen:(g==null?void 0:g.id)===e.id,fitContent:!0,legacyFooter:!1,onOpenChange:k=>w(k?e:void 0),trigger:(k,B)=>s.jsx(i.Button,{ref:B,icon:s.jsx(i.IconPen20,{}),emphasis:i.ButtonEmphasis.Default,onClick:()=>w(e)}),children:s.jsx(i.ActionMenu,{menuBlocks:[{id:"menu",menuItems:[{id:"upload",size:i.MenuItemContentSize.XSmall,title:"Replace with upload",onClick:()=>{b(),w(void 0)},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:s.jsx(i.IconArrowCircleUp20,{})})},{id:"asset",size:i.MenuItemContentSize.XSmall,title:"Replace with asset",onClick:()=>{c(),w(void 0)},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:s.jsx(i.IconImageStack20,{})})}]},{id:"menu-delete",menuItems:[{id:"delete",size:i.MenuItemContentSize.XSmall,title:"Delete",style:i.MenuItemStyle.Danger,onClick:()=>{d(),w(void 0)},initialValue:!0,decorator:s.jsx("div",{className:"tw-mr-2",children:s.jsx(i.IconTrashBin20,{})})}]}]})})})]})]})});Pe.displayName="AttachmentItem";const an=e=>{const{attributes:t,listeners:n,setNodeRef:r,transform:a,transition:l,isDragging:u}=oe.useSortable({id:e.item.id}),d={transform:a?`translate(${a.x}px, ${a.y}px)`:"",transition:l,zIndex:u?2:1},c={...t,...n};return s.jsx(Pe,{ref:r,isDragging:u,transformStyle:d,draggableProps:c,...e})},on=({items:e=[],onDelete:t,onReplaceWithBrowse:n,onReplaceWithUpload:r,onBrowse:a,onUpload:l,onSorted:u,appBridge:d})=>{const[c,m]=y.useState(e),[f,g]=y.useState(!1),w=P.useSensors(P.useSensor(P.PointerSensor),P.useSensor(P.KeyboardSensor)),[b,p]=y.useState(void 0),[S,L]=y.useState(!1),[E,N]=y.useState([]),[D,X]=y.useState(null),F=G.useEditorState(d),k=c==null?void 0:c.find(v=>v.id===b),[B,{results:A,doneAll:Q}]=G.useAssetUpload({onUploadProgress:()=>!S&&L(!0)});y.useEffect(()=>{m(e)},[e]),y.useEffect(()=>{D&&(L(!0),B(D))},[D]),y.useEffect(()=>{(async()=>{Q&&(await l(A),L(!1))})()},[Q,A]);const re=()=>{g(!1),d.openAssetChooser(v=>{a(v),d.closeAssetChooser(),g(!0)},{multiSelection:!0,selectedValueIds:c.map(v=>v.id)})},Y=v=>{g(!1),d.openAssetChooser(async R=>{g(!0),d.closeAssetChooser(),N([...E,v.id]),await n(v,R[0]),N(E.filter(_=>_!==v.id))},{multiSelection:!1,selectedValueIds:c.map(R=>R.id)})},Oe=async(v,R)=>{N([...E,v.id]),await r(v,R),N(E.filter(_=>_!==v.id))},Ft=v=>{const{active:R}=v;p(R.id)},Mt=v=>{const{active:R,over:_}=v;if(_&&R.id!==_.id&&c){const Dt=c.findIndex(ye=>ye.id===R.id),Ot=c.findIndex(ye=>ye.id===_.id),Ue=oe.arrayMove(c,Dt,Ot);m(Ue),u(Ue)}p(void 0)};return F||((c==null?void 0:c.length)??0)>0?s.jsx(i.LegacyTooltip,{withArrow:!0,position:i.TooltipPosition.Top,content:"Attachments",disabled:f,enterDelay:500,triggerElement:s.jsx("div",{"data-test-id":"attachments-flyout-button",children:s.jsx(i.Flyout,{placement:i.FlyoutPlacement.BottomRight,onOpenChange:v=>g(k?!0:v),isOpen:f,hug:!1,fitContent:!0,legacyFooter:!1,trigger:s.jsxs("div",{className:"tw-flex tw-text-[13px] tw-font-body tw-items-center tw-gap-1 tw-rounded-full tw-bg-box-neutral-strong-inverse hover:tw-bg-box-neutral-strong-inverse-hover active:tw-bg-box-neutral-strong-inverse-pressed tw-text-box-neutral-strong tw-outline tw-outline-1 tw-outline-offset-[1px] tw-p-[6px] tw-outline-line",children:[s.jsx(i.IconPaperclip16,{}),s.jsx("div",{children:e.length>0?e.length:"Add"}),s.jsx(i.IconCaretDown12,{})]}),children:s.jsxs("div",{className:"tw-w-[300px]",children:[c.length>0&&s.jsxs(P.DndContext,{sensors:w,collisionDetection:P.closestCenter,onDragStart:Ft,onDragEnd:Mt,modifiers:[Ut.restrictToWindowEdges],children:[s.jsx(oe.SortableContext,{items:c,strategy:oe.rectSortingStrategy,children:s.jsx("div",{className:"tw-border-b tw-border-b-line",children:c.map(v=>s.jsx(an,{isEditing:F,isLoading:E.includes(v.id),item:v,onDelete:()=>t(v),onReplaceWithBrowse:()=>Y(v),onReplaceWithUpload:R=>Oe(v,R)},v.id))})}),s.jsx(P.DragOverlay,{children:k&&s.jsx(Pe,{isOverlay:!0,isEditing:F,item:k,isDragging:!0,onDelete:()=>t(k),onReplaceWithBrowse:()=>Y(k),onReplaceWithUpload:v=>Oe(k,v)},b)})]}),F&&s.jsxs("div",{className:"tw-px-5 tw-py-3",children:[s.jsx("div",{className:"tw-font-body tw-font-medium tw-text-text tw-text-s tw-my-4",children:"Add attachments"}),s.jsx(i.AssetInput,{isLoading:S,size:i.AssetInputSize.Small,onUploadClick:v=>X(v),onLibraryClick:re})]})]})})})}):null},ln=({onDownload:e})=>{const{isFocused:t,focusProps:n}=_e.useFocusRing();return s.jsx(i.LegacyTooltip,{withArrow:!0,position:i.TooltipPosition.Top,content:"Download",enterDelay:500,triggerElement:s.jsx("button",{tabIndex:0,"aria-label":"Download",...n,className:U(["tw-outline-none tw-rounded",t&&i.FOCUS_STYLE]),onClick:e,onPointerDown:r=>r.preventDefault(),children:s.jsx("span",{"data-test-id":"download-button",className:"tw-flex tw-text-xs tw-font-body tw-items-center tw-gap-1 tw-rounded-full tw-bg-box-neutral-strong-inverse hover:tw-bg-box-neutral-strong-inverse-hover active:tw-bg-box-neutral-strong-inverse-pressed tw-text-box-neutral-strong tw-outline tw-outline-1 tw-outline-offset-1 tw-p-1.5 tw-outline-line",children:s.jsx(i.IconArrowCircleDown16,{})})})})},cn=({value:e="",gap:t,columns:n,show:r=!0,plugins:a})=>{const[l,u]=y.useState(null);return y.useEffect(()=>{(async()=>u(await i.serializeRawToHtmlAsync(e,a,n,t)))()},[e,n,t,a]),!r||l==="<br />"?null:l!==null?s.jsx("div",{className:"tw-w-full","data-test-id":"rte-content-html",dangerouslySetInnerHTML:{__html:l}}):s.jsx("div",{className:"tw-rounded-sm tw-bg-base-alt tw-animate-pulse tw-h-full tw-min-h-[10px] tw-w-full"})},Ke=e=>{if(!e)return!1;const t=n=>n.some(r=>r.text?r.text!=="":r.children?t(r.children):!1);try{const n=JSON.parse(e);return t(n)}catch{return!1}},un=(e="p",t="",n)=>Ke(t)?t:JSON.stringify([{type:e,children:[{text:t,textStyle:e}],align:n}]),dn=[P.KeyboardCode.Down,P.KeyboardCode.Right,P.KeyboardCode.Up,P.KeyboardCode.Left],Xe=(e,t)=>(n,{currentCoordinates:r,context:{activeNode:a}})=>{if(n.preventDefault(),dn.includes(n.code)){const l=(a==null?void 0:a.offsetWidth)??0,u=(a==null?void 0:a.offsetHeight)??0;switch(n.code){case P.KeyboardCode.Right:return{...r,x:r.x+l+e};case P.KeyboardCode.Left:return{...r,x:r.x-l-e};case P.KeyboardCode.Down:return{...r,y:r.y+u+t};case P.KeyboardCode.Up:return{...r,y:r.y-u-t}}}},gn=(e,t,n)=>e===q.Custom?t:n,mn=e=>e.map(Qe),Qe=e=>({id:e.id,title:e.name,colors:e.colors.map(t=>({alpha:t.alpha?t.alpha/255:1,red:t.red??0,green:t.green??0,blue:t.blue??0,name:t.name??""}))}),Ye=(e,t)=>{const n=o.getAboveNode(e,{match:{type:o.ELEMENT_LINK}});return Array.isArray(n)?t(n[0]):""},Je=e=>Ye(e,t=>{var n,r;return((r=(n=t.chosenLink)==null?void 0:n.searchResult)==null?void 0:r.link)||""}),Ze=e=>Ye(e,t=>t.url||""),hn=e=>{var t,n;return e.url||((n=(t=e.chosenLink)==null?void 0:t.searchResult)==null?void 0:n.link)||""},Ie=/^\/(document|r)\/\S+$/i,me=e=>{if(Ie.test(e))return e;try{return new URL(e),e}catch{return`https://${e}`}},he=e=>{if(Ie.test(e))return!0;try{const t=new URL(e);return["http:","https:","mailto:","tel:"].includes(t.protocol)&&t.pathname!==""}catch{return!1}},te=e=>he(me(e))||e==="",et=(e,{type:t})=>{const{apply:n,normalizeNode:r}=e;return e.apply=a=>{if(a.type!=="set_selection"){n(a);return}const l=a.newProperties;if(!(l!=null&&l.focus)||!l.anchor||!o.isCollapsed(l)){n(a);return}const u=o.getAboveNode(e,{at:l,match:{type:o.getPluginType(e,C)}});if(u){const[,d]=u;let c;o.isStartPoint(e,l.focus,d)&&(c=o.getPreviousNodeEndPoint(e,d)),o.isEndPoint(e,l.focus,d)&&(c=o.getNextNodeStartPoint(e,d)),c&&(a.newProperties={anchor:c,focus:c})}n(a)},e.normalizeNode=([a,l])=>{if(a.type===o.getPluginType(e,C)){const u=e.selection;if(u&&o.isCollapsed(u)&&o.isEndPoint(e,u.focus,l)){const d=o.getNextNodeStartPoint(e,l);if(d)o.select(e,d);else{const c=_t.Path.next(l);o.insertNodes(e,{text:""},{at:c}),o.select(e,c)}}}r([a,l])},o.withRemoveEmptyNodes(e,o.mockPlugin({options:{types:t}}))},tt=(e,t,n)=>{o.insertNodes(e,[rt(e,t)],n)},Te=o.createStore("floatingButton")({openEditorId:null,mouseDown:!1,updated:!1,url:"",text:"",buttonStyle:"primary",newTab:!1,mode:"",isEditing:!1}).extendActions(e=>({reset:()=>{e.url(""),e.text(""),e.buttonStyle("primary"),e.newTab(!1),e.mode(""),e.isEditing(!1)}})).extendActions(e=>({show:(t,n)=>{e.mode(t),e.isEditing(!1),e.openEditorId(n)},hide:()=>{e.reset(),e.openEditorId(null)}})).extendSelectors(e=>({isOpen:t=>e.openEditorId===t})),I=Te.set,j=Te.get,ne=()=>Te.use,je=e=>{if(!e.selection)return;const{isUrl:t,forceSubmit:n}=o.getPluginOptions(e,C),r=j.url();if(!((t==null?void 0:t(r))||n))return;const l=j.text(),u=j.buttonStyle(),d=j.newTab()?void 0:"_self";return I.hide(),nt(e,{url:r,text:l,buttonStyle:u,target:d,isUrl:c=>n||!t?!0:t(c)}),setTimeout(()=>{o.focusEditor(e,e.selection??void 0)},0),!0},se=(e,t)=>o.withoutNormalizing(e,()=>{var n,r,a,l,u,d;if(t!=null&&t.split){if(o.getAboveNode(e,{at:(n=e.selection)==null?void 0:n.anchor,match:{type:o.getPluginType(e,C)}}))return o.splitNodes(e,{at:(r=e.selection)==null?void 0:r.anchor,match:f=>o.isElement(f)&&f.type===o.getPluginType(e,C)}),se(e,{at:(a=e.selection)==null?void 0:a.anchor}),!0;if(o.getAboveNode(e,{at:(l=e.selection)==null?void 0:l.focus,match:{type:o.getPluginType(e,C)}}))return o.splitNodes(e,{at:(u=e.selection)==null?void 0:u.focus,match:f=>o.isElement(f)&&f.type===o.getPluginType(e,C)}),se(e,{at:(d=e.selection)==null?void 0:d.focus}),!0}o.unwrapNodes(e,{match:{type:o.getPluginType(e,C)},...t})}),nt=(e,{url:t,text:n,buttonStyle:r,target:a,insertTextInButton:l,insertNodesOptions:u,isUrl:d=o.getPluginOptions(e,C).isUrl})=>{var E;const c=e.selection;if(!c)return;const m=o.getAboveNode(e,{at:c,match:{type:o.getPluginType(e,C)}});if(l&&m)return e.insertText(t),!0;if(!(d!=null&&d(t)))return;if(o.isDefined(n)&&n.length===0&&(n=t),m)return yn(t,e,m,a,r,n),!0;const f=o.findNode(e,{at:c,match:{type:o.getPluginType(e,C)}}),[g,w]=f??[],b=fn(e,w,n);if(o.isExpanded(c))return wn(m,e,t,r,a,n),!0;b&&o.removeNodes(e,{at:w});const p=o.getNodeProps(g??{}),S=(E=e.selection)==null?void 0:E.focus.path;if(!S)return;const L=o.getNodeLeaf(e,S);return n!=null&&n.length||(n=t),tt(e,{...p,url:t,target:a,children:[{...L,text:n}]},u),!0};function fn(e,t,n){return t&&(n==null?void 0:n.length)&&n!==o.getEditorString(e,t)}function wn(e,t,n,r,a,l){e?se(t,{at:e[1]}):se(t,{split:!0}),st(t,{url:n,buttonStyle:r,target:a}),Be(t,{url:n,target:a,text:l})}function yn(e,t,n,r,a,l){var u,d,c;(e!==((u=n[0])==null?void 0:u.url)||r!==((d=n[0])==null?void 0:d.target)||a!==((c=n[0])==null?void 0:c.buttonStyle))&&o.setNodes(t,{url:e,target:r,buttonStyle:a},{at:n[1]}),Be(t,{url:e,text:l,target:r})}const Be=(e,{text:t})=>{const n=o.getAboveNode(e,{match:{type:o.getPluginType(e,C)}});if(n){const[r,a]=n;if(t!=null&&t.length&&t!==o.getEditorString(e,a)){const l=r.children[0];o.replaceNodeChildren(e,{at:a,nodes:{...l,text:t},insertOptions:{select:!0}})}}},st=(e,{url:t,buttonStyle:n,target:r,...a})=>{o.wrapNodes(e,{type:o.getPluginType(e,C),url:t,buttonStyle:n,target:r,children:[]},{split:!0,...a})},xn=(e,t)=>{const n=o.getAboveNode(e,{match:{type:C}});return Array.isArray(n)?t(n[0]):""},Le=e=>xn(e,t=>t.url??""),rt=(e,{url:t,text:n="",buttonStyle:r="primary",target:a,children:l})=>({type:o.getPluginType(e,C),url:t,target:a,buttonStyle:r,children:l??[{text:n}]}),at=(e,{focused:t}={})=>{if(j.mode()==="edit"){fe(e);return}Ne(e,{focused:t})},fe=e=>{const t=o.findNode(e,{match:{type:o.getPluginType(e,C)}});if(!t)return;const[n,r]=t;let a=o.getEditorString(e,r);I.url(n.url),I.newTab(n.target===void 0),a===n.url&&(a=""),I.text(a),I.isEditing(!0)},Ne=(e,{focused:t}={})=>{j.mode()||!t||o.isRangeAcrossBlocks(e,{at:e.selection})||o.someNode(e,{match:{type:o.getPluginType(e,C)}})||(I.text(o.getEditorString(e,e.selection)),I.show("insert",e.id))},we={buttonPrimary:{fontFamily:"var(--f-theme-settings-button-primary-font-family)",fontSize:"var(--f-theme-settings-button-primary-font-size)",fontWeight:"var(--f-theme-settings-button-primary-font-weight)",lineHeight:"var(--f-theme-settings-button-primary-line-height)",paddingTop:"var(--f-theme-settings-button-primary-padding-top)",paddingRight:"var(--f-theme-settings-button-primary-padding-right)",paddingBottom:"var(--f-theme-settings-button-primary-padding-bottom)",paddingLeft:"var(--f-theme-settings-button-primary-padding-left)",fontStyle:"var(--f-theme-settings-button-primary-font-style)",textTransform:"var(--f-theme-settings-button-primary-text-transform)",backgroundColor:"var(--f-theme-settings-button-primary-background-color)",borderColor:"var(--f-theme-settings-button-primary-border-color)",borderRadius:"var(--f-theme-settings-button-primary-border-radius)",borderWidth:"var(--f-theme-settings-button-primary-border-width)",color:"var(--f-theme-settings-button-primary-color)",display:"inline-block",hover:{backgroundColor:"var(--f-theme-settings-button-primary-background-color-hover)",borderColor:"var(--f-theme-settings-button-primary-border-color-hover)",color:"var(--f-theme-settings-button-primary-color-hover)"}},buttonSecondary:{fontFamily:"var(--f-theme-settings-button-secondary-font-family)",fontSize:"var(--f-theme-settings-button-secondary-font-size)",fontWeight:"var(--f-theme-settings-button-secondary-font-weight)",lineHeight:"var(--f-theme-settings-button-secondary-line-height)",paddingTop:"var(--f-theme-settings-button-secondary-padding-top)",paddingRight:"var(--f-theme-settings-button-secondary-padding-right)",paddingBottom:"var(--f-theme-settings-button-secondary-padding-bottom)",paddingLeft:"var(--f-theme-settings-button-secondary-padding-left)",fontStyle:"var(--f-theme-settings-button-secondary-font-style)",textTransform:"var(--f-theme-settings-button-secondary-text-transform)",backgroundColor:"var(--f-theme-settings-button-secondary-background-color)",borderColor:"var(--f-theme-settings-button-secondary-border-color)",borderRadius:"var(--f-theme-settings-button-secondary-border-radius)",borderWidth:"var(--f-theme-settings-button-secondary-border-width)",color:"var(--f-theme-settings-button-secondary-color)",display:"inline-block",hover:{backgroundColor:"var(--f-theme-settings-button-secondary-background-color-hover)",borderColor:"var(--f-theme-settings-button-secondary-border-color-hover)",color:"var(--f-theme-settings-button-secondary-color-hover)"}},buttonTertiary:{fontFamily:"var(--f-theme-settings-button-tertiary-font-family)",fontSize:"var(--f-theme-settings-button-tertiary-font-size)",fontWeight:"var(--f-theme-settings-button-tertiary-font-weight)",lineHeight:"var(--f-theme-settings-button-tertiary-line-height)",paddingTop:"var(--f-theme-settings-button-tertiary-padding-top)",paddingRight:"var(--f-theme-settings-button-tertiary-padding-right)",paddingBottom:"var(--f-theme-settings-button-tertiary-padding-bottom)",paddingLeft:"var(--f-theme-settings-button-tertiary-padding-left)",fontStyle:"var(--f-theme-settings-button-tertiary-font-style)",textTransform:"var(--f-theme-settings-button-tertiary-text-transform)",backgroundColor:"var(--f-theme-settings-button-tertiary-background-color)",borderColor:"var(--f-theme-settings-button-tertiary-border-color)",borderRadius:"var(--f-theme-settings-button-tertiary-border-radius)",borderWidth:"var(--f-theme-settings-button-tertiary-border-width)",color:"var(--f-theme-settings-button-tertiary-color)",display:"inline-block",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)"}}},pn=e=>({...o.useElementProps({...e,elementToAttributes:n=>({url:n.href,buttonStyle:n.buttonStyle||"primary",target:n.target||"_blank"})}),onMouseOver:n=>{n.stopPropagation()}}),bn=e=>{const{href:t,target:n,buttonStyle:r}=pn(e),{attributes:a,children:l}=e;return s.jsx(vn,{attributes:a,href:t,target:n,styles:we[`button${r.charAt(0).toUpperCase()+r.slice(1)}`],children:l})},vn=({attributes:e,styles:t={hover:{}},children:n,href:r="#",target:a})=>{const[l,u]=y.useState(!1);return s.jsx("a",{...e,onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),href:r,target:a,style:l?{...t,...t.hover}:t,children:n})};class kn extends i.MarkupElement{constructor(t=C,n=bn){super(t,n)}}const Cn=({type:e,...t})=>{const n=o.useEditorRef(),r=!!o.isRangeInSameBlock(n,{at:n.selection}),a=!!(n!=null&&n.selection)&&o.someNode(n,{match:{type:e}});return s.jsx(o.ToolbarButton,{tooltip:i.getTooltip(r?`Button
2
+ ${i.getHotkeyByPlatform("Ctrl+Shift+K")}`:"Buttons can only be set for a single text block."),classNames:i.getButtonClassNames(r),active:a,onMouseDown:async l=>{n&&(l.preventDefault(),l.stopPropagation(),o.focusEditor(n,n.selection??n.prevSelection??void 0),setTimeout(()=>{at(n,{focused:!0})},0))},...t})},Sn=({editor:e,id:t})=>s.jsx("div",{"data-plugin-id":t,children:s.jsx(Cn,{type:o.getPluginType(e,C),icon:s.jsx("span",{className:"tw-p-2 tw-h-8 tw-justify-center tw-items-center tw-flex",children:s.jsx(i.IconButton16,{})}),styles:i.buttonStyles})}),En=({floatingOptions:e,...t})=>{const n=o.useEditorRef(),r=Ve.useFocused(),a=o.useFloatingLinkSelectors().mode(),l=o.useFloatingLinkSelectors().isOpen(n.id),{triggerFloatingLinkHotkeys:u}=o.getPluginOptions(n,o.ELEMENT_LINK);o.useHotkeys(u,f=>{o.triggerFloatingLinkInsert(n,{focused:r})&&f.preventDefault()},{enableOnContentEditable:!0},[r]);const{update:d,style:c,floating:m}=o.useVirtualFloatingLink({editorId:n.id,open:l&&a==="insert",getBoundingClientRect:o.getSelectionBoundingClientRect,whileElementsMounted:()=>{},...e});return y.useEffect(()=>{l?(d(),o.floatingLinkActions.updated(!0)):o.floatingLinkActions.updated(!1)},[l,d]),o.useFloatingLinkEscape(),{style:{...c,zIndex:1e3},...t,ref:o.useComposedRef(t.ref,m)}},Pn=o.createComponentAs(e=>{var n;const t=En({...e,floatingOptions:{strategy:"absolute"}});return((n=t.style)==null?void 0:n.display)==="none"?null:o.createElementAs("div",t)}),In=o.createComponentAs(e=>{var n;const t=jn({...e,floatingOptions:{strategy:"absolute"}});return((n=t.style)==null?void 0:n.display)==="none"?null:o.createElementAs("div",t)});o.FloatingLink.EditRoot=In;o.FloatingLink.InsertRoot=Pn;const le=o.FloatingLink,ce="link-plugin";var x=(e=>(e.heading1="heading1",e.heading2="heading2",e.heading3="heading3",e.heading4="heading4",e.custom1="custom1",e.custom2="custom2",e.custom3="custom3",e.quote="quote",e.imageCaption="imageCaption",e.imageTitle="imageTitle",e.p="p",e))(x||{});const T={heading1:{fontSize:"var(--f-theme-settings-heading1-font-size)",lineHeight:"var(--f-theme-settings-heading1-line-height)",marginTop:"var(--f-theme-settings-heading1-margin-top)",marginBottom:"var(--f-theme-settings-heading1-margin-bottom)",textDecoration:"var(--f-theme-settings-heading1-text-decoration)",fontStyle:"var(--f-theme-settings-heading1-font-style)",textTransform:"var(--f-theme-settings-heading1-text-transform)",letterSpacing:"var(--f-theme-settings-heading1-letter-spacing)",fontWeight:"var(--f-theme-settings-heading1-font-weight)",fontFamily:"var(--f-theme-settings-heading1-font-family)",color:"var(--f-theme-settings-heading1-color)"},heading2:{fontSize:"var(--f-theme-settings-heading2-font-size)",lineHeight:"var(--f-theme-settings-heading2-line-height)",marginTop:"var(--f-theme-settings-heading2-margin-top)",marginBottom:"var(--f-theme-settings-heading2-margin-bottom)",textDecoration:"var(--f-theme-settings-heading2-text-decoration)",fontStyle:"var(--f-theme-settings-heading2-font-style)",textTransform:"var(--f-theme-settings-heading2-text-transform)",letterSpacing:"var(--f-theme-settings-heading2-letter-spacing)",fontWeight:"var(--f-theme-settings-heading2-font-weight)",fontFamily:"var(--f-theme-settings-heading2-font-family)",color:"var(--f-theme-settings-heading2-color)"},heading3:{fontSize:"var(--f-theme-settings-heading3-font-size)",lineHeight:"var(--f-theme-settings-heading3-line-height)",marginTop:"var(--f-theme-settings-heading3-margin-top)",marginBottom:"var(--f-theme-settings-heading3-margin-bottom)",textDecoration:"var(--f-theme-settings-heading3-text-decoration)",fontStyle:"var(--f-theme-settings-heading3-font-style)",textTransform:"var(--f-theme-settings-heading3-text-transform)",letterSpacing:"var(--f-theme-settings-heading3-letter-spacing)",fontWeight:"var(--f-theme-settings-heading3-font-weight)",fontFamily:"var(--f-theme-settings-heading3-font-family)",color:"var(--f-theme-settings-heading3-color)"},heading4:{fontSize:"var(--f-theme-settings-heading4-font-size)",lineHeight:"var(--f-theme-settings-heading4-line-height)",marginTop:"var(--f-theme-settings-heading4-margin-top)",marginBottom:"var(--f-theme-settings-heading4-margin-bottom)",textDecoration:"var(--f-theme-settings-heading4-text-decoration)",fontStyle:"var(--f-theme-settings-heading4-font-style)",textTransform:"var(--f-theme-settings-heading4-text-transform)",letterSpacing:"var(--f-theme-settings-heading4-letter-spacing)",fontWeight:"var(--f-theme-settings-heading4-font-weight)",fontFamily:"var(--f-theme-settings-heading4-font-family)",color:"var(--f-theme-settings-heading4-color)"},custom1:{fontSize:"var(--f-theme-settings-custom1-font-size)",lineHeight:"var(--f-theme-settings-custom1-line-height)",marginTop:"var(--f-theme-settings-custom1-margin-top)",marginBottom:"var(--f-theme-settings-custom1-margin-bottom)",textDecoration:"var(--f-theme-settings-custom1-text-decoration)",fontStyle:"var(--f-theme-settings-custom1-font-style)",textTransform:"var(--f-theme-settings-custom1-text-transform)",letterSpacing:"var(--f-theme-settings-custom1-letter-spacing)",fontWeight:"var(--f-theme-settings-custom1-font-weight)",fontFamily:"var(--f-theme-settings-custom1-font-family)",color:"var(--f-theme-settings-custom1-color)"},custom2:{fontSize:"var(--f-theme-settings-custom2-font-size)",lineHeight:"var(--f-theme-settings-custom2-line-height)",marginTop:"var(--f-theme-settings-custom2-margin-top)",marginBottom:"var(--f-theme-settings-custom2-margin-bottom)",textDecoration:"var(--f-theme-settings-custom2-text-decoration)",fontStyle:"var(--f-theme-settings-custom2-font-style)",textTransform:"var(--f-theme-settings-custom2-text-transform)",letterSpacing:"var(--f-theme-settings-custom2-letter-spacing)",fontWeight:"var(--f-theme-settings-custom2-font-weight)",fontFamily:"var(--f-theme-settings-custom2-font-family)",color:"var(--f-theme-settings-custom2-color)"},custom3:{fontSize:"var(--f-theme-settings-custom3-font-size)",lineHeight:"var(--f-theme-settings-custom3-line-height)",marginTop:"var(--f-theme-settings-custom3-margin-top)",marginBottom:"var(--f-theme-settings-custom3-margin-bottom)",textDecoration:"var(--f-theme-settings-custom3-text-decoration)",fontStyle:"var(--f-theme-settings-custom3-font-style)",textTransform:"var(--f-theme-settings-custom3-text-transform)",letterSpacing:"var(--f-theme-settings-custom3-letter-spacing)",fontWeight:"var(--f-theme-settings-custom3-font-weight)",fontFamily:"var(--f-theme-settings-custom3-font-family)",color:"var(--f-theme-settings-custom3-color)"},p:{fontSize:"var(--f-theme-settings-body-font-size)",lineHeight:"var(--f-theme-settings-body-line-height)",marginTop:"var(--f-theme-settings-body-margin-top)",marginBottom:"var(--f-theme-settings-body-margin-bottom)",textDecoration:"var(--f-theme-settings-body-text-decoration)",fontStyle:"var(--f-theme-settings-body-font-style)",textTransform:"var(--f-theme-settings-body-text-transform)",letterSpacing:"var(--f-theme-settings-body-letter-spacing)",fontWeight:"var(--f-theme-settings-body-font-weight)",fontFamily:"var(--f-theme-settings-body-font-family)",color:"var(--f-theme-settings-body-color)"},quote:{fontSize:"var(--f-theme-settings-quote-font-size)",lineHeight:"var(--f-theme-settings-quote-line-height)",marginTop:"var(--f-theme-settings-quote-margin-top)",marginBottom:"var(--f-theme-settings-quote-margin-bottom)",textDecoration:"var(--f-theme-settings-quote-text-decoration)",fontStyle:"var(--f-theme-settings-quote-font-style)",textTransform:"var(--f-theme-settings-quote-text-transform)",letterSpacing:"var(--f-theme-settings-quote-letter-spacing)",fontWeight:"var(--f-theme-settings-quote-font-weight)",fontFamily:"var(--f-theme-settings-quote-font-family)",color:"var(--f-theme-settings-quote-color)"},imageCaption:{fontSize:"var(--f-theme-settings-image-caption-font-size)",lineHeight:"var(--f-theme-settings-image-caption-line-height)",marginTop:"var(--f-theme-settings-image-caption-margin-top)",marginBottom:"var(--f-theme-settings-image-caption-margin-bottom)",textDecoration:"var(--f-theme-settings-image-caption-text-decoration)",fontStyle:"var(--f-theme-settings-image-caption-font-style)",textTransform:"var(--f-theme-settings-image-caption-text-transform)",letterSpacing:"var(--f-theme-settings-image-caption-letter-spacing)",fontWeight:"var(--f-theme-settings-image-caption-font-weight)",fontFamily:"var(--f-theme-settings-image-caption-font-family)",color:"var(--f-theme-settings-image-caption-color)"},imageTitle:{fontSize:"var(--f-theme-settings-image-title-font-size)",lineHeight:"var(--f-theme-settings-image-title-line-height)",marginTop:"var(--f-theme-settings-image-title-margin-top)",marginBottom:"var(--f-theme-settings-image-title-margin-bottom)",textDecoration:"var(--f-theme-settings-image-title-text-decoration)",fontStyle:"var(--f-theme-settings-image-title-font-style)",textTransform:"var(--f-theme-settings-image-title-text-transform)",letterSpacing:"var(--f-theme-settings-image-title-letter-spacing)",fontWeight:"var(--f-theme-settings-image-title-font-weight)",fontFamily:"var(--f-theme-settings-image-title-font-family)",color:"var(--f-theme-settings-image-title-color)"},[ce]:{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)"},...we},Tn=()=>{const e=o.useFloatingLinkUrlInput({});return s.jsx("div",{"data-test-id":"floating-link-edit",className:"tw-bg-white tw-rounded tw-shadow tw-p-4 tw-min-w-[400px]",children:s.jsxs("span",{"data-test-id":"preview-link-flyout",className:"tw-flex tw-justify-between",children:[s.jsx("span",{className:"tw-pointer-events-none",style:T.p,children:e.defaultValue}),s.jsxs("span",{className:"tw-flex tw-gap-2",children:[s.jsx("span",{role:"button",tabIndex:0,"data-test-id":"edit-link-button",className:"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1",children:s.jsx(le.EditButton,{children:s.jsx(i.IconPen16,{})})}),s.jsx("span",{role:"button",tabIndex:0,"data-test-id":"remove-link-button",className:"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1",children:s.jsx(le.UnlinkButton,{children:s.jsx(i.IconTrashBin16,{})})})]})]})})},jn=({floatingOptions:e,...t})=>{const n=o.useEditorRef(),r=o.usePlateSelectors().keyEditor(),a=o.useFloatingLinkSelectors().mode(),l=o.useFloatingLinkSelectors().isOpen(n.id),{triggerFloatingLinkHotkeys:u="command+k, ctrl+k"}=o.getPluginOptions(n,o.ELEMENT_LINK),d=y.useCallback(()=>{const w=o.getAboveNode(n,{match:{type:o.getPluginType(n,o.ELEMENT_LINK)}});if(w){const[,b]=w;return o.getRangeBoundingClientRect(n,{anchor:o.getStartPoint(n,b),focus:o.getEndPoint(n,b)})}return o.getDefaultBoundingClientRect()},[n]),c=l&&a==="edit",{update:m,style:f,floating:g}=o.useVirtualFloatingLink({editorId:n.id,open:c,getBoundingClientRect:d,...e});return y.useEffect(()=>{const w=Le(n);if(w&&o.floatingLinkActions.url(w),n.selection&&o.someNode(n,{match:{type:o.getPluginType(n,o.ELEMENT_LINK)}})){o.floatingLinkActions.show("edit",n.id),m();return}o.floatingLinkSelectors.mode()==="edit"&&o.floatingLinkActions.hide()},[n,r,m]),o.useHotkeys(u,w=>{w.preventDefault(),o.floatingLinkSelectors.mode()==="edit"&&o.triggerFloatingLinkEdit(n)},{enableOnContentEditable:!0},[]),o.useFloatingLinkEnter(),o.useFloatingLinkEscape(),{style:{...f,zIndex:1e3},...t,ref:o.useComposedRef(t.ref,g)}},Bn=({section:e,selectedUrl:t,onSelectUrl:n})=>{const r=e.permanentLink===t;return s.jsx("button",{"data-test-id":"internal-link-selector-section-link",className:i.merge(["tw-py-2 tw-px-2.5 tw-pl-14 tw-leading-5 tw-cursor-pointer tw-w-full",r?"tw-bg-box-selected-strong tw-text-box-selected-strong-inverse hover:tw-bg-box-selected-strong-hover:hover hover:tw-text-box-selected-strong-inverse-hover:hover":"hover:tw-bg-box-neutral-hover hover:tw-text-box-neutral-inverse-hover"]),onClick:()=>n(e.permanentLink),onFocus:()=>n(e.permanentLink),children:s.jsxs("div",{className:"tw-flex tw-flex-1 tw-space-x-2 tw-items-center tw-h-6",children:[s.jsx(i.IconDocumentText16,{}),s.jsx("span",{className:"tw-text-s",children:e.title}),s.jsx("span",{className:"tw-flex-auto tw-font-sans tw-text-xs tw-text-right",children:"Section"})]})})},Ln=({page:e,selectedUrl:t,onSelectUrl:n,itemsToExpandInitially:r,appBridge:a})=>{const[l,u]=y.useState(e.id===r.documentId),d=e.permanentLink===t,{documentSections:c}=G.useDocumentSection(a,e.id),m=[...c.values()],f=m.length>0;return y.useEffect(()=>{e.id===r.pageId&&u(!0)},[r,e.id]),s.jsxs(s.Fragment,{children:[s.jsx("div",{tabIndex:0,"data-test-id":"internal-link-selector-page-link",className:i.merge(["tw-py-2 tw-px-2.5 tw-leading-5 tw-cursor-pointer",f?"tw-pl-7":"tw-pl-12",d?"tw-bg-box-selected-strong tw-text-box-selected-strong-inverse hover:tw-bg-box-selected-strong-hover:hover hover:tw-text-box-selected-strong-inverse-hover:hover":"hover:tw-bg-box-neutral-hover hover:tw-text-box-neutral-inverse-hover"]),onClick:()=>n(e.permanentLink),onFocus:()=>n(e.permanentLink),children:s.jsxs("div",{className:"tw-flex tw-flex-1 tw-space-x-1 tw-items-center tw-h-6",children:[f&&s.jsx("button",{"data-test-id":"tree-item-toggle",className:"tw-flex tw-items-center tw-justify-center tw-p-1.5 tw-cursor-pointer",onClick:()=>u(!l),onFocus:()=>u(!l),children:s.jsx("div",{className:i.merge(["tw-transition-transform tw-w-0 tw-h-0 tw-font-normal tw-border-t-4 tw-border-t-transparent tw-border-b-4 tw-border-b-transparent tw-border-l-4 tw-border-l-x-strong",l?"tw-rotate-90":""])})}),s.jsx("span",{className:"tw-text-s",children:e.title}),s.jsx("span",{className:"tw-flex-auto tw-font-sans tw-text-xs tw-text-right",children:"Page"})]},e.id)}),l&&m.length>0&&m.map(g=>s.jsx(Bn,{section:g,selectedUrl:t,onSelectUrl:n},g.id))]})},Nn=({appBridge:e,documentId:t,selectedUrl:n,onSelectUrl:r,itemsToExpandInitially:a})=>{const[l,u]=y.useState([]),[d,c]=y.useState(!0),m=[...l.values()],f=!d&&m.length>0;return y.useEffect(()=>{e.getDocumentPagesByDocumentId(t).then(g=>{const w=g.filter(p=>!!p.category).sort((p,S)=>p.category.sort===S.category.sort?p.sort-S.sort:p.category.sort-S.category.sort),b=g.filter(p=>!p.category).sort((p,S)=>p.sort-S.sort);u([...w,...b])}).finally(()=>{c(!1)})},[]),d?s.jsx("div",{className:"tw-flex tw-justify-center tw-p-4",children:s.jsx(i.LoadingCircle,{})}):f?s.jsx(s.Fragment,{children:m.map(g=>s.jsx(Ln,{page:g,appBridge:e,selectedUrl:n,onSelectUrl:r,itemsToExpandInitially:a},g.id))}):s.jsx("div",{className:"tw-py-2 tw-px-2.5 tw-pl-7 tw-leading-5 tw-text-s tw-text-text-weak",children:"This document does not contain any pages."})},An=({document:e,appBridge:t,selectedUrl:n,onSelectUrl:r,itemsToExpandInitially:a})=>{const[l,u]=y.useState(e.id===a.documentId),d=e.permanentLink===n;return y.useEffect(()=>{e.id===a.documentId&&u(!0)},[a,e.id]),s.jsxs(s.Fragment,{children:[s.jsxs("button",{"data-test-id":"internal-link-selector-document-link",className:i.merge(["tw-flex tw-flex-1 tw-space-x-2 tw-items-center tw-py-2 tw-px-2.5 tw-leading-5 tw-cursor-pointer tw-w-full",d?"tw-bg-box-selected-strong tw-text-box-selected-strong-inverse hover:tw-bg-box-selected-strong-hover:hover hover:tw-text-box-selected-strong-inverse-hover:hover":"hover:tw-bg-box-neutral-hover hover:tw-text-box-neutral-inverse-hover"]),onClick:()=>r(e.permanentLink),onFocus:()=>r(e.permanentLink),children:[s.jsx("div",{role:"button",tabIndex:0,"data-test-id":"tree-item-toggle",className:"tw-flex tw-items-center tw-justify-center tw-p-1.5 tw-cursor-pointer",onClick:()=>u(!l),onFocus:()=>u(!l),children:s.jsx("div",{className:i.merge(["tw-transition-transform tw-w-0 tw-h-0 tw-font-normal tw-border-t-4 tw-border-t-transparent tw-border-b-4 tw-border-b-transparent tw-border-l-4 tw-border-l-x-strong",l?"tw-rotate-90":""])})}),s.jsx(i.IconColorFan16,{}),s.jsx("span",{className:"tw-text-s",children:e.title}),s.jsx("span",{className:"tw-flex-auto tw-font-sans tw-text-xs tw-text-right",children:"Document"})]}),l&&s.jsx(Nn,{appBridge:t,documentId:e.id,selectedUrl:n,onSelectUrl:r,itemsToExpandInitially:a})]})},Rn=({appBridge:e,selectedUrl:t,onSelectUrl:n})=>{const[r,a]=y.useState(!0),[l,u]=y.useState([]),[d,c]=y.useState({documentId:void 0,pageId:void 0}),m=[...l.values()];y.useEffect(()=>{t&&m.length>0&&f().then(g=>{c(g)})},[m.length]),y.useEffect(()=>{e.getAllDocuments().then(g=>{u(g)}).finally(()=>{a(!1)})},[]);const f=async()=>{const g={documentId:void 0,pageId:void 0};if(m.find(b=>b.permanentLink===t))return g;for(const b of m){const p=await e.getDocumentPagesByDocumentId(b.id);e.getAllDocuments();const S=[...p.values()];if(!!S.find(E=>E.permanentLink===t))return g.documentId=b.id,g;for(const E of S)if(!![...(await e.getDocumentSectionsByDocumentPageId(E.id)).values()].find(F=>F.permanentLink===t))return g.documentId=b.id,g.pageId=E.id,g}return g};return r?s.jsx("div",{className:"tw-flex tw-justify-center tw-p-4",children:s.jsx(i.LoadingCircle,{})}):s.jsx(s.Fragment,{children:m.map(g=>s.jsx(An,{document:g,appBridge:e,selectedUrl:t,onSelectUrl:n,itemsToExpandInitially:d},g.id))})},it=({appBridge:e,url:t,onUrlChange:n,buttonSize:r=i.ButtonSize.Medium})=>{const{open:a,isOpen:l,close:u}=Ht.useOverlayTriggerState({}),[d,c]=y.useState(t),m=w=>{c(w)},f=w=>{w.key==="Enter"&&g()};y.useEffect(()=>{t&&!d&&c(t)},[t,d]);const g=()=>{n==null||n(d),u()};return s.jsxs("div",{"data-test-id":"internal-link-selector",onKeyDown:f,children:[s.jsx(i.Button,{icon:s.jsx(i.IconLink,{}),size:r,type:i.ButtonType.Button,style:i.ButtonStyle.Default,emphasis:i.ButtonEmphasis.Default,onClick:()=>a(),children:"Internal link"}),s.jsxs(i.Modal,{zIndex:1001,onClose:()=>u(),isOpen:l,isDismissable:!0,children:[s.jsx(i.Modal.Header,{title:"Select internal link"}),s.jsx(i.Modal.Body,{children:s.jsx(Rn,{appBridge:e,selectedUrl:d,onSelectUrl:m})}),s.jsx(i.Modal.Footer,{buttons:[{children:"Cancel",onClick:()=>u(),style:i.ButtonStyle.Default,emphasis:i.ButtonEmphasis.Default},{children:"Choose",onClick:w=>{w==null||w.preventDefault(),g()},style:i.ButtonStyle.Default,emphasis:i.ButtonEmphasis.Strong,disabled:!d}]})]})]})},ot=({onUrlChange:e,onToggleTab:t,isValidUrlOrEmpty:n,appBridge:r,clearable:a,placeholder:l,newTab:u,openInNewTab:d,url:c="",required:m,info:f,label:g,buttonSize:w,hideInternalLinkButton:b})=>{const p=n?n(c):te(c),S=u??(d?i.CheckboxState.Checked:i.CheckboxState.Unchecked);return s.jsxs("div",{"data-test-id":"link-input",children:[s.jsx(i.FormControl,{label:{children:g,htmlFor:"url",required:m,tooltip:f?{content:f,position:i.TooltipPosition.Top}:void 0},children:s.jsx(i.TextInput,{id:"url",value:c,clearable:a,onChange:e,placeholder:l??"https://example.com",focusOnMount:!0})}),!p&&s.jsx("div",{className:"tw-text-text-negative tw-mt-1 tw-text-s",children:"Please enter a valid URL."}),!b&&s.jsx("div",{className:"tw-mt-3",children:s.jsx(it,{url:c,appBridge:r,onUrlChange:e,buttonSize:w??i.ButtonSize.Medium})}),s.jsx("div",{className:"tw-mt-3",children:s.jsx(i.Checkbox,{value:"new-tab",label:"Open in new tab",state:S,onChange:t})})]})},lt=({state:e,onTextChange:t,onUrlChange:n,onToggleTab:r,onCancel:a,onSave:l,isValidUrlOrEmpty:u,hasValues:d,testId:c,appBridge:m,children:f})=>s.jsxs("div",{"data-test-id":c,className:"tw-bg-white tw-rounded tw-shadow tw-p-7 tw-min-w-[400px] tw-overflow-y-auto",children:[s.jsx(i.FormControl,{label:{children:"Text",htmlFor:"linkText",required:!0},children:s.jsx(i.TextInput,{id:"linkText",value:e.text,placeholder:"Link Text",onChange:t})}),f,s.jsx("div",{className:"tw-mt-5",children:s.jsx(ot,{url:e.url,newTab:e.newTab,onUrlChange:n,onToggleTab:r,isValidUrlOrEmpty:u,appBridge:m})}),s.jsx("div",{className:"tw-mt-3",children:s.jsxs("div",{className:"tw-pt-5 tw-flex tw-gap-x-3 tw-justify-end tw-border-t tw-border-t-black-10",children:[s.jsx(i.Button,{onClick:a,size:i.ButtonSize.Medium,style:i.ButtonStyle.Default,emphasis:i.ButtonEmphasis.Default,children:"Cancel"}),s.jsx(i.Button,{onClick:l,size:i.ButtonSize.Medium,icon:s.jsx(i.IconCheckMark20,{}),disabled:!d||!u(e==null?void 0:e.url),children:"Save"})]})})]}),Fn={url:"",text:"",newTab:i.CheckboxState.Unchecked},Mn=()=>{const[e,t]=y.useReducer((n,r)=>{const{type:a,payload:l}=r;switch(a){case"NEW_TAB":return{...n,newTab:i.CheckboxState.Checked};case"SAME_TAB":return{...n,newTab:i.CheckboxState.Unchecked};case"URL":case"TEXT":case"INIT":return{...n,...l};default:return n}},Fn);return[e,t]},Dn=()=>{const e=o.useEditorRef(),[t,n]=Mn();y.useEffect(()=>{const f=Je(e),g=Ze(e);n({type:"INIT",payload:{text:o.floatingLinkSelectors.text(),newTab:o.floatingLinkSelectors.newTab()?i.CheckboxState.Checked:i.CheckboxState.Unchecked,url:f&&g===""?f:o.floatingLinkSelectors.url()}})},[n,e]);const r=f=>{n({type:"TEXT",payload:{text:f}})},a=f=>{n({type:"URL",payload:{url:f}})},l=f=>{n(f?{type:"NEW_TAB"}:{type:"SAME_TAB"})},u=()=>{o.floatingLinkActions.hide()},d=f=>{if(!te(t.url)||!c)return;const g=me(t.url);o.floatingLinkActions.text(t.text),o.floatingLinkActions.url(g),o.floatingLinkActions.newTab(t.newTab===i.CheckboxState.Checked),o.submitFloatingLink(e)&&(f==null||f.preventDefault())},c=t.url!==""&&t.text!=="",{appBridge:m}=o.getPluginOptions(e,o.ELEMENT_LINK);return o.useHotkeys("enter",d,{enableOnFormTags:["INPUT"]},[]),{state:t,onTextChange:r,onUrlChange:a,onToggleTab:l,onCancel:u,onSave:d,hasValues:c,isValidUrlOrEmpty:te,appBridge:m}},On=()=>s.jsx(lt,{...Dn(),testId:"floating-link-insert"}),Un=({readOnly:e})=>{const t=o.useFloatingLinkSelectors().isEditing();if(e)return null;const n=s.jsx(On,{}),r=t?n:s.jsx(Tn,{});return s.jsxs(s.Fragment,{children:[s.jsx(le.InsertRoot,{children:n}),s.jsx(le.EditRoot,{children:r})]})},Hn=({id:e,editorId:t})=>{const n=o.usePlateEditorState(o.useEventPlateId(t)),r=!!o.isRangeInSameBlock(n,{at:n.selection});return s.jsx("div",{"data-plugin-id":e,children:s.jsx(o.LinkToolbarButton,{tooltip:i.getTooltip(r?`Link
3
+ ${i.getHotkeyByPlatform("Ctrl+K")}`:"Links can only be set for a single text block."),icon:s.jsx("span",{className:"tw-p-2 tw-h-8 tw-justify-center tw-items-center tw-flex",children:s.jsx(i.IconLink,{size:i.IconSize.Size16})}),classNames:i.getButtonClassNames(r),styles:{root:{width:"24px",height:"24px"}},actionHandler:"onMouseDown"})})},_n=e=>({...o.useElementProps({...e,elementToAttributes:n=>{var r,a;return{href:n.url||((a=(r=n.chosenLink)==null?void 0:r.searchResult)==null?void 0:a.link)||"",target:n.target||"_blank"}}}),onMouseOver:n=>{n.stopPropagation()}}),Vn=e=>{const t=_n(e),{attributes:n,children:r}=e;return s.jsx("a",{...n,href:t.href,target:t.target,style:T[ce],children:r})};class zn extends i.MarkupElement{constructor(t=o.ELEMENT_LINK,n=Vn){super(t,n)}}const ct=e=>o.createPluginFactory({...o.createLinkPlugin(),renderAfterEditable:Un,options:{isUrl:he,rangeBeforeOptions:{matchString:" ",skipInvalid:!0,afterMatch:!0},triggerFloatingLinkHotkeys:"command+k, ctrl+k",appBridge:e}})();class ut extends i.Plugin{constructor(t,n=T[ce]){super(ce,{button:Hn,markupElement:new zn,...t}),this.styles={},this.styles=n,this.appBridge=t==null?void 0:t.appBridge}plugins(){return[ct(this.appBridge)]}}const $n="textstyle-custom1-plugin";class dt extends i.Plugin{constructor({styles:t=T.custom1,...n}={}){super(x.custom1,{label:"Custom 1",markupElement:new Wn,...n}),this.styles={},this.styles=t}plugins(){return[qn(this.styles)]}}class Wn extends i.MarkupElement{constructor(t=$n,n=gt){super(t,n)}}const gt=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("p",{...t,style:r,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),children:n})},qn=e=>o.createPluginFactory({key:x.custom1,isElement:!0,deserializeHtml:{rules:[{validClassName:x.custom1}]}})({component:t=>s.jsx(gt,{...t,styles:e})}),Gn="textstyle-custom2-plugin";class mt extends i.Plugin{constructor({styles:t=T.custom2,...n}={}){super(x.custom2,{label:"Custom 2",markupElement:new Kn,...n}),this.styles={},this.styles=t}plugins(){return[Xn(this.styles)]}}class Kn extends i.MarkupElement{constructor(t=Gn,n=ht){super(t,n)}}const ht=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("p",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},Xn=e=>o.createPluginFactory({key:x.custom2,isElement:!0,deserializeHtml:{rules:[{validClassName:x.custom2}]}})({component:t=>s.jsx(ht,{...t,styles:e})}),Qn="textstyle-custom3-plugin";class ft extends i.Plugin{constructor({styles:t=T.custom3,...n}={}){super(i.TextStyles.custom3,{label:"Custom 3",markupElement:new Yn,...n}),this.styles={},this.styles=t}plugins(){return[Jn(this.styles)]}}class Yn extends i.MarkupElement{constructor(t=Qn,n=wt){super(t,n)}}const wt=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("p",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},Jn=e=>o.createPluginFactory({key:i.TextStyles.custom3,isElement:!0,deserializeHtml:{rules:[{validClassName:i.TextStyles.custom3}]}})({component:t=>s.jsx(wt,{...t,styles:e})}),Zn="textstyle-heading1-plugin";class yt extends i.Plugin{constructor({styles:t=T.heading1,...n}={}){super(x.heading1,{label:"Heading 1",markupElement:new es,...n}),this.styles={},this.styles=t}plugins(){return[ts(this.styles)]}}class es extends i.MarkupElement{constructor(t=Zn,n=pe){super(t,n)}}const pe=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("h1",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},ts=e=>o.createPluginFactory({key:x.heading1,isElement:!0,component:pe,deserializeHtml:{rules:[{validNodeName:["h1","H1"]}]}})({component:t=>s.jsx(pe,{...t,styles:e})}),ns="textstyle-heading2-plugin";class xt extends i.Plugin{constructor({styles:t=T.heading2,...n}={}){super(x.heading2,{label:"Heading 2",markupElement:new ss,...n}),this.styles={},this.styles=t}plugins(){return[rs(this.styles)]}}class ss extends i.MarkupElement{constructor(t=ns,n=be){super(t,n)}}const be=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("h2",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},rs=e=>o.createPluginFactory({key:x.heading2,isElement:!0,component:be,deserializeHtml:{rules:[{validNodeName:["h2","H2"]}]}})({component:t=>s.jsx(be,{...t,styles:e})}),as="textstyle-heading3-plugin";class pt extends i.Plugin{constructor({styles:t=T.heading3,...n}={}){super(x.heading3,{label:"Heading 3",markupElement:new is,...n}),this.styles={},this.styles=t}plugins(){return[os(this.styles)]}}class is extends i.MarkupElement{constructor(t=as,n=ve){super(t,n)}}const ve=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("h3",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},os=e=>o.createPluginFactory({key:x.heading3,isElement:!0,component:ve,deserializeHtml:{rules:[{validNodeName:["h3","H3"]}]}})({component:t=>s.jsx(ve,{...t,styles:e})}),ls="textstyle-heading4-plugin";class bt extends i.Plugin{constructor({styles:t=T.heading4,...n}={}){super(x.heading4,{label:"Heading 4",markupElement:new cs,...n}),this.styles={},this.styles=t}plugins(){return[us(this.styles)]}}class cs extends i.MarkupElement{constructor(t=ls,n=ke){super(t,n)}}const ke=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("h4",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},us=e=>o.createPluginFactory({key:x.heading4,isElement:!0,component:ke,deserializeHtml:{rules:[{validNodeName:["h4","H4"]}]}})({component:t=>s.jsx(ke,{...t,styles:e})}),ds="textstyle-imageCaption-plugin";class vt extends i.Plugin{constructor({styles:t=T.imageCaption,...n}={}){super(x.imageCaption,{label:"Image Caption",markupElement:new gs,...n}),this.styles={},this.styles=t}plugins(){return[ms(this.styles)]}}class gs extends i.MarkupElement{constructor(t=ds,n=Ce){super(t,n)}}const Ce=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("p",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},ms=e=>o.createPluginFactory({key:x.imageCaption,isElement:!0,component:Ce,deserializeHtml:{rules:[{validClassName:x.imageCaption}]}})({component:t=>s.jsx(Ce,{...t,styles:e})}),hs="textstyle-imageTitle-plugin";class kt extends i.Plugin{constructor({styles:t=T.imageTitle,...n}={}){super(x.imageTitle,{label:"Image Title",markupElement:new fs,...n}),this.styles={},this.styles=t}plugins(){return[ws(this.styles)]}}class fs extends i.MarkupElement{constructor(t=hs,n=Se){super(t,n)}}const Se=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("p",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},ws=e=>o.createPluginFactory({key:x.imageTitle,isElement:!0,component:Se,deserializeHtml:{rules:[{validClassName:x.imageTitle}]}})({component:t=>s.jsx(Se,{...t,styles:e})});class Ct extends i.Plugin{constructor({styles:t=T.p,...n}={}){super(x.p,{markupElement:new Et,label:"Body Text",...n}),this.styles={},this.styles=t}plugins(){return[Pt(this.styles)]}}const St="tw-m-0 tw-px-0 tw-py-0",ue=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align,l=i.merge([a&&i.alignmentClassnames[a],St,i.getColumnBreakClasses(e)]);return s.jsx("p",{...t,className:l,style:r,children:n})};class Et extends i.MarkupElement{constructor(t=x.p,n=ue){super(t,n)}}const Pt=e=>o.createPluginFactory({...o.createParagraphPlugin(),key:x.p,isElement:!0,component:ue})({component:t=>s.jsx(ue,{...t,styles:e})}),ys="textstyle-quote-plugin";class It extends i.Plugin{constructor({styles:t=T.quote,...n}={}){super(x.quote,{label:"Quote",markupElement:new xs,...n}),this.styles={},this.styles=t}plugins(){return[Tt(this.styles)]}}class xs extends i.MarkupElement{constructor(t=ys,n=de){super(t,n)}}const de=({element:e,attributes:t,children:n,styles:r})=>{const a=e.align;return s.jsx("blockquote",{...t,className:i.merge([a&&i.alignmentClassnames[a],i.getColumnBreakClasses(e)]),style:r,children:n})},Tt=e=>o.createPluginFactory({key:x.quote,isElement:!0,component:de,deserializeHtml:{rules:[{validNodeName:["blockquote","BLOCKQUOTE"]}]}})({component:t=>s.jsx(de,{...t,styles:e})}),Ae=[new yt,new xt,new pt,new bt,new dt,new mt,new ft,new It,new Ct],ee=[x.heading1,x.heading2,x.heading3,x.heading4,x.custom1,x.custom2,x.custom3,x.quote,x.p],ps=[...Ae,new vt,new kt],bs=[...ee,x.imageCaption,x.imageTitle],vs=()=>{const e=Ms({});return s.jsx("div",{"data-test-id":"floating-button-edit",className:"tw-bg-white tw-rounded tw-shadow tw-p-4 tw-min-w-[400px]",children:s.jsxs("span",{"data-test-id":"preview-button-flyout",className:"tw-flex tw-justify-between",children:[s.jsx("span",{className:"tw-pointer-events-none",style:T.p,children:e.defaultValue}),s.jsxs("span",{className:"tw-flex tw-gap-2",children:[s.jsx("span",{role:"button",tabIndex:0,"data-test-id":"edit-button-button",className:"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1",children:s.jsx(ge.EditButton,{children:s.jsx(i.IconPen16,{})})}),s.jsx("span",{role:"button",tabIndex:0,"data-test-id":"remove-button-button",className:"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1",children:s.jsx(ge.UnlinkButton,{children:s.jsx(i.IconTrashBin16,{})})})]})]})})},ks=e=>{var n;const t=o.getAboveNode(e,{match:{type:C}});return Array.isArray(t)&&((n=t[0])==null?void 0:n.buttonStyle)||"primary"},Cs={url:"",text:"",buttonStyle:"primary",newTab:i.CheckboxState.Unchecked},Ss=()=>{const[e,t]=y.useReducer((n,r)=>{const{type:a,payload:l}=r;switch(a){case"NEW_TAB":return{...n,newTab:i.CheckboxState.Checked};case"SAME_TAB":return{...n,newTab:i.CheckboxState.Unchecked};case"URL":case"TEXT":case"BUTTON_STYLE":case"INIT":return{...n,...l};default:return n}},Cs);return[e,t]},Es=()=>{const e=o.useEditorRef(),[t,n]=Ss();y.useEffect(()=>{const g=ks(e);n({type:"INIT",payload:{text:j.text(),buttonStyle:g,newTab:j.newTab()?i.CheckboxState.Checked:i.CheckboxState.Unchecked,url:j.url()}})},[n,e]);const r=g=>{n({type:"TEXT",payload:{text:g}})},a=g=>{n({type:"BUTTON_STYLE",payload:{buttonStyle:g}})},l=g=>{n({type:"URL",payload:{url:g}})},u=g=>{n(g?{type:"NEW_TAB"}:{type:"SAME_TAB"})},d=()=>{I.hide()},c=g=>{if(!te(t.url)||!m)return;const w=me(t.url);I.text(t.text),I.url(w),I.buttonStyle(t.buttonStyle),I.newTab(t.newTab===i.CheckboxState.Checked),je(e)&&(g==null||g.preventDefault())},m=t.url!==""&&t.text!=="",{appBridge:f}=o.getPluginOptions(e,C);return o.useHotkeys("enter",c,{enableOnFormTags:["INPUT"]},[]),{state:t,onTextChange:r,onButtonStyleChange:a,onUrlChange:l,onToggleTab:u,onCancel:d,onSave:c,hasValues:m,isValidUrlOrEmpty:te,appBridge:f}},Ps=()=>{const e=Es(),{state:t,onButtonStyleChange:n}=e;return s.jsx(lt,{...e,testId:"floating-button-insert",children:s.jsx("div",{className:"tw-pt-5",children:s.jsxs(i.FormControl,{label:{children:"Button Style",htmlFor:"buttonStyle",required:!0},children:[s.jsx(xe,{id:"primary",styles:T.buttonPrimary,isActive:t.buttonStyle==="primary",onClick:()=>n("primary"),children:t.text||"Primary Button"}),s.jsx(xe,{id:"secondary",styles:T.buttonSecondary,isActive:t.buttonStyle==="secondary",onClick:()=>n("secondary"),children:t.text||"Secondary Button"}),s.jsx(xe,{id:"tertiary",styles:T.buttonTertiary,isActive:t.buttonStyle==="tertiary",onClick:()=>n("tertiary"),children:t.text||"Tertiary Button"})]})})})},xe=({id:e,styles:t,isActive:n,onClick:r,children:a})=>{const[l,u]=y.useState(!1),d=()=>t&&t.hover&&l?{...t,...t.hover}:t;return s.jsx("button",{"data-test-id":`floating-button-insert-${e}`,onMouseEnter:()=>u(!0),onMouseLeave:()=>u(!1),onClick:r,style:d(),className:n?"tw-outline tw-outline-1 tw-outline-violet-60 tw-outline-offset-2 tw-w-fit":"tw-w-fit",children:a})},Is=()=>{const e=ne().isEditing(),t=s.jsx(Ps,{}),n=e?t:s.jsx(vs,{});return s.jsxs(s.Fragment,{children:[s.jsx(ge.InsertRoot,{children:t}),s.jsx(ge.EditRoot,{children:n})]})},C="button",jt="button-plugin",Bt=e=>o.createPluginFactory({key:C,isElement:!0,isInline:!0,props:({element:t})=>({nodeProps:{href:t==null?void 0:t.url,target:t==null?void 0:t.target}}),withOverrides:et,renderAfterEditable:Is,options:{isUrl:he,rangeBeforeOptions:{matchString:" ",skipInvalid:!0,afterMatch:!0},triggerFloatingButtonHotkeys:"command+shift+k, ctrl+shift+k",appBridge:e},then:(t,{type:n})=>({deserializeHtml:{rules:[{validNodeName:"A",validClassName:"btn"}],getNode:r=>({type:n,url:r.getAttribute("href"),target:r.getAttribute("target")||"_blank"})}})})();class Lt extends i.Plugin{constructor({styles:t=we,...n}){super(jt,{button:Sn,markupElement:new kn,...n}),this.styles={},this.styles=t,this.appBridge=n==null?void 0:n.appBridge}plugins(){return[Bt(this.appBridge)]}}const Ts=({floatingOptions:e,...t})=>{const n=o.useEditorRef(),r=o.usePlateSelectors(n.id).keyEditor(),a=ne().mode(),l=ne().isOpen(n.id),{triggerFloatingButtonHotkeys:u}=o.getPluginOptions(n,C),d=y.useCallback(()=>{const w=o.getAboveNode(n,{match:{type:o.getPluginType(n,C)}});if(w){const[,b]=w;return o.getRangeBoundingClientRect(n,{anchor:o.getStartPoint(n,b),focus:o.getEndPoint(n,b)})}return o.getDefaultBoundingClientRect()},[n]),c=l&&a==="edit",{update:m,style:f,floating:g}=At({open:c,getBoundingClientRect:d,...e});return y.useEffect(()=>{const w=Le(n);if(w&&I.url(w),n.selection&&o.someNode(n,{match:{type:o.getPluginType(n,C)}})){I.show("edit",n.id),m();return}j.mode()==="edit"&&I.hide()},[n,r,m]),o.useHotkeys(u,w=>{w.preventDefault(),j.mode()==="edit"&&fe(n)},{enableOnContentEditable:!0},[]),Ds(),Nt(),{style:{...f,zIndex:1e3},...t,ref:o.useComposedRef(t.ref,g)}},js=({floatingOptions:e,...t})=>{const n=o.useEditorRef(),r=Ve.useFocused(),a=ne().mode(),l=ne().isOpen(n.id),{triggerFloatingButtonHotkeys:u}=o.getPluginOptions(n,C);o.useHotkeys(u,f=>{f.preventDefault(),Ne(n,{focused:r})},{enableOnContentEditable:!0},[r]);const{update:d,style:c,floating:m}=At({open:l&&a==="insert",getBoundingClientRect:o.getSelectionBoundingClientRect,whileElementsMounted:void 0,...e});return y.useEffect(()=>{l&&d(),I.updated(l)},[l,d]),Nt(),{style:{...c,zIndex:1e3},...t,ref:o.useComposedRef(t.ref,m)}},Bs=e=>{const t=o.useEditorRef();return{onClick:y.useCallback(()=>{fe(t)},[t]),...e}},Ls=o.createComponentAs(e=>{const t=Bs(e);return o.createElementAs("button",t)}),Ns=e=>{const t=o.useEditorRef();return{onClick:y.useCallback(()=>{se(t),o.focusEditor(t,t.selection??void 0)},[t]),...e}},As=o.createComponentAs(e=>{const t=Ns(e);return o.createElementAs(o.Button,t)}),Rs=o.createComponentAs(e=>{var n;const t=Ts(e);return((n=t.style)==null?void 0:n.display)==="none"?null:o.createElementAs("div",t)}),Fs=o.createComponentAs(e=>{var n;const t=js(e);return((n=t.style)==null?void 0:n.display)==="none"?null:o.createElementAs("div",t)}),ge={EditRoot:Rs,InsertRoot:Fs,EditButton:Ls,UnlinkButton:As},Ms=e=>{const t=ne().updated(),n=y.useRef(null);y.useEffect(()=>{n.current&&t&&setTimeout(()=>{var a;(a=n.current)==null||a.focus()},0)},[t]);const r=y.useCallback(a=>{I.url(a.target.value)},[]);return o.mergeProps({onChange:r,defaultValue:j.url()},{...e,ref:o.useComposedRef(e.ref,n)})},Ds=()=>{const e=o.useEditorRef();o.useHotkeys("*",t=>{t.key==="Enter"&&je(e)&&t.preventDefault()},{enableOnFormTags:["INPUT"]},[])},Nt=()=>{const e=o.useEditorRef();o.useHotkeys("escape",()=>{if(j.mode()==="edit"){if(j.isEditing()){I.show("edit",e.id),o.focusEditor(e,e.selection??void 0);return}I.hide()}},{enableOnFormTags:["INPUT"],enableOnContentEditable:!0},[])},Os=12,Us=-22,Hs=96,At=e=>o.useVirtualFloating({placement:"bottom-start",middleware:[o.offset({mainAxis:Os,alignmentAxis:Us}),o.flip({padding:Hs})],...e}),_s=({id:e="rte",isEditing:t,value:n,columns:r,gap:a,placeholder:l,plugins:u,onTextChange:d,showSerializedText:c})=>{const[m,f]=y.useState(!1),g=w=>{d&&w!==n&&d(w),f(!1)};return y.useEffect(()=>{const w=b=>(b.preventDefault(),b.returnValue="Unprocessed changes");return m&&window.addEventListener("beforeunload",w),()=>window.removeEventListener("beforeunload",w)},[m]),t?s.jsx(i.RichTextEditor,{id:e,value:n,border:!1,placeholder:l,plugins:u,onValueChanged:()=>f(!0),onTextChange:g,hideExternalFloatingModals:w=>{j.isOpen(w)&&I.reset()}}):s.jsx(cn,{value:n,columns:r,gap:a,show:c,plugins:u})},Vs=e=>new i.PluginComposer().setPlugin(new i.SoftBreakPlugin,new i.TextStylePlugin({textStyles:Ae})).setPlugin([new i.BoldPlugin,new i.ItalicPlugin,new i.UnderlinePlugin,new i.StrikethroughPlugin,new ut({appBridge:e}),new Lt({appBridge:e}),new i.CodePlugin],[new i.AlignLeftPlugin({validTypes:ee}),new i.AlignCenterPlugin({validTypes:ee}),new i.AlignRightPlugin({validTypes:ee}),new i.AlignJustifyPlugin({validTypes:ee}),new i.UnorderedListPlugin,new i.CheckboxListPlugin,new i.OrderedListPlugin,new i.ResetFormattingPlugin]),zs="--f-theme-settings-",$s=(e,t)=>{const{blockAssets:n,updateAssetIdsFromKey:r}=G.useBlockAssets(e),a=(n==null?void 0:n[t])||[];return{onAddAttachments:async m=>{const f=a.map(g=>g.id);for(const g of m)f.push(g.id);await r(t,f)},onAttachmentDelete:async m=>{const f=a.filter(g=>g.id!==m.id).map(g=>g.id);await r(t,f)},onAttachmentReplace:async(m,f)=>{const g=a.map(w=>w.id===m.id?f.id:w.id);await r(t,g)},onAttachmentsSorted:async m=>{const f=m.map(g=>g.id);await r(t,f)},attachments:a}},Ws={start:["Space","Enter"],cancel:[],end:["Space","Enter","Escape"]},qs=(e=0,t=0)=>{const n=Xe(e,t);return P.useSensors(P.useSensor(P.PointerSensor),P.useSensor(P.KeyboardSensor,{coordinateGetter:n,keyboardCodes:Ws}))},Gs=e=>{const t=e!=null&&e.id?`hasBackground${e.id}`:"hasBackground",n=e!=null&&e.id?`backgroundColor${e.id}`:"backgroundColor",r=e!=null&&e.preventDefaultColor?void 0:(e==null?void 0:e.defaultColor)||Jt,a=e!=null&&e.switchLabel?e.switchLabel:void 0;return{id:t,label:"Background",type:"switch",switchLabel:a,defaultValue:!!(e!=null&&e.defaultValue),on:[{id:n,defaultValue:r,type:"colorInput"}]}},Ks=e=>{const t=e!=null&&e.id?`hasBorder_${e.id}`:"hasBorder",n=e!=null&&e.id?`borderSelection_${e.id}`:"borderSelection",r=e!=null&&e.id?`borderStyle_${e.id}`:"borderStyle",a=e!=null&&e.id?`borderWidth_${e.id}`:"borderWidth",l=e!=null&&e.id?`borderColor_${e.id}`:"borderColor",u=(e==null?void 0:e.defaultColor)||We,d=e!=null&&e.switchLabel?e.switchLabel:void 0;return{id:t,label:"Border",type:"switch",switchLabel:d,defaultValue:!!(e!=null&&e.defaultValue),on:[{id:n,type:"multiInput",onChange:c=>h.appendUnit(c,a),layout:h.MultiInputLayout.Columns,lastItemFullWidth:!0,blocks:[{id:r,type:"dropdown",defaultValue:M.Solid,choices:[{value:M.Solid,label:M.Solid},{value:M.Dotted,label:M.Dotted},{value:M.Dashed,label:M.Dashed}]},{id:a,type:"input",defaultValue:Zt,rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)],placeholder:"e.g. 3px"},{id:l,type:"colorInput",defaultValue:u}]}],off:[]}},Re=(e,t=H.None)=>({id:e,type:"segmentedControls",defaultValue:t,choices:[{value:H.None,label:"None"},{value:H.Small,label:"S"},{value:H.Medium,label:"M"},{value:H.Large,label:"L"}]}),Xs=e=>{const t=e!=null&&e.id?`hasRadius_${e.id}`:"hasRadius",n=e!=null&&e.id?`radiusValue_${e.id}`:"radiusValue",r=e!=null&&e.id?`radiusChoice_${e.id}`:"radiusChoice",a=(e==null?void 0:e.defaultRadius)||H.None;return{id:t,label:"Corner radius",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"Determining how rounded the corners are.",show:l=>{var u;return e!=null&&e.dependentSettingId?!!((u=l.getBlock(e.dependentSettingId))!=null&&u.value):!0},onChange:l=>h.presetCustomValue(l,r,n,(e==null?void 0:e.radiusStyleMap)||W),on:[{id:n,type:"input",placeholder:"e.g. 10px",rules:[h.numericalOrPixelRule],onChange:l=>h.appendUnit(l,n)}],off:[Re(r,a)]}},Qs=e=>{const t=e!=null&&e.id?`hasExtendedCustomRadius_${e.id}`:"hasExtendedCustomRadius",n=e!=null&&e.id?`extendedRadiusValue_${e.id}`:"extendedRadiusValue",r=e!=null&&e.id?`extendedRadiusChoice_${e.id}`:"extendedRadiusChoice",a=e!=null&&e.id?`extendedRadiusTopLeft_${e.id}`:"extendedRadiusTopLeft",l=e!=null&&e.id?`extendedRadiusTopRight_${e.id}`:"extendedRadiusTopRight",u=e!=null&&e.id?`extendedRadiusBottomLeft_${e.id}`:"extendedRadiusBottomLeft",d=e!=null&&e.id?`extendedRadiusBottomRight_${e.id}`:"extendedRadiusBottomRight";return{id:t,label:"Corner radius",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"Determining how rounded the corners are.",show:c=>{var m;return e!=null&&e.dependentSettingId?!!((m=c.getBlock(e.dependentSettingId))!=null&&m.value):!0},onChange:c=>{h.presetCustomValue(c,r,a,W),h.presetCustomValue(c,r,l,W),h.presetCustomValue(c,r,u,W),h.presetCustomValue(c,r,d,W)},on:[{id:n,type:"multiInput",layout:h.MultiInputLayout.Columns,blocks:[{id:a,type:"input",label:"Top Left",rules:[h.numericalOrPixelRule],onChange:c=>h.appendUnit(c,a)},{id:l,type:"input",label:"Top Right",rules:[h.numericalOrPixelRule],onChange:c=>h.appendUnit(c,l)},{id:u,type:"input",label:"Bottom Left",rules:[h.numericalOrPixelRule],onChange:c=>h.appendUnit(c,u)},{id:d,type:"input",label:"Bottom Right",rules:[h.numericalOrPixelRule],onChange:c=>h.appendUnit(c,d)}]}],off:[Re(r,e==null?void 0:e.defaultValue)]}},Ys=e=>{const t=e!=null&&e.id?e.id:"hasCustomSpacing",n=e!=null&&e.dependentSettingId?e.dependentSettingId:"columns",r=e!=null&&e.spacingChoiceId?e.spacingChoiceId:"spacingChoice",a=e!=null&&e.spacingCustomId?e.spacingCustomId:"spacingCustom",l=e!=null&&e.defaultValueChoices?e.defaultValueChoices:$.M;return{id:t,type:"switch",defaultValue:!1,switchLabel:"Custom",label:"Gutter",info:"An official nerds term for ‘gap’",onChange:u=>h.presetCustomValue(u,r,a,$e),show:u=>{var d;return((d=u.getBlock(n))==null?void 0:d.value)!=="1"},on:[{id:a,type:"input",rules:[h.numericalOrPixelRule],onChange:u=>h.appendUnit(u,a)}],off:[{id:r,type:"slider",defaultValue:l,choices:[{value:$.Auto,label:"Auto"},{value:$.S,label:"S"},{value:$.M,label:"M"},{value:$.L,label:"L"}]}]}},Fe=e=>({id:e,type:"segmentedControls",defaultValue:z.None,choices:[{value:z.None,label:"None"},{value:z.Small,label:"S"},{value:z.Medium,label:"M"},{value:z.Large,label:"L"}]}),Js=e=>{const t=e!=null&&e.id?`hasCustomMarginValue_${e==null?void 0:e.id}`:"hasCustomMarginValue",n=e!=null&&e.id?`marginValue_${e==null?void 0:e.id}`:"marginValue",r=e!=null&&e.id?`marginChoice_${e==null?void 0:e.id}`:"marginChoice";return{id:t,label:"Margin",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more space",onChange:a=>h.presetCustomValue(a,r,n,(e==null?void 0:e.marginStyleMap)||Z),on:[{id:n,type:"input",placeholder:ie,rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)],onChange:a=>h.appendUnit(a,n)}],off:[Fe(r)]}},Zs=e=>{const t=e!=null&&e.id?`hasExtendedCustomMargin_${e==null?void 0:e.id}`:"hasExtendedCustomMargin",n=e!=null&&e.id?`extendedMarginValues_${e==null?void 0:e.id}`:"extendedMarginValues",r=e!=null&&e.id?`extendedMarginChoice_${e==null?void 0:e.id}`:"extendedMarginChoice",a=e!=null&&e.id?`extendedMarginTop_${e==null?void 0:e.id}`:"extendedMarginTop",l=e!=null&&e.id?`extendedMarginLeft_${e==null?void 0:e.id}`:"extendedMarginLeft",u=e!=null&&e.id?`extendedMarginRight_${e==null?void 0:e.id}`:"extendedMarginRight",d=e!=null&&e.id?`extendedMarginBottom_${e==null?void 0:e.id}`:"extendedMarginBottom";return{id:t,label:"Margin",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more negative space",onChange:c=>{h.presetCustomValue(c,r,a,Z),h.presetCustomValue(c,r,l,Z),h.presetCustomValue(c,r,u,Z),h.presetCustomValue(c,r,d,Z)},on:[{id:n,type:"multiInput",layout:h.MultiInputLayout.Spider,blocks:[{id:a,type:"input",label:"Top",placeholder:ie,onChange:c=>h.appendUnit(c,a),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:l,type:"input",label:"Left",placeholder:ie,onChange:c=>h.appendUnit(c,l),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:u,type:"input",label:"Right",placeholder:ie,onChange:c=>h.appendUnit(c,u),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:d,type:"input",label:"Bottom",placeholder:ie,onChange:c=>h.appendUnit(c,d),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]}]}],off:[Fe(r)]}},Me=e=>({id:e,type:"segmentedControls",defaultValue:V.Small,choices:[{value:V.None,label:"None"},{value:V.Small,label:"S"},{value:V.Medium,label:"M"},{value:V.Large,label:"L"}]}),er=e=>{const t=e!=null&&e.id?`hasCustomPaddingValue_${e==null?void 0:e.id}`:"hasCustomPaddingValue",n=e!=null&&e.id?`paddingValue_${e==null?void 0:e.id}`:"paddingValue",r=e!=null&&e.id?`paddingChoice_${e==null?void 0:e.id}`:"paddingChoice";return{id:t,label:"Padding",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more negative space",onChange:a=>h.presetCustomValue(a,r,n,(e==null?void 0:e.paddingStyleMap)||J),on:[{id:n,type:"input",placeholder:ae,rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)],onChange:a=>h.appendUnit(a,n)}],off:[Me(r)]}},tr=e=>{const t=e!=null&&e.id?`hasExtendedCustomPadding_${e==null?void 0:e.id}`:"hasExtendedCustomPadding",n=e!=null&&e.id?`extendedPaddingValues_${e==null?void 0:e.id}`:"extendedPaddingValues",r=e!=null&&e.id?`extendedPaddingChoice_${e==null?void 0:e.id}`:"extendedPaddingChoice",a=e!=null&&e.id?`extendedPaddingTop_${e==null?void 0:e.id}`:"extendedPaddingTop",l=e!=null&&e.id?`extendedPaddingLeft_${e==null?void 0:e.id}`:"extendedPaddingLeft",u=e!=null&&e.id?`extendedPaddingRight_${e==null?void 0:e.id}`:"extendedPaddingRight",d=e!=null&&e.id?`extendedPaddingBottom_${e==null?void 0:e.id}`:"extendedPaddingBottom";return{id:t,label:"Padding",type:"switch",switchLabel:"Custom",defaultValue:!1,info:"The spacing around UI elements to create more negative space",onChange:c=>{h.presetCustomValue(c,r,a,J),h.presetCustomValue(c,r,l,J),h.presetCustomValue(c,r,u,J),h.presetCustomValue(c,r,d,J)},on:[{id:n,type:"multiInput",layout:h.MultiInputLayout.Spider,blocks:[{id:a,type:"input",label:"Top",placeholder:ae,onChange:c=>h.appendUnit(c,a),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:l,type:"input",label:"Left",placeholder:ae,onChange:c=>h.appendUnit(c,l),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:u,type:"input",label:"Right",placeholder:ae,onChange:c=>h.appendUnit(c,u),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]},{id:d,type:"input",label:"Bottom",placeholder:ae,onChange:c=>h.appendUnit(c,d),rules:[h.numericalOrPixelRule,h.maximumNumericalOrPixelOrAutoRule(500)]}]}],off:[Me(r)]}},nr=e=>{const t=De(e==null?void 0:e.globalControlId);return{id:e!=null&&e.id?e.id:"downloadable",type:"switch",defaultValue:!1,label:"Downloadable",show:n=>{var r;return((r=n.getBlock(t))==null?void 0:r.value)===q.Custom}}},De=e=>e||"security",sr=e=>[{id:De(e),type:"segmentedControls",defaultValue:q.Global,choices:[{value:q.Global,label:"Global Settings"},{value:q.Custom,label:"Custom"}]},{id:"globalSettingsInfo",type:"notification",footer:h.createFooter({label:"Change global settings [here].",replace:{here:{event:"general-settings.open"}}})}];var Rt=(e=>(e.Main="main",e.Basics="basics",e.Layout="layout",e.Style="style",e.Security="security",e.Targets="targets",e))(Rt||{});const rr=e=>e,ar=e=>e;exports.AllTextStylePlugins=ps;exports.AllTextStyles=bs;exports.Attachments=on;exports.BUTTON_PLUGIN=jt;exports.BlockButtonStyles=we;exports.BlockInjectButton=Vt;exports.BlockItemWrapper=sn;exports.BlockStyles=T;exports.BorderStyle=M;exports.ButtonPlugin=Lt;exports.Custom1Plugin=dt;exports.Custom2Plugin=mt;exports.Custom3Plugin=ft;exports.DEFAULT_DRAGGING_TOOLTIP=Ge;exports.DEFAULT_DRAG_TOOLTIP=qe;exports.DownloadButton=ln;exports.ELEMENT_BUTTON=C;exports.GutterSpacing=$;exports.Heading1Plugin=yt;exports.Heading2Plugin=xt;exports.Heading3Plugin=pt;exports.Heading4Plugin=bt;exports.ImageCaptionPlugin=vt;exports.ImageTitlePlugin=kt;exports.LinkInput=ot;exports.LinkPlugin=ut;exports.LinkSelector=it;exports.Margin=z;exports.PARAGRAPH_CLASSES=St;exports.Padding=V;exports.ParagraphMarkupElement=Et;exports.ParagraphMarkupElementNode=ue;exports.ParagraphPlugin=Ct;exports.QuoteMarkupElementNode=de;exports.QuotePlugin=It;exports.Radius=H;exports.RichTextEditor=_s;exports.Sections=Rt;exports.Security=q;exports.THEME_PREFIX=zs;exports.TextStylePluginsWithoutImage=Ae;exports.TextStyles=x;exports.TextStylesWithoutImage=ee;exports.addHttps=me;exports.borderStyleMap=ze;exports.convertToRteValue=un;exports.createButtonNode=rt;exports.createButtonPlugin=Bt;exports.createLinkPlugin=ct;exports.createParagraphPlugin=Pt;exports.createQuotePlugin=Tt;exports.customCoordinatesGetterFactory=Xe;exports.defineBlock=rr;exports.defineSettings=ar;exports.getBackgroundColorStyles=Yt;exports.getBackgroundSettings=Gs;exports.getBorderRadiusSettings=Xs;exports.getBorderRadiusSlider=Re;exports.getBorderSettings=Ks;exports.getBorderStyles=en;exports.getDefaultPluginsWithLinkChooser=Vs;exports.getExtendedBorderRadiusSettings=Qs;exports.getGutterSettings=Ys;exports.getLegacyUrl=Je;exports.getMarginExtendedSettings=Zs;exports.getMarginSettings=Js;exports.getMarginSlider=Fe;exports.getPaddingExtendedSettings=tr;exports.getPaddingSettings=er;exports.getPaddingSlider=Me;exports.getRadiusStyles=tn;exports.getReadableColor=Xt;exports.getSecurityDownloadableSetting=nr;exports.getSecurityGlobalControlId=De;exports.getSecurityGlobalControlSetting=sr;exports.getUrl=Ze;exports.getUrlFromEditor=Le;exports.getUrlFromLinkOrLegacyLink=hn;exports.gutterSpacingStyleMap=$e;exports.hasRichTextValue=Ke;exports.insertButton=tt;exports.isDark=$t;exports.isDownloadable=gn;exports.isValidUrl=he;exports.isValidUrlOrEmpty=te;exports.joinClassNames=U;exports.mapAppBridgeColorPaletteToFonduePalette=Qe;exports.mapAppBridgeColorPalettesToFonduePalettes=mn;exports.marginStyleMap=Z;exports.moveItemInArray=Qt;exports.paddingStyleMap=J;exports.radiusStyleMap=W;exports.relativeUrlRegex=Ie;exports.setAlpha=Gt;exports.submitFloatingButton=je;exports.toColorObject=Kt;exports.toHex8String=Wt;exports.toHexString=qt;exports.toRgbaString=Ee;exports.toShortRgba=K;exports.triggerFloatingButton=at;exports.triggerFloatingButtonEdit=fe;exports.triggerFloatingButtonInsert=Ne;exports.unwrapButton=se;exports.upsertButton=nt;exports.upsertButtonText=Be;exports.useAttachments=$s;exports.useDndSensors=qs;exports.withButton=et;exports.wrapButton=st;Object.keys(h).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>h[e]})});
4
4
  //# sourceMappingURL=index.cjs.js.map