From 34fe06ecef5d5c7d8f250919cd158b83eb3a47fe Mon Sep 17 00:00:00 2001 From: Tom Usborne Date: Thu, 23 Jun 2022 14:20:09 -0700 Subject: [PATCH 01/75] Improve frontend CSS generation --- includes/blocks/class-button-container.php | 267 +++ includes/blocks/class-button.php | 497 +++++ includes/blocks/class-container.php | 847 +++++++++ includes/blocks/class-grid.php | 259 +++ includes/blocks/class-headline.php | 787 ++++++++ includes/blocks/class-image.php | 360 ++++ includes/blocks/class-query-loop.php | 78 + includes/class-enqueue-css.php | 6 + includes/class-render-blocks.php | 712 +------- includes/defaults.php | 486 +---- includes/functions.php | 321 ++++ includes/generate-css.php | 1905 -------------------- plugin.php | 10 +- 13 files changed, 3448 insertions(+), 3087 deletions(-) create mode 100644 includes/blocks/class-button-container.php create mode 100644 includes/blocks/class-button.php create mode 100644 includes/blocks/class-container.php create mode 100644 includes/blocks/class-grid.php create mode 100644 includes/blocks/class-headline.php create mode 100644 includes/blocks/class-image.php create mode 100644 includes/blocks/class-query-loop.php delete mode 100644 includes/generate-css.php diff --git a/includes/blocks/class-button-container.php b/includes/blocks/class-button-container.php new file mode 100644 index 000000000..85a72956e --- /dev/null +++ b/includes/blocks/class-button-container.php @@ -0,0 +1,267 @@ + '', + 'alignmentTablet' => '', + 'alignmentMobile' => '', + 'marginTop' => '', + 'marginRight' => '', + 'marginBottom' => '', + 'marginLeft' => '', + 'marginTopTablet' => '', + 'marginRightTablet' => '', + 'marginBottomTablet' => '', + 'marginLeftTablet' => '', + 'marginTopMobile' => '', + 'marginRightMobile' => '', + 'marginBottomMobile' => '', + 'marginLeftMobile' => '', + 'marginUnit' => 'px', + 'stack' => false, + 'stackTablet' => false, + 'stackMobile' => false, + 'fillHorizontalSpace' => false, + 'fillHorizontalSpaceTablet' => false, + 'fillHorizontalSpaceMobile' => false, + ]; + } + + /** + * Compile our CSS data based on our block attributes. + * + * @param array $attributes Our block attributes. + */ + public static function get_css_data( $attributes ) { + $css = new GenerateBlocks_Dynamic_CSS(); + $desktop_css = new GenerateBlocks_Dynamic_CSS(); + $tablet_css = new GenerateBlocks_Dynamic_CSS(); + $tablet_only_css = new GenerateBlocks_Dynamic_CSS(); + $mobile_css = new GenerateBlocks_Dynamic_CSS(); + $css_data = []; + + $defaults = generateblocks_get_block_defaults(); + + $settings = wp_parse_args( + $attributes, + $defaults['buttonContainer'] + ); + + $id = $attributes['uniqueId']; + $blockVersion = ! empty( $settings['blockVersion'] ) ? $settings['blockVersion'] : 1; + + // Only add this CSS once. + if ( count( (array) self::$block_ids ) === 0 ) { + $css->set_selector( '.gb-button-wrapper' ); + $css->add_property( 'display', 'flex' ); + $css->add_property( 'flex-wrap', 'wrap' ); + $css->add_property( 'align-items', 'flex-start' ); + $css->add_property( 'justify-content', 'flex-start' ); + $css->add_property( 'clear', 'both' ); + } + + self::$block_ids[] = $id; + + $css->set_selector( '.gb-button-wrapper-' . $id ); + $css->add_property( 'margin', array( $settings['marginTop'], $settings['marginRight'], $settings['marginBottom'], $settings['marginLeft'] ), $settings['marginUnit'] ); + $css->add_property( 'justify-content', generateblocks_get_flexbox_alignment( $settings['alignment'] ) ); + + $stack_desktop = $desktop_css; + $stack_tablet_only = $tablet_only_css; + + if ( $blockVersion < 2 ) { + $stack_desktop = $css; + $stack_tablet_only = $tablet_css; + } + + if ( $settings['stack'] ) { + $stack_desktop->set_selector( '.gb-button-wrapper-' . $id ); + $stack_desktop->add_property( 'flex-direction', 'column' ); + $stack_desktop->add_property( 'align-items', generateblocks_get_flexbox_alignment( $settings['alignment'] ) ); + } + + if ( $settings['fillHorizontalSpace'] ) { + $stack_desktop->set_selector( '.gb-button-wrapper-' . $id . ' > .gb-button' ); + $stack_desktop->add_property( 'flex', '1' ); + } + + if ( $settings['stack'] && $settings['fillHorizontalSpace'] ) { + $stack_desktop->add_property( 'width', '100%' ); + $stack_desktop->add_property( 'box-sizing', 'border-box' ); + } + + $tablet_css->set_selector( '.gb-button-wrapper-' . $id ); + $tablet_css->add_property( 'margin', array( $settings['marginTopTablet'], $settings['marginRightTablet'], $settings['marginBottomTablet'], $settings['marginLeftTablet'] ), $settings['marginUnit'] ); + $tablet_css->add_property( 'justify-content', generateblocks_get_flexbox_alignment( $settings['alignmentTablet'] ) ); + + if ( $settings['stackTablet'] ) { + $stack_tablet_only->set_selector( '.gb-button-wrapper-' . $id ); + $stack_tablet_only->add_property( 'flex-direction', 'column' ); + $stack_tablet_only->add_property( 'align-items', generateblocks_get_flexbox_alignment( $settings['alignmentTablet'] ) ); + } + + if ( $settings['fillHorizontalSpaceTablet'] ) { + $stack_tablet_only->set_selector( '.gb-button-wrapper-' . $id . ' > .gb-button' ); + $stack_tablet_only->add_property( 'flex', '1' ); + } + + if ( $settings['stackTablet'] && $settings['fillHorizontalSpaceTablet'] ) { + $stack_tablet_only->add_property( 'width', '100%' ); + $stack_tablet_only->add_property( 'box-sizing', 'border-box' ); + } + + $mobile_css->set_selector( '.gb-button-wrapper-' . $id ); + $mobile_css->add_property( 'margin', array( $settings['marginTopMobile'], $settings['marginRightMobile'], $settings['marginBottomMobile'], $settings['marginLeftMobile'] ), $settings['marginUnit'] ); + $mobile_css->add_property( 'justify-content', generateblocks_get_flexbox_alignment( $settings['alignmentMobile'] ) ); + + if ( $settings['stackMobile'] ) { + $mobile_css->add_property( 'flex-direction', 'column' ); + $mobile_css->add_property( 'align-items', generateblocks_get_flexbox_alignment( $settings['alignmentMobile'] ) ); + } + + if ( $settings['fillHorizontalSpaceMobile'] ) { + $mobile_css->set_selector( '.gb-button-wrapper-' . $id . ' > .gb-button' ); + $mobile_css->add_property( 'flex', '1' ); + } + + if ( $settings['stackMobile'] && $settings['fillHorizontalSpaceMobile'] ) { + $mobile_css->add_property( 'width', '100%' ); + $mobile_css->add_property( 'box-sizing', 'border-box' ); + } + + /** + * Do generateblocks_block_css_data hook + * + * @since 1.0 + * + * @param string $name The name of our block. + * @param array $settings The settings for the current block. + * @param object $css Our desktop/main CSS data. + * @param object $desktop_css Our desktop only CSS data. + * @param object $tablet_css Our tablet CSS data. + * @param object $tablet_only_css Our tablet only CSS data. + * @param object $mobile_css Our mobile CSS data. + */ + do_action( + 'generateblocks_block_css_data', + 'button-container', + $settings, + $css, + $desktop_css, + $tablet_css, + $tablet_only_css, + $mobile_css + ); + + return [ + 'main' => $css->css_output(), + 'desktop' => $desktop_css->css_output(), + 'tablet' => $tablet_css->css_output(), + 'tablet_only' => $tablet_only_css->css_output(), + 'mobile' => $mobile_css->css_output(), + ]; + } + + /** + * Wrapper function for our dynamic buttons. + * + * @since 1.5.0 + * @param array $attributes The block attributes. + * @param string $content The dynamic text to display. + * @param WP_Block $block Block instance. + */ + public static function render_block( $attributes, $content, $block ) { + if ( ! isset( $attributes['isDynamic'] ) || ! $attributes['isDynamic'] ) { + if ( ! in_array( $attributes['uniqueId'], self::$block_ids ) ) { + // Build our CSS for this block. + $content .= generateblocks_do_inline_css_output( + $content, + self::get_css_data( $attributes ) + ); + } + + return $content; + } + + if ( isset( $block->parsed_block['innerBlocks'] ) ) { + $button_count = apply_filters( + 'generateblocks_button_count', + count( (array) $block->parsed_block['innerBlocks'] ), + $attributes, + $block + ); + + if ( 0 === $button_count ) { + return; + } + } + + $defaults = generateblocks_get_block_defaults(); + + $settings = wp_parse_args( + $attributes, + $defaults['buttonContainer'] + ); + + $classNames = array( + 'gb-button-wrapper', + 'gb-button-wrapper-' . $settings['uniqueId'], + ); + + if ( ! empty( $settings['className'] ) ) { + $classNames[] = $settings['className']; + } + + $output = ''; + + if ( ! in_array( $attributes['uniqueId'], self::$block_ids ) ) { + // Build our CSS for this block. + $output .= generateblocks_do_inline_css_output( + '', + self::get_css_data( $attributes ) + ); + } + + $output .= sprintf( + '
', + generateblocks_attr( + 'button-container', + array( + 'id' => isset( $settings['anchor'] ) ? $settings['anchor'] : null, + 'class' => implode( ' ', $classNames ), + ), + $settings, + $block + ) + ); + + $output .= $content; + + $output .= '
'; + + return $output; + } +} diff --git a/includes/blocks/class-button.php b/includes/blocks/class-button.php new file mode 100644 index 000000000..7734a237c --- /dev/null +++ b/includes/blocks/class-button.php @@ -0,0 +1,497 @@ + false, + 'backgroundColorOpacity' => 1, + 'backgroundColorHover' => false, + 'backgroundColorHoverOpacity' => 1, + 'backgroundColorCurrent' => '', + 'textColor' => false, + 'textColorHover' => false, + 'textColorCurrent' => '', + 'borderColor' => false, + 'borderColorOpacity' => 1, + 'borderColorHover' => false, + 'borderColorHoverOpacity' => 1, + 'borderColorCurrent' => false, + 'fontFamily' => '', + 'fontFamilyFallback' => '', + 'googleFont' => false, + 'googleFontVariants' => '', + 'fontWeight' => '', + 'fontSize' => false, + 'fontSizeTablet' => false, + 'fontSizeMobile' => false, + 'fontSizeUnit' => 'px', + 'textTransform' => '', + 'letterSpacing' => '', + 'letterSpacingTablet' => '', + 'letterSpacingMobile' => '', + 'marginTop' => '', + 'marginRight' => '', + 'marginBottom' => '', + 'marginLeft' => '', + 'marginTopTablet' => '', + 'marginRightTablet' => '', + 'marginBottomTablet' => '', + 'marginLeftTablet' => '', + 'marginTopMobile' => '', + 'marginRightMobile' => '', + 'marginBottomMobile' => '', + 'marginLeftMobile' => '', + 'marginUnit' => 'px', + 'paddingTop' => '', + 'paddingRight' => '', + 'paddingBottom' => '', + 'paddingLeft' => '', + 'paddingTopTablet' => '', + 'paddingRightTablet' => '', + 'paddingBottomTablet' => '', + 'paddingLeftTablet' => '', + 'paddingTopMobile' => '', + 'paddingRightMobile' => '', + 'paddingBottomMobile' => '', + 'paddingLeftMobile' => '', + 'paddingUnit' => 'px', + 'borderSizeTop' => '', + 'borderSizeRight' => '', + 'borderSizeBottom' => '', + 'borderSizeLeft' => '', + 'borderSizeTopTablet' => '', + 'borderSizeRightTablet' => '', + 'borderSizeBottomTablet' => '', + 'borderSizeLeftTablet' => '', + 'borderSizeTopMobile' => '', + 'borderSizeRightMobile' => '', + 'borderSizeBottomMobile' => '', + 'borderSizeLeftMobile' => '', + 'borderRadiusTopRight' => '', + 'borderRadiusBottomRight' => '', + 'borderRadiusBottomLeft' => '', + 'borderRadiusTopLeft' => '', + 'borderRadiusTopRightTablet' => '', + 'borderRadiusBottomRightTablet' => '', + 'borderRadiusBottomLeftTablet' => '', + 'borderRadiusTopLeftTablet' => '', + 'borderRadiusTopRightMobile' => '', + 'borderRadiusBottomRightMobile' => '', + 'borderRadiusBottomLeftMobile' => '', + 'borderRadiusTopLeftMobile' => '', + 'borderRadiusUnit' => 'px', + 'icon' => '', + 'hasIcon' => false, + 'iconLocation' => 'left', + 'removeText' => false, + 'ariaLabel' => '', + 'gradient' => false, + 'gradientDirection' => '', + 'gradientColorOne' => '', + 'gradientColorOneOpacity' => '', + 'gradientColorStopOne' => '', + 'gradientColorTwo' => '', + 'gradientColorTwoOpacity' => '', + 'gradientColorStopTwo' => '', + 'iconPaddingTop' => '', + 'iconPaddingRight' => '0.5', + 'iconPaddingBottom' => '', + 'iconPaddingLeft' => '', + 'iconPaddingTopTablet' => '', + 'iconPaddingRightTablet' => '', + 'iconPaddingBottomTablet' => '', + 'iconPaddingLeftTablet' => '', + 'iconPaddingTopMobile' => '', + 'iconPaddingRightMobile' => '', + 'iconPaddingBottomMobile' => '', + 'iconPaddingLeftMobile' => '', + 'iconPaddingUnit' => 'em', + 'iconSize' => 1, + 'iconSizeTablet' => '', + 'iconSizeMobile' => '', + 'iconSizeUnit' => 'em', + ]; + } + + /** + * Compile our CSS data based on our block attributes. + * + * @param array $attributes Our block attributes. + */ + public static function get_css_data( $attributes ) { + $css = new GenerateBlocks_Dynamic_CSS(); + $desktop_css = new GenerateBlocks_Dynamic_CSS(); + $tablet_css = new GenerateBlocks_Dynamic_CSS(); + $tablet_only_css = new GenerateBlocks_Dynamic_CSS(); + $mobile_css = new GenerateBlocks_Dynamic_CSS(); + $css_data = []; + + $defaults = generateblocks_get_block_defaults(); + + $settings = wp_parse_args( + $attributes, + $defaults['button'] + ); + + $id = $attributes['uniqueId']; + $blockVersion = ! empty( $settings['blockVersion'] ) ? $settings['blockVersion'] : 1; + + // Use legacy settings if needed. + if ( $blockVersion < 2 ) { + $settings = GenerateBlocks_Legacy_Attributes::get_settings( '1.4.0', 'button', $settings, $attributes ); + } + + $selector = 'a.gb-button-' . $id; + + if ( isset( $attributes['hasUrl'] ) && ! $attributes['hasUrl'] ) { + $selector = '.gb-button-' . $id; + } + + // Back-compatibility for when icon held a value. + if ( $settings['icon'] ) { + $settings['hasIcon'] = true; + } + + $fontFamily = $settings['fontFamily']; + + if ( $fontFamily && $settings['fontFamilyFallback'] ) { + $fontFamily = $fontFamily . ', ' . $settings['fontFamilyFallback']; + } + + $gradientColorStopOneValue = ''; + $gradientColorStopTwoValue = ''; + + if ( $settings['gradient'] ) { + if ( $settings['gradientColorOne'] && '' !== $settings['gradientColorStopOne'] ) { + $gradientColorStopOneValue = ' ' . $settings['gradientColorStopOne'] . '%'; + } + + if ( $settings['gradientColorTwo'] && '' !== $settings['gradientColorStopTwo'] ) { + $gradientColorStopTwoValue = ' ' . $settings['gradientColorStopTwo'] . '%'; + } + } + + // Only add this CSS once. + if ( count( (array) self::$block_ids ) === 0 ) { + $css->set_selector( '.gb-button-wrapper .gb-button' ); + $css->add_property( 'display', 'inline-flex' ); + $css->add_property( 'align-items', 'center' ); + $css->add_property( 'justify-content', 'center' ); + $css->add_property( 'text-align', 'center' ); + $css->add_property( 'text-decoration', 'none' ); + $css->add_property( 'transition', '.2s background-color ease-in-out, .2s color ease-in-out, .2s border-color ease-in-out, .2s opacity ease-in-out, .2s box-shadow ease-in-out' ); + + $css->set_selector( '.gb-button-wrapper .gb-button .gb-icon' ); + $css->add_property( 'align-items', 'center' ); + + $css->set_selector( '.gb-icon' ); + $css->add_property( 'display', 'inline-flex' ); + $css->add_property( 'line-height', '0' ); + + $css->set_selector( '.gb-icon svg' ); + $css->add_property( 'height', '1em' ); + $css->add_property( 'width', '1em' ); + $css->add_property( 'fill', 'currentColor' ); + } + + self::$block_ids[] = $id; + + $css->set_selector( '.gb-button-wrapper ' . $selector . ',.gb-button-wrapper ' . $selector . ':visited' ); + $css->add_property( 'background-color', generateblocks_hex2rgba( $settings['backgroundColor'], $settings['backgroundColorOpacity'] ) ); + $css->add_property( 'color', $settings['textColor'] ); + + if ( $settings['gradient'] ) { + $css->add_property( 'background-image', 'linear-gradient(' . $settings['gradientDirection'] . 'deg, ' . generateblocks_hex2rgba( $settings['gradientColorOne'], $settings['gradientColorOneOpacity'] ) . $gradientColorStopOneValue . ', ' . generateblocks_hex2rgba( $settings['gradientColorTwo'], $settings['gradientColorTwoOpacity'] ) . $gradientColorStopTwoValue . ')' ); + } + + $css->add_property( 'font-family', $fontFamily ); + $css->add_property( 'font-size', $settings['fontSize'], $settings['fontSizeUnit'] ); + $css->add_property( 'font-weight', $settings['fontWeight'] ); + $css->add_property( 'text-transform', $settings['textTransform'] ); + $css->add_property( 'letter-spacing', $settings['letterSpacing'], 'em' ); + $css->add_property( 'padding', array( $settings['paddingTop'], $settings['paddingRight'], $settings['paddingBottom'], $settings['paddingLeft'] ), $settings['paddingUnit'] ); + $css->add_property( 'border-radius', array( $settings['borderRadiusTopLeft'], $settings['borderRadiusTopRight'], $settings['borderRadiusBottomRight'], $settings['borderRadiusBottomLeft'] ), $settings['borderRadiusUnit'] ); + $css->add_property( 'margin', array( $settings['marginTop'], $settings['marginRight'], $settings['marginBottom'], $settings['marginLeft'] ), $settings['marginUnit'] ); + $css->add_property( 'border-width', array( $settings['borderSizeTop'], $settings['borderSizeRight'], $settings['borderSizeBottom'], $settings['borderSizeLeft'] ), 'px' ); + $css->add_property( 'border-color', generateblocks_hex2rgba( $settings['borderColor'], $settings['borderColorOpacity'] ) ); + $css->add_property( 'text-transform', $settings['textTransform'] ); + + if ( $settings['hasIcon'] ) { + $css->add_property( 'display', 'inline-flex' ); + $css->add_property( 'align-items', 'center' ); + } + + $css->set_selector( '.gb-button-wrapper ' . $selector . ':hover,.gb-button-wrapper ' . $selector . ':active,.gb-button-wrapper ' . $selector . ':focus' ); + $css->add_property( 'background-color', generateblocks_hex2rgba( $settings['backgroundColorHover'], $settings['backgroundColorHoverOpacity'] ) ); + $css->add_property( 'color', $settings['textColorHover'] ); + $css->add_property( 'border-color', generateblocks_hex2rgba( $settings['borderColorHover'], $settings['borderColorHoverOpacity'] ) ); + + $css->set_selector( '.gb-button-wrapper ' . $selector . '.gb-button__current, .gb-button-wrapper ' . $selector . '.gb-button__current:visited' ); + $css->add_property( 'background-color', $settings['backgroundColorCurrent'] ); + $css->add_property( 'color', $settings['textColorCurrent'] ); + $css->add_property( 'border-color', $settings['borderColorCurrent'] ); + + if ( $settings['hasIcon'] ) { + $css->set_selector( $selector . ' .gb-icon' ); + $css->add_property( 'font-size', $settings['iconSize'], $settings['iconSizeUnit'] ); + + if ( ! $settings['removeText'] ) { + $css->add_property( 'padding', array( $settings['iconPaddingTop'], $settings['iconPaddingRight'], $settings['iconPaddingBottom'], $settings['iconPaddingLeft'] ), $settings['iconPaddingUnit'] ); + } + } + + $tablet_css->set_selector( '.gb-button-wrapper ' . $selector ); + $tablet_css->add_property( 'font-size', $settings['fontSizeTablet'], $settings['fontSizeUnit'] ); + $tablet_css->add_property( 'letter-spacing', $settings['letterSpacingTablet'], 'em' ); + $tablet_css->add_property( 'padding', array( $settings['paddingTopTablet'], $settings['paddingRightTablet'], $settings['paddingBottomTablet'], $settings['paddingLeftTablet'] ), $settings['paddingUnit'] ); + $tablet_css->add_property( 'border-radius', array( $settings['borderRadiusTopLeftTablet'], $settings['borderRadiusTopRightTablet'], $settings['borderRadiusBottomRightTablet'], $settings['borderRadiusBottomLeftTablet'] ), $settings['borderRadiusUnit'] ); + $tablet_css->add_property( 'margin', array( $settings['marginTopTablet'], $settings['marginRightTablet'], $settings['marginBottomTablet'], $settings['marginLeftTablet'] ), $settings['marginUnit'] ); + $tablet_css->add_property( 'border-width', array( $settings['borderSizeTopTablet'], $settings['borderSizeRightTablet'], $settings['borderSizeBottomTablet'], $settings['borderSizeLeftTablet'] ), 'px' ); + + if ( $settings['hasIcon'] ) { + $tablet_css->set_selector( $selector . ' .gb-icon' ); + $tablet_css->add_property( 'font-size', $settings['iconSizeTablet'], $settings['iconSizeUnit'] ); + + if ( ! $settings['removeText'] ) { + $tablet_css->add_property( 'padding', array( $settings['iconPaddingTopTablet'], $settings['iconPaddingRightTablet'], $settings['iconPaddingBottomTablet'], $settings['iconPaddingLeftTablet'] ), $settings['iconPaddingUnit'] ); + } + } + + $mobile_css->set_selector( '.gb-button-wrapper ' . $selector ); + $mobile_css->add_property( 'font-size', $settings['fontSizeMobile'], $settings['fontSizeUnit'] ); + $mobile_css->add_property( 'letter-spacing', $settings['letterSpacingMobile'], 'em' ); + $mobile_css->add_property( 'padding', array( $settings['paddingTopMobile'], $settings['paddingRightMobile'], $settings['paddingBottomMobile'], $settings['paddingLeftMobile'] ), $settings['paddingUnit'] ); + $mobile_css->add_property( 'border-radius', array( $settings['borderRadiusTopLeftMobile'], $settings['borderRadiusTopRightMobile'], $settings['borderRadiusBottomRightMobile'], $settings['borderRadiusBottomLeftMobile'] ), $settings['borderRadiusUnit'] ); + $mobile_css->add_property( 'margin', array( $settings['marginTopMobile'], $settings['marginRightMobile'], $settings['marginBottomMobile'], $settings['marginLeftMobile'] ), $settings['marginUnit'] ); + $mobile_css->add_property( 'border-width', array( $settings['borderSizeTopMobile'], $settings['borderSizeRightMobile'], $settings['borderSizeBottomMobile'], $settings['borderSizeLeftMobile'] ), 'px' ); + + if ( $settings['hasIcon'] ) { + $mobile_css->set_selector( $selector . ' .gb-icon' ); + $mobile_css->add_property( 'font-size', $settings['iconSizeMobile'], $settings['iconSizeUnit'] ); + + if ( ! $settings['removeText'] ) { + $mobile_css->add_property( 'padding', array( $settings['iconPaddingTopMobile'], $settings['iconPaddingRightMobile'], $settings['iconPaddingBottomMobile'], $settings['iconPaddingLeftMobile'] ), $settings['iconPaddingUnit'] ); + } + } + + /** + * Do generateblocks_block_css_data hook + * + * @since 1.0 + * + * @param string $name The name of our block. + * @param array $settings The settings for the current block. + * @param object $css Our desktop/main CSS data. + * @param object $desktop_css Our desktop only CSS data. + * @param object $tablet_css Our tablet CSS data. + * @param object $tablet_only_css Our tablet only CSS data. + * @param object $mobile_css Our mobile CSS data. + */ + do_action( + 'generateblocks_block_css_data', + 'button', + $settings, + $css, + $desktop_css, + $tablet_css, + $tablet_only_css, + $mobile_css + ); + + return [ + 'main' => $css->css_output(), + 'desktop' => $desktop_css->css_output(), + 'tablet' => $tablet_css->css_output(), + 'tablet_only' => $tablet_only_css->css_output(), + 'mobile' => $mobile_css->css_output(), + ]; + } + + /** + * Wrapper function for our dynamic buttons. + * + * @since 1.5.0 + * @param array $attributes The block attributes. + * @param string $content The dynamic text to display. + * @param WP_Block $block Block instance. + */ + public static function render_block( $attributes, $content, $block ) { + if ( ! isset( $attributes['hasUrl'] ) && strpos( trim( $content ), ' isset( $settings['anchor'] ) ? $settings['anchor'] : null, + 'class' => implode( ' ', $classNames ), + 'href' => 'a' === $tagName ? $dynamic_link : null, + 'rel' => ! empty( $relAttributes ) ? implode( ' ', $relAttributes ) : null, + 'target' => ! empty( $settings['target'] ) ? '_blank' : null, + ); + + if ( isset( $content['attributes'] ) ) { + foreach ( $content['attributes'] as $attribute => $value ) { + if ( 'class' === $attribute ) { + $button_attributes[ $attribute ] .= ' ' . $value; + } else { + $button_attributes[ $attribute ] = $value; + } + } + } + + $output .= sprintf( + '<%1$s %2$s>', + $tagName, + generateblocks_attr( + 'dynamic-button', + $button_attributes, + $settings, + $block + ) + ); + + if ( $icon_html ) { + if ( 'left' === $settings['iconLocation'] ) { + $output .= $icon_html; + } + + $output .= ''; + } + + if ( isset( $content['content'] ) ) { + $output .= $content['content']; + } else { + $output .= $content; + } + + if ( $icon_html ) { + $output .= ''; + + if ( 'right' === $settings['iconLocation'] ) { + $output .= $icon_html; + } + } + + $output .= sprintf( + '', + $tagName + ); + } + + return $output; + } +} diff --git a/includes/blocks/class-container.php b/includes/blocks/class-container.php new file mode 100644 index 000000000..97cb02ae1 --- /dev/null +++ b/includes/blocks/class-container.php @@ -0,0 +1,847 @@ + 'div', + 'isGrid' => false, + 'containerWidth' => $container_width, + 'outerContainer' => 'full', + 'innerContainer' => 'contained', + 'minHeight' => false, + 'minHeightUnit' => 'px', + 'minHeightTablet' => false, + 'minHeightUnitTablet' => 'px', + 'minHeightMobile' => false, + 'minHeightUnitMobile' => 'px', + 'paddingTop' => '', + 'paddingRight' => '', + 'paddingBottom' => '', + 'paddingLeft' => '', + 'paddingUnit' => 'px', + 'paddingTopTablet' => '', + 'paddingRightTablet' => '', + 'paddingBottomTablet' => '', + 'paddingLeftTablet' => '', + 'paddingTopMobile' => '', + 'paddingRightMobile' => '', + 'paddingBottomMobile' => '', + 'paddingLeftMobile' => '', + 'marginTop' => '', + 'marginRight' => '', + 'marginBottom' => '', + 'marginLeft' => '', + 'marginUnit' => 'px', + 'marginTopTablet' => '', + 'marginRightTablet' => '', + 'marginBottomTablet' => '', + 'marginLeftTablet' => '', + 'marginTopMobile' => '', + 'marginRightMobile' => '', + 'marginBottomMobile' => '', + 'marginLeftMobile' => '', + 'borderSizeTop' => '', + 'borderSizeRight' => '', + 'borderSizeBottom' => '', + 'borderSizeLeft' => '', + 'borderSizeTopTablet' => '', + 'borderSizeRightTablet' => '', + 'borderSizeBottomTablet' => '', + 'borderSizeLeftTablet' => '', + 'borderSizeTopMobile' => '', + 'borderSizeRightMobile' => '', + 'borderSizeBottomMobile' => '', + 'borderSizeLeftMobile' => '', + 'borderRadiusTopRight' => '', + 'borderRadiusBottomRight' => '', + 'borderRadiusBottomLeft' => '', + 'borderRadiusTopLeft' => '', + 'borderRadiusUnit' => 'px', + 'borderRadiusTopRightTablet' => '', + 'borderRadiusBottomRightTablet' => '', + 'borderRadiusBottomLeftTablet' => '', + 'borderRadiusTopLeftTablet' => '', + 'borderRadiusTopRightMobile' => '', + 'borderRadiusBottomRightMobile' => '', + 'borderRadiusBottomLeftMobile' => '', + 'borderRadiusTopLeftMobile' => '', + 'borderColor' => '', + 'borderColorOpacity' => 1, + 'backgroundColor' => '', + 'backgroundColorOpacity' => 1, + 'gradient' => false, + 'gradientDirection' => '', + 'gradientColorOne' => '', + 'gradientColorOneOpacity' => '', + 'gradientColorStopOne' => '', + 'gradientColorTwo' => '', + 'gradientColorTwoOpacity' => '', + 'gradientColorStopTwo' => '', + 'gradientSelector' => 'element', + 'textColor' => '', + 'linkColor' => '', + 'linkColorHover' => '', + 'bgImage' => '', + 'bgOptions' => array( + 'selector' => 'element', + 'opacity' => 1, + 'overlay' => false, + 'position' => 'center center', + 'size' => 'cover', + 'repeat' => 'no-repeat', + 'attachment' => '', + ), + 'bgImageSize' => 'full', + 'bgImageInline' => false, + 'width' => '', + 'widthTablet' => '', + 'widthMobile' => '', + 'autoWidth' => false, + 'autoWidthTablet' => false, + 'autoWidthMobile' => false, + 'flexGrow' => '', + 'flexGrowTablet' => '', + 'flexGrowMobile' => '', + 'flexShrink' => '', + 'flexShrinkTablet' => '', + 'flexShrinkMobile' => '', + 'flexBasis' => '', + 'flexBasisTablet' => '', + 'flexBasisMobile' => '', + 'flexBasisUnit' => 'px', + 'verticalAlignment' => '', + 'verticalAlignmentTablet' => 'inherit', + 'verticalAlignmentMobile' => 'inherit', + 'zindex' => '', + 'innerZindex' => '', + 'removeVerticalGap' => false, + 'removeVerticalGapTablet' => false, + 'removeVerticalGapMobile' => false, + 'orderTablet' => false, + 'orderMobile' => false, + 'alignment' => '', + 'alignmentTablet' => '', + 'alignmentMobile' => '', + 'fontFamily' => '', + 'fontFamilyFallback' => '', + 'googleFont' => false, + 'googleFontVariants' => '', + 'fontWeight' => '', + 'fontSize' => '', + 'fontSizeTablet' => '', + 'fontSizeMobile' => '', + 'fontSizeUnit' => 'px', + 'textTransform' => '', + ]; + } + + /** + * Compile our CSS data based on our block attributes. + * + * @param array $attributes Our block attributes. + */ + public static function get_css_data( $attributes ) { + $css = new GenerateBlocks_Dynamic_CSS(); + $desktop_css = new GenerateBlocks_Dynamic_CSS(); + $tablet_css = new GenerateBlocks_Dynamic_CSS(); + $tablet_only_css = new GenerateBlocks_Dynamic_CSS(); + $mobile_css = new GenerateBlocks_Dynamic_CSS(); + $css_data = []; + + $defaults = generateblocks_get_block_defaults(); + + $settings = wp_parse_args( + $attributes, + $defaults['container'] + ); + + $id = $attributes['uniqueId']; + $blockVersion = ! empty( $settings['blockVersion'] ) ? $settings['blockVersion'] : 1; + + // Use legacy settings if needed. + if ( $blockVersion < 2 ) { + $settings = GenerateBlocks_Legacy_Attributes::get_settings( '1.4.0', 'container', $settings, $attributes ); + } + + $fontFamily = $settings['fontFamily']; + + if ( $fontFamily && $settings['fontFamilyFallback'] ) { + $fontFamily = $fontFamily . ', ' . $settings['fontFamilyFallback']; + } + + if ( ! isset( $settings['bgOptions']['selector'] ) ) { + $settings['bgOptions']['selector'] = 'element'; + } + + $containerWidth = $settings['containerWidth']; + + if ( isset( $settings['useGlobalStyle'] ) && $settings['useGlobalStyle'] ) { + if ( (string) $containerWidth === (string) $defaults['container']['containerWidth'] ) { + $containerWidth = ''; + } + } + + $backgroundImageValue = generateblocks_get_background_image_css( 'image', $settings ); + $gradientValue = generateblocks_get_background_image_css( 'gradient', $settings ); + $hasBgImage = generateblocks_has_background_image( $settings ); + + // Only add this CSS once. + if ( count( (array) self::$block_ids ) === 0 ) { + $css->set_selector( '.gb-container .wp-block-image img' ); + $css->add_property( 'vertical-align', 'middle' ); + + $css->set_selector( '.gb-container .gb-shape' ); + $css->add_property( 'position', 'absolute' ); + $css->add_property( 'overflow', 'hidden' ); + $css->add_property( 'pointer-events', 'none' ); + $css->add_property( 'line-height', '0' ); + + $css->set_selector( '.gb-container .gb-shape svg' ); + $css->add_property( 'fill', 'currentColor' ); + } + + self::$block_ids[] = $id; + + $css->set_selector( '.gb-container-' . $id ); + $css->add_property( 'font-family', $fontFamily ); + $css->add_property( 'font-size', $settings['fontSize'], $settings['fontSizeUnit'] ); + $css->add_property( 'font-weight', $settings['fontWeight'] ); + $css->add_property( 'text-transform', $settings['textTransform'] ); + $css->add_property( 'margin', array( $settings['marginTop'], $settings['marginRight'], $settings['marginBottom'], $settings['marginLeft'] ), $settings['marginUnit'] ); + + if ( 'contained' === $settings['outerContainer'] && ! $settings['isGrid'] ) { + if ( ! empty( $containerWidth ) ) { + $css->add_property( 'max-width', absint( $containerWidth ), 'px' ); + $css->add_property( 'margin-left', 'auto' ); + $css->add_property( 'margin-right', 'auto' ); + } + } + + $css->add_property( 'background-color', generateblocks_hex2rgba( $settings['backgroundColor'], $settings['backgroundColorOpacity'] ) ); + $css->add_property( 'color', $settings['textColor'] ); + + if ( $hasBgImage && 'element' === $settings['bgOptions']['selector'] && $backgroundImageValue ) { + if ( ! $settings['bgImageInline'] || ( $settings['bgImageInline'] && 'element' !== $settings['bgOptions']['selector'] ) ) { + $css->add_property( 'background-image', $backgroundImageValue ); + } + + $css->add_property( 'background-repeat', $settings['bgOptions']['repeat'] ); + $css->add_property( 'background-position', $settings['bgOptions']['position'] ); + $css->add_property( 'background-size', $settings['bgOptions']['size'] ); + $css->add_property( 'background-attachment', $settings['bgOptions']['attachment'] ); + } elseif ( $settings['gradient'] && 'element' === $settings['gradientSelector'] ) { + $css->add_property( 'background-image', $gradientValue ); + } + + if ( + ( $hasBgImage && 'pseudo-element' === $settings['bgOptions']['selector'] ) || + $settings['zindex'] || + ( $settings['gradient'] && 'pseudo-element' === $settings['gradientSelector'] ) + ) { + $css->add_property( 'position', 'relative' ); + } + + if ( + ( $hasBgImage && 'pseudo-element' === $settings['bgOptions']['selector'] ) || + ( $settings['gradient'] && 'pseudo-element' === $settings['gradientSelector'] ) + ) { + $css->add_property( 'overflow', 'hidden' ); + } + + if ( $settings['zindex'] ) { + $css->add_property( 'z-index', $settings['zindex'] ); + } + + $css->add_property( 'border-radius', array( $settings['borderRadiusTopLeft'], $settings['borderRadiusTopRight'], $settings['borderRadiusBottomRight'], $settings['borderRadiusBottomLeft'] ), $settings['borderRadiusUnit'] ); + $css->add_property( 'border-width', array( $settings['borderSizeTop'], $settings['borderSizeRight'], $settings['borderSizeBottom'], $settings['borderSizeLeft'] ), 'px' ); + $css->add_property( 'border-color', generateblocks_hex2rgba( $settings['borderColor'], $settings['borderColorOpacity'] ) ); + $css->add_property( 'min-height', $settings['minHeight'], $settings['minHeightUnit'] ); + + // Set flags so we don't duplicate this CSS in media queries. + $usingMinHeightFlex = false; + $usingMinHeightInnerWidth = false; + + if ( $settings['minHeight'] && $settings['verticalAlignment'] && ! $settings['isGrid'] ) { + $css->add_property( 'display', 'flex' ); + $css->add_property( 'flex-direction', 'row' ); + $css->add_property( 'align-items', $settings['verticalAlignment'] ); + + $usingMinHeightFlex = true; + } + + $css->add_property( 'text-align', $settings['alignment'] ); + + $innerZIndex = $settings['innerZindex']; + + $css->set_selector( '.gb-container-' . $id . ':before' ); + + if ( $hasBgImage && 'pseudo-element' === $settings['bgOptions']['selector'] ) { + $css->add_property( 'content', '""' ); + $css->add_property( 'background-image', $backgroundImageValue ); + $css->add_property( 'background-repeat', $settings['bgOptions']['repeat'] ); + $css->add_property( 'background-position', $settings['bgOptions']['position'] ); + $css->add_property( 'background-size', $settings['bgOptions']['size'] ); + $css->add_property( 'background-attachment', $settings['bgOptions']['attachment'] ); + $css->add_property( 'z-index', '0' ); + $css->add_property( 'position', 'absolute' ); + $css->add_property( 'top', '0' ); + $css->add_property( 'right', '0' ); + $css->add_property( 'bottom', '0' ); + $css->add_property( 'left', '0' ); + $css->add_property( 'transition', 'inherit' ); + $css->add_property( 'border-radius', array( $settings['borderRadiusTopLeft'], $settings['borderRadiusTopRight'], $settings['borderRadiusBottomRight'], $settings['borderRadiusBottomLeft'] ), $settings['borderRadiusUnit'] ); + + if ( isset( $settings['bgOptions']['opacity'] ) && 1 !== $settings['bgOptions']['opacity'] ) { + $css->add_property( 'opacity', $settings['bgOptions']['opacity'] ); + } + + if ( $blockVersion < 2 && ! $innerZIndex ) { + $innerZIndex = 1; + } + } + + if ( $settings['gradient'] && 'pseudo-element' === $settings['gradientSelector'] ) { + $css->set_selector( '.gb-container-' . $id . ':after' ); + $css->add_property( 'content', '""' ); + $css->add_property( 'background-image', $gradientValue ); + $css->add_property( 'z-index', '0' ); + $css->add_property( 'position', 'absolute' ); + $css->add_property( 'top', '0' ); + $css->add_property( 'right', '0' ); + $css->add_property( 'bottom', '0' ); + $css->add_property( 'left', '0' ); + + if ( $blockVersion < 2 && ! $innerZIndex ) { + $innerZIndex = 1; + } + } + + $css->set_selector( '.gb-container-' . $id . ' > .gb-inside-container' ); + $css->add_property( 'padding', array( $settings['paddingTop'], $settings['paddingRight'], $settings['paddingBottom'], $settings['paddingLeft'] ), $settings['paddingUnit'] ); + + if ( 'contained' === $settings['innerContainer'] && ! $settings['isGrid'] ) { + if ( ! empty( $containerWidth ) ) { + $css->add_property( 'max-width', absint( $containerWidth ), 'px' ); + $css->add_property( 'margin-left', 'auto' ); + $css->add_property( 'margin-right', 'auto' ); + } + } + + if ( $usingMinHeightFlex ) { + $css->add_property( 'width', '100%' ); + + $usingMinHeightInnerWidth = true; + } + + if ( $innerZIndex || 0 === $innerZIndex ) { + $css->add_property( 'z-index', $innerZIndex ); + $css->add_property( 'position', 'relative' ); + } + + $css->set_selector( '.gb-container-' . $id . ' a, .gb-container-' . $id . ' a:visited' ); + $css->add_property( 'color', $settings['linkColor'] ); + + $css->set_selector( '.gb-container-' . $id . ' a:hover' ); + $css->add_property( 'color', $settings['linkColorHover'] ); + + if ( $settings['isGrid'] ) { + $css->set_selector( '.gb-grid-wrapper > .gb-grid-column-' . $id ); + $css->add_property( 'width', $settings['width'], '%' ); + + $css->add_property( 'flex-grow', $settings['flexGrow'] ); + $css->add_property( 'flex-shrink', $settings['flexShrink'] ); + + if ( is_numeric( $settings['flexBasis'] ) ) { + $css->add_property( 'flex-basis', $settings['flexBasis'], $settings['flexBasisUnit'] ); + } else { + $css->add_property( 'flex-basis', $settings['flexBasis'] ); + } + } + + if ( $settings['removeVerticalGap'] ) { + $desktop_css->set_selector( '.gb-grid-wrapper > div.gb-grid-column-' . $id ); + $desktop_css->add_property( 'padding-bottom', '0' ); + } + + $css->set_selector( '.gb-grid-wrapper > .gb-grid-column-' . $id . ' > .gb-container' ); + $css->add_property( 'justify-content', $settings['verticalAlignment'] ); + + if ( ! empty( $settings['shapeDividers'] ) ) { + $css->set_selector( '.gb-container-' . $id ); + $css->add_property( 'position', 'relative' ); + + $default_styles = generateblocks_get_default_styles(); + + foreach ( (array) $settings['shapeDividers'] as $index => $options ) { + $shapeNumber = $index + 1; + + $shapeOptions = wp_parse_args( + $options, + $default_styles['container']['shapeDividers'] + ); + + $shapeTransforms = array(); + + if ( 'top' === $shapeOptions['location'] ) { + $shapeTransforms[] = 'scaleY(-1)'; + } + + if ( $shapeOptions['flipHorizontally'] ) { + $shapeTransforms[] = 'scaleX(-1)'; + } + + $css->set_selector( '.gb-container-' . $id . ' > .gb-shapes .gb-shape-' . $shapeNumber ); + $css->add_property( 'color', generateblocks_hex2rgba( $shapeOptions['color'], $shapeOptions['colorOpacity'] ) ); + $css->add_property( 'z-index', $shapeOptions['zindex'] ); + + if ( 'top' === $shapeOptions['location'] || 'bottom' === $shapeOptions['location'] ) { + $css->add_property( 'left', '0' ); + $css->add_property( 'right', '0' ); + } + + if ( 'bottom' === $shapeOptions['location'] ) { + $css->add_property( 'bottom', '-1px' ); + } + + if ( 'top' === $shapeOptions['location'] ) { + $css->add_property( 'top', '-1px' ); + } + + if ( ! empty( $shapeTransforms ) ) { + $css->add_property( 'transform', implode( ' ', $shapeTransforms ) ); + } + + $shapeWidth = $shapeOptions['width'] . '%'; + + if ( 100 === (int) $shapeOptions['width'] ) { + $shapeWidth = 'calc(' . $shapeWidth . ' + 1.3px)'; + } + + $css->set_selector( '.gb-container-' . $id . ' > .gb-shapes .gb-shape-' . $shapeNumber . ' svg' ); + $css->add_property( 'height', $shapeOptions['height'], 'px' ); + $css->add_property( 'width', $shapeWidth ); + + if ( 'top' === $shapeOptions['location'] || 'bottom' === $shapeOptions['location'] ) { + $css->add_property( 'position', 'relative' ); + $css->add_property( 'left', '50%' ); + $css->add_property( 'transform', 'translateX(-50%)' ); + $css->add_property( 'min-width', '100%' ); + } + } + } + + $tablet_css->set_selector( '.gb-container-' . $id ); + $tablet_css->add_property( 'font-size', $settings['fontSizeTablet'], $settings['fontSizeUnit'] ); + $tablet_css->add_property( 'margin', array( $settings['marginTopTablet'], $settings['marginRightTablet'], $settings['marginBottomTablet'], $settings['marginLeftTablet'] ), $settings['marginUnit'] ); + $tablet_css->add_property( 'border-radius', array( $settings['borderRadiusTopLeftTablet'], $settings['borderRadiusTopRightTablet'], $settings['borderRadiusBottomRightTablet'], $settings['borderRadiusBottomLeftTablet'] ), $settings['borderRadiusUnit'] ); + $tablet_css->add_property( 'border-width', array( $settings['borderSizeTopTablet'], $settings['borderSizeRightTablet'], $settings['borderSizeBottomTablet'], $settings['borderSizeLeftTablet'] ), 'px' ); + $tablet_css->add_property( 'min-height', $settings['minHeightTablet'], $settings['minHeightUnitTablet'] ); + + if ( ! $settings['isGrid'] ) { + if ( ! $usingMinHeightFlex && $settings['minHeightTablet'] && 'inherit' !== $settings['verticalAlignmentTablet'] ) { + $tablet_css->add_property( 'display', 'flex' ); + $tablet_css->add_property( 'flex-direction', 'row' ); + + $usingMinHeightFlex = true; + } + + if ( $usingMinHeightFlex && 'inherit' !== $settings['verticalAlignmentTablet'] ) { + $tablet_css->add_property( 'align-items', $settings['verticalAlignmentTablet'] ); + } + } + + $tablet_css->add_property( 'text-align', $settings['alignmentTablet'] ); + + $tablet_css->set_selector( '.gb-container-' . $id . ' > .gb-inside-container' ); + $tablet_css->add_property( 'padding', array( $settings['paddingTopTablet'], $settings['paddingRightTablet'], $settings['paddingBottomTablet'], $settings['paddingLeftTablet'] ), $settings['paddingUnit'] ); + + $usingMinHeightInnerWidthBoxSizing = false; + + if ( ! $settings['isGrid'] ) { + // Needs 100% width if it's a flex item. + if ( ! $usingMinHeightInnerWidth && $settings['minHeightTablet'] && 'inherit' !== $settings['verticalAlignmentTablet'] ) { + $tablet_css->add_property( 'width', '100%' ); + + $usingMinHeightInnerWidth = true; + } elseif ( $usingMinHeightInnerWidth ) { + if ( 'contained' === $settings['innerContainer'] && ! $settings['isGrid'] ) { + $tablet_css->add_property( 'box-sizing', 'border-box' ); + + $usingMinHeightInnerWidthBoxSizing = true; + } + } + } + + $tablet_css->set_selector( '.gb-grid-wrapper > .gb-grid-column-' . $id ); + + if ( ! $settings['autoWidthTablet'] ) { + $tablet_css->add_property( 'width', $settings['widthTablet'], '%' ); + } else { + $tablet_css->add_property( 'width', 'auto' ); + } + + $tablet_css->add_property( 'flex-grow', $settings['flexGrowTablet'] ); + $tablet_css->add_property( 'flex-shrink', $settings['flexShrinkTablet'] ); + + if ( is_numeric( $settings['flexBasisTablet'] ) ) { + $tablet_css->add_property( 'flex-basis', $settings['flexBasisTablet'], $settings['flexBasisUnit'] ); + } else { + $tablet_css->add_property( 'flex-basis', $settings['flexBasisTablet'] ); + } + + if ( $settings['isGrid'] ) { + $tablet_css->add_property( 'order', $settings['orderTablet'] ); + } + + if ( $settings['removeVerticalGapTablet'] ) { + $tablet_only_css->set_selector( '.gb-grid-wrapper > div.gb-grid-column-' . $id ); + $tablet_only_css->add_property( 'padding-bottom', '0' ); + } + + $tablet_css->set_selector( '.gb-grid-wrapper > .gb-grid-column-' . $id . ' > .gb-container' ); + + if ( 'inherit' !== $settings['verticalAlignmentTablet'] ) { + $tablet_css->add_property( 'justify-content', $settings['verticalAlignmentTablet'] ); + } + + if ( $hasBgImage && 'pseudo-element' === $settings['bgOptions']['selector'] ) { + $tablet_css->set_selector( '.gb-container-' . $id . ':before' ); + $tablet_css->add_property( 'border-radius', array( $settings['borderRadiusTopLeftTablet'], $settings['borderRadiusTopRightTablet'], $settings['borderRadiusBottomRightTablet'], $settings['borderRadiusBottomLeftTablet'] ), $settings['borderRadiusUnit'] ); + } + + if ( ! empty( $settings['shapeDividers'] ) ) { + $default_styles = generateblocks_get_default_styles(); + + foreach ( (array) $settings['shapeDividers'] as $index => $options ) { + $shapeNumber = $index + 1; + + $shapeOptions = wp_parse_args( + $options, + $default_styles['container']['shapeDividers'] + ); + + $tablet_css->set_selector( '.gb-container-' . $id . ' > .gb-shapes .gb-shape-' . $shapeNumber . ' svg' ); + $tablet_css->add_property( 'height', $shapeOptions['heightTablet'], 'px' ); + $tablet_css->add_property( 'width', $shapeOptions['widthTablet'], '%' ); + } + } + + $mobile_css->set_selector( '.gb-container-' . $id ); + $mobile_css->add_property( 'font-size', $settings['fontSizeMobile'], $settings['fontSizeUnit'] ); + $mobile_css->add_property( 'margin', array( $settings['marginTopMobile'], $settings['marginRightMobile'], $settings['marginBottomMobile'], $settings['marginLeftMobile'] ), $settings['marginUnit'] ); + $mobile_css->add_property( 'border-radius', array( $settings['borderRadiusTopLeftMobile'], $settings['borderRadiusTopRightMobile'], $settings['borderRadiusBottomRightMobile'], $settings['borderRadiusBottomLeftMobile'] ), $settings['borderRadiusUnit'] ); + $mobile_css->add_property( 'border-width', array( $settings['borderSizeTopMobile'], $settings['borderSizeRightMobile'], $settings['borderSizeBottomMobile'], $settings['borderSizeLeftMobile'] ), 'px' ); + $mobile_css->add_property( 'min-height', $settings['minHeightMobile'], $settings['minHeightUnitMobile'] ); + + if ( ! $settings['isGrid'] ) { + if ( ! $usingMinHeightFlex && $settings['minHeightMobile'] && 'inherit' !== $settings['verticalAlignmentMobile'] ) { + $mobile_css->add_property( 'display', 'flex' ); + $mobile_css->add_property( 'flex-direction', 'row' ); + + $usingMinHeightFlex = true; + } + + if ( $usingMinHeightFlex && 'inherit' !== $settings['verticalAlignmentMobile'] ) { + $mobile_css->add_property( 'align-items', $settings['verticalAlignmentMobile'] ); + } + } + + $mobile_css->add_property( 'text-align', $settings['alignmentMobile'] ); + + $mobile_css->set_selector( '.gb-container-' . $id . ' > .gb-inside-container' ); + $mobile_css->add_property( 'padding', array( $settings['paddingTopMobile'], $settings['paddingRightMobile'], $settings['paddingBottomMobile'], $settings['paddingLeftMobile'] ), $settings['paddingUnit'] ); + + if ( ! $settings['isGrid'] ) { + // Needs 100% width if it's a flex item. + if ( ! $usingMinHeightInnerWidth && $settings['minHeightMobile'] && 'inherit' !== $settings['verticalAlignmentMobile'] ) { + $mobile_css->add_property( 'width', '100%' ); + } elseif ( $usingMinHeightInnerWidth && ! $usingMinHeightInnerWidthBoxSizing ) { + if ( 'contained' === $settings['innerContainer'] && ! $settings['isGrid'] ) { + $mobile_css->add_property( 'box-sizing', 'border-box' ); + } + } + } + + $mobile_css->set_selector( '.gb-grid-wrapper > .gb-grid-column-' . $id ); + + if ( ! $settings['autoWidthMobile'] ) { + $mobile_css->add_property( 'width', $settings['widthMobile'], '%' ); + } + + if ( $settings['autoWidthMobile'] ) { + $mobile_css->add_property( 'width', 'auto' ); + } + + $mobile_css->add_property( 'flex-grow', $settings['flexGrowMobile'] ); + $mobile_css->add_property( 'flex-shrink', $settings['flexShrinkMobile'] ); + + if ( is_numeric( $settings['flexBasisMobile'] ) ) { + $mobile_css->add_property( 'flex-basis', $settings['flexBasisMobile'], $settings['flexBasisUnit'] ); + } else { + $mobile_css->add_property( 'flex-basis', $settings['flexBasisMobile'] ); + } + + if ( $settings['isGrid'] ) { + $mobile_css->add_property( 'order', $settings['orderMobile'] ); + } + + if ( $settings['removeVerticalGapMobile'] ) { + $mobile_css->set_selector( '.gb-grid-wrapper > div.gb-grid-column-' . $id ); + $mobile_css->add_property( 'padding-bottom', '0' ); + } + + $mobile_css->set_selector( '.gb-grid-wrapper > .gb-grid-column-' . $id . ' > .gb-container' ); + + if ( 'inherit' !== $settings['verticalAlignmentMobile'] ) { + $mobile_css->add_property( 'justify-content', $settings['verticalAlignmentMobile'] ); + } + + if ( $hasBgImage && 'pseudo-element' === $settings['bgOptions']['selector'] ) { + $mobile_css->set_selector( '.gb-container-' . $id . ':before' ); + $mobile_css->add_property( 'border-radius', array( $settings['borderRadiusTopLeftMobile'], $settings['borderRadiusTopRightMobile'], $settings['borderRadiusBottomRightMobile'], $settings['borderRadiusBottomLeftMobile'] ), $settings['borderRadiusUnit'] ); + } + + if ( ! empty( $settings['shapeDividers'] ) ) { + $default_styles = generateblocks_get_default_styles(); + + foreach ( (array) $settings['shapeDividers'] as $index => $options ) { + $shapeNumber = $index + 1; + + $shapeOptions = wp_parse_args( + $options, + $default_styles['container']['shapeDividers'] + ); + + $mobile_css->set_selector( '.gb-container-' . $id . ' > .gb-shapes .gb-shape-' . $shapeNumber . ' svg' ); + $mobile_css->add_property( 'height', $shapeOptions['heightMobile'], 'px' ); + $mobile_css->add_property( 'width', $shapeOptions['widthMobile'], '%' ); + } + } + + if ( $hasBgImage && 'fixed' === $settings['bgOptions']['attachment'] ) { + if ( 'element' === $settings['bgOptions']['selector'] ) { + $mobile_css->set_selector( '.gb-container-' . $id ); + } + + if ( 'pseudo-element' === $settings['bgOptions']['selector'] ) { + $mobile_css->set_selector( '.gb-container-' . $id . ':before' ); + } + + $mobile_css->add_property( 'background-attachment', 'initial' ); + } + + /** + * Do generateblocks_block_css_data hook + * + * @since 1.0 + * + * @param string $name The name of our block. + * @param array $settings The settings for the current block. + * @param object $css Our desktop/main CSS data. + * @param object $desktop_css Our desktop only CSS data. + * @param object $tablet_css Our tablet CSS data. + * @param object $tablet_only_css Our tablet only CSS data. + * @param object $mobile_css Our mobile CSS data. + */ + do_action( + 'generateblocks_block_css_data', + 'container', + $settings, + $css, + $desktop_css, + $tablet_css, + $tablet_only_css, + $mobile_css + ); + + return [ + 'main' => $css->css_output(), + 'desktop' => $desktop_css->css_output(), + 'tablet' => $tablet_css->css_output(), + 'tablet_only' => $tablet_only_css->css_output(), + 'mobile' => $mobile_css->css_output(), + ]; + } + + /** + * Wrapper function for our dynamic buttons. + * + * @since 1.5.0 + * @param array $attributes The block attributes. + * @param string $content The dynamic text to display. + * @param WP_Block $block Block instance. + */ + public static function render_block( $attributes, $content, $block ) { + if ( ! isset( $attributes['isDynamic'] ) || ! $attributes['isDynamic'] ) { + if ( ! in_array( $attributes['uniqueId'], self::$block_ids ) ) { + // Build our CSS for this block. + $content = generateblocks_do_inline_css_output( + $content, + self::get_css_data( $attributes ) + ); + } + + return $content; + } + + $defaults = generateblocks_get_block_defaults(); + + $settings = wp_parse_args( + $attributes, + $defaults['container'] + ); + + $output = ''; + + if ( ! in_array( $attributes['uniqueId'], self::$block_ids ) ) { + // Build our CSS for this block. + $output .= generateblocks_do_inline_css_output( + '', + self::get_css_data( $attributes ) + ); + } + + if ( $settings['isGrid'] ) { + $gridItemClassNames = array( + 'gb-grid-column', + 'gb-grid-column-' . $settings['uniqueId'], + ); + + $output .= sprintf( + '
', + generateblocks_attr( + 'grid-item', + array( + 'class' => implode( ' ', $gridItemClassNames ), + ), + $settings, + $block + ) + ); + } + + $classNames = array( + 'gb-container', + 'gb-container-' . $settings['uniqueId'], + ); + + if ( ! empty( $settings['className'] ) ) { + $classNames[] = $settings['className']; + } + + if ( ! $settings['isGrid'] && ! empty( $settings['align'] ) ) { + $classNames[] = 'align' . $settings['align']; + } + + // Pass the dynamic url to our URL attribute. + if ( isset( $settings['url'] ) ) { + if ( $settings['useDynamicData'] && '' !== $settings['dynamicLinkType'] ) { + $attributes['url'] = GenerateBlocks_Dynamic_Content::get_dynamic_url( $settings, $block ); + } + } + + $tagName = apply_filters( + 'generateblocks_container_tagname', + $settings['tagName'], + $attributes, + $block + ); + + $allowedTagNames = apply_filters( + 'generateblocks_container_allowed_tagnames', + array( + 'div', + 'section', + 'header', + 'footer', + 'aside', + 'a', + ), + $attributes, + $block + ); + + if ( ! in_array( $tagName, $allowedTagNames ) ) { + $tagName = 'div'; + } + + $output .= sprintf( + '<%1$s %2$s>', + $tagName, + generateblocks_attr( + 'container', + array( + 'id' => isset( $settings['anchor'] ) ? $settings['anchor'] : null, + 'class' => implode( ' ', $classNames ), + ), + $settings, + $block + ) + ); + + $output = apply_filters( + 'generateblocks_after_container_open', + $output, + $attributes, + $block + ); + + $output .= '
'; + + $output = apply_filters( + 'generateblocks_inside_container', + $output, + $attributes, + $block + ); + + $output .= $content; + $output .= '
'; + + $output = apply_filters( + 'generateblocks_before_container_close', + $output, + $attributes, + $block + ); + + $output .= sprintf( + '', + $tagName + ); + + if ( $settings['isGrid'] ) { + $output .= '
'; + } + + return $output; + } +} diff --git a/includes/blocks/class-grid.php b/includes/blocks/class-grid.php new file mode 100644 index 000000000..5735bc12c --- /dev/null +++ b/includes/blocks/class-grid.php @@ -0,0 +1,259 @@ + '', + 'verticalGap' => '', + 'verticalAlignment' => '', + 'horizontalGapTablet' => '', + 'verticalGapTablet' => '', + 'verticalAlignmentTablet' => 'inherit', + 'horizontalGapMobile' => '', + 'verticalGapMobile' => '', + 'verticalAlignmentMobile' => 'inherit', + 'horizontalAlignment' => '', + 'horizontalAlignmentTablet' => '', + 'horizontalAlignmentMobile' => '', + ]; + } + + /** + * Compile our CSS data based on our block attributes. + * + * @param array $attributes Our block attributes. + */ + public static function get_css_data( $attributes ) { + $css = new GenerateBlocks_Dynamic_CSS(); + $desktop_css = new GenerateBlocks_Dynamic_CSS(); + $tablet_css = new GenerateBlocks_Dynamic_CSS(); + $tablet_only_css = new GenerateBlocks_Dynamic_CSS(); + $mobile_css = new GenerateBlocks_Dynamic_CSS(); + $css_data = []; + + $defaults = generateblocks_get_block_defaults(); + + $settings = wp_parse_args( + $attributes, + $defaults['gridContainer'] + ); + + $id = $attributes['uniqueId']; + $blockVersion = ! empty( $settings['blockVersion'] ) ? $settings['blockVersion'] : 1; + + // Use legacy settings if needed. + if ( $blockVersion < 2 ) { + $settings = GenerateBlocks_Legacy_Attributes::get_settings( '1.4.0', 'grid', $settings, $attributes ); + } + + $gap_direction = 'left'; + + if ( is_rtl() ) { + $gap_direction = 'right'; + } + + // Don't output horizontal gap defaults if we're using global styles. + if ( $blockVersion < 2 && isset( $settings['useGlobalStyle'] ) && $settings['useGlobalStyle'] && isset( $settings['globalStyleId'] ) && $settings['globalStyleId'] ) { + if ( (string) $settings['horizontalGap'] === (string) $defaults['gridContainer']['horizontalGap'] ) { + $settings['horizontalGap'] = ''; + } + } + + // Only add this CSS once. + if ( count( (array) self::$block_ids ) === 0 ) { + $css->set_selector( '.gb-grid-wrapper' ); + $css->add_property( 'display', 'flex' ); + $css->add_property( 'flex-wrap', 'wrap' ); + + $css->set_selector( '.gb-grid-wrapper > .gb-grid-column > .gb-container' ); + $css->add_property( 'display', 'flex' ); + $css->add_property( 'flex-direction', 'column' ); + $css->add_property( 'height', '100%' ); + + $css->set_selector( '.gb-grid-column' ); + $css->add_property( 'box-sizing', 'border-box' ); + + $css->set_selector( '.gb-grid-wrapper .wp-block-image' ); + $css->add_property( 'margin-bottom', '0' ); + } + + self::$block_ids[] = $id; + + $css->set_selector( '.gb-grid-wrapper-' . $id ); + $css->add_property( 'align-items', $settings['verticalAlignment'] ); + $css->add_property( 'justify-content', $settings['horizontalAlignment'] ); + + if ( $settings['horizontalGap'] ) { + $css->add_property( 'margin-' . $gap_direction, '-' . $settings['horizontalGap'] . 'px' ); + } + + $css->set_selector( '.gb-grid-wrapper-' . $id . ' > .gb-grid-column' ); + $css->add_property( 'padding-' . $gap_direction, $settings['horizontalGap'], 'px' ); + $css->add_property( 'padding-bottom', $settings['verticalGap'], 'px' ); + + $tablet_css->set_selector( '.gb-grid-wrapper-' . $id ); + + if ( 'inherit' !== $settings['verticalAlignmentTablet'] ) { + $tablet_css->add_property( 'align-items', $settings['verticalAlignmentTablet'] ); + } + + if ( 'inherit' !== $settings['horizontalAlignmentTablet'] ) { + $tablet_css->add_property( 'justify-content', $settings['horizontalAlignmentTablet'] ); + } + + if ( $settings['horizontalGapTablet'] ) { + $tablet_css->add_property( 'margin-' . $gap_direction, '-' . $settings['horizontalGapTablet'] . 'px' ); + } elseif ( 0 === $settings['horizontalGapTablet'] ) { + $tablet_css->add_property( 'margin-' . $gap_direction, $settings['horizontalGapTablet'] ); + } + + $tablet_css->set_selector( '.gb-grid-wrapper-' . $id . ' > .gb-grid-column' ); + $tablet_css->add_property( 'padding-' . $gap_direction, $settings['horizontalGapTablet'], 'px' ); + $tablet_css->add_property( 'padding-bottom', $settings['verticalGapTablet'], 'px' ); + + $mobile_css->set_selector( '.gb-grid-wrapper-' . $id ); + + if ( 'inherit' !== $settings['verticalAlignmentMobile'] ) { + $mobile_css->add_property( 'align-items', $settings['verticalAlignmentMobile'] ); + } + + if ( 'inherit' !== $settings['horizontalAlignmentMobile'] ) { + $mobile_css->add_property( 'justify-content', $settings['horizontalAlignmentMobile'] ); + } + + if ( $settings['horizontalGapMobile'] ) { + $mobile_css->add_property( 'margin-' . $gap_direction, '-' . $settings['horizontalGapMobile'] . 'px' ); + } elseif ( 0 === $settings['horizontalGapMobile'] ) { + $mobile_css->add_property( 'margin-' . $gap_direction, $settings['horizontalGapMobile'] ); + } + + $mobile_css->set_selector( '.gb-grid-wrapper-' . $id . ' > .gb-grid-column' ); + $mobile_css->add_property( 'padding-' . $gap_direction, $settings['horizontalGapMobile'], 'px' ); + $mobile_css->add_property( 'padding-bottom', $settings['verticalGapMobile'], 'px' ); + + /** + * Do generateblocks_block_css_data hook + * + * @since 1.0 + * + * @param string $name The name of our block. + * @param array $settings The settings for the current block. + * @param object $css Our desktop/main CSS data. + * @param object $desktop_css Our desktop only CSS data. + * @param object $tablet_css Our tablet CSS data. + * @param object $tablet_only_css Our tablet only CSS data. + * @param object $mobile_css Our mobile CSS data. + */ + do_action( + 'generateblocks_block_css_data', + 'grid', + $settings, + $css, + $desktop_css, + $tablet_css, + $tablet_only_css, + $mobile_css + ); + + return [ + 'main' => $css->css_output(), + 'desktop' => $desktop_css->css_output(), + 'tablet' => $tablet_css->css_output(), + 'tablet_only' => $tablet_only_css->css_output(), + 'mobile' => $mobile_css->css_output(), + ]; + } + + /** + * Wrapper function for our dynamic buttons. + * + * @since 1.5.0 + * @param array $attributes The block attributes. + * @param string $content The dynamic text to display. + * @param WP_Block $block Block instance. + */ + public static function render_block( $attributes, $content, $block ) { + if ( ! isset( $attributes['isDynamic'] ) || ! $attributes['isDynamic'] ) { + if ( ! in_array( $attributes['uniqueId'], self::$block_ids ) ) { + // Build our CSS for this block. + $content = generateblocks_do_inline_css_output( + $content, + self::get_css_data( $attributes ) + ); + } + + return $content; + } + + $defaults = generateblocks_get_block_defaults(); + + $settings = wp_parse_args( + $attributes, + $defaults['gridContainer'] + ); + + $classNames = array( + 'gb-grid-wrapper', + 'gb-grid-wrapper-' . $settings['uniqueId'], + ); + + if ( ! empty( $settings['className'] ) ) { + $classNames[] = $settings['className']; + } + + $output = ''; + + if ( ! in_array( $attributes['uniqueId'], self::$block_ids ) ) { + // Build our CSS for this block. + $output .= generateblocks_do_inline_css_output( + '', + self::get_css_data( $attributes ) + ); + } + + $output .= sprintf( + '
', + generateblocks_attr( + 'grid-wrapper', + array( + 'id' => isset( $settings['anchor'] ) ? $settings['anchor'] : null, + 'class' => implode( ' ', $classNames ), + ), + $settings, + $block + ) + ); + + if ( empty( $attributes['isQueryLoop'] ) ) { + $output .= $content; + } else { + $output .= GenerateBlocks_Block_Query_Loop::render_block( $attributes, $content, $block ); + } + + $output .= '
'; + + return $output; + } +} diff --git a/includes/blocks/class-headline.php b/includes/blocks/class-headline.php new file mode 100644 index 000000000..056968e1d --- /dev/null +++ b/includes/blocks/class-headline.php @@ -0,0 +1,787 @@ + 'h2', + 'cssClasses' => '', + 'alignment' => false, + 'alignmentTablet' => false, + 'alignmentMobile' => false, + 'backgroundColor' => false, + 'backgroundColorOpacity' => 1, + 'textColor' => false, + 'linkColor' => false, + 'linkColorHover' => false, + 'borderColor' => false, + 'borderColorOpacity' => 1, + 'highlightTextColor' => false, + 'fontFamily' => '', + 'fontFamilyFallback' => '', + 'googleFont' => false, + 'googleFontVariants' => '', + 'fontWeight' => '', + 'fontSize' => '', + 'fontSizeTablet' => '', + 'fontSizeMobile' => '', + 'fontSizeUnit' => 'px', + 'textTransform' => '', + 'lineHeight' => '', + 'lineHeightTablet' => '', + 'lineHeightMobile' => '', + 'lineHeightUnit' => 'em', + 'letterSpacing' => '', + 'letterSpacingTablet' => '', + 'letterSpacingMobile' => '', + 'marginTop' => '', + 'marginRight' => '', + 'marginBottom' => '', + 'marginLeft' => '', + 'marginTopTablet' => '', + 'marginRightTablet' => '', + 'marginBottomTablet' => '', + 'marginLeftTablet' => '', + 'marginTopMobile' => '', + 'marginRightMobile' => '', + 'marginBottomMobile' => '', + 'marginLeftMobile' => '', + 'marginUnit' => 'px', + 'paddingTop' => '', + 'paddingRight' => '', + 'paddingBottom' => '', + 'paddingLeft' => '', + 'paddingTopTablet' => '', + 'paddingRightTablet' => '', + 'paddingBottomTablet' => '', + 'paddingLeftTablet' => '', + 'paddingTopMobile' => '', + 'paddingRightMobile' => '', + 'paddingBottomMobile' => '', + 'paddingLeftMobile' => '', + 'paddingUnit' => 'px', + 'borderSizeTop' => '', + 'borderSizeRight' => '', + 'borderSizeBottom' => '', + 'borderSizeLeft' => '', + 'borderSizeTopTablet' => '', + 'borderSizeRightTablet' => '', + 'borderSizeBottomTablet' => '', + 'borderSizeLeftTablet' => '', + 'borderSizeTopMobile' => '', + 'borderSizeRightMobile' => '', + 'borderSizeBottomMobile' => '', + 'borderSizeLeftMobile' => '', + 'borderRadiusTopRight' => '', + 'borderRadiusBottomRight' => '', + 'borderRadiusBottomLeft' => '', + 'borderRadiusTopLeft' => '', + 'borderRadiusTopRightTablet' => '', + 'borderRadiusBottomRightTablet' => '', + 'borderRadiusBottomLeftTablet' => '', + 'borderRadiusTopLeftTablet' => '', + 'borderRadiusTopRightMobile' => '', + 'borderRadiusBottomRightMobile' => '', + 'borderRadiusBottomLeftMobile' => '', + 'borderRadiusTopLeftMobile' => '', + 'borderRadiusUnit' => 'px', + 'icon' => '', + 'hasIcon' => false, + 'iconColor' => false, + 'iconColorOpacity' => 1, + 'iconLocation' => 'inline', + 'iconLocationTablet' => '', + 'iconLocationMobile' => '', + 'iconVerticalAlignment' => 'center', + 'iconVerticalAlignmentTablet' => '', + 'iconVerticalAlignmentMobile' => '', + 'iconPaddingTop' => '', + 'iconPaddingRight' => '0.5', + 'iconPaddingBottom' => '', + 'iconPaddingLeft' => '', + 'iconPaddingTopTablet' => '', + 'iconPaddingRightTablet' => '', + 'iconPaddingBottomTablet' => '', + 'iconPaddingLeftTablet' => '', + 'iconPaddingTopMobile' => '', + 'iconPaddingRightMobile' => '', + 'iconPaddingBottomMobile' => '', + 'iconPaddingLeftMobile' => '', + 'iconPaddingUnit' => 'em', + 'iconSize' => 1, + 'iconSizeTablet' => '', + 'iconSizeMobile' => '', + 'iconSizeUnit' => 'em', + 'inlineWidth' => false, + 'inlineWidthTablet' => false, + 'inlineWidthMobile' => false, + 'removeText' => false, + 'ariaLabel' => '', + ]; + } + + /** + * Compile our CSS data based on our block attributes. + * + * @param array $attributes Our block attributes. + */ + public static function get_css_data( $attributes ) { + $css = new GenerateBlocks_Dynamic_CSS(); + $desktop_css = new GenerateBlocks_Dynamic_CSS(); + $tablet_css = new GenerateBlocks_Dynamic_CSS(); + $tablet_only_css = new GenerateBlocks_Dynamic_CSS(); + $mobile_css = new GenerateBlocks_Dynamic_CSS(); + $css_data = []; + + $defaults = generateblocks_get_block_defaults(); + + $settings = wp_parse_args( + $attributes, + $defaults['headline'] + ); + + $id = $attributes['uniqueId']; + + $selector = '.gb-headline-' . $id; + + if ( apply_filters( 'generateblocks_headline_selector_tagname', true, $attributes ) ) { + $selector = $settings['element'] . $selector; + } + + // Back-compatibility for when icon held a value. + if ( $settings['icon'] ) { + $settings['hasIcon'] = true; + } + + $fontFamily = $settings['fontFamily']; + + if ( $fontFamily && $settings['fontFamilyFallback'] ) { + $fontFamily = $fontFamily . ', ' . $settings['fontFamilyFallback']; + } + + // Only add this CSS once. + if ( count( (array) self::$block_ids ) === 0 ) { + $css->set_selector( '.gb-icon' ); + $css->add_property( 'display', 'inline-flex' ); + $css->add_property( 'line-height', '0' ); + + $css->set_selector( '.gb-icon svg' ); + $css->add_property( 'height', '1em' ); + $css->add_property( 'width', '1em' ); + $css->add_property( 'fill', 'currentColor' ); + + $css->set_selector( '.gb-highlight' ); + $css->add_property( 'background', 'none' ); + $css->add_property( 'color', 'unset' ); + } + + self::$block_ids[] = $id; + + if ( ! isset( $atts['hasWrapper'] ) ) { + $css->set_selector( $selector ); + $css->add_property( 'font-family', $fontFamily ); + $css->add_property( 'text-align', $settings['alignment'] ); + $css->add_property( 'color', $settings['textColor'] ); + $css->add_property( 'background-color', generateblocks_hex2rgba( $settings['backgroundColor'], $settings['backgroundColorOpacity'] ) ); + $css->add_property( 'font-size', $settings['fontSize'], $settings['fontSizeUnit'] ); + $css->add_property( 'font-weight', $settings['fontWeight'] ); + $css->add_property( 'text-transform', $settings['textTransform'] ); + $css->add_property( 'line-height', $settings['lineHeight'], $settings['lineHeightUnit'] ); + $css->add_property( 'letter-spacing', $settings['letterSpacing'], 'em' ); + $css->add_property( 'padding', array( $settings['paddingTop'], $settings['paddingRight'], $settings['paddingBottom'], $settings['paddingLeft'] ), $settings['paddingUnit'] ); + $css->add_property( 'margin', array( $settings['marginTop'], $settings['marginRight'], $settings['marginBottom'], $settings['marginLeft'] ), $settings['marginUnit'] ); + $css->add_property( 'border-radius', array( $settings['borderRadiusTopLeft'], $settings['borderRadiusTopRight'], $settings['borderRadiusBottomRight'], $settings['borderRadiusBottomLeft'] ), $settings['borderRadiusUnit'] ); + $css->add_property( 'border-width', array( $settings['borderSizeTop'], $settings['borderSizeRight'], $settings['borderSizeBottom'], $settings['borderSizeLeft'] ), 'px' ); + $css->add_property( 'border-color', generateblocks_hex2rgba( $settings['borderColor'], $settings['borderColorOpacity'] ) ); + + if ( $settings['inlineWidth'] ) { + if ( $settings['hasIcon'] ) { + $css->add_property( 'display', 'inline-flex' ); + } else { + $css->add_property( 'display', 'inline-block' ); + } + } + + if ( $settings['hasIcon'] ) { + if ( ! $settings['inlineWidth'] ) { + $css->add_property( 'display', 'flex' ); + } + + if ( 'above' === $settings['iconLocation'] ) { + $css->add_property( 'text-align', $settings['alignment'] ); + } else { + $css->add_property( 'justify-content', generateblocks_get_flexbox_alignment( $settings['alignment'] ) ); + } + + if ( 'inline' === $settings['iconLocation'] ) { + $css->add_property( 'align-items', generateblocks_get_flexbox_alignment( $settings['iconVerticalAlignment'] ) ); + } + + if ( 'above' === $settings['iconLocation'] ) { + $css->add_property( 'flex-direction', 'column' ); + } + } + + $css->set_selector( $selector . ' a' ); + $css->add_property( 'color', $settings['linkColor'] ); + + $css->set_selector( $selector . ' a:hover' ); + $css->add_property( 'color', $settings['linkColorHover'] ); + + if ( $settings['hasIcon'] ) { + $css->set_selector( $selector . ' .gb-icon' ); + $css->add_property( 'color', generateblocks_hex2rgba( $settings['iconColor'], $settings['iconColorOpacity'] ) ); + + if ( ! $settings['removeText'] ) { + $css->add_property( 'padding', array( $settings['iconPaddingTop'], $settings['iconPaddingRight'], $settings['iconPaddingBottom'], $settings['iconPaddingLeft'] ), $settings['iconPaddingUnit'] ); + } + + if ( 'above' === $settings['iconLocation'] ) { + $css->add_property( 'display', 'inline' ); + } + + $css->set_selector( $selector . ' .gb-icon svg' ); + $css->add_property( 'width', $settings['iconSize'], $settings['iconSizeUnit'] ); + $css->add_property( 'height', $settings['iconSize'], $settings['iconSizeUnit'] ); + } + + if ( $settings['highlightTextColor'] ) { + $css->set_selector( $selector . ' .gb-highlight' ); + $css->add_property( 'color', $settings['highlightTextColor'] ); + } + + $tablet_css->set_selector( $selector ); + $tablet_css->add_property( 'text-align', $settings['alignmentTablet'] ); + $tablet_css->add_property( 'font-size', $settings['fontSizeTablet'], $settings['fontSizeUnit'] ); + $tablet_css->add_property( 'line-height', $settings['lineHeightTablet'], $settings['lineHeightUnit'] ); + $tablet_css->add_property( 'letter-spacing', $settings['letterSpacingTablet'], 'em' ); + $tablet_css->add_property( 'margin', array( $settings['marginTopTablet'], $settings['marginRightTablet'], $settings['marginBottomTablet'], $settings['marginLeftTablet'] ), $settings['marginUnit'] ); + $tablet_css->add_property( 'padding', array( $settings['paddingTopTablet'], $settings['paddingRightTablet'], $settings['paddingBottomTablet'], $settings['paddingLeftTablet'] ), $settings['paddingUnit'] ); + $tablet_css->add_property( 'border-radius', array( $settings['borderRadiusTopLeftTablet'], $settings['borderRadiusTopRightTablet'], $settings['borderRadiusBottomRightTablet'], $settings['borderRadiusBottomLeftTablet'] ), $settings['borderRadiusUnit'] ); + $tablet_css->add_property( 'border-width', array( $settings['borderSizeTopTablet'], $settings['borderSizeRightTablet'], $settings['borderSizeBottomTablet'], $settings['borderSizeLeftTablet'] ), 'px' ); + + if ( $settings['inlineWidthTablet'] ) { + if ( $settings['hasIcon'] ) { + $tablet_css->add_property( 'display', 'inline-flex' ); + } else { + $tablet_css->add_property( 'display', 'inline-block' ); + } + } + + if ( $settings['hasIcon'] ) { + $tablet_css->add_property( 'justify-content', generateblocks_get_flexbox_alignment( $settings['alignmentTablet'] ) ); + + if ( 'inline' === $settings['iconLocationTablet'] ) { + $tablet_css->add_property( 'align-items', generateblocks_get_flexbox_alignment( $settings['iconVerticalAlignmentTablet'] ) ); + } + + if ( 'above' === $settings['iconLocationTablet'] ) { + $tablet_css->add_property( 'flex-direction', 'column' ); + } + + $tablet_css->set_selector( $selector . ' .gb-icon' ); + + if ( ! $settings['removeText'] ) { + $tablet_css->add_property( 'padding', array( $settings['iconPaddingTopTablet'], $settings['iconPaddingRightTablet'], $settings['iconPaddingBottomTablet'], $settings['iconPaddingLeftTablet'] ), $settings['iconPaddingUnit'] ); + } + + if ( 'above' === $settings['iconLocationTablet'] || ( 'above' === $settings['iconLocation'] && '' == $settings['iconLocationTablet'] ) ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison + $tablet_css->add_property( 'align-self', generateblocks_get_flexbox_alignment( $settings['alignmentTablet'] ) ); + } + + if ( 'above' === $settings['iconLocationTablet'] ) { + $tablet_css->add_property( 'display', 'inline' ); + } + + $tablet_css->set_selector( $selector . ' .gb-icon svg' ); + $tablet_css->add_property( 'width', $settings['iconSizeTablet'], $settings['iconSizeUnit'] ); + $tablet_css->add_property( 'height', $settings['iconSizeTablet'], $settings['iconSizeUnit'] ); + } + + $mobile_css->set_selector( $selector ); + $mobile_css->add_property( 'text-align', $settings['alignmentMobile'] ); + $mobile_css->add_property( 'font-size', $settings['fontSizeMobile'], $settings['fontSizeUnit'] ); + $mobile_css->add_property( 'line-height', $settings['lineHeightMobile'], $settings['lineHeightUnit'] ); + $mobile_css->add_property( 'letter-spacing', $settings['letterSpacingMobile'], 'em' ); + $mobile_css->add_property( 'margin', array( $settings['marginTopMobile'], $settings['marginRightMobile'], $settings['marginBottomMobile'], $settings['marginLeftMobile'] ), $settings['marginUnit'] ); + $mobile_css->add_property( 'padding', array( $settings['paddingTopMobile'], $settings['paddingRightMobile'], $settings['paddingBottomMobile'], $settings['paddingLeftMobile'] ), $settings['paddingUnit'] ); + $mobile_css->add_property( 'border-radius', array( $settings['borderRadiusTopLeftMobile'], $settings['borderRadiusTopRightMobile'], $settings['borderRadiusBottomRightMobile'], $settings['borderRadiusBottomLeftMobile'] ), $settings['borderRadiusUnit'] ); + $mobile_css->add_property( 'border-width', array( $settings['borderSizeTopMobile'], $settings['borderSizeRightMobile'], $settings['borderSizeBottomMobile'], $settings['borderSizeLeftMobile'] ), 'px' ); + + if ( $settings['inlineWidthMobile'] ) { + if ( $settings['hasIcon'] ) { + $mobile_css->add_property( 'display', 'inline-flex' ); + } else { + $mobile_css->add_property( 'display', 'inline-block' ); + } + } + + if ( $settings['hasIcon'] ) { + $mobile_css->add_property( 'justify-content', generateblocks_get_flexbox_alignment( $settings['alignmentMobile'] ) ); + + if ( 'inline' === $settings['iconLocationMobile'] ) { + $mobile_css->add_property( 'align-items', generateblocks_get_flexbox_alignment( $settings['iconVerticalAlignmentMobile'] ) ); + } + + if ( 'above' === $settings['iconLocationMobile'] ) { + $mobile_css->add_property( 'flex-direction', 'column' ); + } + + $mobile_css->set_selector( $selector . ' .gb-icon' ); + + if ( ! $settings['removeText'] ) { + $mobile_css->add_property( 'padding', array( $settings['iconPaddingTopMobile'], $settings['iconPaddingRightMobile'], $settings['iconPaddingBottomMobile'], $settings['iconPaddingLeftMobile'] ), $settings['iconPaddingUnit'] ); + } + + if ( 'above' === $settings['iconLocationMobile'] || ( 'above' === $settings['iconLocation'] && '' == $settings['iconLocationMobile'] ) ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison + $mobile_css->add_property( 'align-self', generateblocks_get_flexbox_alignment( $settings['alignmentMobile'] ) ); + } + + if ( 'above' === $settings['iconLocationMobile'] ) { + $mobile_css->add_property( 'display', 'inline' ); + } + + $mobile_css->set_selector( $selector . ' .gb-icon svg' ); + $mobile_css->add_property( 'width', $settings['iconSizeMobile'], $settings['iconSizeUnit'] ); + $mobile_css->add_property( 'height', $settings['iconSizeMobile'], $settings['iconSizeUnit'] ); + } + } else { + // The below CSS is for users using the old headline wrapper. + $css->set_selector( '.gb-headline-wrapper' ); + $css->add_property( 'display', 'flex' ); + + $css->set_selector( '.gb-headline-wrapper > .gb-headline' ); + $css->add_property( 'margin', '0' ); + $css->add_property( 'padding', '0' ); + + $css->set_selector( '.gb-headline-' . $id ); + $css->add_property( 'font-family', $fontFamily ); + $css->add_property( 'text-align', $settings['alignment'] ); + $css->add_property( 'color', $settings['textColor'] ); + + if ( ! $settings['hasIcon'] ) { + $css->add_property( 'background-color', generateblocks_hex2rgba( $settings['backgroundColor'], $settings['backgroundColorOpacity'] ) ); + + if ( $settings['inlineWidth'] ) { + $css->add_property( 'display', 'inline-block' ); + } + + $css->add_property( 'border-width', array( $settings['borderSizeTop'], $settings['borderSizeRight'], $settings['borderSizeBottom'], $settings['borderSizeLeft'] ), 'px' ); + $css->add_property( 'border-color', generateblocks_hex2rgba( $settings['borderColor'], $settings['borderColorOpacity'] ) ); + } + + $css->add_property( 'font-size', $settings['fontSize'], $settings['fontSizeUnit'] ); + $css->add_property( 'font-weight', $settings['fontWeight'] ); + $css->add_property( 'text-transform', $settings['textTransform'] ); + $css->add_property( 'line-height', $settings['lineHeight'], $settings['lineHeightUnit'] ); + $css->add_property( 'letter-spacing', $settings['letterSpacing'], 'em' ); + + if ( ! $settings['hasIcon'] ) { + $css->add_property( 'padding', array( $settings['paddingTop'], $settings['paddingRight'], $settings['paddingBottom'], $settings['paddingLeft'] ), $settings['paddingUnit'] ); + $css->add_property( 'margin', array( $settings['marginTop'], $settings['marginRight'], $settings['marginBottom'], $settings['marginLeft'] ), $settings['marginUnit'] ); + + if ( function_exists( 'generate_get_default_fonts' ) && '' === $settings['marginBottom'] ) { + $defaultBlockStyles = generateblocks_get_default_styles(); + + if ( isset( $defaultBlockStyles['headline'][ $settings['element'] ]['marginBottom'] ) ) { + $css->add_property( 'margin-bottom', $defaultBlockStyles['headline'][ $settings['element'] ]['marginBottom'], $defaultBlockStyles['headline'][ $settings['element'] ]['marginUnit'] ); + } + } + } + + $css->set_selector( '.gb-headline-' . $id . ' a, .gb-headline-' . $id . ' a:visited' ); + $css->add_property( 'color', $settings['linkColor'] ); + + $css->set_selector( '.gb-headline-' . $id . ' a:hover' ); + $css->add_property( 'color', $settings['linkColorHover'] ); + + if ( $settings['hasIcon'] ) { + $css->set_selector( '.gb-headline-wrapper-' . $id . ' .gb-icon' ); + + if ( ! $settings['removeText'] ) { + $css->add_property( 'padding', array( $settings['iconPaddingTop'], $settings['iconPaddingRight'], $settings['iconPaddingBottom'], $settings['iconPaddingLeft'] ), $settings['iconPaddingUnit'] ); + } + + $css->add_property( 'color', generateblocks_hex2rgba( $settings['iconColor'], $settings['iconColorOpacity'] ) ); + + if ( 'above' === $settings['iconLocation'] ) { + $css->add_property( 'display', 'inline' ); + } + + $css->set_selector( '.gb-headline-wrapper-' . $id . ' .gb-icon svg' ); + $css->add_property( 'width', $settings['iconSize'], $settings['iconSizeUnit'] ); + $css->add_property( 'height', $settings['iconSize'], $settings['iconSizeUnit'] ); + + $css->set_selector( '.gb-headline-wrapper-' . $id ); + $css->add_property( 'padding', array( $settings['paddingTop'], $settings['paddingRight'], $settings['paddingBottom'], $settings['paddingLeft'] ), $settings['paddingUnit'] ); + $css->add_property( 'margin', array( $settings['marginTop'], $settings['marginRight'], $settings['marginBottom'], $settings['marginLeft'] ), $settings['marginUnit'] ); + + $defaultBlockStyles = generateblocks_get_default_styles(); + + if ( '' === $settings['marginBottom'] && ! $settings['removeText'] && isset( $defaultBlockStyles['headline'][ $settings['element'] ]['marginBottom'] ) && is_numeric( $defaultBlockStyles['headline'][ $settings['element'] ]['marginBottom'] ) ) { + $css->add_property( 'margin-bottom', $defaultBlockStyles['headline'][ $settings['element'] ]['marginBottom'], $defaultBlockStyles['headline'][ $settings['element'] ]['marginUnit'] ); + } + + if ( '' === $settings['fontSize'] && ! $settings['removeText'] && isset( $defaultBlockStyles['headline'][ $settings['element'] ]['fontSize'] ) ) { + $css->add_property( 'font-size', $defaultBlockStyles['headline'][ $settings['element'] ]['fontSize'], $defaultBlockStyles['headline'][ $settings['element'] ]['fontSizeUnit'] ); + } else { + $css->add_property( 'font-size', $settings['fontSize'], $settings['fontSizeUnit'] ); + } + + if ( 'above' === $settings['iconLocation'] ) { + $css->add_property( 'text-align', $settings['alignment'] ); + } else { + $css->add_property( 'justify-content', generateblocks_get_flexbox_alignment( $settings['alignment'] ) ); + } + + if ( $settings['inlineWidth'] ) { + $css->add_property( 'display', 'inline-flex' ); + } + + if ( 'inline' === $settings['iconLocation'] ) { + $css->add_property( 'align-items', generateblocks_get_flexbox_alignment( $settings['iconVerticalAlignment'] ) ); + } + + $css->add_property( 'background-color', generateblocks_hex2rgba( $settings['backgroundColor'], $settings['backgroundColorOpacity'] ) ); + $css->add_property( 'color', $settings['textColor'] ); + $css->add_property( 'border-width', array( $settings['borderSizeTop'], $settings['borderSizeRight'], $settings['borderSizeBottom'], $settings['borderSizeLeft'] ), 'px' ); + $css->add_property( 'border-color', generateblocks_hex2rgba( $settings['borderColor'], $settings['borderColorOpacity'] ) ); + + if ( 'above' === $settings['iconLocation'] ) { + $css->add_property( 'flex-direction', 'column' ); + } + } + + if ( $settings['highlightTextColor'] ) { + $css->set_selector( '.gb-headline-' . $id . ' .gb-highlight' ); + $css->add_property( 'color', $settings['highlightTextColor'] ); + } + + $tablet_css->set_selector( '.gb-headline-' . $id ); + $tablet_css->add_property( 'text-align', $settings['alignmentTablet'] ); + $tablet_css->add_property( 'font-size', $settings['fontSizeTablet'], $settings['fontSizeUnit'] ); + $tablet_css->add_property( 'line-height', $settings['lineHeightTablet'], $settings['lineHeightUnit'] ); + $tablet_css->add_property( 'letter-spacing', $settings['letterSpacingTablet'], 'em' ); + + if ( ! $settings['hasIcon'] ) { + $tablet_css->add_property( 'margin', array( $settings['marginTopTablet'], $settings['marginRightTablet'], $settings['marginBottomTablet'], $settings['marginLeftTablet'] ), $settings['marginUnit'] ); + $tablet_css->add_property( 'padding', array( $settings['paddingTopTablet'], $settings['paddingRightTablet'], $settings['paddingBottomTablet'], $settings['paddingLeftTablet'] ), $settings['paddingUnit'] ); + $tablet_css->add_property( 'border-width', array( $settings['borderSizeTopTablet'], $settings['borderSizeRightTablet'], $settings['borderSizeBottomTablet'], $settings['borderSizeLeftTablet'] ), 'px' ); + + if ( $settings['inlineWidthTablet'] ) { + $tablet_css->add_property( 'display', 'inline-flex' ); + } + } + + if ( $settings['hasIcon'] ) { + $tablet_css->set_selector( '.gb-headline-wrapper-' . $id . ' .gb-icon' ); + + if ( ! $settings['removeText'] ) { + $tablet_css->add_property( 'padding', array( $settings['iconPaddingTopTablet'], $settings['iconPaddingRightTablet'], $settings['iconPaddingBottomTablet'], $settings['iconPaddingLeftTablet'] ), $settings['iconPaddingUnit'] ); + } + + if ( 'above' === $settings['iconLocationTablet'] || ( 'above' === $settings['iconLocation'] && '' == $settings['iconLocationTablet'] ) ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison + $tablet_css->add_property( 'align-self', generateblocks_get_flexbox_alignment( $settings['alignmentTablet'] ) ); + } + + $tablet_css->set_selector( '.gb-headline-wrapper-' . $id . ' .gb-icon svg' ); + $tablet_css->add_property( 'width', $settings['iconSizeTablet'], $settings['iconSizeUnit'] ); + $tablet_css->add_property( 'height', $settings['iconSizeTablet'], $settings['iconSizeUnit'] ); + + $tablet_css->set_selector( '.gb-headline-wrapper-' . $id ); + $tablet_css->add_property( 'margin', array( $settings['marginTopTablet'], $settings['marginRightTablet'], $settings['marginBottomTablet'], $settings['marginLeftTablet'] ), $settings['marginUnit'] ); + $tablet_css->add_property( 'padding', array( $settings['paddingTopTablet'], $settings['paddingRightTablet'], $settings['paddingBottomTablet'], $settings['paddingLeftTablet'] ), $settings['paddingUnit'] ); + $tablet_css->add_property( 'border-width', array( $settings['borderSizeTopTablet'], $settings['borderSizeRightTablet'], $settings['borderSizeBottomTablet'], $settings['borderSizeLeftTablet'] ), 'px' ); + $tablet_css->add_property( 'justify-content', generateblocks_get_flexbox_alignment( $settings['alignmentTablet'] ) ); + + $defaultBlockStyles = generateblocks_get_default_styles(); + + if ( '' === $settings['marginBottomTablet'] && ! $settings['removeText'] && isset( $defaultBlockStyles['headline'][ $settings['element'] ]['marginBottomTablet'] ) && is_numeric( $defaultBlockStyles['headline'][ $settings['element'] ]['marginBottomTablet'] ) ) { + $tablet_css->add_property( 'margin-bottom', $defaultBlockStyles['headline'][ $settings['element'] ]['marginBottomTablet'], $defaultBlockStyles['headline'][ $settings['element'] ]['marginUnit'] ); + } + + if ( '' === $settings['fontSizeTablet'] && ! $settings['removeText'] && isset( $defaultBlockStyles['headline'][ $settings['element'] ]['fontSizeTablet'] ) ) { + $tablet_css->add_property( 'font-size', $defaultBlockStyles['headline'][ $settings['element'] ]['fontSizeTablet'], $defaultBlockStyles['headline'][ $settings['element'] ]['fontSizeUnit'] ); + } else { + $tablet_css->add_property( 'font-size', $settings['fontSizeTablet'], $settings['fontSizeUnit'] ); + } + + if ( $settings['inlineWidthTablet'] ) { + $tablet_css->add_property( 'display', 'inline-flex' ); + } + + if ( 'inline' === $settings['iconLocationTablet'] ) { + $tablet_css->add_property( 'align-items', generateblocks_get_flexbox_alignment( $settings['iconVerticalAlignmentTablet'] ) ); + } + + if ( 'above' === $settings['iconLocationTablet'] ) { + $tablet_css->add_property( 'flex-direction', 'column' ); + } + } + + $mobile_css->set_selector( '.gb-headline-' . $id ); + $mobile_css->add_property( 'text-align', $settings['alignmentMobile'] ); + $mobile_css->add_property( 'font-size', $settings['fontSizeMobile'], $settings['fontSizeUnit'] ); + $mobile_css->add_property( 'line-height', $settings['lineHeightMobile'], $settings['lineHeightUnit'] ); + $mobile_css->add_property( 'letter-spacing', $settings['letterSpacingMobile'], 'em' ); + + if ( ! $settings['hasIcon'] ) { + $mobile_css->add_property( 'margin', array( $settings['marginTopMobile'], $settings['marginRightMobile'], $settings['marginBottomMobile'], $settings['marginLeftMobile'] ), $settings['marginUnit'] ); + $mobile_css->add_property( 'padding', array( $settings['paddingTopMobile'], $settings['paddingRightMobile'], $settings['paddingBottomMobile'], $settings['paddingLeftMobile'] ), $settings['paddingUnit'] ); + $mobile_css->add_property( 'border-width', array( $settings['borderSizeTopMobile'], $settings['borderSizeRightMobile'], $settings['borderSizeBottomMobile'], $settings['borderSizeLeftMobile'] ), 'px' ); + + if ( $settings['inlineWidthMobile'] ) { + $mobile_css->add_property( 'display', 'inline-flex' ); + } + } + + if ( $settings['hasIcon'] ) { + $mobile_css->set_selector( '.gb-headline-wrapper-' . $id . ' .gb-icon' ); + + if ( ! $settings['removeText'] ) { + $mobile_css->add_property( 'padding', array( $settings['iconPaddingTopMobile'], $settings['iconPaddingRightMobile'], $settings['iconPaddingBottomMobile'], $settings['iconPaddingLeftMobile'] ), $settings['iconPaddingUnit'] ); + } + + if ( 'above' === $settings['iconLocationMobile'] || ( 'above' === $settings['iconLocation'] && '' == $settings['iconLocationMobile'] ) || ( 'above' === $settings['iconLocationTablet'] && '' == $settings['iconLocationMobile'] ) ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison + $mobile_css->add_property( 'align-self', generateblocks_get_flexbox_alignment( $settings['alignmentMobile'] ) ); + } + + $mobile_css->set_selector( '.gb-headline-wrapper-' . $id . ' .gb-icon svg' ); + $mobile_css->add_property( 'width', $settings['iconSizeMobile'], $settings['iconSizeUnit'] ); + $mobile_css->add_property( 'height', $settings['iconSizeMobile'], $settings['iconSizeUnit'] ); + + $mobile_css->set_selector( '.gb-headline-wrapper-' . $id ); + $mobile_css->add_property( 'margin', array( $settings['marginTopMobile'], $settings['marginRightMobile'], $settings['marginBottomMobile'], $settings['marginLeftMobile'] ), $settings['marginUnit'] ); + $mobile_css->add_property( 'padding', array( $settings['paddingTopMobile'], $settings['paddingRightMobile'], $settings['paddingBottomMobile'], $settings['paddingLeftMobile'] ), $settings['paddingUnit'] ); + $mobile_css->add_property( 'justify-content', generateblocks_get_flexbox_alignment( $settings['alignmentMobile'] ) ); + + $defaultBlockStyles = generateblocks_get_default_styles(); + + if ( '' === $settings['marginBottomMobile'] && ! $settings['removeText'] && isset( $defaultBlockStyles['headline'][ $settings['element'] ]['marginBottomMobile'] ) && is_numeric( $defaultBlockStyles['headline'][ $settings['element'] ]['marginBottomMobile'] ) ) { + $mobile_css->add_property( 'margin-bottom', $defaultBlockStyles['headline'][ $settings['element'] ]['marginBottomMobile'], $defaultBlockStyles['headline'][ $settings['element'] ]['marginUnit'] ); + } + + if ( '' === $settings['fontSizeMobile'] && ! $settings['removeText'] && ! empty( $defaultBlockStyles['headline'][ $settings['element'] ]['fontSizeMobile'] ) ) { + $mobile_css->add_property( 'font-size', $defaultBlockStyles['headline'][ $settings['element'] ]['fontSizeMobile'], $defaultBlockStyles['headline'][ $settings['element'] ]['fontSizeUnit'] ); + } else { + $mobile_css->add_property( 'font-size', $settings['fontSizeMobile'], $settings['fontSizeUnit'] ); + } + + if ( $settings['inlineWidthMobile'] ) { + $mobile_css->add_property( 'display', 'inline-flex' ); + } + + if ( 'inline' === $settings['iconLocationMobile'] ) { + $mobile_css->add_property( 'align-items', generateblocks_get_flexbox_alignment( $settings['iconVerticalAlignmentMobile'] ) ); + } + + if ( 'above' === $settings['iconLocationMobile'] ) { + $mobile_css->add_property( 'flex-direction', 'column' ); + } + } + } + + /** + * Do generateblocks_block_css_data hook + * + * @since 1.0 + * + * @param string $name The name of our block. + * @param array $settings The settings for the current block. + * @param object $css Our desktop/main CSS data. + * @param object $desktop_css Our desktop only CSS data. + * @param object $tablet_css Our tablet CSS data. + * @param object $tablet_only_css Our tablet only CSS data. + * @param object $mobile_css Our mobile CSS data. + */ + do_action( + 'generateblocks_block_css_data', + 'headline', + $settings, + $css, + $desktop_css, + $tablet_css, + $tablet_only_css, + $mobile_css + ); + + return [ + 'main' => $css->css_output(), + 'desktop' => $desktop_css->css_output(), + 'tablet' => $tablet_css->css_output(), + 'tablet_only' => $tablet_only_css->css_output(), + 'mobile' => $mobile_css->css_output(), + ]; + } + + /** + * Wrapper function for our dynamic buttons. + * + * @since 1.5.0 + * @param array $attributes The block attributes. + * @param string $content The dynamic text to display. + * @param WP_Block $block Block instance. + */ + public static function render_block( $attributes, $content, $block ) { + if ( strpos( trim( $content ), '
'; + } + } + + $dynamic_link = GenerateBlocks_Dynamic_Content::get_dynamic_url( $attributes, $block ); + + if ( $dynamic_link ) { + $dynamic_content = sprintf( + '%s', + $dynamic_link, + $dynamic_content + ); + } + + $output .= $dynamic_content; + + if ( $icon_html ) { + $output .= ''; + } + + $output .= sprintf( + '', + $tagName + ); + + return $output; + } +} diff --git a/includes/blocks/class-image.php b/includes/blocks/class-image.php new file mode 100644 index 000000000..5c73c0f6b --- /dev/null +++ b/includes/blocks/class-image.php @@ -0,0 +1,360 @@ + '', + 'sizeSlug' => '', + 'width' => '', + 'widthTablet' => '', + 'widthMobile' => '', + 'height' => '', + 'heightTablet' => '', + 'heightMobile' => '', + 'marginTop' => '', + 'marginRight' => '', + 'marginBottom' => '', + 'marginLeft' => '', + 'marginTopTablet' => '', + 'marginRightTablet' => '', + 'marginBottomTablet' => '', + 'marginLeftTablet' => '', + 'marginTopMobile' => '', + 'marginRightMobile' => '', + 'marginBottomMobile' => '', + 'marginLeftMobile' => '', + 'marginUnit' => 'px', + 'paddingTop' => '', + 'paddingRight' => '', + 'paddingBottom' => '', + 'paddingLeft' => '', + 'paddingTopTablet' => '', + 'paddingRightTablet' => '', + 'paddingBottomTablet' => '', + 'paddingLeftTablet' => '', + 'paddingTopMobile' => '', + 'paddingRightMobile' => '', + 'paddingBottomMobile' => '', + 'paddingLeftMobile' => '', + 'paddingUnit' => 'px', + 'borderColor' => '', + 'borderSizeTop' => '', + 'borderSizeRight' => '', + 'borderSizeBottom' => '', + 'borderSizeLeft' => '', + 'borderSizeTopTablet' => '', + 'borderSizeRightTablet' => '', + 'borderSizeBottomTablet' => '', + 'borderSizeLeftTablet' => '', + 'borderSizeTopMobile' => '', + 'borderSizeRightMobile' => '', + 'borderSizeBottomMobile' => '', + 'borderSizeLeftMobile' => '', + 'borderRadiusTopRight' => '', + 'borderRadiusBottomRight' => '', + 'borderRadiusBottomLeft' => '', + 'borderRadiusTopLeft' => '', + 'borderRadiusTopRightTablet' => '', + 'borderRadiusBottomRightTablet' => '', + 'borderRadiusBottomLeftTablet' => '', + 'borderRadiusTopLeftTablet' => '', + 'borderRadiusTopRightMobile' => '', + 'borderRadiusBottomRightMobile' => '', + 'borderRadiusBottomLeftMobile' => '', + 'borderRadiusTopLeftMobile' => '', + 'borderRadiusUnit' => 'px', + 'objectFit' => '', + 'objectFitTablet' => '', + 'objectFitMobile' => '', + 'align' => '', + 'alignment' => '', + 'alignmentTablet' => '', + 'alignmentMobile' => '', + ]; + } + + /** + * Compile our CSS data based on our block attributes. + * + * @param array $attributes Our block attributes. + */ + public static function get_css_data( $attributes ) { + $css = new GenerateBlocks_Dynamic_CSS(); + $desktop_css = new GenerateBlocks_Dynamic_CSS(); + $tablet_css = new GenerateBlocks_Dynamic_CSS(); + $tablet_only_css = new GenerateBlocks_Dynamic_CSS(); + $mobile_css = new GenerateBlocks_Dynamic_CSS(); + $css_data = []; + + $defaults = generateblocks_get_block_defaults(); + + $settings = wp_parse_args( + $atts, + $defaults['image'] + ); + + $id = $atts['uniqueId']; + + // Only add this CSS once. + if ( count( (array) self::$block_ids ) === 0 ) { + $css->set_selector( '.gb-block-image img' ); + $css->add_property( 'vertical-align', 'middle' ); + } + + self::$block_ids[] = $id; + + $css->set_selector( '.gb-block-image-' . $id ); + $css->add_property( 'padding', array( $settings['paddingTop'], $settings['paddingRight'], $settings['paddingBottom'], $settings['paddingLeft'] ), $settings['paddingUnit'] ); + $css->add_property( 'margin', array( $settings['marginTop'], $settings['marginRight'], $settings['marginBottom'], $settings['marginLeft'] ), $settings['marginUnit'] ); + + // Set a flag we'll update later if we disable floats. + $disable_float = false; + $has_desktop_float = 'floatLeft' === $settings['alignment'] || 'floatRight' === $settings['alignment']; + $has_tablet_float = 'floatLeft' === $settings['alignmentTablet'] || 'floatRight' === $settings['alignmentTablet']; + + if ( $has_desktop_float ) { + $css->add_property( 'float', generateblocks_get_float_alignment( $settings['alignment'] ) ); + } else { + $css->add_property( 'text-align', $settings['alignment'] ); + } + + $css->set_selector( '.gb-image-' . $id ); + $css->add_property( 'border-radius', array( $settings['borderRadiusTopLeft'], $settings['borderRadiusTopRight'], $settings['borderRadiusBottomRight'], $settings['borderRadiusBottomLeft'] ), $settings['borderRadiusUnit'] ); + $css->add_property( 'border-width', array( $settings['borderSizeTop'], $settings['borderSizeRight'], $settings['borderSizeBottom'], $settings['borderSizeLeft'] ), 'px' ); + $css->add_property( 'border-color', $settings['borderColor'] ); + $css->add_property( 'width', $settings['width'] ); + $css->add_property( 'height', $settings['height'] ); + $css->add_property( 'object-fit', $settings['objectFit'] ); + + $tablet_css->set_selector( '.gb-block-image-' . $id ); + $tablet_css->add_property( 'padding', array( $settings['paddingTopTablet'], $settings['paddingRightTablet'], $settings['paddingBottomTablet'], $settings['paddingLeftTablet'] ), $settings['paddingUnit'] ); + $tablet_css->add_property( 'margin', array( $settings['marginTopTablet'], $settings['marginRightTablet'], $settings['marginBottomTablet'], $settings['marginLeftTablet'] ), $settings['marginUnit'] ); + + if ( $has_tablet_float ) { + $tablet_css->add_property( 'float', generateblocks_get_float_alignment( $settings['alignmentTablet'] ) ); + } else { + $tablet_css->add_property( 'text-align', $settings['alignmentTablet'] ); + + if ( $settings['alignmentTablet'] && $has_desktop_float ) { + $tablet_css->add_property( 'float', 'none' ); + $disable_float = true; + } + } + + $tablet_css->set_selector( '.gb-image-' . $id ); + $tablet_css->add_property( 'border-radius', array( $settings['borderRadiusTopLeftTablet'], $settings['borderRadiusTopRightTablet'], $settings['borderRadiusBottomRightTablet'], $settings['borderRadiusBottomLeftTablet'] ), $settings['borderRadiusUnit'] ); + $tablet_css->add_property( 'border-width', array( $settings['borderSizeTopTablet'], $settings['borderSizeRightTablet'], $settings['borderSizeBottomTablet'], $settings['borderSizeLeftTablet'] ), 'px' ); + $tablet_css->add_property( 'width', $settings['widthTablet'] ); + $tablet_css->add_property( 'height', $settings['heightTablet'] ); + $tablet_css->add_property( 'object-fit', $settings['objectFitTablet'] ); + + $mobile_css->set_selector( '.gb-block-image-' . $id ); + $mobile_css->add_property( 'padding', array( $settings['paddingTopMobile'], $settings['paddingRightMobile'], $settings['paddingBottomMobile'], $settings['paddingLeftMobile'] ), $settings['paddingUnit'] ); + $mobile_css->add_property( 'margin', array( $settings['marginTopMobile'], $settings['marginRightMobile'], $settings['marginBottomMobile'], $settings['marginLeftMobile'] ), $settings['marginUnit'] ); + + if ( 'floatLeft' === $settings['alignmentMobile'] || 'floatRight' === $settings['alignmentMobile'] ) { + $mobile_css->add_property( 'float', generateblocks_get_float_alignment( $settings['alignmentMobile'] ) ); + } else { + $mobile_css->add_property( 'text-align', $settings['alignmentMobile'] ); + + if ( + $settings['alignmentMobile'] && + ! $disable_float && + ( + $has_desktop_float || + $has_tablet_float + ) + ) { + $mobile_css->add_property( 'float', 'none' ); + } + } + + $mobile_css->set_selector( '.gb-image-' . $id ); + $mobile_css->add_property( 'border-radius', array( $settings['borderRadiusTopLeftMobile'], $settings['borderRadiusTopRightMobile'], $settings['borderRadiusBottomRightMobile'], $settings['borderRadiusBottomLeftMobile'] ), $settings['borderRadiusUnit'] ); + $mobile_css->add_property( 'border-width', array( $settings['borderSizeTopMobile'], $settings['borderSizeRightMobile'], $settings['borderSizeBottomMobile'], $settings['borderSizeLeftMobile'] ), 'px' ); + $mobile_css->add_property( 'width', $settings['widthMobile'] ); + $mobile_css->add_property( 'height', $settings['heightMobile'] ); + $mobile_css->add_property( 'object-fit', $settings['objectFitMobile'] ); + + /** + * Do generateblocks_block_css_data hook + * + * @since 1.0 + * + * @param string $name The name of our block. + * @param array $settings The settings for the current block. + * @param object $css Our desktop/main CSS data. + * @param object $desktop_css Our desktop only CSS data. + * @param object $tablet_css Our tablet CSS data. + * @param object $tablet_only_css Our tablet only CSS data. + * @param object $mobile_css Our mobile CSS data. + */ + do_action( + 'generateblocks_block_css_data', + 'image', + $settings, + $css, + $desktop_css, + $tablet_css, + $tablet_only_css, + $mobile_css + ); + + return [ + 'main' => $css->css_output(), + 'desktop' => $desktop_css->css_output(), + 'tablet' => $tablet_css->css_output(), + 'tablet_only' => $tablet_only_css->css_output(), + 'mobile' => $mobile_css->css_output(), + ]; + } + + /** + * Wrapper function for our dynamic buttons. + * + * @since 1.5.0 + * @param array $attributes The block attributes. + * @param string $content The dynamic text to display. + * @param WP_Block $block Block instance. + */ + public static function render_block( $attributes, $content, $block ) { + if ( empty( $attributes['useDynamicData'] ) ) { + if ( ! in_array( $attributes['uniqueId'], self::$block_ids ) ) { + // Build our CSS for this block. + $content = generateblocks_do_inline_css_output( + $content, + self::get_css_data( $attributes ) + ); + } + + return generateblocks_filter_images( $content, $attributes ); + } + + $image = empty( $attributes['dynamicContentType'] ) + ? generateblocks_filter_images( GenerateBlocks_Dynamic_Content::get_static_content( $content ), $attributes ) + : GenerateBlocks_Dynamic_Content::get_dynamic_image( $attributes, $block ); + + if ( ! $image ) { + return ''; + } + + $defaults = generateblocks_get_block_defaults(); + + $settings = wp_parse_args( + $attributes, + $defaults['image'] + ); + + $output = ''; + + if ( ! in_array( $attributes['uniqueId'], self::$block_ids ) ) { + // Build our CSS for this block. + $output .= generateblocks_do_inline_css_output( + '', + self::get_css_data( $attributes ) + ); + } + + $output .= sprintf( + '
', + generateblocks_attr( + 'image-figure', + array( + 'class' => implode( + ' ', + array( + 'gb-block-image', + 'gb-block-image-' . $settings['uniqueId'], + ) + ), + ), + $settings, + $block + ) + ); + + $dynamic_link = GenerateBlocks_Dynamic_Content::get_dynamic_url( $attributes, $block ); + + if ( $dynamic_link ) { + $relAttributes = array(); + + if ( ! empty( $settings['relNoFollow'] ) ) { + $relAttributes[] = 'nofollow'; + } + + if ( ! empty( $settings['openInNewWindow'] ) ) { + $relAttributes[] = 'noopener'; + $relAttributes[] = 'noreferrer'; + } + + if ( ! empty( $settings['relSponsored'] ) ) { + $relAttributes[] = 'sponsored'; + } + + $dynamic_link_data = array( + 'href' => $dynamic_link, + 'rel' => ! empty( $relAttributes ) ? implode( ' ', $relAttributes ) : null, + 'target' => ! empty( $settings['openInNewWindow'] ) ? '_blank' : null, + ); + + $dynamic_link_attributes = ''; + + foreach ( $dynamic_link_data as $attribute => $value ) { + $dynamic_link_attributes .= sprintf( + ' %s="%s"', + $attribute, + $value + ); + } + + $image = sprintf( + '%s', + trim( $dynamic_link_attributes ), + $image + ); + } + + $output .= $image; + + if ( isset( $block->parsed_block['innerBlocks'][0]['attrs'] ) ) { + $image_id = GenerateBlocks_Dynamic_Content::get_dynamic_image_id( $attributes ); + $block->parsed_block['innerBlocks'][0]['attrs']['dynamicImage'] = $image_id; + + $caption = ( + new WP_Block( + $block->parsed_block['innerBlocks'][0] + ) + )->render( array( 'dynamic' => true ) ); + + if ( $caption ) { + $output .= $caption; + } + } + + $output .= '
'; + + return $output; + } +} diff --git a/includes/blocks/class-query-loop.php b/includes/blocks/class-query-loop.php new file mode 100644 index 000000000..8d61e400e --- /dev/null +++ b/includes/blocks/class-query-loop.php @@ -0,0 +1,78 @@ +context['generateblocks/queryId'] ) ? 'query-' . $block->context['generateblocks/queryId'] . '-page' : 'query-page'; + $page = empty( $_GET[ $page_key ] ) ? 1 : (int) $_GET[ $page_key ]; // phpcs:ignore -- No data processing happening. + $query_args = GenerateBlocks_Query_Loop::get_query_args( $block, $page ); + + // Override the custom query with the global query if needed. + $use_global_query = ( isset( $block->context['generateblocks/inheritQuery'] ) && $block->context['generateblocks/inheritQuery'] ); + + if ( $use_global_query ) { + global $wp_query; + + if ( $wp_query && isset( $wp_query->query_vars ) && is_array( $wp_query->query_vars ) ) { + // Unset `offset` because if is set, $wp_query overrides/ignores the paged parameter and breaks pagination. + unset( $query_args['offset'] ); + $query_args = wp_parse_args( $wp_query->query_vars, $query_args ); + + if ( empty( $query_args['post_type'] ) && is_singular() ) { + $query_args['post_type'] = get_post_type( get_the_ID() ); + } + } + } + + $query_args = apply_filters( + 'generateblocks_query_loop_args', + $query_args, + $attributes, + $block + ); + + $the_query = new WP_Query( $query_args ); + + $content = ''; + if ( $the_query->have_posts() ) { + while ( $the_query->have_posts() ) { + $the_query->the_post(); + + $block_content = ( + new WP_Block( + $block->parsed_block, + array( + 'postType' => get_post_type(), + 'postId' => get_the_ID(), + ) + ) + )->render( array( 'dynamic' => false ) ); + + $content .= $block_content; + } + } + + $the_query->reset_postdata(); + + return $content; + } +} diff --git a/includes/class-enqueue-css.php b/includes/class-enqueue-css.php index 6a9b887bc..ae9cf14fd 100644 --- a/includes/class-enqueue-css.php +++ b/includes/class-enqueue-css.php @@ -138,6 +138,9 @@ public function enqueue_dynamic_css() { */ public function print_inline_css() { if ( 'inline' === $this->mode() || ! wp_style_is( 'generateblocks', 'enqueued' ) ) { + // Build our CSS based on the content we find. + generateblocks_get_dynamic_css(); + $css = generateblocks_get_frontend_block_css(); if ( empty( $css ) ) { @@ -167,6 +170,9 @@ public function make_css() { return false; } + // Build our CSS based on the content we find. + generateblocks_get_dynamic_css(); + $content = generateblocks_get_frontend_block_css(); if ( ! $content ) { diff --git a/includes/class-render-blocks.php b/includes/class-render-blocks.php index be55774cb..449c99e40 100644 --- a/includes/class-render-blocks.php +++ b/includes/class-render-blocks.php @@ -59,7 +59,7 @@ public function register_blocks() { 'generateblocks/container', array( 'title' => esc_html__( 'Container', 'generateblocks' ), - 'render_callback' => array( $this, 'do_container_block' ), + 'render_callback' => [ 'GenerateBlocks_Block_Container', 'render_block' ], 'editor_script' => 'generateblocks', 'editor_style' => 'generateblocks', ) @@ -69,7 +69,7 @@ public function register_blocks() { 'generateblocks/grid', array( 'title' => esc_html__( 'Grid', 'generateblocks' ), - 'render_callback' => array( $this, 'do_grid_block' ), + 'render_callback' => [ 'GenerateBlocks_Block_Grid', 'render_block' ], 'uses_context' => array( 'generateblocks/query', 'generateblocks/queryId', @@ -81,7 +81,7 @@ public function register_blocks() { 'generateblocks/query-loop', array( 'title' => esc_html__( 'Query loop', 'generateblocks' ), - 'render_callback' => array( $this, 'do_grid_block' ), + 'render_callback' => [ 'GenerateBlocks_Block_Grid', 'render_block' ], 'provides_context' => array( 'generateblocks/query' => 'query', 'generateblocks/queryId' => 'uniqueId', @@ -94,7 +94,7 @@ public function register_blocks() { 'generateblocks/button-container', array( 'title' => esc_html__( 'Buttons', 'generateblocks' ), - 'render_callback' => array( $this, 'do_button_container' ), + 'render_callback' => [ 'GenerateBlocks_Block_Button_Container', 'render_block' ], ) ); @@ -102,7 +102,7 @@ public function register_blocks() { 'generateblocks/headline', array( 'title' => esc_html__( 'Headline', 'generateblocks' ), - 'render_callback' => array( $this, 'do_headline_block' ), + 'render_callback' => [ 'GenerateBlocks_Block_Headline', 'render_block' ], ) ); @@ -110,7 +110,7 @@ public function register_blocks() { 'generateblocks/button', array( 'title' => esc_html__( 'Button', 'generateblocks' ), - 'render_callback' => array( $this, 'do_button_block' ), + 'render_callback' => [ 'GenerateBlocks_Block_Button', 'render_block' ], 'uses_context' => array( 'generateblocks/query', 'generateblocks/queryId', @@ -123,7 +123,7 @@ public function register_blocks() { GENERATEBLOCKS_DIR . 'dist/blocks/image', array( 'title' => esc_html__( 'Image', 'generateblocks' ), - 'render_callback' => array( $this, 'do_image_block' ), + 'render_callback' => [ 'GenerateBlocks_Block_Image', 'render_block' ], 'uses_context' => array( 'generateblocks/query', 'generateblocks/queryId', @@ -134,704 +134,6 @@ public function register_blocks() { ); } - /** - * Output the dynamic aspects of our Container block. - * - * @since 1.2.0 - * @param array $attributes The block attributes. - * @param string $content The inner blocks. - * @param object $block The block data. - */ - public function do_container_block( $attributes, $content, $block ) { - if ( ! isset( $attributes['isDynamic'] ) || ! $attributes['isDynamic'] ) { - return $content; - } - - $defaults = generateblocks_get_block_defaults(); - - $settings = wp_parse_args( - $attributes, - $defaults['container'] - ); - - $output = ''; - - if ( $settings['isGrid'] ) { - $gridItemClassNames = array( - 'gb-grid-column', - 'gb-grid-column-' . $settings['uniqueId'], - ); - - $output .= sprintf( - '
', - generateblocks_attr( - 'grid-item', - array( - 'class' => implode( ' ', $gridItemClassNames ), - ), - $settings, - $block - ) - ); - } - - $classNames = array( - 'gb-container', - 'gb-container-' . $settings['uniqueId'], - ); - - if ( ! empty( $settings['className'] ) ) { - $classNames[] = $settings['className']; - } - - if ( ! $settings['isGrid'] && ! empty( $settings['align'] ) ) { - $classNames[] = 'align' . $settings['align']; - } - - // Pass the dynamic url to our URL attribute. - if ( isset( $settings['url'] ) ) { - if ( $settings['useDynamicData'] && '' !== $settings['dynamicLinkType'] ) { - $attributes['url'] = GenerateBlocks_Dynamic_Content::get_dynamic_url( $settings, $block ); - } - } - - $tagName = apply_filters( - 'generateblocks_container_tagname', - $settings['tagName'], - $attributes, - $block - ); - - $allowedTagNames = apply_filters( - 'generateblocks_container_allowed_tagnames', - array( - 'div', - 'section', - 'header', - 'footer', - 'aside', - 'a', - ), - $attributes, - $block - ); - - if ( ! in_array( $tagName, $allowedTagNames ) ) { - $tagName = 'div'; - } - - $output .= sprintf( - '<%1$s %2$s>', - $tagName, - generateblocks_attr( - 'container', - array( - 'id' => isset( $settings['anchor'] ) ? $settings['anchor'] : null, - 'class' => implode( ' ', $classNames ), - ), - $settings, - $block - ) - ); - - $output = apply_filters( - 'generateblocks_after_container_open', - $output, - $attributes, - $block - ); - - $output .= '
'; - - $output = apply_filters( - 'generateblocks_inside_container', - $output, - $attributes, - $block - ); - - $output .= $content; - $output .= '
'; - - $output = apply_filters( - 'generateblocks_before_container_close', - $output, - $attributes, - $block - ); - - $output .= sprintf( - '', - $tagName - ); - - if ( $settings['isGrid'] ) { - $output .= '
'; - } - - return $output; - } - - /** - * Output the dynamic aspects of our Grid block. - * - * @since 1.2.0 - * @param array $attributes The block attributes. - * @param string $content The inner blocks. - * @param object $block The block data. - */ - public function do_grid_block( $attributes, $content, $block ) { - if ( ! isset( $attributes['isDynamic'] ) || ! $attributes['isDynamic'] ) { - return $content; - } - - $defaults = generateblocks_get_block_defaults(); - - $settings = wp_parse_args( - $attributes, - $defaults['gridContainer'] - ); - - $classNames = array( - 'gb-grid-wrapper', - 'gb-grid-wrapper-' . $settings['uniqueId'], - ); - - if ( ! empty( $settings['className'] ) ) { - $classNames[] = $settings['className']; - } - - $output = sprintf( - '
', - generateblocks_attr( - 'grid-wrapper', - array( - 'id' => isset( $settings['anchor'] ) ? $settings['anchor'] : null, - 'class' => implode( ' ', $classNames ), - ), - $settings, - $block - ) - ); - - if ( empty( $attributes['isQueryLoop'] ) ) { - $output .= $content; - } else { - $output .= $this->do_post_template( $attributes, $content, $block ); - } - - $output .= '
'; - - return $output; - } - - /** - * Output the dynamic aspects of our Button Container block. - * - * @since 1.2.0 - * @param array $attributes The block attributes. - * @param string $content The inner blocks. - * @param object $block The block data. - */ - public function do_button_container( $attributes, $content, $block ) { - if ( ! isset( $attributes['isDynamic'] ) || ! $attributes['isDynamic'] ) { - return $content; - } - - if ( isset( $block->parsed_block['innerBlocks'] ) ) { - $button_count = apply_filters( - 'generateblocks_button_count', - count( (array) $block->parsed_block['innerBlocks'] ), - $attributes, - $block - ); - - if ( 0 === $button_count ) { - return; - } - } - - $defaults = generateblocks_get_block_defaults(); - - $settings = wp_parse_args( - $attributes, - $defaults['buttonContainer'] - ); - - $classNames = array( - 'gb-button-wrapper', - 'gb-button-wrapper-' . $settings['uniqueId'], - ); - - if ( ! empty( $settings['className'] ) ) { - $classNames[] = $settings['className']; - } - - $output = sprintf( - '
', - generateblocks_attr( - 'button-container', - array( - 'id' => isset( $settings['anchor'] ) ? $settings['anchor'] : null, - 'class' => implode( ' ', $classNames ), - ), - $settings, - $block - ) - ); - - $output .= $content; - - $output .= '
'; - - return $output; - } - - /** - * Output the query. - * - * @param array $attributes The block attributes. - * @param string $content The inner blocks. - * @param WP_Block $block Block instance. - */ - public function do_post_template( $attributes, $content, $block ) { - $page_key = isset( $block->context['generateblocks/queryId'] ) ? 'query-' . $block->context['generateblocks/queryId'] . '-page' : 'query-page'; - $page = empty( $_GET[ $page_key ] ) ? 1 : (int) $_GET[ $page_key ]; // phpcs:ignore -- No data processing happening. - $query_args = GenerateBlocks_Query_Loop::get_query_args( $block, $page ); - - // Override the custom query with the global query if needed. - $use_global_query = ( isset( $block->context['generateblocks/inheritQuery'] ) && $block->context['generateblocks/inheritQuery'] ); - - if ( $use_global_query ) { - global $wp_query; - - if ( $wp_query && isset( $wp_query->query_vars ) && is_array( $wp_query->query_vars ) ) { - // Unset `offset` because if is set, $wp_query overrides/ignores the paged parameter and breaks pagination. - unset( $query_args['offset'] ); - $query_args = wp_parse_args( $wp_query->query_vars, $query_args ); - - if ( empty( $query_args['post_type'] ) && is_singular() ) { - $query_args['post_type'] = get_post_type( get_the_ID() ); - } - } - } - - $query_args = apply_filters( - 'generateblocks_query_loop_args', - $query_args, - $attributes, - $block - ); - - $the_query = new WP_Query( $query_args ); - - $content = ''; - if ( $the_query->have_posts() ) { - while ( $the_query->have_posts() ) { - $the_query->the_post(); - - $block_content = ( - new WP_Block( - $block->parsed_block, - array( - 'postType' => get_post_type(), - 'postId' => get_the_ID(), - ) - ) - )->render( array( 'dynamic' => false ) ); - - $content .= $block_content; - } - } - - $the_query->reset_postdata(); - - return $content; - } - - /** - * Wrapper function for our dynamic headlines. - * - * @since 1.5.0 - * @param array $attributes The block attributes. - * @param string $content The dynamic text to display. - * @param WP_Block $block Block instance. - */ - public static function do_headline_block( $attributes, $content, $block ) { - if ( ! isset( $attributes['useDynamicData'] ) || ! $attributes['useDynamicData'] ) { - return $content; - } - - $allow_empty_content = false; - - if ( empty( $attributes['dynamicContentType'] ) ) { - $dynamic_content = GenerateBlocks_Dynamic_Content::get_static_content( $content ); - - if ( ! empty( $attributes['hasIcon'] ) && ! empty( $attributes['removeText'] ) ) { - // Allow icon-only items to continue. - $allow_empty_content = true; - } - } else { - $dynamic_content = GenerateBlocks_Dynamic_Content::get_content( $attributes, $block ); - } - - if ( ! $dynamic_content && '0' !== $dynamic_content && ! $allow_empty_content ) { - return ''; - } - - $defaults = generateblocks_get_block_defaults(); - - $settings = wp_parse_args( - $attributes, - $defaults['headline'] - ); - - $classNames = array( - 'gb-headline', - 'gb-headline-' . $settings['uniqueId'], - ); - - if ( ! empty( $settings['className'] ) ) { - $classNames[] = $settings['className']; - } - - if ( empty( $settings['icon'] ) ) { - $classNames[] = 'gb-headline-text'; - } - - $tagName = apply_filters( - 'generateblocks_dynamic_headline_tagname', - $settings['element'], - $attributes, - $block - ); - - $allowedTagNames = apply_filters( - 'generateblocks_dynamic_headline_allowed_tagnames', - array( - 'h1', - 'h2', - 'h3', - 'h4', - 'h5', - 'h6', - 'div', - 'p', - 'figcaption', - ), - $attributes, - $block - ); - - if ( ! in_array( $tagName, $allowedTagNames ) ) { - $tagName = 'div'; - } - - $output = sprintf( - '<%1$s %2$s>', - $tagName, - generateblocks_attr( - 'dynamic-headline', - array( - 'id' => isset( $settings['anchor'] ) ? $settings['anchor'] : null, - 'class' => implode( ' ', $classNames ), - ), - $settings, - $block - ) - ); - - $icon_html = ''; - - // Extract our icon from the static HTML. - if ( $settings['hasIcon'] ) { - $icon_html = GenerateBlocks_Dynamic_Content::get_icon_html( $content ); - - if ( $icon_html ) { - $output .= $icon_html; - $output .= ''; - } - } - - $dynamic_link = GenerateBlocks_Dynamic_Content::get_dynamic_url( $attributes, $block ); - - if ( $dynamic_link ) { - $dynamic_content = sprintf( - '%s', - $dynamic_link, - $dynamic_content - ); - } - - $output .= $dynamic_content; - - if ( $icon_html ) { - $output .= ''; - } - - $output .= sprintf( - '', - $tagName - ); - - return $output; - } - - /** - * Wrapper function for our dynamic buttons. - * - * @since 1.5.0 - * @param array $attributes The block attributes. - * @param string $content The dynamic text to display. - * @param WP_Block $block Block instance. - */ - public static function do_button_block( $attributes, $content, $block ) { - if ( ! isset( $attributes['useDynamicData'] ) || ! $attributes['useDynamicData'] ) { - return $content; - } - - $allow_empty_content = false; - - // Add an attribute showing we're working with the Button block. - $attributes['isButton'] = true; - - if ( empty( $attributes['dynamicContentType'] ) ) { - $dynamic_content = GenerateBlocks_Dynamic_Content::get_static_content( $content ); - - if ( ! empty( $attributes['hasIcon'] ) && ! empty( $attributes['removeText'] ) ) { - // Allow icon-only items to continue. - $allow_empty_content = true; - } - } else { - $dynamic_content = GenerateBlocks_Dynamic_Content::get_content( $attributes, $block ); - } - - if ( ! $dynamic_content && '0' !== $dynamic_content && ! $allow_empty_content ) { - return ''; - } - - $defaults = generateblocks_get_block_defaults(); - - $settings = wp_parse_args( - $attributes, - $defaults['button'] - ); - - $classNames = array( - 'gb-button', - 'gb-button-' . $settings['uniqueId'], - ); - - if ( ! empty( $settings['className'] ) ) { - $classNames[] = $settings['className']; - } - - if ( empty( $settings['icon'] ) ) { - $classNames[] = 'gb-button-text'; - } - - $relAttributes = array(); - - if ( ! empty( $settings['relNoFollow'] ) ) { - $relAttributes[] = 'nofollow'; - } - - if ( ! empty( $settings['target'] ) ) { - $relAttributes[] = 'noopener'; - $relAttributes[] = 'noreferrer'; - } - - if ( ! empty( $settings['relSponsored'] ) ) { - $relAttributes[] = 'sponsored'; - } - - $icon_html = ''; - - // Extract our icon from the static HTML. - if ( $settings['hasIcon'] ) { - $icon_html = GenerateBlocks_Dynamic_Content::get_icon_html( $content ); - } - - $output = ''; - - foreach ( (array) $dynamic_content as $content ) { - $tagName = 'span'; - - $dynamic_link = GenerateBlocks_Dynamic_Content::get_dynamic_url( $attributes, $block ); - - if ( isset( $content['attributes']['href'] ) || $dynamic_link ) { - $tagName = 'a'; - } - - $button_attributes = array( - 'id' => isset( $settings['anchor'] ) ? $settings['anchor'] : null, - 'class' => implode( ' ', $classNames ), - 'href' => 'a' === $tagName ? $dynamic_link : null, - 'rel' => ! empty( $relAttributes ) ? implode( ' ', $relAttributes ) : null, - 'target' => ! empty( $settings['target'] ) ? '_blank' : null, - ); - - if ( isset( $content['attributes'] ) ) { - foreach ( $content['attributes'] as $attribute => $value ) { - if ( 'class' === $attribute ) { - $button_attributes[ $attribute ] .= ' ' . $value; - } else { - $button_attributes[ $attribute ] = $value; - } - } - } - - $output .= sprintf( - '<%1$s %2$s>', - $tagName, - generateblocks_attr( - 'dynamic-button', - $button_attributes, - $settings, - $block - ) - ); - - if ( $icon_html ) { - if ( 'left' === $settings['iconLocation'] ) { - $output .= $icon_html; - } - - $output .= ''; - } - - if ( isset( $content['content'] ) ) { - $output .= $content['content']; - } else { - $output .= $content; - } - - if ( $icon_html ) { - $output .= ''; - - if ( 'right' === $settings['iconLocation'] ) { - $output .= $icon_html; - } - } - - $output .= sprintf( - '', - $tagName - ); - } - - return $output; - } - - /** - * Wrapper function for our image block. - * - * @since 1.5.0 - * @param array $attributes The block attributes. - * @param string $content The dynamic text to display. - * @param WP_Block $block Block instance. - */ - public static function do_image_block( $attributes, $content, $block ) { - if ( empty( $attributes['useDynamicData'] ) ) { - return generateblocks_filter_images( $content, $attributes ); - } - - $image = empty( $attributes['dynamicContentType'] ) - ? generateblocks_filter_images( GenerateBlocks_Dynamic_Content::get_static_content( $content ), $attributes ) - : GenerateBlocks_Dynamic_Content::get_dynamic_image( $attributes, $block ); - - if ( ! $image ) { - return ''; - } - - $defaults = generateblocks_get_block_defaults(); - - $settings = wp_parse_args( - $attributes, - $defaults['image'] - ); - - $output = sprintf( - '
', - generateblocks_attr( - 'image-figure', - array( - 'class' => implode( - ' ', - array( - 'gb-block-image', - 'gb-block-image-' . $settings['uniqueId'], - ) - ), - ), - $settings, - $block - ) - ); - - $dynamic_link = GenerateBlocks_Dynamic_Content::get_dynamic_url( $attributes, $block ); - - if ( $dynamic_link ) { - $relAttributes = array(); - - if ( ! empty( $settings['relNoFollow'] ) ) { - $relAttributes[] = 'nofollow'; - } - - if ( ! empty( $settings['openInNewWindow'] ) ) { - $relAttributes[] = 'noopener'; - $relAttributes[] = 'noreferrer'; - } - - if ( ! empty( $settings['relSponsored'] ) ) { - $relAttributes[] = 'sponsored'; - } - - $dynamic_link_data = array( - 'href' => $dynamic_link, - 'rel' => ! empty( $relAttributes ) ? implode( ' ', $relAttributes ) : null, - 'target' => ! empty( $settings['openInNewWindow'] ) ? '_blank' : null, - ); - - $dynamic_link_attributes = ''; - - foreach ( $dynamic_link_data as $attribute => $value ) { - $dynamic_link_attributes .= sprintf( - ' %s="%s"', - $attribute, - $value - ); - } - - $image = sprintf( - '%s', - trim( $dynamic_link_attributes ), - $image - ); - } - - $output .= $image; - - if ( isset( $block->parsed_block['innerBlocks'][0]['attrs'] ) ) { - $image_id = GenerateBlocks_Dynamic_Content::get_dynamic_image_id( $attributes ); - $block->parsed_block['innerBlocks'][0]['attrs']['dynamicImage'] = $image_id; - - $caption = ( - new WP_Block( - $block->parsed_block['innerBlocks'][0] - ) - )->render( array( 'dynamic' => true ) ); - - if ( $caption ) { - $output .= $caption; - } - } - - $output .= '
'; - - return $output; - } - /** * Filter existing rendered blocks. * diff --git a/includes/defaults.php b/includes/defaults.php index 9d1ec5589..c2a1ae9a6 100644 --- a/includes/defaults.php +++ b/includes/defaults.php @@ -17,483 +17,17 @@ * @return array */ function generateblocks_get_block_defaults() { - $defaults = array(); - - $container_width = generateblocks_get_option( 'container_width' ); - - if ( function_exists( 'generate_get_option' ) ) { - $container_width = generate_get_option( 'container_width' ); - } - - $defaults['container'] = array( - 'tagName' => 'div', - 'isGrid' => false, - 'containerWidth' => $container_width, - 'outerContainer' => 'full', - 'innerContainer' => 'contained', - 'minHeight' => false, - 'minHeightUnit' => 'px', - 'minHeightTablet' => false, - 'minHeightUnitTablet' => 'px', - 'minHeightMobile' => false, - 'minHeightUnitMobile' => 'px', - 'paddingTop' => '', - 'paddingRight' => '', - 'paddingBottom' => '', - 'paddingLeft' => '', - 'paddingUnit' => 'px', - 'paddingTopTablet' => '', - 'paddingRightTablet' => '', - 'paddingBottomTablet' => '', - 'paddingLeftTablet' => '', - 'paddingTopMobile' => '', - 'paddingRightMobile' => '', - 'paddingBottomMobile' => '', - 'paddingLeftMobile' => '', - 'marginTop' => '', - 'marginRight' => '', - 'marginBottom' => '', - 'marginLeft' => '', - 'marginUnit' => 'px', - 'marginTopTablet' => '', - 'marginRightTablet' => '', - 'marginBottomTablet' => '', - 'marginLeftTablet' => '', - 'marginTopMobile' => '', - 'marginRightMobile' => '', - 'marginBottomMobile' => '', - 'marginLeftMobile' => '', - 'borderSizeTop' => '', - 'borderSizeRight' => '', - 'borderSizeBottom' => '', - 'borderSizeLeft' => '', - 'borderSizeTopTablet' => '', - 'borderSizeRightTablet' => '', - 'borderSizeBottomTablet' => '', - 'borderSizeLeftTablet' => '', - 'borderSizeTopMobile' => '', - 'borderSizeRightMobile' => '', - 'borderSizeBottomMobile' => '', - 'borderSizeLeftMobile' => '', - 'borderRadiusTopRight' => '', - 'borderRadiusBottomRight' => '', - 'borderRadiusBottomLeft' => '', - 'borderRadiusTopLeft' => '', - 'borderRadiusUnit' => 'px', - 'borderRadiusTopRightTablet' => '', - 'borderRadiusBottomRightTablet' => '', - 'borderRadiusBottomLeftTablet' => '', - 'borderRadiusTopLeftTablet' => '', - 'borderRadiusTopRightMobile' => '', - 'borderRadiusBottomRightMobile' => '', - 'borderRadiusBottomLeftMobile' => '', - 'borderRadiusTopLeftMobile' => '', - 'borderColor' => '', - 'borderColorOpacity' => 1, - 'backgroundColor' => '', - 'backgroundColorOpacity' => 1, - 'gradient' => false, - 'gradientDirection' => '', - 'gradientColorOne' => '', - 'gradientColorOneOpacity' => '', - 'gradientColorStopOne' => '', - 'gradientColorTwo' => '', - 'gradientColorTwoOpacity' => '', - 'gradientColorStopTwo' => '', - 'gradientSelector' => 'element', - 'textColor' => '', - 'linkColor' => '', - 'linkColorHover' => '', - 'bgImage' => '', - 'bgOptions' => array( - 'selector' => 'element', - 'opacity' => 1, - 'overlay' => false, - 'position' => 'center center', - 'size' => 'cover', - 'repeat' => 'no-repeat', - 'attachment' => '', - ), - 'bgImageSize' => 'full', - 'bgImageInline' => false, - 'width' => '', - 'widthTablet' => '', - 'widthMobile' => '', - 'autoWidth' => false, - 'autoWidthTablet' => false, - 'autoWidthMobile' => false, - 'flexGrow' => '', - 'flexGrowTablet' => '', - 'flexGrowMobile' => '', - 'flexShrink' => '', - 'flexShrinkTablet' => '', - 'flexShrinkMobile' => '', - 'flexBasis' => '', - 'flexBasisTablet' => '', - 'flexBasisMobile' => '', - 'flexBasisUnit' => 'px', - 'verticalAlignment' => '', - 'verticalAlignmentTablet' => 'inherit', - 'verticalAlignmentMobile' => 'inherit', - 'zindex' => '', - 'innerZindex' => '', - 'removeVerticalGap' => false, - 'removeVerticalGapTablet' => false, - 'removeVerticalGapMobile' => false, - 'orderTablet' => false, - 'orderMobile' => false, - 'alignment' => '', - 'alignmentTablet' => '', - 'alignmentMobile' => '', - 'fontFamily' => '', - 'fontFamilyFallback' => '', - 'googleFont' => false, - 'googleFontVariants' => '', - 'fontWeight' => '', - 'fontSize' => '', - 'fontSizeTablet' => '', - 'fontSizeMobile' => '', - 'fontSizeUnit' => 'px', - 'textTransform' => '', - ); - - $defaults['buttonContainer'] = array( - 'alignment' => '', - 'alignmentTablet' => '', - 'alignmentMobile' => '', - 'marginTop' => '', - 'marginRight' => '', - 'marginBottom' => '', - 'marginLeft' => '', - 'marginTopTablet' => '', - 'marginRightTablet' => '', - 'marginBottomTablet' => '', - 'marginLeftTablet' => '', - 'marginTopMobile' => '', - 'marginRightMobile' => '', - 'marginBottomMobile' => '', - 'marginLeftMobile' => '', - 'marginUnit' => 'px', - 'stack' => false, - 'stackTablet' => false, - 'stackMobile' => false, - 'fillHorizontalSpace' => false, - 'fillHorizontalSpaceTablet' => false, - 'fillHorizontalSpaceMobile' => false, - ); - - $defaults['button'] = array( - 'backgroundColor' => false, - 'backgroundColorOpacity' => 1, - 'backgroundColorHover' => false, - 'backgroundColorHoverOpacity' => 1, - 'backgroundColorCurrent' => '', - 'textColor' => false, - 'textColorHover' => false, - 'textColorCurrent' => '', - 'borderColor' => false, - 'borderColorOpacity' => 1, - 'borderColorHover' => false, - 'borderColorHoverOpacity' => 1, - 'borderColorCurrent' => false, - 'fontFamily' => '', - 'fontFamilyFallback' => '', - 'googleFont' => false, - 'googleFontVariants' => '', - 'fontWeight' => '', - 'fontSize' => false, - 'fontSizeTablet' => false, - 'fontSizeMobile' => false, - 'fontSizeUnit' => 'px', - 'textTransform' => '', - 'letterSpacing' => '', - 'letterSpacingTablet' => '', - 'letterSpacingMobile' => '', - 'marginTop' => '', - 'marginRight' => '', - 'marginBottom' => '', - 'marginLeft' => '', - 'marginTopTablet' => '', - 'marginRightTablet' => '', - 'marginBottomTablet' => '', - 'marginLeftTablet' => '', - 'marginTopMobile' => '', - 'marginRightMobile' => '', - 'marginBottomMobile' => '', - 'marginLeftMobile' => '', - 'marginUnit' => 'px', - 'paddingTop' => '', - 'paddingRight' => '', - 'paddingBottom' => '', - 'paddingLeft' => '', - 'paddingTopTablet' => '', - 'paddingRightTablet' => '', - 'paddingBottomTablet' => '', - 'paddingLeftTablet' => '', - 'paddingTopMobile' => '', - 'paddingRightMobile' => '', - 'paddingBottomMobile' => '', - 'paddingLeftMobile' => '', - 'paddingUnit' => 'px', - 'borderSizeTop' => '', - 'borderSizeRight' => '', - 'borderSizeBottom' => '', - 'borderSizeLeft' => '', - 'borderSizeTopTablet' => '', - 'borderSizeRightTablet' => '', - 'borderSizeBottomTablet' => '', - 'borderSizeLeftTablet' => '', - 'borderSizeTopMobile' => '', - 'borderSizeRightMobile' => '', - 'borderSizeBottomMobile' => '', - 'borderSizeLeftMobile' => '', - 'borderRadiusTopRight' => '', - 'borderRadiusBottomRight' => '', - 'borderRadiusBottomLeft' => '', - 'borderRadiusTopLeft' => '', - 'borderRadiusTopRightTablet' => '', - 'borderRadiusBottomRightTablet' => '', - 'borderRadiusBottomLeftTablet' => '', - 'borderRadiusTopLeftTablet' => '', - 'borderRadiusTopRightMobile' => '', - 'borderRadiusBottomRightMobile' => '', - 'borderRadiusBottomLeftMobile' => '', - 'borderRadiusTopLeftMobile' => '', - 'borderRadiusUnit' => 'px', - 'icon' => '', - 'hasIcon' => false, - 'iconLocation' => 'left', - 'removeText' => false, - 'ariaLabel' => '', - 'gradient' => false, - 'gradientDirection' => '', - 'gradientColorOne' => '', - 'gradientColorOneOpacity' => '', - 'gradientColorStopOne' => '', - 'gradientColorTwo' => '', - 'gradientColorTwoOpacity' => '', - 'gradientColorStopTwo' => '', - 'iconPaddingTop' => '', - 'iconPaddingRight' => '0.5', - 'iconPaddingBottom' => '', - 'iconPaddingLeft' => '', - 'iconPaddingTopTablet' => '', - 'iconPaddingRightTablet' => '', - 'iconPaddingBottomTablet' => '', - 'iconPaddingLeftTablet' => '', - 'iconPaddingTopMobile' => '', - 'iconPaddingRightMobile' => '', - 'iconPaddingBottomMobile' => '', - 'iconPaddingLeftMobile' => '', - 'iconPaddingUnit' => 'em', - 'iconSize' => 1, - 'iconSizeTablet' => '', - 'iconSizeMobile' => '', - 'iconSizeUnit' => 'em', - ); - - $defaults['gridContainer'] = array( - 'horizontalGap' => '', - 'verticalGap' => '', - 'verticalAlignment' => '', - 'horizontalGapTablet' => '', - 'verticalGapTablet' => '', - 'verticalAlignmentTablet' => 'inherit', - 'horizontalGapMobile' => '', - 'verticalGapMobile' => '', - 'verticalAlignmentMobile' => 'inherit', - 'horizontalAlignment' => '', - 'horizontalAlignmentTablet' => '', - 'horizontalAlignmentMobile' => '', - ); - - $defaults['headline'] = array( - 'element' => 'h2', - 'cssClasses' => '', - 'alignment' => false, - 'alignmentTablet' => false, - 'alignmentMobile' => false, - 'backgroundColor' => false, - 'backgroundColorOpacity' => 1, - 'textColor' => false, - 'linkColor' => false, - 'linkColorHover' => false, - 'borderColor' => false, - 'borderColorOpacity' => 1, - 'highlightTextColor' => false, - 'fontFamily' => '', - 'fontFamilyFallback' => '', - 'googleFont' => false, - 'googleFontVariants' => '', - 'fontWeight' => '', - 'fontSize' => '', - 'fontSizeTablet' => '', - 'fontSizeMobile' => '', - 'fontSizeUnit' => 'px', - 'textTransform' => '', - 'lineHeight' => '', - 'lineHeightTablet' => '', - 'lineHeightMobile' => '', - 'lineHeightUnit' => 'em', - 'letterSpacing' => '', - 'letterSpacingTablet' => '', - 'letterSpacingMobile' => '', - 'marginTop' => '', - 'marginRight' => '', - 'marginBottom' => '', - 'marginLeft' => '', - 'marginTopTablet' => '', - 'marginRightTablet' => '', - 'marginBottomTablet' => '', - 'marginLeftTablet' => '', - 'marginTopMobile' => '', - 'marginRightMobile' => '', - 'marginBottomMobile' => '', - 'marginLeftMobile' => '', - 'marginUnit' => 'px', - 'paddingTop' => '', - 'paddingRight' => '', - 'paddingBottom' => '', - 'paddingLeft' => '', - 'paddingTopTablet' => '', - 'paddingRightTablet' => '', - 'paddingBottomTablet' => '', - 'paddingLeftTablet' => '', - 'paddingTopMobile' => '', - 'paddingRightMobile' => '', - 'paddingBottomMobile' => '', - 'paddingLeftMobile' => '', - 'paddingUnit' => 'px', - 'borderSizeTop' => '', - 'borderSizeRight' => '', - 'borderSizeBottom' => '', - 'borderSizeLeft' => '', - 'borderSizeTopTablet' => '', - 'borderSizeRightTablet' => '', - 'borderSizeBottomTablet' => '', - 'borderSizeLeftTablet' => '', - 'borderSizeTopMobile' => '', - 'borderSizeRightMobile' => '', - 'borderSizeBottomMobile' => '', - 'borderSizeLeftMobile' => '', - 'borderRadiusTopRight' => '', - 'borderRadiusBottomRight' => '', - 'borderRadiusBottomLeft' => '', - 'borderRadiusTopLeft' => '', - 'borderRadiusTopRightTablet' => '', - 'borderRadiusBottomRightTablet' => '', - 'borderRadiusBottomLeftTablet' => '', - 'borderRadiusTopLeftTablet' => '', - 'borderRadiusTopRightMobile' => '', - 'borderRadiusBottomRightMobile' => '', - 'borderRadiusBottomLeftMobile' => '', - 'borderRadiusTopLeftMobile' => '', - 'borderRadiusUnit' => 'px', - 'icon' => '', - 'hasIcon' => false, - 'iconColor' => false, - 'iconColorOpacity' => 1, - 'iconLocation' => 'inline', - 'iconLocationTablet' => '', - 'iconLocationMobile' => '', - 'iconVerticalAlignment' => 'center', - 'iconVerticalAlignmentTablet' => '', - 'iconVerticalAlignmentMobile' => '', - 'iconPaddingTop' => '', - 'iconPaddingRight' => '0.5', - 'iconPaddingBottom' => '', - 'iconPaddingLeft' => '', - 'iconPaddingTopTablet' => '', - 'iconPaddingRightTablet' => '', - 'iconPaddingBottomTablet' => '', - 'iconPaddingLeftTablet' => '', - 'iconPaddingTopMobile' => '', - 'iconPaddingRightMobile' => '', - 'iconPaddingBottomMobile' => '', - 'iconPaddingLeftMobile' => '', - 'iconPaddingUnit' => 'em', - 'iconSize' => 1, - 'iconSizeTablet' => '', - 'iconSizeMobile' => '', - 'iconSizeUnit' => 'em', - 'inlineWidth' => false, - 'inlineWidthTablet' => false, - 'inlineWidthMobile' => false, - 'removeText' => false, - 'ariaLabel' => '', - ); - - $defaults['image'] = array( - 'mediaId' => '', - 'sizeSlug' => '', - 'width' => '', - 'widthTablet' => '', - 'widthMobile' => '', - 'height' => '', - 'heightTablet' => '', - 'heightMobile' => '', - 'marginTop' => '', - 'marginRight' => '', - 'marginBottom' => '', - 'marginLeft' => '', - 'marginTopTablet' => '', - 'marginRightTablet' => '', - 'marginBottomTablet' => '', - 'marginLeftTablet' => '', - 'marginTopMobile' => '', - 'marginRightMobile' => '', - 'marginBottomMobile' => '', - 'marginLeftMobile' => '', - 'marginUnit' => 'px', - 'paddingTop' => '', - 'paddingRight' => '', - 'paddingBottom' => '', - 'paddingLeft' => '', - 'paddingTopTablet' => '', - 'paddingRightTablet' => '', - 'paddingBottomTablet' => '', - 'paddingLeftTablet' => '', - 'paddingTopMobile' => '', - 'paddingRightMobile' => '', - 'paddingBottomMobile' => '', - 'paddingLeftMobile' => '', - 'paddingUnit' => 'px', - 'borderColor' => '', - 'borderSizeTop' => '', - 'borderSizeRight' => '', - 'borderSizeBottom' => '', - 'borderSizeLeft' => '', - 'borderSizeTopTablet' => '', - 'borderSizeRightTablet' => '', - 'borderSizeBottomTablet' => '', - 'borderSizeLeftTablet' => '', - 'borderSizeTopMobile' => '', - 'borderSizeRightMobile' => '', - 'borderSizeBottomMobile' => '', - 'borderSizeLeftMobile' => '', - 'borderRadiusTopRight' => '', - 'borderRadiusBottomRight' => '', - 'borderRadiusBottomLeft' => '', - 'borderRadiusTopLeft' => '', - 'borderRadiusTopRightTablet' => '', - 'borderRadiusBottomRightTablet' => '', - 'borderRadiusBottomLeftTablet' => '', - 'borderRadiusTopLeftTablet' => '', - 'borderRadiusTopRightMobile' => '', - 'borderRadiusBottomRightMobile' => '', - 'borderRadiusBottomLeftMobile' => '', - 'borderRadiusTopLeftMobile' => '', - 'borderRadiusUnit' => 'px', - 'objectFit' => '', - 'objectFitTablet' => '', - 'objectFitMobile' => '', - 'align' => '', - 'alignment' => '', - 'alignmentTablet' => '', - 'alignmentMobile' => '', + return apply_filters( + 'generateblocks_defaults', + [ + 'container' => GenerateBlocks_Block_Container::defaults(), + 'buttonContainer' => GenerateBlocks_Block_Button_Container::defaults(), + 'button' => GenerateBlocks_Block_Button::defaults(), + 'gridContainer' => GenerateBlocks_Block_Grid::defaults(), + 'headline' => GenerateBlocks_Block_Headline::defaults(), + 'image' => GenerateBlocks_Block_Image::defaults(), + ] ); - - return apply_filters( 'generateblocks_defaults', $defaults ); } /** diff --git a/includes/functions.php b/includes/functions.php index 57e89a5da..fd253ef7d 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -893,3 +893,324 @@ function generateblocks_filter_images( $content, $attributes ) { return $content; } + +/** + * Compile our CSS based on our CSS data. + * + * @since 1.6.0 + * @param array $manual_data CSS data input directly to the function. + */ +function generateblocks_get_compiled_css( $manual_data = [] ) { + $data = apply_filters( 'generateblocks_css_data', [] ); + + // Allows us to input manual data if necessary. + if ( count( (array) $manual_data ) > 0 ) { + $data = $manual_data; + } + + $css = ''; + + if ( ! empty( $data['main'] ) ) { + $css .= $data['main']; + } + + if ( ! empty( $data['desktop'] ) ) { + $css .= sprintf( + '@media %1$s {%2$s}', + generateblocks_get_media_query( 'desktop' ), + $data['desktop'] + ); + } + + if ( ! empty( $data['tablet'] ) ) { + $css .= sprintf( + '@media %1$s {%2$s}', + generateblocks_get_media_query( 'tablet' ), + $data['tablet'] + ); + } + + if ( ! empty( $data['tablet_only'] ) ) { + $css .= sprintf( + '@media %1$s {%2$s}', + generateblocks_get_media_query( 'tablet_only' ), + $data['tablet_only'] + ); + } + + if ( ! empty( $data['mobile'] ) ) { + $css .= sprintf( + '@media %1$s {%2$s}', + generateblocks_get_media_query( 'mobile' ), + $data['mobile'] + ); + } + + return $css; +} + +/** + * This is a helper function that groups our static CSS into device-specific groups. + * + * @since 1.6.0 + * @param array $existing_data An array of existing data to add to. + * @param array $new_data The new data we wish to group. + */ +function generateblocks_group_css_data( $existing_data = [], $new_data ) { + $existing_data = wp_parse_args( + $existing_data, + [ + 'main' => '', + 'desktop' => '', + 'tablet' => '', + 'tablet_only' => '', + 'mobile' => '', + ] + ); + + $existing_data['main'] .= generateblocks_get_parsed_css( $new_data['main'] ); + $existing_data['desktop'] .= generateblocks_get_parsed_css( $new_data['desktop'] ); + $existing_data['tablet'] .= generateblocks_get_parsed_css( $new_data['tablet'] ); + $existing_data['tablet_only'] .= generateblocks_get_parsed_css( $new_data['tablet_only'] ); + $existing_data['mobile'] .= generateblocks_get_parsed_css( $new_data['mobile'] ); + + return $existing_data; +} + +/** + * Output our CSS inline or within wp_head. + * + * This is a fallback in case we aren't able to find + * our blocks in generateblocks_get_parsed_content(). + * + * @since 1.6.0 + * @param string $content Our block content. + * @param array $css_data Our CSS data. + */ +function generateblocks_do_inline_css_output( $content, $css_data ) { + if ( did_action( 'wp_head' ) ) { + // Add inline ', + $compiled_css + ) . $content; + } + } else { + // Add our CSS to the pool of existing CSS in wp_head. + generateblocks_add_to_css_data( $css_data ); + } + + return $content; +} + +/** + * Turn our CSS array into plain CSS. + * + * @since 1.0 + * @param array $data Our CSS data. + */ +function generateblocks_get_parsed_css( $data ) { + $output = ''; + + foreach ( $data as $selector => $properties ) { + if ( ! count( $properties ) ) { + continue; + } + + $temporary_output = $selector . '{'; + $elements_added = 0; + + foreach ( $properties as $key => $value ) { + if ( empty( $value ) ) { + continue; + } + + $elements_added++; + $temporary_output .= $value; + } + + $temporary_output .= '}'; + + if ( $elements_added > 0 ) { + $output .= $temporary_output; + } + } + + return $output; +} + +/** + * Build the CSS from our block attributes. + * + * @since 0.1 + * @param string $content The content we're looking through. + * + * @return string The dynamic CSS. + */ +function generateblocks_get_dynamic_css( $content = '' ) { + if ( ! $content ) { + $content = generateblocks_get_parsed_content(); + } + + $data = generateblocks_get_block_data( $content ); + + if ( empty( $data ) ) { + return; + } + + foreach ( $data as $name => $blockData ) { + /** + * Get our Grid block CSS. + * + * @since 0.1 + */ + if ( 'grid' === $name ) { + if ( empty( $blockData ) ) { + continue; + } + + foreach ( $blockData as $atts ) { + if ( ! isset( $atts['uniqueId'] ) ) { + continue; + } + + generateblocks_add_to_css_data( + GenerateBlocks_Block_Grid::get_css_data( $atts ) + ); + } + } + + /** + * Get our Container block CSS. + * + * @since 0.1 + */ + if ( 'container' === $name ) { + if ( empty( $blockData ) ) { + continue; + } + + foreach ( $blockData as $atts ) { + if ( ! isset( $atts['uniqueId'] ) ) { + continue; + } + + generateblocks_add_to_css_data( + GenerateBlocks_Block_Container::get_css_data( $atts ) + ); + } + } + + /** + * Get our Button Container block CSS. + * + * @since 0.1 + */ + if ( 'button-container' === $name ) { + if ( empty( $blockData ) ) { + continue; + } + + foreach ( $blockData as $atts ) { + if ( ! isset( $atts['uniqueId'] ) ) { + continue; + } + + generateblocks_add_to_css_data( + GenerateBlocks_Block_Button_Container::get_css_data( $atts ) + ); + } + } + + /** + * Get our Button block CSS. + * + * @since 0.1 + */ + if ( 'button' === $name ) { + if ( empty( $blockData ) ) { + continue; + } + + foreach ( $blockData as $atts ) { + if ( ! isset( $atts['uniqueId'] ) ) { + continue; + } + + generateblocks_add_to_css_data( + GenerateBlocks_Block_Button::get_css_data( $atts ) + ); + } + } + + /** + * Get our Headline block CSS. + * + * @since 0.1 + */ + if ( 'headline' === $name ) { + if ( empty( $blockData ) ) { + continue; + } + + foreach ( $blockData as $atts ) { + if ( ! isset( $atts['uniqueId'] ) ) { + continue; + } + + generateblocks_add_to_css_data( + GenerateBlocks_Block_Headline::get_css_data( $atts ) + ); + } + } + + /** + * Get our Image block CSS. + * + * @since 1.5.0 + */ + if ( 'image' === $name ) { + if ( empty( $blockData ) ) { + continue; + } + + foreach ( $blockData as $atts ) { + if ( ! isset( $atts['uniqueId'] ) ) { + continue; + } + + generateblocks_add_to_css_data( + GenerateBlocks_Block_Image::get_css_data( $atts ) + ); + } + } + } +} + +/** + * Print our CSS for each block. + * + * @since 0.1 + */ +function generateblocks_get_frontend_block_css() { + return apply_filters( 'generateblocks_css_output', generateblocks_get_compiled_css() ); +} + +/** + * Add block CSS to our pool of generated CSS. + * + * @since 1.6.0 + * @param array $data Our CSS data. + */ +function generateblocks_add_to_css_data( $data ) { + add_filter( + 'generateblocks_css_data', + function( $css_data ) use ( $data ) { + return generateblocks_group_css_data( $css_data, $data ); + } + ); +} diff --git a/includes/generate-css.php b/includes/generate-css.php deleted file mode 100644 index 20bfebdc5..000000000 --- a/includes/generate-css.php +++ /dev/null @@ -1,1905 +0,0 @@ - $blockData ) { - /** - * Get our Grid block CSS. - * - * @since 0.1 - */ - if ( 'grid' === $name ) { - if ( empty( $blockData ) ) { - continue; - } - - $blocks_exist = true; - - $css = new GenerateBlocks_Dynamic_CSS(); - $desktop_css = new GenerateBlocks_Dynamic_CSS(); - $tablet_css = new GenerateBlocks_Dynamic_CSS(); - $tablet_only_css = new GenerateBlocks_Dynamic_CSS(); - $mobile_css = new GenerateBlocks_Dynamic_CSS(); - - $css->set_selector( '.gb-grid-wrapper' ); - $css->add_property( 'display', 'flex' ); - $css->add_property( 'flex-wrap', 'wrap' ); - - $css->set_selector( '.gb-grid-wrapper > .gb-grid-column > .gb-container' ); - $css->add_property( 'display', 'flex' ); - $css->add_property( 'flex-direction', 'column' ); - $css->add_property( 'height', '100%' ); - - $css->set_selector( '.gb-grid-column' ); - $css->add_property( 'box-sizing', 'border-box' ); - - $css->set_selector( '.gb-grid-wrapper .wp-block-image' ); - $css->add_property( 'margin-bottom', '0' ); - - foreach ( $blockData as $atts ) { - if ( ! isset( $atts['uniqueId'] ) ) { - continue; - } - - $defaults = generateblocks_get_block_defaults(); - - $settings = wp_parse_args( - $atts, - $defaults['gridContainer'] - ); - - $id = $atts['uniqueId']; - $blockVersion = ! empty( $settings['blockVersion'] ) ? $settings['blockVersion'] : 1; - - // Use legacy settings if needed. - if ( $blockVersion < 2 ) { - $settings = GenerateBlocks_Legacy_Attributes::get_settings( '1.4.0', 'grid', $settings, $atts ); - } - - $gap_direction = 'left'; - - if ( is_rtl() ) { - $gap_direction = 'right'; - } - - // Don't output horizontal gap defaults if we're using global styles. - if ( $blockVersion < 2 && isset( $settings['useGlobalStyle'] ) && $settings['useGlobalStyle'] && isset( $settings['globalStyleId'] ) && $settings['globalStyleId'] ) { - if ( (string) $settings['horizontalGap'] === (string) $defaults['gridContainer']['horizontalGap'] ) { - $settings['horizontalGap'] = ''; - } - } - - $css->set_selector( '.gb-grid-wrapper-' . $id ); - $css->add_property( 'align-items', $settings['verticalAlignment'] ); - $css->add_property( 'justify-content', $settings['horizontalAlignment'] ); - - if ( $settings['horizontalGap'] ) { - $css->add_property( 'margin-' . $gap_direction, '-' . $settings['horizontalGap'] . 'px' ); - } - - $css->set_selector( '.gb-grid-wrapper-' . $id . ' > .gb-grid-column' ); - $css->add_property( 'padding-' . $gap_direction, $settings['horizontalGap'], 'px' ); - $css->add_property( 'padding-bottom', $settings['verticalGap'], 'px' ); - - $tablet_css->set_selector( '.gb-grid-wrapper-' . $id ); - - if ( 'inherit' !== $settings['verticalAlignmentTablet'] ) { - $tablet_css->add_property( 'align-items', $settings['verticalAlignmentTablet'] ); - } - - if ( 'inherit' !== $settings['horizontalAlignmentTablet'] ) { - $tablet_css->add_property( 'justify-content', $settings['horizontalAlignmentTablet'] ); - } - - if ( $settings['horizontalGapTablet'] ) { - $tablet_css->add_property( 'margin-' . $gap_direction, '-' . $settings['horizontalGapTablet'] . 'px' ); - } elseif ( 0 === $settings['horizontalGapTablet'] ) { - $tablet_css->add_property( 'margin-' . $gap_direction, $settings['horizontalGapTablet'] ); - } - - $tablet_css->set_selector( '.gb-grid-wrapper-' . $id . ' > .gb-grid-column' ); - $tablet_css->add_property( 'padding-' . $gap_direction, $settings['horizontalGapTablet'], 'px' ); - $tablet_css->add_property( 'padding-bottom', $settings['verticalGapTablet'], 'px' ); - - $mobile_css->set_selector( '.gb-grid-wrapper-' . $id ); - - if ( 'inherit' !== $settings['verticalAlignmentMobile'] ) { - $mobile_css->add_property( 'align-items', $settings['verticalAlignmentMobile'] ); - } - - if ( 'inherit' !== $settings['horizontalAlignmentMobile'] ) { - $mobile_css->add_property( 'justify-content', $settings['horizontalAlignmentMobile'] ); - } - - if ( $settings['horizontalGapMobile'] ) { - $mobile_css->add_property( 'margin-' . $gap_direction, '-' . $settings['horizontalGapMobile'] . 'px' ); - } elseif ( 0 === $settings['horizontalGapMobile'] ) { - $mobile_css->add_property( 'margin-' . $gap_direction, $settings['horizontalGapMobile'] ); - } - - $mobile_css->set_selector( '.gb-grid-wrapper-' . $id . ' > .gb-grid-column' ); - $mobile_css->add_property( 'padding-' . $gap_direction, $settings['horizontalGapMobile'], 'px' ); - $mobile_css->add_property( 'padding-bottom', $settings['verticalGapMobile'], 'px' ); - - /** - * Do generateblocks_block_css_data hook - * - * @since 1.0 - * - * @param string $name The name of our block. - * @param array $settings The settings for the current block. - * @param object $css Our desktop/main CSS data. - * @param object $desktop_css Our desktop only CSS data. - * @param object $tablet_css Our tablet CSS data. - * @param object $tablet_only_css Our tablet only CSS data. - * @param object $mobile_css Our mobile CSS data. - */ - do_action( - 'generateblocks_block_css_data', - $name, - $settings, - $css, - $desktop_css, - $tablet_css, - $tablet_only_css, - $mobile_css - ); - } - - if ( $css->css_output() ) { - $main_css_data[] = $css->css_output(); - } - - if ( $desktop_css->css_output() ) { - $desktop_css_data[] = $desktop_css->css_output(); - } - - if ( $tablet_css->css_output() ) { - $tablet_css_data[] = $tablet_css->css_output(); - } - - if ( $tablet_only_css->css_output() ) { - $tablet_only_css_data[] = $tablet_only_css->css_output(); - } - - if ( $mobile_css->css_output() ) { - $mobile_css_data[] = $mobile_css->css_output(); - } - } - - /** - * Get our Container block CSS. - * - * @since 0.1 - */ - if ( 'container' === $name ) { - if ( empty( $blockData ) ) { - continue; - } - - $blocks_exist = true; - - $css = new GenerateBlocks_Dynamic_CSS(); - $desktop_css = new GenerateBlocks_Dynamic_CSS(); - $tablet_css = new GenerateBlocks_Dynamic_CSS(); - $tablet_only_css = new GenerateBlocks_Dynamic_CSS(); - $mobile_css = new GenerateBlocks_Dynamic_CSS(); - - $css->set_selector( '.gb-container .wp-block-image img' ); - $css->add_property( 'vertical-align', 'middle' ); - - $css->set_selector( '.gb-container .gb-shape' ); - $css->add_property( 'position', 'absolute' ); - $css->add_property( 'overflow', 'hidden' ); - $css->add_property( 'pointer-events', 'none' ); - $css->add_property( 'line-height', '0' ); - - $css->set_selector( '.gb-container .gb-shape svg' ); - $css->add_property( 'fill', 'currentColor' ); - - foreach ( $blockData as $atts ) { - if ( ! isset( $atts['uniqueId'] ) ) { - continue; - } - - $defaults = generateblocks_get_block_defaults(); - - $settings = wp_parse_args( - $atts, - $defaults['container'] - ); - - $id = $atts['uniqueId']; - $blockVersion = ! empty( $settings['blockVersion'] ) ? $settings['blockVersion'] : 1; - - // Use legacy settings if needed. - if ( $blockVersion < 2 ) { - $settings = GenerateBlocks_Legacy_Attributes::get_settings( '1.4.0', 'container', $settings, $atts ); - } - - $fontFamily = $settings['fontFamily']; - - if ( $fontFamily && $settings['fontFamilyFallback'] ) { - $fontFamily = $fontFamily . ', ' . $settings['fontFamilyFallback']; - } - - if ( ! isset( $settings['bgOptions']['selector'] ) ) { - $settings['bgOptions']['selector'] = 'element'; - } - - $containerWidth = $settings['containerWidth']; - - if ( isset( $settings['useGlobalStyle'] ) && $settings['useGlobalStyle'] ) { - if ( (string) $containerWidth === (string) $defaults['container']['containerWidth'] ) { - $containerWidth = ''; - } - } - - $backgroundImageValue = generateblocks_get_background_image_css( 'image', $settings ); - $gradientValue = generateblocks_get_background_image_css( 'gradient', $settings ); - $hasBgImage = generateblocks_has_background_image( $settings ); - - $css->set_selector( '.gb-container-' . $id ); - $css->add_property( 'font-family', $fontFamily ); - $css->add_property( 'font-size', $settings['fontSize'], $settings['fontSizeUnit'] ); - $css->add_property( 'font-weight', $settings['fontWeight'] ); - $css->add_property( 'text-transform', $settings['textTransform'] ); - $css->add_property( 'margin', array( $settings['marginTop'], $settings['marginRight'], $settings['marginBottom'], $settings['marginLeft'] ), $settings['marginUnit'] ); - - if ( 'contained' === $settings['outerContainer'] && ! $settings['isGrid'] ) { - if ( ! empty( $containerWidth ) ) { - $css->add_property( 'max-width', absint( $containerWidth ), 'px' ); - $css->add_property( 'margin-left', 'auto' ); - $css->add_property( 'margin-right', 'auto' ); - } - } - - $css->add_property( 'background-color', generateblocks_hex2rgba( $settings['backgroundColor'], $settings['backgroundColorOpacity'] ) ); - $css->add_property( 'color', $settings['textColor'] ); - - if ( $hasBgImage && 'element' === $settings['bgOptions']['selector'] && $backgroundImageValue ) { - if ( ! $settings['bgImageInline'] || ( $settings['bgImageInline'] && 'element' !== $settings['bgOptions']['selector'] ) ) { - $css->add_property( 'background-image', $backgroundImageValue ); - } - - $css->add_property( 'background-repeat', $settings['bgOptions']['repeat'] ); - $css->add_property( 'background-position', $settings['bgOptions']['position'] ); - $css->add_property( 'background-size', $settings['bgOptions']['size'] ); - $css->add_property( 'background-attachment', $settings['bgOptions']['attachment'] ); - } elseif ( $settings['gradient'] && 'element' === $settings['gradientSelector'] ) { - $css->add_property( 'background-image', $gradientValue ); - } - - if ( - ( $hasBgImage && 'pseudo-element' === $settings['bgOptions']['selector'] ) || - $settings['zindex'] || - ( $settings['gradient'] && 'pseudo-element' === $settings['gradientSelector'] ) - ) { - $css->add_property( 'position', 'relative' ); - } - - if ( - ( $hasBgImage && 'pseudo-element' === $settings['bgOptions']['selector'] ) || - ( $settings['gradient'] && 'pseudo-element' === $settings['gradientSelector'] ) - ) { - $css->add_property( 'overflow', 'hidden' ); - } - - if ( $settings['zindex'] ) { - $css->add_property( 'z-index', $settings['zindex'] ); - } - - $css->add_property( 'border-radius', array( $settings['borderRadiusTopLeft'], $settings['borderRadiusTopRight'], $settings['borderRadiusBottomRight'], $settings['borderRadiusBottomLeft'] ), $settings['borderRadiusUnit'] ); - $css->add_property( 'border-width', array( $settings['borderSizeTop'], $settings['borderSizeRight'], $settings['borderSizeBottom'], $settings['borderSizeLeft'] ), 'px' ); - $css->add_property( 'border-color', generateblocks_hex2rgba( $settings['borderColor'], $settings['borderColorOpacity'] ) ); - $css->add_property( 'min-height', $settings['minHeight'], $settings['minHeightUnit'] ); - - // Set flags so we don't duplicate this CSS in media queries. - $usingMinHeightFlex = false; - $usingMinHeightInnerWidth = false; - - if ( $settings['minHeight'] && $settings['verticalAlignment'] && ! $settings['isGrid'] ) { - $css->add_property( 'display', 'flex' ); - $css->add_property( 'flex-direction', 'row' ); - $css->add_property( 'align-items', $settings['verticalAlignment'] ); - - $usingMinHeightFlex = true; - } - - $css->add_property( 'text-align', $settings['alignment'] ); - - $innerZIndex = $settings['innerZindex']; - - $css->set_selector( '.gb-container-' . $id . ':before' ); - - if ( $hasBgImage && 'pseudo-element' === $settings['bgOptions']['selector'] ) { - $css->add_property( 'content', '""' ); - $css->add_property( 'background-image', $backgroundImageValue ); - $css->add_property( 'background-repeat', $settings['bgOptions']['repeat'] ); - $css->add_property( 'background-position', $settings['bgOptions']['position'] ); - $css->add_property( 'background-size', $settings['bgOptions']['size'] ); - $css->add_property( 'background-attachment', $settings['bgOptions']['attachment'] ); - $css->add_property( 'z-index', '0' ); - $css->add_property( 'position', 'absolute' ); - $css->add_property( 'top', '0' ); - $css->add_property( 'right', '0' ); - $css->add_property( 'bottom', '0' ); - $css->add_property( 'left', '0' ); - $css->add_property( 'transition', 'inherit' ); - $css->add_property( 'border-radius', array( $settings['borderRadiusTopLeft'], $settings['borderRadiusTopRight'], $settings['borderRadiusBottomRight'], $settings['borderRadiusBottomLeft'] ), $settings['borderRadiusUnit'] ); - - if ( isset( $settings['bgOptions']['opacity'] ) && 1 !== $settings['bgOptions']['opacity'] ) { - $css->add_property( 'opacity', $settings['bgOptions']['opacity'] ); - } - - if ( $blockVersion < 2 && ! $innerZIndex ) { - $innerZIndex = 1; - } - } - - if ( $settings['gradient'] && 'pseudo-element' === $settings['gradientSelector'] ) { - $css->set_selector( '.gb-container-' . $id . ':after' ); - $css->add_property( 'content', '""' ); - $css->add_property( 'background-image', $gradientValue ); - $css->add_property( 'z-index', '0' ); - $css->add_property( 'position', 'absolute' ); - $css->add_property( 'top', '0' ); - $css->add_property( 'right', '0' ); - $css->add_property( 'bottom', '0' ); - $css->add_property( 'left', '0' ); - - if ( $blockVersion < 2 && ! $innerZIndex ) { - $innerZIndex = 1; - } - } - - $css->set_selector( '.gb-container-' . $id . ' > .gb-inside-container' ); - $css->add_property( 'padding', array( $settings['paddingTop'], $settings['paddingRight'], $settings['paddingBottom'], $settings['paddingLeft'] ), $settings['paddingUnit'] ); - - if ( 'contained' === $settings['innerContainer'] && ! $settings['isGrid'] ) { - if ( ! empty( $containerWidth ) ) { - $css->add_property( 'max-width', absint( $containerWidth ), 'px' ); - $css->add_property( 'margin-left', 'auto' ); - $css->add_property( 'margin-right', 'auto' ); - } - } - - if ( $usingMinHeightFlex ) { - $css->add_property( 'width', '100%' ); - - $usingMinHeightInnerWidth = true; - } - - if ( $innerZIndex || 0 === $innerZIndex ) { - $css->add_property( 'z-index', $innerZIndex ); - $css->add_property( 'position', 'relative' ); - } - - $css->set_selector( '.gb-container-' . $id . ' a, .gb-container-' . $id . ' a:visited' ); - $css->add_property( 'color', $settings['linkColor'] ); - - $css->set_selector( '.gb-container-' . $id . ' a:hover' ); - $css->add_property( 'color', $settings['linkColorHover'] ); - - if ( $settings['isGrid'] ) { - $css->set_selector( '.gb-grid-wrapper > .gb-grid-column-' . $id ); - $css->add_property( 'width', $settings['width'], '%' ); - - $css->add_property( 'flex-grow', $settings['flexGrow'] ); - $css->add_property( 'flex-shrink', $settings['flexShrink'] ); - - if ( is_numeric( $settings['flexBasis'] ) ) { - $css->add_property( 'flex-basis', $settings['flexBasis'], $settings['flexBasisUnit'] ); - } else { - $css->add_property( 'flex-basis', $settings['flexBasis'] ); - } - } - - if ( $settings['removeVerticalGap'] ) { - $desktop_css->set_selector( '.gb-grid-wrapper > div.gb-grid-column-' . $id ); - $desktop_css->add_property( 'padding-bottom', '0' ); - } - - $css->set_selector( '.gb-grid-wrapper > .gb-grid-column-' . $id . ' > .gb-container' ); - $css->add_property( 'justify-content', $settings['verticalAlignment'] ); - - if ( ! empty( $settings['shapeDividers'] ) ) { - $css->set_selector( '.gb-container-' . $id ); - $css->add_property( 'position', 'relative' ); - - $default_styles = generateblocks_get_default_styles(); - - foreach ( (array) $settings['shapeDividers'] as $index => $options ) { - $shapeNumber = $index + 1; - - $shapeOptions = wp_parse_args( - $options, - $default_styles['container']['shapeDividers'] - ); - - $shapeTransforms = array(); - - if ( 'top' === $shapeOptions['location'] ) { - $shapeTransforms[] = 'scaleY(-1)'; - } - - if ( $shapeOptions['flipHorizontally'] ) { - $shapeTransforms[] = 'scaleX(-1)'; - } - - $css->set_selector( '.gb-container-' . $id . ' > .gb-shapes .gb-shape-' . $shapeNumber ); - $css->add_property( 'color', generateblocks_hex2rgba( $shapeOptions['color'], $shapeOptions['colorOpacity'] ) ); - $css->add_property( 'z-index', $shapeOptions['zindex'] ); - - if ( 'top' === $shapeOptions['location'] || 'bottom' === $shapeOptions['location'] ) { - $css->add_property( 'left', '0' ); - $css->add_property( 'right', '0' ); - } - - if ( 'bottom' === $shapeOptions['location'] ) { - $css->add_property( 'bottom', '-1px' ); - } - - if ( 'top' === $shapeOptions['location'] ) { - $css->add_property( 'top', '-1px' ); - } - - if ( ! empty( $shapeTransforms ) ) { - $css->add_property( 'transform', implode( ' ', $shapeTransforms ) ); - } - - $shapeWidth = $shapeOptions['width'] . '%'; - - if ( 100 === (int) $shapeOptions['width'] ) { - $shapeWidth = 'calc(' . $shapeWidth . ' + 1.3px)'; - } - - $css->set_selector( '.gb-container-' . $id . ' > .gb-shapes .gb-shape-' . $shapeNumber . ' svg' ); - $css->add_property( 'height', $shapeOptions['height'], 'px' ); - $css->add_property( 'width', $shapeWidth ); - - if ( 'top' === $shapeOptions['location'] || 'bottom' === $shapeOptions['location'] ) { - $css->add_property( 'position', 'relative' ); - $css->add_property( 'left', '50%' ); - $css->add_property( 'transform', 'translateX(-50%)' ); - $css->add_property( 'min-width', '100%' ); - } - } - } - - $tablet_css->set_selector( '.gb-container-' . $id ); - $tablet_css->add_property( 'font-size', $settings['fontSizeTablet'], $settings['fontSizeUnit'] ); - $tablet_css->add_property( 'margin', array( $settings['marginTopTablet'], $settings['marginRightTablet'], $settings['marginBottomTablet'], $settings['marginLeftTablet'] ), $settings['marginUnit'] ); - $tablet_css->add_property( 'border-radius', array( $settings['borderRadiusTopLeftTablet'], $settings['borderRadiusTopRightTablet'], $settings['borderRadiusBottomRightTablet'], $settings['borderRadiusBottomLeftTablet'] ), $settings['borderRadiusUnit'] ); - $tablet_css->add_property( 'border-width', array( $settings['borderSizeTopTablet'], $settings['borderSizeRightTablet'], $settings['borderSizeBottomTablet'], $settings['borderSizeLeftTablet'] ), 'px' ); - $tablet_css->add_property( 'min-height', $settings['minHeightTablet'], $settings['minHeightUnitTablet'] ); - - if ( ! $settings['isGrid'] ) { - if ( ! $usingMinHeightFlex && $settings['minHeightTablet'] && 'inherit' !== $settings['verticalAlignmentTablet'] ) { - $tablet_css->add_property( 'display', 'flex' ); - $tablet_css->add_property( 'flex-direction', 'row' ); - - $usingMinHeightFlex = true; - } - - if ( $usingMinHeightFlex && 'inherit' !== $settings['verticalAlignmentTablet'] ) { - $tablet_css->add_property( 'align-items', $settings['verticalAlignmentTablet'] ); - } - } - - $tablet_css->add_property( 'text-align', $settings['alignmentTablet'] ); - - $tablet_css->set_selector( '.gb-container-' . $id . ' > .gb-inside-container' ); - $tablet_css->add_property( 'padding', array( $settings['paddingTopTablet'], $settings['paddingRightTablet'], $settings['paddingBottomTablet'], $settings['paddingLeftTablet'] ), $settings['paddingUnit'] ); - - $usingMinHeightInnerWidthBoxSizing = false; - - if ( ! $settings['isGrid'] ) { - // Needs 100% width if it's a flex item. - if ( ! $usingMinHeightInnerWidth && $settings['minHeightTablet'] && 'inherit' !== $settings['verticalAlignmentTablet'] ) { - $tablet_css->add_property( 'width', '100%' ); - - $usingMinHeightInnerWidth = true; - } elseif ( $usingMinHeightInnerWidth ) { - if ( 'contained' === $settings['innerContainer'] && ! $settings['isGrid'] ) { - $tablet_css->add_property( 'box-sizing', 'border-box' ); - - $usingMinHeightInnerWidthBoxSizing = true; - } - } - } - - $tablet_css->set_selector( '.gb-grid-wrapper > .gb-grid-column-' . $id ); - - if ( ! $settings['autoWidthTablet'] ) { - $tablet_css->add_property( 'width', $settings['widthTablet'], '%' ); - } else { - $tablet_css->add_property( 'width', 'auto' ); - } - - $tablet_css->add_property( 'flex-grow', $settings['flexGrowTablet'] ); - $tablet_css->add_property( 'flex-shrink', $settings['flexShrinkTablet'] ); - - if ( is_numeric( $settings['flexBasisTablet'] ) ) { - $tablet_css->add_property( 'flex-basis', $settings['flexBasisTablet'], $settings['flexBasisUnit'] ); - } else { - $tablet_css->add_property( 'flex-basis', $settings['flexBasisTablet'] ); - } - - if ( $settings['isGrid'] ) { - $tablet_css->add_property( 'order', $settings['orderTablet'] ); - } - - if ( $settings['removeVerticalGapTablet'] ) { - $tablet_only_css->set_selector( '.gb-grid-wrapper > div.gb-grid-column-' . $id ); - $tablet_only_css->add_property( 'padding-bottom', '0' ); - } - - $tablet_css->set_selector( '.gb-grid-wrapper > .gb-grid-column-' . $id . ' > .gb-container' ); - - if ( 'inherit' !== $settings['verticalAlignmentTablet'] ) { - $tablet_css->add_property( 'justify-content', $settings['verticalAlignmentTablet'] ); - } - - if ( $hasBgImage && 'pseudo-element' === $settings['bgOptions']['selector'] ) { - $tablet_css->set_selector( '.gb-container-' . $id . ':before' ); - $tablet_css->add_property( 'border-radius', array( $settings['borderRadiusTopLeftTablet'], $settings['borderRadiusTopRightTablet'], $settings['borderRadiusBottomRightTablet'], $settings['borderRadiusBottomLeftTablet'] ), $settings['borderRadiusUnit'] ); - } - - if ( ! empty( $settings['shapeDividers'] ) ) { - $default_styles = generateblocks_get_default_styles(); - - foreach ( (array) $settings['shapeDividers'] as $index => $options ) { - $shapeNumber = $index + 1; - - $shapeOptions = wp_parse_args( - $options, - $default_styles['container']['shapeDividers'] - ); - - $tablet_css->set_selector( '.gb-container-' . $id . ' > .gb-shapes .gb-shape-' . $shapeNumber . ' svg' ); - $tablet_css->add_property( 'height', $shapeOptions['heightTablet'], 'px' ); - $tablet_css->add_property( 'width', $shapeOptions['widthTablet'], '%' ); - } - } - - $mobile_css->set_selector( '.gb-container-' . $id ); - $mobile_css->add_property( 'font-size', $settings['fontSizeMobile'], $settings['fontSizeUnit'] ); - $mobile_css->add_property( 'margin', array( $settings['marginTopMobile'], $settings['marginRightMobile'], $settings['marginBottomMobile'], $settings['marginLeftMobile'] ), $settings['marginUnit'] ); - $mobile_css->add_property( 'border-radius', array( $settings['borderRadiusTopLeftMobile'], $settings['borderRadiusTopRightMobile'], $settings['borderRadiusBottomRightMobile'], $settings['borderRadiusBottomLeftMobile'] ), $settings['borderRadiusUnit'] ); - $mobile_css->add_property( 'border-width', array( $settings['borderSizeTopMobile'], $settings['borderSizeRightMobile'], $settings['borderSizeBottomMobile'], $settings['borderSizeLeftMobile'] ), 'px' ); - $mobile_css->add_property( 'min-height', $settings['minHeightMobile'], $settings['minHeightUnitMobile'] ); - - if ( ! $settings['isGrid'] ) { - if ( ! $usingMinHeightFlex && $settings['minHeightMobile'] && 'inherit' !== $settings['verticalAlignmentMobile'] ) { - $mobile_css->add_property( 'display', 'flex' ); - $mobile_css->add_property( 'flex-direction', 'row' ); - - $usingMinHeightFlex = true; - } - - if ( $usingMinHeightFlex && 'inherit' !== $settings['verticalAlignmentMobile'] ) { - $mobile_css->add_property( 'align-items', $settings['verticalAlignmentMobile'] ); - } - } - - $mobile_css->add_property( 'text-align', $settings['alignmentMobile'] ); - - $mobile_css->set_selector( '.gb-container-' . $id . ' > .gb-inside-container' ); - $mobile_css->add_property( 'padding', array( $settings['paddingTopMobile'], $settings['paddingRightMobile'], $settings['paddingBottomMobile'], $settings['paddingLeftMobile'] ), $settings['paddingUnit'] ); - - if ( ! $settings['isGrid'] ) { - // Needs 100% width if it's a flex item. - if ( ! $usingMinHeightInnerWidth && $settings['minHeightMobile'] && 'inherit' !== $settings['verticalAlignmentMobile'] ) { - $mobile_css->add_property( 'width', '100%' ); - } elseif ( $usingMinHeightInnerWidth && ! $usingMinHeightInnerWidthBoxSizing ) { - if ( 'contained' === $settings['innerContainer'] && ! $settings['isGrid'] ) { - $mobile_css->add_property( 'box-sizing', 'border-box' ); - } - } - } - - $mobile_css->set_selector( '.gb-grid-wrapper > .gb-grid-column-' . $id ); - - if ( ! $settings['autoWidthMobile'] ) { - $mobile_css->add_property( 'width', $settings['widthMobile'], '%' ); - } - - if ( $settings['autoWidthMobile'] ) { - $mobile_css->add_property( 'width', 'auto' ); - } - - $mobile_css->add_property( 'flex-grow', $settings['flexGrowMobile'] ); - $mobile_css->add_property( 'flex-shrink', $settings['flexShrinkMobile'] ); - - if ( is_numeric( $settings['flexBasisMobile'] ) ) { - $mobile_css->add_property( 'flex-basis', $settings['flexBasisMobile'], $settings['flexBasisUnit'] ); - } else { - $mobile_css->add_property( 'flex-basis', $settings['flexBasisMobile'] ); - } - - if ( $settings['isGrid'] ) { - $mobile_css->add_property( 'order', $settings['orderMobile'] ); - } - - if ( $settings['removeVerticalGapMobile'] ) { - $mobile_css->set_selector( '.gb-grid-wrapper > div.gb-grid-column-' . $id ); - $mobile_css->add_property( 'padding-bottom', '0' ); - } - - $mobile_css->set_selector( '.gb-grid-wrapper > .gb-grid-column-' . $id . ' > .gb-container' ); - - if ( 'inherit' !== $settings['verticalAlignmentMobile'] ) { - $mobile_css->add_property( 'justify-content', $settings['verticalAlignmentMobile'] ); - } - - if ( $hasBgImage && 'pseudo-element' === $settings['bgOptions']['selector'] ) { - $mobile_css->set_selector( '.gb-container-' . $id . ':before' ); - $mobile_css->add_property( 'border-radius', array( $settings['borderRadiusTopLeftMobile'], $settings['borderRadiusTopRightMobile'], $settings['borderRadiusBottomRightMobile'], $settings['borderRadiusBottomLeftMobile'] ), $settings['borderRadiusUnit'] ); - } - - if ( ! empty( $settings['shapeDividers'] ) ) { - $default_styles = generateblocks_get_default_styles(); - - foreach ( (array) $settings['shapeDividers'] as $index => $options ) { - $shapeNumber = $index + 1; - - $shapeOptions = wp_parse_args( - $options, - $default_styles['container']['shapeDividers'] - ); - - $mobile_css->set_selector( '.gb-container-' . $id . ' > .gb-shapes .gb-shape-' . $shapeNumber . ' svg' ); - $mobile_css->add_property( 'height', $shapeOptions['heightMobile'], 'px' ); - $mobile_css->add_property( 'width', $shapeOptions['widthMobile'], '%' ); - } - } - - if ( $hasBgImage && 'fixed' === $settings['bgOptions']['attachment'] ) { - if ( 'element' === $settings['bgOptions']['selector'] ) { - $mobile_css->set_selector( '.gb-container-' . $id ); - } - - if ( 'pseudo-element' === $settings['bgOptions']['selector'] ) { - $mobile_css->set_selector( '.gb-container-' . $id . ':before' ); - } - - $mobile_css->add_property( 'background-attachment', 'initial' ); - } - - /** - * Do generateblocks_block_css_data hook - * - * @since 1.0 - * - * @param string $name The name of our block. - * @param array $settings The settings for the current block. - * @param object $css Our desktop/main CSS data. - * @param object $desktop_css Our desktop only CSS data. - * @param object $tablet_css Our tablet CSS data. - * @param object $tablet_only_css Our tablet only CSS data. - * @param object $mobile_css Our mobile CSS data. - */ - do_action( - 'generateblocks_block_css_data', - $name, - $settings, - $css, - $desktop_css, - $tablet_css, - $tablet_only_css, - $mobile_css - ); - } - - if ( $css->css_output() ) { - $main_css_data[] = $css->css_output(); - } - - if ( $desktop_css->css_output() ) { - $desktop_css_data[] = $desktop_css->css_output(); - } - - if ( $tablet_css->css_output() ) { - $tablet_css_data[] = $tablet_css->css_output(); - } - - if ( $tablet_only_css->css_output() ) { - $tablet_only_css_data[] = $tablet_only_css->css_output(); - } - - if ( $mobile_css->css_output() ) { - $mobile_css_data[] = $mobile_css->css_output(); - } - } - - /** - * Get our Button Container block CSS. - * - * @since 0.1 - */ - if ( 'button-container' === $name ) { - if ( empty( $blockData ) ) { - continue; - } - - $blocks_exist = true; - - $css = new GenerateBlocks_Dynamic_CSS(); - $desktop_css = new GenerateBlocks_Dynamic_CSS(); - $tablet_css = new GenerateBlocks_Dynamic_CSS(); - $tablet_only_css = new GenerateBlocks_Dynamic_CSS(); - $mobile_css = new GenerateBlocks_Dynamic_CSS(); - - $css->set_selector( '.gb-button-wrapper' ); - $css->add_property( 'display', 'flex' ); - $css->add_property( 'flex-wrap', 'wrap' ); - $css->add_property( 'align-items', 'flex-start' ); - $css->add_property( 'justify-content', 'flex-start' ); - $css->add_property( 'clear', 'both' ); - - foreach ( $blockData as $atts ) { - if ( ! isset( $atts['uniqueId'] ) ) { - continue; - } - - $defaults = generateblocks_get_block_defaults(); - - $settings = wp_parse_args( - $atts, - $defaults['buttonContainer'] - ); - - $id = $atts['uniqueId']; - $blockVersion = ! empty( $settings['blockVersion'] ) ? $settings['blockVersion'] : 1; - - $css->set_selector( '.gb-button-wrapper-' . $id ); - $css->add_property( 'margin', array( $settings['marginTop'], $settings['marginRight'], $settings['marginBottom'], $settings['marginLeft'] ), $settings['marginUnit'] ); - $css->add_property( 'justify-content', generateblocks_get_flexbox_alignment( $settings['alignment'] ) ); - - $stack_desktop = $desktop_css; - $stack_tablet_only = $tablet_only_css; - - if ( $blockVersion < 2 ) { - $stack_desktop = $css; - $stack_tablet_only = $tablet_css; - } - - if ( $settings['stack'] ) { - $stack_desktop->set_selector( '.gb-button-wrapper-' . $id ); - $stack_desktop->add_property( 'flex-direction', 'column' ); - $stack_desktop->add_property( 'align-items', generateblocks_get_flexbox_alignment( $settings['alignment'] ) ); - } - - if ( $settings['fillHorizontalSpace'] ) { - $stack_desktop->set_selector( '.gb-button-wrapper-' . $id . ' > .gb-button' ); - $stack_desktop->add_property( 'flex', '1' ); - } - - if ( $settings['stack'] && $settings['fillHorizontalSpace'] ) { - $stack_desktop->add_property( 'width', '100%' ); - $stack_desktop->add_property( 'box-sizing', 'border-box' ); - } - - $tablet_css->set_selector( '.gb-button-wrapper-' . $id ); - $tablet_css->add_property( 'margin', array( $settings['marginTopTablet'], $settings['marginRightTablet'], $settings['marginBottomTablet'], $settings['marginLeftTablet'] ), $settings['marginUnit'] ); - $tablet_css->add_property( 'justify-content', generateblocks_get_flexbox_alignment( $settings['alignmentTablet'] ) ); - - if ( $settings['stackTablet'] ) { - $stack_tablet_only->set_selector( '.gb-button-wrapper-' . $id ); - $stack_tablet_only->add_property( 'flex-direction', 'column' ); - $stack_tablet_only->add_property( 'align-items', generateblocks_get_flexbox_alignment( $settings['alignmentTablet'] ) ); - } - - if ( $settings['fillHorizontalSpaceTablet'] ) { - $stack_tablet_only->set_selector( '.gb-button-wrapper-' . $id . ' > .gb-button' ); - $stack_tablet_only->add_property( 'flex', '1' ); - } - - if ( $settings['stackTablet'] && $settings['fillHorizontalSpaceTablet'] ) { - $stack_tablet_only->add_property( 'width', '100%' ); - $stack_tablet_only->add_property( 'box-sizing', 'border-box' ); - } - - $mobile_css->set_selector( '.gb-button-wrapper-' . $id ); - $mobile_css->add_property( 'margin', array( $settings['marginTopMobile'], $settings['marginRightMobile'], $settings['marginBottomMobile'], $settings['marginLeftMobile'] ), $settings['marginUnit'] ); - $mobile_css->add_property( 'justify-content', generateblocks_get_flexbox_alignment( $settings['alignmentMobile'] ) ); - - if ( $settings['stackMobile'] ) { - $mobile_css->add_property( 'flex-direction', 'column' ); - $mobile_css->add_property( 'align-items', generateblocks_get_flexbox_alignment( $settings['alignmentMobile'] ) ); - } - - if ( $settings['fillHorizontalSpaceMobile'] ) { - $mobile_css->set_selector( '.gb-button-wrapper-' . $id . ' > .gb-button' ); - $mobile_css->add_property( 'flex', '1' ); - } - - if ( $settings['stackMobile'] && $settings['fillHorizontalSpaceMobile'] ) { - $mobile_css->add_property( 'width', '100%' ); - $mobile_css->add_property( 'box-sizing', 'border-box' ); - } - - /** - * Do generateblocks_block_css_data hook - * - * @since 1.0 - * - * @param string $name The name of our block. - * @param array $settings The settings for the current block. - * @param object $css Our desktop/main CSS data. - * @param object $desktop_css Our desktop only CSS data. - * @param object $tablet_css Our tablet CSS data. - * @param object $tablet_only_css Our tablet only CSS data. - * @param object $mobile_css Our mobile CSS data. - */ - do_action( - 'generateblocks_block_css_data', - $name, - $settings, - $css, - $desktop_css, - $tablet_css, - $tablet_only_css, - $mobile_css - ); - } - - if ( $css->css_output() ) { - $main_css_data[] = $css->css_output(); - } - - if ( $desktop_css->css_output() ) { - $desktop_css_data[] = $desktop_css->css_output(); - } - - if ( $tablet_css->css_output() ) { - $tablet_css_data[] = $tablet_css->css_output(); - } - - if ( $tablet_only_css->css_output() ) { - $tablet_only_css_data[] = $tablet_only_css->css_output(); - } - - if ( $mobile_css->css_output() ) { - $mobile_css_data[] = $mobile_css->css_output(); - } - } - - /** - * Get our Button block CSS. - * - * @since 0.1 - */ - if ( 'button' === $name ) { - if ( empty( $blockData ) ) { - continue; - } - - $blocks_exist = true; - - $css = new GenerateBlocks_Dynamic_CSS(); - $desktop_css = new GenerateBlocks_Dynamic_CSS(); - $tablet_css = new GenerateBlocks_Dynamic_CSS(); - $tablet_only_css = new GenerateBlocks_Dynamic_CSS(); - $mobile_css = new GenerateBlocks_Dynamic_CSS(); - - if ( ! $icon_css_added ) { - $css->set_selector( '.gb-icon' ); - $css->add_property( 'display', 'inline-flex' ); - $css->add_property( 'line-height', '0' ); - - $css->set_selector( '.gb-icon svg' ); - $css->add_property( 'height', '1em' ); - $css->add_property( 'width', '1em' ); - $css->add_property( 'fill', 'currentColor' ); - - $icon_css_added = true; - } - - $css->set_selector( '.gb-button-wrapper .gb-button' ); - $css->add_property( 'display', 'inline-flex' ); - $css->add_property( 'align-items', 'center' ); - $css->add_property( 'justify-content', 'center' ); - $css->add_property( 'text-align', 'center' ); - $css->add_property( 'text-decoration', 'none' ); - $css->add_property( 'transition', '.2s background-color ease-in-out, .2s color ease-in-out, .2s border-color ease-in-out, .2s opacity ease-in-out, .2s box-shadow ease-in-out' ); - - $css->set_selector( '.gb-button-wrapper .gb-button .gb-icon' ); - $css->add_property( 'align-items', 'center' ); - - foreach ( $blockData as $atts ) { - if ( ! isset( $atts['uniqueId'] ) ) { - continue; - } - - $defaults = generateblocks_get_block_defaults(); - - $settings = wp_parse_args( - $atts, - $defaults['button'] - ); - - $id = $atts['uniqueId']; - $blockVersion = ! empty( $settings['blockVersion'] ) ? $settings['blockVersion'] : 1; - - // Use legacy settings if needed. - if ( $blockVersion < 2 ) { - $settings = GenerateBlocks_Legacy_Attributes::get_settings( '1.4.0', 'button', $settings, $atts ); - } - - $selector = 'a.gb-button-' . $id; - - if ( isset( $atts['hasUrl'] ) && ! $atts['hasUrl'] ) { - $selector = '.gb-button-' . $id; - } - - // Back-compatibility for when icon held a value. - if ( $settings['icon'] ) { - $settings['hasIcon'] = true; - } - - $fontFamily = $settings['fontFamily']; - - if ( $fontFamily && $settings['fontFamilyFallback'] ) { - $fontFamily = $fontFamily . ', ' . $settings['fontFamilyFallback']; - } - - $gradientColorStopOneValue = ''; - $gradientColorStopTwoValue = ''; - - if ( $settings['gradient'] ) { - if ( $settings['gradientColorOne'] && '' !== $settings['gradientColorStopOne'] ) { - $gradientColorStopOneValue = ' ' . $settings['gradientColorStopOne'] . '%'; - } - - if ( $settings['gradientColorTwo'] && '' !== $settings['gradientColorStopTwo'] ) { - $gradientColorStopTwoValue = ' ' . $settings['gradientColorStopTwo'] . '%'; - } - } - - $css->set_selector( '.gb-button-wrapper ' . $selector . ',.gb-button-wrapper ' . $selector . ':visited' ); - $css->add_property( 'background-color', generateblocks_hex2rgba( $settings['backgroundColor'], $settings['backgroundColorOpacity'] ) ); - $css->add_property( 'color', $settings['textColor'] ); - - if ( $settings['gradient'] ) { - $css->add_property( 'background-image', 'linear-gradient(' . $settings['gradientDirection'] . 'deg, ' . generateblocks_hex2rgba( $settings['gradientColorOne'], $settings['gradientColorOneOpacity'] ) . $gradientColorStopOneValue . ', ' . generateblocks_hex2rgba( $settings['gradientColorTwo'], $settings['gradientColorTwoOpacity'] ) . $gradientColorStopTwoValue . ')' ); - } - - $css->add_property( 'font-family', $fontFamily ); - $css->add_property( 'font-size', $settings['fontSize'], $settings['fontSizeUnit'] ); - $css->add_property( 'font-weight', $settings['fontWeight'] ); - $css->add_property( 'text-transform', $settings['textTransform'] ); - $css->add_property( 'letter-spacing', $settings['letterSpacing'], 'em' ); - $css->add_property( 'padding', array( $settings['paddingTop'], $settings['paddingRight'], $settings['paddingBottom'], $settings['paddingLeft'] ), $settings['paddingUnit'] ); - $css->add_property( 'border-radius', array( $settings['borderRadiusTopLeft'], $settings['borderRadiusTopRight'], $settings['borderRadiusBottomRight'], $settings['borderRadiusBottomLeft'] ), $settings['borderRadiusUnit'] ); - $css->add_property( 'margin', array( $settings['marginTop'], $settings['marginRight'], $settings['marginBottom'], $settings['marginLeft'] ), $settings['marginUnit'] ); - $css->add_property( 'border-width', array( $settings['borderSizeTop'], $settings['borderSizeRight'], $settings['borderSizeBottom'], $settings['borderSizeLeft'] ), 'px' ); - $css->add_property( 'border-color', generateblocks_hex2rgba( $settings['borderColor'], $settings['borderColorOpacity'] ) ); - $css->add_property( 'text-transform', $settings['textTransform'] ); - - if ( $settings['hasIcon'] ) { - $css->add_property( 'display', 'inline-flex' ); - $css->add_property( 'align-items', 'center' ); - } - - $css->set_selector( '.gb-button-wrapper ' . $selector . ':hover,.gb-button-wrapper ' . $selector . ':active,.gb-button-wrapper ' . $selector . ':focus' ); - $css->add_property( 'background-color', generateblocks_hex2rgba( $settings['backgroundColorHover'], $settings['backgroundColorHoverOpacity'] ) ); - $css->add_property( 'color', $settings['textColorHover'] ); - $css->add_property( 'border-color', generateblocks_hex2rgba( $settings['borderColorHover'], $settings['borderColorHoverOpacity'] ) ); - - $css->set_selector( '.gb-button-wrapper ' . $selector . '.gb-button__current, .gb-button-wrapper ' . $selector . '.gb-button__current:visited' ); - $css->add_property( 'background-color', $settings['backgroundColorCurrent'] ); - $css->add_property( 'color', $settings['textColorCurrent'] ); - $css->add_property( 'border-color', $settings['borderColorCurrent'] ); - - if ( $settings['hasIcon'] ) { - $css->set_selector( $selector . ' .gb-icon' ); - $css->add_property( 'font-size', $settings['iconSize'], $settings['iconSizeUnit'] ); - - if ( ! $settings['removeText'] ) { - $css->add_property( 'padding', array( $settings['iconPaddingTop'], $settings['iconPaddingRight'], $settings['iconPaddingBottom'], $settings['iconPaddingLeft'] ), $settings['iconPaddingUnit'] ); - } - } - - $tablet_css->set_selector( '.gb-button-wrapper ' . $selector ); - $tablet_css->add_property( 'font-size', $settings['fontSizeTablet'], $settings['fontSizeUnit'] ); - $tablet_css->add_property( 'letter-spacing', $settings['letterSpacingTablet'], 'em' ); - $tablet_css->add_property( 'padding', array( $settings['paddingTopTablet'], $settings['paddingRightTablet'], $settings['paddingBottomTablet'], $settings['paddingLeftTablet'] ), $settings['paddingUnit'] ); - $tablet_css->add_property( 'border-radius', array( $settings['borderRadiusTopLeftTablet'], $settings['borderRadiusTopRightTablet'], $settings['borderRadiusBottomRightTablet'], $settings['borderRadiusBottomLeftTablet'] ), $settings['borderRadiusUnit'] ); - $tablet_css->add_property( 'margin', array( $settings['marginTopTablet'], $settings['marginRightTablet'], $settings['marginBottomTablet'], $settings['marginLeftTablet'] ), $settings['marginUnit'] ); - $tablet_css->add_property( 'border-width', array( $settings['borderSizeTopTablet'], $settings['borderSizeRightTablet'], $settings['borderSizeBottomTablet'], $settings['borderSizeLeftTablet'] ), 'px' ); - - if ( $settings['hasIcon'] ) { - $tablet_css->set_selector( $selector . ' .gb-icon' ); - $tablet_css->add_property( 'font-size', $settings['iconSizeTablet'], $settings['iconSizeUnit'] ); - - if ( ! $settings['removeText'] ) { - $tablet_css->add_property( 'padding', array( $settings['iconPaddingTopTablet'], $settings['iconPaddingRightTablet'], $settings['iconPaddingBottomTablet'], $settings['iconPaddingLeftTablet'] ), $settings['iconPaddingUnit'] ); - } - } - - $mobile_css->set_selector( '.gb-button-wrapper ' . $selector ); - $mobile_css->add_property( 'font-size', $settings['fontSizeMobile'], $settings['fontSizeUnit'] ); - $mobile_css->add_property( 'letter-spacing', $settings['letterSpacingMobile'], 'em' ); - $mobile_css->add_property( 'padding', array( $settings['paddingTopMobile'], $settings['paddingRightMobile'], $settings['paddingBottomMobile'], $settings['paddingLeftMobile'] ), $settings['paddingUnit'] ); - $mobile_css->add_property( 'border-radius', array( $settings['borderRadiusTopLeftMobile'], $settings['borderRadiusTopRightMobile'], $settings['borderRadiusBottomRightMobile'], $settings['borderRadiusBottomLeftMobile'] ), $settings['borderRadiusUnit'] ); - $mobile_css->add_property( 'margin', array( $settings['marginTopMobile'], $settings['marginRightMobile'], $settings['marginBottomMobile'], $settings['marginLeftMobile'] ), $settings['marginUnit'] ); - $mobile_css->add_property( 'border-width', array( $settings['borderSizeTopMobile'], $settings['borderSizeRightMobile'], $settings['borderSizeBottomMobile'], $settings['borderSizeLeftMobile'] ), 'px' ); - - if ( $settings['hasIcon'] ) { - $mobile_css->set_selector( $selector . ' .gb-icon' ); - $mobile_css->add_property( 'font-size', $settings['iconSizeMobile'], $settings['iconSizeUnit'] ); - - if ( ! $settings['removeText'] ) { - $mobile_css->add_property( 'padding', array( $settings['iconPaddingTopMobile'], $settings['iconPaddingRightMobile'], $settings['iconPaddingBottomMobile'], $settings['iconPaddingLeftMobile'] ), $settings['iconPaddingUnit'] ); - } - } - - /** - * Do generateblocks_block_css_data hook - * - * @since 1.0 - * - * @param string $name The name of our block. - * @param array $settings The settings for the current block. - * @param object $css Our desktop/main CSS data. - * @param object $desktop_css Our desktop only CSS data. - * @param object $tablet_css Our tablet CSS data. - * @param object $tablet_only_css Our tablet only CSS data. - * @param object $mobile_css Our mobile CSS data. - */ - do_action( - 'generateblocks_block_css_data', - $name, - $settings, - $css, - $desktop_css, - $tablet_css, - $tablet_only_css, - $mobile_css - ); - } - - if ( $css->css_output() ) { - $main_css_data[] = $css->css_output(); - } - - if ( $desktop_css->css_output() ) { - $desktop_css_data[] = $desktop_css->css_output(); - } - - if ( $tablet_css->css_output() ) { - $tablet_css_data[] = $tablet_css->css_output(); - } - - if ( $tablet_only_css->css_output() ) { - $tablet_only_css_data[] = $tablet_only_css->css_output(); - } - - if ( $mobile_css->css_output() ) { - $mobile_css_data[] = $mobile_css->css_output(); - } - } - - /** - * Get our Headline block CSS. - * - * @since 0.1 - */ - if ( 'headline' === $name ) { - if ( empty( $blockData ) ) { - continue; - } - - $blocks_exist = true; - - $css = new GenerateBlocks_Dynamic_CSS(); - $desktop_css = new GenerateBlocks_Dynamic_CSS(); - $tablet_css = new GenerateBlocks_Dynamic_CSS(); - $tablet_only_css = new GenerateBlocks_Dynamic_CSS(); - $mobile_css = new GenerateBlocks_Dynamic_CSS(); - - if ( ! $icon_css_added ) { - $css->set_selector( '.gb-icon' ); - $css->add_property( 'display', 'inline-flex' ); - $css->add_property( 'line-height', '0' ); - - $css->set_selector( '.gb-icon svg' ); - $css->add_property( 'height', '1em' ); - $css->add_property( 'width', '1em' ); - $css->add_property( 'fill', 'currentColor' ); - - $icon_css_added = true; - } - - $css->set_selector( '.gb-highlight' ); - $css->add_property( 'background', 'none' ); - $css->add_property( 'color', 'unset' ); - - foreach ( $blockData as $atts ) { - if ( ! isset( $atts['uniqueId'] ) ) { - continue; - } - - $defaults = generateblocks_get_block_defaults(); - - $settings = wp_parse_args( - $atts, - $defaults['headline'] - ); - - $id = $atts['uniqueId']; - - $selector = '.gb-headline-' . $id; - - if ( apply_filters( 'generateblocks_headline_selector_tagname', true, $atts ) ) { - $selector = $settings['element'] . $selector; - } - - // Back-compatibility for when icon held a value. - if ( $settings['icon'] ) { - $settings['hasIcon'] = true; - } - - $fontFamily = $settings['fontFamily']; - - if ( $fontFamily && $settings['fontFamilyFallback'] ) { - $fontFamily = $fontFamily . ', ' . $settings['fontFamilyFallback']; - } - - if ( ! isset( $atts['hasWrapper'] ) ) { - $css->set_selector( $selector ); - $css->add_property( 'font-family', $fontFamily ); - $css->add_property( 'text-align', $settings['alignment'] ); - $css->add_property( 'color', $settings['textColor'] ); - $css->add_property( 'background-color', generateblocks_hex2rgba( $settings['backgroundColor'], $settings['backgroundColorOpacity'] ) ); - $css->add_property( 'font-size', $settings['fontSize'], $settings['fontSizeUnit'] ); - $css->add_property( 'font-weight', $settings['fontWeight'] ); - $css->add_property( 'text-transform', $settings['textTransform'] ); - $css->add_property( 'line-height', $settings['lineHeight'], $settings['lineHeightUnit'] ); - $css->add_property( 'letter-spacing', $settings['letterSpacing'], 'em' ); - $css->add_property( 'padding', array( $settings['paddingTop'], $settings['paddingRight'], $settings['paddingBottom'], $settings['paddingLeft'] ), $settings['paddingUnit'] ); - $css->add_property( 'margin', array( $settings['marginTop'], $settings['marginRight'], $settings['marginBottom'], $settings['marginLeft'] ), $settings['marginUnit'] ); - $css->add_property( 'border-radius', array( $settings['borderRadiusTopLeft'], $settings['borderRadiusTopRight'], $settings['borderRadiusBottomRight'], $settings['borderRadiusBottomLeft'] ), $settings['borderRadiusUnit'] ); - $css->add_property( 'border-width', array( $settings['borderSizeTop'], $settings['borderSizeRight'], $settings['borderSizeBottom'], $settings['borderSizeLeft'] ), 'px' ); - $css->add_property( 'border-color', generateblocks_hex2rgba( $settings['borderColor'], $settings['borderColorOpacity'] ) ); - - if ( $settings['inlineWidth'] ) { - if ( $settings['hasIcon'] ) { - $css->add_property( 'display', 'inline-flex' ); - } else { - $css->add_property( 'display', 'inline-block' ); - } - } - - if ( $settings['hasIcon'] ) { - if ( ! $settings['inlineWidth'] ) { - $css->add_property( 'display', 'flex' ); - } - - if ( 'above' === $settings['iconLocation'] ) { - $css->add_property( 'text-align', $settings['alignment'] ); - } else { - $css->add_property( 'justify-content', generateblocks_get_flexbox_alignment( $settings['alignment'] ) ); - } - - if ( 'inline' === $settings['iconLocation'] ) { - $css->add_property( 'align-items', generateblocks_get_flexbox_alignment( $settings['iconVerticalAlignment'] ) ); - } - - if ( 'above' === $settings['iconLocation'] ) { - $css->add_property( 'flex-direction', 'column' ); - } - } - - $css->set_selector( $selector . ' a' ); - $css->add_property( 'color', $settings['linkColor'] ); - - $css->set_selector( $selector . ' a:hover' ); - $css->add_property( 'color', $settings['linkColorHover'] ); - - if ( $settings['hasIcon'] ) { - $css->set_selector( $selector . ' .gb-icon' ); - $css->add_property( 'color', generateblocks_hex2rgba( $settings['iconColor'], $settings['iconColorOpacity'] ) ); - - if ( ! $settings['removeText'] ) { - $css->add_property( 'padding', array( $settings['iconPaddingTop'], $settings['iconPaddingRight'], $settings['iconPaddingBottom'], $settings['iconPaddingLeft'] ), $settings['iconPaddingUnit'] ); - } - - if ( 'above' === $settings['iconLocation'] ) { - $css->add_property( 'display', 'inline' ); - } - - $css->set_selector( $selector . ' .gb-icon svg' ); - $css->add_property( 'width', $settings['iconSize'], $settings['iconSizeUnit'] ); - $css->add_property( 'height', $settings['iconSize'], $settings['iconSizeUnit'] ); - } - - if ( $settings['highlightTextColor'] ) { - $css->set_selector( $selector . ' .gb-highlight' ); - $css->add_property( 'color', $settings['highlightTextColor'] ); - } - - $tablet_css->set_selector( $selector ); - $tablet_css->add_property( 'text-align', $settings['alignmentTablet'] ); - $tablet_css->add_property( 'font-size', $settings['fontSizeTablet'], $settings['fontSizeUnit'] ); - $tablet_css->add_property( 'line-height', $settings['lineHeightTablet'], $settings['lineHeightUnit'] ); - $tablet_css->add_property( 'letter-spacing', $settings['letterSpacingTablet'], 'em' ); - $tablet_css->add_property( 'margin', array( $settings['marginTopTablet'], $settings['marginRightTablet'], $settings['marginBottomTablet'], $settings['marginLeftTablet'] ), $settings['marginUnit'] ); - $tablet_css->add_property( 'padding', array( $settings['paddingTopTablet'], $settings['paddingRightTablet'], $settings['paddingBottomTablet'], $settings['paddingLeftTablet'] ), $settings['paddingUnit'] ); - $tablet_css->add_property( 'border-radius', array( $settings['borderRadiusTopLeftTablet'], $settings['borderRadiusTopRightTablet'], $settings['borderRadiusBottomRightTablet'], $settings['borderRadiusBottomLeftTablet'] ), $settings['borderRadiusUnit'] ); - $tablet_css->add_property( 'border-width', array( $settings['borderSizeTopTablet'], $settings['borderSizeRightTablet'], $settings['borderSizeBottomTablet'], $settings['borderSizeLeftTablet'] ), 'px' ); - - if ( $settings['inlineWidthTablet'] ) { - if ( $settings['hasIcon'] ) { - $tablet_css->add_property( 'display', 'inline-flex' ); - } else { - $tablet_css->add_property( 'display', 'inline-block' ); - } - } - - if ( $settings['hasIcon'] ) { - $tablet_css->add_property( 'justify-content', generateblocks_get_flexbox_alignment( $settings['alignmentTablet'] ) ); - - if ( 'inline' === $settings['iconLocationTablet'] ) { - $tablet_css->add_property( 'align-items', generateblocks_get_flexbox_alignment( $settings['iconVerticalAlignmentTablet'] ) ); - } - - if ( 'above' === $settings['iconLocationTablet'] ) { - $tablet_css->add_property( 'flex-direction', 'column' ); - } - - $tablet_css->set_selector( $selector . ' .gb-icon' ); - - if ( ! $settings['removeText'] ) { - $tablet_css->add_property( 'padding', array( $settings['iconPaddingTopTablet'], $settings['iconPaddingRightTablet'], $settings['iconPaddingBottomTablet'], $settings['iconPaddingLeftTablet'] ), $settings['iconPaddingUnit'] ); - } - - if ( 'above' === $settings['iconLocationTablet'] || ( 'above' === $settings['iconLocation'] && '' == $settings['iconLocationTablet'] ) ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison - $tablet_css->add_property( 'align-self', generateblocks_get_flexbox_alignment( $settings['alignmentTablet'] ) ); - } - - if ( 'above' === $settings['iconLocationTablet'] ) { - $tablet_css->add_property( 'display', 'inline' ); - } - - $tablet_css->set_selector( $selector . ' .gb-icon svg' ); - $tablet_css->add_property( 'width', $settings['iconSizeTablet'], $settings['iconSizeUnit'] ); - $tablet_css->add_property( 'height', $settings['iconSizeTablet'], $settings['iconSizeUnit'] ); - } - - $mobile_css->set_selector( $selector ); - $mobile_css->add_property( 'text-align', $settings['alignmentMobile'] ); - $mobile_css->add_property( 'font-size', $settings['fontSizeMobile'], $settings['fontSizeUnit'] ); - $mobile_css->add_property( 'line-height', $settings['lineHeightMobile'], $settings['lineHeightUnit'] ); - $mobile_css->add_property( 'letter-spacing', $settings['letterSpacingMobile'], 'em' ); - $mobile_css->add_property( 'margin', array( $settings['marginTopMobile'], $settings['marginRightMobile'], $settings['marginBottomMobile'], $settings['marginLeftMobile'] ), $settings['marginUnit'] ); - $mobile_css->add_property( 'padding', array( $settings['paddingTopMobile'], $settings['paddingRightMobile'], $settings['paddingBottomMobile'], $settings['paddingLeftMobile'] ), $settings['paddingUnit'] ); - $mobile_css->add_property( 'border-radius', array( $settings['borderRadiusTopLeftMobile'], $settings['borderRadiusTopRightMobile'], $settings['borderRadiusBottomRightMobile'], $settings['borderRadiusBottomLeftMobile'] ), $settings['borderRadiusUnit'] ); - $mobile_css->add_property( 'border-width', array( $settings['borderSizeTopMobile'], $settings['borderSizeRightMobile'], $settings['borderSizeBottomMobile'], $settings['borderSizeLeftMobile'] ), 'px' ); - - if ( $settings['inlineWidthMobile'] ) { - if ( $settings['hasIcon'] ) { - $mobile_css->add_property( 'display', 'inline-flex' ); - } else { - $mobile_css->add_property( 'display', 'inline-block' ); - } - } - - if ( $settings['hasIcon'] ) { - $mobile_css->add_property( 'justify-content', generateblocks_get_flexbox_alignment( $settings['alignmentMobile'] ) ); - - if ( 'inline' === $settings['iconLocationMobile'] ) { - $mobile_css->add_property( 'align-items', generateblocks_get_flexbox_alignment( $settings['iconVerticalAlignmentMobile'] ) ); - } - - if ( 'above' === $settings['iconLocationMobile'] ) { - $mobile_css->add_property( 'flex-direction', 'column' ); - } - - $mobile_css->set_selector( $selector . ' .gb-icon' ); - - if ( ! $settings['removeText'] ) { - $mobile_css->add_property( 'padding', array( $settings['iconPaddingTopMobile'], $settings['iconPaddingRightMobile'], $settings['iconPaddingBottomMobile'], $settings['iconPaddingLeftMobile'] ), $settings['iconPaddingUnit'] ); - } - - if ( 'above' === $settings['iconLocationMobile'] || ( 'above' === $settings['iconLocation'] && '' == $settings['iconLocationMobile'] ) ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison - $mobile_css->add_property( 'align-self', generateblocks_get_flexbox_alignment( $settings['alignmentMobile'] ) ); - } - - if ( 'above' === $settings['iconLocationMobile'] ) { - $mobile_css->add_property( 'display', 'inline' ); - } - - $mobile_css->set_selector( $selector . ' .gb-icon svg' ); - $mobile_css->add_property( 'width', $settings['iconSizeMobile'], $settings['iconSizeUnit'] ); - $mobile_css->add_property( 'height', $settings['iconSizeMobile'], $settings['iconSizeUnit'] ); - } - } else { - // The below CSS is for users using the old headline wrapper. - $css->set_selector( '.gb-headline-wrapper' ); - $css->add_property( 'display', 'flex' ); - - $css->set_selector( '.gb-headline-wrapper > .gb-headline' ); - $css->add_property( 'margin', '0' ); - $css->add_property( 'padding', '0' ); - - $css->set_selector( '.gb-headline-' . $id ); - $css->add_property( 'font-family', $fontFamily ); - $css->add_property( 'text-align', $settings['alignment'] ); - $css->add_property( 'color', $settings['textColor'] ); - - if ( ! $settings['hasIcon'] ) { - $css->add_property( 'background-color', generateblocks_hex2rgba( $settings['backgroundColor'], $settings['backgroundColorOpacity'] ) ); - - if ( $settings['inlineWidth'] ) { - $css->add_property( 'display', 'inline-block' ); - } - - $css->add_property( 'border-width', array( $settings['borderSizeTop'], $settings['borderSizeRight'], $settings['borderSizeBottom'], $settings['borderSizeLeft'] ), 'px' ); - $css->add_property( 'border-color', generateblocks_hex2rgba( $settings['borderColor'], $settings['borderColorOpacity'] ) ); - } - - $css->add_property( 'font-size', $settings['fontSize'], $settings['fontSizeUnit'] ); - $css->add_property( 'font-weight', $settings['fontWeight'] ); - $css->add_property( 'text-transform', $settings['textTransform'] ); - $css->add_property( 'line-height', $settings['lineHeight'], $settings['lineHeightUnit'] ); - $css->add_property( 'letter-spacing', $settings['letterSpacing'], 'em' ); - - if ( ! $settings['hasIcon'] ) { - $css->add_property( 'padding', array( $settings['paddingTop'], $settings['paddingRight'], $settings['paddingBottom'], $settings['paddingLeft'] ), $settings['paddingUnit'] ); - $css->add_property( 'margin', array( $settings['marginTop'], $settings['marginRight'], $settings['marginBottom'], $settings['marginLeft'] ), $settings['marginUnit'] ); - - if ( function_exists( 'generate_get_default_fonts' ) && '' === $settings['marginBottom'] ) { - $defaultBlockStyles = generateblocks_get_default_styles(); - - if ( isset( $defaultBlockStyles['headline'][ $settings['element'] ]['marginBottom'] ) ) { - $css->add_property( 'margin-bottom', $defaultBlockStyles['headline'][ $settings['element'] ]['marginBottom'], $defaultBlockStyles['headline'][ $settings['element'] ]['marginUnit'] ); - } - } - } - - $css->set_selector( '.gb-headline-' . $id . ' a, .gb-headline-' . $id . ' a:visited' ); - $css->add_property( 'color', $settings['linkColor'] ); - - $css->set_selector( '.gb-headline-' . $id . ' a:hover' ); - $css->add_property( 'color', $settings['linkColorHover'] ); - - if ( $settings['hasIcon'] ) { - $css->set_selector( '.gb-headline-wrapper-' . $id . ' .gb-icon' ); - - if ( ! $settings['removeText'] ) { - $css->add_property( 'padding', array( $settings['iconPaddingTop'], $settings['iconPaddingRight'], $settings['iconPaddingBottom'], $settings['iconPaddingLeft'] ), $settings['iconPaddingUnit'] ); - } - - $css->add_property( 'color', generateblocks_hex2rgba( $settings['iconColor'], $settings['iconColorOpacity'] ) ); - - if ( 'above' === $settings['iconLocation'] ) { - $css->add_property( 'display', 'inline' ); - } - - $css->set_selector( '.gb-headline-wrapper-' . $id . ' .gb-icon svg' ); - $css->add_property( 'width', $settings['iconSize'], $settings['iconSizeUnit'] ); - $css->add_property( 'height', $settings['iconSize'], $settings['iconSizeUnit'] ); - - $css->set_selector( '.gb-headline-wrapper-' . $id ); - $css->add_property( 'padding', array( $settings['paddingTop'], $settings['paddingRight'], $settings['paddingBottom'], $settings['paddingLeft'] ), $settings['paddingUnit'] ); - $css->add_property( 'margin', array( $settings['marginTop'], $settings['marginRight'], $settings['marginBottom'], $settings['marginLeft'] ), $settings['marginUnit'] ); - - $defaultBlockStyles = generateblocks_get_default_styles(); - - if ( '' === $settings['marginBottom'] && ! $settings['removeText'] && isset( $defaultBlockStyles['headline'][ $settings['element'] ]['marginBottom'] ) && is_numeric( $defaultBlockStyles['headline'][ $settings['element'] ]['marginBottom'] ) ) { - $css->add_property( 'margin-bottom', $defaultBlockStyles['headline'][ $settings['element'] ]['marginBottom'], $defaultBlockStyles['headline'][ $settings['element'] ]['marginUnit'] ); - } - - if ( '' === $settings['fontSize'] && ! $settings['removeText'] && isset( $defaultBlockStyles['headline'][ $settings['element'] ]['fontSize'] ) ) { - $css->add_property( 'font-size', $defaultBlockStyles['headline'][ $settings['element'] ]['fontSize'], $defaultBlockStyles['headline'][ $settings['element'] ]['fontSizeUnit'] ); - } else { - $css->add_property( 'font-size', $settings['fontSize'], $settings['fontSizeUnit'] ); - } - - if ( 'above' === $settings['iconLocation'] ) { - $css->add_property( 'text-align', $settings['alignment'] ); - } else { - $css->add_property( 'justify-content', generateblocks_get_flexbox_alignment( $settings['alignment'] ) ); - } - - if ( $settings['inlineWidth'] ) { - $css->add_property( 'display', 'inline-flex' ); - } - - if ( 'inline' === $settings['iconLocation'] ) { - $css->add_property( 'align-items', generateblocks_get_flexbox_alignment( $settings['iconVerticalAlignment'] ) ); - } - - $css->add_property( 'background-color', generateblocks_hex2rgba( $settings['backgroundColor'], $settings['backgroundColorOpacity'] ) ); - $css->add_property( 'color', $settings['textColor'] ); - $css->add_property( 'border-width', array( $settings['borderSizeTop'], $settings['borderSizeRight'], $settings['borderSizeBottom'], $settings['borderSizeLeft'] ), 'px' ); - $css->add_property( 'border-color', generateblocks_hex2rgba( $settings['borderColor'], $settings['borderColorOpacity'] ) ); - - if ( 'above' === $settings['iconLocation'] ) { - $css->add_property( 'flex-direction', 'column' ); - } - } - - if ( $settings['highlightTextColor'] ) { - $css->set_selector( '.gb-headline-' . $id . ' .gb-highlight' ); - $css->add_property( 'color', $settings['highlightTextColor'] ); - } - - $tablet_css->set_selector( '.gb-headline-' . $id ); - $tablet_css->add_property( 'text-align', $settings['alignmentTablet'] ); - $tablet_css->add_property( 'font-size', $settings['fontSizeTablet'], $settings['fontSizeUnit'] ); - $tablet_css->add_property( 'line-height', $settings['lineHeightTablet'], $settings['lineHeightUnit'] ); - $tablet_css->add_property( 'letter-spacing', $settings['letterSpacingTablet'], 'em' ); - - if ( ! $settings['hasIcon'] ) { - $tablet_css->add_property( 'margin', array( $settings['marginTopTablet'], $settings['marginRightTablet'], $settings['marginBottomTablet'], $settings['marginLeftTablet'] ), $settings['marginUnit'] ); - $tablet_css->add_property( 'padding', array( $settings['paddingTopTablet'], $settings['paddingRightTablet'], $settings['paddingBottomTablet'], $settings['paddingLeftTablet'] ), $settings['paddingUnit'] ); - $tablet_css->add_property( 'border-width', array( $settings['borderSizeTopTablet'], $settings['borderSizeRightTablet'], $settings['borderSizeBottomTablet'], $settings['borderSizeLeftTablet'] ), 'px' ); - - if ( $settings['inlineWidthTablet'] ) { - $tablet_css->add_property( 'display', 'inline-flex' ); - } - } - - if ( $settings['hasIcon'] ) { - $tablet_css->set_selector( '.gb-headline-wrapper-' . $id . ' .gb-icon' ); - - if ( ! $settings['removeText'] ) { - $tablet_css->add_property( 'padding', array( $settings['iconPaddingTopTablet'], $settings['iconPaddingRightTablet'], $settings['iconPaddingBottomTablet'], $settings['iconPaddingLeftTablet'] ), $settings['iconPaddingUnit'] ); - } - - if ( 'above' === $settings['iconLocationTablet'] || ( 'above' === $settings['iconLocation'] && '' == $settings['iconLocationTablet'] ) ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison - $tablet_css->add_property( 'align-self', generateblocks_get_flexbox_alignment( $settings['alignmentTablet'] ) ); - } - - $tablet_css->set_selector( '.gb-headline-wrapper-' . $id . ' .gb-icon svg' ); - $tablet_css->add_property( 'width', $settings['iconSizeTablet'], $settings['iconSizeUnit'] ); - $tablet_css->add_property( 'height', $settings['iconSizeTablet'], $settings['iconSizeUnit'] ); - - $tablet_css->set_selector( '.gb-headline-wrapper-' . $id ); - $tablet_css->add_property( 'margin', array( $settings['marginTopTablet'], $settings['marginRightTablet'], $settings['marginBottomTablet'], $settings['marginLeftTablet'] ), $settings['marginUnit'] ); - $tablet_css->add_property( 'padding', array( $settings['paddingTopTablet'], $settings['paddingRightTablet'], $settings['paddingBottomTablet'], $settings['paddingLeftTablet'] ), $settings['paddingUnit'] ); - $tablet_css->add_property( 'border-width', array( $settings['borderSizeTopTablet'], $settings['borderSizeRightTablet'], $settings['borderSizeBottomTablet'], $settings['borderSizeLeftTablet'] ), 'px' ); - $tablet_css->add_property( 'justify-content', generateblocks_get_flexbox_alignment( $settings['alignmentTablet'] ) ); - - $defaultBlockStyles = generateblocks_get_default_styles(); - - if ( '' === $settings['marginBottomTablet'] && ! $settings['removeText'] && isset( $defaultBlockStyles['headline'][ $settings['element'] ]['marginBottomTablet'] ) && is_numeric( $defaultBlockStyles['headline'][ $settings['element'] ]['marginBottomTablet'] ) ) { - $tablet_css->add_property( 'margin-bottom', $defaultBlockStyles['headline'][ $settings['element'] ]['marginBottomTablet'], $defaultBlockStyles['headline'][ $settings['element'] ]['marginUnit'] ); - } - - if ( '' === $settings['fontSizeTablet'] && ! $settings['removeText'] && isset( $defaultBlockStyles['headline'][ $settings['element'] ]['fontSizeTablet'] ) ) { - $tablet_css->add_property( 'font-size', $defaultBlockStyles['headline'][ $settings['element'] ]['fontSizeTablet'], $defaultBlockStyles['headline'][ $settings['element'] ]['fontSizeUnit'] ); - } else { - $tablet_css->add_property( 'font-size', $settings['fontSizeTablet'], $settings['fontSizeUnit'] ); - } - - if ( $settings['inlineWidthTablet'] ) { - $tablet_css->add_property( 'display', 'inline-flex' ); - } - - if ( 'inline' === $settings['iconLocationTablet'] ) { - $tablet_css->add_property( 'align-items', generateblocks_get_flexbox_alignment( $settings['iconVerticalAlignmentTablet'] ) ); - } - - if ( 'above' === $settings['iconLocationTablet'] ) { - $tablet_css->add_property( 'flex-direction', 'column' ); - } - } - - $mobile_css->set_selector( '.gb-headline-' . $id ); - $mobile_css->add_property( 'text-align', $settings['alignmentMobile'] ); - $mobile_css->add_property( 'font-size', $settings['fontSizeMobile'], $settings['fontSizeUnit'] ); - $mobile_css->add_property( 'line-height', $settings['lineHeightMobile'], $settings['lineHeightUnit'] ); - $mobile_css->add_property( 'letter-spacing', $settings['letterSpacingMobile'], 'em' ); - - if ( ! $settings['hasIcon'] ) { - $mobile_css->add_property( 'margin', array( $settings['marginTopMobile'], $settings['marginRightMobile'], $settings['marginBottomMobile'], $settings['marginLeftMobile'] ), $settings['marginUnit'] ); - $mobile_css->add_property( 'padding', array( $settings['paddingTopMobile'], $settings['paddingRightMobile'], $settings['paddingBottomMobile'], $settings['paddingLeftMobile'] ), $settings['paddingUnit'] ); - $mobile_css->add_property( 'border-width', array( $settings['borderSizeTopMobile'], $settings['borderSizeRightMobile'], $settings['borderSizeBottomMobile'], $settings['borderSizeLeftMobile'] ), 'px' ); - - if ( $settings['inlineWidthMobile'] ) { - $mobile_css->add_property( 'display', 'inline-flex' ); - } - } - - if ( $settings['hasIcon'] ) { - $mobile_css->set_selector( '.gb-headline-wrapper-' . $id . ' .gb-icon' ); - - if ( ! $settings['removeText'] ) { - $mobile_css->add_property( 'padding', array( $settings['iconPaddingTopMobile'], $settings['iconPaddingRightMobile'], $settings['iconPaddingBottomMobile'], $settings['iconPaddingLeftMobile'] ), $settings['iconPaddingUnit'] ); - } - - if ( 'above' === $settings['iconLocationMobile'] || ( 'above' === $settings['iconLocation'] && '' == $settings['iconLocationMobile'] ) || ( 'above' === $settings['iconLocationTablet'] && '' == $settings['iconLocationMobile'] ) ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison - $mobile_css->add_property( 'align-self', generateblocks_get_flexbox_alignment( $settings['alignmentMobile'] ) ); - } - - $mobile_css->set_selector( '.gb-headline-wrapper-' . $id . ' .gb-icon svg' ); - $mobile_css->add_property( 'width', $settings['iconSizeMobile'], $settings['iconSizeUnit'] ); - $mobile_css->add_property( 'height', $settings['iconSizeMobile'], $settings['iconSizeUnit'] ); - - $mobile_css->set_selector( '.gb-headline-wrapper-' . $id ); - $mobile_css->add_property( 'margin', array( $settings['marginTopMobile'], $settings['marginRightMobile'], $settings['marginBottomMobile'], $settings['marginLeftMobile'] ), $settings['marginUnit'] ); - $mobile_css->add_property( 'padding', array( $settings['paddingTopMobile'], $settings['paddingRightMobile'], $settings['paddingBottomMobile'], $settings['paddingLeftMobile'] ), $settings['paddingUnit'] ); - $mobile_css->add_property( 'justify-content', generateblocks_get_flexbox_alignment( $settings['alignmentMobile'] ) ); - - $defaultBlockStyles = generateblocks_get_default_styles(); - - if ( '' === $settings['marginBottomMobile'] && ! $settings['removeText'] && isset( $defaultBlockStyles['headline'][ $settings['element'] ]['marginBottomMobile'] ) && is_numeric( $defaultBlockStyles['headline'][ $settings['element'] ]['marginBottomMobile'] ) ) { - $mobile_css->add_property( 'margin-bottom', $defaultBlockStyles['headline'][ $settings['element'] ]['marginBottomMobile'], $defaultBlockStyles['headline'][ $settings['element'] ]['marginUnit'] ); - } - - if ( '' === $settings['fontSizeMobile'] && ! $settings['removeText'] && ! empty( $defaultBlockStyles['headline'][ $settings['element'] ]['fontSizeMobile'] ) ) { - $mobile_css->add_property( 'font-size', $defaultBlockStyles['headline'][ $settings['element'] ]['fontSizeMobile'], $defaultBlockStyles['headline'][ $settings['element'] ]['fontSizeUnit'] ); - } else { - $mobile_css->add_property( 'font-size', $settings['fontSizeMobile'], $settings['fontSizeUnit'] ); - } - - if ( $settings['inlineWidthMobile'] ) { - $mobile_css->add_property( 'display', 'inline-flex' ); - } - - if ( 'inline' === $settings['iconLocationMobile'] ) { - $mobile_css->add_property( 'align-items', generateblocks_get_flexbox_alignment( $settings['iconVerticalAlignmentMobile'] ) ); - } - - if ( 'above' === $settings['iconLocationMobile'] ) { - $mobile_css->add_property( 'flex-direction', 'column' ); - } - } - } - - /** - * Do generateblocks_block_css_data hook - * - * @since 1.0 - * - * @param string $name The name of our block. - * @param array $settings The settings for the current block. - * @param object $css Our desktop/main CSS data. - * @param object $desktop_css Our desktop only CSS data. - * @param object $tablet_css Our tablet CSS data. - * @param object $tablet_only_css Our tablet only CSS data. - * @param object $mobile_css Our mobile CSS data. - */ - do_action( - 'generateblocks_block_css_data', - $name, - $settings, - $css, - $desktop_css, - $tablet_css, - $tablet_only_css, - $mobile_css - ); - } - - if ( $css->css_output() ) { - $main_css_data[] = $css->css_output(); - } - - if ( $desktop_css->css_output() ) { - $desktop_css_data[] = $desktop_css->css_output(); - } - - if ( $tablet_css->css_output() ) { - $tablet_css_data[] = $tablet_css->css_output(); - } - - if ( $tablet_only_css->css_output() ) { - $tablet_only_css_data[] = $tablet_only_css->css_output(); - } - - if ( $mobile_css->css_output() ) { - $mobile_css_data[] = $mobile_css->css_output(); - } - } - - /** - * Get our Image block CSS. - * - * @since 1.5.0 - */ - if ( 'image' === $name ) { - if ( empty( $blockData ) ) { - continue; - } - - $blocks_exist = true; - - $css = new GenerateBlocks_Dynamic_CSS(); - $desktop_css = new GenerateBlocks_Dynamic_CSS(); - $tablet_css = new GenerateBlocks_Dynamic_CSS(); - $tablet_only_css = new GenerateBlocks_Dynamic_CSS(); - $mobile_css = new GenerateBlocks_Dynamic_CSS(); - - $css->set_selector( '.gb-block-image img' ); - $css->add_property( 'vertical-align', 'middle' ); - - foreach ( $blockData as $atts ) { - if ( ! isset( $atts['uniqueId'] ) ) { - continue; - } - - $defaults = generateblocks_get_block_defaults(); - - $settings = wp_parse_args( - $atts, - $defaults['image'] - ); - - $id = $atts['uniqueId']; - - $css->set_selector( '.gb-block-image-' . $id ); - $css->add_property( 'padding', array( $settings['paddingTop'], $settings['paddingRight'], $settings['paddingBottom'], $settings['paddingLeft'] ), $settings['paddingUnit'] ); - $css->add_property( 'margin', array( $settings['marginTop'], $settings['marginRight'], $settings['marginBottom'], $settings['marginLeft'] ), $settings['marginUnit'] ); - - // Set a flag we'll update later if we disable floats. - $disable_float = false; - $has_desktop_float = 'floatLeft' === $settings['alignment'] || 'floatRight' === $settings['alignment']; - $has_tablet_float = 'floatLeft' === $settings['alignmentTablet'] || 'floatRight' === $settings['alignmentTablet']; - - if ( $has_desktop_float ) { - $css->add_property( 'float', generateblocks_get_float_alignment( $settings['alignment'] ) ); - } else { - $css->add_property( 'text-align', $settings['alignment'] ); - } - - $css->set_selector( '.gb-image-' . $id ); - $css->add_property( 'border-radius', array( $settings['borderRadiusTopLeft'], $settings['borderRadiusTopRight'], $settings['borderRadiusBottomRight'], $settings['borderRadiusBottomLeft'] ), $settings['borderRadiusUnit'] ); - $css->add_property( 'border-width', array( $settings['borderSizeTop'], $settings['borderSizeRight'], $settings['borderSizeBottom'], $settings['borderSizeLeft'] ), 'px' ); - $css->add_property( 'border-color', $settings['borderColor'] ); - $css->add_property( 'width', $settings['width'] ); - $css->add_property( 'height', $settings['height'] ); - $css->add_property( 'object-fit', $settings['objectFit'] ); - - $tablet_css->set_selector( '.gb-block-image-' . $id ); - $tablet_css->add_property( 'padding', array( $settings['paddingTopTablet'], $settings['paddingRightTablet'], $settings['paddingBottomTablet'], $settings['paddingLeftTablet'] ), $settings['paddingUnit'] ); - $tablet_css->add_property( 'margin', array( $settings['marginTopTablet'], $settings['marginRightTablet'], $settings['marginBottomTablet'], $settings['marginLeftTablet'] ), $settings['marginUnit'] ); - - if ( $has_tablet_float ) { - $tablet_css->add_property( 'float', generateblocks_get_float_alignment( $settings['alignmentTablet'] ) ); - } else { - $tablet_css->add_property( 'text-align', $settings['alignmentTablet'] ); - - if ( $settings['alignmentTablet'] && $has_desktop_float ) { - $tablet_css->add_property( 'float', 'none' ); - $disable_float = true; - } - } - - $tablet_css->set_selector( '.gb-image-' . $id ); - $tablet_css->add_property( 'border-radius', array( $settings['borderRadiusTopLeftTablet'], $settings['borderRadiusTopRightTablet'], $settings['borderRadiusBottomRightTablet'], $settings['borderRadiusBottomLeftTablet'] ), $settings['borderRadiusUnit'] ); - $tablet_css->add_property( 'border-width', array( $settings['borderSizeTopTablet'], $settings['borderSizeRightTablet'], $settings['borderSizeBottomTablet'], $settings['borderSizeLeftTablet'] ), 'px' ); - $tablet_css->add_property( 'width', $settings['widthTablet'] ); - $tablet_css->add_property( 'height', $settings['heightTablet'] ); - $tablet_css->add_property( 'object-fit', $settings['objectFitTablet'] ); - - $mobile_css->set_selector( '.gb-block-image-' . $id ); - $mobile_css->add_property( 'padding', array( $settings['paddingTopMobile'], $settings['paddingRightMobile'], $settings['paddingBottomMobile'], $settings['paddingLeftMobile'] ), $settings['paddingUnit'] ); - $mobile_css->add_property( 'margin', array( $settings['marginTopMobile'], $settings['marginRightMobile'], $settings['marginBottomMobile'], $settings['marginLeftMobile'] ), $settings['marginUnit'] ); - - if ( 'floatLeft' === $settings['alignmentMobile'] || 'floatRight' === $settings['alignmentMobile'] ) { - $mobile_css->add_property( 'float', generateblocks_get_float_alignment( $settings['alignmentMobile'] ) ); - } else { - $mobile_css->add_property( 'text-align', $settings['alignmentMobile'] ); - - if ( - $settings['alignmentMobile'] && - ! $disable_float && - ( - $has_desktop_float || - $has_tablet_float - ) - ) { - $mobile_css->add_property( 'float', 'none' ); - } - } - - $mobile_css->set_selector( '.gb-image-' . $id ); - $mobile_css->add_property( 'border-radius', array( $settings['borderRadiusTopLeftMobile'], $settings['borderRadiusTopRightMobile'], $settings['borderRadiusBottomRightMobile'], $settings['borderRadiusBottomLeftMobile'] ), $settings['borderRadiusUnit'] ); - $mobile_css->add_property( 'border-width', array( $settings['borderSizeTopMobile'], $settings['borderSizeRightMobile'], $settings['borderSizeBottomMobile'], $settings['borderSizeLeftMobile'] ), 'px' ); - $mobile_css->add_property( 'width', $settings['widthMobile'] ); - $mobile_css->add_property( 'height', $settings['heightMobile'] ); - $mobile_css->add_property( 'object-fit', $settings['objectFitMobile'] ); - - /** - * Do generateblocks_block_css_data hook - * - * @since 1.0 - * - * @param string $name The name of our block. - * @param array $settings The settings for the current block. - * @param object $css Our desktop/main CSS data. - * @param object $desktop_css Our desktop only CSS data. - * @param object $tablet_css Our tablet CSS data. - * @param object $tablet_only_css Our tablet only CSS data. - * @param object $mobile_css Our mobile CSS data. - */ - do_action( - 'generateblocks_block_css_data', - $name, - $settings, - $css, - $desktop_css, - $tablet_css, - $tablet_only_css, - $mobile_css - ); - } - - if ( $css->css_output() ) { - $main_css_data[] = $css->css_output(); - } - - if ( $desktop_css->css_output() ) { - $desktop_css_data[] = $desktop_css->css_output(); - } - - if ( $tablet_css->css_output() ) { - $tablet_css_data[] = $tablet_css->css_output(); - } - - if ( $tablet_only_css->css_output() ) { - $tablet_only_css_data[] = $tablet_only_css->css_output(); - } - - if ( $mobile_css->css_output() ) { - $mobile_css_data[] = $mobile_css->css_output(); - } - } - } - - if ( ! $blocks_exist ) { - return false; - } - - return apply_filters( - 'generateblocks_css_device_data', - array( - 'main' => $main_css_data, - 'desktop' => $desktop_css_data, - 'tablet' => $tablet_css_data, - 'tablet_only' => $tablet_only_css_data, - 'mobile' => $mobile_css_data, - ), - $settings - ); -} - -/** - * Turn our CSS array into plain CSS. - * - * @since 1.0 - * - * @param array $data Our CSS data. - */ -function generateblocks_get_parsed_css( $data ) { - $output = ''; - - foreach ( $data as $device => $selectors ) { - foreach ( $selectors as $selector => $properties ) { - if ( ! count( $properties ) ) { - continue; - } - - $temporary_output = $selector . '{'; - $elements_added = 0; - - foreach ( $properties as $key => $value ) { - if ( empty( $value ) ) { - continue; - } - - $elements_added++; - $temporary_output .= $value; - } - - $temporary_output .= '}'; - - if ( $elements_added > 0 ) { - $output .= $temporary_output; - } - } - } - - return $output; -} - -/** - * Print our CSS for each block. - * - * @since 0.1 - */ -function generateblocks_get_frontend_block_css() { - if ( ! function_exists( 'has_blocks' ) ) { - return; - } - - $content = generateblocks_get_parsed_content(); - - if ( ! $content ) { - return; - } - - $data = generateblocks_get_dynamic_css( $content ); - - if ( ! $data ) { - return; - } - - $css = ''; - - $css .= generateblocks_get_parsed_css( $data['main'] ); - - if ( ! empty( $data['desktop'] ) ) { - $css .= sprintf( - '@media %1$s {%2$s}', - generateblocks_get_media_query( 'desktop' ), - generateblocks_get_parsed_css( $data['desktop'] ) - ); - } - - if ( ! empty( $data['tablet'] ) ) { - $css .= sprintf( - '@media %1$s {%2$s}', - generateblocks_get_media_query( 'tablet' ), - generateblocks_get_parsed_css( $data['tablet'] ) - ); - } - - if ( ! empty( $data['tablet_only'] ) ) { - $css .= sprintf( - '@media %1$s {%2$s}', - generateblocks_get_media_query( 'tablet_only' ), - generateblocks_get_parsed_css( $data['tablet_only'] ) - ); - } - - if ( ! empty( $data['mobile'] ) ) { - $css .= sprintf( - '@media %1$s {%2$s}', - generateblocks_get_media_query( 'mobile' ), - generateblocks_get_parsed_css( $data['mobile'] ) - ); - } - - return apply_filters( 'generateblocks_css_output', $css ); -} diff --git a/plugin.php b/plugin.php index 3713323f8..cf9755d7f 100644 --- a/plugin.php +++ b/plugin.php @@ -27,7 +27,6 @@ require_once GENERATEBLOCKS_DIR . 'includes/functions.php'; require_once GENERATEBLOCKS_DIR . 'includes/general.php'; require_once GENERATEBLOCKS_DIR . 'includes/defaults.php'; -require_once GENERATEBLOCKS_DIR . 'includes/generate-css.php'; require_once GENERATEBLOCKS_DIR . 'includes/class-do-css.php'; require_once GENERATEBLOCKS_DIR . 'includes/class-enqueue-css.php'; require_once GENERATEBLOCKS_DIR . 'includes/dashboard.php'; @@ -39,6 +38,15 @@ require_once GENERATEBLOCKS_DIR . 'includes/class-rest.php'; require_once GENERATEBLOCKS_DIR . 'includes/class-legacy-attributes.php'; +// Blocks. +require_once GENERATEBLOCKS_DIR . 'includes/blocks/class-button.php'; +require_once GENERATEBLOCKS_DIR . 'includes/blocks/class-container.php'; +require_once GENERATEBLOCKS_DIR . 'includes/blocks/class-button-container.php'; +require_once GENERATEBLOCKS_DIR . 'includes/blocks/class-grid.php'; +require_once GENERATEBLOCKS_DIR . 'includes/blocks/class-headline.php'; +require_once GENERATEBLOCKS_DIR . 'includes/blocks/class-image.php'; +require_once GENERATEBLOCKS_DIR . 'includes/blocks/class-query-loop.php'; + add_action( 'plugins_loaded', 'generateblocks_load_plugin_textdomain' ); /** * Load GenerateBlocks textdomain. From 100570816d510f2792b8c7fd6010f299b158dab8 Mon Sep 17 00:00:00 2001 From: Tom Usborne Date: Thu, 23 Jun 2022 14:24:25 -0700 Subject: [PATCH 02/75] Fix headline output --- includes/blocks/class-headline.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/blocks/class-headline.php b/includes/blocks/class-headline.php index 056968e1d..e528aa982 100644 --- a/includes/blocks/class-headline.php +++ b/includes/blocks/class-headline.php @@ -735,7 +735,7 @@ public static function render_block( $attributes, $content, $block ) { ); } - $output = sprintf( + $output .= sprintf( '<%1$s %2$s>', $tagName, generateblocks_attr( From 70d30aaffa085fa1c42bd89fa54097efc18b0348 Mon Sep 17 00:00:00 2001 From: Tom Usborne Date: Thu, 23 Jun 2022 14:25:23 -0700 Subject: [PATCH 03/75] Fix attributes variables --- includes/blocks/class-headline.php | 2 +- includes/blocks/class-image.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/blocks/class-headline.php b/includes/blocks/class-headline.php index e528aa982..c3b47c75c 100644 --- a/includes/blocks/class-headline.php +++ b/includes/blocks/class-headline.php @@ -198,7 +198,7 @@ public static function get_css_data( $attributes ) { self::$block_ids[] = $id; - if ( ! isset( $atts['hasWrapper'] ) ) { + if ( ! isset( $attributes['hasWrapper'] ) ) { $css->set_selector( $selector ); $css->add_property( 'font-family', $fontFamily ); $css->add_property( 'text-align', $settings['alignment'] ); diff --git a/includes/blocks/class-image.php b/includes/blocks/class-image.php index 5c73c0f6b..238400c51 100644 --- a/includes/blocks/class-image.php +++ b/includes/blocks/class-image.php @@ -111,11 +111,11 @@ public static function get_css_data( $attributes ) { $defaults = generateblocks_get_block_defaults(); $settings = wp_parse_args( - $atts, + $attributes, $defaults['image'] ); - $id = $atts['uniqueId']; + $id = $attributes['uniqueId']; // Only add this CSS once. if ( count( (array) self::$block_ids ) === 0 ) { From f183d4d452215ce776276f564c8529cd726dd406 Mon Sep 17 00:00:00 2001 From: Tom Usborne Date: Thu, 23 Jun 2022 15:51:03 -0700 Subject: [PATCH 04/75] Add with_inline_styles function --- includes/blocks/class-button-container.php | 34 ++++++++++++---------- includes/blocks/class-button.php | 34 ++++++++++++---------- includes/blocks/class-container.php | 34 ++++++++++++---------- includes/blocks/class-grid.php | 34 ++++++++++++---------- includes/blocks/class-headline.php | 34 ++++++++++++---------- includes/blocks/class-image.php | 34 ++++++++++++---------- includes/functions.php | 22 ++++++++++++++ 7 files changed, 130 insertions(+), 96 deletions(-) diff --git a/includes/blocks/class-button-container.php b/includes/blocks/class-button-container.php index 85a72956e..8eac38446 100644 --- a/includes/blocks/class-button-container.php +++ b/includes/blocks/class-button-container.php @@ -195,13 +195,15 @@ public static function get_css_data( $attributes ) { */ public static function render_block( $attributes, $content, $block ) { if ( ! isset( $attributes['isDynamic'] ) || ! $attributes['isDynamic'] ) { - if ( ! in_array( $attributes['uniqueId'], self::$block_ids ) ) { - // Build our CSS for this block. - $content .= generateblocks_do_inline_css_output( - $content, - self::get_css_data( $attributes ) - ); - } + // Add styles to this block if needed. + $content = generateblocks_with_inline_styles( + $content, + [ + 'attributes' => $attributes, + 'css_data' => self::get_css_data( $attributes ), + 'block_ids' => self::$block_ids, + ] + ); return $content; } @@ -235,15 +237,15 @@ public static function render_block( $attributes, $content, $block ) { $classNames[] = $settings['className']; } - $output = ''; - - if ( ! in_array( $attributes['uniqueId'], self::$block_ids ) ) { - // Build our CSS for this block. - $output .= generateblocks_do_inline_css_output( - '', - self::get_css_data( $attributes ) - ); - } + // Add styles to this block if needed. + $output = generateblocks_with_inline_styles( + '', + [ + 'attributes' => $attributes, + 'css_data' => self::get_css_data( $attributes ), + 'block_ids' => self::$block_ids, + ] + ); $output .= sprintf( '
', diff --git a/includes/blocks/class-button.php b/includes/blocks/class-button.php index 7734a237c..9b41ef7a0 100644 --- a/includes/blocks/class-button.php +++ b/includes/blocks/class-button.php @@ -343,13 +343,15 @@ public static function render_block( $attributes, $content, $block ) { } if ( ! isset( $attributes['useDynamicData'] ) || ! $attributes['useDynamicData'] ) { - if ( ! in_array( $attributes['uniqueId'], self::$block_ids ) ) { - // Build our CSS for this block. - $content = generateblocks_do_inline_css_output( - $content, - self::get_css_data( $attributes ) - ); - } + // Add styles to this block if needed. + $content = generateblocks_with_inline_styles( + $content, + [ + 'attributes' => $attributes, + 'css_data' => self::get_css_data( $attributes ), + 'block_ids' => self::$block_ids, + ] + ); return $content; } @@ -416,15 +418,15 @@ public static function render_block( $attributes, $content, $block ) { $icon_html = GenerateBlocks_Dynamic_Content::get_icon_html( $content ); } - $output = ''; - - if ( ! in_array( $attributes['uniqueId'], self::$block_ids ) ) { - // Build our CSS for this block. - $output .= generateblocks_do_inline_css_output( - '', - self::get_css_data( $attributes ) - ); - } + // Add styles to this block if needed. + $output = generateblocks_with_inline_styles( + '', + [ + 'attributes' => $attributes, + 'css_data' => self::get_css_data( $attributes ), + 'block_ids' => self::$block_ids, + ] + ); foreach ( (array) $dynamic_content as $content ) { $tagName = 'span'; diff --git a/includes/blocks/class-container.php b/includes/blocks/class-container.php index 97cb02ae1..d344f393b 100644 --- a/includes/blocks/class-container.php +++ b/includes/blocks/class-container.php @@ -701,13 +701,15 @@ public static function get_css_data( $attributes ) { */ public static function render_block( $attributes, $content, $block ) { if ( ! isset( $attributes['isDynamic'] ) || ! $attributes['isDynamic'] ) { - if ( ! in_array( $attributes['uniqueId'], self::$block_ids ) ) { - // Build our CSS for this block. - $content = generateblocks_do_inline_css_output( - $content, - self::get_css_data( $attributes ) - ); - } + // Add styles to this block if needed. + $content = generateblocks_with_inline_styles( + $content, + [ + 'attributes' => $attributes, + 'css_data' => self::get_css_data( $attributes ), + 'block_ids' => self::$block_ids, + ] + ); return $content; } @@ -719,15 +721,15 @@ public static function render_block( $attributes, $content, $block ) { $defaults['container'] ); - $output = ''; - - if ( ! in_array( $attributes['uniqueId'], self::$block_ids ) ) { - // Build our CSS for this block. - $output .= generateblocks_do_inline_css_output( - '', - self::get_css_data( $attributes ) - ); - } + // Add styles to this block if needed. + $output = generateblocks_with_inline_styles( + '', + [ + 'attributes' => $attributes, + 'css_data' => self::get_css_data( $attributes ), + 'block_ids' => self::$block_ids, + ] + ); if ( $settings['isGrid'] ) { $gridItemClassNames = array( diff --git a/includes/blocks/class-grid.php b/includes/blocks/class-grid.php index 5735bc12c..6efa24c18 100644 --- a/includes/blocks/class-grid.php +++ b/includes/blocks/class-grid.php @@ -196,13 +196,15 @@ public static function get_css_data( $attributes ) { */ public static function render_block( $attributes, $content, $block ) { if ( ! isset( $attributes['isDynamic'] ) || ! $attributes['isDynamic'] ) { - if ( ! in_array( $attributes['uniqueId'], self::$block_ids ) ) { - // Build our CSS for this block. - $content = generateblocks_do_inline_css_output( - $content, - self::get_css_data( $attributes ) - ); - } + // Add styles to this block if needed. + $content = generateblocks_with_inline_styles( + $content, + [ + 'attributes' => $attributes, + 'css_data' => self::get_css_data( $attributes ), + 'block_ids' => self::$block_ids, + ] + ); return $content; } @@ -223,15 +225,15 @@ public static function render_block( $attributes, $content, $block ) { $classNames[] = $settings['className']; } - $output = ''; - - if ( ! in_array( $attributes['uniqueId'], self::$block_ids ) ) { - // Build our CSS for this block. - $output .= generateblocks_do_inline_css_output( - '', - self::get_css_data( $attributes ) - ); - } + // Add styles to this block if needed. + $output = generateblocks_with_inline_styles( + '', + [ + 'attributes' => $attributes, + 'css_data' => self::get_css_data( $attributes ), + 'block_ids' => self::$block_ids, + ] + ); $output .= sprintf( '
', diff --git a/includes/blocks/class-headline.php b/includes/blocks/class-headline.php index c3b47c75c..8924a9b89 100644 --- a/includes/blocks/class-headline.php +++ b/includes/blocks/class-headline.php @@ -649,13 +649,15 @@ public static function render_block( $attributes, $content, $block ) { } if ( ! isset( $attributes['useDynamicData'] ) || ! $attributes['useDynamicData'] ) { - if ( ! in_array( $attributes['uniqueId'], self::$block_ids ) ) { - // Build our CSS for this block. - $content = generateblocks_do_inline_css_output( - $content, - self::get_css_data( $attributes ) - ); - } + // Add styles to this block if needed. + $content = generateblocks_with_inline_styles( + $content, + [ + 'attributes' => $attributes, + 'css_data' => self::get_css_data( $attributes ), + 'block_ids' => self::$block_ids, + ] + ); return $content; } @@ -725,15 +727,15 @@ public static function render_block( $attributes, $content, $block ) { $tagName = 'div'; } - $output = ''; - - if ( ! in_array( $attributes['uniqueId'], self::$block_ids ) ) { - // Build our CSS for this block. - $output .= generateblocks_do_inline_css_output( - '', - self::get_css_data( $attributes ) - ); - } + // Add styles to this block if needed. + $output = generateblocks_with_inline_styles( + '', + [ + 'attributes' => $attributes, + 'css_data' => self::get_css_data( $attributes ), + 'block_ids' => self::$block_ids, + ] + ); $output .= sprintf( '<%1$s %2$s>', diff --git a/includes/blocks/class-image.php b/includes/blocks/class-image.php index 238400c51..96c79fc3b 100644 --- a/includes/blocks/class-image.php +++ b/includes/blocks/class-image.php @@ -241,13 +241,15 @@ public static function get_css_data( $attributes ) { */ public static function render_block( $attributes, $content, $block ) { if ( empty( $attributes['useDynamicData'] ) ) { - if ( ! in_array( $attributes['uniqueId'], self::$block_ids ) ) { - // Build our CSS for this block. - $content = generateblocks_do_inline_css_output( - $content, - self::get_css_data( $attributes ) - ); - } + // Add styles to this block if needed. + $content = generateblocks_with_inline_styles( + $content, + [ + 'attributes' => $attributes, + 'css_data' => self::get_css_data( $attributes ), + 'block_ids' => self::$block_ids, + ] + ); return generateblocks_filter_images( $content, $attributes ); } @@ -267,15 +269,15 @@ public static function render_block( $attributes, $content, $block ) { $defaults['image'] ); - $output = ''; - - if ( ! in_array( $attributes['uniqueId'], self::$block_ids ) ) { - // Build our CSS for this block. - $output .= generateblocks_do_inline_css_output( - '', - self::get_css_data( $attributes ) - ); - } + // Add styles to this block if needed. + $output = generateblocks_with_inline_styles( + '', + [ + 'attributes' => $attributes, + 'css_data' => self::get_css_data( $attributes ), + 'block_ids' => self::$block_ids, + ] + ); $output .= sprintf( '
', diff --git a/includes/functions.php b/includes/functions.php index fd253ef7d..51a114674 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -1214,3 +1214,25 @@ function( $css_data ) use ( $data ) { } ); } + +/** + * Prepend our inline styles to our blocks. + * + * @since 1.6.0 + * @param string $content Our block content. + * @param array $data Block data. + */ +function generateblocks_with_inline_styles( $content = '', $data = [] ) { + if ( + isset( $data['attributes']['uniqueId'] ) && + ! in_array( $data['attributes']['uniqueId'], $data['block_ids'] ) + ) { + // Build our CSS for this block. + $content .= generateblocks_do_inline_css_output( + $content, + $data['css_data'] + ); + } + + return $content; +} From c294a8fdffca34a103b74840d08191cfd4f83521 Mon Sep 17 00:00:00 2001 From: Tom Usborne Date: Mon, 27 Jun 2022 11:38:05 -0700 Subject: [PATCH 05/75] Update descriptions --- includes/blocks/class-button-container.php | 6 +++--- includes/blocks/class-button.php | 6 +++--- includes/blocks/class-container.php | 6 +++--- includes/blocks/class-grid.php | 6 +++--- includes/blocks/class-headline.php | 6 +++--- includes/blocks/class-image.php | 6 +++--- includes/blocks/class-query-loop.php | 6 +++--- 7 files changed, 21 insertions(+), 21 deletions(-) diff --git a/includes/blocks/class-button-container.php b/includes/blocks/class-button-container.php index 8eac38446..b36eae2e9 100644 --- a/includes/blocks/class-button-container.php +++ b/includes/blocks/class-button-container.php @@ -1,6 +1,6 @@ Date: Mon, 27 Jun 2022 12:22:38 -0700 Subject: [PATCH 06/75] Fix inline style generation --- includes/blocks/class-button-container.php | 4 ++-- includes/blocks/class-button.php | 4 ++-- includes/blocks/class-container.php | 4 ++-- includes/blocks/class-grid.php | 4 ++-- includes/blocks/class-headline.php | 4 ++-- includes/blocks/class-image.php | 4 ++-- includes/functions.php | 4 ++-- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/includes/blocks/class-button-container.php b/includes/blocks/class-button-container.php index b36eae2e9..4d8c3317d 100644 --- a/includes/blocks/class-button-container.php +++ b/includes/blocks/class-button-container.php @@ -199,8 +199,8 @@ public static function render_block( $attributes, $content, $block ) { $content = generateblocks_with_inline_styles( $content, [ + 'class_name' => 'GenerateBlocks_Block_Button_Container', 'attributes' => $attributes, - 'css_data' => self::get_css_data( $attributes ), 'block_ids' => self::$block_ids, ] ); @@ -241,8 +241,8 @@ public static function render_block( $attributes, $content, $block ) { $output = generateblocks_with_inline_styles( '', [ + 'class_name' => 'GenerateBlocks_Block_Button_Container', 'attributes' => $attributes, - 'css_data' => self::get_css_data( $attributes ), 'block_ids' => self::$block_ids, ] ); diff --git a/includes/blocks/class-button.php b/includes/blocks/class-button.php index 146990de9..1f1b403b4 100644 --- a/includes/blocks/class-button.php +++ b/includes/blocks/class-button.php @@ -347,8 +347,8 @@ public static function render_block( $attributes, $content, $block ) { $content = generateblocks_with_inline_styles( $content, [ + 'class_name' => 'GenerateBlocks_Block_Button', 'attributes' => $attributes, - 'css_data' => self::get_css_data( $attributes ), 'block_ids' => self::$block_ids, ] ); @@ -422,8 +422,8 @@ public static function render_block( $attributes, $content, $block ) { $output = generateblocks_with_inline_styles( '', [ + 'class_name' => 'GenerateBlocks_Block_Button', 'attributes' => $attributes, - 'css_data' => self::get_css_data( $attributes ), 'block_ids' => self::$block_ids, ] ); diff --git a/includes/blocks/class-container.php b/includes/blocks/class-container.php index beeb4ca3b..03df6fba3 100644 --- a/includes/blocks/class-container.php +++ b/includes/blocks/class-container.php @@ -705,8 +705,8 @@ public static function render_block( $attributes, $content, $block ) { $content = generateblocks_with_inline_styles( $content, [ + 'class_name' => 'GenerateBlocks_Block_Container', 'attributes' => $attributes, - 'css_data' => self::get_css_data( $attributes ), 'block_ids' => self::$block_ids, ] ); @@ -725,8 +725,8 @@ public static function render_block( $attributes, $content, $block ) { $output = generateblocks_with_inline_styles( '', [ + 'class_name' => 'GenerateBlocks_Block_Container', 'attributes' => $attributes, - 'css_data' => self::get_css_data( $attributes ), 'block_ids' => self::$block_ids, ] ); diff --git a/includes/blocks/class-grid.php b/includes/blocks/class-grid.php index bf11bf5b9..b8942adae 100644 --- a/includes/blocks/class-grid.php +++ b/includes/blocks/class-grid.php @@ -200,8 +200,8 @@ public static function render_block( $attributes, $content, $block ) { $content = generateblocks_with_inline_styles( $content, [ + 'class_name' => 'GenerateBlocks_Block_Grid', 'attributes' => $attributes, - 'css_data' => self::get_css_data( $attributes ), 'block_ids' => self::$block_ids, ] ); @@ -229,8 +229,8 @@ public static function render_block( $attributes, $content, $block ) { $output = generateblocks_with_inline_styles( '', [ + 'class_name' => 'GenerateBlocks_Block_Grid', 'attributes' => $attributes, - 'css_data' => self::get_css_data( $attributes ), 'block_ids' => self::$block_ids, ] ); diff --git a/includes/blocks/class-headline.php b/includes/blocks/class-headline.php index 3e86376c5..5608860ad 100644 --- a/includes/blocks/class-headline.php +++ b/includes/blocks/class-headline.php @@ -653,8 +653,8 @@ public static function render_block( $attributes, $content, $block ) { $content = generateblocks_with_inline_styles( $content, [ + 'class_name' => 'GenerateBlocks_Block_Headline', 'attributes' => $attributes, - 'css_data' => self::get_css_data( $attributes ), 'block_ids' => self::$block_ids, ] ); @@ -731,8 +731,8 @@ public static function render_block( $attributes, $content, $block ) { $output = generateblocks_with_inline_styles( '', [ + 'class_name' => 'GenerateBlocks_Block_Headline', 'attributes' => $attributes, - 'css_data' => self::get_css_data( $attributes ), 'block_ids' => self::$block_ids, ] ); diff --git a/includes/blocks/class-image.php b/includes/blocks/class-image.php index 77ba77f7b..063ea5510 100644 --- a/includes/blocks/class-image.php +++ b/includes/blocks/class-image.php @@ -245,8 +245,8 @@ public static function render_block( $attributes, $content, $block ) { $content = generateblocks_with_inline_styles( $content, [ + 'class_name' => 'GenerateBlocks_Block_Image', 'attributes' => $attributes, - 'css_data' => self::get_css_data( $attributes ), 'block_ids' => self::$block_ids, ] ); @@ -273,8 +273,8 @@ public static function render_block( $attributes, $content, $block ) { $output = generateblocks_with_inline_styles( '', [ + 'class_name' => 'GenerateBlocks_Block_Image', 'attributes' => $attributes, - 'css_data' => self::get_css_data( $attributes ), 'block_ids' => self::$block_ids, ] ); diff --git a/includes/functions.php b/includes/functions.php index 51a114674..615100c78 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -1228,9 +1228,9 @@ function generateblocks_with_inline_styles( $content = '', $data = [] ) { ! in_array( $data['attributes']['uniqueId'], $data['block_ids'] ) ) { // Build our CSS for this block. - $content .= generateblocks_do_inline_css_output( + $content = generateblocks_do_inline_css_output( $content, - $data['css_data'] + call_user_func( [ $data['class_name'], 'get_css_data' ], $data['attributes'] ) ); } From 61ab0d76499ac22e6a871b9a44c0d881c0fbe95b Mon Sep 17 00:00:00 2001 From: Tom Usborne Date: Mon, 27 Jun 2022 16:08:26 -0700 Subject: [PATCH 07/75] Simplify CSS functions --- includes/functions.php | 175 +++++++---------------------------------- 1 file changed, 28 insertions(+), 147 deletions(-) diff --git a/includes/functions.php b/includes/functions.php index 615100c78..36e37120e 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -977,36 +977,6 @@ function generateblocks_group_css_data( $existing_data = [], $new_data ) { return $existing_data; } -/** - * Output our CSS inline or within wp_head. - * - * This is a fallback in case we aren't able to find - * our blocks in generateblocks_get_parsed_content(). - * - * @since 1.6.0 - * @param string $content Our block content. - * @param array $css_data Our CSS data. - */ -function generateblocks_do_inline_css_output( $content, $css_data ) { - if ( did_action( 'wp_head' ) ) { - // Add inline ', - $compiled_css - ) . $content; - } - } else { - // Add our CSS to the pool of existing CSS in wp_head. - generateblocks_add_to_css_data( $css_data ); - } - - return $content; -} - /** * Turn our CSS array into plain CSS. * @@ -1062,118 +1032,17 @@ function generateblocks_get_dynamic_css( $content = '' ) { return; } - foreach ( $data as $name => $blockData ) { - /** - * Get our Grid block CSS. - * - * @since 0.1 - */ - if ( 'grid' === $name ) { - if ( empty( $blockData ) ) { - continue; - } - - foreach ( $blockData as $atts ) { - if ( ! isset( $atts['uniqueId'] ) ) { - continue; - } - - generateblocks_add_to_css_data( - GenerateBlocks_Block_Grid::get_css_data( $atts ) - ); - } - } - - /** - * Get our Container block CSS. - * - * @since 0.1 - */ - if ( 'container' === $name ) { - if ( empty( $blockData ) ) { - continue; - } - - foreach ( $blockData as $atts ) { - if ( ! isset( $atts['uniqueId'] ) ) { - continue; - } - - generateblocks_add_to_css_data( - GenerateBlocks_Block_Container::get_css_data( $atts ) - ); - } - } - - /** - * Get our Button Container block CSS. - * - * @since 0.1 - */ - if ( 'button-container' === $name ) { - if ( empty( $blockData ) ) { - continue; - } - - foreach ( $blockData as $atts ) { - if ( ! isset( $atts['uniqueId'] ) ) { - continue; - } - - generateblocks_add_to_css_data( - GenerateBlocks_Block_Button_Container::get_css_data( $atts ) - ); - } - } - - /** - * Get our Button block CSS. - * - * @since 0.1 - */ - if ( 'button' === $name ) { - if ( empty( $blockData ) ) { - continue; - } - - foreach ( $blockData as $atts ) { - if ( ! isset( $atts['uniqueId'] ) ) { - continue; - } - - generateblocks_add_to_css_data( - GenerateBlocks_Block_Button::get_css_data( $atts ) - ); - } - } - - /** - * Get our Headline block CSS. - * - * @since 0.1 - */ - if ( 'headline' === $name ) { - if ( empty( $blockData ) ) { - continue; - } - - foreach ( $blockData as $atts ) { - if ( ! isset( $atts['uniqueId'] ) ) { - continue; - } - - generateblocks_add_to_css_data( - GenerateBlocks_Block_Headline::get_css_data( $atts ) - ); - } - } + $blocks = [ + 'grid' => 'GenerateBlocks_Block_Grid', + 'container' => 'GenerateBlocks_Block_Container', + 'button-container' => 'GenerateBlocks_Block_Button_Container', + 'button' => 'GenerateBlocks_Block_Button', + 'headline' => 'GenerateBlocks_Block_Headline', + 'image' => 'GenerateBlocks_Block_Image', + ]; - /** - * Get our Image block CSS. - * - * @since 1.5.0 - */ - if ( 'image' === $name ) { + foreach ( $data as $name => $blockData ) { + if ( isset( $blocks[ $name ] ) ) { if ( empty( $blockData ) ) { continue; } @@ -1184,7 +1053,7 @@ function generateblocks_get_dynamic_css( $content = '' ) { } generateblocks_add_to_css_data( - GenerateBlocks_Block_Image::get_css_data( $atts ) + call_user_func( [ $blocks[ $name ], 'get_css_data' ], $atts ) ); } } @@ -1227,11 +1096,23 @@ function generateblocks_with_inline_styles( $content = '', $data = [] ) { isset( $data['attributes']['uniqueId'] ) && ! in_array( $data['attributes']['uniqueId'], $data['block_ids'] ) ) { - // Build our CSS for this block. - $content = generateblocks_do_inline_css_output( - $content, - call_user_func( [ $data['class_name'], 'get_css_data' ], $data['attributes'] ) - ); + $css_data = call_user_func( [ $data['class_name'], 'get_css_data' ], $data['attributes'] ); + + if ( did_action( 'wp_head' ) ) { + // Add inline ', + $compiled_css + ) . $content; + } + } else { + // Add our CSS to the pool of existing CSS in wp_head. + generateblocks_add_to_css_data( $css_data ); + } } return $content; From 34aaf0c0a4a345d939ba4a2a504e0838b5d53e58 Mon Sep 17 00:00:00 2001 From: Tom Usborne Date: Mon, 27 Jun 2022 18:32:22 -0700 Subject: [PATCH 08/75] Replace call_user_func --- includes/functions.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/includes/functions.php b/includes/functions.php index 36e37120e..4edb07b12 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -1052,9 +1052,11 @@ function generateblocks_get_dynamic_css( $content = '' ) { continue; } - generateblocks_add_to_css_data( - call_user_func( [ $blocks[ $name ], 'get_css_data' ], $atts ) - ); + if ( is_callable( [ $blocks[ $name ], 'get_css_data' ] ) ) { + generateblocks_add_to_css_data( + $blocks[ $name ]::get_css_data( $atts ) + ); + } } } } @@ -1096,7 +1098,13 @@ function generateblocks_with_inline_styles( $content = '', $data = [] ) { isset( $data['attributes']['uniqueId'] ) && ! in_array( $data['attributes']['uniqueId'], $data['block_ids'] ) ) { - $css_data = call_user_func( [ $data['class_name'], 'get_css_data' ], $data['attributes'] ); + $css_data = is_callable( [ $data['class_name'], 'get_css_data' ] ) + ? $data['class_name']::get_css_data( $data['attributes'] ) + : false; + + if ( ! $css_data ) { + return $content; + } if ( did_action( 'wp_head' ) ) { // Add inline ', + // Add a "dummy" handle we can add inline styles to. + wp_register_style( 'generateblocks', false ); // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.MissingVersion + wp_enqueue_style( 'generateblocks' ); + + wp_add_inline_style( + 'generateblocks', wp_strip_all_tags( $css ) // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ); } diff --git a/includes/functions.php b/includes/functions.php index 6dba2f669..b3afd4d7a 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -1056,7 +1056,7 @@ function generateblocks_get_dynamic_css( $content = '', $store_block_id_only = f if ( is_callable( [ $blocks[ $name ], 'get_css_data' ] ) ) { if ( $store_block_id_only ) { $blocks[ $name ]::store_block_id( $atts['uniqueId'] ); - } else { + } elseif ( ! in_array( $atts['uniqueId'], $blocks[ $name ]::$block_ids ) ) { generateblocks_add_to_css_data( $blocks[ $name ]::get_css_data( $atts ) ); From dca8fa71313c3df6b068a3cde83d19128fc8ff14 Mon Sep 17 00:00:00 2001 From: Tom Usborne Date: Mon, 5 Sep 2022 08:38:19 -0700 Subject: [PATCH 57/75] Add block_id_exists function --- includes/blocks/class-button-container.php | 11 ++++++++++- includes/blocks/class-button.php | 11 ++++++++++- includes/blocks/class-container.php | 11 ++++++++++- includes/blocks/class-grid.php | 11 ++++++++++- includes/blocks/class-headline.php | 11 ++++++++++- includes/blocks/class-image.php | 11 ++++++++++- includes/functions.php | 2 +- 7 files changed, 61 insertions(+), 7 deletions(-) diff --git a/includes/blocks/class-button-container.php b/includes/blocks/class-button-container.php index 543ccc073..298e24a4e 100644 --- a/includes/blocks/class-button-container.php +++ b/includes/blocks/class-button-container.php @@ -18,7 +18,7 @@ class GenerateBlocks_Block_Button_Container { * * @var array $block_ids The current block id. */ - public static $block_ids = []; + private static $block_ids = []; /** * Keep track of CSS we want to output once per block type. @@ -66,6 +66,15 @@ public static function store_block_id( $id ) { self::$block_ids[] = $id; } + /** + * Check if our block ID exists. + * + * @param string $id The block ID to store. + */ + public static function block_id_exists( $id ) { + return in_array( $id, (array) self::$block_ids ); + } + /** * Compile our CSS data based on our block attributes. * diff --git a/includes/blocks/class-button.php b/includes/blocks/class-button.php index 16dc94c41..5bff2b2da 100644 --- a/includes/blocks/class-button.php +++ b/includes/blocks/class-button.php @@ -18,7 +18,7 @@ class GenerateBlocks_Block_Button { * * @var array $block_ids The current block id. */ - public static $block_ids = []; + private static $block_ids = []; /** * Keep track of CSS we want to output once per block type. @@ -151,6 +151,15 @@ public static function store_block_id( $id ) { self::$block_ids[] = $id; } + /** + * Check if our block ID exists. + * + * @param string $id The block ID to store. + */ + public static function block_id_exists( $id ) { + return in_array( $id, (array) self::$block_ids ); + } + /** * Compile our CSS data based on our block attributes. * diff --git a/includes/blocks/class-container.php b/includes/blocks/class-container.php index 53cd8d90c..6b3d35fcd 100644 --- a/includes/blocks/class-container.php +++ b/includes/blocks/class-container.php @@ -18,7 +18,7 @@ class GenerateBlocks_Block_Container { * * @var array $block_ids The current block id. */ - public static $block_ids = []; + private static $block_ids = []; /** * Keep track of CSS we want to output once per block type. @@ -179,6 +179,15 @@ public static function store_block_id( $id ) { self::$block_ids[] = $id; } + /** + * Check if our block ID exists. + * + * @param string $id The block ID to store. + */ + public static function block_id_exists( $id ) { + return in_array( $id, (array) self::$block_ids ); + } + /** * Compile our CSS data based on our block attributes. * diff --git a/includes/blocks/class-grid.php b/includes/blocks/class-grid.php index 8fce902c7..437c8326e 100644 --- a/includes/blocks/class-grid.php +++ b/includes/blocks/class-grid.php @@ -18,7 +18,7 @@ class GenerateBlocks_Block_Grid { * * @var array $block_ids The current block id. */ - public static $block_ids = []; + private static $block_ids = []; /** * Keep track of CSS we want to output once per block type. @@ -56,6 +56,15 @@ public static function store_block_id( $id ) { self::$block_ids[] = $id; } + /** + * Check if our block ID exists. + * + * @param string $id The block ID to store. + */ + public static function block_id_exists( $id ) { + return in_array( $id, (array) self::$block_ids ); + } + /** * Compile our CSS data based on our block attributes. * diff --git a/includes/blocks/class-headline.php b/includes/blocks/class-headline.php index e216c1255..3eb6685a8 100644 --- a/includes/blocks/class-headline.php +++ b/includes/blocks/class-headline.php @@ -18,7 +18,7 @@ class GenerateBlocks_Block_Headline { * * @var array $block_ids The current block id. */ - public static $block_ids = []; + private static $block_ids = []; /** * Keep track of CSS we want to output once per block type. @@ -157,6 +157,15 @@ public static function store_block_id( $id ) { self::$block_ids[] = $id; } + /** + * Check if our block ID exists. + * + * @param string $id The block ID to store. + */ + public static function block_id_exists( $id ) { + return in_array( $id, (array) self::$block_ids ); + } + /** * Compile our CSS data based on our block attributes. * diff --git a/includes/blocks/class-image.php b/includes/blocks/class-image.php index c371b3822..9032b0a6e 100644 --- a/includes/blocks/class-image.php +++ b/includes/blocks/class-image.php @@ -18,7 +18,7 @@ class GenerateBlocks_Block_Image { * * @var array $block_ids The current block id. */ - public static $block_ids = []; + private static $block_ids = []; /** * Keep track of CSS we want to output once per block type. @@ -111,6 +111,15 @@ public static function store_block_id( $id ) { self::$block_ids[] = $id; } + /** + * Check if our block ID exists. + * + * @param string $id The block ID to store. + */ + public static function block_id_exists( $id ) { + return in_array( $id, (array) self::$block_ids ); + } + /** * Compile our CSS data based on our block attributes. * diff --git a/includes/functions.php b/includes/functions.php index b3afd4d7a..40f6f948c 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -1056,7 +1056,7 @@ function generateblocks_get_dynamic_css( $content = '', $store_block_id_only = f if ( is_callable( [ $blocks[ $name ], 'get_css_data' ] ) ) { if ( $store_block_id_only ) { $blocks[ $name ]::store_block_id( $atts['uniqueId'] ); - } elseif ( ! in_array( $atts['uniqueId'], $blocks[ $name ]::$block_ids ) ) { + } elseif ( ! $blocks[ $name ]::block_id_exists( $atts['uniqueId'] ) ) { generateblocks_add_to_css_data( $blocks[ $name ]::get_css_data( $atts ) ); From 4d9df4cbfd3aafccf11f3d1ca81a688335e91f60 Mon Sep 17 00:00:00 2001 From: Tom Usborne Date: Mon, 5 Sep 2022 12:36:43 -0700 Subject: [PATCH 58/75] Update readme.txt --- readme.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/readme.txt b/readme.txt index b73f89a8e..ec35d9863 100644 --- a/readme.txt +++ b/readme.txt @@ -95,6 +95,7 @@ GenerateBlocks was built to work hand-in-hand with [GeneratePress](https://gener * Fix: "Sticky posts only" not displaying correctly in the frontend * Fix: Pass dynamic container link to settings variable * Fix: Color picker behavior when manually changing value +* Tweak: Enqueue inline embedding stylesheet using wp_enqueue_scripts * Tweak: Remove block-editor-block-list__block class from root wrapper * Tweak: Headline transform to core Heading keep the level From 413b09c8fc03e13670c708cab06f6efaa7df4ebe Mon Sep 17 00:00:00 2001 From: Tom Usborne Date: Tue, 6 Sep 2022 08:44:51 -0700 Subject: [PATCH 59/75] 1.6.0-alpha.2 --- package.json | 2 +- plugin.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 6aba06b07..0a7b94310 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "generateblocks", - "version": "1.6.0-alpha.1", + "version": "1.6.0-alpha.2", "private": true, "description": "A small collection of lightweight WordPress blocks that can accomplish nearly anything.", "author": "Tom Usborne", diff --git a/plugin.php b/plugin.php index d43cf4b14..177e1cc5a 100644 --- a/plugin.php +++ b/plugin.php @@ -5,7 +5,7 @@ * Description: A small collection of lightweight WordPress blocks that can accomplish nearly anything. * Author: Tom Usborne * Author URI: https://tomusborne.com - * Version: 1.6.0-alpha.1 + * Version: 1.6.0-alpha.2 * Requires at least: 5.9 * Requires PHP: 5.6 * License: GPL2+ @@ -19,7 +19,7 @@ exit; // Exit if accessed directly. } -define( 'GENERATEBLOCKS_VERSION', '1.6.0-alpha.1' ); +define( 'GENERATEBLOCKS_VERSION', '1.6.0-alpha.2' ); define( 'GENERATEBLOCKS_DIR', plugin_dir_path( __FILE__ ) ); define( 'GENERATEBLOCKS_DIR_URL', plugin_dir_url( __FILE__ ) ); From 00e83433ea3a22e3fbb63f00df6fe8e947a7be2e Mon Sep 17 00:00:00 2001 From: Tom Usborne Date: Mon, 12 Sep 2022 15:15:35 -0700 Subject: [PATCH 60/75] 1.6.0-beta.1 --- package.json | 2 +- plugin.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 0a7b94310..fc67c0a02 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "generateblocks", - "version": "1.6.0-alpha.2", + "version": "1.6.0-beta.1", "private": true, "description": "A small collection of lightweight WordPress blocks that can accomplish nearly anything.", "author": "Tom Usborne", diff --git a/plugin.php b/plugin.php index 177e1cc5a..16953e0d7 100644 --- a/plugin.php +++ b/plugin.php @@ -5,7 +5,7 @@ * Description: A small collection of lightweight WordPress blocks that can accomplish nearly anything. * Author: Tom Usborne * Author URI: https://tomusborne.com - * Version: 1.6.0-alpha.2 + * Version: 1.6.0-beta.1 * Requires at least: 5.9 * Requires PHP: 5.6 * License: GPL2+ @@ -19,7 +19,7 @@ exit; // Exit if accessed directly. } -define( 'GENERATEBLOCKS_VERSION', '1.6.0-alpha.2' ); +define( 'GENERATEBLOCKS_VERSION', '1.6.0-beta.1' ); define( 'GENERATEBLOCKS_DIR', plugin_dir_path( __FILE__ ) ); define( 'GENERATEBLOCKS_DIR_URL', plugin_dir_url( __FILE__ ) ); From 98bd813422b5f5d3d26d736e5979792aee3c098e Mon Sep 17 00:00:00 2001 From: Jean Paiva Date: Tue, 13 Sep 2022 15:10:38 -0300 Subject: [PATCH 61/75] Fix: Container styles being overwritten when multi-selected --- readme.txt | 1 + src/components/color-picker/index.js | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/readme.txt b/readme.txt index ec35d9863..59ebb1e81 100644 --- a/readme.txt +++ b/readme.txt @@ -95,6 +95,7 @@ GenerateBlocks was built to work hand-in-hand with [GeneratePress](https://gener * Fix: "Sticky posts only" not displaying correctly in the frontend * Fix: Pass dynamic container link to settings variable * Fix: Color picker behavior when manually changing value +* Fix: Container styles being overwritten when multi-selected * Tweak: Enqueue inline embedding stylesheet using wp_enqueue_scripts * Tweak: Remove block-editor-block-list__block class from root wrapper * Tweak: Headline transform to core Heading keep the level diff --git a/src/components/color-picker/index.js b/src/components/color-picker/index.js index 431ba1f99..a69b1a3a2 100644 --- a/src/components/color-picker/index.js +++ b/src/components/color-picker/index.js @@ -34,7 +34,7 @@ export default function ColorPicker( props ) { tooltip, } = props; - const [ valueState, setValueState ] = useState( value || '' ); + const [ valueState, setValueState ] = useState( value ); const inputRef = useRef( null ); const Component = alpha && 1 === valueOpacity @@ -65,7 +65,9 @@ export default function ColorPicker( props ) { const debouncedSetColor = useDebounce( onChange ); useEffect( () => { - debouncedSetColor( valueState ); + if ( value !== valueState ) { + debouncedSetColor( valueState ); + } // Keep the input focused. setTimeout( () => { From f28f0e3267eef9e619c336927de23da3b2d19280 Mon Sep 17 00:00:00 2001 From: Tom Usborne Date: Tue, 13 Sep 2022 12:18:49 -0700 Subject: [PATCH 62/75] Update readme.txt --- readme.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/readme.txt b/readme.txt index 59ebb1e81..ec35d9863 100644 --- a/readme.txt +++ b/readme.txt @@ -95,7 +95,6 @@ GenerateBlocks was built to work hand-in-hand with [GeneratePress](https://gener * Fix: "Sticky posts only" not displaying correctly in the frontend * Fix: Pass dynamic container link to settings variable * Fix: Color picker behavior when manually changing value -* Fix: Container styles being overwritten when multi-selected * Tweak: Enqueue inline embedding stylesheet using wp_enqueue_scripts * Tweak: Remove block-editor-block-list__block class from root wrapper * Tweak: Headline transform to core Heading keep the level From ad8ccc4b42c9c717d8523225b8e605ff1bfb030b Mon Sep 17 00:00:00 2001 From: Tom Usborne Date: Tue, 13 Sep 2022 12:27:38 -0700 Subject: [PATCH 63/75] Add empty string default to color --- src/components/color-picker/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/color-picker/index.js b/src/components/color-picker/index.js index a69b1a3a2..82c54cdfb 100644 --- a/src/components/color-picker/index.js +++ b/src/components/color-picker/index.js @@ -34,7 +34,7 @@ export default function ColorPicker( props ) { tooltip, } = props; - const [ valueState, setValueState ] = useState( value ); + const [ valueState, setValueState ] = useState( value || '' ); const inputRef = useRef( null ); const Component = alpha && 1 === valueOpacity From bd502286af1cdf925094c658a5697eae8afc06bc Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 13 Sep 2022 19:30:57 +0000 Subject: [PATCH 64/75] Update dist files --- dist/blocks.asset.php | 2 +- dist/blocks.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/blocks.asset.php b/dist/blocks.asset.php index c23c429e1..72ddf86e3 100644 --- a/dist/blocks.asset.php +++ b/dist/blocks.asset.php @@ -1 +1 @@ - array('lodash', 'react', 'react-dom', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-date', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-notices', 'wp-primitives', 'wp-rich-text'), 'version' => 'dd2516c6c37f4c8296fb10d78dbeb0ac'); \ No newline at end of file + array('lodash', 'react', 'react-dom', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-date', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-notices', 'wp-primitives', 'wp-rich-text'), 'version' => '4007f20da68e8136395e273b5e71295b'); \ No newline at end of file diff --git a/dist/blocks.js b/dist/blocks.js index bd551d471..555fa8edd 100644 --- a/dist/blocks.js +++ b/dist/blocks.js @@ -4,7 +4,7 @@ /* translators: Dimension label (padding, margin, border) */,"aria-label":(0,i.sprintf)((0,i.__)("%s Top","generateblocks"),r),value:l[m.top]||"",min:"margin"!==o?0:void 0}),(0,e.createElement)("label",{htmlFor:m.top,className:"gblocks-dimensions-control__label"},f.top)),(0,e.createElement)("div",null,(0,e.createElement)("input",{id:m.right,className:"components-gblocks-dimensions-control__number",placeholder:B(m.right,l,d,""),type:"number",onChange:e=>{let t=e.target.value;"margin"!==o&&(t=t.toString().replace(/-/g,"")),l[m.sync]?h(t):(e=>{a({[m.right]:e})})(t)} /* translators: Dimension label (padding, margin, border) */,"aria-label":(0,i.sprintf)((0,i.__)("%s Right","generateblocks"),r),value:l[m.right]||"",min:"margin"!==o?0:void 0}),(0,e.createElement)("label",{htmlFor:m.right,className:"gblocks-dimensions-control__label"},f.right)),(0,e.createElement)("div",null,(0,e.createElement)("input",{id:m.bottom,className:"components-gblocks-dimensions-control__number",placeholder:B(m.bottom,l,d,"margin"===o&&"px"===l.marginUnit?b.marginBottom:""),type:"number",onChange:e=>{let t=e.target.value;"margin"!==o&&(t=t.toString().replace(/-/g,"")),l[m.sync]?h(t):(e=>{a({[m.bottom]:e})})(t)} /* translators: Dimension label (padding, margin, border) */,"aria-label":(0,i.sprintf)((0,i.__)("%s Bottom","generateblocks"),r),value:l[m.bottom]||"",min:"margin"!==o?0:void 0}),(0,e.createElement)("label",{htmlFor:m.bottom,className:"gblocks-dimensions-control__label"},f.bottom)),(0,e.createElement)("div",null,(0,e.createElement)("input",{id:m.left,className:"components-gblocks-dimensions-control__number",placeholder:B(m.left,l,d,""),type:"number",onChange:e=>{let t=e.target.value;"margin"!==o&&(t=t.toString().replace(/-/g,"")),l[m.sync]?h(t):(e=>{a({[m.left]:e})})(t)} -/* translators: Dimension label (padding, margin, border) */,"aria-label":(0,i.sprintf)((0,i.__)("%s Left","generateblocks"),r),value:l[m.left]||"",min:"margin"!==o?0:void 0}),(0,e.createElement)("label",{htmlFor:m.left,className:"gblocks-dimensions-control__label"},f.left)),(0,e.createElement)(n.Tooltip,{text:l[m.sync]?(0,i.__)("Unlink Sides","generateblocks"):(0,i.__)("Link Sides","generateblocks")},(0,e.createElement)(n.Button,{className:"components-gblocks-dimensions-control_sync","aria-label":l[m.sync]?(0,i.__)("Unlink Sides","generateblocks"):(0,i.__)("Link Sides","generateblocks"),isPrimary:!!l[m.sync]&&l[m.sync],"aria-pressed":!!l[m.sync]&&l[m.sync],onClick:()=>(e=>{const t=[l[m.top],l[m.right],l[m.bottom],l[m.left]].filter((e=>""!==e));if(0===t.length)return void a({[e]:!l[e]});const r=Math.max.apply(null,t).toString();a({[e]:!l[e],[m.top]:r,[m.right]:r,[m.bottom]:r,[m.left]:r})})(m.sync),isSmall:!0},l[m.sync]?un:gn))))}function pn(a){const{dimensions:l,deviceType:r}=a,n=(0,m.applyFilters)("generateblocks.editor.dimensionGroupItems",l,a);return(0,e.createElement)(e.Fragment,null,n.map(((l,n)=>(0,e.createElement)(dn,t({},a,{key:n,device:r,type:l.type,label:l.label,units:l.units,computedStyles:l.computedStyles})))))}function bn(){return(bn=Object.assign||function(e){for(var t=1;t=0||(r[a]=e[a]);return r}function fn(e){var t=(0,y.useRef)(e),a=(0,y.useRef)((function(e){t.current&&t.current(e)}));return t.current=e,a.current}var hn=function(e,t,a){return void 0===t&&(t=0),void 0===a&&(a=1),e>a?a:e0:e.buttons>0)&&r.current?n(vn(r.current,e,o.current)):a(!1)},t=function(){return a(!1)};function a(a){var l=s.current,n=yn(r.current),i=a?n.addEventListener:n.removeEventListener;i(l?"touchmove":"mousemove",e),i(l?"touchend":"mouseup",t)}return[function(e){var t=e.nativeEvent,l=r.current;if(l&&(wn(t),!function(e,t){return t&&!kn(e)}(t,s.current)&&l)){if(kn(t)){s.current=!0;var i=t.changedTouches||[];i.length&&(o.current=i[0].identifier)}l.focus(),n(vn(l,t,o.current)),a(!0)}},function(e){var t=e.which||e.keyCode;t<37||t>40||(e.preventDefault(),i({left:39===t?.05:37===t?-.05:0,top:40===t?.05:38===t?-.05:0}))},a]}),[i,n]),u=c[0],g=c[1],d=c[2];return(0,y.useEffect)((function(){return d}),[d]),v().createElement("div",bn({},l,{onTouchStart:u,onMouseDown:u,className:"react-colorful__interactive",ref:r,onKeyDown:g,tabIndex:0,role:"slider"}))})),Tn=function(e){return e.filter(Boolean).join(" ")},En=function(e){var t=e.color,a=e.left,l=e.top,r=void 0===l?.5:l,n=Tn(["react-colorful__pointer",e.className]);return v().createElement("div",{className:n,style:{top:100*r+"%",left:100*a+"%"}},v().createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},Sn=function(e,t,a){return void 0===t&&(t=0),void 0===a&&(a=Math.pow(10,t)),Math.round(a*e)/a},xn=(Math.PI,function(e){var t=e.s,a=e.v,l=e.a,r=(200-t)*a/100;return{h:Sn(e.h),s:Sn(r>0&&r<200?t*a/100/(r<=100?r:200-r)*100:0),l:Sn(r/2),a:Sn(l,2)}}),Bn=function(e){var t=xn(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},Mn=function(e){var t=xn(e);return"hsla("+t.h+", "+t.s+"%, "+t.l+"%, "+t.a+")"},Dn=function(e){var t=e.h,a=e.s,l=e.v,r=e.a;t=t/360*6,a/=100,l/=100;var n=Math.floor(t),i=l*(1-a),o=l*(1-(t-n)*a),s=l*(1-(1-t+n)*a),c=n%6;return{r:Sn(255*[l,o,i,i,s,l][c]),g:Sn(255*[s,l,l,o,i,i][c]),b:Sn(255*[i,i,s,l,l,o][c]),a:Sn(r,2)}},Rn=function(e){var t=/rgba?\(?\s*(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(e);return t?zn({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:void 0===t[7]?1:Number(t[7])/(t[8]?100:1)}):{h:0,s:0,v:0,a:1}},Ln=Rn,zn=function(e){var t=e.r,a=e.g,l=e.b,r=e.a,n=Math.max(t,a,l),i=n-Math.min(t,a,l),o=i?n===t?(a-l)/i:n===a?2+(l-t)/i:4+(t-a)/i:0;return{h:Sn(60*(o<0?o+6:o)),s:Sn(n?i/n*100:0),v:Sn(n/255*100),a:r}},On=v().memo((function(e){var t=e.hue,a=e.onChange,l=Tn(["react-colorful__hue",e.className]);return v().createElement("div",{className:l},v().createElement(Cn,{onMove:function(e){a({h:360*e.left})},onKey:function(e){a({h:hn(t+360*e.left,0,360)})},"aria-label":"Hue","aria-valuetext":Sn(t)},v().createElement(En,{className:"react-colorful__hue-pointer",left:t/360,color:Bn({h:t,s:100,v:100,a:1})})))})),In=v().memo((function(e){var t=e.hsva,a=e.onChange,l={backgroundColor:Bn({h:t.h,s:100,v:100,a:1})};return v().createElement("div",{className:"react-colorful__saturation",style:l},v().createElement(Cn,{onMove:function(e){a({s:100*e.left,v:100-100*e.top})},onKey:function(e){a({s:hn(t.s+100*e.left,0,100),v:hn(t.v-100*e.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+Sn(t.s)+"%, Brightness "+Sn(t.v)+"%"},v().createElement(En,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:Bn(t)})))})),Nn=function(e,t){return e.replace(/\s/g,"")===t.replace(/\s/g,"")};function An(e,t,a){var l=fn(a),r=(0,y.useState)((function(){return e.toHsva(t)})),n=r[0],i=r[1],o=(0,y.useRef)({color:t,hsva:n});(0,y.useEffect)((function(){if(!e.equal(t,o.current.color)){var a=e.toHsva(t);o.current={hsva:a,color:t},i(a)}}),[t,e]),(0,y.useEffect)((function(){var t;(function(e,t){if(e===t)return!0;for(var a in e)if(e[a]!==t[a])return!1;return!0})(n,o.current.hsva)||e.equal(t=e.fromHsva(n),o.current.color)||(o.current={hsva:n,color:t},l(t))}),[n,e,l]);var s=(0,y.useCallback)((function(e){i((function(t){return Object.assign({},t,e)}))}),[]);return[n,s]}var Fn="undefined"!=typeof window?y.useLayoutEffect:y.useEffect,Pn=new Map,Hn=function(e){Fn((function(){var t=e.current?e.current.ownerDocument:document;if(void 0!==t&&!Pn.has(t)){var l=t.createElement("style");l.innerHTML='.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url(\'data:image/svg+xml;charset=utf-8,\')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}',Pn.set(t,l);var r=a.nc;r&&l.setAttribute("nonce",r),t.head.appendChild(l)}}),[])},Vn=function(e){var t=e.className,a=e.colorModel,l=e.color,r=void 0===l?a.defaultColor:l,n=e.onChange,i=mn(e,["className","colorModel","color","onChange"]),o=(0,y.useRef)(null);Hn(o);var s=An(a,r,n),c=s[0],u=s[1],g=Tn(["react-colorful",t]);return v().createElement("div",bn({},i,{ref:o,className:g}),v().createElement(In,{hsva:c,onChange:u}),v().createElement(On,{hue:c.h,onChange:u,className:"react-colorful__last-control"}))},Un=function(e){var t=e.className,a=e.hsva,l=e.onChange,r={backgroundImage:"linear-gradient(90deg, "+Mn(Object.assign({},a,{a:0}))+", "+Mn(Object.assign({},a,{a:1}))+")"},n=Tn(["react-colorful__alpha",t]);return v().createElement("div",{className:n},v().createElement("div",{className:"react-colorful__alpha-gradient",style:r}),v().createElement(Cn,{onMove:function(e){l({a:e.left})},onKey:function(e){l({a:hn(a.a+e.left)})},"aria-label":"Alpha","aria-valuetext":Sn(100*a.a)+"%"},v().createElement(En,{className:"react-colorful__alpha-pointer",left:a.a,color:Mn(a)})))},Gn=function(e){var t=e.className,a=e.colorModel,l=e.color,r=void 0===l?a.defaultColor:l,n=e.onChange,i=mn(e,["className","colorModel","color","onChange"]),o=(0,y.useRef)(null);Hn(o);var s=An(a,r,n),c=s[0],u=s[1],g=Tn(["react-colorful",t]);return v().createElement("div",bn({},i,{ref:o,className:g}),v().createElement(In,{hsva:c,onChange:u}),v().createElement(On,{hue:c.h,onChange:u}),v().createElement(Un,{hsva:c,onChange:u,className:"react-colorful__last-control"}))},jn={defaultColor:"rgba(0, 0, 0, 1)",toHsva:Rn,fromHsva:function(e){var t=Dn(e);return"rgba("+t.r+", "+t.g+", "+t.b+", "+t.a+")"},equal:Nn},qn=function(e){return v().createElement(Gn,bn({},e,{colorModel:jn}))},Wn={defaultColor:"rgb(0, 0, 0)",toHsva:Ln,fromHsva:function(e){var t=Dn(e);return"rgb("+t.r+", "+t.g+", "+t.b+")"},equal:Nn},$n=function(e){return v().createElement(Vn,bn({},e,{colorModel:Wn}))},Zn={grad:.9,turn:360,rad:360/(2*Math.PI)},Kn=function(e){return"string"==typeof e?e.length>0:"number"==typeof e},Jn=function(e,t,a){return void 0===t&&(t=0),void 0===a&&(a=Math.pow(10,t)),Math.round(a*e)/a+0},Qn=function(e,t,a){return void 0===t&&(t=0),void 0===a&&(a=1),e>a?a:e>t?e:t},Yn=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},Xn=function(e){return{r:Qn(e.r,0,255),g:Qn(e.g,0,255),b:Qn(e.b,0,255),a:Qn(e.a)}},ei=function(e){return{r:Jn(e.r),g:Jn(e.g),b:Jn(e.b),a:Jn(e.a,3)}},ti=/^#([0-9a-f]{3,8})$/i,ai=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},li=function(e){var t=e.r,a=e.g,l=e.b,r=e.a,n=Math.max(t,a,l),i=n-Math.min(t,a,l),o=i?n===t?(a-l)/i:n===a?2+(l-t)/i:4+(t-a)/i:0;return{h:60*(o<0?o+6:o),s:n?i/n*100:0,v:n/255*100,a:r}},ri=function(e){var t=e.h,a=e.s,l=e.v,r=e.a;t=t/360*6,a/=100,l/=100;var n=Math.floor(t),i=l*(1-a),o=l*(1-(t-n)*a),s=l*(1-(1-t+n)*a),c=n%6;return{r:255*[l,o,i,i,s,l][c],g:255*[s,l,l,o,i,i][c],b:255*[i,i,s,l,l,o][c],a:r}},ni=function(e){return{h:Yn(e.h),s:Qn(e.s,0,100),l:Qn(e.l,0,100),a:Qn(e.a)}},ii=function(e){return{h:Jn(e.h),s:Jn(e.s),l:Jn(e.l),a:Jn(e.a,3)}},oi=function(e){return ri((a=(t=e).s,{h:t.h,s:(a*=((l=t.l)<50?l:100-l)/100)>0?2*a/(l+a)*100:0,v:l+a,a:t.a}));var t,a,l},si=function(e){return{h:(t=li(e)).h,s:(r=(200-(a=t.s))*(l=t.v)/100)>0&&r<200?a*l/100/(r<=100?r:200-r)*100:0,l:r/2,a:t.a};var t,a,l,r},ci=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,ui=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,gi=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,di=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,pi={string:[[function(e){var t=ti.exec(e);return t?(e=t[1]).length<=4?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:4===e.length?Jn(parseInt(e[3]+e[3],16)/255,2):1}:6===e.length||8===e.length?{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16),a:8===e.length?Jn(parseInt(e.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(e){var t=gi.exec(e)||di.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:Xn({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:void 0===t[7]?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(e){var t=ci.exec(e)||ui.exec(e);if(!t)return null;var a,l,r=ni({h:(a=t[1],l=t[2],void 0===l&&(l="deg"),Number(a)*(Zn[l]||1)),s:Number(t[3]),l:Number(t[4]),a:void 0===t[5]?1:Number(t[5])/(t[6]?100:1)});return oi(r)},"hsl"]],object:[[function(e){var t=e.r,a=e.g,l=e.b,r=e.a,n=void 0===r?1:r;return Kn(t)&&Kn(a)&&Kn(l)?Xn({r:Number(t),g:Number(a),b:Number(l),a:Number(n)}):null},"rgb"],[function(e){var t=e.h,a=e.s,l=e.l,r=e.a,n=void 0===r?1:r;if(!Kn(t)||!Kn(a)||!Kn(l))return null;var i=ni({h:Number(t),s:Number(a),l:Number(l),a:Number(n)});return oi(i)},"hsl"],[function(e){var t=e.h,a=e.s,l=e.v,r=e.a,n=void 0===r?1:r;if(!Kn(t)||!Kn(a)||!Kn(l))return null;var i=function(e){return{h:Yn(e.h),s:Qn(e.s,0,100),v:Qn(e.v,0,100),a:Qn(e.a)}}({h:Number(t),s:Number(a),v:Number(l),a:Number(n)});return ri(i)},"hsv"]]},bi=function(e,t){for(var a=0;a=.5},e.prototype.toHex=function(){return t=(e=ei(this.rgba)).r,a=e.g,l=e.b,n=(r=e.a)<1?ai(Jn(255*r)):"","#"+ai(t)+ai(a)+ai(l)+n;var e,t,a,l,r,n},e.prototype.toRgb=function(){return ei(this.rgba)},e.prototype.toRgbString=function(){return t=(e=ei(this.rgba)).r,a=e.g,l=e.b,(r=e.a)<1?"rgba("+t+", "+a+", "+l+", "+r+")":"rgb("+t+", "+a+", "+l+")";var e,t,a,l,r},e.prototype.toHsl=function(){return ii(si(this.rgba))},e.prototype.toHslString=function(){return t=(e=ii(si(this.rgba))).h,a=e.s,l=e.l,(r=e.a)<1?"hsla("+t+", "+a+"%, "+l+"%, "+r+")":"hsl("+t+", "+a+"%, "+l+"%)";var e,t,a,l,r},e.prototype.toHsv=function(){return e=li(this.rgba),{h:Jn(e.h),s:Jn(e.s),v:Jn(e.v),a:Jn(e.a,3)};var e},e.prototype.invert=function(){return yi({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},e.prototype.saturate=function(e){return void 0===e&&(e=.1),yi(mi(this.rgba,e))},e.prototype.desaturate=function(e){return void 0===e&&(e=.1),yi(mi(this.rgba,-e))},e.prototype.grayscale=function(){return yi(mi(this.rgba,-1))},e.prototype.lighten=function(e){return void 0===e&&(e=.1),yi(hi(this.rgba,e))},e.prototype.darken=function(e){return void 0===e&&(e=.1),yi(hi(this.rgba,-e))},e.prototype.rotate=function(e){return void 0===e&&(e=15),this.hue(this.hue()+e)},e.prototype.alpha=function(e){return"number"==typeof e?yi({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):Jn(this.rgba.a,3);var t},e.prototype.hue=function(e){var t=si(this.rgba);return"number"==typeof e?yi({h:e,s:t.s,l:t.l,a:t.a}):Jn(t.h)},e.prototype.isEqual=function(e){return this.toHex()===yi(e).toHex()},e}(),yi=function(e){return e instanceof ki?e:new ki(e)};function vi(e,t){return e?(t||0===t)&&1!==t&&e.startsWith("#")?(e=e.replace("#",""),"rgba("+parseInt(3===e.length?e.slice(0,1).repeat(2):e.slice(0,2),16)+", "+parseInt(3===e.length?e.slice(1,2).repeat(2):e.slice(2,4),16)+", "+parseInt(3===e.length?e.slice(2,3).repeat(2):e.slice(4,6),16)+", "+t+")"):e:""}function wi(t){const{value:a,onChange:l,onOpacityChange:o,label:s,alpha:c=!1,valueOpacity:u=1,tooltip:g}=t,[d,b]=(0,e.useState)(a||""),m=(0,e.useRef)(null),f=c&&1===u?qn:$n,h=(0,e.useMemo)((()=>(e=>{if(String(e).startsWith("var(")){const t=e.match(/\(([^)]+)\)/);if(t){const a=getComputedStyle(document.documentElement).getPropertyValue(t[1]);a&&(e=a)}}return yi(e).toRgbString()})(a)),[a]),k=(0,q.useDebounce)(l);return(0,e.useEffect)((()=>{k(d),setTimeout((()=>{m.current&&m.current.focus()}),10)}),[d]),(0,e.createElement)("div",{className:"gblocks-color-component"},!!s&&(0,e.createElement)("span",{className:"gblocks-color-component__label"},s),(0,e.createElement)(n.Dropdown,{className:"gblocks-color-component__toggle",contentClassName:"gblocks-color-component-content",position:"top left",renderToggle:t=>{let{isOpen:l,onToggle:r}=t;const i=(0,e.createElement)(n.Button,{className:"gblocks-color-component__toggle-button",onClick:r,"aria-expanded":l},(0,e.createElement)("span",{className:"gblocks-color-component__toggle-indicator",style:{background:a?vi(a,u):null}}));return(0,e.createElement)(e.Fragment,null,g?(0,e.createElement)(n.Tooltip,{text:g},i):i)},renderContent:()=>(0,e.createElement)(e.Fragment,null,(0,e.createElement)(f,{color:h,onChange:e=>{yi(e).isValid()&&(e=1===yi(e).alpha()?yi(e).toHex():e),b(e)}}),(0,e.createElement)("div",{className:"gblocks-color-component-content__input-wrapper"},(0,e.createElement)(n.TextControl,{ref:m,className:"gblocks-color-input",type:"text",value:d,onChange:e=>{!e.startsWith("#")&&/^([0-9A-F]{3}){1,2}$/i.test(e)&&(e="#"+e),b(e)},onBlur:()=>{yi(a).isValid()&&1===yi(a).alpha()&&b(yi(a).toHex())}}),(0,e.createElement)(n.Button,{isSmall:!0,isSecondary:!0,className:"gblocks-color-input-clear",onClick:()=>{b(""),c&&1!==u&&o(1)}},(0,i.__)("Clear","generateblocks"))),c&&1!==u&&(0,e.createElement)("div",{className:"gblocks-color-component-content__opacity"},(0,e.createElement)(n.Tooltip,{text:(0,i.__)("Opacity","generateblocks")},p("gradient")),(0,e.createElement)(n.RangeControl,{value:u||0,onChange:e=>o(e),min:0,max:1,step:.01,initialPosition:1})),(0,e.createElement)(n.BaseControl,{className:"gblocks-color-component-content__palette"},(0,e.createElement)(r.ColorPalette,{value:a||"",onChange:e=>{b(e)},disableCustomColors:!0,clearable:!1})))}))}function _i(t){const{setAttributes:a,attributes:l,colors:r}=t,n=(0,m.applyFilters)("generateblocks.editor.colorGroupItems",r,t);return(0,e.createElement)("div",{className:"gblocks-color-group"},n.map(((t,r)=>(0,e.createElement)("div",{key:r,className:"gblocks-color-group__row"},!!t.label&&(0,e.createElement)("span",{className:"gblocks-color-group__row-label"},t.label),t.items.map(((t,r)=>(0,e.createElement)(wi,{key:r,label:t?.label,tooltip:t?.tooltip,value:l[t.attribute],alpha:t.alpha||!1,valueOpacity:l[t.attribute+"Opacity"],onChange:e=>a({[t.attribute]:e}),onOpacityChange:e=>a({[t.attribute+"Opacity"]:e})})))))))}class Ci extends e.Component{render(){const{attributes:t,setAttributes:a,attrGradient:l,attrGradientDirection:r,attrGradientColorOne:o,attrGradientColorOneOpacity:s,attrGradientColorStopOne:c,attrGradientColorTwo:u,attrGradientColorTwoOpacity:g,attrGradientColorStopTwo:d,defaultColorOne:p,defaultColorTwo:b}=this.props,{gradientSelector:m,innerZindex:f}=t,h="element"===m?(0,i.__)("Displays behind the background image.","generateblocks"):(0,i.__)("Displays in front of the background image.","generateblocks");return(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.ToggleControl,{label:(0,i.__)("Use Gradient","generateblocks"),checked:!!t[l],onChange:e=>{const l=this.props;let n=t[r],i=t[o],s=t[u];e&&(n=n||90,i=i||"rgba(255, 255, 255, 0.1)",s=s||"rgba(0, 0, 0, 0.30)"),a({[l.attrGradient]:e,[l.attrGradientDirection]:n,[l.attrGradientColorOne]:i,[l.attrGradientColorTwo]:s})}}),!!t[l]&&(0,e.createElement)(e.Fragment,null,void 0!==m&&(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Selector","generateblocks"),help:h,value:m,options:[{label:(0,i.__)("Element","generateblocks"),value:"element"},{label:(0,i.__)("Pseudo Element","generateblocks"),value:"pseudo-element"}],onChange:e=>{a({gradientSelector:e}),x(f)||"pseudo-element"!==e||a({innerZindex:1})}}),(0,e.createElement)(n.BaseControl,null,(0,e.createElement)("span",{className:"components-base-control__label"},(0,i.__)("Direction","generateblocks")),(0,e.createElement)(n.RangeControl,{value:t[r]?t[r]:0,onChange:e=>{a({[r]:e})},min:0,max:360,step:1,initialPosition:90})),(0,e.createElement)(n.BaseControl,null,(0,e.createElement)("span",{className:"components-base-control__label"},(0,i.__)("Color One","generateblocks")),(0,e.createElement)("div",{className:"gblocks-component-gradient-control"},(0,e.createElement)(wi,{value:t[o],alpha:!0,valueOpacity:t[s]||1,attrOpacity:"gradientColorOneOpacity",onChange:e=>a({[o]:e}),onOpacityChange:e=>a({[s]:e}),onClear:()=>a({[o]:p})}),(0,e.createElement)(n.TextControl,{className:"gblocks-component-gradient-stop-value",type:"text",value:t[c]||0===t[c]?t[c]:"",placeholder:(0,i.__)("Stop position (%)","generateblocks"),onChange:e=>{a({[c]:e})},onBlur:()=>{(t[c]||0===t[c])&&a({[c]:parseFloat(t[c])})},onClick:e=>{e.currentTarget.focus()}}))),(0,e.createElement)(n.BaseControl,null,(0,e.createElement)("span",{className:"components-base-control__label"},(0,i.__)("Color Two","generateblocks")),(0,e.createElement)("div",{className:"gblocks-component-gradient-control"},(0,e.createElement)(wi,{value:t[u],alpha:!0,valueOpacity:t[g]||1,attrOpacity:"gradientColorTwoOpacity",onChange:e=>a({[u]:e}),onOpacityChange:e=>a({[g]:e}),onClear:()=>a({[u]:b})}),(0,e.createElement)(n.TextControl,{className:"gblocks-component-gradient-stop-value",type:"text",value:t[d]||0===t[d]?t[d]:"",placeholder:(0,i.__)("Stop position (%)","generateblocks"),onChange:e=>{a({[d]:e})},onBlur:()=>{(t[d]||0===t[d])&&a({[d]:parseFloat(t[d])})},onClick:e=>{e.currentTarget.focus()}})))))}}var Ti=Ci,Ei=a(856),Si=a.n(Ei);function xi(e){return Si().sanitize(e,{USE_PROFILES:{svg:!0,svgFilters:!0}})}const Bi=e=>x(e)&&"auto"!==e;var Mi=a=>{const{clientId:o,attributes:c,setAttributes:u,deviceType:g,state:d,blockDefaults:b,tagNames:f,filterTagName:h,allShapes:k,context:y}=a,{tagName:v,isGrid:w,isQueryLoopItem:_,gridId:T,width:E,widthTablet:M,widthMobile:D,autoWidthTablet:R,autoWidthMobile:L,flexGrow:z,flexGrowTablet:O,flexGrowMobile:I,flexShrink:N,flexShrinkTablet:A,flexShrinkMobile:F,flexBasis:P,flexBasisTablet:H,flexBasisMobile:V,flexBasisUnit:U,outerContainer:G,innerContainer:j,containerWidth:q,minHeight:W,minHeightUnit:$,minHeightTablet:Z,minHeightUnitTablet:K,minHeightMobile:J,minHeightUnitMobile:Q,backgroundColor:Y,bgImage:X,bgOptions:ee,bgImageSize:te,bgImageInline:ae,verticalAlignment:le,verticalAlignmentTablet:re,verticalAlignmentMobile:ne,zindex:ie,innerZindex:oe,removeVerticalGap:se,removeVerticalGapTablet:ce,removeVerticalGapMobile:ue,orderTablet:ge,orderMobile:de,align:pe,shapeDividers:be,useDynamicData:me,dynamicContentType:fe}=c,{getBlockParents:he,getBlocksByClientId:ke}=(0,l.useSelect)((e=>e("core/block-editor")),[]);(0,e.useEffect)((()=>{const e=he(o,!0);if(e.length>0){const t=ke(e);if(t.length>0)if("generateblocks/grid"===t[0].name){const e=t[0].attributes.uniqueId;e!==T&&u({isGrid:!0,gridId:e})}else w&&!_&&u({isGrid:!1,gridId:""})}else w&&!_&&u({isGrid:!1,gridId:""})}));const ye=void 0!==y["generateblocks/queryId"],ve=Bi(P),we="auto"!==H&&(Bi(P)||Bi(H)),_e="auto"!==V&&(Bi(P)||Bi(H)||Bi(V)),Ce=[];return Object.keys(generateBlocksInfo.imageSizes).forEach((e=>{Ce.push({label:generateBlocksInfo.imageSizes[e],value:generateBlocksInfo.imageSizes[e]})})),(0,e.createElement)(r.InspectorControls,null,!w&&(0,e.createElement)(C,t({},a,{title:(0,i.__)("Layout","generateblocks"),initialOpen:!0,icon:p("layout"),className:"gblocks-panel-label",id:"containerLayout",state:d}),"Desktop"===g&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Container","generateblocks"),value:G,options:[{label:(0,i.__)("Full width","generateblocks"),value:"full"},{label:(0,i.__)("Contained width","generateblocks"),value:"contained"}],onChange:e=>{u({outerContainer:e}),"contained"===e&&"full"===pe&&u({align:""})}}),"full"===G&&(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Inner Container","generateblocks"),value:j,options:[{label:(0,i.__)("Full width","generateblocks"),value:"full"},{label:(0,i.__)("Contained width","generateblocks"),value:"contained"}],onChange:e=>{u({innerContainer:e})}}),("contained"===G||"contained"===j)&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(S,{label:"full"===G&&"contained"===j?(0,i.__)("Inner Container Width","generateblocks"):(0,i.__)("Container Width","generateblocks"),value:"px",units:["px"],onClick:()=>!1}),(0,e.createElement)(n.TextControl,{type:"number",className:"gblocks-container-width",value:parseFloat(q)||"",placeholder:b.containerWidth,onChange:e=>{u({containerWidth:""!==e?parseFloat(e):void 0})}})),(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Tag Name","generateblocks"),value:v,options:f,onChange:e=>{u({tagName:h(e)})}}),(0,m.applyFilters)("generateblocks.editor.controls","","containerAfterElementTag",a,d)),(0,m.applyFilters)("generateblocks.editor.controls","","containerLayout",a,d)),w&&(0,e.createElement)(C,t({},a,{title:(0,i.__)("Layout","generateblocks"),initialOpen:!0,icon:p("layout"),className:"gblocks-panel-label",id:"containerGridLayout",state:d}),"Desktop"===g&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.BaseControl,null,(0,e.createElement)(S,{label:(0,i.__)("Container Width","generateblocks"),value:"%",units:["%"],onClick:()=>!1}),!!ve&&(0,e.createElement)("div",{className:"gblocks-small-notice-description"},(0,i.__)('Width disabled as Flex Basis is not "auto".',"generateblocks")),(0,e.createElement)(n.ButtonGroup,{className:"widthButtons"},(0,e.createElement)(n.Button,{isPrimary:25===E,onClick:()=>u({width:25}),disabled:ve},"25"),(0,e.createElement)(n.Button,{isPrimary:33.33===E,onClick:()=>u({width:33.33}),disabled:ve},"33"),(0,e.createElement)(n.Button,{isPrimary:50===E,onClick:()=>u({width:50}),disabled:ve},"50"),(0,e.createElement)(n.Button,{isPrimary:66.66===E,onClick:()=>u({width:66.66}),disabled:ve},"66"),(0,e.createElement)(n.Button,{isPrimary:75===E,onClick:()=>u({width:75}),disabled:ve},"75"),(0,e.createElement)(n.Button,{isPrimary:100===E,onClick:()=>u({width:100}),disabled:ve},"100")),(0,e.createElement)(on,{value:x(E)?E:"",onChange:e=>{String(e).startsWith(0)&&(e=""),u({width:e})},rangeMin:10,rangeMax:100,step:5,initialPosition:b.width,disabled:ve})),(0,e.createElement)(n.BaseControl,{className:"gblocks-flex-controls"},(0,e.createElement)("div",{className:"gblocks-utility-label"},(0,e.createElement)("label",{htmlFor:"gblocks-flex-grow-desktop",className:"components-base-control__label"},(0,i.__)("Flex","generateblocks")),(0,e.createElement)(n.Tooltip,{text:(0,i.__)("Reset","generateblocks"),position:"top"},(0,e.createElement)(n.Button,{className:"gblocks-reset-button",icon:p("reset"),onClick:()=>{u({flexGrow:"",flexShrink:"",flexBasis:""})}}))),(0,e.createElement)("div",{className:"gblocks-flex-controls-inner"},(0,e.createElement)(n.TextControl,{help:(0,i.__)("Grow","generateblocks"),id:"gblocks-flex-grow-desktop",type:"number",value:z,min:"0",step:"1",placeholder:"0",onChange:e=>{u({flexGrow:e})},onBlur:()=>{""!==z&&u({flexGrow:parseFloat(z)})},onClick:e=>{e.currentTarget.focus()}}),(0,e.createElement)(n.TextControl,{help:(0,i.__)("Shrink","generateblocks"),type:"number",value:N,min:"0",step:"1",placeholder:"1",onChange:e=>{u({flexShrink:e})},onBlur:()=>{""!==N&&u({flexShrink:parseFloat(N)})},onClick:e=>{e.currentTarget.focus()}}),(0,e.createElement)("div",{className:"gblocks-flex-basis-wrapper"},!isNaN(P)&&(0,e.createElement)(S,{value:U,units:["px","%"],onClick:e=>{u({flexBasisUnit:e})}}),(0,e.createElement)(n.TextControl,{help:(0,i.__)("Basis","generateblocks"),type:"text",placeholder:"auto",value:P,onChange:e=>{u({flexBasis:e})},onBlur:()=>{P.match(/(auto|fill|max-content|min-content|fit-content|content|inherit|initial|revert|unset|[0-9.]+)/g)||u({flexBasis:""})}})))),(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Vertical Alignment","generateblocks"),help:(0,i.__)("Align grid item content. Does not apply if vertical alignment is set in the grid.","generateblocks"),value:le,options:[{label:(0,i.__)("Default","generateblocks"),value:""},{label:(0,i.__)("Top","generateblocks"),value:"flex-start"},{label:(0,i.__)("Center","generateblocks"),value:"center"},{label:(0,i.__)("Bottom","generateblocks"),value:"flex-end"}],onChange:e=>{u({verticalAlignment:e})}}),!_&&(0,e.createElement)(n.ToggleControl,{label:(0,i.__)("Remove Vertical Gap","generateblocks"),checked:!!se,onChange:e=>{u({removeVerticalGap:e})}}),(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Tag Name","generateblocks"),value:v,options:f,onChange:e=>{u({tagName:h(e)})}}),(0,m.applyFilters)("generateblocks.editor.controls","","containerAfterElementTag",a,d)),"Tablet"===g&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.BaseControl,null,(0,e.createElement)(S,{label:(0,i.__)("Container Width","generateblocks"),value:"%",units:["%"],onClick:()=>!1}),!!we&&(0,e.createElement)("div",{className:"gblocks-small-notice-description"},(0,i.__)('Width disabled as Flex Basis is not "auto".',"generateblocks")),(0,e.createElement)(n.ButtonGroup,{className:"widthButtons"},(0,e.createElement)(n.Button,{isPrimary:!!R,disabled:we,onClick:()=>{u(R?{autoWidthTablet:!1}:{autoWidthTablet:!0})}},(0,i.__)("Auto","generateblocks")),(0,e.createElement)(n.Button,{isPrimary:25===M&&!R,onClick:()=>u({widthTablet:25,autoWidthTablet:!1}),disabled:we},"25"),(0,e.createElement)(n.Button,{isPrimary:33.33===M&&!R,onClick:()=>u({widthTablet:33.33,autoWidthTablet:!1}),disabled:we},"33"),(0,e.createElement)(n.Button,{isPrimary:50===M&&!R,onClick:()=>u({widthTablet:50,autoWidthTablet:!1}),disabled:we},"50"),(0,e.createElement)(n.Button,{isPrimary:66.66===M&&!R,onClick:()=>u({widthTablet:66.66,autoWidthTablet:!1}),disabled:we},"66"),(0,e.createElement)(n.Button,{isPrimary:75===M&&!R,onClick:()=>u({widthTablet:75,autoWidthTablet:!1}),disabled:we},"75"),(0,e.createElement)(n.Button,{isPrimary:100===M&&!R,onClick:()=>u({widthTablet:100,autoWidthTablet:!1}),disabled:we},"100")),!R&&(0,e.createElement)(on,{value:x(M)?M:"",onChange:e=>{String(e).startsWith(0)&&(e=""),u({widthTablet:e,autoWidthTablet:!1})},rangeMin:10,rangeMax:100,step:5,initialPosition:b.widthTablet,disabled:we})),(0,e.createElement)(n.BaseControl,{className:"gblocks-flex-controls"},(0,e.createElement)("div",{className:"gblocks-utility-label"},(0,e.createElement)("label",{htmlFor:"gblocks-flex-grow-tablet",className:"components-base-control__label"},(0,i.__)("Flex","generateblocks")),(0,e.createElement)(n.Tooltip,{text:(0,i.__)("Reset","generateblocks"),position:"top"},(0,e.createElement)(n.Button,{className:"gblocks-reset-button",icon:p("reset"),onClick:()=>{u({flexGrowTablet:"",flexShrinkTablet:"",flexBasisTablet:""})}}))),(0,e.createElement)("div",{className:"gblocks-flex-controls-inner"},(0,e.createElement)(n.TextControl,{help:(0,i.__)("Grow","generateblocks"),id:"gblocks-flex-grow-tablet",type:"number",value:O,min:"0",step:"1",placeholder:B("flexGrow",c,"Tablet","0"),onChange:e=>{u({flexGrowTablet:e})},onBlur:()=>{""!==O&&u({flexGrowTablet:parseFloat(O)})},onClick:e=>{e.currentTarget.focus()}}),(0,e.createElement)(n.TextControl,{help:(0,i.__)("Shrink","generateblocks"),type:"number",value:A,min:"0",step:"1",placeholder:B("flexShrink",c,"Tablet","1"),onChange:e=>{u({flexShrinkTablet:e})},onBlur:()=>{""!==A&&u({flexShrinkTablet:parseFloat(A)})},onClick:e=>{e.currentTarget.focus()}}),(0,e.createElement)("div",{className:"gblocks-flex-basis-wrapper"},!isNaN(H)&&(0,e.createElement)(S,{value:U,units:["px","%"],onClick:e=>{u({flexBasisUnit:e})}}),(0,e.createElement)(n.TextControl,{help:(0,i.__)("Basis","generateblocks"),type:"text",value:H,placeholder:B("flexBasis",c,"Tablet","auto"),onChange:e=>{u({flexBasisTablet:e})},onBlur:()=>{H.match(/(auto|fill|max-content|min-content|fit-content|content|inherit|initial|revert|unset|[0-9.]+)/g)||u({flexBasisTablet:""})}})))),(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Vertical Alignment","generateblocks"),help:(0,i.__)("Align grid item content. Does not apply if vertical alignment is set in the grid.","generateblocks"),value:re,options:[{label:(0,i.__)("Inherit","generateblocks"),value:"inherit"},{label:(0,i.__)("Default","generateblocks"),value:""},{label:(0,i.__)("Top","generateblocks"),value:"flex-start"},{label:(0,i.__)("Center","generateblocks"),value:"center"},{label:(0,i.__)("Bottom","generateblocks"),value:"flex-end"}],onChange:e=>{u({verticalAlignmentTablet:e})}}),!_&&(0,e.createElement)(n.ToggleControl,{label:(0,i.__)("Remove Vertical Gap","generateblocks"),checked:!!ce,onChange:e=>{u({removeVerticalGapTablet:e})}}),(0,e.createElement)(n.TextControl,{type:"number",label:(0,i.__)("Order","generateblocks"),value:ge||0===ge?ge:"",onChange:e=>{u({orderTablet:parseFloat(e)})}})),"Mobile"===g&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.BaseControl,null,(0,e.createElement)(S,{label:(0,i.__)("Container Width","generateblocks"),value:"%",units:["%"],onClick:()=>!1}),!!_e&&(0,e.createElement)("div",{className:"gblocks-small-notice-description"},(0,i.__)('Width disabled as Flex Basis is not "auto".',"generateblocks")),(0,e.createElement)(n.ButtonGroup,{className:"widthButtons"},(0,e.createElement)(n.Button,{isPrimary:!!L,disabled:_e,onClick:()=>{u(L?{autoWidthMobile:!1}:{autoWidthMobile:!0})}},(0,i.__)("Auto","generateblocks")),(0,e.createElement)(n.Button,{isPrimary:25===D&&!L,onClick:()=>u({widthMobile:25,autoWidthMobile:!1}),disabled:_e},"25"),(0,e.createElement)(n.Button,{isPrimary:33.33===D&&!L,onClick:()=>u({widthMobile:33.33,autoWidthMobile:!1}),disabled:_e},"33"),(0,e.createElement)(n.Button,{isPrimary:50===D&&!L,onClick:()=>u({widthMobile:50,autoWidthMobile:!1}),disabled:_e},"50"),(0,e.createElement)(n.Button,{isPrimary:66.66===D&&!L,onClick:()=>u({widthMobile:66.66,autoWidthMobile:!1}),disabled:_e},"66"),(0,e.createElement)(n.Button,{isPrimary:75===D&&!L,onClick:()=>u({widthMobile:75,autoWidthMobile:!1}),disabled:_e},"75"),(0,e.createElement)(n.Button,{isPrimary:100===D&&!L,onClick:()=>u({widthMobile:100,autoWidthMobile:!1}),disabled:_e},"100")),!L&&(0,e.createElement)(on,{value:x(D)?D:"",onChange:e=>{String(e).startsWith(0)&&(e=""),u({widthMobile:e,autoWidthMobile:!1})},rangeMin:10,rangeMax:100,step:5,initialPosition:b.widthMobile,disabled:_e})),(0,e.createElement)(n.BaseControl,{className:"gblocks-flex-controls"},(0,e.createElement)("div",{className:"gblocks-utility-label"},(0,e.createElement)("label",{htmlFor:"gblocks-flex-grow-mobile",className:"components-base-control__label"},(0,i.__)("Flex","generateblocks")),(0,e.createElement)(n.Tooltip,{text:(0,i.__)("Reset","generateblocks"),position:"top"},(0,e.createElement)(n.Button,{className:"gblocks-reset-button",icon:p("reset"),onClick:()=>{u({flexGrowMobile:"",flexShrinkMobile:"",flexBasisMobile:""})}}))),(0,e.createElement)("div",{className:"gblocks-flex-controls-inner"},(0,e.createElement)(n.TextControl,{help:(0,i.__)("Grow","generateblocks"),id:"gblocks-flex-grow-mobile",type:"number",value:I,min:"0",step:"1",placeholder:B("flexGrow",c,"Mobile","0"),onChange:e=>{u({flexGrowMobile:e})},onBlur:()=>{""!==I&&u({flexGrowMobile:parseFloat(I)})},onClick:e=>{e.currentTarget.focus()}}),(0,e.createElement)(n.TextControl,{help:(0,i.__)("Shrink","generateblocks"),type:"number",value:F,min:"0",step:"1",placeholder:B("flexShrink",c,"Mobile","1"),onChange:e=>{u({flexShrinkMobile:e})},onBlur:()=>{""!==F&&u({flexShrinkMobile:parseFloat(F)})},onClick:e=>{e.currentTarget.focus()}}),(0,e.createElement)("div",{className:"gblocks-flex-basis-wrapper"},!isNaN(V)&&(0,e.createElement)(S,{value:U,units:["px","%"],onClick:e=>{u({flexBasisUnit:e})}}),(0,e.createElement)(n.TextControl,{help:(0,i.__)("Basis","generateblocks"),type:"text",value:V,placeholder:B("flexBasis",c,"Mobile","auto"),onChange:e=>{u({flexBasisMobile:e})},onBlur:()=>{V.match(/(auto|fill|max-content|min-content|fit-content|content|inherit|initial|revert|unset|[0-9.]+)/g)||u({flexBasisMobile:""})}})))),(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Vertical Alignment","generateblocks"),help:(0,i.__)("Align grid item content. Does not apply if vertical alignment is set in the grid.","generateblocks"),value:ne,options:[{label:(0,i.__)("Inherit","generateblocks"),value:"inherit"},{label:(0,i.__)("Default","generateblocks"),value:""},{label:(0,i.__)("Top","generateblocks"),value:"flex-start"},{label:(0,i.__)("Center","generateblocks"),value:"center"},{label:(0,i.__)("Bottom","generateblocks"),value:"flex-end"}],onChange:e=>{u({verticalAlignmentMobile:e})}}),!_&&(0,e.createElement)(n.ToggleControl,{label:(0,i.__)("Remove Vertical Gap","generateblocks"),checked:!!ue,onChange:e=>{u({removeVerticalGapMobile:e})}}),(0,e.createElement)(n.TextControl,{type:"number",label:(0,i.__)("Order","generateblocks"),value:de||0===de?de:"",onChange:e=>{u({orderMobile:parseFloat(e)})}})),(0,m.applyFilters)("generateblocks.editor.controls","","containerGridLayout",a,d)),(0,e.createElement)(C,t({},a,{title:(0,i.__)("Typography","generateblocks"),initialOpen:!1,icon:p("typography"),className:"gblocks-panel-label",id:"containerTypography",state:d}),(0,e.createElement)(cn,t({},a,{deviceType:g,options:["fontWeight","textTransform","fontSize","fontFamily"]})),(0,m.applyFilters)("generateblocks.editor.controls","","containerTypography",a,d)),(0,e.createElement)(C,t({},a,{title:(0,i.__)("Spacing","generateblocks"),initialOpen:!1,icon:p("spacing"),className:"gblocks-panel-label",id:"containerSpacing",state:d}),(0,e.createElement)(pn,t({},a,{deviceType:g,dimensions:[{type:"padding",label:(0,i.__)("Padding","generateblocks"),units:["px","em","%"]},{type:"margin",label:(0,i.__)("Margin","generateblocks"),units:["px","em","%"]},{type:"borderSize",label:(0,i.__)("Border Size","generateblocks"),units:["px"]},{type:"borderRadius",label:(0,i.__)("Border Radius","generateblocks"),units:["px","em","%"]}]})),"Desktop"===g&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(S,{label:(0,i.__)("Minimum Height","generateblocks"),value:$,units:["px","vh","vw"],onClick:e=>{u({minHeightUnit:e})}}),(0,e.createElement)(n.TextControl,{type:"number",value:W||"",onChange:e=>{u({minHeight:parseFloat(e)})}}),!!W&&!w&&(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Vertical Alignment","generateblocks"),value:le,options:[{label:(0,i.__)("Default","generateblocks"),value:""},{label:(0,i.__)("Top","generateblocks"),value:"flex-start"},{label:(0,i.__)("Center","generateblocks"),value:"center"},{label:(0,i.__)("Bottom","generateblocks"),value:"flex-end"}],onChange:e=>{u({verticalAlignment:e})}}),(0,e.createElement)(n.TextControl,{label:(0,i.__)("Outer z-index","generateblocks"),type:"number",value:ie||0===ie?ie:"",onChange:e=>{u({zindex:e})},onBlur:()=>{u({zindex:parseFloat(ie)})},onClick:e=>{e.currentTarget.focus()}}),(0,e.createElement)(n.TextControl,{label:(0,i.__)("Inner z-index","generateblocks"),type:"number",value:oe||0===oe?oe:"",onChange:e=>{u({innerZindex:e})},onBlur:()=>{u({innerZindex:parseFloat(oe)})},onClick:e=>{e.currentTarget.focus()}})),"Tablet"===g&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(S,{label:(0,i.__)("Minimum Height","generateblocks"),value:K,units:["px","vh","vw"],onClick:e=>{u({minHeightUnitTablet:e})}}),(0,e.createElement)(n.TextControl,{type:"number",value:Z||0===Z?Z:"",onChange:e=>{u({minHeightTablet:parseFloat(e)})}}),(!!W||!!Z)&&!w&&(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Vertical Alignment","generateblocks"),value:re,options:[{label:(0,i.__)("Inherit","generateblocks"),value:"inherit"},{label:(0,i.__)("Default","generateblocks"),value:""},{label:(0,i.__)("Top","generateblocks"),value:"flex-start"},{label:(0,i.__)("Center","generateblocks"),value:"center"},{label:(0,i.__)("Bottom","generateblocks"),value:"flex-end"}],onChange:e=>{u({verticalAlignmentTablet:e})}})),"Mobile"===g&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(S,{label:(0,i.__)("Minimum Height","generateblocks"),value:Q,units:["px","vh","vw"],onClick:e=>{u({minHeightUnitMobile:e})}}),(0,e.createElement)(n.TextControl,{type:"number",value:J||0===J?J:"",onChange:e=>{u({minHeightMobile:parseFloat(e)})}}),(!!W||!!Z||!!J)&&!w&&(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Vertical Alignment","generateblocks"),value:ne,options:[{label:(0,i.__)("Inherit","generateblocks"),value:"inherit"},{label:(0,i.__)("Default","generateblocks"),value:""},{label:(0,i.__)("Top","generateblocks"),value:"flex-start"},{label:(0,i.__)("Center","generateblocks"),value:"center"},{label:(0,i.__)("Bottom","generateblocks"),value:"flex-end"}],onChange:e=>{u({verticalAlignmentMobile:e})}})),(0,m.applyFilters)("generateblocks.editor.controls","","containerSpacing",a,d)),(0,e.createElement)(C,t({},a,{title:(0,i.__)("Colors","generateblocks"),initialOpen:!1,icon:p("colors"),className:"gblocks-panel-label",id:"containerColors",state:d}),"Desktop"===g&&(0,e.createElement)(_i,t({},a,{colors:[{group:"background",label:(0,i.__)("Background","generateblocks"),items:[{attribute:"backgroundColor",alpha:!0}]},{group:"text",label:(0,i.__)("Text","generateblocks"),items:[{attribute:"textColor"}]},{group:"link",label:(0,i.__)("Link","generateblocks"),items:[{attribute:"linkColor"},{tooltip:(0,i.__)("Hover","generateblocks"),attribute:"linkColorHover"}]},{group:"border",label:(0,i.__)("Border","generateblocks"),items:[{attribute:"borderColor",alpha:!0}]}]})),(0,m.applyFilters)("generateblocks.editor.controls","","containerColors",a,d)),(0,e.createElement)(C,t({},a,{title:(0,i.__)("Backgrounds","generateblocks"),initialOpen:!1,icon:p("gradients"),className:"gblocks-panel-label",id:"containerBackground",state:d}),(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.BaseControl,{id:"gblocks-background-image-upload",label:(0,i.__)("Image URL","generateblocks")},(0,e.createElement)("div",{className:"gblocks-bg-image-wrapper"},(0,e.createElement)(n.TextControl,{type:"text",value:X?X.image.url:"",onChange:e=>{u(e?{bgImage:{id:"",image:{url:e}}}:{bgImage:null})}}),(0,e.createElement)("div",{className:"gblocks-background-image-action-buttons"},(0,e.createElement)(r.MediaUpload,{title:(0,i.__)("Set background image","generateblocks"),onSelect:e=>{let t=b.bgImageSize;void 0===e.sizes[t]&&(t="full"),u({bgImage:{id:e.id,image:e.sizes[t]}})},onClose:()=>{document.querySelector(".gblocks-bg-image-wrapper input").focus()},allowedTypes:["image"],value:X?X.id:"",modalClass:"editor-gb-container-background__media-modal",render:t=>{let{open:a}=t;return(0,e.createElement)(n.Tooltip,{text:(0,i.__)("Open the Media Library","generateblocks")},(0,e.createElement)(n.Button,{onClick:a,className:"is-secondary is-small"},(0,i.__)("Browse","generateblocks")))}}),(0,m.applyFilters)("generateblocks.editor.backgroundImageActions","",a,d)))),me&&""!==fe&&(0,e.createElement)(n.Notice,{className:"gblocks-option-notice",status:"info",isDismissible:!1},(0,i.__)("Using featured image as dynamic background.","generateblocks")),(!!X||me&&""!==fe)&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.ToggleControl,{label:(0,i.__)("Use inline style","generateblocks"),disabled:me&&""!==fe&&(_||ye),checked:!!ae,onChange:e=>{u({bgImageInline:e})}}),ee.overlay?(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.ToggleControl,{label:(0,i.__)("Background Color Overlay","generateblocks"),checked:!!ee.overlay,onChange:e=>{u({bgOptions:{...ee,overlay:e}})}}),(0,e.createElement)(n.Notice,{className:"gblocks-option-notice",status:"info",isDismissible:!1},(0,i.__)("The background color overlay option is deprecated. Toggle this option to use the new method.","generateblocks"))):(0,e.createElement)(e.Fragment,null,(X&&X.id||me&&""!==fe)&&(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Image Size","generateblocks"),value:te,options:Ce,onChange:e=>{u({bgImageSize:e})}}),(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Selector","generateblocks"),value:ee.selector,options:[{label:(0,i.__)("Element","generateblocks"),value:"element"},{label:(0,i.__)("Pseudo Element","generateblocks"),value:"pseudo-element"}],onChange:e=>{u({bgOptions:{...ee,selector:e}}),"pseudo-element"!==e||oe||0===oe||u({innerZindex:1})}}),(0,e.createElement)(n.RangeControl,{label:(0,i.__)("Image Opacity","generateblocks"),value:ee.opacity,onChange:e=>{u({bgOptions:{...ee,opacity:e,selector:"pseudo-element"}}),oe||0===oe||u({innerZindex:1})},min:0,max:1,step:.01,initialPosition:b.bgOptions.opacity}),1!==ee.opacity&&"pseudo-element"!==ee.selector&&(0,e.createElement)(n.Notice,{className:"gblocks-option-notice",status:"info",isDismissible:!1},(0,i.__)("Your selector must be set to Pseudo Element to use opacity.","generateblocks"))),(0,e.createElement)(n.TextControl,{label:(0,i.__)("Size","generateblocks"),value:ee.size,onChange:e=>{u({bgOptions:{...ee,size:e}})}}),(0,e.createElement)(n.TextControl,{label:(0,i.__)("Position","generateblocks"),value:ee.position,onChange:e=>{u({bgOptions:{...ee,position:e}})}}),(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Repeat","generateblocks"),value:ee.repeat,options:[{label:"no-repeat",value:"no-repeat"},{label:"repeat",value:"repeat"},{label:"repeat-x",value:"repeat-x"},{label:"repeat-y",value:"repeat-y"}],onChange:e=>{u({bgOptions:{...ee,repeat:e}})}}),(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Attachment","generateblocks"),value:ee.attachment,options:[{label:"scroll",value:""},{label:"fixed",value:"fixed"},{label:"local",value:"local"}],onChange:e=>{u({bgOptions:{...ee,attachment:e}})}})),(0,e.createElement)(Ti,t({},a,{attrGradient:"gradient",attrGradientDirection:"gradientDirection",attrGradientColorOne:"gradientColorOne",attrGradientColorStopOne:"gradientColorStopOne",attrGradientColorTwo:"gradientColorTwo",attrGradientColorStopTwo:"gradientColorStopTwo",attrGradientColorOneOpacity:"gradientColorOneOpacity",attrGradientColorTwoOpacity:"gradientColorTwoOpacity",defaultColorOne:b.gradientColorOne,defaultColorTwo:b.gradientColorTwo})),(0,m.applyFilters)("generateblocks.editor.controls","","containerBackground",a,d))),(0,e.createElement)(C,t({},a,{title:(0,i.__)("Shapes","generateblocks"),initialOpen:!1,icon:p("shapes"),className:"gblocks-panel-label",id:"containerShapes",state:d,showPanel:!("Desktop"!==g&&!c.shapeDividers.length)}),(0,e.createElement)(n.BaseControl,{className:"gb-icon-chooser gb-shape-chooser"},be.map(((t,a)=>{const l=a+1;return(0,e.createElement)(e.Fragment,{key:a},(0,e.createElement)("div",{className:"gblocks-shape-container"},(0,e.createElement)("div",{className:s()({"gblocks-shape-toggle-preview":!0,[`gblocks-shape-toggle-preview-${l}`]:!0}),style:{backgroundColor:Y}},void 0!==k[be[a].shape]&&(0,e.createElement)("div",{className:"gblocks-shape-divider-preview",style:{color:be[a].color},dangerouslySetInnerHTML:{__html:xi(k[be[a].shape].icon)}})), +/* translators: Dimension label (padding, margin, border) */,"aria-label":(0,i.sprintf)((0,i.__)("%s Left","generateblocks"),r),value:l[m.left]||"",min:"margin"!==o?0:void 0}),(0,e.createElement)("label",{htmlFor:m.left,className:"gblocks-dimensions-control__label"},f.left)),(0,e.createElement)(n.Tooltip,{text:l[m.sync]?(0,i.__)("Unlink Sides","generateblocks"):(0,i.__)("Link Sides","generateblocks")},(0,e.createElement)(n.Button,{className:"components-gblocks-dimensions-control_sync","aria-label":l[m.sync]?(0,i.__)("Unlink Sides","generateblocks"):(0,i.__)("Link Sides","generateblocks"),isPrimary:!!l[m.sync]&&l[m.sync],"aria-pressed":!!l[m.sync]&&l[m.sync],onClick:()=>(e=>{const t=[l[m.top],l[m.right],l[m.bottom],l[m.left]].filter((e=>""!==e));if(0===t.length)return void a({[e]:!l[e]});const r=Math.max.apply(null,t).toString();a({[e]:!l[e],[m.top]:r,[m.right]:r,[m.bottom]:r,[m.left]:r})})(m.sync),isSmall:!0},l[m.sync]?un:gn))))}function pn(a){const{dimensions:l,deviceType:r}=a,n=(0,m.applyFilters)("generateblocks.editor.dimensionGroupItems",l,a);return(0,e.createElement)(e.Fragment,null,n.map(((l,n)=>(0,e.createElement)(dn,t({},a,{key:n,device:r,type:l.type,label:l.label,units:l.units,computedStyles:l.computedStyles})))))}function bn(){return(bn=Object.assign||function(e){for(var t=1;t=0||(r[a]=e[a]);return r}function fn(e){var t=(0,y.useRef)(e),a=(0,y.useRef)((function(e){t.current&&t.current(e)}));return t.current=e,a.current}var hn=function(e,t,a){return void 0===t&&(t=0),void 0===a&&(a=1),e>a?a:e0:e.buttons>0)&&r.current?n(vn(r.current,e,o.current)):a(!1)},t=function(){return a(!1)};function a(a){var l=s.current,n=yn(r.current),i=a?n.addEventListener:n.removeEventListener;i(l?"touchmove":"mousemove",e),i(l?"touchend":"mouseup",t)}return[function(e){var t=e.nativeEvent,l=r.current;if(l&&(wn(t),!function(e,t){return t&&!kn(e)}(t,s.current)&&l)){if(kn(t)){s.current=!0;var i=t.changedTouches||[];i.length&&(o.current=i[0].identifier)}l.focus(),n(vn(l,t,o.current)),a(!0)}},function(e){var t=e.which||e.keyCode;t<37||t>40||(e.preventDefault(),i({left:39===t?.05:37===t?-.05:0,top:40===t?.05:38===t?-.05:0}))},a]}),[i,n]),u=c[0],g=c[1],d=c[2];return(0,y.useEffect)((function(){return d}),[d]),v().createElement("div",bn({},l,{onTouchStart:u,onMouseDown:u,className:"react-colorful__interactive",ref:r,onKeyDown:g,tabIndex:0,role:"slider"}))})),Tn=function(e){return e.filter(Boolean).join(" ")},En=function(e){var t=e.color,a=e.left,l=e.top,r=void 0===l?.5:l,n=Tn(["react-colorful__pointer",e.className]);return v().createElement("div",{className:n,style:{top:100*r+"%",left:100*a+"%"}},v().createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},Sn=function(e,t,a){return void 0===t&&(t=0),void 0===a&&(a=Math.pow(10,t)),Math.round(a*e)/a},xn=(Math.PI,function(e){var t=e.s,a=e.v,l=e.a,r=(200-t)*a/100;return{h:Sn(e.h),s:Sn(r>0&&r<200?t*a/100/(r<=100?r:200-r)*100:0),l:Sn(r/2),a:Sn(l,2)}}),Bn=function(e){var t=xn(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},Mn=function(e){var t=xn(e);return"hsla("+t.h+", "+t.s+"%, "+t.l+"%, "+t.a+")"},Dn=function(e){var t=e.h,a=e.s,l=e.v,r=e.a;t=t/360*6,a/=100,l/=100;var n=Math.floor(t),i=l*(1-a),o=l*(1-(t-n)*a),s=l*(1-(1-t+n)*a),c=n%6;return{r:Sn(255*[l,o,i,i,s,l][c]),g:Sn(255*[s,l,l,o,i,i][c]),b:Sn(255*[i,i,s,l,l,o][c]),a:Sn(r,2)}},Rn=function(e){var t=/rgba?\(?\s*(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(e);return t?zn({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:void 0===t[7]?1:Number(t[7])/(t[8]?100:1)}):{h:0,s:0,v:0,a:1}},Ln=Rn,zn=function(e){var t=e.r,a=e.g,l=e.b,r=e.a,n=Math.max(t,a,l),i=n-Math.min(t,a,l),o=i?n===t?(a-l)/i:n===a?2+(l-t)/i:4+(t-a)/i:0;return{h:Sn(60*(o<0?o+6:o)),s:Sn(n?i/n*100:0),v:Sn(n/255*100),a:r}},On=v().memo((function(e){var t=e.hue,a=e.onChange,l=Tn(["react-colorful__hue",e.className]);return v().createElement("div",{className:l},v().createElement(Cn,{onMove:function(e){a({h:360*e.left})},onKey:function(e){a({h:hn(t+360*e.left,0,360)})},"aria-label":"Hue","aria-valuetext":Sn(t)},v().createElement(En,{className:"react-colorful__hue-pointer",left:t/360,color:Bn({h:t,s:100,v:100,a:1})})))})),In=v().memo((function(e){var t=e.hsva,a=e.onChange,l={backgroundColor:Bn({h:t.h,s:100,v:100,a:1})};return v().createElement("div",{className:"react-colorful__saturation",style:l},v().createElement(Cn,{onMove:function(e){a({s:100*e.left,v:100-100*e.top})},onKey:function(e){a({s:hn(t.s+100*e.left,0,100),v:hn(t.v-100*e.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+Sn(t.s)+"%, Brightness "+Sn(t.v)+"%"},v().createElement(En,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:Bn(t)})))})),Nn=function(e,t){return e.replace(/\s/g,"")===t.replace(/\s/g,"")};function An(e,t,a){var l=fn(a),r=(0,y.useState)((function(){return e.toHsva(t)})),n=r[0],i=r[1],o=(0,y.useRef)({color:t,hsva:n});(0,y.useEffect)((function(){if(!e.equal(t,o.current.color)){var a=e.toHsva(t);o.current={hsva:a,color:t},i(a)}}),[t,e]),(0,y.useEffect)((function(){var t;(function(e,t){if(e===t)return!0;for(var a in e)if(e[a]!==t[a])return!1;return!0})(n,o.current.hsva)||e.equal(t=e.fromHsva(n),o.current.color)||(o.current={hsva:n,color:t},l(t))}),[n,e,l]);var s=(0,y.useCallback)((function(e){i((function(t){return Object.assign({},t,e)}))}),[]);return[n,s]}var Fn="undefined"!=typeof window?y.useLayoutEffect:y.useEffect,Pn=new Map,Hn=function(e){Fn((function(){var t=e.current?e.current.ownerDocument:document;if(void 0!==t&&!Pn.has(t)){var l=t.createElement("style");l.innerHTML='.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url(\'data:image/svg+xml;charset=utf-8,\')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}',Pn.set(t,l);var r=a.nc;r&&l.setAttribute("nonce",r),t.head.appendChild(l)}}),[])},Vn=function(e){var t=e.className,a=e.colorModel,l=e.color,r=void 0===l?a.defaultColor:l,n=e.onChange,i=mn(e,["className","colorModel","color","onChange"]),o=(0,y.useRef)(null);Hn(o);var s=An(a,r,n),c=s[0],u=s[1],g=Tn(["react-colorful",t]);return v().createElement("div",bn({},i,{ref:o,className:g}),v().createElement(In,{hsva:c,onChange:u}),v().createElement(On,{hue:c.h,onChange:u,className:"react-colorful__last-control"}))},Un=function(e){var t=e.className,a=e.hsva,l=e.onChange,r={backgroundImage:"linear-gradient(90deg, "+Mn(Object.assign({},a,{a:0}))+", "+Mn(Object.assign({},a,{a:1}))+")"},n=Tn(["react-colorful__alpha",t]);return v().createElement("div",{className:n},v().createElement("div",{className:"react-colorful__alpha-gradient",style:r}),v().createElement(Cn,{onMove:function(e){l({a:e.left})},onKey:function(e){l({a:hn(a.a+e.left)})},"aria-label":"Alpha","aria-valuetext":Sn(100*a.a)+"%"},v().createElement(En,{className:"react-colorful__alpha-pointer",left:a.a,color:Mn(a)})))},Gn=function(e){var t=e.className,a=e.colorModel,l=e.color,r=void 0===l?a.defaultColor:l,n=e.onChange,i=mn(e,["className","colorModel","color","onChange"]),o=(0,y.useRef)(null);Hn(o);var s=An(a,r,n),c=s[0],u=s[1],g=Tn(["react-colorful",t]);return v().createElement("div",bn({},i,{ref:o,className:g}),v().createElement(In,{hsva:c,onChange:u}),v().createElement(On,{hue:c.h,onChange:u}),v().createElement(Un,{hsva:c,onChange:u,className:"react-colorful__last-control"}))},jn={defaultColor:"rgba(0, 0, 0, 1)",toHsva:Rn,fromHsva:function(e){var t=Dn(e);return"rgba("+t.r+", "+t.g+", "+t.b+", "+t.a+")"},equal:Nn},qn=function(e){return v().createElement(Gn,bn({},e,{colorModel:jn}))},Wn={defaultColor:"rgb(0, 0, 0)",toHsva:Ln,fromHsva:function(e){var t=Dn(e);return"rgb("+t.r+", "+t.g+", "+t.b+")"},equal:Nn},$n=function(e){return v().createElement(Vn,bn({},e,{colorModel:Wn}))},Zn={grad:.9,turn:360,rad:360/(2*Math.PI)},Kn=function(e){return"string"==typeof e?e.length>0:"number"==typeof e},Jn=function(e,t,a){return void 0===t&&(t=0),void 0===a&&(a=Math.pow(10,t)),Math.round(a*e)/a+0},Qn=function(e,t,a){return void 0===t&&(t=0),void 0===a&&(a=1),e>a?a:e>t?e:t},Yn=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},Xn=function(e){return{r:Qn(e.r,0,255),g:Qn(e.g,0,255),b:Qn(e.b,0,255),a:Qn(e.a)}},ei=function(e){return{r:Jn(e.r),g:Jn(e.g),b:Jn(e.b),a:Jn(e.a,3)}},ti=/^#([0-9a-f]{3,8})$/i,ai=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},li=function(e){var t=e.r,a=e.g,l=e.b,r=e.a,n=Math.max(t,a,l),i=n-Math.min(t,a,l),o=i?n===t?(a-l)/i:n===a?2+(l-t)/i:4+(t-a)/i:0;return{h:60*(o<0?o+6:o),s:n?i/n*100:0,v:n/255*100,a:r}},ri=function(e){var t=e.h,a=e.s,l=e.v,r=e.a;t=t/360*6,a/=100,l/=100;var n=Math.floor(t),i=l*(1-a),o=l*(1-(t-n)*a),s=l*(1-(1-t+n)*a),c=n%6;return{r:255*[l,o,i,i,s,l][c],g:255*[s,l,l,o,i,i][c],b:255*[i,i,s,l,l,o][c],a:r}},ni=function(e){return{h:Yn(e.h),s:Qn(e.s,0,100),l:Qn(e.l,0,100),a:Qn(e.a)}},ii=function(e){return{h:Jn(e.h),s:Jn(e.s),l:Jn(e.l),a:Jn(e.a,3)}},oi=function(e){return ri((a=(t=e).s,{h:t.h,s:(a*=((l=t.l)<50?l:100-l)/100)>0?2*a/(l+a)*100:0,v:l+a,a:t.a}));var t,a,l},si=function(e){return{h:(t=li(e)).h,s:(r=(200-(a=t.s))*(l=t.v)/100)>0&&r<200?a*l/100/(r<=100?r:200-r)*100:0,l:r/2,a:t.a};var t,a,l,r},ci=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,ui=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,gi=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,di=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,pi={string:[[function(e){var t=ti.exec(e);return t?(e=t[1]).length<=4?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:4===e.length?Jn(parseInt(e[3]+e[3],16)/255,2):1}:6===e.length||8===e.length?{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16),a:8===e.length?Jn(parseInt(e.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(e){var t=gi.exec(e)||di.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:Xn({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:void 0===t[7]?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(e){var t=ci.exec(e)||ui.exec(e);if(!t)return null;var a,l,r=ni({h:(a=t[1],l=t[2],void 0===l&&(l="deg"),Number(a)*(Zn[l]||1)),s:Number(t[3]),l:Number(t[4]),a:void 0===t[5]?1:Number(t[5])/(t[6]?100:1)});return oi(r)},"hsl"]],object:[[function(e){var t=e.r,a=e.g,l=e.b,r=e.a,n=void 0===r?1:r;return Kn(t)&&Kn(a)&&Kn(l)?Xn({r:Number(t),g:Number(a),b:Number(l),a:Number(n)}):null},"rgb"],[function(e){var t=e.h,a=e.s,l=e.l,r=e.a,n=void 0===r?1:r;if(!Kn(t)||!Kn(a)||!Kn(l))return null;var i=ni({h:Number(t),s:Number(a),l:Number(l),a:Number(n)});return oi(i)},"hsl"],[function(e){var t=e.h,a=e.s,l=e.v,r=e.a,n=void 0===r?1:r;if(!Kn(t)||!Kn(a)||!Kn(l))return null;var i=function(e){return{h:Yn(e.h),s:Qn(e.s,0,100),v:Qn(e.v,0,100),a:Qn(e.a)}}({h:Number(t),s:Number(a),v:Number(l),a:Number(n)});return ri(i)},"hsv"]]},bi=function(e,t){for(var a=0;a=.5},e.prototype.toHex=function(){return t=(e=ei(this.rgba)).r,a=e.g,l=e.b,n=(r=e.a)<1?ai(Jn(255*r)):"","#"+ai(t)+ai(a)+ai(l)+n;var e,t,a,l,r,n},e.prototype.toRgb=function(){return ei(this.rgba)},e.prototype.toRgbString=function(){return t=(e=ei(this.rgba)).r,a=e.g,l=e.b,(r=e.a)<1?"rgba("+t+", "+a+", "+l+", "+r+")":"rgb("+t+", "+a+", "+l+")";var e,t,a,l,r},e.prototype.toHsl=function(){return ii(si(this.rgba))},e.prototype.toHslString=function(){return t=(e=ii(si(this.rgba))).h,a=e.s,l=e.l,(r=e.a)<1?"hsla("+t+", "+a+"%, "+l+"%, "+r+")":"hsl("+t+", "+a+"%, "+l+"%)";var e,t,a,l,r},e.prototype.toHsv=function(){return e=li(this.rgba),{h:Jn(e.h),s:Jn(e.s),v:Jn(e.v),a:Jn(e.a,3)};var e},e.prototype.invert=function(){return yi({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},e.prototype.saturate=function(e){return void 0===e&&(e=.1),yi(mi(this.rgba,e))},e.prototype.desaturate=function(e){return void 0===e&&(e=.1),yi(mi(this.rgba,-e))},e.prototype.grayscale=function(){return yi(mi(this.rgba,-1))},e.prototype.lighten=function(e){return void 0===e&&(e=.1),yi(hi(this.rgba,e))},e.prototype.darken=function(e){return void 0===e&&(e=.1),yi(hi(this.rgba,-e))},e.prototype.rotate=function(e){return void 0===e&&(e=15),this.hue(this.hue()+e)},e.prototype.alpha=function(e){return"number"==typeof e?yi({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):Jn(this.rgba.a,3);var t},e.prototype.hue=function(e){var t=si(this.rgba);return"number"==typeof e?yi({h:e,s:t.s,l:t.l,a:t.a}):Jn(t.h)},e.prototype.isEqual=function(e){return this.toHex()===yi(e).toHex()},e}(),yi=function(e){return e instanceof ki?e:new ki(e)};function vi(e,t){return e?(t||0===t)&&1!==t&&e.startsWith("#")?(e=e.replace("#",""),"rgba("+parseInt(3===e.length?e.slice(0,1).repeat(2):e.slice(0,2),16)+", "+parseInt(3===e.length?e.slice(1,2).repeat(2):e.slice(2,4),16)+", "+parseInt(3===e.length?e.slice(2,3).repeat(2):e.slice(4,6),16)+", "+t+")"):e:""}function wi(t){const{value:a,onChange:l,onOpacityChange:o,label:s,alpha:c=!1,valueOpacity:u=1,tooltip:g}=t,[d,b]=(0,e.useState)(a||""),m=(0,e.useRef)(null),f=c&&1===u?qn:$n,h=(0,e.useMemo)((()=>(e=>{if(String(e).startsWith("var(")){const t=e.match(/\(([^)]+)\)/);if(t){const a=getComputedStyle(document.documentElement).getPropertyValue(t[1]);a&&(e=a)}}return yi(e).toRgbString()})(a)),[a]),k=(0,q.useDebounce)(l);return(0,e.useEffect)((()=>{a!==d&&k(d),setTimeout((()=>{m.current&&m.current.focus()}),10)}),[d]),(0,e.createElement)("div",{className:"gblocks-color-component"},!!s&&(0,e.createElement)("span",{className:"gblocks-color-component__label"},s),(0,e.createElement)(n.Dropdown,{className:"gblocks-color-component__toggle",contentClassName:"gblocks-color-component-content",position:"top left",renderToggle:t=>{let{isOpen:l,onToggle:r}=t;const i=(0,e.createElement)(n.Button,{className:"gblocks-color-component__toggle-button",onClick:r,"aria-expanded":l},(0,e.createElement)("span",{className:"gblocks-color-component__toggle-indicator",style:{background:a?vi(a,u):null}}));return(0,e.createElement)(e.Fragment,null,g?(0,e.createElement)(n.Tooltip,{text:g},i):i)},renderContent:()=>(0,e.createElement)(e.Fragment,null,(0,e.createElement)(f,{color:h,onChange:e=>{yi(e).isValid()&&(e=1===yi(e).alpha()?yi(e).toHex():e),b(e)}}),(0,e.createElement)("div",{className:"gblocks-color-component-content__input-wrapper"},(0,e.createElement)(n.TextControl,{ref:m,className:"gblocks-color-input",type:"text",value:d,onChange:e=>{!e.startsWith("#")&&/^([0-9A-F]{3}){1,2}$/i.test(e)&&(e="#"+e),b(e)},onBlur:()=>{yi(a).isValid()&&1===yi(a).alpha()&&b(yi(a).toHex())}}),(0,e.createElement)(n.Button,{isSmall:!0,isSecondary:!0,className:"gblocks-color-input-clear",onClick:()=>{b(""),c&&1!==u&&o(1)}},(0,i.__)("Clear","generateblocks"))),c&&1!==u&&(0,e.createElement)("div",{className:"gblocks-color-component-content__opacity"},(0,e.createElement)(n.Tooltip,{text:(0,i.__)("Opacity","generateblocks")},p("gradient")),(0,e.createElement)(n.RangeControl,{value:u||0,onChange:e=>o(e),min:0,max:1,step:.01,initialPosition:1})),(0,e.createElement)(n.BaseControl,{className:"gblocks-color-component-content__palette"},(0,e.createElement)(r.ColorPalette,{value:a||"",onChange:e=>{b(e)},disableCustomColors:!0,clearable:!1})))}))}function _i(t){const{setAttributes:a,attributes:l,colors:r}=t,n=(0,m.applyFilters)("generateblocks.editor.colorGroupItems",r,t);return(0,e.createElement)("div",{className:"gblocks-color-group"},n.map(((t,r)=>(0,e.createElement)("div",{key:r,className:"gblocks-color-group__row"},!!t.label&&(0,e.createElement)("span",{className:"gblocks-color-group__row-label"},t.label),t.items.map(((t,r)=>(0,e.createElement)(wi,{key:r,label:t?.label,tooltip:t?.tooltip,value:l[t.attribute],alpha:t.alpha||!1,valueOpacity:l[t.attribute+"Opacity"],onChange:e=>a({[t.attribute]:e}),onOpacityChange:e=>a({[t.attribute+"Opacity"]:e})})))))))}class Ci extends e.Component{render(){const{attributes:t,setAttributes:a,attrGradient:l,attrGradientDirection:r,attrGradientColorOne:o,attrGradientColorOneOpacity:s,attrGradientColorStopOne:c,attrGradientColorTwo:u,attrGradientColorTwoOpacity:g,attrGradientColorStopTwo:d,defaultColorOne:p,defaultColorTwo:b}=this.props,{gradientSelector:m,innerZindex:f}=t,h="element"===m?(0,i.__)("Displays behind the background image.","generateblocks"):(0,i.__)("Displays in front of the background image.","generateblocks");return(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.ToggleControl,{label:(0,i.__)("Use Gradient","generateblocks"),checked:!!t[l],onChange:e=>{const l=this.props;let n=t[r],i=t[o],s=t[u];e&&(n=n||90,i=i||"rgba(255, 255, 255, 0.1)",s=s||"rgba(0, 0, 0, 0.30)"),a({[l.attrGradient]:e,[l.attrGradientDirection]:n,[l.attrGradientColorOne]:i,[l.attrGradientColorTwo]:s})}}),!!t[l]&&(0,e.createElement)(e.Fragment,null,void 0!==m&&(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Selector","generateblocks"),help:h,value:m,options:[{label:(0,i.__)("Element","generateblocks"),value:"element"},{label:(0,i.__)("Pseudo Element","generateblocks"),value:"pseudo-element"}],onChange:e=>{a({gradientSelector:e}),x(f)||"pseudo-element"!==e||a({innerZindex:1})}}),(0,e.createElement)(n.BaseControl,null,(0,e.createElement)("span",{className:"components-base-control__label"},(0,i.__)("Direction","generateblocks")),(0,e.createElement)(n.RangeControl,{value:t[r]?t[r]:0,onChange:e=>{a({[r]:e})},min:0,max:360,step:1,initialPosition:90})),(0,e.createElement)(n.BaseControl,null,(0,e.createElement)("span",{className:"components-base-control__label"},(0,i.__)("Color One","generateblocks")),(0,e.createElement)("div",{className:"gblocks-component-gradient-control"},(0,e.createElement)(wi,{value:t[o],alpha:!0,valueOpacity:t[s]||1,attrOpacity:"gradientColorOneOpacity",onChange:e=>a({[o]:e}),onOpacityChange:e=>a({[s]:e}),onClear:()=>a({[o]:p})}),(0,e.createElement)(n.TextControl,{className:"gblocks-component-gradient-stop-value",type:"text",value:t[c]||0===t[c]?t[c]:"",placeholder:(0,i.__)("Stop position (%)","generateblocks"),onChange:e=>{a({[c]:e})},onBlur:()=>{(t[c]||0===t[c])&&a({[c]:parseFloat(t[c])})},onClick:e=>{e.currentTarget.focus()}}))),(0,e.createElement)(n.BaseControl,null,(0,e.createElement)("span",{className:"components-base-control__label"},(0,i.__)("Color Two","generateblocks")),(0,e.createElement)("div",{className:"gblocks-component-gradient-control"},(0,e.createElement)(wi,{value:t[u],alpha:!0,valueOpacity:t[g]||1,attrOpacity:"gradientColorTwoOpacity",onChange:e=>a({[u]:e}),onOpacityChange:e=>a({[g]:e}),onClear:()=>a({[u]:b})}),(0,e.createElement)(n.TextControl,{className:"gblocks-component-gradient-stop-value",type:"text",value:t[d]||0===t[d]?t[d]:"",placeholder:(0,i.__)("Stop position (%)","generateblocks"),onChange:e=>{a({[d]:e})},onBlur:()=>{(t[d]||0===t[d])&&a({[d]:parseFloat(t[d])})},onClick:e=>{e.currentTarget.focus()}})))))}}var Ti=Ci,Ei=a(856),Si=a.n(Ei);function xi(e){return Si().sanitize(e,{USE_PROFILES:{svg:!0,svgFilters:!0}})}const Bi=e=>x(e)&&"auto"!==e;var Mi=a=>{const{clientId:o,attributes:c,setAttributes:u,deviceType:g,state:d,blockDefaults:b,tagNames:f,filterTagName:h,allShapes:k,context:y}=a,{tagName:v,isGrid:w,isQueryLoopItem:_,gridId:T,width:E,widthTablet:M,widthMobile:D,autoWidthTablet:R,autoWidthMobile:L,flexGrow:z,flexGrowTablet:O,flexGrowMobile:I,flexShrink:N,flexShrinkTablet:A,flexShrinkMobile:F,flexBasis:P,flexBasisTablet:H,flexBasisMobile:V,flexBasisUnit:U,outerContainer:G,innerContainer:j,containerWidth:q,minHeight:W,minHeightUnit:$,minHeightTablet:Z,minHeightUnitTablet:K,minHeightMobile:J,minHeightUnitMobile:Q,backgroundColor:Y,bgImage:X,bgOptions:ee,bgImageSize:te,bgImageInline:ae,verticalAlignment:le,verticalAlignmentTablet:re,verticalAlignmentMobile:ne,zindex:ie,innerZindex:oe,removeVerticalGap:se,removeVerticalGapTablet:ce,removeVerticalGapMobile:ue,orderTablet:ge,orderMobile:de,align:pe,shapeDividers:be,useDynamicData:me,dynamicContentType:fe}=c,{getBlockParents:he,getBlocksByClientId:ke}=(0,l.useSelect)((e=>e("core/block-editor")),[]);(0,e.useEffect)((()=>{const e=he(o,!0);if(e.length>0){const t=ke(e);if(t.length>0)if("generateblocks/grid"===t[0].name){const e=t[0].attributes.uniqueId;e!==T&&u({isGrid:!0,gridId:e})}else w&&!_&&u({isGrid:!1,gridId:""})}else w&&!_&&u({isGrid:!1,gridId:""})}));const ye=void 0!==y["generateblocks/queryId"],ve=Bi(P),we="auto"!==H&&(Bi(P)||Bi(H)),_e="auto"!==V&&(Bi(P)||Bi(H)||Bi(V)),Ce=[];return Object.keys(generateBlocksInfo.imageSizes).forEach((e=>{Ce.push({label:generateBlocksInfo.imageSizes[e],value:generateBlocksInfo.imageSizes[e]})})),(0,e.createElement)(r.InspectorControls,null,!w&&(0,e.createElement)(C,t({},a,{title:(0,i.__)("Layout","generateblocks"),initialOpen:!0,icon:p("layout"),className:"gblocks-panel-label",id:"containerLayout",state:d}),"Desktop"===g&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Container","generateblocks"),value:G,options:[{label:(0,i.__)("Full width","generateblocks"),value:"full"},{label:(0,i.__)("Contained width","generateblocks"),value:"contained"}],onChange:e=>{u({outerContainer:e}),"contained"===e&&"full"===pe&&u({align:""})}}),"full"===G&&(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Inner Container","generateblocks"),value:j,options:[{label:(0,i.__)("Full width","generateblocks"),value:"full"},{label:(0,i.__)("Contained width","generateblocks"),value:"contained"}],onChange:e=>{u({innerContainer:e})}}),("contained"===G||"contained"===j)&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(S,{label:"full"===G&&"contained"===j?(0,i.__)("Inner Container Width","generateblocks"):(0,i.__)("Container Width","generateblocks"),value:"px",units:["px"],onClick:()=>!1}),(0,e.createElement)(n.TextControl,{type:"number",className:"gblocks-container-width",value:parseFloat(q)||"",placeholder:b.containerWidth,onChange:e=>{u({containerWidth:""!==e?parseFloat(e):void 0})}})),(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Tag Name","generateblocks"),value:v,options:f,onChange:e=>{u({tagName:h(e)})}}),(0,m.applyFilters)("generateblocks.editor.controls","","containerAfterElementTag",a,d)),(0,m.applyFilters)("generateblocks.editor.controls","","containerLayout",a,d)),w&&(0,e.createElement)(C,t({},a,{title:(0,i.__)("Layout","generateblocks"),initialOpen:!0,icon:p("layout"),className:"gblocks-panel-label",id:"containerGridLayout",state:d}),"Desktop"===g&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.BaseControl,null,(0,e.createElement)(S,{label:(0,i.__)("Container Width","generateblocks"),value:"%",units:["%"],onClick:()=>!1}),!!ve&&(0,e.createElement)("div",{className:"gblocks-small-notice-description"},(0,i.__)('Width disabled as Flex Basis is not "auto".',"generateblocks")),(0,e.createElement)(n.ButtonGroup,{className:"widthButtons"},(0,e.createElement)(n.Button,{isPrimary:25===E,onClick:()=>u({width:25}),disabled:ve},"25"),(0,e.createElement)(n.Button,{isPrimary:33.33===E,onClick:()=>u({width:33.33}),disabled:ve},"33"),(0,e.createElement)(n.Button,{isPrimary:50===E,onClick:()=>u({width:50}),disabled:ve},"50"),(0,e.createElement)(n.Button,{isPrimary:66.66===E,onClick:()=>u({width:66.66}),disabled:ve},"66"),(0,e.createElement)(n.Button,{isPrimary:75===E,onClick:()=>u({width:75}),disabled:ve},"75"),(0,e.createElement)(n.Button,{isPrimary:100===E,onClick:()=>u({width:100}),disabled:ve},"100")),(0,e.createElement)(on,{value:x(E)?E:"",onChange:e=>{String(e).startsWith(0)&&(e=""),u({width:e})},rangeMin:10,rangeMax:100,step:5,initialPosition:b.width,disabled:ve})),(0,e.createElement)(n.BaseControl,{className:"gblocks-flex-controls"},(0,e.createElement)("div",{className:"gblocks-utility-label"},(0,e.createElement)("label",{htmlFor:"gblocks-flex-grow-desktop",className:"components-base-control__label"},(0,i.__)("Flex","generateblocks")),(0,e.createElement)(n.Tooltip,{text:(0,i.__)("Reset","generateblocks"),position:"top"},(0,e.createElement)(n.Button,{className:"gblocks-reset-button",icon:p("reset"),onClick:()=>{u({flexGrow:"",flexShrink:"",flexBasis:""})}}))),(0,e.createElement)("div",{className:"gblocks-flex-controls-inner"},(0,e.createElement)(n.TextControl,{help:(0,i.__)("Grow","generateblocks"),id:"gblocks-flex-grow-desktop",type:"number",value:z,min:"0",step:"1",placeholder:"0",onChange:e=>{u({flexGrow:e})},onBlur:()=>{""!==z&&u({flexGrow:parseFloat(z)})},onClick:e=>{e.currentTarget.focus()}}),(0,e.createElement)(n.TextControl,{help:(0,i.__)("Shrink","generateblocks"),type:"number",value:N,min:"0",step:"1",placeholder:"1",onChange:e=>{u({flexShrink:e})},onBlur:()=>{""!==N&&u({flexShrink:parseFloat(N)})},onClick:e=>{e.currentTarget.focus()}}),(0,e.createElement)("div",{className:"gblocks-flex-basis-wrapper"},!isNaN(P)&&(0,e.createElement)(S,{value:U,units:["px","%"],onClick:e=>{u({flexBasisUnit:e})}}),(0,e.createElement)(n.TextControl,{help:(0,i.__)("Basis","generateblocks"),type:"text",placeholder:"auto",value:P,onChange:e=>{u({flexBasis:e})},onBlur:()=>{P.match(/(auto|fill|max-content|min-content|fit-content|content|inherit|initial|revert|unset|[0-9.]+)/g)||u({flexBasis:""})}})))),(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Vertical Alignment","generateblocks"),help:(0,i.__)("Align grid item content. Does not apply if vertical alignment is set in the grid.","generateblocks"),value:le,options:[{label:(0,i.__)("Default","generateblocks"),value:""},{label:(0,i.__)("Top","generateblocks"),value:"flex-start"},{label:(0,i.__)("Center","generateblocks"),value:"center"},{label:(0,i.__)("Bottom","generateblocks"),value:"flex-end"}],onChange:e=>{u({verticalAlignment:e})}}),!_&&(0,e.createElement)(n.ToggleControl,{label:(0,i.__)("Remove Vertical Gap","generateblocks"),checked:!!se,onChange:e=>{u({removeVerticalGap:e})}}),(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Tag Name","generateblocks"),value:v,options:f,onChange:e=>{u({tagName:h(e)})}}),(0,m.applyFilters)("generateblocks.editor.controls","","containerAfterElementTag",a,d)),"Tablet"===g&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.BaseControl,null,(0,e.createElement)(S,{label:(0,i.__)("Container Width","generateblocks"),value:"%",units:["%"],onClick:()=>!1}),!!we&&(0,e.createElement)("div",{className:"gblocks-small-notice-description"},(0,i.__)('Width disabled as Flex Basis is not "auto".',"generateblocks")),(0,e.createElement)(n.ButtonGroup,{className:"widthButtons"},(0,e.createElement)(n.Button,{isPrimary:!!R,disabled:we,onClick:()=>{u(R?{autoWidthTablet:!1}:{autoWidthTablet:!0})}},(0,i.__)("Auto","generateblocks")),(0,e.createElement)(n.Button,{isPrimary:25===M&&!R,onClick:()=>u({widthTablet:25,autoWidthTablet:!1}),disabled:we},"25"),(0,e.createElement)(n.Button,{isPrimary:33.33===M&&!R,onClick:()=>u({widthTablet:33.33,autoWidthTablet:!1}),disabled:we},"33"),(0,e.createElement)(n.Button,{isPrimary:50===M&&!R,onClick:()=>u({widthTablet:50,autoWidthTablet:!1}),disabled:we},"50"),(0,e.createElement)(n.Button,{isPrimary:66.66===M&&!R,onClick:()=>u({widthTablet:66.66,autoWidthTablet:!1}),disabled:we},"66"),(0,e.createElement)(n.Button,{isPrimary:75===M&&!R,onClick:()=>u({widthTablet:75,autoWidthTablet:!1}),disabled:we},"75"),(0,e.createElement)(n.Button,{isPrimary:100===M&&!R,onClick:()=>u({widthTablet:100,autoWidthTablet:!1}),disabled:we},"100")),!R&&(0,e.createElement)(on,{value:x(M)?M:"",onChange:e=>{String(e).startsWith(0)&&(e=""),u({widthTablet:e,autoWidthTablet:!1})},rangeMin:10,rangeMax:100,step:5,initialPosition:b.widthTablet,disabled:we})),(0,e.createElement)(n.BaseControl,{className:"gblocks-flex-controls"},(0,e.createElement)("div",{className:"gblocks-utility-label"},(0,e.createElement)("label",{htmlFor:"gblocks-flex-grow-tablet",className:"components-base-control__label"},(0,i.__)("Flex","generateblocks")),(0,e.createElement)(n.Tooltip,{text:(0,i.__)("Reset","generateblocks"),position:"top"},(0,e.createElement)(n.Button,{className:"gblocks-reset-button",icon:p("reset"),onClick:()=>{u({flexGrowTablet:"",flexShrinkTablet:"",flexBasisTablet:""})}}))),(0,e.createElement)("div",{className:"gblocks-flex-controls-inner"},(0,e.createElement)(n.TextControl,{help:(0,i.__)("Grow","generateblocks"),id:"gblocks-flex-grow-tablet",type:"number",value:O,min:"0",step:"1",placeholder:B("flexGrow",c,"Tablet","0"),onChange:e=>{u({flexGrowTablet:e})},onBlur:()=>{""!==O&&u({flexGrowTablet:parseFloat(O)})},onClick:e=>{e.currentTarget.focus()}}),(0,e.createElement)(n.TextControl,{help:(0,i.__)("Shrink","generateblocks"),type:"number",value:A,min:"0",step:"1",placeholder:B("flexShrink",c,"Tablet","1"),onChange:e=>{u({flexShrinkTablet:e})},onBlur:()=>{""!==A&&u({flexShrinkTablet:parseFloat(A)})},onClick:e=>{e.currentTarget.focus()}}),(0,e.createElement)("div",{className:"gblocks-flex-basis-wrapper"},!isNaN(H)&&(0,e.createElement)(S,{value:U,units:["px","%"],onClick:e=>{u({flexBasisUnit:e})}}),(0,e.createElement)(n.TextControl,{help:(0,i.__)("Basis","generateblocks"),type:"text",value:H,placeholder:B("flexBasis",c,"Tablet","auto"),onChange:e=>{u({flexBasisTablet:e})},onBlur:()=>{H.match(/(auto|fill|max-content|min-content|fit-content|content|inherit|initial|revert|unset|[0-9.]+)/g)||u({flexBasisTablet:""})}})))),(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Vertical Alignment","generateblocks"),help:(0,i.__)("Align grid item content. Does not apply if vertical alignment is set in the grid.","generateblocks"),value:re,options:[{label:(0,i.__)("Inherit","generateblocks"),value:"inherit"},{label:(0,i.__)("Default","generateblocks"),value:""},{label:(0,i.__)("Top","generateblocks"),value:"flex-start"},{label:(0,i.__)("Center","generateblocks"),value:"center"},{label:(0,i.__)("Bottom","generateblocks"),value:"flex-end"}],onChange:e=>{u({verticalAlignmentTablet:e})}}),!_&&(0,e.createElement)(n.ToggleControl,{label:(0,i.__)("Remove Vertical Gap","generateblocks"),checked:!!ce,onChange:e=>{u({removeVerticalGapTablet:e})}}),(0,e.createElement)(n.TextControl,{type:"number",label:(0,i.__)("Order","generateblocks"),value:ge||0===ge?ge:"",onChange:e=>{u({orderTablet:parseFloat(e)})}})),"Mobile"===g&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.BaseControl,null,(0,e.createElement)(S,{label:(0,i.__)("Container Width","generateblocks"),value:"%",units:["%"],onClick:()=>!1}),!!_e&&(0,e.createElement)("div",{className:"gblocks-small-notice-description"},(0,i.__)('Width disabled as Flex Basis is not "auto".',"generateblocks")),(0,e.createElement)(n.ButtonGroup,{className:"widthButtons"},(0,e.createElement)(n.Button,{isPrimary:!!L,disabled:_e,onClick:()=>{u(L?{autoWidthMobile:!1}:{autoWidthMobile:!0})}},(0,i.__)("Auto","generateblocks")),(0,e.createElement)(n.Button,{isPrimary:25===D&&!L,onClick:()=>u({widthMobile:25,autoWidthMobile:!1}),disabled:_e},"25"),(0,e.createElement)(n.Button,{isPrimary:33.33===D&&!L,onClick:()=>u({widthMobile:33.33,autoWidthMobile:!1}),disabled:_e},"33"),(0,e.createElement)(n.Button,{isPrimary:50===D&&!L,onClick:()=>u({widthMobile:50,autoWidthMobile:!1}),disabled:_e},"50"),(0,e.createElement)(n.Button,{isPrimary:66.66===D&&!L,onClick:()=>u({widthMobile:66.66,autoWidthMobile:!1}),disabled:_e},"66"),(0,e.createElement)(n.Button,{isPrimary:75===D&&!L,onClick:()=>u({widthMobile:75,autoWidthMobile:!1}),disabled:_e},"75"),(0,e.createElement)(n.Button,{isPrimary:100===D&&!L,onClick:()=>u({widthMobile:100,autoWidthMobile:!1}),disabled:_e},"100")),!L&&(0,e.createElement)(on,{value:x(D)?D:"",onChange:e=>{String(e).startsWith(0)&&(e=""),u({widthMobile:e,autoWidthMobile:!1})},rangeMin:10,rangeMax:100,step:5,initialPosition:b.widthMobile,disabled:_e})),(0,e.createElement)(n.BaseControl,{className:"gblocks-flex-controls"},(0,e.createElement)("div",{className:"gblocks-utility-label"},(0,e.createElement)("label",{htmlFor:"gblocks-flex-grow-mobile",className:"components-base-control__label"},(0,i.__)("Flex","generateblocks")),(0,e.createElement)(n.Tooltip,{text:(0,i.__)("Reset","generateblocks"),position:"top"},(0,e.createElement)(n.Button,{className:"gblocks-reset-button",icon:p("reset"),onClick:()=>{u({flexGrowMobile:"",flexShrinkMobile:"",flexBasisMobile:""})}}))),(0,e.createElement)("div",{className:"gblocks-flex-controls-inner"},(0,e.createElement)(n.TextControl,{help:(0,i.__)("Grow","generateblocks"),id:"gblocks-flex-grow-mobile",type:"number",value:I,min:"0",step:"1",placeholder:B("flexGrow",c,"Mobile","0"),onChange:e=>{u({flexGrowMobile:e})},onBlur:()=>{""!==I&&u({flexGrowMobile:parseFloat(I)})},onClick:e=>{e.currentTarget.focus()}}),(0,e.createElement)(n.TextControl,{help:(0,i.__)("Shrink","generateblocks"),type:"number",value:F,min:"0",step:"1",placeholder:B("flexShrink",c,"Mobile","1"),onChange:e=>{u({flexShrinkMobile:e})},onBlur:()=>{""!==F&&u({flexShrinkMobile:parseFloat(F)})},onClick:e=>{e.currentTarget.focus()}}),(0,e.createElement)("div",{className:"gblocks-flex-basis-wrapper"},!isNaN(V)&&(0,e.createElement)(S,{value:U,units:["px","%"],onClick:e=>{u({flexBasisUnit:e})}}),(0,e.createElement)(n.TextControl,{help:(0,i.__)("Basis","generateblocks"),type:"text",value:V,placeholder:B("flexBasis",c,"Mobile","auto"),onChange:e=>{u({flexBasisMobile:e})},onBlur:()=>{V.match(/(auto|fill|max-content|min-content|fit-content|content|inherit|initial|revert|unset|[0-9.]+)/g)||u({flexBasisMobile:""})}})))),(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Vertical Alignment","generateblocks"),help:(0,i.__)("Align grid item content. Does not apply if vertical alignment is set in the grid.","generateblocks"),value:ne,options:[{label:(0,i.__)("Inherit","generateblocks"),value:"inherit"},{label:(0,i.__)("Default","generateblocks"),value:""},{label:(0,i.__)("Top","generateblocks"),value:"flex-start"},{label:(0,i.__)("Center","generateblocks"),value:"center"},{label:(0,i.__)("Bottom","generateblocks"),value:"flex-end"}],onChange:e=>{u({verticalAlignmentMobile:e})}}),!_&&(0,e.createElement)(n.ToggleControl,{label:(0,i.__)("Remove Vertical Gap","generateblocks"),checked:!!ue,onChange:e=>{u({removeVerticalGapMobile:e})}}),(0,e.createElement)(n.TextControl,{type:"number",label:(0,i.__)("Order","generateblocks"),value:de||0===de?de:"",onChange:e=>{u({orderMobile:parseFloat(e)})}})),(0,m.applyFilters)("generateblocks.editor.controls","","containerGridLayout",a,d)),(0,e.createElement)(C,t({},a,{title:(0,i.__)("Typography","generateblocks"),initialOpen:!1,icon:p("typography"),className:"gblocks-panel-label",id:"containerTypography",state:d}),(0,e.createElement)(cn,t({},a,{deviceType:g,options:["fontWeight","textTransform","fontSize","fontFamily"]})),(0,m.applyFilters)("generateblocks.editor.controls","","containerTypography",a,d)),(0,e.createElement)(C,t({},a,{title:(0,i.__)("Spacing","generateblocks"),initialOpen:!1,icon:p("spacing"),className:"gblocks-panel-label",id:"containerSpacing",state:d}),(0,e.createElement)(pn,t({},a,{deviceType:g,dimensions:[{type:"padding",label:(0,i.__)("Padding","generateblocks"),units:["px","em","%"]},{type:"margin",label:(0,i.__)("Margin","generateblocks"),units:["px","em","%"]},{type:"borderSize",label:(0,i.__)("Border Size","generateblocks"),units:["px"]},{type:"borderRadius",label:(0,i.__)("Border Radius","generateblocks"),units:["px","em","%"]}]})),"Desktop"===g&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(S,{label:(0,i.__)("Minimum Height","generateblocks"),value:$,units:["px","vh","vw"],onClick:e=>{u({minHeightUnit:e})}}),(0,e.createElement)(n.TextControl,{type:"number",value:W||"",onChange:e=>{u({minHeight:parseFloat(e)})}}),!!W&&!w&&(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Vertical Alignment","generateblocks"),value:le,options:[{label:(0,i.__)("Default","generateblocks"),value:""},{label:(0,i.__)("Top","generateblocks"),value:"flex-start"},{label:(0,i.__)("Center","generateblocks"),value:"center"},{label:(0,i.__)("Bottom","generateblocks"),value:"flex-end"}],onChange:e=>{u({verticalAlignment:e})}}),(0,e.createElement)(n.TextControl,{label:(0,i.__)("Outer z-index","generateblocks"),type:"number",value:ie||0===ie?ie:"",onChange:e=>{u({zindex:e})},onBlur:()=>{u({zindex:parseFloat(ie)})},onClick:e=>{e.currentTarget.focus()}}),(0,e.createElement)(n.TextControl,{label:(0,i.__)("Inner z-index","generateblocks"),type:"number",value:oe||0===oe?oe:"",onChange:e=>{u({innerZindex:e})},onBlur:()=>{u({innerZindex:parseFloat(oe)})},onClick:e=>{e.currentTarget.focus()}})),"Tablet"===g&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(S,{label:(0,i.__)("Minimum Height","generateblocks"),value:K,units:["px","vh","vw"],onClick:e=>{u({minHeightUnitTablet:e})}}),(0,e.createElement)(n.TextControl,{type:"number",value:Z||0===Z?Z:"",onChange:e=>{u({minHeightTablet:parseFloat(e)})}}),(!!W||!!Z)&&!w&&(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Vertical Alignment","generateblocks"),value:re,options:[{label:(0,i.__)("Inherit","generateblocks"),value:"inherit"},{label:(0,i.__)("Default","generateblocks"),value:""},{label:(0,i.__)("Top","generateblocks"),value:"flex-start"},{label:(0,i.__)("Center","generateblocks"),value:"center"},{label:(0,i.__)("Bottom","generateblocks"),value:"flex-end"}],onChange:e=>{u({verticalAlignmentTablet:e})}})),"Mobile"===g&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(S,{label:(0,i.__)("Minimum Height","generateblocks"),value:Q,units:["px","vh","vw"],onClick:e=>{u({minHeightUnitMobile:e})}}),(0,e.createElement)(n.TextControl,{type:"number",value:J||0===J?J:"",onChange:e=>{u({minHeightMobile:parseFloat(e)})}}),(!!W||!!Z||!!J)&&!w&&(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Vertical Alignment","generateblocks"),value:ne,options:[{label:(0,i.__)("Inherit","generateblocks"),value:"inherit"},{label:(0,i.__)("Default","generateblocks"),value:""},{label:(0,i.__)("Top","generateblocks"),value:"flex-start"},{label:(0,i.__)("Center","generateblocks"),value:"center"},{label:(0,i.__)("Bottom","generateblocks"),value:"flex-end"}],onChange:e=>{u({verticalAlignmentMobile:e})}})),(0,m.applyFilters)("generateblocks.editor.controls","","containerSpacing",a,d)),(0,e.createElement)(C,t({},a,{title:(0,i.__)("Colors","generateblocks"),initialOpen:!1,icon:p("colors"),className:"gblocks-panel-label",id:"containerColors",state:d}),"Desktop"===g&&(0,e.createElement)(_i,t({},a,{colors:[{group:"background",label:(0,i.__)("Background","generateblocks"),items:[{attribute:"backgroundColor",alpha:!0}]},{group:"text",label:(0,i.__)("Text","generateblocks"),items:[{attribute:"textColor"}]},{group:"link",label:(0,i.__)("Link","generateblocks"),items:[{attribute:"linkColor"},{tooltip:(0,i.__)("Hover","generateblocks"),attribute:"linkColorHover"}]},{group:"border",label:(0,i.__)("Border","generateblocks"),items:[{attribute:"borderColor",alpha:!0}]}]})),(0,m.applyFilters)("generateblocks.editor.controls","","containerColors",a,d)),(0,e.createElement)(C,t({},a,{title:(0,i.__)("Backgrounds","generateblocks"),initialOpen:!1,icon:p("gradients"),className:"gblocks-panel-label",id:"containerBackground",state:d}),(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.BaseControl,{id:"gblocks-background-image-upload",label:(0,i.__)("Image URL","generateblocks")},(0,e.createElement)("div",{className:"gblocks-bg-image-wrapper"},(0,e.createElement)(n.TextControl,{type:"text",value:X?X.image.url:"",onChange:e=>{u(e?{bgImage:{id:"",image:{url:e}}}:{bgImage:null})}}),(0,e.createElement)("div",{className:"gblocks-background-image-action-buttons"},(0,e.createElement)(r.MediaUpload,{title:(0,i.__)("Set background image","generateblocks"),onSelect:e=>{let t=b.bgImageSize;void 0===e.sizes[t]&&(t="full"),u({bgImage:{id:e.id,image:e.sizes[t]}})},onClose:()=>{document.querySelector(".gblocks-bg-image-wrapper input").focus()},allowedTypes:["image"],value:X?X.id:"",modalClass:"editor-gb-container-background__media-modal",render:t=>{let{open:a}=t;return(0,e.createElement)(n.Tooltip,{text:(0,i.__)("Open the Media Library","generateblocks")},(0,e.createElement)(n.Button,{onClick:a,className:"is-secondary is-small"},(0,i.__)("Browse","generateblocks")))}}),(0,m.applyFilters)("generateblocks.editor.backgroundImageActions","",a,d)))),me&&""!==fe&&(0,e.createElement)(n.Notice,{className:"gblocks-option-notice",status:"info",isDismissible:!1},(0,i.__)("Using featured image as dynamic background.","generateblocks")),(!!X||me&&""!==fe)&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.ToggleControl,{label:(0,i.__)("Use inline style","generateblocks"),disabled:me&&""!==fe&&(_||ye),checked:!!ae,onChange:e=>{u({bgImageInline:e})}}),ee.overlay?(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.ToggleControl,{label:(0,i.__)("Background Color Overlay","generateblocks"),checked:!!ee.overlay,onChange:e=>{u({bgOptions:{...ee,overlay:e}})}}),(0,e.createElement)(n.Notice,{className:"gblocks-option-notice",status:"info",isDismissible:!1},(0,i.__)("The background color overlay option is deprecated. Toggle this option to use the new method.","generateblocks"))):(0,e.createElement)(e.Fragment,null,(X&&X.id||me&&""!==fe)&&(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Image Size","generateblocks"),value:te,options:Ce,onChange:e=>{u({bgImageSize:e})}}),(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Selector","generateblocks"),value:ee.selector,options:[{label:(0,i.__)("Element","generateblocks"),value:"element"},{label:(0,i.__)("Pseudo Element","generateblocks"),value:"pseudo-element"}],onChange:e=>{u({bgOptions:{...ee,selector:e}}),"pseudo-element"!==e||oe||0===oe||u({innerZindex:1})}}),(0,e.createElement)(n.RangeControl,{label:(0,i.__)("Image Opacity","generateblocks"),value:ee.opacity,onChange:e=>{u({bgOptions:{...ee,opacity:e,selector:"pseudo-element"}}),oe||0===oe||u({innerZindex:1})},min:0,max:1,step:.01,initialPosition:b.bgOptions.opacity}),1!==ee.opacity&&"pseudo-element"!==ee.selector&&(0,e.createElement)(n.Notice,{className:"gblocks-option-notice",status:"info",isDismissible:!1},(0,i.__)("Your selector must be set to Pseudo Element to use opacity.","generateblocks"))),(0,e.createElement)(n.TextControl,{label:(0,i.__)("Size","generateblocks"),value:ee.size,onChange:e=>{u({bgOptions:{...ee,size:e}})}}),(0,e.createElement)(n.TextControl,{label:(0,i.__)("Position","generateblocks"),value:ee.position,onChange:e=>{u({bgOptions:{...ee,position:e}})}}),(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Repeat","generateblocks"),value:ee.repeat,options:[{label:"no-repeat",value:"no-repeat"},{label:"repeat",value:"repeat"},{label:"repeat-x",value:"repeat-x"},{label:"repeat-y",value:"repeat-y"}],onChange:e=>{u({bgOptions:{...ee,repeat:e}})}}),(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Attachment","generateblocks"),value:ee.attachment,options:[{label:"scroll",value:""},{label:"fixed",value:"fixed"},{label:"local",value:"local"}],onChange:e=>{u({bgOptions:{...ee,attachment:e}})}})),(0,e.createElement)(Ti,t({},a,{attrGradient:"gradient",attrGradientDirection:"gradientDirection",attrGradientColorOne:"gradientColorOne",attrGradientColorStopOne:"gradientColorStopOne",attrGradientColorTwo:"gradientColorTwo",attrGradientColorStopTwo:"gradientColorStopTwo",attrGradientColorOneOpacity:"gradientColorOneOpacity",attrGradientColorTwoOpacity:"gradientColorTwoOpacity",defaultColorOne:b.gradientColorOne,defaultColorTwo:b.gradientColorTwo})),(0,m.applyFilters)("generateblocks.editor.controls","","containerBackground",a,d))),(0,e.createElement)(C,t({},a,{title:(0,i.__)("Shapes","generateblocks"),initialOpen:!1,icon:p("shapes"),className:"gblocks-panel-label",id:"containerShapes",state:d,showPanel:!("Desktop"!==g&&!c.shapeDividers.length)}),(0,e.createElement)(n.BaseControl,{className:"gb-icon-chooser gb-shape-chooser"},be.map(((t,a)=>{const l=a+1;return(0,e.createElement)(e.Fragment,{key:a},(0,e.createElement)("div",{className:"gblocks-shape-container"},(0,e.createElement)("div",{className:s()({"gblocks-shape-toggle-preview":!0,[`gblocks-shape-toggle-preview-${l}`]:!0}),style:{backgroundColor:Y}},void 0!==k[be[a].shape]&&(0,e.createElement)("div",{className:"gblocks-shape-divider-preview",style:{color:be[a].color},dangerouslySetInnerHTML:{__html:xi(k[be[a].shape].icon)}})), /* translators: Shape number */ (0,i.sprintf)((0,i.__)("Shape %s","generateblocks"),l),(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.Dropdown,{contentClassName:"gblocks-shapes-dropdown",renderToggle:t=>{let{isOpen:a,onToggle:l}=t;return(0,e.createElement)(n.Tooltip,{text:(0,i.__)("Edit Shape","generateblocks")},(0,e.createElement)(n.Button,{className:"gblocks-shape-dropdown",isSecondary:!a||void 0,isPrimary:!!a||void 0,icon:p("wrench"),onClick:l,"aria-expanded":a}))},renderContent:()=>(0,e.createElement)("div",{className:"gblocks-shape-controls"},"Desktop"===g&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.BaseControl,{className:"gb-icon-chooser"},Object.keys(generateBlocksInfo.svgShapes).map(((t,l)=>{const r=generateBlocksInfo.svgShapes[t].svgs;return(0,e.createElement)(n.PanelBody,{title:generateBlocksInfo.svgShapes[t].group,initialOpen:r.hasOwnProperty(be[a].shape),key:l},(0,e.createElement)(n.PanelRow,null,(0,e.createElement)(n.BaseControl,null,(0,e.createElement)("ul",{className:"gblocks-icon-chooser gblocks-shape-chooser"},Object.keys(r).map(((t,l)=>(0,e.createElement)("li",{key:`editor-pblock-types-list-item-${l}`},(0,e.createElement)(n.Tooltip,{text:r[t].label},(0,e.createElement)(n.Button,{className:s()({"editor-block-list-item-button":!0,"gblocks-shape-is-active":be[a].shape===t}),onClick:()=>{const e=[...be];e[a]={...e[a],shape:t},u({shapeDividers:e})}},"string"==typeof r[t].icon?(0,e.createElement)(e.Fragment,null,(0,e.createElement)("span",{className:"editor-block-types-list__item-icon",dangerouslySetInnerHTML:{__html:xi(r[t].icon)}})):(0,e.createElement)(e.Fragment,null,(0,e.createElement)("span",{className:"editor-block-types-list__item-icon"},r[t].icon)))))))))))}))),(0,e.createElement)(n.BaseControl,null,(0,e.createElement)(wi,{label:(0,i.__)("Color","generateblocks"),value:be[a].color,alpha:!0,valueOpacity:be[a].colorOpacity,onChange:e=>{const t=[...be];t[a]={...t[a],color:e},u({shapeDividers:t})},onOpacityChange:e=>{const t=[...be];t[a]={...t[a],colorOpacity:e},u({shapeDividers:t})}})),(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Location","generateblocks"),value:be[a].location,options:[{label:(0,i.__)("Top","generateblocks"),value:"top"},{label:(0,i.__)("Bottom","generateblocks"),value:"bottom"}],onChange:e=>{const t=[...be];t[a]={...t[a],location:e},u({shapeDividers:t})}}),(0,e.createElement)(S,{label:(0,i.__)("Height","generateblocks"),value:"px",units:["px"],onClick:()=>!1}),(0,e.createElement)(n.TextControl,{type:"number",value:be[a].height?be[a].height:"",onChange:e=>{const t=[...be];t[a]={...t[a],height:parseFloat(e)},u({shapeDividers:t})}}),(0,e.createElement)(S,{label:(0,i.__)("Width","generateblocks"),value:"%",units:["%"],onClick:()=>!1}),(0,e.createElement)(n.TextControl,{type:"number",value:be[a].width?be[a].width:"",min:"100",onChange:e=>{const t=[...be];t[a]={...t[a],width:parseFloat(e)},u({shapeDividers:t})}}),(0,e.createElement)(n.ToggleControl,{label:(0,i.__)("Flip Horizontally","generateblocks"),checked:!!be[a].flipHorizontally,onChange:e=>{const t=[...be];t[a]={...t[a],flipHorizontally:e},u({shapeDividers:t})}}),(0,e.createElement)(n.TextControl,{label:(0,i.__)("z-index","generateblocks"),type:"number",min:"0",value:be[a].zindex||0===be[a].zindex?be[a].zindex:"",onChange:e=>{const t=[...be];t[a]={...t[a],zindex:e},u({shapeDividers:t})},onBlur:()=>{const e=[...be];e[a]={...e[a],zindex:parseFloat(be[a].zindex)},u({shapeDividers:e})},onClick:e=>{e.currentTarget.focus()}})),"Tablet"===g&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(S,{label:(0,i.__)("Height","generateblocks"),value:"px",units:["px"],onClick:()=>!1}),(0,e.createElement)(n.TextControl,{type:"number",value:be[a].heightTablet?be[a].heightTablet:"",onChange:e=>{const t=[...be];t[a]={...t[a],heightTablet:parseFloat(e)},u({shapeDividers:t})}}),(0,e.createElement)(S,{label:(0,i.__)("Width","generateblocks"),value:"%",units:["%"],onClick:()=>!1}),(0,e.createElement)(n.TextControl,{type:"number",value:be[a].widthTablet?be[a].widthTablet:"",min:"100",onChange:e=>{const t=[...be];t[a]={...t[a],widthTablet:parseFloat(e)},u({shapeDividers:t})}})),"Mobile"===g&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(S,{label:(0,i.__)("Height","generateblocks"),value:"px",units:["px"],onClick:()=>!1}),(0,e.createElement)(n.TextControl,{type:"number",value:be[a].heightMobile?be[a].heightMobile:"",onChange:e=>{const t=[...be];t[a]={...t[a],heightMobile:parseFloat(e)},u({shapeDividers:t})}}),(0,e.createElement)(S,{label:(0,i.__)("Width","generateblocks"),value:"%",units:["%"],onClick:()=>!1}),(0,e.createElement)(n.TextControl,{type:"number",value:be[a].widthMobile?be[a].widthMobile:"",min:"100",onChange:e=>{const t=[...be];t[a]={...t[a],widthMobile:parseFloat(e)},u({shapeDividers:t})}})))})),"Desktop"===g&&(0,e.createElement)(n.Tooltip,{text:(0,i.__)("Delete Shape","generateblocks")},(0,e.createElement)(n.Button,{className:"gblocks-remove-shape",onClick:()=>{window.confirm((0,i.__)("This will permanently delete this shape.","generateblocks"))&&(e=>{const t=[...be];t.splice(e,1),u({shapeDividers:t})})(a)},icon:p("x")}))))})),(0,e.createElement)("div",{className:"gblocks-add-new-shape"},(0,e.createElement)(n.Button,{isSecondary:!0,onClick:(()=>{const e=[...be];e.push({shape:generateBlocksStyling.container.shapeDividers.shape,color:generateBlocksStyling.container.shapeDividers.color,colorOpacity:generateBlocksStyling.container.shapeDividers.colorOpacity,location:generateBlocksStyling.container.shapeDividers.location,height:generateBlocksStyling.container.shapeDividers.height,heightTablet:generateBlocksStyling.container.shapeDividers.heightTablet,heightMobile:generateBlocksStyling.container.shapeDividers.heightMobile,width:generateBlocksStyling.container.shapeDividers.width,widthTablet:generateBlocksStyling.container.shapeDividers.widthTablet,widthMobile:generateBlocksStyling.container.shapeDividers.widthMobile,flipHorizontally:generateBlocksStyling.container.shapeDividers.flipHorizontally,zindex:generateBlocksStyling.container.shapeDividers.zindex}),u({shapeDividers:e})}).bind(void 0)},(0,i.__)("Add Shape","generateblocks")))),(0,m.applyFilters)("generateblocks.editor.controls","","containerShapeDivider",a,d)))},Di=t=>{let{source:a,onChange:l,help:r,dynamicContentType:n}=t;const o=(e=>{const t=[{value:"current-post",label:"caption"===e?(0,i.__)("Current image","generateblocks"):(0,i.__)("Current post","generateblocks")},{value:"post-type",label:(0,i.__)("Post type","generateblocks")}];return(0,m.applyFilters)("generateblocks.editor.dynamicContent.sourceOptions",t)})(n),s=o.filter((e=>e.value===a));return(0,e.createElement)(Cr,{id:"gblocks-select-source-control",label:(0,i.__)("Data source","generateblocks"),help:r,placeholder:(0,i.__)("Select source","generateblocks"),options:o,value:s,onChange:l})},Ri=t=>{let{dynamicSource:a,postType:l,postId:r,setAttributes:n,dynamicContentType:o}=t;return(0,e.createElement)(e.Fragment,null,(0,e.createElement)(Di,{source:a,onChange:e=>{n({dynamicSource:e.value,postId:"",postType:"post"})},dynamicContentType:o}),"post-type"===a&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(Br,{postType:l,onChange:e=>{n({postType:e.value,postId:""})}}),(0,e.createElement)(Vr,{postId:r,postType:l,value:r?[r]:[],id:"gblocks-select-post",label:(0,i.__)("Select source post","generateblocks"),onChange:e=>{n({postId:e.value})},isMulti:!1})))},Li=t=>{let{dynamicContentType:a,setAttributes:l,name:r,isCaption:n}=t;const o=((e,t)=>{let a=[{options:[{value:"",label:(0,i.__)("Select…","generateblocks")}]},{label:(0,i.__)("Post","generateblocks"),options:[{value:"post-title",label:(0,i.__)("Title","generateblocks")},{value:"post-excerpt",label:(0,i.__)("Excerpt","generateblocks")},{value:"post-date",label:(0,i.__)("Post date","generateblocks")},{value:"post-meta",label:(0,i.__)("Post meta","generateblocks")},{value:"comments-number",label:(0,i.__)("Comments number","generateblocks")},{value:"terms",label:(0,i.__)("List of terms","generateblocks")}]},{label:(0,i.__)("Author","generateblocks"),options:[{value:"author-meta",label:(0,i.__)("Author meta","generateblocks")},{value:"author-email",label:(0,i.__)("Email","generateblocks")},{value:"author-name",label:(0,i.__)("Name","generateblocks")},{value:"author-nickname",label:(0,i.__)("Nickname","generateblocks")},{value:"author-first-name",label:(0,i.__)("First name","generateblocks")},{value:"author-last-name",label:(0,i.__)("Last name","generateblocks")}]}];return"generateblocks/button"===e&&a.push({label:(0,i.__)("Pagination","generateblocks"),options:[{value:"pagination-numbers",label:(0,i.__)("Pagination numbers","generateblocks")}]}),"generateblocks/container"!==e&&"generateblocks/image"!==e||(a=[{options:[{value:"",label:(0,i.__)("Select…","generateblocks")}]},{label:(0,i.__)("Post","generateblocks"),options:[{value:"featured-image",label:(0,i.__)("Featured Image","generateblocks")},{value:"post-meta",label:(0,i.__)("Post meta","generateblocks")}]},{label:(0,i.__)("Author","generateblocks"),options:[{value:"author-avatar",label:(0,i.__)("Author avatar","generateblocks")}]}]),t&&(a=[{options:[{value:"",label:(0,i.__)("Select…","generateblocks")}]},{label:(0,i.__)("Image","generateblocks"),options:[{value:"caption",label:(0,i.__)("Caption","generateblocks")},{value:"post-title",label:(0,i.__)("Title","generateblocks")},{value:"alt-text",label:(0,i.__)("Alt text","generateblocks")},{value:"image-description",label:(0,i.__)("Description","generateblocks")}]}]),(0,m.applyFilters)("generateblocks.editor.dynamicContent.sourceTypes",a,e)})(r,n),s=o.reduce(((e,t)=>e.concat(t.options)),[]).filter((e=>e.value===a));let c=(0,i.__)("Content source","generateblocks");return"generateblocks/container"===r&&(c=(0,i.__)("Background image source","generateblocks")),"generateblocks/image"===r&&(c=(0,i.__)("Image source","generateblocks")),(0,e.createElement)(Cr,{id:"gblocks-select-content-type-control",label:c,placeholder:c,options:o,value:s,onChange:e=>{l({dynamicContentType:e.value,metaFieldName:""}),"comments-number"===e.value?l({noCommentsText:(0,i.__)("No comments","generateblocks"),singleCommentText:(0,i.__)("1 comment","generateblocks"), // translators: Number of comments. From 065e63b26d460da6a668f5daf04de5f6e2dfd4e7 Mon Sep 17 00:00:00 2001 From: Tom Usborne Date: Tue, 20 Sep 2022 14:38:54 -0700 Subject: [PATCH 65/75] Fix: Remove gb-*-text class from blocks with icons --- includes/blocks/class-button.php | 2 +- includes/blocks/class-headline.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/blocks/class-button.php b/includes/blocks/class-button.php index 5bff2b2da..bafe71c2f 100644 --- a/includes/blocks/class-button.php +++ b/includes/blocks/class-button.php @@ -420,7 +420,7 @@ public static function render_block( $attributes, $content, $block ) { $classNames[] = $settings['className']; } - if ( empty( $settings['icon'] ) ) { + if ( empty( $settings['hasIcon'] ) ) { $classNames[] = 'gb-button-text'; } diff --git a/includes/blocks/class-headline.php b/includes/blocks/class-headline.php index 3eb6685a8..4f7433baf 100644 --- a/includes/blocks/class-headline.php +++ b/includes/blocks/class-headline.php @@ -723,7 +723,7 @@ public static function render_block( $attributes, $content, $block ) { $classNames[] = $settings['className']; } - if ( empty( $settings['icon'] ) ) { + if ( empty( $settings['hasIcon'] ) ) { $classNames[] = 'gb-headline-text'; } From c6318f4304218aaa52bb053fd140b827f95be514 Mon Sep 17 00:00:00 2001 From: Tom Usborne Date: Tue, 20 Sep 2022 14:39:20 -0700 Subject: [PATCH 66/75] Fix: Dynamic content conflict with icons and custom classes --- includes/class-dynamic-content.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/includes/class-dynamic-content.php b/includes/class-dynamic-content.php index e2bc7ca69..1366f3dac 100644 --- a/includes/class-dynamic-content.php +++ b/includes/class-dynamic-content.php @@ -1051,10 +1051,12 @@ public static function get_static_content( $content ) { $html_nodes = $doc->getElementsByTagName( '*' ); foreach ( $html_nodes as $node ) { + $classes = explode( ' ', $node->getAttribute( 'class' ) ); + if ( - strpos( $node->getAttribute( 'class' ), 'gb-button-text' ) !== false || - strpos( $node->getAttribute( 'class' ), 'gb-headline-text' ) !== false || - strpos( $node->getAttribute( 'class' ), 'gb-block-image' ) !== false + in_array( 'gb-button-text', $classes ) || + in_array( 'gb-headline-text', $classes ) || + in_array( 'gb-block-image', $classes ) ) { // phpcs:ignore -- DOMDocument doesn't use snake-case. foreach ( $node->childNodes as $childNode ) { From 73178798ff83298e2a219c75a225a14b2dbb087a Mon Sep 17 00:00:00 2001 From: Tom Usborne Date: Tue, 20 Sep 2022 15:50:04 -0700 Subject: [PATCH 67/75] Fix: Missing legacy alpha color slider --- src/components/gradient/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/gradient/index.js b/src/components/gradient/index.js index b8702daea..6c3b74acb 100644 --- a/src/components/gradient/index.js +++ b/src/components/gradient/index.js @@ -127,7 +127,7 @@ class GradientControl extends Component { setAttributes( { @@ -177,7 +177,7 @@ class GradientControl extends Component { setAttributes( { From 834db8bc221361ef3cf3346b7c085a76f2f69bf7 Mon Sep 17 00:00:00 2001 From: Tom Usborne Date: Tue, 20 Sep 2022 15:53:08 -0700 Subject: [PATCH 68/75] Update readme.txt --- readme.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/readme.txt b/readme.txt index ec35d9863..71889fb9e 100644 --- a/readme.txt +++ b/readme.txt @@ -95,6 +95,7 @@ GenerateBlocks was built to work hand-in-hand with [GeneratePress](https://gener * Fix: "Sticky posts only" not displaying correctly in the frontend * Fix: Pass dynamic container link to settings variable * Fix: Color picker behavior when manually changing value +* Fix: Missing legacy alpha color slider in gradient component if set to 0 * Tweak: Enqueue inline embedding stylesheet using wp_enqueue_scripts * Tweak: Remove block-editor-block-list__block class from root wrapper * Tweak: Headline transform to core Heading keep the level From 64807c9ff10198b459daa47246644c9657639b6d Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 21 Sep 2022 15:42:00 +0000 Subject: [PATCH 69/75] Update dist files --- dist/blocks.asset.php | 2 +- dist/blocks.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/blocks.asset.php b/dist/blocks.asset.php index 72ddf86e3..144082f26 100644 --- a/dist/blocks.asset.php +++ b/dist/blocks.asset.php @@ -1 +1 @@ - array('lodash', 'react', 'react-dom', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-date', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-notices', 'wp-primitives', 'wp-rich-text'), 'version' => '4007f20da68e8136395e273b5e71295b'); \ No newline at end of file + array('lodash', 'react', 'react-dom', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-date', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-notices', 'wp-primitives', 'wp-rich-text'), 'version' => '2f78832bc8ff9bf7a6b5dc42b981644b'); \ No newline at end of file diff --git a/dist/blocks.js b/dist/blocks.js index 555fa8edd..301ba1dd4 100644 --- a/dist/blocks.js +++ b/dist/blocks.js @@ -4,7 +4,7 @@ /* translators: Dimension label (padding, margin, border) */,"aria-label":(0,i.sprintf)((0,i.__)("%s Top","generateblocks"),r),value:l[m.top]||"",min:"margin"!==o?0:void 0}),(0,e.createElement)("label",{htmlFor:m.top,className:"gblocks-dimensions-control__label"},f.top)),(0,e.createElement)("div",null,(0,e.createElement)("input",{id:m.right,className:"components-gblocks-dimensions-control__number",placeholder:B(m.right,l,d,""),type:"number",onChange:e=>{let t=e.target.value;"margin"!==o&&(t=t.toString().replace(/-/g,"")),l[m.sync]?h(t):(e=>{a({[m.right]:e})})(t)} /* translators: Dimension label (padding, margin, border) */,"aria-label":(0,i.sprintf)((0,i.__)("%s Right","generateblocks"),r),value:l[m.right]||"",min:"margin"!==o?0:void 0}),(0,e.createElement)("label",{htmlFor:m.right,className:"gblocks-dimensions-control__label"},f.right)),(0,e.createElement)("div",null,(0,e.createElement)("input",{id:m.bottom,className:"components-gblocks-dimensions-control__number",placeholder:B(m.bottom,l,d,"margin"===o&&"px"===l.marginUnit?b.marginBottom:""),type:"number",onChange:e=>{let t=e.target.value;"margin"!==o&&(t=t.toString().replace(/-/g,"")),l[m.sync]?h(t):(e=>{a({[m.bottom]:e})})(t)} /* translators: Dimension label (padding, margin, border) */,"aria-label":(0,i.sprintf)((0,i.__)("%s Bottom","generateblocks"),r),value:l[m.bottom]||"",min:"margin"!==o?0:void 0}),(0,e.createElement)("label",{htmlFor:m.bottom,className:"gblocks-dimensions-control__label"},f.bottom)),(0,e.createElement)("div",null,(0,e.createElement)("input",{id:m.left,className:"components-gblocks-dimensions-control__number",placeholder:B(m.left,l,d,""),type:"number",onChange:e=>{let t=e.target.value;"margin"!==o&&(t=t.toString().replace(/-/g,"")),l[m.sync]?h(t):(e=>{a({[m.left]:e})})(t)} -/* translators: Dimension label (padding, margin, border) */,"aria-label":(0,i.sprintf)((0,i.__)("%s Left","generateblocks"),r),value:l[m.left]||"",min:"margin"!==o?0:void 0}),(0,e.createElement)("label",{htmlFor:m.left,className:"gblocks-dimensions-control__label"},f.left)),(0,e.createElement)(n.Tooltip,{text:l[m.sync]?(0,i.__)("Unlink Sides","generateblocks"):(0,i.__)("Link Sides","generateblocks")},(0,e.createElement)(n.Button,{className:"components-gblocks-dimensions-control_sync","aria-label":l[m.sync]?(0,i.__)("Unlink Sides","generateblocks"):(0,i.__)("Link Sides","generateblocks"),isPrimary:!!l[m.sync]&&l[m.sync],"aria-pressed":!!l[m.sync]&&l[m.sync],onClick:()=>(e=>{const t=[l[m.top],l[m.right],l[m.bottom],l[m.left]].filter((e=>""!==e));if(0===t.length)return void a({[e]:!l[e]});const r=Math.max.apply(null,t).toString();a({[e]:!l[e],[m.top]:r,[m.right]:r,[m.bottom]:r,[m.left]:r})})(m.sync),isSmall:!0},l[m.sync]?un:gn))))}function pn(a){const{dimensions:l,deviceType:r}=a,n=(0,m.applyFilters)("generateblocks.editor.dimensionGroupItems",l,a);return(0,e.createElement)(e.Fragment,null,n.map(((l,n)=>(0,e.createElement)(dn,t({},a,{key:n,device:r,type:l.type,label:l.label,units:l.units,computedStyles:l.computedStyles})))))}function bn(){return(bn=Object.assign||function(e){for(var t=1;t=0||(r[a]=e[a]);return r}function fn(e){var t=(0,y.useRef)(e),a=(0,y.useRef)((function(e){t.current&&t.current(e)}));return t.current=e,a.current}var hn=function(e,t,a){return void 0===t&&(t=0),void 0===a&&(a=1),e>a?a:e0:e.buttons>0)&&r.current?n(vn(r.current,e,o.current)):a(!1)},t=function(){return a(!1)};function a(a){var l=s.current,n=yn(r.current),i=a?n.addEventListener:n.removeEventListener;i(l?"touchmove":"mousemove",e),i(l?"touchend":"mouseup",t)}return[function(e){var t=e.nativeEvent,l=r.current;if(l&&(wn(t),!function(e,t){return t&&!kn(e)}(t,s.current)&&l)){if(kn(t)){s.current=!0;var i=t.changedTouches||[];i.length&&(o.current=i[0].identifier)}l.focus(),n(vn(l,t,o.current)),a(!0)}},function(e){var t=e.which||e.keyCode;t<37||t>40||(e.preventDefault(),i({left:39===t?.05:37===t?-.05:0,top:40===t?.05:38===t?-.05:0}))},a]}),[i,n]),u=c[0],g=c[1],d=c[2];return(0,y.useEffect)((function(){return d}),[d]),v().createElement("div",bn({},l,{onTouchStart:u,onMouseDown:u,className:"react-colorful__interactive",ref:r,onKeyDown:g,tabIndex:0,role:"slider"}))})),Tn=function(e){return e.filter(Boolean).join(" ")},En=function(e){var t=e.color,a=e.left,l=e.top,r=void 0===l?.5:l,n=Tn(["react-colorful__pointer",e.className]);return v().createElement("div",{className:n,style:{top:100*r+"%",left:100*a+"%"}},v().createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},Sn=function(e,t,a){return void 0===t&&(t=0),void 0===a&&(a=Math.pow(10,t)),Math.round(a*e)/a},xn=(Math.PI,function(e){var t=e.s,a=e.v,l=e.a,r=(200-t)*a/100;return{h:Sn(e.h),s:Sn(r>0&&r<200?t*a/100/(r<=100?r:200-r)*100:0),l:Sn(r/2),a:Sn(l,2)}}),Bn=function(e){var t=xn(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},Mn=function(e){var t=xn(e);return"hsla("+t.h+", "+t.s+"%, "+t.l+"%, "+t.a+")"},Dn=function(e){var t=e.h,a=e.s,l=e.v,r=e.a;t=t/360*6,a/=100,l/=100;var n=Math.floor(t),i=l*(1-a),o=l*(1-(t-n)*a),s=l*(1-(1-t+n)*a),c=n%6;return{r:Sn(255*[l,o,i,i,s,l][c]),g:Sn(255*[s,l,l,o,i,i][c]),b:Sn(255*[i,i,s,l,l,o][c]),a:Sn(r,2)}},Rn=function(e){var t=/rgba?\(?\s*(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(e);return t?zn({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:void 0===t[7]?1:Number(t[7])/(t[8]?100:1)}):{h:0,s:0,v:0,a:1}},Ln=Rn,zn=function(e){var t=e.r,a=e.g,l=e.b,r=e.a,n=Math.max(t,a,l),i=n-Math.min(t,a,l),o=i?n===t?(a-l)/i:n===a?2+(l-t)/i:4+(t-a)/i:0;return{h:Sn(60*(o<0?o+6:o)),s:Sn(n?i/n*100:0),v:Sn(n/255*100),a:r}},On=v().memo((function(e){var t=e.hue,a=e.onChange,l=Tn(["react-colorful__hue",e.className]);return v().createElement("div",{className:l},v().createElement(Cn,{onMove:function(e){a({h:360*e.left})},onKey:function(e){a({h:hn(t+360*e.left,0,360)})},"aria-label":"Hue","aria-valuetext":Sn(t)},v().createElement(En,{className:"react-colorful__hue-pointer",left:t/360,color:Bn({h:t,s:100,v:100,a:1})})))})),In=v().memo((function(e){var t=e.hsva,a=e.onChange,l={backgroundColor:Bn({h:t.h,s:100,v:100,a:1})};return v().createElement("div",{className:"react-colorful__saturation",style:l},v().createElement(Cn,{onMove:function(e){a({s:100*e.left,v:100-100*e.top})},onKey:function(e){a({s:hn(t.s+100*e.left,0,100),v:hn(t.v-100*e.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+Sn(t.s)+"%, Brightness "+Sn(t.v)+"%"},v().createElement(En,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:Bn(t)})))})),Nn=function(e,t){return e.replace(/\s/g,"")===t.replace(/\s/g,"")};function An(e,t,a){var l=fn(a),r=(0,y.useState)((function(){return e.toHsva(t)})),n=r[0],i=r[1],o=(0,y.useRef)({color:t,hsva:n});(0,y.useEffect)((function(){if(!e.equal(t,o.current.color)){var a=e.toHsva(t);o.current={hsva:a,color:t},i(a)}}),[t,e]),(0,y.useEffect)((function(){var t;(function(e,t){if(e===t)return!0;for(var a in e)if(e[a]!==t[a])return!1;return!0})(n,o.current.hsva)||e.equal(t=e.fromHsva(n),o.current.color)||(o.current={hsva:n,color:t},l(t))}),[n,e,l]);var s=(0,y.useCallback)((function(e){i((function(t){return Object.assign({},t,e)}))}),[]);return[n,s]}var Fn="undefined"!=typeof window?y.useLayoutEffect:y.useEffect,Pn=new Map,Hn=function(e){Fn((function(){var t=e.current?e.current.ownerDocument:document;if(void 0!==t&&!Pn.has(t)){var l=t.createElement("style");l.innerHTML='.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url(\'data:image/svg+xml;charset=utf-8,\')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}',Pn.set(t,l);var r=a.nc;r&&l.setAttribute("nonce",r),t.head.appendChild(l)}}),[])},Vn=function(e){var t=e.className,a=e.colorModel,l=e.color,r=void 0===l?a.defaultColor:l,n=e.onChange,i=mn(e,["className","colorModel","color","onChange"]),o=(0,y.useRef)(null);Hn(o);var s=An(a,r,n),c=s[0],u=s[1],g=Tn(["react-colorful",t]);return v().createElement("div",bn({},i,{ref:o,className:g}),v().createElement(In,{hsva:c,onChange:u}),v().createElement(On,{hue:c.h,onChange:u,className:"react-colorful__last-control"}))},Un=function(e){var t=e.className,a=e.hsva,l=e.onChange,r={backgroundImage:"linear-gradient(90deg, "+Mn(Object.assign({},a,{a:0}))+", "+Mn(Object.assign({},a,{a:1}))+")"},n=Tn(["react-colorful__alpha",t]);return v().createElement("div",{className:n},v().createElement("div",{className:"react-colorful__alpha-gradient",style:r}),v().createElement(Cn,{onMove:function(e){l({a:e.left})},onKey:function(e){l({a:hn(a.a+e.left)})},"aria-label":"Alpha","aria-valuetext":Sn(100*a.a)+"%"},v().createElement(En,{className:"react-colorful__alpha-pointer",left:a.a,color:Mn(a)})))},Gn=function(e){var t=e.className,a=e.colorModel,l=e.color,r=void 0===l?a.defaultColor:l,n=e.onChange,i=mn(e,["className","colorModel","color","onChange"]),o=(0,y.useRef)(null);Hn(o);var s=An(a,r,n),c=s[0],u=s[1],g=Tn(["react-colorful",t]);return v().createElement("div",bn({},i,{ref:o,className:g}),v().createElement(In,{hsva:c,onChange:u}),v().createElement(On,{hue:c.h,onChange:u}),v().createElement(Un,{hsva:c,onChange:u,className:"react-colorful__last-control"}))},jn={defaultColor:"rgba(0, 0, 0, 1)",toHsva:Rn,fromHsva:function(e){var t=Dn(e);return"rgba("+t.r+", "+t.g+", "+t.b+", "+t.a+")"},equal:Nn},qn=function(e){return v().createElement(Gn,bn({},e,{colorModel:jn}))},Wn={defaultColor:"rgb(0, 0, 0)",toHsva:Ln,fromHsva:function(e){var t=Dn(e);return"rgb("+t.r+", "+t.g+", "+t.b+")"},equal:Nn},$n=function(e){return v().createElement(Vn,bn({},e,{colorModel:Wn}))},Zn={grad:.9,turn:360,rad:360/(2*Math.PI)},Kn=function(e){return"string"==typeof e?e.length>0:"number"==typeof e},Jn=function(e,t,a){return void 0===t&&(t=0),void 0===a&&(a=Math.pow(10,t)),Math.round(a*e)/a+0},Qn=function(e,t,a){return void 0===t&&(t=0),void 0===a&&(a=1),e>a?a:e>t?e:t},Yn=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},Xn=function(e){return{r:Qn(e.r,0,255),g:Qn(e.g,0,255),b:Qn(e.b,0,255),a:Qn(e.a)}},ei=function(e){return{r:Jn(e.r),g:Jn(e.g),b:Jn(e.b),a:Jn(e.a,3)}},ti=/^#([0-9a-f]{3,8})$/i,ai=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},li=function(e){var t=e.r,a=e.g,l=e.b,r=e.a,n=Math.max(t,a,l),i=n-Math.min(t,a,l),o=i?n===t?(a-l)/i:n===a?2+(l-t)/i:4+(t-a)/i:0;return{h:60*(o<0?o+6:o),s:n?i/n*100:0,v:n/255*100,a:r}},ri=function(e){var t=e.h,a=e.s,l=e.v,r=e.a;t=t/360*6,a/=100,l/=100;var n=Math.floor(t),i=l*(1-a),o=l*(1-(t-n)*a),s=l*(1-(1-t+n)*a),c=n%6;return{r:255*[l,o,i,i,s,l][c],g:255*[s,l,l,o,i,i][c],b:255*[i,i,s,l,l,o][c],a:r}},ni=function(e){return{h:Yn(e.h),s:Qn(e.s,0,100),l:Qn(e.l,0,100),a:Qn(e.a)}},ii=function(e){return{h:Jn(e.h),s:Jn(e.s),l:Jn(e.l),a:Jn(e.a,3)}},oi=function(e){return ri((a=(t=e).s,{h:t.h,s:(a*=((l=t.l)<50?l:100-l)/100)>0?2*a/(l+a)*100:0,v:l+a,a:t.a}));var t,a,l},si=function(e){return{h:(t=li(e)).h,s:(r=(200-(a=t.s))*(l=t.v)/100)>0&&r<200?a*l/100/(r<=100?r:200-r)*100:0,l:r/2,a:t.a};var t,a,l,r},ci=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,ui=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,gi=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,di=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,pi={string:[[function(e){var t=ti.exec(e);return t?(e=t[1]).length<=4?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:4===e.length?Jn(parseInt(e[3]+e[3],16)/255,2):1}:6===e.length||8===e.length?{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16),a:8===e.length?Jn(parseInt(e.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(e){var t=gi.exec(e)||di.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:Xn({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:void 0===t[7]?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(e){var t=ci.exec(e)||ui.exec(e);if(!t)return null;var a,l,r=ni({h:(a=t[1],l=t[2],void 0===l&&(l="deg"),Number(a)*(Zn[l]||1)),s:Number(t[3]),l:Number(t[4]),a:void 0===t[5]?1:Number(t[5])/(t[6]?100:1)});return oi(r)},"hsl"]],object:[[function(e){var t=e.r,a=e.g,l=e.b,r=e.a,n=void 0===r?1:r;return Kn(t)&&Kn(a)&&Kn(l)?Xn({r:Number(t),g:Number(a),b:Number(l),a:Number(n)}):null},"rgb"],[function(e){var t=e.h,a=e.s,l=e.l,r=e.a,n=void 0===r?1:r;if(!Kn(t)||!Kn(a)||!Kn(l))return null;var i=ni({h:Number(t),s:Number(a),l:Number(l),a:Number(n)});return oi(i)},"hsl"],[function(e){var t=e.h,a=e.s,l=e.v,r=e.a,n=void 0===r?1:r;if(!Kn(t)||!Kn(a)||!Kn(l))return null;var i=function(e){return{h:Yn(e.h),s:Qn(e.s,0,100),v:Qn(e.v,0,100),a:Qn(e.a)}}({h:Number(t),s:Number(a),v:Number(l),a:Number(n)});return ri(i)},"hsv"]]},bi=function(e,t){for(var a=0;a=.5},e.prototype.toHex=function(){return t=(e=ei(this.rgba)).r,a=e.g,l=e.b,n=(r=e.a)<1?ai(Jn(255*r)):"","#"+ai(t)+ai(a)+ai(l)+n;var e,t,a,l,r,n},e.prototype.toRgb=function(){return ei(this.rgba)},e.prototype.toRgbString=function(){return t=(e=ei(this.rgba)).r,a=e.g,l=e.b,(r=e.a)<1?"rgba("+t+", "+a+", "+l+", "+r+")":"rgb("+t+", "+a+", "+l+")";var e,t,a,l,r},e.prototype.toHsl=function(){return ii(si(this.rgba))},e.prototype.toHslString=function(){return t=(e=ii(si(this.rgba))).h,a=e.s,l=e.l,(r=e.a)<1?"hsla("+t+", "+a+"%, "+l+"%, "+r+")":"hsl("+t+", "+a+"%, "+l+"%)";var e,t,a,l,r},e.prototype.toHsv=function(){return e=li(this.rgba),{h:Jn(e.h),s:Jn(e.s),v:Jn(e.v),a:Jn(e.a,3)};var e},e.prototype.invert=function(){return yi({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},e.prototype.saturate=function(e){return void 0===e&&(e=.1),yi(mi(this.rgba,e))},e.prototype.desaturate=function(e){return void 0===e&&(e=.1),yi(mi(this.rgba,-e))},e.prototype.grayscale=function(){return yi(mi(this.rgba,-1))},e.prototype.lighten=function(e){return void 0===e&&(e=.1),yi(hi(this.rgba,e))},e.prototype.darken=function(e){return void 0===e&&(e=.1),yi(hi(this.rgba,-e))},e.prototype.rotate=function(e){return void 0===e&&(e=15),this.hue(this.hue()+e)},e.prototype.alpha=function(e){return"number"==typeof e?yi({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):Jn(this.rgba.a,3);var t},e.prototype.hue=function(e){var t=si(this.rgba);return"number"==typeof e?yi({h:e,s:t.s,l:t.l,a:t.a}):Jn(t.h)},e.prototype.isEqual=function(e){return this.toHex()===yi(e).toHex()},e}(),yi=function(e){return e instanceof ki?e:new ki(e)};function vi(e,t){return e?(t||0===t)&&1!==t&&e.startsWith("#")?(e=e.replace("#",""),"rgba("+parseInt(3===e.length?e.slice(0,1).repeat(2):e.slice(0,2),16)+", "+parseInt(3===e.length?e.slice(1,2).repeat(2):e.slice(2,4),16)+", "+parseInt(3===e.length?e.slice(2,3).repeat(2):e.slice(4,6),16)+", "+t+")"):e:""}function wi(t){const{value:a,onChange:l,onOpacityChange:o,label:s,alpha:c=!1,valueOpacity:u=1,tooltip:g}=t,[d,b]=(0,e.useState)(a||""),m=(0,e.useRef)(null),f=c&&1===u?qn:$n,h=(0,e.useMemo)((()=>(e=>{if(String(e).startsWith("var(")){const t=e.match(/\(([^)]+)\)/);if(t){const a=getComputedStyle(document.documentElement).getPropertyValue(t[1]);a&&(e=a)}}return yi(e).toRgbString()})(a)),[a]),k=(0,q.useDebounce)(l);return(0,e.useEffect)((()=>{a!==d&&k(d),setTimeout((()=>{m.current&&m.current.focus()}),10)}),[d]),(0,e.createElement)("div",{className:"gblocks-color-component"},!!s&&(0,e.createElement)("span",{className:"gblocks-color-component__label"},s),(0,e.createElement)(n.Dropdown,{className:"gblocks-color-component__toggle",contentClassName:"gblocks-color-component-content",position:"top left",renderToggle:t=>{let{isOpen:l,onToggle:r}=t;const i=(0,e.createElement)(n.Button,{className:"gblocks-color-component__toggle-button",onClick:r,"aria-expanded":l},(0,e.createElement)("span",{className:"gblocks-color-component__toggle-indicator",style:{background:a?vi(a,u):null}}));return(0,e.createElement)(e.Fragment,null,g?(0,e.createElement)(n.Tooltip,{text:g},i):i)},renderContent:()=>(0,e.createElement)(e.Fragment,null,(0,e.createElement)(f,{color:h,onChange:e=>{yi(e).isValid()&&(e=1===yi(e).alpha()?yi(e).toHex():e),b(e)}}),(0,e.createElement)("div",{className:"gblocks-color-component-content__input-wrapper"},(0,e.createElement)(n.TextControl,{ref:m,className:"gblocks-color-input",type:"text",value:d,onChange:e=>{!e.startsWith("#")&&/^([0-9A-F]{3}){1,2}$/i.test(e)&&(e="#"+e),b(e)},onBlur:()=>{yi(a).isValid()&&1===yi(a).alpha()&&b(yi(a).toHex())}}),(0,e.createElement)(n.Button,{isSmall:!0,isSecondary:!0,className:"gblocks-color-input-clear",onClick:()=>{b(""),c&&1!==u&&o(1)}},(0,i.__)("Clear","generateblocks"))),c&&1!==u&&(0,e.createElement)("div",{className:"gblocks-color-component-content__opacity"},(0,e.createElement)(n.Tooltip,{text:(0,i.__)("Opacity","generateblocks")},p("gradient")),(0,e.createElement)(n.RangeControl,{value:u||0,onChange:e=>o(e),min:0,max:1,step:.01,initialPosition:1})),(0,e.createElement)(n.BaseControl,{className:"gblocks-color-component-content__palette"},(0,e.createElement)(r.ColorPalette,{value:a||"",onChange:e=>{b(e)},disableCustomColors:!0,clearable:!1})))}))}function _i(t){const{setAttributes:a,attributes:l,colors:r}=t,n=(0,m.applyFilters)("generateblocks.editor.colorGroupItems",r,t);return(0,e.createElement)("div",{className:"gblocks-color-group"},n.map(((t,r)=>(0,e.createElement)("div",{key:r,className:"gblocks-color-group__row"},!!t.label&&(0,e.createElement)("span",{className:"gblocks-color-group__row-label"},t.label),t.items.map(((t,r)=>(0,e.createElement)(wi,{key:r,label:t?.label,tooltip:t?.tooltip,value:l[t.attribute],alpha:t.alpha||!1,valueOpacity:l[t.attribute+"Opacity"],onChange:e=>a({[t.attribute]:e}),onOpacityChange:e=>a({[t.attribute+"Opacity"]:e})})))))))}class Ci extends e.Component{render(){const{attributes:t,setAttributes:a,attrGradient:l,attrGradientDirection:r,attrGradientColorOne:o,attrGradientColorOneOpacity:s,attrGradientColorStopOne:c,attrGradientColorTwo:u,attrGradientColorTwoOpacity:g,attrGradientColorStopTwo:d,defaultColorOne:p,defaultColorTwo:b}=this.props,{gradientSelector:m,innerZindex:f}=t,h="element"===m?(0,i.__)("Displays behind the background image.","generateblocks"):(0,i.__)("Displays in front of the background image.","generateblocks");return(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.ToggleControl,{label:(0,i.__)("Use Gradient","generateblocks"),checked:!!t[l],onChange:e=>{const l=this.props;let n=t[r],i=t[o],s=t[u];e&&(n=n||90,i=i||"rgba(255, 255, 255, 0.1)",s=s||"rgba(0, 0, 0, 0.30)"),a({[l.attrGradient]:e,[l.attrGradientDirection]:n,[l.attrGradientColorOne]:i,[l.attrGradientColorTwo]:s})}}),!!t[l]&&(0,e.createElement)(e.Fragment,null,void 0!==m&&(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Selector","generateblocks"),help:h,value:m,options:[{label:(0,i.__)("Element","generateblocks"),value:"element"},{label:(0,i.__)("Pseudo Element","generateblocks"),value:"pseudo-element"}],onChange:e=>{a({gradientSelector:e}),x(f)||"pseudo-element"!==e||a({innerZindex:1})}}),(0,e.createElement)(n.BaseControl,null,(0,e.createElement)("span",{className:"components-base-control__label"},(0,i.__)("Direction","generateblocks")),(0,e.createElement)(n.RangeControl,{value:t[r]?t[r]:0,onChange:e=>{a({[r]:e})},min:0,max:360,step:1,initialPosition:90})),(0,e.createElement)(n.BaseControl,null,(0,e.createElement)("span",{className:"components-base-control__label"},(0,i.__)("Color One","generateblocks")),(0,e.createElement)("div",{className:"gblocks-component-gradient-control"},(0,e.createElement)(wi,{value:t[o],alpha:!0,valueOpacity:t[s]||1,attrOpacity:"gradientColorOneOpacity",onChange:e=>a({[o]:e}),onOpacityChange:e=>a({[s]:e}),onClear:()=>a({[o]:p})}),(0,e.createElement)(n.TextControl,{className:"gblocks-component-gradient-stop-value",type:"text",value:t[c]||0===t[c]?t[c]:"",placeholder:(0,i.__)("Stop position (%)","generateblocks"),onChange:e=>{a({[c]:e})},onBlur:()=>{(t[c]||0===t[c])&&a({[c]:parseFloat(t[c])})},onClick:e=>{e.currentTarget.focus()}}))),(0,e.createElement)(n.BaseControl,null,(0,e.createElement)("span",{className:"components-base-control__label"},(0,i.__)("Color Two","generateblocks")),(0,e.createElement)("div",{className:"gblocks-component-gradient-control"},(0,e.createElement)(wi,{value:t[u],alpha:!0,valueOpacity:t[g]||1,attrOpacity:"gradientColorTwoOpacity",onChange:e=>a({[u]:e}),onOpacityChange:e=>a({[g]:e}),onClear:()=>a({[u]:b})}),(0,e.createElement)(n.TextControl,{className:"gblocks-component-gradient-stop-value",type:"text",value:t[d]||0===t[d]?t[d]:"",placeholder:(0,i.__)("Stop position (%)","generateblocks"),onChange:e=>{a({[d]:e})},onBlur:()=>{(t[d]||0===t[d])&&a({[d]:parseFloat(t[d])})},onClick:e=>{e.currentTarget.focus()}})))))}}var Ti=Ci,Ei=a(856),Si=a.n(Ei);function xi(e){return Si().sanitize(e,{USE_PROFILES:{svg:!0,svgFilters:!0}})}const Bi=e=>x(e)&&"auto"!==e;var Mi=a=>{const{clientId:o,attributes:c,setAttributes:u,deviceType:g,state:d,blockDefaults:b,tagNames:f,filterTagName:h,allShapes:k,context:y}=a,{tagName:v,isGrid:w,isQueryLoopItem:_,gridId:T,width:E,widthTablet:M,widthMobile:D,autoWidthTablet:R,autoWidthMobile:L,flexGrow:z,flexGrowTablet:O,flexGrowMobile:I,flexShrink:N,flexShrinkTablet:A,flexShrinkMobile:F,flexBasis:P,flexBasisTablet:H,flexBasisMobile:V,flexBasisUnit:U,outerContainer:G,innerContainer:j,containerWidth:q,minHeight:W,minHeightUnit:$,minHeightTablet:Z,minHeightUnitTablet:K,minHeightMobile:J,minHeightUnitMobile:Q,backgroundColor:Y,bgImage:X,bgOptions:ee,bgImageSize:te,bgImageInline:ae,verticalAlignment:le,verticalAlignmentTablet:re,verticalAlignmentMobile:ne,zindex:ie,innerZindex:oe,removeVerticalGap:se,removeVerticalGapTablet:ce,removeVerticalGapMobile:ue,orderTablet:ge,orderMobile:de,align:pe,shapeDividers:be,useDynamicData:me,dynamicContentType:fe}=c,{getBlockParents:he,getBlocksByClientId:ke}=(0,l.useSelect)((e=>e("core/block-editor")),[]);(0,e.useEffect)((()=>{const e=he(o,!0);if(e.length>0){const t=ke(e);if(t.length>0)if("generateblocks/grid"===t[0].name){const e=t[0].attributes.uniqueId;e!==T&&u({isGrid:!0,gridId:e})}else w&&!_&&u({isGrid:!1,gridId:""})}else w&&!_&&u({isGrid:!1,gridId:""})}));const ye=void 0!==y["generateblocks/queryId"],ve=Bi(P),we="auto"!==H&&(Bi(P)||Bi(H)),_e="auto"!==V&&(Bi(P)||Bi(H)||Bi(V)),Ce=[];return Object.keys(generateBlocksInfo.imageSizes).forEach((e=>{Ce.push({label:generateBlocksInfo.imageSizes[e],value:generateBlocksInfo.imageSizes[e]})})),(0,e.createElement)(r.InspectorControls,null,!w&&(0,e.createElement)(C,t({},a,{title:(0,i.__)("Layout","generateblocks"),initialOpen:!0,icon:p("layout"),className:"gblocks-panel-label",id:"containerLayout",state:d}),"Desktop"===g&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Container","generateblocks"),value:G,options:[{label:(0,i.__)("Full width","generateblocks"),value:"full"},{label:(0,i.__)("Contained width","generateblocks"),value:"contained"}],onChange:e=>{u({outerContainer:e}),"contained"===e&&"full"===pe&&u({align:""})}}),"full"===G&&(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Inner Container","generateblocks"),value:j,options:[{label:(0,i.__)("Full width","generateblocks"),value:"full"},{label:(0,i.__)("Contained width","generateblocks"),value:"contained"}],onChange:e=>{u({innerContainer:e})}}),("contained"===G||"contained"===j)&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(S,{label:"full"===G&&"contained"===j?(0,i.__)("Inner Container Width","generateblocks"):(0,i.__)("Container Width","generateblocks"),value:"px",units:["px"],onClick:()=>!1}),(0,e.createElement)(n.TextControl,{type:"number",className:"gblocks-container-width",value:parseFloat(q)||"",placeholder:b.containerWidth,onChange:e=>{u({containerWidth:""!==e?parseFloat(e):void 0})}})),(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Tag Name","generateblocks"),value:v,options:f,onChange:e=>{u({tagName:h(e)})}}),(0,m.applyFilters)("generateblocks.editor.controls","","containerAfterElementTag",a,d)),(0,m.applyFilters)("generateblocks.editor.controls","","containerLayout",a,d)),w&&(0,e.createElement)(C,t({},a,{title:(0,i.__)("Layout","generateblocks"),initialOpen:!0,icon:p("layout"),className:"gblocks-panel-label",id:"containerGridLayout",state:d}),"Desktop"===g&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.BaseControl,null,(0,e.createElement)(S,{label:(0,i.__)("Container Width","generateblocks"),value:"%",units:["%"],onClick:()=>!1}),!!ve&&(0,e.createElement)("div",{className:"gblocks-small-notice-description"},(0,i.__)('Width disabled as Flex Basis is not "auto".',"generateblocks")),(0,e.createElement)(n.ButtonGroup,{className:"widthButtons"},(0,e.createElement)(n.Button,{isPrimary:25===E,onClick:()=>u({width:25}),disabled:ve},"25"),(0,e.createElement)(n.Button,{isPrimary:33.33===E,onClick:()=>u({width:33.33}),disabled:ve},"33"),(0,e.createElement)(n.Button,{isPrimary:50===E,onClick:()=>u({width:50}),disabled:ve},"50"),(0,e.createElement)(n.Button,{isPrimary:66.66===E,onClick:()=>u({width:66.66}),disabled:ve},"66"),(0,e.createElement)(n.Button,{isPrimary:75===E,onClick:()=>u({width:75}),disabled:ve},"75"),(0,e.createElement)(n.Button,{isPrimary:100===E,onClick:()=>u({width:100}),disabled:ve},"100")),(0,e.createElement)(on,{value:x(E)?E:"",onChange:e=>{String(e).startsWith(0)&&(e=""),u({width:e})},rangeMin:10,rangeMax:100,step:5,initialPosition:b.width,disabled:ve})),(0,e.createElement)(n.BaseControl,{className:"gblocks-flex-controls"},(0,e.createElement)("div",{className:"gblocks-utility-label"},(0,e.createElement)("label",{htmlFor:"gblocks-flex-grow-desktop",className:"components-base-control__label"},(0,i.__)("Flex","generateblocks")),(0,e.createElement)(n.Tooltip,{text:(0,i.__)("Reset","generateblocks"),position:"top"},(0,e.createElement)(n.Button,{className:"gblocks-reset-button",icon:p("reset"),onClick:()=>{u({flexGrow:"",flexShrink:"",flexBasis:""})}}))),(0,e.createElement)("div",{className:"gblocks-flex-controls-inner"},(0,e.createElement)(n.TextControl,{help:(0,i.__)("Grow","generateblocks"),id:"gblocks-flex-grow-desktop",type:"number",value:z,min:"0",step:"1",placeholder:"0",onChange:e=>{u({flexGrow:e})},onBlur:()=>{""!==z&&u({flexGrow:parseFloat(z)})},onClick:e=>{e.currentTarget.focus()}}),(0,e.createElement)(n.TextControl,{help:(0,i.__)("Shrink","generateblocks"),type:"number",value:N,min:"0",step:"1",placeholder:"1",onChange:e=>{u({flexShrink:e})},onBlur:()=>{""!==N&&u({flexShrink:parseFloat(N)})},onClick:e=>{e.currentTarget.focus()}}),(0,e.createElement)("div",{className:"gblocks-flex-basis-wrapper"},!isNaN(P)&&(0,e.createElement)(S,{value:U,units:["px","%"],onClick:e=>{u({flexBasisUnit:e})}}),(0,e.createElement)(n.TextControl,{help:(0,i.__)("Basis","generateblocks"),type:"text",placeholder:"auto",value:P,onChange:e=>{u({flexBasis:e})},onBlur:()=>{P.match(/(auto|fill|max-content|min-content|fit-content|content|inherit|initial|revert|unset|[0-9.]+)/g)||u({flexBasis:""})}})))),(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Vertical Alignment","generateblocks"),help:(0,i.__)("Align grid item content. Does not apply if vertical alignment is set in the grid.","generateblocks"),value:le,options:[{label:(0,i.__)("Default","generateblocks"),value:""},{label:(0,i.__)("Top","generateblocks"),value:"flex-start"},{label:(0,i.__)("Center","generateblocks"),value:"center"},{label:(0,i.__)("Bottom","generateblocks"),value:"flex-end"}],onChange:e=>{u({verticalAlignment:e})}}),!_&&(0,e.createElement)(n.ToggleControl,{label:(0,i.__)("Remove Vertical Gap","generateblocks"),checked:!!se,onChange:e=>{u({removeVerticalGap:e})}}),(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Tag Name","generateblocks"),value:v,options:f,onChange:e=>{u({tagName:h(e)})}}),(0,m.applyFilters)("generateblocks.editor.controls","","containerAfterElementTag",a,d)),"Tablet"===g&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.BaseControl,null,(0,e.createElement)(S,{label:(0,i.__)("Container Width","generateblocks"),value:"%",units:["%"],onClick:()=>!1}),!!we&&(0,e.createElement)("div",{className:"gblocks-small-notice-description"},(0,i.__)('Width disabled as Flex Basis is not "auto".',"generateblocks")),(0,e.createElement)(n.ButtonGroup,{className:"widthButtons"},(0,e.createElement)(n.Button,{isPrimary:!!R,disabled:we,onClick:()=>{u(R?{autoWidthTablet:!1}:{autoWidthTablet:!0})}},(0,i.__)("Auto","generateblocks")),(0,e.createElement)(n.Button,{isPrimary:25===M&&!R,onClick:()=>u({widthTablet:25,autoWidthTablet:!1}),disabled:we},"25"),(0,e.createElement)(n.Button,{isPrimary:33.33===M&&!R,onClick:()=>u({widthTablet:33.33,autoWidthTablet:!1}),disabled:we},"33"),(0,e.createElement)(n.Button,{isPrimary:50===M&&!R,onClick:()=>u({widthTablet:50,autoWidthTablet:!1}),disabled:we},"50"),(0,e.createElement)(n.Button,{isPrimary:66.66===M&&!R,onClick:()=>u({widthTablet:66.66,autoWidthTablet:!1}),disabled:we},"66"),(0,e.createElement)(n.Button,{isPrimary:75===M&&!R,onClick:()=>u({widthTablet:75,autoWidthTablet:!1}),disabled:we},"75"),(0,e.createElement)(n.Button,{isPrimary:100===M&&!R,onClick:()=>u({widthTablet:100,autoWidthTablet:!1}),disabled:we},"100")),!R&&(0,e.createElement)(on,{value:x(M)?M:"",onChange:e=>{String(e).startsWith(0)&&(e=""),u({widthTablet:e,autoWidthTablet:!1})},rangeMin:10,rangeMax:100,step:5,initialPosition:b.widthTablet,disabled:we})),(0,e.createElement)(n.BaseControl,{className:"gblocks-flex-controls"},(0,e.createElement)("div",{className:"gblocks-utility-label"},(0,e.createElement)("label",{htmlFor:"gblocks-flex-grow-tablet",className:"components-base-control__label"},(0,i.__)("Flex","generateblocks")),(0,e.createElement)(n.Tooltip,{text:(0,i.__)("Reset","generateblocks"),position:"top"},(0,e.createElement)(n.Button,{className:"gblocks-reset-button",icon:p("reset"),onClick:()=>{u({flexGrowTablet:"",flexShrinkTablet:"",flexBasisTablet:""})}}))),(0,e.createElement)("div",{className:"gblocks-flex-controls-inner"},(0,e.createElement)(n.TextControl,{help:(0,i.__)("Grow","generateblocks"),id:"gblocks-flex-grow-tablet",type:"number",value:O,min:"0",step:"1",placeholder:B("flexGrow",c,"Tablet","0"),onChange:e=>{u({flexGrowTablet:e})},onBlur:()=>{""!==O&&u({flexGrowTablet:parseFloat(O)})},onClick:e=>{e.currentTarget.focus()}}),(0,e.createElement)(n.TextControl,{help:(0,i.__)("Shrink","generateblocks"),type:"number",value:A,min:"0",step:"1",placeholder:B("flexShrink",c,"Tablet","1"),onChange:e=>{u({flexShrinkTablet:e})},onBlur:()=>{""!==A&&u({flexShrinkTablet:parseFloat(A)})},onClick:e=>{e.currentTarget.focus()}}),(0,e.createElement)("div",{className:"gblocks-flex-basis-wrapper"},!isNaN(H)&&(0,e.createElement)(S,{value:U,units:["px","%"],onClick:e=>{u({flexBasisUnit:e})}}),(0,e.createElement)(n.TextControl,{help:(0,i.__)("Basis","generateblocks"),type:"text",value:H,placeholder:B("flexBasis",c,"Tablet","auto"),onChange:e=>{u({flexBasisTablet:e})},onBlur:()=>{H.match(/(auto|fill|max-content|min-content|fit-content|content|inherit|initial|revert|unset|[0-9.]+)/g)||u({flexBasisTablet:""})}})))),(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Vertical Alignment","generateblocks"),help:(0,i.__)("Align grid item content. Does not apply if vertical alignment is set in the grid.","generateblocks"),value:re,options:[{label:(0,i.__)("Inherit","generateblocks"),value:"inherit"},{label:(0,i.__)("Default","generateblocks"),value:""},{label:(0,i.__)("Top","generateblocks"),value:"flex-start"},{label:(0,i.__)("Center","generateblocks"),value:"center"},{label:(0,i.__)("Bottom","generateblocks"),value:"flex-end"}],onChange:e=>{u({verticalAlignmentTablet:e})}}),!_&&(0,e.createElement)(n.ToggleControl,{label:(0,i.__)("Remove Vertical Gap","generateblocks"),checked:!!ce,onChange:e=>{u({removeVerticalGapTablet:e})}}),(0,e.createElement)(n.TextControl,{type:"number",label:(0,i.__)("Order","generateblocks"),value:ge||0===ge?ge:"",onChange:e=>{u({orderTablet:parseFloat(e)})}})),"Mobile"===g&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.BaseControl,null,(0,e.createElement)(S,{label:(0,i.__)("Container Width","generateblocks"),value:"%",units:["%"],onClick:()=>!1}),!!_e&&(0,e.createElement)("div",{className:"gblocks-small-notice-description"},(0,i.__)('Width disabled as Flex Basis is not "auto".',"generateblocks")),(0,e.createElement)(n.ButtonGroup,{className:"widthButtons"},(0,e.createElement)(n.Button,{isPrimary:!!L,disabled:_e,onClick:()=>{u(L?{autoWidthMobile:!1}:{autoWidthMobile:!0})}},(0,i.__)("Auto","generateblocks")),(0,e.createElement)(n.Button,{isPrimary:25===D&&!L,onClick:()=>u({widthMobile:25,autoWidthMobile:!1}),disabled:_e},"25"),(0,e.createElement)(n.Button,{isPrimary:33.33===D&&!L,onClick:()=>u({widthMobile:33.33,autoWidthMobile:!1}),disabled:_e},"33"),(0,e.createElement)(n.Button,{isPrimary:50===D&&!L,onClick:()=>u({widthMobile:50,autoWidthMobile:!1}),disabled:_e},"50"),(0,e.createElement)(n.Button,{isPrimary:66.66===D&&!L,onClick:()=>u({widthMobile:66.66,autoWidthMobile:!1}),disabled:_e},"66"),(0,e.createElement)(n.Button,{isPrimary:75===D&&!L,onClick:()=>u({widthMobile:75,autoWidthMobile:!1}),disabled:_e},"75"),(0,e.createElement)(n.Button,{isPrimary:100===D&&!L,onClick:()=>u({widthMobile:100,autoWidthMobile:!1}),disabled:_e},"100")),!L&&(0,e.createElement)(on,{value:x(D)?D:"",onChange:e=>{String(e).startsWith(0)&&(e=""),u({widthMobile:e,autoWidthMobile:!1})},rangeMin:10,rangeMax:100,step:5,initialPosition:b.widthMobile,disabled:_e})),(0,e.createElement)(n.BaseControl,{className:"gblocks-flex-controls"},(0,e.createElement)("div",{className:"gblocks-utility-label"},(0,e.createElement)("label",{htmlFor:"gblocks-flex-grow-mobile",className:"components-base-control__label"},(0,i.__)("Flex","generateblocks")),(0,e.createElement)(n.Tooltip,{text:(0,i.__)("Reset","generateblocks"),position:"top"},(0,e.createElement)(n.Button,{className:"gblocks-reset-button",icon:p("reset"),onClick:()=>{u({flexGrowMobile:"",flexShrinkMobile:"",flexBasisMobile:""})}}))),(0,e.createElement)("div",{className:"gblocks-flex-controls-inner"},(0,e.createElement)(n.TextControl,{help:(0,i.__)("Grow","generateblocks"),id:"gblocks-flex-grow-mobile",type:"number",value:I,min:"0",step:"1",placeholder:B("flexGrow",c,"Mobile","0"),onChange:e=>{u({flexGrowMobile:e})},onBlur:()=>{""!==I&&u({flexGrowMobile:parseFloat(I)})},onClick:e=>{e.currentTarget.focus()}}),(0,e.createElement)(n.TextControl,{help:(0,i.__)("Shrink","generateblocks"),type:"number",value:F,min:"0",step:"1",placeholder:B("flexShrink",c,"Mobile","1"),onChange:e=>{u({flexShrinkMobile:e})},onBlur:()=>{""!==F&&u({flexShrinkMobile:parseFloat(F)})},onClick:e=>{e.currentTarget.focus()}}),(0,e.createElement)("div",{className:"gblocks-flex-basis-wrapper"},!isNaN(V)&&(0,e.createElement)(S,{value:U,units:["px","%"],onClick:e=>{u({flexBasisUnit:e})}}),(0,e.createElement)(n.TextControl,{help:(0,i.__)("Basis","generateblocks"),type:"text",value:V,placeholder:B("flexBasis",c,"Mobile","auto"),onChange:e=>{u({flexBasisMobile:e})},onBlur:()=>{V.match(/(auto|fill|max-content|min-content|fit-content|content|inherit|initial|revert|unset|[0-9.]+)/g)||u({flexBasisMobile:""})}})))),(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Vertical Alignment","generateblocks"),help:(0,i.__)("Align grid item content. Does not apply if vertical alignment is set in the grid.","generateblocks"),value:ne,options:[{label:(0,i.__)("Inherit","generateblocks"),value:"inherit"},{label:(0,i.__)("Default","generateblocks"),value:""},{label:(0,i.__)("Top","generateblocks"),value:"flex-start"},{label:(0,i.__)("Center","generateblocks"),value:"center"},{label:(0,i.__)("Bottom","generateblocks"),value:"flex-end"}],onChange:e=>{u({verticalAlignmentMobile:e})}}),!_&&(0,e.createElement)(n.ToggleControl,{label:(0,i.__)("Remove Vertical Gap","generateblocks"),checked:!!ue,onChange:e=>{u({removeVerticalGapMobile:e})}}),(0,e.createElement)(n.TextControl,{type:"number",label:(0,i.__)("Order","generateblocks"),value:de||0===de?de:"",onChange:e=>{u({orderMobile:parseFloat(e)})}})),(0,m.applyFilters)("generateblocks.editor.controls","","containerGridLayout",a,d)),(0,e.createElement)(C,t({},a,{title:(0,i.__)("Typography","generateblocks"),initialOpen:!1,icon:p("typography"),className:"gblocks-panel-label",id:"containerTypography",state:d}),(0,e.createElement)(cn,t({},a,{deviceType:g,options:["fontWeight","textTransform","fontSize","fontFamily"]})),(0,m.applyFilters)("generateblocks.editor.controls","","containerTypography",a,d)),(0,e.createElement)(C,t({},a,{title:(0,i.__)("Spacing","generateblocks"),initialOpen:!1,icon:p("spacing"),className:"gblocks-panel-label",id:"containerSpacing",state:d}),(0,e.createElement)(pn,t({},a,{deviceType:g,dimensions:[{type:"padding",label:(0,i.__)("Padding","generateblocks"),units:["px","em","%"]},{type:"margin",label:(0,i.__)("Margin","generateblocks"),units:["px","em","%"]},{type:"borderSize",label:(0,i.__)("Border Size","generateblocks"),units:["px"]},{type:"borderRadius",label:(0,i.__)("Border Radius","generateblocks"),units:["px","em","%"]}]})),"Desktop"===g&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(S,{label:(0,i.__)("Minimum Height","generateblocks"),value:$,units:["px","vh","vw"],onClick:e=>{u({minHeightUnit:e})}}),(0,e.createElement)(n.TextControl,{type:"number",value:W||"",onChange:e=>{u({minHeight:parseFloat(e)})}}),!!W&&!w&&(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Vertical Alignment","generateblocks"),value:le,options:[{label:(0,i.__)("Default","generateblocks"),value:""},{label:(0,i.__)("Top","generateblocks"),value:"flex-start"},{label:(0,i.__)("Center","generateblocks"),value:"center"},{label:(0,i.__)("Bottom","generateblocks"),value:"flex-end"}],onChange:e=>{u({verticalAlignment:e})}}),(0,e.createElement)(n.TextControl,{label:(0,i.__)("Outer z-index","generateblocks"),type:"number",value:ie||0===ie?ie:"",onChange:e=>{u({zindex:e})},onBlur:()=>{u({zindex:parseFloat(ie)})},onClick:e=>{e.currentTarget.focus()}}),(0,e.createElement)(n.TextControl,{label:(0,i.__)("Inner z-index","generateblocks"),type:"number",value:oe||0===oe?oe:"",onChange:e=>{u({innerZindex:e})},onBlur:()=>{u({innerZindex:parseFloat(oe)})},onClick:e=>{e.currentTarget.focus()}})),"Tablet"===g&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(S,{label:(0,i.__)("Minimum Height","generateblocks"),value:K,units:["px","vh","vw"],onClick:e=>{u({minHeightUnitTablet:e})}}),(0,e.createElement)(n.TextControl,{type:"number",value:Z||0===Z?Z:"",onChange:e=>{u({minHeightTablet:parseFloat(e)})}}),(!!W||!!Z)&&!w&&(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Vertical Alignment","generateblocks"),value:re,options:[{label:(0,i.__)("Inherit","generateblocks"),value:"inherit"},{label:(0,i.__)("Default","generateblocks"),value:""},{label:(0,i.__)("Top","generateblocks"),value:"flex-start"},{label:(0,i.__)("Center","generateblocks"),value:"center"},{label:(0,i.__)("Bottom","generateblocks"),value:"flex-end"}],onChange:e=>{u({verticalAlignmentTablet:e})}})),"Mobile"===g&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(S,{label:(0,i.__)("Minimum Height","generateblocks"),value:Q,units:["px","vh","vw"],onClick:e=>{u({minHeightUnitMobile:e})}}),(0,e.createElement)(n.TextControl,{type:"number",value:J||0===J?J:"",onChange:e=>{u({minHeightMobile:parseFloat(e)})}}),(!!W||!!Z||!!J)&&!w&&(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Vertical Alignment","generateblocks"),value:ne,options:[{label:(0,i.__)("Inherit","generateblocks"),value:"inherit"},{label:(0,i.__)("Default","generateblocks"),value:""},{label:(0,i.__)("Top","generateblocks"),value:"flex-start"},{label:(0,i.__)("Center","generateblocks"),value:"center"},{label:(0,i.__)("Bottom","generateblocks"),value:"flex-end"}],onChange:e=>{u({verticalAlignmentMobile:e})}})),(0,m.applyFilters)("generateblocks.editor.controls","","containerSpacing",a,d)),(0,e.createElement)(C,t({},a,{title:(0,i.__)("Colors","generateblocks"),initialOpen:!1,icon:p("colors"),className:"gblocks-panel-label",id:"containerColors",state:d}),"Desktop"===g&&(0,e.createElement)(_i,t({},a,{colors:[{group:"background",label:(0,i.__)("Background","generateblocks"),items:[{attribute:"backgroundColor",alpha:!0}]},{group:"text",label:(0,i.__)("Text","generateblocks"),items:[{attribute:"textColor"}]},{group:"link",label:(0,i.__)("Link","generateblocks"),items:[{attribute:"linkColor"},{tooltip:(0,i.__)("Hover","generateblocks"),attribute:"linkColorHover"}]},{group:"border",label:(0,i.__)("Border","generateblocks"),items:[{attribute:"borderColor",alpha:!0}]}]})),(0,m.applyFilters)("generateblocks.editor.controls","","containerColors",a,d)),(0,e.createElement)(C,t({},a,{title:(0,i.__)("Backgrounds","generateblocks"),initialOpen:!1,icon:p("gradients"),className:"gblocks-panel-label",id:"containerBackground",state:d}),(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.BaseControl,{id:"gblocks-background-image-upload",label:(0,i.__)("Image URL","generateblocks")},(0,e.createElement)("div",{className:"gblocks-bg-image-wrapper"},(0,e.createElement)(n.TextControl,{type:"text",value:X?X.image.url:"",onChange:e=>{u(e?{bgImage:{id:"",image:{url:e}}}:{bgImage:null})}}),(0,e.createElement)("div",{className:"gblocks-background-image-action-buttons"},(0,e.createElement)(r.MediaUpload,{title:(0,i.__)("Set background image","generateblocks"),onSelect:e=>{let t=b.bgImageSize;void 0===e.sizes[t]&&(t="full"),u({bgImage:{id:e.id,image:e.sizes[t]}})},onClose:()=>{document.querySelector(".gblocks-bg-image-wrapper input").focus()},allowedTypes:["image"],value:X?X.id:"",modalClass:"editor-gb-container-background__media-modal",render:t=>{let{open:a}=t;return(0,e.createElement)(n.Tooltip,{text:(0,i.__)("Open the Media Library","generateblocks")},(0,e.createElement)(n.Button,{onClick:a,className:"is-secondary is-small"},(0,i.__)("Browse","generateblocks")))}}),(0,m.applyFilters)("generateblocks.editor.backgroundImageActions","",a,d)))),me&&""!==fe&&(0,e.createElement)(n.Notice,{className:"gblocks-option-notice",status:"info",isDismissible:!1},(0,i.__)("Using featured image as dynamic background.","generateblocks")),(!!X||me&&""!==fe)&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.ToggleControl,{label:(0,i.__)("Use inline style","generateblocks"),disabled:me&&""!==fe&&(_||ye),checked:!!ae,onChange:e=>{u({bgImageInline:e})}}),ee.overlay?(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.ToggleControl,{label:(0,i.__)("Background Color Overlay","generateblocks"),checked:!!ee.overlay,onChange:e=>{u({bgOptions:{...ee,overlay:e}})}}),(0,e.createElement)(n.Notice,{className:"gblocks-option-notice",status:"info",isDismissible:!1},(0,i.__)("The background color overlay option is deprecated. Toggle this option to use the new method.","generateblocks"))):(0,e.createElement)(e.Fragment,null,(X&&X.id||me&&""!==fe)&&(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Image Size","generateblocks"),value:te,options:Ce,onChange:e=>{u({bgImageSize:e})}}),(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Selector","generateblocks"),value:ee.selector,options:[{label:(0,i.__)("Element","generateblocks"),value:"element"},{label:(0,i.__)("Pseudo Element","generateblocks"),value:"pseudo-element"}],onChange:e=>{u({bgOptions:{...ee,selector:e}}),"pseudo-element"!==e||oe||0===oe||u({innerZindex:1})}}),(0,e.createElement)(n.RangeControl,{label:(0,i.__)("Image Opacity","generateblocks"),value:ee.opacity,onChange:e=>{u({bgOptions:{...ee,opacity:e,selector:"pseudo-element"}}),oe||0===oe||u({innerZindex:1})},min:0,max:1,step:.01,initialPosition:b.bgOptions.opacity}),1!==ee.opacity&&"pseudo-element"!==ee.selector&&(0,e.createElement)(n.Notice,{className:"gblocks-option-notice",status:"info",isDismissible:!1},(0,i.__)("Your selector must be set to Pseudo Element to use opacity.","generateblocks"))),(0,e.createElement)(n.TextControl,{label:(0,i.__)("Size","generateblocks"),value:ee.size,onChange:e=>{u({bgOptions:{...ee,size:e}})}}),(0,e.createElement)(n.TextControl,{label:(0,i.__)("Position","generateblocks"),value:ee.position,onChange:e=>{u({bgOptions:{...ee,position:e}})}}),(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Repeat","generateblocks"),value:ee.repeat,options:[{label:"no-repeat",value:"no-repeat"},{label:"repeat",value:"repeat"},{label:"repeat-x",value:"repeat-x"},{label:"repeat-y",value:"repeat-y"}],onChange:e=>{u({bgOptions:{...ee,repeat:e}})}}),(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Attachment","generateblocks"),value:ee.attachment,options:[{label:"scroll",value:""},{label:"fixed",value:"fixed"},{label:"local",value:"local"}],onChange:e=>{u({bgOptions:{...ee,attachment:e}})}})),(0,e.createElement)(Ti,t({},a,{attrGradient:"gradient",attrGradientDirection:"gradientDirection",attrGradientColorOne:"gradientColorOne",attrGradientColorStopOne:"gradientColorStopOne",attrGradientColorTwo:"gradientColorTwo",attrGradientColorStopTwo:"gradientColorStopTwo",attrGradientColorOneOpacity:"gradientColorOneOpacity",attrGradientColorTwoOpacity:"gradientColorTwoOpacity",defaultColorOne:b.gradientColorOne,defaultColorTwo:b.gradientColorTwo})),(0,m.applyFilters)("generateblocks.editor.controls","","containerBackground",a,d))),(0,e.createElement)(C,t({},a,{title:(0,i.__)("Shapes","generateblocks"),initialOpen:!1,icon:p("shapes"),className:"gblocks-panel-label",id:"containerShapes",state:d,showPanel:!("Desktop"!==g&&!c.shapeDividers.length)}),(0,e.createElement)(n.BaseControl,{className:"gb-icon-chooser gb-shape-chooser"},be.map(((t,a)=>{const l=a+1;return(0,e.createElement)(e.Fragment,{key:a},(0,e.createElement)("div",{className:"gblocks-shape-container"},(0,e.createElement)("div",{className:s()({"gblocks-shape-toggle-preview":!0,[`gblocks-shape-toggle-preview-${l}`]:!0}),style:{backgroundColor:Y}},void 0!==k[be[a].shape]&&(0,e.createElement)("div",{className:"gblocks-shape-divider-preview",style:{color:be[a].color},dangerouslySetInnerHTML:{__html:xi(k[be[a].shape].icon)}})), +/* translators: Dimension label (padding, margin, border) */,"aria-label":(0,i.sprintf)((0,i.__)("%s Left","generateblocks"),r),value:l[m.left]||"",min:"margin"!==o?0:void 0}),(0,e.createElement)("label",{htmlFor:m.left,className:"gblocks-dimensions-control__label"},f.left)),(0,e.createElement)(n.Tooltip,{text:l[m.sync]?(0,i.__)("Unlink Sides","generateblocks"):(0,i.__)("Link Sides","generateblocks")},(0,e.createElement)(n.Button,{className:"components-gblocks-dimensions-control_sync","aria-label":l[m.sync]?(0,i.__)("Unlink Sides","generateblocks"):(0,i.__)("Link Sides","generateblocks"),isPrimary:!!l[m.sync]&&l[m.sync],"aria-pressed":!!l[m.sync]&&l[m.sync],onClick:()=>(e=>{const t=[l[m.top],l[m.right],l[m.bottom],l[m.left]].filter((e=>""!==e));if(0===t.length)return void a({[e]:!l[e]});const r=Math.max.apply(null,t).toString();a({[e]:!l[e],[m.top]:r,[m.right]:r,[m.bottom]:r,[m.left]:r})})(m.sync),isSmall:!0},l[m.sync]?un:gn))))}function pn(a){const{dimensions:l,deviceType:r}=a,n=(0,m.applyFilters)("generateblocks.editor.dimensionGroupItems",l,a);return(0,e.createElement)(e.Fragment,null,n.map(((l,n)=>(0,e.createElement)(dn,t({},a,{key:n,device:r,type:l.type,label:l.label,units:l.units,computedStyles:l.computedStyles})))))}function bn(){return(bn=Object.assign||function(e){for(var t=1;t=0||(r[a]=e[a]);return r}function fn(e){var t=(0,y.useRef)(e),a=(0,y.useRef)((function(e){t.current&&t.current(e)}));return t.current=e,a.current}var hn=function(e,t,a){return void 0===t&&(t=0),void 0===a&&(a=1),e>a?a:e0:e.buttons>0)&&r.current?n(vn(r.current,e,o.current)):a(!1)},t=function(){return a(!1)};function a(a){var l=s.current,n=yn(r.current),i=a?n.addEventListener:n.removeEventListener;i(l?"touchmove":"mousemove",e),i(l?"touchend":"mouseup",t)}return[function(e){var t=e.nativeEvent,l=r.current;if(l&&(wn(t),!function(e,t){return t&&!kn(e)}(t,s.current)&&l)){if(kn(t)){s.current=!0;var i=t.changedTouches||[];i.length&&(o.current=i[0].identifier)}l.focus(),n(vn(l,t,o.current)),a(!0)}},function(e){var t=e.which||e.keyCode;t<37||t>40||(e.preventDefault(),i({left:39===t?.05:37===t?-.05:0,top:40===t?.05:38===t?-.05:0}))},a]}),[i,n]),u=c[0],g=c[1],d=c[2];return(0,y.useEffect)((function(){return d}),[d]),v().createElement("div",bn({},l,{onTouchStart:u,onMouseDown:u,className:"react-colorful__interactive",ref:r,onKeyDown:g,tabIndex:0,role:"slider"}))})),Tn=function(e){return e.filter(Boolean).join(" ")},En=function(e){var t=e.color,a=e.left,l=e.top,r=void 0===l?.5:l,n=Tn(["react-colorful__pointer",e.className]);return v().createElement("div",{className:n,style:{top:100*r+"%",left:100*a+"%"}},v().createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},Sn=function(e,t,a){return void 0===t&&(t=0),void 0===a&&(a=Math.pow(10,t)),Math.round(a*e)/a},xn=(Math.PI,function(e){var t=e.s,a=e.v,l=e.a,r=(200-t)*a/100;return{h:Sn(e.h),s:Sn(r>0&&r<200?t*a/100/(r<=100?r:200-r)*100:0),l:Sn(r/2),a:Sn(l,2)}}),Bn=function(e){var t=xn(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},Mn=function(e){var t=xn(e);return"hsla("+t.h+", "+t.s+"%, "+t.l+"%, "+t.a+")"},Dn=function(e){var t=e.h,a=e.s,l=e.v,r=e.a;t=t/360*6,a/=100,l/=100;var n=Math.floor(t),i=l*(1-a),o=l*(1-(t-n)*a),s=l*(1-(1-t+n)*a),c=n%6;return{r:Sn(255*[l,o,i,i,s,l][c]),g:Sn(255*[s,l,l,o,i,i][c]),b:Sn(255*[i,i,s,l,l,o][c]),a:Sn(r,2)}},Rn=function(e){var t=/rgba?\(?\s*(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(e);return t?zn({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:void 0===t[7]?1:Number(t[7])/(t[8]?100:1)}):{h:0,s:0,v:0,a:1}},Ln=Rn,zn=function(e){var t=e.r,a=e.g,l=e.b,r=e.a,n=Math.max(t,a,l),i=n-Math.min(t,a,l),o=i?n===t?(a-l)/i:n===a?2+(l-t)/i:4+(t-a)/i:0;return{h:Sn(60*(o<0?o+6:o)),s:Sn(n?i/n*100:0),v:Sn(n/255*100),a:r}},On=v().memo((function(e){var t=e.hue,a=e.onChange,l=Tn(["react-colorful__hue",e.className]);return v().createElement("div",{className:l},v().createElement(Cn,{onMove:function(e){a({h:360*e.left})},onKey:function(e){a({h:hn(t+360*e.left,0,360)})},"aria-label":"Hue","aria-valuetext":Sn(t)},v().createElement(En,{className:"react-colorful__hue-pointer",left:t/360,color:Bn({h:t,s:100,v:100,a:1})})))})),In=v().memo((function(e){var t=e.hsva,a=e.onChange,l={backgroundColor:Bn({h:t.h,s:100,v:100,a:1})};return v().createElement("div",{className:"react-colorful__saturation",style:l},v().createElement(Cn,{onMove:function(e){a({s:100*e.left,v:100-100*e.top})},onKey:function(e){a({s:hn(t.s+100*e.left,0,100),v:hn(t.v-100*e.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+Sn(t.s)+"%, Brightness "+Sn(t.v)+"%"},v().createElement(En,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:Bn(t)})))})),Nn=function(e,t){return e.replace(/\s/g,"")===t.replace(/\s/g,"")};function An(e,t,a){var l=fn(a),r=(0,y.useState)((function(){return e.toHsva(t)})),n=r[0],i=r[1],o=(0,y.useRef)({color:t,hsva:n});(0,y.useEffect)((function(){if(!e.equal(t,o.current.color)){var a=e.toHsva(t);o.current={hsva:a,color:t},i(a)}}),[t,e]),(0,y.useEffect)((function(){var t;(function(e,t){if(e===t)return!0;for(var a in e)if(e[a]!==t[a])return!1;return!0})(n,o.current.hsva)||e.equal(t=e.fromHsva(n),o.current.color)||(o.current={hsva:n,color:t},l(t))}),[n,e,l]);var s=(0,y.useCallback)((function(e){i((function(t){return Object.assign({},t,e)}))}),[]);return[n,s]}var Fn="undefined"!=typeof window?y.useLayoutEffect:y.useEffect,Pn=new Map,Hn=function(e){Fn((function(){var t=e.current?e.current.ownerDocument:document;if(void 0!==t&&!Pn.has(t)){var l=t.createElement("style");l.innerHTML='.react-colorful{position:relative;display:flex;flex-direction:column;width:200px;height:200px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:default}.react-colorful__saturation{position:relative;flex-grow:1;border-color:transparent;border-bottom:12px solid #000;border-radius:8px 8px 0 0;background-image:linear-gradient(0deg,#000,transparent),linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.react-colorful__alpha-gradient,.react-colorful__pointer-fill{content:"";position:absolute;left:0;top:0;right:0;bottom:0;pointer-events:none;border-radius:inherit}.react-colorful__alpha-gradient,.react-colorful__saturation{box-shadow:inset 0 0 0 1px rgba(0,0,0,.05)}.react-colorful__alpha,.react-colorful__hue{position:relative;height:24px}.react-colorful__hue{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.react-colorful__last-control{border-radius:0 0 8px 8px}.react-colorful__interactive{position:absolute;left:0;top:0;right:0;bottom:0;border-radius:inherit;outline:none;touch-action:none}.react-colorful__pointer{position:absolute;z-index:1;box-sizing:border-box;width:28px;height:28px;transform:translate(-50%,-50%);background-color:#fff;border:2px solid #fff;border-radius:50%;box-shadow:0 2px 4px rgba(0,0,0,.2)}.react-colorful__interactive:focus .react-colorful__pointer{transform:translate(-50%,-50%) scale(1.1)}.react-colorful__alpha,.react-colorful__alpha-pointer{background-color:#fff;background-image:url(\'data:image/svg+xml;charset=utf-8,\')}.react-colorful__saturation-pointer{z-index:3}.react-colorful__hue-pointer{z-index:2}',Pn.set(t,l);var r=a.nc;r&&l.setAttribute("nonce",r),t.head.appendChild(l)}}),[])},Vn=function(e){var t=e.className,a=e.colorModel,l=e.color,r=void 0===l?a.defaultColor:l,n=e.onChange,i=mn(e,["className","colorModel","color","onChange"]),o=(0,y.useRef)(null);Hn(o);var s=An(a,r,n),c=s[0],u=s[1],g=Tn(["react-colorful",t]);return v().createElement("div",bn({},i,{ref:o,className:g}),v().createElement(In,{hsva:c,onChange:u}),v().createElement(On,{hue:c.h,onChange:u,className:"react-colorful__last-control"}))},Un=function(e){var t=e.className,a=e.hsva,l=e.onChange,r={backgroundImage:"linear-gradient(90deg, "+Mn(Object.assign({},a,{a:0}))+", "+Mn(Object.assign({},a,{a:1}))+")"},n=Tn(["react-colorful__alpha",t]);return v().createElement("div",{className:n},v().createElement("div",{className:"react-colorful__alpha-gradient",style:r}),v().createElement(Cn,{onMove:function(e){l({a:e.left})},onKey:function(e){l({a:hn(a.a+e.left)})},"aria-label":"Alpha","aria-valuetext":Sn(100*a.a)+"%"},v().createElement(En,{className:"react-colorful__alpha-pointer",left:a.a,color:Mn(a)})))},Gn=function(e){var t=e.className,a=e.colorModel,l=e.color,r=void 0===l?a.defaultColor:l,n=e.onChange,i=mn(e,["className","colorModel","color","onChange"]),o=(0,y.useRef)(null);Hn(o);var s=An(a,r,n),c=s[0],u=s[1],g=Tn(["react-colorful",t]);return v().createElement("div",bn({},i,{ref:o,className:g}),v().createElement(In,{hsva:c,onChange:u}),v().createElement(On,{hue:c.h,onChange:u}),v().createElement(Un,{hsva:c,onChange:u,className:"react-colorful__last-control"}))},jn={defaultColor:"rgba(0, 0, 0, 1)",toHsva:Rn,fromHsva:function(e){var t=Dn(e);return"rgba("+t.r+", "+t.g+", "+t.b+", "+t.a+")"},equal:Nn},qn=function(e){return v().createElement(Gn,bn({},e,{colorModel:jn}))},Wn={defaultColor:"rgb(0, 0, 0)",toHsva:Ln,fromHsva:function(e){var t=Dn(e);return"rgb("+t.r+", "+t.g+", "+t.b+")"},equal:Nn},$n=function(e){return v().createElement(Vn,bn({},e,{colorModel:Wn}))},Zn={grad:.9,turn:360,rad:360/(2*Math.PI)},Kn=function(e){return"string"==typeof e?e.length>0:"number"==typeof e},Jn=function(e,t,a){return void 0===t&&(t=0),void 0===a&&(a=Math.pow(10,t)),Math.round(a*e)/a+0},Qn=function(e,t,a){return void 0===t&&(t=0),void 0===a&&(a=1),e>a?a:e>t?e:t},Yn=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},Xn=function(e){return{r:Qn(e.r,0,255),g:Qn(e.g,0,255),b:Qn(e.b,0,255),a:Qn(e.a)}},ei=function(e){return{r:Jn(e.r),g:Jn(e.g),b:Jn(e.b),a:Jn(e.a,3)}},ti=/^#([0-9a-f]{3,8})$/i,ai=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},li=function(e){var t=e.r,a=e.g,l=e.b,r=e.a,n=Math.max(t,a,l),i=n-Math.min(t,a,l),o=i?n===t?(a-l)/i:n===a?2+(l-t)/i:4+(t-a)/i:0;return{h:60*(o<0?o+6:o),s:n?i/n*100:0,v:n/255*100,a:r}},ri=function(e){var t=e.h,a=e.s,l=e.v,r=e.a;t=t/360*6,a/=100,l/=100;var n=Math.floor(t),i=l*(1-a),o=l*(1-(t-n)*a),s=l*(1-(1-t+n)*a),c=n%6;return{r:255*[l,o,i,i,s,l][c],g:255*[s,l,l,o,i,i][c],b:255*[i,i,s,l,l,o][c],a:r}},ni=function(e){return{h:Yn(e.h),s:Qn(e.s,0,100),l:Qn(e.l,0,100),a:Qn(e.a)}},ii=function(e){return{h:Jn(e.h),s:Jn(e.s),l:Jn(e.l),a:Jn(e.a,3)}},oi=function(e){return ri((a=(t=e).s,{h:t.h,s:(a*=((l=t.l)<50?l:100-l)/100)>0?2*a/(l+a)*100:0,v:l+a,a:t.a}));var t,a,l},si=function(e){return{h:(t=li(e)).h,s:(r=(200-(a=t.s))*(l=t.v)/100)>0&&r<200?a*l/100/(r<=100?r:200-r)*100:0,l:r/2,a:t.a};var t,a,l,r},ci=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,ui=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,gi=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,di=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,pi={string:[[function(e){var t=ti.exec(e);return t?(e=t[1]).length<=4?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:4===e.length?Jn(parseInt(e[3]+e[3],16)/255,2):1}:6===e.length||8===e.length?{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16),a:8===e.length?Jn(parseInt(e.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(e){var t=gi.exec(e)||di.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:Xn({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:void 0===t[7]?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(e){var t=ci.exec(e)||ui.exec(e);if(!t)return null;var a,l,r=ni({h:(a=t[1],l=t[2],void 0===l&&(l="deg"),Number(a)*(Zn[l]||1)),s:Number(t[3]),l:Number(t[4]),a:void 0===t[5]?1:Number(t[5])/(t[6]?100:1)});return oi(r)},"hsl"]],object:[[function(e){var t=e.r,a=e.g,l=e.b,r=e.a,n=void 0===r?1:r;return Kn(t)&&Kn(a)&&Kn(l)?Xn({r:Number(t),g:Number(a),b:Number(l),a:Number(n)}):null},"rgb"],[function(e){var t=e.h,a=e.s,l=e.l,r=e.a,n=void 0===r?1:r;if(!Kn(t)||!Kn(a)||!Kn(l))return null;var i=ni({h:Number(t),s:Number(a),l:Number(l),a:Number(n)});return oi(i)},"hsl"],[function(e){var t=e.h,a=e.s,l=e.v,r=e.a,n=void 0===r?1:r;if(!Kn(t)||!Kn(a)||!Kn(l))return null;var i=function(e){return{h:Yn(e.h),s:Qn(e.s,0,100),v:Qn(e.v,0,100),a:Qn(e.a)}}({h:Number(t),s:Number(a),v:Number(l),a:Number(n)});return ri(i)},"hsv"]]},bi=function(e,t){for(var a=0;a=.5},e.prototype.toHex=function(){return t=(e=ei(this.rgba)).r,a=e.g,l=e.b,n=(r=e.a)<1?ai(Jn(255*r)):"","#"+ai(t)+ai(a)+ai(l)+n;var e,t,a,l,r,n},e.prototype.toRgb=function(){return ei(this.rgba)},e.prototype.toRgbString=function(){return t=(e=ei(this.rgba)).r,a=e.g,l=e.b,(r=e.a)<1?"rgba("+t+", "+a+", "+l+", "+r+")":"rgb("+t+", "+a+", "+l+")";var e,t,a,l,r},e.prototype.toHsl=function(){return ii(si(this.rgba))},e.prototype.toHslString=function(){return t=(e=ii(si(this.rgba))).h,a=e.s,l=e.l,(r=e.a)<1?"hsla("+t+", "+a+"%, "+l+"%, "+r+")":"hsl("+t+", "+a+"%, "+l+"%)";var e,t,a,l,r},e.prototype.toHsv=function(){return e=li(this.rgba),{h:Jn(e.h),s:Jn(e.s),v:Jn(e.v),a:Jn(e.a,3)};var e},e.prototype.invert=function(){return yi({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},e.prototype.saturate=function(e){return void 0===e&&(e=.1),yi(mi(this.rgba,e))},e.prototype.desaturate=function(e){return void 0===e&&(e=.1),yi(mi(this.rgba,-e))},e.prototype.grayscale=function(){return yi(mi(this.rgba,-1))},e.prototype.lighten=function(e){return void 0===e&&(e=.1),yi(hi(this.rgba,e))},e.prototype.darken=function(e){return void 0===e&&(e=.1),yi(hi(this.rgba,-e))},e.prototype.rotate=function(e){return void 0===e&&(e=15),this.hue(this.hue()+e)},e.prototype.alpha=function(e){return"number"==typeof e?yi({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):Jn(this.rgba.a,3);var t},e.prototype.hue=function(e){var t=si(this.rgba);return"number"==typeof e?yi({h:e,s:t.s,l:t.l,a:t.a}):Jn(t.h)},e.prototype.isEqual=function(e){return this.toHex()===yi(e).toHex()},e}(),yi=function(e){return e instanceof ki?e:new ki(e)};function vi(e,t){return e?(t||0===t)&&1!==t&&e.startsWith("#")?(e=e.replace("#",""),"rgba("+parseInt(3===e.length?e.slice(0,1).repeat(2):e.slice(0,2),16)+", "+parseInt(3===e.length?e.slice(1,2).repeat(2):e.slice(2,4),16)+", "+parseInt(3===e.length?e.slice(2,3).repeat(2):e.slice(4,6),16)+", "+t+")"):e:""}function wi(t){const{value:a,onChange:l,onOpacityChange:o,label:s,alpha:c=!1,valueOpacity:u=1,tooltip:g}=t,[d,b]=(0,e.useState)(a||""),m=(0,e.useRef)(null),f=c&&1===u?qn:$n,h=(0,e.useMemo)((()=>(e=>{if(String(e).startsWith("var(")){const t=e.match(/\(([^)]+)\)/);if(t){const a=getComputedStyle(document.documentElement).getPropertyValue(t[1]);a&&(e=a)}}return yi(e).toRgbString()})(a)),[a]),k=(0,q.useDebounce)(l);return(0,e.useEffect)((()=>{a!==d&&k(d),setTimeout((()=>{m.current&&m.current.focus()}),10)}),[d]),(0,e.createElement)("div",{className:"gblocks-color-component"},!!s&&(0,e.createElement)("span",{className:"gblocks-color-component__label"},s),(0,e.createElement)(n.Dropdown,{className:"gblocks-color-component__toggle",contentClassName:"gblocks-color-component-content",position:"top left",renderToggle:t=>{let{isOpen:l,onToggle:r}=t;const i=(0,e.createElement)(n.Button,{className:"gblocks-color-component__toggle-button",onClick:r,"aria-expanded":l},(0,e.createElement)("span",{className:"gblocks-color-component__toggle-indicator",style:{background:a?vi(a,u):null}}));return(0,e.createElement)(e.Fragment,null,g?(0,e.createElement)(n.Tooltip,{text:g},i):i)},renderContent:()=>(0,e.createElement)(e.Fragment,null,(0,e.createElement)(f,{color:h,onChange:e=>{yi(e).isValid()&&(e=1===yi(e).alpha()?yi(e).toHex():e),b(e)}}),(0,e.createElement)("div",{className:"gblocks-color-component-content__input-wrapper"},(0,e.createElement)(n.TextControl,{ref:m,className:"gblocks-color-input",type:"text",value:d,onChange:e=>{!e.startsWith("#")&&/^([0-9A-F]{3}){1,2}$/i.test(e)&&(e="#"+e),b(e)},onBlur:()=>{yi(a).isValid()&&1===yi(a).alpha()&&b(yi(a).toHex())}}),(0,e.createElement)(n.Button,{isSmall:!0,isSecondary:!0,className:"gblocks-color-input-clear",onClick:()=>{b(""),c&&1!==u&&o(1)}},(0,i.__)("Clear","generateblocks"))),c&&1!==u&&(0,e.createElement)("div",{className:"gblocks-color-component-content__opacity"},(0,e.createElement)(n.Tooltip,{text:(0,i.__)("Opacity","generateblocks")},p("gradient")),(0,e.createElement)(n.RangeControl,{value:u||0,onChange:e=>o(e),min:0,max:1,step:.01,initialPosition:1})),(0,e.createElement)(n.BaseControl,{className:"gblocks-color-component-content__palette"},(0,e.createElement)(r.ColorPalette,{value:a||"",onChange:e=>{b(e)},disableCustomColors:!0,clearable:!1})))}))}function _i(t){const{setAttributes:a,attributes:l,colors:r}=t,n=(0,m.applyFilters)("generateblocks.editor.colorGroupItems",r,t);return(0,e.createElement)("div",{className:"gblocks-color-group"},n.map(((t,r)=>(0,e.createElement)("div",{key:r,className:"gblocks-color-group__row"},!!t.label&&(0,e.createElement)("span",{className:"gblocks-color-group__row-label"},t.label),t.items.map(((t,r)=>(0,e.createElement)(wi,{key:r,label:t?.label,tooltip:t?.tooltip,value:l[t.attribute],alpha:t.alpha||!1,valueOpacity:l[t.attribute+"Opacity"],onChange:e=>a({[t.attribute]:e}),onOpacityChange:e=>a({[t.attribute+"Opacity"]:e})})))))))}class Ci extends e.Component{render(){const{attributes:t,setAttributes:a,attrGradient:l,attrGradientDirection:r,attrGradientColorOne:o,attrGradientColorOneOpacity:s,attrGradientColorStopOne:c,attrGradientColorTwo:u,attrGradientColorTwoOpacity:g,attrGradientColorStopTwo:d,defaultColorOne:p,defaultColorTwo:b}=this.props,{gradientSelector:m,innerZindex:f}=t,h="element"===m?(0,i.__)("Displays behind the background image.","generateblocks"):(0,i.__)("Displays in front of the background image.","generateblocks");return(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.ToggleControl,{label:(0,i.__)("Use Gradient","generateblocks"),checked:!!t[l],onChange:e=>{const l=this.props;let n=t[r],i=t[o],s=t[u];e&&(n=n||90,i=i||"rgba(255, 255, 255, 0.1)",s=s||"rgba(0, 0, 0, 0.30)"),a({[l.attrGradient]:e,[l.attrGradientDirection]:n,[l.attrGradientColorOne]:i,[l.attrGradientColorTwo]:s})}}),!!t[l]&&(0,e.createElement)(e.Fragment,null,void 0!==m&&(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Selector","generateblocks"),help:h,value:m,options:[{label:(0,i.__)("Element","generateblocks"),value:"element"},{label:(0,i.__)("Pseudo Element","generateblocks"),value:"pseudo-element"}],onChange:e=>{a({gradientSelector:e}),x(f)||"pseudo-element"!==e||a({innerZindex:1})}}),(0,e.createElement)(n.BaseControl,null,(0,e.createElement)("span",{className:"components-base-control__label"},(0,i.__)("Direction","generateblocks")),(0,e.createElement)(n.RangeControl,{value:t[r]?t[r]:0,onChange:e=>{a({[r]:e})},min:0,max:360,step:1,initialPosition:90})),(0,e.createElement)(n.BaseControl,null,(0,e.createElement)("span",{className:"components-base-control__label"},(0,i.__)("Color One","generateblocks")),(0,e.createElement)("div",{className:"gblocks-component-gradient-control"},(0,e.createElement)(wi,{value:t[o],alpha:!0,valueOpacity:t[s]||0===t[s]?t[s]:1,attrOpacity:"gradientColorOneOpacity",onChange:e=>a({[o]:e}),onOpacityChange:e=>a({[s]:e}),onClear:()=>a({[o]:p})}),(0,e.createElement)(n.TextControl,{className:"gblocks-component-gradient-stop-value",type:"text",value:t[c]||0===t[c]?t[c]:"",placeholder:(0,i.__)("Stop position (%)","generateblocks"),onChange:e=>{a({[c]:e})},onBlur:()=>{(t[c]||0===t[c])&&a({[c]:parseFloat(t[c])})},onClick:e=>{e.currentTarget.focus()}}))),(0,e.createElement)(n.BaseControl,null,(0,e.createElement)("span",{className:"components-base-control__label"},(0,i.__)("Color Two","generateblocks")),(0,e.createElement)("div",{className:"gblocks-component-gradient-control"},(0,e.createElement)(wi,{value:t[u],alpha:!0,valueOpacity:t[g]||0===t[g]?t[g]:1,attrOpacity:"gradientColorTwoOpacity",onChange:e=>a({[u]:e}),onOpacityChange:e=>a({[g]:e}),onClear:()=>a({[u]:b})}),(0,e.createElement)(n.TextControl,{className:"gblocks-component-gradient-stop-value",type:"text",value:t[d]||0===t[d]?t[d]:"",placeholder:(0,i.__)("Stop position (%)","generateblocks"),onChange:e=>{a({[d]:e})},onBlur:()=>{(t[d]||0===t[d])&&a({[d]:parseFloat(t[d])})},onClick:e=>{e.currentTarget.focus()}})))))}}var Ti=Ci,Ei=a(856),Si=a.n(Ei);function xi(e){return Si().sanitize(e,{USE_PROFILES:{svg:!0,svgFilters:!0}})}const Bi=e=>x(e)&&"auto"!==e;var Mi=a=>{const{clientId:o,attributes:c,setAttributes:u,deviceType:g,state:d,blockDefaults:b,tagNames:f,filterTagName:h,allShapes:k,context:y}=a,{tagName:v,isGrid:w,isQueryLoopItem:_,gridId:T,width:E,widthTablet:M,widthMobile:D,autoWidthTablet:R,autoWidthMobile:L,flexGrow:z,flexGrowTablet:O,flexGrowMobile:I,flexShrink:N,flexShrinkTablet:A,flexShrinkMobile:F,flexBasis:P,flexBasisTablet:H,flexBasisMobile:V,flexBasisUnit:U,outerContainer:G,innerContainer:j,containerWidth:q,minHeight:W,minHeightUnit:$,minHeightTablet:Z,minHeightUnitTablet:K,minHeightMobile:J,minHeightUnitMobile:Q,backgroundColor:Y,bgImage:X,bgOptions:ee,bgImageSize:te,bgImageInline:ae,verticalAlignment:le,verticalAlignmentTablet:re,verticalAlignmentMobile:ne,zindex:ie,innerZindex:oe,removeVerticalGap:se,removeVerticalGapTablet:ce,removeVerticalGapMobile:ue,orderTablet:ge,orderMobile:de,align:pe,shapeDividers:be,useDynamicData:me,dynamicContentType:fe}=c,{getBlockParents:he,getBlocksByClientId:ke}=(0,l.useSelect)((e=>e("core/block-editor")),[]);(0,e.useEffect)((()=>{const e=he(o,!0);if(e.length>0){const t=ke(e);if(t.length>0)if("generateblocks/grid"===t[0].name){const e=t[0].attributes.uniqueId;e!==T&&u({isGrid:!0,gridId:e})}else w&&!_&&u({isGrid:!1,gridId:""})}else w&&!_&&u({isGrid:!1,gridId:""})}));const ye=void 0!==y["generateblocks/queryId"],ve=Bi(P),we="auto"!==H&&(Bi(P)||Bi(H)),_e="auto"!==V&&(Bi(P)||Bi(H)||Bi(V)),Ce=[];return Object.keys(generateBlocksInfo.imageSizes).forEach((e=>{Ce.push({label:generateBlocksInfo.imageSizes[e],value:generateBlocksInfo.imageSizes[e]})})),(0,e.createElement)(r.InspectorControls,null,!w&&(0,e.createElement)(C,t({},a,{title:(0,i.__)("Layout","generateblocks"),initialOpen:!0,icon:p("layout"),className:"gblocks-panel-label",id:"containerLayout",state:d}),"Desktop"===g&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Container","generateblocks"),value:G,options:[{label:(0,i.__)("Full width","generateblocks"),value:"full"},{label:(0,i.__)("Contained width","generateblocks"),value:"contained"}],onChange:e=>{u({outerContainer:e}),"contained"===e&&"full"===pe&&u({align:""})}}),"full"===G&&(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Inner Container","generateblocks"),value:j,options:[{label:(0,i.__)("Full width","generateblocks"),value:"full"},{label:(0,i.__)("Contained width","generateblocks"),value:"contained"}],onChange:e=>{u({innerContainer:e})}}),("contained"===G||"contained"===j)&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(S,{label:"full"===G&&"contained"===j?(0,i.__)("Inner Container Width","generateblocks"):(0,i.__)("Container Width","generateblocks"),value:"px",units:["px"],onClick:()=>!1}),(0,e.createElement)(n.TextControl,{type:"number",className:"gblocks-container-width",value:parseFloat(q)||"",placeholder:b.containerWidth,onChange:e=>{u({containerWidth:""!==e?parseFloat(e):void 0})}})),(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Tag Name","generateblocks"),value:v,options:f,onChange:e=>{u({tagName:h(e)})}}),(0,m.applyFilters)("generateblocks.editor.controls","","containerAfterElementTag",a,d)),(0,m.applyFilters)("generateblocks.editor.controls","","containerLayout",a,d)),w&&(0,e.createElement)(C,t({},a,{title:(0,i.__)("Layout","generateblocks"),initialOpen:!0,icon:p("layout"),className:"gblocks-panel-label",id:"containerGridLayout",state:d}),"Desktop"===g&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.BaseControl,null,(0,e.createElement)(S,{label:(0,i.__)("Container Width","generateblocks"),value:"%",units:["%"],onClick:()=>!1}),!!ve&&(0,e.createElement)("div",{className:"gblocks-small-notice-description"},(0,i.__)('Width disabled as Flex Basis is not "auto".',"generateblocks")),(0,e.createElement)(n.ButtonGroup,{className:"widthButtons"},(0,e.createElement)(n.Button,{isPrimary:25===E,onClick:()=>u({width:25}),disabled:ve},"25"),(0,e.createElement)(n.Button,{isPrimary:33.33===E,onClick:()=>u({width:33.33}),disabled:ve},"33"),(0,e.createElement)(n.Button,{isPrimary:50===E,onClick:()=>u({width:50}),disabled:ve},"50"),(0,e.createElement)(n.Button,{isPrimary:66.66===E,onClick:()=>u({width:66.66}),disabled:ve},"66"),(0,e.createElement)(n.Button,{isPrimary:75===E,onClick:()=>u({width:75}),disabled:ve},"75"),(0,e.createElement)(n.Button,{isPrimary:100===E,onClick:()=>u({width:100}),disabled:ve},"100")),(0,e.createElement)(on,{value:x(E)?E:"",onChange:e=>{String(e).startsWith(0)&&(e=""),u({width:e})},rangeMin:10,rangeMax:100,step:5,initialPosition:b.width,disabled:ve})),(0,e.createElement)(n.BaseControl,{className:"gblocks-flex-controls"},(0,e.createElement)("div",{className:"gblocks-utility-label"},(0,e.createElement)("label",{htmlFor:"gblocks-flex-grow-desktop",className:"components-base-control__label"},(0,i.__)("Flex","generateblocks")),(0,e.createElement)(n.Tooltip,{text:(0,i.__)("Reset","generateblocks"),position:"top"},(0,e.createElement)(n.Button,{className:"gblocks-reset-button",icon:p("reset"),onClick:()=>{u({flexGrow:"",flexShrink:"",flexBasis:""})}}))),(0,e.createElement)("div",{className:"gblocks-flex-controls-inner"},(0,e.createElement)(n.TextControl,{help:(0,i.__)("Grow","generateblocks"),id:"gblocks-flex-grow-desktop",type:"number",value:z,min:"0",step:"1",placeholder:"0",onChange:e=>{u({flexGrow:e})},onBlur:()=>{""!==z&&u({flexGrow:parseFloat(z)})},onClick:e=>{e.currentTarget.focus()}}),(0,e.createElement)(n.TextControl,{help:(0,i.__)("Shrink","generateblocks"),type:"number",value:N,min:"0",step:"1",placeholder:"1",onChange:e=>{u({flexShrink:e})},onBlur:()=>{""!==N&&u({flexShrink:parseFloat(N)})},onClick:e=>{e.currentTarget.focus()}}),(0,e.createElement)("div",{className:"gblocks-flex-basis-wrapper"},!isNaN(P)&&(0,e.createElement)(S,{value:U,units:["px","%"],onClick:e=>{u({flexBasisUnit:e})}}),(0,e.createElement)(n.TextControl,{help:(0,i.__)("Basis","generateblocks"),type:"text",placeholder:"auto",value:P,onChange:e=>{u({flexBasis:e})},onBlur:()=>{P.match(/(auto|fill|max-content|min-content|fit-content|content|inherit|initial|revert|unset|[0-9.]+)/g)||u({flexBasis:""})}})))),(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Vertical Alignment","generateblocks"),help:(0,i.__)("Align grid item content. Does not apply if vertical alignment is set in the grid.","generateblocks"),value:le,options:[{label:(0,i.__)("Default","generateblocks"),value:""},{label:(0,i.__)("Top","generateblocks"),value:"flex-start"},{label:(0,i.__)("Center","generateblocks"),value:"center"},{label:(0,i.__)("Bottom","generateblocks"),value:"flex-end"}],onChange:e=>{u({verticalAlignment:e})}}),!_&&(0,e.createElement)(n.ToggleControl,{label:(0,i.__)("Remove Vertical Gap","generateblocks"),checked:!!se,onChange:e=>{u({removeVerticalGap:e})}}),(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Tag Name","generateblocks"),value:v,options:f,onChange:e=>{u({tagName:h(e)})}}),(0,m.applyFilters)("generateblocks.editor.controls","","containerAfterElementTag",a,d)),"Tablet"===g&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.BaseControl,null,(0,e.createElement)(S,{label:(0,i.__)("Container Width","generateblocks"),value:"%",units:["%"],onClick:()=>!1}),!!we&&(0,e.createElement)("div",{className:"gblocks-small-notice-description"},(0,i.__)('Width disabled as Flex Basis is not "auto".',"generateblocks")),(0,e.createElement)(n.ButtonGroup,{className:"widthButtons"},(0,e.createElement)(n.Button,{isPrimary:!!R,disabled:we,onClick:()=>{u(R?{autoWidthTablet:!1}:{autoWidthTablet:!0})}},(0,i.__)("Auto","generateblocks")),(0,e.createElement)(n.Button,{isPrimary:25===M&&!R,onClick:()=>u({widthTablet:25,autoWidthTablet:!1}),disabled:we},"25"),(0,e.createElement)(n.Button,{isPrimary:33.33===M&&!R,onClick:()=>u({widthTablet:33.33,autoWidthTablet:!1}),disabled:we},"33"),(0,e.createElement)(n.Button,{isPrimary:50===M&&!R,onClick:()=>u({widthTablet:50,autoWidthTablet:!1}),disabled:we},"50"),(0,e.createElement)(n.Button,{isPrimary:66.66===M&&!R,onClick:()=>u({widthTablet:66.66,autoWidthTablet:!1}),disabled:we},"66"),(0,e.createElement)(n.Button,{isPrimary:75===M&&!R,onClick:()=>u({widthTablet:75,autoWidthTablet:!1}),disabled:we},"75"),(0,e.createElement)(n.Button,{isPrimary:100===M&&!R,onClick:()=>u({widthTablet:100,autoWidthTablet:!1}),disabled:we},"100")),!R&&(0,e.createElement)(on,{value:x(M)?M:"",onChange:e=>{String(e).startsWith(0)&&(e=""),u({widthTablet:e,autoWidthTablet:!1})},rangeMin:10,rangeMax:100,step:5,initialPosition:b.widthTablet,disabled:we})),(0,e.createElement)(n.BaseControl,{className:"gblocks-flex-controls"},(0,e.createElement)("div",{className:"gblocks-utility-label"},(0,e.createElement)("label",{htmlFor:"gblocks-flex-grow-tablet",className:"components-base-control__label"},(0,i.__)("Flex","generateblocks")),(0,e.createElement)(n.Tooltip,{text:(0,i.__)("Reset","generateblocks"),position:"top"},(0,e.createElement)(n.Button,{className:"gblocks-reset-button",icon:p("reset"),onClick:()=>{u({flexGrowTablet:"",flexShrinkTablet:"",flexBasisTablet:""})}}))),(0,e.createElement)("div",{className:"gblocks-flex-controls-inner"},(0,e.createElement)(n.TextControl,{help:(0,i.__)("Grow","generateblocks"),id:"gblocks-flex-grow-tablet",type:"number",value:O,min:"0",step:"1",placeholder:B("flexGrow",c,"Tablet","0"),onChange:e=>{u({flexGrowTablet:e})},onBlur:()=>{""!==O&&u({flexGrowTablet:parseFloat(O)})},onClick:e=>{e.currentTarget.focus()}}),(0,e.createElement)(n.TextControl,{help:(0,i.__)("Shrink","generateblocks"),type:"number",value:A,min:"0",step:"1",placeholder:B("flexShrink",c,"Tablet","1"),onChange:e=>{u({flexShrinkTablet:e})},onBlur:()=>{""!==A&&u({flexShrinkTablet:parseFloat(A)})},onClick:e=>{e.currentTarget.focus()}}),(0,e.createElement)("div",{className:"gblocks-flex-basis-wrapper"},!isNaN(H)&&(0,e.createElement)(S,{value:U,units:["px","%"],onClick:e=>{u({flexBasisUnit:e})}}),(0,e.createElement)(n.TextControl,{help:(0,i.__)("Basis","generateblocks"),type:"text",value:H,placeholder:B("flexBasis",c,"Tablet","auto"),onChange:e=>{u({flexBasisTablet:e})},onBlur:()=>{H.match(/(auto|fill|max-content|min-content|fit-content|content|inherit|initial|revert|unset|[0-9.]+)/g)||u({flexBasisTablet:""})}})))),(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Vertical Alignment","generateblocks"),help:(0,i.__)("Align grid item content. Does not apply if vertical alignment is set in the grid.","generateblocks"),value:re,options:[{label:(0,i.__)("Inherit","generateblocks"),value:"inherit"},{label:(0,i.__)("Default","generateblocks"),value:""},{label:(0,i.__)("Top","generateblocks"),value:"flex-start"},{label:(0,i.__)("Center","generateblocks"),value:"center"},{label:(0,i.__)("Bottom","generateblocks"),value:"flex-end"}],onChange:e=>{u({verticalAlignmentTablet:e})}}),!_&&(0,e.createElement)(n.ToggleControl,{label:(0,i.__)("Remove Vertical Gap","generateblocks"),checked:!!ce,onChange:e=>{u({removeVerticalGapTablet:e})}}),(0,e.createElement)(n.TextControl,{type:"number",label:(0,i.__)("Order","generateblocks"),value:ge||0===ge?ge:"",onChange:e=>{u({orderTablet:parseFloat(e)})}})),"Mobile"===g&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.BaseControl,null,(0,e.createElement)(S,{label:(0,i.__)("Container Width","generateblocks"),value:"%",units:["%"],onClick:()=>!1}),!!_e&&(0,e.createElement)("div",{className:"gblocks-small-notice-description"},(0,i.__)('Width disabled as Flex Basis is not "auto".',"generateblocks")),(0,e.createElement)(n.ButtonGroup,{className:"widthButtons"},(0,e.createElement)(n.Button,{isPrimary:!!L,disabled:_e,onClick:()=>{u(L?{autoWidthMobile:!1}:{autoWidthMobile:!0})}},(0,i.__)("Auto","generateblocks")),(0,e.createElement)(n.Button,{isPrimary:25===D&&!L,onClick:()=>u({widthMobile:25,autoWidthMobile:!1}),disabled:_e},"25"),(0,e.createElement)(n.Button,{isPrimary:33.33===D&&!L,onClick:()=>u({widthMobile:33.33,autoWidthMobile:!1}),disabled:_e},"33"),(0,e.createElement)(n.Button,{isPrimary:50===D&&!L,onClick:()=>u({widthMobile:50,autoWidthMobile:!1}),disabled:_e},"50"),(0,e.createElement)(n.Button,{isPrimary:66.66===D&&!L,onClick:()=>u({widthMobile:66.66,autoWidthMobile:!1}),disabled:_e},"66"),(0,e.createElement)(n.Button,{isPrimary:75===D&&!L,onClick:()=>u({widthMobile:75,autoWidthMobile:!1}),disabled:_e},"75"),(0,e.createElement)(n.Button,{isPrimary:100===D&&!L,onClick:()=>u({widthMobile:100,autoWidthMobile:!1}),disabled:_e},"100")),!L&&(0,e.createElement)(on,{value:x(D)?D:"",onChange:e=>{String(e).startsWith(0)&&(e=""),u({widthMobile:e,autoWidthMobile:!1})},rangeMin:10,rangeMax:100,step:5,initialPosition:b.widthMobile,disabled:_e})),(0,e.createElement)(n.BaseControl,{className:"gblocks-flex-controls"},(0,e.createElement)("div",{className:"gblocks-utility-label"},(0,e.createElement)("label",{htmlFor:"gblocks-flex-grow-mobile",className:"components-base-control__label"},(0,i.__)("Flex","generateblocks")),(0,e.createElement)(n.Tooltip,{text:(0,i.__)("Reset","generateblocks"),position:"top"},(0,e.createElement)(n.Button,{className:"gblocks-reset-button",icon:p("reset"),onClick:()=>{u({flexGrowMobile:"",flexShrinkMobile:"",flexBasisMobile:""})}}))),(0,e.createElement)("div",{className:"gblocks-flex-controls-inner"},(0,e.createElement)(n.TextControl,{help:(0,i.__)("Grow","generateblocks"),id:"gblocks-flex-grow-mobile",type:"number",value:I,min:"0",step:"1",placeholder:B("flexGrow",c,"Mobile","0"),onChange:e=>{u({flexGrowMobile:e})},onBlur:()=>{""!==I&&u({flexGrowMobile:parseFloat(I)})},onClick:e=>{e.currentTarget.focus()}}),(0,e.createElement)(n.TextControl,{help:(0,i.__)("Shrink","generateblocks"),type:"number",value:F,min:"0",step:"1",placeholder:B("flexShrink",c,"Mobile","1"),onChange:e=>{u({flexShrinkMobile:e})},onBlur:()=>{""!==F&&u({flexShrinkMobile:parseFloat(F)})},onClick:e=>{e.currentTarget.focus()}}),(0,e.createElement)("div",{className:"gblocks-flex-basis-wrapper"},!isNaN(V)&&(0,e.createElement)(S,{value:U,units:["px","%"],onClick:e=>{u({flexBasisUnit:e})}}),(0,e.createElement)(n.TextControl,{help:(0,i.__)("Basis","generateblocks"),type:"text",value:V,placeholder:B("flexBasis",c,"Mobile","auto"),onChange:e=>{u({flexBasisMobile:e})},onBlur:()=>{V.match(/(auto|fill|max-content|min-content|fit-content|content|inherit|initial|revert|unset|[0-9.]+)/g)||u({flexBasisMobile:""})}})))),(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Vertical Alignment","generateblocks"),help:(0,i.__)("Align grid item content. Does not apply if vertical alignment is set in the grid.","generateblocks"),value:ne,options:[{label:(0,i.__)("Inherit","generateblocks"),value:"inherit"},{label:(0,i.__)("Default","generateblocks"),value:""},{label:(0,i.__)("Top","generateblocks"),value:"flex-start"},{label:(0,i.__)("Center","generateblocks"),value:"center"},{label:(0,i.__)("Bottom","generateblocks"),value:"flex-end"}],onChange:e=>{u({verticalAlignmentMobile:e})}}),!_&&(0,e.createElement)(n.ToggleControl,{label:(0,i.__)("Remove Vertical Gap","generateblocks"),checked:!!ue,onChange:e=>{u({removeVerticalGapMobile:e})}}),(0,e.createElement)(n.TextControl,{type:"number",label:(0,i.__)("Order","generateblocks"),value:de||0===de?de:"",onChange:e=>{u({orderMobile:parseFloat(e)})}})),(0,m.applyFilters)("generateblocks.editor.controls","","containerGridLayout",a,d)),(0,e.createElement)(C,t({},a,{title:(0,i.__)("Typography","generateblocks"),initialOpen:!1,icon:p("typography"),className:"gblocks-panel-label",id:"containerTypography",state:d}),(0,e.createElement)(cn,t({},a,{deviceType:g,options:["fontWeight","textTransform","fontSize","fontFamily"]})),(0,m.applyFilters)("generateblocks.editor.controls","","containerTypography",a,d)),(0,e.createElement)(C,t({},a,{title:(0,i.__)("Spacing","generateblocks"),initialOpen:!1,icon:p("spacing"),className:"gblocks-panel-label",id:"containerSpacing",state:d}),(0,e.createElement)(pn,t({},a,{deviceType:g,dimensions:[{type:"padding",label:(0,i.__)("Padding","generateblocks"),units:["px","em","%"]},{type:"margin",label:(0,i.__)("Margin","generateblocks"),units:["px","em","%"]},{type:"borderSize",label:(0,i.__)("Border Size","generateblocks"),units:["px"]},{type:"borderRadius",label:(0,i.__)("Border Radius","generateblocks"),units:["px","em","%"]}]})),"Desktop"===g&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(S,{label:(0,i.__)("Minimum Height","generateblocks"),value:$,units:["px","vh","vw"],onClick:e=>{u({minHeightUnit:e})}}),(0,e.createElement)(n.TextControl,{type:"number",value:W||"",onChange:e=>{u({minHeight:parseFloat(e)})}}),!!W&&!w&&(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Vertical Alignment","generateblocks"),value:le,options:[{label:(0,i.__)("Default","generateblocks"),value:""},{label:(0,i.__)("Top","generateblocks"),value:"flex-start"},{label:(0,i.__)("Center","generateblocks"),value:"center"},{label:(0,i.__)("Bottom","generateblocks"),value:"flex-end"}],onChange:e=>{u({verticalAlignment:e})}}),(0,e.createElement)(n.TextControl,{label:(0,i.__)("Outer z-index","generateblocks"),type:"number",value:ie||0===ie?ie:"",onChange:e=>{u({zindex:e})},onBlur:()=>{u({zindex:parseFloat(ie)})},onClick:e=>{e.currentTarget.focus()}}),(0,e.createElement)(n.TextControl,{label:(0,i.__)("Inner z-index","generateblocks"),type:"number",value:oe||0===oe?oe:"",onChange:e=>{u({innerZindex:e})},onBlur:()=>{u({innerZindex:parseFloat(oe)})},onClick:e=>{e.currentTarget.focus()}})),"Tablet"===g&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(S,{label:(0,i.__)("Minimum Height","generateblocks"),value:K,units:["px","vh","vw"],onClick:e=>{u({minHeightUnitTablet:e})}}),(0,e.createElement)(n.TextControl,{type:"number",value:Z||0===Z?Z:"",onChange:e=>{u({minHeightTablet:parseFloat(e)})}}),(!!W||!!Z)&&!w&&(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Vertical Alignment","generateblocks"),value:re,options:[{label:(0,i.__)("Inherit","generateblocks"),value:"inherit"},{label:(0,i.__)("Default","generateblocks"),value:""},{label:(0,i.__)("Top","generateblocks"),value:"flex-start"},{label:(0,i.__)("Center","generateblocks"),value:"center"},{label:(0,i.__)("Bottom","generateblocks"),value:"flex-end"}],onChange:e=>{u({verticalAlignmentTablet:e})}})),"Mobile"===g&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(S,{label:(0,i.__)("Minimum Height","generateblocks"),value:Q,units:["px","vh","vw"],onClick:e=>{u({minHeightUnitMobile:e})}}),(0,e.createElement)(n.TextControl,{type:"number",value:J||0===J?J:"",onChange:e=>{u({minHeightMobile:parseFloat(e)})}}),(!!W||!!Z||!!J)&&!w&&(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Vertical Alignment","generateblocks"),value:ne,options:[{label:(0,i.__)("Inherit","generateblocks"),value:"inherit"},{label:(0,i.__)("Default","generateblocks"),value:""},{label:(0,i.__)("Top","generateblocks"),value:"flex-start"},{label:(0,i.__)("Center","generateblocks"),value:"center"},{label:(0,i.__)("Bottom","generateblocks"),value:"flex-end"}],onChange:e=>{u({verticalAlignmentMobile:e})}})),(0,m.applyFilters)("generateblocks.editor.controls","","containerSpacing",a,d)),(0,e.createElement)(C,t({},a,{title:(0,i.__)("Colors","generateblocks"),initialOpen:!1,icon:p("colors"),className:"gblocks-panel-label",id:"containerColors",state:d}),"Desktop"===g&&(0,e.createElement)(_i,t({},a,{colors:[{group:"background",label:(0,i.__)("Background","generateblocks"),items:[{attribute:"backgroundColor",alpha:!0}]},{group:"text",label:(0,i.__)("Text","generateblocks"),items:[{attribute:"textColor"}]},{group:"link",label:(0,i.__)("Link","generateblocks"),items:[{attribute:"linkColor"},{tooltip:(0,i.__)("Hover","generateblocks"),attribute:"linkColorHover"}]},{group:"border",label:(0,i.__)("Border","generateblocks"),items:[{attribute:"borderColor",alpha:!0}]}]})),(0,m.applyFilters)("generateblocks.editor.controls","","containerColors",a,d)),(0,e.createElement)(C,t({},a,{title:(0,i.__)("Backgrounds","generateblocks"),initialOpen:!1,icon:p("gradients"),className:"gblocks-panel-label",id:"containerBackground",state:d}),(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.BaseControl,{id:"gblocks-background-image-upload",label:(0,i.__)("Image URL","generateblocks")},(0,e.createElement)("div",{className:"gblocks-bg-image-wrapper"},(0,e.createElement)(n.TextControl,{type:"text",value:X?X.image.url:"",onChange:e=>{u(e?{bgImage:{id:"",image:{url:e}}}:{bgImage:null})}}),(0,e.createElement)("div",{className:"gblocks-background-image-action-buttons"},(0,e.createElement)(r.MediaUpload,{title:(0,i.__)("Set background image","generateblocks"),onSelect:e=>{let t=b.bgImageSize;void 0===e.sizes[t]&&(t="full"),u({bgImage:{id:e.id,image:e.sizes[t]}})},onClose:()=>{document.querySelector(".gblocks-bg-image-wrapper input").focus()},allowedTypes:["image"],value:X?X.id:"",modalClass:"editor-gb-container-background__media-modal",render:t=>{let{open:a}=t;return(0,e.createElement)(n.Tooltip,{text:(0,i.__)("Open the Media Library","generateblocks")},(0,e.createElement)(n.Button,{onClick:a,className:"is-secondary is-small"},(0,i.__)("Browse","generateblocks")))}}),(0,m.applyFilters)("generateblocks.editor.backgroundImageActions","",a,d)))),me&&""!==fe&&(0,e.createElement)(n.Notice,{className:"gblocks-option-notice",status:"info",isDismissible:!1},(0,i.__)("Using featured image as dynamic background.","generateblocks")),(!!X||me&&""!==fe)&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.ToggleControl,{label:(0,i.__)("Use inline style","generateblocks"),disabled:me&&""!==fe&&(_||ye),checked:!!ae,onChange:e=>{u({bgImageInline:e})}}),ee.overlay?(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.ToggleControl,{label:(0,i.__)("Background Color Overlay","generateblocks"),checked:!!ee.overlay,onChange:e=>{u({bgOptions:{...ee,overlay:e}})}}),(0,e.createElement)(n.Notice,{className:"gblocks-option-notice",status:"info",isDismissible:!1},(0,i.__)("The background color overlay option is deprecated. Toggle this option to use the new method.","generateblocks"))):(0,e.createElement)(e.Fragment,null,(X&&X.id||me&&""!==fe)&&(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Image Size","generateblocks"),value:te,options:Ce,onChange:e=>{u({bgImageSize:e})}}),(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Selector","generateblocks"),value:ee.selector,options:[{label:(0,i.__)("Element","generateblocks"),value:"element"},{label:(0,i.__)("Pseudo Element","generateblocks"),value:"pseudo-element"}],onChange:e=>{u({bgOptions:{...ee,selector:e}}),"pseudo-element"!==e||oe||0===oe||u({innerZindex:1})}}),(0,e.createElement)(n.RangeControl,{label:(0,i.__)("Image Opacity","generateblocks"),value:ee.opacity,onChange:e=>{u({bgOptions:{...ee,opacity:e,selector:"pseudo-element"}}),oe||0===oe||u({innerZindex:1})},min:0,max:1,step:.01,initialPosition:b.bgOptions.opacity}),1!==ee.opacity&&"pseudo-element"!==ee.selector&&(0,e.createElement)(n.Notice,{className:"gblocks-option-notice",status:"info",isDismissible:!1},(0,i.__)("Your selector must be set to Pseudo Element to use opacity.","generateblocks"))),(0,e.createElement)(n.TextControl,{label:(0,i.__)("Size","generateblocks"),value:ee.size,onChange:e=>{u({bgOptions:{...ee,size:e}})}}),(0,e.createElement)(n.TextControl,{label:(0,i.__)("Position","generateblocks"),value:ee.position,onChange:e=>{u({bgOptions:{...ee,position:e}})}}),(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Repeat","generateblocks"),value:ee.repeat,options:[{label:"no-repeat",value:"no-repeat"},{label:"repeat",value:"repeat"},{label:"repeat-x",value:"repeat-x"},{label:"repeat-y",value:"repeat-y"}],onChange:e=>{u({bgOptions:{...ee,repeat:e}})}}),(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Attachment","generateblocks"),value:ee.attachment,options:[{label:"scroll",value:""},{label:"fixed",value:"fixed"},{label:"local",value:"local"}],onChange:e=>{u({bgOptions:{...ee,attachment:e}})}})),(0,e.createElement)(Ti,t({},a,{attrGradient:"gradient",attrGradientDirection:"gradientDirection",attrGradientColorOne:"gradientColorOne",attrGradientColorStopOne:"gradientColorStopOne",attrGradientColorTwo:"gradientColorTwo",attrGradientColorStopTwo:"gradientColorStopTwo",attrGradientColorOneOpacity:"gradientColorOneOpacity",attrGradientColorTwoOpacity:"gradientColorTwoOpacity",defaultColorOne:b.gradientColorOne,defaultColorTwo:b.gradientColorTwo})),(0,m.applyFilters)("generateblocks.editor.controls","","containerBackground",a,d))),(0,e.createElement)(C,t({},a,{title:(0,i.__)("Shapes","generateblocks"),initialOpen:!1,icon:p("shapes"),className:"gblocks-panel-label",id:"containerShapes",state:d,showPanel:!("Desktop"!==g&&!c.shapeDividers.length)}),(0,e.createElement)(n.BaseControl,{className:"gb-icon-chooser gb-shape-chooser"},be.map(((t,a)=>{const l=a+1;return(0,e.createElement)(e.Fragment,{key:a},(0,e.createElement)("div",{className:"gblocks-shape-container"},(0,e.createElement)("div",{className:s()({"gblocks-shape-toggle-preview":!0,[`gblocks-shape-toggle-preview-${l}`]:!0}),style:{backgroundColor:Y}},void 0!==k[be[a].shape]&&(0,e.createElement)("div",{className:"gblocks-shape-divider-preview",style:{color:be[a].color},dangerouslySetInnerHTML:{__html:xi(k[be[a].shape].icon)}})), /* translators: Shape number */ (0,i.sprintf)((0,i.__)("Shape %s","generateblocks"),l),(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.Dropdown,{contentClassName:"gblocks-shapes-dropdown",renderToggle:t=>{let{isOpen:a,onToggle:l}=t;return(0,e.createElement)(n.Tooltip,{text:(0,i.__)("Edit Shape","generateblocks")},(0,e.createElement)(n.Button,{className:"gblocks-shape-dropdown",isSecondary:!a||void 0,isPrimary:!!a||void 0,icon:p("wrench"),onClick:l,"aria-expanded":a}))},renderContent:()=>(0,e.createElement)("div",{className:"gblocks-shape-controls"},"Desktop"===g&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.BaseControl,{className:"gb-icon-chooser"},Object.keys(generateBlocksInfo.svgShapes).map(((t,l)=>{const r=generateBlocksInfo.svgShapes[t].svgs;return(0,e.createElement)(n.PanelBody,{title:generateBlocksInfo.svgShapes[t].group,initialOpen:r.hasOwnProperty(be[a].shape),key:l},(0,e.createElement)(n.PanelRow,null,(0,e.createElement)(n.BaseControl,null,(0,e.createElement)("ul",{className:"gblocks-icon-chooser gblocks-shape-chooser"},Object.keys(r).map(((t,l)=>(0,e.createElement)("li",{key:`editor-pblock-types-list-item-${l}`},(0,e.createElement)(n.Tooltip,{text:r[t].label},(0,e.createElement)(n.Button,{className:s()({"editor-block-list-item-button":!0,"gblocks-shape-is-active":be[a].shape===t}),onClick:()=>{const e=[...be];e[a]={...e[a],shape:t},u({shapeDividers:e})}},"string"==typeof r[t].icon?(0,e.createElement)(e.Fragment,null,(0,e.createElement)("span",{className:"editor-block-types-list__item-icon",dangerouslySetInnerHTML:{__html:xi(r[t].icon)}})):(0,e.createElement)(e.Fragment,null,(0,e.createElement)("span",{className:"editor-block-types-list__item-icon"},r[t].icon)))))))))))}))),(0,e.createElement)(n.BaseControl,null,(0,e.createElement)(wi,{label:(0,i.__)("Color","generateblocks"),value:be[a].color,alpha:!0,valueOpacity:be[a].colorOpacity,onChange:e=>{const t=[...be];t[a]={...t[a],color:e},u({shapeDividers:t})},onOpacityChange:e=>{const t=[...be];t[a]={...t[a],colorOpacity:e},u({shapeDividers:t})}})),(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Location","generateblocks"),value:be[a].location,options:[{label:(0,i.__)("Top","generateblocks"),value:"top"},{label:(0,i.__)("Bottom","generateblocks"),value:"bottom"}],onChange:e=>{const t=[...be];t[a]={...t[a],location:e},u({shapeDividers:t})}}),(0,e.createElement)(S,{label:(0,i.__)("Height","generateblocks"),value:"px",units:["px"],onClick:()=>!1}),(0,e.createElement)(n.TextControl,{type:"number",value:be[a].height?be[a].height:"",onChange:e=>{const t=[...be];t[a]={...t[a],height:parseFloat(e)},u({shapeDividers:t})}}),(0,e.createElement)(S,{label:(0,i.__)("Width","generateblocks"),value:"%",units:["%"],onClick:()=>!1}),(0,e.createElement)(n.TextControl,{type:"number",value:be[a].width?be[a].width:"",min:"100",onChange:e=>{const t=[...be];t[a]={...t[a],width:parseFloat(e)},u({shapeDividers:t})}}),(0,e.createElement)(n.ToggleControl,{label:(0,i.__)("Flip Horizontally","generateblocks"),checked:!!be[a].flipHorizontally,onChange:e=>{const t=[...be];t[a]={...t[a],flipHorizontally:e},u({shapeDividers:t})}}),(0,e.createElement)(n.TextControl,{label:(0,i.__)("z-index","generateblocks"),type:"number",min:"0",value:be[a].zindex||0===be[a].zindex?be[a].zindex:"",onChange:e=>{const t=[...be];t[a]={...t[a],zindex:e},u({shapeDividers:t})},onBlur:()=>{const e=[...be];e[a]={...e[a],zindex:parseFloat(be[a].zindex)},u({shapeDividers:e})},onClick:e=>{e.currentTarget.focus()}})),"Tablet"===g&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(S,{label:(0,i.__)("Height","generateblocks"),value:"px",units:["px"],onClick:()=>!1}),(0,e.createElement)(n.TextControl,{type:"number",value:be[a].heightTablet?be[a].heightTablet:"",onChange:e=>{const t=[...be];t[a]={...t[a],heightTablet:parseFloat(e)},u({shapeDividers:t})}}),(0,e.createElement)(S,{label:(0,i.__)("Width","generateblocks"),value:"%",units:["%"],onClick:()=>!1}),(0,e.createElement)(n.TextControl,{type:"number",value:be[a].widthTablet?be[a].widthTablet:"",min:"100",onChange:e=>{const t=[...be];t[a]={...t[a],widthTablet:parseFloat(e)},u({shapeDividers:t})}})),"Mobile"===g&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(S,{label:(0,i.__)("Height","generateblocks"),value:"px",units:["px"],onClick:()=>!1}),(0,e.createElement)(n.TextControl,{type:"number",value:be[a].heightMobile?be[a].heightMobile:"",onChange:e=>{const t=[...be];t[a]={...t[a],heightMobile:parseFloat(e)},u({shapeDividers:t})}}),(0,e.createElement)(S,{label:(0,i.__)("Width","generateblocks"),value:"%",units:["%"],onClick:()=>!1}),(0,e.createElement)(n.TextControl,{type:"number",value:be[a].widthMobile?be[a].widthMobile:"",min:"100",onChange:e=>{const t=[...be];t[a]={...t[a],widthMobile:parseFloat(e)},u({shapeDividers:t})}})))})),"Desktop"===g&&(0,e.createElement)(n.Tooltip,{text:(0,i.__)("Delete Shape","generateblocks")},(0,e.createElement)(n.Button,{className:"gblocks-remove-shape",onClick:()=>{window.confirm((0,i.__)("This will permanently delete this shape.","generateblocks"))&&(e=>{const t=[...be];t.splice(e,1),u({shapeDividers:t})})(a)},icon:p("x")}))))})),(0,e.createElement)("div",{className:"gblocks-add-new-shape"},(0,e.createElement)(n.Button,{isSecondary:!0,onClick:(()=>{const e=[...be];e.push({shape:generateBlocksStyling.container.shapeDividers.shape,color:generateBlocksStyling.container.shapeDividers.color,colorOpacity:generateBlocksStyling.container.shapeDividers.colorOpacity,location:generateBlocksStyling.container.shapeDividers.location,height:generateBlocksStyling.container.shapeDividers.height,heightTablet:generateBlocksStyling.container.shapeDividers.heightTablet,heightMobile:generateBlocksStyling.container.shapeDividers.heightMobile,width:generateBlocksStyling.container.shapeDividers.width,widthTablet:generateBlocksStyling.container.shapeDividers.widthTablet,widthMobile:generateBlocksStyling.container.shapeDividers.widthMobile,flipHorizontally:generateBlocksStyling.container.shapeDividers.flipHorizontally,zindex:generateBlocksStyling.container.shapeDividers.zindex}),u({shapeDividers:e})}).bind(void 0)},(0,i.__)("Add Shape","generateblocks")))),(0,m.applyFilters)("generateblocks.editor.controls","","containerShapeDivider",a,d)))},Di=t=>{let{source:a,onChange:l,help:r,dynamicContentType:n}=t;const o=(e=>{const t=[{value:"current-post",label:"caption"===e?(0,i.__)("Current image","generateblocks"):(0,i.__)("Current post","generateblocks")},{value:"post-type",label:(0,i.__)("Post type","generateblocks")}];return(0,m.applyFilters)("generateblocks.editor.dynamicContent.sourceOptions",t)})(n),s=o.filter((e=>e.value===a));return(0,e.createElement)(Cr,{id:"gblocks-select-source-control",label:(0,i.__)("Data source","generateblocks"),help:r,placeholder:(0,i.__)("Select source","generateblocks"),options:o,value:s,onChange:l})},Ri=t=>{let{dynamicSource:a,postType:l,postId:r,setAttributes:n,dynamicContentType:o}=t;return(0,e.createElement)(e.Fragment,null,(0,e.createElement)(Di,{source:a,onChange:e=>{n({dynamicSource:e.value,postId:"",postType:"post"})},dynamicContentType:o}),"post-type"===a&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(Br,{postType:l,onChange:e=>{n({postType:e.value,postId:""})}}),(0,e.createElement)(Vr,{postId:r,postType:l,value:r?[r]:[],id:"gblocks-select-post",label:(0,i.__)("Select source post","generateblocks"),onChange:e=>{n({postId:e.value})},isMulti:!1})))},Li=t=>{let{dynamicContentType:a,setAttributes:l,name:r,isCaption:n}=t;const o=((e,t)=>{let a=[{options:[{value:"",label:(0,i.__)("Select…","generateblocks")}]},{label:(0,i.__)("Post","generateblocks"),options:[{value:"post-title",label:(0,i.__)("Title","generateblocks")},{value:"post-excerpt",label:(0,i.__)("Excerpt","generateblocks")},{value:"post-date",label:(0,i.__)("Post date","generateblocks")},{value:"post-meta",label:(0,i.__)("Post meta","generateblocks")},{value:"comments-number",label:(0,i.__)("Comments number","generateblocks")},{value:"terms",label:(0,i.__)("List of terms","generateblocks")}]},{label:(0,i.__)("Author","generateblocks"),options:[{value:"author-meta",label:(0,i.__)("Author meta","generateblocks")},{value:"author-email",label:(0,i.__)("Email","generateblocks")},{value:"author-name",label:(0,i.__)("Name","generateblocks")},{value:"author-nickname",label:(0,i.__)("Nickname","generateblocks")},{value:"author-first-name",label:(0,i.__)("First name","generateblocks")},{value:"author-last-name",label:(0,i.__)("Last name","generateblocks")}]}];return"generateblocks/button"===e&&a.push({label:(0,i.__)("Pagination","generateblocks"),options:[{value:"pagination-numbers",label:(0,i.__)("Pagination numbers","generateblocks")}]}),"generateblocks/container"!==e&&"generateblocks/image"!==e||(a=[{options:[{value:"",label:(0,i.__)("Select…","generateblocks")}]},{label:(0,i.__)("Post","generateblocks"),options:[{value:"featured-image",label:(0,i.__)("Featured Image","generateblocks")},{value:"post-meta",label:(0,i.__)("Post meta","generateblocks")}]},{label:(0,i.__)("Author","generateblocks"),options:[{value:"author-avatar",label:(0,i.__)("Author avatar","generateblocks")}]}]),t&&(a=[{options:[{value:"",label:(0,i.__)("Select…","generateblocks")}]},{label:(0,i.__)("Image","generateblocks"),options:[{value:"caption",label:(0,i.__)("Caption","generateblocks")},{value:"post-title",label:(0,i.__)("Title","generateblocks")},{value:"alt-text",label:(0,i.__)("Alt text","generateblocks")},{value:"image-description",label:(0,i.__)("Description","generateblocks")}]}]),(0,m.applyFilters)("generateblocks.editor.dynamicContent.sourceTypes",a,e)})(r,n),s=o.reduce(((e,t)=>e.concat(t.options)),[]).filter((e=>e.value===a));let c=(0,i.__)("Content source","generateblocks");return"generateblocks/container"===r&&(c=(0,i.__)("Background image source","generateblocks")),"generateblocks/image"===r&&(c=(0,i.__)("Image source","generateblocks")),(0,e.createElement)(Cr,{id:"gblocks-select-content-type-control",label:c,placeholder:c,options:o,value:s,onChange:e=>{l({dynamicContentType:e.value,metaFieldName:""}),"comments-number"===e.value?l({noCommentsText:(0,i.__)("No comments","generateblocks"),singleCommentText:(0,i.__)("1 comment","generateblocks"), // translators: Number of comments. From 930def0d8cba2509d6886c84653efa652ea3af0e Mon Sep 17 00:00:00 2001 From: Tom Usborne Date: Wed, 21 Sep 2022 09:14:47 -0700 Subject: [PATCH 70/75] 1.6.0-rc.1 --- package.json | 2 +- plugin.php | 4 ++-- readme.txt | 3 +++ 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index fc67c0a02..a1295aa41 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "generateblocks", - "version": "1.6.0-beta.1", + "version": "1.6.0-rc.1", "private": true, "description": "A small collection of lightweight WordPress blocks that can accomplish nearly anything.", "author": "Tom Usborne", diff --git a/plugin.php b/plugin.php index 16953e0d7..cfd2525d2 100644 --- a/plugin.php +++ b/plugin.php @@ -5,7 +5,7 @@ * Description: A small collection of lightweight WordPress blocks that can accomplish nearly anything. * Author: Tom Usborne * Author URI: https://tomusborne.com - * Version: 1.6.0-beta.1 + * Version: 1.6.0-rc.1 * Requires at least: 5.9 * Requires PHP: 5.6 * License: GPL2+ @@ -19,7 +19,7 @@ exit; // Exit if accessed directly. } -define( 'GENERATEBLOCKS_VERSION', '1.6.0-beta.1' ); +define( 'GENERATEBLOCKS_VERSION', '1.6.0-rc.1' ); define( 'GENERATEBLOCKS_DIR', plugin_dir_path( __FILE__ ) ); define( 'GENERATEBLOCKS_DIR_URL', plugin_dir_url( __FILE__ ) ); diff --git a/readme.txt b/readme.txt index 71889fb9e..4f03e4a86 100644 --- a/readme.txt +++ b/readme.txt @@ -96,6 +96,9 @@ GenerateBlocks was built to work hand-in-hand with [GeneratePress](https://gener * Fix: Pass dynamic container link to settings variable * Fix: Color picker behavior when manually changing value * Fix: Missing legacy alpha color slider in gradient component if set to 0 +* Fix: Remove gb-*-text class from dynamic blocks with icons +* Fix: Dynamic content conflict with icons and custom classes +* Fix: Missing legacy alpha color slider in gradient component * Tweak: Enqueue inline embedding stylesheet using wp_enqueue_scripts * Tweak: Remove block-editor-block-list__block class from root wrapper * Tweak: Headline transform to core Heading keep the level From 12305a5e44434948eeaa97b7e81ebfd5060d3bf5 Mon Sep 17 00:00:00 2001 From: Jean Paiva Date: Mon, 26 Sep 2022 09:20:53 -0300 Subject: [PATCH 71/75] Fix php 8 deprecation warning --- includes/functions.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/includes/functions.php b/includes/functions.php index 40f6f948c..6c5455f04 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -952,11 +952,12 @@ function generateblocks_get_compiled_css( $manual_data = [] ) { /** * This is a helper function that groups our static CSS into device-specific groups. * - * @since 1.6.0 * @param array $existing_data An array of existing data to add to. * @param array $new_data The new data we wish to group. + * + * @since 1.6.0 */ -function generateblocks_group_css_data( $existing_data = [], $new_data ) { +function generateblocks_group_css_data( $existing_data = [], $new_data = [] ) { $existing_data = wp_parse_args( $existing_data, [ From 57fd861719786c45bfe1bf6572da12f6be9f41af Mon Sep 17 00:00:00 2001 From: Jean Paiva Date: Tue, 27 Sep 2022 09:14:44 -0300 Subject: [PATCH 72/75] 1.6.0-rc.2 --- package-lock.json | 2 +- package.json | 2 +- plugin.php | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 736d31740..39822ec27 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "generateblocks", - "version": "1.6.0-alpha.1", + "version": "1.6.0-rc.2", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index a1295aa41..de1e82400 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "generateblocks", - "version": "1.6.0-rc.1", + "version": "1.6.0-rc.2", "private": true, "description": "A small collection of lightweight WordPress blocks that can accomplish nearly anything.", "author": "Tom Usborne", diff --git a/plugin.php b/plugin.php index cfd2525d2..79b8529dc 100644 --- a/plugin.php +++ b/plugin.php @@ -5,7 +5,7 @@ * Description: A small collection of lightweight WordPress blocks that can accomplish nearly anything. * Author: Tom Usborne * Author URI: https://tomusborne.com - * Version: 1.6.0-rc.1 + * Version: 1.6.0-rc.2 * Requires at least: 5.9 * Requires PHP: 5.6 * License: GPL2+ @@ -19,7 +19,7 @@ exit; // Exit if accessed directly. } -define( 'GENERATEBLOCKS_VERSION', '1.6.0-rc.1' ); +define( 'GENERATEBLOCKS_VERSION', '1.6.0-rc.2' ); define( 'GENERATEBLOCKS_DIR', plugin_dir_path( __FILE__ ) ); define( 'GENERATEBLOCKS_DIR_URL', plugin_dir_url( __FILE__ ) ); From 3569204d1501728652aff8faf44af112a4506079 Mon Sep 17 00:00:00 2001 From: Jean Paiva Date: Mon, 3 Oct 2022 13:48:36 -0300 Subject: [PATCH 73/75] Fix: Default button not showing after buttons block added --- src/blocks/button-container/edit.js | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/src/blocks/button-container/edit.js b/src/blocks/button-container/edit.js index 8a2aa29be..bdfd63e6a 100644 --- a/src/blocks/button-container/edit.js +++ b/src/blocks/button-container/edit.js @@ -10,7 +10,6 @@ import { applyFilters } from '@wordpress/hooks'; import { compose } from '@wordpress/compose'; import { withButtonContainerLegacyMigration, withUniqueId } from '../../hoc'; import { useDispatch } from '@wordpress/data'; -import { createBlock } from '@wordpress/blocks'; import RootElement from '../../components/root-element'; const ButtonContainerEdit = ( props ) => { @@ -32,20 +31,7 @@ const ButtonContainerEdit = ( props ) => { const [ deviceType, setDeviceType ] = useDeviceType( 'Desktop' ); const innerBlocksCount = useInnerBlocksCount( clientId ); - const { insertBlocks, removeBlock } = useDispatch( 'core/block-editor' ); - - useEffect( () => { - // Add a button when the container is inserted. - if ( 0 === innerBlocksCount ) { - insertBlocks( - createBlock( 'generateblocks/button', generateBlocksStyling.button ), - undefined, - clientId - ); - } - - setButtonCount( innerBlocksCount ); - }, [] ); + const { removeBlock } = useDispatch( 'core/block-editor' ); useEffect( () => { // If we've removed all of our buttons, remove the container. @@ -101,6 +87,9 @@ const ButtonContainerEdit = ( props ) => {
From 47f1d7d69f32b7b49e1e56355e9cbf4054959d5c Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 3 Oct 2022 17:04:09 +0000 Subject: [PATCH 74/75] Update dist files --- dist/blocks.asset.php | 2 +- dist/blocks.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/blocks.asset.php b/dist/blocks.asset.php index 144082f26..360dcccf8 100644 --- a/dist/blocks.asset.php +++ b/dist/blocks.asset.php @@ -1 +1 @@ - array('lodash', 'react', 'react-dom', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-date', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-notices', 'wp-primitives', 'wp-rich-text'), 'version' => '2f78832bc8ff9bf7a6b5dc42b981644b'); \ No newline at end of file + array('lodash', 'react', 'react-dom', 'wp-blob', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-date', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-notices', 'wp-primitives', 'wp-rich-text'), 'version' => '2621a2be94ece6e8e748da3efcd2ac0d'); \ No newline at end of file diff --git a/dist/blocks.js b/dist/blocks.js index 301ba1dd4..7135aacb9 100644 --- a/dist/blocks.js +++ b/dist/blocks.js @@ -10,7 +10,7 @@ // translators: Number of comments. multipleCommentsText:(0,i.__)("% comments","generateblocks")}):l({noCommentsText:"",singleCommentText:"",multipleCommentsText:""}),"author-avatar"===e.value?l({width:"50px",height:"50px"}):l({width:"",height:""})}})};function zi(e,t){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return(0,l.useSelect)((l=>{const{getUser:n,isResolving:i,getEntityRecord:o,getEntityRecords:s,hasFinishedResolution:c}=l(Z.store),u=(0,m.applyFilters)("generateblocks.editor.dynamicContent.post-request-params",["postType",e,t]);let g=o(...u);const d=!c("getEntityRecord",u)||i("getEntityRecord",u);let p=!1;if(a.includes("author")&&!d&&g){const e=(0,m.applyFilters)("generateblocks.editor.dynamicContent.author-request-params",[g.author]),t=n(...e);p=!c("getUser",e)||i("getUser",e),!p&&t&&(g=Object.assign({},g,{author:t}))}let b=!1;if(a.includes("comments")&&!d&&g){const e=(0,m.applyFilters)("generateblocks.editor.dynamicContent.comments-request-params",["root","comment",{post:t}]),a=s(...e);b=!c("getEntityRecords",e)||i("getEntityRecords",e),!b&&a&&(g=Object.assign({},g,{comments:a}))}let f=!1;if(a.includes("terms")&&!d&&g){const e=(0,m.applyFilters)("generateblocks.editor.dynamicContent.terms-request-params",["taxonomy",r.taxonomy,{post:t}]),a=s(...e);f=!c("getEntityRecords",e)||i("getEntityRecords",e),!f&&a&&(g=Object.assign({},g,{terms:a}))}return{record:(0,m.applyFilters)("generateblocks.editor.dynamicContent.postRecord",g),isLoading:d||p||b||f}}),[e,t,a.join(),JSON.stringify(r)])}function Oi(t){const{isActive:a=!1,metaFieldKey:l="metaFieldName",postType:r,postId:n,metaFieldName:o,setAttributes:s}=t,{record:c,isLoading:u}=zi(r,n),g=o?{value:o,label:o}:void 0;let d=g?[g]:[];c&&c.meta&&(d=d.concat(Object.keys(c.meta).filter((e=>e!==o)).map((e=>({value:e,label:e})))));const p=(0,m.applyFilters)("generateblocks.editor.dynamicContent.PostMetaControl.afterComponent",void 0,t,c);return(0,e.createElement)(e.Fragment,null,a&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(Cr,{id:"gblocks-select-post-meta-control",label:(0,i.__)("Post meta field","generateblocks"),help:(0,i.__)("Live preview is only available to meta exposed to the REST API.","generateblocks"),placeholder:(0,i.__)("Choose or add meta key","generateblocks"),options:d,value:g,isSearchable:!0,isCreatable:!0,isClearable:!0,formatCreateLabel:e=>`Add "${e}"`,isLoading:u,onChange:e=>{s({[l]:e?.value||void 0})}}),p))}function Ii(t){const{isActive:a=!1,metaFieldKey:l="metaFieldName",postType:r,postId:n,metaFieldName:o,setAttributes:s}=t,{record:c,isLoading:u}=zi(r,n,["author"]),g=o?{value:o,label:o}:void 0;let d=g?[g]:[];c&&c.author&&c.author.meta&&(d=d.concat(Object.keys(c.author.meta).filter((e=>e!==o)).map((e=>({value:e,label:e})))));const p=(0,m.applyFilters)("generateblocks.editor.dynamicContent.AuthorMetaControl.afterComponent",void 0,t,c);return(0,e.createElement)(e.Fragment,null,a&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(Cr,{id:"gblocks-select-author-meta-control",label:(0,i.__)("Author meta field","generateblocks"),help:(0,i.__)("Live preview is only available to meta exposed to the REST API.","generateblocks"),placeholder:(0,i.__)("Choose or add meta key","generateblocks"),options:d,value:g,isSearchable:!0,isCreatable:!0,isClearable:!0,formatCreateLabel:e=>`Add "${e}"`,isLoading:u,onChange:e=>{s({[l]:e?.value||void 0})}}),p))}Oi.displayName="PostMetaControl";const Ni=(0,m.applyFilters)("generateblocks.editor.dynamicContent.linkPrependOptions",[{label:(0,i.__)("Default","generateblocks"),value:""},{label:(0,i.__)("Email","generateblocks"),value:"mailto:"},{label:(0,i.__)("Telephone","generateblocks"),value:"tel:"}]);var Ai=t=>{let{linkType:a,linkMetaFieldName:l,linkMetaFieldType:r,dynamicContentType:o,setAttributes:s,isPagination:c,isActive:u,name:g,dynamicLinkRemoveIfEmpty:d,postType:p,postId:b,attributes:f}=t;const h=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],a=arguments.length>2?arguments[2]:void 0,l=[{options:[{value:"",label:(0,i.__)("Select…","generateblocks")}]},{label:(0,i.__)("Post","generateblocks"),options:[{value:"single-post",label:(0,i.__)("Single post","generateblocks")},{value:"comments-area",label:(0,i.__)("Comments area","generateblocks")},{value:"post-meta",label:(0,i.__)("Post meta","generateblocks")}]},{label:(0,i.__)("Author","generateblocks"),options:[{value:"author-archives",label:(0,i.__)("Author archives","generateblocks")},{value:"author-meta",label:(0,i.__)("Author meta","generateblocks")},{value:"author-email",label:(0,i.__)("Author email","generateblocks")}]}];return"terms"===e&&(l=[{options:[{value:"",label:(0,i.__)("Select…","generateblocks")}]},{label:(0,i.__)("Terms","generateblocks"),options:[{value:"term-archives",label:(0,i.__)("Term archives","generateblocks")}]}]),t&&(l=[{options:[{value:"",label:(0,i.__)("Select…","generateblocks")}]},{label:(0,i.__)("Pagination","generateblocks"),options:[{value:"pagination-prev",label:(0,i.__)("Previous page","generateblocks")},{value:"pagination-next",label:(0,i.__)("Next page","generateblocks")}]}],"pagination-numbers"===e&&(l=[])),"generateblocks/image"===a&&l.splice(1,0,{label:(0,i.__)("Image","generateblocks"),options:[{value:"single-image",label:(0,i.__)("Single image","generateblocks")}]}),(0,m.applyFilters)("generateblocks.editor.dynamicContent.linkTypes",l,e)}(o,c,g);if(0===h.length)return null;const k=h.reduce(((e,t)=>e.concat(t.options)),[]).filter((e=>e.value===a)),y="post-meta"===a||"author-meta"===a;return(0,e.createElement)(e.Fragment,null,u&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(Cr,{id:"gblocks-select-link-type-control",label:(0,i.__)("Link source","generateblocks"),placeholder:(0,i.__)("Link source","generateblocks"),options:h,value:k,onChange:e=>s({dynamicLinkType:e.value})}),(0,e.createElement)(Oi,{isActive:y&&"post-meta"===a,postType:p,postId:b,metaFieldKey:"linkMetaFieldName",metaFieldName:l,setAttributes:s,attributes:f}),(0,e.createElement)(Ii,{isActive:y&&"author-meta"===a,postType:p,postId:b,metaFieldKey:"linkMetaFieldName",metaFieldName:l,setAttributes:s,attributes:f}),("author-email"===a||y&&!!l)&&(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Link type","generateblocks"),value:r,onChange:e=>s({linkMetaFieldType:e}),options:Ni}),!!a&&(0,e.createElement)(n.ToggleControl,{label:(0,i.__)("Remove block if link is empty","generateblocks"),checked:!!d,onChange:e=>s({dynamicLinkRemoveIfEmpty:e})})))};function Fi(t){const{isActive:a=!1,dateType:l,dateReplacePublished:r,setAttributes:o}=t;return(0,e.createElement)(e.Fragment,null,a&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Date type","generateblocks"),value:l,options:[{value:"published",label:(0,i.__)("Published","generateblocks")},{value:"updated",label:(0,i.__)("Updated","generateblocks")}],onChange:e=>o({dateType:e})}),"published"===l&&(0,e.createElement)(n.ToggleControl,{label:(0,i.__)("Replace with updated date","generateblocks"),checked:!!r,onChange:e=>o({dateReplacePublished:e})})))}function Pi(t){const{isActive:a,noCommentsText:l,singleCommentText:r,multipleCommentsText:o,setAttributes:s}=t;return(0,e.createElement)(e.Fragment,null,a&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.TextControl,{label:(0,i.__)("No comments text","generateblocks"),value:l,onChange:e=>s({noCommentsText:e})}),(0,e.createElement)(n.TextControl,{label:(0,i.__)("Single comment text","generateblocks"),value:r,onChange:e=>s({singleCommentText:e})}),(0,e.createElement)(n.TextControl,{label:(0,i.__)("Multiple comments text","generateblocks"),value:o,onChange:e=>s({multipleCommentsText:e})})))}function Hi(t){const{isActive:a,postType:l,termTaxonomy:r,termSeparator:o,setAttributes:s,name:c}=t,u=K(),g=(0,e.useMemo)((()=>u.filter((e=>e.types.includes(l))).map((e=>({value:e.slug,label:e.name})))),[u,l]);return(0,e.createElement)(e.Fragment,null,a&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(Mr,{label:(0,i.__)("Taxonomy","generateblocks"),options:g,value:r,onChange:e=>{s({termTaxonomy:e.value})}}),"generateblocks/button"!==c&&(0,e.createElement)(n.TextControl,{label:(0,i.__)("Term separator","generateblocks"),value:o,onChange:e=>s({termSeparator:e})})))}function Vi(a){const{isActive:l,useDefaultMoreLink:r,customMoreLinkText:o,setAttributes:s}=a;return(0,e.createElement)(e.Fragment,null,l&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(M,t({},a,{label:(0,i.__)("Excerpt length","generateblocks"),attributeName:"excerptLength",min:"0"})),(0,e.createElement)(n.ToggleControl,{label:(0,i.__)("Use default more link","generateblocks"),checked:!!r,onChange:e=>s({useDefaultMoreLink:e})}),!r&&(0,e.createElement)(Gr,{label:(0,i.__)("Custom more link text","generateblocks"),value:o,onChange:e=>s({customMoreLinkText:e})})))}var Ui=t=>{let{context:a,attributes:l,setAttributes:o,name:s}=t;const{postType:c,postId:u,useDynamicData:g,dynamicSource:d,dynamicContentType:b,dateType:m,dateReplacePublished:f,metaFieldName:h,noCommentsText:k,singleCommentText:y,multipleCommentsText:v,termTaxonomy:w,termSeparator:_,dynamicLinkType:T,linkMetaFieldName:E,linkMetaFieldType:S,isPagination:x,isQueryLoopItem:B,isCaption:M,excerptLength:D,useDefaultMoreLink:R,customMoreLinkText:L,dynamicLinkRemoveIfEmpty:z}=l,O="current-post"===d?a.postType:c,I="current-post"===d?a.postId:u,N=void 0!==a["generateblocks/queryId"];return(0,e.useEffect)((()=>{"generateblocks/container"===s&&g&&""!==b&&(B||N)&&o({bgImageInline:!0})}),[b,B]),(0,e.useEffect)((()=>{"generateblocks/headline"===s&&M&&g&&(a["generateblocks/mediaId"]?o({postId:a["generateblocks/mediaId"],postType:"attachment",dynamicSource:"current-post",dynamicContentType:b||"caption"}):o({postId:"",postType:"post",dynamicSource:"current-post",dynamicContentType:b||"caption"}))}),[M,a["generateblocks/mediaId"],g,b]),(0,e.createElement)(r.InspectorControls,null,(0,e.createElement)(C,{id:"dynamicDataControls",title:(0,i.__)("Dynamic Data","generateblocks"),initialOpen:!1,icon:p("dynamic"),className:"gblocks-panel-label"},(0,e.createElement)(n.ToggleControl,{label:(0,i.__)("Enable Dynamic Data","generateblocks"),checked:g,onChange:e=>{o({useDynamicData:e})}}),g&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(Ri,{dynamicSource:d,postType:c,postId:u,setAttributes:o,dynamicContentType:b}),(0,e.createElement)(Li,{dynamicContentType:b,setAttributes:o,name:s,isCaption:M}),(0,e.createElement)(Fi,{isActive:"post-date"===b,dateType:m,dateReplacePublished:f,setAttributes:o}),(0,e.createElement)(Oi,{isActive:"post-meta"===b,postType:O,postId:I,metaFieldName:h,setAttributes:o,attributes:l}),(0,e.createElement)(Ii,{isActive:"author-meta"===b,postType:O,postId:I,metaFieldName:h,setAttributes:o,attributes:l}),(0,e.createElement)(Pi,{isActive:"comments-number"===b,noCommentsText:k,singleCommentText:y,multipleCommentsText:v,setAttributes:o}),(0,e.createElement)(Hi,{isActive:"terms"===b,postType:O,termTaxonomy:w,termSeparator:_,setAttributes:o,name:s}),(0,e.createElement)(Vi,{isActive:"post-excerpt"===b,excerptLength:D,useDefaultMoreLink:R,customMoreLinkText:L,setAttributes:o,attributes:l}),(0,e.createElement)(Ai,{isActive:"generateblocks/container"!==s||"generateblocks/container"===s&&void 0!==l.url,postType:O,postId:I,attributes:l,linkType:T,dynamicLinkRemoveIfEmpty:z,dynamicContentType:b,linkMetaFieldName:E,linkMetaFieldType:S,isPagination:x,setAttributes:o,name:s}))))};function Gi(t){let{name:a,clientId:n,align:i,children:o}=t;const{getBlockRootClientId:c}=(0,l.useSelect)((e=>e("core/block-editor")),[]),u=(0,l.useSelect)((e=>{const{getSettings:t}=e(r.store);return t().supportsLayout||!1}),[]),g=a.toString().replace("/","-"),d={className:s()({"wp-block":!0,"gb-is-root-block":!0,[`gb-root-block-${g}`]:!0,[`align${i}`]:u}),"data-align":i&&!u?i:null,"data-block":n};return c(n)?o:(0,e.createElement)("div",d,o)}var ji=t=>{let{icon:a,hasIcon:l=!0,direction:r="left",children:n,hideChildren:i=!1,showWrapper:o=!1,wrapperClassname:s=""}=t;const c=a?(0,e.createElement)("span",{className:"gb-icon",dangerouslySetInnerHTML:{__html:a}}):void 0;return(0,e.createElement)(e.Fragment,null,l&&"left"===r&&c,i||(o?(0,e.createElement)("span",{className:s},n):n),l&&"right"===r&&c)};function qi(t){let{tagName:a,htmlAttrs:l,children:r}=t;return(0,e.createElement)(a,l,r)}function Wi(t){const{name:a,clientId:n,attributes:o,setAttributes:c,onSplit:u,onReplace:g,InnerContent:d=r.RichText,headlineRef:p}=t,{uniqueId:b,element:f,content:h,icon:k,hasIcon:y,anchor:v,removeText:w,ariaLabel:_,dynamicContentType:C,dynamicLinkType:T}=o;let E={className:s()({"gb-headline":!0,[`gb-headline-${b}`]:!0,"gb-headline-text":!y}),id:v||null,ref:p};E=(0,m.applyFilters)("generateblocks.frontend.htmlAttributes",E,"generateblocks/headline",o);const S=(0,r.useBlockProps)(E),x=(0,m.applyFilters)("generateblocks.editor.headlineDisableFormatting",!1,t)?[]:null,B="terms"!==C&&T?"a":"span",M=(0,l.useSelect)((e=>e("core/rich-text").getFormatTypes()),[]),D=(0,e.useMemo)((()=>M&&T?M.filter((e=>"core/link"!==e.name)).map((e=>e.name)):x),[M,x,T]);return(0,e.createElement)(Gi,{name:a,clientId:n},(0,e.createElement)(qi,{tagName:f,htmlAttrs:S},(0,e.createElement)(ji,{hasIcon:y,icon:k,hideChildren:w,showWrapper:!w&&y,wrapperClassname:"gb-headline-text",ariaLabel:w&&_?_:void 0},(0,e.createElement)(d,{name:a,tagName:B,value:h,onChange:e=>c({content:e}),onSplit:u(o,n),onReplace:g,placeholder:(0,i.__)("Headline","generateblocks"),allowedFormats:D}))))}function $i(t){const{attributes:a,setAttributes:l,isSelected:n,InnerContent:o=r.RichText,context:c,name:u,buttonRef:g}=t,{uniqueId:d,anchor:p,text:b,url:f,target:h,relNoFollow:k,relSponsored:y,icon:v,iconLocation:w,removeText:_,ariaLabel:C}=a,T=[];k&&T.push("nofollow"),h&&T.push("noopener","noreferrer"),y&&T.push("sponsored");let E={className:s()({"gb-button":!0,[`gb-button-${d}`]:!0,"gb-button-text":!v}),rel:T&&T.length>0?T.join(" "):null,"aria-label":C||null,id:p||null,ref:g};E=(0,m.applyFilters)("generateblocks.frontend.htmlAttributes",E,"generateblocks/button",a);const S=(0,r.useBlockProps)(E),x=(0,m.applyFilters)("generateblocks.editor.buttonDisableFormatting",!1,t)?[]:["core/bold","core/italic","core/strikethrough"];return(0,e.createElement)(qi,{tagName:f?"a":"span",htmlAttrs:S},(0,e.createElement)(ji,{hasIcon:!!v,icon:v,direction:w,hideChildren:_,showWrapper:!_&&!!v,wrapperClassname:"gb-button-text"},(0,e.createElement)(o,{name:u,placeholder:(0,i.__)("Add text…","generateblocks"),value:b,onChange:e=>l({text:e}),allowedFormats:x,isSelected:n,attributes:a,setAttributes:l,context:c})))}var Zi=(0,m.applyFilters)("generateblocks.editor.dynamicContent.attributes",{useDynamicData:{type:"boolean",default:!1},isPagination:{type:"boolean",default:!1},isCaption:{type:"boolean",default:!1},dynamicContentType:{type:"string",default:""},dynamicLinkType:{type:"string",default:""},dynamicLinkRemoveIfEmpty:{type:"boolean",default:!1},dynamicSource:{type:"string",default:"current-post"},postId:{type:"number",default:""},postType:{type:"string",default:"post"},dateType:{type:"string",default:"published"},dateReplacePublished:{type:"boolean",default:!1},metaFieldName:{type:"string",default:""},linkMetaFieldName:{type:"string",default:""},linkMetaFieldType:{type:"string",default:""},termTaxonomy:{type:"string",default:""},termSeparator:{type:"string",default:", "},noCommentsText:{type:"string",default:""},singleCommentText:{type:"string",default:""},multipleCommentsText:{type:"string",default:""},useDefaultMoreLink:{type:"boolean",default:!0},customMoreLinkText:{type:"string",default:""},excerptLength:{type:"number",default:generateBlocksInfo.excerptLength}}),Ki=window.wp.date;const Ji={"post-title":function(e){return e.title?e.title.raw||(0,i.__)("No post title.","generateblocks"):(0,i.__)("Post title not supported for this type.","generateblocks")},"post-excerpt":function(e,t){if(!e.excerpt)return(0,i.__)("Post except not supported for this type.","generateblocks");const{raw:a,rendered:l,protected:r}=e?.excerpt;if(r||!a&&!l)return(0,i.__)("No post excerpt.","generateblocks");const n=e=>(new window.DOMParser).parseFromString(e,"text/html"),o=n(l),s=n(generateBlocksInfo.excerptMore),c=o.body.textContent||o.body.innerText||"";let u=s.body.textContent||s.body.innerText||"";u=u.replace("...","…");let g=a.trim()?a:c;const d=g.includes(u);return g=d?g.replace(u,""):g,g=g.split(" ").splice(0,t.excerptLength).join(" "),t.useDefaultMoreLink?d&&(g+=generateBlocksInfo.excerptMore):g+=' ... '+t.customMoreLinkText+"",g},"post-date":function(e,t){let a=t.dateType;if("published"===a&&t.dateReplacePublished&&(a="updated"),!e.date)return(0,i.__)("No post date.","generateblocks");const l="updated"===a?e.modified:e.date;return(0,Ki.dateI18n)(t.dateFormat||"F j, Y",l,"")},"post-meta":function(e,t){let a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return Yi(t.metaFieldName,e.meta,a,t)},"author-meta":function(e,t){return e.author?Yi(t.metaFieldName,e.author.meta,!1,t):Xi()},"author-email":function(e){return e.author?e.author.email||(0,i.__)("No author email.","generateblocks"):Xi()},"author-name":function(e){return e.author?e.author.name||(0,i.__)("No author name.","generateblocks"):Xi()},"author-nickname":function(e){return e.author?e.author.nickname||(0,i.__)("No author nickname.","generateblocks"):Xi()},"author-first-name":function(e){return e.author?e.author.first_name||(0,i.__)("No author first name.","generateblocks"):Xi()},"author-last-name":function(e){return e.author?e.author.last_name||(0,i.__)("No author last name.","generateblocks"):Xi()},"comments-number":function(e,t){const a=Array.isArray(e.comments)?e.comments.length:0,{noCommentsText:l,singleCommentText:r,multipleCommentsText:n}=t;return 0===a?l:1===a?r:n.replace("%",String(a))},"pagination-numbers":function(){return(0,i.__)("1 … 2 3","generateblocks")},"featured-image":function(e){return e?.featured_media},terms:function(e,t){return Array.isArray(e.terms)&&e.terms.length>0?e.terms.map((e=>e.name)).join(t.termSeparator):"No terms"},"author-avatar":function(e){return{source_url:e?.author?.avatar_urls&&e?.author?.avatar_urls[96]?e?.author?.avatar_urls[96]:""}},caption:function(e){return e?.caption?.raw||(0,i.__)("Image caption","generateblocks")},"alt-text":function(e){return e?.alt_text||(0,i.__)("Image alt text","generateblocks")},"image-description":function(e){return e?.description?.raw||(0,i.__)("Image description","generateblocks")}};function Qi(e,t,a){return a?void 0:(0,i.sprintf)(// translators: %s: Content type. (0,i.__)("Content type %s is not supported.","generateblocks"),t.dynamicContentType)}const Yi=function(e,t){let a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(t&&e){const r=(0,m.applyFilters)("generateblocks.editor.dynamicContent.postMetaField",t[e],l);if(U().isEmpty(r)&&!U().isNumber(r))return e;const n=a?void 0:(0,i.__)("Meta field value not supported.","generateblocks");return U().isString(r)||U().isNumber(r)?U().toString(r):n}return a?void 0:(0,i.__)("Meta value","generateblocks")};function Xi(){return(0,i.__)("Author not found.","generateblocks")}var eo=t=>{let{isGrid:a,uniqueId:l,children:r}=t;return a?(0,e.createElement)("div",{className:`gb-grid-column gb-grid-column-${l}`},r):r},to=t=>{let{attributes:a,allShapes:l}=t;const{shapeDividers:r}=a;return(0,e.createElement)(e.Fragment,null,!!a.shapeDividers.length&&(0,e.createElement)("div",{className:"gb-shapes"},a.shapeDividers.map(((t,a)=>{const n=a+1;return(0,e.createElement)(e.Fragment,{key:a},void 0!==l[r[a].shape]&&(0,e.createElement)("div",{className:s()({"gb-shape":!0,[`gb-shape-${n}`]:!0}),dangerouslySetInnerHTML:{__html:xi(l[r[a].shape].icon)}}))}))))};class ao extends e.Component{render(){const t=(0,m.applyFilters)("generateblocks.editor.cssAttrs",this.props.attributes,this.props),{uniqueId:a,removeVerticalGap:l}=t;let r=[];return r[".gb-grid-column-"+a]=[{"margin-bottom":!!l&&"0px !important"}],r=(0,m.applyFilters)("generateblocks.editor.desktopCSS",r,this.props,"container"),(0,e.createElement)("style",null,O(r))}}class lo extends e.Component{render(){const t=(0,m.applyFilters)("generateblocks.editor.cssAttrs",this.props.attributes,this.props),{uniqueId:a,isGrid:l,widthTablet:r,autoWidthTablet:n,flexGrowTablet:i,flexShrinkTablet:o,flexBasisTablet:s,flexBasisUnit:c,minHeightTablet:u,minHeightUnitTablet:g,paddingTopTablet:d,paddingRightTablet:p,paddingBottomTablet:b,paddingLeftTablet:f,paddingUnit:h,marginTopTablet:k,marginRightTablet:y,marginBottomTablet:v,marginLeftTablet:w,marginUnit:_,borderSizeTopTablet:C,borderSizeRightTablet:T,borderSizeBottomTablet:E,borderSizeLeftTablet:S,borderRadiusTopRightTablet:x,borderRadiusBottomRightTablet:B,borderRadiusBottomLeftTablet:M,borderRadiusTopLeftTablet:D,borderRadiusUnit:R,verticalAlignmentTablet:L,alignmentTablet:z,fontSizeTablet:N,fontSizeUnit:A,orderTablet:F,shapeDividers:P,bgImage:H,bgOptions:V,gridId:U}=t;let G=[];return G[".editor-styles-wrapper .gb-container-"+a]=[{"border-top-left-radius":I(D,R),"border-top-right-radius":I(x,R),"border-bottom-right-radius":I(B,R),"border-bottom-left-radius":I(M,R),"margin-top":I(k,_),"margin-right":I(y,_),"margin-bottom":I(v,_),"margin-left":I(w,_),"text-align":z,"font-size":I(N,A),"min-height":I(u,g)}],(C||T||E||S)&&G[".editor-styles-wrapper .gb-container-"+a].push({"border-top-width":I(C,"px"),"border-right-width":I(T,"px"),"border-bottom-width":I(E,"px"),"border-left-width":I(S,"px"),"border-style":"solid"}),u&&!l&&G[".editor-styles-wrapper .gb-container-"+a].push({display:"flex","flex-direction":"row","align-items":"inherit"!==L?L:null}),l&&"inherit"!==L&&G[".editor-styles-wrapper .gb-container-"+a].push({display:"flex","flex-direction":"column",height:"100%","justify-content":L}),G[".gb-container-"+a+" > .gb-inside-container"]=[{"padding-top":I(d,h),"padding-right":I(p,h),"padding-bottom":I(b,h),"padding-left":I(f,h),width:!(!u||l)&&"100%"}],l&&(G[[".gb-post-template-"+U+" > .gb-post-template-wrapper > .block-editor-inner-blocks",".gb-grid-wrapper > .block-editor-inner-blocks > .block-editor-block-list__layout > .gb-grid-column-"+a].join(",")]=[{width:n?"auto":I(r,"%"),"flex-grow":i,"flex-shrink":o,"flex-basis":isNaN(s)?s:I(s,c),order:F}]),H&&"pseudo-element"===V.selector&&(G[".gb-container-"+a+":before"]=[{"border-top-left-radius":I(D,R),"border-top-right-radius":I(x,R),"border-bottom-right-radius":I(B,R),"border-bottom-left-radius":I(M,R)}]),P.length&&P.forEach(((e,t)=>{G[".gb-container-"+a+" > .gb-shapes .gb-shape-"+(t+1)+" svg"]=[{height:I(P[t].heightTablet,"px"),width:I(P[t].widthTablet,"%")}]})),G=(0,m.applyFilters)("generateblocks.editor.tabletCSS",G,this.props,"container"),(0,e.createElement)("style",null,O(G))}}class ro extends e.Component{render(){const t=(0,m.applyFilters)("generateblocks.editor.cssAttrs",this.props.attributes,this.props),{uniqueId:a,removeVerticalGapTablet:l}=t;let r=[];return l&&(r[".gb-grid-column-"+a]=[{"margin-bottom":"0px !important"}]),r=(0,m.applyFilters)("generateblocks.editor.tabletOnlyCSS",r,this.props,"container"),(0,e.createElement)("style",null,O(r))}}class no extends e.Component{render(){const t=(0,m.applyFilters)("generateblocks.editor.cssAttrs",this.props.attributes,this.props),{uniqueId:a,isGrid:l,widthMobile:r,autoWidthMobile:n,flexGrowMobile:i,flexShrinkMobile:o,flexBasisMobile:s,flexBasisUnit:c,minHeightMobile:u,minHeightUnitMobile:g,paddingTopMobile:d,paddingRightMobile:p,paddingBottomMobile:b,paddingLeftMobile:f,paddingUnit:h,marginTopMobile:k,marginRightMobile:y,marginBottomMobile:v,marginLeftMobile:w,marginUnit:_,borderSizeTopMobile:C,borderSizeRightMobile:T,borderSizeBottomMobile:E,borderSizeLeftMobile:S,borderRadiusTopRightMobile:x,borderRadiusBottomRightMobile:B,borderRadiusBottomLeftMobile:M,borderRadiusTopLeftMobile:D,borderRadiusUnit:R,verticalAlignmentMobile:L,removeVerticalGapMobile:z,alignmentMobile:N,fontSizeMobile:A,fontSizeUnit:F,orderMobile:P,shapeDividers:H,bgImage:V,bgOptions:U,gridId:G}=t;let j=[];return j[".editor-styles-wrapper .gb-container-"+a]=[{"border-top-left-radius":I(D,R),"border-top-right-radius":I(x,R),"border-bottom-right-radius":I(B,R),"border-bottom-left-radius":I(M,R),"margin-top":I(k,_),"margin-right":I(y,_),"margin-bottom":I(v,_),"margin-left":I(w,_),"text-align":N,"font-size":I(A,F),"min-height":I(u,g)}],(C||T||E||S)&&j[".editor-styles-wrapper .gb-container-"+a].push({"border-top-width":I(C,"px"),"border-right-width":I(T,"px"),"border-bottom-width":I(E,"px"),"border-left-width":I(S,"px"),"border-style":"solid"}),"inherit"!==L&&u&&!l&&j[".editor-styles-wrapper .gb-container-"+a].push({display:"flex","flex-direction":"row","align-items":L}),l&&"inherit"!==L&&j[".editor-styles-wrapper .gb-container-"+a].push({display:"flex","flex-direction":"column",height:"100%","justify-content":L}),j[".gb-container-"+a+" > .gb-inside-container"]=[{"padding-top":I(d,h),"padding-right":I(p,h),"padding-bottom":I(b,h),"padding-left":I(f,h),width:!(!u||l)&&"100%"}],l&&(j[[".gb-post-template-"+G+" > .gb-post-template-wrapper > .block-editor-inner-blocks",".gb-grid-wrapper > .block-editor-inner-blocks > .block-editor-block-list__layout > .gb-grid-column-"+a].join(",")]=[{width:n?"auto":I(r,"%"),"flex-grow":i,"flex-shrink":o,"flex-basis":isNaN(s)?s:I(s,c),order:P}]),z&&(j[".gb-grid-column-"+a]=[{"margin-bottom":"0px !important"}]),V&&"pseudo-element"===U.selector&&(j[".gb-container-"+a+":before"]=[{"border-top-left-radius":I(D,R),"border-top-right-radius":I(x,R),"border-bottom-right-radius":I(B,R),"border-bottom-left-radius":I(M,R)}]),H.length&&H.forEach(((e,t)=>{j[".gb-container-"+a+" > .gb-shapes .gb-shape-"+(t+1)+" svg"]=[{height:I(H[t].heightMobile,"px"),width:I(H[t].widthMobile,"%")}]})),V&&"fixed"===U.attachment&&("element"===U.selector&&j[".editor-styles-wrapper .gb-container-"+a].push({"background-attachment":"initial"}),"pseudo-element"===U.selector&&(j[".gb-container-"+a+":before"]=[{"background-attachment":"initial"}])),j=(0,m.applyFilters)("generateblocks.editor.mobileCSS",j,this.props,"container"),(0,e.createElement)("style",null,O(j))}}function io(e,t,a,l,r){if(""!==e||""!==t||""!==a||""!==l)return e=0!=parseFloat(e)&&""!==e?parseFloat(e)+r+" ":"0 ",t=0!=parseFloat(t)&&""!==t?parseFloat(t)+r+" ":"0 ",a=0!=parseFloat(a)&&""!==a?parseFloat(a)+r+" ":"0 ",t===(l=0!=parseFloat(l)&&""!==l?parseFloat(l)+r+" ":"0 ")&&(l="",e===a&&(a="",e===t&&(t=""))),(e+t+a+l).trim()}var oo=e=>{const{attributes:t,featuredImage:a}=e,{dynamicImage:r,useDynamicData:n,dynamicContentType:i,bgImageSize:o}=t;return(0,l.useSelect)((e=>{const{getMedia:t}=e(Z.store);return"featured-image"===i&&a||!isNaN(parseInt(r))?t("featured-image"===i&&a?a:parseInt(r),{context:"view"}):r}),[n,r,o,a,i])};function so(e,t){return"object"==typeof e?e?.media_details?.sizes?.[t]?.source_url||e?.source_url:e}function co(e){const t=(0,m.applyFilters)("generateblocks.editor.cssAttrs",e.attributes,e),{bgImage:a,useDynamicData:l,dynamicContentType:r,bgImageSize:n}=t;let i=a?.image?.url;const o=oo(e);return l&&""!==r&&(i=so(o,n)),(0,m.applyFilters)("generateblocks.editor.bgImageURL",i,e)}function uo(e,t){const a=(0,m.applyFilters)("generateblocks.editor.cssAttrs",t.attributes,t),{backgroundColor:l,backgroundColorOpacity:r,bgImage:n,bgImageInline:i,gradient:o,bgOptions:s,gradientColorOne:c,gradientColorOneOpacity:u,gradientColorTwo:g,gradientColorTwoOpacity:d,gradientColorStopOne:p,gradientColorStopTwo:b,gradientDirection:f,useDynamicData:h,dynamicContentType:k}=a;let y="";if(o){let e="",t="";const a=vi(c,u),l=vi(g,d);c&&""!==p&&(e=" "+p+"%"),g&&""!==b&&(t=" "+b+"%"),y="linear-gradient("+f+"deg, "+a+e+", "+l+t+")"}if("gradient"===e)return y;let v=!1;const w=vi(l,r);if(n||h&&""!==k){const e=co(t);"element"===s.selector&&(w||o)&&void 0!==s.overlay&&s.overlay?o?v=y+", url("+e+")":w&&(v="linear-gradient(0deg, "+w+", "+w+"), url("+e+")"):(v="url("+e+")",i&&"element"!==s.selector&&(v="var(--background-image)"))}return v}function go(t){const a=(0,m.applyFilters)("generateblocks.editor.cssAttrs",t.attributes,t),{clientId:l}=t,{uniqueId:r,isGrid:n,width:i,autoWidth:o,flexGrow:s,flexShrink:c,flexBasis:u,flexBasisUnit:g,outerContainer:d,innerContainer:p,containerWidth:b,minHeight:f,minHeightUnit:h,paddingTop:k,paddingRight:y,paddingBottom:v,paddingLeft:w,paddingUnit:_,marginTop:C,marginRight:T,marginBottom:E,marginLeft:S,marginUnit:x,borderSizeTop:B,borderSizeRight:M,borderSizeBottom:D,borderSizeLeft:R,borderRadiusTopRight:L,borderRadiusBottomRight:z,borderRadiusBottomLeft:N,borderRadiusTopLeft:A,borderRadiusUnit:F,borderColor:P,borderColorOpacity:H,backgroundColor:V,backgroundColorOpacity:U,gradient:G,gradientSelector:j,textColor:q,linkColor:W,linkColorHover:$,bgImage:Z,bgOptions:K,verticalAlignment:J,zindex:Q,innerZindex:Y,alignment:X,fontFamily:ee,fontFamilyFallback:te,fontWeight:ae,fontSize:le,fontSizeUnit:re,textTransform:ne,shapeDividers:ie,gridId:oe,useDynamicData:se,dynamicContentType:ce,bgImageInline:ue}=a;let ge=b;ge||(ge=generateBlocksDefaults.container.containerWidth);let de="";ee&&te&&(de=", "+te);const pe=!!Z||se&&""!==ce,be=uo("image",t),me=uo("gradient",t);let fe=[];return fe[".editor-styles-wrapper .gb-container-"+r]=[{"background-color":vi(V,U),color:q,"border-radius":io(A,L,z,N,F),margin:io(C,T,E,S,x),"z-index":Q,"text-align":X,"font-family":ee+de,"font-weight":ae,"text-transform":ne,"font-size":I(le,re),"min-height":I(f,h),"border-color":vi(P,H)}],pe&&"element"===K.selector&&be?fe[".editor-styles-wrapper .gb-container-"+r].push({"background-image":ue?null:be,"background-size":K.size,"background-position":K.position,"background-repeat":K.repeat,"background-attachment":K.attachment}):G&&"element"===j&&fe[".editor-styles-wrapper .gb-container-"+r].push({"background-image":me}),(pe&&"pseudo-element"===K.selector||Q||G&&"pseudo-element"===j)&&fe[".editor-styles-wrapper .gb-container-"+r].push({position:"relative"}),(pe&&"pseudo-element"===K.selector||G&&"pseudo-element"===j)&&(fe[".editor-styles-wrapper .gb-container-"+r].push({overflow:"hidden"}),fe[".gb-container-"+r+" .block-list-appender"]=[{"z-index":10}]),fe[".editor-styles-wrapper .gb-container-"+r+" h1,\n\t\t.editor-styles-wrapper .gb-container-"+r+" h2,\n\t\t.editor-styles-wrapper .gb-container-"+r+" h3,\n\t\t.editor-styles-wrapper .gb-container-"+r+" h4,\n\t\t.editor-styles-wrapper .gb-container-"+r+" h5,\n\t\t.editor-styles-wrapper .gb-container-"+r+" h6"]=[{color:q}],(B||M||D||R)&&fe[".editor-styles-wrapper .gb-container-"+r].push({"border-width":io(B,M,D,R,"px"),"border-style":"solid"}),f&&!n&&fe[".editor-styles-wrapper .gb-container-"+r].push({display:"flex","flex-direction":"row","align-items":J}),pe&&"pseudo-element"===K.selector&&(fe[".gb-container-"+r+":before"]=[{content:'""',"background-image":be,"background-repeat":K.repeat,"background-position":K.position,"background-size":K.size,"background-attachment":K.attachment,"z-index":"0",position:"absolute",top:"0",right:"0",bottom:"0",left:"0","border-radius":io(A,L,z,N,F)}],void 0!==K.opacity&&1!==K.opacity&&fe[".gb-container-"+r+":before"].push({opacity:K.opacity})),G&&"pseudo-element"===j&&(fe[".gb-container-"+r+":after"]=[{content:'""',"background-image":me,"z-index":"0 !important",position:"absolute",top:"0",right:"0",bottom:"0",left:"0"}]),fe[".editor-styles-wrapper .gb-container-"+r+" a, .editor-styles-wrapper .gb-container-"+r+" a:visited"]=[{color:W}],fe[".editor-styles-wrapper .gb-container-"+r+" a:hover"]=[{color:$}],fe[".gb-container-"+r+" > .gb-inside-container"]=[{padding:io(k,y,v,w,_),width:!(!f||n)&&"100%"}],(Y||0===Y)&&fe[".gb-container-"+r+" > .gb-inside-container"].push({"z-index":Y,position:"relative"}),"contained"!==p||n||fe[".gb-container-"+r+" > .gb-inside-container"].push({"max-width":I(ge,"px"),"margin-left":"auto","margin-right":"auto"}),fe["#block-"+l]=[{"max-width":"contained"===d&&!n&&I(ge,"px"),"margin-left":"contained"===d&&!n&&"auto","margin-right":"contained"===d&&!n&&"auto"}],n&&(fe[[".gb-post-template-"+oe+" > .gb-post-template-wrapper > .block-editor-inner-blocks",".gb-grid-wrapper > .block-editor-inner-blocks > .block-editor-block-list__layout > .gb-grid-column-"+r].join(",")]=[{width:!o&&I(i,"%"),"flex-grow":s,"flex-shrink":c,"flex-basis":isNaN(u)?u:I(u,g)}],fe[".editor-styles-wrapper .gb-container-"+r].push({display:"flex","flex-direction":"column",height:"100%","justify-content":J})),fe["#block-"+l+":not(.has-child-selected):not(.is-selected) .block-list-appender:not(:first-child),\n\t#block-"+l+":not(.has-child-selected):not(.is-selected) .block-editor-block-list__layout > div:not(:first-child) > .block-list-appender"]=[{display:"none"}],ie.length&&(fe[".editor-styles-wrapper .gb-container-"+r].push({position:"relative"}),fe[".gb-container-"+r+" .block-list-appender"]=[{position:"relative","z-index":100}],ie.forEach(((e,t)=>{const a=[],l=t+1;"top"===ie[t].location&&a.push("scaleY(-1)"),ie[t].flipHorizontally&&(a.push("scaleX(-1)"),fe[".gblocks-shape-container > .gblocks-shape-toggle-preview-"+l+" .gblocks-shape-divider-preview"]=[{transform:"scaleX(-1)"}]),fe[".gb-container-"+r+" > .gb-shapes .gb-shape-"+l]=[{color:vi(ie[t].color,ie[t].colorOpacity),"z-index":ie[t].zindex}],"top"!==ie[t].location&&"bottom"!==ie[t].location||fe[".gb-container-"+r+" > .gb-shapes .gb-shape-"+l].push({left:"0",right:"0"}),"bottom"===ie[t].location&&fe[".gb-container-"+r+" > .gb-shapes .gb-shape-"+l].push({bottom:"-1px"}),"top"===ie[t].location&&fe[".gb-container-"+r+" > .gb-shapes .gb-shape-"+l].push({top:"-1px"}),a.length&&fe[".gb-container-"+r+" > .gb-shapes .gb-shape-"+l].push({transform:a.join(" ")});let n=ie[t].width+"%";100===ie[t].width&&(n="calc("+n+" + 1.3px)"),fe[".gb-container-"+r+" > .gb-shapes .gb-shape-"+l+" svg"]=[{height:I(ie[t].height,"px"),width:n}],"top"!==ie[t].location&&"bottom"!==ie[t].location||fe[".gb-container-"+r+" > .gb-shapes .gb-shape-"+l+" svg"].push({position:"relative",left:"50%",transform:"translateX(-50%)","min-width":"100%"})}))),fe=(0,m.applyFilters)("generateblocks.editor.mainCSS",fe,t,"container"),(0,e.createElement)("style",null,O(fe))}var po=(0,e.memo)((function(t){const a=(0,l.useSelect)((e=>{if(!e("core/edit-post"))return"Desktop";const{__experimentalGetPreviewDeviceType:t=(()=>"Desktop")}=e("core/edit-post");return t()}),[]),{isBlockPreview:r=!1}=t?.attributes;return r?null:(0,e.createElement)(e.Fragment,null,(0,e.createElement)(go,t),a&&(0,e.createElement)(e.Fragment,null,"Desktop"===a&&(0,e.createElement)(ao,t),("Tablet"===a||"Mobile"===a)&&(0,e.createElement)(lo,t),"Tablet"===a&&(0,e.createElement)(ro,t),"Mobile"===a&&(0,e.createElement)(no,t)))}),G);function bo(a){const{attributes:o,clientId:c,name:u,filterTagName:g,allShapes:d,deviceType:b}=a,{uniqueId:f,className:h,anchor:k,tagName:y,backgroundColor:v,isGrid:w,bgOptions:_,bgImageInline:C,align:T,isBlockPreview:E=!1}=o,{selectBlock:S}=(0,l.useDispatch)("core/block-editor"),x=0<$(c),B=(0,l.useSelect)((e=>{const{getSettings:t}=e(r.store);return t().supportsLayout||!1}),[]);let M=!!v||o.borderSizeTop||o.borderSizeRight||o.borderSizeBottom||o.borderSizeLeft;M=(0,m.applyFilters)("generateblocks.editor.containerHasStyling",M,a);let D={className:s()({"gb-container":!0,[`gb-container-${f}`]:!0,[`${h}`]:void 0!==h,"gb-container-empty":!x&&!E,"gb-container-visual-guides":!(x||M||a.isSelected||E),[`align${T}`]:B}),id:k||null,"data-align":T&&!B?T:null};const R=co(a);if(C&&R){let e="background-image";"element"!==_.selector&&(e="--"+e),D.style={[e]:"url("+R+")"}}D=(0,m.applyFilters)("generateblocks.frontend.htmlAttributes",D,"generateblocks/container",o);const L=(0,r.useBlockProps)(D);return(0,e.createElement)(e.Fragment,null,(0,e.createElement)(po,t({},a,{deviceType:b})),(0,e.createElement)(Gi,{name:u,clientId:c,align:T},(0,e.createElement)(eo,{isGrid:w,uniqueId:f},(0,e.createElement)(qi,{tagName:g((0,m.applyFilters)("generateblocks.frontend.containerTagName",y,o)),htmlAttrs:L},(0,m.applyFilters)("generateblocks.frontend.afterContainerOpen","",o),(0,e.createElement)("div",{className:"gb-inside-container"},(0,m.applyFilters)("generateblocks.frontend.insideContainer","",o),(0,e.createElement)(r.InnerBlocks,{templateLock:!1,renderAppender:()=>!E&&(a.isSelected?(0,e.createElement)(r.InnerBlocks.ButtonBlockAppender,null):!x&&!a.isSelected&&(0,e.createElement)(n.Button,{className:"gblocks-container-selector",onClick:()=>S(c),"aria-label":(0,i.__)("Select Container","generateblocks")},(0,e.createElement)("span",{className:"gblocks-container-selector__icon"},p("container"))))})),(0,e.createElement)(to,{attributes:o,allShapes:d}),(0,m.applyFilters)("generateblocks.frontend.beforeContainerClose","",o)))))}function mo(t){const{onSelectImage:a,onSelectURL:l,onUploadError:n,attributes:o,canUploadImage:s}=t,{width:c,height:u,useDynamicData:g,uniqueId:d}=o,b=(0,e.createElement)(T.SVG,{className:"components-placeholder__illustration",fill:"none",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 60 60",preserveAspectRatio:"none"},(0,e.createElement)(T.Path,{vectorEffect:"non-scaling-stroke",d:"M60 60 0 0"}));let m=generateBlocksInfo.imagePlaceholders.standard;c&&c<500&&c===u&&(m=generateBlocksInfo.imagePlaceholders.square);let f=(0,e.createElement)(r.MediaPlaceholder,{labels:{title:(0,i.__)("Image","generateblocks"),instructions:(0,i.__)("Choose an image from your media library or add one with a URL.","generateblocks")},icon:p("image"),onSelect:a,onSelectURL:g?null:l,onError:n,accept:"image/*",allowedTypes:["image"]});return s||(f=(0,e.createElement)(e.Fragment,null,(0,e.createElement)("img",{className:"gb-image-"+d,src:m,alt:"",width:c||1e3,height:u||650}),b)),(0,e.createElement)("div",{className:"gblocks-image__placeholder",style:{width:!s&&c?c:null}},f)}function fo(t){const{href:a,openInNewWindow:l,relNoFollow:r,relSponsored:n,children:i,disabled:o}=t,s=[];return l&&s.push("noopener","noreferrer"),r&&s.push("nofollow"),n&&s.push("sponsored"),(0,e.createElement)(e.Fragment,null,a?(0,e.createElement)("a",{href:o?void 0:a,target:l?"_blank":void 0,rel:s&&s.length>0?s.join(" "):null},i):i)}function ho(a){const{src:l,alt:i,title:o,anchorAttributes:c,imageRef:u,setLoadedNaturalSize:g,naturalWidth:d,naturalHeight:p,attributes:b,temporaryURL:f}=a,{uniqueId:h,anchor:k,mediaId:y,dynamicImage:v,useDynamicData:w,className:_,align:C}=b,T=(0,m.applyFilters)("generateblocks.frontend.htmlAttributes",{className:s()({"gb-image":!0,[`gb-image-${h}`]:!0,[`${_}`]:void 0!==_,[`align${C}`]:""!==C}),id:k||null,width:d,height:p,src:f||l,alt:i,title:o},"generateblocks/image",b);return(0,e.createElement)(e.Fragment,null,(0,e.createElement)(fo,c,(0,e.createElement)("img",t({},T,{ref:u,onLoad:e=>{g({loadedNaturalWidth:e.target?.naturalWidth,loadedNaturalHeight:e.target?.naturalHeight})}})),f&&(0,e.createElement)(n.Spinner,null)),(0,e.createElement)(r.BlockContextProvider,{value:{"generateblocks/dynamicImage":!!w&&parseInt(v),"generateblocks/mediaId":!w&&y}},(0,e.createElement)(r.InnerBlocks,{allowedBlocks:["generateblocks/headline"],renderAppender:!1})))}const ko={className:"block-editor-block-settings-menu__popover",position:"bottom right"};function yo(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const a={width:"300px","font-style":"italic","margin-bottom":t?"15px":"0"};return(0,e.createElement)("div",{style:a},(0,i.__)("This button is using a dynamic link.","generateblocks"))}function vo(t){const{attributes:a,setAttributes:l,name:o}=t,{href:s,relNoFollow:c,relSponsored:u,dynamicLinkType:g,useDynamicData:d,url:p}=a,b=d&&g,f="generateblocks/button"===o?"target":"openInNewWindow",h=a[f],k="generateblocks/button"===o?p:s;return(0,e.createElement)(e.Fragment,null,d?(0,e.createElement)(yo,{marginBottom:!!g}):(0,e.createElement)(r.URLInput,{className:"gblocks-link-url",value:k,onChange:e=>l({href:e})}),(0,m.applyFilters)("generateblocks.editor.urlInputMoreOptions","",a),(!!k||b)&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.ToggleControl,{label:(0,i.__)("Open link in a new tab","generateblocks"),checked:h||"",onChange:e=>l({[f]:e})}),(0,e.createElement)(n.ToggleControl,{label:(0,i.__)('Add rel="nofollow"',"generateblocks"),checked:c||"",onChange:e=>l({relNoFollow:e})}),(0,e.createElement)(n.ToggleControl,{label:(0,i.__)('Add rel="sponsored"',"generateblocks"),checked:u||"",onChange:e=>l({relSponsored:e})})))}function wo(t){const{attributes:a,name:l}=t,{url:r,href:o}=a,s="generateblocks/button"===l?r:o,c=s?(0,i.__)("Change Link","generateblocks"):(0,i.__)("Add Link","generateblocks");return(0,e.createElement)(n.Dropdown,{popoverProps:ko,contentClassName:"gblocks-link-control-dropdown",renderToggle:t=>{let{isOpen:a,onToggle:l}=t;return(0,e.createElement)(n.ToolbarButton,{icon:un,label:c,onClick:l,"aria-expanded":a,isPressed:!!s})},renderContent:()=>(0,e.createElement)(vo,t)})}function _o(e,t){let a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const{attributes:l,deviceType:r}=t,n="Desktop"===r?"":r,i=e+n;return a?i:l[i]}var Co=(0,e.createElement)(T.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(T.Path,{d:"M4 19.8h8.9v-1.5H4v1.5zm8.9-15.6H4v1.5h8.9V4.2zm-8.9 7v1.5h16v-1.5H4z"})),To=(0,e.createElement)(T.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(T.Path,{d:"M16.4 4.2H7.6v1.5h8.9V4.2zM4 11.2v1.5h16v-1.5H4zm3.6 8.6h8.9v-1.5H7.6v1.5z"})),Eo=(0,e.createElement)(T.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(T.Path,{d:"M11.1 19.8H20v-1.5h-8.9v1.5zm0-15.6v1.5H20V4.2h-8.9zM4 12.8h16v-1.5H4v1.5z"})),So=(0,e.createElement)(T.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(T.Path,{d:"M4 9v6h14V9H4zm8-4.8H4v1.5h8V4.2zM4 19.8h8v-1.5H4v1.5z"})),xo=(0,e.createElement)(T.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(T.Path,{d:"M6 15h14V9H6v6zm6-10.8v1.5h8V4.2h-8zm0 15.6h8v-1.5h-8v1.5z"})),Bo=(0,e.createElement)(T.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(T.Path,{d:"M5 9v6h14V9H5zm11-4.8H8v1.5h8V4.2zM8 19.8h8v-1.5H8v1.5z"})),Mo=(0,e.createElement)(T.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(T.Path,{d:"M5 4v11h14V4H5zm3 15.8h8v-1.5H8v1.5z"}));function Do(t){const{attributes:a,setAttributes:o,deviceType:s}=t,{align:c}=a,{wideControlsEnabled:u=!1}=(0,l.useSelect)((e=>{const{getSettings:t}=e(r.store);return{wideControlsEnabled:t().alignWide}}),[]),g={left:Co,center:To,right:Eo,floatLeft:So,floatRight:xo,wide:Bo,full:Mo},d=c?g[c]:g[_o("alignment",t)]||Co,p=e=>o({[_o("alignment",t,!0)]:e!==_o("alignment",t)?e:"",align:""}),b=[{icon:Co,title:(0,i.__)("Align left","generateblocks"),onClick:()=>p("left"),isActive:"left"===_o("alignment",t)},{icon:To,title:(0,i.__)("Align center","generateblocks"),onClick:()=>p("center"),isActive:"center"===_o("alignment",t)},{icon:Eo,title:(0,i.__)("Align right","generateblocks"),onClick:()=>p("right"),isActive:"right"===_o("alignment",t)},{icon:So,title:(0,i.__)("Float left","generateblocks"),onClick:()=>p("floatLeft"),isActive:"floatLeft"===_o("alignment",t)},{icon:xo,title:(0,i.__)("Float right","generateblocks"),onClick:()=>p("floatRight"),isActive:"floatRight"===_o("alignment",t)}];return u&&"Desktop"===s&&b.push({icon:Bo,title:(0,i.__)("Wide width","generateblocks"),onClick:()=>o({align:"wide"!==c?"wide":"",alignment:"",alignmentTablet:"",alignmentMobile:""}),isActive:"wide"===c},{icon:Mo,title:(0,i.__)("Full width","generateblocks"),onClick:()=>o({align:"full"!==c?"full":"",alignment:"",alignmentTablet:"",alignmentMobile:""}),isActive:"full"===c}),(0,e.createElement)(n.ToolbarGroup,{isCollapsed:!0,icon:d,controls:b})}function Ro(t){const{attributes:a,setAttributes:o,onSelectImage:s,onUploadError:c,onResetImage:u,imageUrl:d,canUploadImage:b,clientId:m,deviceType:f}=t,{mediaId:h,caption:k}=a,{insertBlocks:y}=(0,l.useDispatch)("core/block-editor"),v=$(m);return(0,e.createElement)(r.BlockControls,null,(0,e.createElement)(Do,{attributes:a,setAttributes:o,deviceType:f}),0===v&&(0,e.createElement)(n.ToolbarGroup,null,(0,e.createElement)(n.ToolbarButton,{className:"gblocks-add-new-button",icon:p("caption"),label:(0,i.__)("Add Caption","generateblocks"),onClick:()=>{y((0,g.createBlock)("generateblocks/headline",{element:"figcaption",content:k,isCaption:!0}),void 0,m)},showTooltip:!0})),!!d&&(0,e.createElement)(n.ToolbarGroup,null,(0,e.createElement)(wo,{attributes:a,setAttributes:o})),!!d&&b&&(0,e.createElement)(n.ToolbarGroup,null,(0,e.createElement)(r.MediaReplaceFlow,{mediaId:h,mediaURL:d,allowedTypes:["image"],accept:"image/*",onSelect:s,onError:c},(0,e.createElement)(n.MenuItem,{onClick:u},(0,i.__)("Reset")))))}function Lo(a){const{attributes:n,setAttributes:i,name:o,clientId:c,deviceType:u,temporaryURL:g}=a,{uniqueId:d,useDynamicData:p,dynamicContentType:b,href:f,openInNewWindow:h,relNoFollow:k,relSponsored:y,sizeSlug:v,className:w,align:_}=n,C=(0,e.useRef)(),T=(0,e.useRef)(),[{loadedNaturalWidth:E,loadedNaturalHeight:S},x]=(0,e.useState)({}),{naturalWidth:B,naturalHeight:M}=(0,e.useMemo)((()=>({naturalWidth:C.current?.naturalWidth||E||void 0,naturalHeight:C.current?.naturalHeight||S||void 0})),[E,S,C.current?.complete]),{getBlockRootClientId:D}=(0,l.useSelect)((e=>e("core/block-editor")),[]),R=D(c),L=oo(a),z=so(L,v),O=(0,m.applyFilters)("generateblocks.editor.dynamicImageFallback",z,a),I=p&&b?O:n.mediaUrl,N=p&&b?L?.alt_text:n.alt,A=p&&b?L?.title?.rendered:n.title,F=(0,l.useSelect)((e=>{const{getSettings:t}=e(r.store);return t().supportsLayout||!1}),[]),P=(0,r.useBlockProps)({className:s()({"gb-block-image":!0,[`gb-block-image-${d}`]:!0,"is-applying":!!g,[`align${_}`]:!!R&&F}),"data-align":R&&!F?_:null,ref:T});P.className.includes(w)&&(P.className=P.className.replace(w,"").trim());const H=!p||p&&!b,V={src:I,alt:N,title:A,setAttributes:i,anchorAttributes:{href:f,openInNewWindow:h,relNoFollow:k,relSponsored:y,disabled:!0},imageRef:C,setLoadedNaturalSize:x,naturalWidth:B,naturalHeight:M,attributes:n,temporaryURL:g};return(0,e.createElement)(e.Fragment,null,(0,e.createElement)(Ro,t({},a,{imageUrl:I,canUploadImage:H,deviceType:u})),(0,e.createElement)(Gi,{name:o,clientId:c,align:_},(0,e.createElement)(qi,{tagName:"figure",htmlAttrs:P},g||I?(0,e.createElement)(ho,V):(0,e.createElement)(mo,t({},a,{canUploadImage:H})))))}function zo(t){const{name:a,attributes:l,context:n}=t,o=function(e,t){return"current-post"===t.dynamicSource?(t.isCaption&&(e.postId=e["generateblocks/dynamicImage"]?e["generateblocks/dynamicImage"]:e["generateblocks/mediaId"],e.postType="attachment"),Object.assign({},t,e)):t}(n,Xr(l,Object.keys(Zi))),{dynamicContentType:s,dynamicLinkType:c,termSeparator:u}=o,g=((e,t)=>{const{postId:a,postType:l}=e;if(!l)return(0,i.__)("Post type not selected.","generateblocks");if(l&&!a)return(0,i.__)("Post source not selected.","generateblocks");const[r]=(0,Z.useEntityProp)("root","site","date_format"),{load:n,loadOptions:o}=function(e,t){const a=[];let l={};return e.startsWith("author-")&&a.push("author"),"terms"===e&&(a.push("terms"),l=Object.assign({},l,{taxonomy:t.termTaxonomy})),"comments-number"===e&&a.push("comments"),{load:a,loadOptions:l}}(e.dynamicContentType,e),{record:s,isLoading:c}=zi(l,a,n,o);if("generateblocks/image"===t&&!s)return;if(c)return(0,i.__)("Loading…","generateblocks");if(!s)return(0,i.sprintf)(// translators: %1$s: post ID, %2$s: post type. -(0,i.__)("Post of id #%1$s and post type %2$s was not found.","generateblocks"),a,l);const u=Object.assign({},e,{dateFormat:r}),g="generateblocks/image"===t;return function(e,t,a){let l=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const r=Ji[e];return r&&"function"==typeof r?r(t,a,l):Qi(0,a,l)}(e.dynamicContentType,s,u,g)})(o,a),d=function(e){return{"generateblocks/headline":Wi,"generateblocks/button":$i,"generateblocks/container":bo,"generateblocks/image":Lo}[e]}(a),p="generateblocks/headline"===a?l.content:l.text;let b=l.dynamicContentType?g:p;c&&"terms"===s&&"generateblocks/headline"===a&&(b=g.split(u).map(((t,a,l)=>(0,e.createElement)(e.Fragment,null,(0,e.createElement)("a",null,t),a+1!==l.length&&u)))),"terms"===s&&"generateblocks/button"===a&&(b=g.split(u)[0]);const m=!b||"generateblocks/container"!==a&&"generateblocks/image"!==a||!function(e){try{return new URL(e),!0}catch(e){return!1}}(b)&&isNaN(parseInt(b))?void 0:b,f=Object.assign({},l,{content:"generateblocks/headline"===a?b:void 0,text:"generateblocks/button"===a?b:void 0,dynamicImage:m}),h=Object.assign({},t,{InnerContent:l.dynamicContentType?r.RichText.Content:r.RichText,attributes:f});return(0,e.createElement)(d,h)}var Oo=t=>a=>{const{attributes:l,setAttributes:r,context:n,name:i}=a,o=l.useDynamicData&&(l.dynamicContentType||l.dynamicLinkType)?Object.assign({},a,{ContentRenderer:zo}):a;return(0,e.createElement)(e.Fragment,null,(0,e.createElement)(t,o),(0,e.createElement)(Ui,{context:n,attributes:l,setAttributes:r,name:i}))},Io=(0,q.compose)(Oo,le,(t=>a=>{const{attributes:l,setAttributes:r}=a;return(0,e.useEffect)((()=>{if(void 0!==l.isDynamic&&l.isDynamic||r({isDynamic:!0}),void 0===l.blockVersion||l.blockVersion<2){let e=l.gradient&&"pseudo-element"===l.gradientSelector&&!x(l.innerZindex);e||(e=!!l.bgImage&&void 0!==l.bgOptions.selector&&"pseudo-element"===l.bgOptions.selector),e||(e=void 0!==l.useAdvBackgrounds&&l.useAdvBackgrounds),e&&r({innerZindex:1})}if(!re(l)&&ne(l.blockVersion,2)){const e=generateBlocksLegacyDefaults.v_1_4_0.container,t=void 0!==l.useGlobalStyle&&l.useGlobalStyle,a={},n=[];t||n.push("paddingTop","paddingRight","paddingBottom","paddingLeft"),l.isGrid&&n.push("width","widthMobile"),l.gradient&&n.push("gradientDirection","gradientColorOne","gradientColorOneOpacity","gradientColorTwo","gradientColorTwoOpacity"),n.forEach((t=>{x(l[t])||(a[t]=e[t])})),Object.keys(a).length>0&&r(a)}void 0===l.bgOptions.selector&&r({bgOptions:{...l.bgOptions,selector:"element"}}),void 0===l.bgOptions.opacity&&r({bgOptions:{...l.bgOptions,opacity:1}}),ne(l.blockVersion,2)&&r({blockVersion:2})}),[]),(0,e.createElement)(t,a)}))((a=>{const{attributes:l,setAttributes:r,ContentRenderer:n=bo}=a,{anchor:i,fontFamily:o,googleFont:s,googleFontVariants:c,isBlockPreview:u=!1}=l,[g,d]=W("Desktop"),p=(0,m.applyFilters)("generateblocks.editor.containerTagNames",[{label:"div",value:"div"},{label:"article",value:"article"},{label:"section",value:"section"},{label:"header",value:"header"},{label:"footer",value:"footer"},{label:"aside",value:"aside"}],a,{deviceType:g}),b=(0,m.applyFilters)("generateblocks.editor.allowedContainerTagNames",["div","article","section","header","footer","aside","a"]),f=e=>b.includes(e)?e:"div",h=[];return Object.keys(generateBlocksInfo.svgShapes).forEach((e=>{const t=generateBlocksInfo.svgShapes[e].svgs;Object.keys(t).forEach((e=>{h[e]={label:t[e].label,icon:t[e].icon}}))})),(0,e.createElement)(e.Fragment,null,(0,e.createElement)(rn,{attributes:l,setAttributes:r,deviceType:g}),(0,e.createElement)(Mi,t({},a,{deviceType:g,setDeviceType:d,state:{deviceType:g},blockDefaults:generateBlocksDefaults.container,tagNames:p,filterTagName:f,allShapes:h})),(0,e.createElement)(z,{anchor:i,setAttributes:r}),(0,e.createElement)(nn,{fontFamily:o,googleFont:s,googleFontVariants:c,isBlockPreview:u}),(0,e.createElement)(n,t({},a,{generateBlocksInfo:generateBlocksInfo,filterTagName:f,allShapes:h,deviceType:g})))})),No={uniqueId:{type:"string",default:""},anchor:{type:"string",default:""},isGrid:{type:"boolean",default:!1},isQueryLoopItem:{type:"boolean",default:!1},gridId:{type:"string",default:""},tagName:{type:"string",default:generateBlocksDefaults.container.tagName},width:{type:"number",default:generateBlocksDefaults.container.width},widthTablet:{type:"number",default:generateBlocksDefaults.container.widthTablet},widthMobile:{type:"number",default:generateBlocksDefaults.container.widthMobile},autoWidthTablet:{type:"boolean",default:generateBlocksDefaults.container.autoWidthTablet},autoWidthMobile:{type:"boolean",default:generateBlocksDefaults.container.autoWidthMobile},flexGrow:{type:"number",default:generateBlocksDefaults.container.flexGrow},flexGrowTablet:{type:"number",default:generateBlocksDefaults.container.flexGrowTablet},flexGrowMobile:{type:"number",default:generateBlocksDefaults.container.flexGrowMobile},flexShrink:{type:"number",default:generateBlocksDefaults.container.flexShrink},flexShrinkTablet:{type:"number",default:generateBlocksDefaults.container.flexShrinkTablet},flexShrinkMobile:{type:"number",default:generateBlocksDefaults.container.flexShrinkMobile},flexBasis:{type:"string",default:generateBlocksDefaults.container.flexBasis},flexBasisTablet:{type:"string",default:generateBlocksDefaults.container.flexBasisTablet},flexBasisMobile:{type:"string",default:generateBlocksDefaults.container.flexBasisMobile},flexBasisUnit:{type:"string",default:generateBlocksDefaults.container.flexBasisUnit},orderTablet:{type:"number",default:generateBlocksDefaults.container.orderTablet},orderMobile:{type:"number",default:generateBlocksDefaults.container.orderMobile},outerContainer:{type:"string",default:generateBlocksDefaults.container.outerContainer},innerContainer:{type:"string",default:generateBlocksDefaults.container.innerContainer},containerWidth:{type:"number",default:generateBlocksDefaults.container.containerWidth},minHeight:{type:"number",default:generateBlocksDefaults.container.minHeight},minHeightUnit:{type:"string",default:generateBlocksDefaults.container.minHeightUnit},minHeightTablet:{type:"number",default:generateBlocksDefaults.container.minHeightTablet},minHeightUnitTablet:{type:"string",default:generateBlocksDefaults.container.minHeightUnitTablet},minHeightMobile:{type:"number",default:generateBlocksDefaults.container.minHeightMobile},minHeightUnitMobile:{type:"string",default:generateBlocksDefaults.container.minHeightUnitMobile},paddingTop:{type:"string",default:generateBlocksDefaults.container.paddingTop},paddingRight:{type:"string",default:generateBlocksDefaults.container.paddingRight},paddingBottom:{type:"string",default:generateBlocksDefaults.container.paddingBottom},paddingLeft:{type:"string",default:generateBlocksDefaults.container.paddingLeft},paddingUnit:{type:"string",default:generateBlocksDefaults.container.paddingUnit},paddingSyncUnits:{type:"boolean",default:!1},paddingTopTablet:{type:"string",default:generateBlocksDefaults.container.paddingTopTablet},paddingRightTablet:{type:"string",default:generateBlocksDefaults.container.paddingRightTablet},paddingBottomTablet:{type:"string",default:generateBlocksDefaults.container.paddingBottomTablet},paddingLeftTablet:{type:"string",default:generateBlocksDefaults.container.paddingLeftTablet},paddingTopMobile:{type:"string",default:generateBlocksDefaults.container.paddingTopMobile},paddingRightMobile:{type:"string",default:generateBlocksDefaults.container.paddingRightMobile},paddingBottomMobile:{type:"string",default:generateBlocksDefaults.container.paddingBottomMobile},paddingLeftMobile:{type:"string",default:generateBlocksDefaults.container.paddingLeftMobile},marginTop:{type:"string",default:generateBlocksDefaults.container.marginTop},marginRight:{type:"string",default:generateBlocksDefaults.container.marginRight},marginBottom:{type:"string",default:generateBlocksDefaults.container.marginBottom},marginLeft:{type:"string",default:generateBlocksDefaults.container.marginLeft},marginUnit:{type:"string",default:generateBlocksDefaults.container.marginUnit},marginSyncUnits:{type:"boolean",default:!1},marginTopTablet:{type:"string",default:generateBlocksDefaults.container.marginTopTablet},marginRightTablet:{type:"string",default:generateBlocksDefaults.container.marginRightTablet},marginBottomTablet:{type:"string",default:generateBlocksDefaults.container.marginBottomTablet},marginLeftTablet:{type:"string",default:generateBlocksDefaults.container.marginLeftTablet},marginTopMobile:{type:"string",default:generateBlocksDefaults.container.marginTopMobile},marginRightMobile:{type:"string",default:generateBlocksDefaults.container.marginRightMobile},marginBottomMobile:{type:"string",default:generateBlocksDefaults.container.marginBottomMobile},marginLeftMobile:{type:"string",default:generateBlocksDefaults.container.marginLeftMobile},borderSizeTop:{type:"string",default:generateBlocksDefaults.container.borderSizeTop},borderSizeRight:{type:"string",default:generateBlocksDefaults.container.borderSizeRight},borderSizeBottom:{type:"string",default:generateBlocksDefaults.container.borderSizeBottom},borderSizeLeft:{type:"string",default:generateBlocksDefaults.container.borderSizeLeft},borderSizeTopTablet:{type:"string",default:generateBlocksDefaults.container.borderSizeTopTablet},borderSizeRightTablet:{type:"string",default:generateBlocksDefaults.container.borderSizeRightTablet},borderSizeBottomTablet:{type:"string",default:generateBlocksDefaults.container.borderSizeBottomTablet},borderSizeLeftTablet:{type:"string",default:generateBlocksDefaults.container.borderSizeLeftTablet},borderSizeTopMobile:{type:"string",default:generateBlocksDefaults.container.borderSizeTopMobile},borderSizeRightMobile:{type:"string",default:generateBlocksDefaults.container.borderSizeRightMobile},borderSizeBottomMobile:{type:"string",default:generateBlocksDefaults.container.borderSizeBottomMobile},borderSizeLeftMobile:{type:"string",default:generateBlocksDefaults.container.borderSizeLeftMobile},borderRadiusTopRight:{type:"string",default:generateBlocksDefaults.container.borderRadiusTopRight},borderRadiusBottomRight:{type:"string",default:generateBlocksDefaults.container.borderRadiusBottomRight},borderRadiusBottomLeft:{type:"string",default:generateBlocksDefaults.container.borderRadiusBottomLeft},borderRadiusTopLeft:{type:"string",default:generateBlocksDefaults.container.borderRadiusTopLeft},borderRadiusUnit:{type:"string",default:generateBlocksDefaults.container.borderRadiusUnit},borderRadiusTopRightTablet:{type:"string",default:generateBlocksDefaults.container.borderRadiusTopRightTablet},borderRadiusBottomRightTablet:{type:"string",default:generateBlocksDefaults.container.borderRadiusBottomRightTablet},borderRadiusBottomLeftTablet:{type:"string",default:generateBlocksDefaults.container.borderRadiusBottomLeftTablet},borderRadiusTopLeftTablet:{type:"string",default:generateBlocksDefaults.container.borderRadiusTopLeftTablet},borderRadiusTopRightMobile:{type:"string",default:generateBlocksDefaults.container.borderRadiusTopRightMobile},borderRadiusBottomRightMobile:{type:"string",default:generateBlocksDefaults.container.borderRadiusBottomRightMobile},borderRadiusBottomLeftMobile:{type:"string",default:generateBlocksDefaults.container.borderRadiusBottomLeftMobile},borderRadiusTopLeftMobile:{type:"string",default:generateBlocksDefaults.container.borderRadiusTopLeftMobile},borderColor:{type:"string",default:generateBlocksDefaults.container.borderColor},borderColorOpacity:{type:"number",default:generateBlocksDefaults.container.borderColorOpacity},backgroundColor:{type:"string",default:generateBlocksDefaults.container.backgroundColor},backgroundColorOpacity:{type:"number",default:generateBlocksDefaults.container.backgroundColorOpacity},gradient:{type:"boolean",default:generateBlocksDefaults.container.gradient},gradientDirection:{type:"number",default:generateBlocksDefaults.container.gradientDirection},gradientColorOne:{type:"string",default:generateBlocksDefaults.container.gradientColorOne},gradientColorOneOpacity:{type:"number",default:generateBlocksDefaults.container.gradientColorOneOpacity},gradientColorStopOne:{type:"number",default:generateBlocksDefaults.container.gradientColorStopOne},gradientColorTwo:{type:"string",default:generateBlocksDefaults.container.gradientColorTwo},gradientColorTwoOpacity:{type:"number",default:generateBlocksDefaults.container.gradientColorTwoOpacity},gradientColorStopTwo:{type:"number",default:generateBlocksDefaults.container.gradientColorStopTwo},gradientSelector:{type:"string",default:"element"},textColor:{type:"string",default:generateBlocksDefaults.container.textColor},linkColor:{type:"string",default:generateBlocksDefaults.container.linkColor},linkColorHover:{type:"string",default:generateBlocksDefaults.container.linkColorHover},bgImage:{type:"object",default:generateBlocksDefaults.container.bgImage},bgOptions:{type:"object",default:{selector:generateBlocksDefaults.container.bgOptions.selector,opacity:generateBlocksDefaults.container.bgOptions.opacity,overlay:generateBlocksDefaults.container.bgOptions.overlay,position:generateBlocksDefaults.container.bgOptions.position,size:generateBlocksDefaults.container.bgOptions.size,repeat:generateBlocksDefaults.container.bgOptions.repeat,attachment:generateBlocksDefaults.container.bgOptions.attachment}},bgImageSize:{type:"string",default:generateBlocksDefaults.container.bgImageSize},bgImageInline:{type:"boolean",default:generateBlocksDefaults.container.bgImageInline},verticalAlignment:{type:"string",default:generateBlocksDefaults.container.verticalAlignment},verticalAlignmentTablet:{type:"string",default:generateBlocksDefaults.container.verticalAlignmentTablet},verticalAlignmentMobile:{type:"string",default:generateBlocksDefaults.container.verticalAlignmentMobile},zindex:{type:"number",default:generateBlocksDefaults.container.zindex},innerZindex:{type:"number",default:generateBlocksDefaults.container.innerZindex},removeVerticalGap:{type:"boolean",default:generateBlocksDefaults.container.removeVerticalGap},removeVerticalGapTablet:{type:"boolean",default:generateBlocksDefaults.container.removeVerticalGapTablet},removeVerticalGapMobile:{type:"boolean",default:generateBlocksDefaults.container.removeVerticalGapMobile},alignment:{type:"string",default:generateBlocksDefaults.container.alignment},alignmentTablet:{type:"string",default:generateBlocksDefaults.container.alignmentTablet},alignmentMobile:{type:"string",default:generateBlocksDefaults.container.alignmentMobile},fontFamily:{type:"string",default:generateBlocksDefaults.container.fontFamily},fontFamilyFallback:{type:"string",default:generateBlocksDefaults.container.fontFamilyFallback},googleFont:{type:"boolean",default:generateBlocksDefaults.container.googleFont},googleFontVariants:{type:"string",default:generateBlocksDefaults.container.googleFontVariants},fontWeight:{type:"string",default:generateBlocksDefaults.container.fontWeight},fontSize:{type:"number",default:generateBlocksDefaults.container.fontSize},fontSizeTablet:{type:"number",default:generateBlocksDefaults.container.fontSizeTablet},fontSizeMobile:{type:"number",default:generateBlocksDefaults.container.fontSizeMobile},fontSizeUnit:{type:"string",default:generateBlocksDefaults.container.fontSizeUnit},textTransform:{type:"string",default:""},align:{type:"string",default:""},shapeDividers:{type:"array",default:[]},isDynamic:{type:"boolean"},blockVersion:{type:"number"},elementId:{type:"string",default:""},cssClasses:{type:"string",default:""}};const Ao=[{attributes:No,supports:{align:!1,anchor:!1,className:!1,customClassName:!1},migrate(e){const t=e.cssClasses?e.cssClasses:e.className,a=e.elementId?e.elementId:e.anchor;return{...e,className:t,anchor:a,cssClasses:"",elementId:""}},save(t){let{attributes:a}=t;const{uniqueId:l,tagName:n,elementId:i,cssClasses:o,isGrid:c,align:u}=a;let g={className:s()({"gb-container":!0,[`gb-container-${l}`]:!0,[`${o}`]:""!==o,[`align${u}`]:!!u&&!c}),id:i||null};return g=(0,m.applyFilters)("generateblocks.frontend.htmlAttributes",g,"generateblocks/container",a),(0,e.createElement)((e=>{let{condition:t,wrap:a,children:l}=e;return t?a(l):l}),{condition:c,wrap:t=>(0,e.createElement)("div",{className:s()({"gb-grid-column":!0,[`gb-grid-column-${l}`]:!0})},t)},(0,e.createElement)(qi,{tagName:n,htmlAttrs:g},(0,m.applyFilters)("generateblocks.frontend.insideContainer","",a),(0,e.createElement)("div",{className:s()({"gb-inside-container":!0})},(0,e.createElement)(r.InnerBlocks.Content,null))))}}];var Fo=Ao;const Po=Object.assign({},No,Zi);(0,g.registerBlockType)("generateblocks/container",{apiVersion:2,title:(0,i.__)("Container","generateblocks"),description:(0,i.__)("Organize your content into rows and sections.","generateblocks"),icon:p("container"),category:"generateblocks",keywords:[(0,i.__)("section"),(0,i.__)("container"),(0,i.__)("generate")],attributes:Po,supports:{align:!1,className:!1,html:!1},usesContext:["postId","postType","generateblocks/queryId"],edit:Io,save:()=>(0,e.createElement)(r.InnerBlocks.Content,null),deprecated:Fo,__experimentalLabel:e=>e.isQueryLoopItem?(0,i.__)("Post Template","generateblocks"):(0,i.__)("Container","generateblocks")});var Ho=(0,e.createElement)(T.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(T.Path,{d:"M18 11.2h-5.2V6h-1.6v5.2H6v1.6h5.2V18h1.6v-5.2H18z"}));const Vo=[{icon:Co,title:(0,i.__)("Align buttons left","generateblocks"),align:"left"},{icon:To,title:(0,i.__)("Align buttons center","generateblocks"),align:"center"},{icon:Eo,title:(0,i.__)("Align buttons right","generateblocks"),align:"right"}];var Uo=t=>{const{attributes:a,setAttributes:o,clientId:s,deviceType:c}=t,{alignment:u,alignmentTablet:d,alignmentMobile:p,isPagination:b}=a,{insertBlocks:m}=(0,l.useDispatch)("core/block-editor"),{getBlocksByClientId:f}=(0,l.useSelect)((e=>e("core/block-editor")),[]);return(0,e.createElement)(r.BlockControls,null,!b&&(0,e.createElement)(n.ToolbarGroup,null,(0,e.createElement)(n.ToolbarButton,{className:"gblocks-add-new-button",icon:Ho,label:(0,i.__)("Add Button","generateblocks"),onClick:()=>{const e=f(s)[0];if(e){const t=e.innerBlocks,a=Object.keys(t),l=a[a.length-1];if(void 0!==t[l]){const e=t[l].clientId;if(e){const t=f(e)[0],a=(0,g.cloneBlock)(t,{uniqueId:""});m(a,void 0,s)}}else 0===t.length&&m((0,g.createBlock)("generateblocks/button",generateBlocksStyling.button),void 0,s)}},showTooltip:!0})),"Desktop"===c&&(0,e.createElement)(r.AlignmentToolbar,{value:u,alignmentControls:Vo,onChange:e=>{o({alignment:e})}}),"Tablet"===c&&(0,e.createElement)(r.AlignmentToolbar,{value:d,alignmentControls:Vo,onChange:e=>{o({alignmentTablet:e})}}),"Mobile"===c&&(0,e.createElement)(r.AlignmentToolbar,{value:p,alignmentControls:Vo,onChange:e=>{o({alignmentMobile:e})}}))},Go=a=>{const{attributes:l,setAttributes:o,deviceType:s,state:c}=a,{stack:u,stackTablet:g,stackMobile:d,fillHorizontalSpace:b,fillHorizontalSpaceTablet:f,fillHorizontalSpaceMobile:h}=l;return(0,e.createElement)(r.InspectorControls,null,(0,e.createElement)(C,t({},a,{title:(0,i.__)("Spacing","generateblocks"),initialOpen:!0,icon:p("spacing"),className:"gblocks-panel-label",id:"buttonContainerSpacing",state:c}),(0,e.createElement)(dn,t({},a,{device:s,type:"margin",label:(0,i.__)("Margin","generateblocks"),units:["px","em","%"]})),"Desktop"===s&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.ToggleControl,{label:(0,i.__)("Stack Vertically","generateblocks"),checked:!!u,onChange:e=>{o({stack:e,stackTablet:e&&!g?e:g,stackMobile:e&&!d?e:d})}}),(0,e.createElement)(n.ToggleControl,{label:(0,i.__)("Fill Horizontal Space","generateblocks"),checked:!!b,onChange:e=>{o({fillHorizontalSpace:e,fillHorizontalSpaceTablet:e&&!f?e:f,fillHorizontalSpaceMobile:e&&!h?e:h})}})),"Tablet"===s&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.ToggleControl,{label:(0,i.__)("Stack Vertically","generateblocks"),checked:!!g,onChange:e=>{o({stackTablet:e,stackMobile:e&&!d?e:d})}}),(0,e.createElement)(n.ToggleControl,{label:(0,i.__)("Fill Horizontal Space","generateblocks"),checked:!!f,onChange:e=>{o({fillHorizontalSpaceTablet:e,fillHorizontalSpaceMobile:e&&!h?e:h})}})),"Mobile"===s&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.ToggleControl,{label:(0,i.__)("Stack Vertically","generateblocks"),checked:!!d,onChange:e=>{o({stackMobile:e})}}),(0,e.createElement)(n.ToggleControl,{label:(0,i.__)("Fill Horizontal Space","generateblocks"),checked:!!h,onChange:e=>{o({fillHorizontalSpaceMobile:e})}})),(0,m.applyFilters)("generateblocks.editor.controls","","buttonContainerSpacing",a,c)))};function jo(e){return"left"===e||"top"===e?"flex-start":"right"===e||"bottom"===e?"flex-end":e}class qo extends e.Component{render(){const t=(0,m.applyFilters)("generateblocks.editor.cssAttrs",this.props.attributes,this.props),{uniqueId:a,alignment:l,stack:r,fillHorizontalSpace:n}=t;let i=[];return i[".gb-button-wrapper-"+a]=[{display:!!n&&"block","flex-direction":!!r&&"column","align-items":!!r&&jo(l)}],i[".gb-button-wrapper-"+a+" > .block-editor-inner-blocks > .block-editor-block-list__layout"]=[{"flex-direction":!!r&&"column","align-items":!!r&&jo(l)}],n&&(i[".gb-button-wrapper-"+a+" > .block-editor-inner-blocks > .block-editor-block-list__layout > .wp-block"]=[{flex:"1"}],i[".gb-button-wrapper-"+a+" > .components-button"]=[{background:"#fff",border:"1px solid #ddd","margin-top":"10px"}]),r&&n&&(i[".gb-button-wrapper-"+a+" > .block-editor-inner-blocks > .block-editor-block-list__layout > .wp-block"]=[{width:"100% !important","box-sizing":"border-box"}]),i=(0,m.applyFilters)("generateblocks.editor.desktopCSS",i,this.props,"button-container"),(0,e.createElement)("style",null,O(i))}}class Wo extends e.Component{render(){const t=(0,m.applyFilters)("generateblocks.editor.cssAttrs",this.props.attributes,this.props),{uniqueId:a,alignmentTablet:l,marginTopTablet:r,marginRightTablet:n,marginBottomTablet:i,marginLeftTablet:o,marginUnit:s}=t;let c=[];return c[".editor-styles-wrapper .gb-button-wrapper-"+a]=[{"margin-top":I(r,s),"margin-right":I(n,s),"margin-bottom":I(i,s),"margin-left":I(o,s),"justify-content":jo(l)}],c[".gb-button-wrapper-"+a+" > .block-editor-inner-blocks > .block-editor-block-list__layout"]=[{"justify-content":jo(l)}],c=(0,m.applyFilters)("generateblocks.editor.tabletCSS",c,this.props,"button-container"),(0,e.createElement)("style",null,O(c))}}class $o extends e.Component{render(){const t=(0,m.applyFilters)("generateblocks.editor.cssAttrs",this.props.attributes,this.props),{uniqueId:a,alignmentTablet:l,stackTablet:r,fillHorizontalSpaceTablet:n}=t;let i=[];return i[".gb-button-wrapper-"+a]=[{display:!!n&&"block","flex-direction":!!r&&"column","align-items":!!r&&jo(l)}],i[".gb-button-wrapper-"+a+" > .block-editor-inner-blocks > .block-editor-block-list__layout"]=[{"flex-direction":!!r&&"column","align-items":!!r&&jo(l)}],n&&(i[".gb-button-wrapper-"+a+" > .block-editor-inner-blocks > .block-editor-block-list__layout > .wp-block"]=[{flex:"1"}],i[".gb-button-wrapper-"+a+" > .components-button"]=[{background:"#fff",border:"1px solid #ddd","margin-top":"10px"}]),r&&n&&(i[".gb-button-wrapper-"+a+" > .block-editor-inner-blocks > .block-editor-block-list__layout > .wp-block"]=[{width:"100% !important","box-sizing":"border-box"}]),i=(0,m.applyFilters)("generateblocks.editor.tabletOnlyCSS",i,this.props,"button-container"),(0,e.createElement)("style",null,O(i))}}class Zo extends e.Component{render(){const t=(0,m.applyFilters)("generateblocks.editor.cssAttrs",this.props.attributes,this.props),{uniqueId:a,alignmentMobile:l,marginTopMobile:r,marginRightMobile:n,marginBottomMobile:i,marginLeftMobile:o,marginUnit:s,stackMobile:c,fillHorizontalSpaceMobile:u}=t;let g=[];return g[".editor-styles-wrapper .gb-button-wrapper-"+a]=[{display:!!u&&"block","margin-top":I(r,s),"margin-right":I(n,s),"margin-bottom":I(i,s),"margin-left":I(o,s),"justify-content":jo(l),"flex-direction":!!c&&"column","align-items":!!c&&jo(l)}],g[".gb-button-wrapper-"+a+" > .block-editor-inner-blocks > .block-editor-block-list__layout"]=[{"flex-direction":!!c&&"column","align-items":!!c&&jo(l),"justify-content":jo(l)}],u&&(g[".gb-button-wrapper-"+a+" > .block-editor-inner-blocks > .block-editor-block-list__layout > .wp-block"]=[{flex:"1"}],g[".gb-button-wrapper-"+a+" > .components-button"]=[{background:"#fff",border:"1px solid #ddd","margin-top":"10px"}]),c&&u&&(g[".gb-button-wrapper-"+a+" > .block-editor-inner-blocks > .block-editor-block-list__layout > .wp-block"]=[{width:"100% !important","box-sizing":"border-box"}]),g=(0,m.applyFilters)("generateblocks.editor.mobileCSS",g,this.props,"button-container"),(0,e.createElement)("style",null,O(g))}}class Ko extends e.Component{render(){const t=(0,m.applyFilters)("generateblocks.editor.cssAttrs",this.props.attributes,this.props),{uniqueId:a,alignment:l,marginTop:r,marginRight:n,marginBottom:i,marginLeft:o,marginUnit:s}=t;let c=[];return c[".editor-styles-wrapper .gb-button-wrapper-"+a]=[{margin:io(r,n,i,o,s),"justify-content":jo(l)}],c[".gb-button-wrapper-"+a+" > .block-editor-inner-blocks > .block-editor-block-list__layout"]=[{"justify-content":jo(l)}],c=(0,m.applyFilters)("generateblocks.editor.mainCSS",c,this.props,"button-container"),(0,e.createElement)("style",null,O(c))}}var Jo=(0,e.memo)((function(t){const a=(0,l.useSelect)((e=>{if(!e("core/edit-post"))return"Desktop";const{__experimentalGetPreviewDeviceType:t=(()=>"Desktop")}=e("core/edit-post");return t()}),[]),{isBlockPreview:r=!1}=t?.attributes;return r?null:(0,e.createElement)(e.Fragment,null,(0,e.createElement)(Ko,t),a&&(0,e.createElement)(e.Fragment,null,"Desktop"===a&&(0,e.createElement)(qo,t),("Tablet"===a||"Mobile"===a)&&(0,e.createElement)(Wo,t),"Tablet"===a&&(0,e.createElement)($o,t),"Mobile"===a&&(0,e.createElement)(Zo,t)))}),G),Qo=(0,q.compose)(le,(t=>a=>{const{attributes:l,setAttributes:r}=a;return(0,e.useEffect)((()=>{void 0!==l.isDynamic&&l.isDynamic||r({isDynamic:!0}),(void 0===l.blockVersion||l.blockVersion<2)&&(l.stack||l.fillHorizontalSpace)&&(l.stack&&r({stackTablet:!0,stackMobile:!0}),l.fillHorizontalSpace&&r({fillHorizontalSpaceTablet:!0,fillHorizontalSpaceMobile:!0})),(void 0===l.blockVersion||l.blockVersion<2)&&r({blockVersion:2})}),[]),(0,e.createElement)(t,a)}))((a=>{const{attributes:n,setAttributes:i,clientId:o,name:c,context:u}=a,{uniqueId:d,className:p,anchor:b}=n,[f,h]=(0,e.useState)(0),[k,y]=W("Desktop"),v=$(o),{insertBlocks:w,removeBlock:_}=(0,l.useDispatch)("core/block-editor");(0,e.useEffect)((()=>{0===v&&w((0,g.createBlock)("generateblocks/button",generateBlocksStyling.button),void 0,o),h(v)}),[]),(0,e.useEffect)((()=>{1===f&&0===v&&_(o),h(v)}),[v]);let C={className:s()({"gb-button-wrapper":!0,[`gb-button-wrapper-${d}`]:!0,[`${p}`]:void 0!==p}),id:b||null};C=(0,m.applyFilters)("generateblocks.frontend.htmlAttributes",C,"generateblocks/button-container",n);const T=(0,r.useBlockProps)(C);return(0,e.createElement)(e.Fragment,null,(0,e.createElement)(Uo,{attributes:n,setAttributes:i,clientId:o,deviceType:k}),(0,e.createElement)(Go,t({},a,{deviceType:k,setDeviceType:y,state:{deviceType:k},blockDefaults:generateBlocksDefaults.buttonContainer})),(0,e.createElement)(z,{anchor:b,setAttributes:i}),(0,e.createElement)(Jo,t({},a,{deviceType:k})),(0,e.createElement)(Gi,{name:c,clientId:o},(0,e.createElement)("div",T,(0,e.createElement)(r.BlockContextProvider,{value:{"generateblocks/query":u["generateblocks/query"]}},(0,e.createElement)(r.InnerBlocks,{allowedBlocks:["generateblocks/button"],renderAppender:!1})))))})),Yo={uniqueId:{type:"string",default:""},anchor:{type:"string",default:""},isPagination:{type:"boolean",default:!1},alignment:{type:"string",default:generateBlocksDefaults.buttonContainer.alignment},alignmentTablet:{type:"string",default:generateBlocksDefaults.buttonContainer.alignment},alignmentMobile:{type:"string",default:generateBlocksDefaults.buttonContainer.alignment},marginTop:{type:"string",default:generateBlocksDefaults.buttonContainer.marginTop},marginRight:{type:"string",default:generateBlocksDefaults.buttonContainer.marginRight},marginBottom:{type:"string",default:generateBlocksDefaults.buttonContainer.marginBottom},marginLeft:{type:"string",default:generateBlocksDefaults.buttonContainer.marginLeft},marginUnit:{type:"string",default:generateBlocksDefaults.buttonContainer.marginUnit},marginTopTablet:{type:"string",default:generateBlocksDefaults.buttonContainer.marginTopTablet},marginRightTablet:{type:"string",default:generateBlocksDefaults.buttonContainer.marginRightTablet},marginBottomTablet:{type:"string",default:generateBlocksDefaults.buttonContainer.marginBottomTablet},marginLeftTablet:{type:"string",default:generateBlocksDefaults.buttonContainer.marginLeftTablet},marginTopMobile:{type:"string",default:generateBlocksDefaults.buttonContainer.marginTopMobile},marginRightMobile:{type:"string",default:generateBlocksDefaults.buttonContainer.marginRightMobile},marginBottomMobile:{type:"string",default:generateBlocksDefaults.buttonContainer.marginBottomMobile},marginLeftMobile:{type:"string",default:generateBlocksDefaults.buttonContainer.marginLeftMobile},stack:{type:"boolean",default:generateBlocksDefaults.buttonContainer.stack},stackTablet:{type:"boolean",default:generateBlocksDefaults.buttonContainer.stackTablet},stackMobile:{type:"boolean",default:generateBlocksDefaults.buttonContainer.stackMobile},fillHorizontalSpace:{type:"boolean",default:generateBlocksDefaults.buttonContainer.fillHorizontalSpace},fillHorizontalSpaceTablet:{type:"boolean",default:generateBlocksDefaults.buttonContainer.fillHorizontalSpaceTablet},fillHorizontalSpaceMobile:{type:"boolean",default:generateBlocksDefaults.buttonContainer.fillHorizontalSpaceMobile},isDynamic:{type:"boolean"},blockVersion:{type:"number"},elementId:{type:"string",default:""},cssClasses:{type:"string",default:""}};const Xo=[{attributes:Yo,supports:{anchor:!1,className:!1,customClassName:!1},migrate(e){const t=e.cssClasses?e.cssClasses:e.className,a=e.elementId?e.elementId:e.anchor;return{...e,className:t,anchor:a,cssClasses:"",elementId:""}},save(t){let{attributes:a}=t;const{uniqueId:l,elementId:n,cssClasses:i}=a;let o={id:n||void 0,className:s()({"gb-button-wrapper":!0,[`gb-button-wrapper-${l}`]:!0,[`${i}`]:""!==i})};return o=(0,m.applyFilters)("generateblocks.frontend.htmlAttributes",o,"generateblocks/button-container",a),(0,e.createElement)("div",o,(0,e.createElement)(r.InnerBlocks.Content,null))}}];var es=Xo;(0,g.registerBlockType)("generateblocks/button-container",{apiVersion:2,title:(0,i.__)("Buttons","generateblocks"),description:(0,i.__)("Drive conversions with beautiful buttons.","generateblocks"),icon:p("button-container"),category:"generateblocks",keywords:[(0,i.__)("button"),(0,i.__)("buttons"),(0,i.__)("generate")],attributes:Yo,supports:{className:!1,html:!1},usesContext:["generateblocks/queryId","generateblocks/query"],edit:Qo,save:()=>(0,e.createElement)(r.InnerBlocks.Content,null),deprecated:es,__experimentalLabel:e=>e.isPagination?(0,i.__)("Pagination","generateblocks"):(0,i.__)("Buttons","generateblocks")});var ts=t=>{let{clientId:a,attributes:o,setAttributes:s}=t;const{insertBlocks:c}=(0,l.useDispatch)("core/block-editor"),{getBlockParentsByBlockName:u,getBlockRootClientId:d,getBlocksByClientId:p}=(0,l.useSelect)((e=>e("core/block-editor")),[]),{url:b,target:f,relNoFollow:h,relSponsored:k,useDynamicData:y,dynamicLinkType:v}=o,w=y&&v;return(0,e.createElement)(e.Fragment,null,(0,e.createElement)(r.BlockControls,null,(0,e.createElement)(n.ToolbarGroup,null,(0,e.createElement)(n.ToolbarButton,{className:"gblocks-add-new-button",icon:Ho,label:(0,i.__)("Add Button","generateblocks"),onClick:()=>{let e=!1;e="function"==typeof u?u(a,"generateblocks/button-container",!0)[0]:d(a);const t=p(a)[0],l=(0,g.cloneBlock)(t,{uniqueId:""});c(l,void 0,e)},showTooltip:!0})),(0,e.createElement)(n.ToolbarGroup,null,(!y||w)&&(0,e.createElement)(n.Dropdown,{contentClassName:"gblocks-button-link-dropdown",popoverProps:{className:"block-editor-block-settings-menu__popover",position:"bottom right"},renderToggle:t=>{let{isOpen:a,onToggle:l}=t;return(0,e.createElement)(n.ToolbarButton,{icon:un,label:b?(0,i.__)("Change Link","generateblocks"):(0,i.__)("Add Link","generateblocks"),onClick:l,"aria-expanded":a,isPressed:!!b})},renderContent:()=>(0,e.createElement)(e.Fragment,null,!y&&(0,e.createElement)(r.URLInput,{className:"gblocks-button-link",value:b,onChange:e=>{s({url:e,hasUrl:!!e})}}),!!y&&(0,e.createElement)("div",{style:{width:"300px","font-style":"italic","margin-bottom":v?"15px":"0"}},(0,i.__)("This button is using a dynamic link.","generateblocks")),(0,m.applyFilters)("generateblocks.editor.urlInputMoreOptions","",o),(!!b||w)&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.ToggleControl,{label:(0,i.__)("Open link in a new tab","generateblocks"),checked:f||"",onChange:e=>{s({target:e})}}),(0,e.createElement)(n.ToggleControl,{label:(0,i.__)('Add rel="nofollow"',"generateblocks"),checked:h||"",onChange:e=>{s({relNoFollow:e})}}),(0,e.createElement)(n.ToggleControl,{label:(0,i.__)('Add rel="sponsored"',"generateblocks"),checked:k||"",onChange:e=>{s({relSponsored:e})}})))}))))},as={facebook:{label:(0,i._x)("Facebook","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 320 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M279.14 288l14.22-92.66h-88.91v-60.13c0-25.35 12.42-50.06 52.24-50.06h40.42V6.26S260.43 0 225.36 0c-73.22 0-121.08 44.38-121.08 124.72v70.62H22.89V288h81.39v224h100.17V288z"}))},facebookCircle:{label:(0,i._x)("Facebook - Circle","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M504 256C504 119 393 8 256 8S8 119 8 256c0 123.78 90.69 226.38 209.25 245V327.69h-63V256h63v-54.64c0-62.15 37-96.48 93.67-96.48 27.14 0 55.52 4.84 55.52 4.84v61h-31.28c-30.8 0-40.41 19.12-40.41 38.73V256h68.78l-11 71.69h-57.78V501C413.31 482.38 504 379.78 504 256z"}))},facebookSquare:{label:(0,i._x)("Facebook - Square","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 448 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M400 32H48A48 48 0 0 0 0 80v352a48 48 0 0 0 48 48h137.25V327.69h-63V256h63v-54.64c0-62.15 37-96.48 93.67-96.48 27.14 0 55.52 4.84 55.52 4.84v61h-31.27c-30.81 0-40.42 19.12-40.42 38.73V256h68.78l-11 71.69h-57.78V480H400a48 48 0 0 0 48-48V80a48 48 0 0 0-48-48z"}))},instagram:{label:(0,i._x)("Instagram","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 448 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M224.1 141c-63.6 0-114.9 51.3-114.9 114.9s51.3 114.9 114.9 114.9S339 319.5 339 255.9 287.7 141 224.1 141zm0 189.6c-41.1 0-74.7-33.5-74.7-74.7s33.5-74.7 74.7-74.7 74.7 33.5 74.7 74.7-33.6 74.7-74.7 74.7zm146.4-194.3c0 14.9-12 26.8-26.8 26.8-14.9 0-26.8-12-26.8-26.8s12-26.8 26.8-26.8 26.8 12 26.8 26.8zm76.1 27.2c-1.7-35.9-9.9-67.7-36.2-93.9-26.2-26.2-58-34.4-93.9-36.2-37-2.1-147.9-2.1-184.9 0-35.8 1.7-67.6 9.9-93.9 36.1s-34.4 58-36.2 93.9c-2.1 37-2.1 147.9 0 184.9 1.7 35.9 9.9 67.7 36.2 93.9s58 34.4 93.9 36.2c37 2.1 147.9 2.1 184.9 0 35.9-1.7 67.7-9.9 93.9-36.2 26.2-26.2 34.4-58 36.2-93.9 2.1-37 2.1-147.8 0-184.8zM398.8 388c-7.8 19.6-22.9 34.7-42.6 42.6-29.5 11.7-99.5 9-132.1 9s-102.7 2.6-132.1-9c-19.6-7.8-34.7-22.9-42.6-42.6-11.7-29.5-9-99.5-9-132.1s-2.6-102.7 9-132.1c7.8-19.6 22.9-34.7 42.6-42.6 29.5-11.7 99.5-9 132.1-9s102.7-2.6 132.1 9c19.6 7.8 34.7 22.9 42.6 42.6 11.7 29.5 9 99.5 9 132.1s2.7 102.7-9 132.1z"}))},linkedin:{label:(0,i._x)("LinkedIn","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 448 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M100.28 448H7.4V148.9h92.88zM53.79 108.1C24.09 108.1 0 83.5 0 53.8a53.79 53.79 0 0 1 107.58 0c0 29.7-24.1 54.3-53.79 54.3zM447.9 448h-92.68V302.4c0-34.7-.7-79.2-48.29-79.2-48.29 0-55.69 37.7-55.69 76.7V448h-92.78V148.9h89.08v40.8h1.3c12.4-23.5 42.69-48.3 87.88-48.3 94 0 111.28 61.9 111.28 142.3V448z"}))},linkedinSquare:{label:(0,i._x)("LinkedIn - Square","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 448 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M416 32H31.9C14.3 32 0 46.5 0 64.3v383.4C0 465.5 14.3 480 31.9 480H416c17.6 0 32-14.5 32-32.3V64.3c0-17.8-14.4-32.3-32-32.3zM135.4 416H69V202.2h66.5V416zm-33.2-243c-21.3 0-38.5-17.3-38.5-38.5S80.9 96 102.2 96c21.2 0 38.5 17.3 38.5 38.5 0 21.3-17.2 38.5-38.5 38.5zm282.1 243h-66.4V312c0-24.8-.5-56.7-34.5-56.7-34.6 0-39.9 27-39.9 54.9V416h-66.4V202.2h63.7v29.2h.9c8.9-16.8 30.6-34.5 62.9-34.5 67.2 0 79.7 44.3 79.7 101.9V416z"}))},pinterest:{label:(0,i._x)("Pinterest","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 384 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M204 6.5C101.4 6.5 0 74.9 0 185.6 0 256 39.6 296 63.6 296c9.9 0 15.6-27.6 15.6-35.4 0-9.3-23.7-29.1-23.7-67.8 0-80.4 61.2-137.4 140.4-137.4 68.1 0 118.5 38.7 118.5 109.8 0 53.1-21.3 152.7-90.3 152.7-24.9 0-46.2-18-46.2-43.8 0-37.8 26.4-74.4 26.4-113.4 0-66.2-93.9-54.2-93.9 25.8 0 16.8 2.1 35.4 9.6 50.7-13.8 59.4-42 147.9-42 209.1 0 18.9 2.7 37.5 4.5 56.4 3.4 3.8 1.7 3.4 6.9 1.5 50.4-69 48.6-82.5 71.4-172.8 12.3 23.4 44.1 36 69.3 36 106.2 0 153.9-103.5 153.9-196.8C384 71.3 298.2 6.5 204 6.5z"}))},pinterestCircle:{label:(0,i._x)("Pinterest - Circle","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 496 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M496 256c0 137-111 248-248 248-25.6 0-50.2-3.9-73.4-11.1 10.1-16.5 25.2-43.5 30.8-65 3-11.6 15.4-59 15.4-59 8.1 15.4 31.7 28.5 56.8 28.5 74.8 0 128.7-68.8 128.7-154.3 0-81.9-66.9-143.2-152.9-143.2-107 0-163.9 71.8-163.9 150.1 0 36.4 19.4 81.7 50.3 96.1 4.7 2.2 7.2 1.2 8.3-3.3.8-3.4 5-20.3 6.9-28.1.6-2.5.3-4.7-1.7-7.1-10.1-12.5-18.3-35.3-18.3-56.6 0-54.7 41.4-107.6 112-107.6 60.9 0 103.6 41.5 103.6 100.9 0 67.1-33.9 113.6-78 113.6-24.3 0-42.6-20.1-36.7-44.8 7-29.5 20.5-61.3 20.5-82.6 0-19-10.2-34.9-31.4-34.9-24.9 0-44.9 25.7-44.9 60.2 0 22 7.4 36.8 7.4 36.8s-24.5 103.8-29 123.2c-5 21.4-3 51.6-.9 71.2C65.4 450.9 0 361.1 0 256 0 119 111 8 248 8s248 111 248 248z"}))},pinterestSquare:{label:(0,i._x)("Pinterest - Square","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 448 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M448 80v352c0 26.5-21.5 48-48 48H154.4c9.8-16.4 22.4-40 27.4-59.3 3-11.5 15.3-58.4 15.3-58.4 8 15.3 31.4 28.2 56.3 28.2 74.1 0 127.4-68.1 127.4-152.7 0-81.1-66.2-141.8-151.4-141.8-106 0-162.2 71.1-162.2 148.6 0 36 19.2 80.8 49.8 95.1 4.7 2.2 7.1 1.2 8.2-3.3.8-3.4 5-20.1 6.8-27.8.6-2.5.3-4.6-1.7-7-10.1-12.3-18.3-34.9-18.3-56 0-54.2 41-106.6 110.9-106.6 60.3 0 102.6 41.1 102.6 99.9 0 66.4-33.5 112.4-77.2 112.4-24.1 0-42.1-19.9-36.4-44.4 6.9-29.2 20.3-60.7 20.3-81.8 0-53-75.5-45.7-75.5 25 0 21.7 7.3 36.5 7.3 36.5-31.4 132.8-36.1 134.5-29.6 192.6l2.2.8H48c-26.5 0-48-21.5-48-48V80c0-26.5 21.5-48 48-48h352c26.5 0 48 21.5 48 48z"}))},reddit:{label:(0,i._x)("Reddit","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M440.3 203.5c-15 0-28.2 6.2-37.9 15.9-35.7-24.7-83.8-40.6-137.1-42.3L293 52.3l88.2 19.8c0 21.6 17.6 39.2 39.2 39.2 22 0 39.7-18.1 39.7-39.7s-17.6-39.7-39.7-39.7c-15.4 0-28.7 9.3-35.3 22l-97.4-21.6c-4.9-1.3-9.7 2.2-11 7.1L246.3 177c-52.9 2.2-100.5 18.1-136.3 42.8-9.7-10.1-23.4-16.3-38.4-16.3-55.6 0-73.8 74.6-22.9 100.1-1.8 7.9-2.6 16.3-2.6 24.7 0 83.8 94.4 151.7 210.3 151.7 116.4 0 210.8-67.9 210.8-151.7 0-8.4-.9-17.2-3.1-25.1 49.9-25.6 31.5-99.7-23.8-99.7zM129.4 308.9c0-22 17.6-39.7 39.7-39.7 21.6 0 39.2 17.6 39.2 39.7 0 21.6-17.6 39.2-39.2 39.2-22 .1-39.7-17.6-39.7-39.2zm214.3 93.5c-36.4 36.4-139.1 36.4-175.5 0-4-3.5-4-9.7 0-13.7 3.5-3.5 9.7-3.5 13.2 0 27.8 28.5 120 29 149 0 3.5-3.5 9.7-3.5 13.2 0 4.1 4 4.1 10.2.1 13.7zm-.8-54.2c-21.6 0-39.2-17.6-39.2-39.2 0-22 17.6-39.7 39.2-39.7 22 0 39.7 17.6 39.7 39.7-.1 21.5-17.7 39.2-39.7 39.2z"}))},redditCircle:{label:(0,i._x)("Reddit - Circle","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M201.5 305.5c-13.8 0-24.9-11.1-24.9-24.6 0-13.8 11.1-24.9 24.9-24.9 13.6 0 24.6 11.1 24.6 24.9 0 13.6-11.1 24.6-24.6 24.6zM504 256c0 137-111 248-248 248S8 393 8 256 119 8 256 8s248 111 248 248zm-132.3-41.2c-9.4 0-17.7 3.9-23.8 10-22.4-15.5-52.6-25.5-86.1-26.6l17.4-78.3 55.4 12.5c0 13.6 11.1 24.6 24.6 24.6 13.8 0 24.9-11.3 24.9-24.9s-11.1-24.9-24.9-24.9c-9.7 0-18 5.8-22.1 13.8l-61.2-13.6c-3-.8-6.1 1.4-6.9 4.4l-19.1 86.4c-33.2 1.4-63.1 11.3-85.5 26.8-6.1-6.4-14.7-10.2-24.1-10.2-34.9 0-46.3 46.9-14.4 62.8-1.1 5-1.7 10.2-1.7 15.5 0 52.6 59.2 95.2 132 95.2 73.1 0 132.3-42.6 132.3-95.2 0-5.3-.6-10.8-1.9-15.8 31.3-16 19.8-62.5-14.9-62.5zM302.8 331c-18.2 18.2-76.1 17.9-93.6 0-2.2-2.2-6.1-2.2-8.3 0-2.5 2.5-2.5 6.4 0 8.6 22.8 22.8 87.3 22.8 110.2 0 2.5-2.2 2.5-6.1 0-8.6-2.2-2.2-6.1-2.2-8.3 0zm7.7-75c-13.6 0-24.6 11.1-24.6 24.9 0 13.6 11.1 24.6 24.6 24.6 13.8 0 24.9-11.1 24.9-24.6 0-13.8-11-24.9-24.9-24.9z"}))},redditSquare:{label:(0,i._x)("Reddit - Square","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 448 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M283.2 345.5c2.7 2.7 2.7 6.8 0 9.2-24.5 24.5-93.8 24.6-118.4 0-2.7-2.4-2.7-6.5 0-9.2 2.4-2.4 6.5-2.4 8.9 0 18.7 19.2 81 19.6 100.5 0 2.4-2.3 6.6-2.3 9 0zm-91.3-53.8c0-14.9-11.9-26.8-26.5-26.8-14.9 0-26.8 11.9-26.8 26.8 0 14.6 11.9 26.5 26.8 26.5 14.6 0 26.5-11.9 26.5-26.5zm90.7-26.8c-14.6 0-26.5 11.9-26.5 26.8 0 14.6 11.9 26.5 26.5 26.5 14.9 0 26.8-11.9 26.8-26.5 0-14.9-11.9-26.8-26.8-26.8zM448 80v352c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V80c0-26.5 21.5-48 48-48h352c26.5 0 48 21.5 48 48zm-99.7 140.6c-10.1 0-19 4.2-25.6 10.7-24.1-16.7-56.5-27.4-92.5-28.6l18.7-84.2 59.5 13.4c0 14.6 11.9 26.5 26.5 26.5 14.9 0 26.8-12.2 26.8-26.8 0-14.6-11.9-26.8-26.8-26.8-10.4 0-19.3 6.2-23.8 14.9l-65.7-14.6c-3.3-.9-6.5 1.5-7.4 4.8l-20.5 92.8c-35.7 1.5-67.8 12.2-91.9 28.9-6.5-6.8-15.8-11-25.9-11-37.5 0-49.8 50.4-15.5 67.5-1.2 5.4-1.8 11-1.8 16.7 0 56.5 63.7 102.3 141.9 102.3 78.5 0 142.2-45.8 142.2-102.3 0-5.7-.6-11.6-2.1-17 33.6-17.2 21.2-67.2-16.1-67.2z"}))},snapchat:{label:(0,i._x)("Snapchat","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M510.846 392.673c-5.211 12.157-27.239 21.089-67.36 27.318-2.064 2.786-3.775 14.686-6.507 23.956-1.625 5.566-5.623 8.869-12.128 8.869l-.297-.005c-9.395 0-19.203-4.323-38.852-4.323-26.521 0-35.662 6.043-56.254 20.588-21.832 15.438-42.771 28.764-74.027 27.399-31.646 2.334-58.025-16.908-72.871-27.404-20.714-14.643-29.828-20.582-56.241-20.582-18.864 0-30.736 4.72-38.852 4.72-8.073 0-11.213-4.922-12.422-9.04-2.703-9.189-4.404-21.263-6.523-24.13-20.679-3.209-67.31-11.344-68.498-32.15a10.627 10.627 0 0 1 8.877-11.069c69.583-11.455 100.924-82.901 102.227-85.934.074-.176.155-.344.237-.515 3.713-7.537 4.544-13.849 2.463-18.753-5.05-11.896-26.872-16.164-36.053-19.796-23.715-9.366-27.015-20.128-25.612-27.504 2.437-12.836 21.725-20.735 33.002-15.453 8.919 4.181 16.843 6.297 23.547 6.297 5.022 0 8.212-1.204 9.96-2.171-2.043-35.936-7.101-87.29 5.687-115.969C158.122 21.304 229.705 15.42 250.826 15.42c.944 0 9.141-.089 10.11-.089 52.148 0 102.254 26.78 126.723 81.643 12.777 28.65 7.749 79.792 5.695 116.009 1.582.872 4.357 1.942 8.599 2.139 6.397-.286 13.815-2.389 22.069-6.257 6.085-2.846 14.406-2.461 20.48.058l.029.01c9.476 3.385 15.439 10.215 15.589 17.87.184 9.747-8.522 18.165-25.878 25.018-2.118.835-4.694 1.655-7.434 2.525-9.797 3.106-24.6 7.805-28.616 17.271-2.079 4.904-1.256 11.211 2.46 18.748.087.168.166.342.239.515 1.301 3.03 32.615 74.46 102.23 85.934 6.427 1.058 11.163 7.877 7.725 15.859z"}))},soundcloud:{label:(0,i._x)("Soundcloud","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 640 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M111.4 256.3l5.8 65-5.8 68.3c-.3 2.5-2.2 4.4-4.4 4.4s-4.2-1.9-4.2-4.4l-5.6-68.3 5.6-65c0-2.2 1.9-4.2 4.2-4.2 2.2 0 4.1 2 4.4 4.2zm21.4-45.6c-2.8 0-4.7 2.2-5 5l-5 105.6 5 68.3c.3 2.8 2.2 5 5 5 2.5 0 4.7-2.2 4.7-5l5.8-68.3-5.8-105.6c0-2.8-2.2-5-4.7-5zm25.5-24.1c-3.1 0-5.3 2.2-5.6 5.3l-4.4 130 4.4 67.8c.3 3.1 2.5 5.3 5.6 5.3 2.8 0 5.3-2.2 5.3-5.3l5.3-67.8-5.3-130c0-3.1-2.5-5.3-5.3-5.3zM7.2 283.2c-1.4 0-2.2 1.1-2.5 2.5L0 321.3l4.7 35c.3 1.4 1.1 2.5 2.5 2.5s2.2-1.1 2.5-2.5l5.6-35-5.6-35.6c-.3-1.4-1.1-2.5-2.5-2.5zm23.6-21.9c-1.4 0-2.5 1.1-2.5 2.5l-6.4 57.5 6.4 56.1c0 1.7 1.1 2.8 2.5 2.8s2.5-1.1 2.8-2.5l7.2-56.4-7.2-57.5c-.3-1.4-1.4-2.5-2.8-2.5zm25.3-11.4c-1.7 0-3.1 1.4-3.3 3.3L47 321.3l5.8 65.8c.3 1.7 1.7 3.1 3.3 3.1 1.7 0 3.1-1.4 3.1-3.1l6.9-65.8-6.9-68.1c0-1.9-1.4-3.3-3.1-3.3zm25.3-2.2c-1.9 0-3.6 1.4-3.6 3.6l-5.8 70 5.8 67.8c0 2.2 1.7 3.6 3.6 3.6s3.6-1.4 3.9-3.6l6.4-67.8-6.4-70c-.3-2.2-2-3.6-3.9-3.6zm241.4-110.9c-1.1-.8-2.8-1.4-4.2-1.4-2.2 0-4.2.8-5.6 1.9-1.9 1.7-3.1 4.2-3.3 6.7v.8l-3.3 176.7 1.7 32.5 1.7 31.7c.3 4.7 4.2 8.6 8.9 8.6s8.6-3.9 8.6-8.6l3.9-64.2-3.9-177.5c-.4-3-2-5.8-4.5-7.2zm-26.7 15.3c-1.4-.8-2.8-1.4-4.4-1.4s-3.1.6-4.4 1.4c-2.2 1.4-3.6 3.9-3.6 6.7l-.3 1.7-2.8 160.8s0 .3 3.1 65.6v.3c0 1.7.6 3.3 1.7 4.7 1.7 1.9 3.9 3.1 6.4 3.1 2.2 0 4.2-1.1 5.6-2.5 1.7-1.4 2.5-3.3 2.5-5.6l.3-6.7 3.1-58.6-3.3-162.8c-.3-2.8-1.7-5.3-3.9-6.7zm-111.4 22.5c-3.1 0-5.8 2.8-5.8 6.1l-4.4 140.6 4.4 67.2c.3 3.3 2.8 5.8 5.8 5.8 3.3 0 5.8-2.5 6.1-5.8l5-67.2-5-140.6c-.2-3.3-2.7-6.1-6.1-6.1zm376.7 62.8c-10.8 0-21.1 2.2-30.6 6.1-6.4-70.8-65.8-126.4-138.3-126.4-17.8 0-35 3.3-50.3 9.4-6.1 2.2-7.8 4.4-7.8 9.2v249.7c0 5 3.9 8.6 8.6 9.2h218.3c43.3 0 78.6-35 78.6-78.3.1-43.6-35.2-78.9-78.5-78.9zm-296.7-60.3c-4.2 0-7.5 3.3-7.8 7.8l-3.3 136.7 3.3 65.6c.3 4.2 3.6 7.5 7.8 7.5 4.2 0 7.5-3.3 7.5-7.5l3.9-65.6-3.9-136.7c-.3-4.5-3.3-7.8-7.5-7.8zm-53.6-7.8c-3.3 0-6.4 3.1-6.4 6.7l-3.9 145.3 3.9 66.9c.3 3.6 3.1 6.4 6.4 6.4 3.6 0 6.4-2.8 6.7-6.4l4.4-66.9-4.4-145.3c-.3-3.6-3.1-6.7-6.7-6.7zm26.7 3.4c-3.9 0-6.9 3.1-6.9 6.9L227 321.3l3.9 66.4c.3 3.9 3.1 6.9 6.9 6.9s6.9-3.1 6.9-6.9l4.2-66.4-4.2-141.7c0-3.9-3-6.9-6.9-6.9z"}))},twitch:{label:(0,i._x)("Twitch","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 448 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M40.1 32L10 108.9v314.3h107V480h60.2l56.8-56.8h87l117-117V32H40.1zm357.8 254.1L331 353H224l-56.8 56.8V353H76.9V72.1h321v214zM331 149v116.9h-40.1V149H331zm-107 0v116.9h-40.1V149H224z"}))},twitter:{label:(0,i._x)("Twitter","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M459.37 151.716c.325 4.548.325 9.097.325 13.645 0 138.72-105.583 298.558-298.558 298.558-59.452 0-114.68-17.219-161.137-47.106 8.447.974 16.568 1.299 25.34 1.299 49.055 0 94.213-16.568 130.274-44.832-46.132-.975-84.792-31.188-98.112-72.772 6.498.974 12.995 1.624 19.818 1.624 9.421 0 18.843-1.3 27.614-3.573-48.081-9.747-84.143-51.98-84.143-102.985v-1.299c13.969 7.797 30.214 12.67 47.431 13.319-28.264-18.843-46.781-51.005-46.781-87.391 0-19.492 5.197-37.36 14.294-52.954 51.655 63.675 129.3 105.258 216.365 109.807-1.624-7.797-2.599-15.918-2.599-24.04 0-57.828 46.782-104.934 104.934-104.934 30.213 0 57.502 12.67 76.67 33.137 23.715-4.548 46.456-13.32 66.599-25.34-7.798 24.366-24.366 44.833-46.132 57.827 21.117-2.273 41.584-8.122 60.426-16.243-14.292 20.791-32.161 39.308-52.628 54.253z"}))},twitterSquare:{label:(0,i._x)("Twitter - Square","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 448 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zm-48.9 158.8c.2 2.8.2 5.7.2 8.5 0 86.7-66 186.6-186.6 186.6-37.2 0-71.7-10.8-100.7-29.4 5.3.6 10.4.8 15.8.8 30.7 0 58.9-10.4 81.4-28-28.8-.6-53-19.5-61.3-45.5 10.1 1.5 19.2 1.5 29.6-1.2-30-6.1-52.5-32.5-52.5-64.4v-.8c8.7 4.9 18.9 7.9 29.6 8.3a65.447 65.447 0 0 1-29.2-54.6c0-12.2 3.2-23.4 8.9-33.1 32.3 39.8 80.8 65.8 135.2 68.6-9.3-44.5 24-80.6 64-80.6 18.9 0 35.9 7.9 47.9 20.7 14.8-2.8 29-8.3 41.6-15.8-4.9 15.2-15.2 28-28.8 36.1 13.2-1.4 26-5.1 37.8-10.2-8.9 13.1-20.1 24.7-32.9 34z"}))},vimeo:{label:(0,i._x)("Vimeo","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 448 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M447.8 153.6c-2 43.6-32.4 103.3-91.4 179.1-60.9 79.2-112.4 118.8-154.6 118.8-26.1 0-48.2-24.1-66.3-72.3C100.3 250 85.3 174.3 56.2 174.3c-3.4 0-15.1 7.1-35.2 21.1L0 168.2c51.6-45.3 100.9-95.7 131.8-98.5 34.9-3.4 56.3 20.5 64.4 71.5 28.7 181.5 41.4 208.9 93.6 126.7 18.7-29.6 28.8-52.1 30.2-67.6 4.8-45.9-35.8-42.8-63.3-31 22-72.1 64.1-107.1 126.2-105.1 45.8 1.2 67.5 31.1 64.9 89.4z"}))},vimeoSquare:{label:(0,i._x)("Vimeo - Square","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 448 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M403.2 32H44.8C20.1 32 0 52.1 0 76.8v358.4C0 459.9 20.1 480 44.8 480h358.4c24.7 0 44.8-20.1 44.8-44.8V76.8c0-24.7-20.1-44.8-44.8-44.8zM377 180.8c-1.4 31.5-23.4 74.7-66 129.4-44 57.2-81.3 85.8-111.7 85.8-18.9 0-34.8-17.4-47.9-52.3-25.5-93.3-36.4-148-57.4-148-2.4 0-10.9 5.1-25.4 15.2l-15.2-19.6c37.3-32.8 72.9-69.2 95.2-71.2 25.2-2.4 40.7 14.8 46.5 51.7 20.7 131.2 29.9 151 67.6 91.6 13.5-21.4 20.8-37.7 21.8-48.9 3.5-33.2-25.9-30.9-45.8-22.4 15.9-52.1 46.3-77.4 91.2-76 33.3.9 49 22.5 47.1 64.7z"}))},whatsapp:{label:(0,i._x)("WhatsApp","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 448 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M380.9 97.1C339 55.1 283.2 32 223.9 32c-122.4 0-222 99.6-222 222 0 39.1 10.2 77.3 29.6 111L0 480l117.7-30.9c32.4 17.7 68.9 27 106.1 27h.1c122.3 0 224.1-99.6 224.1-222 0-59.3-25.2-115-67.1-157zm-157 341.6c-33.2 0-65.7-8.9-94-25.7l-6.7-4-69.8 18.3L72 359.2l-4.4-7c-18.5-29.4-28.2-63.3-28.2-98.2 0-101.7 82.8-184.5 184.6-184.5 49.3 0 95.6 19.2 130.4 54.1 34.8 34.9 56.2 81.2 56.1 130.5 0 101.8-84.9 184.6-186.6 184.6zm101.2-138.2c-5.5-2.8-32.8-16.2-37.9-18-5.1-1.9-8.8-2.8-12.5 2.8-3.7 5.6-14.3 18-17.6 21.8-3.2 3.7-6.5 4.2-12 1.4-32.6-16.3-54-29.1-75.5-66-5.7-9.8 5.7-9.1 16.3-30.3 1.8-3.7.9-6.9-.5-9.7-1.4-2.8-12.5-30.1-17.1-41.2-4.5-10.8-9.1-9.3-12.5-9.5-3.2-.2-6.9-.2-10.6-.2-3.7 0-9.7 1.4-14.8 6.9-5.1 5.6-19.4 19-19.4 46.3 0 27.3 19.9 53.7 22.6 57.4 2.8 3.7 39.1 59.7 94.8 83.8 35.2 15.2 49 16.5 66.6 13.9 10.7-1.6 32.8-13.4 37.4-26.4 4.6-13 4.6-24.1 3.2-26.4-1.3-2.5-5-3.9-10.5-6.6z"}))},whatsappSquare:{label:(0,i._x)("WhatsApp - Square","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 448 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M224 122.8c-72.7 0-131.8 59.1-131.9 131.8 0 24.9 7 49.2 20.2 70.1l3.1 5-13.3 48.6 49.9-13.1 4.8 2.9c20.2 12 43.4 18.4 67.1 18.4h.1c72.6 0 133.3-59.1 133.3-131.8 0-35.2-15.2-68.3-40.1-93.2-25-25-58-38.7-93.2-38.7zm77.5 188.4c-3.3 9.3-19.1 17.7-26.7 18.8-12.6 1.9-22.4.9-47.5-9.9-39.7-17.2-65.7-57.2-67.7-59.8-2-2.6-16.2-21.5-16.2-41s10.2-29.1 13.9-33.1c3.6-4 7.9-5 10.6-5 2.6 0 5.3 0 7.6.1 2.4.1 5.7-.9 8.9 6.8 3.3 7.9 11.2 27.4 12.2 29.4s1.7 4.3.3 6.9c-7.6 15.2-15.7 14.6-11.6 21.6 15.3 26.3 30.6 35.4 53.9 47.1 4 2 6.3 1.7 8.6-1 2.3-2.6 9.9-11.6 12.5-15.5 2.6-4 5.3-3.3 8.9-2 3.6 1.3 23.1 10.9 27.1 12.9s6.6 3 7.6 4.6c.9 1.9.9 9.9-2.4 19.1zM400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zM223.9 413.2c-26.6 0-52.7-6.7-75.8-19.3L64 416l22.5-82.2c-13.9-24-21.2-51.3-21.2-79.3C65.4 167.1 136.5 96 223.9 96c42.4 0 82.2 16.5 112.2 46.5 29.9 30 47.9 69.8 47.9 112.2 0 87.4-72.7 158.5-160.1 158.5z"}))},youtube:{label:(0,i._x)("YouTube","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 576 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M549.655 124.083c-6.281-23.65-24.787-42.276-48.284-48.597C458.781 64 288 64 288 64S117.22 64 74.629 75.486c-23.497 6.322-42.003 24.947-48.284 48.597-11.412 42.867-11.412 132.305-11.412 132.305s0 89.438 11.412 132.305c6.281 23.65 24.787 41.5 48.284 47.821C117.22 448 288 448 288 448s170.78 0 213.371-11.486c23.497-6.321 42.003-24.171 48.284-47.821 11.412-42.867 11.412-132.305 11.412-132.305s0-89.438-11.412-132.305zm-317.51 213.508V175.185l142.739 81.205-142.739 81.201z"}))}},ls={clock:{label:(0,i._x)("Clock","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm92.49 313l-20 25a16 16 0 01-22.49 2.5l-67-49.72a40 40 0 01-15-31.23V112a16 16 0 0116-16h32a16 16 0 0116 16v144l58 42.5a16 16 0 012.49 22.5z"}))},clockAlt:{label:(0,i._x)("Clock Outline","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm0 448c-110.5 0-200-89.5-200-200S145.5 56 256 56s200 89.5 200 200-89.5 200-200 200zm61.8-104.4l-84.9-61.7c-3.1-2.3-4.9-5.9-4.9-9.7V116c0-6.6 5.4-12 12-12h32c6.6 0 12 5.4 12 12v141.7l66.8 48.6c5.4 3.9 6.5 11.4 2.6 16.8L334.6 349c-3.9 5.3-11.4 6.5-16.8 2.6z"}))},asterisk:{label:(0,i._x)("Asterisk","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M478.21 334.093L336 256l142.21-78.093c11.795-6.477 15.961-21.384 9.232-33.037l-19.48-33.741c-6.728-11.653-21.72-15.499-33.227-8.523L296 186.718l3.475-162.204C299.763 11.061 288.937 0 275.48 0h-38.96c-13.456 0-24.283 11.061-23.994 24.514L216 186.718 77.265 102.607c-11.506-6.976-26.499-3.13-33.227 8.523l-19.48 33.741c-6.728 11.653-2.562 26.56 9.233 33.037L176 256 33.79 334.093c-11.795 6.477-15.961 21.384-9.232 33.037l19.48 33.741c6.728 11.653 21.721 15.499 33.227 8.523L216 325.282l-3.475 162.204C212.237 500.939 223.064 512 236.52 512h38.961c13.456 0 24.283-11.061 23.995-24.514L296 325.282l138.735 84.111c11.506 6.976 26.499 3.13 33.227-8.523l19.48-33.741c6.728-11.653 2.563-26.559-9.232-33.036z"}))},at:{label:(0,i._x)("At","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M256 8C118.941 8 8 118.919 8 256c0 137.059 110.919 248 248 248 48.154 0 95.342-14.14 135.408-40.223 12.005-7.815 14.625-24.288 5.552-35.372l-10.177-12.433c-7.671-9.371-21.179-11.667-31.373-5.129C325.92 429.757 291.314 440 256 440c-101.458 0-184-82.542-184-184S154.542 72 256 72c100.139 0 184 57.619 184 160 0 38.786-21.093 79.742-58.17 83.693-17.349-.454-16.91-12.857-13.476-30.024l23.433-121.11C394.653 149.75 383.308 136 368.225 136h-44.981a13.518 13.518 0 0 0-13.432 11.993l-.01.092c-14.697-17.901-40.448-21.775-59.971-21.775-74.58 0-137.831 62.234-137.831 151.46 0 65.303 36.785 105.87 96 105.87 26.984 0 57.369-15.637 74.991-38.333 9.522 34.104 40.613 34.103 70.71 34.103C462.609 379.41 504 307.798 504 232 504 95.653 394.023 8 256 8zm-21.68 304.43c-22.249 0-36.07-15.623-36.07-40.771 0-44.993 30.779-72.729 58.63-72.729 22.292 0 35.601 15.241 35.601 40.77 0 45.061-33.875 72.73-58.161 72.73z"}))},award:{label:(0,i._x)("Award","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 384 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M97.12 362.63c-8.69-8.69-4.16-6.24-25.12-11.85-9.51-2.55-17.87-7.45-25.43-13.32L1.2 448.7c-4.39 10.77 3.81 22.47 15.43 22.03l52.69-2.01L105.56 507c8 8.44 22.04 5.81 26.43-4.96l52.05-127.62c-10.84 6.04-22.87 9.58-35.31 9.58-19.5 0-37.82-7.59-51.61-21.37zM382.8 448.7l-45.37-111.24c-7.56 5.88-15.92 10.77-25.43 13.32-21.07 5.64-16.45 3.18-25.12 11.85-13.79 13.78-32.12 21.37-51.62 21.37-12.44 0-24.47-3.55-35.31-9.58L252 502.04c4.39 10.77 18.44 13.4 26.43 4.96l36.25-38.28 52.69 2.01c11.62.44 19.82-11.27 15.43-22.03zM263 340c15.28-15.55 17.03-14.21 38.79-20.14 13.89-3.79 24.75-14.84 28.47-28.98 7.48-28.4 5.54-24.97 25.95-45.75 10.17-10.35 14.14-25.44 10.42-39.58-7.47-28.38-7.48-24.42 0-52.83 3.72-14.14-.25-29.23-10.42-39.58-20.41-20.78-18.47-17.36-25.95-45.75-3.72-14.14-14.58-25.19-28.47-28.98-27.88-7.61-24.52-5.62-44.95-26.41-10.17-10.35-25-14.4-38.89-10.61-27.87 7.6-23.98 7.61-51.9 0-13.89-3.79-28.72.25-38.89 10.61-20.41 20.78-17.05 18.8-44.94 26.41-13.89 3.79-24.75 14.84-28.47 28.98-7.47 28.39-5.54 24.97-25.95 45.75-10.17 10.35-14.15 25.44-10.42 39.58 7.47 28.36 7.48 24.4 0 52.82-3.72 14.14.25 29.23 10.42 39.59 20.41 20.78 18.47 17.35 25.95 45.75 3.72 14.14 14.58 25.19 28.47 28.98C104.6 325.96 106.27 325 121 340c13.23 13.47 33.84 15.88 49.74 5.82a39.676 39.676 0 0 1 42.53 0c15.89 10.06 36.5 7.65 49.73-5.82zM97.66 175.96c0-53.03 42.24-96.02 94.34-96.02s94.34 42.99 94.34 96.02-42.24 96.02-94.34 96.02-94.34-42.99-94.34-96.02z"}))},ban:{label:(0,i._x)("Ban","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M256 8C119.034 8 8 119.033 8 256s111.034 248 248 248 248-111.034 248-248S392.967 8 256 8zm130.108 117.892c65.448 65.448 70 165.481 20.677 235.637L150.47 105.216c70.204-49.356 170.226-44.735 235.638 20.676zM125.892 386.108c-65.448-65.448-70-165.481-20.677-235.637L361.53 406.784c-70.203 49.356-170.226 44.736-235.638-20.676z"}))},bars:{label:(0,i._x)("Bars","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 448 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M16 132h416c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H16C7.163 60 0 67.163 0 76v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z"}))},beer:{label:(0,i._x)("Beer","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 448 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M368 96h-48V56c0-13.255-10.745-24-24-24H24C10.745 32 0 42.745 0 56v400c0 13.255 10.745 24 24 24h272c13.255 0 24-10.745 24-24v-42.11l80.606-35.977C429.396 365.063 448 336.388 448 304.86V176c0-44.112-35.888-80-80-80zm16 208.86a16.018 16.018 0 0 1-9.479 14.611L320 343.805V160h48c8.822 0 16 7.178 16 16v128.86zM208 384c-8.836 0-16-7.164-16-16V144c0-8.836 7.164-16 16-16s16 7.164 16 16v224c0 8.836-7.164 16-16 16zm-96 0c-8.836 0-16-7.164-16-16V144c0-8.836 7.164-16 16-16s16 7.164 16 16v224c0 8.836-7.164 16-16 16z"}))},bolt:{label:(0,i._x)("Bolt","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 320 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M296 160H180.6l42.6-129.8C227.2 15 215.7 0 200 0H56C44 0 33.8 8.9 32.2 20.8l-32 240C-1.7 275.2 9.5 288 24 288h118.7L96.6 482.5c-3.6 15.2 8 29.5 23.3 29.5 8.4 0 16.4-4.4 20.8-12l176-304c9.3-15.9-2.2-36-20.7-36z"}))},book:{label:(0,i._x)("Book","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 448 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M448 360V24c0-13.3-10.7-24-24-24H96C43 0 0 43 0 96v320c0 53 43 96 96 96h328c13.3 0 24-10.7 24-24v-16c0-7.5-3.5-14.3-8.9-18.7-4.2-15.4-4.2-59.3 0-74.7 5.4-4.3 8.9-11.1 8.9-18.6zM128 134c0-3.3 2.7-6 6-6h212c3.3 0 6 2.7 6 6v20c0 3.3-2.7 6-6 6H134c-3.3 0-6-2.7-6-6v-20zm0 64c0-3.3 2.7-6 6-6h212c3.3 0 6 2.7 6 6v20c0 3.3-2.7 6-6 6H134c-3.3 0-6-2.7-6-6v-20zm253.4 250H96c-17.7 0-32-14.3-32-32 0-17.6 14.4-32 32-32h285.4c-1.9 17.1-1.9 46.9 0 64z"}))},boxOpen:{label:(0,i._x)("Box - Open","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 640 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M425.7 256c-16.9 0-32.8-9-41.4-23.4L320 126l-64.2 106.6c-8.7 14.5-24.6 23.5-41.5 23.5-4.5 0-9-.6-13.3-1.9L64 215v178c0 14.7 10 27.5 24.2 31l216.2 54.1c10.2 2.5 20.9 2.5 31 0L551.8 424c14.2-3.6 24.2-16.4 24.2-31V215l-137 39.1c-4.3 1.3-8.8 1.9-13.3 1.9zm212.6-112.2L586.8 41c-3.1-6.2-9.8-9.8-16.7-8.9L320 64l91.7 152.1c3.8 6.3 11.4 9.3 18.5 7.3l197.9-56.5c9.9-2.9 14.7-13.9 10.2-23.1zM53.2 41L1.7 143.8c-4.6 9.2.3 20.2 10.1 23l197.9 56.5c7.1 2 14.7-1 18.5-7.3L320 64 69.8 32.1c-6.9-.8-13.5 2.7-16.6 8.9z"}))},bullhorn:{label:(0,i._x)("Bullhorn","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 576 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M576 240c0-23.63-12.95-44.04-32-55.12V32.01C544 23.26 537.02 0 512 0c-7.12 0-14.19 2.38-19.98 7.02l-85.03 68.03C364.28 109.19 310.66 128 256 128H64c-35.35 0-64 28.65-64 64v96c0 35.35 28.65 64 64 64h33.7c-1.39 10.48-2.18 21.14-2.18 32 0 39.77 9.26 77.35 25.56 110.94 5.19 10.69 16.52 17.06 28.4 17.06h74.28c26.05 0 41.69-29.84 25.9-50.56-16.4-21.52-26.15-48.36-26.15-77.44 0-11.11 1.62-21.79 4.41-32H256c54.66 0 108.28 18.81 150.98 52.95l85.03 68.03a32.023 32.023 0 0 0 19.98 7.02c24.92 0 32-22.78 32-32V295.13C563.05 284.04 576 263.63 576 240zm-96 141.42l-33.05-26.44C392.95 311.78 325.12 288 256 288v-96c69.12 0 136.95-23.78 190.95-66.98L480 98.58v282.84z"}))},bullseye:{label:(0,i._x)("Bullseye","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 496 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M248 8C111.03 8 0 119.03 0 256s111.03 248 248 248 248-111.03 248-248S384.97 8 248 8zm0 432c-101.69 0-184-82.29-184-184 0-101.69 82.29-184 184-184 101.69 0 184 82.29 184 184 0 101.69-82.29 184-184 184zm0-312c-70.69 0-128 57.31-128 128s57.31 128 128 128 128-57.31 128-128-57.31-128-128-128zm0 192c-35.29 0-64-28.71-64-64s28.71-64 64-64 64 28.71 64 64-28.71 64-64 64z"}))},burn:{label:(0,i._x)("Burn","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 384 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M192 0C79.7 101.3 0 220.9 0 300.5 0 425 79 512 192 512s192-87 192-211.5c0-79.9-80.2-199.6-192-300.5zm0 448c-56.5 0-96-39-96-94.8 0-13.5 4.6-61.5 96-161.2 91.4 99.7 96 147.7 96 161.2 0 55.8-39.5 94.8-96 94.8z"}))},calendarAlt:{label:(0,i._x)("Calender","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 448 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M148 288h-40c-6.6 0-12-5.4-12-12v-40c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12zm108-12v-40c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12v40c0 6.6 5.4 12 12 12h40c6.6 0 12-5.4 12-12zm96 0v-40c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12v40c0 6.6 5.4 12 12 12h40c6.6 0 12-5.4 12-12zm-96 96v-40c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12v40c0 6.6 5.4 12 12 12h40c6.6 0 12-5.4 12-12zm-96 0v-40c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12v40c0 6.6 5.4 12 12 12h40c6.6 0 12-5.4 12-12zm192 0v-40c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12v40c0 6.6 5.4 12 12 12h40c6.6 0 12-5.4 12-12zm96-260v352c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V112c0-26.5 21.5-48 48-48h48V12c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v52h128V12c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v52h48c26.5 0 48 21.5 48 48zm-48 346V160H48v298c0 3.3 2.7 6 6 6h340c3.3 0 6-2.7 6-6z"}))},check:{label:(0,i._x)("Check","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"}))},checkCircle:{label:(0,i._x)("Check - Circle","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M504 256c0 136.967-111.033 248-248 248S8 392.967 8 256 119.033 8 256 8s248 111.033 248 248zM227.314 387.314l184-184c6.248-6.248 6.248-16.379 0-22.627l-22.627-22.627c-6.248-6.249-16.379-6.249-22.628 0L216 308.118l-70.059-70.059c-6.248-6.248-16.379-6.248-22.628 0l-22.627 22.627c-6.248 6.248-6.248 16.379 0 22.627l104 104c6.249 6.249 16.379 6.249 22.628.001z"}))},checkCircleOutline:{label:(0,i._x)("Check - Circle Outline","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M256 8C119.033 8 8 119.033 8 256s111.033 248 248 248 248-111.033 248-248S392.967 8 256 8zm0 48c110.532 0 200 89.451 200 200 0 110.532-89.451 200-200 200-110.532 0-200-89.451-200-200 0-110.532 89.451-200 200-200m140.204 130.267l-22.536-22.718c-4.667-4.705-12.265-4.736-16.97-.068L215.346 303.697l-59.792-60.277c-4.667-4.705-12.265-4.736-16.97-.069l-22.719 22.536c-4.705 4.667-4.736 12.265-.068 16.971l90.781 91.516c4.667 4.705 12.265 4.736 16.97.068l172.589-171.204c4.704-4.668 4.734-12.266.067-16.971z"}))},checkSquare:{label:(0,i._x)("Check - Square","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 448 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M400 480H48c-26.51 0-48-21.49-48-48V80c0-26.51 21.49-48 48-48h352c26.51 0 48 21.49 48 48v352c0 26.51-21.49 48-48 48zm-204.686-98.059l184-184c6.248-6.248 6.248-16.379 0-22.627l-22.627-22.627c-6.248-6.248-16.379-6.249-22.628 0L184 302.745l-70.059-70.059c-6.248-6.248-16.379-6.248-22.628 0l-22.627 22.627c-6.248 6.248-6.248 16.379 0 22.627l104 104c6.249 6.25 16.379 6.25 22.628.001z"}))},checkSquareOutline:{label:(0,i._x)("Check - Square Outline","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 448 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M400 32H48C21.49 32 0 53.49 0 80v352c0 26.51 21.49 48 48 48h352c26.51 0 48-21.49 48-48V80c0-26.51-21.49-48-48-48zm0 400H48V80h352v352zm-35.864-241.724L191.547 361.48c-4.705 4.667-12.303 4.637-16.97-.068l-90.781-91.516c-4.667-4.705-4.637-12.303.069-16.971l22.719-22.536c4.705-4.667 12.303-4.637 16.97.069l59.792 60.277 141.352-140.216c4.705-4.667 12.303-4.637 16.97.068l22.536 22.718c4.667 4.706 4.637 12.304-.068 16.971z"}))},chevronDown:{label:(0,i._x)("Chevron - Down","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 448 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M207.029 381.476L12.686 187.132c-9.373-9.373-9.373-24.569 0-33.941l22.667-22.667c9.357-9.357 24.522-9.375 33.901-.04L224 284.505l154.745-154.021c9.379-9.335 24.544-9.317 33.901.04l22.667 22.667c9.373 9.373 9.373 24.569 0 33.941L240.971 381.476c-9.373 9.372-24.569 9.372-33.942 0z"}))},chevronLeft:{label:(0,i._x)("Chevron - Left","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 256 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M31.7 239l136-136c9.4-9.4 24.6-9.4 33.9 0l22.6 22.6c9.4 9.4 9.4 24.6 0 33.9L127.9 256l96.4 96.4c9.4 9.4 9.4 24.6 0 33.9L201.7 409c-9.4 9.4-24.6 9.4-33.9 0l-136-136c-9.5-9.4-9.5-24.6-.1-34z"}))},chevronRight:{label:(0,i._x)("Chevron - Right","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 256 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34z"}))},chevronUp:{label:(0,i._x)("Chevron - Up","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 448 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M240.971 130.524l194.343 194.343c9.373 9.373 9.373 24.569 0 33.941l-22.667 22.667c-9.357 9.357-24.522 9.375-33.901.04L224 227.495 69.255 381.516c-9.379 9.335-24.544 9.317-33.901-.04l-22.667-22.667c-9.373-9.373-9.373-24.569 0-33.941L207.03 130.525c9.372-9.373 24.568-9.373 33.941-.001z"}))},circle:{label:(0,i._x)("Circle","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8z"}))},circleOutline:{label:(0,i._x)("Circle - Outline","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm0 448c-110.5 0-200-89.5-200-200S145.5 56 256 56s200 89.5 200 200-89.5 200-200 200z"}))},coffee:{label:(0,i._x)("Coffee","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 640 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M192 384h192c53 0 96-43 96-96h32c70.6 0 128-57.4 128-128S582.6 32 512 32H120c-13.3 0-24 10.7-24 24v232c0 53 43 96 96 96zM512 96c35.3 0 64 28.7 64 64s-28.7 64-64 64h-32V96h32zm47.7 384H48.3c-47.6 0-61-64-36-64h583.3c25 0 11.8 64-35.9 64z"}))},dotCircle:{label:(0,i._x)("Dot - Circle","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M256 8C119.033 8 8 119.033 8 256s111.033 248 248 248 248-111.033 248-248S392.967 8 256 8zm80 248c0 44.112-35.888 80-80 80s-80-35.888-80-80 35.888-80 80-80 80 35.888 80 80z"}))},dotCircleOutline:{label:(0,i._x)("Dot - Circle Outline","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M256 56c110.532 0 200 89.451 200 200 0 110.532-89.451 200-200 200-110.532 0-200-89.451-200-200 0-110.532 89.451-200 200-200m0-48C119.033 8 8 119.033 8 256s111.033 248 248 248 248-111.033 248-248S392.967 8 256 8zm0 168c-44.183 0-80 35.817-80 80s35.817 80 80 80 80-35.817 80-80-35.817-80-80-80z"}))},ellipsesH:{label:(0,i._x)("Ellipses - Horizontal","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M328 256c0 39.8-32.2 72-72 72s-72-32.2-72-72 32.2-72 72-72 72 32.2 72 72zm104-72c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72zm-352 0c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72z"}))},ellipsesV:{label:(0,i._x)("Ellipses - Vertical","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 192 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M96 184c39.8 0 72 32.2 72 72s-32.2 72-72 72-72-32.2-72-72 32.2-72 72-72zM24 80c0 39.8 32.2 72 72 72s72-32.2 72-72S135.8 8 96 8 24 40.2 24 80zm0 352c0 39.8 32.2 72 72 72s72-32.2 72-72-32.2-72-72-72-72 32.2-72 72z"}))},envelope:{label:(0,i._x)("Envelope","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M464 64H48C21.49 64 0 85.49 0 112v288c0 26.51 21.49 48 48 48h416c26.51 0 48-21.49 48-48V112c0-26.51-21.49-48-48-48zm0 48v40.805c-22.422 18.259-58.168 46.651-134.587 106.49-16.841 13.247-50.201 45.072-73.413 44.701-23.208.375-56.579-31.459-73.413-44.701C106.18 199.465 70.425 171.067 48 152.805V112h416zM48 400V214.398c22.914 18.251 55.409 43.862 104.938 82.646 21.857 17.205 60.134 55.186 103.062 54.955 42.717.231 80.509-37.199 103.053-54.947 49.528-38.783 82.032-64.401 104.947-82.653V400H48z"}))},fireAlt:{label:(0,i._x)("Fire","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 448 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M323.56 51.2c-20.8 19.3-39.58 39.59-56.22 59.97C240.08 73.62 206.28 35.53 168 0 69.74 91.17 0 209.96 0 281.6 0 408.85 100.29 512 224 512s224-103.15 224-230.4c0-53.27-51.98-163.14-124.44-230.4zm-19.47 340.65C282.43 407.01 255.72 416 226.86 416 154.71 416 96 368.26 96 290.75c0-38.61 24.31-72.63 72.79-130.75 6.93 7.98 98.83 125.34 98.83 125.34l58.63-66.88c4.14 6.85 7.91 13.55 11.27 19.97 27.35 52.19 15.81 118.97-33.43 153.42z"}))},heart:{label:(0,i._x)("Heart","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M462.3 62.6C407.5 15.9 326 24.3 275.7 76.2L256 96.5l-19.7-20.3C186.1 24.3 104.5 15.9 49.7 62.6c-62.8 53.6-66.1 149.8-9.9 207.9l193.5 199.8c12.5 12.9 32.8 12.9 45.3 0l193.5-199.8c56.3-58.1 53-154.3-9.8-207.9z"}))},mapMarkerAlt:{label:(0,i._x)("Map Marker","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 384 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M172.268 501.67C26.97 291.031 0 269.413 0 192 0 85.961 85.961 0 192 0s192 85.961 192 192c0 77.413-26.97 99.031-172.268 309.67-9.535 13.774-29.93 13.773-39.464 0zM192 272c44.183 0 80-35.817 80-80s-35.817-80-80-80-80 35.817-80 80 35.817 80 80 80z"}))},paperPlane:{label:(0,i._x)("Paper Plane","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M440 6.5L24 246.4c-34.4 19.9-31.1 70.8 5.7 85.9L144 379.6V464c0 46.4 59.2 65.5 86.6 28.6l43.8-59.1 111.9 46.2c5.9 2.4 12.1 3.6 18.3 3.6 8.2 0 16.3-2.1 23.6-6.2 12.8-7.2 21.6-20 23.9-34.5l59.4-387.2c6.1-40.1-36.9-68.8-71.5-48.9zM192 464v-64.6l36.6 15.1L192 464zm212.6-28.7l-153.8-63.5L391 169.5c10.7-15.5-9.5-33.5-23.7-21.2L155.8 332.6 48 288 464 48l-59.4 387.3z"}))},phone:{label:(0,i._x)("Phone","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M493.4 24.6l-104-24c-11.3-2.6-22.9 3.3-27.5 13.9l-48 112c-4.2 9.8-1.4 21.3 6.9 28l60.6 49.6c-36 76.7-98.9 140.5-177.2 177.2l-49.6-60.6c-6.8-8.3-18.2-11.1-28-6.9l-112 48C3.9 366.5-2 378.1.6 389.4l24 104C27.1 504.2 36.7 512 48 512c256.1 0 464-207.5 464-464 0-11.2-7.7-20.9-18.6-23.4z"}))},plus:{label:(0,i._x)("Plus","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 448 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z"}))},plusCircle:{label:(0,i._x)("Plus - Circle","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm144 276c0 6.6-5.4 12-12 12h-92v92c0 6.6-5.4 12-12 12h-56c-6.6 0-12-5.4-12-12v-92h-92c-6.6 0-12-5.4-12-12v-56c0-6.6 5.4-12 12-12h92v-92c0-6.6 5.4-12 12-12h56c6.6 0 12 5.4 12 12v92h92c6.6 0 12 5.4 12 12v56z"}))},plusSquare:{label:(0,i._x)("Plus - Square","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 448 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zm-32 252c0 6.6-5.4 12-12 12h-92v92c0 6.6-5.4 12-12 12h-56c-6.6 0-12-5.4-12-12v-92H92c-6.6 0-12-5.4-12-12v-56c0-6.6 5.4-12 12-12h92v-92c0-6.6 5.4-12 12-12h56c6.6 0 12 5.4 12 12v92h92c6.6 0 12 5.4 12 12v56z"}))},plusSquareOutline:{label:(0,i._x)("Plus - Square Outline","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 448 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M352 240v32c0 6.6-5.4 12-12 12h-88v88c0 6.6-5.4 12-12 12h-32c-6.6 0-12-5.4-12-12v-88h-88c-6.6 0-12-5.4-12-12v-32c0-6.6 5.4-12 12-12h88v-88c0-6.6 5.4-12 12-12h32c6.6 0 12 5.4 12 12v88h88c6.6 0 12 5.4 12 12zm96-160v352c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V80c0-26.5 21.5-48 48-48h352c26.5 0 48 21.5 48 48zm-48 346V86c0-3.3-2.7-6-6-6H54c-3.3 0-6 2.7-6 6v340c0 3.3 2.7 6 6 6h340c3.3 0 6-2.7 6-6z"}))},shield:{label:(0,i._x)("Shield","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M466.5 83.7l-192-80a48.15 48.15 0 0 0-36.9 0l-192 80C27.7 91.1 16 108.6 16 128c0 198.5 114.5 335.7 221.5 380.3 11.8 4.9 25.1 4.9 36.9 0C360.1 472.6 496 349.3 496 128c0-19.4-11.7-36.9-29.5-44.3zM256.1 446.3l-.1-381 175.9 73.3c-3.3 151.4-82.1 261.1-175.8 307.7z"}))},star:{label:(0,i._x)("Star","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 576 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M259.3 17.8L194 150.2 47.9 171.5c-26.2 3.8-36.7 36.1-17.7 54.6l105.7 103-25 145.5c-4.5 26.3 23.2 46 46.4 33.7L288 439.6l130.7 68.7c23.2 12.2 50.9-7.4 46.4-33.7l-25-145.5 105.7-103c19-18.5 8.5-50.8-17.7-54.6L382 150.2 316.7 17.8c-11.7-23.6-45.6-23.9-57.4 0z"}))},tags:{label:(0,i._x)("Tags","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 640 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M497.941 225.941L286.059 14.059A48 48 0 0 0 252.118 0H48C21.49 0 0 21.49 0 48v204.118a48 48 0 0 0 14.059 33.941l211.882 211.882c18.744 18.745 49.136 18.746 67.882 0l204.118-204.118c18.745-18.745 18.745-49.137 0-67.882zM112 160c-26.51 0-48-21.49-48-48s21.49-48 48-48 48 21.49 48 48-21.49 48-48 48zm513.941 133.823L421.823 497.941c-18.745 18.745-49.137 18.745-67.882 0l-.36-.36L527.64 323.522c16.999-16.999 26.36-39.6 26.36-63.64s-9.362-46.641-26.36-63.64L331.397 0h48.721a48 48 0 0 1 33.941 14.059l211.882 211.882c18.745 18.745 18.745 49.137 0 67.882z"}))},userCircle:{label:(0,i._x)("User - Circle","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 496 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm0 96c48.6 0 88 39.4 88 88s-39.4 88-88 88-88-39.4-88-88 39.4-88 88-88zm0 344c-58.7 0-111.3-26.6-146.5-68.2 18.8-35.4 55.6-59.8 98.5-59.8 2.4 0 4.8.4 7.1 1.1 13 4.2 26.6 6.9 40.9 6.9 14.3 0 28-2.7 40.9-6.9 2.3-.7 4.7-1.1 7.1-1.1 42.9 0 79.7 24.4 98.5 59.8C359.3 421.4 306.7 448 248 448z"}))}};class rs extends e.Component{constructor(){super(...arguments),this.state={showIcons:!1,showGeneralIcons:!1,showSocialIcons:!1}}render(){const{attributes:t,setAttributes:a,attrIcon:l,attrIconLocation:r,locationOptions:o,attrRemoveText:s}=this.props;let c={general:{group:(0,i.__)("General","generateblocks"),svgs:ls},social:{group:(0,i.__)("Social","generateblocks"),svgs:as}};return c=(0,m.applyFilters)("generateblocks.editor.iconSVGSets",c),(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.BaseControl,{className:"gb-svg-html"},(0,e.createElement)(n.TextControl,{label:(0,i.__)("Icon SVG HTML","generateblocks"),value:t[l],onChange:e=>{a({[this.props.attrIcon]:xi(e)}),a(""!==e?{hasIcon:!0}:{hasIcon:!1})}}),(0,e.createElement)("div",{className:"gb-icon-preview"},(0,e.createElement)("span",{dangerouslySetInnerHTML:{__html:xi(t[l])}}),(0,e.createElement)(n.Button,{isSmall:!0,className:"reset-icon is-secondary",onClick:()=>{a({[this.props.attrIcon]:"",hasIcon:!1,[this.props.attrRemoveText]:!1})}},(0,e.createElement)("span",{className:"editor-block-types-list__item-icon"},(0,i.__)("Clear","generateblocks"))))),(0,e.createElement)(n.BaseControl,{className:"gb-icon-chooser"},Object.keys(c).map(((t,l)=>{const r=c[t].svgs;return(0,e.createElement)(n.PanelBody,{title:c[t].group,initialOpen:!1,key:l},(0,e.createElement)(n.PanelRow,null,(0,e.createElement)(n.BaseControl,null,(0,e.createElement)("ul",{className:"gblocks-icon-chooser"},Object.keys(r).map(((t,l)=>(0,e.createElement)("li",{key:`editor-pblock-types-list-item-${l}`},(0,e.createElement)(n.Tooltip,{text:r[t].label},(0,e.createElement)(n.Button,{className:"editor-block-list-item-button",onClick:()=>{let l=r[t].icon;"string"!=typeof l&&(l=(0,e.renderToString)(l)),a({[this.props.attrIcon]:l,hasIcon:!0})}},"string"==typeof r[t].icon?(0,e.createElement)(e.Fragment,null,(0,e.createElement)("span",{className:"editor-block-types-list__item-icon",dangerouslySetInnerHTML:{__html:xi(r[t].icon)}})):(0,e.createElement)(e.Fragment,null,(0,e.createElement)("span",{className:"editor-block-types-list__item-icon"},r[t].icon)))))))))))}))),void 0!==t[r]&&!t[s]&&!!t[l]&&(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Icon Location","generateblocks"),value:t[r],options:o,onChange:e=>{const l=t.iconPaddingLeft,r=t.iconPaddingRight,n=t.iconPaddingRightTablet,i=t.iconPaddingLeftTablet,o=t.iconPaddingRightMobile,s=t.iconPaddingLeftMobile;"right"===e&&(!l&&r&&a({iconPaddingLeft:r,iconPaddingRight:""}),!i&&n&&a({iconPaddingLeftTablet:n,iconPaddingRightTablet:""}),!s&&o&&a({iconPaddingLeftMobile:o,iconPaddingRightMobile:""})),"left"===e&&(!r&&l&&a({iconPaddingRight:l,iconPaddingLeft:""}),!n&&i&&a({iconPaddingRightTablet:i,iconPaddingLeftTablet:""}),!o&&s&&a({iconPaddingRightMobile:s,iconPaddingLeftMobile:""})),a({[this.props.attrIconLocation]:e})}}),void 0!==t[s]&&!!t[l]&&(0,e.createElement)(n.ToggleControl,{label:(0,i.__)("Remove Text","generateblocks"),checked:!!t[s],onChange:e=>{a({[this.props.attrRemoveText]:e})}}))}}var ns=rs;(0,m.addFilter)("generateblocks.editor.colorGroupItems","generateblocks/button-colors/add-conditional-color-items",(function(e,t){const{name:a,attributes:l}=t,{useDynamicData:r,dynamicContentType:n}=l;if("generateblocks/button"!==a)return e;if(r&&"pagination-numbers"===n){const t=[{group:"background",attribute:"backgroundColorCurrent",tooltip:(0,i.__)("Current","generateblocks"),alpha:!0},{group:"text",attribute:"textColorCurrent",tooltip:(0,i.__)("Current","generateblocks"),alpha:!1},{group:"border",attribute:"borderColorCurrent",tooltip:(0,i.__)("Current","generateblocks"),alpha:!0}];e.forEach(((a,l)=>{t.forEach((t=>{t.group!==a.group||a.items.some((e=>e.attribute===t.attribute))||e[l].items.push({tooltip:t.tooltip,attribute:t.attribute,alpha:t.alpha})}))}))}return e}));var is=a=>{const{attributes:l,deviceType:n,state:o,blockDefaults:s,computedStyles:c}=a,{icon:u,removeText:g,iconSizeUnit:d}=l;return(0,e.createElement)(r.InspectorControls,null,(0,e.createElement)(C,t({},a,{title:(0,i.__)("Typography","generateblocks"),initialOpen:!1,icon:p("typography"),className:"gblocks-panel-label",id:"buttonTypography",state:o,showPanel:!g||!1}),(0,e.createElement)(cn,t({},a,{deviceType:n,options:["fontWeight","textTransform","fontSize","letterSpacing","fontFamily"],computedStyles:c})),(0,m.applyFilters)("generateblocks.editor.controls","","buttonTypography",a,o)),(0,e.createElement)(C,t({},a,{title:(0,i.__)("Spacing","generateblocks"),initialOpen:!1,icon:p("spacing"),className:"gblocks-panel-label",id:"buttonSpacing",state:o}),(0,e.createElement)(pn,t({},a,{deviceType:n,dimensions:[{type:"padding",label:(0,i.__)("Padding","generateblocks"),units:["px","em","%"]},{type:"margin",label:(0,i.__)("Margin","generateblocks"),units:["px","em","%"]},{type:"borderSize",label:(0,i.__)("Border Size","generateblocks"),units:["px"]},{type:"borderRadius",label:(0,i.__)("Border Radius","generateblocks"),units:["px","em","%"]}]})),(0,m.applyFilters)("generateblocks.editor.controls","","buttonSpacing",a,o)),(0,e.createElement)(C,t({},a,{title:(0,i.__)("Colors","generateblocks"),initialOpen:!1,icon:p("colors"),className:"gblocks-panel-label",id:"buttonColors",state:o}),"Desktop"===n&&(0,e.createElement)(_i,t({},a,{colors:[{group:"background",label:(0,i.__)("Background","generateblocks"),items:[{attribute:"backgroundColor",alpha:!0},{tooltip:(0,i.__)("Hover","generateblocks"),attribute:"backgroundColorHover",alpha:!0}]},{group:"text",label:(0,i.__)("Text","generateblocks"),items:[{attribute:"textColor"},{tooltip:(0,i.__)("Hover","generateblocks"),attribute:"textColorHover"}]},{group:"border",label:(0,i.__)("Border","generateblocks"),items:[{attribute:"borderColor",alpha:!0},{tooltip:(0,i.__)("Hover","generateblocks"),attribute:"borderColorHover",alpha:!0}]}]})),(0,m.applyFilters)("generateblocks.editor.controls","","buttonColors",a,o)),(0,e.createElement)(C,t({},a,{title:(0,i.__)("Background Gradient","generateblocks"),initialOpen:!1,icon:p("gradients"),className:"gblocks-panel-label",id:"buttonBackgroundGradient",state:o}),"Desktop"===n&&(0,e.createElement)(Ti,t({},a,{attrGradient:"gradient",attrGradientDirection:"gradientDirection",attrGradientColorOne:"gradientColorOne",attrGradientColorOneOpacity:"gradientColorOneOpacity",attrGradientColorStopOne:"gradientColorStopOne",attrGradientColorTwo:"gradientColorTwo",attrGradientColorTwoOpacity:"gradientColorTwoOpacity",attrGradientColorStopTwo:"gradientColorStopTwo",defaultColorOne:s.gradientColorOne,defaultColorTwo:s.gradientColorTwo})),(0,m.applyFilters)("generateblocks.editor.controls","","buttonBackgroundGradient",a,o)),(0,e.createElement)(C,t({},a,{title:(0,i.__)("Icon","generateblocks"),initialOpen:!1,icon:p("icons"),className:"gblocks-panel-label",id:"buttonIcon",state:o,showPanel:!("Desktop"!==n&&!u)}),"Desktop"===n&&(0,e.createElement)(ns,t({},a,{attrIcon:"icon",attrIconLocation:"iconLocation",attrRemoveText:"removeText",locationOptions:[{label:(0,i.__)("Left","generateblocks"),value:"left"},{label:(0,i.__)("Right","generateblocks"),value:"right"}]})),"Desktop"===n&&!!u&&(0,e.createElement)(e.Fragment,null,!g&&(0,e.createElement)(dn,t({},a,{device:n,type:"iconPadding",label:(0,i.__)("Padding","generateblocks"),units:["px","em","%"]}))),"Tablet"===n&&!!u&&(0,e.createElement)(e.Fragment,null,!g&&(0,e.createElement)(dn,t({},a,{device:n,type:"iconPadding",label:(0,i.__)("Padding","generateblocks"),units:["px","em","%"]}))),"Mobile"===n&&!!u&&(0,e.createElement)(e.Fragment,null,!g&&(0,e.createElement)(dn,t({},a,{device:n,type:"iconPadding",label:(0,i.__)("Padding","generateblocks"),units:["px","em","%"]}))),!!u&&(0,e.createElement)(M,t({},a,{label:(0,i.__)("Icon Size","generateblocks"),attributeName:"iconSize",units:["px","em"],device:n,presets:[{unit:"em",data:[.7,1,1.5,2]}],min:"1",step:"em"===d?.1:1})),(0,m.applyFilters)("generateblocks.editor.controls","","buttonIcon",a,o)))},os=t=>{let{anchor:a,ariaLabel:l,setAttributes:o}=t;return(0,e.createElement)(r.InspectorAdvancedControls,null,(0,e.createElement)(L,{anchor:a,setAttributes:o}),(0,e.createElement)(n.TextControl,{label:(0,i.__)("ARIA Label","generateblocks"),help:(0,i.__)("Helpful to people using screen readers.","generateblocks"),value:l,onChange:e=>{o({ariaLabel:e})}}))};class ss extends e.Component{render(){let t=[];return t=(0,m.applyFilters)("generateblocks.editor.desktopCSS",t,this.props,"button"),(0,e.createElement)("style",null,O(t))}}class cs extends e.Component{render(){const t=(0,m.applyFilters)("generateblocks.editor.cssAttrs",this.props.attributes,this.props),{url:a,uniqueId:l,removeText:r,letterSpacingTablet:n,fontSizeTablet:i,fontSizeUnit:o,marginTopTablet:s,marginRightTablet:c,marginBottomTablet:u,marginLeftTablet:g,marginUnit:d,paddingTopTablet:p,paddingRightTablet:b,paddingBottomTablet:f,paddingLeftTablet:h,paddingUnit:k,borderSizeTopTablet:y,borderSizeRightTablet:v,borderSizeBottomTablet:w,borderSizeLeftTablet:_,borderRadiusTopRightTablet:C,borderRadiusBottomRightTablet:T,borderRadiusBottomLeftTablet:E,borderRadiusTopLeftTablet:S,borderRadiusUnit:x,iconPaddingTopTablet:B,iconPaddingRightTablet:M,iconPaddingBottomTablet:D,iconPaddingLeftTablet:R,iconPaddingUnit:L,iconSizeTablet:z,iconSizeUnit:N}=t;let A=".editor-styles-wrapper .gb-button-wrapper a.gb-button-"+l;a||(A=".editor-styles-wrapper .gb-button-wrapper .gb-button-"+l);let F=[];return F[A]=[{"padding-top":I(p,k),"padding-right":I(b,k),"padding-bottom":I(f,k),"padding-left":I(h,k),"border-top-left-radius":I(S,x),"border-top-right-radius":I(C,x),"border-bottom-right-radius":I(T,x),"border-bottom-left-radius":I(E,x),"font-size":I(i,o),"letter-spacing":I(n,"em"),"margin-top":I(s,d),"margin-right":I(c,d),"margin-bottom":I(u,d),"margin-left":I(g,d)}],(y||v||w||_)&&F[A].push({"border-top-width":I(y,"px"),"border-right-width":I(v,"px"),"border-bottom-width":I(w,"px"),"border-left-width":I(_,"px"),"border-style":"solid"}),F[A+" .gb-icon"]=[{"padding-top":!r&&I(B,L),"padding-right":!r&&I(M,L),"padding-bottom":!r&&I(D,L),"padding-left":!r&&I(R,L),"font-size":I(z,N)}],F=(0,m.applyFilters)("generateblocks.editor.tabletCSS",F,this.props,"button"),(0,e.createElement)("style",null,O(F))}}class us extends e.Component{render(){let t=[];return t=(0,m.applyFilters)("generateblocks.editor.tabletOnlyCSS",t,this.props,"button"),(0,e.createElement)("style",null,O(t))}}class gs extends e.Component{render(){const t=(0,m.applyFilters)("generateblocks.editor.cssAttrs",this.props.attributes,this.props),{url:a,uniqueId:l,removeText:r,letterSpacingMobile:n,fontSizeMobile:i,fontSizeUnit:o,marginTopMobile:s,marginRightMobile:c,marginBottomMobile:u,marginLeftMobile:g,marginUnit:d,paddingTopMobile:p,paddingRightMobile:b,paddingBottomMobile:f,paddingLeftMobile:h,paddingUnit:k,borderSizeTopMobile:y,borderSizeRightMobile:v,borderSizeBottomMobile:w,borderSizeLeftMobile:_,borderRadiusTopRightMobile:C,borderRadiusBottomRightMobile:T,borderRadiusBottomLeftMobile:E,borderRadiusTopLeftMobile:S,borderRadiusUnit:x,iconPaddingTopMobile:B,iconPaddingRightMobile:M,iconPaddingBottomMobile:D,iconPaddingLeftMobile:R,iconPaddingUnit:L,iconSizeMobile:z,iconSizeUnit:N}=t;let A=".editor-styles-wrapper .gb-button-wrapper a.gb-button-"+l;a||(A=".editor-styles-wrapper .gb-button-wrapper .gb-button-"+l);let F=[];return F[A]=[{"padding-top":I(p,k),"padding-right":I(b,k),"padding-bottom":I(f,k),"padding-left":I(h,k),"border-top-left-radius":I(S,x),"border-top-right-radius":I(C,x),"border-bottom-right-radius":I(T,x),"border-bottom-left-radius":I(E,x),"font-size":I(i,o),"letter-spacing":I(n,"em"),"margin-top":I(s,d),"margin-right":I(c,d),"margin-bottom":I(u,d),"margin-left":I(g,d)}],(y||v||w||_)&&F[A].push({"border-top-width":I(y,"px"),"border-right-width":I(v,"px"),"border-bottom-width":I(w,"px"),"border-left-width":I(_,"px"),"border-style":"solid"}),F[A+" .gb-icon"]=[{"padding-top":!r&&I(B,L),"padding-right":!r&&I(M,L),"padding-bottom":!r&&I(D,L),"padding-left":!r&&I(R,L),"font-size":I(z,N)}],F=(0,m.applyFilters)("generateblocks.editor.mobileCSS",F,this.props,"button"),(0,e.createElement)("style",null,O(F))}}class ds extends e.Component{render(){const t=(0,m.applyFilters)("generateblocks.editor.cssAttrs",this.props.attributes,this.props),{url:a,uniqueId:l,removeText:r,backgroundColor:n,backgroundColorOpacity:i,textColor:o,backgroundColorHover:s,backgroundColorHoverOpacity:c,textColorHover:u,fontFamily:g,fontFamilyFallback:d,fontWeight:p,textTransform:b,letterSpacing:f,fontSize:h,fontSizeUnit:k,marginTop:y,marginRight:v,marginBottom:w,marginLeft:_,marginUnit:C,paddingTop:T,paddingRight:E,paddingBottom:S,paddingLeft:x,paddingUnit:B,borderSizeTop:M,borderSizeRight:D,borderSizeBottom:R,borderSizeLeft:L,borderRadiusTopRight:z,borderRadiusBottomRight:N,borderRadiusBottomLeft:A,borderRadiusTopLeft:F,borderRadiusUnit:P,borderColor:H,borderColorOpacity:V,borderColorHover:U,borderColorHoverOpacity:G,gradient:j,gradientDirection:q,gradientColorOne:W,gradientColorOneOpacity:$,gradientColorStopOne:Z,gradientColorTwo:K,gradientColorTwoOpacity:J,gradientColorStopTwo:Q,iconPaddingTop:Y,iconPaddingRight:X,iconPaddingBottom:ee,iconPaddingLeft:te,iconPaddingUnit:ae,iconSize:le,iconSizeUnit:re}=t;let ne,ie="",oe="",se="";j&&(W&&""!==Z&&(oe=" "+Z+"%"),K&&""!==Q&&(se=" "+Q+"%")),j&&(ne="linear-gradient("+q+"deg, "+vi(W,$)+oe+", "+vi(K,J)+se+");"),g&&d&&(ie=", "+d);let ce=".editor-styles-wrapper .gb-button-wrapper a.gb-button-"+l;a||(ce=".editor-styles-wrapper .gb-button-wrapper .gb-button-"+l);let ue=[];return ue[ce]=[{"background-color":vi(n,i),"background-image":ne,color:o,padding:io(T,E,S,x,B),"border-radius":io(F,z,N,A,P),"font-family":g+ie,"font-weight":p,"text-transform":b,"font-size":I(h,k),"letter-spacing":I(f,"em"),margin:io(y,v,w,_,C),"border-color":vi(H,V)}],(M||D||R||L)&&ue[ce].push({"border-width":io(M,D,R,L,"px"),"border-style":"solid"}),ue[ce+":hover, "+ce+":focus, "+ce+":active"]=[{"background-color":vi(s,c),color:u,"border-color":vi(U,G)}],ue[ce+" .gb-icon"]=[{padding:!r&&io(Y,X,ee,te,ae),"font-size":I(le,re)}],ue=(0,m.applyFilters)("generateblocks.editor.mainCSS",ue,this.props,"button"),(0,e.createElement)("style",null,O(ue))}}var ps=(0,e.memo)((function(t){const a=(0,l.useSelect)((e=>{if(!e("core/edit-post"))return"Desktop";const{__experimentalGetPreviewDeviceType:t=(()=>"Desktop")}=e("core/edit-post");return t()}),[]),{isBlockPreview:r=!1}=t?.attributes;return r?null:(0,e.createElement)(e.Fragment,null,(0,e.createElement)(ds,t),a&&(0,e.createElement)(e.Fragment,null,"Desktop"===a&&(0,e.createElement)(ss,t),("Tablet"===a||"Mobile"===a)&&(0,e.createElement)(cs,t),"Tablet"===a&&(0,e.createElement)(us,t),"Mobile"===a&&(0,e.createElement)(gs,t)))}),G),bs=(0,q.compose)(Oo,le,(t=>a=>{const{attributes:l,setAttributes:r}=a,{hasIcon:n,icon:i,hasUrl:o,url:s,blockVersion:c,gradient:u}=l;return(0,e.useEffect)((()=>{if(!n&&i&&r({hasIcon:!0}),o||r({hasUrl:!!s}),!re(l)&&ne(c,2)){const e=generateBlocksLegacyDefaults.v_1_4_0.button,t={},a=[];u&&a.push("gradientDirection","gradientColorOne","gradientColorOneOpacity","gradientColorTwo","gradientColorTwoOpacity"),a.forEach((a=>{x(l[a])||(t[a]=e[a])})),Object.keys(t).length>0&&r(t)}ne(c,2)&&r({blockVersion:2})}),[]),(0,e.createElement)(t,a)}))((a=>{const{attributes:l,setAttributes:r,clientId:n,ContentRenderer:i=$i}=a,{anchor:o,ariaLabel:s,fontFamily:c,googleFont:u,googleFontVariants:g,isBlockPreview:d=!1}=l,p=(0,e.useRef)(null),[b,m]=(0,e.useState)({}),[f,h]=W("Desktop");return(0,e.useEffect)((()=>{const e=getComputedStyle(p.current);m({fontSize:parseInt(e.fontSize)||""})}),[]),(0,e.createElement)(e.Fragment,null,(0,e.createElement)(ts,{clientId:n,attributes:l,setAttributes:r}),(0,e.createElement)(is,t({},a,{deviceType:f,setDeviceType:h,state:{deviceType:f},blockDefaults:generateBlocksDefaults.button,computedStyles:b})),(0,e.createElement)(os,{anchor:o,ariaLabel:s,setAttributes:r}),(0,e.createElement)(ps,t({},a,{deviceType:f})),(0,e.createElement)(nn,{fontFamily:c,googleFont:u,googleFontVariants:g,isBlockPreview:d}),(0,e.createElement)(i,t({},a,{buttonRef:p})))})),ms={uniqueId:{type:"string",default:""},anchor:{type:"string",default:""},url:{type:"string",source:"attribute",selector:".gb-button",attribute:"href"},hasUrl:{type:"boolean"},target:{type:"boolean"},relNoFollow:{type:"boolean"},relSponsored:{type:"boolean"},text:{type:"string",source:"html",selector:".gb-button-text",default:"Button"},icon:{type:"string",source:"html",selector:".gb-icon"},hasIcon:{type:"boolean",default:!1},iconLocation:{type:"string",default:generateBlocksDefaults.button.iconLocation},customIcon:{type:"boolean",default:!1},removeText:{type:"boolean",default:generateBlocksDefaults.button.removeText},ariaLabel:{type:"string",default:generateBlocksDefaults.button.ariaLabel},backgroundColor:{type:"string",default:generateBlocksDefaults.button.backgroundColor},backgroundColorOpacity:{type:"number",default:generateBlocksDefaults.button.backgroundColorOpacity},backgroundColorHover:{type:"string",default:generateBlocksDefaults.button.backgroundColorHover},backgroundColorHoverOpacity:{type:"number",default:generateBlocksDefaults.button.backgroundColorHoverOpacity},backgroundColorCurrent:{type:"string",default:generateBlocksDefaults.button.backgroundColorCurrent},textColor:{type:"string",default:generateBlocksDefaults.button.textColor},textColorHover:{type:"string",default:generateBlocksDefaults.button.textColorHover},textColorCurrent:{type:"string",default:generateBlocksDefaults.button.textColorCurrent},borderColor:{type:"string",default:generateBlocksDefaults.button.borderColor},borderColorOpacity:{type:"number",default:generateBlocksDefaults.button.borderColorOpacity},borderColorHover:{type:"string",default:generateBlocksDefaults.button.borderColorHover},borderColorHoverOpacity:{type:"number",default:generateBlocksDefaults.button.borderColorHoverOpacity},borderColorCurrent:{type:"string",default:generateBlocksDefaults.button.borderColorCurrent},fontFamily:{type:"string",default:generateBlocksDefaults.button.fontFamily},fontFamilyFallback:{type:"string",default:generateBlocksDefaults.button.fontFamilyFallback},googleFont:{type:"boolean",default:generateBlocksDefaults.button.googleFont},googleFontVariants:{type:"string",default:generateBlocksDefaults.button.googleFontVariants},fontWeight:{type:"string",default:generateBlocksDefaults.button.fontWeight},fontSize:{type:"number",default:generateBlocksDefaults.button.fontSize},fontSizeTablet:{type:"number",default:generateBlocksDefaults.button.fontSizeTablet},fontSizeMobile:{type:"number",default:generateBlocksDefaults.button.fontSizeMobile},fontSizeUnit:{type:"string",default:generateBlocksDefaults.button.fontSizeUnit},textTransform:{type:"string",default:generateBlocksDefaults.button.textTransform},letterSpacing:{type:"number",default:generateBlocksDefaults.button.letterSpacing},letterSpacingTablet:{type:"number",default:generateBlocksDefaults.button.letterSpacingTablet},letterSpacingMobile:{type:"number",default:generateBlocksDefaults.button.letterSpacingMobile},marginTop:{type:"string",default:generateBlocksDefaults.button.marginTop},marginRight:{type:"string",default:generateBlocksDefaults.button.marginRight},marginBottom:{type:"string",default:generateBlocksDefaults.button.marginBottom},marginLeft:{type:"string",default:generateBlocksDefaults.button.marginLeft},marginUnit:{type:"string",default:generateBlocksDefaults.button.marginUnit},marginTopTablet:{type:"string",default:generateBlocksDefaults.button.marginTopTablet},marginRightTablet:{type:"string",default:generateBlocksDefaults.button.marginRightTablet},marginBottomTablet:{type:"string",default:generateBlocksDefaults.button.marginBottomTablet},marginLeftTablet:{type:"string",default:generateBlocksDefaults.button.marginLeftTablet},marginTopMobile:{type:"string",default:generateBlocksDefaults.button.marginTopMobile},marginRightMobile:{type:"string",default:generateBlocksDefaults.button.marginRightMobile},marginBottomMobile:{type:"string",default:generateBlocksDefaults.button.marginBottomMobile},marginLeftMobile:{type:"string",default:generateBlocksDefaults.button.marginLeftMobile},paddingTop:{type:"string",default:generateBlocksDefaults.button.paddingTop},paddingRight:{type:"string",default:generateBlocksDefaults.button.paddingRight},paddingBottom:{type:"string",default:generateBlocksDefaults.button.paddingBottom},paddingLeft:{type:"string",default:generateBlocksDefaults.button.paddingLeft},paddingUnit:{type:"string",default:generateBlocksDefaults.button.paddingUnit},paddingTopTablet:{type:"string",default:generateBlocksDefaults.button.paddingTopTablet},paddingRightTablet:{type:"string",default:generateBlocksDefaults.button.paddingRightTablet},paddingBottomTablet:{type:"string",default:generateBlocksDefaults.button.paddingBottomTablet},paddingLeftTablet:{type:"string",default:generateBlocksDefaults.button.paddingLeftTablet},paddingTopMobile:{type:"string",default:generateBlocksDefaults.button.paddingTopMobile},paddingRightMobile:{type:"string",default:generateBlocksDefaults.button.paddingRightMobile},paddingBottomMobile:{type:"string",default:generateBlocksDefaults.button.paddingBottomMobile},paddingLeftMobile:{type:"string",default:generateBlocksDefaults.button.paddingLeftMobile},borderSizeTop:{type:"string",default:generateBlocksDefaults.button.borderSizeTop},borderSizeRight:{type:"string",default:generateBlocksDefaults.button.borderSizeRight},borderSizeBottom:{type:"string",default:generateBlocksDefaults.button.borderSizeBottom},borderSizeLeft:{type:"string",default:generateBlocksDefaults.button.borderSizeLeft},borderSizeTopTablet:{type:"string",default:generateBlocksDefaults.button.borderSizeTopTablet},borderSizeRightTablet:{type:"string",default:generateBlocksDefaults.button.borderSizeRightTablet},borderSizeBottomTablet:{type:"string",default:generateBlocksDefaults.button.borderSizeBottomTablet},borderSizeLeftTablet:{type:"string",default:generateBlocksDefaults.button.borderSizeLeftTablet},borderSizeTopMobile:{type:"string",default:generateBlocksDefaults.button.borderSizeTopMobile},borderSizeRightMobile:{type:"string",default:generateBlocksDefaults.button.borderSizeRightMobile},borderSizeBottomMobile:{type:"string",default:generateBlocksDefaults.button.borderSizeBottomMobile},borderSizeLeftMobile:{type:"string",default:generateBlocksDefaults.button.borderSizeLeftMobile},borderRadiusTopRight:{type:"string",default:generateBlocksDefaults.button.borderRadiusTopRight},borderRadiusBottomRight:{type:"string",default:generateBlocksDefaults.button.borderRadiusBottomRight},borderRadiusBottomLeft:{type:"string",default:generateBlocksDefaults.button.borderRadiusBottomLeft},borderRadiusTopLeft:{type:"string",default:generateBlocksDefaults.button.borderRadiusTopLeft},borderRadiusUnit:{type:"string",default:generateBlocksDefaults.button.borderRadiusUnit},borderRadiusTopRightTablet:{type:"string",default:generateBlocksDefaults.button.borderRadiusTopRightTablet},borderRadiusBottomRightTablet:{type:"string",default:generateBlocksDefaults.button.borderRadiusBottomRightTablet},borderRadiusBottomLeftTablet:{type:"string",default:generateBlocksDefaults.button.borderRadiusBottomLeftTablet},borderRadiusTopLeftTablet:{type:"string",default:generateBlocksDefaults.button.borderRadiusTopLeftTablet},borderRadiusTopRightMobile:{type:"string",default:generateBlocksDefaults.button.borderRadiusTopRightMobile},borderRadiusBottomRightMobile:{type:"string",default:generateBlocksDefaults.button.borderRadiusBottomRightMobile},borderRadiusBottomLeftMobile:{type:"string",default:generateBlocksDefaults.button.borderRadiusBottomLeftMobile},borderRadiusTopLeftMobile:{type:"string",default:generateBlocksDefaults.button.borderRadiusTopLeftMobile},gradient:{type:"boolean",default:generateBlocksDefaults.button.gradient},gradientDirection:{type:"number",default:generateBlocksDefaults.button.gradientDirection},gradientColorOne:{type:"string",default:generateBlocksDefaults.button.gradientColorOne},gradientColorOneOpacity:{type:"number",default:generateBlocksDefaults.button.gradientColorOneOpacity},gradientColorStopOne:{type:"number",default:generateBlocksDefaults.button.gradientColorStopOne},gradientColorTwo:{type:"string",default:generateBlocksDefaults.button.gradientColorTwo},gradientColorTwoOpacity:{type:"number",default:generateBlocksDefaults.button.gradientColorTwoOpacity},gradientColorStopTwo:{type:"number",default:generateBlocksDefaults.button.gradientColorStopTwo},iconPaddingTop:{type:"string",default:generateBlocksDefaults.button.iconPaddingTop},iconPaddingRight:{type:"string",default:generateBlocksDefaults.button.iconPaddingRight},iconPaddingBottom:{type:"string",default:generateBlocksDefaults.button.iconPaddingBottom},iconPaddingLeft:{type:"string",default:generateBlocksDefaults.button.iconPaddingLeft},iconPaddingTopTablet:{type:"string",default:generateBlocksDefaults.button.iconPaddingTopTablet},iconPaddingRightTablet:{type:"string",default:generateBlocksDefaults.button.iconPaddingRightTablet},iconPaddingBottomTablet:{type:"string",default:generateBlocksDefaults.button.iconPaddingBottomTablet},iconPaddingLeftTablet:{type:"string",default:generateBlocksDefaults.button.iconPaddingLeftTablet},iconPaddingTopMobile:{type:"string",default:generateBlocksDefaults.button.iconPaddingTopMobile},iconPaddingRightMobile:{type:"string",default:generateBlocksDefaults.button.iconPaddingRightMobile},iconPaddingBottomMobile:{type:"string",default:generateBlocksDefaults.button.iconPaddingBottomMobile},iconPaddingLeftMobile:{type:"string",default:generateBlocksDefaults.button.iconPaddingLeftMobile},iconPaddingUnit:{type:"string",default:generateBlocksDefaults.button.iconPaddingUnit},iconPaddingSyncUnits:{type:"boolean",default:!1},iconSize:{type:"number",default:generateBlocksDefaults.button.iconSize},iconSizeTablet:{type:"number",default:generateBlocksDefaults.button.iconSizeTablet},iconSizeMobile:{type:"number",default:generateBlocksDefaults.button.iconSizeMobile},iconSizeUnit:{type:"string",default:generateBlocksDefaults.button.iconSizeUnit},blockVersion:{type:"number"},elementId:{type:"string",default:""},cssClasses:{type:"string",default:""}};const fs=[{attributes:{...ms,text:{type:"array",source:"children",selector:".gb-button .button-text",default:"Button"}},supports:{anchor:!1,className:!1,customClassName:!1,inserter:!1,reusable:!1},migrate(e){const t=e.cssClasses?e.cssClasses:e.className,a=e.elementId?e.elementId:e.anchor;return{...e,className:t,anchor:a,cssClasses:"",elementId:""}},save(t){let{attributes:a}=t;const{uniqueId:l,elementId:n,cssClasses:i,text:o,url:c,target:u,relNoFollow:g,relSponsored:d,icon:p,iconLocation:b,removeText:f,ariaLabel:h}=a,k=[];g&&k.push("nofollow"),u&&k.push("noopener","noreferrer"),d&&k.push("sponsored");let y={id:n||void 0,className:s()({"gb-button":!0,[`gb-button-${l}`]:!0,[`${i}`]:""!==i}),href:c||void 0,target:u?"_blank":void 0,rel:k&&k.length>0?k.join(" "):void 0,"aria-label":h||void 0};return y=(0,m.applyFilters)("generateblocks.frontend.htmlAttributes",y,"generateblocks/button",a),(0,e.createElement)("a",y,p&&"left"===b&&(0,e.createElement)("span",{className:"gb-icon",dangerouslySetInnerHTML:{__html:xi(p)}}),!f&&(0,e.createElement)(r.RichText.Content,{tagName:"span",className:"button-text",value:o,key:"button-text"}),p&&"right"===b&&(0,e.createElement)("span",{className:"gb-icon",dangerouslySetInnerHTML:{__html:xi(p)}}))}}];var hs=fs;function ks(e){return e?(0,i.sprintf)("Post meta: %s",e):(0,i.__)("Post meta","generateblocks")}function ys(e,t){const{useDynamicData:a,dynamicContentType:l,dynamicLinkType:r,isCaption:n,metaFieldName:o}=e;if(a){const e={"post-title":(0,i.__)("Post title","generateblocks"),"post-excerpt":(0,i.__)("Post excerpt","generateblocks"),"post-date":(0,i.__)("Post date","generateblocks"),"post-meta":ks(o),"author-email":(0,i.__)("Author email","generateblocks"),"author-name":(0,i.__)("Author name","generateblocks"),"author-nickname":(0,i.__)("Author nickname","generateblocks"),"author-first-name":(0,i.__)("Author first name","generateblocks"),"author-last-name":(0,i.__)("Author last name","generateblocks"),"author-meta":(0,i.__)("Author meta","generateblocks"),"pagination-numbers":(0,i.__)("Page numbers","generateblocks"),caption:(0,i.__)("Caption","generateblocks"),terms:(0,i.__)("List of terms","generateblocks"),"comments-number":(0,i.__)("Comments number","generateblocks")},t={"single-post":(0,i.__)("Single post","generateblocks"),"author-archives":(0,i.__)("Author archives","generateblocks"),"comments-area":(0,i.__)("Comments area","generateblocks"),"post-meta":ks(o),"previous-posts":(0,i.__)("Previous posts","generateblocks"),"next-posts":(0,i.__)("Next posts","generateblocks"),"term-archives":(0,i.__)("Term archives","generateblocks"),"pagination-prev":(0,i.__)("Previous page","generateblocks"),"pagination-next":(0,i.__)("Next page","generateblocks")};return Object.keys(e).includes(l)?e[l]:Object.keys(t).includes(r)?t[r]:(0,i.__)("Dynamic content","generateblocks")}return n?(0,i.__)("Caption","generateblocks"):t}const vs=Object.assign({},ms,Zi);(0,g.registerBlockType)("generateblocks/button",{apiVersion:2,title:(0,i.__)("Button","generateblocks"),description:(0,i.__)("Drive conversions with beautiful buttons.","generateblocks"),parent:["generateblocks/button-container"],icon:p("button"),category:"generateblocks",keywords:[(0,i.__)("button"),(0,i.__)("buttons"),(0,i.__)("generate")],attributes:vs,supports:{className:!1,inserter:!1,reusable:!1},edit:bs,save:t=>{let{attributes:a}=t;const{uniqueId:l,text:n,url:i,target:o,relNoFollow:c,relSponsored:u,icon:g,iconLocation:d,removeText:p,ariaLabel:b,anchor:f}=a,h=[];c&&h.push("nofollow"),o&&h.push("noopener","noreferrer"),u&&h.push("sponsored");let k={className:s()({"gb-button":!0,[`gb-button-${l}`]:!0,"gb-button-text":!g}),href:i||null,target:o?"_blank":null,rel:h&&h.length>0?h.join(" "):null,"aria-label":b||null,id:f||null};k=(0,m.applyFilters)("generateblocks.frontend.htmlAttributes",k,"generateblocks/button",a);const y=r.useBlockProps.save(k);return(0,e.createElement)(qi,{tagName:i?"a":"span",htmlAttrs:y},(0,e.createElement)(ji,{hasIcon:!!g,direction:d,icon:g,hideChildren:p,showWrapper:!1},(0,e.createElement)(r.RichText.Content,{value:n,tagName:g?"span":void 0,className:g?"gb-button-text":void 0})))},deprecated:hs,usesContext:["postId","postType","generateblocks/query","generateblocks/inheritQuery"],__experimentalLabel:e=>ys(e,(0,i.__)("Button","generateblocks"))});var ws=window.wp.richText;const _s=(0,e.createElement)("svg",{viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",strokeLinejoin:"round",strokeMiterlimit:"1.414"},(0,e.createElement)("path",{d:"M4.331,15.598l2.193,1.693c0,0 -0.813,1.215 -0.992,1.215c-1.129,0.003 -1.424,0.008 -2.603,-0.001c-0.741,-0.006 -0.04,-0.955 0.187,-1.269c0.502,-0.694 1.215,-1.638 1.215,-1.638Zm7.632,-14.107c0.364,-0.061 5.412,3.896 5.439,4.272c0.031,0.438 -4.887,8.469 -5.635,9.648c-0.251,0.397 -1.185,0.206 -2.064,0.472c-0.801,0.243 -1.89,1.336 -2.193,1.105c-1.047,-0.796 -2.217,-1.646 -3.117,-2.49c-0.367,-0.343 0.388,-1.241 0.405,-2.188c0.015,-0.811 -0.644,-2.029 -0.196,-2.575c0.836,-1.019 6.931,-8.172 7.361,-8.244Zm0.144,1.454l3.95,3.105l-4.972,8.1l-5.197,-4.053l6.219,-7.152Z"})),Cs="generateblocks/mark",Ts=(0,q.compose)((0,l.withSelect)((function(e){return{selectedBlock:e("core/block-editor").getSelectedBlock()}})),(0,q.ifCondition)((function(e){return e.selectedBlock&&"generateblocks/headline"===e.selectedBlock.name})))((function(t){const a=()=>t.onChange((0,ws.toggleFormat)(t.value,{type:Cs}));return(0,e.createElement)(e.Fragment,null,(0,e.createElement)(r.RichTextShortcut,{type:"primary",character:"m",onUse:a}),(0,e.createElement)(r.RichTextToolbarButton,{icon:_s,title:(0,i.__)("Highlight","generateblocks"),onClick:a,isActive:t.isActive,shortcutType:"access",shortcutCharacter:"m",className:`toolbar-button-with-text toolbar-button__${Cs}`}))})),Es={title:(0,i.__)("Highlight","generateblocks"),tagName:"mark",className:"gb-highlight",edit:Ts};function Ss(t){let{level:a}=t;const l={h1:"M9 5h2v10H9v-4H5v4H3V5h2v4h4V5zm6.6 0c-.6.9-1.5 1.7-2.6 2v1h2v7h2V5h-1.4z",h2:"M7 5h2v10H7v-4H3v4H1V5h2v4h4V5zm8 8c.5-.4.6-.6 1.1-1.1.4-.4.8-.8 1.2-1.3.3-.4.6-.8.9-1.3.2-.4.3-.8.3-1.3 0-.4-.1-.9-.3-1.3-.2-.4-.4-.7-.8-1-.3-.3-.7-.5-1.2-.6-.5-.2-1-.2-1.5-.2-.4 0-.7 0-1.1.1-.3.1-.7.2-1 .3-.3.1-.6.3-.9.5-.3.2-.6.4-.8.7l1.2 1.2c.3-.3.6-.5 1-.7.4-.2.7-.3 1.2-.3s.9.1 1.3.4c.3.3.5.7.5 1.1 0 .4-.1.8-.4 1.1-.3.5-.6.9-1 1.2-.4.4-1 .9-1.6 1.4-.6.5-1.4 1.1-2.2 1.6V15h8v-2H15z",h3:"M12.1 12.2c.4.3.8.5 1.2.7.4.2.9.3 1.4.3.5 0 1-.1 1.4-.3.3-.1.5-.5.5-.8 0-.2 0-.4-.1-.6-.1-.2-.3-.3-.5-.4-.3-.1-.7-.2-1-.3-.5-.1-1-.1-1.5-.1V9.1c.7.1 1.5-.1 2.2-.4.4-.2.6-.5.6-.9 0-.3-.1-.6-.4-.8-.3-.2-.7-.3-1.1-.3-.4 0-.8.1-1.1.3-.4.2-.7.4-1.1.6l-1.2-1.4c.5-.4 1.1-.7 1.6-.9.5-.2 1.2-.3 1.8-.3.5 0 1 .1 1.6.2.4.1.8.3 1.2.5.3.2.6.5.8.8.2.3.3.7.3 1.1 0 .5-.2.9-.5 1.3-.4.4-.9.7-1.5.9v.1c.6.1 1.2.4 1.6.8.4.4.7.9.7 1.5 0 .4-.1.8-.3 1.2-.2.4-.5.7-.9.9-.4.3-.9.4-1.3.5-.5.1-1 .2-1.6.2-.8 0-1.6-.1-2.3-.4-.6-.2-1.1-.6-1.6-1l1.1-1.4zM7 9H3V5H1v10h2v-4h4v4h2V5H7v4z",h4:"M9 15H7v-4H3v4H1V5h2v4h4V5h2v10zm10-2h-1v2h-2v-2h-5v-2l4-6h3v6h1v2zm-3-2V7l-2.8 4H16z",h5:"M12.1 12.2c.4.3.7.5 1.1.7.4.2.9.3 1.3.3.5 0 1-.1 1.4-.4.4-.3.6-.7.6-1.1 0-.4-.2-.9-.6-1.1-.4-.3-.9-.4-1.4-.4H14c-.1 0-.3 0-.4.1l-.4.1-.5.2-1-.6.3-5h6.4v1.9h-4.3L14 8.8c.2-.1.5-.1.7-.2.2 0 .5-.1.7-.1.5 0 .9.1 1.4.2.4.1.8.3 1.1.6.3.2.6.6.8.9.2.4.3.9.3 1.4 0 .5-.1 1-.3 1.4-.2.4-.5.8-.9 1.1-.4.3-.8.5-1.3.7-.5.2-1 .3-1.5.3-.8 0-1.6-.1-2.3-.4-.6-.2-1.1-.6-1.6-1-.1-.1 1-1.5 1-1.5zM9 15H7v-4H3v4H1V5h2v4h4V5h2v10z",h6:"M9 15H7v-4H3v4H1V5h2v4h4V5h2v10zm8.6-7.5c-.2-.2-.5-.4-.8-.5-.6-.2-1.3-.2-1.9 0-.3.1-.6.3-.8.5l-.6.9c-.2.5-.2.9-.2 1.4.4-.3.8-.6 1.2-.8.4-.2.8-.3 1.3-.3.4 0 .8 0 1.2.2.4.1.7.3 1 .6.3.3.5.6.7.9.2.4.3.8.3 1.3s-.1.9-.3 1.4c-.2.4-.5.7-.8 1-.4.3-.8.5-1.2.6-1 .3-2 .3-3 0-.5-.2-1-.5-1.4-.9-.4-.4-.8-.9-1-1.5-.2-.6-.3-1.3-.3-2.1s.1-1.6.4-2.3c.2-.6.6-1.2 1-1.6.4-.4.9-.7 1.4-.9.6-.3 1.1-.4 1.7-.4.7 0 1.4.1 2 .3.5.2 1 .5 1.4.8 0 .1-1.3 1.4-1.3 1.4zm-2.4 5.8c.2 0 .4 0 .6-.1.2 0 .4-.1.5-.2.1-.1.3-.3.4-.5.1-.2.1-.5.1-.7 0-.4-.1-.8-.4-1.1-.3-.2-.7-.3-1.1-.3-.3 0-.7.1-1 .2-.4.2-.7.4-1 .7 0 .3.1.7.3 1 .1.2.3.4.4.6.2.1.3.3.5.3.2.1.5.2.7.1z",p:"M7.411 18V6.005h3.887c1.474 0 2.429.067 2.881.184.687.185 1.257.57 1.726 1.173.452.603.687 1.374.687 2.329 0 .737-.135 1.357-.403 1.86-.268.502-.603.904-1.021 1.189-.403.284-.821.469-1.257.57-.57.117-1.407.167-2.496.167H9.823V18H7.411zm2.412-9.968v3.401h1.324c.955 0 1.591-.05 1.926-.184.319-.118.57-.319.754-.587.185-.268.268-.57.268-.938 0-.435-.117-.787-.385-1.072a1.607 1.607 0 00-.972-.536c-.284-.05-.87-.084-1.742-.084H9.823z",div:"M6.969 6.005h4.423c1.005 0 1.759.084 2.295.235.703.2 1.306.57 1.809 1.105.503.52.871 1.173 1.14 1.944.267.754.385 1.708.385 2.83 0 .99-.118 1.844-.369 2.547-.302.871-.72 1.592-1.273 2.128-.419.402-.989.72-1.709.955-.536.167-1.24.251-2.144.251H6.969V6.005zm2.43 2.027v7.94h1.808c.67 0 1.156-.033 1.458-.1.402-.1.72-.268.972-.502.268-.235.485-.62.636-1.156.168-.536.251-1.273.251-2.195 0-.938-.083-1.641-.25-2.144-.152-.486-.386-.888-.688-1.156-.285-.285-.67-.469-1.122-.57-.335-.067-.989-.117-1.977-.117H9.398z"};if(!l.hasOwnProperty(a))return null;let r="0 0 20 20";return"p"!==a&&"div"!==a||(r="0 0 24 24"),(0,e.createElement)(n.SVG,{width:"24",height:"24",viewBox:r,xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)(n.Path,{d:l[a]}))}(0,ws.registerFormatType)(Cs,Es);var xs=t=>{let{setAttributes:a,element:l,isCaption:r}=t;return r?null:(0,e.createElement)(n.ToolbarGroup,{isCollapsed:!0,icon:(0,e.createElement)(Ss,{level:l}),label:(0,i.__)("Change Headline Element","generateblocks"),controls:[{isActive:"h1"===l,icon:(0,e.createElement)(Ss,{level:"h1"}),title:(0,i.sprintf)(// translators: %s: heading level e.g: "1", "2", "3" +(0,i.__)("Post of id #%1$s and post type %2$s was not found.","generateblocks"),a,l);const u=Object.assign({},e,{dateFormat:r}),g="generateblocks/image"===t;return function(e,t,a){let l=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const r=Ji[e];return r&&"function"==typeof r?r(t,a,l):Qi(0,a,l)}(e.dynamicContentType,s,u,g)})(o,a),d=function(e){return{"generateblocks/headline":Wi,"generateblocks/button":$i,"generateblocks/container":bo,"generateblocks/image":Lo}[e]}(a),p="generateblocks/headline"===a?l.content:l.text;let b=l.dynamicContentType?g:p;c&&"terms"===s&&"generateblocks/headline"===a&&(b=g.split(u).map(((t,a,l)=>(0,e.createElement)(e.Fragment,null,(0,e.createElement)("a",null,t),a+1!==l.length&&u)))),"terms"===s&&"generateblocks/button"===a&&(b=g.split(u)[0]);const m=!b||"generateblocks/container"!==a&&"generateblocks/image"!==a||!function(e){try{return new URL(e),!0}catch(e){return!1}}(b)&&isNaN(parseInt(b))?void 0:b,f=Object.assign({},l,{content:"generateblocks/headline"===a?b:void 0,text:"generateblocks/button"===a?b:void 0,dynamicImage:m}),h=Object.assign({},t,{InnerContent:l.dynamicContentType?r.RichText.Content:r.RichText,attributes:f});return(0,e.createElement)(d,h)}var Oo=t=>a=>{const{attributes:l,setAttributes:r,context:n,name:i}=a,o=l.useDynamicData&&(l.dynamicContentType||l.dynamicLinkType)?Object.assign({},a,{ContentRenderer:zo}):a;return(0,e.createElement)(e.Fragment,null,(0,e.createElement)(t,o),(0,e.createElement)(Ui,{context:n,attributes:l,setAttributes:r,name:i}))},Io=(0,q.compose)(Oo,le,(t=>a=>{const{attributes:l,setAttributes:r}=a;return(0,e.useEffect)((()=>{if(void 0!==l.isDynamic&&l.isDynamic||r({isDynamic:!0}),void 0===l.blockVersion||l.blockVersion<2){let e=l.gradient&&"pseudo-element"===l.gradientSelector&&!x(l.innerZindex);e||(e=!!l.bgImage&&void 0!==l.bgOptions.selector&&"pseudo-element"===l.bgOptions.selector),e||(e=void 0!==l.useAdvBackgrounds&&l.useAdvBackgrounds),e&&r({innerZindex:1})}if(!re(l)&&ne(l.blockVersion,2)){const e=generateBlocksLegacyDefaults.v_1_4_0.container,t=void 0!==l.useGlobalStyle&&l.useGlobalStyle,a={},n=[];t||n.push("paddingTop","paddingRight","paddingBottom","paddingLeft"),l.isGrid&&n.push("width","widthMobile"),l.gradient&&n.push("gradientDirection","gradientColorOne","gradientColorOneOpacity","gradientColorTwo","gradientColorTwoOpacity"),n.forEach((t=>{x(l[t])||(a[t]=e[t])})),Object.keys(a).length>0&&r(a)}void 0===l.bgOptions.selector&&r({bgOptions:{...l.bgOptions,selector:"element"}}),void 0===l.bgOptions.opacity&&r({bgOptions:{...l.bgOptions,opacity:1}}),ne(l.blockVersion,2)&&r({blockVersion:2})}),[]),(0,e.createElement)(t,a)}))((a=>{const{attributes:l,setAttributes:r,ContentRenderer:n=bo}=a,{anchor:i,fontFamily:o,googleFont:s,googleFontVariants:c,isBlockPreview:u=!1}=l,[g,d]=W("Desktop"),p=(0,m.applyFilters)("generateblocks.editor.containerTagNames",[{label:"div",value:"div"},{label:"article",value:"article"},{label:"section",value:"section"},{label:"header",value:"header"},{label:"footer",value:"footer"},{label:"aside",value:"aside"}],a,{deviceType:g}),b=(0,m.applyFilters)("generateblocks.editor.allowedContainerTagNames",["div","article","section","header","footer","aside","a"]),f=e=>b.includes(e)?e:"div",h=[];return Object.keys(generateBlocksInfo.svgShapes).forEach((e=>{const t=generateBlocksInfo.svgShapes[e].svgs;Object.keys(t).forEach((e=>{h[e]={label:t[e].label,icon:t[e].icon}}))})),(0,e.createElement)(e.Fragment,null,(0,e.createElement)(rn,{attributes:l,setAttributes:r,deviceType:g}),(0,e.createElement)(Mi,t({},a,{deviceType:g,setDeviceType:d,state:{deviceType:g},blockDefaults:generateBlocksDefaults.container,tagNames:p,filterTagName:f,allShapes:h})),(0,e.createElement)(z,{anchor:i,setAttributes:r}),(0,e.createElement)(nn,{fontFamily:o,googleFont:s,googleFontVariants:c,isBlockPreview:u}),(0,e.createElement)(n,t({},a,{generateBlocksInfo:generateBlocksInfo,filterTagName:f,allShapes:h,deviceType:g})))})),No={uniqueId:{type:"string",default:""},anchor:{type:"string",default:""},isGrid:{type:"boolean",default:!1},isQueryLoopItem:{type:"boolean",default:!1},gridId:{type:"string",default:""},tagName:{type:"string",default:generateBlocksDefaults.container.tagName},width:{type:"number",default:generateBlocksDefaults.container.width},widthTablet:{type:"number",default:generateBlocksDefaults.container.widthTablet},widthMobile:{type:"number",default:generateBlocksDefaults.container.widthMobile},autoWidthTablet:{type:"boolean",default:generateBlocksDefaults.container.autoWidthTablet},autoWidthMobile:{type:"boolean",default:generateBlocksDefaults.container.autoWidthMobile},flexGrow:{type:"number",default:generateBlocksDefaults.container.flexGrow},flexGrowTablet:{type:"number",default:generateBlocksDefaults.container.flexGrowTablet},flexGrowMobile:{type:"number",default:generateBlocksDefaults.container.flexGrowMobile},flexShrink:{type:"number",default:generateBlocksDefaults.container.flexShrink},flexShrinkTablet:{type:"number",default:generateBlocksDefaults.container.flexShrinkTablet},flexShrinkMobile:{type:"number",default:generateBlocksDefaults.container.flexShrinkMobile},flexBasis:{type:"string",default:generateBlocksDefaults.container.flexBasis},flexBasisTablet:{type:"string",default:generateBlocksDefaults.container.flexBasisTablet},flexBasisMobile:{type:"string",default:generateBlocksDefaults.container.flexBasisMobile},flexBasisUnit:{type:"string",default:generateBlocksDefaults.container.flexBasisUnit},orderTablet:{type:"number",default:generateBlocksDefaults.container.orderTablet},orderMobile:{type:"number",default:generateBlocksDefaults.container.orderMobile},outerContainer:{type:"string",default:generateBlocksDefaults.container.outerContainer},innerContainer:{type:"string",default:generateBlocksDefaults.container.innerContainer},containerWidth:{type:"number",default:generateBlocksDefaults.container.containerWidth},minHeight:{type:"number",default:generateBlocksDefaults.container.minHeight},minHeightUnit:{type:"string",default:generateBlocksDefaults.container.minHeightUnit},minHeightTablet:{type:"number",default:generateBlocksDefaults.container.minHeightTablet},minHeightUnitTablet:{type:"string",default:generateBlocksDefaults.container.minHeightUnitTablet},minHeightMobile:{type:"number",default:generateBlocksDefaults.container.minHeightMobile},minHeightUnitMobile:{type:"string",default:generateBlocksDefaults.container.minHeightUnitMobile},paddingTop:{type:"string",default:generateBlocksDefaults.container.paddingTop},paddingRight:{type:"string",default:generateBlocksDefaults.container.paddingRight},paddingBottom:{type:"string",default:generateBlocksDefaults.container.paddingBottom},paddingLeft:{type:"string",default:generateBlocksDefaults.container.paddingLeft},paddingUnit:{type:"string",default:generateBlocksDefaults.container.paddingUnit},paddingSyncUnits:{type:"boolean",default:!1},paddingTopTablet:{type:"string",default:generateBlocksDefaults.container.paddingTopTablet},paddingRightTablet:{type:"string",default:generateBlocksDefaults.container.paddingRightTablet},paddingBottomTablet:{type:"string",default:generateBlocksDefaults.container.paddingBottomTablet},paddingLeftTablet:{type:"string",default:generateBlocksDefaults.container.paddingLeftTablet},paddingTopMobile:{type:"string",default:generateBlocksDefaults.container.paddingTopMobile},paddingRightMobile:{type:"string",default:generateBlocksDefaults.container.paddingRightMobile},paddingBottomMobile:{type:"string",default:generateBlocksDefaults.container.paddingBottomMobile},paddingLeftMobile:{type:"string",default:generateBlocksDefaults.container.paddingLeftMobile},marginTop:{type:"string",default:generateBlocksDefaults.container.marginTop},marginRight:{type:"string",default:generateBlocksDefaults.container.marginRight},marginBottom:{type:"string",default:generateBlocksDefaults.container.marginBottom},marginLeft:{type:"string",default:generateBlocksDefaults.container.marginLeft},marginUnit:{type:"string",default:generateBlocksDefaults.container.marginUnit},marginSyncUnits:{type:"boolean",default:!1},marginTopTablet:{type:"string",default:generateBlocksDefaults.container.marginTopTablet},marginRightTablet:{type:"string",default:generateBlocksDefaults.container.marginRightTablet},marginBottomTablet:{type:"string",default:generateBlocksDefaults.container.marginBottomTablet},marginLeftTablet:{type:"string",default:generateBlocksDefaults.container.marginLeftTablet},marginTopMobile:{type:"string",default:generateBlocksDefaults.container.marginTopMobile},marginRightMobile:{type:"string",default:generateBlocksDefaults.container.marginRightMobile},marginBottomMobile:{type:"string",default:generateBlocksDefaults.container.marginBottomMobile},marginLeftMobile:{type:"string",default:generateBlocksDefaults.container.marginLeftMobile},borderSizeTop:{type:"string",default:generateBlocksDefaults.container.borderSizeTop},borderSizeRight:{type:"string",default:generateBlocksDefaults.container.borderSizeRight},borderSizeBottom:{type:"string",default:generateBlocksDefaults.container.borderSizeBottom},borderSizeLeft:{type:"string",default:generateBlocksDefaults.container.borderSizeLeft},borderSizeTopTablet:{type:"string",default:generateBlocksDefaults.container.borderSizeTopTablet},borderSizeRightTablet:{type:"string",default:generateBlocksDefaults.container.borderSizeRightTablet},borderSizeBottomTablet:{type:"string",default:generateBlocksDefaults.container.borderSizeBottomTablet},borderSizeLeftTablet:{type:"string",default:generateBlocksDefaults.container.borderSizeLeftTablet},borderSizeTopMobile:{type:"string",default:generateBlocksDefaults.container.borderSizeTopMobile},borderSizeRightMobile:{type:"string",default:generateBlocksDefaults.container.borderSizeRightMobile},borderSizeBottomMobile:{type:"string",default:generateBlocksDefaults.container.borderSizeBottomMobile},borderSizeLeftMobile:{type:"string",default:generateBlocksDefaults.container.borderSizeLeftMobile},borderRadiusTopRight:{type:"string",default:generateBlocksDefaults.container.borderRadiusTopRight},borderRadiusBottomRight:{type:"string",default:generateBlocksDefaults.container.borderRadiusBottomRight},borderRadiusBottomLeft:{type:"string",default:generateBlocksDefaults.container.borderRadiusBottomLeft},borderRadiusTopLeft:{type:"string",default:generateBlocksDefaults.container.borderRadiusTopLeft},borderRadiusUnit:{type:"string",default:generateBlocksDefaults.container.borderRadiusUnit},borderRadiusTopRightTablet:{type:"string",default:generateBlocksDefaults.container.borderRadiusTopRightTablet},borderRadiusBottomRightTablet:{type:"string",default:generateBlocksDefaults.container.borderRadiusBottomRightTablet},borderRadiusBottomLeftTablet:{type:"string",default:generateBlocksDefaults.container.borderRadiusBottomLeftTablet},borderRadiusTopLeftTablet:{type:"string",default:generateBlocksDefaults.container.borderRadiusTopLeftTablet},borderRadiusTopRightMobile:{type:"string",default:generateBlocksDefaults.container.borderRadiusTopRightMobile},borderRadiusBottomRightMobile:{type:"string",default:generateBlocksDefaults.container.borderRadiusBottomRightMobile},borderRadiusBottomLeftMobile:{type:"string",default:generateBlocksDefaults.container.borderRadiusBottomLeftMobile},borderRadiusTopLeftMobile:{type:"string",default:generateBlocksDefaults.container.borderRadiusTopLeftMobile},borderColor:{type:"string",default:generateBlocksDefaults.container.borderColor},borderColorOpacity:{type:"number",default:generateBlocksDefaults.container.borderColorOpacity},backgroundColor:{type:"string",default:generateBlocksDefaults.container.backgroundColor},backgroundColorOpacity:{type:"number",default:generateBlocksDefaults.container.backgroundColorOpacity},gradient:{type:"boolean",default:generateBlocksDefaults.container.gradient},gradientDirection:{type:"number",default:generateBlocksDefaults.container.gradientDirection},gradientColorOne:{type:"string",default:generateBlocksDefaults.container.gradientColorOne},gradientColorOneOpacity:{type:"number",default:generateBlocksDefaults.container.gradientColorOneOpacity},gradientColorStopOne:{type:"number",default:generateBlocksDefaults.container.gradientColorStopOne},gradientColorTwo:{type:"string",default:generateBlocksDefaults.container.gradientColorTwo},gradientColorTwoOpacity:{type:"number",default:generateBlocksDefaults.container.gradientColorTwoOpacity},gradientColorStopTwo:{type:"number",default:generateBlocksDefaults.container.gradientColorStopTwo},gradientSelector:{type:"string",default:"element"},textColor:{type:"string",default:generateBlocksDefaults.container.textColor},linkColor:{type:"string",default:generateBlocksDefaults.container.linkColor},linkColorHover:{type:"string",default:generateBlocksDefaults.container.linkColorHover},bgImage:{type:"object",default:generateBlocksDefaults.container.bgImage},bgOptions:{type:"object",default:{selector:generateBlocksDefaults.container.bgOptions.selector,opacity:generateBlocksDefaults.container.bgOptions.opacity,overlay:generateBlocksDefaults.container.bgOptions.overlay,position:generateBlocksDefaults.container.bgOptions.position,size:generateBlocksDefaults.container.bgOptions.size,repeat:generateBlocksDefaults.container.bgOptions.repeat,attachment:generateBlocksDefaults.container.bgOptions.attachment}},bgImageSize:{type:"string",default:generateBlocksDefaults.container.bgImageSize},bgImageInline:{type:"boolean",default:generateBlocksDefaults.container.bgImageInline},verticalAlignment:{type:"string",default:generateBlocksDefaults.container.verticalAlignment},verticalAlignmentTablet:{type:"string",default:generateBlocksDefaults.container.verticalAlignmentTablet},verticalAlignmentMobile:{type:"string",default:generateBlocksDefaults.container.verticalAlignmentMobile},zindex:{type:"number",default:generateBlocksDefaults.container.zindex},innerZindex:{type:"number",default:generateBlocksDefaults.container.innerZindex},removeVerticalGap:{type:"boolean",default:generateBlocksDefaults.container.removeVerticalGap},removeVerticalGapTablet:{type:"boolean",default:generateBlocksDefaults.container.removeVerticalGapTablet},removeVerticalGapMobile:{type:"boolean",default:generateBlocksDefaults.container.removeVerticalGapMobile},alignment:{type:"string",default:generateBlocksDefaults.container.alignment},alignmentTablet:{type:"string",default:generateBlocksDefaults.container.alignmentTablet},alignmentMobile:{type:"string",default:generateBlocksDefaults.container.alignmentMobile},fontFamily:{type:"string",default:generateBlocksDefaults.container.fontFamily},fontFamilyFallback:{type:"string",default:generateBlocksDefaults.container.fontFamilyFallback},googleFont:{type:"boolean",default:generateBlocksDefaults.container.googleFont},googleFontVariants:{type:"string",default:generateBlocksDefaults.container.googleFontVariants},fontWeight:{type:"string",default:generateBlocksDefaults.container.fontWeight},fontSize:{type:"number",default:generateBlocksDefaults.container.fontSize},fontSizeTablet:{type:"number",default:generateBlocksDefaults.container.fontSizeTablet},fontSizeMobile:{type:"number",default:generateBlocksDefaults.container.fontSizeMobile},fontSizeUnit:{type:"string",default:generateBlocksDefaults.container.fontSizeUnit},textTransform:{type:"string",default:""},align:{type:"string",default:""},shapeDividers:{type:"array",default:[]},isDynamic:{type:"boolean"},blockVersion:{type:"number"},elementId:{type:"string",default:""},cssClasses:{type:"string",default:""}};const Ao=[{attributes:No,supports:{align:!1,anchor:!1,className:!1,customClassName:!1},migrate(e){const t=e.cssClasses?e.cssClasses:e.className,a=e.elementId?e.elementId:e.anchor;return{...e,className:t,anchor:a,cssClasses:"",elementId:""}},save(t){let{attributes:a}=t;const{uniqueId:l,tagName:n,elementId:i,cssClasses:o,isGrid:c,align:u}=a;let g={className:s()({"gb-container":!0,[`gb-container-${l}`]:!0,[`${o}`]:""!==o,[`align${u}`]:!!u&&!c}),id:i||null};return g=(0,m.applyFilters)("generateblocks.frontend.htmlAttributes",g,"generateblocks/container",a),(0,e.createElement)((e=>{let{condition:t,wrap:a,children:l}=e;return t?a(l):l}),{condition:c,wrap:t=>(0,e.createElement)("div",{className:s()({"gb-grid-column":!0,[`gb-grid-column-${l}`]:!0})},t)},(0,e.createElement)(qi,{tagName:n,htmlAttrs:g},(0,m.applyFilters)("generateblocks.frontend.insideContainer","",a),(0,e.createElement)("div",{className:s()({"gb-inside-container":!0})},(0,e.createElement)(r.InnerBlocks.Content,null))))}}];var Fo=Ao;const Po=Object.assign({},No,Zi);(0,g.registerBlockType)("generateblocks/container",{apiVersion:2,title:(0,i.__)("Container","generateblocks"),description:(0,i.__)("Organize your content into rows and sections.","generateblocks"),icon:p("container"),category:"generateblocks",keywords:[(0,i.__)("section"),(0,i.__)("container"),(0,i.__)("generate")],attributes:Po,supports:{align:!1,className:!1,html:!1},usesContext:["postId","postType","generateblocks/queryId"],edit:Io,save:()=>(0,e.createElement)(r.InnerBlocks.Content,null),deprecated:Fo,__experimentalLabel:e=>e.isQueryLoopItem?(0,i.__)("Post Template","generateblocks"):(0,i.__)("Container","generateblocks")});var Ho=(0,e.createElement)(T.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,e.createElement)(T.Path,{d:"M18 11.2h-5.2V6h-1.6v5.2H6v1.6h5.2V18h1.6v-5.2H18z"}));const Vo=[{icon:Co,title:(0,i.__)("Align buttons left","generateblocks"),align:"left"},{icon:To,title:(0,i.__)("Align buttons center","generateblocks"),align:"center"},{icon:Eo,title:(0,i.__)("Align buttons right","generateblocks"),align:"right"}];var Uo=t=>{const{attributes:a,setAttributes:o,clientId:s,deviceType:c}=t,{alignment:u,alignmentTablet:d,alignmentMobile:p,isPagination:b}=a,{insertBlocks:m}=(0,l.useDispatch)("core/block-editor"),{getBlocksByClientId:f}=(0,l.useSelect)((e=>e("core/block-editor")),[]);return(0,e.createElement)(r.BlockControls,null,!b&&(0,e.createElement)(n.ToolbarGroup,null,(0,e.createElement)(n.ToolbarButton,{className:"gblocks-add-new-button",icon:Ho,label:(0,i.__)("Add Button","generateblocks"),onClick:()=>{const e=f(s)[0];if(e){const t=e.innerBlocks,a=Object.keys(t),l=a[a.length-1];if(void 0!==t[l]){const e=t[l].clientId;if(e){const t=f(e)[0],a=(0,g.cloneBlock)(t,{uniqueId:""});m(a,void 0,s)}}else 0===t.length&&m((0,g.createBlock)("generateblocks/button",generateBlocksStyling.button),void 0,s)}},showTooltip:!0})),"Desktop"===c&&(0,e.createElement)(r.AlignmentToolbar,{value:u,alignmentControls:Vo,onChange:e=>{o({alignment:e})}}),"Tablet"===c&&(0,e.createElement)(r.AlignmentToolbar,{value:d,alignmentControls:Vo,onChange:e=>{o({alignmentTablet:e})}}),"Mobile"===c&&(0,e.createElement)(r.AlignmentToolbar,{value:p,alignmentControls:Vo,onChange:e=>{o({alignmentMobile:e})}}))},Go=a=>{const{attributes:l,setAttributes:o,deviceType:s,state:c}=a,{stack:u,stackTablet:g,stackMobile:d,fillHorizontalSpace:b,fillHorizontalSpaceTablet:f,fillHorizontalSpaceMobile:h}=l;return(0,e.createElement)(r.InspectorControls,null,(0,e.createElement)(C,t({},a,{title:(0,i.__)("Spacing","generateblocks"),initialOpen:!0,icon:p("spacing"),className:"gblocks-panel-label",id:"buttonContainerSpacing",state:c}),(0,e.createElement)(dn,t({},a,{device:s,type:"margin",label:(0,i.__)("Margin","generateblocks"),units:["px","em","%"]})),"Desktop"===s&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.ToggleControl,{label:(0,i.__)("Stack Vertically","generateblocks"),checked:!!u,onChange:e=>{o({stack:e,stackTablet:e&&!g?e:g,stackMobile:e&&!d?e:d})}}),(0,e.createElement)(n.ToggleControl,{label:(0,i.__)("Fill Horizontal Space","generateblocks"),checked:!!b,onChange:e=>{o({fillHorizontalSpace:e,fillHorizontalSpaceTablet:e&&!f?e:f,fillHorizontalSpaceMobile:e&&!h?e:h})}})),"Tablet"===s&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.ToggleControl,{label:(0,i.__)("Stack Vertically","generateblocks"),checked:!!g,onChange:e=>{o({stackTablet:e,stackMobile:e&&!d?e:d})}}),(0,e.createElement)(n.ToggleControl,{label:(0,i.__)("Fill Horizontal Space","generateblocks"),checked:!!f,onChange:e=>{o({fillHorizontalSpaceTablet:e,fillHorizontalSpaceMobile:e&&!h?e:h})}})),"Mobile"===s&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.ToggleControl,{label:(0,i.__)("Stack Vertically","generateblocks"),checked:!!d,onChange:e=>{o({stackMobile:e})}}),(0,e.createElement)(n.ToggleControl,{label:(0,i.__)("Fill Horizontal Space","generateblocks"),checked:!!h,onChange:e=>{o({fillHorizontalSpaceMobile:e})}})),(0,m.applyFilters)("generateblocks.editor.controls","","buttonContainerSpacing",a,c)))};function jo(e){return"left"===e||"top"===e?"flex-start":"right"===e||"bottom"===e?"flex-end":e}class qo extends e.Component{render(){const t=(0,m.applyFilters)("generateblocks.editor.cssAttrs",this.props.attributes,this.props),{uniqueId:a,alignment:l,stack:r,fillHorizontalSpace:n}=t;let i=[];return i[".gb-button-wrapper-"+a]=[{display:!!n&&"block","flex-direction":!!r&&"column","align-items":!!r&&jo(l)}],i[".gb-button-wrapper-"+a+" > .block-editor-inner-blocks > .block-editor-block-list__layout"]=[{"flex-direction":!!r&&"column","align-items":!!r&&jo(l)}],n&&(i[".gb-button-wrapper-"+a+" > .block-editor-inner-blocks > .block-editor-block-list__layout > .wp-block"]=[{flex:"1"}],i[".gb-button-wrapper-"+a+" > .components-button"]=[{background:"#fff",border:"1px solid #ddd","margin-top":"10px"}]),r&&n&&(i[".gb-button-wrapper-"+a+" > .block-editor-inner-blocks > .block-editor-block-list__layout > .wp-block"]=[{width:"100% !important","box-sizing":"border-box"}]),i=(0,m.applyFilters)("generateblocks.editor.desktopCSS",i,this.props,"button-container"),(0,e.createElement)("style",null,O(i))}}class Wo extends e.Component{render(){const t=(0,m.applyFilters)("generateblocks.editor.cssAttrs",this.props.attributes,this.props),{uniqueId:a,alignmentTablet:l,marginTopTablet:r,marginRightTablet:n,marginBottomTablet:i,marginLeftTablet:o,marginUnit:s}=t;let c=[];return c[".editor-styles-wrapper .gb-button-wrapper-"+a]=[{"margin-top":I(r,s),"margin-right":I(n,s),"margin-bottom":I(i,s),"margin-left":I(o,s),"justify-content":jo(l)}],c[".gb-button-wrapper-"+a+" > .block-editor-inner-blocks > .block-editor-block-list__layout"]=[{"justify-content":jo(l)}],c=(0,m.applyFilters)("generateblocks.editor.tabletCSS",c,this.props,"button-container"),(0,e.createElement)("style",null,O(c))}}class $o extends e.Component{render(){const t=(0,m.applyFilters)("generateblocks.editor.cssAttrs",this.props.attributes,this.props),{uniqueId:a,alignmentTablet:l,stackTablet:r,fillHorizontalSpaceTablet:n}=t;let i=[];return i[".gb-button-wrapper-"+a]=[{display:!!n&&"block","flex-direction":!!r&&"column","align-items":!!r&&jo(l)}],i[".gb-button-wrapper-"+a+" > .block-editor-inner-blocks > .block-editor-block-list__layout"]=[{"flex-direction":!!r&&"column","align-items":!!r&&jo(l)}],n&&(i[".gb-button-wrapper-"+a+" > .block-editor-inner-blocks > .block-editor-block-list__layout > .wp-block"]=[{flex:"1"}],i[".gb-button-wrapper-"+a+" > .components-button"]=[{background:"#fff",border:"1px solid #ddd","margin-top":"10px"}]),r&&n&&(i[".gb-button-wrapper-"+a+" > .block-editor-inner-blocks > .block-editor-block-list__layout > .wp-block"]=[{width:"100% !important","box-sizing":"border-box"}]),i=(0,m.applyFilters)("generateblocks.editor.tabletOnlyCSS",i,this.props,"button-container"),(0,e.createElement)("style",null,O(i))}}class Zo extends e.Component{render(){const t=(0,m.applyFilters)("generateblocks.editor.cssAttrs",this.props.attributes,this.props),{uniqueId:a,alignmentMobile:l,marginTopMobile:r,marginRightMobile:n,marginBottomMobile:i,marginLeftMobile:o,marginUnit:s,stackMobile:c,fillHorizontalSpaceMobile:u}=t;let g=[];return g[".editor-styles-wrapper .gb-button-wrapper-"+a]=[{display:!!u&&"block","margin-top":I(r,s),"margin-right":I(n,s),"margin-bottom":I(i,s),"margin-left":I(o,s),"justify-content":jo(l),"flex-direction":!!c&&"column","align-items":!!c&&jo(l)}],g[".gb-button-wrapper-"+a+" > .block-editor-inner-blocks > .block-editor-block-list__layout"]=[{"flex-direction":!!c&&"column","align-items":!!c&&jo(l),"justify-content":jo(l)}],u&&(g[".gb-button-wrapper-"+a+" > .block-editor-inner-blocks > .block-editor-block-list__layout > .wp-block"]=[{flex:"1"}],g[".gb-button-wrapper-"+a+" > .components-button"]=[{background:"#fff",border:"1px solid #ddd","margin-top":"10px"}]),c&&u&&(g[".gb-button-wrapper-"+a+" > .block-editor-inner-blocks > .block-editor-block-list__layout > .wp-block"]=[{width:"100% !important","box-sizing":"border-box"}]),g=(0,m.applyFilters)("generateblocks.editor.mobileCSS",g,this.props,"button-container"),(0,e.createElement)("style",null,O(g))}}class Ko extends e.Component{render(){const t=(0,m.applyFilters)("generateblocks.editor.cssAttrs",this.props.attributes,this.props),{uniqueId:a,alignment:l,marginTop:r,marginRight:n,marginBottom:i,marginLeft:o,marginUnit:s}=t;let c=[];return c[".editor-styles-wrapper .gb-button-wrapper-"+a]=[{margin:io(r,n,i,o,s),"justify-content":jo(l)}],c[".gb-button-wrapper-"+a+" > .block-editor-inner-blocks > .block-editor-block-list__layout"]=[{"justify-content":jo(l)}],c=(0,m.applyFilters)("generateblocks.editor.mainCSS",c,this.props,"button-container"),(0,e.createElement)("style",null,O(c))}}var Jo=(0,e.memo)((function(t){const a=(0,l.useSelect)((e=>{if(!e("core/edit-post"))return"Desktop";const{__experimentalGetPreviewDeviceType:t=(()=>"Desktop")}=e("core/edit-post");return t()}),[]),{isBlockPreview:r=!1}=t?.attributes;return r?null:(0,e.createElement)(e.Fragment,null,(0,e.createElement)(Ko,t),a&&(0,e.createElement)(e.Fragment,null,"Desktop"===a&&(0,e.createElement)(qo,t),("Tablet"===a||"Mobile"===a)&&(0,e.createElement)(Wo,t),"Tablet"===a&&(0,e.createElement)($o,t),"Mobile"===a&&(0,e.createElement)(Zo,t)))}),G),Qo=(0,q.compose)(le,(t=>a=>{const{attributes:l,setAttributes:r}=a;return(0,e.useEffect)((()=>{void 0!==l.isDynamic&&l.isDynamic||r({isDynamic:!0}),(void 0===l.blockVersion||l.blockVersion<2)&&(l.stack||l.fillHorizontalSpace)&&(l.stack&&r({stackTablet:!0,stackMobile:!0}),l.fillHorizontalSpace&&r({fillHorizontalSpaceTablet:!0,fillHorizontalSpaceMobile:!0})),(void 0===l.blockVersion||l.blockVersion<2)&&r({blockVersion:2})}),[]),(0,e.createElement)(t,a)}))((a=>{const{attributes:n,setAttributes:i,clientId:o,name:c,context:u}=a,{uniqueId:g,className:d,anchor:p}=n,[b,f]=(0,e.useState)(0),[h,k]=W("Desktop"),y=$(o),{removeBlock:v}=(0,l.useDispatch)("core/block-editor");(0,e.useEffect)((()=>{1===b&&0===y&&v(o),f(y)}),[y]);let w={className:s()({"gb-button-wrapper":!0,[`gb-button-wrapper-${g}`]:!0,[`${d}`]:void 0!==d}),id:p||null};w=(0,m.applyFilters)("generateblocks.frontend.htmlAttributes",w,"generateblocks/button-container",n);const _=(0,r.useBlockProps)(w);return(0,e.createElement)(e.Fragment,null,(0,e.createElement)(Uo,{attributes:n,setAttributes:i,clientId:o,deviceType:h}),(0,e.createElement)(Go,t({},a,{deviceType:h,setDeviceType:k,state:{deviceType:h},blockDefaults:generateBlocksDefaults.buttonContainer})),(0,e.createElement)(z,{anchor:p,setAttributes:i}),(0,e.createElement)(Jo,t({},a,{deviceType:h})),(0,e.createElement)(Gi,{name:c,clientId:o},(0,e.createElement)("div",_,(0,e.createElement)(r.BlockContextProvider,{value:{"generateblocks/query":u["generateblocks/query"]}},(0,e.createElement)(r.InnerBlocks,{allowedBlocks:["generateblocks/button"],renderAppender:!1,template:[["generateblocks/button",generateBlocksStyling.button]]})))))})),Yo={uniqueId:{type:"string",default:""},anchor:{type:"string",default:""},isPagination:{type:"boolean",default:!1},alignment:{type:"string",default:generateBlocksDefaults.buttonContainer.alignment},alignmentTablet:{type:"string",default:generateBlocksDefaults.buttonContainer.alignment},alignmentMobile:{type:"string",default:generateBlocksDefaults.buttonContainer.alignment},marginTop:{type:"string",default:generateBlocksDefaults.buttonContainer.marginTop},marginRight:{type:"string",default:generateBlocksDefaults.buttonContainer.marginRight},marginBottom:{type:"string",default:generateBlocksDefaults.buttonContainer.marginBottom},marginLeft:{type:"string",default:generateBlocksDefaults.buttonContainer.marginLeft},marginUnit:{type:"string",default:generateBlocksDefaults.buttonContainer.marginUnit},marginTopTablet:{type:"string",default:generateBlocksDefaults.buttonContainer.marginTopTablet},marginRightTablet:{type:"string",default:generateBlocksDefaults.buttonContainer.marginRightTablet},marginBottomTablet:{type:"string",default:generateBlocksDefaults.buttonContainer.marginBottomTablet},marginLeftTablet:{type:"string",default:generateBlocksDefaults.buttonContainer.marginLeftTablet},marginTopMobile:{type:"string",default:generateBlocksDefaults.buttonContainer.marginTopMobile},marginRightMobile:{type:"string",default:generateBlocksDefaults.buttonContainer.marginRightMobile},marginBottomMobile:{type:"string",default:generateBlocksDefaults.buttonContainer.marginBottomMobile},marginLeftMobile:{type:"string",default:generateBlocksDefaults.buttonContainer.marginLeftMobile},stack:{type:"boolean",default:generateBlocksDefaults.buttonContainer.stack},stackTablet:{type:"boolean",default:generateBlocksDefaults.buttonContainer.stackTablet},stackMobile:{type:"boolean",default:generateBlocksDefaults.buttonContainer.stackMobile},fillHorizontalSpace:{type:"boolean",default:generateBlocksDefaults.buttonContainer.fillHorizontalSpace},fillHorizontalSpaceTablet:{type:"boolean",default:generateBlocksDefaults.buttonContainer.fillHorizontalSpaceTablet},fillHorizontalSpaceMobile:{type:"boolean",default:generateBlocksDefaults.buttonContainer.fillHorizontalSpaceMobile},isDynamic:{type:"boolean"},blockVersion:{type:"number"},elementId:{type:"string",default:""},cssClasses:{type:"string",default:""}};const Xo=[{attributes:Yo,supports:{anchor:!1,className:!1,customClassName:!1},migrate(e){const t=e.cssClasses?e.cssClasses:e.className,a=e.elementId?e.elementId:e.anchor;return{...e,className:t,anchor:a,cssClasses:"",elementId:""}},save(t){let{attributes:a}=t;const{uniqueId:l,elementId:n,cssClasses:i}=a;let o={id:n||void 0,className:s()({"gb-button-wrapper":!0,[`gb-button-wrapper-${l}`]:!0,[`${i}`]:""!==i})};return o=(0,m.applyFilters)("generateblocks.frontend.htmlAttributes",o,"generateblocks/button-container",a),(0,e.createElement)("div",o,(0,e.createElement)(r.InnerBlocks.Content,null))}}];var es=Xo;(0,g.registerBlockType)("generateblocks/button-container",{apiVersion:2,title:(0,i.__)("Buttons","generateblocks"),description:(0,i.__)("Drive conversions with beautiful buttons.","generateblocks"),icon:p("button-container"),category:"generateblocks",keywords:[(0,i.__)("button"),(0,i.__)("buttons"),(0,i.__)("generate")],attributes:Yo,supports:{className:!1,html:!1},usesContext:["generateblocks/queryId","generateblocks/query"],edit:Qo,save:()=>(0,e.createElement)(r.InnerBlocks.Content,null),deprecated:es,__experimentalLabel:e=>e.isPagination?(0,i.__)("Pagination","generateblocks"):(0,i.__)("Buttons","generateblocks")});var ts=t=>{let{clientId:a,attributes:o,setAttributes:s}=t;const{insertBlocks:c}=(0,l.useDispatch)("core/block-editor"),{getBlockParentsByBlockName:u,getBlockRootClientId:d,getBlocksByClientId:p}=(0,l.useSelect)((e=>e("core/block-editor")),[]),{url:b,target:f,relNoFollow:h,relSponsored:k,useDynamicData:y,dynamicLinkType:v}=o,w=y&&v;return(0,e.createElement)(e.Fragment,null,(0,e.createElement)(r.BlockControls,null,(0,e.createElement)(n.ToolbarGroup,null,(0,e.createElement)(n.ToolbarButton,{className:"gblocks-add-new-button",icon:Ho,label:(0,i.__)("Add Button","generateblocks"),onClick:()=>{let e=!1;e="function"==typeof u?u(a,"generateblocks/button-container",!0)[0]:d(a);const t=p(a)[0],l=(0,g.cloneBlock)(t,{uniqueId:""});c(l,void 0,e)},showTooltip:!0})),(0,e.createElement)(n.ToolbarGroup,null,(!y||w)&&(0,e.createElement)(n.Dropdown,{contentClassName:"gblocks-button-link-dropdown",popoverProps:{className:"block-editor-block-settings-menu__popover",position:"bottom right"},renderToggle:t=>{let{isOpen:a,onToggle:l}=t;return(0,e.createElement)(n.ToolbarButton,{icon:un,label:b?(0,i.__)("Change Link","generateblocks"):(0,i.__)("Add Link","generateblocks"),onClick:l,"aria-expanded":a,isPressed:!!b})},renderContent:()=>(0,e.createElement)(e.Fragment,null,!y&&(0,e.createElement)(r.URLInput,{className:"gblocks-button-link",value:b,onChange:e=>{s({url:e,hasUrl:!!e})}}),!!y&&(0,e.createElement)("div",{style:{width:"300px","font-style":"italic","margin-bottom":v?"15px":"0"}},(0,i.__)("This button is using a dynamic link.","generateblocks")),(0,m.applyFilters)("generateblocks.editor.urlInputMoreOptions","",o),(!!b||w)&&(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.ToggleControl,{label:(0,i.__)("Open link in a new tab","generateblocks"),checked:f||"",onChange:e=>{s({target:e})}}),(0,e.createElement)(n.ToggleControl,{label:(0,i.__)('Add rel="nofollow"',"generateblocks"),checked:h||"",onChange:e=>{s({relNoFollow:e})}}),(0,e.createElement)(n.ToggleControl,{label:(0,i.__)('Add rel="sponsored"',"generateblocks"),checked:k||"",onChange:e=>{s({relSponsored:e})}})))}))))},as={facebook:{label:(0,i._x)("Facebook","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 320 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M279.14 288l14.22-92.66h-88.91v-60.13c0-25.35 12.42-50.06 52.24-50.06h40.42V6.26S260.43 0 225.36 0c-73.22 0-121.08 44.38-121.08 124.72v70.62H22.89V288h81.39v224h100.17V288z"}))},facebookCircle:{label:(0,i._x)("Facebook - Circle","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M504 256C504 119 393 8 256 8S8 119 8 256c0 123.78 90.69 226.38 209.25 245V327.69h-63V256h63v-54.64c0-62.15 37-96.48 93.67-96.48 27.14 0 55.52 4.84 55.52 4.84v61h-31.28c-30.8 0-40.41 19.12-40.41 38.73V256h68.78l-11 71.69h-57.78V501C413.31 482.38 504 379.78 504 256z"}))},facebookSquare:{label:(0,i._x)("Facebook - Square","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 448 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M400 32H48A48 48 0 0 0 0 80v352a48 48 0 0 0 48 48h137.25V327.69h-63V256h63v-54.64c0-62.15 37-96.48 93.67-96.48 27.14 0 55.52 4.84 55.52 4.84v61h-31.27c-30.81 0-40.42 19.12-40.42 38.73V256h68.78l-11 71.69h-57.78V480H400a48 48 0 0 0 48-48V80a48 48 0 0 0-48-48z"}))},instagram:{label:(0,i._x)("Instagram","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 448 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M224.1 141c-63.6 0-114.9 51.3-114.9 114.9s51.3 114.9 114.9 114.9S339 319.5 339 255.9 287.7 141 224.1 141zm0 189.6c-41.1 0-74.7-33.5-74.7-74.7s33.5-74.7 74.7-74.7 74.7 33.5 74.7 74.7-33.6 74.7-74.7 74.7zm146.4-194.3c0 14.9-12 26.8-26.8 26.8-14.9 0-26.8-12-26.8-26.8s12-26.8 26.8-26.8 26.8 12 26.8 26.8zm76.1 27.2c-1.7-35.9-9.9-67.7-36.2-93.9-26.2-26.2-58-34.4-93.9-36.2-37-2.1-147.9-2.1-184.9 0-35.8 1.7-67.6 9.9-93.9 36.1s-34.4 58-36.2 93.9c-2.1 37-2.1 147.9 0 184.9 1.7 35.9 9.9 67.7 36.2 93.9s58 34.4 93.9 36.2c37 2.1 147.9 2.1 184.9 0 35.9-1.7 67.7-9.9 93.9-36.2 26.2-26.2 34.4-58 36.2-93.9 2.1-37 2.1-147.8 0-184.8zM398.8 388c-7.8 19.6-22.9 34.7-42.6 42.6-29.5 11.7-99.5 9-132.1 9s-102.7 2.6-132.1-9c-19.6-7.8-34.7-22.9-42.6-42.6-11.7-29.5-9-99.5-9-132.1s-2.6-102.7 9-132.1c7.8-19.6 22.9-34.7 42.6-42.6 29.5-11.7 99.5-9 132.1-9s102.7-2.6 132.1 9c19.6 7.8 34.7 22.9 42.6 42.6 11.7 29.5 9 99.5 9 132.1s2.7 102.7-9 132.1z"}))},linkedin:{label:(0,i._x)("LinkedIn","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 448 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M100.28 448H7.4V148.9h92.88zM53.79 108.1C24.09 108.1 0 83.5 0 53.8a53.79 53.79 0 0 1 107.58 0c0 29.7-24.1 54.3-53.79 54.3zM447.9 448h-92.68V302.4c0-34.7-.7-79.2-48.29-79.2-48.29 0-55.69 37.7-55.69 76.7V448h-92.78V148.9h89.08v40.8h1.3c12.4-23.5 42.69-48.3 87.88-48.3 94 0 111.28 61.9 111.28 142.3V448z"}))},linkedinSquare:{label:(0,i._x)("LinkedIn - Square","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 448 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M416 32H31.9C14.3 32 0 46.5 0 64.3v383.4C0 465.5 14.3 480 31.9 480H416c17.6 0 32-14.5 32-32.3V64.3c0-17.8-14.4-32.3-32-32.3zM135.4 416H69V202.2h66.5V416zm-33.2-243c-21.3 0-38.5-17.3-38.5-38.5S80.9 96 102.2 96c21.2 0 38.5 17.3 38.5 38.5 0 21.3-17.2 38.5-38.5 38.5zm282.1 243h-66.4V312c0-24.8-.5-56.7-34.5-56.7-34.6 0-39.9 27-39.9 54.9V416h-66.4V202.2h63.7v29.2h.9c8.9-16.8 30.6-34.5 62.9-34.5 67.2 0 79.7 44.3 79.7 101.9V416z"}))},pinterest:{label:(0,i._x)("Pinterest","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 384 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M204 6.5C101.4 6.5 0 74.9 0 185.6 0 256 39.6 296 63.6 296c9.9 0 15.6-27.6 15.6-35.4 0-9.3-23.7-29.1-23.7-67.8 0-80.4 61.2-137.4 140.4-137.4 68.1 0 118.5 38.7 118.5 109.8 0 53.1-21.3 152.7-90.3 152.7-24.9 0-46.2-18-46.2-43.8 0-37.8 26.4-74.4 26.4-113.4 0-66.2-93.9-54.2-93.9 25.8 0 16.8 2.1 35.4 9.6 50.7-13.8 59.4-42 147.9-42 209.1 0 18.9 2.7 37.5 4.5 56.4 3.4 3.8 1.7 3.4 6.9 1.5 50.4-69 48.6-82.5 71.4-172.8 12.3 23.4 44.1 36 69.3 36 106.2 0 153.9-103.5 153.9-196.8C384 71.3 298.2 6.5 204 6.5z"}))},pinterestCircle:{label:(0,i._x)("Pinterest - Circle","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 496 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M496 256c0 137-111 248-248 248-25.6 0-50.2-3.9-73.4-11.1 10.1-16.5 25.2-43.5 30.8-65 3-11.6 15.4-59 15.4-59 8.1 15.4 31.7 28.5 56.8 28.5 74.8 0 128.7-68.8 128.7-154.3 0-81.9-66.9-143.2-152.9-143.2-107 0-163.9 71.8-163.9 150.1 0 36.4 19.4 81.7 50.3 96.1 4.7 2.2 7.2 1.2 8.3-3.3.8-3.4 5-20.3 6.9-28.1.6-2.5.3-4.7-1.7-7.1-10.1-12.5-18.3-35.3-18.3-56.6 0-54.7 41.4-107.6 112-107.6 60.9 0 103.6 41.5 103.6 100.9 0 67.1-33.9 113.6-78 113.6-24.3 0-42.6-20.1-36.7-44.8 7-29.5 20.5-61.3 20.5-82.6 0-19-10.2-34.9-31.4-34.9-24.9 0-44.9 25.7-44.9 60.2 0 22 7.4 36.8 7.4 36.8s-24.5 103.8-29 123.2c-5 21.4-3 51.6-.9 71.2C65.4 450.9 0 361.1 0 256 0 119 111 8 248 8s248 111 248 248z"}))},pinterestSquare:{label:(0,i._x)("Pinterest - Square","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 448 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M448 80v352c0 26.5-21.5 48-48 48H154.4c9.8-16.4 22.4-40 27.4-59.3 3-11.5 15.3-58.4 15.3-58.4 8 15.3 31.4 28.2 56.3 28.2 74.1 0 127.4-68.1 127.4-152.7 0-81.1-66.2-141.8-151.4-141.8-106 0-162.2 71.1-162.2 148.6 0 36 19.2 80.8 49.8 95.1 4.7 2.2 7.1 1.2 8.2-3.3.8-3.4 5-20.1 6.8-27.8.6-2.5.3-4.6-1.7-7-10.1-12.3-18.3-34.9-18.3-56 0-54.2 41-106.6 110.9-106.6 60.3 0 102.6 41.1 102.6 99.9 0 66.4-33.5 112.4-77.2 112.4-24.1 0-42.1-19.9-36.4-44.4 6.9-29.2 20.3-60.7 20.3-81.8 0-53-75.5-45.7-75.5 25 0 21.7 7.3 36.5 7.3 36.5-31.4 132.8-36.1 134.5-29.6 192.6l2.2.8H48c-26.5 0-48-21.5-48-48V80c0-26.5 21.5-48 48-48h352c26.5 0 48 21.5 48 48z"}))},reddit:{label:(0,i._x)("Reddit","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M440.3 203.5c-15 0-28.2 6.2-37.9 15.9-35.7-24.7-83.8-40.6-137.1-42.3L293 52.3l88.2 19.8c0 21.6 17.6 39.2 39.2 39.2 22 0 39.7-18.1 39.7-39.7s-17.6-39.7-39.7-39.7c-15.4 0-28.7 9.3-35.3 22l-97.4-21.6c-4.9-1.3-9.7 2.2-11 7.1L246.3 177c-52.9 2.2-100.5 18.1-136.3 42.8-9.7-10.1-23.4-16.3-38.4-16.3-55.6 0-73.8 74.6-22.9 100.1-1.8 7.9-2.6 16.3-2.6 24.7 0 83.8 94.4 151.7 210.3 151.7 116.4 0 210.8-67.9 210.8-151.7 0-8.4-.9-17.2-3.1-25.1 49.9-25.6 31.5-99.7-23.8-99.7zM129.4 308.9c0-22 17.6-39.7 39.7-39.7 21.6 0 39.2 17.6 39.2 39.7 0 21.6-17.6 39.2-39.2 39.2-22 .1-39.7-17.6-39.7-39.2zm214.3 93.5c-36.4 36.4-139.1 36.4-175.5 0-4-3.5-4-9.7 0-13.7 3.5-3.5 9.7-3.5 13.2 0 27.8 28.5 120 29 149 0 3.5-3.5 9.7-3.5 13.2 0 4.1 4 4.1 10.2.1 13.7zm-.8-54.2c-21.6 0-39.2-17.6-39.2-39.2 0-22 17.6-39.7 39.2-39.7 22 0 39.7 17.6 39.7 39.7-.1 21.5-17.7 39.2-39.7 39.2z"}))},redditCircle:{label:(0,i._x)("Reddit - Circle","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M201.5 305.5c-13.8 0-24.9-11.1-24.9-24.6 0-13.8 11.1-24.9 24.9-24.9 13.6 0 24.6 11.1 24.6 24.9 0 13.6-11.1 24.6-24.6 24.6zM504 256c0 137-111 248-248 248S8 393 8 256 119 8 256 8s248 111 248 248zm-132.3-41.2c-9.4 0-17.7 3.9-23.8 10-22.4-15.5-52.6-25.5-86.1-26.6l17.4-78.3 55.4 12.5c0 13.6 11.1 24.6 24.6 24.6 13.8 0 24.9-11.3 24.9-24.9s-11.1-24.9-24.9-24.9c-9.7 0-18 5.8-22.1 13.8l-61.2-13.6c-3-.8-6.1 1.4-6.9 4.4l-19.1 86.4c-33.2 1.4-63.1 11.3-85.5 26.8-6.1-6.4-14.7-10.2-24.1-10.2-34.9 0-46.3 46.9-14.4 62.8-1.1 5-1.7 10.2-1.7 15.5 0 52.6 59.2 95.2 132 95.2 73.1 0 132.3-42.6 132.3-95.2 0-5.3-.6-10.8-1.9-15.8 31.3-16 19.8-62.5-14.9-62.5zM302.8 331c-18.2 18.2-76.1 17.9-93.6 0-2.2-2.2-6.1-2.2-8.3 0-2.5 2.5-2.5 6.4 0 8.6 22.8 22.8 87.3 22.8 110.2 0 2.5-2.2 2.5-6.1 0-8.6-2.2-2.2-6.1-2.2-8.3 0zm7.7-75c-13.6 0-24.6 11.1-24.6 24.9 0 13.6 11.1 24.6 24.6 24.6 13.8 0 24.9-11.1 24.9-24.6 0-13.8-11-24.9-24.9-24.9z"}))},redditSquare:{label:(0,i._x)("Reddit - Square","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 448 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M283.2 345.5c2.7 2.7 2.7 6.8 0 9.2-24.5 24.5-93.8 24.6-118.4 0-2.7-2.4-2.7-6.5 0-9.2 2.4-2.4 6.5-2.4 8.9 0 18.7 19.2 81 19.6 100.5 0 2.4-2.3 6.6-2.3 9 0zm-91.3-53.8c0-14.9-11.9-26.8-26.5-26.8-14.9 0-26.8 11.9-26.8 26.8 0 14.6 11.9 26.5 26.8 26.5 14.6 0 26.5-11.9 26.5-26.5zm90.7-26.8c-14.6 0-26.5 11.9-26.5 26.8 0 14.6 11.9 26.5 26.5 26.5 14.9 0 26.8-11.9 26.8-26.5 0-14.9-11.9-26.8-26.8-26.8zM448 80v352c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V80c0-26.5 21.5-48 48-48h352c26.5 0 48 21.5 48 48zm-99.7 140.6c-10.1 0-19 4.2-25.6 10.7-24.1-16.7-56.5-27.4-92.5-28.6l18.7-84.2 59.5 13.4c0 14.6 11.9 26.5 26.5 26.5 14.9 0 26.8-12.2 26.8-26.8 0-14.6-11.9-26.8-26.8-26.8-10.4 0-19.3 6.2-23.8 14.9l-65.7-14.6c-3.3-.9-6.5 1.5-7.4 4.8l-20.5 92.8c-35.7 1.5-67.8 12.2-91.9 28.9-6.5-6.8-15.8-11-25.9-11-37.5 0-49.8 50.4-15.5 67.5-1.2 5.4-1.8 11-1.8 16.7 0 56.5 63.7 102.3 141.9 102.3 78.5 0 142.2-45.8 142.2-102.3 0-5.7-.6-11.6-2.1-17 33.6-17.2 21.2-67.2-16.1-67.2z"}))},snapchat:{label:(0,i._x)("Snapchat","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M510.846 392.673c-5.211 12.157-27.239 21.089-67.36 27.318-2.064 2.786-3.775 14.686-6.507 23.956-1.625 5.566-5.623 8.869-12.128 8.869l-.297-.005c-9.395 0-19.203-4.323-38.852-4.323-26.521 0-35.662 6.043-56.254 20.588-21.832 15.438-42.771 28.764-74.027 27.399-31.646 2.334-58.025-16.908-72.871-27.404-20.714-14.643-29.828-20.582-56.241-20.582-18.864 0-30.736 4.72-38.852 4.72-8.073 0-11.213-4.922-12.422-9.04-2.703-9.189-4.404-21.263-6.523-24.13-20.679-3.209-67.31-11.344-68.498-32.15a10.627 10.627 0 0 1 8.877-11.069c69.583-11.455 100.924-82.901 102.227-85.934.074-.176.155-.344.237-.515 3.713-7.537 4.544-13.849 2.463-18.753-5.05-11.896-26.872-16.164-36.053-19.796-23.715-9.366-27.015-20.128-25.612-27.504 2.437-12.836 21.725-20.735 33.002-15.453 8.919 4.181 16.843 6.297 23.547 6.297 5.022 0 8.212-1.204 9.96-2.171-2.043-35.936-7.101-87.29 5.687-115.969C158.122 21.304 229.705 15.42 250.826 15.42c.944 0 9.141-.089 10.11-.089 52.148 0 102.254 26.78 126.723 81.643 12.777 28.65 7.749 79.792 5.695 116.009 1.582.872 4.357 1.942 8.599 2.139 6.397-.286 13.815-2.389 22.069-6.257 6.085-2.846 14.406-2.461 20.48.058l.029.01c9.476 3.385 15.439 10.215 15.589 17.87.184 9.747-8.522 18.165-25.878 25.018-2.118.835-4.694 1.655-7.434 2.525-9.797 3.106-24.6 7.805-28.616 17.271-2.079 4.904-1.256 11.211 2.46 18.748.087.168.166.342.239.515 1.301 3.03 32.615 74.46 102.23 85.934 6.427 1.058 11.163 7.877 7.725 15.859z"}))},soundcloud:{label:(0,i._x)("Soundcloud","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 640 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M111.4 256.3l5.8 65-5.8 68.3c-.3 2.5-2.2 4.4-4.4 4.4s-4.2-1.9-4.2-4.4l-5.6-68.3 5.6-65c0-2.2 1.9-4.2 4.2-4.2 2.2 0 4.1 2 4.4 4.2zm21.4-45.6c-2.8 0-4.7 2.2-5 5l-5 105.6 5 68.3c.3 2.8 2.2 5 5 5 2.5 0 4.7-2.2 4.7-5l5.8-68.3-5.8-105.6c0-2.8-2.2-5-4.7-5zm25.5-24.1c-3.1 0-5.3 2.2-5.6 5.3l-4.4 130 4.4 67.8c.3 3.1 2.5 5.3 5.6 5.3 2.8 0 5.3-2.2 5.3-5.3l5.3-67.8-5.3-130c0-3.1-2.5-5.3-5.3-5.3zM7.2 283.2c-1.4 0-2.2 1.1-2.5 2.5L0 321.3l4.7 35c.3 1.4 1.1 2.5 2.5 2.5s2.2-1.1 2.5-2.5l5.6-35-5.6-35.6c-.3-1.4-1.1-2.5-2.5-2.5zm23.6-21.9c-1.4 0-2.5 1.1-2.5 2.5l-6.4 57.5 6.4 56.1c0 1.7 1.1 2.8 2.5 2.8s2.5-1.1 2.8-2.5l7.2-56.4-7.2-57.5c-.3-1.4-1.4-2.5-2.8-2.5zm25.3-11.4c-1.7 0-3.1 1.4-3.3 3.3L47 321.3l5.8 65.8c.3 1.7 1.7 3.1 3.3 3.1 1.7 0 3.1-1.4 3.1-3.1l6.9-65.8-6.9-68.1c0-1.9-1.4-3.3-3.1-3.3zm25.3-2.2c-1.9 0-3.6 1.4-3.6 3.6l-5.8 70 5.8 67.8c0 2.2 1.7 3.6 3.6 3.6s3.6-1.4 3.9-3.6l6.4-67.8-6.4-70c-.3-2.2-2-3.6-3.9-3.6zm241.4-110.9c-1.1-.8-2.8-1.4-4.2-1.4-2.2 0-4.2.8-5.6 1.9-1.9 1.7-3.1 4.2-3.3 6.7v.8l-3.3 176.7 1.7 32.5 1.7 31.7c.3 4.7 4.2 8.6 8.9 8.6s8.6-3.9 8.6-8.6l3.9-64.2-3.9-177.5c-.4-3-2-5.8-4.5-7.2zm-26.7 15.3c-1.4-.8-2.8-1.4-4.4-1.4s-3.1.6-4.4 1.4c-2.2 1.4-3.6 3.9-3.6 6.7l-.3 1.7-2.8 160.8s0 .3 3.1 65.6v.3c0 1.7.6 3.3 1.7 4.7 1.7 1.9 3.9 3.1 6.4 3.1 2.2 0 4.2-1.1 5.6-2.5 1.7-1.4 2.5-3.3 2.5-5.6l.3-6.7 3.1-58.6-3.3-162.8c-.3-2.8-1.7-5.3-3.9-6.7zm-111.4 22.5c-3.1 0-5.8 2.8-5.8 6.1l-4.4 140.6 4.4 67.2c.3 3.3 2.8 5.8 5.8 5.8 3.3 0 5.8-2.5 6.1-5.8l5-67.2-5-140.6c-.2-3.3-2.7-6.1-6.1-6.1zm376.7 62.8c-10.8 0-21.1 2.2-30.6 6.1-6.4-70.8-65.8-126.4-138.3-126.4-17.8 0-35 3.3-50.3 9.4-6.1 2.2-7.8 4.4-7.8 9.2v249.7c0 5 3.9 8.6 8.6 9.2h218.3c43.3 0 78.6-35 78.6-78.3.1-43.6-35.2-78.9-78.5-78.9zm-296.7-60.3c-4.2 0-7.5 3.3-7.8 7.8l-3.3 136.7 3.3 65.6c.3 4.2 3.6 7.5 7.8 7.5 4.2 0 7.5-3.3 7.5-7.5l3.9-65.6-3.9-136.7c-.3-4.5-3.3-7.8-7.5-7.8zm-53.6-7.8c-3.3 0-6.4 3.1-6.4 6.7l-3.9 145.3 3.9 66.9c.3 3.6 3.1 6.4 6.4 6.4 3.6 0 6.4-2.8 6.7-6.4l4.4-66.9-4.4-145.3c-.3-3.6-3.1-6.7-6.7-6.7zm26.7 3.4c-3.9 0-6.9 3.1-6.9 6.9L227 321.3l3.9 66.4c.3 3.9 3.1 6.9 6.9 6.9s6.9-3.1 6.9-6.9l4.2-66.4-4.2-141.7c0-3.9-3-6.9-6.9-6.9z"}))},twitch:{label:(0,i._x)("Twitch","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 448 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M40.1 32L10 108.9v314.3h107V480h60.2l56.8-56.8h87l117-117V32H40.1zm357.8 254.1L331 353H224l-56.8 56.8V353H76.9V72.1h321v214zM331 149v116.9h-40.1V149H331zm-107 0v116.9h-40.1V149H224z"}))},twitter:{label:(0,i._x)("Twitter","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M459.37 151.716c.325 4.548.325 9.097.325 13.645 0 138.72-105.583 298.558-298.558 298.558-59.452 0-114.68-17.219-161.137-47.106 8.447.974 16.568 1.299 25.34 1.299 49.055 0 94.213-16.568 130.274-44.832-46.132-.975-84.792-31.188-98.112-72.772 6.498.974 12.995 1.624 19.818 1.624 9.421 0 18.843-1.3 27.614-3.573-48.081-9.747-84.143-51.98-84.143-102.985v-1.299c13.969 7.797 30.214 12.67 47.431 13.319-28.264-18.843-46.781-51.005-46.781-87.391 0-19.492 5.197-37.36 14.294-52.954 51.655 63.675 129.3 105.258 216.365 109.807-1.624-7.797-2.599-15.918-2.599-24.04 0-57.828 46.782-104.934 104.934-104.934 30.213 0 57.502 12.67 76.67 33.137 23.715-4.548 46.456-13.32 66.599-25.34-7.798 24.366-24.366 44.833-46.132 57.827 21.117-2.273 41.584-8.122 60.426-16.243-14.292 20.791-32.161 39.308-52.628 54.253z"}))},twitterSquare:{label:(0,i._x)("Twitter - Square","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 448 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zm-48.9 158.8c.2 2.8.2 5.7.2 8.5 0 86.7-66 186.6-186.6 186.6-37.2 0-71.7-10.8-100.7-29.4 5.3.6 10.4.8 15.8.8 30.7 0 58.9-10.4 81.4-28-28.8-.6-53-19.5-61.3-45.5 10.1 1.5 19.2 1.5 29.6-1.2-30-6.1-52.5-32.5-52.5-64.4v-.8c8.7 4.9 18.9 7.9 29.6 8.3a65.447 65.447 0 0 1-29.2-54.6c0-12.2 3.2-23.4 8.9-33.1 32.3 39.8 80.8 65.8 135.2 68.6-9.3-44.5 24-80.6 64-80.6 18.9 0 35.9 7.9 47.9 20.7 14.8-2.8 29-8.3 41.6-15.8-4.9 15.2-15.2 28-28.8 36.1 13.2-1.4 26-5.1 37.8-10.2-8.9 13.1-20.1 24.7-32.9 34z"}))},vimeo:{label:(0,i._x)("Vimeo","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 448 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M447.8 153.6c-2 43.6-32.4 103.3-91.4 179.1-60.9 79.2-112.4 118.8-154.6 118.8-26.1 0-48.2-24.1-66.3-72.3C100.3 250 85.3 174.3 56.2 174.3c-3.4 0-15.1 7.1-35.2 21.1L0 168.2c51.6-45.3 100.9-95.7 131.8-98.5 34.9-3.4 56.3 20.5 64.4 71.5 28.7 181.5 41.4 208.9 93.6 126.7 18.7-29.6 28.8-52.1 30.2-67.6 4.8-45.9-35.8-42.8-63.3-31 22-72.1 64.1-107.1 126.2-105.1 45.8 1.2 67.5 31.1 64.9 89.4z"}))},vimeoSquare:{label:(0,i._x)("Vimeo - Square","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 448 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M403.2 32H44.8C20.1 32 0 52.1 0 76.8v358.4C0 459.9 20.1 480 44.8 480h358.4c24.7 0 44.8-20.1 44.8-44.8V76.8c0-24.7-20.1-44.8-44.8-44.8zM377 180.8c-1.4 31.5-23.4 74.7-66 129.4-44 57.2-81.3 85.8-111.7 85.8-18.9 0-34.8-17.4-47.9-52.3-25.5-93.3-36.4-148-57.4-148-2.4 0-10.9 5.1-25.4 15.2l-15.2-19.6c37.3-32.8 72.9-69.2 95.2-71.2 25.2-2.4 40.7 14.8 46.5 51.7 20.7 131.2 29.9 151 67.6 91.6 13.5-21.4 20.8-37.7 21.8-48.9 3.5-33.2-25.9-30.9-45.8-22.4 15.9-52.1 46.3-77.4 91.2-76 33.3.9 49 22.5 47.1 64.7z"}))},whatsapp:{label:(0,i._x)("WhatsApp","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 448 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M380.9 97.1C339 55.1 283.2 32 223.9 32c-122.4 0-222 99.6-222 222 0 39.1 10.2 77.3 29.6 111L0 480l117.7-30.9c32.4 17.7 68.9 27 106.1 27h.1c122.3 0 224.1-99.6 224.1-222 0-59.3-25.2-115-67.1-157zm-157 341.6c-33.2 0-65.7-8.9-94-25.7l-6.7-4-69.8 18.3L72 359.2l-4.4-7c-18.5-29.4-28.2-63.3-28.2-98.2 0-101.7 82.8-184.5 184.6-184.5 49.3 0 95.6 19.2 130.4 54.1 34.8 34.9 56.2 81.2 56.1 130.5 0 101.8-84.9 184.6-186.6 184.6zm101.2-138.2c-5.5-2.8-32.8-16.2-37.9-18-5.1-1.9-8.8-2.8-12.5 2.8-3.7 5.6-14.3 18-17.6 21.8-3.2 3.7-6.5 4.2-12 1.4-32.6-16.3-54-29.1-75.5-66-5.7-9.8 5.7-9.1 16.3-30.3 1.8-3.7.9-6.9-.5-9.7-1.4-2.8-12.5-30.1-17.1-41.2-4.5-10.8-9.1-9.3-12.5-9.5-3.2-.2-6.9-.2-10.6-.2-3.7 0-9.7 1.4-14.8 6.9-5.1 5.6-19.4 19-19.4 46.3 0 27.3 19.9 53.7 22.6 57.4 2.8 3.7 39.1 59.7 94.8 83.8 35.2 15.2 49 16.5 66.6 13.9 10.7-1.6 32.8-13.4 37.4-26.4 4.6-13 4.6-24.1 3.2-26.4-1.3-2.5-5-3.9-10.5-6.6z"}))},whatsappSquare:{label:(0,i._x)("WhatsApp - Square","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 448 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M224 122.8c-72.7 0-131.8 59.1-131.9 131.8 0 24.9 7 49.2 20.2 70.1l3.1 5-13.3 48.6 49.9-13.1 4.8 2.9c20.2 12 43.4 18.4 67.1 18.4h.1c72.6 0 133.3-59.1 133.3-131.8 0-35.2-15.2-68.3-40.1-93.2-25-25-58-38.7-93.2-38.7zm77.5 188.4c-3.3 9.3-19.1 17.7-26.7 18.8-12.6 1.9-22.4.9-47.5-9.9-39.7-17.2-65.7-57.2-67.7-59.8-2-2.6-16.2-21.5-16.2-41s10.2-29.1 13.9-33.1c3.6-4 7.9-5 10.6-5 2.6 0 5.3 0 7.6.1 2.4.1 5.7-.9 8.9 6.8 3.3 7.9 11.2 27.4 12.2 29.4s1.7 4.3.3 6.9c-7.6 15.2-15.7 14.6-11.6 21.6 15.3 26.3 30.6 35.4 53.9 47.1 4 2 6.3 1.7 8.6-1 2.3-2.6 9.9-11.6 12.5-15.5 2.6-4 5.3-3.3 8.9-2 3.6 1.3 23.1 10.9 27.1 12.9s6.6 3 7.6 4.6c.9 1.9.9 9.9-2.4 19.1zM400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zM223.9 413.2c-26.6 0-52.7-6.7-75.8-19.3L64 416l22.5-82.2c-13.9-24-21.2-51.3-21.2-79.3C65.4 167.1 136.5 96 223.9 96c42.4 0 82.2 16.5 112.2 46.5 29.9 30 47.9 69.8 47.9 112.2 0 87.4-72.7 158.5-160.1 158.5z"}))},youtube:{label:(0,i._x)("YouTube","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 576 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M549.655 124.083c-6.281-23.65-24.787-42.276-48.284-48.597C458.781 64 288 64 288 64S117.22 64 74.629 75.486c-23.497 6.322-42.003 24.947-48.284 48.597-11.412 42.867-11.412 132.305-11.412 132.305s0 89.438 11.412 132.305c6.281 23.65 24.787 41.5 48.284 47.821C117.22 448 288 448 288 448s170.78 0 213.371-11.486c23.497-6.321 42.003-24.171 48.284-47.821 11.412-42.867 11.412-132.305 11.412-132.305s0-89.438-11.412-132.305zm-317.51 213.508V175.185l142.739 81.205-142.739 81.201z"}))}},ls={clock:{label:(0,i._x)("Clock","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm92.49 313l-20 25a16 16 0 01-22.49 2.5l-67-49.72a40 40 0 01-15-31.23V112a16 16 0 0116-16h32a16 16 0 0116 16v144l58 42.5a16 16 0 012.49 22.5z"}))},clockAlt:{label:(0,i._x)("Clock Outline","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm0 448c-110.5 0-200-89.5-200-200S145.5 56 256 56s200 89.5 200 200-89.5 200-200 200zm61.8-104.4l-84.9-61.7c-3.1-2.3-4.9-5.9-4.9-9.7V116c0-6.6 5.4-12 12-12h32c6.6 0 12 5.4 12 12v141.7l66.8 48.6c5.4 3.9 6.5 11.4 2.6 16.8L334.6 349c-3.9 5.3-11.4 6.5-16.8 2.6z"}))},asterisk:{label:(0,i._x)("Asterisk","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M478.21 334.093L336 256l142.21-78.093c11.795-6.477 15.961-21.384 9.232-33.037l-19.48-33.741c-6.728-11.653-21.72-15.499-33.227-8.523L296 186.718l3.475-162.204C299.763 11.061 288.937 0 275.48 0h-38.96c-13.456 0-24.283 11.061-23.994 24.514L216 186.718 77.265 102.607c-11.506-6.976-26.499-3.13-33.227 8.523l-19.48 33.741c-6.728 11.653-2.562 26.56 9.233 33.037L176 256 33.79 334.093c-11.795 6.477-15.961 21.384-9.232 33.037l19.48 33.741c6.728 11.653 21.721 15.499 33.227 8.523L216 325.282l-3.475 162.204C212.237 500.939 223.064 512 236.52 512h38.961c13.456 0 24.283-11.061 23.995-24.514L296 325.282l138.735 84.111c11.506 6.976 26.499 3.13 33.227-8.523l19.48-33.741c6.728-11.653 2.563-26.559-9.232-33.036z"}))},at:{label:(0,i._x)("At","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M256 8C118.941 8 8 118.919 8 256c0 137.059 110.919 248 248 248 48.154 0 95.342-14.14 135.408-40.223 12.005-7.815 14.625-24.288 5.552-35.372l-10.177-12.433c-7.671-9.371-21.179-11.667-31.373-5.129C325.92 429.757 291.314 440 256 440c-101.458 0-184-82.542-184-184S154.542 72 256 72c100.139 0 184 57.619 184 160 0 38.786-21.093 79.742-58.17 83.693-17.349-.454-16.91-12.857-13.476-30.024l23.433-121.11C394.653 149.75 383.308 136 368.225 136h-44.981a13.518 13.518 0 0 0-13.432 11.993l-.01.092c-14.697-17.901-40.448-21.775-59.971-21.775-74.58 0-137.831 62.234-137.831 151.46 0 65.303 36.785 105.87 96 105.87 26.984 0 57.369-15.637 74.991-38.333 9.522 34.104 40.613 34.103 70.71 34.103C462.609 379.41 504 307.798 504 232 504 95.653 394.023 8 256 8zm-21.68 304.43c-22.249 0-36.07-15.623-36.07-40.771 0-44.993 30.779-72.729 58.63-72.729 22.292 0 35.601 15.241 35.601 40.77 0 45.061-33.875 72.73-58.161 72.73z"}))},award:{label:(0,i._x)("Award","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 384 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M97.12 362.63c-8.69-8.69-4.16-6.24-25.12-11.85-9.51-2.55-17.87-7.45-25.43-13.32L1.2 448.7c-4.39 10.77 3.81 22.47 15.43 22.03l52.69-2.01L105.56 507c8 8.44 22.04 5.81 26.43-4.96l52.05-127.62c-10.84 6.04-22.87 9.58-35.31 9.58-19.5 0-37.82-7.59-51.61-21.37zM382.8 448.7l-45.37-111.24c-7.56 5.88-15.92 10.77-25.43 13.32-21.07 5.64-16.45 3.18-25.12 11.85-13.79 13.78-32.12 21.37-51.62 21.37-12.44 0-24.47-3.55-35.31-9.58L252 502.04c4.39 10.77 18.44 13.4 26.43 4.96l36.25-38.28 52.69 2.01c11.62.44 19.82-11.27 15.43-22.03zM263 340c15.28-15.55 17.03-14.21 38.79-20.14 13.89-3.79 24.75-14.84 28.47-28.98 7.48-28.4 5.54-24.97 25.95-45.75 10.17-10.35 14.14-25.44 10.42-39.58-7.47-28.38-7.48-24.42 0-52.83 3.72-14.14-.25-29.23-10.42-39.58-20.41-20.78-18.47-17.36-25.95-45.75-3.72-14.14-14.58-25.19-28.47-28.98-27.88-7.61-24.52-5.62-44.95-26.41-10.17-10.35-25-14.4-38.89-10.61-27.87 7.6-23.98 7.61-51.9 0-13.89-3.79-28.72.25-38.89 10.61-20.41 20.78-17.05 18.8-44.94 26.41-13.89 3.79-24.75 14.84-28.47 28.98-7.47 28.39-5.54 24.97-25.95 45.75-10.17 10.35-14.15 25.44-10.42 39.58 7.47 28.36 7.48 24.4 0 52.82-3.72 14.14.25 29.23 10.42 39.59 20.41 20.78 18.47 17.35 25.95 45.75 3.72 14.14 14.58 25.19 28.47 28.98C104.6 325.96 106.27 325 121 340c13.23 13.47 33.84 15.88 49.74 5.82a39.676 39.676 0 0 1 42.53 0c15.89 10.06 36.5 7.65 49.73-5.82zM97.66 175.96c0-53.03 42.24-96.02 94.34-96.02s94.34 42.99 94.34 96.02-42.24 96.02-94.34 96.02-94.34-42.99-94.34-96.02z"}))},ban:{label:(0,i._x)("Ban","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M256 8C119.034 8 8 119.033 8 256s111.034 248 248 248 248-111.034 248-248S392.967 8 256 8zm130.108 117.892c65.448 65.448 70 165.481 20.677 235.637L150.47 105.216c70.204-49.356 170.226-44.735 235.638 20.676zM125.892 386.108c-65.448-65.448-70-165.481-20.677-235.637L361.53 406.784c-70.203 49.356-170.226 44.736-235.638-20.676z"}))},bars:{label:(0,i._x)("Bars","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 448 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M16 132h416c8.837 0 16-7.163 16-16V76c0-8.837-7.163-16-16-16H16C7.163 60 0 67.163 0 76v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16zm0 160h416c8.837 0 16-7.163 16-16v-40c0-8.837-7.163-16-16-16H16c-8.837 0-16 7.163-16 16v40c0 8.837 7.163 16 16 16z"}))},beer:{label:(0,i._x)("Beer","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 448 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M368 96h-48V56c0-13.255-10.745-24-24-24H24C10.745 32 0 42.745 0 56v400c0 13.255 10.745 24 24 24h272c13.255 0 24-10.745 24-24v-42.11l80.606-35.977C429.396 365.063 448 336.388 448 304.86V176c0-44.112-35.888-80-80-80zm16 208.86a16.018 16.018 0 0 1-9.479 14.611L320 343.805V160h48c8.822 0 16 7.178 16 16v128.86zM208 384c-8.836 0-16-7.164-16-16V144c0-8.836 7.164-16 16-16s16 7.164 16 16v224c0 8.836-7.164 16-16 16zm-96 0c-8.836 0-16-7.164-16-16V144c0-8.836 7.164-16 16-16s16 7.164 16 16v224c0 8.836-7.164 16-16 16z"}))},bolt:{label:(0,i._x)("Bolt","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 320 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M296 160H180.6l42.6-129.8C227.2 15 215.7 0 200 0H56C44 0 33.8 8.9 32.2 20.8l-32 240C-1.7 275.2 9.5 288 24 288h118.7L96.6 482.5c-3.6 15.2 8 29.5 23.3 29.5 8.4 0 16.4-4.4 20.8-12l176-304c9.3-15.9-2.2-36-20.7-36z"}))},book:{label:(0,i._x)("Book","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 448 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M448 360V24c0-13.3-10.7-24-24-24H96C43 0 0 43 0 96v320c0 53 43 96 96 96h328c13.3 0 24-10.7 24-24v-16c0-7.5-3.5-14.3-8.9-18.7-4.2-15.4-4.2-59.3 0-74.7 5.4-4.3 8.9-11.1 8.9-18.6zM128 134c0-3.3 2.7-6 6-6h212c3.3 0 6 2.7 6 6v20c0 3.3-2.7 6-6 6H134c-3.3 0-6-2.7-6-6v-20zm0 64c0-3.3 2.7-6 6-6h212c3.3 0 6 2.7 6 6v20c0 3.3-2.7 6-6 6H134c-3.3 0-6-2.7-6-6v-20zm253.4 250H96c-17.7 0-32-14.3-32-32 0-17.6 14.4-32 32-32h285.4c-1.9 17.1-1.9 46.9 0 64z"}))},boxOpen:{label:(0,i._x)("Box - Open","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 640 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M425.7 256c-16.9 0-32.8-9-41.4-23.4L320 126l-64.2 106.6c-8.7 14.5-24.6 23.5-41.5 23.5-4.5 0-9-.6-13.3-1.9L64 215v178c0 14.7 10 27.5 24.2 31l216.2 54.1c10.2 2.5 20.9 2.5 31 0L551.8 424c14.2-3.6 24.2-16.4 24.2-31V215l-137 39.1c-4.3 1.3-8.8 1.9-13.3 1.9zm212.6-112.2L586.8 41c-3.1-6.2-9.8-9.8-16.7-8.9L320 64l91.7 152.1c3.8 6.3 11.4 9.3 18.5 7.3l197.9-56.5c9.9-2.9 14.7-13.9 10.2-23.1zM53.2 41L1.7 143.8c-4.6 9.2.3 20.2 10.1 23l197.9 56.5c7.1 2 14.7-1 18.5-7.3L320 64 69.8 32.1c-6.9-.8-13.5 2.7-16.6 8.9z"}))},bullhorn:{label:(0,i._x)("Bullhorn","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 576 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M576 240c0-23.63-12.95-44.04-32-55.12V32.01C544 23.26 537.02 0 512 0c-7.12 0-14.19 2.38-19.98 7.02l-85.03 68.03C364.28 109.19 310.66 128 256 128H64c-35.35 0-64 28.65-64 64v96c0 35.35 28.65 64 64 64h33.7c-1.39 10.48-2.18 21.14-2.18 32 0 39.77 9.26 77.35 25.56 110.94 5.19 10.69 16.52 17.06 28.4 17.06h74.28c26.05 0 41.69-29.84 25.9-50.56-16.4-21.52-26.15-48.36-26.15-77.44 0-11.11 1.62-21.79 4.41-32H256c54.66 0 108.28 18.81 150.98 52.95l85.03 68.03a32.023 32.023 0 0 0 19.98 7.02c24.92 0 32-22.78 32-32V295.13C563.05 284.04 576 263.63 576 240zm-96 141.42l-33.05-26.44C392.95 311.78 325.12 288 256 288v-96c69.12 0 136.95-23.78 190.95-66.98L480 98.58v282.84z"}))},bullseye:{label:(0,i._x)("Bullseye","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 496 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M248 8C111.03 8 0 119.03 0 256s111.03 248 248 248 248-111.03 248-248S384.97 8 248 8zm0 432c-101.69 0-184-82.29-184-184 0-101.69 82.29-184 184-184 101.69 0 184 82.29 184 184 0 101.69-82.29 184-184 184zm0-312c-70.69 0-128 57.31-128 128s57.31 128 128 128 128-57.31 128-128-57.31-128-128-128zm0 192c-35.29 0-64-28.71-64-64s28.71-64 64-64 64 28.71 64 64-28.71 64-64 64z"}))},burn:{label:(0,i._x)("Burn","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 384 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M192 0C79.7 101.3 0 220.9 0 300.5 0 425 79 512 192 512s192-87 192-211.5c0-79.9-80.2-199.6-192-300.5zm0 448c-56.5 0-96-39-96-94.8 0-13.5 4.6-61.5 96-161.2 91.4 99.7 96 147.7 96 161.2 0 55.8-39.5 94.8-96 94.8z"}))},calendarAlt:{label:(0,i._x)("Calender","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 448 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M148 288h-40c-6.6 0-12-5.4-12-12v-40c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v40c0 6.6-5.4 12-12 12zm108-12v-40c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12v40c0 6.6 5.4 12 12 12h40c6.6 0 12-5.4 12-12zm96 0v-40c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12v40c0 6.6 5.4 12 12 12h40c6.6 0 12-5.4 12-12zm-96 96v-40c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12v40c0 6.6 5.4 12 12 12h40c6.6 0 12-5.4 12-12zm-96 0v-40c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12v40c0 6.6 5.4 12 12 12h40c6.6 0 12-5.4 12-12zm192 0v-40c0-6.6-5.4-12-12-12h-40c-6.6 0-12 5.4-12 12v40c0 6.6 5.4 12 12 12h40c6.6 0 12-5.4 12-12zm96-260v352c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V112c0-26.5 21.5-48 48-48h48V12c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v52h128V12c0-6.6 5.4-12 12-12h40c6.6 0 12 5.4 12 12v52h48c26.5 0 48 21.5 48 48zm-48 346V160H48v298c0 3.3 2.7 6 6 6h340c3.3 0 6-2.7 6-6z"}))},check:{label:(0,i._x)("Check","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z"}))},checkCircle:{label:(0,i._x)("Check - Circle","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M504 256c0 136.967-111.033 248-248 248S8 392.967 8 256 119.033 8 256 8s248 111.033 248 248zM227.314 387.314l184-184c6.248-6.248 6.248-16.379 0-22.627l-22.627-22.627c-6.248-6.249-16.379-6.249-22.628 0L216 308.118l-70.059-70.059c-6.248-6.248-16.379-6.248-22.628 0l-22.627 22.627c-6.248 6.248-6.248 16.379 0 22.627l104 104c6.249 6.249 16.379 6.249 22.628.001z"}))},checkCircleOutline:{label:(0,i._x)("Check - Circle Outline","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M256 8C119.033 8 8 119.033 8 256s111.033 248 248 248 248-111.033 248-248S392.967 8 256 8zm0 48c110.532 0 200 89.451 200 200 0 110.532-89.451 200-200 200-110.532 0-200-89.451-200-200 0-110.532 89.451-200 200-200m140.204 130.267l-22.536-22.718c-4.667-4.705-12.265-4.736-16.97-.068L215.346 303.697l-59.792-60.277c-4.667-4.705-12.265-4.736-16.97-.069l-22.719 22.536c-4.705 4.667-4.736 12.265-.068 16.971l90.781 91.516c4.667 4.705 12.265 4.736 16.97.068l172.589-171.204c4.704-4.668 4.734-12.266.067-16.971z"}))},checkSquare:{label:(0,i._x)("Check - Square","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 448 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M400 480H48c-26.51 0-48-21.49-48-48V80c0-26.51 21.49-48 48-48h352c26.51 0 48 21.49 48 48v352c0 26.51-21.49 48-48 48zm-204.686-98.059l184-184c6.248-6.248 6.248-16.379 0-22.627l-22.627-22.627c-6.248-6.248-16.379-6.249-22.628 0L184 302.745l-70.059-70.059c-6.248-6.248-16.379-6.248-22.628 0l-22.627 22.627c-6.248 6.248-6.248 16.379 0 22.627l104 104c6.249 6.25 16.379 6.25 22.628.001z"}))},checkSquareOutline:{label:(0,i._x)("Check - Square Outline","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 448 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M400 32H48C21.49 32 0 53.49 0 80v352c0 26.51 21.49 48 48 48h352c26.51 0 48-21.49 48-48V80c0-26.51-21.49-48-48-48zm0 400H48V80h352v352zm-35.864-241.724L191.547 361.48c-4.705 4.667-12.303 4.637-16.97-.068l-90.781-91.516c-4.667-4.705-4.637-12.303.069-16.971l22.719-22.536c4.705-4.667 12.303-4.637 16.97.069l59.792 60.277 141.352-140.216c4.705-4.667 12.303-4.637 16.97.068l22.536 22.718c4.667 4.706 4.637 12.304-.068 16.971z"}))},chevronDown:{label:(0,i._x)("Chevron - Down","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 448 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M207.029 381.476L12.686 187.132c-9.373-9.373-9.373-24.569 0-33.941l22.667-22.667c9.357-9.357 24.522-9.375 33.901-.04L224 284.505l154.745-154.021c9.379-9.335 24.544-9.317 33.901.04l22.667 22.667c9.373 9.373 9.373 24.569 0 33.941L240.971 381.476c-9.373 9.372-24.569 9.372-33.942 0z"}))},chevronLeft:{label:(0,i._x)("Chevron - Left","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 256 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M31.7 239l136-136c9.4-9.4 24.6-9.4 33.9 0l22.6 22.6c9.4 9.4 9.4 24.6 0 33.9L127.9 256l96.4 96.4c9.4 9.4 9.4 24.6 0 33.9L201.7 409c-9.4 9.4-24.6 9.4-33.9 0l-136-136c-9.5-9.4-9.5-24.6-.1-34z"}))},chevronRight:{label:(0,i._x)("Chevron - Right","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 256 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M224.3 273l-136 136c-9.4 9.4-24.6 9.4-33.9 0l-22.6-22.6c-9.4-9.4-9.4-24.6 0-33.9l96.4-96.4-96.4-96.4c-9.4-9.4-9.4-24.6 0-33.9L54.3 103c9.4-9.4 24.6-9.4 33.9 0l136 136c9.5 9.4 9.5 24.6.1 34z"}))},chevronUp:{label:(0,i._x)("Chevron - Up","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 448 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M240.971 130.524l194.343 194.343c9.373 9.373 9.373 24.569 0 33.941l-22.667 22.667c-9.357 9.357-24.522 9.375-33.901.04L224 227.495 69.255 381.516c-9.379 9.335-24.544 9.317-33.901-.04l-22.667-22.667c-9.373-9.373-9.373-24.569 0-33.941L207.03 130.525c9.372-9.373 24.568-9.373 33.941-.001z"}))},circle:{label:(0,i._x)("Circle","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8z"}))},circleOutline:{label:(0,i._x)("Circle - Outline","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm0 448c-110.5 0-200-89.5-200-200S145.5 56 256 56s200 89.5 200 200-89.5 200-200 200z"}))},coffee:{label:(0,i._x)("Coffee","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 640 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M192 384h192c53 0 96-43 96-96h32c70.6 0 128-57.4 128-128S582.6 32 512 32H120c-13.3 0-24 10.7-24 24v232c0 53 43 96 96 96zM512 96c35.3 0 64 28.7 64 64s-28.7 64-64 64h-32V96h32zm47.7 384H48.3c-47.6 0-61-64-36-64h583.3c25 0 11.8 64-35.9 64z"}))},dotCircle:{label:(0,i._x)("Dot - Circle","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M256 8C119.033 8 8 119.033 8 256s111.033 248 248 248 248-111.033 248-248S392.967 8 256 8zm80 248c0 44.112-35.888 80-80 80s-80-35.888-80-80 35.888-80 80-80 80 35.888 80 80z"}))},dotCircleOutline:{label:(0,i._x)("Dot - Circle Outline","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M256 56c110.532 0 200 89.451 200 200 0 110.532-89.451 200-200 200-110.532 0-200-89.451-200-200 0-110.532 89.451-200 200-200m0-48C119.033 8 8 119.033 8 256s111.033 248 248 248 248-111.033 248-248S392.967 8 256 8zm0 168c-44.183 0-80 35.817-80 80s35.817 80 80 80 80-35.817 80-80-35.817-80-80-80z"}))},ellipsesH:{label:(0,i._x)("Ellipses - Horizontal","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M328 256c0 39.8-32.2 72-72 72s-72-32.2-72-72 32.2-72 72-72 72 32.2 72 72zm104-72c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72zm-352 0c-39.8 0-72 32.2-72 72s32.2 72 72 72 72-32.2 72-72-32.2-72-72-72z"}))},ellipsesV:{label:(0,i._x)("Ellipses - Vertical","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 192 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M96 184c39.8 0 72 32.2 72 72s-32.2 72-72 72-72-32.2-72-72 32.2-72 72-72zM24 80c0 39.8 32.2 72 72 72s72-32.2 72-72S135.8 8 96 8 24 40.2 24 80zm0 352c0 39.8 32.2 72 72 72s72-32.2 72-72-32.2-72-72-72-72 32.2-72 72z"}))},envelope:{label:(0,i._x)("Envelope","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M464 64H48C21.49 64 0 85.49 0 112v288c0 26.51 21.49 48 48 48h416c26.51 0 48-21.49 48-48V112c0-26.51-21.49-48-48-48zm0 48v40.805c-22.422 18.259-58.168 46.651-134.587 106.49-16.841 13.247-50.201 45.072-73.413 44.701-23.208.375-56.579-31.459-73.413-44.701C106.18 199.465 70.425 171.067 48 152.805V112h416zM48 400V214.398c22.914 18.251 55.409 43.862 104.938 82.646 21.857 17.205 60.134 55.186 103.062 54.955 42.717.231 80.509-37.199 103.053-54.947 49.528-38.783 82.032-64.401 104.947-82.653V400H48z"}))},fireAlt:{label:(0,i._x)("Fire","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 448 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M323.56 51.2c-20.8 19.3-39.58 39.59-56.22 59.97C240.08 73.62 206.28 35.53 168 0 69.74 91.17 0 209.96 0 281.6 0 408.85 100.29 512 224 512s224-103.15 224-230.4c0-53.27-51.98-163.14-124.44-230.4zm-19.47 340.65C282.43 407.01 255.72 416 226.86 416 154.71 416 96 368.26 96 290.75c0-38.61 24.31-72.63 72.79-130.75 6.93 7.98 98.83 125.34 98.83 125.34l58.63-66.88c4.14 6.85 7.91 13.55 11.27 19.97 27.35 52.19 15.81 118.97-33.43 153.42z"}))},heart:{label:(0,i._x)("Heart","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M462.3 62.6C407.5 15.9 326 24.3 275.7 76.2L256 96.5l-19.7-20.3C186.1 24.3 104.5 15.9 49.7 62.6c-62.8 53.6-66.1 149.8-9.9 207.9l193.5 199.8c12.5 12.9 32.8 12.9 45.3 0l193.5-199.8c56.3-58.1 53-154.3-9.8-207.9z"}))},mapMarkerAlt:{label:(0,i._x)("Map Marker","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 384 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M172.268 501.67C26.97 291.031 0 269.413 0 192 0 85.961 85.961 0 192 0s192 85.961 192 192c0 77.413-26.97 99.031-172.268 309.67-9.535 13.774-29.93 13.773-39.464 0zM192 272c44.183 0 80-35.817 80-80s-35.817-80-80-80-80 35.817-80 80 35.817 80 80 80z"}))},paperPlane:{label:(0,i._x)("Paper Plane","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M440 6.5L24 246.4c-34.4 19.9-31.1 70.8 5.7 85.9L144 379.6V464c0 46.4 59.2 65.5 86.6 28.6l43.8-59.1 111.9 46.2c5.9 2.4 12.1 3.6 18.3 3.6 8.2 0 16.3-2.1 23.6-6.2 12.8-7.2 21.6-20 23.9-34.5l59.4-387.2c6.1-40.1-36.9-68.8-71.5-48.9zM192 464v-64.6l36.6 15.1L192 464zm212.6-28.7l-153.8-63.5L391 169.5c10.7-15.5-9.5-33.5-23.7-21.2L155.8 332.6 48 288 464 48l-59.4 387.3z"}))},phone:{label:(0,i._x)("Phone","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M493.4 24.6l-104-24c-11.3-2.6-22.9 3.3-27.5 13.9l-48 112c-4.2 9.8-1.4 21.3 6.9 28l60.6 49.6c-36 76.7-98.9 140.5-177.2 177.2l-49.6-60.6c-6.8-8.3-18.2-11.1-28-6.9l-112 48C3.9 366.5-2 378.1.6 389.4l24 104C27.1 504.2 36.7 512 48 512c256.1 0 464-207.5 464-464 0-11.2-7.7-20.9-18.6-23.4z"}))},plus:{label:(0,i._x)("Plus","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 448 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M416 208H272V64c0-17.67-14.33-32-32-32h-32c-17.67 0-32 14.33-32 32v144H32c-17.67 0-32 14.33-32 32v32c0 17.67 14.33 32 32 32h144v144c0 17.67 14.33 32 32 32h32c17.67 0 32-14.33 32-32V304h144c17.67 0 32-14.33 32-32v-32c0-17.67-14.33-32-32-32z"}))},plusCircle:{label:(0,i._x)("Plus - Circle","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm144 276c0 6.6-5.4 12-12 12h-92v92c0 6.6-5.4 12-12 12h-56c-6.6 0-12-5.4-12-12v-92h-92c-6.6 0-12-5.4-12-12v-56c0-6.6 5.4-12 12-12h92v-92c0-6.6 5.4-12 12-12h56c6.6 0 12 5.4 12 12v92h92c6.6 0 12 5.4 12 12v56z"}))},plusSquare:{label:(0,i._x)("Plus - Square","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 448 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zm-32 252c0 6.6-5.4 12-12 12h-92v92c0 6.6-5.4 12-12 12h-56c-6.6 0-12-5.4-12-12v-92H92c-6.6 0-12-5.4-12-12v-56c0-6.6 5.4-12 12-12h92v-92c0-6.6 5.4-12 12-12h56c6.6 0 12 5.4 12 12v92h92c6.6 0 12 5.4 12 12v56z"}))},plusSquareOutline:{label:(0,i._x)("Plus - Square Outline","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 448 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M352 240v32c0 6.6-5.4 12-12 12h-88v88c0 6.6-5.4 12-12 12h-32c-6.6 0-12-5.4-12-12v-88h-88c-6.6 0-12-5.4-12-12v-32c0-6.6 5.4-12 12-12h88v-88c0-6.6 5.4-12 12-12h32c6.6 0 12 5.4 12 12v88h88c6.6 0 12 5.4 12 12zm96-160v352c0 26.5-21.5 48-48 48H48c-26.5 0-48-21.5-48-48V80c0-26.5 21.5-48 48-48h352c26.5 0 48 21.5 48 48zm-48 346V86c0-3.3-2.7-6-6-6H54c-3.3 0-6 2.7-6 6v340c0 3.3 2.7 6 6 6h340c3.3 0 6-2.7 6-6z"}))},shield:{label:(0,i._x)("Shield","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 512 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M466.5 83.7l-192-80a48.15 48.15 0 0 0-36.9 0l-192 80C27.7 91.1 16 108.6 16 128c0 198.5 114.5 335.7 221.5 380.3 11.8 4.9 25.1 4.9 36.9 0C360.1 472.6 496 349.3 496 128c0-19.4-11.7-36.9-29.5-44.3zM256.1 446.3l-.1-381 175.9 73.3c-3.3 151.4-82.1 261.1-175.8 307.7z"}))},star:{label:(0,i._x)("Star","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 576 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M259.3 17.8L194 150.2 47.9 171.5c-26.2 3.8-36.7 36.1-17.7 54.6l105.7 103-25 145.5c-4.5 26.3 23.2 46 46.4 33.7L288 439.6l130.7 68.7c23.2 12.2 50.9-7.4 46.4-33.7l-25-145.5 105.7-103c19-18.5 8.5-50.8-17.7-54.6L382 150.2 316.7 17.8c-11.7-23.6-45.6-23.9-57.4 0z"}))},tags:{label:(0,i._x)("Tags","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 640 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M497.941 225.941L286.059 14.059A48 48 0 0 0 252.118 0H48C21.49 0 0 21.49 0 48v204.118a48 48 0 0 0 14.059 33.941l211.882 211.882c18.744 18.745 49.136 18.746 67.882 0l204.118-204.118c18.745-18.745 18.745-49.137 0-67.882zM112 160c-26.51 0-48-21.49-48-48s21.49-48 48-48 48 21.49 48 48-21.49 48-48 48zm513.941 133.823L421.823 497.941c-18.745 18.745-49.137 18.745-67.882 0l-.36-.36L527.64 323.522c16.999-16.999 26.36-39.6 26.36-63.64s-9.362-46.641-26.36-63.64L331.397 0h48.721a48 48 0 0 1 33.941 14.059l211.882 211.882c18.745 18.745 18.745 49.137 0 67.882z"}))},userCircle:{label:(0,i._x)("User - Circle","label","generateblocks"),icon:(0,e.createElement)("svg",{"aria-hidden":"true",role:"img",height:"1em",width:"1em",viewBox:"0 0 496 512",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)("path",{fill:"currentColor",d:"M248 8C111 8 0 119 0 256s111 248 248 248 248-111 248-248S385 8 248 8zm0 96c48.6 0 88 39.4 88 88s-39.4 88-88 88-88-39.4-88-88 39.4-88 88-88zm0 344c-58.7 0-111.3-26.6-146.5-68.2 18.8-35.4 55.6-59.8 98.5-59.8 2.4 0 4.8.4 7.1 1.1 13 4.2 26.6 6.9 40.9 6.9 14.3 0 28-2.7 40.9-6.9 2.3-.7 4.7-1.1 7.1-1.1 42.9 0 79.7 24.4 98.5 59.8C359.3 421.4 306.7 448 248 448z"}))}};class rs extends e.Component{constructor(){super(...arguments),this.state={showIcons:!1,showGeneralIcons:!1,showSocialIcons:!1}}render(){const{attributes:t,setAttributes:a,attrIcon:l,attrIconLocation:r,locationOptions:o,attrRemoveText:s}=this.props;let c={general:{group:(0,i.__)("General","generateblocks"),svgs:ls},social:{group:(0,i.__)("Social","generateblocks"),svgs:as}};return c=(0,m.applyFilters)("generateblocks.editor.iconSVGSets",c),(0,e.createElement)(e.Fragment,null,(0,e.createElement)(n.BaseControl,{className:"gb-svg-html"},(0,e.createElement)(n.TextControl,{label:(0,i.__)("Icon SVG HTML","generateblocks"),value:t[l],onChange:e=>{a({[this.props.attrIcon]:xi(e)}),a(""!==e?{hasIcon:!0}:{hasIcon:!1})}}),(0,e.createElement)("div",{className:"gb-icon-preview"},(0,e.createElement)("span",{dangerouslySetInnerHTML:{__html:xi(t[l])}}),(0,e.createElement)(n.Button,{isSmall:!0,className:"reset-icon is-secondary",onClick:()=>{a({[this.props.attrIcon]:"",hasIcon:!1,[this.props.attrRemoveText]:!1})}},(0,e.createElement)("span",{className:"editor-block-types-list__item-icon"},(0,i.__)("Clear","generateblocks"))))),(0,e.createElement)(n.BaseControl,{className:"gb-icon-chooser"},Object.keys(c).map(((t,l)=>{const r=c[t].svgs;return(0,e.createElement)(n.PanelBody,{title:c[t].group,initialOpen:!1,key:l},(0,e.createElement)(n.PanelRow,null,(0,e.createElement)(n.BaseControl,null,(0,e.createElement)("ul",{className:"gblocks-icon-chooser"},Object.keys(r).map(((t,l)=>(0,e.createElement)("li",{key:`editor-pblock-types-list-item-${l}`},(0,e.createElement)(n.Tooltip,{text:r[t].label},(0,e.createElement)(n.Button,{className:"editor-block-list-item-button",onClick:()=>{let l=r[t].icon;"string"!=typeof l&&(l=(0,e.renderToString)(l)),a({[this.props.attrIcon]:l,hasIcon:!0})}},"string"==typeof r[t].icon?(0,e.createElement)(e.Fragment,null,(0,e.createElement)("span",{className:"editor-block-types-list__item-icon",dangerouslySetInnerHTML:{__html:xi(r[t].icon)}})):(0,e.createElement)(e.Fragment,null,(0,e.createElement)("span",{className:"editor-block-types-list__item-icon"},r[t].icon)))))))))))}))),void 0!==t[r]&&!t[s]&&!!t[l]&&(0,e.createElement)(n.SelectControl,{label:(0,i.__)("Icon Location","generateblocks"),value:t[r],options:o,onChange:e=>{const l=t.iconPaddingLeft,r=t.iconPaddingRight,n=t.iconPaddingRightTablet,i=t.iconPaddingLeftTablet,o=t.iconPaddingRightMobile,s=t.iconPaddingLeftMobile;"right"===e&&(!l&&r&&a({iconPaddingLeft:r,iconPaddingRight:""}),!i&&n&&a({iconPaddingLeftTablet:n,iconPaddingRightTablet:""}),!s&&o&&a({iconPaddingLeftMobile:o,iconPaddingRightMobile:""})),"left"===e&&(!r&&l&&a({iconPaddingRight:l,iconPaddingLeft:""}),!n&&i&&a({iconPaddingRightTablet:i,iconPaddingLeftTablet:""}),!o&&s&&a({iconPaddingRightMobile:s,iconPaddingLeftMobile:""})),a({[this.props.attrIconLocation]:e})}}),void 0!==t[s]&&!!t[l]&&(0,e.createElement)(n.ToggleControl,{label:(0,i.__)("Remove Text","generateblocks"),checked:!!t[s],onChange:e=>{a({[this.props.attrRemoveText]:e})}}))}}var ns=rs;(0,m.addFilter)("generateblocks.editor.colorGroupItems","generateblocks/button-colors/add-conditional-color-items",(function(e,t){const{name:a,attributes:l}=t,{useDynamicData:r,dynamicContentType:n}=l;if("generateblocks/button"!==a)return e;if(r&&"pagination-numbers"===n){const t=[{group:"background",attribute:"backgroundColorCurrent",tooltip:(0,i.__)("Current","generateblocks"),alpha:!0},{group:"text",attribute:"textColorCurrent",tooltip:(0,i.__)("Current","generateblocks"),alpha:!1},{group:"border",attribute:"borderColorCurrent",tooltip:(0,i.__)("Current","generateblocks"),alpha:!0}];e.forEach(((a,l)=>{t.forEach((t=>{t.group!==a.group||a.items.some((e=>e.attribute===t.attribute))||e[l].items.push({tooltip:t.tooltip,attribute:t.attribute,alpha:t.alpha})}))}))}return e}));var is=a=>{const{attributes:l,deviceType:n,state:o,blockDefaults:s,computedStyles:c}=a,{icon:u,removeText:g,iconSizeUnit:d}=l;return(0,e.createElement)(r.InspectorControls,null,(0,e.createElement)(C,t({},a,{title:(0,i.__)("Typography","generateblocks"),initialOpen:!1,icon:p("typography"),className:"gblocks-panel-label",id:"buttonTypography",state:o,showPanel:!g||!1}),(0,e.createElement)(cn,t({},a,{deviceType:n,options:["fontWeight","textTransform","fontSize","letterSpacing","fontFamily"],computedStyles:c})),(0,m.applyFilters)("generateblocks.editor.controls","","buttonTypography",a,o)),(0,e.createElement)(C,t({},a,{title:(0,i.__)("Spacing","generateblocks"),initialOpen:!1,icon:p("spacing"),className:"gblocks-panel-label",id:"buttonSpacing",state:o}),(0,e.createElement)(pn,t({},a,{deviceType:n,dimensions:[{type:"padding",label:(0,i.__)("Padding","generateblocks"),units:["px","em","%"]},{type:"margin",label:(0,i.__)("Margin","generateblocks"),units:["px","em","%"]},{type:"borderSize",label:(0,i.__)("Border Size","generateblocks"),units:["px"]},{type:"borderRadius",label:(0,i.__)("Border Radius","generateblocks"),units:["px","em","%"]}]})),(0,m.applyFilters)("generateblocks.editor.controls","","buttonSpacing",a,o)),(0,e.createElement)(C,t({},a,{title:(0,i.__)("Colors","generateblocks"),initialOpen:!1,icon:p("colors"),className:"gblocks-panel-label",id:"buttonColors",state:o}),"Desktop"===n&&(0,e.createElement)(_i,t({},a,{colors:[{group:"background",label:(0,i.__)("Background","generateblocks"),items:[{attribute:"backgroundColor",alpha:!0},{tooltip:(0,i.__)("Hover","generateblocks"),attribute:"backgroundColorHover",alpha:!0}]},{group:"text",label:(0,i.__)("Text","generateblocks"),items:[{attribute:"textColor"},{tooltip:(0,i.__)("Hover","generateblocks"),attribute:"textColorHover"}]},{group:"border",label:(0,i.__)("Border","generateblocks"),items:[{attribute:"borderColor",alpha:!0},{tooltip:(0,i.__)("Hover","generateblocks"),attribute:"borderColorHover",alpha:!0}]}]})),(0,m.applyFilters)("generateblocks.editor.controls","","buttonColors",a,o)),(0,e.createElement)(C,t({},a,{title:(0,i.__)("Background Gradient","generateblocks"),initialOpen:!1,icon:p("gradients"),className:"gblocks-panel-label",id:"buttonBackgroundGradient",state:o}),"Desktop"===n&&(0,e.createElement)(Ti,t({},a,{attrGradient:"gradient",attrGradientDirection:"gradientDirection",attrGradientColorOne:"gradientColorOne",attrGradientColorOneOpacity:"gradientColorOneOpacity",attrGradientColorStopOne:"gradientColorStopOne",attrGradientColorTwo:"gradientColorTwo",attrGradientColorTwoOpacity:"gradientColorTwoOpacity",attrGradientColorStopTwo:"gradientColorStopTwo",defaultColorOne:s.gradientColorOne,defaultColorTwo:s.gradientColorTwo})),(0,m.applyFilters)("generateblocks.editor.controls","","buttonBackgroundGradient",a,o)),(0,e.createElement)(C,t({},a,{title:(0,i.__)("Icon","generateblocks"),initialOpen:!1,icon:p("icons"),className:"gblocks-panel-label",id:"buttonIcon",state:o,showPanel:!("Desktop"!==n&&!u)}),"Desktop"===n&&(0,e.createElement)(ns,t({},a,{attrIcon:"icon",attrIconLocation:"iconLocation",attrRemoveText:"removeText",locationOptions:[{label:(0,i.__)("Left","generateblocks"),value:"left"},{label:(0,i.__)("Right","generateblocks"),value:"right"}]})),"Desktop"===n&&!!u&&(0,e.createElement)(e.Fragment,null,!g&&(0,e.createElement)(dn,t({},a,{device:n,type:"iconPadding",label:(0,i.__)("Padding","generateblocks"),units:["px","em","%"]}))),"Tablet"===n&&!!u&&(0,e.createElement)(e.Fragment,null,!g&&(0,e.createElement)(dn,t({},a,{device:n,type:"iconPadding",label:(0,i.__)("Padding","generateblocks"),units:["px","em","%"]}))),"Mobile"===n&&!!u&&(0,e.createElement)(e.Fragment,null,!g&&(0,e.createElement)(dn,t({},a,{device:n,type:"iconPadding",label:(0,i.__)("Padding","generateblocks"),units:["px","em","%"]}))),!!u&&(0,e.createElement)(M,t({},a,{label:(0,i.__)("Icon Size","generateblocks"),attributeName:"iconSize",units:["px","em"],device:n,presets:[{unit:"em",data:[.7,1,1.5,2]}],min:"1",step:"em"===d?.1:1})),(0,m.applyFilters)("generateblocks.editor.controls","","buttonIcon",a,o)))},os=t=>{let{anchor:a,ariaLabel:l,setAttributes:o}=t;return(0,e.createElement)(r.InspectorAdvancedControls,null,(0,e.createElement)(L,{anchor:a,setAttributes:o}),(0,e.createElement)(n.TextControl,{label:(0,i.__)("ARIA Label","generateblocks"),help:(0,i.__)("Helpful to people using screen readers.","generateblocks"),value:l,onChange:e=>{o({ariaLabel:e})}}))};class ss extends e.Component{render(){let t=[];return t=(0,m.applyFilters)("generateblocks.editor.desktopCSS",t,this.props,"button"),(0,e.createElement)("style",null,O(t))}}class cs extends e.Component{render(){const t=(0,m.applyFilters)("generateblocks.editor.cssAttrs",this.props.attributes,this.props),{url:a,uniqueId:l,removeText:r,letterSpacingTablet:n,fontSizeTablet:i,fontSizeUnit:o,marginTopTablet:s,marginRightTablet:c,marginBottomTablet:u,marginLeftTablet:g,marginUnit:d,paddingTopTablet:p,paddingRightTablet:b,paddingBottomTablet:f,paddingLeftTablet:h,paddingUnit:k,borderSizeTopTablet:y,borderSizeRightTablet:v,borderSizeBottomTablet:w,borderSizeLeftTablet:_,borderRadiusTopRightTablet:C,borderRadiusBottomRightTablet:T,borderRadiusBottomLeftTablet:E,borderRadiusTopLeftTablet:S,borderRadiusUnit:x,iconPaddingTopTablet:B,iconPaddingRightTablet:M,iconPaddingBottomTablet:D,iconPaddingLeftTablet:R,iconPaddingUnit:L,iconSizeTablet:z,iconSizeUnit:N}=t;let A=".editor-styles-wrapper .gb-button-wrapper a.gb-button-"+l;a||(A=".editor-styles-wrapper .gb-button-wrapper .gb-button-"+l);let F=[];return F[A]=[{"padding-top":I(p,k),"padding-right":I(b,k),"padding-bottom":I(f,k),"padding-left":I(h,k),"border-top-left-radius":I(S,x),"border-top-right-radius":I(C,x),"border-bottom-right-radius":I(T,x),"border-bottom-left-radius":I(E,x),"font-size":I(i,o),"letter-spacing":I(n,"em"),"margin-top":I(s,d),"margin-right":I(c,d),"margin-bottom":I(u,d),"margin-left":I(g,d)}],(y||v||w||_)&&F[A].push({"border-top-width":I(y,"px"),"border-right-width":I(v,"px"),"border-bottom-width":I(w,"px"),"border-left-width":I(_,"px"),"border-style":"solid"}),F[A+" .gb-icon"]=[{"padding-top":!r&&I(B,L),"padding-right":!r&&I(M,L),"padding-bottom":!r&&I(D,L),"padding-left":!r&&I(R,L),"font-size":I(z,N)}],F=(0,m.applyFilters)("generateblocks.editor.tabletCSS",F,this.props,"button"),(0,e.createElement)("style",null,O(F))}}class us extends e.Component{render(){let t=[];return t=(0,m.applyFilters)("generateblocks.editor.tabletOnlyCSS",t,this.props,"button"),(0,e.createElement)("style",null,O(t))}}class gs extends e.Component{render(){const t=(0,m.applyFilters)("generateblocks.editor.cssAttrs",this.props.attributes,this.props),{url:a,uniqueId:l,removeText:r,letterSpacingMobile:n,fontSizeMobile:i,fontSizeUnit:o,marginTopMobile:s,marginRightMobile:c,marginBottomMobile:u,marginLeftMobile:g,marginUnit:d,paddingTopMobile:p,paddingRightMobile:b,paddingBottomMobile:f,paddingLeftMobile:h,paddingUnit:k,borderSizeTopMobile:y,borderSizeRightMobile:v,borderSizeBottomMobile:w,borderSizeLeftMobile:_,borderRadiusTopRightMobile:C,borderRadiusBottomRightMobile:T,borderRadiusBottomLeftMobile:E,borderRadiusTopLeftMobile:S,borderRadiusUnit:x,iconPaddingTopMobile:B,iconPaddingRightMobile:M,iconPaddingBottomMobile:D,iconPaddingLeftMobile:R,iconPaddingUnit:L,iconSizeMobile:z,iconSizeUnit:N}=t;let A=".editor-styles-wrapper .gb-button-wrapper a.gb-button-"+l;a||(A=".editor-styles-wrapper .gb-button-wrapper .gb-button-"+l);let F=[];return F[A]=[{"padding-top":I(p,k),"padding-right":I(b,k),"padding-bottom":I(f,k),"padding-left":I(h,k),"border-top-left-radius":I(S,x),"border-top-right-radius":I(C,x),"border-bottom-right-radius":I(T,x),"border-bottom-left-radius":I(E,x),"font-size":I(i,o),"letter-spacing":I(n,"em"),"margin-top":I(s,d),"margin-right":I(c,d),"margin-bottom":I(u,d),"margin-left":I(g,d)}],(y||v||w||_)&&F[A].push({"border-top-width":I(y,"px"),"border-right-width":I(v,"px"),"border-bottom-width":I(w,"px"),"border-left-width":I(_,"px"),"border-style":"solid"}),F[A+" .gb-icon"]=[{"padding-top":!r&&I(B,L),"padding-right":!r&&I(M,L),"padding-bottom":!r&&I(D,L),"padding-left":!r&&I(R,L),"font-size":I(z,N)}],F=(0,m.applyFilters)("generateblocks.editor.mobileCSS",F,this.props,"button"),(0,e.createElement)("style",null,O(F))}}class ds extends e.Component{render(){const t=(0,m.applyFilters)("generateblocks.editor.cssAttrs",this.props.attributes,this.props),{url:a,uniqueId:l,removeText:r,backgroundColor:n,backgroundColorOpacity:i,textColor:o,backgroundColorHover:s,backgroundColorHoverOpacity:c,textColorHover:u,fontFamily:g,fontFamilyFallback:d,fontWeight:p,textTransform:b,letterSpacing:f,fontSize:h,fontSizeUnit:k,marginTop:y,marginRight:v,marginBottom:w,marginLeft:_,marginUnit:C,paddingTop:T,paddingRight:E,paddingBottom:S,paddingLeft:x,paddingUnit:B,borderSizeTop:M,borderSizeRight:D,borderSizeBottom:R,borderSizeLeft:L,borderRadiusTopRight:z,borderRadiusBottomRight:N,borderRadiusBottomLeft:A,borderRadiusTopLeft:F,borderRadiusUnit:P,borderColor:H,borderColorOpacity:V,borderColorHover:U,borderColorHoverOpacity:G,gradient:j,gradientDirection:q,gradientColorOne:W,gradientColorOneOpacity:$,gradientColorStopOne:Z,gradientColorTwo:K,gradientColorTwoOpacity:J,gradientColorStopTwo:Q,iconPaddingTop:Y,iconPaddingRight:X,iconPaddingBottom:ee,iconPaddingLeft:te,iconPaddingUnit:ae,iconSize:le,iconSizeUnit:re}=t;let ne,ie="",oe="",se="";j&&(W&&""!==Z&&(oe=" "+Z+"%"),K&&""!==Q&&(se=" "+Q+"%")),j&&(ne="linear-gradient("+q+"deg, "+vi(W,$)+oe+", "+vi(K,J)+se+");"),g&&d&&(ie=", "+d);let ce=".editor-styles-wrapper .gb-button-wrapper a.gb-button-"+l;a||(ce=".editor-styles-wrapper .gb-button-wrapper .gb-button-"+l);let ue=[];return ue[ce]=[{"background-color":vi(n,i),"background-image":ne,color:o,padding:io(T,E,S,x,B),"border-radius":io(F,z,N,A,P),"font-family":g+ie,"font-weight":p,"text-transform":b,"font-size":I(h,k),"letter-spacing":I(f,"em"),margin:io(y,v,w,_,C),"border-color":vi(H,V)}],(M||D||R||L)&&ue[ce].push({"border-width":io(M,D,R,L,"px"),"border-style":"solid"}),ue[ce+":hover, "+ce+":focus, "+ce+":active"]=[{"background-color":vi(s,c),color:u,"border-color":vi(U,G)}],ue[ce+" .gb-icon"]=[{padding:!r&&io(Y,X,ee,te,ae),"font-size":I(le,re)}],ue=(0,m.applyFilters)("generateblocks.editor.mainCSS",ue,this.props,"button"),(0,e.createElement)("style",null,O(ue))}}var ps=(0,e.memo)((function(t){const a=(0,l.useSelect)((e=>{if(!e("core/edit-post"))return"Desktop";const{__experimentalGetPreviewDeviceType:t=(()=>"Desktop")}=e("core/edit-post");return t()}),[]),{isBlockPreview:r=!1}=t?.attributes;return r?null:(0,e.createElement)(e.Fragment,null,(0,e.createElement)(ds,t),a&&(0,e.createElement)(e.Fragment,null,"Desktop"===a&&(0,e.createElement)(ss,t),("Tablet"===a||"Mobile"===a)&&(0,e.createElement)(cs,t),"Tablet"===a&&(0,e.createElement)(us,t),"Mobile"===a&&(0,e.createElement)(gs,t)))}),G),bs=(0,q.compose)(Oo,le,(t=>a=>{const{attributes:l,setAttributes:r}=a,{hasIcon:n,icon:i,hasUrl:o,url:s,blockVersion:c,gradient:u}=l;return(0,e.useEffect)((()=>{if(!n&&i&&r({hasIcon:!0}),o||r({hasUrl:!!s}),!re(l)&&ne(c,2)){const e=generateBlocksLegacyDefaults.v_1_4_0.button,t={},a=[];u&&a.push("gradientDirection","gradientColorOne","gradientColorOneOpacity","gradientColorTwo","gradientColorTwoOpacity"),a.forEach((a=>{x(l[a])||(t[a]=e[a])})),Object.keys(t).length>0&&r(t)}ne(c,2)&&r({blockVersion:2})}),[]),(0,e.createElement)(t,a)}))((a=>{const{attributes:l,setAttributes:r,clientId:n,ContentRenderer:i=$i}=a,{anchor:o,ariaLabel:s,fontFamily:c,googleFont:u,googleFontVariants:g,isBlockPreview:d=!1}=l,p=(0,e.useRef)(null),[b,m]=(0,e.useState)({}),[f,h]=W("Desktop");return(0,e.useEffect)((()=>{const e=getComputedStyle(p.current);m({fontSize:parseInt(e.fontSize)||""})}),[]),(0,e.createElement)(e.Fragment,null,(0,e.createElement)(ts,{clientId:n,attributes:l,setAttributes:r}),(0,e.createElement)(is,t({},a,{deviceType:f,setDeviceType:h,state:{deviceType:f},blockDefaults:generateBlocksDefaults.button,computedStyles:b})),(0,e.createElement)(os,{anchor:o,ariaLabel:s,setAttributes:r}),(0,e.createElement)(ps,t({},a,{deviceType:f})),(0,e.createElement)(nn,{fontFamily:c,googleFont:u,googleFontVariants:g,isBlockPreview:d}),(0,e.createElement)(i,t({},a,{buttonRef:p})))})),ms={uniqueId:{type:"string",default:""},anchor:{type:"string",default:""},url:{type:"string",source:"attribute",selector:".gb-button",attribute:"href"},hasUrl:{type:"boolean"},target:{type:"boolean"},relNoFollow:{type:"boolean"},relSponsored:{type:"boolean"},text:{type:"string",source:"html",selector:".gb-button-text",default:"Button"},icon:{type:"string",source:"html",selector:".gb-icon"},hasIcon:{type:"boolean",default:!1},iconLocation:{type:"string",default:generateBlocksDefaults.button.iconLocation},customIcon:{type:"boolean",default:!1},removeText:{type:"boolean",default:generateBlocksDefaults.button.removeText},ariaLabel:{type:"string",default:generateBlocksDefaults.button.ariaLabel},backgroundColor:{type:"string",default:generateBlocksDefaults.button.backgroundColor},backgroundColorOpacity:{type:"number",default:generateBlocksDefaults.button.backgroundColorOpacity},backgroundColorHover:{type:"string",default:generateBlocksDefaults.button.backgroundColorHover},backgroundColorHoverOpacity:{type:"number",default:generateBlocksDefaults.button.backgroundColorHoverOpacity},backgroundColorCurrent:{type:"string",default:generateBlocksDefaults.button.backgroundColorCurrent},textColor:{type:"string",default:generateBlocksDefaults.button.textColor},textColorHover:{type:"string",default:generateBlocksDefaults.button.textColorHover},textColorCurrent:{type:"string",default:generateBlocksDefaults.button.textColorCurrent},borderColor:{type:"string",default:generateBlocksDefaults.button.borderColor},borderColorOpacity:{type:"number",default:generateBlocksDefaults.button.borderColorOpacity},borderColorHover:{type:"string",default:generateBlocksDefaults.button.borderColorHover},borderColorHoverOpacity:{type:"number",default:generateBlocksDefaults.button.borderColorHoverOpacity},borderColorCurrent:{type:"string",default:generateBlocksDefaults.button.borderColorCurrent},fontFamily:{type:"string",default:generateBlocksDefaults.button.fontFamily},fontFamilyFallback:{type:"string",default:generateBlocksDefaults.button.fontFamilyFallback},googleFont:{type:"boolean",default:generateBlocksDefaults.button.googleFont},googleFontVariants:{type:"string",default:generateBlocksDefaults.button.googleFontVariants},fontWeight:{type:"string",default:generateBlocksDefaults.button.fontWeight},fontSize:{type:"number",default:generateBlocksDefaults.button.fontSize},fontSizeTablet:{type:"number",default:generateBlocksDefaults.button.fontSizeTablet},fontSizeMobile:{type:"number",default:generateBlocksDefaults.button.fontSizeMobile},fontSizeUnit:{type:"string",default:generateBlocksDefaults.button.fontSizeUnit},textTransform:{type:"string",default:generateBlocksDefaults.button.textTransform},letterSpacing:{type:"number",default:generateBlocksDefaults.button.letterSpacing},letterSpacingTablet:{type:"number",default:generateBlocksDefaults.button.letterSpacingTablet},letterSpacingMobile:{type:"number",default:generateBlocksDefaults.button.letterSpacingMobile},marginTop:{type:"string",default:generateBlocksDefaults.button.marginTop},marginRight:{type:"string",default:generateBlocksDefaults.button.marginRight},marginBottom:{type:"string",default:generateBlocksDefaults.button.marginBottom},marginLeft:{type:"string",default:generateBlocksDefaults.button.marginLeft},marginUnit:{type:"string",default:generateBlocksDefaults.button.marginUnit},marginTopTablet:{type:"string",default:generateBlocksDefaults.button.marginTopTablet},marginRightTablet:{type:"string",default:generateBlocksDefaults.button.marginRightTablet},marginBottomTablet:{type:"string",default:generateBlocksDefaults.button.marginBottomTablet},marginLeftTablet:{type:"string",default:generateBlocksDefaults.button.marginLeftTablet},marginTopMobile:{type:"string",default:generateBlocksDefaults.button.marginTopMobile},marginRightMobile:{type:"string",default:generateBlocksDefaults.button.marginRightMobile},marginBottomMobile:{type:"string",default:generateBlocksDefaults.button.marginBottomMobile},marginLeftMobile:{type:"string",default:generateBlocksDefaults.button.marginLeftMobile},paddingTop:{type:"string",default:generateBlocksDefaults.button.paddingTop},paddingRight:{type:"string",default:generateBlocksDefaults.button.paddingRight},paddingBottom:{type:"string",default:generateBlocksDefaults.button.paddingBottom},paddingLeft:{type:"string",default:generateBlocksDefaults.button.paddingLeft},paddingUnit:{type:"string",default:generateBlocksDefaults.button.paddingUnit},paddingTopTablet:{type:"string",default:generateBlocksDefaults.button.paddingTopTablet},paddingRightTablet:{type:"string",default:generateBlocksDefaults.button.paddingRightTablet},paddingBottomTablet:{type:"string",default:generateBlocksDefaults.button.paddingBottomTablet},paddingLeftTablet:{type:"string",default:generateBlocksDefaults.button.paddingLeftTablet},paddingTopMobile:{type:"string",default:generateBlocksDefaults.button.paddingTopMobile},paddingRightMobile:{type:"string",default:generateBlocksDefaults.button.paddingRightMobile},paddingBottomMobile:{type:"string",default:generateBlocksDefaults.button.paddingBottomMobile},paddingLeftMobile:{type:"string",default:generateBlocksDefaults.button.paddingLeftMobile},borderSizeTop:{type:"string",default:generateBlocksDefaults.button.borderSizeTop},borderSizeRight:{type:"string",default:generateBlocksDefaults.button.borderSizeRight},borderSizeBottom:{type:"string",default:generateBlocksDefaults.button.borderSizeBottom},borderSizeLeft:{type:"string",default:generateBlocksDefaults.button.borderSizeLeft},borderSizeTopTablet:{type:"string",default:generateBlocksDefaults.button.borderSizeTopTablet},borderSizeRightTablet:{type:"string",default:generateBlocksDefaults.button.borderSizeRightTablet},borderSizeBottomTablet:{type:"string",default:generateBlocksDefaults.button.borderSizeBottomTablet},borderSizeLeftTablet:{type:"string",default:generateBlocksDefaults.button.borderSizeLeftTablet},borderSizeTopMobile:{type:"string",default:generateBlocksDefaults.button.borderSizeTopMobile},borderSizeRightMobile:{type:"string",default:generateBlocksDefaults.button.borderSizeRightMobile},borderSizeBottomMobile:{type:"string",default:generateBlocksDefaults.button.borderSizeBottomMobile},borderSizeLeftMobile:{type:"string",default:generateBlocksDefaults.button.borderSizeLeftMobile},borderRadiusTopRight:{type:"string",default:generateBlocksDefaults.button.borderRadiusTopRight},borderRadiusBottomRight:{type:"string",default:generateBlocksDefaults.button.borderRadiusBottomRight},borderRadiusBottomLeft:{type:"string",default:generateBlocksDefaults.button.borderRadiusBottomLeft},borderRadiusTopLeft:{type:"string",default:generateBlocksDefaults.button.borderRadiusTopLeft},borderRadiusUnit:{type:"string",default:generateBlocksDefaults.button.borderRadiusUnit},borderRadiusTopRightTablet:{type:"string",default:generateBlocksDefaults.button.borderRadiusTopRightTablet},borderRadiusBottomRightTablet:{type:"string",default:generateBlocksDefaults.button.borderRadiusBottomRightTablet},borderRadiusBottomLeftTablet:{type:"string",default:generateBlocksDefaults.button.borderRadiusBottomLeftTablet},borderRadiusTopLeftTablet:{type:"string",default:generateBlocksDefaults.button.borderRadiusTopLeftTablet},borderRadiusTopRightMobile:{type:"string",default:generateBlocksDefaults.button.borderRadiusTopRightMobile},borderRadiusBottomRightMobile:{type:"string",default:generateBlocksDefaults.button.borderRadiusBottomRightMobile},borderRadiusBottomLeftMobile:{type:"string",default:generateBlocksDefaults.button.borderRadiusBottomLeftMobile},borderRadiusTopLeftMobile:{type:"string",default:generateBlocksDefaults.button.borderRadiusTopLeftMobile},gradient:{type:"boolean",default:generateBlocksDefaults.button.gradient},gradientDirection:{type:"number",default:generateBlocksDefaults.button.gradientDirection},gradientColorOne:{type:"string",default:generateBlocksDefaults.button.gradientColorOne},gradientColorOneOpacity:{type:"number",default:generateBlocksDefaults.button.gradientColorOneOpacity},gradientColorStopOne:{type:"number",default:generateBlocksDefaults.button.gradientColorStopOne},gradientColorTwo:{type:"string",default:generateBlocksDefaults.button.gradientColorTwo},gradientColorTwoOpacity:{type:"number",default:generateBlocksDefaults.button.gradientColorTwoOpacity},gradientColorStopTwo:{type:"number",default:generateBlocksDefaults.button.gradientColorStopTwo},iconPaddingTop:{type:"string",default:generateBlocksDefaults.button.iconPaddingTop},iconPaddingRight:{type:"string",default:generateBlocksDefaults.button.iconPaddingRight},iconPaddingBottom:{type:"string",default:generateBlocksDefaults.button.iconPaddingBottom},iconPaddingLeft:{type:"string",default:generateBlocksDefaults.button.iconPaddingLeft},iconPaddingTopTablet:{type:"string",default:generateBlocksDefaults.button.iconPaddingTopTablet},iconPaddingRightTablet:{type:"string",default:generateBlocksDefaults.button.iconPaddingRightTablet},iconPaddingBottomTablet:{type:"string",default:generateBlocksDefaults.button.iconPaddingBottomTablet},iconPaddingLeftTablet:{type:"string",default:generateBlocksDefaults.button.iconPaddingLeftTablet},iconPaddingTopMobile:{type:"string",default:generateBlocksDefaults.button.iconPaddingTopMobile},iconPaddingRightMobile:{type:"string",default:generateBlocksDefaults.button.iconPaddingRightMobile},iconPaddingBottomMobile:{type:"string",default:generateBlocksDefaults.button.iconPaddingBottomMobile},iconPaddingLeftMobile:{type:"string",default:generateBlocksDefaults.button.iconPaddingLeftMobile},iconPaddingUnit:{type:"string",default:generateBlocksDefaults.button.iconPaddingUnit},iconPaddingSyncUnits:{type:"boolean",default:!1},iconSize:{type:"number",default:generateBlocksDefaults.button.iconSize},iconSizeTablet:{type:"number",default:generateBlocksDefaults.button.iconSizeTablet},iconSizeMobile:{type:"number",default:generateBlocksDefaults.button.iconSizeMobile},iconSizeUnit:{type:"string",default:generateBlocksDefaults.button.iconSizeUnit},blockVersion:{type:"number"},elementId:{type:"string",default:""},cssClasses:{type:"string",default:""}};const fs=[{attributes:{...ms,text:{type:"array",source:"children",selector:".gb-button .button-text",default:"Button"}},supports:{anchor:!1,className:!1,customClassName:!1,inserter:!1,reusable:!1},migrate(e){const t=e.cssClasses?e.cssClasses:e.className,a=e.elementId?e.elementId:e.anchor;return{...e,className:t,anchor:a,cssClasses:"",elementId:""}},save(t){let{attributes:a}=t;const{uniqueId:l,elementId:n,cssClasses:i,text:o,url:c,target:u,relNoFollow:g,relSponsored:d,icon:p,iconLocation:b,removeText:f,ariaLabel:h}=a,k=[];g&&k.push("nofollow"),u&&k.push("noopener","noreferrer"),d&&k.push("sponsored");let y={id:n||void 0,className:s()({"gb-button":!0,[`gb-button-${l}`]:!0,[`${i}`]:""!==i}),href:c||void 0,target:u?"_blank":void 0,rel:k&&k.length>0?k.join(" "):void 0,"aria-label":h||void 0};return y=(0,m.applyFilters)("generateblocks.frontend.htmlAttributes",y,"generateblocks/button",a),(0,e.createElement)("a",y,p&&"left"===b&&(0,e.createElement)("span",{className:"gb-icon",dangerouslySetInnerHTML:{__html:xi(p)}}),!f&&(0,e.createElement)(r.RichText.Content,{tagName:"span",className:"button-text",value:o,key:"button-text"}),p&&"right"===b&&(0,e.createElement)("span",{className:"gb-icon",dangerouslySetInnerHTML:{__html:xi(p)}}))}}];var hs=fs;function ks(e){return e?(0,i.sprintf)("Post meta: %s",e):(0,i.__)("Post meta","generateblocks")}function ys(e,t){const{useDynamicData:a,dynamicContentType:l,dynamicLinkType:r,isCaption:n,metaFieldName:o}=e;if(a){const e={"post-title":(0,i.__)("Post title","generateblocks"),"post-excerpt":(0,i.__)("Post excerpt","generateblocks"),"post-date":(0,i.__)("Post date","generateblocks"),"post-meta":ks(o),"author-email":(0,i.__)("Author email","generateblocks"),"author-name":(0,i.__)("Author name","generateblocks"),"author-nickname":(0,i.__)("Author nickname","generateblocks"),"author-first-name":(0,i.__)("Author first name","generateblocks"),"author-last-name":(0,i.__)("Author last name","generateblocks"),"author-meta":(0,i.__)("Author meta","generateblocks"),"pagination-numbers":(0,i.__)("Page numbers","generateblocks"),caption:(0,i.__)("Caption","generateblocks"),terms:(0,i.__)("List of terms","generateblocks"),"comments-number":(0,i.__)("Comments number","generateblocks")},t={"single-post":(0,i.__)("Single post","generateblocks"),"author-archives":(0,i.__)("Author archives","generateblocks"),"comments-area":(0,i.__)("Comments area","generateblocks"),"post-meta":ks(o),"previous-posts":(0,i.__)("Previous posts","generateblocks"),"next-posts":(0,i.__)("Next posts","generateblocks"),"term-archives":(0,i.__)("Term archives","generateblocks"),"pagination-prev":(0,i.__)("Previous page","generateblocks"),"pagination-next":(0,i.__)("Next page","generateblocks")};return Object.keys(e).includes(l)?e[l]:Object.keys(t).includes(r)?t[r]:(0,i.__)("Dynamic content","generateblocks")}return n?(0,i.__)("Caption","generateblocks"):t}const vs=Object.assign({},ms,Zi);(0,g.registerBlockType)("generateblocks/button",{apiVersion:2,title:(0,i.__)("Button","generateblocks"),description:(0,i.__)("Drive conversions with beautiful buttons.","generateblocks"),parent:["generateblocks/button-container"],icon:p("button"),category:"generateblocks",keywords:[(0,i.__)("button"),(0,i.__)("buttons"),(0,i.__)("generate")],attributes:vs,supports:{className:!1,inserter:!1,reusable:!1},edit:bs,save:t=>{let{attributes:a}=t;const{uniqueId:l,text:n,url:i,target:o,relNoFollow:c,relSponsored:u,icon:g,iconLocation:d,removeText:p,ariaLabel:b,anchor:f}=a,h=[];c&&h.push("nofollow"),o&&h.push("noopener","noreferrer"),u&&h.push("sponsored");let k={className:s()({"gb-button":!0,[`gb-button-${l}`]:!0,"gb-button-text":!g}),href:i||null,target:o?"_blank":null,rel:h&&h.length>0?h.join(" "):null,"aria-label":b||null,id:f||null};k=(0,m.applyFilters)("generateblocks.frontend.htmlAttributes",k,"generateblocks/button",a);const y=r.useBlockProps.save(k);return(0,e.createElement)(qi,{tagName:i?"a":"span",htmlAttrs:y},(0,e.createElement)(ji,{hasIcon:!!g,direction:d,icon:g,hideChildren:p,showWrapper:!1},(0,e.createElement)(r.RichText.Content,{value:n,tagName:g?"span":void 0,className:g?"gb-button-text":void 0})))},deprecated:hs,usesContext:["postId","postType","generateblocks/query","generateblocks/inheritQuery"],__experimentalLabel:e=>ys(e,(0,i.__)("Button","generateblocks"))});var ws=window.wp.richText;const _s=(0,e.createElement)("svg",{viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",strokeLinejoin:"round",strokeMiterlimit:"1.414"},(0,e.createElement)("path",{d:"M4.331,15.598l2.193,1.693c0,0 -0.813,1.215 -0.992,1.215c-1.129,0.003 -1.424,0.008 -2.603,-0.001c-0.741,-0.006 -0.04,-0.955 0.187,-1.269c0.502,-0.694 1.215,-1.638 1.215,-1.638Zm7.632,-14.107c0.364,-0.061 5.412,3.896 5.439,4.272c0.031,0.438 -4.887,8.469 -5.635,9.648c-0.251,0.397 -1.185,0.206 -2.064,0.472c-0.801,0.243 -1.89,1.336 -2.193,1.105c-1.047,-0.796 -2.217,-1.646 -3.117,-2.49c-0.367,-0.343 0.388,-1.241 0.405,-2.188c0.015,-0.811 -0.644,-2.029 -0.196,-2.575c0.836,-1.019 6.931,-8.172 7.361,-8.244Zm0.144,1.454l3.95,3.105l-4.972,8.1l-5.197,-4.053l6.219,-7.152Z"})),Cs="generateblocks/mark",Ts=(0,q.compose)((0,l.withSelect)((function(e){return{selectedBlock:e("core/block-editor").getSelectedBlock()}})),(0,q.ifCondition)((function(e){return e.selectedBlock&&"generateblocks/headline"===e.selectedBlock.name})))((function(t){const a=()=>t.onChange((0,ws.toggleFormat)(t.value,{type:Cs}));return(0,e.createElement)(e.Fragment,null,(0,e.createElement)(r.RichTextShortcut,{type:"primary",character:"m",onUse:a}),(0,e.createElement)(r.RichTextToolbarButton,{icon:_s,title:(0,i.__)("Highlight","generateblocks"),onClick:a,isActive:t.isActive,shortcutType:"access",shortcutCharacter:"m",className:`toolbar-button-with-text toolbar-button__${Cs}`}))})),Es={title:(0,i.__)("Highlight","generateblocks"),tagName:"mark",className:"gb-highlight",edit:Ts};function Ss(t){let{level:a}=t;const l={h1:"M9 5h2v10H9v-4H5v4H3V5h2v4h4V5zm6.6 0c-.6.9-1.5 1.7-2.6 2v1h2v7h2V5h-1.4z",h2:"M7 5h2v10H7v-4H3v4H1V5h2v4h4V5zm8 8c.5-.4.6-.6 1.1-1.1.4-.4.8-.8 1.2-1.3.3-.4.6-.8.9-1.3.2-.4.3-.8.3-1.3 0-.4-.1-.9-.3-1.3-.2-.4-.4-.7-.8-1-.3-.3-.7-.5-1.2-.6-.5-.2-1-.2-1.5-.2-.4 0-.7 0-1.1.1-.3.1-.7.2-1 .3-.3.1-.6.3-.9.5-.3.2-.6.4-.8.7l1.2 1.2c.3-.3.6-.5 1-.7.4-.2.7-.3 1.2-.3s.9.1 1.3.4c.3.3.5.7.5 1.1 0 .4-.1.8-.4 1.1-.3.5-.6.9-1 1.2-.4.4-1 .9-1.6 1.4-.6.5-1.4 1.1-2.2 1.6V15h8v-2H15z",h3:"M12.1 12.2c.4.3.8.5 1.2.7.4.2.9.3 1.4.3.5 0 1-.1 1.4-.3.3-.1.5-.5.5-.8 0-.2 0-.4-.1-.6-.1-.2-.3-.3-.5-.4-.3-.1-.7-.2-1-.3-.5-.1-1-.1-1.5-.1V9.1c.7.1 1.5-.1 2.2-.4.4-.2.6-.5.6-.9 0-.3-.1-.6-.4-.8-.3-.2-.7-.3-1.1-.3-.4 0-.8.1-1.1.3-.4.2-.7.4-1.1.6l-1.2-1.4c.5-.4 1.1-.7 1.6-.9.5-.2 1.2-.3 1.8-.3.5 0 1 .1 1.6.2.4.1.8.3 1.2.5.3.2.6.5.8.8.2.3.3.7.3 1.1 0 .5-.2.9-.5 1.3-.4.4-.9.7-1.5.9v.1c.6.1 1.2.4 1.6.8.4.4.7.9.7 1.5 0 .4-.1.8-.3 1.2-.2.4-.5.7-.9.9-.4.3-.9.4-1.3.5-.5.1-1 .2-1.6.2-.8 0-1.6-.1-2.3-.4-.6-.2-1.1-.6-1.6-1l1.1-1.4zM7 9H3V5H1v10h2v-4h4v4h2V5H7v4z",h4:"M9 15H7v-4H3v4H1V5h2v4h4V5h2v10zm10-2h-1v2h-2v-2h-5v-2l4-6h3v6h1v2zm-3-2V7l-2.8 4H16z",h5:"M12.1 12.2c.4.3.7.5 1.1.7.4.2.9.3 1.3.3.5 0 1-.1 1.4-.4.4-.3.6-.7.6-1.1 0-.4-.2-.9-.6-1.1-.4-.3-.9-.4-1.4-.4H14c-.1 0-.3 0-.4.1l-.4.1-.5.2-1-.6.3-5h6.4v1.9h-4.3L14 8.8c.2-.1.5-.1.7-.2.2 0 .5-.1.7-.1.5 0 .9.1 1.4.2.4.1.8.3 1.1.6.3.2.6.6.8.9.2.4.3.9.3 1.4 0 .5-.1 1-.3 1.4-.2.4-.5.8-.9 1.1-.4.3-.8.5-1.3.7-.5.2-1 .3-1.5.3-.8 0-1.6-.1-2.3-.4-.6-.2-1.1-.6-1.6-1-.1-.1 1-1.5 1-1.5zM9 15H7v-4H3v4H1V5h2v4h4V5h2v10z",h6:"M9 15H7v-4H3v4H1V5h2v4h4V5h2v10zm8.6-7.5c-.2-.2-.5-.4-.8-.5-.6-.2-1.3-.2-1.9 0-.3.1-.6.3-.8.5l-.6.9c-.2.5-.2.9-.2 1.4.4-.3.8-.6 1.2-.8.4-.2.8-.3 1.3-.3.4 0 .8 0 1.2.2.4.1.7.3 1 .6.3.3.5.6.7.9.2.4.3.8.3 1.3s-.1.9-.3 1.4c-.2.4-.5.7-.8 1-.4.3-.8.5-1.2.6-1 .3-2 .3-3 0-.5-.2-1-.5-1.4-.9-.4-.4-.8-.9-1-1.5-.2-.6-.3-1.3-.3-2.1s.1-1.6.4-2.3c.2-.6.6-1.2 1-1.6.4-.4.9-.7 1.4-.9.6-.3 1.1-.4 1.7-.4.7 0 1.4.1 2 .3.5.2 1 .5 1.4.8 0 .1-1.3 1.4-1.3 1.4zm-2.4 5.8c.2 0 .4 0 .6-.1.2 0 .4-.1.5-.2.1-.1.3-.3.4-.5.1-.2.1-.5.1-.7 0-.4-.1-.8-.4-1.1-.3-.2-.7-.3-1.1-.3-.3 0-.7.1-1 .2-.4.2-.7.4-1 .7 0 .3.1.7.3 1 .1.2.3.4.4.6.2.1.3.3.5.3.2.1.5.2.7.1z",p:"M7.411 18V6.005h3.887c1.474 0 2.429.067 2.881.184.687.185 1.257.57 1.726 1.173.452.603.687 1.374.687 2.329 0 .737-.135 1.357-.403 1.86-.268.502-.603.904-1.021 1.189-.403.284-.821.469-1.257.57-.57.117-1.407.167-2.496.167H9.823V18H7.411zm2.412-9.968v3.401h1.324c.955 0 1.591-.05 1.926-.184.319-.118.57-.319.754-.587.185-.268.268-.57.268-.938 0-.435-.117-.787-.385-1.072a1.607 1.607 0 00-.972-.536c-.284-.05-.87-.084-1.742-.084H9.823z",div:"M6.969 6.005h4.423c1.005 0 1.759.084 2.295.235.703.2 1.306.57 1.809 1.105.503.52.871 1.173 1.14 1.944.267.754.385 1.708.385 2.83 0 .99-.118 1.844-.369 2.547-.302.871-.72 1.592-1.273 2.128-.419.402-.989.72-1.709.955-.536.167-1.24.251-2.144.251H6.969V6.005zm2.43 2.027v7.94h1.808c.67 0 1.156-.033 1.458-.1.402-.1.72-.268.972-.502.268-.235.485-.62.636-1.156.168-.536.251-1.273.251-2.195 0-.938-.083-1.641-.25-2.144-.152-.486-.386-.888-.688-1.156-.285-.285-.67-.469-1.122-.57-.335-.067-.989-.117-1.977-.117H9.398z"};if(!l.hasOwnProperty(a))return null;let r="0 0 20 20";return"p"!==a&&"div"!==a||(r="0 0 24 24"),(0,e.createElement)(n.SVG,{width:"24",height:"24",viewBox:r,xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)(n.Path,{d:l[a]}))}(0,ws.registerFormatType)(Cs,Es);var xs=t=>{let{setAttributes:a,element:l,isCaption:r}=t;return r?null:(0,e.createElement)(n.ToolbarGroup,{isCollapsed:!0,icon:(0,e.createElement)(Ss,{level:l}),label:(0,i.__)("Change Headline Element","generateblocks"),controls:[{isActive:"h1"===l,icon:(0,e.createElement)(Ss,{level:"h1"}),title:(0,i.sprintf)(// translators: %s: heading level e.g: "1", "2", "3" (0,i.__)("Heading %s","generateblocks"),"1"),onClick:()=>{a({element:"h1"})}},{isActive:"h2"===l,icon:(0,e.createElement)(Ss,{level:"h2"}),title:(0,i.sprintf)(// translators: %s: heading level e.g: "1", "2", "3" (0,i.__)("Heading %s","generateblocks"),"2"),onClick:()=>{a({element:"h2"})}},{isActive:"h3"===l,icon:(0,e.createElement)(Ss,{level:"h3"}),title:(0,i.sprintf)(// translators: %s: heading level e.g: "1", "2", "3" (0,i.__)("Heading %s","generateblocks"),"3"),onClick:()=>{a({element:"h3"})}},{isActive:"h4"===l,icon:(0,e.createElement)(Ss,{level:"h4"}),title:(0,i.sprintf)(// translators: %s: heading level e.g: "1", "2", "3" From 5a21fca52d0e0a5db4c939c208848a7c57178297 Mon Sep 17 00:00:00 2001 From: Tom Usborne Date: Tue, 4 Oct 2022 09:19:11 -0700 Subject: [PATCH 75/75] 1.6.0 --- package.json | 2 +- plugin.php | 4 ++-- readme.txt | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index de1e82400..e4b004308 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "generateblocks", - "version": "1.6.0-rc.2", + "version": "1.6.0", "private": true, "description": "A small collection of lightweight WordPress blocks that can accomplish nearly anything.", "author": "Tom Usborne", diff --git a/plugin.php b/plugin.php index 79b8529dc..aebb4a08c 100644 --- a/plugin.php +++ b/plugin.php @@ -5,7 +5,7 @@ * Description: A small collection of lightweight WordPress blocks that can accomplish nearly anything. * Author: Tom Usborne * Author URI: https://tomusborne.com - * Version: 1.6.0-rc.2 + * Version: 1.6.0 * Requires at least: 5.9 * Requires PHP: 5.6 * License: GPL2+ @@ -19,7 +19,7 @@ exit; // Exit if accessed directly. } -define( 'GENERATEBLOCKS_VERSION', '1.6.0-rc.2' ); +define( 'GENERATEBLOCKS_VERSION', '1.6.0' ); define( 'GENERATEBLOCKS_DIR', plugin_dir_path( __FILE__ ) ); define( 'GENERATEBLOCKS_DIR_URL', plugin_dir_url( __FILE__ ) ); diff --git a/readme.txt b/readme.txt index 4f03e4a86..464ba6fa9 100644 --- a/readme.txt +++ b/readme.txt @@ -5,7 +5,7 @@ Tags: blocks, gutenberg, container, headline, grid, columns, page builder, wysiw Requires at least: 5.9 Tested up to: 6.0 Requires PHP: 5.6 -Stable tag: 1.5.4 +Stable tag: 1.6.0 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html