From 7a8b680faa62bb30214a2825374abc82d6a22624 Mon Sep 17 00:00:00 2001 From: Fabiano Taioli Date: Mon, 8 Jun 2020 16:54:45 +0200 Subject: [PATCH 1/3] fix mouse paste --- horsey.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/horsey.js b/horsey.js index bc0d3d9..f53c601 100644 --- a/horsey.js +++ b/horsey.js @@ -750,7 +750,10 @@ function autocomplete (el, options = {}) { crossvent[op](attachment, 'keypress', deferredShow); crossvent[op](attachment, 'keypress', deferredFiltering); crossvent[op](attachment, 'keydown', deferredFilteringNoEnter); - crossvent[op](attachment, 'paste', deferredFiltering); + crossvent[op](attachment, 'paste', function (ev) { + deferredShow(ev); + deferredFiltering(ev); + }); crossvent[op](attachment, 'keydown', keydown); if (o.autoHideOnBlur) { crossvent[op](attachment, 'keydown', hideOnBlur); } } else { From ef36f14663965b05ed983a820b90d97e04aad7f4 Mon Sep 17 00:00:00 2001 From: Fabiano Taioli Date: Mon, 8 Jun 2020 17:03:02 +0200 Subject: [PATCH 2/3] Fix deps and rebuild --- dist/horsey.js | 1902 +++++++++++++++++++++++++++----------------- dist/horsey.min.js | 2 +- horsey.es5.js | 69 +- package.json | 90 +-- 4 files changed, 1258 insertions(+), 805 deletions(-) diff --git a/dist/horsey.js b/dist/horsey.js index cb3a681..1cbb03d 100644 --- a/dist/horsey.js +++ b/dist/horsey.js @@ -1,4 +1,4 @@ -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.horsey = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o 1 && arguments[1] !== undefined ? arguments[1] : {}; + var setAppends = options.setAppends, + _set = options.set, + filter = options.filter, + source = options.source, + _options$cache = options.cache, + cache = _options$cache === undefined ? {} : _options$cache, + predictNextSearch = options.predictNextSearch, + renderItem = options.renderItem, + renderCategory = options.renderCategory, + blankSearch = options.blankSearch, + appendTo = options.appendTo, + anchor = options.anchor, + debounce = options.debounce; var caching = options.cache !== false; if (!source) { @@ -117,8 +117,8 @@ function horsey(el) { return data.query.length; } function sourceFunction(data, done) { - var query = data.query; - var limit = data.limit; + var query = data.query, + limit = data.limit; if (!options.blankSearch && query.length === 0) { done(null, [], true);return; @@ -168,25 +168,25 @@ function horsey(el) { } function autocomplete(el) { - var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var o = options; var parent = o.appendTo || doc.body; - var getText = o.getText; - var getValue = o.getValue; - var form = o.form; - var source = o.source; - var noMatches = o.noMatches; - var noMatchesText = o.noMatchesText; - var _o$highlighter = o.highlighter; - var highlighter = _o$highlighter === undefined ? true : _o$highlighter; - var _o$highlightCompleteW = o.highlightCompleteWords; - var highlightCompleteWords = _o$highlightCompleteW === undefined ? true : _o$highlightCompleteW; - var _o$renderItem = o.renderItem; - var renderItem = _o$renderItem === undefined ? defaultItemRenderer : _o$renderItem; - var _o$renderCategory = o.renderCategory; - var renderCategory = _o$renderCategory === undefined ? defaultCategoryRenderer : _o$renderCategory; - var setAppends = o.setAppends; + var getText = o.getText, + getValue = o.getValue, + form = o.form, + source = o.source, + noMatches = o.noMatches, + noMatchesText = o.noMatchesText, + _o$highlighter = o.highlighter, + highlighter = _o$highlighter === undefined ? true : _o$highlighter, + _o$highlightCompleteW = o.highlightCompleteWords, + highlightCompleteWords = _o$highlightCompleteW === undefined ? true : _o$highlightCompleteW, + _o$renderItem = o.renderItem, + renderItem = _o$renderItem === undefined ? defaultItemRenderer : _o$renderItem, + _o$renderCategory = o.renderCategory, + renderCategory = _o$renderCategory === undefined ? defaultCategoryRenderer : _o$renderCategory, + setAppends = o.setAppends; var limit = typeof o.limit === 'number' ? o.limit : Infinity; var userFilter = o.filter || defaultFilter; @@ -920,7 +920,10 @@ function autocomplete(el) { _crossvent2.default[op](attachment, 'keypress', deferredShow); _crossvent2.default[op](attachment, 'keypress', deferredFiltering); _crossvent2.default[op](attachment, 'keydown', deferredFilteringNoEnter); - _crossvent2.default[op](attachment, 'paste', deferredFiltering); + _crossvent2.default[op](attachment, 'paste', function (ev) { + deferredShow(ev); + deferredFiltering(ev); + }); _crossvent2.default[op](attachment, 'keydown', keydown); if (o.autoHideOnBlur) { _crossvent2.default[op](attachment, 'keydown', hideOnBlur); @@ -1068,158 +1071,760 @@ function isEditable(el) { module.exports = horsey; -},{"bullseye":3,"contra/emitter":7,"crossvent":8,"fuzzysearch":11,"hash-sum":12,"lodash/debounce":13,"sektor":20,"sell":29}],2:[function(require,module,exports){ -module.exports = function atoa (a, n) { return Array.prototype.slice.call(a, n); } +},{"bullseye":10,"contra/emitter":17,"crossvent":18,"fuzzysearch":21,"hash-sum":22,"lodash/debounce":2,"sektor":24,"sell":33}],2:[function(require,module,exports){ +var isObject = require('./isObject'), + now = require('./now'), + toNumber = require('./toNumber'); -},{}],3:[function(require,module,exports){ -'use strict'; +/** Used as the `TypeError` message for "Functions" methods. */ +var FUNC_ERROR_TEXT = 'Expected a function'; -var crossvent = require('crossvent'); -var throttle = require('./throttle'); -var tailormade = require('./tailormade'); +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max, + nativeMin = Math.min; -function bullseye (el, target, options) { - var o = options; - var domTarget = target && target.tagName; +/** + * Creates a debounced function that delays invoking `func` until after `wait` + * milliseconds have elapsed since the last time the debounced function was + * invoked. The debounced function comes with a `cancel` method to cancel + * delayed `func` invocations and a `flush` method to immediately invoke them. + * Provide an options object to indicate whether `func` should be invoked on + * the leading and/or trailing edge of the `wait` timeout. The `func` is invoked + * with the last arguments provided to the debounced function. Subsequent calls + * to the debounced function return the result of the last `func` invocation. + * + * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked + * on the trailing edge of the timeout only if the debounced function is + * invoked more than once during the `wait` timeout. + * + * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) + * for details over the differences between `_.debounce` and `_.throttle`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to debounce. + * @param {number} [wait=0] The number of milliseconds to delay. + * @param {Object} [options={}] The options object. + * @param {boolean} [options.leading=false] + * Specify invoking on the leading edge of the timeout. + * @param {number} [options.maxWait] + * The maximum time `func` is allowed to be delayed before it's invoked. + * @param {boolean} [options.trailing=true] + * Specify invoking on the trailing edge of the timeout. + * @returns {Function} Returns the new debounced function. + * @example + * + * // Avoid costly calculations while the window size is in flux. + * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); + * + * // Invoke `sendMail` when clicked, debouncing subsequent calls. + * jQuery(element).on('click', _.debounce(sendMail, 300, { + * 'leading': true, + * 'trailing': false + * })); + * + * // Ensure `batchLog` is invoked once after 1 second of debounced calls. + * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 }); + * var source = new EventSource('/stream'); + * jQuery(source).on('message', debounced); + * + * // Cancel the trailing debounced invocation. + * jQuery(window).on('popstate', debounced.cancel); + */ +function debounce(func, wait, options) { + var lastArgs, + lastThis, + maxWait, + result, + timerId, + lastCallTime, + lastInvokeTime = 0, + leading = false, + maxing = false, + trailing = true; - if (!domTarget && arguments.length === 2) { - o = target; + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); } - if (!domTarget) { - target = el; + wait = toNumber(wait) || 0; + if (isObject(options)) { + leading = !!options.leading; + maxing = 'maxWait' in options; + maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait; + trailing = 'trailing' in options ? !!options.trailing : trailing; } - if (!o) { o = {}; } - var destroyed = false; - var throttledWrite = throttle(write, 30); - var tailorOptions = { update: o.autoupdateToCaret !== false && update }; - var tailor = o.caret && tailormade(target, tailorOptions); + function invokeFunc(time) { + var args = lastArgs, + thisArg = lastThis; - write(); + lastArgs = lastThis = undefined; + lastInvokeTime = time; + result = func.apply(thisArg, args); + return result; + } - if (o.tracking !== false) { - crossvent.add(window, 'resize', throttledWrite); + function leadingEdge(time) { + // Reset any `maxWait` timer. + lastInvokeTime = time; + // Start the timer for the trailing edge. + timerId = setTimeout(timerExpired, wait); + // Invoke the leading edge. + return leading ? invokeFunc(time) : result; } - return { - read: readNull, - refresh: write, - destroy: destroy, - sleep: sleep - }; + function remainingWait(time) { + var timeSinceLastCall = time - lastCallTime, + timeSinceLastInvoke = time - lastInvokeTime, + result = wait - timeSinceLastCall; - function sleep () { - tailorOptions.sleeping = true; + return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result; } - function readNull () { return read(); } + function shouldInvoke(time) { + var timeSinceLastCall = time - lastCallTime, + timeSinceLastInvoke = time - lastInvokeTime; - function read (readings) { - var bounds = target.getBoundingClientRect(); - var scrollTop = document.body.scrollTop || document.documentElement.scrollTop; - if (tailor) { - readings = tailor.read(); - return { - x: (readings.absolute ? 0 : bounds.left) + readings.x, - y: (readings.absolute ? 0 : bounds.top) + scrollTop + readings.y + 20 - }; - } - return { - x: bounds.left, - y: bounds.top + scrollTop - }; + // Either this is the first call, activity has stopped and we're at the + // trailing edge, the system time has gone backwards and we're treating + // it as the trailing edge, or we've hit the `maxWait` limit. + return (lastCallTime === undefined || (timeSinceLastCall >= wait) || + (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); } - function update (readings) { - write(readings); + function timerExpired() { + var time = now(); + if (shouldInvoke(time)) { + return trailingEdge(time); + } + // Restart the timer. + timerId = setTimeout(timerExpired, remainingWait(time)); } - function write (readings) { - if (destroyed) { - throw new Error('Bullseye can\'t refresh after being destroyed. Create another instance instead.'); - } - if (tailor && !readings) { - tailorOptions.sleeping = false; - tailor.refresh(); return; - } - var p = read(readings); - if (!tailor && target !== el) { - p.y += target.offsetHeight; + function trailingEdge(time) { + timerId = undefined; + + // Only invoke if we have `lastArgs` which means `func` has been + // debounced at least once. + if (trailing && lastArgs) { + return invokeFunc(time); } - var context = o.context; - el.style.left = p.x + 'px'; - el.style.top = (context ? context.offsetHeight : p.y) + 'px'; + lastArgs = lastThis = undefined; + return result; } - function destroy () { - if (tailor) { tailor.destroy(); } - crossvent.remove(window, 'resize', throttledWrite); - destroyed = true; + function cancel() { + lastInvokeTime = 0; + lastArgs = lastCallTime = lastThis = timerId = undefined; } -} - -module.exports = bullseye; - -},{"./tailormade":4,"./throttle":5,"crossvent":8}],4:[function(require,module,exports){ -(function (global){ -'use strict'; - -var sell = require('sell'); -var crossvent = require('crossvent'); -var seleccion = require('seleccion'); -var throttle = require('./throttle'); -var getSelection = seleccion.get; -var props = [ - 'direction', - 'boxSizing', - 'width', - 'height', - 'overflowX', - 'overflowY', - 'borderTopWidth', - 'borderRightWidth', - 'borderBottomWidth', - 'borderLeftWidth', - 'paddingTop', - 'paddingRight', - 'paddingBottom', - 'paddingLeft', - 'fontStyle', - 'fontVariant', - 'fontWeight', - 'fontStretch', - 'fontSize', - 'fontSizeAdjust', - 'lineHeight', - 'fontFamily', - 'textAlign', - 'textTransform', - 'textIndent', - 'textDecoration', - 'letterSpacing', - 'wordSpacing' -]; -var win = global; -var doc = document; -var ff = win.mozInnerScreenX !== null && win.mozInnerScreenX !== void 0; - -function tailormade (el, options) { - var textInput = el.tagName === 'INPUT' || el.tagName === 'TEXTAREA'; - var throttledRefresh = throttle(refresh, 30); - var o = options || {}; - bind(); + function flush() { + return timerId === undefined ? result : trailingEdge(now()); + } - return { - read: readPosition, - refresh: throttledRefresh, - destroy: destroy - }; + function debounced() { + var time = now(), + isInvoking = shouldInvoke(time); - function noop () {} - function readPosition () { return (textInput ? coordsText : coordsHTML)(); } + lastArgs = arguments; + lastThis = this; + lastCallTime = time; - function refresh () { + if (isInvoking) { + if (timerId === undefined) { + return leadingEdge(lastCallTime); + } + if (maxing) { + // Handle invocations in a tight loop. + timerId = setTimeout(timerExpired, wait); + return invokeFunc(lastCallTime); + } + } + if (timerId === undefined) { + timerId = setTimeout(timerExpired, wait); + } + return result; + } + debounced.cancel = cancel; + debounced.flush = flush; + return debounced; +} + +module.exports = debounce; + +},{"./isObject":4,"./now":7,"./toNumber":8}],3:[function(require,module,exports){ +var isObject = require('./isObject'); + +/** `Object#toString` result references. */ +var funcTag = '[object Function]', + genTag = '[object GeneratorFunction]'; + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * of values. + */ +var objectToString = objectProto.toString; + +/** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ +function isFunction(value) { + // The use of `Object#toString` avoids issues with the `typeof` operator + // in Safari 8 which returns 'object' for typed array and weak map constructors, + // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. + var tag = isObject(value) ? objectToString.call(value) : ''; + return tag == funcTag || tag == genTag; +} + +module.exports = isFunction; + +},{"./isObject":4}],4:[function(require,module,exports){ +/** + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(_.noop); + * // => true + * + * _.isObject(null); + * // => false + */ +function isObject(value) { + var type = typeof value; + return !!value && (type == 'object' || type == 'function'); +} + +module.exports = isObject; + +},{}],5:[function(require,module,exports){ +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return !!value && typeof value == 'object'; +} + +module.exports = isObjectLike; + +},{}],6:[function(require,module,exports){ +var isObjectLike = require('./isObjectLike'); + +/** `Object#toString` result references. */ +var symbolTag = '[object Symbol]'; + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) + * of values. + */ +var objectToString = objectProto.toString; + +/** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, + * else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ +function isSymbol(value) { + return typeof value == 'symbol' || + (isObjectLike(value) && objectToString.call(value) == symbolTag); +} + +module.exports = isSymbol; + +},{"./isObjectLike":5}],7:[function(require,module,exports){ +/** + * Gets the timestamp of the number of milliseconds that have elapsed since + * the Unix epoch (1 January 1970 00:00:00 UTC). + * + * @static + * @memberOf _ + * @since 2.4.0 + * @category Date + * @returns {number} Returns the timestamp. + * @example + * + * _.defer(function(stamp) { + * console.log(_.now() - stamp); + * }, _.now()); + * // => Logs the number of milliseconds it took for the deferred invocation. + */ +function now() { + return Date.now(); +} + +module.exports = now; + +},{}],8:[function(require,module,exports){ +var isFunction = require('./isFunction'), + isObject = require('./isObject'), + isSymbol = require('./isSymbol'); + +/** Used as references for various `Number` constants. */ +var NAN = 0 / 0; + +/** Used to match leading and trailing whitespace. */ +var reTrim = /^\s+|\s+$/g; + +/** Used to detect bad signed hexadecimal string values. */ +var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; + +/** Used to detect binary string values. */ +var reIsBinary = /^0b[01]+$/i; + +/** Used to detect octal string values. */ +var reIsOctal = /^0o[0-7]+$/i; + +/** Built-in method references without a dependency on `root`. */ +var freeParseInt = parseInt; + +/** + * Converts `value` to a number. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to process. + * @returns {number} Returns the number. + * @example + * + * _.toNumber(3.2); + * // => 3.2 + * + * _.toNumber(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toNumber(Infinity); + * // => Infinity + * + * _.toNumber('3.2'); + * // => 3.2 + */ +function toNumber(value) { + if (typeof value == 'number') { + return value; + } + if (isSymbol(value)) { + return NAN; + } + if (isObject(value)) { + var other = isFunction(value.valueOf) ? value.valueOf() : value; + value = isObject(other) ? (other + '') : other; + } + if (typeof value != 'string') { + return value === 0 ? value : +value; + } + value = value.replace(reTrim, ''); + var isBinary = reIsBinary.test(value); + return (isBinary || reIsOctal.test(value)) + ? freeParseInt(value.slice(2), isBinary ? 2 : 8) + : (reIsBadHex.test(value) ? NAN : +value); +} + +module.exports = toNumber; + +},{"./isFunction":3,"./isObject":4,"./isSymbol":6}],9:[function(require,module,exports){ +module.exports = function atoa (a, n) { return Array.prototype.slice.call(a, n); } + +},{}],10:[function(require,module,exports){ +'use strict'; + +var crossvent = require('crossvent'); +var throttle = require('./throttle'); +var tailormade = require('./tailormade'); + +function bullseye (el, target, options) { + var o = options; + var domTarget = target && target.tagName; + + if (!domTarget && arguments.length === 2) { + o = target; + } + if (!domTarget) { + target = el; + } + if (!o) { o = {}; } + + var destroyed = false; + var throttledWrite = throttle(write, 30); + var tailorOptions = { update: o.autoupdateToCaret !== false && update }; + var tailor = o.caret && tailormade(target, tailorOptions); + + write(); + + if (o.tracking !== false) { + crossvent.add(window, 'resize', throttledWrite); + } + + return { + read: readNull, + refresh: write, + destroy: destroy, + sleep: sleep + }; + + function sleep () { + tailorOptions.sleeping = true; + } + + function readNull () { return read(); } + + function read (readings) { + var bounds = target.getBoundingClientRect(); + var scrollTop = document.body.scrollTop || document.documentElement.scrollTop; + if (tailor) { + readings = tailor.read(); + return { + x: (readings.absolute ? 0 : bounds.left) + readings.x, + y: (readings.absolute ? 0 : bounds.top) + scrollTop + readings.y + 20 + }; + } + return { + x: bounds.left, + y: bounds.top + scrollTop + }; + } + + function update (readings) { + write(readings); + } + + function write (readings) { + if (destroyed) { + throw new Error('Bullseye can\'t refresh after being destroyed. Create another instance instead.'); + } + if (tailor && !readings) { + tailorOptions.sleeping = false; + tailor.refresh(); return; + } + var p = read(readings); + if (!tailor && target !== el) { + p.y += target.offsetHeight; + } + var context = o.context; + el.style.left = p.x + 'px'; + el.style.top = (context ? context.offsetHeight : p.y) + 'px'; + } + + function destroy () { + if (tailor) { tailor.destroy(); } + crossvent.remove(window, 'resize', throttledWrite); + destroyed = true; + } +} + +module.exports = bullseye; + +},{"./tailormade":14,"./throttle":15,"crossvent":11}],11:[function(require,module,exports){ +(function (global){ +'use strict'; + +var customEvent = require('custom-event'); +var eventmap = require('./eventmap'); +var doc = global.document; +var addEvent = addEventEasy; +var removeEvent = removeEventEasy; +var hardCache = []; + +if (!global.addEventListener) { + addEvent = addEventHard; + removeEvent = removeEventHard; +} + +module.exports = { + add: addEvent, + remove: removeEvent, + fabricate: fabricateEvent +}; + +function addEventEasy (el, type, fn, capturing) { + return el.addEventListener(type, fn, capturing); +} + +function addEventHard (el, type, fn) { + return el.attachEvent('on' + type, wrap(el, type, fn)); +} + +function removeEventEasy (el, type, fn, capturing) { + return el.removeEventListener(type, fn, capturing); +} + +function removeEventHard (el, type, fn) { + var listener = unwrap(el, type, fn); + if (listener) { + return el.detachEvent('on' + type, listener); + } +} + +function fabricateEvent (el, type, model) { + var e = eventmap.indexOf(type) === -1 ? makeCustomEvent() : makeClassicEvent(); + if (el.dispatchEvent) { + el.dispatchEvent(e); + } else { + el.fireEvent('on' + type, e); + } + function makeClassicEvent () { + var e; + if (doc.createEvent) { + e = doc.createEvent('Event'); + e.initEvent(type, true, true); + } else if (doc.createEventObject) { + e = doc.createEventObject(); + } + return e; + } + function makeCustomEvent () { + return new customEvent(type, { detail: model }); + } +} + +function wrapperFactory (el, type, fn) { + return function wrapper (originalEvent) { + var e = originalEvent || global.event; + e.target = e.target || e.srcElement; + e.preventDefault = e.preventDefault || function preventDefault () { e.returnValue = false; }; + e.stopPropagation = e.stopPropagation || function stopPropagation () { e.cancelBubble = true; }; + e.which = e.which || e.keyCode; + fn.call(el, e); + }; +} + +function wrap (el, type, fn) { + var wrapper = unwrap(el, type, fn) || wrapperFactory(el, type, fn); + hardCache.push({ + wrapper: wrapper, + element: el, + type: type, + fn: fn + }); + return wrapper; +} + +function unwrap (el, type, fn) { + var i = find(el, type, fn); + if (i) { + var wrapper = hardCache[i].wrapper; + hardCache.splice(i, 1); // free up a tad of memory + return wrapper; + } +} + +function find (el, type, fn) { + var i, item; + for (i = 0; i < hardCache.length; i++) { + item = hardCache[i]; + if (item.element === el && item.type === type && item.fn === fn) { + return i; + } + } +} + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) + +},{"./eventmap":12,"custom-event":13}],12:[function(require,module,exports){ +(function (global){ +'use strict'; + +var eventmap = []; +var eventname = ''; +var ron = /^on/; + +for (eventname in global) { + if (ron.test(eventname)) { + eventmap.push(eventname.slice(2)); + } +} + +module.exports = eventmap; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) + +},{}],13:[function(require,module,exports){ +(function (global){ + +var NativeCustomEvent = global.CustomEvent; + +function useNative () { + try { + var p = new NativeCustomEvent('cat', { detail: { foo: 'bar' } }); + return 'cat' === p.type && 'bar' === p.detail.foo; + } catch (e) { + } + return false; +} + +/** + * Cross-browser `CustomEvent` constructor. + * + * https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent.CustomEvent + * + * @public + */ + +module.exports = useNative() ? NativeCustomEvent : + +// IE >= 9 +'undefined' !== typeof document && 'function' === typeof document.createEvent ? function CustomEvent (type, params) { + var e = document.createEvent('CustomEvent'); + if (params) { + e.initCustomEvent(type, params.bubbles, params.cancelable, params.detail); + } else { + e.initCustomEvent(type, false, false, void 0); + } + return e; +} : + +// IE <= 8 +function CustomEvent (type, params) { + var e = document.createEventObject(); + e.type = type; + if (params) { + e.bubbles = Boolean(params.bubbles); + e.cancelable = Boolean(params.cancelable); + e.detail = params.detail; + } else { + e.bubbles = false; + e.cancelable = false; + e.detail = void 0; + } + return e; +} + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) + +},{}],14:[function(require,module,exports){ +(function (global){ +'use strict'; + +var sell = require('sell'); +var crossvent = require('crossvent'); +var seleccion = require('seleccion'); +var throttle = require('./throttle'); +var getSelection = seleccion.get; +var props = [ + 'direction', + 'boxSizing', + 'width', + 'height', + 'overflowX', + 'overflowY', + 'borderTopWidth', + 'borderRightWidth', + 'borderBottomWidth', + 'borderLeftWidth', + 'paddingTop', + 'paddingRight', + 'paddingBottom', + 'paddingLeft', + 'fontStyle', + 'fontVariant', + 'fontWeight', + 'fontStretch', + 'fontSize', + 'fontSizeAdjust', + 'lineHeight', + 'fontFamily', + 'textAlign', + 'textTransform', + 'textIndent', + 'textDecoration', + 'letterSpacing', + 'wordSpacing' +]; +var win = global; +var doc = document; +var ff = win.mozInnerScreenX !== null && win.mozInnerScreenX !== void 0; + +function tailormade (el, options) { + var textInput = el.tagName === 'INPUT' || el.tagName === 'TEXTAREA'; + var throttledRefresh = throttle(refresh, 30); + var o = options || {}; + + bind(); + + return { + read: readPosition, + refresh: throttledRefresh, + destroy: destroy + }; + + function noop () {} + function readPosition () { return (textInput ? coordsText : coordsHTML)(); } + + function refresh () { if (o.sleeping) { return; } @@ -1341,7 +1946,7 @@ module.exports = tailormade; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./throttle":5,"crossvent":8,"seleccion":27,"sell":29}],5:[function(require,module,exports){ +},{"./throttle":15,"crossvent":11,"seleccion":31,"sell":33}],15:[function(require,module,exports){ 'use strict'; function throttle (fn, boundary) { @@ -1370,7 +1975,7 @@ function throttle (fn, boundary) { module.exports = throttle; -},{}],6:[function(require,module,exports){ +},{}],16:[function(require,module,exports){ 'use strict'; var ticky = require('ticky'); @@ -1382,7 +1987,7 @@ module.exports = function debounce (fn, args, ctx) { }); }; -},{"ticky":30}],7:[function(require,module,exports){ +},{"ticky":34}],17:[function(require,module,exports){ 'use strict'; var atoa = require('atoa'); @@ -1438,7 +2043,7 @@ module.exports = function emitter (thing, options) { return thing; }; -},{"./debounce":6,"atoa":2}],8:[function(require,module,exports){ +},{"./debounce":16,"atoa":9}],18:[function(require,module,exports){ (function (global){ 'use strict'; @@ -1520,613 +2125,374 @@ function wrap (el, type, fn) { type: type, fn: fn }); - return wrapper; -} - -function unwrap (el, type, fn) { - var i = find(el, type, fn); - if (i) { - var wrapper = hardCache[i].wrapper; - hardCache.splice(i, 1); // free up a tad of memory - return wrapper; - } -} - -function find (el, type, fn) { - var i, item; - for (i = 0; i < hardCache.length; i++) { - item = hardCache[i]; - if (item.element === el && item.type === type && item.fn === fn) { - return i; - } - } -} - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) - -},{"./eventmap":9,"custom-event":10}],9:[function(require,module,exports){ -(function (global){ -'use strict'; - -var eventmap = []; -var eventname = ''; -var ron = /^on/; - -for (eventname in global) { - if (ron.test(eventname)) { - eventmap.push(eventname.slice(2)); - } -} - -module.exports = eventmap; - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) - -},{}],10:[function(require,module,exports){ -(function (global){ - -var NativeCustomEvent = global.CustomEvent; - -function useNative () { - try { - var p = new NativeCustomEvent('cat', { detail: { foo: 'bar' } }); - return 'cat' === p.type && 'bar' === p.detail.foo; - } catch (e) { - } - return false; -} - -/** - * Cross-browser `CustomEvent` constructor. - * - * https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent.CustomEvent - * - * @public - */ - -module.exports = useNative() ? NativeCustomEvent : - -// IE >= 9 -'function' === typeof document.createEvent ? function CustomEvent (type, params) { - var e = document.createEvent('CustomEvent'); - if (params) { - e.initCustomEvent(type, params.bubbles, params.cancelable, params.detail); - } else { - e.initCustomEvent(type, false, false, void 0); - } - return e; -} : - -// IE <= 8 -function CustomEvent (type, params) { - var e = document.createEventObject(); - e.type = type; - if (params) { - e.bubbles = Boolean(params.bubbles); - e.cancelable = Boolean(params.cancelable); - e.detail = params.detail; - } else { - e.bubbles = false; - e.cancelable = false; - e.detail = void 0; - } - return e; -} - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) - -},{}],11:[function(require,module,exports){ -'use strict'; - -function fuzzysearch (needle, haystack) { - var tlen = haystack.length; - var qlen = needle.length; - if (qlen > tlen) { - return false; - } - if (qlen === tlen) { - return needle === haystack; - } - outer: for (var i = 0, j = 0; i < qlen; i++) { - var nch = needle.charCodeAt(i); - while (j < tlen) { - if (haystack.charCodeAt(j++) === nch) { - continue outer; - } - } - return false; - } - return true; -} - -module.exports = fuzzysearch; - -},{}],12:[function(require,module,exports){ -'use strict'; - -function pad (hash, len) { - while (hash.length < len) { - hash = '0' + hash; - } - return hash; -} - -function fold (hash, text) { - var i; - var chr; - var len; - if (text.length === 0) { - return hash; - } - for (i = 0, len = text.length; i < len; i++) { - chr = text.charCodeAt(i); - hash = ((hash << 5) - hash) + chr; - hash |= 0; - } - return hash < 0 ? hash * -2 : hash; -} - -function foldObject (hash, o, seen) { - return Object.keys(o).sort().reduce(foldKey, hash); - function foldKey (hash, key) { - return foldValue(hash, o[key], key, seen); - } -} - -function foldValue (input, value, key, seen) { - var hash = fold(fold(fold(input, key), toString(value)), typeof value); - if (value === null) { - return fold(hash, 'null'); - } - if (value === undefined) { - return fold(hash, 'undefined'); - } - if (typeof value === 'object') { - if (seen.indexOf(value) !== -1) { - return fold(hash, '[Circular]' + key); - } - seen.push(value); - return foldObject(hash, value, seen); - } - return fold(hash, value.toString()); -} - -function toString (o) { - return Object.prototype.toString.call(o); -} - -function sum (o) { - return pad(foldValue(0, o, '', []).toString(16), 8); -} - -module.exports = sum; - -},{}],13:[function(require,module,exports){ -var isObject = require('./isObject'), - now = require('./now'), - toNumber = require('./toNumber'); - -/** Used as the `TypeError` message for "Functions" methods. */ -var FUNC_ERROR_TEXT = 'Expected a function'; - -/* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeMax = Math.max, - nativeMin = Math.min; - -/** - * Creates a debounced function that delays invoking `func` until after `wait` - * milliseconds have elapsed since the last time the debounced function was - * invoked. The debounced function comes with a `cancel` method to cancel - * delayed `func` invocations and a `flush` method to immediately invoke them. - * Provide an options object to indicate whether `func` should be invoked on - * the leading and/or trailing edge of the `wait` timeout. The `func` is invoked - * with the last arguments provided to the debounced function. Subsequent calls - * to the debounced function return the result of the last `func` invocation. - * - * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked - * on the trailing edge of the timeout only if the debounced function is - * invoked more than once during the `wait` timeout. - * - * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) - * for details over the differences between `_.debounce` and `_.throttle`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {Function} func The function to debounce. - * @param {number} [wait=0] The number of milliseconds to delay. - * @param {Object} [options={}] The options object. - * @param {boolean} [options.leading=false] - * Specify invoking on the leading edge of the timeout. - * @param {number} [options.maxWait] - * The maximum time `func` is allowed to be delayed before it's invoked. - * @param {boolean} [options.trailing=true] - * Specify invoking on the trailing edge of the timeout. - * @returns {Function} Returns the new debounced function. - * @example - * - * // Avoid costly calculations while the window size is in flux. - * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); - * - * // Invoke `sendMail` when clicked, debouncing subsequent calls. - * jQuery(element).on('click', _.debounce(sendMail, 300, { - * 'leading': true, - * 'trailing': false - * })); - * - * // Ensure `batchLog` is invoked once after 1 second of debounced calls. - * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 }); - * var source = new EventSource('/stream'); - * jQuery(source).on('message', debounced); - * - * // Cancel the trailing debounced invocation. - * jQuery(window).on('popstate', debounced.cancel); - */ -function debounce(func, wait, options) { - var lastArgs, - lastThis, - maxWait, - result, - timerId, - lastCallTime, - lastInvokeTime = 0, - leading = false, - maxing = false, - trailing = true; + return wrapper; +} - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); +function unwrap (el, type, fn) { + var i = find(el, type, fn); + if (i) { + var wrapper = hardCache[i].wrapper; + hardCache.splice(i, 1); // free up a tad of memory + return wrapper; } - wait = toNumber(wait) || 0; - if (isObject(options)) { - leading = !!options.leading; - maxing = 'maxWait' in options; - maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait; - trailing = 'trailing' in options ? !!options.trailing : trailing; +} + +function find (el, type, fn) { + var i, item; + for (i = 0; i < hardCache.length; i++) { + item = hardCache[i]; + if (item.element === el && item.type === type && item.fn === fn) { + return i; + } } +} - function invokeFunc(time) { - var args = lastArgs, - thisArg = lastThis; +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) - lastArgs = lastThis = undefined; - lastInvokeTime = time; - result = func.apply(thisArg, args); - return result; - } +},{"./eventmap":19,"custom-event":20}],19:[function(require,module,exports){ +(function (global){ +'use strict'; - function leadingEdge(time) { - // Reset any `maxWait` timer. - lastInvokeTime = time; - // Start the timer for the trailing edge. - timerId = setTimeout(timerExpired, wait); - // Invoke the leading edge. - return leading ? invokeFunc(time) : result; +var eventmap = []; +var eventname = ''; +var ron = /^on/; + +for (eventname in global) { + if (ron.test(eventname)) { + eventmap.push(eventname.slice(2)); } +} - function remainingWait(time) { - var timeSinceLastCall = time - lastCallTime, - timeSinceLastInvoke = time - lastInvokeTime, - result = wait - timeSinceLastCall; +module.exports = eventmap; - return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result; - } +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) - function shouldInvoke(time) { - var timeSinceLastCall = time - lastCallTime, - timeSinceLastInvoke = time - lastInvokeTime; +},{}],20:[function(require,module,exports){ +(function (global){ - // Either this is the first call, activity has stopped and we're at the - // trailing edge, the system time has gone backwards and we're treating - // it as the trailing edge, or we've hit the `maxWait` limit. - return (lastCallTime === undefined || (timeSinceLastCall >= wait) || - (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); - } +var NativeCustomEvent = global.CustomEvent; - function timerExpired() { - var time = now(); - if (shouldInvoke(time)) { - return trailingEdge(time); - } - // Restart the timer. - timerId = setTimeout(timerExpired, remainingWait(time)); +function useNative () { + try { + var p = new NativeCustomEvent('cat', { detail: { foo: 'bar' } }); + return 'cat' === p.type && 'bar' === p.detail.foo; + } catch (e) { } + return false; +} - function trailingEdge(time) { - timerId = undefined; +/** + * Cross-browser `CustomEvent` constructor. + * + * https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent.CustomEvent + * + * @public + */ - // Only invoke if we have `lastArgs` which means `func` has been - // debounced at least once. - if (trailing && lastArgs) { - return invokeFunc(time); - } - lastArgs = lastThis = undefined; - return result; - } +module.exports = useNative() ? NativeCustomEvent : - function cancel() { - lastInvokeTime = 0; - lastArgs = lastCallTime = lastThis = timerId = undefined; +// IE >= 9 +'function' === typeof document.createEvent ? function CustomEvent (type, params) { + var e = document.createEvent('CustomEvent'); + if (params) { + e.initCustomEvent(type, params.bubbles, params.cancelable, params.detail); + } else { + e.initCustomEvent(type, false, false, void 0); } + return e; +} : - function flush() { - return timerId === undefined ? result : trailingEdge(now()); +// IE <= 8 +function CustomEvent (type, params) { + var e = document.createEventObject(); + e.type = type; + if (params) { + e.bubbles = Boolean(params.bubbles); + e.cancelable = Boolean(params.cancelable); + e.detail = params.detail; + } else { + e.bubbles = false; + e.cancelable = false; + e.detail = void 0; } + return e; +} - function debounced() { - var time = now(), - isInvoking = shouldInvoke(time); +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) - lastArgs = arguments; - lastThis = this; - lastCallTime = time; +},{}],21:[function(require,module,exports){ +'use strict'; - if (isInvoking) { - if (timerId === undefined) { - return leadingEdge(lastCallTime); - } - if (maxing) { - // Handle invocations in a tight loop. - timerId = setTimeout(timerExpired, wait); - return invokeFunc(lastCallTime); +function fuzzysearch (needle, haystack) { + var tlen = haystack.length; + var qlen = needle.length; + if (qlen > tlen) { + return false; + } + if (qlen === tlen) { + return needle === haystack; + } + outer: for (var i = 0, j = 0; i < qlen; i++) { + var nch = needle.charCodeAt(i); + while (j < tlen) { + if (haystack.charCodeAt(j++) === nch) { + continue outer; } } - if (timerId === undefined) { - timerId = setTimeout(timerExpired, wait); - } - return result; + return false; } - debounced.cancel = cancel; - debounced.flush = flush; - return debounced; + return true; } -module.exports = debounce; - -},{"./isObject":15,"./now":18,"./toNumber":19}],14:[function(require,module,exports){ -var isObject = require('./isObject'); - -/** `Object#toString` result references. */ -var funcTag = '[object Function]', - genTag = '[object GeneratorFunction]'; - -/** Used for built-in method references. */ -var objectProto = Object.prototype; +module.exports = fuzzysearch; -/** - * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) - * of values. - */ -var objectToString = objectProto.toString; +},{}],22:[function(require,module,exports){ +'use strict'; -/** - * Checks if `value` is classified as a `Function` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, - * else `false`. - * @example - * - * _.isFunction(_); - * // => true - * - * _.isFunction(/abc/); - * // => false - */ -function isFunction(value) { - // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8 which returns 'object' for typed array and weak map constructors, - // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. - var tag = isObject(value) ? objectToString.call(value) : ''; - return tag == funcTag || tag == genTag; +function pad (hash, len) { + while (hash.length < len) { + hash = '0' + hash; + } + return hash; } -module.exports = isFunction; - -},{"./isObject":15}],15:[function(require,module,exports){ -/** - * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) - * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); +function fold (hash, text) { + var i; + var chr; + var len; + if (text.length === 0) { + return hash; + } + for (i = 0, len = text.length; i < len; i++) { + chr = text.charCodeAt(i); + hash = ((hash << 5) - hash) + chr; + hash |= 0; + } + return hash < 0 ? hash * -2 : hash; } -module.exports = isObject; +function foldObject (hash, o, seen) { + return Object.keys(o).sort().reduce(foldKey, hash); + function foldKey (hash, key) { + return foldValue(hash, o[key], key, seen); + } +} -},{}],16:[function(require,module,exports){ -/** - * Checks if `value` is object-like. A value is object-like if it's not `null` - * and has a `typeof` result of "object". - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. - * @example - * - * _.isObjectLike({}); - * // => true - * - * _.isObjectLike([1, 2, 3]); - * // => true - * - * _.isObjectLike(_.noop); - * // => false - * - * _.isObjectLike(null); - * // => false - */ -function isObjectLike(value) { - return !!value && typeof value == 'object'; +function foldValue (input, value, key, seen) { + var hash = fold(fold(fold(input, key), toString(value)), typeof value); + if (value === null) { + return fold(hash, 'null'); + } + if (value === undefined) { + return fold(hash, 'undefined'); + } + if (typeof value === 'object') { + if (seen.indexOf(value) !== -1) { + return fold(hash, '[Circular]' + key); + } + seen.push(value); + return foldObject(hash, value, seen); + } + return fold(hash, value.toString()); } -module.exports = isObjectLike; +function toString (o) { + return Object.prototype.toString.call(o); +} -},{}],17:[function(require,module,exports){ -var isObjectLike = require('./isObjectLike'); +function sum (o) { + return pad(foldValue(0, o, '', []).toString(16), 8); +} -/** `Object#toString` result references. */ -var symbolTag = '[object Symbol]'; +module.exports = sum; -/** Used for built-in method references. */ -var objectProto = Object.prototype; +},{}],23:[function(require,module,exports){ +// shim for using process in browser +var process = module.exports = {}; -/** - * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) - * of values. - */ -var objectToString = objectProto.toString; +// cached from whatever global is present so that test runners that stub it +// don't break things. But we need to wrap it in a try catch in case it is +// wrapped in strict mode code which doesn't define any globals. It's inside a +// function because try/catches deoptimize in certain engines. -/** - * Checks if `value` is classified as a `Symbol` primitive or object. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, - * else `false`. - * @example - * - * _.isSymbol(Symbol.iterator); - * // => true - * - * _.isSymbol('abc'); - * // => false - */ -function isSymbol(value) { - return typeof value == 'symbol' || - (isObjectLike(value) && objectToString.call(value) == symbolTag); +var cachedSetTimeout; +var cachedClearTimeout; + +function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); +} +function defaultClearTimeout () { + throw new Error('clearTimeout has not been defined'); } +(function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; + } + } catch (e) { + cachedSetTimeout = defaultSetTimout; + } + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; + } +} ()) +function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); + } + // if setTimeout wasn't available but was latter defined + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch(e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch(e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); + } + } -module.exports = isSymbol; -},{"./isObjectLike":16}],18:[function(require,module,exports){ -/** - * Gets the timestamp of the number of milliseconds that have elapsed since - * the Unix epoch (1 January 1970 00:00:00 UTC). - * - * @static - * @memberOf _ - * @since 2.4.0 - * @category Date - * @returns {number} Returns the timestamp. - * @example - * - * _.defer(function(stamp) { - * console.log(_.now() - stamp); - * }, _.now()); - * // => Logs the number of milliseconds it took for the deferred invocation. - */ -function now() { - return Date.now(); } +function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); + } + // if clearTimeout wasn't available but was latter defined + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e){ + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e){ + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + return cachedClearTimeout.call(this, marker); + } + } -module.exports = now; - -},{}],19:[function(require,module,exports){ -var isFunction = require('./isFunction'), - isObject = require('./isObject'), - isSymbol = require('./isSymbol'); -/** Used as references for various `Number` constants. */ -var NAN = 0 / 0; -/** Used to match leading and trailing whitespace. */ -var reTrim = /^\s+|\s+$/g; +} +var queue = []; +var draining = false; +var currentQueue; +var queueIndex = -1; -/** Used to detect bad signed hexadecimal string values. */ -var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; +function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + draining = false; + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + if (queue.length) { + drainQueue(); + } +} -/** Used to detect binary string values. */ -var reIsBinary = /^0b[01]+$/i; +function drainQueue() { + if (draining) { + return; + } + var timeout = runTimeout(cleanUpNextTick); + draining = true; -/** Used to detect octal string values. */ -var reIsOctal = /^0o[0-7]+$/i; + var len = queue.length; + while(len) { + currentQueue = queue; + queue = []; + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } + } + queueIndex = -1; + len = queue.length; + } + currentQueue = null; + draining = false; + runClearTimeout(timeout); +} -/** Built-in method references without a dependency on `root`. */ -var freeParseInt = parseInt; +process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + queue.push(new Item(fun, args)); + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } +}; -/** - * Converts `value` to a number. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to process. - * @returns {number} Returns the number. - * @example - * - * _.toNumber(3.2); - * // => 3.2 - * - * _.toNumber(Number.MIN_VALUE); - * // => 5e-324 - * - * _.toNumber(Infinity); - * // => Infinity - * - * _.toNumber('3.2'); - * // => 3.2 - */ -function toNumber(value) { - if (typeof value == 'number') { - return value; - } - if (isSymbol(value)) { - return NAN; - } - if (isObject(value)) { - var other = isFunction(value.valueOf) ? value.valueOf() : value; - value = isObject(other) ? (other + '') : other; - } - if (typeof value != 'string') { - return value === 0 ? value : +value; - } - value = value.replace(reTrim, ''); - var isBinary = reIsBinary.test(value); - return (isBinary || reIsOctal.test(value)) - ? freeParseInt(value.slice(2), isBinary ? 2 : 8) - : (reIsBadHex.test(value) ? NAN : +value); +// v8 likes predictible objects +function Item(fun, array) { + this.fun = fun; + this.array = array; } +Item.prototype.run = function () { + this.fun.apply(null, this.array); +}; +process.title = 'browser'; +process.browser = true; +process.env = {}; +process.argv = []; +process.version = ''; // empty string to avoid regexp issues +process.versions = {}; + +function noop() {} + +process.on = noop; +process.addListener = noop; +process.once = noop; +process.off = noop; +process.removeListener = noop; +process.removeAllListeners = noop; +process.emit = noop; +process.prependListener = noop; +process.prependOnceListener = noop; + +process.listeners = function (name) { return [] } + +process.binding = function (name) { + throw new Error('process.binding is not supported'); +}; -module.exports = toNumber; +process.cwd = function () { return '/' }; +process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); +}; +process.umask = function() { return 0; }; -},{"./isFunction":14,"./isObject":15,"./isSymbol":17}],20:[function(require,module,exports){ +},{}],24:[function(require,module,exports){ (function (global){ 'use strict'; @@ -2202,7 +2568,7 @@ function never () { return false; } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],21:[function(require,module,exports){ +},{}],25:[function(require,module,exports){ (function (global){ 'use strict'; @@ -2224,7 +2590,7 @@ module.exports = getSelection; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./getSelectionNullOp":22,"./getSelectionRaw":23,"./getSelectionSynthetic":24,"./isHost":25}],22:[function(require,module,exports){ +},{"./getSelectionNullOp":26,"./getSelectionRaw":27,"./getSelectionSynthetic":28,"./isHost":29}],26:[function(require,module,exports){ 'use strict'; function noop () {} @@ -2238,7 +2604,7 @@ function getSelectionNullOp () { module.exports = getSelectionNullOp; -},{}],23:[function(require,module,exports){ +},{}],27:[function(require,module,exports){ (function (global){ 'use strict'; @@ -2250,7 +2616,7 @@ module.exports = getSelectionRaw; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],24:[function(require,module,exports){ +},{}],28:[function(require,module,exports){ (function (global){ 'use strict'; @@ -2505,7 +2871,7 @@ module.exports = getSelection; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./rangeToTextRange":26}],25:[function(require,module,exports){ +},{"./rangeToTextRange":30}],29:[function(require,module,exports){ 'use strict'; function isHostMethod (host, prop) { @@ -2536,7 +2902,7 @@ module.exports = { properties: many(isHostProperty) }; -},{}],26:[function(require,module,exports){ +},{}],30:[function(require,module,exports){ (function (global){ 'use strict'; @@ -2601,7 +2967,7 @@ module.exports = rangeToTextRange; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],27:[function(require,module,exports){ +},{}],31:[function(require,module,exports){ 'use strict'; var getSelection = require('./getSelection'); @@ -2612,7 +2978,7 @@ module.exports = { set: setSelection }; -},{"./getSelection":21,"./setSelection":28}],28:[function(require,module,exports){ +},{"./getSelection":25,"./setSelection":32}],32:[function(require,module,exports){ (function (global){ 'use strict'; @@ -2652,7 +3018,7 @@ module.exports = setSelection; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./getSelection":21,"./rangeToTextRange":26}],29:[function(require,module,exports){ +},{"./getSelection":25,"./rangeToTextRange":30}],33:[function(require,module,exports){ 'use strict'; var get = easyGet; @@ -2750,7 +3116,8 @@ function sell (el, p) { module.exports = sell; -},{}],30:[function(require,module,exports){ +},{}],34:[function(require,module,exports){ +(function (setImmediate){ var si = typeof setImmediate === 'function', tick; if (si) { tick = function (fn) { setImmediate(fn); }; @@ -2759,6 +3126,89 @@ if (si) { } module.exports = tick; -},{}]},{},[1])(1) +}).call(this,require("timers").setImmediate) + +},{"timers":35}],35:[function(require,module,exports){ +(function (setImmediate,clearImmediate){ +var nextTick = require('process/browser.js').nextTick; +var apply = Function.prototype.apply; +var slice = Array.prototype.slice; +var immediateIds = {}; +var nextImmediateId = 0; + +// DOM APIs, for completeness + +exports.setTimeout = function() { + return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout); +}; +exports.setInterval = function() { + return new Timeout(apply.call(setInterval, window, arguments), clearInterval); +}; +exports.clearTimeout = +exports.clearInterval = function(timeout) { timeout.close(); }; + +function Timeout(id, clearFn) { + this._id = id; + this._clearFn = clearFn; +} +Timeout.prototype.unref = Timeout.prototype.ref = function() {}; +Timeout.prototype.close = function() { + this._clearFn.call(window, this._id); +}; + +// Does not start the time, just sets up the members needed. +exports.enroll = function(item, msecs) { + clearTimeout(item._idleTimeoutId); + item._idleTimeout = msecs; +}; + +exports.unenroll = function(item) { + clearTimeout(item._idleTimeoutId); + item._idleTimeout = -1; +}; + +exports._unrefActive = exports.active = function(item) { + clearTimeout(item._idleTimeoutId); + + var msecs = item._idleTimeout; + if (msecs >= 0) { + item._idleTimeoutId = setTimeout(function onTimeout() { + if (item._onTimeout) + item._onTimeout(); + }, msecs); + } +}; + +// That's not how node.js implements it but the exposed api is the same. +exports.setImmediate = typeof setImmediate === "function" ? setImmediate : function(fn) { + var id = nextImmediateId++; + var args = arguments.length < 2 ? false : slice.call(arguments, 1); + + immediateIds[id] = true; + + nextTick(function onNextTick() { + if (immediateIds[id]) { + // fn.call() is faster so we optimize for the common use-case + // @see http://jsperf.com/call-apply-segu + if (args) { + fn.apply(null, args); + } else { + fn.call(null); + } + // Prevent ids from leaking + exports.clearImmediate(id); + } + }); + + return id; +}; + +exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : function(id) { + delete immediateIds[id]; +}; +}).call(this,require("timers").setImmediate,require("timers").clearImmediate) + +},{"process/browser.js":23,"timers":35}]},{},[1])(1) }); -//# sourceMappingURL=data:application/json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IGVsLnRleHRDb250ZW50KTtcbiAgICB9XG5cbiAgICBmdW5jdGlvbiB3aG9sZSAoKSB7XG4gICAgICBmb3IgKGxldCB3b3JkIG9mIHdvcmRzKSB7XG4gICAgICAgIGxldCB0ZW1wSW5kZXggPSBzdGFydEluZGV4O1xuICAgICAgICByZXRyeTogd2hpbGUgKHRlbXBJbmRleCAhPT0gLTEpIHtcbiAgICAgICAgICBsZXQgaW5pdCA9IHRydWU7XG4gICAgICAgICAgbGV0IHByZXZJbmRleCA9IHRlbXBJbmRleDtcbiAgICAgICAgICBmb3IgKGxldCBjaGFyIG9mIHdvcmQpIHtcbiAgICAgICAgICAgIGNvbnN0IGkgPSBjaGFycy5pbmRleE9mKGNoYXIsIHByZXZJbmRleCArIDEpO1xuICAgICAgICAgICAgY29uc3QgZmFpbCA9IGkgPT09IC0xIHx8ICghaW5pdCAmJiBwcmV2SW5kZXggKyAxICE9PSBpKTtcbiAgICAgICAgICAgIGlmIChpbml0KSB7XG4gICAgICAgICAgICAgIGluaXQgPSBmYWxzZTtcbiAgICAgICAgICAgICAgdGVtcEluZGV4ID0gaTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChmYWlsKSB7XG4gICAgICAgICAgICAgIGNvbnRpbnVlIHJldHJ5O1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcHJldkluZGV4ID0gaTtcbiAgICAgICAgICB9XG4gICAgICAgICAgZm9yIChsZXQgZWwgb2YgZWxlbXMuc3BsaWNlKHRlbXBJbmRleCwgMSArIHByZXZJbmRleCAtIHRlbXBJbmRleCkpIHtcbiAgICAgICAgICAgIG9uKGVsKTtcbiAgICAgICAgICB9XG4gICAgICAgICAgYmFsYW5jZSgpO1xuICAgICAgICAgIG5lZWRsZSA9IG5lZWRsZS5yZXBsYWNlKHdvcmQsICcnKTtcbiAgICAgICAgICBicmVhaztcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH1cblxuICAgIGZ1bmN0aW9uIGZ1enp5ICgpIH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wgZWwudGV4dENvbnRlbnQpO1xuICAgIH1cblxuICAgIGZ1bmN0aW9uIHdob2xlICgpIHtcbiAgICAgIGZvciAobGV0IHdvcmQgb2Ygd29yZHMpIHtcbiAgICAgICAgbGV0IHRlbXBJbmRleCA9IHN0YXJ0SW5kZXg7XG4gICAgICAgIHJldHJ5OiB3aGlsZSAodGVtcEluZGV4ICE9PSAtMSkge1xuICAgICAgICAgIGxldCBpbml0ID0gdHJ1ZTtcbiAgICAgICAgICBsZXQgcHJldkluZGV4ID0gdGVtcEluZGV4O1xuICAgICAgICAgIGZvciAobGV0IGNoYXIgb2Ygd29yZCkge1xuICAgICAgICAgICAgY29uc3QgaSA9IGNoYXJzLmluZGV4T2YoY2hhciwgcHJldkluZGV4ICsgMSk7XG4gICAgICAgICAgICBjb25zdCBmYWlsID0gaSA9PT0gLTEgfHwgKCFpbml0ICYmIHByZXZJbmRleCArIDEgIT09IGkpO1xuICAgICAgICAgICAgaWYgKGluaXQpIHtcbiAgICAgICAgICAgICAgaW5pdCA9IGZhbHNlO1xuICAgICAgICAgICAgICB0ZW1wSW5kZXggPSBpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKGZhaWwpIHtcbiAgICAgICAgICAgICAgY29udGludWUgcmV0cnk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBwcmV2SW5kZXggPSBpO1xuICAgICAgICAgIH1cbiAgICAgICAgICBmb3IgKGxldCBlbCBvZiBlbGVtcy5zcGxpY2UodGVtcEluZGV4LCAxICsgcHJldkluZGV4IC0gdGVtcEluZGV4KSkge1xuICAgICAgICAgICAgb24oZWwpO1xuICAgICAgICAgIH1cbiAgICAgICAgICBiYWxhbmNlKCk7XG4gICAgICAgICAgbmVlZGxlID0gbmVlZGxlLnJlcGxhY2Uod29yZCwgJycpO1xuICAgICAgICAgIGJyZWFrO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gZnV6enkgKCkge1xuICAgICAgZ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dKSB7XG4gICAgICAgICAgcmV0dXJuIGZpbmRMaXN0KGNhdFtuZXh0XSlbZmlyc3RdO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgICByZXR1cm4gZmluZExpc3QoY2F0ZWdvcmllc1tmaXJzdF0pW2ZpcnN0XTtcbiAgICB9XG4gIH1cblxuICBmdW5jdGlvbiBoaWRlICgpIHtcbiAgICBleWUuc2xlZXAoKTtcbiAgICBjb250YWluZXIuY2xhc3NOYW1lID0gY29udGFpbmVyLmNsYXNzTmFtZS5yZXBsYWNlKC8gc2V5LXNob3cvZywgJycpO1xuICAgIHVuc2VsZWN0KCk7XG4gICAgY3Jvc3N2ZW50LmZhYnJpY2F0ZShhdHRhY2htZW50LCAnaG9yc2V5LWhpZGUnKTtcbiAgICBpZiAoZWwudmFsdWUgPT09IGxhc3RQcmVmaXgpIHtcbiAgICAgIGVsLnZhbHVlID0gJyc7XG4gICAgfVxuICB9XG5cbiAgZnVuY3Rpb24ga2V5ZG93biAoZSkge1xuICAgIGNvbnN0IHNob3duID0gdmlzaWJsZSgpO1xuICAgIGNvbnN0IHdoaWNoID0gZS53aGljaCB8fCBlLmtleUNvZGU7XG4gICAgaWYgKHdoaWNoID09PSBLRVlfRE9XTikge1xuICAgICAgaWYgKGFueUlucHV0ICYmIG8uYXV0b1Nob3dPblVwRG93bikge1xuICAgICAgICBzaG93KCk7XG4gICAgICB9XG4gICAgICBpZiAoc2hvd24pIHtcbiAgICAgICAgbW92ZSgpO1xuICAgICAgICBzdG9wKGUpO1xuICAgICAgfVxuICAgIH0gZWxzZSBpZiAod2hpY2ggPT09IEtFWV9VUCkge1xuICAgICAgaWYgKGFueUlucHV0ICYmIG8uYXV0b1Nob3dPblVwRG93bikge1xuICAgICAgICBzaG93KCk7XG4gICAgICB9XG4gICAgICBpZiAoc2hvd24pIHtcbiAgICAgICAgbW92ZSh0cnVlKTtcbiAgICAgICAgc3RvcChlKTtcbiAgICAgIH1cbiAgICB9IGVsc2UgaWYgKHdoa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nRpYWw7XG4gICAgICAgIGNhdGVnb3J5ID0gY2F0ZWdvcnkubmV4dFNpYmxpbmc7XG4gICAgICB9XG4gICAgICByZXR1cm4gY291bnQ7XG4gICAgfVxuICAgIGZ1bmN0aW9uIHdhbGtDYXRlZ29yeSAodWwpIHtcbiAgICAgIGxldCBsaSA9IHVsLmZpcnN0Q2hpbGQ7XG4gICAgICBsZXQgY291bnQgPSAwO1xuICAgICAgd2hpbGUgKGxpKSB7XG4gICAgICAgIGlmIChjb3VudCA+PSBsaW1pdCkge1xuICAgICAgICAgIGNyb3NzdmVudC5mYWJyaWNhdGUobGksICdob3JzZXktaGlkZScpO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIGNyb3NzdmVudC5mYWJyaWNhdGUobGksICdob3JzZXktZmlsdGVyJyk7XG4gICAgICAgICAgaWYgKGxpLmNsYXNzTmFtZS5pbmRleE9mKCdzZXktaGlkZScpID09PSAtMSkge1xuICAgICAgICAgICAgY291bnQrKztcbiAgICAgICAgICAgIGlmIChoaWdobGlnaHRlcikge1xuICAgICAgICAgICAgICBoaWdobGlnaHQobGksIHZhbHVlKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgbGkgPSBsaS5uZXh0U2libGluZztcbiAgICAgIH1cbiAgICAgIHJldHVybiBjb3VudDtcbiAgICB9XG4gIH1cblxuICBmdW5jdGlvbiBkZWZlcnJlZEZpbHRlcmluZ05vRW50ZXIgKGUpIHtcbiAgICBjb25zdCB3aGljaCA9IGUud2hpY2ggfHwgZS5rZXlDb2RlO1xuICAgIGlmICh3aGljaCA9PT0gS0VZX0VOVEVSKSB7XG4gICAgICByZXR1cm47XG4gICAgfVxuICAgIGRlZmVycmVkRmlsdGVyaW5nKCk7XG4gIH1cblxuICBmdW5jdGlvbiBkZWZlcnJlZFNob3cgKGUpIHtcbiAgICBjb25zdCB3aGljaCA9IGUud2hpY2ggfHwgZS5rZXlDb2RlO1xuICAgIGlm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0aW9uKGlkKSB7XG4gIGRlbGV0ZSBpbW1lZGlhdGVJZHNbaWRdO1xufTsiXX0= diff --git a/dist/horsey.min.js b/dist/horsey.min.js index e6aeeff..f920eba 100644 --- a/dist/horsey.min.js +++ b/dist/horsey.min.js @@ -1 +1 @@ -!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.horsey=e()}}(function(){return function e(t,n,r){function o(a,u){if(!n[a]){if(!t[a]){var c="function"==typeof require&&require;if(!u&&c)return c(a,!0);if(i)return i(a,!0);var f=new Error("Cannot find module '"+a+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[a]={exports:{}};t[a][0].call(l.exports,function(e){var n=t[a][1][e];return o(n?n:e)},l,l.exports,e,t,n,r)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;anew Date;if(g)return void n(null,c.items.slice())}}var y={previousSuggestions:S.slice(),previousSelection:E,input:i,renderItem:h,renderCategory:p,limit:a};"function"==typeof r.source?r.source(y,o):o(null,r.source)}var r=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],o=r.setAppends,a=r.set,u=r.filter,c=r.source,f=r.cache,l=void 0===f?{}:f,s=r.predictNextSearch,h=r.renderItem,p=r.renderCategory,v=r.blankSearch,g=r.appendTo,y=r.anchor,m=r.debounce,b=r.cache!==!1;if(c){var w=r.getText,x=r.getValue,C="string"==typeof w?function(e){return e[w]}:"function"==typeof w?w:function(e){return e.toString()},T="string"==typeof x?function(e){return e[x]}:"function"==typeof x?x:function(e){return e},S=[],E=null,N=Number(r.limit)||1/0,O=i(e,{source:n,limit:N,getText:C,getValue:T,setAppends:o,predictNextSearch:s,renderItem:h,renderCategory:p,appendTo:g,anchor:y,noMatches:t,noMatchesText:r.noMatches,blankSearch:v,debounce:m,set:function(t){o!==!0&&(e.value=""),E=t,(a||O.defaultSetter)(C(t),t),O.emit("afterSet")},filter:u});return O}}function i(e){function t(e){tt(!0),qt=Jt.attachment=e,zt="INPUT"===qt.tagName||"TEXTAREA"===qt.tagName,Ft=zt||l(qt),tt()}function n(){Bt&&Bt.refresh()}function o(e){function t(t,n,o){Dt.counter===r&&(i(n,e),(t||o)&&(Gt=!1))}if("function"==typeof bt){C["default"].remove(qt,"focus",o);var n=d();if(n!==Dt.query){Gt=!1,Dt.query=n;var r=++Dt.counter;bt({query:n,limit:Lt},t)}}}function i(e,t){s(),Gt=!0,Jt.source=[],e.forEach(function(e){return e.list.forEach(function(t){return v(t,e)})}),t&&U(),Y()}function s(){for(W();Mt.lastChild;)Mt.removeChild(Mt.lastChild);Ut=Object.create(null),Gt=!1}function d(){return(zt?e.value:e.innerHTML).trim()}function h(e){function t(){var t=u("div","sey-category"),n=u("ul","sey-list");return At(t,e),t.appendChild(n),Mt.appendChild(t),{data:e,ul:n}}return e.id||(e.id="default"),Ut[e.id]||(Ut[e.id]=t()),Ut[e.id]}function v(t,n){function r(){q(f)}function o(){var n=gt(t);T(t),F(),qt.focus(),$t=pt.predictNextSearch&&pt.predictNextSearch({input:n,source:Jt.source.slice(),selection:t})||"",$t&&(e.value=$t,e.select(),U(),Y())}function i(){var e=d();E(e,t)?f.className=f.className.replace(/ sey-hide/g,""):C["default"].fabricate(f,"horsey-hide")}function a(){D(f)||(f.className+=" sey-hide",Pt===f&&W())}var c=h(n),f=u("li","sey-item");return Ot(f,t),Tt&&y(f),C["default"].add(f,"mouseenter",r),C["default"].add(f,"click",o),C["default"].add(f,"horsey-filter",i),C["default"].add(f,"horsey-hide",a),c.ul.appendChild(f),Jt.source.push(t),f}function y(e){x(e).forEach(function(e){function t(e){var t=j.createElement("span");return t.className="sey-char",t.textContent=t.innerText=e,t}var n=e.parentElement,r=e.textContent||e.nodeValue||"";if(0!==r.length){var o=!0,i=!1,a=void 0;try{for(var u,c=r[Symbol.iterator]();!(o=(u=c.next()).done);o=!0){var f=u.value;n.insertBefore(t(f),e)}}catch(l){i=!0,a=l}finally{try{!o&&c["return"]&&c["return"]()}finally{if(i)throw a}}n.removeChild(e)}})}function b(e,t){function n(){d=s.map(function(e){return e.innerText||e.textContent})}function o(){var e=!0,r=!1,o=void 0;try{for(var i,a=l[Symbol.iterator]();!(e=(i=a.next()).done);e=!0){var c=i.value,f=h;e:for(;-1!==f;){var p=!0,v=f,g=!0,y=!1,m=void 0;try{for(var b,w=c[Symbol.iterator]();!(g=(b=w.next()).done);g=!0){var x=b.value,C=d.indexOf(x,v+1),T=-1===C||!p&&v+1!==C;if(p&&(p=!1,f=C),T)continue e;v=C}}catch(S){y=!0,m=S}finally{try{!g&&w["return"]&&w["return"]()}finally{if(y)throw m}}var E=!0,N=!1,O=void 0;try{for(var R,A=s.splice(f,1+v-f)[Symbol.iterator]();!(E=(R=A.next()).done);E=!0){var k=R.value;u(k)}}catch(S){N=!0,O=S}finally{try{!E&&A["return"]&&A["return"]()}finally{if(N)throw O}}n(),t=t.replace(c,"");break}}}catch(S){r=!0,o=S}finally{try{!e&&a["return"]&&a["return"]()}finally{if(r)throw o}}}function i(){var e=!0,n=!1,r=void 0;try{for(var o,i=t[Symbol.iterator]();!(e=(o=i.next()).done);e=!0)for(var a=o.value;s.length;){var f=s.shift();if((f.innerText||f.textContent)===a){u(f);break}c(f)}}catch(l){n=!0,r=l}finally{try{!e&&i["return"]&&i["return"]()}finally{if(n)throw r}}}function a(){for(;s.length;)c(s.shift())}function u(e){e.classList.add("sey-char-highlight")}function c(e){e.classList.remove("sey-char-highlight")}var f=/[\s,._\[\]{}()-]/g,l=t.split(f).filter(function(e){return e.length}),s=[].concat(r(e.querySelectorAll(".sey-char"))),d=void 0,h=0;n(),Et&&o(),i(),a()}function x(e){for(var t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null,!1),r=void 0;r=n.nextNode();)t.push(r);return t}function T(e){return pt.anchor?(I()?Jt.appendText:Jt.appendHTML)(yt(e)):void jt(e)}function E(e,t){if(pt.anchor){var n=(I()?Jt.filterAnchoredText:Jt.filterAnchoredHTML)(e,t);return n?_t(n.input,n.suggestion):!1}return _t(e,t)}function I(){return a(qt)}function H(){return-1!==It.className.indexOf("sey-show")}function D(e){return-1!==e.className.indexOf("sey-hide")}function U(){Bt.refresh(),H()||(It.className+=" sey-show",C["default"].fabricate(qt,"horsey-show"))}function P(e){var t=1===e.which&&!e.metaKey&&!e.ctrlKey;t!==!1&&B()}function B(){H()?F():U()}function q(e){W(),e&&(Pt=e,Pt.className+=" sey-selected")}function W(){Pt&&(Pt.className=Pt.className.replace(/ sey-selected/g,""),Pt=null)}function z(e,t){function n(e){for(;e;){if(g["default"].matchesSelector(e.parentElement,".sey-category"))return e.parentElement;e=e.parentElement}return null}function r(){if(Pt){if(Pt[u])return Pt[u];if(i[u]&&dt(i[u])[a])return dt(i[u])[a]}return dt(Mt[a])[a]}var o=Jt.source.length;if(0!==o){if(t>o)return void W();var i=n(Pt)||Mt.firstChild,a=e?"lastChild":"firstChild",u=e?"previousSibling":"nextSibling",c=r();q(c),D(c)&&z(e,t?t+1:1)}}function F(){Bt.sleep(),It.className=It.className.replace(/ sey-show/g,""),W(),C["default"].fabricate(qt,"horsey-hide"),e.value===$t&&(e.value="")}function X(e){var t=H(),n=e.which||e.keyCode;n===L?(Ft&&pt.autoShowOnUpDown&&U(),t&&(z(),V(e))):n===k?(Ft&&pt.autoShowOnUpDown&&U(),t&&(z(!0),V(e))):n===O?Ft&&pt.autoShowOnUpDown&&U():t&&(n===R?(Pt?C["default"].fabricate(Pt,"click"):F(),V(e)):n===A&&(F(),V(e)))}function V(e){e.stopPropagation(),e.preventDefault()}function $(){Wt&&Wt.classList.remove("sey-hide")}function K(){Wt&&Wt.classList.add("sey-hide")}function Y(){function e(){for(var e=Mt.firstChild,n=0;e;){var r=dt(e),o=t(r);0===o?e.classList.add("sey-hide"):e.classList.remove("sey-hide"),n+=o,e=e.nextSibling}return n}function t(e){for(var t=e.firstChild,r=0;t;)r>=Lt?C["default"].fabricate(t,"horsey-hide"):(C["default"].fabricate(t,"horsey-filter"),-1===t.className.indexOf("sey-hide")&&(r++,Tt&&b(t,n))),t=t.nextSibling;return r}if(H()){Yt(!0),C["default"].fabricate(qt,"horsey-filter");var n=d();if(!pt.blankSearch&&!n)return void F();var r=wt({query:n}),o=e();0===o&&r&&Gt?$():K(),Pt||z(),Pt||r||F()}}function G(e){var t=e.which||e.keyCode;t!==R&&Ht()}function J(e){var t=e.which||e.keyCode;t!==R&&t!==_&&setTimeout(U,0)}function Q(e){var t=e.target;if(t===qt)return!0;for(;t;){if(t===It||t===qt)return!0;t=t.parentNode}}function Z(e){var t=e.which||e.keyCode;t===_&&F()}function et(e){Q(e)||F()}function tt(e){var t=e?"remove":"add";Bt&&(Bt.destroy(),Bt=null),e||(Bt=w["default"](It,qt,{caret:Ft&&"INPUT"!==qt.tagName,context:pt.appendTo}),H()||Bt.sleep()),e||Ft&&j.activeElement!==qt?C["default"][t](qt,"focus",o):o(),Ft?(C["default"][t](qt,"keypress",J),C["default"][t](qt,"keypress",Ht),C["default"][t](qt,"keydown",G),C["default"][t](qt,"paste",Ht),C["default"][t](qt,"keydown",X),pt.autoHideOnBlur&&C["default"][t](qt,"keydown",Z)):(C["default"][t](qt,"click",P),C["default"][t](M,"keydown",X)),pt.autoHideOnClick&&C["default"][t](j,"click",et),mt&&C["default"][t](mt,"submit",F)}function nt(){tt(!0),vt.contains(It)&&vt.removeChild(It)}function rt(t){zt?kt===!0?e.value+=" "+t:e.value=t:kt===!0?e.innerHTML+=" "+t:e.innerHTML=t}function ot(e,t){f(e,gt(t))}function it(e,t){if("default"!==t.id){var n=u("div","sey-category-id");e.appendChild(n),f(n,t.id)}}function at(e,t){var n=e.toLowerCase(),r=gt(t)||"";if(S["default"](n,r.toLowerCase()))return!0;var o=yt(t)||"";return"string"!=typeof o?!1:S["default"](n,o.toLowerCase())}function ut(e,t){for(var n="",r=!1,o=t.start;r===!1&&o>=0;)n=e.substr(o-1,t.start-o+1),r=Xt.test(n),o--;return{text:r?n:null,start:o}}function ct(t,n){var r=p["default"](e),o=ut(t,r).text;return o?{input:o,suggestion:n}:void 0}function ft(t){var n=e.value,r=p["default"](e),o=ut(n,r),i=n.substr(0,o.start),a=n.substr(o.start+o.text.length+(r.end-r.start)),u=i+t+" ";e.value=u+a,p["default"](e,{start:u.length,end:u.length})}function lt(){throw new Error("Anchoring in editable elements is disabled by default.")}function st(){throw new Error("Anchoring in editable elements is disabled by default.")}function dt(e){return g["default"](".sey-list",e)[0]}var ht=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],pt=ht,vt=pt.appendTo||j.body,gt=pt.getText,yt=pt.getValue,mt=pt.form,bt=pt.source,wt=pt.noMatches,xt=pt.noMatchesText,Ct=pt.highlighter,Tt=void 0===Ct?!0:Ct,St=pt.highlightCompleteWords,Et=void 0===St?!0:St,Nt=pt.renderItem,Ot=void 0===Nt?ot:Nt,Rt=pt.renderCategory,At=void 0===Rt?it:Rt,kt=pt.setAppends,Lt="number"==typeof pt.limit?pt.limit:1/0,_t=pt.filter||at,jt=pt.set||rt,Mt=u("div","sey-categories"),It=u("div","sey-container"),Ht=c(Y),Dt={counter:0,query:null},Ut=Object.create(null),Pt=null,Bt=void 0,qt=e,Wt=void 0,zt=void 0,Ft=void 0,Xt=void 0,Vt=void 0,$t="",Kt=pt.debounce||300,Yt=N["default"](o,Kt);void 0===pt.autoHideOnBlur&&(pt.autoHideOnBlur=!0),void 0===pt.autoHideOnClick&&(pt.autoHideOnClick=!0),void 0===pt.autoShowOnUpDown&&(pt.autoShowOnUpDown="INPUT"===e.tagName),pt.anchor&&(Xt=new RegExp("^"+pt.anchor),Vt=new RegExp(pt.anchor+"$"));var Gt=!1,Jt=m["default"]({anchor:pt.anchor,clear:s,show:U,hide:F,toggle:B,destroy:nt,refreshPosition:n,appendText:ft,appendHTML:st,filterAnchoredText:ct,filterAnchoredHTML:lt,defaultAppendText:ft,defaultFilter:at,defaultItemRenderer:ot,defaultCategoryRenderer:it,defaultSetter:rt,retarget:t,attachment:qt,source:[]});return t(e),It.appendChild(Mt),wt&&xt&&(Wt=u("div","sey-empty sey-hide"),f(Wt,xt),It.appendChild(Wt)),vt.appendChild(It),e.setAttribute("autocomplete","off"),Array.isArray(bt)&&i(bt,!1),Jt}function a(e){return"INPUT"===e.tagName||"TEXTAREA"===e.tagName}function u(e,t){var n=j.createElement(e);return n.className=t,n}function c(e){return function(){setTimeout(e,0)}}function f(e,t){e.innerText=e.textContent=t}function l(e){var t=e.getAttribute("contentEditable");return"false"===t?!1:"true"===t?!0:e.parentElement?l(e.parentElement):!1}var s=e("hash-sum"),d=n(s),h=e("sell"),p=n(h),v=e("sektor"),g=n(v),y=e("contra/emitter"),m=n(y),b=e("bullseye"),w=n(b),x=e("crossvent"),C=n(x),T=e("fuzzysearch"),S=n(T),E=e("lodash/debounce"),N=n(E),O=8,R=13,A=27,k=38,L=40,_=9,j=document,M=j.documentElement;t.exports=o},{bullseye:3,"contra/emitter":7,crossvent:8,fuzzysearch:11,"hash-sum":12,"lodash/debounce":13,sektor:20,sell:29}],2:[function(e,t){t.exports=function(e,t){return Array.prototype.slice.call(e,t)}},{}],3:[function(e,t){"use strict";function n(e,t,n){function a(){g.sleeping=!0}function u(){return c()}function c(e){var n=t.getBoundingClientRect(),r=document.body.scrollTop||document.documentElement.scrollTop;return y?(e=y.read(),{x:(e.absolute?0:n.left)+e.x,y:(e.absolute?0:n.top)+r+e.y+20}):{x:n.left,y:n.top+r}}function f(e){l(e)}function l(n){if(p)throw new Error("Bullseye can't refresh after being destroyed. Create another instance instead.");if(y&&!n)return g.sleeping=!1,void y.refresh();var r=c(n);y||t===e||(r.y+=t.offsetHeight);var o=d.context;e.style.left=r.x+"px",e.style.top=(o?o.offsetHeight:r.y)+"px"}function s(){y&&y.destroy(),r.remove(window,"resize",v),p=!0}var d=n,h=t&&t.tagName;h||2!==arguments.length||(d=t),h||(t=e),d||(d={});var p=!1,v=o(l,30),g={update:d.autoupdateToCaret!==!1&&f},y=d.caret&&i(t,g);return l(),d.tracking!==!1&&r.add(window,"resize",v),{read:u,refresh:l,destroy:s,sleep:a}}var r=e("crossvent"),o=e("./throttle"),i=e("./tailormade");t.exports=n},{"./tailormade":4,"./throttle":5,crossvent:8}],4:[function(e,t){(function(n){"use strict";function r(e,t){function n(){}function r(){return(x?h:p)()}function a(){return T.sleeping?void 0:(T.update||n)(r())}function h(){var t=o(e),n=y(),r=v(n,t.start);return s.body.removeChild(n.mirror),r}function p(){var e=c();if(e.rangeCount){var t=e.getRangeAt(0),n="P"===t.startContainer.nodeName&&0===t.startOffset;if(n)return{x:t.startContainer.offsetLeft,y:t.startContainer.offsetTop,absolute:!0};if(t.getClientRects){var r=t.getClientRects();if(r.length>0)return{x:r[0].left,y:r[0].top,absolute:!0}}}return{x:0,y:0}}function v(t,n){var r=s.createElement("span"),o=t.mirror,i=t.computed;return m(o,g(e).substring(0,n)),"INPUT"===e.tagName&&(o.textContent=o.textContent.replace(/\s/g," ")),m(r,g(e).substring(n)||"."),o.appendChild(r),{x:r.offsetLeft+parseInt(i.borderLeftWidth),y:r.offsetTop+parseInt(i.borderTopWidth)}}function g(e){return x?e.value:e.innerHTML}function y(){function t(e){o[e]=n[e]}var n=l.getComputedStyle?getComputedStyle(e):e.currentStyle,r=s.createElement("div"),o=r.style;return s.body.appendChild(r),"INPUT"!==e.tagName&&(o.wordWrap="break-word"),o.whiteSpace="pre-wrap",o.position="absolute",o.visibility="hidden",f.forEach(t),d?(o.width=parseInt(n.width)-2+"px",e.scrollHeight>parseInt(n.height)&&(o.overflowY="scroll")):o.overflow="hidden",{mirror:r,computed:n}}function m(e,t){x?e.textContent=t:e.innerHTML=t}function b(t){var n=t?"remove":"add";i[n](e,"keydown",C),i[n](e,"keyup",C),i[n](e,"input",C),i[n](e,"paste",C),i[n](e,"change",C)}function w(){b(!0)}var x="INPUT"===e.tagName||"TEXTAREA"===e.tagName,C=u(a,30),T=t||{};return b(),{read:r,refresh:C,destroy:w}}var o=e("sell"),i=e("crossvent"),a=e("seleccion"),u=e("./throttle"),c=a.get,f=["direction","boxSizing","width","height","overflowX","overflowY","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","paddingTop","paddingRight","paddingBottom","paddingLeft","fontStyle","fontVariant","fontWeight","fontStretch","fontSize","fontSizeAdjust","lineHeight","fontFamily","textAlign","textTransform","textIndent","textDecoration","letterSpacing","wordSpacing"],l=n,s=document,d=null!==l.mozInnerScreenX&&void 0!==l.mozInnerScreenX;t.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./throttle":5,crossvent:8,seleccion:27,sell:29}],5:[function(e,t){"use strict";function n(e,t){var n,r=-1/0;return function(){function o(){clearTimeout(n),n=null;var i=r+t,a=Date.now();a>i?(r=a,e()):n=setTimeout(o,i-a)}n||o()}}t.exports=n},{}],6:[function(e,t){"use strict";var n=e("ticky");t.exports=function(e,t,r){e&&n(function(){e.apply(r||null,t||[])})}},{ticky:30}],7:[function(e,t){"use strict";var n=e("atoa"),r=e("./debounce");t.exports=function(e,t){var o=t||{},i={};return void 0===e&&(e={}),e.on=function(t,n){return i[t]?i[t].push(n):i[t]=[n],e},e.once=function(t,n){return n._once=!0,e.on(t,n),e},e.off=function(t,n){var r=arguments.length;if(1===r)delete i[t];else if(0===r)i={};else{var o=i[t];if(!o)return e;o.splice(o.indexOf(n),1)}return e},e.emit=function(){var t=n(arguments);return e.emitterSnapshot(t.shift()).apply(this,t)},e.emitterSnapshot=function(t){var a=(i[t]||[]).slice(0);return function(){var i=n(arguments),u=this||e;if("error"===t&&o["throws"]!==!1&&!a.length)throw 1===i.length?i[0]:i;return a.forEach(function(n){o.async?r(n,i,u):n.apply(u,i),n._once&&e.off(t,n)}),e}},e}},{"./debounce":6,atoa:2}],8:[function(e,t){(function(n){"use strict";function r(e,t,n,r){return e.addEventListener(t,n,r)}function o(e,t,n){return e.attachEvent("on"+t,f(e,t,n))}function i(e,t,n,r){return e.removeEventListener(t,n,r)}function a(e,t,n){var r=l(e,t,n);return r?e.detachEvent("on"+t,r):void 0}function u(e,t,n){function r(){var e;return p.createEvent?(e=p.createEvent("Event"),e.initEvent(t,!0,!0)):p.createEventObject&&(e=p.createEventObject()),e}function o(){return new d(t,{detail:n})}var i=-1===h.indexOf(t)?o():r();e.dispatchEvent?e.dispatchEvent(i):e.fireEvent("on"+t,i)}function c(e,t,r){return function(t){var o=t||n.event;o.target=o.target||o.srcElement,o.preventDefault=o.preventDefault||function(){o.returnValue=!1},o.stopPropagation=o.stopPropagation||function(){o.cancelBubble=!0},o.which=o.which||o.keyCode,r.call(e,o)}}function f(e,t,n){var r=l(e,t,n)||c(e,t,n);return y.push({wrapper:r,element:e,type:t,fn:n}),r}function l(e,t,n){var r=s(e,t,n);if(r){var o=y[r].wrapper;return y.splice(r,1),o}}function s(e,t,n){var r,o;for(r=0;rn)return!1;if(r===n)return e===t;e:for(var o=0,i=0;r>o;o++){for(var a=e.charCodeAt(o);n>i;)if(t.charCodeAt(i++)===a)continue e;return!1}return!0}t.exports=n},{}],12:[function(e,t){"use strict";function n(e,t){for(;e.lengthn;n++)r=t.charCodeAt(n),e=(e<<5)-e+r,e|=0;return 0>e?-2*e:e}function o(e,t,n){function r(e,r){return i(e,t[r],r,n)}return Object.keys(t).sort().reduce(r,e)}function i(e,t,n,i){var u=r(r(r(e,n),a(t)),typeof t);return null===t?r(u,"null"):void 0===t?r(u,"undefined"):"object"==typeof t?-1!==i.indexOf(t)?r(u,"[Circular]"+n):(i.push(t),o(u,t,i)):r(u,t.toString())}function a(e){return Object.prototype.toString.call(e)}function u(e){return n(i(0,e,"",[]).toString(16),8)}t.exports=u},{}],13:[function(e,t){function n(e,t,n){function f(t){var n=m,r=b;return m=b=void 0,S=t,x=e.apply(r,n)}function l(e){return S=e,C=setTimeout(h,t),E?f(e):x}function s(e){var n=e-T,r=e-S,o=t-n;return N?c(o,w-r):o}function d(e){var n=e-T,r=e-S;return void 0===T||n>=t||0>n||N&&r>=w}function h(){var e=o();return d(e)?p(e):void(C=setTimeout(h,s(e)))}function p(e){return C=void 0,O&&m?f(e):(m=b=void 0,x)}function v(){S=0,m=T=b=C=void 0}function g(){return void 0===C?x:p(o())}function y(){var e=o(),n=d(e);if(m=arguments,b=this,T=e,n){if(void 0===C)return l(T);if(N)return C=setTimeout(h,t),f(T)}return void 0===C&&(C=setTimeout(h,t)),x}var m,b,w,x,C,T,S=0,E=!1,N=!1,O=!0;if("function"!=typeof e)throw new TypeError(a);return t=i(t)||0,r(n)&&(E=!!n.leading,N="maxWait"in n,w=N?u(i(n.maxWait)||0,t):w,O="trailing"in n?!!n.trailing:O),y.cancel=v,y.flush=g,y}var r=e("./isObject"),o=e("./now"),i=e("./toNumber"),a="Expected a function",u=Math.max,c=Math.min;t.exports=n},{"./isObject":15,"./now":18,"./toNumber":19}],14:[function(e,t){function n(e){var t=r(e)?u.call(e):"";return t==o||t==i}var r=e("./isObject"),o="[object Function]",i="[object GeneratorFunction]",a=Object.prototype,u=a.toString;t.exports=n},{"./isObject":15}],15:[function(e,t){function n(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}t.exports=n},{}],16:[function(e,t){function n(e){return!!e&&"object"==typeof e}t.exports=n},{}],17:[function(e,t){function n(e){return"symbol"==typeof e||r(e)&&a.call(e)==o}var r=e("./isObjectLike"),o="[object Symbol]",i=Object.prototype,a=i.toString;t.exports=n},{"./isObjectLike":16}],18:[function(e,t){function n(){return Date.now()}t.exports=n},{}],19:[function(e,t){function n(e){if("number"==typeof e)return e;if(i(e))return a;if(o(e)){var t=r(e.valueOf)?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(u,"");var n=f.test(e);return n||l.test(e)?s(e.slice(2),n?2:8):c.test(e)?a:+e}var r=e("./isFunction"),o=e("./isObject"),i=e("./isSymbol"),a=0/0,u=/^\s+|\s+$/g,c=/^[-+]0x[0-9a-f]+$/i,f=/^0b[01]+$/i,l=/^0o[0-7]+$/i,s=parseInt;t.exports=n},{"./isFunction":14,"./isObject":15,"./isSymbol":17}],20:[function(e,t){(function(e){"use strict";function n(e,t){var n,r,o,i,a,l=t!==f;l&&(n=t.getAttribute("id"),r=n||u,o="#"+r+" ",i=o+e.replace(/,/g,","+o),a=c.test(e)&&t.parentNode,n||t.setAttribute("id",r));try{return(a||t).querySelectorAll(i||e)}catch(s){return[]}finally{null===n&&t.removeAttribute("id")}}function r(e,t,r,o){var a,u=t||f,c=r||[],l=0;if("string"!=typeof e)return c;if(1!==u.nodeType&&9!==u.nodeType)return[];if(o)for(;a=o[l++];)i(a,e)&&c.push(a);else c.push.apply(c,n(e,u));return c}function o(e,t){return r(e,null,null,t)}function i(e,t){return s.call(e,t)}function a(){return!1}var u="sektor-"+Date.now(),c=/[+~]/,f=e.document,l=f.documentElement||{},s=l.matches||l.webkitMatchesSelector||l.mozMatchesSelector||l.oMatchesSelector||l.msMatchesSelector||a;t.exports=r,r.matches=o,r.matchesSelector=i}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],21:[function(e,t){(function(n){"use strict";var r,o=n.document,i=e("./getSelectionRaw"),a=e("./getSelectionNullOp"),u=e("./getSelectionSynthetic"),c=e("./isHost");r=c.method(n,"getSelection")?i:"object"==typeof o.selection&&o.selection?u:a,t.exports=r}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./getSelectionNullOp":22,"./getSelectionRaw":23,"./getSelectionSynthetic":24,"./isHost":25}],22:[function(e,t){"use strict";function n(){}function r(){return{removeAllRanges:n,addRange:n}}t.exports=r},{}],23:[function(e,t){(function(e){"use strict";function n(){return e.getSelection()}t.exports=n}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],24:[function(e,t){(function(n){"use strict";function r(e){var t=this,n=e.createRange();this._selection=e,this._ranges=[],"Control"===e.type?d(t):l(n)?s(t,n):u(t)}function o(e,t){for(var n,r=b.createControlRange(),o=0,i=t.length;i>o;++o){n=f(t[o]);try{r.add(n)}catch(a){throw new Error("setRanges(): Element could not be added to control selection")}}r.select(),d(e)}function i(e,t){var n=e.getAllRanges();e.removeAllRanges();for(var r=0,o=n.length;o>r;++r)p(t,n[r])||e.addRange(n[r]);e.rangeCount||u(e)}function a(e,t){var n="start",r="end";e.anchorNode=t[n+"Container"],e.anchorOffset=t[n+"Offset"],e.focusNode=t[r+"Container"],e.focusOffset=t[r+"Offset"]}function u(e){e.anchorNode=e.focusNode=null,e.anchorOffset=e.focusOffset=0,e.rangeCount=0,e.isCollapsed=!0,e._ranges.length=0}function c(e){if(!e.length||1!==e[0].nodeType)return!1;for(var t=1,n=e.length;n>t;++t)if(!v(e[0],e[t]))return!1;return!0}function f(e){var t=e.getNodes();if(!c(t))throw new Error("getSingleElementFromRange(): range did not consist of a single element");return t[0]}function l(e){return e&&void 0!==e.text}function s(e,t){e._ranges=[t],a(e,t,!1),e.rangeCount=1,e.isCollapsed=t.collapsed}function d(e){if(e._ranges.length=0,"None"===e._selection.type)u(e);else{var t=e._selection.createRange();if(l(t))s(e,t);else{e.rangeCount=t.length;for(var n,r=0;ri;++i)o.add(n.item(i));try{o.add(r)}catch(u){throw new Error("addRange(): Element could not be added to control selection")}o.select(),d(e)}function p(e,t){return e.startContainer===t.startContainer&&e.startOffset===t.startOffset&&e.endContainer===t.endContainer&&e.endOffset===t.endOffset}function v(e,t){for(var n=t;n.parentNode;){if(n.parentNode===e)return!0;n=n.parentNode}return!1}function g(){return new r(n.document.selection)}var y=e("./rangeToTextRange"),m=n.document,b=m.body,w=r.prototype;w.removeAllRanges=function(){var e;try{this._selection.empty(),"None"!==this._selection.type&&(e=b.createTextRange(),e.select(),this._selection.empty())}catch(t){}u(this)},w.addRange=function(e){"Control"===this._selection.type?h(this,e):(y(e).select(),this._ranges[0]=e,this.rangeCount=1,this.isCollapsed=this._ranges[0].collapsed,a(this,e,!1))},w.setRanges=function(e){this.removeAllRanges();var t=e.length;t>1?o(this,e):t&&this.addRange(e[0])},w.getRangeAt=function(e){if(0>e||e>=this.rangeCount)throw new Error("getRangeAt(): index out of bounds");return this._ranges[e].cloneRange()},w.removeRange=function(e){if("Control"!==this._selection.type)return void i(this,e);for(var t,n=this._selection.createRange(),r=f(e),o=b.createControlRange(),a=!1,u=0,c=n.length;c>u;++u)t=n.item(u),t!==r||a?o.add(n.item(u)):a=!0;o.select(),d(this)},w.eachRange=function(e,t){var n=0,r=this._ranges.length;for(n=0;r>n;++n)if(e(this.getRangeAt(n)))return t},w.getAllRanges=function(){var e=[];return this.eachRange(function(t){e.push(t)}),e},w.setSingleRange=function(e){this.removeAllRanges(),this.addRange(e)},t.exports=g}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./rangeToTextRange":26}],25:[function(e,t){"use strict";function n(e,t){var n=typeof e[t];return"function"===n||!("object"!==n||!e[t])||"unknown"===n}function r(e,t){return"undefined"!=typeof e[t]}function o(e){return function(t,n){for(var r=n.length;r--;)if(!e(t,n[r]))return!1;return!0}}t.exports={method:n,methods:o(n),property:r,properties:o(r)}},{}],26:[function(e,t){(function(e){"use strict";function n(e){if(e.collapsed)return o({node:e.startContainer,offset:e.startOffset},!0);var t=o({node:e.startContainer,offset:e.startOffset},!0),n=o({node:e.endContainer,offset:e.endOffset},!1),r=a.createTextRange();return r.setEndPoint("StartToStart",t),r.setEndPoint("EndToEnd",n),r}function r(e){var t=e.nodeType;return 3===t||4===t||8===t}function o(e,t){var n,o,u,c,f=e.offset,l=a.createTextRange(),s=r(e.node);return s?(n=e.node,o=n.parentNode):(c=e.node.childNodes,n=f1&&void 0!==arguments[1]?arguments[1]:{},n=t,r=n.appendTo||p.body,s=n.getText,v=n.getValue,x=n.form,T=n.source,E=n.noMatches,C=n.noMatchesText,S=n.highlighter,N=void 0===S||S,O=n.highlightCompleteWords,R=void 0===O||O,A=n.renderItem,k=void 0===A?He:A,_=n.renderCategory,L=void 0===_?De:_,I=n.setAppends,j="number"==typeof n.limit?n.limit:1/0,M=n.filter||Be,H=n.set||Me,D=m("div","sey-categories"),B=m("div","sey-container"),P=y(Oe),U={counter:0,query:null},q=Object.create(null),W=null,z=void 0,F=e,X=void 0,V=void 0,$=void 0,K=void 0,Y="",G=n.debounce||300,J=(0,l.default)(ne,G);void 0===n.autoHideOnBlur&&(n.autoHideOnBlur=!0),void 0===n.autoHideOnClick&&(n.autoHideOnClick=!0),void 0===n.autoShowOnUpDown&&(n.autoShowOnUpDown="INPUT"===e.tagName),n.anchor&&(K=new RegExp("^"+n.anchor),new RegExp(n.anchor+"$"));var Q=!1,Z=(0,a.default)({anchor:n.anchor,clear:oe,show:ge,hide:Te,toggle:ye,destroy:je,refreshPosition:te,appendText:qe,appendHTML:ze,filterAnchoredText:Ue,filterAnchoredHTML:We,defaultAppendText:qe,defaultFilter:Be,defaultItemRenderer:He,defaultCategoryRenderer:De,defaultSetter:Me,retarget:ee,attachment:F,source:[]});return ee(e),B.appendChild(D),E&&C&&(b(X=m("div","sey-empty sey-hide"),C),B.appendChild(X)),r.appendChild(B),e.setAttribute("autocomplete","off"),Array.isArray(T)&&re(T,!1),Z;function ee(e){Ie(!0),F=Z.attachment=e,V="INPUT"===F.tagName||"TEXTAREA"===F.tagName,$=V||w(F),Ie()}function te(){z&&z.refresh()}function ne(e){if("function"==typeof T){c.default.remove(F,"focus",ne);var t=ie();if(t!==U.query){Q=!1,U.query=t;var n=++U.counter;T({query:t,limit:j},(function(t,r,o){if(U.counter!==n)return;re(r,e),(t||o)&&(Q=!1)}))}}}function re(e,t){oe(),Q=!0,Z.source=[],e.forEach((function(e){return e.list.forEach((function(t){return ue(t,e)}))})),t&&ge(),Oe()}function oe(){for(we();D.lastChild;)D.removeChild(D.lastChild);q=Object.create(null),Q=!1}function ie(){return(V?e.value:e.innerHTML).trim()}function ae(e){var t,n;return e.id||(e.id="default"),q[e.id]||(q[e.id]=(t=m("div","sey-category"),n=m("ul","sey-list"),L(t,e),t.appendChild(n),D.appendChild(t),{data:e,ul:n})),q[e.id]}function ue(t,r){var o=ae(r),i=m("li","sey-item");return k(i,t),N&&ce(i),c.default.add(i,"mouseenter",(function(){be(i)})),c.default.add(i,"click",(function(){var r=s(t);se(t),Te(),F.focus(),(Y=n.predictNextSearch&&n.predictNextSearch({input:r,source:Z.source.slice(),selection:t})||"")&&(e.value=Y,e.select(),ge(),Oe())})),c.default.add(i,"horsey-filter",(function(){de(ie(),t)?i.className=i.className.replace(/ sey-hide/g,""):c.default.fabricate(i,"horsey-hide")})),c.default.add(i,"horsey-hide",(function(){ve(i)||(i.className+=" sey-hide",W===i&&we())})),o.ul.appendChild(i),Z.source.push(t),i}function ce(e){le(e).forEach((function(e){var t=e.parentElement,n=e.textContent||e.nodeValue||"";if(0!==n.length){var r=!0,o=!1,i=void 0;try{for(var a,u=n[Symbol.iterator]();!(r=(a=u.next()).done);r=!0){var c=a.value;t.insertBefore(f(c),e)}}catch(e){o=!0,i=e}finally{try{!r&&u.return&&u.return()}finally{if(o)throw i}}t.removeChild(e)}function f(e){var t=p.createElement("span");return t.className="sey-char",t.textContent=t.innerText=e,t}}))}function fe(e,t){var n=t.split(/[\s,._\[\]{}()-]/g).filter((function(e){return e.length})),r=[].concat(d(e.querySelectorAll(".sey-char"))),o=void 0;function i(){o=r.map((function(e){return e.innerText||e.textContent}))}function a(e){e.classList.add("sey-char-highlight")}function u(e){e.classList.remove("sey-char-highlight")}i(),R&&function(){var e=!0,u=!1,c=void 0;try{for(var f,l=n[Symbol.iterator]();!(e=(f=l.next()).done);e=!0){var s=f.value,d=0;e:for(;-1!==d;){var p=!0,h=d,v=!0,g=!1,m=void 0;try{for(var y,b=s[Symbol.iterator]();!(v=(y=b.next()).done);v=!0){var w=y.value,x=o.indexOf(w,h+1),T=-1===x||!p&&h+1!==x;if(p&&(p=!1,d=x),T)continue e;h=x}}catch(e){g=!0,m=e}finally{try{!v&&b.return&&b.return()}finally{if(g)throw m}}var E=!0,C=!1,S=void 0;try{for(var N,O=r.splice(d,1+h-d)[Symbol.iterator]();!(E=(N=O.next()).done);E=!0){a(N.value)}}catch(e){C=!0,S=e}finally{try{!E&&O.return&&O.return()}finally{if(C)throw S}}i(),t=t.replace(s,"");break}}}catch(e){u=!0,c=e}finally{try{!e&&l.return&&l.return()}finally{if(u)throw c}}}(),function(){var e=!0,n=!1,o=void 0;try{for(var i,c=t[Symbol.iterator]();!(e=(i=c.next()).done);e=!0)for(var f=i.value;r.length;){var l=r.shift();if((l.innerText||l.textContent)===f){a(l);break}u(l)}}catch(e){n=!0,o=e}finally{try{!e&&c.return&&c.return()}finally{if(n)throw o}}}(),function(){for(;r.length;)u(r.shift())}()}function le(e){for(var t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null,!1),r=void 0;r=n.nextNode();)t.push(r);return t}function se(e){if(n.anchor)return(pe()?Z.appendText:Z.appendHTML)(v(e));H(e)}function de(e,t){if(n.anchor){var r=(pe()?Z.filterAnchoredText:Z.filterAnchoredHTML)(e,t);return!!r&&M(r.input,r.suggestion)}return M(e,t)}function pe(){return g(F)}function he(){return-1!==B.className.indexOf("sey-show")}function ve(e){return-1!==e.className.indexOf("sey-hide")}function ge(){z.refresh(),he()||(B.className+=" sey-show",c.default.fabricate(F,"horsey-show"))}function me(e){!1!==(1===e.which&&!e.metaKey&&!e.ctrlKey)&&ye()}function ye(){he()?Te():ge()}function be(e){we(),e&&((W=e).className+=" sey-selected")}function we(){W&&(W.className=W.className.replace(/ sey-selected/g,""),W=null)}function xe(e,t){var n=Z.source.length;if(0!==n)if(t>n)we();else{var r=function(e){for(;e;){if(i.default.matchesSelector(e.parentElement,".sey-category"))return e.parentElement;e=e.parentElement}return null}(W)||D.firstChild,o=e?"lastChild":"firstChild",a=e?"previousSibling":"nextSibling",u=function(){if(W){if(W[a])return W[a];if(r[a]&&Fe(r[a])[o])return Fe(r[a])[o]}return Fe(D[o])[o]}();be(u),ve(u)&&xe(e,t?t+1:1)}}function Te(){z.sleep(),B.className=B.className.replace(/ sey-show/g,""),we(),c.default.fabricate(F,"horsey-hide"),e.value===Y&&(e.value="")}function Ee(e){var t=he(),r=e.which||e.keyCode;40===r?($&&n.autoShowOnUpDown&&ge(),t&&(xe(),Ce(e))):38===r?($&&n.autoShowOnUpDown&&ge(),t&&(xe(!0),Ce(e))):8===r?$&&n.autoShowOnUpDown&&ge():t&&(13===r?(W?c.default.fabricate(W,"click"):Te(),Ce(e)):27===r&&(Te(),Ce(e)))}function Ce(e){e.stopPropagation(),e.preventDefault()}function Se(){X&&X.classList.remove("sey-hide")}function Ne(){X&&X.classList.add("sey-hide")}function Oe(){if(he()){J(!0),c.default.fabricate(F,"horsey-filter");var e=ie();if(n.blankSearch||e){var t=E({query:e});0===function(){var e=D.firstChild,t=0;for(;e;){var n=r(Fe(e));0===n?e.classList.add("sey-hide"):e.classList.remove("sey-hide"),t+=n,e=e.nextSibling}return t}()&&t&&Q?Se():Ne(),W||xe(),W||t||Te()}else Te()}function r(t){for(var n=t.firstChild,r=0;n;)r>=j?c.default.fabricate(n,"horsey-hide"):(c.default.fabricate(n,"horsey-filter"),-1===n.className.indexOf("sey-hide")&&(r++,N&&fe(n,e))),n=n.nextSibling;return r}}function Re(e){13!==(e.which||e.keyCode)&&P()}function Ae(e){var t=e.which||e.keyCode;13!==t&&9!==t&&setTimeout(ge,0)}function ke(e){var t=e.target;if(t===F)return!0;for(;t;){if(t===B||t===F)return!0;t=t.parentNode}}function _e(e){9===(e.which||e.keyCode)&&Te()}function Le(e){ke(e)||Te()}function Ie(e){var t=e?"remove":"add";z&&(z.destroy(),z=null),e||(z=(0,u.default)(B,F,{caret:$&&"INPUT"!==F.tagName,context:n.appendTo}),he()||z.sleep()),e||$&&p.activeElement!==F?c.default[t](F,"focus",ne):ne(),$?(c.default[t](F,"keypress",Ae),c.default[t](F,"keypress",P),c.default[t](F,"keydown",Re),c.default[t](F,"paste",(function(e){Ae(e),P(e)})),c.default[t](F,"keydown",Ee),n.autoHideOnBlur&&c.default[t](F,"keydown",_e)):(c.default[t](F,"click",me),c.default[t](h,"keydown",Ee)),n.autoHideOnClick&&c.default[t](p,"click",Le),x&&c.default[t](x,"submit",Te)}function je(){Ie(!0),r.contains(B)&&r.removeChild(B)}function Me(t){V?!0===I?e.value+=" "+t:e.value=t:!0===I?e.innerHTML+=" "+t:e.innerHTML=t}function He(e,t){b(e,s(t))}function De(e,t){if("default"!==t.id){var n=m("div","sey-category-id");e.appendChild(n),b(n,t.id)}}function Be(e,t){var n=e.toLowerCase(),r=s(t)||"";if((0,f.default)(n,r.toLowerCase()))return!0;var o=v(t)||"";return"string"==typeof o&&(0,f.default)(n,o.toLowerCase())}function Pe(e,t){for(var n="",r=!1,o=t.start;!1===r&&o>=0;)n=e.substr(o-1,t.start-o+1),r=K.test(n),o--;return{text:r?n:null,start:o}}function Ue(t,n){var r=Pe(t,(0,o.default)(e)).text;if(r)return{input:r,suggestion:n}}function qe(t){var n=e.value,r=(0,o.default)(e),i=Pe(n,r),a=n.substr(0,i.start),u=n.substr(i.start+i.text.length+(r.end-r.start)),c=a+t+" ";e.value=c+u,(0,o.default)(e,{start:c.length,end:c.length})}function We(){throw new Error("Anchoring in editable elements is disabled by default.")}function ze(){throw new Error("Anchoring in editable elements is disabled by default.")}function Fe(e){return(0,i.default)(".sey-list",e)[0]}}function g(e){return"INPUT"===e.tagName||"TEXTAREA"===e.tagName}function m(e,t){var n=p.createElement(e);return n.className=t,n}function y(e){return function(){setTimeout(e,0)}}function b(e,t){e.innerText=e.textContent=t}function w(e){var t=e.getAttribute("contentEditable");return"false"!==t&&("true"===t||!!e.parentElement&&w(e.parentElement))}t.exports=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.setAppends,o=t.set,i=t.filter,a=t.source,u=t.cache,c=void 0===u?{}:u,f=t.predictNextSearch,l=t.renderItem,s=t.renderCategory,d=t.blankSearch,p=t.appendTo,h=t.anchor,g=t.debounce,m=!1!==t.cache;if(a){var y=t.getText,b=t.getValue,w="string"==typeof y?function(e){return e[y]}:"function"==typeof y?y:function(e){return e.toString()},x="string"==typeof b?function(e){return e[b]}:"function"==typeof b?b:function(e){return e},T=[],E=null,C=Number(t.limit)||1/0,S=v(e,{source:O,limit:C,getText:w,getValue:x,setAppends:n,predictNextSearch:f,renderItem:l,renderCategory:s,appendTo:p,anchor:h,noMatches:N,noMatchesText:t.noMatches,blankSearch:d,debounce:g,set:function(t){!0!==n&&(e.value=""),E=t,(o||S.defaultSetter)(w(t),t),S.emit("afterSet")},filter:i});return S}function N(e){return!!t.noMatches&&e.query.length}function O(n,o){var i=n.query,a=n.limit;if(t.blankSearch||0!==i.length){S&&S.emit("beforeUpdate");var u=(0,r.default)(i);if(m){var f=c[u];if(f){var d=f.created.getTime(),p=c.duration||86400;if(new Date(d+1e3*p)>new Date)return void o(null,f.items.slice())}}var h={previousSuggestions:T.slice(),previousSelection:E,input:i,renderItem:l,renderCategory:s,limit:a};"function"==typeof t.source?t.source(h,v):v(null,t.source)}else o(null,[],!0);function v(t,n){t&&(console.log("Autocomplete source error.",t,e),o(t,[]));var r=Array.isArray(n)?n:[];m&&(c[u]={created:new Date,items:r}),T=r,o(null,r.slice())}}}},{bullseye:10,"contra/emitter":17,crossvent:18,fuzzysearch:21,"hash-sum":22,"lodash/debounce":2,sektor:24,sell:33}],2:[function(e,t,n){var r=e("./isObject"),o=e("./now"),i=e("./toNumber"),a=Math.max,u=Math.min;t.exports=function(e,t,n){var c,f,l,s,d,p,h=0,v=!1,g=!1,m=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function y(t){var n=c,r=f;return c=f=void 0,h=t,s=e.apply(r,n)}function b(e){return h=e,d=setTimeout(x,t),v?y(e):s}function w(e){var n=e-p;return void 0===p||n>=t||n<0||g&&e-h>=l}function x(){var e=o();if(w(e))return T(e);d=setTimeout(x,function(e){var n=t-(e-p);return g?u(n,l-(e-h)):n}(e))}function T(e){return d=void 0,m&&c?y(e):(c=f=void 0,s)}function E(){var e=o(),n=w(e);if(c=arguments,f=this,p=e,n){if(void 0===d)return b(p);if(g)return d=setTimeout(x,t),y(p)}return void 0===d&&(d=setTimeout(x,t)),s}return t=i(t)||0,r(n)&&(v=!!n.leading,l=(g="maxWait"in n)?a(i(n.maxWait)||0,t):l,m="trailing"in n?!!n.trailing:m),E.cancel=function(){h=0,c=p=f=d=void 0},E.flush=function(){return void 0===d?s:T(o())},E}},{"./isObject":4,"./now":7,"./toNumber":8}],3:[function(e,t,n){var r=e("./isObject"),o=Object.prototype.toString;t.exports=function(e){var t=r(e)?o.call(e):"";return"[object Function]"==t||"[object GeneratorFunction]"==t}},{"./isObject":4}],4:[function(e,t,n){t.exports=function(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}},{}],5:[function(e,t,n){t.exports=function(e){return!!e&&"object"==typeof e}},{}],6:[function(e,t,n){var r=e("./isObjectLike"),o=Object.prototype.toString;t.exports=function(e){return"symbol"==typeof e||r(e)&&"[object Symbol]"==o.call(e)}},{"./isObjectLike":5}],7:[function(e,t,n){t.exports=function(){return Date.now()}},{}],8:[function(e,t,n){var r=e("./isFunction"),o=e("./isObject"),i=e("./isSymbol"),a=/^\s+|\s+$/g,u=/^[-+]0x[0-9a-f]+$/i,c=/^0b[01]+$/i,f=/^0o[0-7]+$/i,l=parseInt;t.exports=function(e){if("number"==typeof e)return e;if(i(e))return NaN;if(o(e)){var t=r(e.valueOf)?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(a,"");var n=c.test(e);return n||f.test(e)?l(e.slice(2),n?2:8):u.test(e)?NaN:+e}},{"./isFunction":3,"./isObject":4,"./isSymbol":6}],9:[function(e,t,n){t.exports=function(e,t){return Array.prototype.slice.call(e,t)}},{}],10:[function(e,t,n){"use strict";var r=e("crossvent"),o=e("./throttle"),i=e("./tailormade");t.exports=function(e,t,n){var a=n,u=t&&t.tagName;u||2!==arguments.length||(a=t),u||(t=e),a||(a={});var c=!1,f=o(g,30),l={update:!1!==a.autoupdateToCaret&&v},s=a.caret&&i(t,l);return g(),!1!==a.tracking&&r.add(window,"resize",f),{read:p,refresh:g,destroy:m,sleep:d};function d(){l.sleeping=!0}function p(){return h()}function h(e){var n=t.getBoundingClientRect(),r=document.body.scrollTop||document.documentElement.scrollTop;return s?{x:((e=s.read()).absolute?0:n.left)+e.x,y:(e.absolute?0:n.top)+r+e.y+20}:{x:n.left,y:n.top+r}}function v(e){g(e)}function g(n){if(c)throw new Error("Bullseye can't refresh after being destroyed. Create another instance instead.");if(s&&!n)return l.sleeping=!1,void s.refresh();var r=h(n);s||t===e||(r.y+=t.offsetHeight);var o=a.context;e.style.left=r.x+"px",e.style.top=(o?o.offsetHeight:r.y)+"px"}function m(){s&&s.destroy(),r.remove(window,"resize",f),c=!0}}},{"./tailormade":14,"./throttle":15,crossvent:11}],11:[function(e,t,n){(function(n){"use strict";var r=e("custom-event"),o=e("./eventmap"),i=n.document,a=function(e,t,n,r){return e.addEventListener(t,n,r)},u=function(e,t,n,r){return e.removeEventListener(t,n,r)},c=[];function f(e,t,n){var r=function(e,t,n){var r,o;for(r=0;rparseInt(t.height)&&(r.overflowY="scroll")):r.overflow="hidden";return{mirror:n,computed:t}}(),o=function(t,n){var r=l.createElement("span"),o=t.mirror,i=t.computed;y(o,m(e).substring(0,n)),"INPUT"===e.tagName&&(o.textContent=o.textContent.replace(/\s/g," "));return y(r,m(e).substring(n)||"."),o.appendChild(r),{x:r.offsetLeft+parseInt(i.borderLeftWidth),y:r.offsetTop+parseInt(i.borderTopWidth)}}(n,t.start);return l.body.removeChild(n.mirror),o}function g(){var e=u();if(e.rangeCount){var t=e.getRangeAt(0);if("P"===t.startContainer.nodeName&&0===t.startOffset)return{x:t.startContainer.offsetLeft,y:t.startContainer.offsetTop,absolute:!0};if(t.getClientRects){var n=t.getClientRects();if(n.length>0)return{x:n[0].left,y:n[0].top,absolute:!0}}}return{x:0,y:0}}function m(e){return n?e.value:e.innerHTML}function y(e,t){n?e.textContent=t:e.innerHTML=t}function b(t){var n=t?"remove":"add";o[n](e,"keydown",i),o[n](e,"keyup",i),o[n](e,"input",i),o[n](e,"paste",i),o[n](e,"change",i)}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./throttle":15,crossvent:11,seleccion:31,sell:33}],15:[function(e,t,n){"use strict";t.exports=function(e,t){var n,r=-1/0;return function(){n||function o(){clearTimeout(n),n=null;var i=r+t,a=Date.now();a>i?(r=a,e()):n=setTimeout(o,i-a)}()}}},{}],16:[function(e,t,n){"use strict";var r=e("ticky");t.exports=function(e,t,n){e&&r((function(){e.apply(n||null,t||[])}))}},{ticky:34}],17:[function(e,t,n){"use strict";var r=e("atoa"),o=e("./debounce");t.exports=function(e,t){var n=t||{},i={};return void 0===e&&(e={}),e.on=function(t,n){return i[t]?i[t].push(n):i[t]=[n],e},e.once=function(t,n){return n._once=!0,e.on(t,n),e},e.off=function(t,n){var r=arguments.length;if(1===r)delete i[t];else if(0===r)i={};else{var o=i[t];if(!o)return e;o.splice(o.indexOf(n),1)}return e},e.emit=function(){var t=r(arguments);return e.emitterSnapshot(t.shift()).apply(this,t)},e.emitterSnapshot=function(t){var a=(i[t]||[]).slice(0);return function(){var i=r(arguments),u=this||e;if("error"===t&&!1!==n.throws&&!a.length)throw 1===i.length?i[0]:i;return a.forEach((function(r){n.async?o(r,i,u):r.apply(u,i),r._once&&e.off(t,r)})),e}},e}},{"./debounce":16,atoa:9}],18:[function(e,t,n){(function(n){"use strict";var r=e("custom-event"),o=e("./eventmap"),i=n.document,a=function(e,t,n,r){return e.addEventListener(t,n,r)},u=function(e,t,n,r){return e.removeEventListener(t,n,r)},c=[];function f(e,t,n){var r=function(e,t,n){var r,o;for(r=0;rn)return!1;if(r===n)return e===t;e:for(var o=0,i=0;o1)for(var n=1;n1?function(e,t){for(var n,r=i.createControlRange(),o=0,a=t.length;o=this.rangeCount)throw new Error("getRangeAt(): index out of bounds");return this._ranges[e].cloneRange()},a.removeRange=function(e){if("Control"===this._selection.type){for(var t=this._selection.createRange(),n=l(e),r=i.createControlRange(),o=!1,a=0,u=t.length;a=0&&(e._idleTimeoutId=setTimeout((function(){e._onTimeout&&e._onTimeout()}),t))},n.setImmediate="function"==typeof t?t:function(e){var t=c++,r=!(arguments.length<2)&&a.call(arguments,1);return u[t]=!0,o((function(){u[t]&&(r?e.apply(null,r):e.call(null),n.clearImmediate(t))})),t},n.clearImmediate="function"==typeof r?r:function(e){delete u[e]}}).call(this,e("timers").setImmediate,e("timers").clearImmediate)},{"process/browser.js":23,timers:35}]},{},[1])(1)})); \ No newline at end of file diff --git a/horsey.es5.js b/horsey.es5.js index da86598..b9cd70f 100644 --- a/horsey.es5.js +++ b/horsey.es5.js @@ -46,20 +46,20 @@ var doc = document; var docElement = doc.documentElement; function horsey(el) { - var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; - var setAppends = options.setAppends; - var _set = options.set; - var filter = options.filter; - var source = options.source; - var _options$cache = options.cache; - var cache = _options$cache === undefined ? {} : _options$cache; - var predictNextSearch = options.predictNextSearch; - var renderItem = options.renderItem; - var renderCategory = options.renderCategory; - var blankSearch = options.blankSearch; - var appendTo = options.appendTo; - var anchor = options.anchor; - var debounce = options.debounce; + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var setAppends = options.setAppends, + _set = options.set, + filter = options.filter, + source = options.source, + _options$cache = options.cache, + cache = _options$cache === undefined ? {} : _options$cache, + predictNextSearch = options.predictNextSearch, + renderItem = options.renderItem, + renderCategory = options.renderCategory, + blankSearch = options.blankSearch, + appendTo = options.appendTo, + anchor = options.anchor, + debounce = options.debounce; var caching = options.cache !== false; if (!source) { @@ -116,8 +116,8 @@ function horsey(el) { return data.query.length; } function sourceFunction(data, done) { - var query = data.query; - var limit = data.limit; + var query = data.query, + limit = data.limit; if (!options.blankSearch && query.length === 0) { done(null, [], true);return; @@ -167,25 +167,25 @@ function horsey(el) { } function autocomplete(el) { - var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var o = options; var parent = o.appendTo || doc.body; - var getText = o.getText; - var getValue = o.getValue; - var form = o.form; - var source = o.source; - var noMatches = o.noMatches; - var noMatchesText = o.noMatchesText; - var _o$highlighter = o.highlighter; - var highlighter = _o$highlighter === undefined ? true : _o$highlighter; - var _o$highlightCompleteW = o.highlightCompleteWords; - var highlightCompleteWords = _o$highlightCompleteW === undefined ? true : _o$highlightCompleteW; - var _o$renderItem = o.renderItem; - var renderItem = _o$renderItem === undefined ? defaultItemRenderer : _o$renderItem; - var _o$renderCategory = o.renderCategory; - var renderCategory = _o$renderCategory === undefined ? defaultCategoryRenderer : _o$renderCategory; - var setAppends = o.setAppends; + var getText = o.getText, + getValue = o.getValue, + form = o.form, + source = o.source, + noMatches = o.noMatches, + noMatchesText = o.noMatchesText, + _o$highlighter = o.highlighter, + highlighter = _o$highlighter === undefined ? true : _o$highlighter, + _o$highlightCompleteW = o.highlightCompleteWords, + highlightCompleteWords = _o$highlightCompleteW === undefined ? true : _o$highlightCompleteW, + _o$renderItem = o.renderItem, + renderItem = _o$renderItem === undefined ? defaultItemRenderer : _o$renderItem, + _o$renderCategory = o.renderCategory, + renderCategory = _o$renderCategory === undefined ? defaultCategoryRenderer : _o$renderCategory, + setAppends = o.setAppends; var limit = typeof o.limit === 'number' ? o.limit : Infinity; var userFilter = o.filter || defaultFilter; @@ -919,7 +919,10 @@ function autocomplete(el) { _crossvent2.default[op](attachment, 'keypress', deferredShow); _crossvent2.default[op](attachment, 'keypress', deferredFiltering); _crossvent2.default[op](attachment, 'keydown', deferredFilteringNoEnter); - _crossvent2.default[op](attachment, 'paste', deferredFiltering); + _crossvent2.default[op](attachment, 'paste', function (ev) { + deferredShow(ev); + deferredFiltering(ev); + }); _crossvent2.default[op](attachment, 'keydown', keydown); if (o.autoHideOnBlur) { _crossvent2.default[op](attachment, 'keydown', hideOnBlur); diff --git a/package.json b/package.json index f10d5d0..01a8a55 100644 --- a/package.json +++ b/package.json @@ -1,47 +1,47 @@ { - "name": "horsey", - "version": "4.2.2", - "description": "Progressive and customizable autocomplete component", - "main": "horsey.es5.js", - "scripts": { - "build": "npm run scripts && npm run styles", - "deploy": "npm run build && npm run deployment && npm run sync", - "deployment": "git add dist ; git add horsey.es5.js ; npm version ${BUMP:-\"patch\"} ; git add package.json ; git commit -am \"Release $(cat package.json | jq -r .version)\" ; git push --tags ; npm publish ; git push", - "scripts": "jshint . && babel --presets es2015 --out-file horsey.es5.js horsey.js && browserify -s horsey -t [ babelify --presets [ es2015 ] ] -do dist/horsey.js horsey.js && uglifyjs -m -c -o dist/horsey.min.js dist/horsey.js", - "start": "watchify -vs horsey -t [ babelify --presets [ es2015 ] ] -do dist/horsey.js horsey.js & stylus -w horsey.styl -o dist", - "styles": "stylus horsey.styl -o dist && cleancss dist/horsey.css -o dist/horsey.min.css", - "sync": "git checkout gh-pages ; git merge master ; git push ; git checkout master" - }, - "repository": { - "type": "git", - "url": "https://github.com/bevacqua/horsey.git" - }, - "author": "Nicolas Bevacqua (http://bevacqua.io/)", - "license": "MIT", - "bugs": { - "url": "https://github.com/bevacqua/horsey/issues" - }, - "homepage": "https://github.com/bevacqua/horsey", - "dependencies": { - "bullseye": "1.5.0", - "contra": "1.9.4", - "crossvent": "1.5.4", - "fuzzysearch": "1.0.3", - "hash-sum": "1.0.2", - "lodash": "4.13.1", - "sektor": "1.1.4", - "sell": "1.0.0" - }, - "devDependencies": { - "babel-cli": "6.10.1", - "babel-preset-es2015": "6.9.0", - "babelify": "7.3.0", - "browserify": "13.0.1", - "clean-css": "3.0.4", - "jshint": "2.9.2", - "nib": "1.0.4", - "stylus": "0.49.3", - "uglify-js": "2.4.16", - "watchify": "2.2.1" - } + "name": "horsey", + "version": "4.2.2-fbn", + "description": "Progressive and customizable autocomplete component", + "main": "horsey.es5.js", + "scripts": { + "build": "yarn scripts && yarn styles", + "deploy": "yarn build && yarn deployment && yarn sync", + "deployment": "git add dist ; git add horsey.es5.js ; npm version ${BUMP:-\"patch\"} ; git add package.json ; git commit -am \"Release $(cat package.json | jq -r .version)\" ; git push --tags ; npm publish ; git push", + "scripts": "jshint . && babel --presets es2015 --out-file horsey.es5.js horsey.js && browserify -s horsey -t [ babelify --presets [ es2015 ] ] -do dist/horsey.js horsey.js && terser -m -c -o dist/horsey.min.js dist/horsey.js", + "start": "watchify -vs horsey -t [ babelify --presets [ es2015 ] ] -do dist/horsey.js horsey.js & stylus -w horsey.styl -o dist", + "styles": "stylus horsey.styl -o dist && cleancss dist/horsey.css -o dist/horsey.min.css", + "sync": "git checkout gh-pages ; git merge master ; git push ; git checkout master" + }, + "repository": { + "type": "git", + "url": "https://github.com/bevacqua/horsey.git" + }, + "author": "Nicolas Bevacqua (http://bevacqua.io/)", + "license": "MIT", + "bugs": { + "url": "https://github.com/bevacqua/horsey/issues" + }, + "homepage": "https://github.com/bevacqua/horsey", + "dependencies": { + "bullseye": "1.5.0", + "contra": "1.9.4", + "crossvent": "1.5.4", + "fuzzysearch": "1.0.3", + "hash-sum": "1.0.2", + "lodash": "4.13.1", + "sektor": "1.1.4", + "sell": "1.0.0" + }, + "devDependencies": { + "babel-cli": "6.10.1", + "babel-preset-es2015": "6.9.0", + "babelify": "7.3.0", + "browserify": "13.0.1", + "clean-css": "3.0.4", + "jshint": "2.9.2", + "nib": "1.0.4", + "stylus": "0.49.3", + "terser": "^4.7.0", + "watchify": "2.2.1" + } } From 4eabf1dbe7db752ed2ba8f333a32810eb469da0a Mon Sep 17 00:00:00 2001 From: Fabiano Taioli Date: Mon, 8 Jun 2020 17:16:24 +0200 Subject: [PATCH 3/3] deps update --- dist/horsey.js | 2202 ++++++++++++++++++++++---------------------- dist/horsey.min.js | 2 +- horsey.es5.js | 436 +++++---- package.json | 39 +- 4 files changed, 1392 insertions(+), 1287 deletions(-) diff --git a/dist/horsey.js b/dist/horsey.js index 1cbb03d..bc160b8 100644 --- a/dist/horsey.js +++ b/dist/horsey.js @@ -1,41 +1,37 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.horsey = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } -var _debounce = require('lodash/debounce'); +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } -var _debounce2 = _interopRequireDefault(_debounce); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } var KEY_BACKSPACE = 8; var KEY_ENTER = 13; @@ -53,7 +49,7 @@ function horsey(el) { filter = options.filter, source = options.source, _options$cache = options.cache, - cache = _options$cache === undefined ? {} : _options$cache, + cache = _options$cache === void 0 ? {} : _options$cache, predictNextSearch = options.predictNextSearch, renderItem = options.renderItem, renderCategory = options.renderCategory, @@ -61,8 +57,8 @@ function horsey(el) { appendTo = options.appendTo, anchor = options.anchor, debounce = options.debounce; - var caching = options.cache !== false; + if (!source) { return; } @@ -79,7 +75,6 @@ function horsey(el) { } : typeof userGetValue === 'function' ? userGetValue : function (d) { return d; }; - var previousSuggestions = []; var previousSelection = null; var limit = Number(options.limit) || Infinity; @@ -102,43 +97,56 @@ function horsey(el) { if (setAppends !== true) { el.value = ''; } + previousSelection = s; + (_set || completer.defaultSetter)(getText(s), s); + completer.emit('afterSet'); }, - filter: filter }); return completer; + function noMatches(data) { if (!options.noMatches) { return false; } + return data.query.length; } + function sourceFunction(data, done) { var query = data.query, limit = data.limit; if (!options.blankSearch && query.length === 0) { - done(null, [], true);return; + done(null, [], true); + return; } + if (completer) { completer.emit('beforeUpdate'); } - var hash = (0, _hashSum2.default)(query); // fast, case insensitive, prevents collisions + + var hash = (0, _hashSum["default"])(query); // fast, case insensitive, prevents collisions + if (caching) { var entry = cache[hash]; + if (entry) { var start = entry.created.getTime(); var duration = cache.duration || 60 * 60 * 24; var diff = duration * 1000; var fresh = new Date(start + diff) > new Date(); + if (fresh) { - done(null, entry.items.slice());return; + done(null, entry.items.slice()); + return; } } } + var sourceData = { previousSuggestions: previousSuggestions.slice(), previousSelection: previousSelection, @@ -147,20 +155,28 @@ function horsey(el) { renderCategory: renderCategory, limit: limit }; + if (typeof options.source === 'function') { options.source(sourceData, sourced); } else { sourced(null, options.source); } + function sourced(err, result) { if (err) { console.log('Autocomplete source error.', err, el); done(err, []); } + var items = Array.isArray(result) ? result : []; + if (caching) { - cache[hash] = { created: new Date(), items: items }; + cache[hash] = { + created: new Date(), + items: items + }; } + previousSuggestions = items; done(null, items.slice()); } @@ -169,7 +185,6 @@ function horsey(el) { function autocomplete(el) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var o = options; var parent = o.appendTo || doc.body; var getText = o.getText, @@ -179,51 +194,56 @@ function autocomplete(el) { noMatches = o.noMatches, noMatchesText = o.noMatchesText, _o$highlighter = o.highlighter, - highlighter = _o$highlighter === undefined ? true : _o$highlighter, + highlighter = _o$highlighter === void 0 ? true : _o$highlighter, _o$highlightCompleteW = o.highlightCompleteWords, - highlightCompleteWords = _o$highlightCompleteW === undefined ? true : _o$highlightCompleteW, + highlightCompleteWords = _o$highlightCompleteW === void 0 ? true : _o$highlightCompleteW, _o$renderItem = o.renderItem, - renderItem = _o$renderItem === undefined ? defaultItemRenderer : _o$renderItem, + renderItem = _o$renderItem === void 0 ? defaultItemRenderer : _o$renderItem, _o$renderCategory = o.renderCategory, - renderCategory = _o$renderCategory === undefined ? defaultCategoryRenderer : _o$renderCategory, + renderCategory = _o$renderCategory === void 0 ? defaultCategoryRenderer : _o$renderCategory, setAppends = o.setAppends; - var limit = typeof o.limit === 'number' ? o.limit : Infinity; var userFilter = o.filter || defaultFilter; var userSet = o.set || defaultSetter; var categories = tag('div', 'sey-categories'); var container = tag('div', 'sey-container'); var deferredFiltering = defer(filtering); - var state = { counter: 0, query: null }; + var state = { + counter: 0, + query: null + }; var categoryMap = Object.create(null); var selection = null; - var eye = void 0; + var eye; var attachment = el; - var noneMatch = void 0; - var textInput = void 0; - var anyInput = void 0; - var ranchorleft = void 0; - var ranchorright = void 0; + var noneMatch; + var textInput; + var anyInput; + var ranchorleft; + var ranchorright; var lastPrefix = ''; var debounceTime = o.debounce || 300; - var debouncedLoading = (0, _debounce2.default)(loading, debounceTime); + var debouncedLoading = (0, _debounce["default"])(loading, debounceTime); if (o.autoHideOnBlur === void 0) { o.autoHideOnBlur = true; } + if (o.autoHideOnClick === void 0) { o.autoHideOnClick = true; } + if (o.autoShowOnUpDown === void 0) { o.autoShowOnUpDown = el.tagName === 'INPUT'; } + if (o.anchor) { ranchorleft = new RegExp('^' + o.anchor); ranchorright = new RegExp(o.anchor + '$'); } var hasItems = false; - var api = (0, _emitter2.default)({ + var api = (0, _emitter["default"])({ anchor: o.anchor, clear: clear, show: show, @@ -244,14 +264,15 @@ function autocomplete(el) { attachment: attachment, source: [] }); - retarget(el); container.appendChild(categories); + if (noMatches && noMatchesText) { noneMatch = tag('div', 'sey-empty sey-hide'); text(noneMatch, noMatchesText); container.appendChild(noneMatch); } + parent.appendChild(container); el.setAttribute('autocomplete', 'off'); @@ -279,23 +300,30 @@ function autocomplete(el) { if (typeof source !== 'function') { return; } - _crossvent2.default.remove(attachment, 'focus', loading); + + _crossvent["default"].remove(attachment, 'focus', loading); + var query = readInput(); + if (query === state.query) { return; } + hasItems = false; state.query = query; - var counter = ++state.counter; - - source({ query: query, limit: limit }, sourced); + source({ + query: query, + limit: limit + }, sourced); function sourced(err, result, blankQuery) { if (state.counter !== counter) { return; } + loaded(result, forceShow); + if (err || blankQuery) { hasItems = false; } @@ -311,17 +339,21 @@ function autocomplete(el) { return add(suggestion, cat); }); }); + if (forceShow) { show(); } + filtering(); } function clear() { unselect(); + while (categories.lastChild) { categories.removeChild(categories.lastChild); } + categoryMap = Object.create(null); hasItems = false; } @@ -334,17 +366,23 @@ function autocomplete(el) { if (!data.id) { data.id = 'default'; } + if (!categoryMap[data.id]) { categoryMap[data.id] = createCategory(); } + return categoryMap[data.id]; + function createCategory() { var category = tag('div', 'sey-category'); var ul = tag('ul', 'sey-list'); renderCategory(category, data); category.appendChild(ul); categories.appendChild(category); - return { data: data, ul: ul }; + return { + data: data, + ul: ul + }; } } @@ -352,13 +390,19 @@ function autocomplete(el) { var cat = getCategory(categoryData); var li = tag('li', 'sey-item'); renderItem(li, suggestion); + if (highlighter) { breakupForHighlighter(li); } - _crossvent2.default.add(li, 'mouseenter', hoverSuggestion); - _crossvent2.default.add(li, 'click', clickedSuggestion); - _crossvent2.default.add(li, 'horsey-filter', filterItem); - _crossvent2.default.add(li, 'horsey-hide', hideItem); + + _crossvent["default"].add(li, 'mouseenter', hoverSuggestion); + + _crossvent["default"].add(li, 'click', clickedSuggestion); + + _crossvent["default"].add(li, 'horsey-filter', filterItem); + + _crossvent["default"].add(li, 'horsey-hide', hideItem); + cat.ul.appendChild(li); api.source.push(suggestion); return li; @@ -377,6 +421,7 @@ function autocomplete(el) { source: api.source.slice(), selection: suggestion }) || ''; + if (lastPrefix) { el.value = lastPrefix; el.select(); @@ -387,16 +432,18 @@ function autocomplete(el) { function filterItem() { var value = readInput(); + if (filter(value, suggestion)) { li.className = li.className.replace(/ sey-hide/g, ''); } else { - _crossvent2.default.fabricate(li, 'horsey-hide'); + _crossvent["default"].fabricate(li, 'horsey-hide'); } } function hideItem() { if (!hidden(li)) { li.className += ' sey-hide'; + if (selection === li) { unselect(); } @@ -408,39 +455,31 @@ function autocomplete(el) { getTextChildren(el).forEach(function (el) { var parent = el.parentElement; var text = el.textContent || el.nodeValue || ''; + if (text.length === 0) { return; } - var _iteratorNormalCompletion = true; - var _didIteratorError = false; - var _iteratorError = undefined; - try { - for (var _iterator = text[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - var char = _step.value; + var _iterator = _createForOfIteratorHelper(text), + _step; - parent.insertBefore(spanFor(char), el); + try { + for (_iterator.s(); !(_step = _iterator.n()).done;) { + var _char2 = _step.value; + parent.insertBefore(spanFor(_char2), el); } } catch (err) { - _didIteratorError = true; - _iteratorError = err; + _iterator.e(err); } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } + _iterator.f(); } parent.removeChild(el); - function spanFor(char) { + + function spanFor(_char) { var span = doc.createElement('span'); span.className = 'sey-char'; - span.textContent = span.innerText = char; + span.textContent = span.innerText = _char; return span; } }); @@ -451,14 +490,17 @@ function autocomplete(el) { var words = needle.split(rword).filter(function (w) { return w.length; }); - var elems = [].concat(_toConsumableArray(el.querySelectorAll('.sey-char'))); - var chars = void 0; - var startIndex = 0; + var elems = _toConsumableArray(el.querySelectorAll('.sey-char')); + + var chars; + var startIndex = 0; balance(); + if (highlightCompleteWords) { whole(); } + fuzzy(); clearRemainder(); @@ -469,75 +511,56 @@ function autocomplete(el) { } function whole() { - var _iteratorNormalCompletion2 = true; - var _didIteratorError2 = false; - var _iteratorError2 = undefined; + var _iterator2 = _createForOfIteratorHelper(words), + _step2; try { - for (var _iterator2 = words[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { + for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { var word = _step2.value; - var tempIndex = startIndex; + retry: while (tempIndex !== -1) { var init = true; var prevIndex = tempIndex; - var _iteratorNormalCompletion3 = true; - var _didIteratorError3 = false; - var _iteratorError3 = undefined; - try { - for (var _iterator3 = word[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { - var char = _step3.value; + var _iterator3 = _createForOfIteratorHelper(word), + _step3; - var i = chars.indexOf(char, prevIndex + 1); + try { + for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) { + var _char3 = _step3.value; + var i = chars.indexOf(_char3, prevIndex + 1); var fail = i === -1 || !init && prevIndex + 1 !== i; + if (init) { init = false; tempIndex = i; } + if (fail) { continue retry; } + prevIndex = i; } } catch (err) { - _didIteratorError3 = true; - _iteratorError3 = err; + _iterator3.e(err); } finally { - try { - if (!_iteratorNormalCompletion3 && _iterator3.return) { - _iterator3.return(); - } - } finally { - if (_didIteratorError3) { - throw _iteratorError3; - } - } + _iterator3.f(); } - var _iteratorNormalCompletion4 = true; - var _didIteratorError4 = false; - var _iteratorError4 = undefined; + var _iterator4 = _createForOfIteratorHelper(elems.splice(tempIndex, 1 + prevIndex - tempIndex)), + _step4; try { - for (var _iterator4 = elems.splice(tempIndex, 1 + prevIndex - tempIndex)[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) { + for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) { var _el = _step4.value; - on(_el); } } catch (err) { - _didIteratorError4 = true; - _iteratorError4 = err; + _iterator4.e(err); } finally { - try { - if (!_iteratorNormalCompletion4 && _iterator4.return) { - _iterator4.return(); - } - } finally { - if (_didIteratorError4) { - throw _iteratorError4; - } - } + _iterator4.f(); } balance(); @@ -546,32 +569,23 @@ function autocomplete(el) { } } } catch (err) { - _didIteratorError2 = true; - _iteratorError2 = err; + _iterator2.e(err); } finally { - try { - if (!_iteratorNormalCompletion2 && _iterator2.return) { - _iterator2.return(); - } - } finally { - if (_didIteratorError2) { - throw _iteratorError2; - } - } + _iterator2.f(); } } function fuzzy() { - var _iteratorNormalCompletion5 = true; - var _didIteratorError5 = false; - var _iteratorError5 = undefined; + var _iterator5 = _createForOfIteratorHelper(needle), + _step5; try { - for (var _iterator5 = needle[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) { + for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) { var input = _step5.value; while (elems.length) { var _el2 = elems.shift(); + if ((_el2.innerText || _el2.textContent) === input) { on(_el2); break; @@ -581,18 +595,9 @@ function autocomplete(el) { } } } catch (err) { - _didIteratorError5 = true; - _iteratorError5 = err; + _iterator5.e(err); } finally { - try { - if (!_iteratorNormalCompletion5 && _iterator5.return) { - _iterator5.return(); - } - } finally { - if (_didIteratorError5) { - throw _iteratorError5; - } - } + _iterator5.f(); } } @@ -605,6 +610,7 @@ function autocomplete(el) { function on(ch) { ch.classList.add('sey-char-highlight'); } + function off(ch) { ch.classList.remove('sey-char-highlight'); } @@ -613,10 +619,12 @@ function autocomplete(el) { function getTextChildren(el) { var texts = []; var walker = document.createTreeWalker(el, NodeFilter.SHOW_TEXT, null, false); - var node = void 0; + var node; + while (node = walker.nextNode()) { texts.push(node); } + return texts; } @@ -624,6 +632,7 @@ function autocomplete(el) { if (o.anchor) { return (isText() ? api.appendText : api.appendHTML)(getValue(value)); } + userSet(value); } @@ -632,32 +641,39 @@ function autocomplete(el) { var il = (isText() ? api.filterAnchoredText : api.filterAnchoredHTML)(value, suggestion); return il ? userFilter(il.input, il.suggestion) : false; } + return userFilter(value, suggestion); } function isText() { return isInput(attachment); } + function visible() { return container.className.indexOf('sey-show') !== -1; } + function hidden(li) { return li.className.indexOf('sey-hide') !== -1; } function show() { eye.refresh(); + if (!visible()) { container.className += ' sey-show'; - _crossvent2.default.fabricate(attachment, 'horsey-show'); + + _crossvent["default"].fabricate(attachment, 'horsey-show'); } } function toggler(e) { var left = e.which === 1 && !e.metaKey && !e.ctrlKey; + if (left === false) { return; // we only care about honest to god left-clicks } + toggle(); } @@ -671,6 +687,7 @@ function autocomplete(el) { function select(li) { unselect(); + if (li) { selection = li; selection.className += ' sey-selected'; @@ -686,13 +703,16 @@ function autocomplete(el) { function move(up, moves) { var total = api.source.length; + if (total === 0) { return; } + if (moves > total) { unselect(); return; } + var cat = findCategory(selection) || categories.firstChild; var first = up ? 'lastChild' : 'firstChild'; var last = up ? 'firstChild' : 'lastChild'; @@ -707,11 +727,13 @@ function autocomplete(el) { function findCategory(el) { while (el) { - if (_sektor2.default.matchesSelector(el.parentElement, '.sey-category')) { + if (_sektor["default"].matchesSelector(el.parentElement, '.sey-category')) { return el.parentElement; } + el = el.parentElement; } + return null; } @@ -720,10 +742,12 @@ function autocomplete(el) { if (selection[next]) { return selection[next]; } + if (cat[next] && findList(cat[next])[first]) { return findList(cat[next])[first]; } } + return findList(categories[first])[first]; } } @@ -732,7 +756,9 @@ function autocomplete(el) { eye.sleep(); container.className = container.className.replace(/ sey-show/g, ''); unselect(); - _crossvent2.default.fabricate(attachment, 'horsey-hide'); + + _crossvent["default"].fabricate(attachment, 'horsey-hide'); + if (el.value === lastPrefix) { el.value = ''; } @@ -741,10 +767,12 @@ function autocomplete(el) { function keydown(e) { var shown = visible(); var which = e.which || e.keyCode; + if (which === KEY_DOWN) { if (anyInput && o.autoShowOnUpDown) { show(); } + if (shown) { move(); stop(e); @@ -753,6 +781,7 @@ function autocomplete(el) { if (anyInput && o.autoShowOnUpDown) { show(); } + if (shown) { move(true); stop(e); @@ -764,10 +793,11 @@ function autocomplete(el) { } else if (shown) { if (which === KEY_ENTER) { if (selection) { - _crossvent2.default.fabricate(selection, 'click'); + _crossvent["default"].fabricate(selection, 'click'); } else { hide(); } + stop(e); } else if (which === KEY_ESC) { hide(); @@ -797,93 +827,123 @@ function autocomplete(el) { if (!visible()) { return; } + debouncedLoading(true); - _crossvent2.default.fabricate(attachment, 'horsey-filter'); + + _crossvent["default"].fabricate(attachment, 'horsey-filter'); + var value = readInput(); + if (!o.blankSearch && !value) { - hide();return; + hide(); + return; } - var nomatch = noMatches({ query: value }); + + var nomatch = noMatches({ + query: value + }); var count = walkCategories(); + if (count === 0 && nomatch && hasItems) { showNoResults(); } else { hideNoResults(); } + if (!selection) { move(); } + if (!selection && !nomatch) { hide(); } + function walkCategories() { var category = categories.firstChild; var count = 0; + while (category) { var list = findList(category); var partial = walkCategory(list); + if (partial === 0) { category.classList.add('sey-hide'); } else { category.classList.remove('sey-hide'); } + count += partial; category = category.nextSibling; } + return count; } + function walkCategory(ul) { var li = ul.firstChild; var count = 0; + while (li) { if (count >= limit) { - _crossvent2.default.fabricate(li, 'horsey-hide'); + _crossvent["default"].fabricate(li, 'horsey-hide'); } else { - _crossvent2.default.fabricate(li, 'horsey-filter'); + _crossvent["default"].fabricate(li, 'horsey-filter'); + if (li.className.indexOf('sey-hide') === -1) { count++; + if (highlighter) { highlight(li, value); } } } + li = li.nextSibling; } + return count; } } function deferredFilteringNoEnter(e) { var which = e.which || e.keyCode; + if (which === KEY_ENTER) { return; } + deferredFiltering(); } function deferredShow(e) { var which = e.which || e.keyCode; + if (which === KEY_ENTER || which === KEY_TAB) { return; } + setTimeout(show, 0); } function autocompleteEventTarget(e) { var target = e.target; + if (target === attachment) { return true; } + while (target) { if (target === container || target === attachment) { return true; } + target = target.parentNode; } } function hideOnBlur(e) { var which = e.which || e.keyCode; + if (which === KEY_TAB) { hide(); } @@ -893,55 +953,70 @@ function autocomplete(el) { if (autocompleteEventTarget(e)) { return; } + hide(); } function inputEvents(remove) { var op = remove ? 'remove' : 'add'; + if (eye) { eye.destroy(); eye = null; } + if (!remove) { - eye = (0, _bullseye2.default)(container, attachment, { + eye = (0, _bullseye["default"])(container, attachment, { caret: anyInput && attachment.tagName !== 'INPUT', context: o.appendTo }); + if (!visible()) { eye.sleep(); } } + if (remove || anyInput && doc.activeElement !== attachment) { - _crossvent2.default[op](attachment, 'focus', loading); + _crossvent["default"][op](attachment, 'focus', loading); } else { loading(); } + if (anyInput) { - _crossvent2.default[op](attachment, 'keypress', deferredShow); - _crossvent2.default[op](attachment, 'keypress', deferredFiltering); - _crossvent2.default[op](attachment, 'keydown', deferredFilteringNoEnter); - _crossvent2.default[op](attachment, 'paste', function (ev) { + _crossvent["default"][op](attachment, 'keypress', deferredShow); + + _crossvent["default"][op](attachment, 'keypress', deferredFiltering); + + _crossvent["default"][op](attachment, 'keydown', deferredFilteringNoEnter); + + _crossvent["default"][op](attachment, 'paste', function (ev) { deferredShow(ev); deferredFiltering(ev); }); - _crossvent2.default[op](attachment, 'keydown', keydown); + + _crossvent["default"][op](attachment, 'keydown', keydown); + if (o.autoHideOnBlur) { - _crossvent2.default[op](attachment, 'keydown', hideOnBlur); + _crossvent["default"][op](attachment, 'keydown', hideOnBlur); } } else { - _crossvent2.default[op](attachment, 'click', toggler); - _crossvent2.default[op](docElement, 'keydown', keydown); + _crossvent["default"][op](attachment, 'click', toggler); + + _crossvent["default"][op](docElement, 'keydown', keydown); } + if (o.autoHideOnClick) { - _crossvent2.default[op](doc, 'click', hideOnClick); + _crossvent["default"][op](doc, 'click', hideOnClick); } + if (form) { - _crossvent2.default[op](form, 'submit', hide); + _crossvent["default"][op](form, 'submit', hide); } } function destroy() { inputEvents(true); + if (parent.contains(container)) { parent.removeChild(container); } @@ -978,25 +1053,31 @@ function autocomplete(el) { function defaultFilter(q, suggestion) { var needle = q.toLowerCase(); var text = getText(suggestion) || ''; - if ((0, _fuzzysearch2.default)(needle, text.toLowerCase())) { + + if ((0, _fuzzysearch["default"])(needle, text.toLowerCase())) { return true; } + var value = getValue(suggestion) || ''; + if (typeof value !== 'string') { return false; } - return (0, _fuzzysearch2.default)(needle, value.toLowerCase()); + + return (0, _fuzzysearch["default"])(needle, value.toLowerCase()); } function loopbackToAnchor(text, p) { var result = ''; var anchored = false; var start = p.start; + while (anchored === false && start >= 0) { result = text.substr(start - 1, p.start - start + 1); anchored = ranchorleft.test(result); start--; } + return { text: anchored ? result : null, start: start @@ -1004,23 +1085,29 @@ function autocomplete(el) { } function filterAnchoredText(q, suggestion) { - var position = (0, _sell2.default)(el); + var position = (0, _sell["default"])(el); var input = loopbackToAnchor(q, position).text; + if (input) { - return { input: input, suggestion: suggestion }; + return { + input: input, + suggestion: suggestion + }; } } function appendText(value) { var current = el.value; - var position = (0, _sell2.default)(el); + var position = (0, _sell["default"])(el); var input = loopbackToAnchor(current, position); var left = current.substr(0, input.start); var right = current.substr(input.start + input.text.length + (position.end - position.start)); var before = left + value + ' '; - el.value = before + right; - (0, _sell2.default)(el, { start: before.length, end: before.length }); + (0, _sell["default"])(el, { + start: before.length, + end: before.length + }); } function filterAnchoredHTML() { @@ -1032,7 +1119,7 @@ function autocomplete(el) { } function findList(category) { - return (0, _sektor2.default)('.sey-list', category)[0]; + return (0, _sektor["default"])('.sey-list', category)[0]; } } @@ -1051,544 +1138,402 @@ function defer(fn) { setTimeout(fn, 0); }; } + function text(el, value) { el.innerText = el.textContent = value; } function isEditable(el) { var value = el.getAttribute('contentEditable'); + if (value === 'false') { return false; } + if (value === 'true') { return true; } + if (el.parentElement) { return isEditable(el.parentElement); } + return false; } module.exports = horsey; -},{"bullseye":10,"contra/emitter":17,"crossvent":18,"fuzzysearch":21,"hash-sum":22,"lodash/debounce":2,"sektor":24,"sell":33}],2:[function(require,module,exports){ -var isObject = require('./isObject'), - now = require('./now'), - toNumber = require('./toNumber'); +},{"bullseye":3,"contra/emitter":7,"crossvent":8,"fuzzysearch":11,"hash-sum":12,"lodash/debounce":19,"sektor":26,"sell":35}],2:[function(require,module,exports){ +module.exports = function atoa (a, n) { return Array.prototype.slice.call(a, n); } -/** Used as the `TypeError` message for "Functions" methods. */ -var FUNC_ERROR_TEXT = 'Expected a function'; +},{}],3:[function(require,module,exports){ +'use strict'; -/* Built-in method references for those with the same name as other `lodash` methods. */ -var nativeMax = Math.max, - nativeMin = Math.min; +var crossvent = require('crossvent'); +var throttle = require('./throttle'); +var tailormade = require('./tailormade'); -/** - * Creates a debounced function that delays invoking `func` until after `wait` - * milliseconds have elapsed since the last time the debounced function was - * invoked. The debounced function comes with a `cancel` method to cancel - * delayed `func` invocations and a `flush` method to immediately invoke them. - * Provide an options object to indicate whether `func` should be invoked on - * the leading and/or trailing edge of the `wait` timeout. The `func` is invoked - * with the last arguments provided to the debounced function. Subsequent calls - * to the debounced function return the result of the last `func` invocation. - * - * **Note:** If `leading` and `trailing` options are `true`, `func` is invoked - * on the trailing edge of the timeout only if the debounced function is - * invoked more than once during the `wait` timeout. - * - * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) - * for details over the differences between `_.debounce` and `_.throttle`. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Function - * @param {Function} func The function to debounce. - * @param {number} [wait=0] The number of milliseconds to delay. - * @param {Object} [options={}] The options object. - * @param {boolean} [options.leading=false] - * Specify invoking on the leading edge of the timeout. - * @param {number} [options.maxWait] - * The maximum time `func` is allowed to be delayed before it's invoked. - * @param {boolean} [options.trailing=true] - * Specify invoking on the trailing edge of the timeout. - * @returns {Function} Returns the new debounced function. - * @example - * - * // Avoid costly calculations while the window size is in flux. - * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); - * - * // Invoke `sendMail` when clicked, debouncing subsequent calls. - * jQuery(element).on('click', _.debounce(sendMail, 300, { - * 'leading': true, - * 'trailing': false - * })); - * - * // Ensure `batchLog` is invoked once after 1 second of debounced calls. - * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 }); - * var source = new EventSource('/stream'); - * jQuery(source).on('message', debounced); - * - * // Cancel the trailing debounced invocation. - * jQuery(window).on('popstate', debounced.cancel); - */ -function debounce(func, wait, options) { - var lastArgs, - lastThis, - maxWait, - result, - timerId, - lastCallTime, - lastInvokeTime = 0, - leading = false, - maxing = false, - trailing = true; +function bullseye (el, target, options) { + var o = options; + var domTarget = target && target.tagName; - if (typeof func != 'function') { - throw new TypeError(FUNC_ERROR_TEXT); - } - wait = toNumber(wait) || 0; - if (isObject(options)) { - leading = !!options.leading; - maxing = 'maxWait' in options; - maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait; - trailing = 'trailing' in options ? !!options.trailing : trailing; + if (!domTarget && arguments.length === 2) { + o = target; } - - function invokeFunc(time) { - var args = lastArgs, - thisArg = lastThis; - - lastArgs = lastThis = undefined; - lastInvokeTime = time; - result = func.apply(thisArg, args); - return result; + if (!domTarget) { + target = el; } + if (!o) { o = {}; } - function leadingEdge(time) { - // Reset any `maxWait` timer. - lastInvokeTime = time; - // Start the timer for the trailing edge. - timerId = setTimeout(timerExpired, wait); - // Invoke the leading edge. - return leading ? invokeFunc(time) : result; - } + var destroyed = false; + var throttledWrite = throttle(write, 30); + var tailorOptions = { update: o.autoupdateToCaret !== false && update }; + var tailor = o.caret && tailormade(target, tailorOptions); - function remainingWait(time) { - var timeSinceLastCall = time - lastCallTime, - timeSinceLastInvoke = time - lastInvokeTime, - result = wait - timeSinceLastCall; + write(); - return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result; + if (o.tracking !== false) { + crossvent.add(window, 'resize', throttledWrite); } - function shouldInvoke(time) { - var timeSinceLastCall = time - lastCallTime, - timeSinceLastInvoke = time - lastInvokeTime; + return { + read: readNull, + refresh: write, + destroy: destroy, + sleep: sleep + }; - // Either this is the first call, activity has stopped and we're at the - // trailing edge, the system time has gone backwards and we're treating - // it as the trailing edge, or we've hit the `maxWait` limit. - return (lastCallTime === undefined || (timeSinceLastCall >= wait) || - (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); + function sleep () { + tailorOptions.sleeping = true; } - function timerExpired() { - var time = now(); - if (shouldInvoke(time)) { - return trailingEdge(time); + function readNull () { return read(); } + + function read (readings) { + var bounds = target.getBoundingClientRect(); + var scrollTop = document.body.scrollTop || document.documentElement.scrollTop; + if (tailor) { + readings = tailor.read(); + return { + x: (readings.absolute ? 0 : bounds.left) + readings.x, + y: (readings.absolute ? 0 : bounds.top) + scrollTop + readings.y + 20 + }; } - // Restart the timer. - timerId = setTimeout(timerExpired, remainingWait(time)); + return { + x: bounds.left, + y: bounds.top + scrollTop + }; } - function trailingEdge(time) { - timerId = undefined; + function update (readings) { + write(readings); + } - // Only invoke if we have `lastArgs` which means `func` has been - // debounced at least once. - if (trailing && lastArgs) { - return invokeFunc(time); + function write (readings) { + if (destroyed) { + throw new Error('Bullseye can\'t refresh after being destroyed. Create another instance instead.'); } - lastArgs = lastThis = undefined; - return result; + if (tailor && !readings) { + tailorOptions.sleeping = false; + tailor.refresh(); return; + } + var p = read(readings); + if (!tailor && target !== el) { + p.y += target.offsetHeight; + } + var context = o.context; + el.style.left = p.x + 'px'; + el.style.top = (context ? context.offsetHeight : p.y) + 'px'; } - function cancel() { - lastInvokeTime = 0; - lastArgs = lastCallTime = lastThis = timerId = undefined; + function destroy () { + if (tailor) { tailor.destroy(); } + crossvent.remove(window, 'resize', throttledWrite); + destroyed = true; } +} - function flush() { - return timerId === undefined ? result : trailingEdge(now()); - } +module.exports = bullseye; - function debounced() { - var time = now(), - isInvoking = shouldInvoke(time); +},{"./tailormade":4,"./throttle":5,"crossvent":8}],4:[function(require,module,exports){ +(function (global){ +'use strict'; - lastArgs = arguments; - lastThis = this; - lastCallTime = time; +var sell = require('sell'); +var crossvent = require('crossvent'); +var seleccion = require('seleccion'); +var throttle = require('./throttle'); +var getSelection = seleccion.get; +var props = [ + 'direction', + 'boxSizing', + 'width', + 'height', + 'overflowX', + 'overflowY', + 'borderTopWidth', + 'borderRightWidth', + 'borderBottomWidth', + 'borderLeftWidth', + 'paddingTop', + 'paddingRight', + 'paddingBottom', + 'paddingLeft', + 'fontStyle', + 'fontVariant', + 'fontWeight', + 'fontStretch', + 'fontSize', + 'fontSizeAdjust', + 'lineHeight', + 'fontFamily', + 'textAlign', + 'textTransform', + 'textIndent', + 'textDecoration', + 'letterSpacing', + 'wordSpacing' +]; +var win = global; +var doc = document; +var ff = win.mozInnerScreenX !== null && win.mozInnerScreenX !== void 0; - if (isInvoking) { - if (timerId === undefined) { - return leadingEdge(lastCallTime); +function tailormade (el, options) { + var textInput = el.tagName === 'INPUT' || el.tagName === 'TEXTAREA'; + var throttledRefresh = throttle(refresh, 30); + var o = options || {}; + + bind(); + + return { + read: readPosition, + refresh: throttledRefresh, + destroy: destroy + }; + + function noop () {} + function readPosition () { return (textInput ? coordsText : coordsHTML)(); } + + function refresh () { + if (o.sleeping) { + return; + } + return (o.update || noop)(readPosition()); + } + + function coordsText () { + var p = sell(el); + var context = prepare(); + var readings = readTextCoords(context, p.start); + doc.body.removeChild(context.mirror); + return readings; + } + + function coordsHTML () { + var sel = getSelection(); + if (sel.rangeCount) { + var range = sel.getRangeAt(0); + var needsToWorkAroundNewlineBug = range.startContainer.nodeName === 'P' && range.startOffset === 0; + if (needsToWorkAroundNewlineBug) { + return { + x: range.startContainer.offsetLeft, + y: range.startContainer.offsetTop, + absolute: true + }; } - if (maxing) { - // Handle invocations in a tight loop. - timerId = setTimeout(timerExpired, wait); - return invokeFunc(lastCallTime); + if (range.getClientRects) { + var rects = range.getClientRects(); + if (rects.length > 0) { + return { + x: rects[0].left, + y: rects[0].top, + absolute: true + }; + } } } - if (timerId === undefined) { - timerId = setTimeout(timerExpired, wait); - } - return result; + return { x: 0, y: 0 }; } - debounced.cancel = cancel; - debounced.flush = flush; - return debounced; -} -module.exports = debounce; + function readTextCoords (context, p) { + var rest = doc.createElement('span'); + var mirror = context.mirror; + var computed = context.computed; -},{"./isObject":4,"./now":7,"./toNumber":8}],3:[function(require,module,exports){ -var isObject = require('./isObject'); + write(mirror, read(el).substring(0, p)); -/** `Object#toString` result references. */ -var funcTag = '[object Function]', - genTag = '[object GeneratorFunction]'; + if (el.tagName === 'INPUT') { + mirror.textContent = mirror.textContent.replace(/\s/g, '\u00a0'); + } -/** Used for built-in method references. */ -var objectProto = Object.prototype; + write(rest, read(el).substring(p) || '.'); -/** - * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) - * of values. - */ -var objectToString = objectProto.toString; + mirror.appendChild(rest); -/** - * Checks if `value` is classified as a `Function` object. - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, - * else `false`. - * @example - * - * _.isFunction(_); - * // => true - * - * _.isFunction(/abc/); - * // => false - */ -function isFunction(value) { - // The use of `Object#toString` avoids issues with the `typeof` operator - // in Safari 8 which returns 'object' for typed array and weak map constructors, - // and PhantomJS 1.9 which returns 'function' for `NodeList` instances. - var tag = isObject(value) ? objectToString.call(value) : ''; - return tag == funcTag || tag == genTag; -} - -module.exports = isFunction; - -},{"./isObject":4}],4:[function(require,module,exports){ -/** - * Checks if `value` is the - * [language type](http://www.ecma-international.org/ecma-262/6.0/#sec-ecmascript-language-types) - * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) - * - * @static - * @memberOf _ - * @since 0.1.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is an object, else `false`. - * @example - * - * _.isObject({}); - * // => true - * - * _.isObject([1, 2, 3]); - * // => true - * - * _.isObject(_.noop); - * // => true - * - * _.isObject(null); - * // => false - */ -function isObject(value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); -} - -module.exports = isObject; + return { + x: rest.offsetLeft + parseInt(computed['borderLeftWidth']), + y: rest.offsetTop + parseInt(computed['borderTopWidth']) + }; + } -},{}],5:[function(require,module,exports){ -/** - * Checks if `value` is object-like. A value is object-like if it's not `null` - * and has a `typeof` result of "object". - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is object-like, else `false`. - * @example - * - * _.isObjectLike({}); - * // => true - * - * _.isObjectLike([1, 2, 3]); - * // => true - * - * _.isObjectLike(_.noop); - * // => false - * - * _.isObjectLike(null); - * // => false - */ -function isObjectLike(value) { - return !!value && typeof value == 'object'; -} + function read (el) { + return textInput ? el.value : el.innerHTML; + } -module.exports = isObjectLike; + function prepare () { + var computed = win.getComputedStyle ? getComputedStyle(el) : el.currentStyle; + var mirror = doc.createElement('div'); + var style = mirror.style; -},{}],6:[function(require,module,exports){ -var isObjectLike = require('./isObjectLike'); + doc.body.appendChild(mirror); -/** `Object#toString` result references. */ -var symbolTag = '[object Symbol]'; + if (el.tagName !== 'INPUT') { + style.wordWrap = 'break-word'; + } + style.whiteSpace = 'pre-wrap'; + style.position = 'absolute'; + style.visibility = 'hidden'; + props.forEach(copy); -/** Used for built-in method references. */ -var objectProto = Object.prototype; + if (ff) { + style.width = parseInt(computed.width) - 2 + 'px'; + if (el.scrollHeight > parseInt(computed.height)) { + style.overflowY = 'scroll'; + } + } else { + style.overflow = 'hidden'; + } + return { mirror: mirror, computed: computed }; -/** - * Used to resolve the - * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring) - * of values. - */ -var objectToString = objectProto.toString; + function copy (prop) { + style[prop] = computed[prop]; + } + } -/** - * Checks if `value` is classified as a `Symbol` primitive or object. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to check. - * @returns {boolean} Returns `true` if `value` is correctly classified, - * else `false`. - * @example - * - * _.isSymbol(Symbol.iterator); - * // => true - * - * _.isSymbol('abc'); - * // => false - */ -function isSymbol(value) { - return typeof value == 'symbol' || - (isObjectLike(value) && objectToString.call(value) == symbolTag); -} + function write (el, value) { + if (textInput) { + el.textContent = value; + } else { + el.innerHTML = value; + } + } -module.exports = isSymbol; + function bind (remove) { + var op = remove ? 'remove' : 'add'; + crossvent[op](el, 'keydown', throttledRefresh); + crossvent[op](el, 'keyup', throttledRefresh); + crossvent[op](el, 'input', throttledRefresh); + crossvent[op](el, 'paste', throttledRefresh); + crossvent[op](el, 'change', throttledRefresh); + } -},{"./isObjectLike":5}],7:[function(require,module,exports){ -/** - * Gets the timestamp of the number of milliseconds that have elapsed since - * the Unix epoch (1 January 1970 00:00:00 UTC). - * - * @static - * @memberOf _ - * @since 2.4.0 - * @category Date - * @returns {number} Returns the timestamp. - * @example - * - * _.defer(function(stamp) { - * console.log(_.now() - stamp); - * }, _.now()); - * // => Logs the number of milliseconds it took for the deferred invocation. - */ -function now() { - return Date.now(); + function destroy () { + bind(true); + } } -module.exports = now; - -},{}],8:[function(require,module,exports){ -var isFunction = require('./isFunction'), - isObject = require('./isObject'), - isSymbol = require('./isSymbol'); - -/** Used as references for various `Number` constants. */ -var NAN = 0 / 0; +module.exports = tailormade; -/** Used to match leading and trailing whitespace. */ -var reTrim = /^\s+|\s+$/g; +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -/** Used to detect bad signed hexadecimal string values. */ -var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; +},{"./throttle":5,"crossvent":8,"seleccion":33,"sell":35}],5:[function(require,module,exports){ +'use strict'; -/** Used to detect binary string values. */ -var reIsBinary = /^0b[01]+$/i; +function throttle (fn, boundary) { + var last = -Infinity; + var timer; + return function bounced () { + if (timer) { + return; + } + unbound(); -/** Used to detect octal string values. */ -var reIsOctal = /^0o[0-7]+$/i; + function unbound () { + clearTimeout(timer); + timer = null; + var next = last + boundary; + var now = Date.now(); + if (now > next) { + last = now; + fn(); + } else { + timer = setTimeout(unbound, next - now); + } + } + }; +} -/** Built-in method references without a dependency on `root`. */ -var freeParseInt = parseInt; +module.exports = throttle; -/** - * Converts `value` to a number. - * - * @static - * @memberOf _ - * @since 4.0.0 - * @category Lang - * @param {*} value The value to process. - * @returns {number} Returns the number. - * @example - * - * _.toNumber(3.2); - * // => 3.2 - * - * _.toNumber(Number.MIN_VALUE); - * // => 5e-324 - * - * _.toNumber(Infinity); - * // => Infinity - * - * _.toNumber('3.2'); - * // => 3.2 - */ -function toNumber(value) { - if (typeof value == 'number') { - return value; - } - if (isSymbol(value)) { - return NAN; - } - if (isObject(value)) { - var other = isFunction(value.valueOf) ? value.valueOf() : value; - value = isObject(other) ? (other + '') : other; - } - if (typeof value != 'string') { - return value === 0 ? value : +value; - } - value = value.replace(reTrim, ''); - var isBinary = reIsBinary.test(value); - return (isBinary || reIsOctal.test(value)) - ? freeParseInt(value.slice(2), isBinary ? 2 : 8) - : (reIsBadHex.test(value) ? NAN : +value); -} +},{}],6:[function(require,module,exports){ +'use strict'; -module.exports = toNumber; +var ticky = require('ticky'); -},{"./isFunction":3,"./isObject":4,"./isSymbol":6}],9:[function(require,module,exports){ -module.exports = function atoa (a, n) { return Array.prototype.slice.call(a, n); } +module.exports = function debounce (fn, args, ctx) { + if (!fn) { return; } + ticky(function run () { + fn.apply(ctx || null, args || []); + }); +}; -},{}],10:[function(require,module,exports){ +},{"ticky":36}],7:[function(require,module,exports){ 'use strict'; -var crossvent = require('crossvent'); -var throttle = require('./throttle'); -var tailormade = require('./tailormade'); +var atoa = require('atoa'); +var debounce = require('./debounce'); -function bullseye (el, target, options) { - var o = options; - var domTarget = target && target.tagName; - - if (!domTarget && arguments.length === 2) { - o = target; - } - if (!domTarget) { - target = el; - } - if (!o) { o = {}; } - - var destroyed = false; - var throttledWrite = throttle(write, 30); - var tailorOptions = { update: o.autoupdateToCaret !== false && update }; - var tailor = o.caret && tailormade(target, tailorOptions); - - write(); - - if (o.tracking !== false) { - crossvent.add(window, 'resize', throttledWrite); - } - - return { - read: readNull, - refresh: write, - destroy: destroy, - sleep: sleep +module.exports = function emitter (thing, options) { + var opts = options || {}; + var evt = {}; + if (thing === undefined) { thing = {}; } + thing.on = function (type, fn) { + if (!evt[type]) { + evt[type] = [fn]; + } else { + evt[type].push(fn); + } + return thing; }; - - function sleep () { - tailorOptions.sleeping = true; - } - - function readNull () { return read(); } - - function read (readings) { - var bounds = target.getBoundingClientRect(); - var scrollTop = document.body.scrollTop || document.documentElement.scrollTop; - if (tailor) { - readings = tailor.read(); - return { - x: (readings.absolute ? 0 : bounds.left) + readings.x, - y: (readings.absolute ? 0 : bounds.top) + scrollTop + readings.y + 20 - }; + thing.once = function (type, fn) { + fn._once = true; // thing.off(fn) still works! + thing.on(type, fn); + return thing; + }; + thing.off = function (type, fn) { + var c = arguments.length; + if (c === 1) { + delete evt[type]; + } else if (c === 0) { + evt = {}; + } else { + var et = evt[type]; + if (!et) { return thing; } + et.splice(et.indexOf(fn), 1); } - return { - x: bounds.left, - y: bounds.top + scrollTop + return thing; + }; + thing.emit = function () { + var args = atoa(arguments); + return thing.emitterSnapshot(args.shift()).apply(this, args); + }; + thing.emitterSnapshot = function (type) { + var et = (evt[type] || []).slice(0); + return function () { + var args = atoa(arguments); + var ctx = this || thing; + if (type === 'error' && opts.throws !== false && !et.length) { throw args.length === 1 ? args[0] : args; } + et.forEach(function emitter (listen) { + if (opts.async) { debounce(listen, args, ctx); } else { listen.apply(ctx, args); } + if (listen._once) { thing.off(type, listen); } + }); + return thing; }; - } - - function update (readings) { - write(readings); - } - - function write (readings) { - if (destroyed) { - throw new Error('Bullseye can\'t refresh after being destroyed. Create another instance instead.'); - } - if (tailor && !readings) { - tailorOptions.sleeping = false; - tailor.refresh(); return; - } - var p = read(readings); - if (!tailor && target !== el) { - p.y += target.offsetHeight; - } - var context = o.context; - el.style.left = p.x + 'px'; - el.style.top = (context ? context.offsetHeight : p.y) + 'px'; - } - - function destroy () { - if (tailor) { tailor.destroy(); } - crossvent.remove(window, 'resize', throttledWrite); - destroyed = true; - } -} - -module.exports = bullseye; + }; + return thing; +}; -},{"./tailormade":14,"./throttle":15,"crossvent":11}],11:[function(require,module,exports){ +},{"./debounce":6,"atoa":2}],8:[function(require,module,exports){ (function (global){ 'use strict'; @@ -1694,7 +1639,7 @@ function find (el, type, fn) { }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./eventmap":12,"custom-event":13}],12:[function(require,module,exports){ +},{"./eventmap":9,"custom-event":10}],9:[function(require,module,exports){ (function (global){ 'use strict'; @@ -1712,7 +1657,7 @@ module.exports = eventmap; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],13:[function(require,module,exports){ +},{}],10:[function(require,module,exports){ (function (global){ var NativeCustomEvent = global.CustomEvent; @@ -1765,548 +1710,615 @@ function CustomEvent (type, params) { }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],14:[function(require,module,exports){ -(function (global){ +},{}],11:[function(require,module,exports){ 'use strict'; -var sell = require('sell'); -var crossvent = require('crossvent'); -var seleccion = require('seleccion'); -var throttle = require('./throttle'); -var getSelection = seleccion.get; -var props = [ - 'direction', - 'boxSizing', - 'width', - 'height', - 'overflowX', - 'overflowY', - 'borderTopWidth', - 'borderRightWidth', - 'borderBottomWidth', - 'borderLeftWidth', - 'paddingTop', - 'paddingRight', - 'paddingBottom', - 'paddingLeft', - 'fontStyle', - 'fontVariant', - 'fontWeight', - 'fontStretch', - 'fontSize', - 'fontSizeAdjust', - 'lineHeight', - 'fontFamily', - 'textAlign', - 'textTransform', - 'textIndent', - 'textDecoration', - 'letterSpacing', - 'wordSpacing' -]; -var win = global; -var doc = document; -var ff = win.mozInnerScreenX !== null && win.mozInnerScreenX !== void 0; - -function tailormade (el, options) { - var textInput = el.tagName === 'INPUT' || el.tagName === 'TEXTAREA'; - var throttledRefresh = throttle(refresh, 30); - var o = options || {}; - - bind(); - - return { - read: readPosition, - refresh: throttledRefresh, - destroy: destroy - }; - - function noop () {} - function readPosition () { return (textInput ? coordsText : coordsHTML)(); } - - function refresh () { - if (o.sleeping) { - return; - } - return (o.update || noop)(readPosition()); +function fuzzysearch (needle, haystack) { + var tlen = haystack.length; + var qlen = needle.length; + if (qlen > tlen) { + return false; } - - function coordsText () { - var p = sell(el); - var context = prepare(); - var readings = readTextCoords(context, p.start); - doc.body.removeChild(context.mirror); - return readings; + if (qlen === tlen) { + return needle === haystack; } - - function coordsHTML () { - var sel = getSelection(); - if (sel.rangeCount) { - var range = sel.getRangeAt(0); - var needsToWorkAroundNewlineBug = range.startContainer.nodeName === 'P' && range.startOffset === 0; - if (needsToWorkAroundNewlineBug) { - return { - x: range.startContainer.offsetLeft, - y: range.startContainer.offsetTop, - absolute: true - }; - } - if (range.getClientRects) { - var rects = range.getClientRects(); - if (rects.length > 0) { - return { - x: rects[0].left, - y: rects[0].top, - absolute: true - }; - } + outer: for (var i = 0, j = 0; i < qlen; i++) { + var nch = needle.charCodeAt(i); + while (j < tlen) { + if (haystack.charCodeAt(j++) === nch) { + continue outer; } } - return { x: 0, y: 0 }; + return false; } + return true; +} - function readTextCoords (context, p) { - var rest = doc.createElement('span'); - var mirror = context.mirror; - var computed = context.computed; - - write(mirror, read(el).substring(0, p)); - - if (el.tagName === 'INPUT') { - mirror.textContent = mirror.textContent.replace(/\s/g, '\u00a0'); - } - - write(rest, read(el).substring(p) || '.'); +module.exports = fuzzysearch; - mirror.appendChild(rest); +},{}],12:[function(require,module,exports){ +'use strict'; - return { - x: rest.offsetLeft + parseInt(computed['borderLeftWidth']), - y: rest.offsetTop + parseInt(computed['borderTopWidth']) - }; +function pad (hash, len) { + while (hash.length < len) { + hash = '0' + hash; } + return hash; +} - function read (el) { - return textInput ? el.value : el.innerHTML; +function fold (hash, text) { + var i; + var chr; + var len; + if (text.length === 0) { + return hash; } + for (i = 0, len = text.length; i < len; i++) { + chr = text.charCodeAt(i); + hash = ((hash << 5) - hash) + chr; + hash |= 0; + } + return hash < 0 ? hash * -2 : hash; +} - function prepare () { - var computed = win.getComputedStyle ? getComputedStyle(el) : el.currentStyle; - var mirror = doc.createElement('div'); - var style = mirror.style; - - doc.body.appendChild(mirror); +function foldObject (hash, o, seen) { + return Object.keys(o).sort().reduce(foldKey, hash); + function foldKey (hash, key) { + return foldValue(hash, o[key], key, seen); + } +} - if (el.tagName !== 'INPUT') { - style.wordWrap = 'break-word'; +function foldValue (input, value, key, seen) { + var hash = fold(fold(fold(input, key), toString(value)), typeof value); + if (value === null) { + return fold(hash, 'null'); + } + if (value === undefined) { + return fold(hash, 'undefined'); + } + if (typeof value === 'object' || typeof value === 'function') { + if (seen.indexOf(value) !== -1) { + return fold(hash, '[Circular]' + key); } - style.whiteSpace = 'pre-wrap'; - style.position = 'absolute'; - style.visibility = 'hidden'; - props.forEach(copy); + seen.push(value); - if (ff) { - style.width = parseInt(computed.width) - 2 + 'px'; - if (el.scrollHeight > parseInt(computed.height)) { - style.overflowY = 'scroll'; - } - } else { - style.overflow = 'hidden'; - } - return { mirror: mirror, computed: computed }; + var objHash = foldObject(hash, value, seen) - function copy (prop) { - style[prop] = computed[prop]; + if (!('valueOf' in value) || typeof value.valueOf !== 'function') { + return objHash; } - } - function write (el, value) { - if (textInput) { - el.textContent = value; - } else { - el.innerHTML = value; + try { + return fold(objHash, String(value.valueOf())) + } catch (err) { + return fold(objHash, '[valueOf exception]' + (err.stack || err.message)) } } + return fold(hash, value.toString()); +} - function bind (remove) { - var op = remove ? 'remove' : 'add'; - crossvent[op](el, 'keydown', throttledRefresh); - crossvent[op](el, 'keyup', throttledRefresh); - crossvent[op](el, 'input', throttledRefresh); - crossvent[op](el, 'paste', throttledRefresh); - crossvent[op](el, 'change', throttledRefresh); - } +function toString (o) { + return Object.prototype.toString.call(o); +} - function destroy () { - bind(true); - } +function sum (o) { + return pad(foldValue(0, o, '', []).toString(16), 8); } -module.exports = tailormade; +module.exports = sum; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],13:[function(require,module,exports){ +var root = require('./_root'); -},{"./throttle":15,"crossvent":11,"seleccion":31,"sell":33}],15:[function(require,module,exports){ -'use strict'; +/** Built-in value references. */ +var Symbol = root.Symbol; -function throttle (fn, boundary) { - var last = -Infinity; - var timer; - return function bounced () { - if (timer) { - return; - } - unbound(); +module.exports = Symbol; - function unbound () { - clearTimeout(timer); - timer = null; - var next = last + boundary; - var now = Date.now(); - if (now > next) { - last = now; - fn(); - } else { - timer = setTimeout(unbound, next - now); - } - } - }; +},{"./_root":18}],14:[function(require,module,exports){ +var Symbol = require('./_Symbol'), + getRawTag = require('./_getRawTag'), + objectToString = require('./_objectToString'); + +/** `Object#toString` result references. */ +var nullTag = '[object Null]', + undefinedTag = '[object Undefined]'; + +/** Built-in value references. */ +var symToStringTag = Symbol ? Symbol.toStringTag : undefined; + +/** + * The base implementation of `getTag` without fallbacks for buggy environments. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the `toStringTag`. + */ +function baseGetTag(value) { + if (value == null) { + return value === undefined ? undefinedTag : nullTag; + } + return (symToStringTag && symToStringTag in Object(value)) + ? getRawTag(value) + : objectToString(value); } -module.exports = throttle; +module.exports = baseGetTag; + +},{"./_Symbol":13,"./_getRawTag":16,"./_objectToString":17}],15:[function(require,module,exports){ +(function (global){ +/** Detect free variable `global` from Node.js. */ +var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; + +module.exports = freeGlobal; + +}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{}],16:[function(require,module,exports){ -'use strict'; +var Symbol = require('./_Symbol'); -var ticky = require('ticky'); +/** Used for built-in method references. */ +var objectProto = Object.prototype; -module.exports = function debounce (fn, args, ctx) { - if (!fn) { return; } - ticky(function run () { - fn.apply(ctx || null, args || []); - }); -}; +/** Used to check objects for own properties. */ +var hasOwnProperty = objectProto.hasOwnProperty; -},{"ticky":34}],17:[function(require,module,exports){ -'use strict'; +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ +var nativeObjectToString = objectProto.toString; -var atoa = require('atoa'); -var debounce = require('./debounce'); +/** Built-in value references. */ +var symToStringTag = Symbol ? Symbol.toStringTag : undefined; -module.exports = function emitter (thing, options) { - var opts = options || {}; - var evt = {}; - if (thing === undefined) { thing = {}; } - thing.on = function (type, fn) { - if (!evt[type]) { - evt[type] = [fn]; - } else { - evt[type].push(fn); - } - return thing; - }; - thing.once = function (type, fn) { - fn._once = true; // thing.off(fn) still works! - thing.on(type, fn); - return thing; - }; - thing.off = function (type, fn) { - var c = arguments.length; - if (c === 1) { - delete evt[type]; - } else if (c === 0) { - evt = {}; +/** + * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. + * + * @private + * @param {*} value The value to query. + * @returns {string} Returns the raw `toStringTag`. + */ +function getRawTag(value) { + var isOwn = hasOwnProperty.call(value, symToStringTag), + tag = value[symToStringTag]; + + try { + value[symToStringTag] = undefined; + var unmasked = true; + } catch (e) {} + + var result = nativeObjectToString.call(value); + if (unmasked) { + if (isOwn) { + value[symToStringTag] = tag; } else { - var et = evt[type]; - if (!et) { return thing; } - et.splice(et.indexOf(fn), 1); + delete value[symToStringTag]; } - return thing; - }; - thing.emit = function () { - var args = atoa(arguments); - return thing.emitterSnapshot(args.shift()).apply(this, args); - }; - thing.emitterSnapshot = function (type) { - var et = (evt[type] || []).slice(0); - return function () { - var args = atoa(arguments); - var ctx = this || thing; - if (type === 'error' && opts.throws !== false && !et.length) { throw args.length === 1 ? args[0] : args; } - et.forEach(function emitter (listen) { - if (opts.async) { debounce(listen, args, ctx); } else { listen.apply(ctx, args); } - if (listen._once) { thing.off(type, listen); } - }); - return thing; - }; - }; - return thing; -}; + } + return result; +} -},{"./debounce":16,"atoa":9}],18:[function(require,module,exports){ -(function (global){ -'use strict'; +module.exports = getRawTag; -var customEvent = require('custom-event'); -var eventmap = require('./eventmap'); -var doc = global.document; -var addEvent = addEventEasy; -var removeEvent = removeEventEasy; -var hardCache = []; +},{"./_Symbol":13}],17:[function(require,module,exports){ +/** Used for built-in method references. */ +var objectProto = Object.prototype; -if (!global.addEventListener) { - addEvent = addEventHard; - removeEvent = removeEventHard; +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ +var nativeObjectToString = objectProto.toString; + +/** + * Converts `value` to a string using `Object.prototype.toString`. + * + * @private + * @param {*} value The value to convert. + * @returns {string} Returns the converted string. + */ +function objectToString(value) { + return nativeObjectToString.call(value); } -module.exports = { - add: addEvent, - remove: removeEvent, - fabricate: fabricateEvent -}; +module.exports = objectToString; -function addEventEasy (el, type, fn, capturing) { - return el.addEventListener(type, fn, capturing); -} +},{}],18:[function(require,module,exports){ +var freeGlobal = require('./_freeGlobal'); -function addEventHard (el, type, fn) { - return el.attachEvent('on' + type, wrap(el, type, fn)); -} +/** Detect free variable `self`. */ +var freeSelf = typeof self == 'object' && self && self.Object === Object && self; -function removeEventEasy (el, type, fn, capturing) { - return el.removeEventListener(type, fn, capturing); -} +/** Used as a reference to the global object. */ +var root = freeGlobal || freeSelf || Function('return this')(); -function removeEventHard (el, type, fn) { - var listener = unwrap(el, type, fn); - if (listener) { - return el.detachEvent('on' + type, listener); +module.exports = root; + +},{"./_freeGlobal":15}],19:[function(require,module,exports){ +var isObject = require('./isObject'), + now = require('./now'), + toNumber = require('./toNumber'); + +/** Error message constants. */ +var FUNC_ERROR_TEXT = 'Expected a function'; + +/* Built-in method references for those with the same name as other `lodash` methods. */ +var nativeMax = Math.max, + nativeMin = Math.min; + +/** + * Creates a debounced function that delays invoking `func` until after `wait` + * milliseconds have elapsed since the last time the debounced function was + * invoked. The debounced function comes with a `cancel` method to cancel + * delayed `func` invocations and a `flush` method to immediately invoke them. + * Provide `options` to indicate whether `func` should be invoked on the + * leading and/or trailing edge of the `wait` timeout. The `func` is invoked + * with the last arguments provided to the debounced function. Subsequent + * calls to the debounced function return the result of the last `func` + * invocation. + * + * **Note:** If `leading` and `trailing` options are `true`, `func` is + * invoked on the trailing edge of the timeout only if the debounced function + * is invoked more than once during the `wait` timeout. + * + * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred + * until to the next tick, similar to `setTimeout` with a timeout of `0`. + * + * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) + * for details over the differences between `_.debounce` and `_.throttle`. + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Function + * @param {Function} func The function to debounce. + * @param {number} [wait=0] The number of milliseconds to delay. + * @param {Object} [options={}] The options object. + * @param {boolean} [options.leading=false] + * Specify invoking on the leading edge of the timeout. + * @param {number} [options.maxWait] + * The maximum time `func` is allowed to be delayed before it's invoked. + * @param {boolean} [options.trailing=true] + * Specify invoking on the trailing edge of the timeout. + * @returns {Function} Returns the new debounced function. + * @example + * + * // Avoid costly calculations while the window size is in flux. + * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); + * + * // Invoke `sendMail` when clicked, debouncing subsequent calls. + * jQuery(element).on('click', _.debounce(sendMail, 300, { + * 'leading': true, + * 'trailing': false + * })); + * + * // Ensure `batchLog` is invoked once after 1 second of debounced calls. + * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 }); + * var source = new EventSource('/stream'); + * jQuery(source).on('message', debounced); + * + * // Cancel the trailing debounced invocation. + * jQuery(window).on('popstate', debounced.cancel); + */ +function debounce(func, wait, options) { + var lastArgs, + lastThis, + maxWait, + result, + timerId, + lastCallTime, + lastInvokeTime = 0, + leading = false, + maxing = false, + trailing = true; + + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + wait = toNumber(wait) || 0; + if (isObject(options)) { + leading = !!options.leading; + maxing = 'maxWait' in options; + maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait; + trailing = 'trailing' in options ? !!options.trailing : trailing; } -} -function fabricateEvent (el, type, model) { - var e = eventmap.indexOf(type) === -1 ? makeCustomEvent() : makeClassicEvent(); - if (el.dispatchEvent) { - el.dispatchEvent(e); - } else { - el.fireEvent('on' + type, e); + function invokeFunc(time) { + var args = lastArgs, + thisArg = lastThis; + + lastArgs = lastThis = undefined; + lastInvokeTime = time; + result = func.apply(thisArg, args); + return result; } - function makeClassicEvent () { - var e; - if (doc.createEvent) { - e = doc.createEvent('Event'); - e.initEvent(type, true, true); - } else if (doc.createEventObject) { - e = doc.createEventObject(); + + function leadingEdge(time) { + // Reset any `maxWait` timer. + lastInvokeTime = time; + // Start the timer for the trailing edge. + timerId = setTimeout(timerExpired, wait); + // Invoke the leading edge. + return leading ? invokeFunc(time) : result; + } + + function remainingWait(time) { + var timeSinceLastCall = time - lastCallTime, + timeSinceLastInvoke = time - lastInvokeTime, + timeWaiting = wait - timeSinceLastCall; + + return maxing + ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) + : timeWaiting; + } + + function shouldInvoke(time) { + var timeSinceLastCall = time - lastCallTime, + timeSinceLastInvoke = time - lastInvokeTime; + + // Either this is the first call, activity has stopped and we're at the + // trailing edge, the system time has gone backwards and we're treating + // it as the trailing edge, or we've hit the `maxWait` limit. + return (lastCallTime === undefined || (timeSinceLastCall >= wait) || + (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); + } + + function timerExpired() { + var time = now(); + if (shouldInvoke(time)) { + return trailingEdge(time); } - return e; + // Restart the timer. + timerId = setTimeout(timerExpired, remainingWait(time)); } - function makeCustomEvent () { - return new customEvent(type, { detail: model }); + + function trailingEdge(time) { + timerId = undefined; + + // Only invoke if we have `lastArgs` which means `func` has been + // debounced at least once. + if (trailing && lastArgs) { + return invokeFunc(time); + } + lastArgs = lastThis = undefined; + return result; } -} -function wrapperFactory (el, type, fn) { - return function wrapper (originalEvent) { - var e = originalEvent || global.event; - e.target = e.target || e.srcElement; - e.preventDefault = e.preventDefault || function preventDefault () { e.returnValue = false; }; - e.stopPropagation = e.stopPropagation || function stopPropagation () { e.cancelBubble = true; }; - e.which = e.which || e.keyCode; - fn.call(el, e); - }; -} + function cancel() { + if (timerId !== undefined) { + clearTimeout(timerId); + } + lastInvokeTime = 0; + lastArgs = lastCallTime = lastThis = timerId = undefined; + } -function wrap (el, type, fn) { - var wrapper = unwrap(el, type, fn) || wrapperFactory(el, type, fn); - hardCache.push({ - wrapper: wrapper, - element: el, - type: type, - fn: fn - }); - return wrapper; -} + function flush() { + return timerId === undefined ? result : trailingEdge(now()); + } -function unwrap (el, type, fn) { - var i = find(el, type, fn); - if (i) { - var wrapper = hardCache[i].wrapper; - hardCache.splice(i, 1); // free up a tad of memory - return wrapper; + function debounced() { + var time = now(), + isInvoking = shouldInvoke(time); + + lastArgs = arguments; + lastThis = this; + lastCallTime = time; + + if (isInvoking) { + if (timerId === undefined) { + return leadingEdge(lastCallTime); + } + if (maxing) { + // Handle invocations in a tight loop. + clearTimeout(timerId); + timerId = setTimeout(timerExpired, wait); + return invokeFunc(lastCallTime); + } + } + if (timerId === undefined) { + timerId = setTimeout(timerExpired, wait); + } + return result; } + debounced.cancel = cancel; + debounced.flush = flush; + return debounced; +} + +module.exports = debounce; + +},{"./isObject":20,"./now":23,"./toNumber":24}],20:[function(require,module,exports){ +/** + * Checks if `value` is the + * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) + * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @since 0.1.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(_.noop); + * // => true + * + * _.isObject(null); + * // => false + */ +function isObject(value) { + var type = typeof value; + return value != null && (type == 'object' || type == 'function'); } -function find (el, type, fn) { - var i, item; - for (i = 0; i < hardCache.length; i++) { - item = hardCache[i]; - if (item.element === el && item.type === type && item.fn === fn) { - return i; - } - } +module.exports = isObject; + +},{}],21:[function(require,module,exports){ +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return value != null && typeof value == 'object'; } -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +module.exports = isObjectLike; -},{"./eventmap":19,"custom-event":20}],19:[function(require,module,exports){ -(function (global){ -'use strict'; +},{}],22:[function(require,module,exports){ +var baseGetTag = require('./_baseGetTag'), + isObjectLike = require('./isObjectLike'); -var eventmap = []; -var eventname = ''; -var ron = /^on/; +/** `Object#toString` result references. */ +var symbolTag = '[object Symbol]'; -for (eventname in global) { - if (ron.test(eventname)) { - eventmap.push(eventname.slice(2)); - } +/** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ +function isSymbol(value) { + return typeof value == 'symbol' || + (isObjectLike(value) && baseGetTag(value) == symbolTag); } -module.exports = eventmap; - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) - -},{}],20:[function(require,module,exports){ -(function (global){ - -var NativeCustomEvent = global.CustomEvent; +module.exports = isSymbol; -function useNative () { - try { - var p = new NativeCustomEvent('cat', { detail: { foo: 'bar' } }); - return 'cat' === p.type && 'bar' === p.detail.foo; - } catch (e) { - } - return false; -} +},{"./_baseGetTag":14,"./isObjectLike":21}],23:[function(require,module,exports){ +var root = require('./_root'); /** - * Cross-browser `CustomEvent` constructor. + * Gets the timestamp of the number of milliseconds that have elapsed since + * the Unix epoch (1 January 1970 00:00:00 UTC). * - * https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent.CustomEvent + * @static + * @memberOf _ + * @since 2.4.0 + * @category Date + * @returns {number} Returns the timestamp. + * @example * - * @public + * _.defer(function(stamp) { + * console.log(_.now() - stamp); + * }, _.now()); + * // => Logs the number of milliseconds it took for the deferred invocation. */ +var now = function() { + return root.Date.now(); +}; -module.exports = useNative() ? NativeCustomEvent : - -// IE >= 9 -'function' === typeof document.createEvent ? function CustomEvent (type, params) { - var e = document.createEvent('CustomEvent'); - if (params) { - e.initCustomEvent(type, params.bubbles, params.cancelable, params.detail); - } else { - e.initCustomEvent(type, false, false, void 0); - } - return e; -} : - -// IE <= 8 -function CustomEvent (type, params) { - var e = document.createEventObject(); - e.type = type; - if (params) { - e.bubbles = Boolean(params.bubbles); - e.cancelable = Boolean(params.cancelable); - e.detail = params.detail; - } else { - e.bubbles = false; - e.cancelable = false; - e.detail = void 0; - } - return e; -} +module.exports = now; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{"./_root":18}],24:[function(require,module,exports){ +var isObject = require('./isObject'), + isSymbol = require('./isSymbol'); -},{}],21:[function(require,module,exports){ -'use strict'; +/** Used as references for various `Number` constants. */ +var NAN = 0 / 0; -function fuzzysearch (needle, haystack) { - var tlen = haystack.length; - var qlen = needle.length; - if (qlen > tlen) { - return false; - } - if (qlen === tlen) { - return needle === haystack; - } - outer: for (var i = 0, j = 0; i < qlen; i++) { - var nch = needle.charCodeAt(i); - while (j < tlen) { - if (haystack.charCodeAt(j++) === nch) { - continue outer; - } - } - return false; - } - return true; -} +/** Used to match leading and trailing whitespace. */ +var reTrim = /^\s+|\s+$/g; -module.exports = fuzzysearch; +/** Used to detect bad signed hexadecimal string values. */ +var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; -},{}],22:[function(require,module,exports){ -'use strict'; +/** Used to detect binary string values. */ +var reIsBinary = /^0b[01]+$/i; -function pad (hash, len) { - while (hash.length < len) { - hash = '0' + hash; - } - return hash; -} +/** Used to detect octal string values. */ +var reIsOctal = /^0o[0-7]+$/i; -function fold (hash, text) { - var i; - var chr; - var len; - if (text.length === 0) { - return hash; - } - for (i = 0, len = text.length; i < len; i++) { - chr = text.charCodeAt(i); - hash = ((hash << 5) - hash) + chr; - hash |= 0; - } - return hash < 0 ? hash * -2 : hash; -} +/** Built-in method references without a dependency on `root`. */ +var freeParseInt = parseInt; -function foldObject (hash, o, seen) { - return Object.keys(o).sort().reduce(foldKey, hash); - function foldKey (hash, key) { - return foldValue(hash, o[key], key, seen); +/** + * Converts `value` to a number. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to process. + * @returns {number} Returns the number. + * @example + * + * _.toNumber(3.2); + * // => 3.2 + * + * _.toNumber(Number.MIN_VALUE); + * // => 5e-324 + * + * _.toNumber(Infinity); + * // => Infinity + * + * _.toNumber('3.2'); + * // => 3.2 + */ +function toNumber(value) { + if (typeof value == 'number') { + return value; } -} - -function foldValue (input, value, key, seen) { - var hash = fold(fold(fold(input, key), toString(value)), typeof value); - if (value === null) { - return fold(hash, 'null'); + if (isSymbol(value)) { + return NAN; } - if (value === undefined) { - return fold(hash, 'undefined'); + if (isObject(value)) { + var other = typeof value.valueOf == 'function' ? value.valueOf() : value; + value = isObject(other) ? (other + '') : other; } - if (typeof value === 'object') { - if (seen.indexOf(value) !== -1) { - return fold(hash, '[Circular]' + key); - } - seen.push(value); - return foldObject(hash, value, seen); + if (typeof value != 'string') { + return value === 0 ? value : +value; } - return fold(hash, value.toString()); -} - -function toString (o) { - return Object.prototype.toString.call(o); -} - -function sum (o) { - return pad(foldValue(0, o, '', []).toString(16), 8); + value = value.replace(reTrim, ''); + var isBinary = reIsBinary.test(value); + return (isBinary || reIsOctal.test(value)) + ? freeParseInt(value.slice(2), isBinary ? 2 : 8) + : (reIsBadHex.test(value) ? NAN : +value); } -module.exports = sum; +module.exports = toNumber; -},{}],23:[function(require,module,exports){ +},{"./isObject":20,"./isSymbol":22}],25:[function(require,module,exports){ // shim for using process in browser var process = module.exports = {}; @@ -2492,14 +2504,14 @@ process.chdir = function (dir) { }; process.umask = function() { return 0; }; -},{}],24:[function(require,module,exports){ +},{}],26:[function(require,module,exports){ (function (global){ 'use strict'; var expando = 'sektor-' + Date.now(); var rsiblings = /[+~]/; var document = global.document; -var del = document.documentElement || {}; +var del = (document && document.documentElement) || {}; var match = ( del.matches || del.webkitMatchesSelector || @@ -2568,7 +2580,7 @@ function never () { return false; } }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],25:[function(require,module,exports){ +},{}],27:[function(require,module,exports){ (function (global){ 'use strict'; @@ -2590,7 +2602,7 @@ module.exports = getSelection; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./getSelectionNullOp":26,"./getSelectionRaw":27,"./getSelectionSynthetic":28,"./isHost":29}],26:[function(require,module,exports){ +},{"./getSelectionNullOp":28,"./getSelectionRaw":29,"./getSelectionSynthetic":30,"./isHost":31}],28:[function(require,module,exports){ 'use strict'; function noop () {} @@ -2604,7 +2616,7 @@ function getSelectionNullOp () { module.exports = getSelectionNullOp; -},{}],27:[function(require,module,exports){ +},{}],29:[function(require,module,exports){ (function (global){ 'use strict'; @@ -2616,7 +2628,7 @@ module.exports = getSelectionRaw; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],28:[function(require,module,exports){ +},{}],30:[function(require,module,exports){ (function (global){ 'use strict'; @@ -2871,7 +2883,7 @@ module.exports = getSelection; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./rangeToTextRange":30}],29:[function(require,module,exports){ +},{"./rangeToTextRange":32}],31:[function(require,module,exports){ 'use strict'; function isHostMethod (host, prop) { @@ -2902,7 +2914,7 @@ module.exports = { properties: many(isHostProperty) }; -},{}],30:[function(require,module,exports){ +},{}],32:[function(require,module,exports){ (function (global){ 'use strict'; @@ -2967,7 +2979,7 @@ module.exports = rangeToTextRange; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],31:[function(require,module,exports){ +},{}],33:[function(require,module,exports){ 'use strict'; var getSelection = require('./getSelection'); @@ -2978,7 +2990,7 @@ module.exports = { set: setSelection }; -},{"./getSelection":25,"./setSelection":32}],32:[function(require,module,exports){ +},{"./getSelection":27,"./setSelection":34}],34:[function(require,module,exports){ (function (global){ 'use strict'; @@ -3018,7 +3030,7 @@ module.exports = setSelection; }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./getSelection":25,"./rangeToTextRange":30}],33:[function(require,module,exports){ +},{"./getSelection":27,"./rangeToTextRange":32}],35:[function(require,module,exports){ 'use strict'; var get = easyGet; @@ -3116,7 +3128,7 @@ function sell (el, p) { module.exports = sell; -},{}],34:[function(require,module,exports){ +},{}],36:[function(require,module,exports){ (function (setImmediate){ var si = typeof setImmediate === 'function', tick; if (si) { @@ -3128,7 +3140,7 @@ if (si) { module.exports = tick; }).call(this,require("timers").setImmediate) -},{"timers":35}],35:[function(require,module,exports){ +},{"timers":37}],37:[function(require,module,exports){ (function (setImmediate,clearImmediate){ var nextTick = require('process/browser.js').nextTick; var apply = Function.prototype.apply; @@ -3208,7 +3220,7 @@ exports.clearImmediate = typeof clearImmediate === "function" ? clearImmediate : }; }).call(this,require("timers").setImmediate,require("timers").clearImmediate) -},{"process/browser.js":23,"timers":35}]},{},[1])(1) +},{"process/browser.js":25,"timers":37}]},{},[1])(1) }); -//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL25vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJob3JzZXkuanMiLCJub2RlX21vZHVsZXMvbG9kYXNoL2RlYm91bmNlLmpzIiwibm9kZV9tb2R1bGVzL2xvZGFzaC9pc0Z1bmN0aW9uLmpzIiwibm9kZV9tb2R1bGVzL2xvZGFzaC9pc09iamVjdC5qcyIsIm5vZGVfbW9kdWxlcy9sb2Rhc2gvaXNPYmplY3RMaWtlLmpzIiwibm9kZV9tb2R1bGVzL2xvZGFzaC9pc1N5bWJvbC5qcyIsIm5vZGVfbW9kdWxlcy9sb2Rhc2gvbm93LmpzIiwibm9kZV9tb2R1bGVzL2xvZGFzaC90b051bWJlci5qcyIsIi4uL25vZGVfbW9kdWxlcy9hdG9hL2F0b2EuanMiLCIuLi9ub2RlX21vZHVsZXMvYnVsbHNleWUvYnVsbHNleWUuanMiLCIuLi9ub2RlX21vZHVsZXMvYnVsbHNleWUvbm9kZV9tb2R1bGVzL2Nyb3NzdmVudC9zcmMvY3Jvc3N2ZW50LmpzIiwiLi4vbm9kZV9tb2R1bGVzL2J1bGxzZXllL25vZGVfbW9kdWxlcy9jcm9zc3ZlbnQvc3JjL2V2ZW50bWFwLmpzIiwiLi4vbm9kZV9tb2R1bGVzL2J1bGxzZXllL25vZGVfbW9kdWxlcy9jdXN0b20tZXZlbnQvaW5kZXguanMiLCIuLi9ub2RlX21vZHVsZXMvYnVsbHNleWUvdGFpbG9ybWFkZS5qcyIsIi4uL25vZGVfbW9kdWxlcy9idWxsc2V5ZS90aHJvd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AgICAgICAgIGZvciAobGV0IGNoYXIgb2Ygd29yZCkge1xuICAgICAgICAgICAgY29uc3QgaSA9IGNoYXJzLmluZGV4T2YoY2hhciwgcHJldkluZGV4ICsgMSk7XG4gICAgICAgICAgICBjb25zdCBmYWlsID0gaSA9PT0gLTEgfHwgKCFpbml0ICYmIHByZXZJbmRleCArIDEgIT09IGkpO1xuICAgICAgICAgICAgaWYgKGluaXQpIHtcbiAgICAgICAgICAgICAgaW5pdCA9IGZhbHNlO1xuICAgICAgICAgICAgICB0ZW1wSW5kZXggPSBpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKGZhaWwpIHtcbiAgICAgICAgICAgICAgY29udGludWUgcmV0cnk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBwcmV2SW5kZXggPSBpO1xuICAgICAgICAgIH1cbiAgICAgICAgICBmb3IgKGxldCBlbCBvZiBlbGVtcy5zcGxpY2UodGVtcEluZGV4LCAxICsgcHJldkluZGV4IC0gdGVtcEluZGV4KSkge1xuICAgICAgICAgICAgb24oZWwpO1xuICAgICAgICAgIH1cbiAgICAgICAgICBiYWxhbmNlKCk7XG4gICAgICAgICAgbmVlZGxlID0gbmVlZGxlLnJlcGxhY2Uod29yZCwgJycpO1xuICAgICAgICAgIGJyZWFrO1xuICAgICAgICB9XG4gICAgICB9XG4gICAgfVxuXG4gICAgZnVuY3Rpb24gZnV6enkgKCkge1xuICAgICAgZm9yIChsZXQgaW5wdXQgb2YgbmVlZGxlKSB7XG4gICAgICAgIHdoaWxlIChlbGVtcy5sZW5ndGgpIHtcbiAgICAgICAgICBsZXQgZWwgPSBlbGVtcy5zaGlmdCgpO1xuICAgICAgICAgIGlmICgoZWwuaW5uZXJUZXh0IHx8IGVsLnRleHRDb250ZW50KSA9PT0gaW5wdXQpIHtcbiAgICAgICAgICAgIG9uKGVsKTtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBvZmYoZW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V5LXNob3cvZywgJycpO1xuICAgIHVuc2VsZWN0KCk7XG4gICAgY3Jvc3N2ZW50LmZhYnJpY2F0ZShhdHRhY2htZW50LCAnaG9yc2V5LWhpZGUnKTtcbiAgICBpZiAoZWwudmFsdWUgPT09IGxhc3RQcmVmaXgpIHtcbiAgICAgIGVsLnZhbHVlID0gJyc7XG4gICAgfVxuICB9XG5cbiAgZnVuY3Rpb24ga2V5ZG93biAoZSkge1xuICAgIGNvbnN0IHNob3duID0gdmlzaWJsZSgpO1xuICAgIGNvbnN0IHdoaWNoID0gZS53aGljaCB8fCBlLmtleUNvZGU7XG4gICAgaWYgKHdoaWNoID09PSBLRVlfRE9XTikge1xuICAgICAgaWYgKGFueUlucHV0ICYmIG8uYXV0b1Nob3dPblVwRG93bikge1xuICAgICAgICBzaG93KCk7XG4gICAgICB9XG4gICAgICBpZiAoc2hvd24pIHtcbiAgICAgICAgbW92ZSgpO1xuICAgICAgICBzdG9wKGUpO1xuICAgICAgfVxuICAgIH0gZWxzZSBpZiAod2hpY2ggPT09IEtFWV9VUCkge1xuICAgICAgaWYgKGFueUlucHV0ICYmIG8uYXV0b1Nob3dPblVwRG93bikge1xuICAgICAgICBzaG93KCk7XG4gICAgICB9XG4gICAgICBpZiAoc2hvd24pIHtcbiAgICAgICAgbW92ZSh0cnVlKTtcbiAgICAgICAgc3RvcChlKTtcbiAgICAgIH1cbiAgICB9IGVsc2UgaWYgKHdoaWNoID09PSBLRVlfQkFDS1NQQUNFKSB7XG4gICAgICBpZiAoYW55SW5wdXQgJiYgby5hdXRvU2hvd09uVXBEb3duKSB7XG4gICAgICAgIHNob3coKTtcbiAgICAgIH1cbiAgICB9IGVsc2UgaWYgKHNob3duKSB7XG4gICAgICBpZiAod2hpY2ggPT09IEtFWV9FTlRFUikge1xuICAgICAgICBpZiAoc2VsZWN0aW9uKSB7XG4gICAgICAgICAgY3Jvc3N2ZW50LmZhYnJpY2F0ZShzZWxlY3Rpb24sICdjbGljaycpO1xuICAgICA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gIGNyb3NzdmVudC5mYWJyaWNhdGUobGksICdob3JzZXktaGlkZScpO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgIGNyb3NzdmVudC5mYWJyaWNhdGUobGksICdob3JzZXktZmlsdGVyJyk7XG4gICAgICAgICAgaWYgKGxpLmNsYXNzTmFtZS5pbmRleE9mKCdzZXktaGlkZScpID09PSAtMSkge1xuICAgICAgICAgICAgY291bnQrKztcbiAgICAgICAgICAgIGlmIChoaWdobGlnaHRlcikge1xuICAgICAgICAgICAgICBoaWdobGlnaHQobGksIHZhbHVlKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgbGkgPSBsaS5uZXh0U2libGluZztcbiAgICAgIH1cbiAgICAgIHJldHVybiBjb3VudDtcbiAgICB9XG4gIH1cblxuICBmdW5jdGlvbiBkZWZlcnJlZEZpbHRlcmluZ05vRW50ZXIgKGUpIHtcbiAgICBjb25zdCB3aGljaCA9IGUud2hpY2ggfHwgZS5rZXlDb2RlO1xuICAgIGlmICh3aGljaCA9PT0gS0VZX0VOVEVSKSB7XG4gICAgICByZXR1cm47XG4gICAgfVxuICAgIGRlZmVycmVkRmlsdGVyaW5nKCk7XG4gIH1cblxuICBmdW5jdGlvbiBkZWZlcnJlZFNob3cgKGUpIHtcbiAgICBjb25zdCB3aGljaCA9IGUud2hpY2ggfHwgZS5rZXlDb2RlO1xuICAgIGlmICh3aGljaCA9PT0gS0VZX0VOVEVSIHx8IHdoaWNoID09PSBLRVlfVEFCKSB7XG4gICAgICByZXR1cm47XG4gICAgfVxuICAgIHNldFRpbWVvdXQoc2hvdywgMCk7XG4gIH1cblxuICBmdW5jdGlvbiBhdXRvY29tcGxldGVFdmVudFRhcmdldCAoZSkge1xuICAgIGxldCB0YXJnZXQgPSBlLnRhcmdldDtcbiAgICBpZiAodGFyZ2V0ID09PSBhdHRhY2htZW50KSB7XG4gICAgICByZXR1cm4gdHJ1ZTtcbiAgICB9XG4gICA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G4gICAgICAgICAgICAgIGNvbnRpbnVlIHJldHJ5O1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcHJldkluZGV4ID0gaTtcbiAgICAgICAgICB9XG4gICAgICAgICAgZm9yIChsZXQgZWwgb2YgZWxlbXMuc3BsaWNlKHRlbXBJbmRleCwgMSArIHByZXZJbmRleCAtIHRlbXBJbmRleCkpIHtcbiAgICAgICAgICAgIG9uKGVsKTtcbiAgICAgICAgICB9XG4gICAgICAgICAgYmFsYW5jZSgpO1xuICAgICAgICAgIG5lZWRsZSA9IG5lZWRsZS5yZXBsYWNlKHdvcmQsICcnKTtcbiAgICAgICAgICBicmVhaztcbiAgICAgICAgfVxuICAgICAgfVxuICAgIH1cblxuICAgIGZ1bmN0aW9uIGZ1enp5ICgpIHtcbiAgICAgIGZvciAobGV0IGlucHV0IG9mIG5lZWRsZSkge1xuICAgICAgICB3aGlsZSAoZWxlbXMubGVuZ3RoKSB7XG4gICAgICAgICAgbGV0IGVsID0gZWxlbXMuc2hpZnQoKTtcbiAgICAgICAgICBpZiAoKGVsLmlubmVyVGV4dCB8fCBlbC50ZXh0Q29udGVudCkgPT09IGlucHV0KSB7XG4gICAgICAgICAgICBvbihlbCk7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgb2ZmKGVsKTtcbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9XG5cbiAgICBmdW5jdGlvbiBjbGVhclJlbWFpbmRlciAoKSB7XG4gICAgICB3aGlsZSAoZWxlbXMubGVuZ3RoKSB7XG4gICAgICAgIG9mZihlbGVtcy5zaGlmdCgpKTtcbiAgICAgIH1cbiAgICB9XG5cbiAgICBmdW5jdGlvbiBvbiAoY2gpIHtcbiAgICAgIGNoLmNsYXNzTGlzdC5hZGQoJ3NleS1jaGFyLWhpZ2hsaWdodCcpO1xuICAgIH1cbiAgICBmdW5jdGlvbiBvZmYgKGNoKSB7XG4gICAgICB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ICAgIGlmICh3aGljaCA9PT0gS0VZX0RPV04pIHtcbiAgICAgIGlmIChhbnlJbnB1dCAmJiBvLmF1dG9TaG93T25VcERvd24pIHtcbiAgICAgICAgc2hvdygpO1xuICAgICAgfVxuICAgICAgaWYgKHNob3duKSB7XG4gICAgICAgIG1vdmUoKTtcbiAgICAgICAgc3RvcChlKTtcbiAgICAgIH1cbiAgICB9IGVsc2UgaWYgKHdoaWNoID09PSBLRVlfVVApIHtcbiAgICAgIGlmIChhbnlJbnB1dCAmJiBvLmF1dG9TaG93T25VcERvd24pIHtcbiAgICAgICAgc2hvdygpO1xuICAgICAgfVxuICAgICAgaWYgKHNob3duKSB7XG4gICAgICAgIG1vdmUodHJ1ZSk7XG4gICAgICAgIHN0b3AoZSk7XG4gICAgICB9XG4gICAgfSBlbHNlIGlmICh3aGljaCA9PT0gS0VZX0JBQ0tTUEFDRSkge1xuICAgICAgaWYgKGFueUlucHV0ICYmIG8uYXV0b1Nob3dPblVwRG93bikge1xuICAgICAgICBzaG93KCk7XG4gICAgICB9XG4gICAgfSBlbHNlIGlmIChzaG93bikge1xuICAgICAgaWYgKHdoaWNoID09PSBLRVlfRU5URVIpIHtcbiAgICAgICAgaWYgKHNlbGVjdGlvbikge1xuICAgICAgICAgIGNyb3NzdmVudC5mYWJyaWNhdGUoc2VsZWN0aW9uLCAnY2xpY2snKTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICBoaWRlKCk7XG4gICAgICAgIH1cbiAgICAgICAgc3RvcChlKTtcbiAgICAgIH0gZWxzZSBpZiAod2hpY2ggPT09IEtFWV9FU0MpIHtcbiAgICAgICAgaGlkZSgpO1xuICAgICAgICBzdG9wKGUpO1xuICAgICAgfVxuICAgIH1cbiAgfVxuXG4gIGZ1bmN0aW9uIHN0b3AgKGUpIHtcbiAgICBlLnN0b3BQcm9wYWdhdGlvbigpO1xuICAgIGUucHJldmVudERlZmF1bHQoKTtcbiAgfVxuXG4gIGZ1bmN0aW9uIHNob3dO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xsLCBhcmdzKTtcbiAgICAgIH0gZWxzZSB7XG4gICAgICAgIGZuLmNhbGwobnVsbCk7XG4gICAgICB9XG4gICAgICAvLyBQcmV2ZW50IGlkcyBmcm9tIGxlYWtpbmdcbiAgICAgIGV4cG9ydHMuY2xlYXJJbW1lZGlhdGUoaWQpO1xuICAgIH1cbiAgfSk7XG5cbiAgcmV0dXJuIGlkO1xufTtcblxuZXhwb3J0cy5jbGVhckltbWVkaWF0ZSA9IHR5cGVvZiBjbGVhckltbWVkaWF0ZSA9PT0gXCJmdW5jdGlvblwiID8gY2xlYXJJbW1lZGlhdGUgOiBmdW5jdGlvbihpZCkge1xuICBkZWxldGUgaW1tZWRpYXRlSWRzW2lkXTtcbn07Il19 diff --git a/dist/horsey.min.js b/dist/horsey.min.js index f920eba..e097f55 100644 --- a/dist/horsey.min.js +++ b/dist/horsey.min.js @@ -1 +1 @@ -!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).horsey=e()}}((function(){return function e(t,n,r){function o(a,u){if(!n[a]){if(!t[a]){var c="function"==typeof require&&require;if(!u&&c)return c(a,!0);if(i)return i(a,!0);var f=new Error("Cannot find module '"+a+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[a]={exports:{}};t[a][0].call(l.exports,(function(e){return o(t[a][1][e]||e)}),l,l.exports,e,t,n,r)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;a1&&void 0!==arguments[1]?arguments[1]:{},n=t,r=n.appendTo||p.body,s=n.getText,v=n.getValue,x=n.form,T=n.source,E=n.noMatches,C=n.noMatchesText,S=n.highlighter,N=void 0===S||S,O=n.highlightCompleteWords,R=void 0===O||O,A=n.renderItem,k=void 0===A?He:A,_=n.renderCategory,L=void 0===_?De:_,I=n.setAppends,j="number"==typeof n.limit?n.limit:1/0,M=n.filter||Be,H=n.set||Me,D=m("div","sey-categories"),B=m("div","sey-container"),P=y(Oe),U={counter:0,query:null},q=Object.create(null),W=null,z=void 0,F=e,X=void 0,V=void 0,$=void 0,K=void 0,Y="",G=n.debounce||300,J=(0,l.default)(ne,G);void 0===n.autoHideOnBlur&&(n.autoHideOnBlur=!0),void 0===n.autoHideOnClick&&(n.autoHideOnClick=!0),void 0===n.autoShowOnUpDown&&(n.autoShowOnUpDown="INPUT"===e.tagName),n.anchor&&(K=new RegExp("^"+n.anchor),new RegExp(n.anchor+"$"));var Q=!1,Z=(0,a.default)({anchor:n.anchor,clear:oe,show:ge,hide:Te,toggle:ye,destroy:je,refreshPosition:te,appendText:qe,appendHTML:ze,filterAnchoredText:Ue,filterAnchoredHTML:We,defaultAppendText:qe,defaultFilter:Be,defaultItemRenderer:He,defaultCategoryRenderer:De,defaultSetter:Me,retarget:ee,attachment:F,source:[]});return ee(e),B.appendChild(D),E&&C&&(b(X=m("div","sey-empty sey-hide"),C),B.appendChild(X)),r.appendChild(B),e.setAttribute("autocomplete","off"),Array.isArray(T)&&re(T,!1),Z;function ee(e){Ie(!0),F=Z.attachment=e,V="INPUT"===F.tagName||"TEXTAREA"===F.tagName,$=V||w(F),Ie()}function te(){z&&z.refresh()}function ne(e){if("function"==typeof T){c.default.remove(F,"focus",ne);var t=ie();if(t!==U.query){Q=!1,U.query=t;var n=++U.counter;T({query:t,limit:j},(function(t,r,o){if(U.counter!==n)return;re(r,e),(t||o)&&(Q=!1)}))}}}function re(e,t){oe(),Q=!0,Z.source=[],e.forEach((function(e){return e.list.forEach((function(t){return ue(t,e)}))})),t&&ge(),Oe()}function oe(){for(we();D.lastChild;)D.removeChild(D.lastChild);q=Object.create(null),Q=!1}function ie(){return(V?e.value:e.innerHTML).trim()}function ae(e){var t,n;return e.id||(e.id="default"),q[e.id]||(q[e.id]=(t=m("div","sey-category"),n=m("ul","sey-list"),L(t,e),t.appendChild(n),D.appendChild(t),{data:e,ul:n})),q[e.id]}function ue(t,r){var o=ae(r),i=m("li","sey-item");return k(i,t),N&&ce(i),c.default.add(i,"mouseenter",(function(){be(i)})),c.default.add(i,"click",(function(){var r=s(t);se(t),Te(),F.focus(),(Y=n.predictNextSearch&&n.predictNextSearch({input:r,source:Z.source.slice(),selection:t})||"")&&(e.value=Y,e.select(),ge(),Oe())})),c.default.add(i,"horsey-filter",(function(){de(ie(),t)?i.className=i.className.replace(/ sey-hide/g,""):c.default.fabricate(i,"horsey-hide")})),c.default.add(i,"horsey-hide",(function(){ve(i)||(i.className+=" sey-hide",W===i&&we())})),o.ul.appendChild(i),Z.source.push(t),i}function ce(e){le(e).forEach((function(e){var t=e.parentElement,n=e.textContent||e.nodeValue||"";if(0!==n.length){var r=!0,o=!1,i=void 0;try{for(var a,u=n[Symbol.iterator]();!(r=(a=u.next()).done);r=!0){var c=a.value;t.insertBefore(f(c),e)}}catch(e){o=!0,i=e}finally{try{!r&&u.return&&u.return()}finally{if(o)throw i}}t.removeChild(e)}function f(e){var t=p.createElement("span");return t.className="sey-char",t.textContent=t.innerText=e,t}}))}function fe(e,t){var n=t.split(/[\s,._\[\]{}()-]/g).filter((function(e){return e.length})),r=[].concat(d(e.querySelectorAll(".sey-char"))),o=void 0;function i(){o=r.map((function(e){return e.innerText||e.textContent}))}function a(e){e.classList.add("sey-char-highlight")}function u(e){e.classList.remove("sey-char-highlight")}i(),R&&function(){var e=!0,u=!1,c=void 0;try{for(var f,l=n[Symbol.iterator]();!(e=(f=l.next()).done);e=!0){var s=f.value,d=0;e:for(;-1!==d;){var p=!0,h=d,v=!0,g=!1,m=void 0;try{for(var y,b=s[Symbol.iterator]();!(v=(y=b.next()).done);v=!0){var w=y.value,x=o.indexOf(w,h+1),T=-1===x||!p&&h+1!==x;if(p&&(p=!1,d=x),T)continue e;h=x}}catch(e){g=!0,m=e}finally{try{!v&&b.return&&b.return()}finally{if(g)throw m}}var E=!0,C=!1,S=void 0;try{for(var N,O=r.splice(d,1+h-d)[Symbol.iterator]();!(E=(N=O.next()).done);E=!0){a(N.value)}}catch(e){C=!0,S=e}finally{try{!E&&O.return&&O.return()}finally{if(C)throw S}}i(),t=t.replace(s,"");break}}}catch(e){u=!0,c=e}finally{try{!e&&l.return&&l.return()}finally{if(u)throw c}}}(),function(){var e=!0,n=!1,o=void 0;try{for(var i,c=t[Symbol.iterator]();!(e=(i=c.next()).done);e=!0)for(var f=i.value;r.length;){var l=r.shift();if((l.innerText||l.textContent)===f){a(l);break}u(l)}}catch(e){n=!0,o=e}finally{try{!e&&c.return&&c.return()}finally{if(n)throw o}}}(),function(){for(;r.length;)u(r.shift())}()}function le(e){for(var t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null,!1),r=void 0;r=n.nextNode();)t.push(r);return t}function se(e){if(n.anchor)return(pe()?Z.appendText:Z.appendHTML)(v(e));H(e)}function de(e,t){if(n.anchor){var r=(pe()?Z.filterAnchoredText:Z.filterAnchoredHTML)(e,t);return!!r&&M(r.input,r.suggestion)}return M(e,t)}function pe(){return g(F)}function he(){return-1!==B.className.indexOf("sey-show")}function ve(e){return-1!==e.className.indexOf("sey-hide")}function ge(){z.refresh(),he()||(B.className+=" sey-show",c.default.fabricate(F,"horsey-show"))}function me(e){!1!==(1===e.which&&!e.metaKey&&!e.ctrlKey)&&ye()}function ye(){he()?Te():ge()}function be(e){we(),e&&((W=e).className+=" sey-selected")}function we(){W&&(W.className=W.className.replace(/ sey-selected/g,""),W=null)}function xe(e,t){var n=Z.source.length;if(0!==n)if(t>n)we();else{var r=function(e){for(;e;){if(i.default.matchesSelector(e.parentElement,".sey-category"))return e.parentElement;e=e.parentElement}return null}(W)||D.firstChild,o=e?"lastChild":"firstChild",a=e?"previousSibling":"nextSibling",u=function(){if(W){if(W[a])return W[a];if(r[a]&&Fe(r[a])[o])return Fe(r[a])[o]}return Fe(D[o])[o]}();be(u),ve(u)&&xe(e,t?t+1:1)}}function Te(){z.sleep(),B.className=B.className.replace(/ sey-show/g,""),we(),c.default.fabricate(F,"horsey-hide"),e.value===Y&&(e.value="")}function Ee(e){var t=he(),r=e.which||e.keyCode;40===r?($&&n.autoShowOnUpDown&&ge(),t&&(xe(),Ce(e))):38===r?($&&n.autoShowOnUpDown&&ge(),t&&(xe(!0),Ce(e))):8===r?$&&n.autoShowOnUpDown&&ge():t&&(13===r?(W?c.default.fabricate(W,"click"):Te(),Ce(e)):27===r&&(Te(),Ce(e)))}function Ce(e){e.stopPropagation(),e.preventDefault()}function Se(){X&&X.classList.remove("sey-hide")}function Ne(){X&&X.classList.add("sey-hide")}function Oe(){if(he()){J(!0),c.default.fabricate(F,"horsey-filter");var e=ie();if(n.blankSearch||e){var t=E({query:e});0===function(){var e=D.firstChild,t=0;for(;e;){var n=r(Fe(e));0===n?e.classList.add("sey-hide"):e.classList.remove("sey-hide"),t+=n,e=e.nextSibling}return t}()&&t&&Q?Se():Ne(),W||xe(),W||t||Te()}else Te()}function r(t){for(var n=t.firstChild,r=0;n;)r>=j?c.default.fabricate(n,"horsey-hide"):(c.default.fabricate(n,"horsey-filter"),-1===n.className.indexOf("sey-hide")&&(r++,N&&fe(n,e))),n=n.nextSibling;return r}}function Re(e){13!==(e.which||e.keyCode)&&P()}function Ae(e){var t=e.which||e.keyCode;13!==t&&9!==t&&setTimeout(ge,0)}function ke(e){var t=e.target;if(t===F)return!0;for(;t;){if(t===B||t===F)return!0;t=t.parentNode}}function _e(e){9===(e.which||e.keyCode)&&Te()}function Le(e){ke(e)||Te()}function Ie(e){var t=e?"remove":"add";z&&(z.destroy(),z=null),e||(z=(0,u.default)(B,F,{caret:$&&"INPUT"!==F.tagName,context:n.appendTo}),he()||z.sleep()),e||$&&p.activeElement!==F?c.default[t](F,"focus",ne):ne(),$?(c.default[t](F,"keypress",Ae),c.default[t](F,"keypress",P),c.default[t](F,"keydown",Re),c.default[t](F,"paste",(function(e){Ae(e),P(e)})),c.default[t](F,"keydown",Ee),n.autoHideOnBlur&&c.default[t](F,"keydown",_e)):(c.default[t](F,"click",me),c.default[t](h,"keydown",Ee)),n.autoHideOnClick&&c.default[t](p,"click",Le),x&&c.default[t](x,"submit",Te)}function je(){Ie(!0),r.contains(B)&&r.removeChild(B)}function Me(t){V?!0===I?e.value+=" "+t:e.value=t:!0===I?e.innerHTML+=" "+t:e.innerHTML=t}function He(e,t){b(e,s(t))}function De(e,t){if("default"!==t.id){var n=m("div","sey-category-id");e.appendChild(n),b(n,t.id)}}function Be(e,t){var n=e.toLowerCase(),r=s(t)||"";if((0,f.default)(n,r.toLowerCase()))return!0;var o=v(t)||"";return"string"==typeof o&&(0,f.default)(n,o.toLowerCase())}function Pe(e,t){for(var n="",r=!1,o=t.start;!1===r&&o>=0;)n=e.substr(o-1,t.start-o+1),r=K.test(n),o--;return{text:r?n:null,start:o}}function Ue(t,n){var r=Pe(t,(0,o.default)(e)).text;if(r)return{input:r,suggestion:n}}function qe(t){var n=e.value,r=(0,o.default)(e),i=Pe(n,r),a=n.substr(0,i.start),u=n.substr(i.start+i.text.length+(r.end-r.start)),c=a+t+" ";e.value=c+u,(0,o.default)(e,{start:c.length,end:c.length})}function We(){throw new Error("Anchoring in editable elements is disabled by default.")}function ze(){throw new Error("Anchoring in editable elements is disabled by default.")}function Fe(e){return(0,i.default)(".sey-list",e)[0]}}function g(e){return"INPUT"===e.tagName||"TEXTAREA"===e.tagName}function m(e,t){var n=p.createElement(e);return n.className=t,n}function y(e){return function(){setTimeout(e,0)}}function b(e,t){e.innerText=e.textContent=t}function w(e){var t=e.getAttribute("contentEditable");return"false"!==t&&("true"===t||!!e.parentElement&&w(e.parentElement))}t.exports=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.setAppends,o=t.set,i=t.filter,a=t.source,u=t.cache,c=void 0===u?{}:u,f=t.predictNextSearch,l=t.renderItem,s=t.renderCategory,d=t.blankSearch,p=t.appendTo,h=t.anchor,g=t.debounce,m=!1!==t.cache;if(a){var y=t.getText,b=t.getValue,w="string"==typeof y?function(e){return e[y]}:"function"==typeof y?y:function(e){return e.toString()},x="string"==typeof b?function(e){return e[b]}:"function"==typeof b?b:function(e){return e},T=[],E=null,C=Number(t.limit)||1/0,S=v(e,{source:O,limit:C,getText:w,getValue:x,setAppends:n,predictNextSearch:f,renderItem:l,renderCategory:s,appendTo:p,anchor:h,noMatches:N,noMatchesText:t.noMatches,blankSearch:d,debounce:g,set:function(t){!0!==n&&(e.value=""),E=t,(o||S.defaultSetter)(w(t),t),S.emit("afterSet")},filter:i});return S}function N(e){return!!t.noMatches&&e.query.length}function O(n,o){var i=n.query,a=n.limit;if(t.blankSearch||0!==i.length){S&&S.emit("beforeUpdate");var u=(0,r.default)(i);if(m){var f=c[u];if(f){var d=f.created.getTime(),p=c.duration||86400;if(new Date(d+1e3*p)>new Date)return void o(null,f.items.slice())}}var h={previousSuggestions:T.slice(),previousSelection:E,input:i,renderItem:l,renderCategory:s,limit:a};"function"==typeof t.source?t.source(h,v):v(null,t.source)}else o(null,[],!0);function v(t,n){t&&(console.log("Autocomplete source error.",t,e),o(t,[]));var r=Array.isArray(n)?n:[];m&&(c[u]={created:new Date,items:r}),T=r,o(null,r.slice())}}}},{bullseye:10,"contra/emitter":17,crossvent:18,fuzzysearch:21,"hash-sum":22,"lodash/debounce":2,sektor:24,sell:33}],2:[function(e,t,n){var r=e("./isObject"),o=e("./now"),i=e("./toNumber"),a=Math.max,u=Math.min;t.exports=function(e,t,n){var c,f,l,s,d,p,h=0,v=!1,g=!1,m=!0;if("function"!=typeof e)throw new TypeError("Expected a function");function y(t){var n=c,r=f;return c=f=void 0,h=t,s=e.apply(r,n)}function b(e){return h=e,d=setTimeout(x,t),v?y(e):s}function w(e){var n=e-p;return void 0===p||n>=t||n<0||g&&e-h>=l}function x(){var e=o();if(w(e))return T(e);d=setTimeout(x,function(e){var n=t-(e-p);return g?u(n,l-(e-h)):n}(e))}function T(e){return d=void 0,m&&c?y(e):(c=f=void 0,s)}function E(){var e=o(),n=w(e);if(c=arguments,f=this,p=e,n){if(void 0===d)return b(p);if(g)return d=setTimeout(x,t),y(p)}return void 0===d&&(d=setTimeout(x,t)),s}return t=i(t)||0,r(n)&&(v=!!n.leading,l=(g="maxWait"in n)?a(i(n.maxWait)||0,t):l,m="trailing"in n?!!n.trailing:m),E.cancel=function(){h=0,c=p=f=d=void 0},E.flush=function(){return void 0===d?s:T(o())},E}},{"./isObject":4,"./now":7,"./toNumber":8}],3:[function(e,t,n){var r=e("./isObject"),o=Object.prototype.toString;t.exports=function(e){var t=r(e)?o.call(e):"";return"[object Function]"==t||"[object GeneratorFunction]"==t}},{"./isObject":4}],4:[function(e,t,n){t.exports=function(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}},{}],5:[function(e,t,n){t.exports=function(e){return!!e&&"object"==typeof e}},{}],6:[function(e,t,n){var r=e("./isObjectLike"),o=Object.prototype.toString;t.exports=function(e){return"symbol"==typeof e||r(e)&&"[object Symbol]"==o.call(e)}},{"./isObjectLike":5}],7:[function(e,t,n){t.exports=function(){return Date.now()}},{}],8:[function(e,t,n){var r=e("./isFunction"),o=e("./isObject"),i=e("./isSymbol"),a=/^\s+|\s+$/g,u=/^[-+]0x[0-9a-f]+$/i,c=/^0b[01]+$/i,f=/^0o[0-7]+$/i,l=parseInt;t.exports=function(e){if("number"==typeof e)return e;if(i(e))return NaN;if(o(e)){var t=r(e.valueOf)?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(a,"");var n=c.test(e);return n||f.test(e)?l(e.slice(2),n?2:8):u.test(e)?NaN:+e}},{"./isFunction":3,"./isObject":4,"./isSymbol":6}],9:[function(e,t,n){t.exports=function(e,t){return Array.prototype.slice.call(e,t)}},{}],10:[function(e,t,n){"use strict";var r=e("crossvent"),o=e("./throttle"),i=e("./tailormade");t.exports=function(e,t,n){var a=n,u=t&&t.tagName;u||2!==arguments.length||(a=t),u||(t=e),a||(a={});var c=!1,f=o(g,30),l={update:!1!==a.autoupdateToCaret&&v},s=a.caret&&i(t,l);return g(),!1!==a.tracking&&r.add(window,"resize",f),{read:p,refresh:g,destroy:m,sleep:d};function d(){l.sleeping=!0}function p(){return h()}function h(e){var n=t.getBoundingClientRect(),r=document.body.scrollTop||document.documentElement.scrollTop;return s?{x:((e=s.read()).absolute?0:n.left)+e.x,y:(e.absolute?0:n.top)+r+e.y+20}:{x:n.left,y:n.top+r}}function v(e){g(e)}function g(n){if(c)throw new Error("Bullseye can't refresh after being destroyed. Create another instance instead.");if(s&&!n)return l.sleeping=!1,void s.refresh();var r=h(n);s||t===e||(r.y+=t.offsetHeight);var o=a.context;e.style.left=r.x+"px",e.style.top=(o?o.offsetHeight:r.y)+"px"}function m(){s&&s.destroy(),r.remove(window,"resize",f),c=!0}}},{"./tailormade":14,"./throttle":15,crossvent:11}],11:[function(e,t,n){(function(n){"use strict";var r=e("custom-event"),o=e("./eventmap"),i=n.document,a=function(e,t,n,r){return e.addEventListener(t,n,r)},u=function(e,t,n,r){return e.removeEventListener(t,n,r)},c=[];function f(e,t,n){var r=function(e,t,n){var r,o;for(r=0;rparseInt(t.height)&&(r.overflowY="scroll")):r.overflow="hidden";return{mirror:n,computed:t}}(),o=function(t,n){var r=l.createElement("span"),o=t.mirror,i=t.computed;y(o,m(e).substring(0,n)),"INPUT"===e.tagName&&(o.textContent=o.textContent.replace(/\s/g," "));return y(r,m(e).substring(n)||"."),o.appendChild(r),{x:r.offsetLeft+parseInt(i.borderLeftWidth),y:r.offsetTop+parseInt(i.borderTopWidth)}}(n,t.start);return l.body.removeChild(n.mirror),o}function g(){var e=u();if(e.rangeCount){var t=e.getRangeAt(0);if("P"===t.startContainer.nodeName&&0===t.startOffset)return{x:t.startContainer.offsetLeft,y:t.startContainer.offsetTop,absolute:!0};if(t.getClientRects){var n=t.getClientRects();if(n.length>0)return{x:n[0].left,y:n[0].top,absolute:!0}}}return{x:0,y:0}}function m(e){return n?e.value:e.innerHTML}function y(e,t){n?e.textContent=t:e.innerHTML=t}function b(t){var n=t?"remove":"add";o[n](e,"keydown",i),o[n](e,"keyup",i),o[n](e,"input",i),o[n](e,"paste",i),o[n](e,"change",i)}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./throttle":15,crossvent:11,seleccion:31,sell:33}],15:[function(e,t,n){"use strict";t.exports=function(e,t){var n,r=-1/0;return function(){n||function o(){clearTimeout(n),n=null;var i=r+t,a=Date.now();a>i?(r=a,e()):n=setTimeout(o,i-a)}()}}},{}],16:[function(e,t,n){"use strict";var r=e("ticky");t.exports=function(e,t,n){e&&r((function(){e.apply(n||null,t||[])}))}},{ticky:34}],17:[function(e,t,n){"use strict";var r=e("atoa"),o=e("./debounce");t.exports=function(e,t){var n=t||{},i={};return void 0===e&&(e={}),e.on=function(t,n){return i[t]?i[t].push(n):i[t]=[n],e},e.once=function(t,n){return n._once=!0,e.on(t,n),e},e.off=function(t,n){var r=arguments.length;if(1===r)delete i[t];else if(0===r)i={};else{var o=i[t];if(!o)return e;o.splice(o.indexOf(n),1)}return e},e.emit=function(){var t=r(arguments);return e.emitterSnapshot(t.shift()).apply(this,t)},e.emitterSnapshot=function(t){var a=(i[t]||[]).slice(0);return function(){var i=r(arguments),u=this||e;if("error"===t&&!1!==n.throws&&!a.length)throw 1===i.length?i[0]:i;return a.forEach((function(r){n.async?o(r,i,u):r.apply(u,i),r._once&&e.off(t,r)})),e}},e}},{"./debounce":16,atoa:9}],18:[function(e,t,n){(function(n){"use strict";var r=e("custom-event"),o=e("./eventmap"),i=n.document,a=function(e,t,n,r){return e.addEventListener(t,n,r)},u=function(e,t,n,r){return e.removeEventListener(t,n,r)},c=[];function f(e,t,n){var r=function(e,t,n){var r,o;for(r=0;rn)return!1;if(r===n)return e===t;e:for(var o=0,i=0;o1)for(var n=1;n1?function(e,t){for(var n,r=i.createControlRange(),o=0,a=t.length;o=this.rangeCount)throw new Error("getRangeAt(): index out of bounds");return this._ranges[e].cloneRange()},a.removeRange=function(e){if("Control"===this._selection.type){for(var t=this._selection.createRange(),n=l(e),r=i.createControlRange(),o=!1,a=0,u=t.length;a=0&&(e._idleTimeoutId=setTimeout((function(){e._onTimeout&&e._onTimeout()}),t))},n.setImmediate="function"==typeof t?t:function(e){var t=c++,r=!(arguments.length<2)&&a.call(arguments,1);return u[t]=!0,o((function(){u[t]&&(r?e.apply(null,r):e.call(null),n.clearImmediate(t))})),t},n.clearImmediate="function"==typeof r?r:function(e){delete u[e]}}).call(this,e("timers").setImmediate,e("timers").clearImmediate)},{"process/browser.js":23,timers:35}]},{},[1])(1)})); \ No newline at end of file +!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).horsey=e()}}((function(){return function e(t,n,r){function o(a,u){if(!n[a]){if(!t[a]){var c="function"==typeof require&&require;if(!u&&c)return c(a,!0);if(i)return i(a,!0);var f=new Error("Cannot find module '"+a+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[a]={exports:{}};t[a][0].call(l.exports,(function(e){return o(t[a][1][e]||e)}),l,l.exports,e,t,n,r)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;a=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return a=e.done,e},e:function(e){u=!0,i=e},f:function(){try{a||null==n.return||n.return()}finally{if(u)throw i}}}}function h(e,t){if(e){if("string"==typeof e)return v(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)?v(e,t):void 0}}function v(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n1&&void 0!==arguments[1]?arguments[1]:{},y=v,S=y.appendTo||g.body,E=y.getText,O=y.getValue,N=y.form,R=y.source,A=y.noMatches,_=y.noMatchesText,k=y.highlighter,j=void 0===k||k,I=y.highlightCompleteWords,L=void 0===I||I,M=y.renderItem,H=void 0===M?De:M,D=y.renderCategory,U=void 0===D?Ue:D,P=y.setAppends,B="number"==typeof y.limit?y.limit:1/0,q=y.filter||Pe,W=y.set||He,z=w("div","sey-categories"),F=w("div","sey-container"),X=T(Re),V={counter:0,query:null},$=Object.create(null),G=null,K=e,Y="",J=y.debounce||300,Q=(0,l.default)(re,J);void 0===y.autoHideOnBlur&&(y.autoHideOnBlur=!0),void 0===y.autoHideOnClick&&(y.autoHideOnClick=!0),void 0===y.autoShowOnUpDown&&(y.autoShowOnUpDown="INPUT"===e.tagName),y.anchor&&(h=new RegExp("^"+y.anchor),new RegExp(y.anchor+"$"));var Z=!1,ee=(0,a.default)({anchor:y.anchor,clear:ie,show:me,hide:Ce,toggle:be,destroy:Me,refreshPosition:ne,appendText:We,appendHTML:Fe,filterAnchoredText:qe,filterAnchoredHTML:ze,defaultAppendText:We,defaultFilter:Pe,defaultItemRenderer:De,defaultCategoryRenderer:Ue,defaultSetter:He,retarget:te,attachment:K,source:[]});return te(e),F.appendChild(z),A&&_&&(x(n=w("div","sey-empty sey-hide"),_),F.appendChild(n)),S.appendChild(F),e.setAttribute("autocomplete","off"),Array.isArray(R)&&oe(R,!1),ee;function te(e){Le(!0),K=ee.attachment=e,r="INPUT"===K.tagName||"TEXTAREA"===K.tagName,s=r||C(K),Le()}function ne(){t&&t.refresh()}function re(e){if("function"==typeof R){c.default.remove(K,"focus",re);var t=ae();if(t!==V.query){Z=!1,V.query=t;var n=++V.counter;R({query:t,limit:B},(function(t,r,o){if(V.counter!==n)return;oe(r,e),(t||o)&&(Z=!1)}))}}}function oe(e,t){ie(),Z=!0,ee.source=[],e.forEach((function(e){return e.list.forEach((function(t){return ce(t,e)}))})),t&&me(),Re()}function ie(){for(Te();z.lastChild;)z.removeChild(z.lastChild);$=Object.create(null),Z=!1}function ae(){return(r?e.value:e.innerHTML).trim()}function ue(e){var t,n;return e.id||(e.id="default"),$[e.id]||($[e.id]=(t=w("div","sey-category"),n=w("ul","sey-list"),U(t,e),t.appendChild(n),z.appendChild(t),{data:e,ul:n})),$[e.id]}function ce(t,n){var r=ue(n),o=w("li","sey-item");return H(o,t),j&&fe(o),c.default.add(o,"mouseenter",(function(){we(o)})),c.default.add(o,"click",(function(){var n=E(t);de(t),Ce(),K.focus(),(Y=y.predictNextSearch&&y.predictNextSearch({input:n,source:ee.source.slice(),selection:t})||"")&&(e.value=Y,e.select(),me(),Re())})),c.default.add(o,"horsey-filter",(function(){pe(ae(),t)?o.className=o.className.replace(/ sey-hide/g,""):c.default.fabricate(o,"horsey-hide")})),c.default.add(o,"horsey-hide",(function(){ge(o)||(o.className+=" sey-hide",G===o&&Te())})),r.ul.appendChild(o),ee.source.push(t),o}function fe(e){se(e).forEach((function(e){var t=e.parentElement,n=e.textContent||e.nodeValue||"";if(0!==n.length){var r,o=p(n);try{for(o.s();!(r=o.n()).done;){var i=r.value;t.insertBefore(a(i),e)}}catch(e){o.e(e)}finally{o.f()}t.removeChild(e)}function a(e){var t=g.createElement("span");return t.className="sey-char",t.textContent=t.innerText=e,t}}))}function le(e,t){var n,r=t.split(/[\s,._\[\]{}()-]/g).filter((function(e){return e.length})),o=d(e.querySelectorAll(".sey-char"));function i(){n=o.map((function(e){return e.innerText||e.textContent}))}function a(e){e.classList.add("sey-char-highlight")}function u(e){e.classList.remove("sey-char-highlight")}i(),L&&function(){var e,u=p(r);try{for(u.s();!(e=u.n()).done;){var c=e.value,f=0;e:for(;-1!==f;){var l,s=!0,d=f,h=p(c);try{for(h.s();!(l=h.n()).done;){var v=l.value,g=n.indexOf(v,d+1),m=-1===g||!s&&d+1!==g;if(s&&(s=!1,f=g),m)continue e;d=g}}catch(e){h.e(e)}finally{h.f()}var y,b=p(o.splice(f,1+d-f));try{for(b.s();!(y=b.n()).done;){a(y.value)}}catch(e){b.e(e)}finally{b.f()}i(),t=t.replace(c,"");break}}}catch(e){u.e(e)}finally{u.f()}}(),function(){var e,n=p(t);try{for(n.s();!(e=n.n()).done;)for(var r=e.value;o.length;){var i=o.shift();if((i.innerText||i.textContent)===r){a(i);break}u(i)}}catch(e){n.e(e)}finally{n.f()}}(),function(){for(;o.length;)u(o.shift())}()}function se(e){for(var t,n=[],r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,null,!1);t=r.nextNode();)n.push(t);return n}function de(e){if(y.anchor)return(he()?ee.appendText:ee.appendHTML)(O(e));W(e)}function pe(e,t){if(y.anchor){var n=(he()?ee.filterAnchoredText:ee.filterAnchoredHTML)(e,t);return!!n&&q(n.input,n.suggestion)}return q(e,t)}function he(){return b(K)}function ve(){return-1!==F.className.indexOf("sey-show")}function ge(e){return-1!==e.className.indexOf("sey-hide")}function me(){t.refresh(),ve()||(F.className+=" sey-show",c.default.fabricate(K,"horsey-show"))}function ye(e){!1!==(1===e.which&&!e.metaKey&&!e.ctrlKey)&&be()}function be(){ve()?Ce():me()}function we(e){Te(),e&&((G=e).className+=" sey-selected")}function Te(){G&&(G.className=G.className.replace(/ sey-selected/g,""),G=null)}function xe(e,t){var n=ee.source.length;if(0!==n)if(t>n)Te();else{var r=function(e){for(;e;){if(i.default.matchesSelector(e.parentElement,".sey-category"))return e.parentElement;e=e.parentElement}return null}(G)||z.firstChild,o=e?"lastChild":"firstChild",a=e?"previousSibling":"nextSibling",u=function(){if(G){if(G[a])return G[a];if(r[a]&&Xe(r[a])[o])return Xe(r[a])[o]}return Xe(z[o])[o]}();we(u),ge(u)&&xe(e,t?t+1:1)}}function Ce(){t.sleep(),F.className=F.className.replace(/ sey-show/g,""),Te(),c.default.fabricate(K,"horsey-hide"),e.value===Y&&(e.value="")}function Se(e){var t=ve(),n=e.which||e.keyCode;40===n?(s&&y.autoShowOnUpDown&&me(),t&&(xe(),Ee(e))):38===n?(s&&y.autoShowOnUpDown&&me(),t&&(xe(!0),Ee(e))):8===n?s&&y.autoShowOnUpDown&&me():t&&(13===n?(G?c.default.fabricate(G,"click"):Ce(),Ee(e)):27===n&&(Ce(),Ee(e)))}function Ee(e){e.stopPropagation(),e.preventDefault()}function Oe(){n&&n.classList.remove("sey-hide")}function Ne(){n&&n.classList.add("sey-hide")}function Re(){if(ve()){Q(!0),c.default.fabricate(K,"horsey-filter");var e=ae();if(y.blankSearch||e){var t=A({query:e});0===function(){var e=z.firstChild,t=0;for(;e;){var r=n(Xe(e));0===r?e.classList.add("sey-hide"):e.classList.remove("sey-hide"),t+=r,e=e.nextSibling}return t}()&&t&&Z?Oe():Ne(),G||xe(),G||t||Ce()}else Ce()}function n(t){for(var n=t.firstChild,r=0;n;)r>=B?c.default.fabricate(n,"horsey-hide"):(c.default.fabricate(n,"horsey-filter"),-1===n.className.indexOf("sey-hide")&&(r++,j&&le(n,e))),n=n.nextSibling;return r}}function Ae(e){13!==(e.which||e.keyCode)&&X()}function _e(e){var t=e.which||e.keyCode;13!==t&&9!==t&&setTimeout(me,0)}function ke(e){var t=e.target;if(t===K)return!0;for(;t;){if(t===F||t===K)return!0;t=t.parentNode}}function je(e){9===(e.which||e.keyCode)&&Ce()}function Ie(e){ke(e)||Ce()}function Le(e){var n=e?"remove":"add";t&&(t.destroy(),t=null),e||(t=(0,u.default)(F,K,{caret:s&&"INPUT"!==K.tagName,context:y.appendTo}),ve()||t.sleep()),e||s&&g.activeElement!==K?c.default[n](K,"focus",re):re(),s?(c.default[n](K,"keypress",_e),c.default[n](K,"keypress",X),c.default[n](K,"keydown",Ae),c.default[n](K,"paste",(function(e){_e(e),X(e)})),c.default[n](K,"keydown",Se),y.autoHideOnBlur&&c.default[n](K,"keydown",je)):(c.default[n](K,"click",ye),c.default[n](m,"keydown",Se)),y.autoHideOnClick&&c.default[n](g,"click",Ie),N&&c.default[n](N,"submit",Ce)}function Me(){Le(!0),S.contains(F)&&S.removeChild(F)}function He(t){r?!0===P?e.value+=" "+t:e.value=t:!0===P?e.innerHTML+=" "+t:e.innerHTML=t}function De(e,t){x(e,E(t))}function Ue(e,t){if("default"!==t.id){var n=w("div","sey-category-id");e.appendChild(n),x(n,t.id)}}function Pe(e,t){var n=e.toLowerCase(),r=E(t)||"";if((0,f.default)(n,r.toLowerCase()))return!0;var o=O(t)||"";return"string"==typeof o&&(0,f.default)(n,o.toLowerCase())}function Be(e,t){for(var n="",r=!1,o=t.start;!1===r&&o>=0;)n=e.substr(o-1,t.start-o+1),r=h.test(n),o--;return{text:r?n:null,start:o}}function qe(t,n){var r=Be(t,(0,o.default)(e)).text;if(r)return{input:r,suggestion:n}}function We(t){var n=e.value,r=(0,o.default)(e),i=Be(n,r),a=n.substr(0,i.start),u=n.substr(i.start+i.text.length+(r.end-r.start)),c=a+t+" ";e.value=c+u,(0,o.default)(e,{start:c.length,end:c.length})}function ze(){throw new Error("Anchoring in editable elements is disabled by default.")}function Fe(){throw new Error("Anchoring in editable elements is disabled by default.")}function Xe(e){return(0,i.default)(".sey-list",e)[0]}}function b(e){return"INPUT"===e.tagName||"TEXTAREA"===e.tagName}function w(e,t){var n=g.createElement(e);return n.className=t,n}function T(e){return function(){setTimeout(e,0)}}function x(e,t){e.innerText=e.textContent=t}function C(e){var t=e.getAttribute("contentEditable");return"false"!==t&&("true"===t||!!e.parentElement&&C(e.parentElement))}t.exports=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=t.setAppends,o=t.set,i=t.filter,a=t.source,u=t.cache,c=void 0===u?{}:u,f=t.predictNextSearch,l=t.renderItem,s=t.renderCategory,d=t.blankSearch,p=t.appendTo,h=t.anchor,v=t.debounce,g=!1!==t.cache;if(a){var m=t.getText,b=t.getValue,w="string"==typeof m?function(e){return e[m]}:"function"==typeof m?m:function(e){return e.toString()},T="string"==typeof b?function(e){return e[b]}:"function"==typeof b?b:function(e){return e},x=[],C=null,S=Number(t.limit)||1/0,E=y(e,{source:N,limit:S,getText:w,getValue:T,setAppends:n,predictNextSearch:f,renderItem:l,renderCategory:s,appendTo:p,anchor:h,noMatches:O,noMatchesText:t.noMatches,blankSearch:d,debounce:v,set:function(t){!0!==n&&(e.value=""),C=t,(o||E.defaultSetter)(w(t),t),E.emit("afterSet")},filter:i});return E}function O(e){return!!t.noMatches&&e.query.length}function N(n,o){var i=n.query,a=n.limit;if(t.blankSearch||0!==i.length){E&&E.emit("beforeUpdate");var u=(0,r.default)(i);if(g){var f=c[u];if(f){var d=f.created.getTime(),p=c.duration||86400;if(new Date(d+1e3*p)>new Date)return void o(null,f.items.slice())}}var h={previousSuggestions:x.slice(),previousSelection:C,input:i,renderItem:l,renderCategory:s,limit:a};"function"==typeof t.source?t.source(h,v):v(null,t.source)}else o(null,[],!0);function v(t,n){t&&(console.log("Autocomplete source error.",t,e),o(t,[]));var r=Array.isArray(n)?n:[];g&&(c[u]={created:new Date,items:r}),x=r,o(null,r.slice())}}}},{bullseye:3,"contra/emitter":7,crossvent:8,fuzzysearch:11,"hash-sum":12,"lodash/debounce":19,sektor:26,sell:35}],2:[function(e,t,n){t.exports=function(e,t){return Array.prototype.slice.call(e,t)}},{}],3:[function(e,t,n){"use strict";var r=e("crossvent"),o=e("./throttle"),i=e("./tailormade");t.exports=function(e,t,n){var a=n,u=t&&t.tagName;u||2!==arguments.length||(a=t),u||(t=e),a||(a={});var c=!1,f=o(g,30),l={update:!1!==a.autoupdateToCaret&&v},s=a.caret&&i(t,l);return g(),!1!==a.tracking&&r.add(window,"resize",f),{read:p,refresh:g,destroy:m,sleep:d};function d(){l.sleeping=!0}function p(){return h()}function h(e){var n=t.getBoundingClientRect(),r=document.body.scrollTop||document.documentElement.scrollTop;return s?{x:((e=s.read()).absolute?0:n.left)+e.x,y:(e.absolute?0:n.top)+r+e.y+20}:{x:n.left,y:n.top+r}}function v(e){g(e)}function g(n){if(c)throw new Error("Bullseye can't refresh after being destroyed. Create another instance instead.");if(s&&!n)return l.sleeping=!1,void s.refresh();var r=h(n);s||t===e||(r.y+=t.offsetHeight);var o=a.context;e.style.left=r.x+"px",e.style.top=(o?o.offsetHeight:r.y)+"px"}function m(){s&&s.destroy(),r.remove(window,"resize",f),c=!0}}},{"./tailormade":4,"./throttle":5,crossvent:8}],4:[function(e,t,n){(function(n){"use strict";var r=e("sell"),o=e("crossvent"),i=e("seleccion"),a=e("./throttle"),u=i.get,c=["direction","boxSizing","width","height","overflowX","overflowY","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","paddingTop","paddingRight","paddingBottom","paddingLeft","fontStyle","fontVariant","fontWeight","fontStretch","fontSize","fontSizeAdjust","lineHeight","fontFamily","textAlign","textTransform","textIndent","textDecoration","letterSpacing","wordSpacing"],f=n,l=document,s=null!==f.mozInnerScreenX&&void 0!==f.mozInnerScreenX;t.exports=function(e,t){var n="INPUT"===e.tagName||"TEXTAREA"===e.tagName,i=a((function(){if(d.sleeping)return;return(d.update||p)(h())}),30),d=t||{};return b(),{read:h,refresh:i,destroy:function(){b(!0)}};function p(){}function h(){return(n?v:g)()}function v(){var t=r(e),n=function(){var t=f.getComputedStyle?getComputedStyle(e):e.currentStyle,n=l.createElement("div"),r=n.style;l.body.appendChild(n),"INPUT"!==e.tagName&&(r.wordWrap="break-word");r.whiteSpace="pre-wrap",r.position="absolute",r.visibility="hidden",c.forEach((function(e){r[e]=t[e]})),s?(r.width=parseInt(t.width)-2+"px",e.scrollHeight>parseInt(t.height)&&(r.overflowY="scroll")):r.overflow="hidden";return{mirror:n,computed:t}}(),o=function(t,n){var r=l.createElement("span"),o=t.mirror,i=t.computed;y(o,m(e).substring(0,n)),"INPUT"===e.tagName&&(o.textContent=o.textContent.replace(/\s/g," "));return y(r,m(e).substring(n)||"."),o.appendChild(r),{x:r.offsetLeft+parseInt(i.borderLeftWidth),y:r.offsetTop+parseInt(i.borderTopWidth)}}(n,t.start);return l.body.removeChild(n.mirror),o}function g(){var e=u();if(e.rangeCount){var t=e.getRangeAt(0);if("P"===t.startContainer.nodeName&&0===t.startOffset)return{x:t.startContainer.offsetLeft,y:t.startContainer.offsetTop,absolute:!0};if(t.getClientRects){var n=t.getClientRects();if(n.length>0)return{x:n[0].left,y:n[0].top,absolute:!0}}}return{x:0,y:0}}function m(e){return n?e.value:e.innerHTML}function y(e,t){n?e.textContent=t:e.innerHTML=t}function b(t){var n=t?"remove":"add";o[n](e,"keydown",i),o[n](e,"keyup",i),o[n](e,"input",i),o[n](e,"paste",i),o[n](e,"change",i)}}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./throttle":5,crossvent:8,seleccion:33,sell:35}],5:[function(e,t,n){"use strict";t.exports=function(e,t){var n,r=-1/0;return function(){n||function o(){clearTimeout(n),n=null;var i=r+t,a=Date.now();a>i?(r=a,e()):n=setTimeout(o,i-a)}()}}},{}],6:[function(e,t,n){"use strict";var r=e("ticky");t.exports=function(e,t,n){e&&r((function(){e.apply(n||null,t||[])}))}},{ticky:36}],7:[function(e,t,n){"use strict";var r=e("atoa"),o=e("./debounce");t.exports=function(e,t){var n=t||{},i={};return void 0===e&&(e={}),e.on=function(t,n){return i[t]?i[t].push(n):i[t]=[n],e},e.once=function(t,n){return n._once=!0,e.on(t,n),e},e.off=function(t,n){var r=arguments.length;if(1===r)delete i[t];else if(0===r)i={};else{var o=i[t];if(!o)return e;o.splice(o.indexOf(n),1)}return e},e.emit=function(){var t=r(arguments);return e.emitterSnapshot(t.shift()).apply(this,t)},e.emitterSnapshot=function(t){var a=(i[t]||[]).slice(0);return function(){var i=r(arguments),u=this||e;if("error"===t&&!1!==n.throws&&!a.length)throw 1===i.length?i[0]:i;return a.forEach((function(r){n.async?o(r,i,u):r.apply(u,i),r._once&&e.off(t,r)})),e}},e}},{"./debounce":6,atoa:2}],8:[function(e,t,n){(function(n){"use strict";var r=e("custom-event"),o=e("./eventmap"),i=n.document,a=function(e,t,n,r){return e.addEventListener(t,n,r)},u=function(e,t,n,r){return e.removeEventListener(t,n,r)},c=[];function f(e,t,n){var r=function(e,t,n){var r,o;for(r=0;rn)return!1;if(r===n)return e===t;e:for(var o=0,i=0;o=t||n<0||g&&e-h>=l}function T(){var e=o();if(w(e))return x(e);d=setTimeout(T,function(e){var n=t-(e-p);return g?u(n,l-(e-h)):n}(e))}function x(e){return d=void 0,m&&c?y(e):(c=f=void 0,s)}function C(){var e=o(),n=w(e);if(c=arguments,f=this,p=e,n){if(void 0===d)return b(p);if(g)return clearTimeout(d),d=setTimeout(T,t),y(p)}return void 0===d&&(d=setTimeout(T,t)),s}return t=i(t)||0,r(n)&&(v=!!n.leading,l=(g="maxWait"in n)?a(i(n.maxWait)||0,t):l,m="trailing"in n?!!n.trailing:m),C.cancel=function(){void 0!==d&&clearTimeout(d),h=0,c=p=f=d=void 0},C.flush=function(){return void 0===d?s:x(o())},C}},{"./isObject":20,"./now":23,"./toNumber":24}],20:[function(e,t,n){t.exports=function(e){var t=typeof e;return null!=e&&("object"==t||"function"==t)}},{}],21:[function(e,t,n){t.exports=function(e){return null!=e&&"object"==typeof e}},{}],22:[function(e,t,n){var r=e("./_baseGetTag"),o=e("./isObjectLike");t.exports=function(e){return"symbol"==typeof e||o(e)&&"[object Symbol]"==r(e)}},{"./_baseGetTag":14,"./isObjectLike":21}],23:[function(e,t,n){var r=e("./_root");t.exports=function(){return r.Date.now()}},{"./_root":18}],24:[function(e,t,n){var r=e("./isObject"),o=e("./isSymbol"),i=/^\s+|\s+$/g,a=/^[-+]0x[0-9a-f]+$/i,u=/^0b[01]+$/i,c=/^0o[0-7]+$/i,f=parseInt;t.exports=function(e){if("number"==typeof e)return e;if(o(e))return NaN;if(r(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=r(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(i,"");var n=u.test(e);return n||c.test(e)?f(e.slice(2),n?2:8):a.test(e)?NaN:+e}},{"./isObject":20,"./isSymbol":22}],25:[function(e,t,n){var r,o,i=t.exports={};function a(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}function c(e){if(r===setTimeout)return setTimeout(e,0);if((r===a||!r)&&setTimeout)return r=setTimeout,setTimeout(e,0);try{return r(e,0)}catch(t){try{return r.call(null,e,0)}catch(t){return r.call(this,e,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:a}catch(e){r=a}try{o="function"==typeof clearTimeout?clearTimeout:u}catch(e){o=u}}();var f,l=[],s=!1,d=-1;function p(){s&&f&&(s=!1,f.length?l=f.concat(l):d=-1,l.length&&h())}function h(){if(!s){var e=c(p);s=!0;for(var t=l.length;t;){for(f=l,l=[];++d1)for(var n=1;n1?function(e,t){for(var n,r=i.createControlRange(),o=0,a=t.length;o=this.rangeCount)throw new Error("getRangeAt(): index out of bounds");return this._ranges[e].cloneRange()},a.removeRange=function(e){if("Control"===this._selection.type){for(var t=this._selection.createRange(),n=l(e),r=i.createControlRange(),o=!1,a=0,u=t.length;a=0&&(e._idleTimeoutId=setTimeout((function(){e._onTimeout&&e._onTimeout()}),t))},n.setImmediate="function"==typeof t?t:function(e){var t=c++,r=!(arguments.length<2)&&a.call(arguments,1);return u[t]=!0,o((function(){u[t]&&(r?e.apply(null,r):e.call(null),n.clearImmediate(t))})),t},n.clearImmediate="function"==typeof r?r:function(e){delete u[e]}}).call(this,e("timers").setImmediate,e("timers").clearImmediate)},{"process/browser.js":25,timers:37}]},{},[1])(1)})); \ No newline at end of file diff --git a/horsey.es5.js b/horsey.es5.js index b9cd70f..e6bb043 100644 --- a/horsey.es5.js +++ b/horsey.es5.js @@ -1,40 +1,36 @@ 'use strict'; -var _hashSum = require('hash-sum'); +var _hashSum = _interopRequireDefault(require("hash-sum")); -var _hashSum2 = _interopRequireDefault(_hashSum); +var _sell = _interopRequireDefault(require("sell")); -var _sell = require('sell'); +var _sektor = _interopRequireDefault(require("sektor")); -var _sell2 = _interopRequireDefault(_sell); +var _emitter = _interopRequireDefault(require("contra/emitter")); -var _sektor = require('sektor'); +var _bullseye = _interopRequireDefault(require("bullseye")); -var _sektor2 = _interopRequireDefault(_sektor); +var _crossvent = _interopRequireDefault(require("crossvent")); -var _emitter = require('contra/emitter'); +var _fuzzysearch = _interopRequireDefault(require("fuzzysearch")); -var _emitter2 = _interopRequireDefault(_emitter); +var _debounce = _interopRequireDefault(require("lodash/debounce")); -var _bullseye = require('bullseye'); +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } -var _bullseye2 = _interopRequireDefault(_bullseye); +function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } -var _crossvent = require('crossvent'); +function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } -var _crossvent2 = _interopRequireDefault(_crossvent); +function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } -var _fuzzysearch = require('fuzzysearch'); +function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } -var _fuzzysearch2 = _interopRequireDefault(_fuzzysearch); +function _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; } -var _debounce = require('lodash/debounce'); +function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } -var _debounce2 = _interopRequireDefault(_debounce); - -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } - -function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } +function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } var KEY_BACKSPACE = 8; var KEY_ENTER = 13; @@ -52,7 +48,7 @@ function horsey(el) { filter = options.filter, source = options.source, _options$cache = options.cache, - cache = _options$cache === undefined ? {} : _options$cache, + cache = _options$cache === void 0 ? {} : _options$cache, predictNextSearch = options.predictNextSearch, renderItem = options.renderItem, renderCategory = options.renderCategory, @@ -60,8 +56,8 @@ function horsey(el) { appendTo = options.appendTo, anchor = options.anchor, debounce = options.debounce; - var caching = options.cache !== false; + if (!source) { return; } @@ -78,7 +74,6 @@ function horsey(el) { } : typeof userGetValue === 'function' ? userGetValue : function (d) { return d; }; - var previousSuggestions = []; var previousSelection = null; var limit = Number(options.limit) || Infinity; @@ -101,43 +96,56 @@ function horsey(el) { if (setAppends !== true) { el.value = ''; } + previousSelection = s; + (_set || completer.defaultSetter)(getText(s), s); + completer.emit('afterSet'); }, - filter: filter }); return completer; + function noMatches(data) { if (!options.noMatches) { return false; } + return data.query.length; } + function sourceFunction(data, done) { var query = data.query, limit = data.limit; if (!options.blankSearch && query.length === 0) { - done(null, [], true);return; + done(null, [], true); + return; } + if (completer) { completer.emit('beforeUpdate'); } - var hash = (0, _hashSum2.default)(query); // fast, case insensitive, prevents collisions + + var hash = (0, _hashSum["default"])(query); // fast, case insensitive, prevents collisions + if (caching) { var entry = cache[hash]; + if (entry) { var start = entry.created.getTime(); var duration = cache.duration || 60 * 60 * 24; var diff = duration * 1000; var fresh = new Date(start + diff) > new Date(); + if (fresh) { - done(null, entry.items.slice());return; + done(null, entry.items.slice()); + return; } } } + var sourceData = { previousSuggestions: previousSuggestions.slice(), previousSelection: previousSelection, @@ -146,20 +154,28 @@ function horsey(el) { renderCategory: renderCategory, limit: limit }; + if (typeof options.source === 'function') { options.source(sourceData, sourced); } else { sourced(null, options.source); } + function sourced(err, result) { if (err) { console.log('Autocomplete source error.', err, el); done(err, []); } + var items = Array.isArray(result) ? result : []; + if (caching) { - cache[hash] = { created: new Date(), items: items }; + cache[hash] = { + created: new Date(), + items: items + }; } + previousSuggestions = items; done(null, items.slice()); } @@ -168,7 +184,6 @@ function horsey(el) { function autocomplete(el) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var o = options; var parent = o.appendTo || doc.body; var getText = o.getText, @@ -178,51 +193,56 @@ function autocomplete(el) { noMatches = o.noMatches, noMatchesText = o.noMatchesText, _o$highlighter = o.highlighter, - highlighter = _o$highlighter === undefined ? true : _o$highlighter, + highlighter = _o$highlighter === void 0 ? true : _o$highlighter, _o$highlightCompleteW = o.highlightCompleteWords, - highlightCompleteWords = _o$highlightCompleteW === undefined ? true : _o$highlightCompleteW, + highlightCompleteWords = _o$highlightCompleteW === void 0 ? true : _o$highlightCompleteW, _o$renderItem = o.renderItem, - renderItem = _o$renderItem === undefined ? defaultItemRenderer : _o$renderItem, + renderItem = _o$renderItem === void 0 ? defaultItemRenderer : _o$renderItem, _o$renderCategory = o.renderCategory, - renderCategory = _o$renderCategory === undefined ? defaultCategoryRenderer : _o$renderCategory, + renderCategory = _o$renderCategory === void 0 ? defaultCategoryRenderer : _o$renderCategory, setAppends = o.setAppends; - var limit = typeof o.limit === 'number' ? o.limit : Infinity; var userFilter = o.filter || defaultFilter; var userSet = o.set || defaultSetter; var categories = tag('div', 'sey-categories'); var container = tag('div', 'sey-container'); var deferredFiltering = defer(filtering); - var state = { counter: 0, query: null }; + var state = { + counter: 0, + query: null + }; var categoryMap = Object.create(null); var selection = null; - var eye = void 0; + var eye; var attachment = el; - var noneMatch = void 0; - var textInput = void 0; - var anyInput = void 0; - var ranchorleft = void 0; - var ranchorright = void 0; + var noneMatch; + var textInput; + var anyInput; + var ranchorleft; + var ranchorright; var lastPrefix = ''; var debounceTime = o.debounce || 300; - var debouncedLoading = (0, _debounce2.default)(loading, debounceTime); + var debouncedLoading = (0, _debounce["default"])(loading, debounceTime); if (o.autoHideOnBlur === void 0) { o.autoHideOnBlur = true; } + if (o.autoHideOnClick === void 0) { o.autoHideOnClick = true; } + if (o.autoShowOnUpDown === void 0) { o.autoShowOnUpDown = el.tagName === 'INPUT'; } + if (o.anchor) { ranchorleft = new RegExp('^' + o.anchor); ranchorright = new RegExp(o.anchor + '$'); } var hasItems = false; - var api = (0, _emitter2.default)({ + var api = (0, _emitter["default"])({ anchor: o.anchor, clear: clear, show: show, @@ -243,14 +263,15 @@ function autocomplete(el) { attachment: attachment, source: [] }); - retarget(el); container.appendChild(categories); + if (noMatches && noMatchesText) { noneMatch = tag('div', 'sey-empty sey-hide'); text(noneMatch, noMatchesText); container.appendChild(noneMatch); } + parent.appendChild(container); el.setAttribute('autocomplete', 'off'); @@ -278,23 +299,30 @@ function autocomplete(el) { if (typeof source !== 'function') { return; } - _crossvent2.default.remove(attachment, 'focus', loading); + + _crossvent["default"].remove(attachment, 'focus', loading); + var query = readInput(); + if (query === state.query) { return; } + hasItems = false; state.query = query; - var counter = ++state.counter; - - source({ query: query, limit: limit }, sourced); + source({ + query: query, + limit: limit + }, sourced); function sourced(err, result, blankQuery) { if (state.counter !== counter) { return; } + loaded(result, forceShow); + if (err || blankQuery) { hasItems = false; } @@ -310,17 +338,21 @@ function autocomplete(el) { return add(suggestion, cat); }); }); + if (forceShow) { show(); } + filtering(); } function clear() { unselect(); + while (categories.lastChild) { categories.removeChild(categories.lastChild); } + categoryMap = Object.create(null); hasItems = false; } @@ -333,17 +365,23 @@ function autocomplete(el) { if (!data.id) { data.id = 'default'; } + if (!categoryMap[data.id]) { categoryMap[data.id] = createCategory(); } + return categoryMap[data.id]; + function createCategory() { var category = tag('div', 'sey-category'); var ul = tag('ul', 'sey-list'); renderCategory(category, data); category.appendChild(ul); categories.appendChild(category); - return { data: data, ul: ul }; + return { + data: data, + ul: ul + }; } } @@ -351,13 +389,19 @@ function autocomplete(el) { var cat = getCategory(categoryData); var li = tag('li', 'sey-item'); renderItem(li, suggestion); + if (highlighter) { breakupForHighlighter(li); } - _crossvent2.default.add(li, 'mouseenter', hoverSuggestion); - _crossvent2.default.add(li, 'click', clickedSuggestion); - _crossvent2.default.add(li, 'horsey-filter', filterItem); - _crossvent2.default.add(li, 'horsey-hide', hideItem); + + _crossvent["default"].add(li, 'mouseenter', hoverSuggestion); + + _crossvent["default"].add(li, 'click', clickedSuggestion); + + _crossvent["default"].add(li, 'horsey-filter', filterItem); + + _crossvent["default"].add(li, 'horsey-hide', hideItem); + cat.ul.appendChild(li); api.source.push(suggestion); return li; @@ -376,6 +420,7 @@ function autocomplete(el) { source: api.source.slice(), selection: suggestion }) || ''; + if (lastPrefix) { el.value = lastPrefix; el.select(); @@ -386,16 +431,18 @@ function autocomplete(el) { function filterItem() { var value = readInput(); + if (filter(value, suggestion)) { li.className = li.className.replace(/ sey-hide/g, ''); } else { - _crossvent2.default.fabricate(li, 'horsey-hide'); + _crossvent["default"].fabricate(li, 'horsey-hide'); } } function hideItem() { if (!hidden(li)) { li.className += ' sey-hide'; + if (selection === li) { unselect(); } @@ -407,39 +454,31 @@ function autocomplete(el) { getTextChildren(el).forEach(function (el) { var parent = el.parentElement; var text = el.textContent || el.nodeValue || ''; + if (text.length === 0) { return; } - var _iteratorNormalCompletion = true; - var _didIteratorError = false; - var _iteratorError = undefined; - try { - for (var _iterator = text[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { - var char = _step.value; + var _iterator = _createForOfIteratorHelper(text), + _step; - parent.insertBefore(spanFor(char), el); + try { + for (_iterator.s(); !(_step = _iterator.n()).done;) { + var _char2 = _step.value; + parent.insertBefore(spanFor(_char2), el); } } catch (err) { - _didIteratorError = true; - _iteratorError = err; + _iterator.e(err); } finally { - try { - if (!_iteratorNormalCompletion && _iterator.return) { - _iterator.return(); - } - } finally { - if (_didIteratorError) { - throw _iteratorError; - } - } + _iterator.f(); } parent.removeChild(el); - function spanFor(char) { + + function spanFor(_char) { var span = doc.createElement('span'); span.className = 'sey-char'; - span.textContent = span.innerText = char; + span.textContent = span.innerText = _char; return span; } }); @@ -450,14 +489,17 @@ function autocomplete(el) { var words = needle.split(rword).filter(function (w) { return w.length; }); - var elems = [].concat(_toConsumableArray(el.querySelectorAll('.sey-char'))); - var chars = void 0; - var startIndex = 0; + var elems = _toConsumableArray(el.querySelectorAll('.sey-char')); + + var chars; + var startIndex = 0; balance(); + if (highlightCompleteWords) { whole(); } + fuzzy(); clearRemainder(); @@ -468,75 +510,56 @@ function autocomplete(el) { } function whole() { - var _iteratorNormalCompletion2 = true; - var _didIteratorError2 = false; - var _iteratorError2 = undefined; + var _iterator2 = _createForOfIteratorHelper(words), + _step2; try { - for (var _iterator2 = words[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { + for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) { var word = _step2.value; - var tempIndex = startIndex; + retry: while (tempIndex !== -1) { var init = true; var prevIndex = tempIndex; - var _iteratorNormalCompletion3 = true; - var _didIteratorError3 = false; - var _iteratorError3 = undefined; - try { - for (var _iterator3 = word[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { - var char = _step3.value; + var _iterator3 = _createForOfIteratorHelper(word), + _step3; - var i = chars.indexOf(char, prevIndex + 1); + try { + for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) { + var _char3 = _step3.value; + var i = chars.indexOf(_char3, prevIndex + 1); var fail = i === -1 || !init && prevIndex + 1 !== i; + if (init) { init = false; tempIndex = i; } + if (fail) { continue retry; } + prevIndex = i; } } catch (err) { - _didIteratorError3 = true; - _iteratorError3 = err; + _iterator3.e(err); } finally { - try { - if (!_iteratorNormalCompletion3 && _iterator3.return) { - _iterator3.return(); - } - } finally { - if (_didIteratorError3) { - throw _iteratorError3; - } - } + _iterator3.f(); } - var _iteratorNormalCompletion4 = true; - var _didIteratorError4 = false; - var _iteratorError4 = undefined; + var _iterator4 = _createForOfIteratorHelper(elems.splice(tempIndex, 1 + prevIndex - tempIndex)), + _step4; try { - for (var _iterator4 = elems.splice(tempIndex, 1 + prevIndex - tempIndex)[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) { + for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) { var _el = _step4.value; - on(_el); } } catch (err) { - _didIteratorError4 = true; - _iteratorError4 = err; + _iterator4.e(err); } finally { - try { - if (!_iteratorNormalCompletion4 && _iterator4.return) { - _iterator4.return(); - } - } finally { - if (_didIteratorError4) { - throw _iteratorError4; - } - } + _iterator4.f(); } balance(); @@ -545,32 +568,23 @@ function autocomplete(el) { } } } catch (err) { - _didIteratorError2 = true; - _iteratorError2 = err; + _iterator2.e(err); } finally { - try { - if (!_iteratorNormalCompletion2 && _iterator2.return) { - _iterator2.return(); - } - } finally { - if (_didIteratorError2) { - throw _iteratorError2; - } - } + _iterator2.f(); } } function fuzzy() { - var _iteratorNormalCompletion5 = true; - var _didIteratorError5 = false; - var _iteratorError5 = undefined; + var _iterator5 = _createForOfIteratorHelper(needle), + _step5; try { - for (var _iterator5 = needle[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) { + for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) { var input = _step5.value; while (elems.length) { var _el2 = elems.shift(); + if ((_el2.innerText || _el2.textContent) === input) { on(_el2); break; @@ -580,18 +594,9 @@ function autocomplete(el) { } } } catch (err) { - _didIteratorError5 = true; - _iteratorError5 = err; + _iterator5.e(err); } finally { - try { - if (!_iteratorNormalCompletion5 && _iterator5.return) { - _iterator5.return(); - } - } finally { - if (_didIteratorError5) { - throw _iteratorError5; - } - } + _iterator5.f(); } } @@ -604,6 +609,7 @@ function autocomplete(el) { function on(ch) { ch.classList.add('sey-char-highlight'); } + function off(ch) { ch.classList.remove('sey-char-highlight'); } @@ -612,10 +618,12 @@ function autocomplete(el) { function getTextChildren(el) { var texts = []; var walker = document.createTreeWalker(el, NodeFilter.SHOW_TEXT, null, false); - var node = void 0; + var node; + while (node = walker.nextNode()) { texts.push(node); } + return texts; } @@ -623,6 +631,7 @@ function autocomplete(el) { if (o.anchor) { return (isText() ? api.appendText : api.appendHTML)(getValue(value)); } + userSet(value); } @@ -631,32 +640,39 @@ function autocomplete(el) { var il = (isText() ? api.filterAnchoredText : api.filterAnchoredHTML)(value, suggestion); return il ? userFilter(il.input, il.suggestion) : false; } + return userFilter(value, suggestion); } function isText() { return isInput(attachment); } + function visible() { return container.className.indexOf('sey-show') !== -1; } + function hidden(li) { return li.className.indexOf('sey-hide') !== -1; } function show() { eye.refresh(); + if (!visible()) { container.className += ' sey-show'; - _crossvent2.default.fabricate(attachment, 'horsey-show'); + + _crossvent["default"].fabricate(attachment, 'horsey-show'); } } function toggler(e) { var left = e.which === 1 && !e.metaKey && !e.ctrlKey; + if (left === false) { return; // we only care about honest to god left-clicks } + toggle(); } @@ -670,6 +686,7 @@ function autocomplete(el) { function select(li) { unselect(); + if (li) { selection = li; selection.className += ' sey-selected'; @@ -685,13 +702,16 @@ function autocomplete(el) { function move(up, moves) { var total = api.source.length; + if (total === 0) { return; } + if (moves > total) { unselect(); return; } + var cat = findCategory(selection) || categories.firstChild; var first = up ? 'lastChild' : 'firstChild'; var last = up ? 'firstChild' : 'lastChild'; @@ -706,11 +726,13 @@ function autocomplete(el) { function findCategory(el) { while (el) { - if (_sektor2.default.matchesSelector(el.parentElement, '.sey-category')) { + if (_sektor["default"].matchesSelector(el.parentElement, '.sey-category')) { return el.parentElement; } + el = el.parentElement; } + return null; } @@ -719,10 +741,12 @@ function autocomplete(el) { if (selection[next]) { return selection[next]; } + if (cat[next] && findList(cat[next])[first]) { return findList(cat[next])[first]; } } + return findList(categories[first])[first]; } } @@ -731,7 +755,9 @@ function autocomplete(el) { eye.sleep(); container.className = container.className.replace(/ sey-show/g, ''); unselect(); - _crossvent2.default.fabricate(attachment, 'horsey-hide'); + + _crossvent["default"].fabricate(attachment, 'horsey-hide'); + if (el.value === lastPrefix) { el.value = ''; } @@ -740,10 +766,12 @@ function autocomplete(el) { function keydown(e) { var shown = visible(); var which = e.which || e.keyCode; + if (which === KEY_DOWN) { if (anyInput && o.autoShowOnUpDown) { show(); } + if (shown) { move(); stop(e); @@ -752,6 +780,7 @@ function autocomplete(el) { if (anyInput && o.autoShowOnUpDown) { show(); } + if (shown) { move(true); stop(e); @@ -763,10 +792,11 @@ function autocomplete(el) { } else if (shown) { if (which === KEY_ENTER) { if (selection) { - _crossvent2.default.fabricate(selection, 'click'); + _crossvent["default"].fabricate(selection, 'click'); } else { hide(); } + stop(e); } else if (which === KEY_ESC) { hide(); @@ -796,93 +826,123 @@ function autocomplete(el) { if (!visible()) { return; } + debouncedLoading(true); - _crossvent2.default.fabricate(attachment, 'horsey-filter'); + + _crossvent["default"].fabricate(attachment, 'horsey-filter'); + var value = readInput(); + if (!o.blankSearch && !value) { - hide();return; + hide(); + return; } - var nomatch = noMatches({ query: value }); + + var nomatch = noMatches({ + query: value + }); var count = walkCategories(); + if (count === 0 && nomatch && hasItems) { showNoResults(); } else { hideNoResults(); } + if (!selection) { move(); } + if (!selection && !nomatch) { hide(); } + function walkCategories() { var category = categories.firstChild; var count = 0; + while (category) { var list = findList(category); var partial = walkCategory(list); + if (partial === 0) { category.classList.add('sey-hide'); } else { category.classList.remove('sey-hide'); } + count += partial; category = category.nextSibling; } + return count; } + function walkCategory(ul) { var li = ul.firstChild; var count = 0; + while (li) { if (count >= limit) { - _crossvent2.default.fabricate(li, 'horsey-hide'); + _crossvent["default"].fabricate(li, 'horsey-hide'); } else { - _crossvent2.default.fabricate(li, 'horsey-filter'); + _crossvent["default"].fabricate(li, 'horsey-filter'); + if (li.className.indexOf('sey-hide') === -1) { count++; + if (highlighter) { highlight(li, value); } } } + li = li.nextSibling; } + return count; } } function deferredFilteringNoEnter(e) { var which = e.which || e.keyCode; + if (which === KEY_ENTER) { return; } + deferredFiltering(); } function deferredShow(e) { var which = e.which || e.keyCode; + if (which === KEY_ENTER || which === KEY_TAB) { return; } + setTimeout(show, 0); } function autocompleteEventTarget(e) { var target = e.target; + if (target === attachment) { return true; } + while (target) { if (target === container || target === attachment) { return true; } + target = target.parentNode; } } function hideOnBlur(e) { var which = e.which || e.keyCode; + if (which === KEY_TAB) { hide(); } @@ -892,55 +952,70 @@ function autocomplete(el) { if (autocompleteEventTarget(e)) { return; } + hide(); } function inputEvents(remove) { var op = remove ? 'remove' : 'add'; + if (eye) { eye.destroy(); eye = null; } + if (!remove) { - eye = (0, _bullseye2.default)(container, attachment, { + eye = (0, _bullseye["default"])(container, attachment, { caret: anyInput && attachment.tagName !== 'INPUT', context: o.appendTo }); + if (!visible()) { eye.sleep(); } } + if (remove || anyInput && doc.activeElement !== attachment) { - _crossvent2.default[op](attachment, 'focus', loading); + _crossvent["default"][op](attachment, 'focus', loading); } else { loading(); } + if (anyInput) { - _crossvent2.default[op](attachment, 'keypress', deferredShow); - _crossvent2.default[op](attachment, 'keypress', deferredFiltering); - _crossvent2.default[op](attachment, 'keydown', deferredFilteringNoEnter); - _crossvent2.default[op](attachment, 'paste', function (ev) { + _crossvent["default"][op](attachment, 'keypress', deferredShow); + + _crossvent["default"][op](attachment, 'keypress', deferredFiltering); + + _crossvent["default"][op](attachment, 'keydown', deferredFilteringNoEnter); + + _crossvent["default"][op](attachment, 'paste', function (ev) { deferredShow(ev); deferredFiltering(ev); }); - _crossvent2.default[op](attachment, 'keydown', keydown); + + _crossvent["default"][op](attachment, 'keydown', keydown); + if (o.autoHideOnBlur) { - _crossvent2.default[op](attachment, 'keydown', hideOnBlur); + _crossvent["default"][op](attachment, 'keydown', hideOnBlur); } } else { - _crossvent2.default[op](attachment, 'click', toggler); - _crossvent2.default[op](docElement, 'keydown', keydown); + _crossvent["default"][op](attachment, 'click', toggler); + + _crossvent["default"][op](docElement, 'keydown', keydown); } + if (o.autoHideOnClick) { - _crossvent2.default[op](doc, 'click', hideOnClick); + _crossvent["default"][op](doc, 'click', hideOnClick); } + if (form) { - _crossvent2.default[op](form, 'submit', hide); + _crossvent["default"][op](form, 'submit', hide); } } function destroy() { inputEvents(true); + if (parent.contains(container)) { parent.removeChild(container); } @@ -977,25 +1052,31 @@ function autocomplete(el) { function defaultFilter(q, suggestion) { var needle = q.toLowerCase(); var text = getText(suggestion) || ''; - if ((0, _fuzzysearch2.default)(needle, text.toLowerCase())) { + + if ((0, _fuzzysearch["default"])(needle, text.toLowerCase())) { return true; } + var value = getValue(suggestion) || ''; + if (typeof value !== 'string') { return false; } - return (0, _fuzzysearch2.default)(needle, value.toLowerCase()); + + return (0, _fuzzysearch["default"])(needle, value.toLowerCase()); } function loopbackToAnchor(text, p) { var result = ''; var anchored = false; var start = p.start; + while (anchored === false && start >= 0) { result = text.substr(start - 1, p.start - start + 1); anchored = ranchorleft.test(result); start--; } + return { text: anchored ? result : null, start: start @@ -1003,23 +1084,29 @@ function autocomplete(el) { } function filterAnchoredText(q, suggestion) { - var position = (0, _sell2.default)(el); + var position = (0, _sell["default"])(el); var input = loopbackToAnchor(q, position).text; + if (input) { - return { input: input, suggestion: suggestion }; + return { + input: input, + suggestion: suggestion + }; } } function appendText(value) { var current = el.value; - var position = (0, _sell2.default)(el); + var position = (0, _sell["default"])(el); var input = loopbackToAnchor(current, position); var left = current.substr(0, input.start); var right = current.substr(input.start + input.text.length + (position.end - position.start)); var before = left + value + ' '; - el.value = before + right; - (0, _sell2.default)(el, { start: before.length, end: before.length }); + (0, _sell["default"])(el, { + start: before.length, + end: before.length + }); } function filterAnchoredHTML() { @@ -1031,7 +1118,7 @@ function autocomplete(el) { } function findList(category) { - return (0, _sektor2.default)('.sey-list', category)[0]; + return (0, _sektor["default"])('.sey-list', category)[0]; } } @@ -1050,21 +1137,26 @@ function defer(fn) { setTimeout(fn, 0); }; } + function text(el, value) { el.innerText = el.textContent = value; } function isEditable(el) { var value = el.getAttribute('contentEditable'); + if (value === 'false') { return false; } + if (value === 'true') { return true; } + if (el.parentElement) { return isEditable(el.parentElement); } + return false; } diff --git a/package.json b/package.json index 01a8a55..b15eda4 100644 --- a/package.json +++ b/package.json @@ -7,8 +7,8 @@ "build": "yarn scripts && yarn styles", "deploy": "yarn build && yarn deployment && yarn sync", "deployment": "git add dist ; git add horsey.es5.js ; npm version ${BUMP:-\"patch\"} ; git add package.json ; git commit -am \"Release $(cat package.json | jq -r .version)\" ; git push --tags ; npm publish ; git push", - "scripts": "jshint . && babel --presets es2015 --out-file horsey.es5.js horsey.js && browserify -s horsey -t [ babelify --presets [ es2015 ] ] -do dist/horsey.js horsey.js && terser -m -c -o dist/horsey.min.js dist/horsey.js", - "start": "watchify -vs horsey -t [ babelify --presets [ es2015 ] ] -do dist/horsey.js horsey.js & stylus -w horsey.styl -o dist", + "scripts": "jshint . && babel --presets @babel/preset-env --out-file horsey.es5.js horsey.js && browserify -s horsey -t [ babelify --presets [ @babel/preset-env ] ] -do dist/horsey.js horsey.js && terser -m -c -o dist/horsey.min.js dist/horsey.js", + "start": "watchify -vs horsey -t [ babelify --presets [ @babel/preset-env ] ] -do dist/horsey.js horsey.js & stylus -w horsey.styl -o dist", "styles": "stylus horsey.styl -o dist && cleancss dist/horsey.css -o dist/horsey.min.css", "sync": "git checkout gh-pages ; git merge master ; git push ; git checkout master" }, @@ -23,25 +23,26 @@ }, "homepage": "https://github.com/bevacqua/horsey", "dependencies": { - "bullseye": "1.5.0", - "contra": "1.9.4", - "crossvent": "1.5.4", - "fuzzysearch": "1.0.3", - "hash-sum": "1.0.2", - "lodash": "4.13.1", - "sektor": "1.1.4", - "sell": "1.0.0" + "bullseye": "^1.5.0", + "contra": "^1.9.4", + "crossvent": "^1.5.5", + "fuzzysearch": "^1.0.3", + "hash-sum": "^2.0.0", + "lodash": "^4.17.15", + "sektor": "^1.1.5", + "sell": "^1.0.0" }, "devDependencies": { - "babel-cli": "6.10.1", - "babel-preset-es2015": "6.9.0", - "babelify": "7.3.0", - "browserify": "13.0.1", - "clean-css": "3.0.4", - "jshint": "2.9.2", - "nib": "1.0.4", - "stylus": "0.49.3", + "@babel/core": "^7.10.2", + "@babel/preset-env": "^7.10.2", + "babelify": "^10.0.0", + "browserify": "^16.5.1", + "clean-css": "^4.2.3", + "clean-css-cli": "^4.3.0", + "jshint": "^2.11.1", + "nib": "^1.1.2", + "stylus": "^0.54.7", "terser": "^4.7.0", - "watchify": "2.2.1" + "watchify": "^3.11.1" } }