(()=>{var mt=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Q=mt(()=>{});var a;function R(t){return typeof t!="undefined"?t:!0}function V(t){let e=Array(t);for(let n=0;n=this.B&&(y||!u[f])){var r=M(g,i,p),h="";switch(this.G){case"full":if(2r;o--)if(o-r>=this.B){var l=M(g,i,p,s,r);h=f.substring(r,o),q(this,u,h,l,t,n)}break}case"reverse":if(1=this.B&&q(this,u,h,M(g,i,p,s,o),t,n);h=""}case"forward":if(1=this.B&&q(this,u,h,r,t,n);break}default:if(this.C&&(r=Math.min(r/this.C(e,f,p)|0,g-1)),q(this,u,f,r,t,n),y&&1=this.B&&!s[f]){s[f]=1;let d=this.l&&f>r;q(this,c,d?r:f,M(h+(i/2>h?0:1),i,p,o-1,l-1),t,n,d?f:r)}}}}}this.m||(this.register[t]=1)}}return this};function M(t,e,n,i,s){return n&&1=this.B&&!n[g])if(this.s||r||this.map[g])l[y++]=g,n[g]=1;else return i;t=l,s=t.length}if(!s)return i;e||(e=100),o=this.depth&&1=i))));g++);if(u){if(r)return ft(l,i,0);e[e.length]=l;return}}return!n&&l}function ft(t,e,n){return t=t.length===1?t[0]:[].concat.apply([],t),n||t.length>e?t.slice(n,n+e):t}function $(t,e,n,i){return n?(i=i&&e>n,t=(t=t[i?e:n])&&t[i?n:e]):t=t[e],t}a.contain=function(t){return!!this.register[t]};a.update=function(t,e){return this.remove(t).add(t,e)};a.remove=function(t,e){let n=this.register[t];if(n){if(this.m)for(let i=0,s;i{r=c}));let o,l;switch(s||(s=0)){case 0:if(o="reg",this.m){l=m();for(let c in this.register)l[c]=1}else l=this.register;break;case 1:o="cfg",l={doc:0,opt:this.s?1:0};break;case 2:o="map",l=this.map;break;case 3:o="ctx",l=this.h;break;default:typeof n=="undefined"&&r&&r();return}return lt(t,e||this,n,o,i,s,l,r),h};a.import=function(t,e){if(e)switch(k(e)&&(e=JSON.parse(e)),t){case"cfg":this.s=!!e.opt;break;case"reg":this.m=!1,this.register=e;break;case"map":this.map=e;break;case"ctx":this.h=e}};rt(D.prototype);function _t(t){t=t.data;var e=self._index;let n=t.args;var i=t.task;switch(i){case"init":i=t.options||{},t=t.factory,e=i.encode,i.cache=!1,e&&e.indexOf("function")===0&&(i.encode=Function("return "+e)()),t?(Function("return "+t)()(self),self._index=new self.FlexSearch.Index(i),delete self.FlexSearch):self._index=new D(i);break;default:t=t.id,e=e[i].apply(e,n),postMessage(i==="search"?{id:t,msg:e}:{id:t})}}var b=0;function F(t){if(!(this instanceof F))return new F(t);var e;t?U(e=t.encode)&&(t.encode=e.toString()):t={},(e=(self||window)._factory)&&(e=e.toString());let n=typeof window=="undefined"&&self.exports,i=this;this.o=At(e,n,t.worker),this.h=m(),this.o&&(n?this.o.on("message",function(s){i.h[s.id](s.msg),delete i.h[s.id]}):this.o.onmessage=function(s){s=s.data,i.h[s.id](s.msg),delete i.h[s.id]},this.o.postMessage({task:"init",factory:e,options:t}))}I("add");I("append");I("search");I("update");I("remove");function I(t){F.prototype[t]=F.prototype[t+"Async"]=function(){let e=this,n=[].slice.call(arguments);var i=n[n.length-1];let s;return U(i)&&(s=i,n.splice(n.length-1,1)),i=new Promise(function(r){setTimeout(function(){e.h[++b]=r,e.o.postMessage({task:t,id:b,args:n})})}),s?(i.then(s),this):i}}function At(t,e,n){let i;try{i=e?new(Q()).Worker(__dirname+"/node/node.js"):t?new Worker(URL.createObjectURL(new Blob(["onmessage="+_t.toString()],{type:"text/javascript"}))):new Worker(k(n)?n:"worker/worker.js",{type:"module"})}catch(s){}return i}function B(t){if(!(this instanceof B))return new B(t);var e=t.document||t.doc||t,n;this.K=[],this.h=[],this.A=[],this.register=m(),this.key=(n=e.key||e.id)&&z(n,this.A)||"id",this.m=R(t.fastupdate),this.C=(n=e.store)&&n!==!0&&[],this.store=n&&m(),this.I=(n=e.tag)&&z(n,this.A),this.l=n&&m(),this.cache=(n=t.cache)&&new J(n),t.cache=!1,this.o=t.worker,this.async=!1,n=m();let i=e.index||e.field||e;k(i)&&(i=[i]);for(let s=0,r,h;se||n)&&(s=s.slice(n,n+e)),i&&(s=ct.call(this,s)),{tag:t,result:s}}function ct(t){let e=Array(t.length);for(let n=0,i;n{r=o})),s||(s=0),i||(i=0),i{t.ctrlKey&&t.key==="/"?(t.preventDefault(),P.focus()):t.key==="Escape"&&(P.blur(),A.classList.add("search__suggestions--hidden"))});document.addEventListener("click",t=>{A.contains(t.target)||A.classList.add("search__suggestions--hidden")});document.addEventListener("keydown",t=>{if(A.classList.contains("search__suggestions--hidden"))return;let n=[...A.querySelectorAll("a")];if(n.length===0)return;let i=n.indexOf(document.activeElement);if(t.key==="ArrowDown"){t.preventDefault();let s=i+10?i-1:0;n[s].focus()}});(function(){let t=pt.Document({tokenize:"forward",document:{id:"id",index:[{field:"title"},{field:"tags"},{field:"content"},{field:"date",tokenize:"strict",encode:!1}],store:["title","summary","date","permalink"]}});fetch("/search-index.json").then(function(e){return e.json()}).then(function(e){e.forEach(function(n){t.add(n)})}),P.addEventListener("input",function(){let n=this.value,i=t.search({query:n,limit:5,enrich:!0}),s=new Map;for(let r of i.flatMap(h=>h.result))s.has(r.permalink)||s.set(r.doc.permalink,r.doc);if(A.innerHTML="",A.classList.remove("search__suggestions--hidden"),s.size===0&&n){let r=document.createElement("div");r.innerHTML=`No results for "${n}"`,r.classList.add("search__no-results"),A.appendChild(r);return}for(let[r,h]of s){let o=document.createElement("a");o.href=r,o.classList.add("search__suggestion-item"),A.appendChild(o);let l=document.createElement("div");l.textContent=h.title,l.classList.add("search__suggestion-title"),o.appendChild(l);let c=document.createElement("div");if(c.textContent=h.summary,c.classList.add("search__suggestion-summary"),o.appendChild(c),A.childElementCount===5)break}})})();})(); /*! Source: https://dev.to/shubhamprakash/trap-focus-using-javascript-6a3 */ /*! The FlexSearch implementation is inspired by the Doks theme | MIT license | https://github.com/thuliteio/doks-core/blob/eb9f50cee0eeae5d72f3751951f30cf914144bc0/assets/js/flexsearch.js */