site/node_modules/flexsearch/dist/lang/latin/extra.min.js

3 lines
1.3 KiB
JavaScript
Raw Permalink Normal View History

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