fuse.js-ie11
Version:
Lightweight fuzzy-search
9 lines • 20.8 kB
JavaScript
/**
* Fuse.js v6.0.0 - Lightweight fuzzy-search (http://fusejs.io)
*
* Copyright (c) 2020 Kiro Risk (http://kiro.me)
* All Rights Reserved. Apache Software License 2.0
*
* http://www.apache.org/licenses/LICENSE-2.0
*/
var e,t;e=this,t=function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function r(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function c(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function s(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&u(e,t)}function a(e){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function u(e,t){return(u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function h(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function f(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=a(e);if(t){var i=a(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return h(this,n)}}function l(e){return function(e){if(Array.isArray(e))return d(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return d(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?d(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function d(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function v(e){return Array.isArray?Array.isArray(e):"[object Array]"===Object.prototype.toString.call(e)}function y(e){return"string"==typeof e}function g(e){return"number"==typeof e}function p(e){return null!=e}function m(e){return!e.trim().length}var k=function(e){return"Invalid value for key ".concat(e)},M=function(e){return"Pattern length exceeds max of ".concat(e,".")},b=Object.prototype.hasOwnProperty,x=function(){function e(n){var r=this;t(this,e),this._keys={},this._keyNames=[];var i=0;n.forEach((function(e){var t,n=1;if(y(e))t=e;else{if(!b.call(e,"name"))throw new Error("Missing ".concat("name"," property in key"));if(t=e.name,b.call(e,"weight")&&(n=e.weight)<=0)throw new Error(function(e){return"Property 'weight' in key '".concat(e,"' must be a positive integer")}(t))}r._keyNames.push(t),r._keys[t]={weight:n},i+=n})),this._keyNames.forEach((function(e){r._keys[e].weight/=i}))}return r(e,[{key:"get",value:function(e,t){return this._keys[e]&&this._keys[e][t]}},{key:"keys",value:function(){return this._keyNames}},{key:"toJSON",value:function(){return JSON.stringify(this._keys)}}]),e}(),S=c({},{isCaseSensitive:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:function(e,t){return e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1}},{},{includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},{},{location:0,threshold:.6,distance:100},{},{useExtendedSearch:!1,getFn:function(e,t){var n=[],r=!1;return function e(t,i){if(i){var o=i.indexOf("."),c=i,s=null;-1!==o&&(c=i.slice(0,o),s=i.slice(o+1));var a=t[c];if(!p(a))return;if(s||!y(a)&&!g(a))if(v(a)){r=!0;for(var u=0,h=a.length;u<h;u+=1)e(a[u],s)}else s&&e(a,s);else n.push(function(e){return null==e?"":function(e){if("string"==typeof e)return e;var t=e+"";return"0"==t&&1/e==-1/0?"-0":t}(e)}(a))}else n.push(t)}(e,t),r?n:n[0]}}),_=/[^ ]+/g;function w(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:3,t=new Map;return{get:function(n){var r=n.match(_).length;if(t.has(r))return t.get(r);var i=parseFloat((1/Math.sqrt(r)).toFixed(e));return t.set(r,i),i},clear:function(){t.clear()}}}var O=function(){function e(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=n.getFn,i=void 0===r?S.getFn:r;t(this,e),this.norm=w(3),this.getFn=i,this.isCreated=!1,this.setRecords()}return r(e,[{key:"setCollection",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.docs=e}},{key:"setRecords",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.records=e}},{key:"setKeys",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.keys=e}},{key:"create",value:function(){var e=this;!this.isCreated&&this.docs.length&&(this.isCreated=!0,y(this.docs[0])?this.docs.forEach((function(t,n){e._addString(t,n)})):this.docs.forEach((function(t,n){e._addObject(t,n)})),this.norm.clear())}},{key:"add",value:function(e){var t=this.size();y(e)?this._addString(e,t):this._addObject(e,t)}},{key:"removeAt",value:function(e){this.records.splice(e,1);for(var t=e,n=this.size();t<n;t+=1)this.records[t].i-=1}},{key:"size",value:function(){return this.records.length}},{key:"_addString",value:function(e,t){if(p(e)&&!m(e)){var n={v:e,i:t,n:this.norm.get(e)};this.records.push(n)}}},{key:"_addObject",value:function(e,t){var n=this,r={i:t,$:{}};this.keys.forEach((function(t,i){var o=n.getFn(e,t);if(p(o))if(v(o))!function(){for(var e=[],t=[{nestedArrIndex:-1,value:o}];t.length;){var c=t.pop(),s=c.nestedArrIndex,a=c.value;if(p(a))if(y(a)&&!m(a)){var u={v:a,i:s,n:n.norm.get(a)};e.push(u)}else v(a)&&a.forEach((function(e,n){t.push({nestedArrIndex:n,value:e})}))}r.$[i]=e}();else if(!m(o)){var c={v:o,n:n.norm.get(o)};r.$[i]=c}})),this.records.push(r)}},{key:"toJSON",value:function(){return{keys:this.keys,records:this.records}}}]),e}();function C(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.getFn,i=void 0===r?S.getFn:r,o=new O({getFn:i});return o.setKeys(e),o.setCollection(t),o.create(),o}function L(e,t){var n=e.matches;t.matches=[],p(n)&&n.forEach((function(e){if(p(e.indices)&&e.indices.length){var n={indices:e.indices,value:e.value};e.key&&(n.key=e.key),e.idx>-1&&(n.refIndex=e.idx),t.matches.push(n)}}))}function j(e,t){t.score=e.score}function A(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.errors,r=void 0===n?0:n,i=t.currentLocation,o=void 0===i?0:i,c=t.expectedLocation,s=void 0===c?0:c,a=t.distance,u=void 0===a?S.distance:a,h=r/e.length,f=Math.abs(s-o);return u?h+f/u:f?1:h}function E(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:S.minMatchCharLength,n=[],r=-1,i=-1,o=0,c=e.length;o<c;o+=1){var s=e[o];s&&-1===r?r=o:s||-1===r||((i=o-1)-r+1>=t&&n.push([r,i]),r=-1)}return e[o-1]&&o-r>=t&&n.push([r,o-1]),n}function I(e){for(var t={},n=0,r=e.length;n<r;n+=1){var i=e.charAt(n);t[i]=(t[i]||0)|1<<r-n-1}return t}var $=function(){function e(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r.location,o=void 0===i?S.location:i,c=r.threshold,s=void 0===c?S.threshold:c,a=r.distance,u=void 0===a?S.distance:a,h=r.includeMatches,f=void 0===h?S.includeMatches:h,l=r.findAllMatches,d=void 0===l?S.findAllMatches:l,v=r.minMatchCharLength,y=void 0===v?S.minMatchCharLength:v,g=r.isCaseSensitive,p=void 0===g?S.isCaseSensitive:g;t(this,e),this.options={location:o,threshold:s,distance:u,includeMatches:f,findAllMatches:d,minMatchCharLength:y,isCaseSensitive:p},this.pattern=p?n:n.toLowerCase(),this.chunks=[];for(var m=0;m<this.pattern.length;){var k=this.pattern.substring(m,m+32);this.chunks.push({pattern:k,alphabet:I(k)}),m+=32}}return r(e,[{key:"searchIn",value:function(e){var t=this.options,n=t.isCaseSensitive,r=t.includeMatches;if(n||(e=e.toLowerCase()),this.pattern===e){var i={isMatch:!0,score:0};return r&&(i.indices=[[0,e.length-1]]),i}var o=this.options,c=o.location,s=o.distance,a=o.threshold,u=o.findAllMatches,h=o.minMatchCharLength,f=[],d=0,v=!1;this.chunks.forEach((function(t,n){var i=t.pattern,o=t.alphabet,y=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=r.location,o=void 0===i?S.location:i,c=r.distance,s=void 0===c?S.distance:c,a=r.threshold,u=void 0===a?S.threshold:a,h=r.findAllMatches,f=void 0===h?S.findAllMatches:h,l=r.minMatchCharLength,d=void 0===l?S.minMatchCharLength:l,v=r.includeMatches,y=void 0===v?S.includeMatches:v;if(t.length>32)throw new Error(M(32));var g,p=t.length,m=e.length,k=Math.max(0,Math.min(o,m)),b=u,x=k,_=[];if(y)for(var w=0;w<m;w+=1)_[w]=0;for(;(g=e.indexOf(t,x))>-1;){var O=A(t,{currentLocation:g,expectedLocation:k,distance:s});if(b=Math.min(O,b),x=g+p,y)for(var C=0;C<p;)_[g+C]=1,C+=1}x=-1;for(var L=[],j=1,I=p+m,$=1<<(p<=31?p-1:30),R=0;R<p;R+=1){for(var P=0,F=I;P<F;){var N=A(t,{errors:R,currentLocation:k+F,expectedLocation:k,distance:s});N<=b?P=F:I=F,F=Math.floor((I-P)/2+P)}I=F;var D=Math.max(1,k-F+1),z=f?m:Math.min(k+F,m)+p,q=Array(z+2);q[z+1]=(1<<R)-1;for(var W=z;W>=D;W-=1){var J=W-1,K=n[e.charAt(J)];if(K&&y&&(_[J]=1),q[W]=(q[W+1]<<1|1)&K,0!==R&&(q[W]|=(L[W+1]|L[W])<<1|1|L[W+1]),q[W]&$&&(j=A(t,{errors:R,currentLocation:J,expectedLocation:k,distance:s}))<=b){if(b=j,(x=J)<=k)break;D=Math.max(1,2*k-x)}}var T=A(t,{errors:R+1,currentLocation:k,expectedLocation:k,distance:s});if(T>b)break;L=q}var U={isMatch:x>=0,score:Math.max(.001,j)};return y&&(U.indices=E(_,d)),U}(e,i,o,{location:c+32*n,distance:s,threshold:a,findAllMatches:u,minMatchCharLength:h,includeMatches:r}),g=y.isMatch,p=y.score,m=y.indices;g&&(v=!0),d+=p,g&&m&&(f=[].concat(l(f),l(m)))}));var y={isMatch:v,score:v?d/this.chunks.length:1};return v&&r&&(y.indices=f),y}}]),e}(),R=function(){function e(n){t(this,e),this.pattern=n}return r(e,[{key:"search",value:function(){}}],[{key:"isMultiMatch",value:function(e){return P(e,this.multiRegex)}},{key:"isSingleMatch",value:function(e){return P(e,this.singleRegex)}}]),e}();function P(e,t){var n=e.match(t);return n?n[1]:null}var F=function(e){s(i,e);var n=f(i);function i(e){return t(this,i),n.call(this,e)}return r(i,[{key:"search",value:function(e){for(var t,n=0,r=[],i=this.pattern.length;(t=e.indexOf(this.pattern,n))>-1;)n=t+i,r.push([t,n-1]);var o=!!r.length;return{isMatch:o,score:o?1:0,indices:r}}}],[{key:"type",get:function(){return"exact"}},{key:"multiRegex",get:function(){return/^'"(.*)"$/}},{key:"singleRegex",get:function(){return/^'(.*)$/}}]),i}(R),N=function(e){s(i,e);var n=f(i);function i(e){return t(this,i),n.call(this,e)}return r(i,[{key:"search",value:function(e){var t=-1===e.indexOf(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}],[{key:"type",get:function(){return"inverse-exact"}},{key:"multiRegex",get:function(){return/^!"(.*)"$/}},{key:"singleRegex",get:function(){return/^!(.*)$/}}]),i}(R),D=function(e){s(i,e);var n=f(i);function i(e){return t(this,i),n.call(this,e)}return r(i,[{key:"search",value:function(e){var t=e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}}],[{key:"type",get:function(){return"prefix-exact"}},{key:"multiRegex",get:function(){return/^\^"(.*)"$/}},{key:"singleRegex",get:function(){return/^\^(.*)$/}}]),i}(R),z=function(e){s(i,e);var n=f(i);function i(e){return t(this,i),n.call(this,e)}return r(i,[{key:"search",value:function(e){var t=!e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}],[{key:"type",get:function(){return"inverse-prefix-exact"}},{key:"multiRegex",get:function(){return/^!\^"(.*)"$/}},{key:"singleRegex",get:function(){return/^!\^(.*)$/}}]),i}(R),q=function(e){s(i,e);var n=f(i);function i(e){return t(this,i),n.call(this,e)}return r(i,[{key:"search",value:function(e){var t=e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[e.length-this.pattern.length,e.length-1]}}}],[{key:"type",get:function(){return"suffix-exact"}},{key:"multiRegex",get:function(){return/^"(.*)"\$$/}},{key:"singleRegex",get:function(){return/^(.*)\$$/}}]),i}(R),W=function(e){s(i,e);var n=f(i);function i(e){return t(this,i),n.call(this,e)}return r(i,[{key:"search",value:function(e){var t=!e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}}],[{key:"type",get:function(){return"inverse-suffix-exact"}},{key:"multiRegex",get:function(){return/^!"(.*)"\$$/}},{key:"singleRegex",get:function(){return/^!(.*)\$$/}}]),i}(R),J=function(e){s(i,e);var n=f(i);function i(e){var r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},c=o.location,s=void 0===c?S.location:c,a=o.threshold,u=void 0===a?S.threshold:a,h=o.distance,f=void 0===h?S.distance:h,l=o.includeMatches,d=void 0===l?S.includeMatches:l,v=o.findAllMatches,y=void 0===v?S.findAllMatches:v,g=o.minMatchCharLength,p=void 0===g?S.minMatchCharLength:g,m=o.isCaseSensitive,k=void 0===m?S.isCaseSensitive:m;return t(this,i),(r=n.call(this,e))._bitapSearch=new $(e,{location:s,threshold:u,distance:f,includeMatches:d,findAllMatches:y,minMatchCharLength:p,isCaseSensitive:k}),r}return r(i,[{key:"search",value:function(e){return this._bitapSearch.searchIn(e)}}],[{key:"type",get:function(){return"fuzzy"}},{key:"multiRegex",get:function(){return/^"(.*)"$/}},{key:"singleRegex",get:function(){return/^(.*)$/}}]),i}(R),K=[F,D,z,W,q,N,J],T=K.length,U=/ +(?=([^\"]*\"[^\"]*\")*[^\"]*$)/;function B(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.split("|").map((function(e){for(var n=e.trim().split(U).filter((function(e){return e&&!!e.trim()})),r=[],i=0,o=n.length;i<o;i+=1){for(var c=n[i],s=!1,a=-1;!s&&++a<T;){var u=K[a],h=u.isMultiMatch(c);h&&(r.push(new u(h,t)),s=!0)}if(!s)for(a=-1;++a<T;){var f=K[a],l=f.isSingleMatch(c);if(l){r.push(new f(l,t));break}}}return r}))}var G=new Set([J.type,F.type]),H=function(){function e(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r.isCaseSensitive,o=void 0===i?S.isCaseSensitive:i,c=r.includeMatches,s=void 0===c?S.includeMatches:c,a=r.minMatchCharLength,u=void 0===a?S.minMatchCharLength:a,h=r.findAllMatches,f=void 0===h?S.findAllMatches:h,l=r.location,d=void 0===l?S.location:l,v=r.threshold,y=void 0===v?S.threshold:v,g=r.distance,p=void 0===g?S.distance:g;t(this,e),this.query=null,this.options={isCaseSensitive:o,includeMatches:s,minMatchCharLength:u,findAllMatches:f,location:d,threshold:y,distance:p},this.pattern=o?n:n.toLowerCase(),this.query=B(this.pattern,this.options)}return r(e,[{key:"searchIn",value:function(e){var t=this.query;if(!t)return{isMatch:!1,score:1};var n=this.options,r=n.includeMatches;e=n.isCaseSensitive?e:e.toLowerCase();for(var i=0,o=[],c=0,s=0,a=t.length;s<a;s+=1){var u=t[s];o.length=0,i=0;for(var h=0,f=u.length;h<f;h+=1){var d=u[h],v=d.search(e),y=v.isMatch,g=v.indices,p=v.score;if(!y){c=0,i=0,o.length=0;break}if(i+=1,c+=p,r){var m=d.constructor.type;G.has(m)?o=[].concat(l(o),l(g)):o.push(g)}}if(i){var k={isMatch:!0,score:c/i};return r&&(k.indices=o),k}}return{isMatch:!1,score:1}}}],[{key:"condition",value:function(e,t){return t.useExtendedSearch}}]),e}(),Q=[];function V(e,t){for(var n=0,r=Q.length;n<r;n+=1){var i=Q[n];if(i.condition(e,t))return new i(e,t)}return new $(e,t)}var X="$and",Y="$or",Z=function(e){return!(!e[X]&&!e[Y])},ee=function(t){return!v(t)&&"object"===e(t)&&!Z(t)},te=function(e){return i({},X,Object.keys(e).map((function(t){return i({},t,e[t])})))},ne=function(){function e(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;t(this,e),this.options=c({},S,{},r),this.options.useExtendedSearch,this._keyStore=new x(this.options.keys),this.setCollection(n,i)}return r(e,[{key:"setCollection",value:function(e,t){if(this._docs=e,t&&!(t instanceof O))throw new Error("Incorrect 'index' type");this._myIndex=t||C(this._keyStore.keys(),this._docs,{getFn:this.options.getFn})}},{key:"add",value:function(e){p(e)&&(this._docs.push(e),this._myIndex.add(e))}},{key:"removeAt",value:function(e){this._docs.splice(e,1),this._myIndex.removeAt(e)}},{key:"getIndex",value:function(){return this._myIndex}},{key:"search",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.limit,r=void 0===n?-1:n,i=this.options,o=i.includeMatches,c=i.includeScore,s=i.shouldSort,a=i.sortFn,u=y(e)?y(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e);return re(u,this._keyStore),s&&u.sort(a),g(r)&&r>-1&&(u=u.slice(0,r)),ie(u,this._docs,{includeMatches:o,includeScore:c})}},{key:"_searchStringList",value:function(e){var t=V(e,this.options),n=this._myIndex.records,r=[];return n.forEach((function(e){var n=e.v,i=e.i,o=e.n;if(p(n)){var c=t.searchIn(n),s=c.isMatch,a=c.score,u=c.indices;s&&r.push({item:n,idx:i,matches:[{score:a,value:n,norm:o,indices:u}]})}})),r}},{key:"_searchLogical",value:function(e){var t=this,n=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.auto,i=void 0===r||r,o=function e(n){var r=Object.keys(n);if(r.length>1&&!Z(n))return e(te(n));var o=r[0];if(ee(n)){var c=n[o];if(!y(c))throw new Error(k(o));var s={key:o,pattern:c};return i&&(s.searcher=V(c,t)),s}var a={children:[],operator:o};return r.forEach((function(t){var r=n[t];v(r)&&r.forEach((function(t){a.children.push(e(t))}))})),a};return Z(e)||(e=te(e)),o(e)}(e,this.options),r=this._myIndex,i=r.keys,o=r.records,c={},s=[];return o.forEach((function(e){var r=e.$,o=e.i;p(r)&&function e(n,r,o){if(!n.children){var a=n.key,u=n.searcher,h=r[i.indexOf(a)];return t._findMatches({key:a,value:h,searcher:u})}for(var f=n.operator,d=[],v=0;v<n.children.length;v+=1){var y=e(n.children[v],r,o);if(y&&y.length){if(d.push({idx:o,item:r,matches:y}),f===Y)break}else if(f===X){d.length=0;break}}d.length&&(c[o]||(c[o]={idx:o,item:r,matches:[]},s.push(c[o])),d.forEach((function(e){var t,n=e.matches;(t=c[o].matches).push.apply(t,l(n))})))}(n,r,o)})),s}},{key:"_searchObjectList",value:function(e){var t=this,n=V(e,this.options),r=this._myIndex,i=r.keys,o=r.records,c=[];return o.forEach((function(e){var r=e.$,o=e.i;if(p(r)){var s=[];i.forEach((function(e,i){s.push.apply(s,l(t._findMatches({key:e,value:r[i],searcher:n})))})),s.length&&c.push({idx:o,item:r,matches:s})}})),c}},{key:"_findMatches",value:function(e){var t=e.key,n=e.value,r=e.searcher;if(!p(n))return[];var i=[];if(v(n))n.forEach((function(e){var n=e.v,o=e.i,c=e.n;if(p(n)){var s=r.searchIn(n),a=s.isMatch,u=s.score,h=s.indices;a&&i.push({score:u,key:t,value:n,idx:o,norm:c,indices:h})}}));else{var o=n.v,c=n.n,s=r.searchIn(o),a=s.isMatch,u=s.score,h=s.indices;a&&i.push({score:u,key:t,value:o,norm:c,indices:h})}return i}}]),e}();function re(e,t){e.forEach((function(e){var n=1;e.matches.forEach((function(e){var r=e.key,i=e.norm,o=e.score,c=t.get(r,"weight");n*=Math.pow(0===o&&c?Number.EPSILON:o,(c||1)*i)})),e.score=n}))}function ie(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.includeMatches,i=void 0===r?S.includeMatches:r,o=n.includeScore,c=void 0===o?S.includeScore:o,s=[];return i&&s.push(L),c&&s.push(j),e.map((function(e){var n=e.idx,r={item:t[n],refIndex:n};return s.length&&s.forEach((function(t){t(e,r)})),r}))}return ne.version="6.0.0",ne.createIndex=C,ne.parseIndex=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.getFn,r=void 0===n?S.getFn:n,i=e.keys,o=e.records,c=new O({getFn:r});return c.setKeys(i),c.setRecords(o),c},ne.config=S,function(){Q.push.apply(Q,arguments)}(H),ne},"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).Fuse=t();