document.addEventListener("DOMContentLoaded",function(){if(/iPad|iPhone|Macintosh/.test(navigator.userAgent)){const e=document.querySelectorAll(".search-wrapper kbd");e.forEach(e=>{e.innerHTML='⌘K'})}}),function(){const l="/es.search-data.json",d=document.querySelectorAll(".search-input");for(const e of d)e.addEventListener("focus",s),e.addEventListener("keyup",h),e.addEventListener("keydown",o);function e(){const e=Array.from(document.querySelectorAll(".search-wrapper")).filter(e=>e.clientHeight>0);return e.length===1?{wrapper:e[0],inputElement:e[0].querySelector(".search-input"),resultsElement:e[0].querySelector(".search-results")}:void 0}const r=["input","select","button","textarea"];document.addEventListener("keydown",function(t){const{inputElement:n}=e();if(!n)return;const s=document.activeElement,o=s&&s.tagName;if(n===s||!o||r.includes(o)||s&&s.isContentEditable)return;t.key==="/"||t.key==="k"&&(t.metaKey||t.ctrlKey)?(t.preventDefault(),n.focus()):t.key==="Escape"&&n.value&&n.blur()}),document.addEventListener("mousedown",function(n){const{inputElement:o,resultsElement:s}=e();if(!o||!s)return;n.target!==o&&n.target!==s&&!s.contains(n.target)&&t()});function i(){const{resultsElement:n}=e();if(!n)return{result:void 0,index:-1};const t=n.querySelector(".active");if(!t)return{result:void 0,index:-1};const s=parseInt(t.dataset.index,10);return{result:t,index:s}}function a(t){const{resultsElement:s}=e();if(!s)return;const{result:o}=i();o&&o.classList.remove("active");const n=s.querySelector(`[data-index="${t}"]`);n&&(n.classList.add("active"),n.focus())}function c(){const{resultsElement:t}=e();return t?t.dataset.count:0}function n(){const{inputElement:n}=e();if(!n)return;t(),n.value="",n.blur()}function t(){const{resultsElement:t}=e();if(!t)return;t.classList.add("hidden")}function o(s){const{inputElement:r}=e();if(!r)return;const d=c(),{result:l,index:o}=i();switch(s.key){case"ArrowUp":s.preventDefault(),o>0&&a(o-1);break;case"ArrowDown":s.preventDefault(),o+1e._page_rk===t._page_rk?e._section_rk-t._section_rk:s[e._page_rk]!==s[t._page_rk]?s[t._page_rk]-s[e._page_rk]:e._page_rk-t._page_rk).map(e=>({id:`${e._page_rk}_${e._section_rk}`,route:e.route,prefix:e.prefix,children:e.children}));m(c,i)}function m(t,s){const{resultsElement:i}=e();if(!i)return;if(!t.length){i.innerHTML=`No hubo resultados.`;return}function r(e,t){const n=t.replace(/[-\\^$*+?.()|[\]{}]/g,"\\$&"),s=new RegExp(n,"gi");return e.replace(s,e=>`${e}`)}function c(e){const t=document.createElement("div");return t.innerHTML=e.trim(),t.firstChild}function l(e){const t=e.target.closest("a");if(t){const e=i.querySelector("a.active");e&&e.classList.remove("active"),t.classList.add("active")}}const a=document.createDocumentFragment();for(let i=0;i${e.prefix}`));let d=c(` `+r(e.children.title,s)+``+(e.children.content?``+r(e.children.content,s)+``:"")+` `);d.addEventListener("mousemove",l),d.addEventListener("keydown",o),d.querySelector("a").addEventListener("click",n),a.appendChild(d)}i.appendChild(a),i.dataset.count=t.length}}()