<?php
declare(strict_types=1);

if (!defined('ABSPATH')) { exit; }

/**
 * Shared element renderers — load registry.
 *
 * Both `templates/impulse-page.php` (frontend) and
 * `admin/views/impulse-preview.php` (editor) require this file once at
 * bootstrap. Each element type extracted from the per-renderer switch
 * statements gets its own file under this directory and is loaded here.
 *
 * Pattern per file:
 *   - One function: `impulse_element_render_<type>(array $el, array $settings, string $context): string`
 *   - Returns inner HTML (no `.impulse-el` wrapper)
 *   - Side effects (wp_add_inline_style, asset registration) are
 *     permitted but explicitly documented in the function's docblock
 *
 * See docs/renderer-architecture.md for the full contract.
 */

$_imp_rdir = __DIR__;

// Shared helpers used by multiple element renderers. Load BEFORE the
// per-element files so functions like impulse_resolve_image are defined
// when those files run.
require_once $_imp_rdir . '/helpers.php';

// Shared product card renderer. Loaded BEFORE products / product_carousel
// (which call it). The inline definitions in templates/impulse-page.php and
// admin/views/impulse-preview.php are guarded by `function_exists` and skip
// themselves when this shared version has already been declared.
require_once $_imp_rdir . '/_product_card.php';

// Each extracted element renderer registers below. Keep alphabetical so
// the load order is stable and the file list scans easily.
require_once $_imp_rdir . '/account.php';
require_once $_imp_rdir . '/title_animated.php';
require_once $_imp_rdir . '/booking.php';
// demo is a marketing-page block — excluded from the WP.org zip
// (see build.py WP_EXCLUDE_FILES). Use file_exists so the WP build doesn't
// fatal trying to require a file that isn't shipped.
if (file_exists($_imp_rdir . '/demo.php')) {
    require_once $_imp_rdir . '/demo.php';
}
require_once $_imp_rdir . '/bundle.php';
require_once $_imp_rdir . '/button.php';
require_once $_imp_rdir . '/carousel.php';
require_once $_imp_rdir . '/cart.php';
require_once $_imp_rdir . '/rows.php';
require_once $_imp_rdir . '/chart.php';
require_once $_imp_rdir . '/checkout.php';
require_once $_imp_rdir . '/code.php';
// configurator (pizza build-a-pizza) is a separate add-on, excluded from the
// zip builds (see build.py CONFIGURATOR_FILES). Guard like demo.php so the WP
// build doesn't fatal requiring a file that isn't shipped.
if (file_exists($_imp_rdir . '/configurator.php')) {
    require_once $_imp_rdir . '/configurator.php';
}
require_once $_imp_rdir . '/contact.php';
require_once $_imp_rdir . '/divider.php';
require_once $_imp_rdir . '/flip_box.php';
require_once $_imp_rdir . '/shipping.php';
require_once $_imp_rdir . '/columns.php';
// gig_grid renderer removed 2.1.413 — marketplace teardown.
require_once $_imp_rdir . '/grid.php';
require_once $_imp_rdir . '/title.php';
require_once $_imp_rdir . '/icon_card.php';
require_once $_imp_rdir . '/table.php';
require_once $_imp_rdir . '/image.php';
// image_popup renderer merged into image.php 2.1.420 as lightbox mode.
require_once $_imp_rdir . '/login.php';
require_once $_imp_rdir . '/map.php';
require_once $_imp_rdir . '/mini_cart.php';
require_once $_imp_rdir . '/nav_menu.php';
require_once $_imp_rdir . '/network.php';
require_once $_imp_rdir . '/marquee.php';
require_once $_imp_rdir . '/modal.php';
require_once $_imp_rdir . '/plans.php';
require_once $_imp_rdir . '/posts.php';
require_once $_imp_rdir . '/price_list.php';
require_once $_imp_rdir . '/products.php';
require_once $_imp_rdir . '/register.php';
require_once $_imp_rdir . '/reviews.php';

require_once $_imp_rdir . '/section.php';
require_once $_imp_rdir . '/footer.php';
require_once $_imp_rdir . '/header.php';
require_once $_imp_rdir . '/slider.php';
// storyboard renderer removed 2.1.453 — block retired in favour of Scene-as-block.
require_once $_imp_rdir . '/social.php';
require_once $_imp_rdir . '/text.php';
require_once $_imp_rdir . '/receipt.php';
require_once $_imp_rdir . '/unfold.php';
require_once $_imp_rdir . '/video.php';
