You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2 lines
24 KiB
JavaScript
2 lines
24 KiB
JavaScript
!function(){function p(e){var t=new p.Index;return t.pipeline.add(p.trimmer,p.stopWordFilter,p.stemmer),e&&e.call(t,t),t}var t;p.version="0.9.5",(lunr=p).utils={},p.utils.warn=(t=this,function(e){t.console&&console.warn&&console.warn(e)}),p.utils.toString=function(e){return null==e?"":e.toString()},(p.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)},p.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]},p.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)}},p.EventEmitter.prototype.hasHandler=function(e){return e in this.events},(p.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 p.utils.toString(e).toLowerCase()}),[]);return e.forEach(function(e){e=e.split(p.tokenizer.seperator),t=t.concat(e)},this),t}return n.toString().trim().toLowerCase().split(p.tokenizer.seperator)}).defaultSeperator=/[\s-]+/,p.tokenizer.seperator=p.tokenizer.defaultSeperator,p.tokenizer.setSeperator=function(e){null!=e&&"object"==typeof e&&(p.tokenizer.seperator=e)},p.tokenizer.resetSeperator=function(){p.tokenizer.seperator=p.tokenizer.defaultSeperator},p.tokenizer.getSeperator=function(){return p.tokenizer.seperator},(p.Pipeline=function(){this._queue=[]}).registeredFunctions={},p.Pipeline.registerFunction=function(e,t){t in p.Pipeline.registeredFunctions&&p.utils.warn("Overwriting existing registered function: "+t),e.label=t,p.Pipeline.registeredFunctions[t]=e},p.Pipeline.getRegisteredFunction=function(e){return e in p.Pipeline.registeredFunctions!=1?null:p.Pipeline.registeredFunctions[e]},p.Pipeline.warnIfFunctionNotRegistered=function(e){e.label&&e.label in this.registeredFunctions||p.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\n",e)},p.Pipeline.load=function(e){const n=new p.Pipeline;return e.forEach(function(e){var t=p.Pipeline.getRegisteredFunction(e);if(!t)throw new Error("Cannot load un-registered function: "+e);n.add(t)}),n},p.Pipeline.prototype.add=function(){Array.prototype.slice.call(arguments).forEach(function(e){p.Pipeline.warnIfFunctionNotRegistered(e),this._queue.push(e)},this)},p.Pipeline.prototype.after=function(e,t){if(p.Pipeline.warnIfFunctionNotRegistered(t),-1===(e=this._queue.indexOf(e)))throw new Error("Cannot find existingFn");this._queue.splice(e+1,0,t)},p.Pipeline.prototype.before=function(e,t){if(p.Pipeline.warnIfFunctionNotRegistered(t),-1===(e=this._queue.indexOf(e)))throw new Error("Cannot find existingFn");this._queue.splice(e,0,t)},p.Pipeline.prototype.remove=function(e){-1!==(e=this._queue.indexOf(e))&&this._queue.splice(e,1)},p.Pipeline.prototype.run=function(o){var e=[],t=o.length,i=this._queue.length;for(let n=0;n<t;n++){let t=o[n];for(let e=0;e<i&&void 0!==(t=this._queue[e](t,n,o))&&null!==t;e++);null!=t&&e.push(t)}return e},p.Pipeline.prototype.reset=function(){this._queue=[]},p.Pipeline.prototype.get=function(){return this._queue},p.Pipeline.prototype.toJSON=function(){return this._queue.map(function(e){return p.Pipeline.warnIfFunctionNotRegistered(e),e.label})},(p.Index=function(){this._fields=[],this._ref="id",this.pipeline=new p.Pipeline,this.documentStore=new p.DocumentStore,this.index={},this.eventEmitter=new p.EventEmitter,this._idfCache={},this.on("add","remove","update",function(){this._idfCache={}}.bind(this))}).prototype.on=function(){var e=Array.prototype.slice.call(arguments);return this.eventEmitter.addListener.apply(this.eventEmitter,e)},p.Index.prototype.off=function(e,t){return this.eventEmitter.removeListener(e,t)},p.Index.load=function(e){e.version!==p.version&&p.utils.warn("version mismatch: current "+p.version+" importing "+e.version);var t=new this;t._fields=e.fields,t._ref=e.ref,t.documentStore=p.DocumentStore.load(e.documentStore),t.pipeline=p.Pipeline.load(e.pipeline),t.index={};for(const n in e.index)t.index[n]=p.InvertedIndex.load(e.index[n]);return t},p.Index.prototype.addField=function(e){return this._fields.push(e),this.index[e]=new p.InvertedIndex,this},p.Index.prototype.setRef=function(e){return this._ref=e,this},p.Index.prototype.saveDocument=function(e){return this.documentStore=new p.DocumentStore(e),this},p.Index.prototype.addDoc=function(i,e){if(i){e=void 0===e||e;const r=i[this._ref];this.documentStore.addDoc(r,i),this._fields.forEach(function(e){var t=this.pipeline.run(p.tokenizer(i[e]));this.documentStore.addFieldLength(r,e,t.length);const n={};t.forEach(function(e){e in n?n[e]+=1:n[e]=1},this);for(const p in n){var o=n[p],o=Math.sqrt(o);this.index[e].addToken(p,{ref:r,tf:o})}},this),e&&this.eventEmitter.emit("add",i,this)}},p.Index.prototype.removeDocByRef=function(e,t){e&&!1!==this.documentStore.isDocStored()&&this.documentStore.hasDoc(e)&&(e=this.documentStore.getDoc(e),this.removeDoc(e,!1))},p.Index.prototype.removeDoc=function(e,t){if(e){t=void 0===t||t;const n=e[this._ref];this.documentStore.hasDoc(n)&&(this.documentStore.removeDoc(n),this._fields.forEach(function(t){this.pipeline.run(p.tokenizer(e[t])).forEach(function(e){this.index[t].removeToken(e,n)},this)},this),t)&&this.eventEmitter.emit("remove",e,this)}},p.Index.prototype.updateDoc=function(e,t){t=void 0===t||t,this.removeDocByRef(e[this._ref],!1),this.addDoc(e,!1),t&&this.eventEmitter.emit("update",e,this)},p.Index.prototype.idf=function(e,t){var n="@"+t+"/"+e;return Object.prototype.hasOwnProperty.call(this._idfCache,n)?this._idfCache[n]:(t=this.index[t].getDocFreq(e),e=1+Math.log(this.documentStore.length/(t+1)),this._idfCache[n]=e)},p.Index.prototype.getFields=function(){return this._fields.slice()},p.Index.prototype.search=function(t,e){if(!t)return[];t="string"==typeof t?{any:t}:JSON.parse(JSON.stringify(t));let n=null;null!=e&&(n=JSON.stringify(e));var o=new p.Configuration(n,this.getFields()).get(),i={},r=Object.keys(t);for(let e=0;e<r.length;e++){var s=r[e];i[s]=this.pipeline.run(p.tokenizer(t[s]))}var l={};for(const p in o){var u=i[p]||i.any;if(u){var a=this.fieldSearch(u,p,o),c=o[p].boost;for(h in a)a[h]=a[h]*c;for(h in a)h in l?l[h]+=a[h]:l[h]=a[h]}}var d,h,f=[];for(h in l)d={ref:h,score:l[h]},this.documentStore.hasDoc(h)&&(d.doc=this.documentStore.getDoc(h)),f.push(d);return f.sort(function(e,t){return t.score-e.score}),f},p.Index.prototype.fieldSearch=function(e,a,t){const c=t[a].bool,n=t[a].expand;t=t[a].boost;let d=null;const h={};if(0!==t)return e.forEach(function(l){let e=[l];!0===n&&(e=this.index[a].expandToken(l));const u={};e.forEach(function(n){let e=this.index[a].getDocs(n);var o=this.idf(n,a);if(d&&"AND"===c){var i,t={};for(i in d)i in e&&(t[i]=e[i]);e=t}for(i in n===l&&this.fieldSearchStats(h,n,e),e){var r=this.index[a].getTermFrequency(n,i),s=this.documentStore.getFieldLength(i,a);let e=1,t=(0!==s&&(e=1/Math.sqrt(s)),1);n!==l&&(t=.15*(1-(n.length-l.length)/n.length)),s=r*o*e*t,i in u?u[i]+=s:u[i]=s}},this),d=this.mergeScores(d,u,c)},this),d=this.coordNorm(d,h,e.length)},p.Index.prototype.mergeScores=function(e,t,n){if(!e)return t;if("AND"===n){var o={};for(i in t)i in e&&(o[i]=e[i]+t[i]);return o}for(var i in t)i in e?e[i]+=t[i]:e[i]=t[i];return e},p.Index.prototype.fieldSearchStats=function(e,t,n){for(const o in n)o in e?e[o].push(t):e[o]=[t]},p.Index.prototype.coordNorm=function(e,t,n){for(const i in e){var o;i in t&&(o=t[i].length,e[i]=e[i]*o/n)}return e},p.Index.prototype.toJSON=function(){const t={};return this._fields.forEach(function(e){t[e]=this.index[e].toJSON()},this),{version:p.version,fields:this._fields,ref:this._ref,documentStore:this.documentStore.toJSON(),index:t,pipeline:this.pipeline.toJSON()}},p.Index.prototype.use=function(e){var t=Array.prototype.slice.call(arguments,1);t.unshift(this),e.apply(this,t)},(p.DocumentStore=function(e){this._save=null==e||e,this.docs={},this.docInfo={},this.length=0}).load=function(e){var t=new this;return t.length=e.length,t.docs=e.docs,t.docInfo=e.docInfo,t._save=e.save,t},p.DocumentStore.prototype.isDocStored=function(){return this._save},p.DocumentStore.prototype.addDoc=function(e,t){this.hasDoc(e)||this.length++,!0===this._save?this.docs[e]=function(e){if(null===e||"object"!=typeof e)return e;var t=e.constructor();for(const n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}(t):this.docs[e]=null},p.DocumentStore.prototype.getDoc=function(e){return!1===this.hasDoc(e)?null:this.docs[e]},p.DocumentStore.prototype.hasDoc=function(e){return e in this.docs},p.DocumentStore.prototype.removeDoc=function(e){this.hasDoc(e)&&(delete this.docs[e],delete this.docInfo[e],this.length--)},p.DocumentStore.prototype.addFieldLength=function(e,t,n){null!=e&&0!=this.hasDoc(e)&&(this.docInfo[e]||(this.docInfo[e]={}),this.docInfo[e][t]=n)},p.DocumentStore.prototype.updateFieldLength=function(e,t,n){null!=e&&0!=this.hasDoc(e)&&this.addFieldLength(e,t,n)},p.DocumentStore.prototype.getFieldLength=function(e,t){return null!=e&&e in this.docs&&t in this.docInfo[e]?this.docInfo[e][t]:0},p.DocumentStore.prototype.toJSON=function(){return{docs:this.docs,docInfo:this.docInfo,length:this.length,save:this._save}},p.stemmer=function(){const 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]*";const 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$/,P=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)&&(t=(u=r.exec(e))[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)&&(e=(t=(u=i.exec(e))[1])+"i"),(i=I).test(e)&&(t=(u=i.exec(e))[1],n=u[2],(i=d).test(t))&&(e=t+a[n]),(i=k).test(e)&&(t=(u=i.exec(e))[1],n=u[2],(i=d).test(t))&&(e=t+c[n]),i=_,r=D,i.test(e)?(t=(u=i.exec(e))[1],(i=h).test(t)&&(e=t)):r.test(e)&&(t=(u=r.exec(e))[1]+u[2],(r=h).test(t))&&(e=t),(i=F).test(e)&&(t=(u=i.exec(e))[1],i=h,r=f,s=P,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}}(),p.Pipeline.registerFunction(p.stemmer,"stemmer"),p.stopWordFilter=function(e){if(e&&!0!==p.stopWordFilter.stopWords[e])return e},p.clearStopWords=function(){p.stopWordFilter.stopWords={}},p.addStopWords=function(e){null!=e&&!1!==Array.isArray(e)&&e.forEach(function(e){p.stopWordFilter.stopWords[e]=!0},this)},p.resetStopWords=function(){p.stopWordFilter.stopWords=p.defaultStopWords},p.stopWordFilter.stopWords=p.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},p.Pipeline.registerFunction(p.stopWordFilter,"stopWordFilter"),p.Pipeline.registerFunction(p.trimmer=function(e){if(null==e)throw new Error("token should not be undefined");return e.replace(/^\W+/,"").replace(/\W+$/,"")},"trimmer"),(p.InvertedIndex=function(){this.root={docs:{},df:0}}).load=function(e){var t=new this;return t.root=e.root,t},p.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)},p.InvertedIndex.prototype.hasToken=function(t){if(!t)return!1;let n=this.root;for(let e=0;e<t.length;e++){if(!n[t[e]])return!1;n=n[t[e]]}return!0},p.InvertedIndex.prototype.getNode=function(t){if(!t)return null;let n=this.root;for(let e=0;e<t.length;e++){if(!n[t[e]])return null;n=n[t[e]]}return n},p.InvertedIndex.prototype.getDocs=function(e){return null==(e=this.getNode(e))?{}:e.docs},p.InvertedIndex.prototype.getTermFrequency=function(e,t){return null!=(e=this.getNode(e))&&t in e.docs?e.docs[t].tf:0},p.InvertedIndex.prototype.getDocFreq=function(e){return null==(e=this.getNode(e))?0:e.df},p.InvertedIndex.prototype.removeToken=function(e,t){e&&null!=(e=this.getNode(e))&&t in e.docs&&(delete e.docs[t],--e.df)},p.InvertedIndex.prototype.expandToken=function(e,t,n){if(null==e||""==e)return[];if(t=t||[],null!=n||null!=(n=this.getNode(e))){0<n.df&&t.push(e);for(const o in n)"docs"!==o&&"df"!==o&&this.expandToken(e+o,t,n[o])}return t},p.InvertedIndex.prototype.toJSON=function(){return{root:this.root}},(p.Configuration=function(e,t){var n;if(e=e||"",null==t)throw new Error("fields should not be null");this.config={};try{n=JSON.parse(e),this.buildUserConfig(n,t)}catch(e){p.utils.warn("user configuration parse failed, will use default configuration"),this.buildDefaultConfig(t)}}).prototype.buildDefaultConfig=function(e){this.reset(),e.forEach(function(e){this.config[e]={boost:1,bool:"OR",expand:!1}},this)},p.Configuration.prototype.buildUserConfig=function(t,e){let n="OR",o=!1;if(this.reset(),"bool"in t&&(n=t.bool||n),"expand"in t&&(o=t.expand||o),"fields"in t)for(const r in t.fields)if(-1<e.indexOf(r)){var i=t.fields[r];let e=o;null!=i.expand&&(e=i.expand),this.config[r]={boost:i.boost||0===i.boost?i.boost:1,bool:i.bool||n,expand:e}}else p.utils.warn("field name in user configuration not found in index instance fields");else this.addAllFields2UserConfig(n,o,e)},p.Configuration.prototype.addAllFields2UserConfig=function(t,n,e){e.forEach(function(e){this.config[e]={boost:1,bool:t,expand:n}},this)},p.Configuration.prototype.get=function(){return this.config},p.Configuration.prototype.reset=function(){this.config={}},lunr.SortedSet=function(){this.length=0,this.elements=[]},lunr.SortedSet.load=function(e){var t=new this;return t.elements=e,t.length=e.length,t},lunr.SortedSet.prototype.add=function(){let e,t;for(e=0;e<arguments.length;e++)t=arguments[e],~this.indexOf(t)||this.elements.splice(this.locationFor(t),0,t);this.length=this.elements.length},lunr.SortedSet.prototype.toArray=function(){return this.elements.slice()},lunr.SortedSet.prototype.map=function(e,t){return this.elements.map(e,t)},lunr.SortedSet.prototype.forEach=function(e,t){return this.elements.forEach(e,t)},lunr.SortedSet.prototype.indexOf=function(e){let t=0,n=this.elements.length,o=n-t,i=t+Math.floor(o/2),r=this.elements[i];for(;1<o;){if(r===e)return i;r<e&&(t=i),r>e&&(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(;1<o;)r<e&&(t=i),r>e&&(n=i),o=n-t,i=t+Math.floor(o/2),r=this.elements[i];return r>e?i:r<e?i+1:void 0},lunr.SortedSet.prototype.intersect=function(e){var t=new lunr.SortedSet;let n=0,o=0;for(var i=this.length,r=e.length,s=this.elements,l=e.elements;!(n>i-1||o>r-1);)s[n]===l[o]?(t.add(s[n]),n++,o++):s[n]<l[o]?n++: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<t.length;e++)o.add(t[e]);return o},lunr.SortedSet.prototype.toJSON=function(){return this.toArray()},"function"==typeof define&&define.amd?define(function(){return p}):"object"==typeof exports?module.exports=p:this.elasticlunr=p}(),window.onload=function(){if(document.body.contains(document.getElementById("searchModal"))){const d=document.documentElement.lang,h=document.getElementById("searchInput"),f=document.getElementById("searchModal"),s=document.getElementById("search-button"),p=document.getElementById("clear-search"),g=document.getElementById("results-container"),m=document.getElementById("results"),v={zero_results:document.getElementById("zero_results"),one_results:document.getElementById("one_results"),two_results:document.getElementById("two_results"),few_results:document.getElementById("few_results"),many_results:document.getElementById("many_results")};{var n=s;const w=window.navigator.userAgent.toLowerCase().includes("mac")?"Cmd + K":"Ctrl + K";["title","aria-label"].forEach(e=>{let t=n.getAttribute(e);t&&(t=t.replace("$SHORTCUT",w),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),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),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],m.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="",m.innerHTML="",g.style.display="none",h.removeAttribute("aria-activedescendant")}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 y(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(){const s=this.value.trim();var e=await r;m.innerHTML="",g.style.display=0<s.length?"block":"none";var t,n=(e=e.search(s,{bool:"OR",fields:{title:{boost:3},body:{boost:2},description:{boost:1},path:{boost:1}}})).length,o=d,i=0===(i=n)?"zero_results":1===i?"one_results":"ar"===o?(t=i%100,2===i?"two_results":3<=t&&t<=10?"few_results":"many_results"):["uk","be","bs","hr","ru","sr"].includes(o)?(t=i%100,1==(o=i%10)&&11!=t?"one_results":2<=o&&o<=4&&!(12<=t&&t<=14)?"few_results":"many_results"):"many_results";Object.values(v).forEach(e=>{e&&(e.style.display="none")}),(i=v[i])&&(i.style.display="inline",i.textContent=i.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="<a href><span></span><span></span></a>",n.querySelector("a")),i=n.querySelector("span:first-child"),r=n.querySelector("span:nth-child(2)");i.textContent=t.doc.title||t.doc.path||t.doc.id,i=t.doc.body?function(n,e){var o=e.map(function(e){return elasticlunr.stemmer(e.toLowerCase())});let i=0;var r=[];for(const e of n.toLowerCase().split(". ")){let t=!0;for(const s of e.split(/[\s\n]/)){if(0<s.length){let e=t?8:2;for(const n of o)elasticlunr.stemmer(s).startsWith(n)&&(e=40);r.push([s,e,i]),t=!1}i+=s.length+1}i+=1}if(0===r.length)return 150<n.length?n.substring(0,150)+"…":n;var s=[];let t=0;for(var l=0;l<Math.min(r.length,30);l++)t+=r[l][1];for(s.push(t),l=1;l<=r.length-30;l++)t=(t-=r[l-1][1])+r[l+30-1][1],s.push(t);let u=0,a=0;for(l=s.length-1;0<=l;l--)a<s[l]&&(a=s[l],u=l);var c=[];let d=function(e,t){let n=0,o=t-1;for(;0<=o&&n<4;){if(" "===e[o]&&"."!==e[o-1])n++;else if("."===e[o]&&" "===e[o+1])break;o--}return 4===n?o+1:t}(n,r[u][2]);for(var h=/^[\x00-\xff]+$/,l=u;l<u+30&&l<r.length;l++){var f,p=r[l],g=(d<p[2]&&(c.push(n.substring(d,p[2])),d=p[2]),40===p[1]&&c.push("<b>"),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<t.length;e++){var l=t.codePointAt(e).toString(16);if(o=4<l.length&&++e+1<t.length?"200d"===t.codePointAt(e+1).toString(16):o){if(i+=y(l),e==t.length-1){if(!((r+=i)<=12))break;n+=t.substr(s,e-s+1)}}else if(0!=i){if(!((r=(r+=i)+y(l))<=12))break;n+=t.substr(s,e-s+1),s=e+1,i=0}else{if(!((r+=y(l))<=12))break;l.length<=4?n+=t[e]:n+=t[e-1]+t[e],s=e+1}}return n}(n.substring(p[2],g)),c.push(f)):c.push(n.substring(p[2],g)),40===p[1]&&c.push("</b>"),d=g}c.push("…");var m=e=c.join("");return 150<e.replace(/<[^>]+>/g,"").length?e.substring(0,150)+"…":m}(t.doc.body,s.split(/\s+/)):t.doc.description||"",r.innerHTML=i;let e=t.ref;t.doc.body&&(e+="#:~:text="+(r=encodeURIComponent(s))),o.href=e,m.appendChild(n)}}),h.setAttribute("aria-expanded",0<l?"true":"false"),m.firstChild&&a(m.firstChild),m.addEventListener("mouseover",function(e){e.target.closest('div[role="option"]')&&a(e.target.closest('div[role="option"]'))}),document.querySelectorAll("#results > div").forEach(e=>{e.removeEventListener("touchstart",c),e.addEventListener("touchstart",c)})},!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=m.querySelectorAll("#results > div")).length){var n,o,i=Array.from(r),r=m.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()})}};
|