{"id":16574,"date":"2025-11-21T10:15:43","date_gmt":"2025-11-21T10:15:43","guid":{"rendered":"https:\/\/royal.entornodedesarrollo.es\/?page_id=16574"},"modified":"2026-05-25T13:23:39","modified_gmt":"2026-05-25T13:23:39","slug":"book-service","status":"publish","type":"page","link":"https:\/\/royal.entornodedesarrollo.es\/ar\/book-service\/","title":{"rendered":"Book Service"},"content":{"rendered":"<div data-elementor-type=\"wp-page\" data-elementor-id=\"16574\" class=\"elementor elementor-16574\" data-elementor-post-type=\"page\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-fc69d79 elementor-section-height-min-height elementor-section-boxed elementor-section-height-default elementor-section-items-middle\" data-id=\"fc69d79\" data-element_type=\"section\" data-e-type=\"section\" data-settings=\"{&quot;background_background&quot;:&quot;classic&quot;}\">\n\t\t\t\t\t\t\t<div class=\"elementor-background-overlay\"><\/div>\n\t\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-ce9935f\" data-id=\"ce9935f\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-aa22234 elementor-widget elementor-widget-heading\" data-id=\"aa22234\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<h1 class=\"elementor-heading-title elementor-size-default\">Book Service<\/h1>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-d44e7cb elementor-widget-divider--view-line elementor-widget elementor-widget-divider\" data-id=\"d44e7cb\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"divider.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"elementor-divider\">\n\t\t\t<span class=\"elementor-divider-separator\">\n\t\t\t\t\t\t<\/span>\n\t\t<\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-0835a17 elementor-widget elementor-widget-heading\" data-id=\"0835a17\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<span class=\"elementor-heading-title elementor-size-default\">\n<b>Someone from our team will respond immediately during extended business hours<\/b><\/span>\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-c871a9e elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"c871a9e\" data-element_type=\"section\" data-e-type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-76e2f7a\" data-id=\"76e2f7a\" data-element_type=\"column\" data-e-type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-d0003bc elementor-widget elementor-widget-jet-form-builder-form\" data-id=\"d0003bc\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"jet-form-builder-form.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<link rel='stylesheet' id='wp-block-library-rtl-css' href='https:\/\/royal.entornodedesarrollo.es\/wp-includes\/css\/dist\/block-library\/style-rtl.min.css?ver=6.9.4' media='all' \/>\n<style id=\"jet-form-builder-23989-inline-css\"><\/style><form  class=\"jet-form-builder layout-column submit-type-ajax\" action=\"https:\/\/royal.entornodedesarrollo.es\/ar\/wp-json\/wp\/v2\/pages\/16574\/?Nt429Z=WFj3336JB3d8&#038;method=reload\" method=\"POST\" data-form-id=\"23989\" data-layout=\"column\" enctype=\"multipart\/form-data\" novalidate=\"null\" ssr_validation_method=\"rest\" data-trp-original-action=\"https:\/\/royal.entornodedesarrollo.es\/ar\/wp-json\/wp\/v2\/pages\/16574\/?Nt429Z=WFj3336JB3d8&amp;method=reload\"><input type=\"hidden\" id=\"_wpnonce\" name=\"_wpnonce\" value=\"a0367e8ab3\" \/><input type=\"hidden\" name=\"_wp_http_referer\" value=\"\/ar\/wp-json\/wp\/v2\/pages\/16574\" \/>\r\n<input type=\"hidden\" name=\"_jfb_current_render_states[]\" value=\"DEFAULT.STATE\" data-jfb-sync \/><input type=\"hidden\" class=\"jet-form-builder__field hidden-field\" name=\"_jet_engine_booking_form_id\" data-field-name=\"_jet_engine_booking_form_id\" value=\"23989\">\n<input type=\"hidden\" class=\"jet-form-builder__field hidden-field\" name=\"_jet_engine_refer\" data-field-name=\"_jet_engine_refer\" value=\"https:\/\/royal.entornodedesarrollo.es\/ar\/wp-json\/wp\/v2\/pages\/16574\/\">\n<input type=\"hidden\" class=\"jet-form-builder__field hidden-field\" name=\"__queried_post_id\" data-field-name=\"__queried_post_id\" value=\"16574\">\n<div  class=\"jet-form-builder-row field-type-text-field\" >\n<div class=\"jet-form-builder__label\">\r\n<div class=\"jet-form-builder__label-text\">Name <span class=\"jet-form-builder__required\">*<\/span><\/div><\/div><div class=\"jet-form-builder__field-wrap\">\n\t\t\t\t<input placeholder=\"John Doe (*)\" required=\"required\" name=\"name\" id=\"name\" type=\"text\" data-field-name=\"name\" class=\"jet-form-builder__field text-field namerow\" data-jfb-sync=\"null\" autocomplete=\"off_mrktyaHO\">\n\t\t\t\t\t<\/div>\n<\/div>\n\n<div  class=\"jet-form-builder-row field-type-text-field\" >\n<div class=\"jet-form-builder__label\">\r\n<div class=\"jet-form-builder__label-text\">Email <span class=\"jet-form-builder__required\">*<\/span><\/div><\/div><div class=\"jet-form-builder__field-wrap\">\n\t\t\t\t<input placeholder=\"youremail@domain.com (*)\" required=\"required\" name=\"email\" id=\"email\" type=\"email\" data-field-name=\"email\" class=\"jet-form-builder__field text-field emailrow\" data-jfb-sync=\"null\" autocomplete=\"off_Egm5D0pl\">\n\t\t\t\t\t<\/div>\n<\/div>\n\n<div  class=\"jet-form-builder-row field-type-text-field\" >\n<div class=\"jet-form-builder__label\">\r\n<div class=\"jet-form-builder__label-text\">Phone <span class=\"jet-form-builder__required\">*<\/span><\/div><\/div><div class=\"jet-form-builder__field-wrap\">\n\t\t\t\t<input placeholder=\"+1 (202) 555-5151 (*)\" required=\"required\" name=\"phone\" id=\"phone\" type=\"tel\" data-field-name=\"phone\" class=\"jet-form-builder__field text-field phonerow\" data-jfb-sync=\"null\" autocomplete=\"off_sm4JUwuA\">\n\t\t\t\t\t<\/div>\n<\/div>\n\n\n<div id=\"passenger-luggage-selector\">\n    <div id=\"passenger-luggage-display\">\n        <div>\n            <span class=\"passengers-display\">1 Passenger<\/span> - \n            <span class=\"luggage-display\">0 Luggage<\/span>\n        <\/div>\n        <span class=\"arrow\">\u25bc<\/span>\n    <\/div>\n    <div id=\"passenger-luggage-dropdown\">\n        <div class=\"counter-row\">\n            <span class=\"counter-label\">Passengers<\/span>\n            <div class=\"counter-controls\">\n                <button type=\"button\" class=\"minus-passenger\">-<\/button>\n                <span class=\"value\" id=\"passenger-count\">1<\/span>\n                <button type=\"button\" class=\"plus-passenger\">+<\/button>\n            <\/div>\n        <\/div>\n        <div class=\"counter-row\">\n            <span class=\"counter-label\">Luggage<\/span>\n            <div class=\"counter-controls\">\n                <button type=\"button\" class=\"minus-luggage\">-<\/button>\n                <span class=\"value\" id=\"luggage-count\">0<\/span>\n                <button type=\"button\" class=\"plus-luggage\">+<\/button>\n            <\/div>\n        <\/div>\n    <\/div>\n<\/div>\n\n\n\n\n<div  class=\"jet-form-builder-row field-type-number-field\" >\n<div class=\"jet-form-builder__field-wrap\">\n\t\t<input type=\"number\" class=\"jet-form-builder__field text-field npassengersrow\" placeholder=\"1\" name=\"number_of_passengers\" data-field-name=\"number_of_passengers\" id=\"number_of_passengers\" data-jfb-sync=\"null\">\n\t<\/div>\n<\/div>\n\n<div  class=\"jet-form-builder-row field-type-number-field\" >\n<div class=\"jet-form-builder__field-wrap\">\n\t\t<input type=\"number\" class=\"jet-form-builder__field text-field nluggage\" placeholder=\"0\" name=\"number_of_luggage\" data-field-name=\"number_of_luggage\" id=\"number_of_luggage\" data-jfb-sync=\"null\">\n\t<\/div>\n<\/div>\n\n\n<input type=\"hidden\" class=\"captcha-token\" name=\"_captcha_token\" value=\"\"\/>\n\n\n<div  class=\"jet-form-builder-row field-type-repeater-field\" >\n<div class=\"jet-form-builder__label\">\r\n<div class=\"jet-form-builder__label-text\">Flight Legs<\/div><\/div><div class=\"jet-form-builder__field-wrap\"><div data-repeater=\"1\" data-field-name=\"flight_legs\" name=\"flight_legs\"  class=\"jet-form-builder-repeater jet-form-builder__field flightlegtitle\" data-jfb-sync=\"null\">\n<template class=\"jet-form-builder-repeater__initial\"><div class=\"jet-form-builder-repeater__row\" data-repeater-row=\"1\"><div class=\"jet-form-builder-repeater__row-fields\">\n<div  class=\"jet-form-builder-row field-type-select-field wp-block-jet-forms-select-field\">\n<div class=\"jet-form-builder__label\">\r\n<div class=\"jet-form-builder__label-text\">Type of Service <span class=\"jet-form-builder__required\">*<\/span><\/div><\/div><div class=\"jet-form-builder__field-wrap\">\n\t<select class=\"jet-form-builder__field select-field typeservicerow\" required=\"required\" name=\"flight_legs[__i__][type_of_service]\" data-field-name=\"type_of_service\" id=\"flight_legs___i___type_of_service\" data-jfb-sync=\"null\">\n\t\t<option value=\"Type of service\"  data-calculate=\"Type of service\">Type of service<\/option><option value=\"Arrival\" >Arrival<\/option><option value=\"Departure\" >Departure<\/option><option value=\"Connection\" >Connection<\/option>\t<\/select>\n<\/div>\n<\/div>\n\n<div  class=\"jet-form-builder-row field-type-date-field\" >\n<div class=\"jet-form-builder__label\">\r\n<div class=\"jet-form-builder__label-text\">Date <span class=\"jet-form-builder__required\">*<\/span><\/div><\/div><input class=\"jet-form-builder__field date-field datelegrow\" required=\"required\" name=\"flight_legs[__i__][date]\" type=\"date\" data-field-name=\"date\" id=\"flight_legs___i___date\" data-jfb-sync=\"null\">\n<\/div>\n\n<div  class=\"jet-form-builder-row field-type-select-field wp-block-jet-forms-select-field\">\n<div class=\"jet-form-builder__label\">\r\n<div class=\"jet-form-builder__label-text\">Airline<\/div><\/div><div class=\"jet-form-builder__field-wrap\">\n\t<select class=\"jet-form-builder__field select-field\" name=\"flight_legs[__i__][aerolineas]\" data-field-name=\"aerolineas\" id=\"flight_legs___i___aerolineas\" data-jfb-sync=\"null\">\n\t\t\t<\/select>\n<\/div>\n<\/div>\n\n<div  data-value=\"[{&quot;id&quot;:6158,&quot;conditions&quot;:[{&quot;__visible&quot;:true,&quot;field&quot;:&quot;date&quot;,&quot;operator&quot;:&quot;equal&quot;,&quot;value&quot;:&quot;connection&quot;}],&quot;to_set&quot;:&quot;test&quot;},{&quot;id&quot;:4736,&quot;conditions&quot;:[{&quot;__visible&quot;:true,&quot;value&quot;:&quot;&quot;}],&quot;to_set&quot;:&quot;&quot;}]\" class=\"jet-form-builder-row field-type-text-field\" >\n<div class=\"jet-form-builder__label\">\r\n<div class=\"jet-form-builder__label-text\">Flight<\/div><\/div><div class=\"jet-form-builder__field-wrap\">\n\t\t\t\t<input placeholder=\"Flight: 613\" name=\"flight_legs[__i__][flight]\" id=\"flight_legs___i___flight\" type=\"text\" data-field-name=\"flight\" class=\"jet-form-builder__field text-field flightrow\" data-jfb-sync=\"null\" autocomplete=\"off_2F6otHVu\">\n\t\t\t\t\t<\/div>\n<\/div>\n\n<div  class=\"jet-form-builder-row field-type-text-field\" >\n<div class=\"jet-form-builder__label\">\r\n<div class=\"jet-form-builder__label-text\">Arriving Flight <\/div><\/div><div class=\"jet-form-builder__field-wrap\">\n\t\t\t\t<input placeholder=\"Flight: AA613\" name=\"flight_legs[__i__][arriving_flight]\" id=\"flight_legs___i___arriving_flight\" type=\"text\" data-field-name=\"arriving_flight\" class=\"jet-form-builder__field text-field arrivingflightrow\" data-jfb-sync=\"null\" autocomplete=\"off_ZzLcKq2d\">\n\t\t\t\t\t<\/div>\n<\/div>\n\n\n<input type=\"hidden\" class=\"jet-form-builder__field hidden-field fromairport\" name=\"flight_legs[__i__][fromairport]\" data-field-name=\"fromairport\" data-jfb-sync=\"null\" value=\"16574\">\n\n\n\n<div  class=\"jet-form-builder-row field-type-select-field wp-block-jet-forms-select-field\">\n<div class=\"jet-form-builder__label\">\r\n<div class=\"jet-form-builder__label-text\">Airline<\/div><\/div><div class=\"jet-form-builder__field-wrap\">\n\t<select class=\"jet-form-builder__field select-field aerolineas_connect\" name=\"flight_legs[__i__][aerolineas_connect]\" data-field-name=\"aerolineas_connect\" id=\"flight_legs___i___aerolineas_connect\" data-jfb-sync=\"null\">\n\t\t\t<\/select>\n<\/div>\n<\/div>\n\n<div  class=\"jet-form-builder-row field-type-text-field\" >\n<div class=\"jet-form-builder__label\">\r\n<div class=\"jet-form-builder__label-text\">Departing Flight<\/div><\/div><div class=\"jet-form-builder__field-wrap\">\n\t\t\t\t<input placeholder=\"Flight: AA613\" name=\"flight_legs[__i__][departing_flight]\" id=\"flight_legs___i___departing_flight\" type=\"text\" data-field-name=\"departing_flight\" class=\"jet-form-builder__field text-field departingflightrow\" data-jfb-sync=\"null\" autocomplete=\"off_XIhWROae\">\n\t\t\t\t\t<\/div>\n<\/div>\n\n\n<input type=\"hidden\" class=\"jet-form-builder__field hidden-field toairport\" name=\"flight_legs[__i__][toairport]\" data-field-name=\"toairport\" data-jfb-sync=\"null\">\n\n\n\n\n<input type=\"hidden\" class=\"jet-form-builder__field hidden-field\" name=\"flight_legs[__i__][airport]\" data-field-name=\"airport\" data-jfb-sync=\"null\">\n\n\n<\/div><div class=\"jet-form-builder-repeater__row-remove\"><button type=\"button\" class=\"jet-form-builder-repeater__remove\">&times;<\/button><\/div><\/div><\/template>\n<div class=\"jet-form-builder-repeater__items\"><\/div><div class=\"jet-form-builder-repeater__actions\">\n                <button type=\"button\" class=\"jet-form-builder-repeater__new\">Add new<\/button>\n                <\/div><\/div><\/div>\n<\/div>\n\n<div  class=\"jet-form-builder-row field-type-textarea-field\" >\n<div class=\"jet-form-builder__label\">\r\n<div class=\"jet-form-builder__label-text\">Special Instructions (Optional)<\/div><\/div><div class=\"jet-form-builder__field-wrap\">\n\t\t<textarea class=\"jet-form-builder__field textarea-field specialrow\" placeholder=\"Add any special requests or additional information here...\" name=\"special_instructions_optional\" data-field-name=\"special_instructions_optional\" id=\"special_instructions_optional\" data-jfb-sync=\"null\"><\/textarea>\n\t<\/div>\n<\/div>\n\n<div  class=\"jet-form-builder-row field-type-submit-field\" >\n\t<div data-type=\"submit\" class=\"jet-form-builder__action-button-wrapper jet-form-builder__submit-wrap\">\n\t<button class=\"jet-form-builder__action-button jet-form-builder__submit submit-type-ajax\" type=\"submit\">Submit Booking Request<\/button>\n\t<\/div>\n\t\n<\/div>\n\n\n\n\n<input type=\"hidden\" class=\"jet-form-builder__field hidden-field\" name=\"url_anterior\" data-field-name=\"url_anterior\" data-jfb-sync=\"null\">\n\n\t<div class=\"jet-form-builder-messages-wrap\" data-form-id=\"23989\"><\/div>\n<input type=\"hidden\" name=\"trp-form-language\" value=\"ar\"\/><\/form>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-b3f314c elementor-widget elementor-widget-shortcode\" data-id=\"b3f314c\" data-element_type=\"widget\" data-e-type=\"widget\" data-widget_type=\"shortcode.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"elementor-shortcode\">    <script>\n        document.addEventListener('DOMContentLoaded', function () {\n\n            function bindJetFormBuilderTracking(attempt) {\n                const currentAttempt = attempt || 0;\n\n                if (typeof JetFormBuilder === 'undefined' || !JetFormBuilder.events || typeof JetFormBuilder.events.subscribe !== 'function') {\n                    if (currentAttempt < 20) {\n                        window.setTimeout(function () {\n                            bindJetFormBuilderTracking(currentAttempt + 1);\n                        }, 300);\n                    } else {\n                        console.warn('JetFormBuilder no detectado');\n                    }\n                    return;\n                }\n\n                console.log('PostHog + JetFormBuilder (identify + booking + webhook) activo');\n\n                JetFormBuilder.events.subscribe(\n                    'submit.success',\n                    function (response, form) {\n\n                        let email = null;\n                        let name = null;\n                        let serviceDate = null;\n                        let airport = null;\n                        let bookingId = null;\n\n                        \/\/ Extraer campos del formulario\n                        Object.keys(form.fields).forEach(function (key) {\n                            const field = form.fields[key];\n\n                            if (field.type === 'email') {\n                                email = field.value;\n                            }\n\n                            if (key.toLowerCase().includes('name')) {\n                                name = field.value;\n                            }\n\n                            if (key.toLowerCase().includes('date')) {\n                                serviceDate = field.value;\n                            }\n\n                            if (key.toLowerCase().includes('airport')) {\n                                airport = field.value;\n                            }\n                        });\n\n                        if (!email) {\n                            console.warn('Booking sin email \u2014 abortado');\n                            return;\n                        }\n\n                        if (typeof posthog === 'undefined') {\n                            console.warn('PostHog no cargado');\n                            return;\n                        }\n\n                        \/* =========================\n                           1. IDENTIFY (YA VALIDADO)\n                           ========================= *\/\n                        posthog.identify(email, {\n                            email: email,\n                            name: name || null,\n                            source: 'JetForm Booking'\n                        });\n\n                        \/* =========================\n                           2. EVENTO BOOKING COMPLETED\n                           ========================= *\/\n                        posthog.capture('booking_completed', {\n                            booking_id: bookingId || 'pending',\n                            booker_email: email,\n                            service_date: serviceDate,\n                            airport: airport,\n                            status: 'pending',\n                            created_at: new Date().toISOString()\n                        });\n\n                        \/* =========================\n                           3. WEBHOOK (URL PENDIENTE)\n                           ========================= *\/\n                        fetch('PENDIENTE_BACKEND_WEBHOOK_URL', {\n                            method: 'POST',\n                            headers: {\n                                'Content-Type': 'application\/json'\n                            },\n                            body: JSON.stringify({\n                                event: 'booking_submitted',\n                                distinct_id: email, \/\/ CR\u00cdTICO: mismo que identify\n                                properties: {\n                                    booking_id: bookingId || 'pending',\n                                    booker_email: email,\n                                    service_date: serviceDate,\n                                    airport: airport,\n                                    status: 'pending',\n                                    created_at: new Date().toISOString()\n                                }\n                            })\n                        }).catch(err => {\n                            console.error('Error enviando webhook booking:', err);\n                        });\n\n                    }\n                );\n            }\n\n            bindJetFormBuilderTracking(0);\n        });\n    <\/script>\n\n\n\n    <script>\n        document.addEventListener(\"DOMContentLoaded\", function () {\n\n            \/\/ === FUNCI\u00d3N QUE ACTIVA EL DATEPICKER NATIVO ===\n            function forceNativeDatepicker(field) {\n                \/\/ Para evitar duplicar handlers\n                field.addEventListener(\"click\", (e) => {\n                    try {\n                        if (e.isTrusted && field.showPicker) {\n                            field.showPicker();\n                        }\n                    } catch (err) {\n                        \/\/ Evitar que crashee si es un clic sint\u00e9tico\n                    }\n                });\n            }\n\n            \/\/ === APLICAR A TODOS LOS CAMPOS YA CARGADOS ===\n            function initDateFields() {\n                const dateFields = document.querySelectorAll('input[type=\"date\"].datelegrow');\n                dateFields.forEach(field => forceNativeDatepicker(field));\n            }\n\n            initDateFields();\n\n            \/\/ === MUTATION OBSERVER PARA REPEATERS ===\n            const observer = new MutationObserver(() => {\n                initDateFields(); \/\/ Cada vez que JetFormBuilder agrega un campo nuevo, lo activamos\n            });\n\n            observer.observe(document.body, {\n                childList: true,\n                subtree: true\n            });\n\n        });\n    <\/script>\n\n\n    <script src=\"https:\/\/code.jquery.com\/jquery-3.7.1.min.js\"><\/script>\n    <script>\n        jQuery(function ($) {\n\n            \/\/ Copiar arriving -> flight para una fila concreta\n            function copyValue($row) {\n                const $arriving = $row.find('.arrivingflightrow');\n                const $flight = $row.find('.flightrow');\n\n                if ($arriving.length && $flight.length) {\n                    $flight.val($arriving.val());\n                }\n            }\n\n            \/\/ Activar listeners en una fila\n            function initRow($row) {\n                const $arriving = $row.find('.arrivingflightrow');\n                if (!$arriving.length) return;\n\n                \/\/ Copiar inicialmente\n                copyValue($row);\n\n                \/\/ Escuchar cambios\n                $arriving.off('.flightcopy').on('input.flightcopy change.flightcopy', function () {\n                    copyValue($row);\n                });\n            }\n\n            \/\/ Inicializar filas existentes al cargar\n            $('.jet-form-builder-repeater__row').each(function () {\n                initRow($(this));\n            });\n\n            \/\/ Detectar filas nuevas con MutationObserver (no invasivo)\n            const observer = new MutationObserver(function (mutations) {\n                mutations.forEach(function (mutation) {\n                    $(mutation.addedNodes).each(function () {\n                        const $node = $(this);\n\n                        if ($node.hasClass('jet-form-builder-repeater__row')) {\n                            \/\/ JetForm crea inputs con un peque\u00f1o delay\n                            setTimeout(() => initRow($node), 10);\n                        }\n                    });\n                });\n            });\n\n            observer.observe(document.body, { childList: true, subtree: true });\n\n        });\n    <\/script>\n\n\n    <!-- MENSAJE FIJO DESPU\u00c9S DEL BOT\u00d3N DE ENV\u00cdO -->\n    <style>\n        \/* Icono por defecto (desktop) *\/\n        #fixed-jfb-success-message .jfb-success-icon {\n            width: 26px;\n            height: 26px;\n            border-radius: 50%;\n            background: #000;\n            color: #fff;\n            display: flex;\n            align-items: center;\n            justify-content: center;\n            font-weight: bold;\n            font-size: 14px;\n            flex-shrink: 0;\n        }\n\n        \/* Mobile *\/\n        @media (max-width: 768px) {\n            #fixed-jfb-success-message .jfb-success-icon {\n                width: 35px;\n                height: 35px;\n                font-size: 20px;\n            }\n        }\n    <\/style>\n\n    <script>\n        (function () {\n            window.apiFormAllowMessageScroll = false;\n\n            var successHtml = '\\\n                                        <div id=\"fixed-jfb-success-message\" style=\"\\\n                                          margin-top: 20px;\\\n                                          padding: 16px;\\\n                                          border-radius: 10px;\\\n                                          background: #ffffff;\\\n                                          border: 1px solid #ddd;\\\n                                          box-shadow: rgba(0, 0, 0, 0.08) 0px 4px 12px;\\\n                                          display: flex;\\\n                                          align-items: center;\\\n                                          gap: 12px;\\\n                                          color: #000;\\\n                                          font-size: 14px;\\\n                                        \">\\\n                                          <div class=\"jfb-success-icon\">\u2713<\/div>\\\n                                          <div>\\\n                                            <strong style=\"display:block; font-size:15px;\">Booking request submitted successfully!<\/strong>\\\n                                            Someone from our team will get in touch within an hour during extended business hours.\\\n                                          <\/div>\\\n                                        <\/div>';\n\n            function insertFixedMessage() {\n                if (document.getElementById('fixed-jfb-success-message')) return;\n\n                var submitWrapper = document.querySelector('.jet-form-builder-row.field-type-submit-field');\n                if (!submitWrapper || typeof submitWrapper.insertAdjacentHTML !== 'function') return;\n\n                submitWrapper.insertAdjacentHTML('afterend', successHtml);\n            }\n\n            var observer = new MutationObserver(function (muts) {\n                for (var i = 0; i < muts.length; i++) {\n                    var m = muts[i];\n                    if (!m.addedNodes) continue;\n\n                    for (var j = 0; j < m.addedNodes.length; j++) {\n                        var node = m.addedNodes[j];\n                        if (node.nodeType !== 1) continue;\n\n                        var isSuccess = node.classList?.contains('jet-form-builder-message--success') || node.querySelector?.('.jet-form-builder-message--success');\n                        var isError = node.classList?.contains('jet-form-builder-message--error') || node.querySelector?.('.jet-form-builder-message--error');\n\n                        if (isSuccess || isError) {\n                            if (isSuccess) {\n                                insertFixedMessage();\n                            }\n\n                            if (window.apiFormAllowMessageScroll === true) {\n                                \/\/ Microanimacion de scroll hacia el mensaje de exito o error solo cuando el submit vino del modal\n                                setTimeout(function () {\n                                    var target = (node.classList && node.classList.contains('jet-form-builder-message'))\n                                        ? node\n                                        : (node.querySelector ? node.querySelector('.jet-form-builder-message') : null);\n                                    if (!target) target = node;\n\n                                    if (isSuccess && document.getElementById('fixed-jfb-success-message')) {\n                                        target = document.getElementById('fixed-jfb-success-message');\n                                    }\n\n                                    if (target && typeof jQuery !== 'undefined') {\n                                        jQuery('html, body').animate({ scrollTop: jQuery(target).offset().top - 150 }, 500);\n                                    } else if (target) {\n                                        target.scrollIntoView({ behavior: 'smooth', block: 'center' });\n                                    }\n\n                                    window.apiFormAllowMessageScroll = false;\n                                }, 300);\n                            } else {\n                                window.apiFormAllowMessageScroll = false;\n                            }\n\n                            return;\n                        }\n                    }\n                }\n            });\n\n            observer.observe(document.body, { childList: true, subtree: true });\n\n            if (document.querySelector('.jet-form-builder-message--success')) {\n                insertFixedMessage();\n            }\n\n            \/\/ Si ya hay un mensaje al cargar, no forzamos scroll automatico\n            var exMsg = document.querySelector('.jet-form-builder-message--success, .jet-form-builder-message--error');\n            if (exMsg) {\n                window.apiFormAllowMessageScroll = false;\n            }\n\n\n\n        })();\n    <\/script>\n\n\n    <!--CAMBIAR ICONOS DEL TYPE OF SERVICE-->\n    <html lang=\"es\">\n\n    <head>\n        <meta charset=\"UTF-8\">\n        <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n        <title>Selector de Servicio<\/title>\n\n        <!-- FONT AWESOME -->\n        <link rel=\"stylesheet\" href=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/font-awesome\/6.5.0\/css\/all.min.css\">\n\n        <style>\n            \/* Ocultar los selects originales pero mantenerlos funcionales *\/\n            .jet-form-builder__field-wrap {\n                position: relative;\n            }\n\n            .typeservicerow {\n                position: absolute !important;\n                left: -9999px !important;\n                opacity: 0 !important;\n                pointer-events: none !important;\n            }\n\n            \/* Select personalizado *\/\n            .custom-service-select {\n                width: 100%;\n                padding: 12px 15px;\n                border: 2px solid #e0e0e0;\n                border-radius: 8px;\n                background: white;\n                cursor: pointer;\n                display: flex;\n                align-items: center;\n                gap: 12px;\n                font-size: 14px;\n                transition: all 0.3s ease;\n                position: relative;\n                z-index: 9998 !important;\n            }\n\n            .custom-service-select:hover {\n                border-color: #007cba;\n            }\n\n            .custom-service-select.open {\n                border-color: #007cba;\n                border-bottom-left-radius: 0;\n                border-bottom-right-radius: 0;\n                z-index: 9999 !important;\n            }\n\n            .selected-service {\n                display: flex;\n                align-items: center;\n                gap: 12px;\n                flex-grow: 1;\n            }\n\n            .service-icon i {\n                font-size: 20px;\n                color: #555;\n            }\n\n            .dropdown-arrow {\n                transition: transform 0.3s ease;\n                color: #666;\n            }\n\n            .open .dropdown-arrow {\n                transform: rotate(180deg);\n            }\n\n            .custom-options-container {\n                position: absolute;\n                top: 100%;\n                left: 0;\n                width: 100%;\n                background: white;\n                border: 2px solid #007cba;\n                border-top: none;\n                border-bottom-left-radius: 8px;\n                border-bottom-right-radius: 8px;\n                z-index: 10000 !important;\n                display: none;\n                box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);\n                max-height: 300px;\n                overflow-y: auto;\n            }\n\n            .custom-service-option {\n                padding: 12px 15px;\n                display: flex;\n                align-items: center;\n                gap: 12px;\n                cursor: pointer;\n                transition: background-color 0.2s;\n                border-bottom: 1px solid #f0f0f0;\n                background: white;\n            }\n\n            .custom-service-option:last-child {\n                border-bottom: none;\n            }\n\n            .custom-service-option:hover {\n                background-color: #f8f9fa;\n            }\n\n            .custom-service-option.selected {\n                background-color: #f0f7ff;\n            }\n\n            .custom-service-container {\n                position: relative;\n                margin-bottom: 15px;\n            }\n\n            .select2-container,\n            .jet-form-builder,\n            .elementor-widget-container {\n                z-index: 1 !important;\n                position: relative;\n            }\n        <\/style>\n    <\/head>\n\n    <body>\n\n        <div class=\"elementor-widget-container\">\n            <!-- Aqu\u00ed va tu JetForm -->\n        <\/div>\n\n        <script>\n            document.addEventListener('DOMContentLoaded', function () {\n\n                \/\/ ICONOS MODERNOS (Font Awesome)\n                const serviceIcons = {\n                    '': { icon: '<i class=\"fa-solid fa-list\"><\/i>', text: 'Type of service' },\n                    'Arrival': { icon: '<i class=\"fa-solid fa-plane-arrival\"><\/i>', text: 'Arrival' },\n                    'Departure': { icon: '<i class=\"fa-solid fa-plane-departure\"><\/i>', text: 'Departure' },\n                    'Connection': { icon: '<i class=\"fa-solid fa-right-left\"><\/i>', text: 'Connection' }\n                };\n\n                function createCustomSelect(originalSelect) {\n                    const wrapper = originalSelect.parentElement;\n\n                    const customContainer = document.createElement('div');\n                    customContainer.className = 'custom-service-container';\n\n                    const customSelect = document.createElement('div');\n                    customSelect.className = 'custom-service-select';\n\n                    const selectedService = document.createElement('div');\n                    selectedService.className = 'selected-service';\n\n                    const icon = document.createElement('div');\n                    icon.className = 'service-icon';\n                    icon.innerHTML = serviceIcons[''].icon;\n\n                    const text = document.createElement('span');\n                    text.className = 'selected-text';\n                    text.textContent = serviceIcons[''].text;\n\n                    const arrow = document.createElement('div');\n                    arrow.className = 'dropdown-arrow';\n                    arrow.textContent = '\u25bc';\n\n                    selectedService.appendChild(icon);\n                    selectedService.appendChild(text);\n                    customSelect.appendChild(selectedService);\n                    customSelect.appendChild(arrow);\n\n                    const optionsContainer = document.createElement('div');\n                    optionsContainer.className = 'custom-options-container';\n\n                    Array.from(originalSelect.options).forEach(option => {\n                        if (option.value === '') return;\n\n                        const customOption = document.createElement('div');\n                        customOption.className = 'custom-service-option';\n                        customOption.setAttribute('data-value', option.value);\n\n                        const optionIcon = document.createElement('div');\n                        optionIcon.className = 'service-icon';\n                        optionIcon.innerHTML = serviceIcons[option.value]?.icon || '<i class=\"fa-solid fa-list\"><\/i>';\n\n                        const optionText = document.createElement('span');\n                        optionText.textContent = option.text;\n\n                        customOption.appendChild(optionIcon);\n                        customOption.appendChild(optionText);\n                        optionsContainer.appendChild(customOption);\n\n                        customOption.addEventListener('click', function () {\n                            const value = this.getAttribute('data-value');\n                            const service = serviceIcons[value];\n\n                            if (service) {\n                                icon.innerHTML = service.icon;\n                                text.textContent = service.text;\n\n                                originalSelect.value = value;\n\n                                customSelect.classList.remove('open');\n                                optionsContainer.style.display = 'none';\n\n                                ['change', 'input', 'click'].forEach(eventType => {\n                                    const event = new Event(eventType, { bubbles: true });\n                                    originalSelect.dispatchEvent(event);\n                                });\n\n                                optionsContainer.querySelectorAll('.custom-service-option').forEach(opt => {\n                                    opt.classList.remove('selected');\n                                });\n                                this.classList.add('selected');\n                            }\n                        });\n                    });\n\n                    customContainer.appendChild(customSelect);\n                    customContainer.appendChild(optionsContainer);\n                    wrapper.appendChild(customContainer);\n\n                    customSelect.addEventListener('click', function (e) {\n                        e.stopPropagation();\n                        const isOpen = customSelect.classList.contains('open');\n\n                        document.querySelectorAll('.custom-service-select').forEach(sel => sel.classList.remove('open'));\n                        document.querySelectorAll('.custom-options-container').forEach(opt => opt.style.display = 'none');\n\n                        if (!isOpen) {\n                            customSelect.classList.add('open');\n                            optionsContainer.style.display = 'block';\n                            optionsContainer.style.zIndex = '10000';\n                        }\n                    });\n\n                    originalSelect.addEventListener('change', function () {\n                        const value = this.value;\n                        const service = serviceIcons[value];\n\n                        if (service) {\n                            icon.innerHTML = service.icon;\n                            text.textContent = service.text;\n\n                            optionsContainer.querySelectorAll('.custom-service-option').forEach(opt => {\n                                opt.classList.remove('selected');\n                                if (opt.getAttribute('data-value') === value) opt.classList.add('selected');\n                            });\n                        }\n                    });\n\n                    if (originalSelect.value && originalSelect.value !== '') {\n                        const service = serviceIcons[originalSelect.value];\n                        if (service) {\n                            icon.innerHTML = service.icon;\n                            text.textContent = service.text;\n                        }\n                    }\n                }\n\n                function initCustomSelects() {\n                    const serviceSelects = document.querySelectorAll('select.typeservicerow');\n\n                    serviceSelects.forEach(select => {\n                        if (!select.parentElement.querySelector('.custom-service-container')) {\n                            createCustomSelect(select);\n                        }\n                    });\n                }\n\n                const observer = new MutationObserver(function (mutations) {\n                    let shouldUpdate = false;\n\n                    mutations.forEach(function (mutation) {\n                        if (mutation.addedNodes.length) {\n                            mutation.addedNodes.forEach(function (node) {\n                                if (node.nodeType === 1) {\n                                    if (node.querySelector && node.querySelector('select.typeservicerow')) shouldUpdate = true;\n                                    if (node.matches && node.matches('select.typeservicerow')) shouldUpdate = true;\n                                }\n                            });\n                        }\n                    });\n\n                    if (shouldUpdate) setTimeout(initCustomSelects, 100);\n                });\n\n                initCustomSelects();\n\n                observer.observe(document.body, {\n                    childList: true,\n                    subtree: true\n                });\n\n                document.addEventListener('click', function () {\n                    document.querySelectorAll('.custom-service-select').forEach(sel => sel.classList.remove('open'));\n                    document.querySelectorAll('.custom-options-container').forEach(opt => opt.style.display = 'none');\n                });\n\n            });\n        <\/script>\n\n    <\/body>\n\n    <\/html>\n\n\n    <!--\/* ---------------------------------------------\n   BLOQUEO DE ESPACIOS PARA CAMPOS DE VUELO\n   (Detecta filas a\u00f1adidas o visibles con MutationObserver)\n   --------------------------------------------- *\/-->\n    <script>\n\n\n        (function ($) {\n\n            \/\/ Adjuntar bloqueo a un input individual (evita duplicados)\n            function attachSpaceBlockerToInput($input) {\n                if (!$input || !$input.length) return;\n                if ($input.attr('data-space-blocked') === '1') return;\n                $input.attr('data-space-blocked', '1');\n\n                \/\/ prevenir tecla espacio\n                $input.on('keydown.spaceBlock', function (e) {\n                    if (e.key === ' ') {\n                        e.preventDefault();\n                    }\n                });\n\n                \/\/ manejar pegado (paste) y input\n                $input.on('paste.spaceBlock', function (e) {\n                    \/\/ Leer clipboard (async) y sanitizar\n                    e.preventDefault();\n                    const clipboard = (e.originalEvent || e).clipboardData || window.clipboardData;\n                    let text = clipboard ? clipboard.getData('text') : '';\n                    text = text.replace(\/\\s+\/g, '');\n                    \/\/ insertar en la posici\u00f3n del cursor si es necesario\n                    const el = this;\n                    const start = el.selectionStart || 0;\n                    const end = el.selectionEnd || 0;\n                    const cur = $(this).val() || '';\n                    const newVal = cur.slice(0, start) + text + cur.slice(end);\n                    $(this).val(newVal);\n                    \/\/ ubicar cursor al final del texto pegado\n                    setTimeout(() => {\n                        el.setSelectionRange(start + text.length, start + text.length);\n                        $(el).trigger('input'); \/\/ por si hay l\u00f3gica dependiente\n                    }, 0);\n                });\n\n                \/\/ eliminar espacios en input (typing, autocompletes, etc.)\n                $input.on('input.spaceBlock', function () {\n                    const old = $(this).val() || '';\n                    const clean = old.replace(\/\\s+\/g, '');\n                    if (old !== clean) {\n                        $(this).val(clean);\n                        \/\/ ajustar cursor al final (seguro)\n                        try {\n                            const el = this;\n                            const pos = clean.length;\n                            el.setSelectionRange(pos, pos);\n                        } catch (err) { }\n                    }\n                });\n            }\n\n            \/\/ Buscar y adjuntar bloqueo en una fila concreta (row jQuery element)\n            function attachSpaceBlockerToRow($row) {\n                if (!$row || !$row.length) return;\n                \/\/ buscar inputs por las clases que mostraste en el DOM\n                const selectors = 'input.flightrow, input.arrivingflightrow, input.departingflightrow';\n                $row.find(selectors).each(function () {\n                    attachSpaceBlockerToInput($(this));\n                });\n            }\n\n            \/\/ Adjuntar a todas las filas ya existentes\n            function attachToExistingRows() {\n                $('.jet-form-builder-repeater__row').each(function () {\n                    attachSpaceBlockerToRow($(this));\n                });\n            }\n\n            \/\/ Observer para nuevas filas o cambios dentro del repeater\n            function initRepeaterObserver() {\n                const container = document.querySelector('.jet-form-builder-repeater');\n                if (!container) return;\n\n                const observer = new MutationObserver(function (mutations) {\n                    mutations.forEach(function (mutation) {\n                        \/\/ Si se agregan nodos: buscar inputs dentro de ellos\n                        if (mutation.addedNodes && mutation.addedNodes.length) {\n                            mutation.addedNodes.forEach(function (node) {\n                                if (node.nodeType !== 1) return;\n                                const $node = $(node);\n\n                                \/\/ Si la fila completa fue a\u00f1adida\n                                if ($node.hasClass('jet-form-builder-repeater__row')) {\n                                    attachSpaceBlockerToRow($node);\n                                } else {\n                                    \/\/ por si a\u00f1adieron un fragmento que contiene filas o inputs\n                                    $node.find('.jet-form-builder-repeater__row').each(function () {\n                                        attachSpaceBlockerToRow($(this));\n                                    });\n                                    \/\/ tambi\u00e9n buscar inputs sueltos dentro del subtree\n                                    $node.find('input.flightrow, input.arrivingflightrow, input.departingflightrow').each(function () {\n                                        attachSpaceBlockerToInput($(this));\n                                    });\n                                }\n                            });\n                        }\n\n                        \/\/ Si cambian atributos (p. ej. display style) -> buscar visibilidad nueva\n                        if (mutation.type === 'attributes' && mutation.target) {\n                            const $t = $(mutation.target);\n                            \/\/ si el target es un campo input que nos interesa\n                            if ($t.is('input.flightrow, input.arrivingflightrow, input.departingflightrow')) {\n                                attachSpaceBlockerToInput($t);\n                            } else {\n                                \/\/ si cambiaron atributos en una fila, reintentar attach\n                                if ($t.closest('.jet-form-builder-repeater__row').length) {\n                                    attachSpaceBlockerToRow($t.closest('.jet-form-builder-repeater__row'));\n                                }\n                            }\n                        }\n                    });\n                });\n\n                observer.observe(container, {\n                    childList: true,\n                    subtree: true,\n                    attributes: true,\n                    attributeFilter: ['style', 'class', 'hidden', 'data-index']\n                });\n\n                \/\/ Tambi\u00e9n retornar el observer por si quieres detenerlo despu\u00e9s\n                return observer;\n            }\n\n            \/\/ Tambi\u00e9n atamos al evento 'click' del add new (por compatibilidad)\n            $(document).on('click', '.jet-form-builder-repeater__new', function () {\n                \/\/ Esperar un poco para que la nueva fila se inyecte y luego adjuntar\n                setTimeout(function () {\n                    const $last = $('.jet-form-builder-repeater__row').last();\n                    attachSpaceBlockerToRow($last);\n                }, 80);\n            });\n\n            \/\/ Adem\u00e1s, cuando cambie type_of_service en una fila, re-intentar attach (por si muestra inputs condicionales)\n            $(document).on('change', 'select[name*=\"type_of_service\"], select.typeservicerow', function () {\n                const $row = $(this).closest('.jet-form-builder-repeater__row');\n                \/\/ peque\u00f1o delay para que la l\u00f3gica que muestra\/oculta campos haga su trabajo\n                setTimeout(function () {\n                    attachSpaceBlockerToRow($row);\n                }, 50);\n            });\n\n            \/\/ Inicializaci\u00f3n: adjuntar a las filas existentes y arrancar observer\n            attachToExistingRows();\n            initRepeaterObserver();\n\n        })(jQuery);\n\n\n    <\/script>\n\n    <script src=\"https:\/\/code.jquery.com\/jquery-3.7.1.min.js\"><\/script>\n    <script>\n        jQuery(document).ready(function ($) {\n            \/\/ Retrasamos la ejecuci\u00f3n 2 segundos\n            setTimeout(function () {\n                \/\/ Seleccionamos la fila que contiene el textarea\n                var $textareaRow = $('#special_instructions_optional').closest('.jet-form-builder-row');\n\n                if ($textareaRow.length) {\n                    \/\/ 1. Ocultamos el label original\n                    $textareaRow.find('.jet-form-builder__label').hide();\n\n                    \/\/ 2. Ocultamos el textarea al inicio\n                    $textareaRow.find('.jet-form-builder__field-wrap').hide();\n\n                    \/\/ 3. Creamos un toggle din\u00e1mico\n                    var $toggle = $('<div class=\"accordion-toggle\">Special Instructions (Optional)<\/div>');\n                    $toggle.css({\n                        'cursor': 'pointer',\n                        'background': '#f1f5f9',\n                        'padding': '10px 15px',\n                        'border': '1px solid #dce1e6',\n                        'border-radius': '5px',\n                        'font-weight': 'bold',\n                        'margin-bottom': '5px'\n                    });\n\n                    \/\/ Insertamos el toggle antes del textarea\n                    $textareaRow.find('.jet-form-builder__field-wrap').before($toggle);\n\n                    \/\/ 4. Click para mostrar\/ocultar el textarea\n                    $toggle.on('click', function () {\n                        $textareaRow.find('.jet-form-builder__field-wrap').slideToggle(300, function () {\n                            \/\/ Cambiar color de fondo seg\u00fan estado\n                            $toggle.css('background', $(this).is(':visible') ? '#e2e8f0' : '#f1f5f9');\n                        });\n                    });\n                }\n            }, 500); \/\/ 2000 ms = 2 segundos\n        });\n    <\/script>\n\n\n    <script>\n        document.addEventListener('DOMContentLoaded', () => {\n            const select = document.querySelector('.typeservicerow');\n            const display = document.getElementById('customSelectDisplay');\n            const optionsContainer = document.getElementById('customOptions');\n            const displayText = document.getElementById('customSelectText');\n            if (!select || !display || !optionsContainer || !displayText) return;\n\n            const options = optionsContainer.querySelectorAll('.custom-option');\n\n            \/\/ Funci\u00f3n para actualizar selecci\u00f3n\n            function selectOption(value, text) {\n                displayText.textContent = text;\n                select.value = value;\n                select.dispatchEvent(new Event('change'));\n                options.forEach(opt => opt.classList.remove('selected'));\n                const selected = optionsContainer.querySelector(`[data-value=\"${value}\"]`);\n                if (selected) selected.classList.add('selected');\n                optionsContainer.style.display = 'none';\n            }\n\n            \/\/ Inicializar con valor actual\n            if (select.value && select.value !== 'typeofservice') {\n                const text = select.options[select.selectedIndex].text;\n                selectOption(select.value, text);\n            }\n\n            \/\/ Mostrar\/ocultar opciones\n            display.addEventListener('click', (e) => {\n                e.stopPropagation();\n                optionsContainer.style.display = optionsContainer.style.display === 'flex' ? 'none' : 'flex';\n                optionsContainer.style.flexDirection = 'column';\n            });\n\n            \/\/ Selecci\u00f3n de opci\u00f3n\n            options.forEach(option => {\n                option.addEventListener('click', (e) => {\n                    e.stopPropagation();\n                    selectOption(option.dataset.value, option.textContent.trim());\n                });\n            });\n\n            \/\/ Cerrar dropdown al hacer click fuera\n            document.addEventListener('click', () => {\n                optionsContainer.style.display = 'none';\n            });\n        });\n    <\/script>\n\n    <!-- Mostrar y ocultar campos del type service y airline -->\n\n    <style>\n        .jfb-hidden {\n            visibility: hidden !important;\n            height: 0 !important;\n            margin: 0 !important;\n            padding-top: 0 !important;\n            padding-bottom: 0 !important;\n            overflow: hidden !important;\n        }\n\n        .jfb-hidden>* {\n            display: none !important;\n        }\n    <\/style>\n\n    <script src=\"https:\/\/code.jquery.com\/jquery-3.7.1.min.js\"><\/script>\n    <script>\n        jQuery(function ($) {\n\n            \/* -------------------------------\n               CONTENEDOR REAL DE CADA CAMPO\n            --------------------------------*\/\n            function fieldContainer($el) {\n                var $c = $el.closest('.jet-form-builder-field');\n                if ($c.length) return $c;\n\n                $c = $el.closest('.jet-form-builder-row');\n                if ($c.length) return $c;\n\n                return $el.parent();\n            }\n\n            \/* -------------------------------\n               OCULTAR SOLO CAMPOS DE VUELO\n            --------------------------------*\/\n            function hideFlightInputs($row, excludeFields = []) {\n\n                if (!excludeFields.includes('flightrow')) {\n                    fieldContainer($row.find('.flightrow')).addClass('jfb-hidden');\n                }\n                if (!excludeFields.includes('arrivingflightrow')) {\n                    fieldContainer($row.find('.arrivingflightrow')).addClass('jfb-hidden');\n                }\n                if (!excludeFields.includes('departingflightrow')) {\n                    fieldContainer($row.find('.departingflightrow')).addClass('jfb-hidden');\n                }\n                if (!excludeFields.includes('aerolineasconnectrow')) {\n                    fieldContainer($row.find('.aerolineas_connect')).addClass('jfb-hidden');\n                }\n            }\n\n            \/* -------------------------------\n               MOSTRAR \/ OCULTAR CAMPOS\n            --------------------------------*\/\n            function showFlight($row) {\n                fieldContainer($row.find('.flightrow')).removeClass('jfb-hidden');\n            }\n\n            function showArrivingDeparting($row) {\n                fieldContainer($row.find('.arrivingflightrow')).removeClass('jfb-hidden');\n                fieldContainer($row.find('.departingflightrow')).removeClass('jfb-hidden');\n            }\n\n            function forceHideArrivingDeparting($row) {\n                fieldContainer($row.find('.arrivingflightrow')).addClass('jfb-hidden');\n                fieldContainer($row.find('.departingflightrow')).addClass('jfb-hidden');\n            }\n\n            function forceHideFlight($row) {\n                fieldContainer($row.find('.flightrow')).addClass('jfb-hidden');\n            }\n\n            function showAerolineasConnect($row) {\n                fieldContainer($row.find('.aerolineas_connect')).removeClass('jfb-hidden');\n            }\n\n            function forceHideAerolineasConnect($row) {\n                fieldContainer($row.find('.aerolineas_connect')).addClass('jfb-hidden');\n            }\n\n            \/* -------------------------------\n               L\u00d3GICA PRINCIPAL\n            --------------------------------*\/\n            function applyLogic(row) {\n                var $row = $(row);\n                var val = $row.find('.typeservicerow').val();\n\n                \/\/ Ocultar campos de vuelo seg\u00fan tipo\n                if (val === \"Connection\") {\n                    hideFlightInputs($row, ['arrivingflightrow', 'departingflightrow']);\n                } else {\n                    hideFlightInputs($row);\n                }\n\n                \/\/ Fecha siempre visible\n                fieldContainer($row.find('.datelegrow')).removeClass('jfb-hidden').show();\n\n                if (val === \"Arrival\" || val === \"Departure\") {\n                    showFlight($row);\n                    forceHideArrivingDeparting($row);\n                } else if (val === \"Connection\") {\n                    showArrivingDeparting($row);\n                    forceHideFlight($row);\n                }\n\n                \/* -----------------------------------\n                   aerolineas_connect \u2192 regla correcta\n                   Arrival \u2192 oculto\n                   Departure \u2192 oculto\n                   Connection \u2192 visible\n                -----------------------------------*\/\n                if (val === \"Arrival\" || val === \"Departure\") {\n                    forceHideAerolineasConnect($row);\n                } else {\n                    showAerolineasConnect($row); \/\/ incluye Connection\n                }\n            }\n\n            \/* INICIALIZAR FILAS EXISTENTES *\/\n            $('.jet-form-builder-repeater__row').each(function () {\n                applyLogic(this);\n            });\n\n            \/* SELECT CHANGE *\/\n            $(document).on('change', '.typeservicerow', function () {\n                applyLogic($(this).closest('.jet-form-builder-repeater__row'));\n            });\n\n            \/* OBSERVER *\/\n            var container = document.querySelector('.jet-form-builder-repeater__items');\n\n            if (container) {\n                var observer = new MutationObserver(function (muts) {\n                    muts.forEach(function (m) {\n                        m.addedNodes.forEach(function (node) {\n\n                            if (node.nodeType !== 1) return;\n                            if (!node.classList.contains('jet-form-builder-repeater__row')) return;\n\n                            var $node = $(node);\n\n                            hideFlightInputs($node);\n\n                            setTimeout(function () {\n                                applyLogic($node);\n                            }, 25);\n                        });\n                    });\n                });\n\n                observer.observe(container, { childList: true, subtree: true });\n            }\n\n            \/* AUTO ADD NEW *\/\n            setTimeout(function () {\n                var btn = document.querySelector('.jet-form-builder-repeater__new');\n                if (btn) btn.click();\n            }, 300);\n\n        });\n    <\/script>\n\n\n    <style>\n        \/* Desaparece el bot\u00f3n y su contenedor sin dejar huecos *\/\n        .d-none {\n            display: none !important;\n            visibility: hidden !important;\n            height: 0 !important;\n            margin: 0 !important;\n            padding: 0 !important;\n        }\n\n        \/* CENTRAR EL BOT\u00d3N DE SUBMIT *\/\n        .jet-form-builder-row.field-type-submit-field,\n        .jet-form-builder__submit-wrap {\n            display: flex !important;\n            justify-content: center !important;\n            width: 100% !important;\n        }\n\n        \/* Forzar el mensaje de validacion de vuelos a una nueva fila completa *\/\n        .flight-leg-api-info-persistent {\n            display: block !important;\n            width: 100% !important;\n            max-width: 100% !important;\n            flex: 0 0 100% !important;\n            margin-top: 34px !important;\n            text-align: center !important;\n            background: transparent !important;\n            background-color: transparent !important;\n            box-shadow: none !important;\n            border: 0 !important;\n        }\n\n        .flight-leg-api-info-persistent>div {\n            display: block;\n            width: 100%;\n            line-height: 1.3;\n            background: transparent !important;\n            background-color: transparent !important;\n            box-shadow: none !important;\n            border: 0 !important;\n        }\n\n        .flight-leg-api-info-persistent>div[style*=\"dc3545\"] {\n            color: #ef3340 !important;\n            font-size: clamp(20px, 2vw, 26px) !important;\n            font-weight: 700 !important;\n            font-style: italic !important;\n        }\n\n        \/* Validacion flotante tipo Bootstrap *\/\n        .jet-form-builder .email-bootstrap-feedback,\n        .jet-form-builder .required-bootstrap-feedback {\n            position: absolute;\n            top: calc(100% + 10px);\n            left: 16px;\n            display: block;\n            min-width: 250px;\n            max-width: min(320px, calc(100% - 16px));\n            padding: 10px 14px 10px 46px;\n            border-radius: 4px;\n            border: 1px solid rgba(0, 0, 0, 0.28);\n            background: #fff;\n            box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);\n            font-size: 14px;\n            line-height: 1.35;\n            color: #333333;\n            opacity: 0;\n            visibility: hidden;\n            transform: translateY(-4px);\n            transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;\n            z-index: 50;\n            pointer-events: none;\n        }\n\n        .jet-form-builder .email-bootstrap-feedback::before,\n        .jet-form-builder .required-bootstrap-feedback::before {\n            content: \"\";\n            position: absolute;\n            left: 16px;\n            top: -8px;\n            width: 14px;\n            height: 14px;\n            background: #ffffff;\n            border-left: 1px solid rgba(0, 0, 0, 0.28);\n            border-top: 1px solid rgba(0, 0, 0, 0.28);\n            transform: rotate(45deg);\n        }\n\n        .jet-form-builder .email-bootstrap-feedback::after,\n        .jet-form-builder .required-bootstrap-feedback::after {\n            content: \"!\";\n            position: absolute;\n            left: 12px;\n            top: 50%;\n            width: 22px;\n            height: 22px;\n            margin-top: -11px;\n            border-radius: 4px;\n            background: #ff8a00;\n            color: #ffffff;\n            font-size: 16px;\n            font-weight: 700;\n            line-height: 22px;\n            text-align: center;\n        }\n\n        .jet-form-builder .email-bootstrap-feedback.is-visible,\n        .jet-form-builder .required-bootstrap-feedback.is-visible {\n            opacity: 1;\n            visibility: visible;\n            transform: translateY(0);\n        }\n\n        .jet-form-builder input[type=\"email\"].is-invalid,\n        .jet-form-builder input.is-invalid,\n        .jet-form-builder textarea.is-invalid,\n        .jet-form-builder select.is-invalid {\n            border-color: #dc3545 !important;\n        }\n\n        .jet-form-builder .select2.is-invalid-select2 .select2-selection--single {\n            border-color: #dc3545 !important;\n        }\n    <\/style>\n\n    <script src=\"https:\/\/code.jquery.com\/jquery-3.7.1.min.js\"><\/script>\n    <script>\n        jQuery(document).ready(function ($) {\n            \/* -------------------------\n               CONFIGURACI\u00d3N INICIAL\n            ------------------------- *\/\n            window.flightApiBackup = {};\n            window.activeApiRequests = 0;\n            window.flightError = true; \/\/ Asumimos error hasta validar\n            window.flightSearchDebounce = {};\n            window.isTypingSpecialInstructions = false;\n            window.formWasSubmitted = false;\n            window.customBookingFieldsValid = true;\n            window.apiFormRevealValidationSummary = false;\n            window.apiFormSkipGlobalSubmitValidation = false;\n\n            $('.jet-form-builder form, form.jet-form-builder, .jet-form-builder').attr('novalidate', 'novalidate');\n\n            function clearEmailHideTimer($input) {\n                const timerId = $input.data('email-hide-timer');\n                if (timerId) {\n                    clearTimeout(timerId);\n                    $input.removeData('email-hide-timer');\n                }\n            }\n\n            function clearFieldHideTimer($field) {\n                const timerId = $field.data('required-hide-timer');\n                if (timerId) {\n                    clearTimeout(timerId);\n                    $field.removeData('required-hide-timer');\n                }\n            }\n\n            function getEmailFeedbackElement($input) {\n                let $feedback = $input.siblings('.email-bootstrap-feedback').first();\n\n                if (!$feedback.length) {\n                    const $wrap = $input.closest('.jet-form-builder__field-wrap');\n                    if ($wrap.length) {\n                        $wrap.css('position', 'relative');\n                    }\n                    $feedback = $('<div class=\"email-bootstrap-feedback\">Please enter a valid email address containing \"@\" and \".\"<\/div>');\n                    $input.after($feedback);\n                }\n\n                return $feedback;\n            }\n\n            function getFieldAnchor($field) {\n                if ($field.is('select') && $field.next('.select2').length) {\n                    return $field.next('.select2');\n                }\n\n                return $field;\n            }\n\n            function scrollToField($field) {\n                if (!$field || !$field.length) return;\n\n                const $anchor = getFieldAnchor($field);\n                const offsetTop = ($anchor.offset() || $field.offset() || { top: 0 }).top - 140;\n\n                if (typeof jQuery !== 'undefined') {\n                    jQuery('html, body').animate({ scrollTop: Math.max(0, offsetTop) }, 500);\n                } else if ($anchor.get(0)) {\n                    $anchor.get(0).scrollIntoView({ behavior: 'smooth', block: 'center' });\n                }\n            }\n\n            function getRequiredFeedbackElement($field) {\n                const $anchor = getFieldAnchor($field);\n                let $feedback = $anchor.siblings('.required-bootstrap-feedback').first();\n\n                if (!$feedback.length) {\n                    const $wrap = $field.closest('.jet-form-builder__field-wrap');\n                    if ($wrap.length) {\n                        $wrap.css('position', 'relative');\n                    }\n\n                    $feedback = $('<div class=\"required-bootstrap-feedback\">This field is required.<\/div>');\n                    $anchor.after($feedback);\n                }\n\n                return $feedback;\n            }\n\n            function hasFieldValue($field) {\n                const value = $field.val();\n\n                if (Array.isArray(value)) {\n                    return value.length > 0;\n                }\n\n                return String(value || '').trim() !== '';\n            }\n\n            function isEligibleRequiredField($field) {\n                if (!$field.length || $field.prop('disabled') || $field.prop('readonly')) return false;\n                if ($field.is('[type=\"hidden\"], [type=\"submit\"], [type=\"button\"], [type=\"radio\"], [type=\"checkbox\"], [type=\"file\"]')) return false;\n                if ($field.is('[type=\"email\"], [type=\"date\"]')) return false;\n\n                const isRequired = $field.prop('required') ||\n                    $field.attr('aria-required') === 'true' ||\n                    $field.closest('.jet-form-builder-row').find('.jet-form-builder__required').length > 0;\n\n                return isRequired;\n            }\n\n            function setRequiredFieldInvalidState($field, isInvalid) {\n                $field.toggleClass('is-invalid', isInvalid);\n\n                if ($field.is('select') && $field.next('.select2').length) {\n                    $field.next('.select2').toggleClass('is-invalid-select2', isInvalid);\n                }\n            }\n\n            function showRequiredFeedback($field) {\n                clearFieldHideTimer($field);\n                getRequiredFeedbackElement($field).addClass('is-visible');\n            }\n\n            function hideRequiredFeedback($field, delay) {\n                const $feedback = getRequiredFeedbackElement($field);\n                clearFieldHideTimer($field);\n\n                if (!delay) {\n                    $feedback.removeClass('is-visible');\n                    return;\n                }\n\n                const timerId = setTimeout(function () {\n                    $feedback.removeClass('is-visible');\n                    $field.removeData('required-hide-timer');\n                }, delay);\n\n                $field.data('required-hide-timer', timerId);\n            }\n\n            function validateRequiredField($field, options) {\n                if (!isEligibleRequiredField($field)) return true;\n\n                const settings = $.extend({\n                    showFloating: false,\n                    hideDelay: 0\n                }, options || {});\n\n                const wasTouched = $field.data('required-touched') === true;\n\n                if (!wasTouched) {\n                    setRequiredFieldInvalidState($field, false);\n                    hideRequiredFeedback($field, 0);\n                    $field.attr('aria-invalid', 'false');\n                    return true;\n                }\n\n                if (hasFieldValue($field)) {\n                    setRequiredFieldInvalidState($field, false);\n                    hideRequiredFeedback($field, 0);\n                    $field.attr('aria-invalid', 'false');\n                    return true;\n                }\n\n                setRequiredFieldInvalidState($field, true);\n                $field.attr('aria-invalid', 'true');\n\n                if (settings.showFloating) {\n                    showRequiredFeedback($field);\n                    if (settings.hideDelay) {\n                        hideRequiredFeedback($field, settings.hideDelay);\n                    }\n                }\n\n                return false;\n            }\n\n            function showEmailFeedback($input) {\n                clearEmailHideTimer($input);\n                getEmailFeedbackElement($input).addClass('is-visible');\n            }\n\n            function hideEmailFeedback($input, delay) {\n                const $feedback = getEmailFeedbackElement($input);\n                clearEmailHideTimer($input);\n\n                if (!delay) {\n                    $feedback.removeClass('is-visible');\n                    return;\n                }\n\n                const timerId = setTimeout(function () {\n                    $feedback.removeClass('is-visible');\n                    $input.removeData('email-hide-timer');\n                }, delay);\n\n                $input.data('email-hide-timer', timerId);\n            }\n\n            function validateEmailField($input, options) {\n                if (!$input.length || !$input.is(':visible')) return true;\n\n                const settings = $.extend({\n                    showFloating: false,\n                    hideDelay: 0\n                }, options || {});\n\n                const value = ($input.val() || '').trim();\n                const emailRegex = \/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$\/;\n                const hasValue = value !== '';\n                const wasTouched = $input.data('required-touched') === true;\n                const isValid = hasValue && emailRegex.test(value);\n\n                $input.removeClass('is-invalid');\n\n                if (!hasValue && !wasTouched) {\n                    $input.attr('aria-invalid', 'false');\n                    hideEmailFeedback($input, 0);\n                    return true;\n                }\n\n                if (isValid) {\n                    $input.attr('aria-invalid', 'false');\n                    hideEmailFeedback($input, 0);\n                    return true;\n                }\n\n                $input.addClass('is-invalid');\n                $input.attr('aria-invalid', 'true');\n                getEmailFeedbackElement($input).text(hasValue ? 'Please enter a valid email address containing \"@\" and \".\"' : 'This field is required.');\n\n                if (settings.showFloating) {\n                    showEmailFeedback($input);\n                    if (settings.hideDelay) {\n                        hideEmailFeedback($input, settings.hideDelay);\n                    }\n                }\n\n                return false;\n            }\n\n            function validateVisibleEmailFields() {\n                $('.jet-form-builder input[type=\"email\"]:visible').each(function () {\n                    validateEmailField($(this));\n                });\n            }\n\n            function sanitizePhoneValue(value) {\n                let sanitized = (value || '').replace(\/[^\\d+]\/g, '');\n\n                if (sanitized.indexOf('+') > 0) {\n                    sanitized = sanitized.replace(\/\\+\/g, '');\n                }\n\n                if (sanitized.startsWith('+')) {\n                    sanitized = '+' + sanitized.slice(1).replace(\/\\+\/g, '');\n                } else {\n                    sanitized = sanitized.replace(\/\\+\/g, '');\n                }\n\n                return sanitized;\n            }\n\n            \/* -------------------------\n               FUNCI\u00d3N \u00daNICA PARA ESTADO DEL BOT\u00d3N\n            ------------------------- *\/\n            function updateSubmitButtonState() {\n                if (window.formWasSubmitted) return;\n\n                const $submitButton = $('.jet-form-builder__submit');\n                if (!$submitButton.length) return;\n\n                validateVisibleEmailFields();\n                const shouldBlock =\n                    window.activeApiRequests > 0 ||\n                    window.flightError === true ||\n                    window.isTypingSpecialInstructions === true ||\n                    window.customBookingFieldsValid === false;\n\n                if (shouldBlock) {\n                    $submitButton.prop('disabled', true).css({ 'opacity': '0.5', 'cursor': 'not-allowed' });\n                } else {\n                    $submitButton.prop('disabled', false).css({ 'opacity': '1', 'cursor': 'pointer' });\n                }\n            }\n\n            window.apiFormFieldHelpers = {\n                getFieldAnchor: getFieldAnchor,\n                getEmailFeedbackElement: getEmailFeedbackElement,\n                getRequiredFeedbackElement: getRequiredFeedbackElement,\n                scrollToField: scrollToField,\n                updateSubmitButtonState: updateSubmitButtonState,\n                isEligibleRequiredField: isEligibleRequiredField,\n                validateRequiredField: validateRequiredField,\n                validateEmailField: validateEmailField\n            };\n\n            function incrementApiRequests() {\n                window.activeApiRequests++;\n                updateSubmitButtonState();\n            }\n\n            function decrementApiRequests() {\n                window.activeApiRequests = Math.max(0, window.activeApiRequests - 1);\n                updateSubmitButtonState();\n            }\n\n            \/* -------------------------\n               SISTEMA DE BACKUP\n            ------------------------- *\/\n            let backupTimeout = null;\n            function scheduleBackup() {\n                clearTimeout(backupTimeout);\n                backupTimeout = setTimeout(backupAllApiContainers, 500);\n            }\n\n            function backupAllApiContainers() {\n                window.flightApiBackup = {};\n                $('.jet-form-builder-repeater__row').each(function (index) {\n                    const $row = $(this);\n                    const container = $row.find('.flight-leg-api-info-persistent');\n                    if (container.length && container.html().trim() !== '') {\n                        const backupKey = `row-${index}`;\n                        window.flightApiBackup[backupKey] = {\n                            html: container.html(),\n                            rowIndex: index\n                        };\n                    }\n                });\n            }\n\n            function restoreApiContainers() {\n                $('.jet-form-builder-repeater__row').each(function (index) {\n                    const $row = $(this);\n                    const backupKey = `row-${index}`;\n                    if (window.flightApiBackup[backupKey]) {\n                        const container = injectPersistentContainer($row);\n                        container.html(window.flightApiBackup[backupKey].html);\n                        if (window.flightApiBackup[backupKey].html.trim() !== '') {\n                            $row.find('.flight-leg-title').hide();\n                        }\n                    }\n                });\n            }\n\n            \/* -------------------------\n               CONTAINER PERSISTENTE\n            ------------------------- *\/\n            function injectPersistentContainer($row) {\n                const existing = $row.find('.flight-leg-api-info-persistent');\n                if (existing.length) return existing;\n\n                const container = $(`\n            <div class=\"flight-leg-api-info-persistent jet-fb-persistent-element\"\n                 style=\"font-weight:bold; font-size:14px; margin-top:10px; text-align:center;\"\n                 data-persistent=\"true\"\n                 data-jetfb-ignore=\"true\">\n            <\/div>\n        `);\n\n                const $fieldsContainer = $row.find('.jet-form-builder-repeater__row-fields');\n                if ($fieldsContainer.length) {\n                    $fieldsContainer.append(container);\n                }\n                return container;\n            }\n\n            function setAirportField($row, airportCode) {\n                const $airportInput = $row.find('input[data-field-name=\"airport\"]');\n                if ($airportInput.length) $airportInput.val(airportCode || '').trigger('change');\n            }\n\n            function setFromAirportField($row, airportCode) {\n                const $fromAirportInput = $row.find('input[data-field-name=\"fromairport\"]');\n                if ($fromAirportInput.length) $fromAirportInput.val(airportCode || '').trigger('change');\n            }\n\n            function setToAirportField($row, airportCode) {\n                const $toAirportInput = $row.find('input[data-field-name=\"toairport\"]');\n                if ($toAirportInput.length) $toAirportInput.val(airportCode || '').trigger('change');\n            }\n\n            function formatFlightTime(isoString) {\n                if (!isoString) return '';\n                const date = new Date(isoString);\n                return `${date.getHours().toString().padStart(2, '0')}:${date.getMinutes().toString().padStart(2, '0')}`;\n            }\n\n            function getFlightRows() {\n                return $('.jet-form-builder-repeater__row').filter(function () {\n                    const $row = $(this);\n                    return $row.is(':visible') && $row.find('.typeservicerow, .flightrow, .arrivingflightrow, .departingflightrow, .datelegrow').length > 0;\n                });\n            }\n\n            function getFlightValidationState() {\n                const messages = [];\n                const invalidFields = [];\n                const globalErrors = [];\n\n                function pushMessage(message, $field) {\n                    if (message && !messages.includes(message)) {\n                        messages.push(message);\n                    }\n\n                    if ($field && $field.length) {\n                        invalidFields.push($field);\n                    } else if (message && !globalErrors.includes(message)) {\n                        globalErrors.push(message);\n                    }\n                }\n\n                getFlightRows().each(function (index) {\n                    const $row = $(this);\n                    const legNumber = index + 1;\n                    const $serviceField = $row.find('.typeservicerow').first();\n                    const $dateField = $row.find('.datelegrow').first();\n                    const $airlineField = $row.find('select[name*=\"aerolineas\"]').first();\n                    const $connectAirlineField = $row.find('select[name*=\"aerolineas_connect\"]').first();\n                    const $flightField = $row.find('.flightrow').first();\n                    const $arrivingField = $row.find('.arrivingflightrow').first();\n                    const $departingField = $row.find('.departingflightrow').first();\n                    const service = (($row.find('.typeservicerow').val() || '').toString().trim().toLowerCase());\n                    const date = (($row.find('.datelegrow').val() || '').toString().trim());\n                    const airline = (($airlineField.val() || '').toString().trim());\n                    const connectAirline = (($connectAirlineField.val() || '').toString().trim());\n                    const flight = (($row.find('.flightrow').val() || '').toString().trim());\n                    const arrivingFlight = (($row.find('.arrivingflightrow').val() || '').toString().trim());\n                    const departingFlight = (($row.find('.departingflightrow').val() || '').toString().trim());\n                    const containerText = (($row.find('.flight-leg-api-info-persistent').text() || '').toString().trim());\n\n                    if (!service || service === 'type of service' || service === 'typeofservice') {\n                        pushMessage('Flight leg ' + legNumber + ': please choose a service type.', $serviceField);\n                        return;\n                    }\n\n                    if (!date) {\n                        pushMessage('Flight leg ' + legNumber + ': please choose a date.', $dateField);\n                    }\n\n                    if (service === 'arrival' || service === 'departure') {\n                        if (!airline) {\n                            pushMessage('Flight leg ' + legNumber + ': please choose an airline.', $airlineField);\n                        }\n\n                        if (!flight) {\n                            pushMessage('Flight leg ' + legNumber + ': please enter the flight number.', $flightField);\n                            return;\n                        }\n                    }\n\n                    if (service === 'connection') {\n                        if (!airline) {\n                            pushMessage('Flight leg ' + legNumber + ': please choose the arriving airline.', $airlineField);\n                        }\n\n                        if (!arrivingFlight) {\n                            pushMessage('Flight leg ' + legNumber + ': please enter the arriving flight number.', $arrivingField);\n                        }\n\n                        if (!connectAirline) {\n                            pushMessage('Flight leg ' + legNumber + ': please choose the departing airline.', $connectAirlineField);\n                        }\n\n                        if (!departingFlight) {\n                            pushMessage('Flight leg ' + legNumber + ': please enter the departing flight number.', $departingField);\n                        }\n\n                        if (!airline || !arrivingFlight || !connectAirline || !departingFlight) {\n                            return;\n                        }\n                    }\n\n                    if (!containerText) {\n                        pushMessage('Flight leg ' + legNumber + ': please wait for the flight details to finish validating.', service === 'connection' ? $arrivingField : $flightField);\n                        return;\n                    }\n\n                    if (\n                        containerText.includes('wasn\u2019t found') ||\n                        containerText.includes('No scheduled flights found') ||\n                        containerText.includes('Error') ||\n                        containerText.includes('Please complete') ||\n                        containerText.includes('Connection flight not found') ||\n                        containerText.includes('Both flights required') ||\n                        containerText.includes('Re-validating') ||\n                        containerText.includes('Fetching')\n                    ) {\n                        return;\n                    }\n                });\n\n                return {\n                    messages: messages,\n                    invalidFields: invalidFields,\n                    globalErrors: globalErrors\n                };\n            }\n\n            function getFlightValidationErrors() {\n                return getFlightValidationState().messages;\n            }\n\n            window.getFlightValidationErrors = getFlightValidationErrors;\n\n            function escapeFlightValidationHtml(value) {\n                return String(value || '')\n                    .replace(\/&\/g, '&amp;')\n                    .replace(\/<\/g, '&lt;')\n                    .replace(\/>\/g, '&gt;')\n                    .replace(\/\"\/g, '&quot;')\n                    .replace(\/'\/g, '&#039;');\n            }\n\n            function buildFlightValidationMessageHtml() {\n                const errors = getFlightValidationErrors();\n\n                if (!errors.length) {\n                    return 'Please fix flight errors.';\n                }\n\n                return '<ul style=\"margin:0; padding-left:18px;\">' + errors.map(function (message) {\n                    return '<li>' + escapeFlightValidationHtml(message) + '<\/li>';\n                }).join('') + '<\/ul>';\n            }\n\n            function checkAllFlightsValid() {\n                let allValid = true;\n\n                $('.jet-form-builder-repeater__row').each(function () {\n                    const $row = $(this);\n                    const container = $row.find('.flight-leg-api-info-persistent');\n                    if (container.length) {\n                        const html = container.html();\n                        const service = ($row.find('.typeservicerow').val() || '').toLowerCase();\n                        const hasFlightData = $row.find('.flightrow').val() || $row.find('.arrivingflightrow').val() || $row.find('.departingflightrow').val();\n\n                        if (hasFlightData && service !== '') {\n                            if (html.includes('The flight entered wasn\u2019t found') || html.includes('No scheduled flights found') || html.includes('Error') || html.includes('Please complete') || html.includes('Connection flight not found') || html.includes('Both flights required') || html.includes('Re-validating') || html.includes('Fetching') || html.trim() === '') {\n                                allValid = false;\n                            }\n                        } else if (!hasFlightData) {\n                            allValid = false;\n                        }\n                    } else {\n                        allValid = false;\n                    }\n                });\n\n                return allValid;\n            }\n\n            \/* -------------------------\n               CONSULTA API CON DEBOUNCE\n            ------------------------- *\/\n            function consultarFlightStats($row, forceRefresh = false) {\n                const rowId = $row.index();\n                if (window.flightSearchDebounce[rowId]) clearTimeout(window.flightSearchDebounce[rowId]);\n\n                window.flightSearchDebounce[rowId] = setTimeout(() => {\n                    executeFlightStatsQuery($row, forceRefresh);\n                }, 800);\n            }\n\n            function executeFlightStatsQuery($row, forceRefresh = false) {\n                const container = injectPersistentContainer($row);\n                const rawService = $row.find('.typeservicerow').val();\n\n                if (!rawService || rawService.trim() === '' || rawService.trim().toLowerCase() === 'type of service') {\n                    container.html(`<div style=\"font-weight:bold; color: #dc3545; font-style:italic; text-align:center;\">Please select a Type of Service first<\/div>`);\n                    window.flightError = true;\n                    scheduleBackup(); updateSubmitButtonState();\n                    return;\n                }\n\n                const service = rawService.toLowerCase();\n\n                container.html(`<div style=\"font-weight:bold; display: flex; justify-content:center; align-items: center; color: #007cba; font-style:italic;\">Fetching flight information...<\/div>`);\n\n                if (service === 'arrival' || service === 'departure') {\n                    handleArrivalDeparture($row, service, container);\n                } else if (service === 'connection') {\n                    handleConnection($row, container);\n                }\n            }\n\n            function buildInlineFlightRequirementMessage(parts) {\n                const filteredParts = (parts || []).filter(Boolean);\n                if (!filteredParts.length) return 'Please complete the flight details.';\n                if (filteredParts.length === 1) return 'Please ' + filteredParts[0] + '.';\n                if (filteredParts.length === 2) return 'Please ' + filteredParts[0] + ' and ' + filteredParts[1] + '.';\n\n                return 'Please ' + filteredParts.slice(0, -1).join(', ') + ', and ' + filteredParts[filteredParts.length - 1] + '.';\n            }\n\n            function handleArrivalDeparture($row, service, container) {\n                const rawFlightNumber = ($row.find('.flightrow').val() || '').toUpperCase();\n                const $airlineSelect = $row.find('select[name*=\"aerolineas\"]');\n                const airlineCode = typeof window.getApiCarrierCode === 'function' ? window.getApiCarrierCode($airlineSelect) : '';\n                const flightNumber = typeof window.normalizeFlightNumber === 'function'\n                    ? window.normalizeFlightNumber(rawFlightNumber, $airlineSelect)\n                    : rawFlightNumber;\n\n                const date = $row.find('.datelegrow').val();\n\n                const missingRequirements = [];\n                if (!date) missingRequirements.push('select a date');\n                if (!airlineCode) missingRequirements.push('choose an airline');\n                if (!rawFlightNumber) missingRequirements.push('enter the flight number');\n\n                if (missingRequirements.length) {\n                    window.flightError = true;\n                    container.html('<div style=\"color: #dc3545;font-weight:bold; font-style: italic;\">' + buildInlineFlightRequirementMessage(missingRequirements) + '<\/div>');\n                    setAirportField($row, ''); setFromAirportField($row, ''); setToAirportField($row, '');\n                    scheduleBackup(); updateSubmitButtonState();\n                    return;\n                }\n\n                const typeOfService = service === 'arrival' ? 'arriving' : 'departing';\n                incrementApiRequests();\n                window.flightError = true;\n\n                $.ajax({\n                    url: '\/wp-json\/flightstats\/v1\/check-flight',\n                    method: 'POST',\n                    contentType: 'application\/json',\n                    data: JSON.stringify({ carrier: airlineCode, flightNumber, date, typeOfService }),\n                    success: function (response) {\n                        let finalHtml = '';\n                        if (response.scheduledFlights && response.scheduledFlights.length > 0) {\n                            const f = response.scheduledFlights[0];\n                            if (service === 'arrival') {\n                                finalHtml = `<div>Arrival ${f.arrivalAirportFsCode} at ${formatFlightTime(f.arrivalTime)}<\/div>`;\n                                setAirportField($row, f.arrivalAirportFsCode);\n                            } else {\n                                finalHtml = `<div>Departure ${f.departureAirportFsCode} at ${formatFlightTime(f.departureTime)}<\/div>`;\n                                setAirportField($row, f.departureAirportFsCode);\n                            }\n                            setFromAirportField($row, ''); setToAirportField($row, '');\n                        } else {\n                            finalHtml = '<div style=\"font-weight:bold; color: #dc3545; font-style: italic;\">The flight entered wasn\u2019t found. Check flight number and date.<\/div>';\n                            setAirportField($row, ''); setFromAirportField($row, ''); setToAirportField($row, '');\n                        }\n                        container.html(finalHtml);\n                        window.flightError = !checkAllFlightsValid();\n                        scheduleBackup(); updateSubmitButtonState();\n                    },\n                    error: function () {\n                        container.html('<div style=\"font-weight:bold; color: #dc3545; font-style: italic;\">Error fetching flight data.<\/div>');\n                        setAirportField($row, ''); setFromAirportField($row, ''); setToAirportField($row, '');\n                        window.flightError = !checkAllFlightsValid();\n                        scheduleBackup(); updateSubmitButtonState();\n                    },\n                    complete: function () { decrementApiRequests(); }\n                });\n            }\n\n            function handleConnection($row, container) {\n                const arrivingRaw = ($row.find('.arrivingflightrow').val() || '').toUpperCase();\n                const $arrivingAirlineSelect = $row.find('select[name*=\"aerolineas\"]');\n                const arrivingAirline = typeof window.getApiCarrierCode === 'function' ? window.getApiCarrierCode($arrivingAirlineSelect) : '';\n                const arrivingFlight = typeof window.normalizeFlightNumber === 'function'\n                    ? window.normalizeFlightNumber(arrivingRaw, $arrivingAirlineSelect)\n                    : arrivingRaw;\n\n                const departingRaw = ($row.find('.departingflightrow').val() || '').toUpperCase();\n                const $departingAirlineSelect = $row.find('select[name*=\"aerolineas_connect\"]');\n                const departingAirline = typeof window.getApiCarrierCode === 'function' ? window.getApiCarrierCode($departingAirlineSelect) : '';\n                const departingFlight = typeof window.normalizeFlightNumber === 'function'\n                    ? window.normalizeFlightNumber(departingRaw, $departingAirlineSelect)\n                    : departingRaw;\n\n                const date = $row.find('.datelegrow').val();\n\n                const missingRequirements = [];\n                if (!date) missingRequirements.push('select a date');\n                if (!arrivingAirline) missingRequirements.push('choose the arriving airline');\n                if (!arrivingRaw) missingRequirements.push('enter the arriving flight number');\n                if (!departingAirline) missingRequirements.push('choose the departing airline');\n                if (!departingRaw) missingRequirements.push('enter the departing flight number');\n\n                if (missingRequirements.length) {\n                    window.flightError = true;\n                    container.html('<div style=\"font-weight:bold; color: #dc3545; font-style: italic;\">' + buildInlineFlightRequirementMessage(missingRequirements) + '<\/div>');\n                    setAirportField($row, ''); setFromAirportField($row, ''); setToAirportField($row, '');\n                    scheduleBackup(); updateSubmitButtonState();\n                    return;\n                }\n\n                window.flightError = true;\n                let connectionData = { arrivingAirport: '', arrivingTime: '', departingAirport: '', departingTime: '', connectionAirport: '', arrivingValid: false, departingValid: false };\n                let requestsCompleted = 0; const totalRequests = 2;\n\n                incrementApiRequests();\n\n                function checkAllCompleted() {\n                    if (++requestsCompleted === totalRequests) {\n                        if (!connectionData.arrivingValid || !connectionData.departingValid || !connectionData.connectionAirport) {\n                            window.flightError = true;\n                            container.html('<div style=\"color:#dc3545;font-weight:bold;\">Connection flight not found<\/div>');\n                            setAirportField($row, ''); setFromAirportField($row, ''); setToAirportField($row, '');\n                        } else {\n                            const line = `Connection: ${connectionData.connectionAirport} at ${connectionData.arrivingTime} \u2192 ${connectionData.connectionAirport} at ${connectionData.departingTime}`;\n                            container.html(`<div>${line}<\/div>`);\n                            setAirportField($row, connectionData.connectionAirport);\n                            setFromAirportField($row, connectionData.arrivingAirport);\n                            setToAirportField($row, connectionData.departingAirport);\n                        }\n                        window.flightError = !checkAllFlightsValid();\n                        scheduleBackup(); decrementApiRequests(); updateSubmitButtonState();\n                    }\n                }\n\n                function processFlight(flightNumber, typeOfService, isArriving) {\n                    $.ajax({\n                        url: '\/wp-json\/flightstats\/v1\/check-flight',\n                        method: 'POST',\n                        contentType: 'application\/json',\n                        data: JSON.stringify({\n                            carrier: isArriving ? arrivingAirline : departingAirline,\n                            flightNumber,\n                            date,\n                            typeOfService\n                        }),\n                        success: function (response) {\n                            if (response.scheduledFlights && response.scheduledFlights.length > 0) {\n                                const f = response.scheduledFlights[0];\n                                if (isArriving) {\n                                    connectionData.arrivingAirport = f.departureAirportFsCode;\n                                    connectionData.arrivingTime = formatFlightTime(f.arrivalTime);\n                                    connectionData.arrivingValid = true;\n                                } else {\n                                    connectionData.departingAirport = f.arrivalAirportFsCode;\n                                    connectionData.departingTime = formatFlightTime(f.departureTime);\n                                    connectionData.connectionAirport = f.departureAirportFsCode;\n                                    connectionData.departingValid = true;\n                                }\n                            }\n                            checkAllCompleted();\n                        },\n                        error: function () {\n                            if (isArriving) connectionData.arrivingValid = false; else connectionData.departingValid = false;\n                            checkAllCompleted();\n                        }\n                    });\n                }\n                processFlight(arrivingFlight, 'arriving', true);\n                processFlight(departingFlight, 'departing', false);\n            }\n\n            \/* =========================================================\n               RE-VALIDACI\u00d3N INSTANT\u00c1NEA AL CAMBIAR AEROL\u00cdNEA\/VUELO\n               ========================================================= *\/\n            let globalTypingTimer = null;\n            let lastScheduledFingerprint = {};\n\n            $(document).on('input change', '.flightrow, .arrivingflightrow, .departingflightrow, .datelegrow, .typeservicerow, select[name*=\"aerolineas\"]', function (e) {\n                if (window.formWasSubmitted) return; \/\/ FIX: Prevent redundant validation loops on submit\n\n                const $row = $(this).closest('.jet-form-builder-repeater__row');\n                const rowIndex = $row.index();\n\n                const currentFingerprint =\n                    ($row.find('.typeservicerow').val() || '') + '|' +\n                    ($row.find('.flightrow').val() || '') + '|' +\n                    ($row.find('select[name*=\"aerolineas\"]').first().val() || '') + '|' +\n                    ($row.find('.arrivingflightrow').val() || '') + '|' +\n                    ($row.find('select[name*=\"aerolineas_connect\"]').val() || '') + '|' +\n                    ($row.find('.departingflightrow').val() || '') + '|' +\n                    ($row.find('.datelegrow').val() || '');\n\n                \/\/ Prevent redundant fetches if the data hasn't actually changed since the last fetch schedule\n                if (lastScheduledFingerprint[rowIndex] === currentFingerprint && e.type !== 'click') {\n                    return;\n                }\n                lastScheduledFingerprint[rowIndex] = currentFingerprint;\n\n                const container = injectPersistentContainer($row);\n\n                window.flightError = true;\n                updateSubmitButtonState();\n\n                container.html('<div style=\"color: #007cba; font-weight:bold; font-size:13px; font-style:italic;\">Re-validating flight info...<\/div>');\n\n                clearTimeout(globalTypingTimer);\n                globalTypingTimer = setTimeout(() => {\n                    consultarFlightStats($row, true);\n                }, 800);\n            });\n\n            let specialTypingTimer = null;\n            let lastTypedField = null;\n\n            $(document).on('input', '.specialrow', function () {\n                const $field = $(this);\n                if (lastTypedField !== this) { clearTimeout(specialTypingTimer); lastTypedField = this; }\n                window.isTypingSpecialInstructions = true; updateSubmitButtonState();\n                clearTimeout(specialTypingTimer);\n                specialTypingTimer = setTimeout(function () {\n                    if (lastTypedField !== $field[0]) return;\n                    window.isTypingSpecialInstructions = false; updateSubmitButtonState();\n                }, 1000);\n            });\n\n            $(document).on('input change click keyup', '.jet-form-builder input, .jet-form-builder select', function () {\n                $(this).data('last-val', $(this).val());\n                updateSubmitButtonState();\n            });\n\n            $(document).on('focus', '.jet-form-builder input[type=\"email\"]', function () {\n                validateEmailField($(this), { showFloating: true });\n            });\n\n            $(document).on('input change', '.jet-form-builder input[type=\"email\"]', function () {\n                const $input = $(this);\n                validateEmailField($input, { showFloating: $input.is(':focus') });\n            });\n\n            $(document).on('blur', '.jet-form-builder input[type=\"email\"]', function () {\n                const $input = $(this);\n                if (!(($input.val() || '').trim())) {\n                    $input.data('required-touched', true);\n                }\n                validateEmailField($input, { showFloating: true, hideDelay: 5000 });\n            });\n\n            const requiredFieldSelector = '.jet-form-builder input:not([type=\"email\"]):not([type=\"hidden\"]):not([type=\"submit\"]):not([type=\"button\"]):not([type=\"radio\"]):not([type=\"checkbox\"]):not([type=\"file\"]), .jet-form-builder textarea, .jet-form-builder select';\n\n            $(document).on('focus', requiredFieldSelector, function () {\n                const $field = $(this);\n                if (!$field.data('required-touched')) return;\n                validateRequiredField($field, { showFloating: true });\n            });\n\n            $(document).on('input change', requiredFieldSelector, function () {\n                const $field = $(this);\n                if (!isEligibleRequiredField($field)) return;\n                validateRequiredField($field, { showFloating: $field.is(':focus') });\n            });\n\n            $(document).on('blur', requiredFieldSelector, function () {\n                const $field = $(this);\n                if (!isEligibleRequiredField($field)) return;\n\n                if (!hasFieldValue($field)) {\n                    $field.data('required-touched', true);\n                }\n\n                validateRequiredField($field, { showFloating: !hasFieldValue($field), hideDelay: hasFieldValue($field) ? 0 : 2000 });\n            });\n\n            $(document).on('input', '.jet-form-builder input[type=\"tel\"], .jet-form-builder input[name*=\"phone\"], .jet-form-builder input[name*=\"telefono\"], .jet-form-builder .phonenumberrow input', function () {\n                const sanitized = sanitizePhoneValue(this.value);\n                if (this.value !== sanitized) {\n                    this.value = sanitized;\n                }\n            });\n\n            $(document).on('keypress', '.jet-form-builder input[type=\"tel\"], .jet-form-builder input[name*=\"phone\"], .jet-form-builder input[name*=\"telefono\"], .jet-form-builder .phonenumberrow input', function (e) {\n                const char = String.fromCharCode(e.which || e.keyCode);\n                const isDigit = \/\\d\/.test(char);\n                const isPlus = char === '+';\n                const hasPlus = this.value.indexOf('+') !== -1;\n                const cursorAtStart = (this.selectionStart || 0) === 0;\n\n                if (isDigit) return;\n                if (isPlus && !hasPlus && cursorAtStart) return;\n                if (e.which === 0 || e.which === 8) return;\n\n                e.preventDefault();\n            });\n\n            $(document).on('paste', '.jet-form-builder input[type=\"tel\"], .jet-form-builder input[name*=\"phone\"], .jet-form-builder input[name*=\"telefono\"], .jet-form-builder .phonenumberrow input', function () {\n                const input = this;\n                setTimeout(function () {\n                    input.value = sanitizePhoneValue(input.value);\n                }, 0);\n            });\n\n            validateVisibleEmailFields();\n\n            \/\/ Validar cambios abruptos por scripts externos que llenan campos sin disparar eventos (ej. select de aerol\u00ednea)\n            setInterval(function () {\n                if (window.formWasSubmitted) return; \/\/ FIX: Don't trigger changes if the form is already submitting\n\n                $('.jet-form-builder-repeater__row').each(function () {\n                    let elementsToTrigger = [];\n                    $(this).find('.flightrow, .arrivingflightrow, .departingflightrow, .datelegrow, .typeservicerow, select').each(function () {\n                        const $el = $(this);\n                        const currentVal = $el.val();\n                        const lastVal = $el.data('last-val');\n                        if (lastVal !== undefined && lastVal !== currentVal) {\n                            elementsToTrigger.push($el);\n                        }\n                        $el.data('last-val', currentVal);\n                    });\n                    elementsToTrigger.forEach($el => $el.trigger('change'));\n                });\n                updateSubmitButtonState();\n            }, 500);\n\n            $(document).on('blur', '.specialrow', function () {\n                clearTimeout(specialTypingTimer); lastTypedField = null;\n                window.isTypingSpecialInstructions = false; updateSubmitButtonState();\n            });\n\n            $(document).on('click', '.jet-form-builder-repeater__remove, .jet-form-builder-repeater__new', function () {\n                scheduleBackup();\n                setTimeout(function () {\n                    restoreApiContainers(); window.flightError = !checkAllFlightsValid(); updateSubmitButtonState();\n                }, 100);\n            });\n\n            function initializeRows() {\n                $('.jet-form-builder-repeater__row').each(function (index) {\n                    const $row = $(this);\n                    ensureFlightLegTitle($row, index);\n                    const hasData = $row.find('.flightrow').val() || $row.find('.arrivingflightrow').val() || $row.find('.departingflightrow').val();\n                    const hasDate = $row.find('.datelegrow').val();\n\n                    if (hasData && hasDate) {\n                        $row.find('.flight-leg-title').hide(); consultarFlightStats($row);\n                    } else {\n                        setAirportField($row, ''); setFromAirportField($row, ''); setToAirportField($row, '');\n                    }\n                });\n                window.flightError = !checkAllFlightsValid(); scheduleBackup(); updateSubmitButtonState();\n            }\n\n            function ensureFlightLegTitle($row, index) {\n                let title = $row.find('.flight-leg-title');\n                if (!title.length) {\n                    title = $('<h3 class=\"flight-leg-title\" style=\"margin-bottom: 10px; color: #004aad; font-weight: 600; font-size: 16px;\"><\/h3>').prependTo($row.find('.jet-form-builder-repeater__row-fields'));\n                }\n                title.text('Flight leg ' + (index + 1));\n                return title;\n            }\n\n            $(window).on('load', function () { setTimeout(initializeRows, 500); });\n\n            document.addEventListener('submit', function (e) {\n                const form = e.target;\n                if (!form || !form.tagName || form.tagName.toUpperCase() !== 'FORM' || !$(form).closest('.jet-form-builder').length) {\n                    return;\n                }\n\n                if (window.apiFormSkipGlobalSubmitValidation === true) {\n                    window.apiFormSkipGlobalSubmitValidation = false;\n                    return;\n                }\n\n                window.formWasSubmitted = true; \/\/ Block setInterval from triggering more validation changes\n                let hasConnectionErrors = false;\n\n                $('.jet-form-builder-repeater__row').each(function () {\n                    const $row = $(this);\n                    const service = ($row.find('.typeservicerow').val() || '').toLowerCase();\n\n                    \/\/ Guardar el c\u00f3digo universal del vuelo para los payloads posteriores\n                    const $airlineSelect = $row.find('select[name*=\"aerolineas\"]');\n\n                    if (service === 'arrival' || service === 'departure') {\n                        const $flightRow = $row.find('.flightrow');\n                        const rawFlightNumber = ($flightRow.val() || '').toUpperCase();\n                        const normalizedFlightNumber = typeof window.buildUniversalFlightCode === 'function'\n                            ? window.buildUniversalFlightCode(rawFlightNumber, $airlineSelect)\n                            : rawFlightNumber;\n                        if (normalizedFlightNumber !== rawFlightNumber) {\n                            $flightRow.val(normalizedFlightNumber);\n                        }\n                    } else if (service === 'connection') {\n                        const arrivingRaw = ($row.find('.arrivingflightrow').val() || '').toUpperCase();\n                        const $arrivingFlightRow = $row.find('.arrivingflightrow');\n                        const normalizedArrivingFlight = typeof window.buildUniversalFlightCode === 'function'\n                            ? window.buildUniversalFlightCode(arrivingRaw, $airlineSelect)\n                            : arrivingRaw;\n                        if (normalizedArrivingFlight !== arrivingRaw) {\n                            $arrivingFlightRow.val(normalizedArrivingFlight);\n                        }\n\n                        const $departingAirlineSelect = $row.find('select[name*=\"aerolineas_connect\"]');\n                        const departingRaw = ($row.find('.departingflightrow').val() || '').toUpperCase();\n                        const $departingFlightRow = $row.find('.departingflightrow');\n                        const normalizedDepartingFlight = typeof window.buildUniversalFlightCode === 'function'\n                            ? window.buildUniversalFlightCode(departingRaw, $departingAirlineSelect)\n                            : departingRaw;\n                        if (normalizedDepartingFlight !== departingRaw) {\n                            $departingFlightRow.val(normalizedDepartingFlight);\n                        }\n\n                        const containerHtml = $row.find('.flight-leg-api-info-persistent').html() || '';\n                        if (!arrivingRaw || !departingRaw || containerHtml.includes('not found') || containerHtml.includes('required')) {\n                            hasConnectionErrors = true;\n                        }\n                    }\n                });\n\n                const showError = (msgHtml) => {\n                    window.formWasSubmitted = false;\n                    e.preventDefault();\n                    e.stopPropagation();\n                    e.stopImmediatePropagation();\n\n                    let $wrap = $(form).find('.jet-form-builder-messages-wrap');\n                    if (!$wrap.length) {\n                        $(form).append('<div class=\"jet-form-builder-messages-wrap\" data-form-id=\"' + (form.dataset.formId || '') + '\"><\/div>');\n                        $wrap = $(form).find('.jet-form-builder-messages-wrap');\n                    }\n\n                    $wrap.html('<div class=\"jet-form-builder-message jet-form-builder-message--error\">' + msgHtml + '<\/div>');\n                };\n\n                if (hasConnectionErrors) { showError(buildFlightValidationMessageHtml()); return; }\n                if (window.flightError === true) {\n                    showError(buildFlightValidationMessageHtml());\n                    return;\n                }\n                if (window.isTypingSpecialInstructions === true) { showError('Please finish typing in special instructions.'); return; }\n                if (window.activeApiRequests > 0) { showError('Please wait while flight data is loading.'); return; }\n\n                \/\/ Timeout to unlock the form in case the backend throws an error that requires user changes\n                setTimeout(() => {\n                    window.formWasSubmitted = false;\n                }, 5000);\n\n            }, true); \/\/ Use capture phase to ensure this runs BEFORE JetFormBuilder's submit listener\n\n            \/* =========================================================\n               INYECCI\u00d3N NATURAL DEL MENSAJE SIN DUPLICAR CAJAS\n               ========================================================= *\/\n            const successObserver = new MutationObserver(function (mutations) {\n                const existingCustomBox = document.getElementById('fixed-jfb-success-message');\n\n                if (existingCustomBox && window.getComputedStyle(existingCustomBox).display !== 'none' && !existingCustomBox.dataset.textoAgregado) {\n\n                    window.formWasSubmitted = true;\n                    $('.jet-form-builder-row.field-type-submit-field').addClass('d-none');\n                    $('.jet-form-builder__submit').addClass('d-none');\n\n                    $('.jet-form-builder-message--success').hide();\n\n                    existingCustomBox.dataset.textoAgregado = 'true';\n\n                    $(existingCustomBox).find('div').last().append('<span style=\"display:block; font-size: 13px; color: #666; font-style: italic; margin-top: 6px;\">Thank you! There is no need to submit this form again.<\/span>');\n                }\n            });\n\n            successObserver.observe(document.body, { childList: true, subtree: true, attributes: true });\n\n            \/* =========================================================\n               JETFORMBUILDER PAYLOAD INTERCEPTION\n               ========================================================= *\/\n            $(document).on('jet-form-builder\/before-send', function (event, form, requestData) {\n                syncBookingPayloadFields();\n\n                \/\/ requestData is FormData. We need to iterate over it and modify flight numbers\n                \/\/ JetFormBuilder repeater fields usually look like: my_repeater[0][flight]\n\n                let modified = false;\n                const newFormData = new FormData();\n\n                \/\/ Second pass: store flight numbers in universal carrier+number format\n                for (let [key, value] of requestData.entries()) {\n                    let newValue = value;\n\n                    const flightMatch = key.match(\/\\[(\\d+)\\]\\[flight\\]\/);\n                    if (flightMatch && typeof value === 'string') {\n                        const rowIndex = flightMatch[1];\n                        const rawValue = value.toUpperCase();\n                        const $row = $('.jet-form-builder-repeater__row').eq(Number(rowIndex));\n                        const normalizedValue = typeof window.buildUniversalFlightCode === 'function'\n                            ? window.buildUniversalFlightCode(rawValue, $row.find('select[name*=\"aerolineas\"]'))\n                            : rawValue;\n                        if (normalizedValue !== rawValue) {\n                            newValue = normalizedValue;\n                            modified = true;\n                        }\n                    }\n\n                    const arrivingMatch = key.match(\/\\[(\\d+)\\]\\[arriving_flight\\]\/);\n                    if (arrivingMatch && typeof value === 'string') {\n                        const rowIndex = arrivingMatch[1];\n                        const rawValue = value.toUpperCase();\n                        const $row = $('.jet-form-builder-repeater__row').eq(Number(rowIndex));\n                        const normalizedValue = typeof window.buildUniversalFlightCode === 'function'\n                            ? window.buildUniversalFlightCode(rawValue, $row.find('select[name*=\"aerolineas\"]'))\n                            : rawValue;\n                        if (normalizedValue !== rawValue) {\n                            newValue = normalizedValue;\n                            modified = true;\n                        }\n                    }\n\n                    const departingMatch = key.match(\/\\[(\\d+)\\]\\[departing_flight\\]\/);\n                    if (departingMatch && typeof value === 'string') {\n                        const rowIndex = departingMatch[1];\n                        const rawValue = value.toUpperCase();\n                        const $row = $('.jet-form-builder-repeater__row').eq(Number(rowIndex));\n                        const normalizedValue = typeof window.buildUniversalFlightCode === 'function'\n                            ? window.buildUniversalFlightCode(rawValue, $row.find('select[name*=\"aerolineas_connect\"]'))\n                            : rawValue;\n                        if (normalizedValue !== rawValue) {\n                            newValue = normalizedValue;\n                            modified = true;\n                        }\n                    }\n\n                    newFormData.append(key, newValue);\n                }\n\n                const customPayloadFields = {\n                    additional_passengers: $('#additional_passengers_payload').val() || '[]',\n                    booking_for_someone_else: $('#booking_for_someone_else').val() || 'no',\n\n                    reservation_contact_same_as_passengers: $('#reservation_contact_same_as_passengers').val() || '0',\n                    same_as_previously_entered: $('#same_as_previously_entered_payload').val() || 'no',\n                    booking_for_other_meta: $('#booking_for_other_meta_payload').val() || '{}',\n                    booked_by_name: $('#booked_by_name_payload').val() || '',\n                    booked_by_email: $('#booked_by_email_payload').val() || '',\n                    booked_by_phone: $('#booked_by_phone_payload').val() || '',\n                    reservation_for_other_name: $('#reservation_for_other_name_payload').val() || '',\n                    reservation_for_other_phone: $('#reservation_for_other_phone_payload').val() || '',\n                    reservation_for_other_additional_passengers: $('#reservation_for_other_additional_passengers_payload').val() || '[]'\n                };\n\n                Object.keys(customPayloadFields).forEach(function (key) {\n                    newFormData.delete(key);\n                    newFormData.append(key, customPayloadFields[key]);\n                });\n                modified = true;\n\n                if (modified) {\n                    \/\/ Overwrite the original FormData completely\n                    for (let [key] of requestData.entries()) {\n                        requestData.delete(key);\n                    }\n                    for (let [key, value] of newFormData.entries()) {\n                        requestData.append(key, value);\n                    }\n                }\n            });\n\n        });\n    <\/script>\n\n    <!-- PASSENGERS & LUGGAGE COMBOBOX -->\n\n    <style>\n        \/* Instantly hide original inputs *\/\n        #number_of_passengers,\n        #number_of_luggage {\n            display: none !important;\n        }\n\n        \/* Main selector container *\/\n        .additional-passengers-row {\n            width: 100%;\n            clear: both;\n            margin-top: 18px;\n            display: block;\n        }\n\n        .booking-extra-label {\n            display: block;\n            margin-bottom: 10px;\n            color: #444;\n            font-size: 13px;\n            font-weight: 600;\n            text-transform: uppercase;\n            letter-spacing: 0.5px;\n        }\n\n        #passenger-luggage-selector {\n            position: relative;\n            display: inline-block;\n            font-family: Arial, sans-serif;\n            cursor: pointer;\n            width: 25%;\n            user-select: none;\n            border: 1px solid #dce1e6;\n            padding: 12px 18px;\n            border-radius: 0px 15px 15px 0px;\n            background: #fff;\n            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);\n            transition: all 0.3s ease;\n            z-index: 100;\n        }\n\n        @media (max-width: 768px) {\n            #passenger-luggage-selector {\n                width: 100%;\n                border-radius: 15px !important;\n                display: block;\n            }\n        }\n\n        #passenger-luggage-selector:hover {\n            border-color: #3498db;\n            box-shadow: 0 4px 12px rgba(52, 152, 219, 0.15);\n        }\n\n        #passenger-luggage-selector.active {\n            border-color: #3498db;\n            box-shadow: 0 4px 12px rgba(52, 152, 219, 0.25);\n        }\n\n        #passenger-luggage-display {\n            display: flex;\n            justify-content: space-between;\n            align-items: center;\n            font-size: 16px;\n            color: #2c3e50;\n            font-weight: 500;\n        }\n\n        #passenger-luggage-display .arrow {\n            transition: transform 0.3s ease;\n            color: #7f8c8d;\n            font-size: 12px;\n            margin-left: 10px;\n        }\n\n        #passenger-luggage-selector.active .arrow {\n            transform: rotate(180deg);\n            color: #3498db;\n        }\n\n        #passenger-luggage-dropdown {\n            position: absolute;\n            top: 100%;\n            left: 0;\n            width: 100%;\n            background: #fff;\n            border: 1px solid #dce1e6;\n            border-radius: 10px;\n            margin-top: 8px;\n            padding: 20px;\n            box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);\n            display: none;\n            z-index: 1000;\n            animation: fadeIn 0.2s ease-out;\n        }\n\n        @keyframes fadeIn {\n            from {\n                opacity: 0;\n                transform: translateY(-10px);\n            }\n\n            to {\n                opacity: 1;\n                transform: translateY(0);\n            }\n        }\n\n        .counter-row {\n            display: flex;\n            justify-content: space-between;\n            align-items: center;\n            margin-bottom: 20px;\n            font-size: 16px;\n            color: #2c3e50;\n        }\n\n        .counter-row:last-child {\n            margin-bottom: 0;\n        }\n\n        .counter-label {\n            font-weight: 500;\n        }\n\n        .counter-controls {\n            display: flex;\n            align-items: center;\n            gap: 12px;\n        }\n\n        .counter-row button {\n            width: 36px;\n            height: 36px;\n            border: 1px solid #dce1e6;\n            background: #f8f9fa;\n            border-radius: 8px;\n            font-weight: bold;\n            cursor: pointer;\n            font-size: 18px;\n            line-height: 1;\n            display: flex;\n            align-items: center;\n            justify-content: center;\n            transition: all 0.2s ease;\n            color: #2c3e50;\n        }\n\n        .counter-row button:hover {\n            background: #e9ecef;\n            border-color: #adb5bd;\n        }\n\n        .counter-row button:active {\n            background: #dee2e6;\n        }\n\n        .counter-row button:disabled {\n            background: #f8f9fa;\n            border-color: #e9ecef;\n            color: #adb5bd;\n            cursor: not-allowed;\n        }\n\n        .counter-row span.value {\n            display: inline-block;\n            width: 40px;\n            text-align: center;\n            font-weight: 600;\n            font-size: 18px;\n            color: #2c3e50;\n        }\n\n  .booking-extra-grid {\n    display: grid;\n    grid-template-columns: 1fr; \/* Esto alinea las cajas verticalmente (1 sola columna) *\/\n    gap: 14px;\n    max-width: 400px; \/* Esto hace que las cajas sean m\u00e1s angostas *\/\n}\n\n        .booking-extra-field label {\n            display: block;\n            margin-bottom: 8px;\n            color: #444;\n            font-size: 13px;\n            font-weight: 600;\n            text-transform: uppercase;\n            letter-spacing: 0.5px;\n        }\n\n        .booking-extra-field input[type=\"text\"] {\n            width: 100%;\n            min-height: 48px;\n            padding: 0 14px;\n            border: 1px solid #c7ccd3;\n            border-radius: 4px;\n            background: #ffffff;\n            color: #4f4f4f;\n            font-size: 15px;\n            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);\n        }\n\n        .booking-extra-field input[type=\"text\"]:focus {\n            outline: none;\n            border-color: #282a5c;\n            box-shadow: 0 0 0 3px rgba(40, 42, 92, 0.08);\n        }\n\n        .booking-extra-help {\n            margin-top: 8px;\n            color: #6b7280;\n            font-size: 13px;\n        }\n\n        .reservation-modal {\n            position: fixed;\n            inset: 0;\n            z-index: 99999;\n            display: none;\n            align-items: center;\n            justify-content: center;\n            padding: 20px;\n            background: rgba(16, 24, 40, 0.45);\n        }\n\n        .reservation-modal.is-open {\n            display: flex;\n        }\n\n        .reservation-modal__dialog {\n            width: min(620px, 100%);\n            background: #ffffff;\n            border-radius: 18px;\n            box-shadow: 0 30px 80px rgba(15, 23, 42, 0.22);\n            overflow: hidden;\n            border: 1px solid rgba(226, 232, 240, 0.9);\n        }\n\n        .reservation-modal__header {\n            padding: 22px 24px 10px;\n        }\n\n        .reservation-modal__title {\n            margin: 0;\n            color: #282a5c;\n            font-size: 24px;\n            line-height: 1.2;\n            font-weight: 600;\n        }\n\n        .reservation-modal__subtitle {\n            margin: 8px 0 0;\n            color: #5b6472;\n            font-size: 15px;\n            line-height: 1.5;\n        }\n\n        .reservation-modal__body {\n            padding: 10px 24px 24px;\n        }\n\n        .reservation-modal__actions {\n            display: flex;\n            flex-wrap: wrap;\n            gap: 12px;\n            margin-top: 20px;\n        }\n\n        .reservation-modal__btn {\n            border: none;\n            border-radius: 10px;\n            min-height: 46px;\n            padding: 0 20px;\n            font-size: 15px;\n            font-weight: 600;\n            cursor: pointer;\n            transition: background 0.2s ease, transform 0.2s ease;\n        }\n\n        .reservation-modal__btn:hover {\n            transform: translateY(-1px);\n        }\n\n        .reservation-modal__btn--primary {\n            background: #282a5c;\n            color: #ffffff;\n        }\n\n        .reservation-modal__btn--primary:hover {\n            background: #1c1e42;\n        }\n\n        .reservation-modal__btn--secondary {\n            background: #eef2f7;\n            color: #2c3e50;\n        }\n\n        .reservation-modal__btn--secondary:hover {\n            background: #e2e8f0;\n        }\n\n        .reservation-modal__step {\n            display: none;\n        }\n\n        .reservation-modal__step.is-active {\n            display: block;\n        }\n\n        .reservation-modal__checkbox {\n            display: flex;\n            align-items: center;\n            gap: 10px;\n            margin: 4px 0 20px;\n            color: #334155;\n            font-size: 14px;\n            font-weight: 500;\n        }\n\n        .reservation-modal__checkbox input {\n            width: 18px;\n            height: 18px;\n        }\n\n        body.reservation-modal-open,\n        html.reservation-modal-open {\n            overflow: hidden !important;\n            height: 100%;\n        }\n    <\/style>\n\n    \n    <script src=\"https:\/\/code.jquery.com\/jquery-3.7.1.min.js\"><\/script>\n\n    <script>\n        jQuery(document).ready(function ($) {\n            const bookingPrefill = {\"service_type\":\"\",\"travel_date\":\"\",\"service_date\":\"\",\"passengers\":0,\"luggage\":1,\"email\":\"\",\"legs\":[]};\n            let submitBypass = false;\n            let decisionCaptured = false;\n            let bookingExperienceReady = false;\n            let isSyncingPassengerLuggage = false;\n            let luggageManuallyModified = false;\n\n            function parseCount(value, fallback) {\n                const parsed = parseInt(value, 10);\n                return Number.isFinite(parsed) ? parsed : fallback;\n            }\n\n            function getForm() {\n                return $('.jet-form-builder').first();\n            }\n\n            function getPassengerInput() {\n                return $('#number_of_passengers').first();\n            }\n\n            function getLuggageInput() {\n                return $('#number_of_luggage').first();\n            }\n\n            function getPrimaryPassengerField() {\n                const $candidates = getForm().find('input[type=\"text\"], input:not([type])').filter(function () {\n                    const $field = $(this);\n                    if (!$field.is(':visible')) return false;\n\n                    const haystack = [\n                        this.name || '',\n                        this.id || '',\n                        $field.attr('data-field-name') || '',\n                        $field.attr('placeholder') || ''\n                    ].join(' ').toLowerCase();\n\n                    const excluded = ['airport', 'flight', 'airline', 'phone', 'special', 'company', 'city', 'hotel', 'date'];\n                    if (excluded.some(fragment => haystack.includes(fragment))) {\n                        return false;\n                    }\n\n                    return haystack.includes('name') || haystack.includes('passenger');\n                });\n\n                if ($candidates.length) {\n                    return $candidates.first();\n                }\n\n                return getForm().find('input[type=\"text\"], input:not([type])').filter(':visible').first();\n            }\n\n            function ensureBookingFields() {\n                const $form = getForm();\n                if (!$form.length) return false;\n\n                function ensureHiddenPayloadField(id, name, defaultValue) {\n                    let $field = $('#' + id);\n\n                    if (!$field.length) {\n                        $field = $form.find('input[name=\"' + name + '\"]').first();\n                        if ($field.length) {\n                            $field.attr('id', id);\n                        }\n                    }\n\n                    if (!$field.length) {\n                        $form.append('<input type=\"hidden\" id=\"' + id + '\" name=\"' + name + '\" value=\"' + $('<div>').text(defaultValue).html() + '\">');\n                        $field = $('#' + id);\n                    }\n\n                    if ($field.length && (!$field.val() || $field.val() === '')) {\n                        $field.val(defaultValue);\n                    }\n\n                    return $field;\n                }\n\n                ensureHiddenPayloadField('booking_for_someone_else', 'booking_for_someone_else', 'no');\n                ensureHiddenPayloadField('reservation_contact_same_as_passengers', 'reservation_contact_same_as_passengers', '0');\n                ensureHiddenPayloadField('same_as_previously_entered_payload', 'same_as_previously_entered', 'no');\n                ensureHiddenPayloadField('booking_for_other_meta_payload', 'booking_for_other_meta', '{}');\n                ensureHiddenPayloadField('booked_by_name_payload', 'booked_by_name', '');\n                ensureHiddenPayloadField('booked_by_email_payload', 'booked_by_email', '');\n                ensureHiddenPayloadField('booked_by_phone_payload', 'booked_by_phone', '');\n                ensureHiddenPayloadField('additional_passengers_payload', 'additional_passengers', '[]');\n                ensureHiddenPayloadField('reservation_for_other_name_payload', 'reservation_for_other_name', '');\n                ensureHiddenPayloadField('reservation_for_other_phone_payload', 'reservation_for_other_phone', '');\n                ensureHiddenPayloadField('reservation_for_other_additional_passengers_payload', 'reservation_for_other_additional_passengers', '[]');\n\n\n                return true;\n            }\n\n            function ensurePassengerSelector() {\n                const $passengerInput = getPassengerInput();\n                const $luggageInput = getLuggageInput();\n                const selectorHtml = '\\\n                                                <div id=\"passenger-luggage-selector\">\\\n                                                    <div id=\"passenger-luggage-display\">\\\n                                                        <span><span class=\"passengers-display\">1 Passenger<\/span> - <span class=\"luggage-display\">1 Luggage<\/span><\/span>\\\n                                                        <span class=\"arrow\">\u25b2<\/span>\\\n                                                    <\/div>\\\n                                                    <div id=\"passenger-luggage-dropdown\">\\\n                                                        <div class=\"counter-row\">\\\n                                                            <span class=\"counter-label\">Passengers<\/span>\\\n                                                            <div class=\"counter-controls\">\\\n                                                                <button type=\"button\" class=\"minus-passenger\" aria-label=\"Decrease passengers\">-<\/button>\\\n                                                                <span class=\"value\" id=\"passenger-count\">1<\/span>\\\n                                                                <button type=\"button\" class=\"plus-passenger\" aria-label=\"Increase passengers\">+<\/button>\\\n                                                            <\/div>\\\n                                                        <\/div>\\\n                                                        <div class=\"counter-row\">\\\n                                                            <span class=\"counter-label\">Luggage<\/span>\\\n                                                            <div class=\"counter-controls\">\\\n                                                                <button type=\"button\" class=\"minus-luggage\" aria-label=\"Decrease luggage\">-<\/button>\\\n                                                                <span class=\"value\" id=\"luggage-count\">1<\/span>\\\n                                                                <button type=\"button\" class=\"plus-luggage\" aria-label=\"Increase luggage\">+<\/button>\\\n                                                            <\/div>\\\n                                                        <\/div>\\\n                                                    <\/div>\\\n                                                <\/div>';\n                if (!$passengerInput.length || !$luggageInput.length) return false;\n\n                const $anchorRow = $luggageInput.closest('.jet-form-builder-row').length\n                    ? $luggageInput.closest('.jet-form-builder-row')\n                    : $passengerInput.closest('.jet-form-builder-row');\n\n                if (!$('#passenger-luggage-selector').length) {\n                    if ($anchorRow.length) {\n                        $anchorRow.after(selectorHtml);\n                    } else {\n                        $passengerInput.after(selectorHtml);\n                    }\n                }\n\n                return true;\n            }\n\n            function ensureAdditionalPassengerSection() {\n                if ($('#additional-passengers-section').length) return true;\n\n                const $form = getForm();\n                if (!$form.length) return false;\n\n                const additionalPassengersHtml = '\\\n                                                <div class=\"jet-form-builder-row additional-passengers-row\" id=\"additional-passengers-section\" style=\"display:none;\">\\\n                                                    <label class=\"booking-extra-label\">Additional Passengers<\/label>\\\n                                                    <div id=\"additional-passengers-fields\" class=\"booking-extra-grid\"><\/div>\\\n                                                    <div class=\"booking-extra-help\">Add the names of the extra passengers travelling with the main passenger.<\/div>\\\n                                                <\/div>';\n\n                const $serviceAdvisory = $form.find('.avinf').first();\n                const $repeaterRow = $form.find('.jet-form-builder-row.field-type-repeater-field').first();\n                const $passengerHiddenRow = getPassengerInput().closest('.jet-form-builder-row');\n\n                if ($serviceAdvisory.length) {\n                    $serviceAdvisory.before(additionalPassengersHtml);\n                } else if ($repeaterRow.length) {\n                    $repeaterRow.before(additionalPassengersHtml);\n                } else if ($passengerHiddenRow.length) {\n                    $passengerHiddenRow.before(additionalPassengersHtml);\n                } else {\n                    $form.append(additionalPassengersHtml);\n                }\n\n                return $('#additional-passengers-section').length > 0;\n            }\n\n            function ensureReservationModal() {\n                const $form = getForm();\n                if (!$form.length || $('#reservation-for-others-modal').length) return;\n\n                const modalHtml = '\\\n                                                <div class=\"reservation-modal\" id=\"reservation-for-others-modal\" aria-hidden=\"true\">\\\n                                                    <div class=\"reservation-modal__dialog\" role=\"dialog\" aria-modal=\"true\" aria-labelledby=\"reservation-modal-title\">\\\n                                                        <div class=\"reservation-modal__header\">\\\n                                                            <h3 class=\"reservation-modal__title\" id=\"reservation-modal-title\">Are you making this reservation for someone else?<\/h3>\\\n                                                            <p class=\"reservation-modal__subtitle\">If not, we will submit the booking request normally. If yes, we will include the traveller details below.<\/p>\\\n                                                        <\/div>\\\n                                                        <div class=\"reservation-modal__body\">\\\n                                                            <div class=\"reservation-modal__step is-active\" id=\"reservation-modal-step-question\">\\\n                                                                <div class=\"reservation-modal__actions\">\\\n                                                                    <button type=\"button\" class=\"reservation-modal__btn reservation-modal__btn--primary\" id=\"reservation-modal-yes\">Yes<\/button>\\\n                                                                    <button type=\"button\" class=\"reservation-modal__btn reservation-modal__btn--secondary\" id=\"reservation-modal-no\">No<\/button>\\\n                                                                <\/div>\\\n                                                            <\/div>\\\n                                                            <div class=\"reservation-modal__step\" id=\"reservation-modal-step-details\">\\\n                                                                <label class=\"reservation-modal__checkbox\">\\\n                                                                    <input type=\"checkbox\" id=\"reservation-same-as-previously-entered\">\\\n                                                                    <span>Same as previously entered?<\/span>\\\n                                                                <\/label>\\\n                                                                <div class=\"booking-extra-grid\">\\\n                                                                    <div class=\"booking-extra-field\">\\\n                                                                        <label for=\"reservation_for_other_name\">Passenger Name<\/label>\\\n                                                                        <input type=\"text\" id=\"reservation_for_other_name\" data-booking-field=\"reservation-name\" disabled>\\\n                                                                    <\/div>\\\n                                                                    <div class=\"booking-extra-field\">\\\n                                                                        <label for=\"reservation_for_other_phone\">Passenger Phone<\/label>\\\n                                                                        <input type=\"tel\" id=\"reservation_for_other_phone\" data-booking-field=\"reservation-phone\" disabled>\\\n                                                                    <\/div>\\\n                                                                <\/div>\\\n                                                                <div id=\"reservation-other-passengers-wrapper\" style=\"margin-top:14px; display:none;\">\\\n                                                                    <label class=\"booking-extra-label\">Additional Passengers<\/label>\\\n                                                                    <div id=\"reservation-other-passengers-fields\" class=\"booking-extra-grid\"><\/div>\\\n                                                                <\/div>\\\n                                                                <div class=\"reservation-modal__actions\">\\\n                                                                    <button type=\"button\" class=\"reservation-modal__btn reservation-modal__btn--primary\" id=\"reservation-modal-confirm\">Continue<\/button>\\\n                                                                    <button type=\"button\" class=\"reservation-modal__btn reservation-modal__btn--secondary\" id=\"reservation-modal-back\">Back<\/button>\\\n                                                                <\/div>\\\n                                                            <\/div>\\\n                                                        <\/div>\\\n                                                    <\/div>\\\n                                                <\/div>';\n\n                $form.append(modalHtml);\n            }\n\n            function renderAdditionalPassengerFields(passengers) {\n                ensurePassengerSelector();\n                ensureAdditionalPassengerSection();\n\n                const extraPassengers = Math.max(0, passengers - 1);\n                const $section = $('#additional-passengers-section');\n                const $container = $('#additional-passengers-fields');\n\n                if (!$section.length || !$container.length) return;\n\n                const previousValues = $container.find('input').map(function () {\n                    return $(this).val();\n                }).get();\n\n                if (extraPassengers === 0) {\n                    $container.empty();\n                    $section.hide();\n                    return;\n                }\n\n                let html = '';\n                for (let i = 0; i < extraPassengers; i += 1) {\n                    const index = i + 2;\n                    const value = previousValues[i] || '';\n                    html += '\\\n                                                    <div class=\"booking-extra-field\">\\\n                                                        <label for=\"additional_passenger_' + index + '\">Passenger ' + index + '<\/label>\\\n                                                        <input type=\"text\" id=\"additional_passenger_' + index + '\" data-booking-field=\"additional-passenger\" value=\"' + $('<div>').text(value).html() + '\">\\\n                                                    <\/div>';\n                }\n\n                $container.html(html);\n                $section.show();\n            }\n\n            function renderReservationPassengerFields(passengers) {\n                ensurePassengerSelector();\n\n                const extraPassengers = Math.max(0, passengers - 1);\n                const $wrapper = $('#reservation-other-passengers-wrapper');\n                const $container = $('#reservation-other-passengers-fields');\n\n                if (!$wrapper.length || !$container.length) return;\n\n                const previousValues = $container.find('input').map(function () {\n                    return $(this).val();\n                }).get();\n\n                if (extraPassengers === 0) {\n                    $container.empty();\n                    $wrapper.hide();\n                    return;\n                }\n\n                let html = '';\n                for (let i = 0; i < extraPassengers; i += 1) {\n                    const index = i + 2;\n                    const value = previousValues[i] || '';\n                    html += '\\\n                                                    <div class=\"booking-extra-field\">\\\n                                                        <label for=\"reservation_for_other_additional_passenger_' + index + '\">Passenger ' + index + '<\/label>\\\n                                                        <input type=\"text\" id=\"reservation_for_other_additional_passenger_' + index + '\" data-booking-field=\"reservation-additional-passenger\" value=\"' + $('<div>').text(value).html() + '\" disabled>\\\n                                                    <\/div>';\n                }\n\n                $container.html(html);\n                $wrapper.show();\n            }\n\n            function getAdditionalPassengerValues() {\n                return $('#additional-passengers-fields input').map(function () {\n                    return ($(this).val() || '').trim();\n                }).get().filter(function (value) {\n                    return value !== '';\n                });\n            }\n\n            function getReservationAdditionalPassengerValues() {\n                return $('#reservation-other-passengers-fields input').map(function () {\n                    return ($(this).val() || '').trim();\n                }).get().filter(function (value) {\n                    return value !== '';\n                });\n            }\n\n            function syncBookingPayloadFields() {\n                ensureBookingFields();\n\n                const additionalPassengers = getAdditionalPassengerValues();\n                const reservationOtherName = (($('#reservation_for_other_name').val() || '').trim());\n                const reservationOtherPhone = (($('#reservation_for_other_phone').val() || '').trim());\n                const reservationAdditionalPassengers = getReservationAdditionalPassengerValues();\n                const sameAsPreviouslyEntered = $('#reservation-same-as-previously-entered').is(':checked');\n                const bookingForSomeoneElse = ($('#booking_for_someone_else').val() || 'no').toLowerCase() === 'yes';\n                const bookedByName = (getPrimaryPassengerField().val() || '').trim();\n                const bookedByEmail = (getPrimaryEmailField().val() || '').trim();\n                const bookedByPhone = (getPrimaryPhoneField().val() || '').trim();\n                const bookingMeta = {\n                    booking_for_someone_else: bookingForSomeoneElse ? 'yes' : 'no',\n                    same_as_previously_entered: sameAsPreviouslyEntered ? 'yes' : 'no',\n                    reservation_contact_same_as_passengers: sameAsPreviouslyEntered ? '1' : '0',\n                    reservation_for_other_name: reservationOtherName,\n                    reservation_for_other_phone: reservationOtherPhone,\n                    reservation_for_other_additional_passengers: reservationAdditionalPassengers,\n                    booked_by_name: bookedByName,\n                    booked_by_email: bookedByEmail,\n                    booked_by_phone: bookedByPhone\n                };\n\n                $('#additional_passengers_payload').val(JSON.stringify(additionalPassengers));\n                $('#booking_for_other_meta_payload').val(JSON.stringify(bookingMeta));\n                $('#booked_by_name_payload').val(bookedByName);\n                $('#booked_by_email_payload').val(bookedByEmail);\n                $('#booked_by_phone_payload').val(bookedByPhone);\n                $('#reservation_for_other_name_payload').val(reservationOtherName);\n                $('#reservation_for_other_phone_payload').val(reservationOtherPhone);\n                $('#reservation_for_other_additional_passengers_payload').val(JSON.stringify(reservationAdditionalPassengers));\n                $('#reservation_contact_same_as_passengers').val(sameAsPreviouslyEntered ? '1' : '0');\n                $('#same_as_previously_entered_payload').val(sameAsPreviouslyEntered ? 'yes' : 'no');\n\n            }\n\n            function escapeHtml(value) {\n                return String(value || '')\n                    .replace(\/&\/g, '&amp;')\n                    .replace(\/<\/g, '&lt;')\n                    .replace(\/>\/g, '&gt;')\n                    .replace(\/\"\/g, '&quot;')\n                    .replace(\/'\/g, '&#039;');\n            }\n\n            function getFieldValidationMessage($field) {\n                if (!$field || !$field.length) {\n                    return 'This field is required.';\n                }\n\n                const type = (($field.attr('type') || '') + '').toLowerCase();\n                const value = (($field.val() || '') + '').trim();\n                const metadata = [\n                    $field.attr('id') || '',\n                    $field.attr('name') || '',\n                    $field.attr('placeholder') || '',\n                    $field.attr('data-field-name') || '',\n                    $field.closest('.booking-extra-field, .jet-form-builder-row').find('label').first().text() || ''\n                ].join(' ').toLowerCase();\n                const labelText = (($field.closest('.booking-extra-field, .jet-form-builder-row').find('label').first().text() || '').toString().trim());\n                const passengerMatch = labelText.match(\/Passenger\\s+(\\d+)\/i);\n\n                if (type === 'email') {\n                    return value === ''\n                        ? 'Please enter email address.'\n                        : 'Please enter a valid email address.';\n                }\n\n                if (metadata.includes('phone') || metadata.includes('telefono')) {\n                    return 'Please enter phone number.';\n                }\n\n                if (metadata.includes('type_of_service') || metadata.includes('type of service') || metadata.includes('typeservicerow')) {\n                    return 'Please select type of service.';\n                }\n\n                if (type === 'date' || metadata.includes('datelegrow') || metadata.includes('travel date') || metadata.includes('date')) {\n                    return 'Please select date.';\n                }\n\n                if (metadata.includes('reservation_for_other_name')) {\n                    return 'Please enter the passenger name for this reservation.';\n                }\n\n                if (metadata.includes('reservation_for_other_phone') || metadata.includes('reservation-phone')) {\n                    return 'Please enter the passenger phone number for this reservation.';\n                }\n\n                if (passengerMatch) {\n                    return 'Please enter the name for passenger ' + passengerMatch[1] + '.';\n                }\n\n                if (metadata.includes('additional_passenger') || metadata.includes('reservation-additional-passenger') || metadata.includes('passenger')) {\n                    return 'Please enter passenger name.';\n                }\n\n                if (metadata.includes('name')) {\n                    return 'Please enter name.';\n                }\n\n                return 'This field is required.';\n            }\n\n            function setFieldInvalidState($field, isInvalid) {\n                if (!$field || !$field.length) return;\n                $field.removeClass('is-invalid').attr('aria-invalid', isInvalid ? 'true' : 'false');\n\n                if ($field.is('select') && $field.next('.select2').length) {\n                    $field.next('.select2').removeClass('is-invalid-select2');\n                }\n\n                const $container = $field.closest('.booking-extra-field, .jet-form-builder-row');\n                $container.find('.jet-form-builder__field-error').remove();\n            }\n\n            function isSelectPlaceholderValue($field) {\n                if (!$field.is('select')) return false;\n                const value = ($field.val() || '').toString().trim().toLowerCase();\n                return value === '' || value === 'type of service' || value === 'typeofservice';\n            }\n\n            function isFlightRelatedField($field) {\n                if (!$field || !$field.length) return false;\n\n                const metadata = [\n                    $field.attr('id') || '',\n                    $field.attr('name') || '',\n                    $field.attr('class') || '',\n                    $field.attr('data-field-name') || ''\n                ].join(' ').toLowerCase();\n\n                return metadata.includes('flightrow') ||\n                    metadata.includes('arrivingflightrow') ||\n                    metadata.includes('departingflightrow') ||\n                    metadata.includes('typeservicerow') ||\n                    metadata.includes('datelegrow') ||\n                    metadata.includes('aerolineas') ||\n                    metadata.includes('airport') ||\n                    $field.closest('.jet-form-builder-repeater__row').length > 0;\n            }\n\n            function isMainBookingFieldRequired($field) {\n                if (!$field || !$field.length) return false;\n\n                const isRequired = $field.prop('required') ||\n                    $field.attr('aria-required') === 'true' ||\n                    $field.closest('.jet-form-builder-row').find('.jet-form-builder__required').length > 0;\n\n                if (isRequired) {\n                    return true;\n                }\n\n                const metadata = [\n                    $field.attr('id') || '',\n                    $field.attr('name') || '',\n                    $field.attr('placeholder') || '',\n                    $field.attr('data-field-name') || '',\n                    $field.closest('.jet-form-builder-row').find('label').first().text() || ''\n                ].join(' ').toLowerCase();\n\n                if (($field.attr('type') || '').toLowerCase() === 'email') {\n                    return true;\n                }\n\n                return metadata.includes('name') || metadata.includes('email') || metadata.includes('phone') || metadata.includes('telefono');\n            }\n\n            function getPrimaryEmailField() {\n                return getForm().find('input[type=\"email\"]').filter(':visible').first();\n            }\n\n            function getPrimaryPhoneField() {\n                return getForm().find('input[type=\"tel\"], input[name*=\"phone\"], input[name*=\"telefono\"], .phonenumberrow input').filter(':visible').first();\n            }\n\n            function getCoreBookingFields() {\n                const fields = [];\n                const seen = new Set();\n\n                [getPrimaryPassengerField(), getPrimaryEmailField(), getPrimaryPhoneField()].forEach(function ($field) {\n                    if (!$field || !$field.length) return;\n                    const key = $field.attr('id') || $field.attr('name') || String(fields.length);\n                    if (seen.has(key)) return;\n                    seen.add(key);\n                    fields.push($field);\n                });\n\n                return fields;\n            }\n\n            function getAdditionalPassengerFields() {\n                return $('#additional-passengers-fields input');\n            }\n\n            function isMainFieldValid($field) {\n                if (!$field || !$field.length) return true;\n\n                const value = ($field.val() || '').toString().trim();\n                const type = (($field.attr('type') || '') + '').toLowerCase();\n\n                if (type === 'email') {\n                    return \/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$\/.test(value);\n                }\n\n                return value !== '' && !isSelectPlaceholderValue($field);\n            }\n\n            function showCoreFieldValidationFeedback($field) {\n                if (!$field || !$field.length) return;\n\n                const type = (($field.attr('type') || '') + '').toLowerCase();\n                const sharedHelpers = window.apiFormFieldHelpers || {};\n                const validateEmail = typeof validateEmailField === 'function'\n                    ? validateEmailField\n                    : function ($input, options) {\n                        if (typeof sharedHelpers.validateEmailField === 'function') {\n                            return sharedHelpers.validateEmailField($input, options);\n                        }\n                        return true;\n                    };\n                const validateRequired = typeof validateRequiredField === 'function'\n                    ? validateRequiredField\n                    : function ($currentField, options) {\n                        if (typeof sharedHelpers.validateRequiredField === 'function') {\n                            return sharedHelpers.validateRequiredField($currentField, options);\n                        }\n                        return true;\n                    };\n                const getEmailFeedback = typeof getEmailFeedbackElement === 'function'\n                    ? getEmailFeedbackElement\n                    : function ($input) {\n                        if (typeof sharedHelpers.getEmailFeedbackElement === 'function') {\n                            return sharedHelpers.getEmailFeedbackElement($input);\n                        }\n\n                        let $feedback = $input.siblings('.email-bootstrap-feedback').first();\n                        if (!$feedback.length) {\n                            $feedback = $('<div class=\"email-bootstrap-feedback\">Please enter a valid email address.<\/div>');\n                            $input.after($feedback);\n                        }\n                        return $feedback;\n                    };\n                const getRequiredFeedback = typeof getRequiredFeedbackElement === 'function'\n                    ? getRequiredFeedbackElement\n                    : function ($currentField) {\n                        if (typeof sharedHelpers.getRequiredFeedbackElement === 'function') {\n                            return sharedHelpers.getRequiredFeedbackElement($currentField);\n                        }\n\n                        let $anchor = $currentField;\n                        if ($currentField.is('select') && $currentField.next('.select2').length) {\n                            $anchor = $currentField.next('.select2');\n                        }\n\n                        let $feedback = $anchor.siblings('.required-bootstrap-feedback').first();\n                        if (!$feedback.length) {\n                            $feedback = $('<div class=\"required-bootstrap-feedback\">This field is required.<\/div>');\n                            $anchor.after($feedback);\n                        }\n                        return $feedback;\n                    };\n\n                if (type === 'email') {\n                    $field.data('required-touched', true);\n                    getEmailFeedback($field).text(getFieldValidationMessage($field));\n                    validateEmail($field, { showFloating: true, hideDelay: 5000 });\n                    return;\n                }\n\n                $field.data('required-touched', true);\n                getRequiredFeedback($field).text(getFieldValidationMessage($field));\n                validateRequired($field, { showFloating: true, hideDelay: 5000 });\n            }\n\n            function revealBlockedSubmitValidation() {\n                window.apiFormRevealValidationSummary = true;\n\n                getCoreBookingFields().forEach(function ($field) {\n                    if (!isMainFieldValid($field)) {\n                        showCoreFieldValidationFeedback($field);\n                    }\n                });\n\n                getAdditionalPassengerFields().each(function () {\n                    const $field = $(this);\n                    if ((($field.val() || '').toString().trim()) === '') {\n                        showCoreFieldValidationFeedback($field);\n                    }\n                });\n\n                refreshCustomBookingValidationState();\n            }\n\n            function getValidationSummaryWrap() {\n                const $form = getForm();\n                if (!$form.length) return $();\n\n                let $wrap = $form.find('#api-form-validation-summary').first();\n                if ($wrap.length) return $wrap;\n\n                const html = '<div id=\"api-form-validation-summary\" class=\"jet-form-builder-messages-wrap\" style=\"display:none;\"><div class=\"jet-form-builder-message jet-form-builder-message--error\"><\/div><\/div>';\n                const $submitRow = $form.find('.jet-form-builder-row.field-type-submit-field').first();\n\n                if ($submitRow.length) {\n                    $submitRow.after(html);\n                } else {\n                    $form.append(html);\n                }\n\n                return $form.find('#api-form-validation-summary').first();\n            }\n\n            function renderValidationSummary(messages) {\n                const uniqueMessages = [];\n\n                (messages || []).forEach(function (message) {\n                    const normalized = String(message || '').trim();\n                    if (normalized && uniqueMessages.indexOf(normalized) === -1) {\n                        uniqueMessages.push(normalized);\n                    }\n                });\n\n                const $wrap = getValidationSummaryWrap();\n                if (!$wrap.length) return;\n\n                const shouldReveal = window.apiFormRevealValidationSummary === true || $('.jet-form-builder__field-error').length > 0;\n\n                if (!uniqueMessages.length || !shouldReveal) {\n                    $wrap.hide().find('.jet-form-builder-message').empty();\n                    return;\n                }\n\n                const listHtml = '<ul style=\"margin:0; padding-left:18px;\">' + uniqueMessages.map(function (message) {\n                    return '<li>' + escapeHtml(message) + '<\/li>';\n                }).join('') + '<\/ul>';\n\n                $wrap.find('.jet-form-builder-message').html(listHtml);\n                $wrap.show();\n            }\n\n            function collectMainFormValidationErrors() {\n                const $form = getForm();\n                const errors = [];\n                const seenMessages = new Set();\n                if (!$form.length) return errors;\n\n                const emailRegex = \/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$\/;\n\n                function pushError(message) {\n                    const normalized = String(message || '').trim();\n                    if (!normalized || seenMessages.has(normalized)) return;\n                    seenMessages.add(normalized);\n                    errors.push(normalized);\n                }\n\n                $form.find('input, select, textarea').filter(':visible').not('#reservation-for-others-modal input, #reservation-for-others-modal select, #reservation-for-others-modal textarea').each(function () {\n                    const $field = $(this);\n\n                    if ($field.is('[type=\"hidden\"], [type=\"submit\"], [type=\"button\"], [type=\"radio\"], [type=\"checkbox\"], [type=\"file\"]')) {\n                        return;\n                    }\n\n                    if (isFlightRelatedField($field)) {\n                        return;\n                    }\n\n                    const isRequired = isMainBookingFieldRequired($field);\n                    if (!isRequired) {\n                        return;\n                    }\n\n                    const value = ($field.val() || '').toString().trim();\n                    let fieldValid = value !== '';\n\n                    if (($field.attr('type') || '').toLowerCase() === 'email') {\n                        fieldValid = fieldValid && emailRegex.test(value);\n                    }\n\n                    if (fieldValid && isSelectPlaceholderValue($field)) {\n                        fieldValid = false;\n                    }\n\n                    if (!fieldValid) {\n                        pushError(getFieldValidationMessage($field));\n                    }\n                });\n\n                $('#additional-passengers-fields input').each(function () {\n                    const $field = $(this);\n                    if ((($field.val() || '').toString().trim()) === '') {\n                        pushError(getFieldValidationMessage($field));\n                    }\n                });\n\n                getCoreBookingFields().forEach(function ($field) {\n                    if (!isMainFieldValid($field)) {\n                        pushError(getFieldValidationMessage($field));\n                    }\n                });\n\n                return errors;\n            }\n\n            function collectReservationModalValidationErrors() {\n                const errors = [];\n\n                if (!$('#reservation-for-others-modal').hasClass('is-open')) {\n                    return errors;\n                }\n\n                if ($('#reservation-modal-step-details').hasClass('is-active') && !$('#reservation-same-as-previously-entered').is(':checked')) {\n                    const $nameField = $('#reservation_for_other_name');\n                    if ((($nameField.val() || '').toString().trim()) === '') {\n                        errors.push(getFieldValidationMessage($nameField));\n                    }\n\n                    const $phoneField = $('#reservation_for_other_phone');\n                    if ((($phoneField.val() || '').toString().trim()) === '') {\n                        errors.push(getFieldValidationMessage($phoneField));\n                    }\n\n                    $('#reservation-other-passengers-fields input').each(function () {\n                        const $field = $(this);\n                        if ((($field.val() || '').toString().trim()) === '') {\n                            errors.push(getFieldValidationMessage($field));\n                        }\n                    });\n                }\n\n                return errors;\n            }\n\n            function refreshValidationSummary() {\n                const flightErrors = typeof getFlightValidationErrors === 'function'\n                    ? getFlightValidationErrors()\n                    : (typeof window.getFlightValidationErrors === 'function' ? window.getFlightValidationErrors() : []);\n\n                renderValidationSummary(\n                    collectMainFormValidationErrors()\n                        .concat(collectReservationModalValidationErrors())\n                        .concat(flightErrors)\n                );\n            }\n\n            function validateMainFormFields(markInvalid) {\n                const $form = getForm();\n                if (!$form.length) return false;\n\n                let isValid = true;\n                const emailRegex = \/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$\/;\n\n                $form.find('input, select, textarea').filter(':visible').not('#reservation-for-others-modal input, #reservation-for-others-modal select, #reservation-for-others-modal textarea').each(function () {\n                    const $field = $(this);\n\n                    if ($field.is('[type=\"hidden\"], [type=\"submit\"], [type=\"button\"], [type=\"radio\"], [type=\"checkbox\"], [type=\"file\"]')) {\n                        return;\n                    }\n\n                    const isRequired = isMainBookingFieldRequired($field);\n                    if (!isRequired) {\n                        return;\n                    }\n\n                    const value = ($field.val() || '').toString().trim();\n                    let fieldValid = value !== '';\n\n                    if ($field.attr('type') === 'email') {\n                        fieldValid = fieldValid && emailRegex.test(value);\n                    }\n\n                    if (fieldValid && isSelectPlaceholderValue($field)) {\n                        fieldValid = false;\n                    }\n\n                    if (!fieldValid) {\n                        isValid = false;\n                    }\n\n                    if (markInvalid) {\n                        setFieldInvalidState($field, !fieldValid);\n                    }\n                });\n\n                $('#additional-passengers-fields input').each(function () {\n                    const $field = $(this);\n                    const fieldValid = (($field.val() || '').toString().trim() !== '');\n                    if (!fieldValid) {\n                        isValid = false;\n                    }\n                    if (markInvalid) {\n                        setFieldInvalidState($field, !fieldValid);\n                    }\n                });\n\n                getCoreBookingFields().forEach(function ($field) {\n                    const fieldValid = isMainFieldValid($field);\n                    if (!fieldValid) {\n                        isValid = false;\n                    }\n\n                    if (markInvalid && !fieldValid) {\n                        showCoreFieldValidationFeedback($field);\n                    }\n                });\n\n                return isValid;\n            }\n\n            function validateReservationModalFields(markInvalid) {\n                if (!$('#reservation-for-others-modal').hasClass('is-open')) {\n                    return true;\n                }\n\n                if ($('#reservation-modal-step-details').hasClass('is-active') && !$('#reservation-same-as-previously-entered').is(':checked')) {\n                    let isValid = true;\n                    const $nameField = $('#reservation_for_other_name');\n                    const nameValid = (($nameField.val() || '').toString().trim() !== '');\n                    const $phoneField = $('#reservation_for_other_phone');\n                    const phoneValid = (($phoneField.val() || '').toString().trim() !== '');\n\n                    if (!nameValid) {\n                        isValid = false;\n                    }\n                    if (!phoneValid) {\n                        isValid = false;\n                    }\n\n                    if (markInvalid) {\n                        setFieldInvalidState($nameField, !nameValid);\n                        setFieldInvalidState($phoneField, !phoneValid);\n                    }\n\n                    $('#reservation-other-passengers-fields input').each(function () {\n                        const $field = $(this);\n                        const fieldValid = (($field.val() || '').toString().trim() !== '');\n                        if (!fieldValid) {\n                            isValid = false;\n                        }\n                        if (markInvalid) {\n                            setFieldInvalidState($field, !fieldValid);\n                        }\n                    });\n\n                    return isValid;\n                }\n\n                return true;\n            }\n\n            function refreshCustomBookingValidationState() {\n                const mainFormValid = validateMainFormFields(false);\n                const modalValid = validateReservationModalFields(false);\n                window.customBookingFieldsValid = mainFormValid && modalValid;\n                refreshValidationSummary();\n                if (typeof updateSubmitButtonState === 'function') {\n                    updateSubmitButtonState();\n                } else if (window.apiFormFieldHelpers && typeof window.apiFormFieldHelpers.updateSubmitButtonState === 'function') {\n                    window.apiFormFieldHelpers.updateSubmitButtonState();\n                }\n            }\n\n            function updateDisplay() {\n                ensurePassengerSelector();\n                ensureAdditionalPassengerSection();\n\n                if (isSyncingPassengerLuggage) return;\n\n                const passengers = Math.max(1, parseCount($('#passenger-count').text(), 1));\n                const luggage = Math.max(0, parseCount($('#luggage-count').text(), 0));\n\n                $('.passengers-display').text(passengers + (passengers === 1 ? ' Passenger' : ' Passengers'));\n                $('.luggage-display').text(luggage + ' Luggage');\n\n                isSyncingPassengerLuggage = true;\n                getPassengerInput().val(passengers);\n                getLuggageInput().val(luggage);\n                isSyncingPassengerLuggage = false;\n\n                renderAdditionalPassengerFields(passengers);\n                renderReservationPassengerFields(passengers);\n                syncBookingPayloadFields();\n            }\n\n            function updateButtonStates() {\n                const passengers = Math.max(1, parseCount($('#passenger-count').text(), 1));\n                const luggage = Math.max(0, parseCount($('#luggage-count').text(), 0));\n\n                $('.minus-passenger').prop('disabled', passengers <= 1);\n                $('.minus-luggage').prop('disabled', luggage <= 0);\n            }\n\n            function syncCountsFromInputs() {\n                ensurePassengerSelector();\n                ensureAdditionalPassengerSection();\n\n                if (isSyncingPassengerLuggage) return;\n\n                const passengers = Math.max(1, parseCount(getPassengerInput().val(), 1));\n                const luggage = Math.max(0, parseCount(getLuggageInput().val(), 0));\n\n                isSyncingPassengerLuggage = true;\n                $('#passenger-count').text(passengers);\n                $('#luggage-count').text(luggage);\n                isSyncingPassengerLuggage = false;\n\n                updateDisplay();\n                updateButtonStates();\n            }\n\n            function syncAdditionalPassengerUI() {\n                const passengers = Math.max(1, parseCount(getPassengerInput().val(), 1));\n                renderAdditionalPassengerFields(passengers);\n                renderReservationPassengerFields(passengers);\n            }\n\n            function getPrimaryFlightRow() {\n                return getForm().find('.jet-form-builder-repeater__row').first();\n            }\n\n            function prefillServiceType(value) {\n                if (!value) return;\n\n                const normalized = value.toString().trim().toLowerCase();\n                const $row = getPrimaryFlightRow();\n                const $select = $row.length\n                    ? $row.find('select[name*=\"type_of_service\"], select.typeservicerow').first()\n                    : getForm().find('select[name*=\"type_of_service\"], select.typeservicerow').first();\n                if (!$select.length) return;\n\n                const matchingValue = $select.find('option').filter(function () {\n                    return ($(this).val() || '').toLowerCase() === normalized;\n                }).first().val();\n\n                if (matchingValue) {\n                    $select.val(matchingValue).trigger('change');\n                }\n            }\n\n            function prefillDate(value) {\n                if (!value) return;\n                const $row = getPrimaryFlightRow();\n                const $dateField = $row.length\n                    ? $row.find('input.datelegrow, input[type=\"date\"]').first()\n                    : getForm().find('input.datelegrow, input[type=\"date\"]').filter(':visible').first();\n                if ($dateField.length) {\n                    $dateField.val(value).trigger('input').trigger('change');\n                }\n            }\n\n            function prefillEmail(value) {\n                if (!value) return;\n                const $emailField = getForm().find('input[type=\"email\"]').filter(':visible').first();\n                if ($emailField.length) {\n                    $emailField.val(value).trigger('input').trigger('change');\n                }\n            }\n\n            function getPrefillServiceType() {\n                if (bookingPrefill.service_type) {\n                    return bookingPrefill.service_type;\n                }\n\n                if (Array.isArray(bookingPrefill.legs) && bookingPrefill.legs.length && bookingPrefill.legs[0].type) {\n                    return bookingPrefill.legs[0].type;\n                }\n\n                return '';\n            }\n\n            function getPrefillTravelDate() {\n                if (bookingPrefill.travel_date) {\n                    return bookingPrefill.travel_date;\n                }\n\n                if (bookingPrefill.service_date) {\n                    return bookingPrefill.service_date;\n                }\n\n                if (Array.isArray(bookingPrefill.legs) && bookingPrefill.legs.length && bookingPrefill.legs[0].date) {\n                    return bookingPrefill.legs[0].date;\n                }\n\n                return '';\n            }\n\n            function applyBookingPrefill() {\n                prefillServiceType(getPrefillServiceType());\n                prefillDate(getPrefillTravelDate());\n                prefillEmail(bookingPrefill.email || '');\n\n                if (bookingPrefill.passengers) {\n                    getPassengerInput().val(Math.max(1, parseCount(bookingPrefill.passengers, 1)));\n                }\n\n                if (typeof bookingPrefill.luggage !== 'undefined' && bookingPrefill.luggage !== null && bookingPrefill.luggage !== '') {\n                    getLuggageInput().val(Math.max(0, parseCount(bookingPrefill.luggage, 0)));\n                }\n\n                syncCountsFromInputs();\n            }\n\n            function setReservationFieldState(enabled) {\n                $('#reservation_for_other_name, #reservation_for_other_phone, #reservation-other-passengers-fields input').prop('disabled', !enabled);\n                $('#reservation_contact_same_as_passengers').val($('#reservation-same-as-previously-entered').is(':checked') ? '1' : '0');\n                syncBookingPayloadFields();\n            }\n\n            function fillReservationFromMainPassengerData() {\n                const primaryName = getPrimaryPassengerField().val() || '';\n                $('#reservation_for_other_name').val(primaryName);\n                $('#reservation_for_other_phone').val(getPrimaryPhoneField().val() || '');\n\n                const extraValues = $('#additional-passengers-fields input').map(function () {\n                    return $(this).val();\n                }).get();\n\n                $('#reservation-other-passengers-fields input').each(function (index) {\n                    $(this).val(extraValues[index] || '');\n                });\n\n                syncBookingPayloadFields();\n            }\n\n            function clearReservationModalFields() {\n                $('#reservation_for_other_name').val('');\n                $('#reservation_for_other_phone').val('');\n                $('#reservation-other-passengers-fields input').val('');\n                $('#reservation_contact_same_as_passengers').val('0');\n                syncBookingPayloadFields();\n            }\n\n            function openReservationModal() {\n                window.formWasSubmitted = false;\n                $('html, body').addClass('reservation-modal-open');\n                $('#reservation-modal-step-question').addClass('is-active');\n                $('#reservation-modal-step-details').removeClass('is-active');\n                $('#reservation-for-others-modal').addClass('is-open').attr('aria-hidden', 'false');\n                refreshCustomBookingValidationState();\n            }\n\n            function closeReservationModal() {\n                const activeElement = document.activeElement;\n                if (activeElement && typeof activeElement.blur === 'function' && $(activeElement).closest('#reservation-for-others-modal').length) {\n                    activeElement.blur();\n                }\n\n                $('html, body').removeClass('reservation-modal-open');\n                $('#reservation-for-others-modal').removeClass('is-open').attr('aria-hidden', 'true');\n                refreshCustomBookingValidationState();\n            }\n\n            function submitFormAfterDecision() {\n                const form = getForm().get(0);\n                if (!form) return;\n\n                closeReservationModal();\n                window.apiFormAllowMessageScroll = true;\n                window.apiFormSkipGlobalSubmitValidation = true;\n                submitBypass = true;\n\n                if (typeof form.requestSubmit === 'function') {\n                    form.requestSubmit();\n                } else {\n                    form.submit();\n                }\n            }\n\n            function attachSubmitInterception() {\n                const form = getForm().get(0);\n                if (!form || form.dataset.bookingDecisionBound === '1') return;\n\n                form.dataset.bookingDecisionBound = '1';\n                form.addEventListener('submit', function (event) {\n                    if (submitBypass) {\n                        submitBypass = false;\n                        return;\n                    }\n\n                    if (decisionCaptured) {\n                        return;\n                    }\n\n                    event.preventDefault();\n                    event.stopPropagation();\n                    if (typeof event.stopImmediatePropagation === 'function') {\n                        event.stopImmediatePropagation();\n                    }\n\n                    if (!validateMainFormFields(true)) {\n                        window.apiFormRevealValidationSummary = true;\n                        refreshCustomBookingValidationState();\n                        return;\n                    }\n\n                    if (window.flightError === true || window.activeApiRequests > 0) {\n                        const msg = window.flightError === true ? buildFlightValidationMessageHtml() : 'Please wait while flight data is loading.';\n                        let $wrap = $(form).find('.jet-form-builder-messages-wrap');\n                        if (!$wrap.length) {\n                            $(form).append('<div class=\"jet-form-builder-messages-wrap\" data-form-id=\"' + (form.dataset.formId || '') + '\"><\/div>');\n                            $wrap = $(form).find('.jet-form-builder-messages-wrap');\n                        }\n                        $wrap.html('<div class=\"jet-form-builder-message jet-form-builder-message--error\">' + msg + '<\/div>');\n                        return;\n                    }\n\n                    openReservationModal();\n                }, true);\n            }\n\n            function initializeCustomBookingExperience() {\n                if (bookingExperienceReady) return true;\n                if (!ensureBookingFields()) return false;\n                if (!ensurePassengerSelector()) return false;\n                ensureAdditionalPassengerSection();\n\n                syncAdditionalPassengerUI();\n                ensureReservationModal();\n                attachSubmitInterception();\n                syncCountsFromInputs();\n                applyBookingPrefill();\n                refreshCustomBookingValidationState();\n                bookingExperienceReady = true;\n                return true;\n            }\n\n            $(document).on('click', '.plus-passenger', function () {\n                const newPassenger = parseCount($('#passenger-count').text(), 1) + 1;\n                $('#passenger-count').text(newPassenger);\n                if (!luggageManuallyModified) {\n                    $('#luggage-count').text(newPassenger);\n                }\n                updateDisplay();\n                updateButtonStates();\n            });\n\n            $(document).on('click', '.minus-passenger', function () {\n                const current = parseCount($('#passenger-count').text(), 1);\n                if (current > 1) {\n                    const newPassenger = current - 1;\n                    $('#passenger-count').text(newPassenger);\n                    if (!luggageManuallyModified) {\n                        $('#luggage-count').text(newPassenger);\n                    }\n                    updateDisplay();\n                    updateButtonStates();\n                }\n            });\n\n            $(document).on('click', '.plus-luggage', function () {\n                luggageManuallyModified = true;\n                $('#luggage-count').text(parseCount($('#luggage-count').text(), 0) + 1);\n                updateDisplay();\n                updateButtonStates();\n            });\n\n            $(document).on('click', '.minus-luggage', function () {\n                luggageManuallyModified = true;\n                const current = parseCount($('#luggage-count').text(), 0);\n                if (current > 0) {\n                    $('#luggage-count').text(current - 1);\n                    updateDisplay();\n                    updateButtonStates();\n                }\n            });\n\n            $(document).on('input change', '#number_of_passengers', function () {\n                syncCountsFromInputs();\n            });\n\n            $(document).on('input change', '#number_of_luggage', function () {\n                syncCountsFromInputs();\n            });\n\n            $(document).on('input change', '#additional-passengers-fields input, #reservation-other-passengers-fields input, #reservation_for_other_name, #reservation_for_other_phone', function (event) {\n                const $field = $(this);\n                const hasValue = (($field.val() || '').toString().trim() !== '');\n                const shouldRevealError = !!event.originalEvent || $field.hasClass('is-invalid') || $field.closest('.booking-extra-field, .jet-form-builder-row').find('.jet-form-builder__field-error').length > 0;\n\n                if (event.originalEvent) {\n                    window.apiFormRevealValidationSummary = true;\n                }\n\n                if (hasValue) {\n                    setFieldInvalidState($field, false);\n                } else if (shouldRevealError) {\n                    window.apiFormRevealValidationSummary = true;\n                    setFieldInvalidState($field, true);\n                }\n\n                syncBookingPayloadFields();\n                refreshCustomBookingValidationState();\n            });\n\n            $(document).on('input change', '.jet-form-builder input, .jet-form-builder select, .jet-form-builder textarea', function (event) {\n                const $field = $(this);\n\n                if (event.originalEvent) {\n                    window.apiFormRevealValidationSummary = true;\n                }\n\n                if ($field.closest('#reservation-for-others-modal').length || $field.closest('#additional-passengers-fields, #reservation-other-passengers-fields').length) {\n                    return;\n                }\n\n                if ($field.is('[type=\"hidden\"], [type=\"submit\"], [type=\"button\"], [type=\"radio\"], [type=\"checkbox\"], [type=\"file\"]')) {\n                    refreshCustomBookingValidationState();\n                    return;\n                }\n\n                const isRequired = isMainBookingFieldRequired($field);\n\n                if (!isRequired) {\n                    refreshCustomBookingValidationState();\n                    return;\n                }\n\n                const value = ($field.val() || '').toString().trim();\n                let isValid = value !== '' && !isSelectPlaceholderValue($field);\n\n                if (($field.attr('type') || '').toLowerCase() === 'email') {\n                    isValid = \/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$\/.test(value);\n                }\n\n                const shouldRevealError = !!event.originalEvent || $field.hasClass('is-invalid') || $field.closest('.booking-extra-field, .jet-form-builder-row').find('.jet-form-builder__field-error').length > 0;\n\n                if (isValid) {\n                    setFieldInvalidState($field, false);\n                } else if (shouldRevealError) {\n                    window.apiFormRevealValidationSummary = true;\n                    setFieldInvalidState($field, true);\n                }\n\n                refreshCustomBookingValidationState();\n            });\n\n            $(document).on('click', '#passenger-luggage-display', function (e) {\n                e.stopPropagation();\n                $('#passenger-luggage-dropdown').toggle();\n                $('#passenger-luggage-selector')\n                    .toggleClass('active')\n                    .attr('aria-expanded', $('#passenger-luggage-dropdown').is(':visible') ? 'true' : 'false');\n            });\n\n            $(document).on('mouseenter pointerdown click', '.jet-form-builder-row.field-type-submit-field, .jet-form-builder__submit-wrap', function (event) {\n                const $submitButton = $(this).find('.jet-form-builder__submit').first();\n                if (!$submitButton.length || !$submitButton.prop('disabled')) {\n                    return;\n                }\n\n                if (event.type === 'pointerdown' || event.type === 'click') {\n                    event.preventDefault();\n                }\n\n                revealBlockedSubmitValidation();\n            });\n\n            $(document).on('click', function (e) {\n                if (!$(e.target).closest('#passenger-luggage-selector').length) {\n                    $('#passenger-luggage-dropdown').hide();\n                    $('#passenger-luggage-selector').removeClass('active').attr('aria-expanded', 'false');\n                }\n            });\n\n            $(document).on('click', '#reservation-modal-no', function () {\n                $('#booking_for_someone_else').val('no');\n                $('#reservation_contact_same_as_passengers').val('0');\n                setReservationFieldState(false);\n                decisionCaptured = true;\n                submitFormAfterDecision();\n            });\n\n            $(document).on('click', '#reservation-modal-yes', function () {\n                $('#reservation-modal-step-question').removeClass('is-active');\n                $('#reservation-modal-step-details').addClass('is-active');\n                setReservationFieldState(true);\n            });\n\n            $(document).on('click', '#reservation-modal-back', function () {\n                $('#reservation-modal-step-details').removeClass('is-active');\n                $('#reservation-modal-step-question').addClass('is-active');\n                $('#reservation-same-as-previously-entered').prop('checked', false);\n                clearReservationModalFields();\n                closeReservationModal();\n            });\n\n            $(document).on('change', '#reservation-same-as-previously-entered', function () {\n                if ($(this).is(':checked')) {\n                    fillReservationFromMainPassengerData();\n                } else {\n                    clearReservationModalFields();\n                }\n                $('#reservation_contact_same_as_passengers').val($(this).is(':checked') ? '1' : '0');\n                syncBookingPayloadFields();\n                refreshCustomBookingValidationState();\n            });\n\n            $(document).on('click', '#reservation-modal-confirm', function () {\n                if (!validateReservationModalFields(true)) {\n                    window.apiFormRevealValidationSummary = true;\n                    refreshCustomBookingValidationState();\n                    return;\n                }\n\n                if ($('#reservation-same-as-previously-entered').is(':checked')) {\n                    fillReservationFromMainPassengerData();\n                }\n\n                $('#booking_for_someone_else').val('yes');\n                setReservationFieldState(true);\n                decisionCaptured = true;\n                submitFormAfterDecision();\n            });\n\n            function bootCustomBookingExperience(maxAttempts) {\n                let attempts = 0;\n\n                function tryInitialize() {\n                    attempts += 1;\n                    if (initializeCustomBookingExperience()) {\n                        return;\n                    }\n\n                    if (attempts < maxAttempts) {\n                        window.setTimeout(tryInitialize, 250);\n                    }\n                }\n\n                tryInitialize();\n            }\n\n            function ensureBookingPrefill(maxAttempts) {\n                let attempts = 0;\n\n                function tryPrefill() {\n                    attempts += 1;\n\n                    const hasServiceTarget = getForm().find('select[name*=\"type_of_service\"], select.typeservicerow').length > 0;\n                    const hasDateTarget = getForm().find('input.datelegrow, input[type=\"date\"]').length > 0;\n\n                    if (hasServiceTarget || hasDateTarget) {\n                        applyBookingPrefill();\n                    }\n\n                    if (attempts < maxAttempts && (!hasServiceTarget || !hasDateTarget)) {\n                        window.setTimeout(tryPrefill, 300);\n                    }\n                }\n\n                tryPrefill();\n            }\n\n            bootCustomBookingExperience(20);\n            ensureBookingPrefill(20);\n            syncAdditionalPassengerUI();\n            $(window).on('load', function () {\n                if (!bookingExperienceReady) {\n                    bootCustomBookingExperience(10);\n                }\n                ensureBookingPrefill(10);\n                syncAdditionalPassengerUI();\n                refreshCustomBookingValidationState();\n            });\n\n        });\n    <\/script>\n\n\n    <script src=\"https:\/\/code.jquery.com\/jquery-3.7.1.min.js\"><\/script>\n    <link href=\"https:\/\/cdn.jsdelivr.net\/npm\/select2@4.1.0-rc.0\/dist\/css\/select2.min.css\" rel=\"stylesheet\" \/>\n    <script src=\"https:\/\/cdn.jsdelivr.net\/npm\/select2@4.1.0-rc.0\/dist\/js\/select2.min.js\"><\/script>\n\n    <style>\n        .select2-container,\n        .jet-form-builder,\n        .elementor-widget-container {\n            z-index: 1 !important;\n            position: relative;\n        }\n\n        .select2-container--open,\n        .select2-dropdown {\n            z-index: 9999 !important;\n        }\n\n        .airline-select2-dropdown .select2-results__options {\n            max-height: 230px;\n            padding: 0;\n            background: #ffffff;\n            border-radius: 0 0 4px 4px;\n        }\n\n        .airline-select2-dropdown {\n            border: 1px solid #aeb4bc !important;\n            border-radius: 4px !important;\n            background: #fff !important;\n            box-shadow: none !important;\n            overflow: hidden;\n        }\n\n        .airline-select2-dropdown .select2-results>.select2-results__options {\n            max-height: 230px;\n        }\n\n        .airline-select2-dropdown .select2-results__option {\n            padding: 0 !important;\n            background: #fff !important;\n        }\n\n        .airline-select2-dropdown .select2-results__option--highlighted.select2-results__option--selectable {\n            background: #5897fb !important;\n            color: #ffffff !important;\n        }\n\n        .airline-select2-dropdown .airline-option {\n            padding: 8px 14px;\n            display: flex;\n            flex-direction: column;\n            gap: 10px;\n            border-bottom: 1px solid #f1f1f1;\n            transition: background 0.2s;\n            background: transparent;\n        }\n\n        .airline-select2-dropdown .select2-results__option:last-child .airline-option {\n            border-bottom: 0;\n        }\n\n        .airline-select2-dropdown .airline-option:hover {\n            background-color: #f5f7f9;\n        }\n\n        .airline-select2-dropdown .airline-option strong {\n            color: #434a54;\n            font-size: 14px;\n            font-weight: 600;\n            display: block;\n            line-height: 1.2;\n        }\n\n        .airline-select2-dropdown .airline-code {\n            color: #7c848e;\n            font-size: 12px;\n            font-weight: 400;\n            line-height: 1.2;\n        }\n\n        .airline-select2-dropdown .select2-results__option--highlighted.select2-results__option--selectable .airline-option {\n            background: #5897fb !important;\n            border-bottom-color: #5897fb !important;\n        }\n\n        .airline-select2-dropdown .select2-results__option--highlighted.select2-results__option--selectable .airline-option strong {\n            color: #ffffff !important;\n        }\n\n        .airline-select2-dropdown .select2-results__option--highlighted.select2-results__option--selectable .airline-code {\n            color: #d9e4fb !important;\n        }\n\n        .airline-select2-dropdown .select2-results__options::-webkit-scrollbar {\n            width: 10px;\n        }\n\n        .airline-select2-dropdown .select2-results__options::-webkit-scrollbar-track {\n            background: #ffffff;\n        }\n\n        .airline-select2-dropdown .select2-results__options::-webkit-scrollbar-thumb {\n            background: #9e9e9e;\n            border-radius: 10px;\n            border: 2px solid #ffffff;\n        }\n\n        .airline-select2-dropdown .select2-search--dropdown {\n            padding: 10px;\n            background: #ffffff;\n            border-bottom: 1px solid #ececec;\n        }\n\n        .airline-select2-dropdown .select2-search--dropdown .select2-search__field {\n            border: 1px solid #6f6f6f !important;\n            border-radius: 2px !important;\n            padding: 6px 10px !important;\n            color: #434a54;\n            background: #ffffff !important;\n            box-shadow: none !important;\n            min-height: 36px;\n            font-size: 14px !important;\n        }\n\n        .airline-select2-container.select2-container--default .select2-selection--single {\n            height: 50px;\n            border: 1px solid #c7ccd3;\n            border-radius: 4px;\n            display: flex;\n            align-items: center;\n            background: #ffffff;\n            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);\n            overflow: hidden;\n        }\n\n        .airline-select2-container.select2-container--default .select2-selection--single .select2-selection__rendered {\n            color: #4f4f4f;\n            display: block !important;\n            width: 100%;\n            min-height: 48px;\n            line-height: 48px !important;\n            padding-left: 15px !important;\n            padding-right: 42px !important;\n            font-size: 15px !important;\n            font-weight: 400;\n            margin-top: 0 !important;\n            margin-bottom: 0 !important;\n            text-align: left;\n        }\n\n        .airline-select2-container.select2-container--default .select2-selection--single .select2-selection__placeholder {\n            color: #7c848e !important;\n        }\n\n        .airline-select2-container.select2-container--default .select2-selection--single .select2-selection__arrow {\n            height: 48px;\n            right: 10px;\n        }\n\n        .airline-select2-container.select2-container--default .select2-selection--single .select2-selection__arrow b {\n            border-color: #8b8b8b transparent transparent transparent;\n            border-width: 6px 5px 0 5px;\n            margin-left: -5px;\n            margin-top: -2px;\n        }\n\n        .airline-select2-container.select2-container--default.select2-container--open .select2-selection--single {\n            border-color: #aeb4bc;\n        }\n    <\/style>\n\n    <script>\n        jQuery(document).ready(function ($) {\n            \/\/ Cache local para aerol\u00edneas\n            const airlinesCache = new Map();\n            let isInitializing = false;\n            let initialAirlinesLoaded = false;\n\n            \/* -------------------------\n               FUNCIONES ESENCIALES\n            ------------------------- *\/\n            function formatFlightTime(isoString) {\n                if (!isoString) return '';\n                const date = new Date(isoString);\n                return date.getHours().toString().padStart(2, '0') + ':' +\n                    date.getMinutes().toString().padStart(2, '0');\n            }\n\n            function getAirlineMetadata(value) {\n                const normalizedValue = (value || '').toString().trim().toUpperCase();\n                if (!normalizedValue) return null;\n\n                const cached = airlinesCache.get(normalizedValue);\n                if (cached) return cached;\n\n                return {\n                    fs: normalizedValue,\n                    iata: '',\n                    icao: '',\n                    name: ''\n                };\n            }\n            window.getAirlineMetadata = getAirlineMetadata;\n\n            function getApiCarrierCode($select) {\n                const airlineValue = ($select.val() || '').toString().trim().toUpperCase();\n                const airline = getAirlineMetadata(airlineValue);\n\n                if (!airline) return '';\n\n                return (\n                    (airline.iata || '').toString().trim().toUpperCase() ||\n                    (airline.fs || '').toString().trim().toUpperCase() ||\n                    (airline.icao || '').toString().trim().toUpperCase() ||\n                    airlineValue\n                );\n            }\n            window.getApiCarrierCode = getApiCarrierCode;\n\n            function getAirlinePrefixes($select) {\n                const airlineValue = ($select.val() || '').toString().trim().toUpperCase();\n                const airline = getAirlineMetadata(airlineValue) || {};\n\n                return [...new Set([\n                    airlineValue,\n                    airline.fs,\n                    airline.iata,\n                    airline.icao\n                ].map(code => (code || '').toString().trim().toUpperCase()).filter(Boolean))];\n            }\n            window.getAirlinePrefixes = getAirlinePrefixes;\n\n            function normalizeFlightNumber(rawValue, $select) {\n                let normalized = (rawValue || '').toString().trim().toUpperCase().replace(\/\\s+\/g, '');\n                if (!normalized) return '';\n\n                getAirlinePrefixes($select).forEach(prefix => {\n                    if (normalized.startsWith(prefix)) {\n                        normalized = normalized.slice(prefix.length);\n                    }\n                });\n\n                return normalized.replace(\/^-+\/, '');\n            }\n            window.normalizeFlightNumber = normalizeFlightNumber;\n\n            function buildUniversalFlightCode(rawValue, $select) {\n                const carrierCode = getApiCarrierCode($select);\n                const normalizedFlightNumber = normalizeFlightNumber(rawValue, $select);\n\n                if (!carrierCode || !normalizedFlightNumber) {\n                    return normalizedFlightNumber || '';\n                }\n\n                return carrierCode + normalizedFlightNumber;\n            }\n            window.buildUniversalFlightCode = buildUniversalFlightCode;\n\n            function updateFieldVisibility($row) {\n                const serviceType = $row.find('select[name*=\"type_of_service\"]').val();\n\n                const $flightField = $row.find('input[id*=\"flight\"]').closest('.jet-form-builder-row');\n                const $arrivingField = $row.find('input[id*=\"arriving_flight\"]').closest('.jet-form-builder-row');\n                const $departingField = $row.find('input[id*=\"departing_flight\"]').closest('.jet-form-builder-row');\n\n                const $airlineMainRow = $row.find('select[name*=\"aerolineas\"]').closest('.jet-form-builder-row');\n                const $airlineCopyRow = $row.find('select[name*=\"aerolineas_connect\"]').closest('.jet-form-builder-row');\n\n                \/\/ Ocultar todo de base\n                $flightField.hide();\n                $arrivingField.hide();\n                $departingField.hide();\n\n                if ($airlineMainRow.length) $airlineMainRow.hide();\n                if ($airlineCopyRow.length) $airlineCopyRow.hide();\n\n                \/\/ Mostrar campos seg\u00fan tipo de servicio\n                if (serviceType === 'Arrival' || serviceType === 'Departure') {\n                    $flightField.show();\n                    if ($airlineMainRow.length) $airlineMainRow.show();\n                    \/\/ aerolineas_connect no se usa aqu\u00ed\n                } else if (serviceType === 'Connection') {\n                    $arrivingField.show();\n                    $departingField.show();\n                    if ($airlineMainRow.length) $airlineMainRow.show();   \/\/ para arriving\n                    if ($airlineCopyRow.length) $airlineCopyRow.show();   \/\/ para departing\n                }\n            }\n\n            \/* -------------------------\n               CARGAR AEROL\u00cdNEAS INICIALES\n            ------------------------- *\/\n            function loadInitialAirlines() {\n                if (initialAirlinesLoaded) return;\n\n                $.ajax({\n                    url: '\/wp-json\/flightapi\/v1\/airlines',\n                    method: 'GET',\n                    data: {\n                        limit: 20\n                    },\n                    success: function (data) {\n                        if (data.success && data.airlines.length > 0) {\n                            data.airlines.forEach(airline => {\n                                airlinesCache.set((airline.fs || '').toUpperCase(), airline);\n                            });\n                            initialAirlinesLoaded = true;\n                        }\n                    },\n                    error: function () {\n                        console.log('Error loading initial airlines');\n                    }\n                });\n            }\n\n            \/* -------------------------\n               SELECT2 PARA aerolineas Y aerolineas_connect\n            ------------------------- *\/\n            function initializeAirlineSelect($select) {\n                if ($select.hasClass('select2-hidden-accessible')) {\n                    return;\n                }\n\n                function getAirlineDisplayData(airline) {\n                    const code = (airline && (airline.code || airline.id || '') || '').toString();\n                    let name = airline && airline.name ? airline.name.toString() : '';\n\n                    if (!name && airline && airline.text) {\n                        name = airline.text.toString().replace(\/\\s*\\([^)]+\\)\\s*$\/, '');\n                    }\n\n                    return {\n                        name: name || (airline && airline.text ? airline.text.toString() : ''),\n                        code: code\n                    };\n                }\n\n                function renderAirlineOption(airline) {\n                    if (airline.loading) {\n                        return airline.text;\n                    }\n\n                    const display = getAirlineDisplayData(airline);\n\n                    return $(\n                        '<div class=\"airline-option\">' +\n                        '<strong>' + display.name + '<\/strong>' +\n                        '<span class=\"airline-code\">' + display.code + '<\/span>' +\n                        '<\/div>'\n                    );\n                }\n\n                function renderAirlineSelection(airline) {\n                    const display = getAirlineDisplayData(airline);\n\n                    if (display.name && display.code) {\n                        return display.name + ' (' + display.code + ')';\n                    }\n\n                    return display.name || '';\n                }\n\n                $select.select2({\n                    placeholder: 'Select or search airline...',\n                    minimumInputLength: 0,\n                    width: '100%',\n                    allowClear: true,\n                    containerCssClass: 'airline-select2-container',\n                    dropdownCssClass: 'airline-select2-dropdown',\n                    ajax: {\n                        url: '\/wp-json\/flightapi\/v1\/airlines',\n                        dataType: 'json',\n                        delay: 300,\n                        data: function (params) {\n                            return {\n                                search: params.term || '',\n                                limit: params.term ? 15 : 20\n                            };\n                        },\n                        processResults: function (data) {\n                            if (data.success) {\n                                data.airlines.forEach(airline => {\n                                    airlinesCache.set((airline.fs || '').toUpperCase(), airline);\n                                });\n\n                                return {\n                                    results: data.airlines.map(airline => ({\n                                        id: airline.fs,\n                                        text: `${airline.name} (${airline.fs})`,\n                                        name: airline.name,\n                                        code: airline.fs,\n                                        fs: airline.fs,\n                                        iata: airline.iata,\n                                        icao: airline.icao\n                                    }))\n                                };\n                            }\n                            return { results: [] };\n                        },\n                        cache: true\n                    },\n                    templateResult: renderAirlineOption,\n                    templateSelection: renderAirlineSelection\n                });\n\n                let firstFocus = true;\n                $select.on('select2:open', function () {\n                    if (firstFocus) {\n                        firstFocus = false;\n                        setTimeout(() => {\n                            const $search = $('.select2-container--open .select2-search__field');\n                            if ($search.length && $search.val() === '') {\n                                $search.trigger('focus');\n                            }\n                        }, 100);\n                    }\n                });\n\n                $select.on('select2:select', function (e) {\n                    const data = e.params.data;\n                    if (data && data.id) {\n                        airlinesCache.set(data.id.toUpperCase(), {\n                            fs: data.code || data.id,\n                            iata: data.iata || '',\n                            icao: data.icao || '',\n                            name: data.name || data.text || ''\n                        });\n                    }\n                });\n            }\n\n            \/* -------------------------\n               INICIALIZACI\u00d3N\n            ------------------------- *\/\n            function initializeJetFormRepeaters() {\n                if (isInitializing) return;\n                isInitializing = true;\n\n                loadInitialAirlines();\n\n                $('select[name*=\"aerolineas\"], select[name*=\"aerolineas_connect\"]').each(function () {\n                    if (!$(this).hasClass('select2-hidden-accessible')) {\n                        initializeAirlineSelect($(this));\n                    }\n                });\n\n                $('.jet-form-builder-repeater__row').each(function () {\n                    updateFieldVisibility($(this));\n                });\n\n                isInitializing = false;\n            }\n\n            $(document).on('change', 'select[name*=\"type_of_service\"]', function () {\n                const $row = $(this).closest('.jet-form-builder-repeater__row');\n                updateFieldVisibility($row);\n            });\n\n            function initializeNewRepeater($newRow) {\n                setTimeout(() => {\n                    $newRow.find('select[name*=\"aerolineas\"], select[name*=\"aerolineas_connect\"]').each(function () {\n                        if (!$(this).hasClass('select2-hidden-accessible')) {\n                            initializeAirlineSelect($(this));\n                        }\n                    });\n                    updateFieldVisibility($newRow);\n                }, 50);\n            }\n\n            const repeaterObserver = new MutationObserver(function (mutations) {\n                mutations.forEach(function (mutation) {\n                    mutation.addedNodes.forEach(function (node) {\n                        if (node.nodeType === 1) {\n                            const $node = $(node);\n                            if ($node.hasClass('jet-form-builder-repeater__row')) {\n                                initializeNewRepeater($node);\n                            } else {\n                                $node.find('.jet-form-builder-repeater__row').each(function () {\n                                    initializeNewRepeater($(this));\n                                });\n                            }\n                        }\n                    });\n                });\n            });\n\n            $(window).on('load', function () {\n                initializeJetFormRepeaters();\n\n                const repeaterContainer = document.querySelector('.jet-form-builder-repeater');\n                if (repeaterContainer) {\n                    repeaterObserver.observe(repeaterContainer, {\n                        childList: true,\n                        subtree: true\n                    });\n                }\n            });\n\n            $(document).on('click', '.jet-form-builder-repeater__new', function () {\n                setTimeout(() => {\n                    const $newRows = $('.jet-form-builder-repeater__row').last();\n                    initializeNewRepeater($newRows);\n                }, 100);\n            });\n\n        });\n    <\/script>\n\n    <\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>","protected":false},"excerpt":{"rendered":"<p>Someone from our team will respond immediately during extended business hours Name * Email * Phone * 1 Passenger &#8211; 0 Luggage \u25bc Passengers &#8211; 1 + Luggage &#8211; 0 + Flight Legs Type of Service * Type of serviceArrivalDepartureConnection Date * Airline Flight Arriving Flight Airline Departing Flight &times; Add new Special Instructions (Optional) [&hellip;]<\/p>\n\n        <div class=\"jm-meta-line text-sm text-muted-foreground mt-3\">\n            <div class=\"jm-meta-left\">\n                <div class=\"item\">\n                    \n        <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"h-4 w-4\" width=\"24\" height=\"24\" viewbox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n            <path d=\"M8 2v4\"><\/path>\n            <path d=\"M16 2v4\"><\/path>\n            <rect width=\"18\" height=\"18\" x=\"3\" y=\"4\" rx=\"2\"><\/rect>\n            <path d=\"M3 10h18\"><\/path>\n        <\/svg>\n    \n                    <span>\u0646\u0648\u0641\u0645\u0628\u0631 21, 2025<\/span>\n                <\/div>\n                <div class=\"item\">\n                    \n        <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"h-4 w-4\" width=\"24\" height=\"24\" viewbox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n            <circle cx=\"12\" cy=\"12\" r=\"10\"><\/circle>\n            <polyline points=\"12 6 12 12 16 14\"><\/polyline>\n        <\/svg>\n    \n                    <span>1 min read<\/span>\n                <\/div>\n                <div class=\"item jm-meta-arrow\">\n                    \n        <a href=\"https:\/\/royal.entornodedesarrollo.es\/ar\/book-service\/\" class=\"jm-arrow-link\" aria-label=\"Leer m\u00e1s\">\n            <svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"h-4 w-4 text-yellow-500\" width=\"24\" height=\"24\" viewbox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n                <path d=\"M5 12h14\"><\/path>\n                <path d=\"M13 5l7 7-7 7\"><\/path>\n            <\/svg>\n        <\/a>\n    \n                <\/div>\n            <\/div>\n        <\/div>","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"_acf_changed":false,"site-sidebar-layout":"no-sidebar","site-content-layout":"page-builder","ast-site-content-layout":"full-width-container","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"disabled","ast-breadcrumbs-content":"","ast-featured-img":"disabled","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"class_list":["post-16574","page","type-page","status-publish","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/royal.entornodedesarrollo.es\/ar\/wp-json\/wp\/v2\/pages\/16574","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/royal.entornodedesarrollo.es\/ar\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/royal.entornodedesarrollo.es\/ar\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/royal.entornodedesarrollo.es\/ar\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/royal.entornodedesarrollo.es\/ar\/wp-json\/wp\/v2\/comments?post=16574"}],"version-history":[{"count":814,"href":"https:\/\/royal.entornodedesarrollo.es\/ar\/wp-json\/wp\/v2\/pages\/16574\/revisions"}],"predecessor-version":[{"id":24181,"href":"https:\/\/royal.entornodedesarrollo.es\/ar\/wp-json\/wp\/v2\/pages\/16574\/revisions\/24181"}],"wp:attachment":[{"href":"https:\/\/royal.entornodedesarrollo.es\/ar\/wp-json\/wp\/v2\/media?parent=16574"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}