3 lines
1.3 KiB
JavaScript
3 lines
1.3 KiB
JavaScript
(function(self){'use strict';const b=/[\u0300-\u036f]/g;function l(a){return new RegExp(a,"g")};const p=/[\W_]+/,r=[l("[\u00e0\u00e1\u00e2\u00e3\u00e4\u00e5]"),"a",l("[\u00e8\u00e9\u00ea\u00eb]"),"e",l("[\u00ec\u00ed\u00ee\u00ef]"),"i",l("[\u00f2\u00f3\u00f4\u00f5\u00f6\u0151]"),"o",l("[\u00f9\u00fa\u00fb\u00fc\u0171]"),"u",l("[\u00fd\u0177\u00ff]"),"y",l("\u00f1"),"n",l("[\u00e7c]"),"k",l("\u00df"),"s",l(" & ")," and "];const t=/[^a-z0-9]+/,u={b:"p",v:"f",w:"f",z:"s",x:"s","\u00df":"s",d:"t",n:"m",c:"k",g:"k",j:"k",q:"k",i:"e",y:"e",u:"o"};const v=[l("ae"),"a",l("oe"),"o",l("sh"),"s",l("th"),"t",l("ph"),"f",l("pf"),"f"];self.FlexSearch.registerCharset("latin:advanced",{encode:function(a,h){if(a){var e=this.h,f=a;f.normalize&&(f=f.normalize("NFD").replace(b,""));a=e.call(this,f.toLowerCase(),!a.normalize&&r,p,!1).join(" ");e=[];if(a){f=a.split(t);const c=f.length;for(let g=0,d,w=0;g<c;g++)if((a=f[g])&&(!this.filter||!this.filter[a])){d=a[0];let m=u[d]||d,q=m;for(let n=1;n<a.length;n++){d=a[n];const k=u[d]||d;k&&k!==q&&(m+=k,q=k)}e[w++]=m}}a=e.join(" ");if(2<a.length)for(let c=0,g=v.length;c<g&&(a=a.replace(v[c],v[c+
|
|
1]),a);c+=2);if(!h){if(1<a.length){e=h="";for(let c=0,g=a.length,d;c<g;c++)(d=a[c])!==e&&(h+=e=d);a=h}a&&(a=a.split(" "))}}return a},l:!1,m:""});}(this));
|