You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
28 KiB

2 years ago
!function(){var t,l,c,h,d,f,p,y,m,g,x,v,w,Q,k,S,E,L,b,P,T,O,I,e,r,D=function(e){var t=new D.Builder;return t.pipeline.add(D.trimmer,D.stopWordFilter,D.stemmer),t.searchPipeline.add(D.stemmer),e.call(t,t),t.build()};function i(e){var t,r,i,n,s,o,a,u;return e.length<3||("y"==(r=e.substr(0,1))&&(e=r.toUpperCase()+e.substr(1)),a=m,(s=y).test(e)?e=e.replace(s,"$1$2"):a.test(e)&&(e=e.replace(a,"$1$2")),a=x,(s=g).test(e)?(u=s.exec(e),(s=h).test(u[1])&&(s=v,e=e.replace(s,""))):a.test(e)&&(o=(u=a.exec(e))[1],(a=p).test(o)&&(i=Q,n=k,(a=w).test(e=o)?e+="e":i.test(e)?(s=v,e=e.replace(s,"")):n.test(e)&&(e+="e"))),(s=S).test(e)&&(e=(o=(u=s.exec(e))[1])+"i"),(s=E).test(e)&&(o=(u=s.exec(e))[1],t=u[2],(s=h).test(o)&&(e=o+l[t])),(s=L).test(e)&&(o=(u=s.exec(e))[1],t=u[2],(s=h).test(o)&&(e=o+c[t])),a=P,(s=b).test(e)?(o=(u=s.exec(e))[1],(s=d).test(o)&&(e=o)):a.test(e)&&(o=(u=a.exec(e))[1]+u[2],(a=d).test(o)&&(e=o)),(s=T).test(e)&&(o=(u=s.exec(e))[1],a=f,i=I,((s=d).test(o)||a.test(o)&&!i.test(o))&&(e=o)),a=d,(s=O).test(e)&&a.test(e)&&(s=v,e=e.replace(s,"")),"y"==r&&(e=r.toLowerCase()+e.substr(1))),e}D.version="2.3.8",D.utils={},D.utils.warn=(t=this,function(e){t.console&&console.warn&&console.warn(e)}),D.utils.asString=function(e){return null==e?"":e.toString()},D.utils.clone=function(e){if(null==e)return e;for(var t=Object.create(null),r=Object.keys(e),i=0;i<r.length;i++){var n=r[i],s=e[n];if(Array.isArray(s))t[n]=s.slice();else{if("string"!=typeof s&&"number"!=typeof s&&"boolean"!=typeof s)throw new TypeError("clone is not deep and does not support nested objects");t[n]=s}}return t},D.FieldRef=function(e,t,r){this.docRef=e,this.fieldName=t,this._stringValue=r},D.FieldRef.joiner="/",D.FieldRef.fromString=function(e){var t=e.indexOf(D.FieldRef.joiner);if(-1===t)throw"malformed field ref string";var r=e.slice(0,t),t=e.slice(t+1);return new D.FieldRef(t,r,e)},D.FieldRef.prototype.toString=function(){return null==this._stringValue&&(this._stringValue=this.fieldName+D.FieldRef.joiner+this.docRef),this._stringValue},D.Set=function(e){if(this.elements=Object.create(null),e){this.length=e.length;for(var t=0;t<this.length;t++)this.elements[e[t]]=!0}else this.length=0},D.Set.complete={intersect:function(e){return e},union:function(e){return e},contains:function(){return!0}},D.Set.empty={intersect:function(){return this},union:function(e){return e},contains:function(){return!1}},D.Set.prototype.contains=function(e){return!!this.elements[e]},D.Set.prototype.intersect=function(e){var t,r,i,n=[];if(e===D.Set.complete)return this;if(e===D.Set.empty)return e;r=this.length<e.length?(t=this,e):(t=e,this),i=Object.keys(t.elements);for(var s=0;s<i.length;s++){var o=i[s];o in r.elements&&n.push(o)}return new D.Set(n)},D.Set.prototype.union=function(e){return e===D.Set.complete?D.Set.complete:e===D.Set.empty?this:new D.Set(Object.keys(this.elements).concat(Object.keys(e.elements)))},D.idf=function(e,t){var r,i=0;for(r in e)"_index"!=r&&(i+=Object.keys(e[r]).length);t=(t-i+.5)/(i+.5);return Math.log(1+Math.abs(t))},D.Token=function(e,t){this.str=e||"",this.metadata=t||{}},D.Token.prototype.toString=function(){return this.str},D.Token.prototype.update=function(e){return this.str=e(this.str,this.metadata),this},D.Token.prototype.clone=function(e){return e=e||function(e){return e},new D.Token(e(this.str,this.metadata),this.metadata)},D.tokenizer=function(e,t){if(null==e||null==e)return[];if(Array.isArray(e))return e.map(function(e){return new D.Token(D.utils.asString(e).toLowerCase(),D.utils.clone(t))});for(var r=e.toString().toLowerCase(),i=r.length,n=[],s=0,o=0;s<=i;s++){var a,u=s-o;!r.charAt(s).match(D.tokenizer.separator)&&s!=i||(0<u&&((a=D.utils.clone(t)||{}).position=[o,u],a.index=n.length,n.push(new D.Token(r.slice(o,s),a))),o=s+1)}return n},D.tokenizer.separator=/[\s\-]+/,D.Pipeline=function(){this._stack=[]},D.Pipeline.registeredFunctions=Object.create(null),D.Pipeline.registerFunction=function(e,t){t in this.registeredFunctions&&D.utils.warn("Overwriting existing registered function: "+t),e.label=t,D.Pipeline.registeredFunctions[e.label]=e},D.Pipeline.warn