From 3896c1597c847ae31528d2e59b24e01d26a6485a Mon Sep 17 00:00:00 2001 From: vinidlidoo Date: Tue, 24 Feb 2026 22:46:44 -0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(search):=20prevent=20IME=20c?= =?UTF-8?q?omposition=20from=20triggering=20navigation=20(#628)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/js/searchElasticlunr.js | 5 +++-- static/js/searchElasticlunr.min.js | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/static/js/searchElasticlunr.js b/static/js/searchElasticlunr.js index 9ad09e1a..b496af97 100644 --- a/static/js/searchElasticlunr.js +++ b/static/js/searchElasticlunr.js @@ -3157,7 +3157,8 @@ window.onload = function () { if ( ['ArrowUp', 'ArrowDown', 'Home', 'End', 'PageUp', 'PageDown'].includes( event.key - ) + ) && + !event.isComposing ) { event.preventDefault(); let newIndex = activeDivIndex; @@ -3188,7 +3189,7 @@ window.onload = function () { } } - if (event.key === 'Enter' && activeDiv) { + if (event.key === 'Enter' && activeDiv && !event.isComposing) { event.preventDefault(); event.stopImmediatePropagation(); const anchorTag = activeDiv.querySelector('a'); diff --git a/static/js/searchElasticlunr.min.js b/static/js/searchElasticlunr.min.js index 291bc7a3..3d0afbde 100644 --- a/static/js/searchElasticlunr.min.js +++ b/static/js/searchElasticlunr.min.js @@ -1 +1 @@ -!function(){function g(e){var t=new g.Index;return t.pipeline.add(g.trimmer,g.stopWordFilter,g.stemmer),e&&e.call(t,t),t}var t;g.version="0.9.5",(lunr=g).utils={},g.utils.warn=(t=this,function(e){t.console&&console.warn&&console.warn(e)}),g.utils.toString=function(e){return null==e?"":e.toString()},(g.EventEmitter=function(){this.events={}}).prototype.addListener=function(){var e=Array.prototype.slice.call(arguments);const t=e.pop();if("function"!=typeof t)throw new TypeError("last argument must be a function");e.forEach(function(e){this.hasHandler(e)||(this.events[e]=[]),this.events[e].push(t)},this)},g.EventEmitter.prototype.removeListener=function(e,t){this.hasHandler(e)&&-1!==(t=this.events[e].indexOf(t))&&(this.events[e].splice(t,1),0===this.events[e].length)&&delete this.events[e]},g.EventEmitter.prototype.emit=function(e){if(this.hasHandler(e)){const t=Array.prototype.slice.call(arguments,1);this.events[e].forEach(function(e){e.apply(void 0,t)},this)}},g.EventEmitter.prototype.hasHandler=function(e){return e in this.events},(g.tokenizer=function(n){if(!arguments.length||null==n)return[];if(Array.isArray(n)){let e=n.filter(function(e){return null!=e}),t=(e=e.map(function(e){return g.utils.toString(e).toLowerCase()}),[]);return e.forEach(function(e){e=e.split(g.tokenizer.seperator),t=t.concat(e)},this),t}return n.toString().trim().toLowerCase().split(g.tokenizer.seperator)}).defaultSeperator=/[\s-]+/,g.tokenizer.seperator=g.tokenizer.defaultSeperator,g.tokenizer.setSeperator=function(e){null!=e&&"object"==typeof e&&(g.tokenizer.seperator=e)},g.tokenizer.resetSeperator=function(){g.tokenizer.seperator=g.tokenizer.defaultSeperator},g.tokenizer.getSeperator=function(){return g.tokenizer.seperator},(g.Pipeline=function(){this._queue=[]}).registeredFunctions={},g.Pipeline.registerFunction=function(e,t){t in g.Pipeline.registeredFunctions&&g.utils.warn("Overwriting existing registered function: "+t),e.label=t,g.Pipeline.registeredFunctions[t]=e},g.Pipeline.getRegisteredFunction=function(e){return e in g.Pipeline.registeredFunctions!=1?null:g.Pipeline.registeredFunctions[e]},g.Pipeline.warnIfFunctionNotRegistered=function(e){e.label&&e.label in this.registeredFunctions||g.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\n",e)},g.Pipeline.load=function(e){const n=new g.Pipeline;return e.forEach(function(e){var t=g.Pipeline.getRegisteredFunction(e);if(!t)throw new Error("Cannot load un-registered function: "+e);n.add(t)}),n},g.Pipeline.prototype.add=function(){Array.prototype.slice.call(arguments).forEach(function(e){g.Pipeline.warnIfFunctionNotRegistered(e),this._queue.push(e)},this)},g.Pipeline.prototype.after=function(e,t){if(g.Pipeline.warnIfFunctionNotRegistered(t),-1===(e=this._queue.indexOf(e)))throw new Error("Cannot find existingFn");this._queue.splice(e+1,0,t)},g.Pipeline.prototype.before=function(e,t){if(g.Pipeline.warnIfFunctionNotRegistered(t),-1===(e=this._queue.indexOf(e)))throw new Error("Cannot find existingFn");this._queue.splice(e,0,t)},g.Pipeline.prototype.remove=function(e){-1!==(e=this._queue.indexOf(e))&&this._queue.splice(e,1)},g.Pipeline.prototype.run=function(o){var e=[],t=o.length,i=this._queue.length;for(let n=0;ne&&(n=i),o=n-t,i=t+Math.floor(o/2),r=this.elements[i]}return r===e?i:-1},lunr.SortedSet.prototype.locationFor=function(e){let t=0,n=this.elements.length,o=n-t,i=t+Math.floor(o/2),r=this.elements[i];for(;1e&&(n=i),o=n-t,i=t+Math.floor(o/2),r=this.elements[i];return r>e?i:ri-1||o>r-1);)s[n]===l[o]?(t.add(s[n]),n++,o++):s[n]l[o]&&o++;return t},lunr.SortedSet.prototype.clone=function(){var e=new lunr.SortedSet;return e.elements=this.toArray(),e.length=e.elements.length,e},lunr.SortedSet.prototype.union=function(e){let t,n,o;n=this.length>=e.length?(t=this,e):(t=e,this),o=t.clone();for(let e=0,t=n.toArray();e{let t=n.getAttribute(e);t&&(t=t.replace("$SHORTCUT",v),n.setAttribute(e,t))})}s.addEventListener("keydown",function(e){"Enter"!==e.key&&" "!==e.key||s.click()});let e,r=(f.addEventListener("click",o),f.addEventListener("touchend",o,{passive:!0}),document.addEventListener("keydown",function(e){"Escape"===e.key&&u()}),p.addEventListener("click",function(){t(),h.focus()}),p.addEventListener("keydown",function(e){"Enter"!==e.key&&" "!==e.key||(t(),h.focus(),e.preventDefault())}),s.addEventListener("mouseover",i),s.addEventListener("click",l),s.addEventListener("touchstart",l,{passive:!0}),null);function l(){e=document.activeElement,i(),f.style.display="block",h.focus()}function u(){f.style.display="none",t(),e&&document.body.contains(e)&&e.focus()}function a(e){var t;"true"!==e.getAttribute("aria-selected")&&([t=null]=[e],y.querySelectorAll("#results > div").forEach(e=>{e!==t&&e.setAttribute("aria-selected","false")}),e.setAttribute("aria-selected","true")),h.setAttribute("aria-activedescendant",e.id)}function t(){h.value="",y.innerHTML="",g.style.display="none",h.removeAttribute("aria-activedescendant"),p.style.display="none"}function o(e){e.target===f&&u(),e.stopPropagation()}function i(){if(!r)if(window.searchIndex)r=Promise.resolve(elasticlunr.Index.load(window.searchIndex));else{var t=document.documentElement.getAttribute("lang").substring(0,2);let e=document.querySelector("meta[name='base']").getAttribute("content");e.endsWith("/")&&(e=e.slice(0,-1)),r=fetch(e+"/search_index."+t+".json").then(e=>e.json()).then(e=>elasticlunr.Index.load(e))}}function S(e){return e=parseInt(e,16).toString(2),[0,1,2,3,4][Math.ceil(e.length/8)]}function c(){a(this)}h.addEventListener("input",async function(){var e=this.value;const s=e.trim();var t=await r;y.innerHTML="",p.style.display=0{e&&(e.style.display="none")}),(o=m[o])&&(o.style.display="inline",o.textContent=o.textContent.replace("$NUMBER",t.toString()));let l=0;e.forEach(function(t){if(t.doc.title||t.doc.path||t.doc.id){var n=document.createElement("div"),o=(n.setAttribute("role","option"),n.id="result-"+l++,n.innerHTML="",n.querySelector("a")),i=n.querySelector("span:first-child"),r=n.querySelector("span:nth-child(2)"),i=(i.textContent=t.doc.title||t.doc.path||t.doc.id,t.doc.body?function(e,t){var n=t.map(function(e){return elasticlunr.stemmer(e.toLowerCase())});let o=0;var i=[];for(const m of e.toLowerCase().split(". ")){let t=!0;for(const v of m.split(/[\s\n]/)){if(0"),p[2]+p[0].length);!h.test(p[0])&&12<=p[0].length?(f=function(t){let n="",o=!1,i=0,r=0,s=0;for(let e=0;e"),d=g}c.push("…");var y=t=c.join("");return 150]+>/g,"").length?t.substring(0,150)+"…":y}(t.doc.body,s.split(/\s+/)):t.doc.description||"");r.innerHTML=i;let e=t.ref;t.doc.body&&(r=encodeURIComponent(s),e+="#:~:text="+r),o.href=e,y.appendChild(n)}}),h.setAttribute("aria-expanded",0e.split("#")[0].replace(/\/$/,""))(o)!==n(t)||e.ctrlKey||e.metaKey||u())}),document.querySelectorAll("#results > div").forEach(e=>{e.removeEventListener("touchstart",c),e.addEventListener("touchstart",c,{passive:!0})})},!0),document.addEventListener("keydown",function(t){var e=navigator.userAgent.toLowerCase().includes("mac")?t.metaKey:t.ctrlKey;if("k"===t.key&&e)t.preventDefault(),("block"===f.style.display?u:l)();else if(e=document.activeElement,"Tab"!==t.key||e!==h&&e!==p){if(0!==(r=y.querySelectorAll("#results > div")).length){var n,o,i=Array.from(r),r=y.querySelector('[aria-selected="true"]'),s=i.indexOf(r);if(["ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(t.key)){t.preventDefault();let e=s;switch(t.key){case"ArrowUp":e=Math.max(s-1,0);break;case"ArrowDown":e=Math.min(s+1,i.length-1);break;case"Home":e=0;break;case"End":e=i.length-1;break;case"PageUp":e=Math.max(s-3,0);break;case"PageDown":e=Math.min(s+3,i.length-1)}e!==s&&(a((o=i)[n=e]),o[n].scrollIntoView({block:"nearest",inline:"start"}))}"Enter"===t.key&&r&&(t.preventDefault(),t.stopImmediatePropagation(),(o=r.querySelector("a"))&&(window.location.href=o.getAttribute("href")),u())}}else t.preventDefault(),(e===h?p:h).focus()})}}; +!function(){function g(e){var t=new g.Index;return t.pipeline.add(g.trimmer,g.stopWordFilter,g.stemmer),e&&e.call(t,t),t}var t,e,n;g.version="0.9.5",(lunr=g).utils={},g.utils.warn=(t=this,function(e){t.console&&console.warn&&console.warn(e)}),g.utils.toString=function(e){return null==e?"":e.toString()},g.EventEmitter=function(){this.events={}},g.EventEmitter.prototype.addListener=function(){var e=Array.prototype.slice.call(arguments);let t=e.pop();if("function"!=typeof t)throw new TypeError("last argument must be a function");e.forEach(function(e){this.hasHandler(e)||(this.events[e]=[]),this.events[e].push(t)},this)},g.EventEmitter.prototype.removeListener=function(e,t){this.hasHandler(e)&&-1!==(t=this.events[e].indexOf(t))&&(this.events[e].splice(t,1),0===this.events[e].length)&&delete this.events[e]},g.EventEmitter.prototype.emit=function(e){if(this.hasHandler(e)){let t=Array.prototype.slice.call(arguments,1);this.events[e].forEach(function(e){e.apply(void 0,t)},this)}},g.EventEmitter.prototype.hasHandler=function(e){return e in this.events},g.tokenizer=function(n){if(!arguments.length||null==n)return[];if(Array.isArray(n)){let e=n.filter(function(e){return null!=e}),t=(e=e.map(function(e){return g.utils.toString(e).toLowerCase()}),[]);return e.forEach(function(e){e=e.split(g.tokenizer.seperator);t=t.concat(e)},this),t}return n.toString().trim().toLowerCase().split(g.tokenizer.seperator)},g.tokenizer.defaultSeperator=/[\s-]+/,g.tokenizer.seperator=g.tokenizer.defaultSeperator,g.tokenizer.setSeperator=function(e){null!=e&&"object"==typeof e&&(g.tokenizer.seperator=e)},g.tokenizer.resetSeperator=function(){g.tokenizer.seperator=g.tokenizer.defaultSeperator},g.tokenizer.getSeperator=function(){return g.tokenizer.seperator},g.Pipeline=function(){this._queue=[]},g.Pipeline.registeredFunctions={},g.Pipeline.registerFunction=function(e,t){t in g.Pipeline.registeredFunctions&&g.utils.warn("Overwriting existing registered function: "+t),e.label=t,g.Pipeline.registeredFunctions[t]=e},g.Pipeline.getRegisteredFunction=function(e){return e in g.Pipeline.registeredFunctions!=!0?null:g.Pipeline.registeredFunctions[e]},g.Pipeline.warnIfFunctionNotRegistered=function(e){e.label&&e.label in this.registeredFunctions||g.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\n",e)},g.Pipeline.load=function(e){let n=new g.Pipeline;return e.forEach(function(e){var t=g.Pipeline.getRegisteredFunction(e);if(!t)throw new Error("Cannot load un-registered function: "+e);n.add(t)}),n},g.Pipeline.prototype.add=function(){Array.prototype.slice.call(arguments).forEach(function(e){g.Pipeline.warnIfFunctionNotRegistered(e),this._queue.push(e)},this)},g.Pipeline.prototype.after=function(e,t){g.Pipeline.warnIfFunctionNotRegistered(t);e=this._queue.indexOf(e);if(-1===e)throw new Error("Cannot find existingFn");this._queue.splice(e+1,0,t)},g.Pipeline.prototype.before=function(e,t){g.Pipeline.warnIfFunctionNotRegistered(t);e=this._queue.indexOf(e);if(-1===e)throw new Error("Cannot find existingFn");this._queue.splice(e,0,t)},g.Pipeline.prototype.remove=function(e){e=this._queue.indexOf(e);-1!==e&&this._queue.splice(e,1)},g.Pipeline.prototype.run=function(o){var e=[],t=o.length,i=this._queue.length;for(let n=0;n{if(null===e||"object"!=typeof e)return e;var t,n=e.constructor();for(t in e)e.hasOwnProperty(t)&&(n[t]=e[t]);return n})(t):this.docs[e]=null},g.DocumentStore.prototype.getDoc=function(e){return!1===this.hasDoc(e)?null:this.docs[e]},g.DocumentStore.prototype.hasDoc=function(e){return e in this.docs},g.DocumentStore.prototype.removeDoc=function(e){this.hasDoc(e)&&(delete this.docs[e],delete this.docInfo[e],this.length--)},g.DocumentStore.prototype.addFieldLength=function(e,t,n){null!=e&&0!=this.hasDoc(e)&&(this.docInfo[e]||(this.docInfo[e]={}),this.docInfo[e][t]=n)},g.DocumentStore.prototype.updateFieldLength=function(e,t,n){null!=e&&0!=this.hasDoc(e)&&this.addFieldLength(e,t,n)},g.DocumentStore.prototype.getFieldLength=function(e,t){return null!=e&&e in this.docs&&t in this.docInfo[e]?this.docInfo[e][t]:0},g.DocumentStore.prototype.toJSON=function(){return{docs:this.docs,docInfo:this.docInfo,length:this.length,save:this._save}},g.stemmer=(()=>{let a={ational:"ate",tional:"tion",enci:"ence",anci:"ance",izer:"ize",bli:"ble",alli:"al",entli:"ent",eli:"e",ousli:"ous",ization:"ize",ation:"ate",ator:"ate",alism:"al",iveness:"ive",fulness:"ful",ousness:"ous",aliti:"al",iviti:"ive",biliti:"ble",logi:"log"},c={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""};var e="[aeiouy]",t="[^aeiou][^aeiouy]*";let d=new RegExp("^([^aeiou][^aeiouy]*)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*"),h=new RegExp("^([^aeiou][^aeiouy]*)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*[aeiouy][aeiou]*[^aeiou][^aeiouy]*"),f=new RegExp("^([^aeiou][^aeiouy]*)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*([aeiouy][aeiou]*)?$"),p=new RegExp("^([^aeiou][^aeiouy]*)?[aeiouy]"),g=/^(.+?)(ss|i)es$/,m=/^(.+?)([^s])s$/,y=/^(.+?)eed$/,v=/^(.+?)(ed|ing)$/,w=/.$/,S=/(at|bl|iz)$/,b=new RegExp("([^aeiouylsz])\\1$"),x=new RegExp("^"+t+e+"[^aeiouwxy]$"),E=/^(.+?[^aeiou])y$/,I=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,k=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,_=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,D=/^(.+?)(s|t)(ion)$/,F=/^(.+?)e$/,A=/ll$/,C=new RegExp("^"+t+e+"[^aeiouwxy]$");return function(e){let t,n,o,i,r,s,l;var u;return e.length<3||("y"==(o=e.substr(0,1))&&(e=o.toUpperCase()+e.substr(1)),i=g,r=m,i.test(e)?e=e.replace(i,"$1$2"):r.test(e)&&(e=e.replace(r,"$1$2")),i=y,r=v,i.test(e)?(u=i.exec(e),(i=d).test(u[1])&&(i=w,e=e.replace(i,""))):r.test(e)&&(u=r.exec(e),t=u[1],(r=p).test(t))&&(e=t,r=S,s=b,l=x,r.test(e)?e+="e":s.test(e)?(i=w,e=e.replace(i,"")):l.test(e)&&(e+="e")),(i=E).test(e)&&(u=i.exec(e),e=(t=u[1])+"i"),(i=I).test(e)&&(u=i.exec(e),t=u[1],n=u[2],(i=d).test(t))&&(e=t+a[n]),(i=k).test(e)&&(u=i.exec(e),t=u[1],n=u[2],(i=d).test(t))&&(e=t+c[n]),i=_,r=D,i.test(e)?(u=i.exec(e),t=u[1],(i=h).test(t)&&(e=t)):r.test(e)&&(u=r.exec(e),t=u[1]+u[2],(r=h).test(t))&&(e=t),(i=F).test(e)&&(u=i.exec(e),t=u[1],i=h,r=f,s=C,i.test(t)||r.test(t)&&!s.test(t))&&(e=t),i=A,r=h,i.test(e)&&r.test(e)&&(i=w,e=e.replace(i,"")),"y"==o&&(e=o.toLowerCase()+e.substr(1))),e}})(),g.Pipeline.registerFunction(g.stemmer,"stemmer"),g.stopWordFilter=function(e){if(e&&!0!==g.stopWordFilter.stopWords[e])return e},g.clearStopWords=function(){g.stopWordFilter.stopWords={}},g.addStopWords=function(e){null!=e&&!1!==Array.isArray(e)&&e.forEach(function(e){g.stopWordFilter.stopWords[e]=!0},this)},g.resetStopWords=function(){g.stopWordFilter.stopWords=g.defaultStopWords},g.defaultStopWords={"":!0,a:!0,able:!0,about:!0,across:!0,after:!0,all:!0,almost:!0,also:!0,am:!0,among:!0,an:!0,and:!0,any:!0,are:!0,as:!0,at:!0,be:!0,because:!0,been:!0,but:!0,by:!0,can:!0,cannot:!0,could:!0,dear:!0,did:!0,do:!0,does:!0,either:!0,else:!0,ever:!0,every:!0,for:!0,from:!0,get:!0,got:!0,had:!0,has:!0,have:!0,he:!0,her:!0,hers:!0,him:!0,his:!0,how:!0,however:!0,i:!0,if:!0,in:!0,into:!0,is:!0,it:!0,its:!0,just:!0,least:!0,let:!0,like:!0,likely:!0,may:!0,me:!0,might:!0,most:!0,must:!0,my:!0,neither:!0,no:!0,nor:!0,not:!0,of:!0,off:!0,often:!0,on:!0,only:!0,or:!0,other:!0,our:!0,own:!0,rather:!0,said:!0,say:!0,says:!0,she:!0,should:!0,since:!0,so:!0,some:!0,than:!0,that:!0,the:!0,their:!0,them:!0,then:!0,there:!0,these:!0,they:!0,this:!0,tis:!0,to:!0,too:!0,twas:!0,us:!0,wants:!0,was:!0,we:!0,were:!0,what:!0,when:!0,where:!0,which:!0,while:!0,who:!0,whom:!0,why:!0,will:!0,with:!0,would:!0,yet:!0,you:!0,your:!0},g.stopWordFilter.stopWords=g.defaultStopWords,g.Pipeline.registerFunction(g.stopWordFilter,"stopWordFilter"),g.trimmer=function(e){if(null==e)throw new Error("token should not be undefined");return e.replace(/^\W+/,"").replace(/\W+$/,"")},g.Pipeline.registerFunction(g.trimmer,"trimmer"),g.InvertedIndex=function(){this.root={docs:{},df:0}},g.InvertedIndex.load=function(e){var t=new this;return t.root=e.root,t},g.InvertedIndex.prototype.addToken=function(e,t,n){n=n||this.root;let o=0;for(;o<=e.length-1;){var i=e[o];i in n||(n[i]={docs:{},df:0}),o+=1,n=n[i]}var r=t.ref;n.docs[r]?n.docs[r]={tf:t.tf}:(n.docs[r]={tf:t.tf},n.df+=1)},g.InvertedIndex.prototype.hasToken=function(t){if(!t)return!1;let n=this.root;for(let e=0;ee&&(n=i),o=n-t,i=t+Math.floor(o/2),r=this.elements[i]}return r===e?i:-1},lunr.SortedSet.prototype.locationFor=function(e){let t=0,n=this.elements.length,o=n-t,i=t+Math.floor(o/2),r=this.elements[i];for(;1e&&(n=i),o=n-t,i=t+Math.floor(o/2),r=this.elements[i];return r>e?i:ri-1||o>r-1);)s[n]===l[o]?(t.add(s[n]),n++,o++):s[n]l[o]&&o++;return t},lunr.SortedSet.prototype.clone=function(){var e=new lunr.SortedSet;return e.elements=this.toArray(),e.length=e.elements.length,e},lunr.SortedSet.prototype.union=function(e){let t,n,o;n=this.length>=e.length?(t=this,e):(t=e,this),o=t.clone();for(let e=0,t=n.toArray();e{let t=s.getAttribute(e);t&&(t=t.replace("$SHORTCUT",n),s.setAttribute(e,t))})}t.addEventListener("keydown",function(e){"Enter"!==e.key&&" "!==e.key||t.click()});let e,d=(l.addEventListener("click",m),l.addEventListener("touchend",m,{passive:!0}),document.addEventListener("keydown",function(e){"Escape"===e.key&&p()}),a.addEventListener("click",function(){n(),u.focus()}),a.addEventListener("keydown",function(e){"Enter"!==e.key&&" "!==e.key||(n(),u.focus(),e.preventDefault())}),t.addEventListener("mouseover",y),t.addEventListener("click",f),t.addEventListener("touchstart",f,{passive:!0}),null);function f(){e=document.activeElement,y(),l.style.display="block",u.focus()}function p(){l.style.display="none",n(),e&&document.body.contains(e)&&e.focus()}function g(e){var t;"true"!==e.getAttribute("aria-selected")&&([t=null]=[e],c.querySelectorAll("#results > div").forEach(e=>{e!==t&&e.setAttribute("aria-selected","false")}),e.setAttribute("aria-selected","true")),u.setAttribute("aria-activedescendant",e.id)}function n(){u.value="",c.innerHTML="",i.style.display="none",u.removeAttribute("aria-activedescendant"),a.style.display="none"}function m(e){e.target===l&&p(),e.stopPropagation()}function y(){if(!d)if(window.searchIndex)d=Promise.resolve(elasticlunr.Index.load(window.searchIndex));else{var t=document.documentElement.getAttribute("lang").substring(0,2);let e=document.querySelector("meta[name='base']").getAttribute("content");e.endsWith("/")&&(e=e.slice(0,-1)),d=fetch(e+"/search_index."+t+".json").then(e=>e.json()).then(e=>elasticlunr.Index.load(e))}}function S(e){return e=parseInt(e,16).toString(2),[0,1,2,3,4][Math.ceil(e.length/8)]}function v(e,t){var n=t.map(function(e){return elasticlunr.stemmer(e.toLowerCase())});let o=0;var i,r,s=[];for(i of e.toLowerCase().split(". ")){let t=!0;for(r of i.split(/[\s\n]/)){if(0{let o=0,i=t-1;for(;0<=i&&o"),y[2]+y[0].length);!g.test(y[0])&&12<=y[0].length?(m=((t,n)=>{let o="",i=!1,r=0,s=0,l=0;for(let e=0;e"),p=v}f.push("…");t=f.join("");let w=t;return w=150]+>/g,"").length?t.substring(0,150)+"…":w}function w(){g(this)}u.addEventListener("input",async function(){var e=this.value;let s=e.trim();var t,n=await d,e=(c.innerHTML="",a.style.display=0{let n="";var o;return n=0===e?"zero_results":1===e?"one_results":"ar"===t?(o=e%100,2===e?"two_results":3<=o&&o<=10?"few_results":"many_results"):["uk","be","bs","hr","ru","sr"].includes(t)?(o=e%100,1==(t=e%10)&&11!=o?"one_results":2<=t&&t<=4&&!(12<=o&&o<=14)?"few_results":"many_results"):"many_results"})(n,o),Object.values(r).forEach(e=>{e&&(e.style.display="none")}),(t=r[t])&&(t.style.display="inline",t.textContent=t.textContent.replace("$NUMBER",n.toString()));let l=0;e.forEach(function(t){if(t.doc.title||t.doc.path||t.doc.id){var n=document.createElement("div"),o=(n.setAttribute("role","option"),n.id="result-"+l++,n.innerHTML="",n.querySelector("a")),i=n.querySelector("span:first-child"),r=n.querySelector("span:nth-child(2)"),i=(i.textContent=t.doc.title||t.doc.path||t.doc.id,t.doc.body?v(t.doc.body,s.split(/\s+/)):t.doc.description||"");r.innerHTML=i;let e=t.ref;t.doc.body&&(r=encodeURIComponent(s),e+="#:~:text="+r),o.href=e,c.appendChild(n)}}),u.setAttribute("aria-expanded",0e.split("#")[0].replace(/\/$/,""))(o)!==n(t)||e.ctrlKey||e.metaKey||p())}),document.querySelectorAll("#results > div").forEach(e=>{e.removeEventListener("touchstart",w),e.addEventListener("touchstart",w,{passive:!0})})},!0),document.addEventListener("keydown",function(t){var e=navigator.userAgent.toLowerCase().includes("mac")?t.metaKey:t.ctrlKey;if("k"===t.key&&e)t.preventDefault(),("block"===l.style.display?p:f)();else{e=document.activeElement;if("Tab"!==t.key||e!==u&&e!==a){var n=c.querySelectorAll("#results > div");if(0!==n.length){var o,i,r=Array.from(n),n=c.querySelector('[aria-selected="true"]'),s=r.indexOf(n);if(["ArrowUp","ArrowDown","Home","End","PageUp","PageDown"].includes(t.key)&&!t.isComposing){t.preventDefault();let e=s;switch(t.key){case"ArrowUp":e=Math.max(s-1,0);break;case"ArrowDown":e=Math.min(s+1,r.length-1);break;case"Home":e=0;break;case"End":e=r.length-1;break;case"PageUp":e=Math.max(s-3,0);break;case"PageDown":e=Math.min(s+3,r.length-1)}e!==s&&(o=e,g((i=r)[o]),i[o].scrollIntoView({block:"nearest",inline:"start"}))}"Enter"===t.key&&n&&!t.isComposing&&(t.preventDefault(),t.stopImmediatePropagation(),(i=n.querySelector("a"))&&(window.location.href=i.getAttribute("href")),p())}}else t.preventDefault(),(e===u?a:u).focus()}})}}; \ No newline at end of file