-
Notifications
You must be signed in to change notification settings - Fork 0
/
list.fuzzysearch.min.js
1 lines (1 loc) · 8.34 KB
/
list.fuzzysearch.min.js
1
!function(){function a(b,c,d){var e=a.resolve(b);if(null==e){d=d||b,c=c||"root";var f=new Error('Failed to require "'+d+'" from "'+c+'"');throw f.path=d,f.parent=c,f.require=!0,f}var g=a.modules[e];if(!g._resolving&&!g.exports){var h={};h.exports={},h.client=h.component=!0,g._resolving=!0,g.call(this,h.exports,a.relative(e),h),delete g._resolving,g.exports=h.exports}return g.exports}a.modules={},a.aliases={},a.resolve=function(b){"/"===b.charAt(0)&&(b=b.slice(1));for(var c=[b,b+".js",b+".json",b+"/index.js",b+"/index.json"],d=0;d<c.length;d++){var b=c[d];if(a.modules.hasOwnProperty(b))return b;if(a.aliases.hasOwnProperty(b))return a.aliases[b]}},a.normalize=function(a,b){var c=[];if("."!=b.charAt(0))return b;a=a.split("/"),b=b.split("/");for(var d=0;d<b.length;++d)".."==b[d]?a.pop():"."!=b[d]&&""!=b[d]&&c.push(b[d]);return a.concat(c).join("/")},a.register=function(b,c){a.modules[b]=c},a.alias=function(b,c){if(!a.modules.hasOwnProperty(b))throw new Error('Failed to alias "'+b+'", it does not exist');a.aliases[c]=b},a.relative=function(b){function c(a,b){for(var c=a.length;c--;)if(a[c]===b)return c;return-1}function d(c){var e=d.resolve(c);return a(e,b,c)}var e=a.normalize(b,"..");return d.resolve=function(d){var f=d.charAt(0);if("/"==f)return d.slice(1);if("."==f)return a.normalize(e,d);var g=b.split("/"),h=c(g,"deps")+1;return h||(h=0),d=g.slice(0,h+1).join("/")+"/deps/"+d},d.exists=function(b){return a.modules.hasOwnProperty(d.resolve(b))},d},a.register("component-indexof/index.js",function(a,b,c){c.exports=function(a,b){if(a.indexOf)return a.indexOf(b);for(var c=0;c<a.length;++c)if(a[c]===b)return c;return-1}}),a.register("component-classes/index.js",function(a,b,c){function d(a){if(!a)throw new Error("A DOM element reference is required");this.el=a,this.list=a.classList}var e=b("indexof"),f=/\s+/,g=Object.prototype.toString;c.exports=function(a){return new d(a)},d.prototype.add=function(a){if(this.list)return this.list.add(a),this;var b=this.array(),c=e(b,a);return~c||b.push(a),this.el.className=b.join(" "),this},d.prototype.remove=function(a){if("[object RegExp]"==g.call(a))return this.removeMatching(a);if(this.list)return this.list.remove(a),this;var b=this.array(),c=e(b,a);return~c&&b.splice(c,1),this.el.className=b.join(" "),this},d.prototype.removeMatching=function(a){for(var b=this.array(),c=0;c<b.length;c++)a.test(b[c])&&this.remove(b[c]);return this},d.prototype.toggle=function(a){return this.list?(this.list.toggle(a),this):(this.has(a)?this.remove(a):this.add(a),this)},d.prototype.array=function(){var a=this.el.className.replace(/^\s+|\s+$/g,""),b=a.split(f);return""===b[0]&&b.shift(),b},d.prototype.has=d.prototype.contains=function(a){return this.list?this.list.contains(a):!!~e(this.array(),a)}}),a.register("segmentio-extend/index.js",function(a,b,c){c.exports=function(a){for(var b,c=Array.prototype.slice.call(arguments,1),d=0;b=c[d];d++)if(b)for(var e in b)a[e]=b[e];return a}}),a.register("component-event/index.js",function(a){var b=void 0!==window.addEventListener?"addEventListener":"attachEvent",c=void 0!==window.removeEventListener?"removeEventListener":"detachEvent",d="addEventListener"!==b?"on":"";a.bind=function(a,c,e,f){return a[b](d+c,e,f||!1),e},a.unbind=function(a,b,e,f){return a[c](d+b,e,f||!1),e}}),a.register("component-type/index.js",function(a,b,c){var d=Object.prototype.toString;c.exports=function(a){switch(d.call(a)){case"[object Function]":return"function";case"[object Date]":return"date";case"[object RegExp]":return"regexp";case"[object Arguments]":return"arguments";case"[object Array]":return"array";case"[object String]":return"string"}return null===a?"null":void 0===a?"undefined":a&&1===a.nodeType?"element":a===Object(a)?"object":typeof a}}),a.register("timoxley-is-collection/index.js",function(a,b,c){function d(a){return"object"==typeof a&&/^\[object (NodeList)\]$/.test(Object.prototype.toString.call(a))&&a.hasOwnProperty("length")&&(0==a.length||"object"==typeof a[0]&&a[0].nodeType>0)}var e=b("type");c.exports=function(a){var b=e(a);if("array"===b)return 1;switch(b){case"arguments":return 2;case"object":if(d(a))return 2;try{if("length"in a&&!a.tagName&&(!a.scrollTo||!a.document)&&!a.apply)return 2}catch(c){}default:return 0}}}),a.register("javve-events/index.js",function(a,b){var c=b("event"),d=b("is-collection");a.bind=function(a,b,e,f){if(d(a)){if(a&&void 0!==a[0])for(var g=0;g<a.length;g++)c.bind(a[g],b,e,f)}else c.bind(a,b,e,f)},a.unbind=function(a,b,e,f){if(d(a)){if(a&&void 0!==a[0])for(var g=0;g<a.length;g++)c.unbind(a[g],b,e,f)}else c.unbind(a,b,e,f)}}),a.register("javve-get-by-class/index.js",function(a,b,c){c.exports=function(){return document.getElementsByClassName?function(a,b,c){return c?a.getElementsByClassName(b)[0]:a.getElementsByClassName(b)}:document.querySelector?function(a,b,c){return c?a.querySelector(b):a.querySelectorAll(b)}:function(a,b,c){var d=[],e="*";null==a&&(a=document);for(var f=a.getElementsByTagName(e),g=f.length,h=new RegExp("(^|\\s)"+b+"(\\s|$)"),i=0,j=0;g>i;i++)if(h.test(f[i].className)){if(c)return f[i];d[j]=f[i],j++}return d}}()}),a.register("javve-to-string/index.js",function(a,b,c){c.exports=function(a){return a=void 0===a?"":a,a=null===a?"":a,a=a.toString()}}),a.register("list.fuzzysearch.js/index.js",function(a,b,c){var d=(b("classes"),b("events")),e=b("extend"),f=b("to-string"),g=b("get-by-class");c.exports=function(a){a=a||{},e(a,{location:0,distance:100,threshold:.4,multiSearch:!0,searchClass:"fuzzy-search"});var c,h=b("./src/fuzzy"),i={search:function(b,d){for(var e=a.multiSearch?b.replace(/ +$/,"").split(/ +/):[b],f=0,g=c.items.length;g>f;f++)i.item(c.items[f],d,e)},item:function(a,b,c){for(var d=!0,e=0;e<c.length;e++){for(var f=!1,g=0,h=b.length;h>g;g++)i.values(a.values(),b[g],c[e])&&(f=!0);f||(d=!1)}a.found=d},values:function(b,c,d){if(b.hasOwnProperty(c)){var e=f(b[c]).toLowerCase();if(h(e,d,a))return!0}return!1}};return{init:function(b){c=b,d.bind(g(c.listContainer,a.searchClass),"keyup",function(a){var b=a.target||a.srcElement;c.search(b.value,i.search)})},search:function(a,b){c.search(a,b,i.search)},name:a.name||"fuzzySearch"}}}),a.register("list.fuzzysearch.js/src/fuzzy.js",function(a,b,c){c.exports=function(a,b,c){function d(a,c){var d=a/b.length,e=Math.abs(h-c);return f?d+e/f:e?1:d}var e=c.location||0,f=c.distance||100,g=c.threshold||.4;if(b===a)return!0;if(b.length>32)return!1;var h=e,i=function(){var a,c={};for(a=0;a<b.length;a++)c[b.charAt(a)]=0;for(a=0;a<b.length;a++)c[b.charAt(a)]|=1<<b.length-a-1;return c}(),j=g,k=a.indexOf(b,h);-1!=k&&(j=Math.min(d(0,k),j),k=a.lastIndexOf(b,h+b.length),-1!=k&&(j=Math.min(d(0,k),j)));var l=1<<b.length-1;k=-1;for(var m,n,o,p=b.length+a.length,q=0;q<b.length;q++){for(m=0,n=p;n>m;)d(q,h+n)<=j?m=n:p=n,n=Math.floor((p-m)/2+m);p=n;var r=Math.max(1,h-n+1),s=Math.min(h+n,a.length)+b.length,t=Array(s+2);t[s+1]=(1<<q)-1;for(var u=s;u>=r;u--){var v=i[a.charAt(u-1)];if(t[u]=0===q?(t[u+1]<<1|1)&v:(t[u+1]<<1|1)&v|((o[u+1]|o[u])<<1|1)|o[u+1],t[u]&l){var w=d(q,u-1);if(j>=w){if(j=w,k=u-1,!(k>h))break;r=Math.max(1,2*h-k)}}}if(d(q+1,h)>j)break;o=t}return 0>k?!1:!0}}),a.alias("component-classes/index.js","list.fuzzysearch.js/deps/classes/index.js"),a.alias("component-classes/index.js","classes/index.js"),a.alias("component-indexof/index.js","component-classes/deps/indexof/index.js"),a.alias("segmentio-extend/index.js","list.fuzzysearch.js/deps/extend/index.js"),a.alias("segmentio-extend/index.js","extend/index.js"),a.alias("javve-events/index.js","list.fuzzysearch.js/deps/events/index.js"),a.alias("javve-events/index.js","events/index.js"),a.alias("component-event/index.js","javve-events/deps/event/index.js"),a.alias("timoxley-is-collection/index.js","javve-events/deps/is-collection/index.js"),a.alias("component-type/index.js","timoxley-is-collection/deps/type/index.js"),a.alias("javve-get-by-class/index.js","list.fuzzysearch.js/deps/get-by-class/index.js"),a.alias("javve-get-by-class/index.js","get-by-class/index.js"),a.alias("javve-to-string/index.js","list.fuzzysearch.js/deps/to-string/index.js"),a.alias("javve-to-string/index.js","list.fuzzysearch.js/deps/to-string/index.js"),a.alias("javve-to-string/index.js","to-string/index.js"),a.alias("javve-to-string/index.js","javve-to-string/index.js"),a.alias("list.fuzzysearch.js/index.js","list.fuzzysearch.js/index.js"),"object"==typeof exports?module.exports=a("list.fuzzysearch.js"):"function"==typeof define&&define.amd?define(function(){return a("list.fuzzysearch.js")}):this.ListFuzzySearch=a("list.fuzzysearch.js")}();