1var m;function R(e){return typeof e<"u"?e:!0}function H(e){const t=Array(e);for(let s=0;s<e;s++)t[s]=p();return t}function p(){return Object.create(null)}function ae(e,t){return t.length-e.length}function v(e){return typeof e=="string"}function B(e){return typeof e=="object"}function V(e){return typeof e=="function"}function $(e,t){var s=ue;if(e&&(t&&(e=F(e,t)),this.H&&(e=F(e,this.H)),this.J&&1<e.length&&(e=F(e,this.J)),s||s==="")){if(t=e.split(s),this.filter){e=this.filter,s=t.length;const i=[];for(let r=0,n=0;r<s;r++){const l=t[r];l&&!e[l]&&(i[n++]=l)}e=i}else e=t;return e}return e}const ue=/[\p{Z}\p{S}\p{P}\p{C}]+/u,fe=/[\u0300-\u036f]/g;function N(e,t){const s=Object.keys(e),i=s.length,r=[];let n="",l=0;for(let h=0,o,a;h<i;h++)o=s[h],(a=e[o])?(r[l++]=w(t?"(?!\\b)"+o+"(\\b|_)":o),r[l++]=a):n+=(n?"|":"")+o;return n&&(r[l++]=w(t?"(?!\\b)("+n+")(\\b|_)":"("+n+")"),r[l]=""),r}function F(e,t){for(let s=0,i=t.length;s<i&&(e=e.replace(t[s],t[s+1]),e);s+=2);return e}function w(e){return new RegExp(e,"g")}function b(e){let t="",s="";for(let i=0,r=e.length,n;i<r;i++)(n=e[i])!==s&&(t+=s=n);return t}var de={encode:ee,F:!1,G:""};function ee(e){return $.call(this,(""+e).toLowerCase(),!1)}const ge={},E={};function te(e){q(e,"add"),q(e,"append"),q(e,"search"),q(e,"update"),q(e,"remove")}function q(e,t){e[t+"Async"]=function(){const s=this,i=arguments;var r=i[i.length-1];let n;return V(r)&&(n=r,delete i[i.length-1]),r=new Promise(function(l){setTimeout(function(){s.async=!0;const h=s[t].apply(s,i);s.async=!1,l(h)})}),n?(r.then(n),this):r}}function se(e,t,s,i){const r=e.length;let n=[],l,h,o=0;i&&(i=[]);for(let a=r-1;0<=a;a--){const u=e[a],y=u.length,d=p();let g=!l;for(let c=0;c<y;c++){const f=u[c],C=f.length;if(C)for(let k=0,x,S;k<C;k++)if(S=f[k],l){if(l[S]){if(!a){if(s)s--;else if(n[o++]=S,o===t)return n}(a||i)&&(d[S]=1),g=!0}if(i&&(x=(h[S]||0)+1,h[S]=x,x<r)){const L=i[x-2]||(i[x-2]=[]);L[L.length]=S}}else d[S]=1}if(i)l||(h=d);else if(!g)return[];l=d}if(i)for(let a=i.length-1,u,y;0<=a;a--){u=i[a],y=u.length;for(let d=0,g;d<y;d++)if(g=u[d],!l[g]){if(s)s--;else if(n[o++]=g,o===t)return n;l[g]=1}}return n}function pe(e,t){const s=p(),i=p(),r=[];for(let n=0;n<e.length;n++)s[e[n]]=1;for(let n=0,l;n<t.length;n++){l=t[n];for(let h=0,o;h<l.length;h++)o=l[h],s[o]&&!i[o]&&(i[o]=1,r[r.length]=o)}return r}function z(e){this.l=e!==!0&&e,this.cache=p(),this.h=[]}function ie(e,t,s){B(e)&&(e=e.query);let i=this.cache.get(e);return i||(i=this.search(e,t,s),this.cache.set(e,i)),i}z.prototype.set=function(e,t){if(!this.cache[e]){var s=this.h.length;for(s===this.l?delete this.cache[this.h[s-1]]:s++,--s;0<s;s--)this.h[s]=this.h[s-1];this.h[0]=e}this.cache[e]=t};z.prototype.get=function(e){const t=this.cache[e];if(this.l&&t&&(e=this.h.indexOf(e))){const s=this.h[e-1];this.h[e-1]=this.h[e],this.h[e]=s}return t};
1const me={memory:{charset:"latin:extra",D:3,B:4,m:!1},performance:{D:3,B:3,s:!1,context:{depth:2,D:1}},match:{charset:"latin:extra",G:"reverse"},score:{charset:"latin:advanced",D:20,B:3,context:{depth:3,D:9}},default:{}};function re(e,t,s,i,r,n,l,h){setTimeout(function(){const o=e(s?s+"."+i:i,JSON.stringify(l));o&&o.then?o.then(function(){t.export(e,t,s,r,n+1,h)}):t.export(e,t,s,r,n+1,h)})}function A(e,t){if(!(this instanceof A))return new A(e);var s;if(e){v(e)?e=me[e]:(s=e.preset)&&(e=Object.assign({},s[s],e)),s=e.charset;var i=e.lang;v(s)&&(s.indexOf(":")===-1&&(s+=":default"),s=E[s]),v(i)&&(i=ge[i])}else e={};let r,n,l=e.context||{};if(this.encode=e.encode||s&&s.encode||ee,this.register=t||p(),this.D=r=e.resolution||9,this.G=t=s&&s.G||e.tokenize||"strict",this.depth=t==="strict"&&l.depth,this.l=R(l.bidirectional),this.s=n=R(e.optimize),this.m=R(e.fastupdate),this.B=e.minlength||1,this.C=e.boost,this.map=n?H(r):p(),this.A=r=l.resolution||1,this.h=n?H(r):p(),this.F=s&&s.F||e.rtl,this.H=(t=e.matcher||i&&i.H)&&N(t,!1),this.J=(t=e.stemmer||i&&i.J)&&N(t,!0),s=t=e.filter||i&&i.filter){s=t,i=p();for(let h=0,o=s.length;h<o;h++)i[s[h]]=1;s=i}this.filter=s,this.cache=(t=e.cache)&&new z(t)}m=A.prototype;m.append=function(e,t){return this.add(e,t,!0)};m.add=function(e,t,s,i){if(t&&(e||e===0)){if(!i&&!s&&this.register[e])return this.update(e,t);if(t=this.encode(t),i=t.length){const a=p(),u=p(),y=this.depth,d=this.D;for(let g=0;g<i;g++){let c=t[this.F?i-1-g:g];var r=c.length;if(c&&r>=this.B&&(y||!u[c])){var n=j(d,i,g),l="";switch(this.G){case"full":if(2<r){for(n=0;n<r;n++)for(var h=r;h>n;h--)if(h-n>=this.B){var o=j(d,i,g,r,n);l=c.substring(n,h),P(this,u,l,o,e,s)}break}case"reverse":if(1<r){for(h=r-1;0<h;h--)l=c[h]+l,l.length>=this.B&&P(this,u,l,j(d,i,g,r,h),e,s);l=""}case"forward":if(1<r){for(h=0;h<r;h++)l+=c[h],l.length>=this.B&&P(this,u,l,n,e,s);break}default:if(this.C&&(n=Math.min(n/this.C(t,c,g)|0,d-1)),P(this,u,c,n,e,s),y&&1<i&&g<i-1){for(r=p(),l=this.A,n=c,h=Math.min(y+1,i-g),r[n]=1,o=1;o<h;o++)if((c=t[this.F?i-1-g-o:g+o])&&c.length>=this.B&&!r[c]){r[c]=1;const f=this.l&&c>n;P(this,a,f?n:c,j(l+(i/2>l?0:1),i,g,h-1,o-1),e,s,f?c:n)}}}}}this.m||(this.register[e]=1)}}return this};function j(e,t,s,i,r){return s&&1<e?t+(i||0)<=e?s+(r||0):(e-1)/(t+(i||0))*(s+(r||0))+1|0:0}function P(e,t,s,i,r,n,l){let h=l?e.h:e.map;(!t[s]||l&&!t[s][l])&&(e.s&&(h=h[i]),l?(t=t[s]||(t[s]=p()),t[l]=1,h=h[l]||(h[l]=p())):t[s]=1,h=h[s]||(h[s]=[]),e.s||(h=h[i]||(h[i]=[])),n&&h.includes(r)||(h[h.length]=r,e.m&&(e=e.register[r]||(e.register[r]=[]),e[e.length]=h)))}m.search=function(e,t,s){s||(!t&&B(e)?(s=e,e=s.query):B(t)&&(s=t));let i=[],r,n,l=0;if(s){e=s.query||e,t=s.limit,l=s.offset||0;var h=s.context;n=s.suggest}if(e&&(e=this.encode(""+e),r=e.length,1<r)){s=p();var o=[];for(let u=0,y=0,d;u<r;u++)if((d=e[u])&&d.length>=this.B&&!s[d])if(this.s||n||this.map[d])o[y++]=d,s[d]=1;else return i;e=o,r=e.length}if(!r)return i;t||(t=100),h=this.depth&&1<r&&h!==!1,s=0;let a;h?(a=e[0],s=1):1<r&&e.sort(ae);for(let u,y;s<r;s++){if(y=e[s],h?(u=W(this,i,n,t,l,r===2,y,a),n&&u===!1&&i.length||(a=y)):u=W(this,i,n,t,l,r===1,y),u)return u;if(n&&s===r-1){if(o=i.length,!o){if(h){h=0,s=-1;continue}return i}if(o===1)return ne(i[0],t,l)}}return se(i,t,l,n)};function W(e,t,s,i,r,n,l,h){let o=[],a=h?e.h:e.map;if(e.s||(a=X(a,l,h,e.l)),a){let u=0;const y=Math.min(a.length,h?e.A:e.D);for(let d=0,g=0,c,f;d<y&&!((c=a[d])&&(e.s&&(c=X(c,l,h,e.l)),r&&c&&n&&(f=c.length,f<=r?(r-=f,c=null):(c=c.slice(r),r=0)),c&&(o[u++]=c,n&&(g+=c.length,g>=i))));d++);if(u){if(n)return ne(o,i,0);t[t.length]=o;return}}return!s&&o}function ne(e,t,s){return e=e.length===1?e[0]:[].concat.apply([],e),s||e.length>t?e.slice(s,s+t):e}function X(e,t,s,i){return s?(i=i&&t>s,e=(e=e[i?t:s])&&e[i?s:t]):e=e[t],e}m.contain=function(e){return!!this.register[e]};m.update=function(e,t){return this.remove(e).add(e,t)};m.remove=function(e,t){const s=this.register[e];if(s){if(this.m)for(let i=0,r;i<s.length;i++)r=s[i],r.splice(r.indexOf(e),1);else Q(this.map,e,this.D,this.s),this.depth&&Q(this.h,e,this.A,this.s);if(t||delete this.register[e],this.cache){t=this.cache;for(let i=0,r,n;i<t.h.length;i++)n=t.h[i],r=t.cache[n],r.includes(e)&&(t.h.splice(i--,1),delete t.cache[n])}}return this};function Q(e,t,s,i,r){let n=0;if(e.constructor===Array)if(r)t=e.indexOf(t),t!==-1?1<e.length&&(e.splice(t,1),n++):n++;else{r=Math.min(e.length,s);for(let l=0,h;l<r;l++)(h=e[l])&&(n=Q(h,t,s,i,r),i||n||delete e[l])}else for(let l in e)(n=Q(e[l],t,s,i,r))||delete e[l];return n}m.searchCache=ie;m.export=function(e,t,s,i,r,n){let l=!0;typeof n>"u"&&(l=new Promise(a=>{n=a}));let h,o;switch(r||(r=0)){case 0:if(h="reg",this.m){o=p();for(let a in this.register)o[a]=1}else o=this.register;break;case 1:h="cfg",o={doc:0,opt:this.s?1:0};break;case 2:h="map",o=this.map;break;case 3:h="ctx",o=this.h;break;default:typeof s>"u"&&n&&n();return}return re(e,t||this,s,h,i,r,o,n),l};m.import=function(e,t){if(t)switch(v(t)&&(t=JSON.parse(t)),e){case"cfg":this.s=!!t.opt;break;case"reg":this.m=!1,this.register=t;break;case"map":this.map=t;break;case"ctx":this.h=t}};te(A.prototype);function ye(e){e=e.data;var t=self._index;const s=e.args;var i=e.task;switch(i){case"init":i=e.options||{},e=e.factory,t=i.encode,i.cache=!1,t&&t.indexOf("function")===0&&(i.encode=Function("return "+t)()),e?(Function("return "+e)()(self),self._index=new self.FlexSearch.Index(i),delete self.FlexSearch):self._index=new A(i);break;default:e=e.id,t=t[i].apply(t,s),postMessage(i==="search"?{id:e,msg:t}:{id:e})}}let Z=0;function I(e){if(!(this instanceof I))return new I(e);var t;e?V(t=e.encode)&&(e.encode=t.toString()):e={},(t=(self||window)._factory)&&(t=t.toString());const s=typeof window>"u"&&self.exports,i=this;this.o=we(t,s,e.worker),this.h=p(),this.o&&(s?this.o.on("message",function(r){i.h[r.id](r.msg),delete i.h[r.id]}):this.o.onmessage=function(r){r=r.data,i.h[r.id](r.msg),delete i.h[r.id]},this.o.postMessage({task:"init",factory:t,options:e}))}T("add");T("append");T("search");T("update");T("remove");function T(e){I.prototype[e]=I.prototype[e+"Async"]=function(){const t=this,s=[].slice.call(arguments);var i=s[s.length-1];let r;return V(i)&&(r=i,s.splice(s.length-1,1)),i=new Promise(function(n){setTimeout(function(){t.h[++Z]=n,t.o.postMessage({task:e,id:Z,args:s})})}),r?(i.then(r),this):i}}function we(e,t,s){let i;try{i=t?new(require("worker_threads")).Worker(__dirname+"/node/node.js"):e?new Worker(URL.createObjectURL(new Blob(["onmessage="+ye.toString()],{t
1ype:"text/javascript"}))):new Worker(v(s)?s:"worker/worker.js",{type:"module"})}catch{}return i}function J(e){if(!(this instanceof J))return new J(e);var t=e.document||e.doc||e,s;this.K=[],this.h=[],this.A=[],this.register=p(),this.key=(s=t.key||t.id)&&O(s,this.A)||"id",this.m=R(e.fastupdate),this.C=(s=t.store)&&s!==!0&&[],this.store=s&&p(),this.I=(s=t.tag)&&O(s,this.A),this.l=s&&p(),this.cache=(s=e.cache)&&new z(s),e.cache=!1,this.o=e.worker,this.async=!1,s=p();let i=t.index||t.field||t;v(i)&&(i=[i]);for(let r=0,n,l;r<i.length;r++)n=i[r],v(n)||(l=n,n=n.field),l=B(l)?Object.assign({},e,l):e,this.o&&(s[n]=new I(l),s[n].o||(this.o=!1)),this.o||(s[n]=new A(l,this.register)),this.K[r]=O(n,this.A),this.h[r]=n;if(this.C)for(e=t.store,v(e)&&(e=[e]),t=0;t<e.length;t++)this.C[t]=O(e[t],this.A);this.index=s}function O(e,t){const s=e.split(":");let i=0;for(let r=0;r<s.length;r++)e=s[r],0<=e.indexOf("[]")&&(e=e.substring(0,e.length-2))&&(t[i]=!0),e&&(s[i++]=e);return i<s.length&&(s.length=i),1<i?s:s[0]}function K(e,t){if(v(t))e=e[t];else for(let s=0;e&&s<t.length;s++)e=e[t[s]];return e}function M(e,t,s,i,r){if(e=e[r],i===s.length-1)t[r]=e;else if(e)if(e.constructor===Array)for(t=t[r]=Array(e.length),r=0;r<e.length;r++)M(e,t,s,i,r);else t=t[r]||(t[r]=p()),r=s[++i],M(e,t,s,i,r)}function U(e,t,s,i,r,n,l,h){if(e=e[l])if(i===t.length-1){if(e.constructor===Array){if(s[i]){for(t=0;t<e.length;t++)r.add(n,e[t],!0,!0);return}e=e.join(" ")}r.add(n,e,h,!0)}else if(e.constructor===Array)for(l=0;l<e.length;l++)U(e,t,s,i,r,n,l,h);else l=t[++i],U(e,t,s,i,r,n,l,h)}m=J.prototype;m.add=function(e,t,s){if(B(e)&&(t=e,e=K(t,this.key)),t&&(e||e===0)){if(!s&&this.register[e])return this.update(e,t);for(let i=0,r,n;i<this.h.length;i++)n=this.h[i],r=this.K[i],v(r)&&(r=[r]),U(t,r,this.A,0,this.index[n],e,r[0],s);if(this.I){let i=K(t,this.I),r=p();v(i)&&(i=[i]);for(let n=0,l,h;n<i.length;n++)if(l=i[n],!r[l]&&(r[l]=1,h=this.l[l]||(this.l[l]=[]),!s||!h.includes(e))&&(h[h.length]=e,this.m)){const o=this.register[e]||(this.register[e]=[]);o[o.length]=h}}if(this.store&&(!s||!this.store[e])){let i;if(this.C){i=p();for(let r=0,n;r<this.C.length;r++)n=this.C[r],v(n)?i[n]=t[n]:M(t,i,n,0,n[0])}this.store[e]=i||t}}return this};m.append=function(e,t){return this.add(e,t,!0)};m.update=function(e,t){return this.remove(e).add(e,t)};m.remove=function(e){if(B(e)&&(e=K(e,this.key)),this.register[e]){for(var t=0;t<this.h.length&&(this.index[this.h[t]].remove(e,!this.o),!this.m);t++);if(this.I&&!this.m)for(let s in this.l){t=this.l[s];const i=t.indexOf(e);i!==-1&&(1<t.length?t.splice(i,1):delete this.l[s])}this.store&&delete this.store[e],delete this.register[e]}return this};m.search=function(e,t,s,i){s||(!t&&B(e)?(s=e,e=""):B(t)&&(s=t,t=0));let r=[],n=[],l,h,o,a,u,y,d=0;if(s)if(s.constructor===Array)o=s,s=null;else{if(e=s.query||e,o=(l=s.pluck)||s.index||s.field,a=s.tag,h=this.store&&s.enrich,u=s.bool==="and",t=s.limit||t||100,y=s.offset||0,a&&(v(a)&&(a=[a]),!e)){for(let c=0,f;c<a.length;c++)(f=ve.call(this,a[c],t,y,h))&&(r[r.length]=f,d++);return d?r:[]}v(o)&&(o=[o])}o||(o=this.h),u=u&&(1<o.length||a&&1<a.length);const g=!i&&(this.o||this.async)&&[];for(let c=0,f,C,k;c<o.length;c++){let x;if(C=o[c],v(C)||(x=C,C=x.field,e=x.query||e,t=x.limit||t,h=x.enrich||h),g)g[c]=this.index[C].searchAsync(e,t,x||s);else{if(i?f=i[c]:f=this.index[C].search(e,t,x||s),k=f&&f.length,a&&k){const S=[];let L=0;u&&(S[0]=[f]);for(let G=0,_,D;G<a.length;G++)_=a[G],(k=(D=this.l[_])&&D.length)&&(L++,S[S.length]=u?[D]:D);L&&(f=u?se(S,t||100,y||0):pe(f,S),k=f.length)}if(k)n[d]=C,r[d++]=f;else if(u)return[]}}if(g){const c=this;return new Promise(function(f){Promise.all(g).then(function(C){f(c.search(e,t,s,C))})})}if(!d)return[];if(l&&(!h||!this.store))return r[0];for(let c=0,f;c<n.length;c++){if(f=r[c],f.length&&h&&(f=he.call(this,f)),l)return f;r[c]={field:n[c],result:f}}return r};function ve(e,t,s,i){let r=this.l[e],n=r&&r.length-s;if(n&&0<n)return(n>t||s)&&(r=r.slice(s,s+t)),i&&(r=he.call(this,r)),{tag:e,result:r}}function he(e){const t=Array(e.length);for(let s=0,i;s<e.length;s++)i=e[s],t[s]={id:i,doc:this.store[i]};return t}m.contain=function(e){return!!this.register[e]};m.get=function(e){return this.store[e]};m.set=function(e,t){return this.store[e]=t,this};m.searchCache=ie;m.export=function(e,t,s,i,r,n){let l;if(typeof n>"u"&&(l=new Promise(h=>{n=h})),r||(r=0),i||(i=0),i<this.h.length){const h=this.h[i],o=this.index[h];t=this,setTimeout(function(){o.export(e,t,r?h:"",i,r++,n)||(i++,r=1,t.export(e,t,h,i,r,n
1))})}else{let h,o;switch(r){case 1:h="tag",o=this.l,s=null;break;case 2:h="store",o=this.store,s=null;break;default:n();return}re(e,this,s,h,i,r,o,n)}return l};m.import=function(e,t){if(t)switch(v(t)&&(t=JSON.parse(t)),e){case"tag":this.l=t;break;case"reg":this.m=!1,this.register=t;for(let i=0,r;i<this.h.length;i++)r=this.index[this.h[i]],r.register=t,r.m=!1;break;case"store":this.store=t;break;default:e=e.split(".");const s=e[0];e=e[1],s&&e&&this.index[s].import(e,t)}};te(J.prototype);var Se={encode:le,F:!1,G:""};const xe=[w("[à áâãäå]"),"a",w("[èéêë]"),"e",w("[ìÃîï]"),"i",w("[òóôõöÅ]"),"o",w("[ùúûüű]"),"u",w("[ýŷÿ]"),"y",w("ñ"),"n",w("[çc]"),"k",w("Ã"),"s",w(" & ")," and "];function le(e){var t=e=""+e;return t.normalize&&(t=t.normalize("NFD").replace(fe,"")),$.call(this,t.toLowerCase(),!e.normalize&&xe)}var Ce={encode:oe,F:!1,G:"strict"};const ke=/[^a-z0-9]+/,Y={b:"p",v:"f",w:"f",z:"s",x:"s",Ã:"s",d:"t",n:"m",c:"k",g:"k",j:"k",q:"k",i:"e",y:"e",u:"o"};function oe(e){e=le.call(this,e).join(" ");const t=[];if(e){const s=e.split(ke),i=s.length;for(let r=0,n,l=0;r<i;r++)if((e=s[r])&&(!this.filter||!this.filter[e])){n=e[0];let h=Y[n]||n,o=h;for(let a=1;a<e.length;a++){n=e[a];const u=Y[n]||n;u&&u!==o&&(h+=u,o=u)}t[l++]=h}}return t}var Be={encode:ce,F:!1,G:""};const Ae=[w("ae"),"a",w("oe"),"o",w("sh"),"s",w("th"),"t",w("ph"),"f",w("pf"),"f",w("(?![aeo])h(?![aeo])"),"",w("(?!^[aeo])h(?!^[aeo])"),""];function ce(e,t){return e&&(e=oe.call(this,e).join(" "),2<e.length&&(e=F(e,Ae)),t||(1<e.length&&(e=b(e)),e&&(e=e.split(" ")))),e||[]}var Ee={encode:qe,F:!1,G:""};const Le=w("(?!\\b)[aeo]");function qe(e){return e&&(e=ce.call(this,e,!0),1<e.length&&(e=e.replace(Le,"")),1<e.length&&(e=b(e)),e&&(e=e.split(" "))),e||[]}E["latin:default"]=de;E["latin:simple"]=Se;E["latin:balance"]=Ce;E["latin:advanced"]=Be;E["latin:extra"]=Ee;const Pe={Index:A};class je{constructor(){this.controllers=[],this.searchBars=document.querySelectorAll(".searchbar"),this.searchBars.forEach(t=>{this.controllers.push(new Ie(t))})}}class Ie{constructor(t){this.init(t)}init(t){this.view=new De(t),this.model=new Te,this.model.itemsToSearch=this.view.getItemsToSearch(),this.model.searchKeys=this.view.getSearchKeys(),this.model.searchDelay=this.view.getSearchDelay(),this.model.setupIndex(),this.addEventListeners(),this.model.getURLSearchQuery(this.view)}addEventListeners(){this.view.searchBar.addEventListener("input",this.model.search.bind(this.model,this.view)),this.view.searchBar.addEventListener("input",this.view.updateClearIcon.bind(this.view)),this.view.searchBar.addEventListener("mousemove",this.view.mouseMoveClearIcon.bind(this.view)),this.view.searchBar.addEventListener("click",this.view.handleClearSearchClicked.bind(this.view)),this.view.target.addEventListener("updateresults",this.view.updateResults.bind(this.view,this.model))}}class Te{constructor(){this.isAjaxEnabled=!1}enableAjax(){this.isAjaxEnabled=!0}
1setupIndex(){this.index=new Pe.Index({charset:"latin:advanced",tokenize:"forward"}),this.itemsToSearch.length>0&&this.itemsToSearch.forEach(t=>{let s="";this.searchKeys.forEach(i=>{s+=t[i]+" "}),this.index.add(t.id,s)})}search(t){clearTimeout(this.searchDelayTimeout),this.searchDelayTimeout=setTimeout(()=>{const s=t.getSearchQuery();if(this.isAjaxEnabled)t.target.dispatchEvent(new CustomEvent("search-change",{detail:{query:s}}));else{let i=[];s.length>0?i=this.index.search(s):i=this.itemsToSearch.map(r=>r.id),this.searchResults=i,this.setURLSearchQuery(t),t.target.dispatchEvent(new Event("updateresults"))}},this.searchDelay)}getURLSearchQuery(t){if(t.hasSearchParam()){let s="";const i=window.location.search,r=new URLSearchParams(i);if(r.has(t.searchParam)){const n=r.get(t.searchParam).trim();n.length>0&&(s=n)}t.setSearchQuery(s)}}setURLSearchQuery(t){if(t.hasSearchParam()){const s=new URL(window.location),i=t.getSearchQuery().trim();i.length>0?s.searchParams.set(t.searchParam,i):s.searchParams.has(t.searchParam)&&s.searchParams.delete(t.searchParam),window.history.pushState({},"",s)}}}class De{constructor(t){this.searchBar=t,this.target=this.getTarget(),this.itemClass=this.target.dataset.itemClass??this.target.dataset.postsClass,this.searchProperties=this.getSearchProperties(),this.searchSeparatorClass=this.searchBar.dataset.searchSeparatorClass}handleClearSearchClicked(){this.searchBar.classList.contains("searchbar-on-clear")&&this.setSearchQuery("")}mouseMoveClearIcon(t){this.searchBar.classList.contains("searchbar-clear")&&t.clientX-this.searchBar.getBoundingClientRect().left<this.searchBar.offsetWidth-20&&t.clientX-this.searchBar.getBoundingClientRect().left>this.searchBar.offsetWidth-44?this.searchBar.classList.add("searchbar-on-clear"):this.searchBar.classList.contains("searchbar-on-clear")&&this.searchBar.classList.remove("searchbar-on-clear")}updateClearIcon(){this.searchBar.value.length>0?this.searchBar.classList.add("searchbar-clear"):this.searchBar.classList.remove("searchbar-clear")}hasSearchParam(){let t=!1;return this.searchBar.hasAttribute("data-search-param")&&(this.searchParam=this.searchBar.dataset.searchParam??"query",t=!0),t}getItemsToSearch(){let t=[];if(this.target.dataset.postsJson!==void 0)t=JSON.parse(this.target.dataset.postsJson);else if(this.target&&this.searchProperties.length>0){let s;this.itemClass!==void 0?s=this.target.querySelectorAll("."+this.itemClass):s=this.target.querySelectorAll("[data-item-id]"),s.length>0&&s.forEach((i,r)=>{const n=parseInt(i.dataset.itemId)?parseInt(i.dataset.itemId):r;t[r]={},t[r].id=n,i.setAttribute("data-item-id",n),this.searchProperties.forEach(l=>{let h="",o="";if(l.includes("searchClass")){const a=this.searchBar.dataset[l];h=i.querySelector("."+a).innerText,o=l.replace("searchClass","").toLowerCase()}else l.includes("searchValue")&&(o=l.replace("searchValue","").toLowerCase(),h=i.dataset[o]);t[r][o]=h})})}return t}getTarget(){let t=this.searchBar.dataset.target;return t!==void 0&&(t=document.getElementById(t)),t}getSearchProperties(){let t=[];return t=Object.keys(this.searchBar.dataset).filter(s=>s.includes("searchClass")||s.includes("searchValue")),t}getSearchKeys(){const t=[];return this.searchProperties.forEach(s=>{let i="";s.includes("searchClass")?i=s.replace("searchClass","").toLowerCase():s.includes("searchValue")&&(i=s.replace("searchValue","").toLowerCase()),t.push(i)}),t}getSearchDelay(){return parseInt(this.searchBar.dataset.searchDelay)??300}getSearchQuery(){return this.searchBar.value}setSearchQuery(t){this.searchBar.value=t,this.searchBar.dispatchEvent(new Event("input"))}updateResults(t){t.searchResults.length>=0&&t.itemsToSearch.length>0&&t.itemsToSearch.forEach(s=>{const i=this.target.querySelector('[data-item-id="'+s.id+'"]');i&&(t.searchResults.includes(s.id)?i.classList.remove("search-hidden"):i.classList.add("search-hidden"))}),this.searchSeparatorClass!==void 0&&this.target.querySelectorAll("."+this.searchSeparatorClass).forEach(i=>{t.searchResults.length!==t.itemsToSearch.length?i.classList.add("search-hidden"):i.classList.remove("search-hidden")}),this.target.dispatchEvent(new Event("initpagination")),this.target.dispatchEvent(new Event("updateresultcount"))}}export{je as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.