-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
9-2152530669b4465e711f.js
2 lines (2 loc) · 17.1 KB
/
9-2152530669b4465e711f.js
1
2
(window.webpackJsonp=window.webpackJsonp||[]).push([[9],{165:function(t,e,n){var o,r;!function(){var i,s,u,a,h,c,p,l,d,f,v,y,m,S,w,I,x,g,E,D,F,P,k,b,z,C=function(t){var e=new C.Index;return e.pipeline.add(C.trimmer,C.stopWordFilter,C.stemmer),t&&t.call(e,e),e};C.version="0.9.5",lunr=C,C.utils={},C.utils.warn=(i=this,function(t){i.console&&console.warn&&console.warn(t)}),C.utils.toString=function(t){return null==t?"":t.toString()},C.EventEmitter=function(){this.events={}},C.EventEmitter.prototype.addListener=function(){var t=Array.prototype.slice.call(arguments),e=t.pop(),n=t;if("function"!=typeof e)throw new TypeError("last argument must be a function");n.forEach(function(t){this.hasHandler(t)||(this.events[t]=[]),this.events[t].push(e)},this)},C.EventEmitter.prototype.removeListener=function(t,e){if(this.hasHandler(t)){var n=this.events[t].indexOf(e);-1!==n&&(this.events[t].splice(n,1),0==this.events[t].length&&delete this.events[t])}},C.EventEmitter.prototype.emit=function(t){if(this.hasHandler(t)){var e=Array.prototype.slice.call(arguments,1);this.events[t].forEach(function(t){t.apply(void 0,e)},this)}},C.EventEmitter.prototype.hasHandler=function(t){return t in this.events},C.tokenizer=function(t){if(!arguments.length||null==t)return[];if(Array.isArray(t)){var e=t.filter(function(t){return null!=t});e=e.map(function(t){return C.utils.toString(t).toLowerCase()});var n=[];return e.forEach(function(t){var e=t.split(C.tokenizer.seperator);n=n.concat(e)},this),n}return t.toString().trim().toLowerCase().split(C.tokenizer.seperator)},C.tokenizer.defaultSeperator=/[\s\-]+/,C.tokenizer.seperator=C.tokenizer.defaultSeperator,C.tokenizer.setSeperator=function(t){null!=t&&"object"==typeof t&&(C.tokenizer.seperator=t)},C.tokenizer.resetSeperator=function(){C.tokenizer.seperator=C.tokenizer.defaultSeperator},C.tokenizer.getSeperator=function(){return C.tokenizer.seperator},C.Pipeline=function(){this._queue=[]},C.Pipeline.registeredFunctions={},C.Pipeline.registerFunction=function(t,e){e in C.Pipeline.registeredFunctions&&C.utils.warn("Overwriting existing registered function: "+e),t.label=e,C.Pipeline.registeredFunctions[e]=t},C.Pipeline.getRegisteredFunction=function(t){return t in C.Pipeline.registeredFunctions!=!0?null:C.Pipeline.registeredFunctions[t]},C.Pipeline.warnIfFunctionNotRegistered=function(t){t.label&&t.label in this.registeredFunctions||C.utils.warn("Function is not registered with pipeline. This may cause problems when serialising the index.\n",t)},C.Pipeline.load=function(t){var e=new C.Pipeline;return t.forEach(function(t){var n=C.Pipeline.getRegisteredFunction(t);if(!n)throw new Error("Cannot load un-registered function: "+t);e.add(n)}),e},C.Pipeline.prototype.add=function(){Array.prototype.slice.call(arguments).forEach(function(t){C.Pipeline.warnIfFunctionNotRegistered(t),this._queue.push(t)},this)},C.Pipeline.prototype.after=function(t,e){C.Pipeline.warnIfFunctionNotRegistered(e);var n=this._queue.indexOf(t);if(-1===n)throw new Error("Cannot find existingFn");this._queue.splice(n+1,0,e)},C.Pipeline.prototype.before=function(t,e){C.Pipeline.warnIfFunctionNotRegistered(e);var n=this._queue.indexOf(t);if(-1===n)throw new Error("Cannot find existingFn");this._queue.splice(n,0,e)},C.Pipeline.prototype.remove=function(t){var e=this._queue.indexOf(t);-1!==e&&this._queue.splice(e,1)},C.Pipeline.prototype.run=function(t){for(var e=[],n=t.length,o=this._queue.length,r=0;r<n;r++){for(var i=t[r],s=0;s<o&&null!=(i=this._queue[s](i,r,t));s++);null!=i&&e.push(i)}return e},C.Pipeline.prototype.reset=function(){this._queue=[]},C.Pipeline.prototype.get=function(){return this._queue},C.Pipeline.prototype.toJSON=function(){return this._queue.map(function(t){return C.Pipeline.warnIfFunctionNotRegistered(t),t.label})},C.Index=function(){this._fields=[],this._ref="id",this.pipeline=new C.Pipeline,this.documentStore=new C.DocumentStore,this.index={},this.eventEmitter=new C.EventEmitter,this._idfCache={},this.on("add","remove","update",function(){this._idfCache={}}.bind(this))},C.Index.prototype.on=function(){var t=Array.prototype.slice.call(arguments);return this.eventEmitter.addListener.apply(this.eventEmitter,t)},C.Index.prototype.off=function(t,e){return this.eventEmitter.removeListener(t,e)},C.Index.load=function(t){t.version!==C.version&&C.utils.warn("version mismatch: current "+C.version+" importing "+t.version);var e=new this;for(var n in e._fields=t.fields,e._ref=t.ref,e.documentStore=C.DocumentStore.load(t.documentStore),e.pipeline=C.Pipeline.load(t.pipeline),e.index={},t.index)e.index[n]=C.InvertedIndex.load(t.index[n]);return e},C.Index.prototype.addField=function(t){return this._fields.push(t),this.index[t]=new C.InvertedIndex,this},C.Index.prototype.setRef=function(t){return this._ref=t,this},C.Index.prototype.saveDocument=function(t){return this.documentStore=new C.DocumentStore(t),this},C.Index.prototype.addDoc=function(t,e){if(t){e=void 0===e||e;var n=t[this._ref];this.documentStore.addDoc(n,t),this._fields.forEach(function(e){var o=this.pipeline.run(C.tokenizer(t[e]));this.documentStore.addFieldLength(n,e,o.length);var r={};for(var i in o.forEach(function(t){t in r?r[t]+=1:r[t]=1},this),r){var s=r[i];s=Math.sqrt(s),this.index[e].addToken(i,{ref:n,tf:s})}},this),e&&this.eventEmitter.emit("add",t,this)}},C.Index.prototype.removeDocByRef=function(t,e){if(t&&!1!==this.documentStore.isDocStored()&&this.documentStore.hasDoc(t)){var n=this.documentStore.getDoc(t);this.removeDoc(n,!1)}},C.Index.prototype.removeDoc=function(t,e){if(t){e=void 0===e||e;var n=t[this._ref];this.documentStore.hasDoc(n)&&(this.documentStore.removeDoc(n),this._fields.forEach(function(e){this.pipeline.run(C.tokenizer(t[e])).forEach(function(t){this.index[e].removeToken(t,n)},this)},this),e&&this.eventEmitter.emit("remove",t,this))}},C.Index.prototype.updateDoc=function(t,e){e=void 0===e||e;this.removeDocByRef(t[this._ref],!1),this.addDoc(t,!1),e&&this.eventEmitter.emit("update",t,this)},C.Index.prototype.idf=function(t,e){var n="@"+e+"/"+t;if(Object.prototype.hasOwnProperty.call(this._idfCache,n))return this._idfCache[n];var o=this.index[e].getDocFreq(t),r=1+Math.log(this.documentStore.length/(o+1));return this._idfCache[n]=r,r},C.Index.prototype.getFields=function(){return this._fields.slice()},C.Index.prototype.search=function(t,e){if(!t)return[];var n=null;null!=e&&(n=JSON.stringify(e));var o=new C.Configuration(n,this.getFields()).get(),r=this.pipeline.run(C.tokenizer(t)),i={};for(var s in o){var u=this.fieldSearch(r,s,o),a=o[s].boost;for(var h in u)u[h]=u[h]*a;for(var h in u)h in i?i[h]+=u[h]:i[h]=u[h]}var c=[];for(var h in i)c.push({ref:h,score:i[h]});return c.sort(function(t,e){return e.score-t.score}),c},C.Index.prototype.fieldSearch=function(t,e,n){var o=n[e].bool,r=n[e].expand,i=n[e].boost,s=null,u={};if(0!==i)return t.forEach(function(t){var n=[t];1==r&&(n=this.index[e].expandToken(t));var i={};n.forEach(function(n){var r=this.index[e].getDocs(n),a=this.idf(n,e);if(s&&"AND"==o){var h={};for(var c in s)c in r&&(h[c]=r[c]);r=h}for(var c in n==t&&this.fieldSearchStats(u,n,r),r){var p=this.index[e].getTermFrequency(n,c),l=this.documentStore.getFieldLength(c,e),d=1;0!=l&&(d=1/Math.sqrt(l));var f=1;n!=t&&(f=.15*(1-(n.length-t.length)/n.length));var v=p*a*d*f;c in i?i[c]+=v:i[c]=v}},this),s=this.mergeScores(s,i,o)},this),s=this.coordNorm(s,u,t.length)},C.Index.prototype.mergeScores=function(t,e,n){if(!t)return e;if("AND"==n){var o={};for(var r in e)r in t&&(o[r]=t[r]+e[r]);return o}for(var r in e)r in t?t[r]+=e[r]:t[r]=e[r];return t},C.Index.prototype.fieldSearchStats=function(t,e,n){for(var o in n)o in t?t[o].push(e):t[o]=[e]},C.Index.prototype.coordNorm=function(t,e,n){for(var o in t)if(o in e){var r=e[o].length;t[o]=t[o]*r/n}return t},C.Index.prototype.toJSON=function(){var t={};return this._fields.forEach(function(e){t[e]=this.index[e].toJSON()},this),{version:C.version,fields:this._fields,ref:this._ref,documentStore:this.documentStore.toJSON(),index:t,pipeline:this.pipeline.toJSON()}},C.Index.prototype.use=function(t){var e=Array.prototype.slice.call(arguments,1);e.unshift(this),t.apply(this,e)},C.DocumentStore=function(t){this._save=null==t||t,this.docs={},this.docInfo={},this.length=0},C.DocumentStore.load=function(t){var e=new this;return e.length=t.length,e.docs=t.docs,e.docInfo=t.docInfo,e._save=t.save,e},C.DocumentStore.prototype.isDocStored=function(){return this._save},C.DocumentStore.prototype.addDoc=function(t,e){this.hasDoc(t)||this.length++,!0===this._save?this.docs[t]=function(t){if(null===t||"object"!=typeof t)return t;var e=t.constructor();for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}(e):this.docs[t]=null},C.DocumentStore.prototype.getDoc=function(t){return!1===this.hasDoc(t)?null:this.docs[t]},C.DocumentStore.prototype.hasDoc=function(t){return t in this.docs},C.DocumentStore.prototype.removeDoc=function(t){this.hasDoc(t)&&(delete this.docs[t],delete this.docInfo[t],this.length--)},C.DocumentStore.prototype.addFieldLength=function(t,e,n){null!=t&&0!=this.hasDoc(t)&&(this.docInfo[t]||(this.docInfo[t]={}),this.docInfo[t][e]=n)},C.DocumentStore.prototype.updateFieldLength=function(t,e,n){null!=t&&0!=this.hasDoc(t)&&this.addFieldLength(t,e,n)},C.DocumentStore.prototype.getFieldLength=function(t,e){return null==t?0:t in this.docs&&e in this.docInfo[t]?this.docInfo[t][e]:0},C.DocumentStore.prototype.toJSON=function(){return{docs:this.docs,docInfo:this.docInfo,length:this.length,save:this._save}},C.stemmer=(s={ational:"ate",tional:"tion",enci:"ence",anci:"ance",izer:"ize",bli:"ble",alli:"al",entli:"ent",eli:"e",ousli:"ous",ization:"ize",ation:"ate",ator:"ate",alism:"al",iveness:"ive",fulness:"ful",ousness:"ous",aliti:"al",iviti:"ive",biliti:"ble",logi:"log"},u={icate:"ic",ative:"",alize:"al",iciti:"ic",ical:"ic",ful:"",ness:""},a="[aeiouy]",h="[^aeiou][^aeiouy]*",c=new RegExp("^([^aeiou][^aeiouy]*)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*"),p=new RegExp("^([^aeiou][^aeiouy]*)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*[aeiouy][aeiou]*[^aeiou][^aeiouy]*"),l=new RegExp("^([^aeiou][^aeiouy]*)?[aeiouy][aeiou]*[^aeiou][^aeiouy]*([aeiouy][aeiou]*)?$"),d=new RegExp("^([^aeiou][^aeiouy]*)?[aeiouy]"),f=/^(.+?)(ss|i)es$/,v=/^(.+?)([^s])s$/,y=/^(.+?)eed$/,m=/^(.+?)(ed|ing)$/,S=/.$/,w=/(at|bl|iz)$/,I=new RegExp("([^aeiouylsz])\\1$"),x=new RegExp("^"+h+a+"[^aeiouwxy]$"),g=/^(.+?[^aeiou])y$/,E=/^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/,D=/^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/,F=/^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/,P=/^(.+?)(s|t)(ion)$/,k=/^(.+?)e$/,b=/ll$/,z=new RegExp("^"+h+a+"[^aeiouwxy]$"),function(t){var e,n,o,r,i,a,h;if(t.length<3)return t;if("y"==(o=t.substr(0,1))&&(t=o.toUpperCase()+t.substr(1)),i=v,(r=f).test(t)?t=t.replace(r,"$1$2"):i.test(t)&&(t=t.replace(i,"$1$2")),i=m,(r=y).test(t)){var C=r.exec(t);(r=c).test(C[1])&&(r=S,t=t.replace(r,""))}else i.test(t)&&(e=(C=i.exec(t))[1],(i=d).test(e)&&(a=I,h=x,(i=w).test(t=e)?t+="e":a.test(t)?(r=S,t=t.replace(r,"")):h.test(t)&&(t+="e")));return(r=g).test(t)&&(t=(e=(C=r.exec(t))[1])+"i"),(r=E).test(t)&&(e=(C=r.exec(t))[1],n=C[2],(r=c).test(e)&&(t=e+s[n])),(r=D).test(t)&&(e=(C=r.exec(t))[1],n=C[2],(r=c).test(e)&&(t=e+u[n])),i=P,(r=F).test(t)?(e=(C=r.exec(t))[1],(r=p).test(e)&&(t=e)):i.test(t)&&(e=(C=i.exec(t))[1]+C[2],(i=p).test(e)&&(t=e)),(r=k).test(t)&&(e=(C=r.exec(t))[1],i=l,a=z,((r=p).test(e)||i.test(e)&&!a.test(e))&&(t=e)),i=p,(r=b).test(t)&&i.test(t)&&(r=S,t=t.replace(r,"")),"y"==o&&(t=o.toLowerCase()+t.substr(1)),t}),C.Pipeline.registerFunction(C.stemmer,"stemmer"),C.stopWordFilter=function(t){if(t&&!0!==C.stopWordFilter.stopWords[t])return t},C.clearStopWords=function(){C.stopWordFilter.stopWords={}},C.addStopWords=function(t){null!=t&&!1!==Array.isArray(t)&&t.forEach(function(t){C.stopWordFilter.stopWords[t]=!0},this)},C.resetStopWords=function(){C.stopWordFilter.stopWords=C.defaultStopWords},C.defaultStopWords={"":!0,a:!0,able:!0,about:!0,across:!0,after:!0,all:!0,almost:!0,also:!0,am:!0,among:!0,an:!0,and:!0,any:!0,are:!0,as:!0,at:!0,be:!0,because:!0,been:!0,but:!0,by:!0,can:!0,cannot:!0,could:!0,dear:!0,did:!0,do:!0,does:!0,either:!0,else:!0,ever:!0,every:!0,for:!0,from:!0,get:!0,got:!0,had:!0,has:!0,have:!0,he:!0,her:!0,hers:!0,him:!0,his:!0,how:!0,however:!0,i:!0,if:!0,in:!0,into:!0,is:!0,it:!0,its:!0,just:!0,least:!0,let:!0,like:!0,likely:!0,may:!0,me:!0,might:!0,most:!0,must:!0,my:!0,neither:!0,no:!0,nor:!0,not:!0,of:!0,off:!0,often:!0,on:!0,only:!0,or:!0,other:!0,our:!0,own:!0,rather:!0,said:!0,say:!0,says:!0,she:!0,should:!0,since:!0,so:!0,some:!0,than:!0,that:!0,the:!0,their:!0,them:!0,then:!0,there:!0,these:!0,they:!0,this:!0,tis:!0,to:!0,too:!0,twas:!0,us:!0,wants:!0,was:!0,we:!0,were:!0,what:!0,when:!0,where:!0,which:!0,while:!0,who:!0,whom:!0,why:!0,will:!0,with:!0,would:!0,yet:!0,you:!0,your:!0},C.stopWordFilter.stopWords=C.defaultStopWords,C.Pipeline.registerFunction(C.stopWordFilter,"stopWordFilter"),C.trimmer=function(t){if(null==t)throw new Error("token should not be undefined");return t.replace(/^\W+/,"").replace(/\W+$/,"")},C.Pipeline.registerFunction(C.trimmer,"trimmer"),C.InvertedIndex=function(){this.root={docs:{},df:0}},C.InvertedIndex.load=function(t){var e=new this;return e.root=t.root,e},C.InvertedIndex.prototype.addToken=function(t,e,n){n=n||this.root;for(var o=0;o<=t.length-1;){var r=t[o];r in n||(n[r]={docs:{},df:0}),o+=1,n=n[r]}var i=e.ref;n.docs[i]?n.docs[i]={tf:e.tf}:(n.docs[i]={tf:e.tf},n.df+=1)},C.InvertedIndex.prototype.hasToken=function(t){if(!t)return!1;for(var e=this.root,n=0;n<t.length;n++){if(!e[t[n]])return!1;e=e[t[n]]}return!0},C.InvertedIndex.prototype.getNode=function(t){if(!t)return null;for(var e=this.root,n=0;n<t.length;n++){if(!e[t[n]])return null;e=e[t[n]]}return e},C.InvertedIndex.prototype.getDocs=function(t){var e=this.getNode(t);return null==e?{}:e.docs},C.InvertedIndex.prototype.getTermFrequency=function(t,e){var n=this.getNode(t);return null==n?0:e in n.docs?n.docs[e].tf:0},C.InvertedIndex.prototype.getDocFreq=function(t){var e=this.getNode(t);return null==e?0:e.df},C.InvertedIndex.prototype.removeToken=function(t,e){if(t){var n=this.getNode(t);null!=n&&e in n.docs&&(delete n.docs[e],n.df-=1)}},C.InvertedIndex.prototype.expandToken=function(t,e,n){if(null==t||""==t)return[];e=e||[];if(null==n&&null==(n=this.getNode(t)))return e;for(var o in n.df>0&&e.push(t),n)"docs"!==o&&"df"!==o&&this.expandToken(t+o,e,n[o]);return e},C.InvertedIndex.prototype.toJSON=function(){return{root:this.root}},C.Configuration=function(t,e){var n;t=t||"";if(null==e||null==e)throw new Error("fields should not be null");this.config={};try{n=JSON.parse(t),this.buildUserConfig(n,e)}catch(o){C.utils.warn("user configuration parse failed, will use default configuration"),this.buildDefaultConfig(e)}},C.Configuration.prototype.buildDefaultConfig=function(t){this.reset(),t.forEach(function(t){this.config[t]={boost:1,bool:"OR",expand:!1}},this)},C.Configuration.prototype.buildUserConfig=function(t,e){var n="OR",o=!1;if(this.reset(),"bool"in t&&(n=t.bool||n),"expand"in t&&(o=t.expand||o),"fields"in t)for(var r in t.fields)if(e.indexOf(r)>-1){var i=t.fields[r],s=o;null!=i.expand&&(s=i.expand),this.config[r]={boost:i.boost||0===i.boost?i.boost:1,bool:i.bool||n,expand:s}}else C.utils.warn("field name in user configuration not found in index instance fields");else this.addAllFields2UserConfig(n,o,e)},C.Configuration.prototype.addAllFields2UserConfig=function(t,e,n){n.forEach(function(n){this.config[n]={boost:1,bool:t,expand:e}},this)},C.Configuration.prototype.get=function(){return this.config},C.Configuration.prototype.reset=function(){this.config={}},lunr.SortedSet=function(){this.length=0,this.elements=[]},lunr.SortedSet.load=function(t){var e=new this;return e.elements=t,e.length=t.length,e},lunr.SortedSet.prototype.add=function(){var t,e;for(t=0;t<arguments.length;t++)e=arguments[t],~this.indexOf(e)||this.elements.splice(this.locationFor(e),0,e);this.length=this.elements.length},lunr.SortedSet.prototype.toArray=function(){return this.elements.slice()},lunr.SortedSet.prototype.map=function(t,e){return this.elements.map(t,e)},lunr.SortedSet.prototype.forEach=function(t,e){return this.elements.forEach(t,e)},lunr.SortedSet.prototype.indexOf=function(t){for(var e=0,n=this.elements.length,o=n-e,r=e+Math.floor(o/2),i=this.elements[r];o>1;){if(i===t)return r;i<t&&(e=r),i>t&&(n=r),o=n-e,r=e+Math.floor(o/2),i=this.elements[r]}return i===t?r:-1},lunr.SortedSet.prototype.locationFor=function(t){for(var e=0,n=this.elements.length,o=n-e,r=e+Math.floor(o/2),i=this.elements[r];o>1;)i<t&&(e=r),i>t&&(n=r),o=n-e,r=e+Math.floor(o/2),i=this.elements[r];return i>t?r:i<t?r+1:void 0},lunr.SortedSet.prototype.intersect=function(t){for(var e=new lunr.SortedSet,n=0,o=0,r=this.length,i=t.length,s=this.elements,u=t.elements;!(n>r-1||o>i-1);)s[n]!==u[o]?s[n]<u[o]?n++:s[n]>u[o]&&o++:(e.add(s[n]),n++,o++);return e},lunr.SortedSet.prototype.clone=function(){var t=new lunr.SortedSet;return t.elements=this.toArray(),t.length=t.elements.length,t},lunr.SortedSet.prototype.union=function(t){var e,n,o;this.length>=t.length?(e=this,n=t):(e=t,n=this),o=e.clone();for(var r=0,i=n.toArray();r<i.length;r++)o.add(i[r]);return o},lunr.SortedSet.prototype.toJSON=function(){return this.toArray()},void 0===(r="function"==typeof(o=function(){return C})?o.call(e,n,e,t):o)||(t.exports=r)}()}}]);
//# sourceMappingURL=9-2152530669b4465e711f.js.map