(function(p,y){typeof exports=="object"&&typeof module<"u"?module.exports=y():typeof define=="function"&&define.amd?define(y):(p=typeof globalThis<"u"?globalThis:p||self,p.RevealSearch=y())})(this,(function(){"use strict";return()=>{let c,t,i,n,o,v,s;function x(){t=document.createElement("div"),t.classList.add("searchbox"),t.style.position="absolute",t.style.top="10px",t.style.right="10px",t.style.zIndex=10,t.innerHTML=` `,i=t.querySelector(".searchinput"),i.style.width="240px",i.style.fontSize="14px",i.style.padding="4px 6px",i.style.color="#000",i.style.background="#fff",i.style.borderRadius="2px",i.style.border="0",i.style.outline="0",i.style.boxShadow="0 2px 18px rgba(0, 0, 0, 0.2)",i.style["-webkit-appearance"]="none",c.getRevealElement().appendChild(t),i.addEventListener("keyup",function(r){r.keyCode===13?(r.preventDefault(),L(),v=!1):v=!0},!1),m()}function E(){t||x(),t.style.display="inline",i.focus(),i.select()}function m(){t||x(),t.style.display="none",s&&s.remove()}function N(){t||x(),t.style.display!=="inline"?E():m()}function L(){if(v){var r=i.value;r===""?(s&&s.remove(),n=null):(s=new I("slidecontent"),n=s.apply(r),o=0)}n&&(n.length&&n.length<=o&&(o=0),n.length>o&&(c.slide(n[o].h,n[o].v),o++))}function I(r,f){var M=document.getElementById(r)||document.body,S=f||"EM",B=new RegExp("^(?:"+S+"|SCRIPT|FORM)$"),R=["#ff6","#a0ffff","#9f9","#f99","#f6f"],b=[],D=0,g="",d=[];this.setRegex=function(e){e=e.trim(),g=new RegExp("("+e+")","i")},this.getRegex=function(){return g.toString().replace(/^\/\\b\(|\)\\b\/i$/g,"").replace(/\|/g," ")},this.hiliteWords=function(e){if(!(e==null||!e)&&g&&!B.test(e.nodeName)){if(e.hasChildNodes())for(var l=0;l{c=r,c.registerKeyboardShortcut("CTRL + Shift + F","Search"),document.addEventListener("keydown",function(f){f.key=="F"&&(f.ctrlKey||f.metaKey)&&(f.preventDefault(),N())},!1)},open:E,close:m,toggle:N}}}));