vue-searchbox
Version:
Lightweight searchbox component for Vue
1,343 lines (1,113 loc) • 246 kB
JavaScript
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('vue')) :
typeof define === 'function' && define.amd ? define(['vue'], factory) :
(global = global || self, global.VueSearchbox = factory(global.Vue));
}(this, function (Vue) { 'use strict';
Vue = Vue && Vue.hasOwnProperty('default') ? Vue['default'] : Vue;
var global$1 = typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {};
function _extends() {
_extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends.apply(this, arguments);
}
function _taggedTemplateLiteralLoose(strings, raw) {
if (!raw) {
raw = strings.slice(0);
}
strings.raw = raw;
return strings;
}
/*!
* isobject <https://github.com/jonschlinkert/isobject>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*/
function isObject(val) {
return val != null && typeof val === 'object' && Array.isArray(val) === false;
}
/*!
* is-plain-object <https://github.com/jonschlinkert/is-plain-object>
*
* Copyright (c) 2014-2017, Jon Schlinkert.
* Released under the MIT License.
*/
function isObjectObject(o) {
return isObject(o) === true && Object.prototype.toString.call(o) === '[object Object]';
}
function isPlainObject(o) {
var ctor, prot;
if (isObjectObject(o) === false) return false; // If has modified constructor
ctor = o.constructor;
if (typeof ctor !== 'function') return false; // If has modified prototype
prot = ctor.prototype;
if (isObjectObject(prot) === false) return false; // If constructor does not have an Object-specific method
if (prot.hasOwnProperty('isPrototypeOf') === false) {
return false;
} // Most likely a plain Object
return true;
}
var ObjProto = Object.prototype;
var toString = ObjProto.toString;
var hasOwn = ObjProto.hasOwnProperty;
var FN_MATCH_REGEXP = /^\s*function (\w+)/; // https://github.com/vuejs/vue/blob/dev/src/core/util/props.js#L177
function getType(fn) {
var type = fn !== null && fn !== undefined ? fn.type ? fn.type : fn : null;
var match = type && type.toString().match(FN_MATCH_REGEXP);
return match && match[1];
}
function getNativeType(value) {
if (value === null || value === undefined) return null;
var match = value.constructor.toString().match(FN_MATCH_REGEXP);
return match && match[1];
}
/**
* No-op function
*/
function noop() {}
/**
* Determines whether the passed value is an integer. Uses `Number.isInteger` if available
*
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isInteger
* @param {*} value - The value to be tested for being an integer.
* @returns {boolean}
*/
var isInteger = Number.isInteger || function isInteger(value) {
return typeof value === 'number' && isFinite(value) && Math.floor(value) === value;
};
/**
* Determines whether the passed value is an Array.
*
* @param {*} value - The value to be tested for being an array.
* @returns {boolean}
*/
var isArray = Array.isArray || function isArray(value) {
return toString.call(value) === '[object Array]';
};
/**
* Checks if a value is a function
*
* @param {any} value - Value to check
* @returns {boolean}
*/
var isFunction = function isFunction(value) {
return toString.call(value) === '[object Function]';
};
/**
* Adds a `def` method to the object returning a new object with passed in argument as `default` property
*
* @param {object} type - Object to enhance
* @returns {object} the passed-in prop type
*/
function withDefault(type) {
return Object.defineProperty(type, 'def', {
value: function value(def) {
if (def === undefined && !this["default"]) {
return this;
}
if (!isFunction(def) && !validateType(this, def)) {
warn(this._vueTypes_name + " - invalid default value: \"" + def + "\"", def);
return this;
}
if (isArray(def)) {
this["default"] = function () {
return [].concat(def);
};
} else if (isPlainObject(def)) {
this["default"] = function () {
return Object.assign({}, def);
};
} else {
this["default"] = def;
}
return this;
},
enumerable: false,
writable: false
});
}
/**
* Adds a `isRequired` getter returning a new object with `required: true` key-value
*
* @param {object} type - Object to enhance
* @returns {object} the passed-in prop type
*/
function withRequired(type) {
return Object.defineProperty(type, 'isRequired', {
get: function get() {
this.required = true;
return this;
},
enumerable: false
});
}
/**
* Adds a validate method useful to set the prop `validator` function.
*
* @param {object} type Prop type to extend
* @returns {object} the passed-in prop type
*/
function withValidate(type) {
return Object.defineProperty(type, 'validate', {
value: function value(fn) {
this.validator = fn.bind(this);
return this;
},
enumerable: false
});
}
/**
* Adds `isRequired` and `def` modifiers to an object
*
* @param {string} name - Type internal name
* @param {object} obj - Object to enhance
* @returns {object}
*/
function toType(name, obj, validateFn) {
if (validateFn === void 0) {
validateFn = false;
}
Object.defineProperty(obj, '_vueTypes_name', {
enumerable: false,
writable: false,
value: name
});
withDefault(withRequired(obj));
if (validateFn) {
withValidate(obj);
}
if (isFunction(obj.validator)) {
obj.validator = obj.validator.bind(obj);
}
return obj;
}
/**
* Validates a given value against a prop type object
*
* @param {Object|*} type - Type to use for validation. Either a type object or a constructor
* @param {*} value - Value to check
* @param {boolean} silent - Silence warnings
* @returns {boolean}
*/
function validateType(type, value, silent) {
if (silent === void 0) {
silent = false;
}
var typeToCheck = type;
var valid = true;
var expectedType;
if (!isPlainObject(type)) {
typeToCheck = {
type: type
};
}
var namePrefix = typeToCheck._vueTypes_name ? typeToCheck._vueTypes_name + ' - ' : '';
if (hasOwn.call(typeToCheck, 'type') && typeToCheck.type !== null) {
if (typeToCheck.type === undefined) {
throw new TypeError("[VueTypes error]: Setting type to undefined is not allowed.");
}
if (!typeToCheck.required && value === undefined) {
return valid;
}
if (isArray(typeToCheck.type)) {
valid = typeToCheck.type.some(function (type) {
return validateType(type, value, true);
});
expectedType = typeToCheck.type.map(function (type) {
return getType(type);
}).join(' or ');
} else {
expectedType = getType(typeToCheck);
if (expectedType === 'Array') {
valid = isArray(value);
} else if (expectedType === 'Object') {
valid = isPlainObject(value);
} else if (expectedType === 'String' || expectedType === 'Number' || expectedType === 'Boolean' || expectedType === 'Function') {
valid = getNativeType(value) === expectedType;
} else {
valid = value instanceof typeToCheck.type;
}
}
}
if (!valid) {
silent === false && warn(namePrefix + "value \"" + value + "\" should be of type \"" + expectedType + "\"");
return false;
}
if (hasOwn.call(typeToCheck, 'validator') && isFunction(typeToCheck.validator)) {
// swallow warn
var oldWarn;
if (silent) {
oldWarn = warn;
warn = noop;
}
valid = typeToCheck.validator(value);
oldWarn && (warn = oldWarn);
if (!valid && silent === false) warn(namePrefix + "custom validation failed");
return valid;
}
return valid;
}
var warn = noop;
{
var hasConsole = typeof console !== 'undefined';
warn = hasConsole ? function warn(msg) {
// eslint-disable-next-line no-console
Vue.config.silent === false && console.warn("[VueTypes warn]: " + msg);
} : noop;
}
var typeDefaults = function typeDefaults() {
return {
func: function func() {},
bool: true,
string: '',
number: 0,
array: function array() {
return [];
},
object: function object() {
return {};
},
integer: 0
};
};
var setDefaults = function setDefaults(root) {
var currentDefaults = typeDefaults();
return Object.defineProperty(root, 'sensibleDefaults', {
enumerable: false,
set: function set(value) {
if (value === false) {
currentDefaults = {};
} else if (value === true) {
currentDefaults = typeDefaults();
} else {
currentDefaults = value;
}
},
get: function get() {
return currentDefaults;
}
});
};
function _objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
var VueTypes = {
get any() {
return toType('any', {
type: null
}, true);
},
get func() {
return toType('function', {
type: Function
}, true).def(VueTypes.sensibleDefaults.func);
},
get bool() {
return toType('boolean', {
type: Boolean
}, true).def(VueTypes.sensibleDefaults.bool);
},
get string() {
return toType('string', {
type: String
}, true).def(VueTypes.sensibleDefaults.string);
},
get number() {
return toType('number', {
type: Number
}, true).def(VueTypes.sensibleDefaults.number);
},
get array() {
return toType('array', {
type: Array
}, true).def(VueTypes.sensibleDefaults.array);
},
get object() {
return toType('object', {
type: Object
}, true).def(VueTypes.sensibleDefaults.object);
},
get integer() {
return toType('integer', {
type: Number,
validator: function validator(value) {
return isInteger(value);
}
}).def(VueTypes.sensibleDefaults.integer);
},
get symbol() {
return toType('symbol', {
type: null,
validator: function validator(value) {
return typeof value === 'symbol';
}
}, true);
},
extend: function extend(props) {
if (props === void 0) {
props = {};
}
var _props = props,
name = _props.name,
_props$validate = _props.validate,
validate = _props$validate === void 0 ? false : _props$validate,
_props$getter = _props.getter,
getter = _props$getter === void 0 ? false : _props$getter,
type = _objectWithoutPropertiesLoose(_props, ["name", "validate", "getter"]);
var descriptor;
if (getter) {
descriptor = {
get: function get() {
return toType(name, Object.assign({}, type), validate);
},
enumerable: true,
configurable: false
};
} else {
var validator = type.validator;
descriptor = {
value: function value() {
var ret = toType(name, Object.assign({}, type), validate);
if (validator) {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
ret.validator = validator.bind.apply(validator, [ret].concat(args));
}
return ret;
},
writable: false,
enumerable: true,
configurable: false
};
}
return Object.defineProperty(this, name, descriptor);
},
custom: function custom(validatorFn, warnMsg) {
if (warnMsg === void 0) {
warnMsg = 'custom validation failed';
}
if (typeof validatorFn !== 'function') {
throw new TypeError('[VueTypes error]: You must provide a function as argument');
}
return toType(validatorFn.name || '<<anonymous function>>', {
validator: function validator(value) {
var valid = validatorFn(value);
if (!valid) warn(this._vueTypes_name + " - " + warnMsg);
return valid;
}
});
},
oneOf: function oneOf(arr) {
if (!isArray(arr)) {
throw new TypeError('[VueTypes error]: You must provide an array as argument');
}
var msg = "oneOf - value should be one of \"" + arr.join('", "') + "\"";
var allowedTypes = arr.reduce(function (ret, v) {
if (v !== null && v !== undefined) {
ret.indexOf(v.constructor) === -1 && ret.push(v.constructor);
}
return ret;
}, []);
return toType('oneOf', {
type: allowedTypes.length > 0 ? allowedTypes : null,
validator: function validator(value) {
var valid = arr.indexOf(value) !== -1;
if (!valid) warn(msg);
return valid;
}
});
},
instanceOf: function instanceOf(instanceConstructor) {
return toType('instanceOf', {
type: instanceConstructor
});
},
oneOfType: function oneOfType(arr) {
if (!isArray(arr)) {
throw new TypeError('[VueTypes error]: You must provide an array as argument');
}
var hasCustomValidators = false;
var nativeChecks = arr.reduce(function (ret, type) {
if (isPlainObject(type)) {
if (type._vueTypes_name === 'oneOf') {
return ret.concat(type.type || []);
}
if (type.type && !isFunction(type.validator)) {
if (isArray(type.type)) return ret.concat(type.type);
ret.push(type.type);
} else if (isFunction(type.validator)) {
hasCustomValidators = true;
}
return ret;
}
ret.push(type);
return ret;
}, []);
if (!hasCustomValidators) {
// we got just native objects (ie: Array, Object)
// delegate to Vue native prop check
return toType('oneOfType', {
type: nativeChecks
});
}
var typesStr = arr.map(function (type) {
if (type && isArray(type.type)) {
return type.type.map(getType);
}
return getType(type);
}).reduce(function (ret, type) {
return ret.concat(isArray(type) ? type : [type]);
}, []).join('", "');
return this.custom(function oneOfType(value) {
var valid = arr.some(function (type) {
if (type._vueTypes_name === 'oneOf') {
return type.type ? validateType(type.type, value, true) : true;
}
return validateType(type, value, true);
});
if (!valid) warn("oneOfType - value type should be one of \"" + typesStr + "\"");
return valid;
});
},
arrayOf: function arrayOf(type) {
return toType('arrayOf', {
type: Array,
validator: function validator(values) {
var valid = values.every(function (value) {
return validateType(type, value);
});
if (!valid) warn("arrayOf - value must be an array of \"" + getType(type) + "\"");
return valid;
}
});
},
objectOf: function objectOf(type) {
return toType('objectOf', {
type: Object,
validator: function validator(obj) {
var valid = Object.keys(obj).every(function (key) {
return validateType(type, obj[key]);
});
if (!valid) warn("objectOf - value must be an object of \"" + getType(type) + "\"");
return valid;
}
});
},
shape: function shape(obj) {
var keys = Object.keys(obj);
var requiredKeys = keys.filter(function (key) {
return obj[key] && obj[key].required === true;
});
var type = toType('shape', {
type: Object,
validator: function validator(value) {
var _this = this;
if (!isPlainObject(value)) {
return false;
}
var valueKeys = Object.keys(value); // check for required keys (if any)
if (requiredKeys.length > 0 && requiredKeys.some(function (req) {
return valueKeys.indexOf(req) === -1;
})) {
warn("shape - at least one of required properties \"" + requiredKeys.join('", "') + "\" is not present");
return false;
}
return valueKeys.every(function (key) {
if (keys.indexOf(key) === -1) {
if (_this._vueTypes_isLoose === true) return true;
warn("shape - object is missing \"" + key + "\" property");
return false;
}
var type = obj[key];
return validateType(type, value[key]);
});
}
});
Object.defineProperty(type, '_vueTypes_isLoose', {
enumerable: false,
writable: true,
value: false
});
Object.defineProperty(type, 'loose', {
get: function get() {
this._vueTypes_isLoose = true;
return this;
},
enumerable: false
});
return type;
}
};
setDefaults(VueTypes);
VueTypes.utils = {
validate: function validate(value, type) {
return validateType(type, value, true);
},
toType: toType
};
VueTypes.sensibleDefaults = false;
var DataField = VueTypes.shape({
field: VueTypes.string,
weight: VueTypes.number
});
var types = {
app: VueTypes.string.isRequired,
url: VueTypes.string.def("https://scalr.api.appbase.io"),
credentials: VueTypes.string.isRequired,
analytics: VueTypes.bool.def(false),
headers: VueTypes.object,
dataField: VueTypes.oneOfType([VueTypes.string, VueTypes.arrayOf(VueTypes.oneOfType([VueTypes.string, DataField]))]),
nestedField: VueTypes.string,
title: VueTypes.string,
defaultValue: VueTypes.string,
placeholder: VueTypes.string.def("Search"),
showIcon: VueTypes.bool.def(true),
iconPosition: VueTypes.oneOf(["left", "right"]).def("right"),
icon: VueTypes.any,
showClear: VueTypes.bool.def(false),
clearIcon: VueTypes.any,
autosuggest: VueTypes.bool.def(true),
strictSelection: VueTypes.bool.def(false),
defaultSuggestions: VueTypes.arrayOf(VueTypes.object),
debounce: VueTypes.number.def(0),
highlight: VueTypes.bool.def(false),
highlightField: VueTypes.oneOfType([VueTypes.string, VueTypes.arrayOf(VueTypes.string)]),
customHighlight: VueTypes.func,
queryFormat: VueTypes.oneOf(["and", "or"]).def("or"),
fuzziness: VueTypes.oneOf([0, 1, 2, "AUTO"]),
showVoiceSearch: VueTypes.bool.def(false),
searchOperators: VueTypes.bool.def(false),
render: VueTypes.func,
renderError: VueTypes.oneOfType([VueTypes.string, VueTypes.any]),
renderNoSuggestion: VueTypes.oneOfType([VueTypes.string, VueTypes.any]),
renderAllSuggestions: VueTypes.oneOfType([VueTypes.string, VueTypes.func]),
renderMic: VueTypes.func,
innerClass: VueTypes.object,
style: VueTypes.object,
defaultQuery: VueTypes.func,
beforeValueChange: VueTypes.func,
className: VueTypes.string.def(""),
loader: VueTypes.object,
autoFocus: VueTypes.bool.def(false),
currentURL: VueTypes.string.def(""),
searchTerm: VueTypes.string.def("search"),
URLParams: VueTypes.bool.def(false),
analyticsConfig: VueTypes.shape({
emptyQuery: VueTypes.bool,
suggestionAnalytics: VueTypes.bool,
userId: VueTypes.string,
customEvents: VueTypes.object
}).def({})
};
/*
Based off glamor's StyleSheet, thanks Sunil ❤️
high performance StyleSheet for css-in-js systems
- uses multiple style tags behind the scenes for millions of rules
- uses `insertRule` for appending in production for *much* faster performance
// usage
import { StyleSheet } from '@emotion/sheet'
let styleSheet = new StyleSheet({ key: '', container: document.head })
styleSheet.insert('#box { border: 1px solid red; }')
- appends a css rule into the stylesheet
styleSheet.flush()
- empties the stylesheet of all its contents
*/
// $FlowFixMe
function sheetForTag(tag) {
if (tag.sheet) {
// $FlowFixMe
return tag.sheet;
} // this weirdness brought to you by firefox
/* istanbul ignore next */
for (var i = 0; i < document.styleSheets.length; i++) {
if (document.styleSheets[i].ownerNode === tag) {
// $FlowFixMe
return document.styleSheets[i];
}
}
}
function createStyleElement(options) {
var tag = document.createElement('style');
tag.setAttribute('data-emotion', options.key);
if (options.nonce !== undefined) {
tag.setAttribute('nonce', options.nonce);
}
tag.appendChild(document.createTextNode(''));
return tag;
}
var StyleSheet =
/*#__PURE__*/
function () {
function StyleSheet(options) {
this.isSpeedy = options.speedy === undefined ? "development" === 'production' : options.speedy;
this.tags = [];
this.ctr = 0;
this.nonce = options.nonce; // key is the value of the data-emotion attribute, it's used to identify different sheets
this.key = options.key;
this.container = options.container;
this.before = null;
}
var _proto = StyleSheet.prototype;
_proto.insert = function insert(rule) {
// the max length is how many rules we have per style tag, it's 65000 in speedy mode
// it's 1 in dev because we insert source maps that map a single rule to a location
// and you can only have one source map per style tag
if (this.ctr % (this.isSpeedy ? 65000 : 1) === 0) {
var _tag = createStyleElement(this);
var before;
if (this.tags.length === 0) {
before = this.before;
} else {
before = this.tags[this.tags.length - 1].nextSibling;
}
this.container.insertBefore(_tag, before);
this.tags.push(_tag);
}
var tag = this.tags[this.tags.length - 1];
if (this.isSpeedy) {
var sheet = sheetForTag(tag);
try {
// this is a really hot path
// we check the second character first because having "i"
// as the second character will happen less often than
// having "@" as the first character
var isImportRule = rule.charCodeAt(1) === 105 && rule.charCodeAt(0) === 64; // this is the ultrafast version, works across browsers
// the big drawback is that the css won't be editable in devtools
sheet.insertRule(rule, // we need to insert @import rules before anything else
// otherwise there will be an error
// technically this means that the @import rules will
// _usually_(not always since there could be multiple style tags)
// be the first ones in prod and generally later in dev
// this shouldn't really matter in the real world though
// @import is generally only used for font faces from google fonts and etc.
// so while this could be technically correct then it would be slower and larger
// for a tiny bit of correctness that won't matter in the real world
isImportRule ? 0 : sheet.cssRules.length);
} catch (e) {
{
console.warn("There was a problem inserting the following rule: \"" + rule + "\"", e);
}
}
} else {
tag.appendChild(document.createTextNode(rule));
}
this.ctr++;
};
_proto.flush = function flush() {
// $FlowFixMe
this.tags.forEach(function (tag) {
return tag.parentNode.removeChild(tag);
});
this.tags = [];
this.ctr = 0;
};
return StyleSheet;
}();
function stylis_min(W) {
function M(d, c, e, h, a) {
for (var m = 0, b = 0, v = 0, n = 0, q, g, x = 0, K = 0, k, u = k = q = 0, l = 0, r = 0, I = 0, t = 0, B = e.length, J = B - 1, y, f = '', p = '', F = '', G = '', C; l < B;) {
g = e.charCodeAt(l);
l === J && 0 !== b + n + v + m && (0 !== b && (g = 47 === b ? 10 : 47), n = v = m = 0, B++, J++);
if (0 === b + n + v + m) {
if (l === J && (0 < r && (f = f.replace(N, '')), 0 < f.trim().length)) {
switch (g) {
case 32:
case 9:
case 59:
case 13:
case 10:
break;
default:
f += e.charAt(l);
}
g = 59;
}
switch (g) {
case 123:
f = f.trim();
q = f.charCodeAt(0);
k = 1;
for (t = ++l; l < B;) {
switch (g = e.charCodeAt(l)) {
case 123:
k++;
break;
case 125:
k--;
break;
case 47:
switch (g = e.charCodeAt(l + 1)) {
case 42:
case 47:
a: {
for (u = l + 1; u < J; ++u) {
switch (e.charCodeAt(u)) {
case 47:
if (42 === g && 42 === e.charCodeAt(u - 1) && l + 2 !== u) {
l = u + 1;
break a;
}
break;
case 10:
if (47 === g) {
l = u + 1;
break a;
}
}
}
l = u;
}
}
break;
case 91:
g++;
case 40:
g++;
case 34:
case 39:
for (; l++ < J && e.charCodeAt(l) !== g;) {}
}
if (0 === k) break;
l++;
}
k = e.substring(t, l);
0 === q && (q = (f = f.replace(ca, '').trim()).charCodeAt(0));
switch (q) {
case 64:
0 < r && (f = f.replace(N, ''));
g = f.charCodeAt(1);
switch (g) {
case 100:
case 109:
case 115:
case 45:
r = c;
break;
default:
r = O;
}
k = M(c, r, k, g, a + 1);
t = k.length;
0 < A && (r = X(O, f, I), C = H(3, k, r, c, D, z, t, g, a, h), f = r.join(''), void 0 !== C && 0 === (t = (k = C.trim()).length) && (g = 0, k = ''));
if (0 < t) switch (g) {
case 115:
f = f.replace(da, ea);
case 100:
case 109:
case 45:
k = f + '{' + k + '}';
break;
case 107:
f = f.replace(fa, '$1 $2');
k = f + '{' + k + '}';
k = 1 === w || 2 === w && L('@' + k, 3) ? '@-webkit-' + k + '@' + k : '@' + k;
break;
default:
k = f + k, 112 === h && (k = (p += k, ''));
} else k = '';
break;
default:
k = M(c, X(c, f, I), k, h, a + 1);
}
F += k;
k = I = r = u = q = 0;
f = '';
g = e.charCodeAt(++l);
break;
case 125:
case 59:
f = (0 < r ? f.replace(N, '') : f).trim();
if (1 < (t = f.length)) switch (0 === u && (q = f.charCodeAt(0), 45 === q || 96 < q && 123 > q) && (t = (f = f.replace(' ', ':')).length), 0 < A && void 0 !== (C = H(1, f, c, d, D, z, p.length, h, a, h)) && 0 === (t = (f = C.trim()).length) && (f = '\x00\x00'), q = f.charCodeAt(0), g = f.charCodeAt(1), q) {
case 0:
break;
case 64:
if (105 === g || 99 === g) {
G += f + e.charAt(l);
break;
}
default:
58 !== f.charCodeAt(t - 1) && (p += P(f, q, g, f.charCodeAt(2)));
}
I = r = u = q = 0;
f = '';
g = e.charCodeAt(++l);
}
}
switch (g) {
case 13:
case 10:
47 === b ? b = 0 : 0 === 1 + q && 107 !== h && 0 < f.length && (r = 1, f += '\x00');
0 < A * Y && H(0, f, c, d, D, z, p.length, h, a, h);
z = 1;
D++;
break;
case 59:
case 125:
if (0 === b + n + v + m) {
z++;
break;
}
default:
z++;
y = e.charAt(l);
switch (g) {
case 9:
case 32:
if (0 === n + m + b) switch (x) {
case 44:
case 58:
case 9:
case 32:
y = '';
break;
default:
32 !== g && (y = ' ');
}
break;
case 0:
y = '\\0';
break;
case 12:
y = '\\f';
break;
case 11:
y = '\\v';
break;
case 38:
0 === n + b + m && (r = I = 1, y = '\f' + y);
break;
case 108:
if (0 === n + b + m + E && 0 < u) switch (l - u) {
case 2:
112 === x && 58 === e.charCodeAt(l - 3) && (E = x);
case 8:
111 === K && (E = K);
}
break;
case 58:
0 === n + b + m && (u = l);
break;
case 44:
0 === b + v + n + m && (r = 1, y += '\r');
break;
case 34:
case 39:
0 === b && (n = n === g ? 0 : 0 === n ? g : n);
break;
case 91:
0 === n + b + v && m++;
break;
case 93:
0 === n + b + v && m--;
break;
case 41:
0 === n + b + m && v--;
break;
case 40:
if (0 === n + b + m) {
if (0 === q) switch (2 * x + 3 * K) {
case 533:
break;
default:
q = 1;
}
v++;
}
break;
case 64:
0 === b + v + n + m + u + k && (k = 1);
break;
case 42:
case 47:
if (!(0 < n + m + v)) switch (b) {
case 0:
switch (2 * g + 3 * e.charCodeAt(l + 1)) {
case 235:
b = 47;
break;
case 220:
t = l, b = 42;
}
break;
case 42:
47 === g && 42 === x && t + 2 !== l && (33 === e.charCodeAt(t + 2) && (p += e.substring(t, l + 1)), y = '', b = 0);
}
}
0 === b && (f += y);
}
K = x;
x = g;
l++;
}
t = p.length;
if (0 < t) {
r = c;
if (0 < A && (C = H(2, p, r, d, D, z, t, h, a, h), void 0 !== C && 0 === (p = C).length)) return G + p + F;
p = r.join(',') + '{' + p + '}';
if (0 !== w * E) {
2 !== w || L(p, 2) || (E = 0);
switch (E) {
case 111:
p = p.replace(ha, ':-moz-$1') + p;
break;
case 112:
p = p.replace(Q, '::-webkit-input-$1') + p.replace(Q, '::-moz-$1') + p.replace(Q, ':-ms-input-$1') + p;
}
E = 0;
}
}
return G + p + F;
}
function X(d, c, e) {
var h = c.trim().split(ia);
c = h;
var a = h.length,
m = d.length;
switch (m) {
case 0:
case 1:
var b = 0;
for (d = 0 === m ? '' : d[0] + ' '; b < a; ++b) {
c[b] = Z(d, c[b], e).trim();
}
break;
default:
var v = b = 0;
for (c = []; b < a; ++b) {
for (var n = 0; n < m; ++n) {
c[v++] = Z(d[n] + ' ', h[b], e).trim();
}
}
}
return c;
}
function Z(d, c, e) {
var h = c.charCodeAt(0);
33 > h && (h = (c = c.trim()).charCodeAt(0));
switch (h) {
case 38:
return c.replace(F, '$1' + d.trim());
case 58:
return d.trim() + c.replace(F, '$1' + d.trim());
default:
if (0 < 1 * e && 0 < c.indexOf('\f')) return c.replace(F, (58 === d.charCodeAt(0) ? '' : '$1') + d.trim());
}
return d + c;
}
function P(d, c, e, h) {
var a = d + ';',
m = 2 * c + 3 * e + 4 * h;
if (944 === m) {
d = a.indexOf(':', 9) + 1;
var b = a.substring(d, a.length - 1).trim();
b = a.substring(0, d).trim() + b + ';';
return 1 === w || 2 === w && L(b, 1) ? '-webkit-' + b + b : b;
}
if (0 === w || 2 === w && !L(a, 1)) return a;
switch (m) {
case 1015:
return 97 === a.charCodeAt(10) ? '-webkit-' + a + a : a;
case 951:
return 116 === a.charCodeAt(3) ? '-webkit-' + a + a : a;
case 963:
return 110 === a.charCodeAt(5) ? '-webkit-' + a + a : a;
case 1009:
if (100 !== a.charCodeAt(4)) break;
case 969:
case 942:
return '-webkit-' + a + a;
case 978:
return '-webkit-' + a + '-moz-' + a + a;
case 1019:
case 983:
return '-webkit-' + a + '-moz-' + a + '-ms-' + a + a;
case 883:
if (45 === a.charCodeAt(8)) return '-webkit-' + a + a;
if (0 < a.indexOf('image-set(', 11)) return a.replace(ja, '$1-webkit-$2') + a;
break;
case 932:
if (45 === a.charCodeAt(4)) switch (a.charCodeAt(5)) {
case 103:
return '-webkit-box-' + a.replace('-grow', '') + '-webkit-' + a + '-ms-' + a.replace('grow', 'positive') + a;
case 115:
return '-webkit-' + a + '-ms-' + a.replace('shrink', 'negative') + a;
case 98:
return '-webkit-' + a + '-ms-' + a.replace('basis', 'preferred-size') + a;
}
return '-webkit-' + a + '-ms-' + a + a;
case 964:
return '-webkit-' + a + '-ms-flex-' + a + a;
case 1023:
if (99 !== a.charCodeAt(8)) break;
b = a.substring(a.indexOf(':', 15)).replace('flex-', '').replace('space-between', 'justify');
return '-webkit-box-pack' + b + '-webkit-' + a + '-ms-flex-pack' + b + a;
case 1005:
return ka.test(a) ? a.replace(aa, ':-webkit-') + a.replace(aa, ':-moz-') + a : a;
case 1e3:
b = a.substring(13).trim();
c = b.indexOf('-') + 1;
switch (b.charCodeAt(0) + b.charCodeAt(c)) {
case 226:
b = a.replace(G, 'tb');
break;
case 232:
b = a.replace(G, 'tb-rl');
break;
case 220:
b = a.replace(G, 'lr');
break;
default:
return a;
}
return '-webkit-' + a + '-ms-' + b + a;
case 1017:
if (-1 === a.indexOf('sticky', 9)) break;
case 975:
c = (a = d).length - 10;
b = (33 === a.charCodeAt(c) ? a.substring(0, c) : a).substring(d.indexOf(':', 7) + 1).trim();
switch (m = b.charCodeAt(0) + (b.charCodeAt(7) | 0)) {
case 203:
if (111 > b.charCodeAt(8)) break;
case 115:
a = a.replace(b, '-webkit-' + b) + ';' + a;
break;
case 207:
case 102:
a = a.replace(b, '-webkit-' + (102 < m ? 'inline-' : '') + 'box') + ';' + a.replace(b, '-webkit-' + b) + ';' + a.replace(b, '-ms-' + b + 'box') + ';' + a;
}
return a + ';';
case 938:
if (45 === a.charCodeAt(5)) switch (a.charCodeAt(6)) {
case 105:
return b = a.replace('-items', ''), '-webkit-' + a + '-webkit-box-' + b + '-ms-flex-' + b + a;
case 115:
return '-webkit-' + a + '-ms-flex-item-' + a.replace(ba, '') + a;
default:
return '-webkit-' + a + '-ms-flex-line-pack' + a.replace('align-content', '').replace(ba, '') + a;
}
break;
case 973:
case 989:
if (45 !== a.charCodeAt(3) || 122 === a.charCodeAt(4)) break;
case 931:
case 953:
if (!0 === la.test(d)) return 115 === (b = d.substring(d.indexOf(':') + 1)).charCodeAt(0) ? P(d.replace('stretch', 'fill-available'), c, e, h).replace(':fill-available', ':stretch') :