PageSourceSearch

https://nic.ec/templates/nic-2026/assets/js/homepage-init.js?v=979005-ddv40

js nic.ec collected 2026-10-02 07:45:18 UTC 58,771 bytes, 1,432 lines download raw bytes

1/**
2 * Homepage NIC.ec — homepage-init.js (Fase 3)
3 */
4(function ($) {
5'use strict';
6
7if (!window.NIC_HOME) {
8    console.error('homepage-init: NIC_HOME config missing');
9    return;
10}
11
12var registradores = window.NIC_HOME.registradores;
13var url = window.NIC_HOME.urlAgentes;
14var url2 = window.NIC_HOME.urlImages;
15window.homeLang = window.NIC_HOME.homeLang;
16
17function showDomainLoader() {
18    var el = document.getElementById('domain-loader');
19    if (el) el.classList.remove('hidden');
20}
21
22function hideDomainLoader() {
23    var el = document.getElementById('domain-loader');
24    if (el) el.classList.add('hidden');
25}
26
27window.showDomainLoader = showDomainLoader;
28window.hideDomainLoader = hideDomainLoader;
29
30/** Tarifario: solo registro NIC.ec (sin agentes). */
31function isTarifarioNicOnlySearch() {
32    return document.documentElement.classList.contains('tarifario-nic');
33}
34
35function interesDominioEnsureVisitorId() {
36    var id = null;
37    try {
38        id = localStorage.getItem('visitor_id');
39    } catch (e) {}
40    if (!id) {
41        id = 'v_' + Math.random().toString(36).slice(2) + Date.now().toString(36);
42        try {
43            localStorage.setItem('visitor_id', id);
44        } catch (e2) {}
45    }
46    return id;
47}
48
49function interesDominioIsPropio(nombre, id) {
50    // Ya no se clasifica por nombre/id de agente.
51    // Solo cuenta como propio el botón NIC.ec (#regnow_btn / ECUADORDOMAIN S.A.).
52    return false;
53}
54
55function trackInteresDominio(payload) {
56    try {
57        payload = payload || {};
58        payload.visitor_id = payload.visitor_id || interesDominioEnsureVisitorId();
59        payload.page_url = payload.page_url || window.location.href;
60
61        // Evitar doble registro si hay varios handlers.
62        var dedupeKey = [
63            payload.event_type || '',
64            payload.domain || '',
65            payload.destino || '',
66            payload.destino_id || '',
67            payload.destino_nombre || ''
68        ].join('|');
69        var now = Date.now();
70        if (!window.__interesDominioDedupe) {
71            window.__interesDominioDedupe = {};
72        }
73        var last = window.__interesDominioDedupe[dedupeKey] || 0;
74        if (now - last < 1500) {
75            return;
76        }
77        window.__interesDominioDedupe[dedupeKey] = now;
78
79        var body = JSON.stringify(payload);
80        var endpoint = '/modules/addons/interes_dominio/capture.php';
81        if (window.fetch) {
82            fetch(endpoint, {
83                method: 'POST',
84                headers: { 'Content-Type': 'application/json' },
85                body: body,
86                keepalive: true,
87                credentials: 'same-origin'
88            }).catch(function () {});
89            return;
90        }
91        if (navigator.sendBeacon) {
92            navigator.sendBeacon(endpoint, new Blob([body], { type: 'application/json' }));
93        }
94    } catch (e) {}
95}
96
97window.trackInteresDominio = trackInteresDominio;
98
99function trackInteresDominioFromClickEl(el) {
100    if (!el || !el.getAttribute) {
101        return;
102    }
103    var agenteNombre = (el.getAttribute('agente') || '').trim();
104    var agenteId = el.getAttribute('agente-id') || '';
105    if (!agenteNombre && !agenteId) {
106        return;
107    }
108    var dominioBusqueda = '';
109    try {
110        dominioBusqueda = (window.jQuery
111            ? (jQuery('#resultados .domainSearch').text() || jQuery('#domainNameEst').val() || '')
112            : ''
113        ).trim();
114    } catch (e) {}
115    if (!dominioBusqueda && typeof domainName !== 'undefined') {
116        dominioBusqueda = String(domainName || '');
117    }
118    // Dominios Ecuador y cualquier logo de #registradores / exclusivos = agente.
119    // Lo propio (NIC.ec / ECUADORDOMAIN S.A.) solo se registra desde #regnow_btn.
120    var nombreCanon = agenteNombre || 'Agente';
121    var idCanon = String(agenteId || '');
122    var upper = nombreCanon.toUpperCase();
123    if (idCanon === '5' || upper === 'DOMINIOSECUADOR' || upper.indexOf('DOMINIOS ECUADOR') !== -1) {
124        nombreCanon = '.ec DOMINIOS ECUADOR';
125        idCanon = idCanon || '5';
126    }
127    trackInteresDominio({
128        event_type: 'click',
129        domain: dominioBusqueda,
130        domain_available: true,
131        destino: 'agente',
132        destino_nombre: nombreCanon,
133        destino_id: idCanon,
134        destino_url: el.href || ''
135    });
136}
137
138if (!window.__interesDominioClickBound) {
139    window.__interesDominioClickBound = true;
140    document.addEventListener('click', function (e) {
141        var el = e.target && e.target.closest
142            ? e.target.closest('.miFbq-click, #registradores a, a.item[agente], [agente][agente-id], #regnow_btn--dominiosec')
143            : null;
144        if (!el) {
145            return;
146        }
147        // #regnow_btn (NIC) se trackea en su propio handler con URL de destino
148        if (el.id === 'regnow_btn') {
149            return;
150        }
151        trackInteresDominioFromClickEl(el);
152    }, true);
153}
154
155document.addEventListener("DOMContentLoaded", function() {
156
157        if (window.__NIC_COOKIE_BAR_ENABLED__) {
158
159        var acceptButton = document.getElementById("acceptButton");
160        var rejectButton = document.getElementById("rejectButton");
161        var cookieModal = document.getElementById("cookieBar");
162
163        // =========================
164        // COOKIE CONSENT (robusto)
165        // =========================
166        var CONSENT_COOKIE = "cookieConsent"; // accepted | rejected
167        var CONSENT_DAYS = 180;
168        var OPTIONAL_COOKIE_NAMES = ["_ga", "_gid", "_gat", "_fbp", "fr"];
169
170        function getConsent() {
171            return (window.Cookies && Cookies.get(CONSENT_COOKIE)) || null;
172        }
173
174        function setConsent(value) {
175            if (!window.Cookies) return;
176            Cookies.set(CONSENT_COOKIE, value, {
177                expires: CONSENT_DAYS,
178                sameSite: "Lax",
179                path: "/"
180            });
181        }
182
183        function deleteCookie(name) {
184            if (!window.Cookies) return;
185            Cookies.remove(name);
186            Cookies.remove(name, {
187                path: "/"
188            });
189        }
190
191        function purgeOptionalCookies() {
192            OPTIONAL_COOKIE_NAMES.forEach(function(n) {
193                deleteCookie(n);
194            });
195            document.cookie.split(";").forEach(function(c) {
196                var cookieName = c.split("=")[0].trim();
197                if (cookieName.indexOf("_ga_") === 0) deleteCookie(cookieName);
198            });
199        }
200
201        function enableOptional() {
202            if (window.nicAnalytics && typeof window.nicAnalytics.loadThirdParty === 'function') {
203                window.nicAnalytics.loadThirdParty();
204            }
205        }
206
207        function disableOptional() {
208            purgeOptionalCookies();
209        }
210
211        function hardCloseModal() {
212            if (cookieModal) {
213                cookieModal.style.display = 'none';
214                cookieModal.setAttribute('aria-hidden', 'true');
215            }
216            document.documentElement.classList.add('nic-cookie-ok');
217            document.body.classList.remove('modal-open');
218            try {
219                jQuery('.modal-backdrop').remove();
220            } catch (e) {}
221        }
222
223        var consent = getConsent();
224        if (!consent) {
225            if (cookieModal) {
226                cookieModal.style.display = 'block';
227                cookieModal.setAttribute('aria-hidden', 'false');
228            }
229            document.documentElement.classList.remove('nic-cookie-ok');
230        } else {
231            hardCloseModal();
232            if (consent === 'accepted') {
233                enableOptional();
234            } else {
235                disableOptional();
236            }
237        }
238
239        if (acceptButton) {
240            acceptButton.addEventListener("click", function() {
241                setConsent("accepted");
242                enableOptional();
243                hardCloseModal();
244            });
245        }
246
247        if (rejectButton) {
248            rejectButton.addEventListener("click", function() {
249                setConsent("rejected");
250                disableOptional();
251                hardCloseModal();
252            });
253        }
254
255        } /* fin COOKIE_BAR_TEMP_DISABLED */
256
257        jQuery(document).ready(function() {
258            if (!jQuery.fn.slick || !jQuery('.video-carousel').length) return;
259            jQuery('.video-carousel').slick({
260                arrows: true,
261                dots: true,
262                infinite: true,
263                speed: 300,
264                slidesToShow: 3,
265                adaptiveHeight: true,
266                responsive: [{
267                    breakpoint: 768,
268                    settings: {
269                        slidesToShow: 1
270                    }
271                }]
272            });
273        });
274
275    });
276
277
278
279
280
281    function buildAgentes(agentes) {
282        agentes.forEach(agente => {
283            jQuery('.slider').append(
284                '<div class="item"><a href="' + agente.url + '" rel="nofollow" target="_blank">' +
285                '<img loading="lazy" decoding="async" src="' + url + '/' + agente.logo + '" alt="' + agente.nombre + '">' +
286                '</a></div>'
287            );
288        });
289    }
290
291    function normalizarLogoUrl(src) {
292        if (!src) return src;
293        return src.replace(/\.[^.]+$/, '.webp');
294    }
295
296    function fillAgentes(agentes) {
297
298        const containerRegistradores = document.getElementById('registradores');
299
300        containerRegistradores.innerHTML = '';
301
302        // 👇 eliminar botón anterior si existe
303        const oldBtn = document.getElementById('toggleAgentesBtn');
304
305        if (oldBtn) {
306            oldBtn.remove();
307        }
308
309        // Orden según responde la API (sin prioridad hardcodeada)
310        agentes.forEach((agente, index) => {
311
312            const div = document.createElement('div');
313            div.className = 'item';
314
315            if (index >= 4) {
316                div.classList.add('agente-extra');
317                div.style.display = 'none';
318            }
319
320            const a = document.createElement('a');
321            a.className = 'miFbq-click';
322
323            if (agente.url_car) {
324                a.href = agente.url_car + domainName;
325            } else {
326                a.href = agente.url;
327            }
328
329            a.target = '_blank';
330            a.rel = 'nofollow';
331            a.setAttribute('agente', (agente.nombre || '').substring(0, 50));
332            a.setAttribute('agente-id', String(agente.id != null ? agente.id : (agente.roid || '')));
333
334            const img = document.createElement('img');
335
336            img.loading = 'lazy';
337            img.decoding = 'async';
338
339            if (agente.roid === '771226-nicec') {
340                img.src = `${url}/openprovider-logo.webp`;
341            } else if (agente.roid === '851496-nicec') {
342                img.src = `${url}/edomains_logo.webp`;
343            } else if (agente.roid === '634935-nicec') {
344                img.src = `${url2}/LOGO-NIC.EC.png`;
345            } else {
346                img.src = normalizarLogoUrl(`${url}/${agente.logo}`);
347            }
348
349            img.alt = agente.nombre;
350
351            a.appendChild(img);
352            div.appendChild(a);
353
354            containerRegistradores.appendChild(div);
355        });
356
357        if (agentes.length > 4) {
358
359            const btn = document.createElement('button');
360
361            btn.id = 'toggleAgentesBtn';
362            btn.innerHTML = window.homeLang.moreAgents;
363
364            btn.style.background = '#fedc32';
365            btn.style.border = 'none';
366            btn.style.padding = '10px 22px';
367            btn.style.borderRadius = '999px';
368            btn.style.fontWeight = 'bold';
369            btn.style.fontStyle = 'italic';
370            btn.style.cursor = 'pointer';
371            btn.style.margin = '20px auto 0';
372            btn.style.display = 'block';
373
374            let expanded = false;
375
376            btn.addEventListener('click', () => {
377
378                expanded = !expanded;
379
380                document.querySelectorAll('.agente-extra').forEach(el => {
381                    el.style.display = expanded ? 'block' : 'none';
382                });
383
384                btn.innerHTML = expanded ?
385                    window.homeLang.lessAgents :
386                    window.homeLang.moreAgents;
387            });
388
389            document.getElementById('card-agentes').appendChild(btn);
390        }
391    }
392
393    jQuery(document).ready(function() {
394        if (!jQuery.fn.slick) return;
395        jQuery('.slider').slick({
396            centerMode: false,
397            dots: false,
398            infinite: true,
399            mobileFirst: true,
400            speed: 300,
401            adaptiveHeight: false,
402            autoplay: true,
403            autoplaySpeed: 5000,
404            arrows: true,
405            slidesToShow: 1,
406            slidesToScroll: 1,
407            responsive: [{
408                breakpoint: 1024,
409                settings: {
410                    arrows: true,
411                    dots: true,
412                    slidesToShow: 3,
413                    slidesToScroll: 3
414                }
415            }]
416        });
417    });
418
419
420
421
422    function animateValue(obj, start, end, duration) {
423        let startTimestamp = null;
424        const step = (timestamp) => {
425            if (!startTimestamp) startTimestamp = timestamp;
426            const progress = Math.min((timestamp - startTimestamp) / duration, 1);
427            obj.innerHTML = Math.floor(progress * (end - start) + start).toLocaleString('es-MX').replace(',', '.');
428            if (progress < 1) window.requestAnimationFrame(step);
429        };
430        window.requestAnimationFrame(step);
431    }
432
433
434
435
436
437    let i = 1 / 0;
438    let domainName;
439
440    const INPUT_SEL = '.search-domain input[name="domain"]';
441    const CONTAINER_SEL = '.input-container-home-search';
442    const MSG_ID = '#domainErrorMsg';
443
444    function getEcRegex() {
445        return /^[a-zA-Z0-9-]+?(\.gob|\.mil|\.com|\.net|\.adm|\.art|\.dng|\.pro|\.k12|\.rrpp|\.bar|\.pub|\.disco|\.tech|\.info|\.doc|\.fot|\.uio|\.rio|\.edu|\.org|\.med|\.odont|\.tur|\.fin|\.agron|\.arqt|\.chef|\.cpa|\.mktg|\.ntr|\.prof|\.psic|\.psiq|\.vet|\.abg)?(\.ec)$/i;
446    }
447
448    function normalizeDomain(v) {
449        return String(v || '').trim().toLowerCase().replace(/\s+/g, '');
450    }
451
452    function showError(msg) {
453        jQuery(CONTAINER_SEL).addClass('error');
454        if (msg) jQuery(MSG_ID).text(msg);
455        jQuery(MSG_ID).show();
456    }
457
458    function clearError() {
459        jQuery(CONTAINER_SEL).removeClass('error');
460        jQuery(MSG_ID).hide();
461    }
462
463    function isEmailLike(v) {
464        v = normalizeDomain(v);
465        return v.includes('@');
466    }
467
468    function addEcDomainIfNeeded() {
469        const $input = jQuery(INPUT_SEL);
470        let v = normalizeDomain($input.val());
471
472        if (!v || isEmailLike(v)) {
473            $input.val(v);
474            return v;
475        }
476
477        if (!v.endsWith('.ec')) {
478            v += '.ec';
479        }
480        /* Siempre reflejar minúsculas en el input (serialize envía el valor visible) */
481        $input.val(v);
482        return v;
483    }
484
485    function isValidDomainForSearch(v) {
486        v = normalizeDomain(v);
487
488        if (!v || isEmailLike(v)) return false;
489
490        return getEcRegex().test(v);
491    }
492
493    function sendForm() {
494        let domain = addEcDomainIfNeeded();
495        domainName = domain;
496
497        if (!isValidDomainForSearch(domain)) {
498            showError(window.NIC_HOME.msgDominioInvalido);
499            return false;
500        }
501
502        clearError();
503
504        if (window.showDomainLoader) showDomainLoader();
505
506        jQuery('#domainssearch').off('hidden.bs.modal.reset');
507        jQuery('#domainssearch').on('hidden.bs.modal.reset', function(e) {
508            jQuery('#sugerencias-header').hide();
509            document.getElementById('card-nuevas-opciones')
510                .style.setProperty('display', 'none', 'important');
511            jQuery('#resultados .domainSearch').text('');
512            jQuery('#resultados .domainType').text('');
513            jQuery("#btnRegisterNow").addClass("btnRegisterNow");
514            jQuery('#resultados .btnRegisterNow').text('');
515            jQuery('#resultados .nuevas-opciones').text('');
516            jQuery('#resultados .text-elige').text('');
517            jQuery('#resultados .text-elige-tmp').text('');
518            jQuery('#resultados .titulo-agentes-exclusivos').text('');
519            jQuery('#resultados .sugerencias').text('');
520            jQuery('#resultados .exclusiveAgent').text('');
521            jQuery("#noDisBox3").empty();
522            jQuery('#resultados .contenedor-agentes').css('display', 'block');
523            jQuery('.logos-agentes').css('display', 'none'); /* CORREGIDO: selector sin #resultados */
524            jQuery('#resultados .domain-result').html(
525                '<div class="lds-ellipsis"><div></div><div></div><div></div><div></div></div>'
526            );
527        });
528
529        searchDomain();
530        return false;
531    }
532
533    jQuery(document).off('submit.domainSearch', 'form.search-domain');
534    jQuery(document).on('submit.domainSearch', 'form.search-domain', function(e) {
535        e.preventDefault();
536        return sendForm();
537    });
538
539    jQuery(document).off('click.domainBtn', '#searchDomainEst');
540    jQuery(document).on('click.domainBtn', '#searchDomainEst', function(e) {
541        e.preventDefault();
542        return sendForm();
543    });
544
545    jQuery(document).off('keypress.domainEnter', INPUT_SEL);
546    jQuery(document).on('keypress.domainEnter', INPUT_SEL, function(e) {
547        if (e.which === 13) {
548            e.preventDefault();
549            return sendForm();
550        }
551    });
552
553    jQuery(document).off('blur.domainBlur', INPUT_SEL);
554    jQuery(document).on('blur.domainBlur', INPUT_SEL, function() {
555        const v = addEcDomainIfNeeded();
556        if (!v) {
557            clearError();
558            return;
559        }
560        if (!isValidDomainForSearch(v)) {
561            showError(window.NIC_HOME.msgDominioInvalido);
562        } else {
563            clearError();
564        }
565    });
566
567    function render(agente) {
568        const agenteExcluidoId = 10;
569        if (agente.id === agenteExcluidoId) return '';
570
571        const array = [3, 5, 12, 15, 16, 18, 27];
572        let url = window.NIC_HOME.urlAgentes + "/";
573        let data = '<a class="item miFbq-click" agente="' + agente.nombre + '" agente-id="' + agente.id +
574            '" target="_new" rel="nofollow">';
575        if (array.includes(agente.id)) {
576            data = '<a class="item miFbq-click" href="' + agente.url_car + domainName + '" agente="' + agente.nombre +
577                '" agente-id="' + agente.id + '" target="_new" rel="nofollow">';
578        }
579        data += '<img loading="lazy" decoding="async" src="' + url + agente.logo + '">';
580        data += '</a>';
581        return data;
582    }
583
584
585
586
587
588    function searchDomain() {
589        jQuery('#elemento-dinamico-tooltip').remove();
590        jQuery('#resultados .sugerencias').hide();
591        jQuery('#resultados .banner').hide();
592        jQuery('#resultados .contenedor-agentes').hide();
593        jQuery('#resultados .text-elige').hide();
594
595        const diccionario = window.NIC_HOME.diccionario;
596
597        fetch('/tracking_capture.php', {
598            method: 'POST',
599            headers: {
600                'Content-Type': 'application/json'
601            },
602            body: JSON.stringify({
603                visitor_id: localStorage.getItem('visitor_id'),
604                event_type: 'buscar_dominio',
605                event_data: {
606                    dominio: jQuery("#domainNameEst").val()
607                },
608                page_url: window.location.href
609            })
610        });
611
612        jQuery.ajax({
613            type: 'POST',
614            url: (window.NIC_HOME.webRoot || '') + '/sugeridos.php',
615            data: jQuery('form.search-domain').serialize(),
616            success: function(result) {
617                try {
618                jQuery('#resultados div.tabla').html('');
619
620                if (result.result === 'success') {
621                    switch (result.tipo) {
622                        case "Comercial":
623                            result.tipo = diccionario.textoComercial;
624                            break;
625                        case "Restringido":
626                            result.tipo = diccionario.textoRestringido;
627                            break;
628                        case "Especial":
629                            result.tipo = diccionario.textoEspecial;
630                            break;
631                        case "Profesionales":
632                            result.tipo = diccionario.textoProfesional;
633                            break;
634                        case "Territorial":
635                            result.tipo = diccionario.textoTerritorial;
636                            break;
637                        case "No válido":
638                            result.tipo = diccionario.textoNoValido;
639                            break;
640                    }
641
642                    jQuery('#resultados .domain-result').remove();
643
644                    if (result.tipo === diccionario.textoNoValido) {
645                        jQuery('#resultados .domainSearch').text(result.dominio);
646                        jQuery('#resultados .domainType').text(diccionario.tipo + ': ' + result.tipo);
647                        jQuery('#resultados .banner').hide();
648                        jQuery('#resultados .sugerencias').hide();
649                        jQuery('#resultados .contenedor-agentes').hide();
650                        jQuery('#resultados .text-elige').hide();
651                        jQuery("#btnRegisterNow").addClass("btnRegisterNow");
652                        jQuery('#resultados .bannerNoDisp').text('');
653                        jQuery('#domainssearch').modal();
654                        hideDomainLoader();
655                        jQuery('#resultados').css('display', 'flex');
656                        return;
657                    }
658
659                    if (result.status === 'available') {
660                        jQuery('#sugerencias-header').hide();
661                        document.getElementById('card-nuevas-opciones')
662                            .style.setProperty('display', 'none', 'important');
663                        document.getElementById('card-disponible').style.display = 'block';
664                        document.getElementById('card-NoDisp').style.display = 'none';
665                        document.getElementById('bannerNoDisp').style.display = 'none';
666
667                        jQuery('#resultados .sugerencias').hide();
668                        jQuery('#resultados .contenedor-agentes').show();
669                        //jQuery('#resultados .text-elige').show();
670
671                        let domain = result.dominio;
672                        trackInteresDominio({
673                            event_type: 'busqueda',
674                            domain: result.dominio,
675                            domain_available: true,
676                            domain_type: result.tipo || ''
677                        });
678                        jQuery('#resultados .domainSearch').text(result.dominio);
679                        jQuery('#resultados .domainType').text(diccionario.tipo + ': ' + result.tipo);
680                        insertarElementoDebajoDeTipo(result.tipo, result.dominio);
681
682                        if (result.tipo === diccionario.textoRestringido) {
683                            //jQuery('#resultados .text-elige').hide();
684                            jQuery('#resultados .contenedor-agentes').css('display', 'none');
685                            jQuery('#resultados #btnRegisterNow').append(
686                                '<div id="regnow_btn" role="button" class="tres-colum-btn-yellow tres-colum-btn-yellow2"><img src="' + url2 + '/logo-nic-ec-register.webp" alt="NIC.ec" class="regnow-btn__logo">' + diccionario.registraAhora + '</div>'
687                            );
688                            document.getElementById('btnRegisterNow').style.display = 'block';
689                            document.getElementById('text-dominios-restringidos').style.display = 'block';
690                            document.getElementById('card-agentes').style.display = 'none';
691                            /* Ocultar solo el párrafo de "no proveemos hosting", no todo el contenedor */
692                            document.getElementById('text-registro-comerciales').querySelector('p').style
693                                .display = 'none';
694                            document.getElementById('text-registro-comerciales').style.display =
695                                'block'; // ← mantener visible para que #btnRegisterNow se vea
696                        } else {
697                            document.getElementById('text-registro-comerciales').style.display = 'block';
698                            document.getElementById('text-dominios-restringidos').style.display = 'none';
699                            document.getElementById('btnRegisterNow').style.display = 'block';
700                            //document.getElementById('text-agente').style.display = 'block';
701                            jQuery('#resultados .btnRegisterNow').append(
702                                '<div id="regnow_btn" role="button" class="tres-colum-btn-yellow tres-colum-btn-yellow2"><img src="' + url2 + '/logo-nic-ec-register.webp" alt="NIC.ec" class="regnow-btn__logo">' + diccionario.registraAhora + '</div>'
703                            );
704                            if (isTarifarioNicOnlySearch()) {
705                                document.getElementById('card-agentes').style.display = 'none';
706                                jQuery('#resultados .contenedor-agentes').css('display', 'none');
707                                jQuery('.logos-agentes').css('display', 'none');
708                            } else {
709                                document.getElementById('card-agentes').style.display = 'block';
710                                fetch(registradores).then((response) => response.json())
711                                    .then(agentes => {
712                                        fillAgentes(agentes, result.dominio);
713                                    });
714                                jQuery('#resultados .contenedor-agentes').css('display', 'block');
715                                jQuery('.logos-agentes').css('display',
716                                    'block'); /* CORREGIDO: selector sin #resultados */
717                            }
718                        }
719
720                        $('#regnow_btn').on('click', function() {
721                            var root = window.NIC_HOME.webRoot || '';
722                            var dominio = domain || (result && result.dominio) || '';
723                            /* Solo pasamos el dominio: el PHP arma cart.php?... (evita cortar en &) */
724                            var gateUrl = root + '/tiene-cuenta.php?domain=' +
725                                encodeURIComponent(dominio);
726                            trackInteresDominio({
727                                event_type: 'click',
728                                domain: dominio,
729                                domain_available: true,
730                                domain_type: result.tipo || '',
731                                destino: 'propio',
732                                destino_nombre: 'NIC.ec',
733                                destino_id: 'nic',
734                                destino_url: gateUrl
735                            });
736                            setTimeout(function () {
737                                window.location.href = gateUrl;
738                            }, 150);
739                        });
740
741                        jQuery('#resultados .text-elige').html('');
742                        jQuery('#resultados .contenedor-titulo').html('');
743
744                        /*jQuery('#resultados .text-elige').append(
745                            '<h3 class="titulo-agentes-exclusivos">' + diccionario.tituloAgentes +
746                            '</h3>'
747                        );*/
748
749                        jQuery('#resultados .contenedor-titulo').append(
750                            '<h3 class="titulo-agentes-exclusivos" >' + diccionario.agentesHosting +
751                            ' </h3>' +
752                            '<h3 class="titulo-agentes-exclusivos" >' + diccionario.agentesExclusivos +
753                            ' </h3>'
754                        );
755
756                        jQuery('#resultados .exclusiveAgent').append(
757                            '<div class=""><a class="item miFbq-click" href="https://dominiosecuador.ec/cart.php?a=add&domain=register&query=' +
758                            domain +
759                            '" target="_blank" agente=".ec DOMINIOS ECUADOR" agente-id="5" rel="nofollow">' +
760                            '<img class="ancho-60" src="/templates/nic-2026/assets/images/agentes/logo-01.webp" alt="Logo Dominios Ecuador"></a></div>'
761                        );
762                        jQuery('#resultados .exclusiveAgent').append(
763                            '<div id="regnow_btn--dominiosec" agente=".ec DOMINIOS ECUADOR" agente-id="5" role="button" class="tres-colum-btn-yellow ancho-50">' + diccionario.registrarAhora + '</div>'
764                        );
765                        jQuery('#regnow_btn--dominiosec').on('click', function() {
766                            miFbq(this);
767                            window.open(
768                                "https://dominiosecuador.ec/cart.php?a=add&domain=register&query=" +
769                                domain, "_blank");
770                        });
771
772                        let element = jQuery('#resultados .domain-result .agentes');
773                        if (element.length) {
774                            result.agentes.map(agente => {
775                                element.append(render(agente));
776                            });
777                        }
778
779                        document.querySelectorAll('.miFbq-click').forEach(el => {
780                            el.addEventListener('click', function() {
781                                miFbq(this);
782                            });
783                        });
784
785                        jQuery('#agentes_btn').on('click', function() {
786                            let agentesBox = jQuery('#agentes_box');
787                            if (agentesBox.css('display') === 'none') agentesBox.css('display',
788                                'grid');
789                            else agentesBox.css('display', 'none');
790                        });
791
792                        jQuery('#resultados .banner').show();
793                        //jQuery('#resultados .text-elige').show();
794                        jQuery('#resultados .contenedor-agentes').show();
795                        if (document.getElementsByClassName('bannerNoDisp')[0]) {
796                            document.getElementsByClassName('bannerNoDisp')[0].style.display = 'none';
797                        }
798                    } else {
799                        trackInteresDominio({
800                            event_type: 'busqueda',
801                            domain: result.dominio || jQuery('#domainNameEst').val() || '',
802                            domain_available: false,
803                            domain_type: result.tipo || ''
804                        });
805                        document.getElementById('text-registro-comerciales').style.display = 'none';
806                        document.getElementById('text-dominios-restringidos').style.display = 'none';
807                        document.getElementById('card-disponible').style.display = 'none';
808                        document.getElementById('text-agente').style.display = 'none';
809
810                        document.getElementById('card-NoDisp').style.display = 'block';
811                        if (result.tipo === diccionario.textoRestringido) {
812                            document.getElementById('bannerNoDisp').style.display = 'none';
813                            jQuery('#resultados .sugerencias').hide();
814                            jQuery('#sugerencias-header').hide();
815                            jQuery('#card-nuevas-opciones')
816                        .hide(); /* ocultar botón buscar más en restringidos */
817                            console.log("El dominio es restringido, y no disponible.");
818                        } else {
819                            document.getElementById('bannerNoDisp').style.display = 'block';
820                            jQuery('#resultados .sugerencias').show();
821                            jQuery('#sugerencias-header').show();
822                            console.log("El dominio es restringido, y esta disponible.");
823                            if (document.getElementsByClassName('bannerNoDisp')[0]) {
824                                document.getElementsByClassName('bannerNoDisp')[0].style.display = 'flex';
825                            }
826                        }
827                        document.getElementById('card-agentes').style.display = 'none';
828                        document.getElementById('card-nuevas-opciones').style.display = 'block';
829                        jQuery("#resultados .contenedor-agentes").hide();
830                        jQuery('#resultados .text-elige').hide();
831
832                        var disponible = false;
833                        jQuery("#btnRegisterNow").removeClass("btnRegisterNow");
834
835                        jQuery('#resultados .sugerencias').empty();
836                        result.sugeridos.forEach(function(item) {
837                            if (item.disponible) disponible = true;
838                        });
839
840
841                        var html = '';
842                        if (disponible) {
843                            //jQuery('#resultados .sugerencias').show();
844                            html =
845                                '<div class="divSugerencias" style="width:100%;"><ul style="width:100%;">';
846                        }
847                        result.sugeridos.forEach(function(item) {
848                            if (item.disponible) {
849                                html +=
850                                    '<li class="disponible sugerencia-clickable" data-dominio="' +
851                                    item.dominio +
852                                    '" style="display:flex; justify-content:center; cursor:pointer;">' +
853                                    '<div style="display:flex; align-items:center; justify-content:space-between; width:100%; color:inherit;">' +
854                                    '<div style="display:flex; align-items:center; gap:8px; font-size:1.5rem;">' +
855                                    '<span>' + item.dominio + '</span>' +
856                                    '</div>' +
857                                    '</div>' +
858                                    '</li>';
859                            }
860                        });
861                        if (disponible) html += '</ul></div>';
862                        jQuery('#resultados .sugerencias').append(html);
863
864                        /* Clic en sugerencia: mostrar flujo de dominio disponible */
865                        jQuery(document).off('click.sugerencia').on('click.sugerencia',
866                            '.sugerencia-clickable',
867                            function() {
868                                var dominioElegido = jQuery(this).data('dominio');
869
870                                /* Actualizar variable global de dominio */
871                                domainName = dominioElegido;
872
873                                /* Ocultar pantalla de no disponible */
874                                document.getElementById('card-NoDisp').style.display = 'none';
875                                document.getElementById('bannerNoDisp').style.display = 'none';
876                                jQuery('#sugerencias-header').hide();
877                                jQuery('#resultados .sugerencias').hide();
878                                document.getElementById('card-nuevas-opciones').style.setProperty(
879                                    'display', 'none', 'important');
880
881                                /* Mostrar card de disponible con el nuevo dominio */
882                                document.getElementById('card-disponible').style.display = 'block';
883                                jQuery('#resultados .domainSearch').text(dominioElegido);
884                                jQuery('#resultados .domainType').text(diccionario.tipo + ': ' + diccionario.textoComercial);
885
886                                /* Mostrar botón NIC.ec */
887                                jQuery('#text-registro-comerciales').show();
888                                jQuery('#text-registro-comerciales p').show();
889                                jQuery('#btnRegisterNow').empty().append(
890                                    '<div id="regnow_btn" role="button" class="tres-colum-btn-yellow tres-colum-btn-yellow2">' +
891                                    '<img src="' + url2 + '/logo-nic-ec-register.webp" alt="NIC.ec" class="regnow-btn__logo">' +
892                                    window.homeLang.registerNow + '</div>'
893                                ).show();
894
895                                /* Asignar clic del botón NIC.ec */
896                                jQuery('#regnow_btn').off('click').on('click', function() {
897                                    var gateUrl = (window.NIC_HOME.webRoot || '') + '/tiene-cuenta.php?domain=' +
898                                        encodeURIComponent(dominioElegido);
899                                    trackInteresDominio({
900                                        event_type: 'click',
901                                        domain: dominioElegido,
902                                        domain_available: true,
903                                        domain_type: diccionario.textoComercial || '',
904                                        destino: 'propio',
905                                        destino_nombre: 'NIC.ec',
906                                        destino_id: 'nic',
907                                        destino_url: gateUrl
908                                    });
909                                    setTimeout(function () {
910                                        window.location.href = gateUrl;
911                                    }, 150);
912                                });
913
914                                /* Mostrar agentes (no en Tarifario: solo NIC.ec) */
915                                if (isTarifarioNicOnlySearch()) {
916                                    document.getElementById('card-agentes').style.display = 'none';
917                                    jQuery('.logos-agentes').css('display', 'none');
918                                } else {
919                                    document.getElementById('card-agentes').style.display = 'block';
920                                    fetch(registradores).then(r => r.json()).then(function(agentes) {
921                                        fillAgentes(agentes, dominioElegido);
922                                    });
923                                    jQuery('.logos-agentes').css('display', 'block');
924                                }
925
926                            });
927
928                        var textoAlternativas = (result.tipo === diccionario.textoRestringido) ? '' : '<p>' + window.homeLang.showAlternatives + '</p>';
929                        jQuery('#noDisBox3').append('<div class="domainUnavailableWrapper">' +
930                            '<div class="domainUnavailableIcon">✕</div>' +
931                            '<div class="domainUnavailableContent">' + '<div class="domainSearch">' +
932                            result.dominio +
933                            '<span style="color:red;font-size:1.3rem;">' + window.homeLang.domainUnavailableSuffix + '</span>' +
934                            '</div>' + '<div class="domainUnavailableText">' +
935                            '<p>' + window.homeLang.alreadyRegistered + '</p>' + textoAlternativas + '</div>' +
936                            '</div>' + '</div>');
937                        /*jQuery('#noDisBox3').append(
938                            '<div class="noDispBox"><div class="noDispText">' + diccionario
939                            .noDisponible + '</div></div>'
940                        );*/
941                        /*jQuery('#noDisBox3').append(
942                            '<div class="noDispBox"><div class="domainType">Tipo: ' + result.tipo +
943                            '</div></div>'
944                        );*/
945                        jQuery('#noDisBox3').append(
946                            '<div class="noDispBox"><div class="domainType"> <strong><span style="color: red; font-size:1.3rem;">✖</span> ' + window.homeLang.notAvailable + '</strong></div></div>'
947                        );
948
949
950                        jQuery('#resultados .domain-result').html('');
951                    }
952                }
953
954                if (result.result === 'error') {
955                    hideDomainLoader();
956                    jQuery('.loading').hide();
957                    showError(result.message || (window.homeLang && window.homeLang.searchError) || 'No se pudo completar la consulta. Intenta de nuevo.');
958                    return;
959                }
960
961                jQuery('#domainssearch').modal();
962                jQuery('#resultados').css('display', 'flex');
963                } catch (err) {
964                    console.error('searchDomain success handler:', err);
965                    hideDomainLoader();
966                    showError((window.homeLang && window.homeLang.searchError) || 'No se pudo completar la consulta. Intenta de nuevo.');
967                } finally {
968                    hideDomainLoader();
969                }
970            },
971            error: function() {
972                hideDomainLoader();
973                jQuery('.loading').hide();
974                jQuery('#resultados').hide();
975                showError((window.homeLang && window.homeLang.searchError) || 'No se pudo completar la consulta. Intenta de nuevo.');
976            }
977        });
978    }
979
980
981
982
983
984    /**
985     * Autobúsqueda desde query:
986     * - Blog/WordPress: ?domain=ejemplo.ec (o ?q=)
987     * - RDAP / enlaces legacy: ?domaindirect=ejemplo.ec
988     * Rellena el buscador, limpia la URL y ejecuta la búsqueda.
989     */
990    function tryAutoSearchFromQuery() {
991        var params;
992        try {
993            params = new URLSearchParams(window.location.search);
994        } catch (e) {
995            return;
996        }
997        var domain = normalizeDomain(params.get('domain') || params.get('q') || params.get('domaindirect') || '');
998        if (!domain) {
999            return;
1000        }
1001        if (!jQuery(INPUT_SEL).length) {
1002            return;
1003        }
1004
1005        jQuery(INPUT_SEL).val(domain);
1006
1007        params.delete('domain');
1008        params.delete('q');
1009        params.delete('domaindirect');
1010        var clean = params.toString();
1011        var nextUrl = window.location.pathname + (clean ? ('?' + clean) : '') + window.location.hash;
1012        try {
1013            window.history.replaceState({}, document.title, nextUrl);
1014        } catch (e2) {}
1015
1016        setTimeout(function () {
1017            sendForm();
1018        }, 150);
1019    }
1020
1021    tryAutoSearchFromQuery();
1022
1023    jQuery(document).on('click', '.accordion-button', function() {
1024        jQuery(this).parent('.accordion-header').siblings('.accordion-collapse').toggle('500');
1025    });
1026    jQuery(document).ready(function() {
1027        if (jQuery.fn.slick) {
1028            jQuery('.multiple-items').slick({
1029                infinite: true,
1030                slidesToShow: 3,
1031                slidesToScroll: 3,
1032                dots: true,
1033                autoplay: true,
1034                autoplaySpeed: 4000,
1035            });
1036        }
1037    });
1038    jQuery(document).on('click', '.container-slider-domain', function() {
1039        const image = jQuery(this).find('img').attr('src');
1040        jQuery('.imagen-preview-slider').attr('src', image);
1041    });
1042
1043
1044
1045
1046    let domainId;
1047    var gooCredential = null,
1048        email_g = null,
1049        familyName_g = null,
1050        givenName_g = null,
1051        hd_g = null,
1052        google_id_g = null,
1053        name_g = null,
1054        picture_g = null,
1055        verifiedEmail_g = null;
1056
1057    jQuery("#searchDomainEst").click(async function() {
1058        const userIp = await jQuery.get("https://ipinfo.io", function(response) {
1059            return response.ip;
1060        }, "json");
1061        const domainName = jQuery("#domainNameEst").val();
1062        let sisDate = new Date();
1063        const searchDate = sisDate.toISOString().split('T')[0];
1064
1065        jQuery.post("https://promociones.nic.ec/api/busqueda/dominio", {
1066            dominio: domainName,
1067            fecha: searchDate,
1068            ip: userIp?.ip,
1069            ciudad: userIp?.city,
1070            region: userIp?.region,
1071            pais: userIp?.country,
1072            email: email_g,
1073            familyName: familyName_g,
1074            givenName: givenName_g,
1075            hd: hd_g,
1076            google_id: google_id_g,
1077            name: name_g,
1078            picture: picture_g,
1079            verifiedEmail: verifiedEmail_g
1080        }, function(data) {
1081            domainId = data.id;
1082            return data;
1083        });
1084    });
1085
1086
1087
1088
1089
1090
1091    function miFbq(objeto) {
1092        const agenteNombre = (objeto.getAttribute('agente') || '').trim();
1093        const agente = agenteNombre.substring(0, 15);
1094        const agenteId = objeto.getAttribute('agente-id');
1095        const dominioBusqueda = (jQuery('#resultados .domainSearch').text() || jQuery('#domainNameEst').val() || '').trim();
1096
1097        // El tracking a interes_dominio va por delegación en capture phase.
1098        // Aquí se mantiene GA + tracking_capture + API promociones.
1099
1100        if (window.nicAnalytics) {
1101            window.nicAnalytics.trackRegistrarClick({
1102                agente: agente,
1103                agente_id: agenteId,
1104                domain: dominioBusqueda
1105            });
1106        }
1107
1108        const visitorId = localStorage.getItem('visitor_id') || interesDominioEnsureVisitorId();
1109
1110        if (visitorId && agente) {
1111            fetch('/tracking_capture.php', {
1112                method: 'POST',
1113                headers: {
1114                    'Content-Type': 'application/json'
1115                },
1116                body: JSON.stringify({
1117                    visitor_id: visitorId,
1118                    event_type: 'click_agente_exclusivo',
1119                    event_data: {
1120                        agente,
1121                        agenteId,
1122                        domain: dominioBusqueda
1123                    },
1124                    page_url: window.location.href
1125                })
1126            });
1127        }
1128
1129        if (typeof domainId !== 'undefined') {
1130            const datos = {
1131                domainId: domainId,
1132                agenteId: agenteId
1133            };
1134
1135            jQuery.ajax({
1136                url: "https://promociones.nic.ec/api/busqueda/dominio/" + domainId,
1137                type: "PUT",
1138                contentType: "application/json",
1139                data: JSON.stringify(datos),
1140                success: function(response) {
1141                    console.log("Datos actualizados correctamente:", response);
1142                },
1143                error: function(error) {
1144                    console.error("Error al actualizar datos:", error);
1145                }
1146            });
1147        } else {
1148            console.warn("domainId no está definido");
1149        }
1150    }
1151
1152
1153
1154
1155
1156
1157    function playVideo(wrapper) {
1158        wrapper.classList.add('active');
1159        const iframe = wrapper.querySelector('iframe');
1160        const videoSrc = iframe.getAttribute('src');
1161        iframe.setAttribute('src', videoSrc + '?autoplay=1');
1162    }
1163
1164
1165
1166
1167    function insertarElementoDebajoDeTipo(tipo, dominio) {
1168        if (tipo == window.homeLang.textoComercial || tipo == window.homeLang.textoTerritorial) return;
1169
1170        const tooltipHTML = `
1171    <div id="elemento-dinamico-tooltip" style="margin-top: 10px; display:flex; justify-content:center;">
1172      <span class="tooltip-requisitos">
1173        ` + window.homeLang.requirements + ` <span class="tooltip-icon">i</span>
1174        <div class="tooltip-popup">
1175          <p>` + window.homeLang.loading + `</p>
1176        </div>
1177      </span>
1178    </div>
1179  `;
1180
1181        jQuery('#resultados .domainType').after(tooltipHTML);
1182        actualizarContenidoTooltip(dominio);
1183    }
1184
1185    function actualizarContenidoTooltip(dominio) {
1186        let contenido = '';
1187
1188        if (dominio.endsWith('.med.ec')) {
1189            contenido = `
1190      <div style="margin-bottom: 20px;">
1191        <strong>LA EXTENSIÓN MED.EC puede ser registrada únicamente por profesionales y establecimientos de atención a la salud del Ecuador</strong>
1192      </div>
1193      <div style="margin-bottom: 10px;">
1194        <strong>Establecimiento:</strong>
1195        <ul style="margin: 5px 0; padding-left: 15px;">
1196          <li>Permiso de funcionamiento a establecimientos de servicios de salud públicos y privados del Sistema Nacional de Salud, emitido por la Agencia de Aseguramiento de la calidad de Servicios de Salud y Medicina Prepagada ACESS.</li>
1197          <li>Certificado electrónico del RUC.</li>
1198          <li>Copia del documento de identificación del representante legal.</li>
1199        </ul>
1200      </div>
1201      <div>
1202        <strong>Profesionales de la salud:</strong>
1203        <ul style="margin: 5px 0; padding-left: 15px;">
1204          <li>Certificado electrónico de registro de título universitario emitido por SENECYT.</li>
1205          <li>Documento de identificación.</li>
1206          <li>Certificado de habilitación del ejercicio profesional del personal de Salud emitido por la Agencia de Aseguramiento de la calidad de Servicios de Salud y Medicina Prepagada (ACESS) .</li>
1207        </ul>
1208      </div>
1209    `;
1210        } else if (dominio.endsWith('.fin.ec')) {
1211            contenido = `
1212      <div style="margin-bottom: 20px;">
1213        <strong>LA EXTENSIÓN FIN.EC puede ser registrada únicamente por instituciones del Sistema Financiero del Ecuador, como bancos, sociedades financieras, cooperativas de ahorro y crédito, y mutualistas. También incluye instituciones de servicios financieros y auxiliares, adjuntando al registro la siguiente documentación: </strong>
1214      </div>
1215      <div>
1216        <ul style="margin: 5px 0; padding-left: 15px;">
1217          <li>Acuerdo o Resolución de creación emitida por la Superintendencia de Bancos o la Superintendencia de Economía Popular y Solidaria, según corresponda.</li>
1218          <li>Certificado del RUC.</li>
1219          <li>Copia del documento de identificación del representante legal.</li>
1220        </ul>
1221      </div>
1222    `;
1223        } else if (dominio.endsWith('.org.ec')) {
1224            contenido = `
1225      <div style="margin-bottom: 20px;">
1226        <strong>LA EXTENSIÓN ORG.EC puede ser registrada por fundaciones, corporaciones (asociación, club, comité, federacion, confederación), adjuntando al registro la siguiente documentación: </strong>
1227      </div>
1228      <div>
1229        <ul style="margin: 5px 0; padding-left: 15px;">
1230          <li>Acuerdo o Resolución del otorgamiento de la personalidad jurídica de las Organizaciones Sociales sin fines de Lucro emitida por el Ministerio de Inclusión Económica y Social (MIES).</li>
1231          <li>Certificado del RUC.</li>
1232          <li>Cédula del representante legal.</li>
1233        </ul>
1234      </div>
1235    `;
1236        } else if (dominio.endsWith('.k12.ec')) {
1237            contenido = `
1238      <div style="margin-bottom: 20px;">
1239        <strong>LA EXTENSIÓN k12.EC puede ser registrada únicamente por instituciones educativas de nivel inicial del Ecuador, adjuntando al registro la siguiente documentación: </strong>
1240      </div>
1241      <div>
1242        <ul style="margin: 5px 0; padding-left: 15px;">
1243          <li>Acuerdo Ministerial de creación de la Institución</li>
1244          <li>Copia del documento de identificación del representante legal.</li>
1245          <li>Certificado electrónico de RUC emitido por el SRI.</li>
1246        </ul>
1247      </div>
1248    `;
1249        } else if (dominio.endsWith('.edu.ec')) {
1250            contenido = `
1251      <div style="margin-bottom: 20px;">
1252        <strong>LA EXTENSIÓN EDU.EC puede ser registrada únicamente por instituciones educativas del Ecuador, adjuntando al registro la siguiente documentación: </strong>
1253      </div>
1254      <div>
1255        <ul style="margin: 5px 0; padding-left: 15px;">
1256          <li>Acuerdo ministerial de la creación de la institución.</li>
1257          <li>Copia del documento de identificación del representante legal.</li>
1258          <li>Certificado electrónico de RUC emitido por el SRI.</li>
1259        </ul>
1260      </div>
1261    `;
1262        } else if (dominio.endsWith('.abg.ec')) {
1263            contenido = `
1264      <div style="margin-bottom: 20px;">
1265        <strong>LA EXTENSIÓN ABG.EC puede ser registrada únicamente por profesionales en Derecho y Estudios Jurídicos del Ecuador, adjuntando al registro la siguiente documentación</strong>
1266      </div>
1267      <div style="margin-bottom: 10px;">
1268        <strong>Estudios Jurídicos:</strong>
1269        <ul style="margin: 5px 0; padding-left: 15px;">
1270          <li>Certificado electrónico del RUC.</li>
1271          <li>Copia del documento de identificación del representante legal.</li>
1272        </ul>
1273      </div>
1274      <div>
1275        <strong>Profesionales:</strong>
1276        <ul style="margin: 5px 0; padding-left: 15px;">
1277          <li>Certificado electrónico de registro de título universitario emitido por SENECYT.</li>
1278          <li>Documento de identificación.</li>
1279        </ul>
1280      </div>
1281    `;
1282        } else if (dominio.endsWith('.chef.ec')) {
1283            contenido = `
1284      <div style="margin-bottom: 20px;">
1285        <strong>LA EXTENSIÓN CHEF.EC puede ser registrada únicamente por Chef titulados, adjuntando al registro la siguiente documentación.</strong>
1286      </div>
1287      <div style="margin-bottom: 10px;">
1288        <ul style="margin: 5px 0; padding-left: 15px;">
1289          <li>Certificado electrónico de registro de título universitario emitido por SENECYT.</li>
1290          <li>Documento de identificación.</li>
1291        </ul>
1292      </div>
1293    `;
1294        } else if (dominio.endsWith('.vet.ec')) {
1295            contenido = `
1296      <div style="margin-bottom: 20px;">
1297        <strong>LA EXTENSIÓN VET.EC puede ser registrada únicamente por profesionales en Veterinaria y Clinicas Veter
1297inarias del Ecuador, adjuntando al registro la siguiente documentación:</strong>
1298      </div>
1299      <div style="margin-bottom: 10px;">
1300        <strong>Profesionales:</strong>
1301        <ul style="margin: 5px 0; padding-left: 15px;">
1302          <li>Certificado electrónico de registro de título universitario emitido por SENECYT.</li>
1303          <li>Documento de identificación.</li>
1304        </ul>
1305      </div>
1306      <div>
1307        <strong>Establecimientos de atención a la salud:</strong>
1308        <ul style="margin: 5px 0; padding-left: 15px;">
1309          <li>Permiso de funcionamiento a establecimientos de servicios de salud públicos y privados del Sistema Nacional de Salud, emitido por La Agencia Nacional de Regulación, Control y Vigilancia Sanitaria (ARCSA) </li>
1310          <li>Certificado Electrónico del RUC.</li>
1311          <li>Copia del documento de identificación del representante legal.</li>
1312        </ul>
1313      </div>
1314    `;
1315        } else if (dominio.endsWith('.gob.ec')) {
1316            contenido = `
1317      <div style="margin-bottom: 20px;">
1318        <strong>LA EXTENSIÓN GOB.EC puede ser registrada únicamente por entidades de Gobierno del Ecuador, adjuntando al registro la siguiente documentación.</strong>
1319      </div>
1320      <div style="margin-bottom: 10px;">
1321        <ul style="margin: 5px 0; padding-left: 15px;">
1322          <li>Certificado Electrónico del RUC del ente de Gobierno.</li>
1323          <li>Nombramiento y copia del documento de identificación del representante legal.</li>
1324        </ul>
1325      </div>
1326    `;
1327        } else if (dominio.endsWith('.mil.ec')) {
1328            contenido = `
1329      <div style="margin-bottom: 20px;">
1330        <strong>LA EXTENSIÓN MIL.EC puede ser registrada únicamente por entidades militares del Ecuador, adjuntando al registro la siguiente documentación.</strong>
1331      </div>
1332      <div style="margin-bottom: 10px;">
1333        <ul style="margin: 5px 0; padding-left: 15px;">
1334          <li>Certificado Electrónico del RUC del ente de Gobierno.</li>
1335          <li>Nombramiento y copia del documento de identificación del representante legal.</li>
1336        </ul>
1337      </div>
1338    `;
1339        }
1340
1341        jQuery('.tooltip-popup').html(contenido);
1342    }
1343
1344    document.head.insertAdjacentHTML('beforeend', `
1345<style>
1346.input-container-home-search.error .search-input-box{
1347  border: 2px solid #d32f2f !important;
1348  box-shadow: 0 0 0 3px rgba(211,47,47,.15);
1349  outline: none;
1350}
1351
1352.modal-header .close{ font-size: 3rem !important; color:#000 !important; }
1353.modal .modal-header{
1354  background-color: #fff !important;
1355  border-bottom:none !important;
1356  border-radius: 2rem !important;
1357}
1358.tooltip-requisitos {
1359  position: relative;
1360  display: inline-block;
1361  cursor: help;
1362  color: #000;
1363  font-family: "Montserrat-Regular";
1364}
1365.tooltip-icon {
1366  display: inline-flex;
1367  align-items: center;
1368  justify-content: center;
1369  width: 16px;
1370  height: 16px;
1371  background-color: #000;
1372  color: white;
1373  border-radius: 50%;
1374  font-size: 11px;
1375  font-weight: bold;
1376  margin-left: 5px;
1377}
1378.tooltip-popup {
1379  visibility: hidden;
1380  opacity: 0;
1381  position: absolute;
1382  top: 100%;
1383  left: 50%;
1384  transform: translateX(-50%);
1385  margin-top: 5px;
1386  width: 400px;
1387  max-width: 90vw;
1388  background-color: white;
1389  color: #000;
1390  text-align: left;
1391  border-radius: 6px;
1392  padding: 15px;
1393  border: 1px solid #ccc;
1394  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
1395  z-index: 9999;
1396  transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out;
1397  max-height: 400px;
1398  overflow-y: auto;
1399}
1400.tooltip-popup::before {
1401  content: "";
1402  position: absolute;
1403  bottom: 100%;
1404  left: 50%;
1405  margin-left: -5px;
1406  border-width: 5px;
1407  border-style: solid;
1408  border-color: transparent transparent #ccc transparent;
1409}
1410.tooltip-popup::after {
1411  content: "";
1412  position: absolute;
1413  bottom: 100%;
1414  left: 50%;
1415  margin-left: -4px;
1416  border-width: 4px;
1417  border-style: solid;
1418  border-color: transparent transparent white transparent;
1419}
1420.tooltip-requisitos:hover .tooltip-popup { visibility: visible; opacity: 1; }
1421.tooltip-popup h4 { margin: 0 0 10px 0; font-size: 14px; font-weight: bold; color: #000; }
1422.tooltip-popup p { margin: 0; font-size: 13px; line-height: 1.4; }
1423.tooltip-popup strong { display: block; margin-bottom: 5px; font-size: 13px; color: #444; }
1424.tooltip-popup ul { list-style-type: disc; }
1425.tooltip-popup li { font-size: 12px; line-height: 1.4; margin-bottom: 3px; list-style: disc; }
1426@media (max-width: 500px) {
1427  .tooltip-popup { width: 280px; left: 0; transform: none; margin-left: -50px; }
1428}
1429</style>
1430`);
1431
1432})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.