(function() {
	const { registerBlockType } = wp.blocks;
	const { createElement: el, useEffect, useRef, RawHTML, Fragment } = wp.element;
	const { useBlockProps, InspectorControls, RichText } = wp.blockEditor || wp.editor || {};
	const ServerSideRender = wp.serverSideRender || wp.components.ServerSideRender;
	const { PanelBody, TextControl, TextareaControl, SelectControl, ToggleControl, RangeControl, CheckboxControl, RadioControl, ColorPalette, Notice, Button, Spinner, SearchControl, ExternalLink, ComboboxControl, FormTokenField, DatePicker, TimePicker, DateTimePicker, Popover, Icon, __experimentalUnitControl: UnitControl } = wp.components || {};
	const { useSelect, useDispatch } = wp.data || {};
	const { __ } = wp.i18n;
	const React = { useEffect, useRef }; // React compatibility for hooks

	registerBlockType('{{BLOCK_NAMESPACE}}/{{BLOCK_SLUG}}', {
		title: '{{BLOCK_TITLE}}',
		icon: '{{BLOCK_ICON}}',
		category: '{{BLOCK_CATEGORY}}',
		description: '{{BLOCK_DESCRIPTION}}',
		keywords: {{BLOCK_KEYWORDS}},
		attributes: {{BLOCK_ATTRIBUTES_JSON}},
		supports: {{BLOCK_SUPPORTS_JSON}},

		edit: function(props) {
			const { attributes, setAttributes, clientId, isSelected } = props;
			const blockProps = useBlockProps();

			{{POST_SELECTOR_DATA_FETCHING}}

			return [
				el(InspectorControls, { key: 'inspector' },
					{{ATTRIBUTE_CONTROLS_PLAIN_JS}}
				),
				el('div', Object.assign({}, blockProps, { key: 'editor-view' }),
					{{#IF_DYNAMIC}}{{DYNAMIC_BLOCK_CONTENT}}{{/IF_DYNAMIC}}{{#IF_STATIC}}{{#IF_CUSTOM_TEMPLATE_HAS_WRAPPER}}{{ATTRIBUTE_DISPLAY_EDIT_JS}}{{EDITOR_VIEW_APPEND_CODE}}{{/IF_CUSTOM_TEMPLATE_HAS_WRAPPER}}{{^IF_CUSTOM_TEMPLATE_HAS_WRAPPER}}el('div', { className: 'wp-block-{{BLOCK_NAMESPACE}}-{{BLOCK_SLUG}}-wrapper' }, {{ATTRIBUTE_DISPLAY_EDIT_JS}}{{EDITOR_VIEW_APPEND_CODE}}){{/IF_CUSTOM_TEMPLATE_HAS_WRAPPER}}{{/IF_STATIC}}
				)
			];
		},

		{{#IF_STATIC}}
		save: function(props) {
			const { attributes } = props;
			const blockProps = useBlockProps.save();
{{#IF_CUSTOM_TEMPLATE_HAS_WRAPPER}}return {{SAVE_VIEW_WRAPPED_CODE}};{{/IF_CUSTOM_TEMPLATE_HAS_WRAPPER}}{{^IF_CUSTOM_TEMPLATE_HAS_WRAPPER}}return el('div', blockProps, el('div', { className: 'wp-block-{{BLOCK_NAMESPACE}}-{{BLOCK_SLUG}}-wrapper' }, {{ATTRIBUTE_DISPLAY_PLAIN_JS}}{{SAVE_VIEW_APPEND_CODE}}));{{/IF_CUSTOM_TEMPLATE_HAS_WRAPPER}}
		},
		{{/IF_STATIC}}
	});
})();
