diff --git a/dist/quill.js b/dist/quill.js new file mode 100644 index 0000000000..75565b05ca --- /dev/null +++ b/dist/quill.js @@ -0,0 +1,8980 @@ +/*! Quill Editor v0.18.1 + * https://quilljs.com/ + * Copyright (c) 2014, Jason Chen + * Copyright (c) 2013, salesforce.com + */ +!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.Quill=e()}}(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);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o + * Build: `lodash modern include="difference,flatten,intersection,last,all,each,indexOf,invoke,map,pluck,reduce,bind,defer,partial,clone,defaults,has,keys,omit,values,isArray,isElement,isEqual,isNumber,isObject,isString,uniqueId" --debug --output .build/lodash.js` + * Copyright 2012-2013 The Dojo Foundation + * Based on Underscore.js 1.5.2 + * Copyright 2009-2013 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ +;(function() { + + /** Used as a safe reference for `undefined` in pre ES5 environments */ + var undefined; + + /** Used to pool arrays and objects used internally */ + var arrayPool = [], + objectPool = []; + + /** Used to generate unique IDs */ + var idCounter = 0; + + /** Used to prefix keys to avoid issues with `__proto__` and properties on `Object.prototype` */ + var keyPrefix = +new Date + ''; + + /** Used as the size when optimizations are enabled for large arrays */ + var largeArraySize = 75; + + /** Used as the max size of the `arrayPool` and `objectPool` */ + var maxPoolSize = 40; + + /** Used to match regexp flags from their coerced string values */ + var reFlags = /\w*$/; + + /** Used to detected named functions */ + var reFuncName = /^\s*function[ \n\r\t]+\w/; + + /** Used to detect functions containing a `this` reference */ + var reThis = /\bthis\b/; + + /** `Object#toString` result shortcuts */ + var argsClass = '[object Arguments]', + arrayClass = '[object Array]', + boolClass = '[object Boolean]', + dateClass = '[object Date]', + funcClass = '[object Function]', + numberClass = '[object Number]', + objectClass = '[object Object]', + regexpClass = '[object RegExp]', + stringClass = '[object String]'; + + /** Used to identify object classifications that `_.clone` supports */ + var cloneableClasses = {}; + cloneableClasses[funcClass] = false; + cloneableClasses[argsClass] = cloneableClasses[arrayClass] = + cloneableClasses[boolClass] = cloneableClasses[dateClass] = + cloneableClasses[numberClass] = cloneableClasses[objectClass] = + cloneableClasses[regexpClass] = cloneableClasses[stringClass] = true; + + /** Used as the property descriptor for `__bindData__` */ + var descriptor = { + 'configurable': false, + 'enumerable': false, + 'value': null, + 'writable': false + }; + + /** Used to determine if values are of the language type Object */ + var objectTypes = { + 'boolean': false, + 'function': true, + 'object': true, + 'number': false, + 'string': false, + 'undefined': false + }; + + /** Used as a reference to the global object */ + var root = (objectTypes[typeof window] && window) || this; + + /** Detect free variable `exports` */ + var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports; + + /** Detect free variable `module` */ + var freeModule = objectTypes[typeof module] && module && !module.nodeType && module; + + /** Detect the popular CommonJS extension `module.exports` */ + var moduleExports = freeModule && freeModule.exports === freeExports && freeExports; + + /** Detect free variable `global` from Node.js or Browserified code and use it as `root` */ + var freeGlobal = objectTypes[typeof global] && global; + if (freeGlobal && (freeGlobal.global === freeGlobal || freeGlobal.window === freeGlobal)) { + root = freeGlobal; + } + + /*--------------------------------------------------------------------------*/ + + /** + * The base implementation of `_.indexOf` without support for binary searches + * or `fromIndex` constraints. + * + * @private + * @param {Array} array The array to search. + * @param {*} value The value to search for. + * @param {number} [fromIndex=0] The index to search from. + * @returns {number} Returns the index of the matched value or `-1`. + */ + function baseIndexOf(array, value, fromIndex) { + var index = (fromIndex || 0) - 1, + length = array ? array.length : 0; + + while (++index < length) { + if (array[index] === value) { + return index; + } + } + return -1; + } + + /** + * An implementation of `_.contains` for cache objects that mimics the return + * signature of `_.indexOf` by returning `0` if the value is found, else `-1`. + * + * @private + * @param {Object} cache The cache object to inspect. + * @param {*} value The value to search for. + * @returns {number} Returns `0` if `value` is found, else `-1`. + */ + function cacheIndexOf(cache, value) { + var type = typeof value; + cache = cache.cache; + + if (type == 'boolean' || value == null) { + return cache[value] ? 0 : -1; + } + if (type != 'number' && type != 'string') { + type = 'object'; + } + var key = type == 'number' ? value : keyPrefix + value; + cache = (cache = cache[type]) && cache[key]; + + return type == 'object' + ? (cache && baseIndexOf(cache, value) > -1 ? 0 : -1) + : (cache ? 0 : -1); + } + + /** + * Adds a given value to the corresponding cache object. + * + * @private + * @param {*} value The value to add to the cache. + */ + function cachePush(value) { + var cache = this.cache, + type = typeof value; + + if (type == 'boolean' || value == null) { + cache[value] = true; + } else { + if (type != 'number' && type != 'string') { + type = 'object'; + } + var key = type == 'number' ? value : keyPrefix + value, + typeCache = cache[type] || (cache[type] = {}); + + if (type == 'object') { + (typeCache[key] || (typeCache[key] = [])).push(value); + } else { + typeCache[key] = true; + } + } + } + + /** + * Creates a cache object to optimize linear searches of large arrays. + * + * @private + * @param {Array} [array=[]] The array to search. + * @returns {null|Object} Returns the cache object or `null` if caching should not be used. + */ + function createCache(array) { + var index = -1, + length = array.length, + first = array[0], + mid = array[(length / 2) | 0], + last = array[length - 1]; + + if (first && typeof first == 'object' && + mid && typeof mid == 'object' && last && typeof last == 'object') { + return false; + } + var cache = getObject(); + cache['false'] = cache['null'] = cache['true'] = cache['undefined'] = false; + + var result = getObject(); + result.array = array; + result.cache = cache; + result.push = cachePush; + + while (++index < length) { + result.push(array[index]); + } + return result; + } + + /** + * Gets an array from the array pool or creates a new one if the pool is empty. + * + * @private + * @returns {Array} The array from the pool. + */ + function getArray() { + return arrayPool.pop() || []; + } + + /** + * Gets an object from the object pool or creates a new one if the pool is empty. + * + * @private + * @returns {Object} The object from the pool. + */ + function getObject() { + return objectPool.pop() || { + 'array': null, + 'cache': null, + 'false': false, + 'null': false, + 'number': null, + 'object': null, + 'push': null, + 'string': null, + 'true': false, + 'undefined': false + }; + } + + /** + * Releases the given array back to the array pool. + * + * @private + * @param {Array} [array] The array to release. + */ + function releaseArray(array) { + array.length = 0; + if (arrayPool.length < maxPoolSize) { + arrayPool.push(array); + } + } + + /** + * Releases the given object back to the object pool. + * + * @private + * @param {Object} [object] The object to release. + */ + function releaseObject(object) { + var cache = object.cache; + if (cache) { + releaseObject(cache); + } + object.array = object.cache =object.object = object.number = object.string =null; + if (objectPool.length < maxPoolSize) { + objectPool.push(object); + } + } + + /** + * Slices the `collection` from the `start` index up to, but not including, + * the `end` index. + * + * Note: This function is used instead of `Array#slice` to support node lists + * in IE < 9 and to ensure dense arrays are returned. + * + * @private + * @param {Array|Object|string} collection The collection to slice. + * @param {number} start The start index. + * @param {number} end The end index. + * @returns {Array} Returns the new array. + */ + function slice(array, start, end) { + start || (start = 0); + if (typeof end == 'undefined') { + end = array ? array.length : 0; + } + var index = -1, + length = end - start || 0, + result = Array(length < 0 ? 0 : length); + + while (++index < length) { + result[index] = array[start + index]; + } + return result; + } + + /*--------------------------------------------------------------------------*/ + + /** + * Used for `Array` method references. + * + * Normally `Array.prototype` would suffice, however, using an array literal + * avoids issues in Narwhal. + */ + var arrayRef = []; + + /** Used for native method references */ + var objectProto = Object.prototype; + + /** Used to resolve the internal [[Class]] of values */ + var toString = objectProto.toString; + + /** Used to detect if a method is native */ + var reNative = RegExp('^' + + String(toString) + .replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + .replace(/toString| for [^\]]+/g, '.*?') + '$' + ); + + /** Native method shortcuts */ + var fnToString = Function.prototype.toString, + hasOwnProperty = objectProto.hasOwnProperty, + push = arrayRef.push, + unshift = arrayRef.unshift; + + /** Used to set meta data on functions */ + var defineProperty = (function() { + // IE 8 only accepts DOM elements + try { + var o = {}, + func = isNative(func = Object.defineProperty) && func, + result = func(o, o, o) && func; + } catch(e) { } + return result; + }()); + + /* Native method shortcuts for methods with the same name as other `lodash` methods */ + var nativeCreate = isNative(nativeCreate = Object.create) && nativeCreate, + nativeIsArray = isNative(nativeIsArray = Array.isArray) && nativeIsArray, + nativeKeys = isNative(nativeKeys = Object.keys) && nativeKeys, + nativeMax = Math.max; + + /** Used to lookup a built-in constructor by [[Class]] */ + var ctorByClass = {}; + ctorByClass[arrayClass] = Array; + ctorByClass[boolClass] = Boolean; + ctorByClass[dateClass] = Date; + ctorByClass[funcClass] = Function; + ctorByClass[objectClass] = Object; + ctorByClass[numberClass] = Number; + ctorByClass[regexpClass] = RegExp; + ctorByClass[stringClass] = String; + + /*--------------------------------------------------------------------------*/ + + /** + * Creates a `lodash` object which wraps the given value to enable intuitive + * method chaining. + * + * In addition to Lo-Dash methods, wrappers also have the following `Array` methods: + * `concat`, `join`, `pop`, `push`, `reverse`, `shift`, `slice`, `sort`, `splice`, + * and `unshift` + * + * Chaining is supported in custom builds as long as the `value` method is + * implicitly or explicitly included in the build. + * + * The chainable wrapper functions are: + * `after`, `assign`, `bind`, `bindAll`, `bindKey`, `chain`, `compact`, + * `compose`, `concat`, `countBy`, `create`, `createCallback`, `curry`, + * `debounce`, `defaults`, `defer`, `delay`, `difference`, `filter`, `flatten`, + * `forEach`, `forEachRight`, `forIn`, `forInRight`, `forOwn`, `forOwnRight`, + * `functions`, `groupBy`, `indexBy`, `initial`, `intersection`, `invert`, + * `invoke`, `keys`, `map`, `max`, `memoize`, `merge`, `min`, `object`, `omit`, + * `once`, `pairs`, `partial`, `partialRight`, `pick`, `pluck`, `pull`, `push`, + * `range`, `reject`, `remove`, `rest`, `reverse`, `shuffle`, `slice`, `sort`, + * `sortBy`, `splice`, `tap`, `throttle`, `times`, `toArray`, `transform`, + * `union`, `uniq`, `unshift`, `unzip`, `values`, `where`, `without`, `wrap`, + * and `zip` + * + * The non-chainable wrapper functions are: + * `clone`, `cloneDeep`, `contains`, `escape`, `every`, `find`, `findIndex`, + * `findKey`, `findLast`, `findLastIndex`, `findLastKey`, `has`, `identity`, + * `indexOf`, `isArguments`, `isArray`, `isBoolean`, `isDate`, `isElement`, + * `isEmpty`, `isEqual`, `isFinite`, `isFunction`, `isNaN`, `isNull`, `isNumber`, + * `isObject`, `isPlainObject`, `isRegExp`, `isString`, `isUndefined`, `join`, + * `lastIndexOf`, `mixin`, `noConflict`, `parseInt`, `pop`, `random`, `reduce`, + * `reduceRight`, `result`, `shift`, `size`, `some`, `sortedIndex`, `runInContext`, + * `template`, `unescape`, `uniqueId`, and `value` + * + * The wrapper functions `first` and `last` return wrapped values when `n` is + * provided, otherwise they return unwrapped values. + * + * Explicit chaining can be enabled by using the `_.chain` method. + * + * @name _ + * @constructor + * @category Chaining + * @param {*} value The value to wrap in a `lodash` instance. + * @returns {Object} Returns a `lodash` instance. + * @example + * + * var wrapped = _([1, 2, 3]); + * + * // returns an unwrapped value + * wrapped.reduce(function(sum, num) { + * return sum + num; + * }); + * // => 6 + * + * // returns a wrapped value + * var squares = wrapped.map(function(num) { + * return num * num; + * }); + * + * _.isArray(squares); + * // => false + * + * _.isArray(squares.value()); + * // => true + */ + function lodash() { + // no operation performed + } + + /** + * An object used to flag environments features. + * + * @static + * @memberOf _ + * @type Object + */ + var support = lodash.support = {}; + + /** + * Detect if functions can be decompiled by `Function#toString` + * (all but PS3 and older Opera mobile browsers & avoided in Windows 8 apps). + * + * @memberOf _.support + * @type boolean + */ + support.funcDecomp = !isNative(root.WinRTError) && reThis.test(function() { return this; }); + + /** + * Detect if `Function#name` is supported (all but IE). + * + * @memberOf _.support + * @type boolean + */ + support.funcNames = typeof Function.name == 'string'; + + /*--------------------------------------------------------------------------*/ + + /** + * The base implementation of `_.bind` that creates the bound function and + * sets its meta data. + * + * @private + * @param {Array} bindData The bind data array. + * @returns {Function} Returns the new bound function. + */ + function baseBind(bindData) { + var func = bindData[0], + partialArgs = bindData[2], + thisArg = bindData[4]; + + function bound() { + // `Function#bind` spec + // http://es5.github.io/#x15.3.4.5 + if (partialArgs) { + // avoid `arguments` object deoptimizations by using `slice` instead + // of `Array.prototype.slice.call` and not assigning `arguments` to a + // variable as a ternary expression + var args = slice(partialArgs); + push.apply(args, arguments); + } + // mimic the constructor's `return` behavior + // http://es5.github.io/#x13.2.2 + if (this instanceof bound) { + // ensure `new bound` is an instance of `func` + var thisBinding = baseCreate(func.prototype), + result = func.apply(thisBinding, args || arguments); + return isObject(result) ? result : thisBinding; + } + return func.apply(thisArg, args || arguments); + } + setBindData(bound, bindData); + return bound; + } + + /** + * The base implementation of `_.clone` without argument juggling or support + * for `thisArg` binding. + * + * @private + * @param {*} value The value to clone. + * @param {boolean} [isDeep=false] Specify a deep clone. + * @param {Function} [callback] The function to customize cloning values. + * @param {Array} [stackA=[]] Tracks traversed source objects. + * @param {Array} [stackB=[]] Associates clones with source counterparts. + * @returns {*} Returns the cloned value. + */ + function baseClone(value, isDeep, callback, stackA, stackB) { + if (callback) { + var result = callback(value); + if (typeof result != 'undefined') { + return result; + } + } + // inspect [[Class]] + var isObj = isObject(value); + if (isObj) { + var className = toString.call(value); + if (!cloneableClasses[className]) { + return value; + } + var ctor = ctorByClass[className]; + switch (className) { + case boolClass: + case dateClass: + return new ctor(+value); + + case numberClass: + case stringClass: + return new ctor(value); + + case regexpClass: + result = ctor(value.source, reFlags.exec(value)); + result.lastIndex = value.lastIndex; + return result; + } + } else { + return value; + } + var isArr = isArray(value); + if (isDeep) { + // check for circular references and return corresponding clone + var initedStack = !stackA; + stackA || (stackA = getArray()); + stackB || (stackB = getArray()); + + var length = stackA.length; + while (length--) { + if (stackA[length] == value) { + return stackB[length]; + } + } + result = isArr ? ctor(value.length) : {}; + } + else { + result = isArr ? slice(value) : assign({}, value); + } + // add array properties assigned by `RegExp#exec` + if (isArr) { + if (hasOwnProperty.call(value, 'index')) { + result.index = value.index; + } + if (hasOwnProperty.call(value, 'input')) { + result.input = value.input; + } + } + // exit for shallow clone + if (!isDeep) { + return result; + } + // add the source value to the stack of traversed objects + // and associate it with its clone + stackA.push(value); + stackB.push(result); + + // recursively populate clone (susceptible to call stack limits) + (isArr ? forEach : forOwn)(value, function(objValue, key) { + result[key] = baseClone(objValue, isDeep, callback, stackA, stackB); + }); + + if (initedStack) { + releaseArray(stackA); + releaseArray(stackB); + } + return result; + } + + /** + * The base implementation of `_.create` without support for assigning + * properties to the created object. + * + * @private + * @param {Object} prototype The object to inherit from. + * @returns {Object} Returns the new object. + */ + function baseCreate(prototype, properties) { + return isObject(prototype) ? nativeCreate(prototype) : {}; + } + // fallback for browsers without `Object.create` + if (!nativeCreate) { + baseCreate = (function() { + function Object() {} + return function(prototype) { + if (isObject(prototype)) { + Object.prototype = prototype; + var result = new Object; + Object.prototype = null; + } + return result || root.Object(); + }; + }()); + } + + /** + * The base implementation of `_.createCallback` without support for creating + * "_.pluck" or "_.where" style callbacks. + * + * @private + * @param {*} [func=identity] The value to convert to a callback. + * @param {*} [thisArg] The `this` binding of the created callback. + * @param {number} [argCount] The number of arguments the callback accepts. + * @returns {Function} Returns a callback function. + */ + function baseCreateCallback(func, thisArg, argCount) { + if (typeof func != 'function') { + return identity; + } + // exit early for no `thisArg` or already bound by `Function#bind` + if (typeof thisArg == 'undefined' || !('prototype' in func)) { + return func; + } + var bindData = func.__bindData__; + if (typeof bindData == 'undefined') { + if (support.funcNames) { + bindData = !func.name; + } + bindData = bindData || !support.funcDecomp; + if (!bindData) { + var source = fnToString.call(func); + if (!support.funcNames) { + bindData = !reFuncName.test(source); + } + if (!bindData) { + // checks if `func` references the `this` keyword and stores the result + bindData = reThis.test(source); + setBindData(func, bindData); + } + } + } + // exit early if there are no `this` references or `func` is bound + if (bindData === false || (bindData !== true && bindData[1] & 1)) { + return func; + } + switch (argCount) { + case 1: return function(value) { + return func.call(thisArg, value); + }; + case 2: return function(a, b) { + return func.call(thisArg, a, b); + }; + case 3: return function(value, index, collection) { + return func.call(thisArg, value, index, collection); + }; + case 4: return function(accumulator, value, index, collection) { + return func.call(thisArg, accumulator, value, index, collection); + }; + } + return bind(func, thisArg); + } + + /** + * The base implementation of `createWrapper` that creates the wrapper and + * sets its meta data. + * + * @private + * @param {Array} bindData The bind data array. + * @returns {Function} Returns the new function. + */ + function baseCreateWrapper(bindData) { + var func = bindData[0], + bitmask = bindData[1], + partialArgs = bindData[2], + partialRightArgs = bindData[3], + thisArg = bindData[4], + arity = bindData[5]; + + var isBind = bitmask & 1, + isBindKey = bitmask & 2, + isCurry = bitmask & 4, + isCurryBound = bitmask & 8, + key = func; + + function bound() { + var thisBinding = isBind ? thisArg : this; + if (partialArgs) { + var args = slice(partialArgs); + push.apply(args, arguments); + } + if (partialRightArgs || isCurry) { + args || (args = slice(arguments)); + if (partialRightArgs) { + push.apply(args, partialRightArgs); + } + if (isCurry && args.length < arity) { + bitmask |= 16 & ~32; + return baseCreateWrapper([func, (isCurryBound ? bitmask : bitmask & ~3), args, null, thisArg, arity]); + } + } + args || (args = arguments); + if (isBindKey) { + func = thisBinding[key]; + } + if (this instanceof bound) { + thisBinding = baseCreate(func.prototype); + var result = func.apply(thisBinding, args); + return isObject(result) ? result : thisBinding; + } + return func.apply(thisBinding, args); + } + setBindData(bound, bindData); + return bound; + } + + /** + * The base implementation of `_.difference` that accepts a single array + * of values to exclude. + * + * @private + * @param {Array} array The array to process. + * @param {Array} [values] The array of values to exclude. + * @returns {Array} Returns a new array of filtered values. + */ + function baseDifference(array, values) { + var index = -1, + indexOf = getIndexOf(), + length = array ? array.length : 0, + isLarge = length >= largeArraySize && indexOf === baseIndexOf, + result = []; + + if (isLarge) { + var cache = createCache(values); + if (cache) { + indexOf = cacheIndexOf; + values = cache; + } else { + isLarge = false; + } + } + while (++index < length) { + var value = array[index]; + if (indexOf(values, value) < 0) { + result.push(value); + } + } + if (isLarge) { + releaseObject(values); + } + return result; + } + + /** + * The base implementation of `_.flatten` without support for callback + * shorthands or `thisArg` binding. + * + * @private + * @param {Array} array The array to flatten. + * @param {boolean} [isShallow=false] A flag to restrict flattening to a single level. + * @param {boolean} [isStrict=false] A flag to restrict flattening to arrays and `arguments` objects. + * @param {number} [fromIndex=0] The index to start from. + * @returns {Array} Returns a new flattened array. + */ + function baseFlatten(array, isShallow, isStrict, fromIndex) { + var index = (fromIndex || 0) - 1, + length = array ? array.length : 0, + result = []; + + while (++index < length) { + var value = array[index]; + + if (value && typeof value == 'object' && typeof value.length == 'number' + && (isArray(value) || isArguments(value))) { + // recursively flatten arrays (susceptible to call stack limits) + if (!isShallow) { + value = baseFlatten(value, isShallow, isStrict); + } + var valIndex = -1, + valLength = value.length, + resIndex = result.length; + + result.length += valLength; + while (++valIndex < valLength) { + result[resIndex++] = value[valIndex]; + } + } else if (!isStrict) { + result.push(value); + } + } + return result; + } + + /** + * The base implementation of `_.isEqual`, without support for `thisArg` binding, + * that allows partial "_.where" style comparisons. + * + * @private + * @param {*} a The value to compare. + * @param {*} b The other value to compare. + * @param {Function} [callback] The function to customize comparing values. + * @param {Function} [isWhere=false] A flag to indicate performing partial comparisons. + * @param {Array} [stackA=[]] Tracks traversed `a` objects. + * @param {Array} [stackB=[]] Tracks traversed `b` objects. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + */ + function baseIsEqual(a, b, callback, isWhere, stackA, stackB) { + // used to indicate that when comparing objects, `a` has at least the properties of `b` + if (callback) { + var result = callback(a, b); + if (typeof result != 'undefined') { + return !!result; + } + } + // exit early for identical values + if (a === b) { + // treat `+0` vs. `-0` as not equal + return a !== 0 || (1 / a == 1 / b); + } + var type = typeof a, + otherType = typeof b; + + // exit early for unlike primitive values + if (a === a && + !(a && objectTypes[type]) && + !(b && objectTypes[otherType])) { + return false; + } + // exit early for `null` and `undefined` avoiding ES3's Function#call behavior + // http://es5.github.io/#x15.3.4.4 + if (a == null || b == null) { + return a === b; + } + // compare [[Class]] names + var className = toString.call(a), + otherClass = toString.call(b); + + if (className == argsClass) { + className = objectClass; + } + if (otherClass == argsClass) { + otherClass = objectClass; + } + if (className != otherClass) { + return false; + } + switch (className) { + case boolClass: + case dateClass: + // coerce dates and booleans to numbers, dates to milliseconds and booleans + // to `1` or `0` treating invalid dates coerced to `NaN` as not equal + return +a == +b; + + case numberClass: + // treat `NaN` vs. `NaN` as equal + return (a != +a) + ? b != +b + // but treat `+0` vs. `-0` as not equal + : (a == 0 ? (1 / a == 1 / b) : a == +b); + + case regexpClass: + case stringClass: + // coerce regexes to strings (http://es5.github.io/#x15.10.6.4) + // treat string primitives and their corresponding object instances as equal + return a == String(b); + } + var isArr = className == arrayClass; + if (!isArr) { + // unwrap any `lodash` wrapped values + var aWrapped = hasOwnProperty.call(a, '__wrapped__'), + bWrapped = hasOwnProperty.call(b, '__wrapped__'); + + if (aWrapped || bWrapped) { + return baseIsEqual(aWrapped ? a.__wrapped__ : a, bWrapped ? b.__wrapped__ : b, callback, isWhere, stackA, stackB); + } + // exit for functions and DOM nodes + if (className != objectClass) { + return false; + } + // in older versions of Opera, `arguments` objects have `Array` constructors + var ctorA = a.constructor, + ctorB = b.constructor; + + // non `Object` object instances with different constructors are not equal + if (ctorA != ctorB && + !(isFunction(ctorA) && ctorA instanceof ctorA && isFunction(ctorB) && ctorB instanceof ctorB) && + ('constructor' in a && 'constructor' in b) + ) { + return false; + } + } + // assume cyclic structures are equal + // the algorithm for detecting cyclic structures is adapted from ES 5.1 + // section 15.12.3, abstract operation `JO` (http://es5.github.io/#x15.12.3) + var initedStack = !stackA; + stackA || (stackA = getArray()); + stackB || (stackB = getArray()); + + var length = stackA.length; + while (length--) { + if (stackA[length] == a) { + return stackB[length] == b; + } + } + var size = 0; + result = true; + + // add `a` and `b` to the stack of traversed objects + stackA.push(a); + stackB.push(b); + + // recursively compare objects and arrays (susceptible to call stack limits) + if (isArr) { + // compare lengths to determine if a deep comparison is necessary + length = a.length; + size = b.length; + result = size == length; + + if (result || isWhere) { + // deep compare the contents, ignoring non-numeric properties + while (size--) { + var index = length, + value = b[size]; + + if (isWhere) { + while (index--) { + if ((result = baseIsEqual(a[index], value, callback, isWhere, stackA, stackB))) { + break; + } + } + } else if (!(result = baseIsEqual(a[size], value, callback, isWhere, stackA, stackB))) { + break; + } + } + } + } + else { + // deep compare objects using `forIn`, instead of `forOwn`, to avoid `Object.keys` + // which, in this case, is more costly + forIn(b, function(value, key, b) { + if (hasOwnProperty.call(b, key)) { + // count the number of properties. + size++; + // deep compare each property value. + return (result = hasOwnProperty.call(a, key) && baseIsEqual(a[key], value, callback, isWhere, stackA, stackB)); + } + }); + + if (result && !isWhere) { + // ensure both objects have the same number of properties + forIn(a, function(value, key, a) { + if (hasOwnProperty.call(a, key)) { + // `size` will be `-1` if `a` has more properties than `b` + return (result = --size > -1); + } + }); + } + } + stackA.pop(); + stackB.pop(); + + if (initedStack) { + releaseArray(stackA); + releaseArray(stackB); + } + return result; + } + + /** + * Creates a function that, when called, either curries or invokes `func` + * with an optional `this` binding and partially applied arguments. + * + * @private + * @param {Function|string} func The function or method name to reference. + * @param {number} bitmask The bitmask of method flags to compose. + * The bitmask may be composed of the following flags: + * 1 - `_.bind` + * 2 - `_.bindKey` + * 4 - `_.curry` + * 8 - `_.curry` (bound) + * 16 - `_.partial` + * 32 - `_.partialRight` + * @param {Array} [partialArgs] An array of arguments to prepend to those + * provided to the new function. + * @param {Array} [partialRightArgs] An array of arguments to append to those + * provided to the new function. + * @param {*} [thisArg] The `this` binding of `func`. + * @param {number} [arity] The arity of `func`. + * @returns {Function} Returns the new function. + */ + function createWrapper(func, bitmask, partialArgs, partialRightArgs, thisArg, arity) { + var isBind = bitmask & 1, + isBindKey = bitmask & 2, + isCurry = bitmask & 4, + isCurryBound = bitmask & 8, + isPartial = bitmask & 16, + isPartialRight = bitmask & 32; + + if (!isBindKey && !isFunction(func)) { + throw new TypeError; + } + if (isPartial && !partialArgs.length) { + bitmask &= ~16; + isPartial = partialArgs = false; + } + if (isPartialRight && !partialRightArgs.length) { + bitmask &= ~32; + isPartialRight = partialRightArgs = false; + } + var bindData = func && func.__bindData__; + if (bindData && bindData !== true) { + // clone `bindData` + bindData = slice(bindData); + if (bindData[2]) { + bindData[2] = slice(bindData[2]); + } + if (bindData[3]) { + bindData[3] = slice(bindData[3]); + } + // set `thisBinding` is not previously bound + if (isBind && !(bindData[1] & 1)) { + bindData[4] = thisArg; + } + // set if previously bound but not currently (subsequent curried functions) + if (!isBind && bindData[1] & 1) { + bitmask |= 8; + } + // set curried arity if not yet set + if (isCurry && !(bindData[1] & 4)) { + bindData[5] = arity; + } + // append partial left arguments + if (isPartial) { + push.apply(bindData[2] || (bindData[2] = []), partialArgs); + } + // append partial right arguments + if (isPartialRight) { + unshift.apply(bindData[3] || (bindData[3] = []), partialRightArgs); + } + // merge flags + bindData[1] |= bitmask; + return createWrapper.apply(null, bindData); + } + // fast path for `_.bind` + var creater = (bitmask == 1 || bitmask === 17) ? baseBind : baseCreateWrapper; + return creater([func, bitmask, partialArgs, partialRightArgs, thisArg, arity]); + } + + /** + * Gets the appropriate "indexOf" function. If the `_.indexOf` method is + * customized, this method returns the custom method, otherwise it returns + * the `baseIndexOf` function. + * + * @private + * @returns {Function} Returns the "indexOf" function. + */ + function getIndexOf() { + var result = (result = lodash.indexOf) === indexOf ? baseIndexOf : result; + return result; + } + + /** + * Checks if `value` is a native function. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if the `value` is a native function, else `false`. + */ + function isNative(value) { + return typeof value == 'function' && reNative.test(value); + } + + /** + * Sets `this` binding data on a given function. + * + * @private + * @param {Function} func The function to set data on. + * @param {Array} value The data array to set. + */ + var setBindData = !defineProperty ? noop : function(func, value) { + descriptor.value = value; + defineProperty(func, '__bindData__', descriptor); + }; + + /*--------------------------------------------------------------------------*/ + + /** + * Checks if `value` is an `arguments` object. + * + * @static + * @memberOf _ + * @category Objects + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if the `value` is an `arguments` object, else `false`. + * @example + * + * (function() { return _.isArguments(arguments); })(1, 2, 3); + * // => true + * + * _.isArguments([1, 2, 3]); + * // => false + */ + function isArguments(value) { + return value && typeof value == 'object' && typeof value.length == 'number' && + toString.call(value) == argsClass || false; + } + + /** + * Checks if `value` is an array. + * + * @static + * @memberOf _ + * @type Function + * @category Objects + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if the `value` is an array, else `false`. + * @example + * + * (function() { return _.isArray(arguments); })(); + * // => false + * + * _.isArray([1, 2, 3]); + * // => true + */ + var isArray = nativeIsArray || function(value) { + return value && typeof value == 'object' && typeof value.length == 'number' && + toString.call(value) == arrayClass || false; + }; + + /** + * A fallback implementation of `Object.keys` which produces an array of the + * given object's own enumerable property names. + * + * @private + * @type Function + * @param {Object} object The object to inspect. + * @returns {Array} Returns an array of property names. + */ + var shimKeys = function(object) { + var index, iterable = object, result = []; + if (!iterable) return result; + if (!(objectTypes[typeof object])) return result; + for (index in iterable) { + if (hasOwnProperty.call(iterable, index)) { + result.push(index); + } + } + return result + }; + + /** + * Creates an array composed of the own enumerable property names of an object. + * + * @static + * @memberOf _ + * @category Objects + * @param {Object} object The object to inspect. + * @returns {Array} Returns an array of property names. + * @example + * + * _.keys({ 'one': 1, 'two': 2, 'three': 3 }); + * // => ['one', 'two', 'three'] (property order is not guaranteed across environments) + */ + var keys = !nativeKeys ? shimKeys : function(object) { + if (!isObject(object)) { + return []; + } + return nativeKeys(object); + }; + + /*--------------------------------------------------------------------------*/ + + /** + * Assigns own enumerable properties of source object(s) to the destination + * object. Subsequent sources will overwrite property assignments of previous + * sources. If a callback is provided it will be executed to produce the + * assigned values. The callback is bound to `thisArg` and invoked with two + * arguments; (objectValue, sourceValue). + * + * @static + * @memberOf _ + * @type Function + * @alias extend + * @category Objects + * @param {Object} object The destination object. + * @param {...Object} [source] The source objects. + * @param {Function} [callback] The function to customize assigning values. + * @param {*} [thisArg] The `this` binding of `callback`. + * @returns {Object} Returns the destination object. + * @example + * + * _.assign({ 'name': 'fred' }, { 'employer': 'slate' }); + * // => { 'name': 'fred', 'employer': 'slate' } + * + * var defaults = _.partialRight(_.assign, function(a, b) { + * return typeof a == 'undefined' ? b : a; + * }); + * + * var object = { 'name': 'barney' }; + * defaults(object, { 'name': 'fred', 'employer': 'slate' }); + * // => { 'name': 'barney', 'employer': 'slate' } + */ + var assign = function(object, source, guard) { + var index, iterable = object, result = iterable; + if (!iterable) return result; + var args = arguments, + argsIndex = 0, + argsLength = typeof guard == 'number' ? 2 : args.length; + if (argsLength > 3 && typeof args[argsLength - 2] == 'function') { + var callback = baseCreateCallback(args[--argsLength - 1], args[argsLength--], 2); + } else if (argsLength > 2 && typeof args[argsLength - 1] == 'function') { + callback = args[--argsLength]; + } + while (++argsIndex < argsLength) { + iterable = args[argsIndex]; + if (iterable && objectTypes[typeof iterable]) { + var ownIndex = -1, + ownProps = objectTypes[typeof iterable] && keys(iterable), + length = ownProps ? ownProps.length : 0; + + while (++ownIndex < length) { + index = ownProps[ownIndex]; + result[index] = callback ? callback(result[index], iterable[index]) : iterable[index]; + } + } + } + return result + }; + + /** + * Creates a clone of `value`. If `isDeep` is `true` nested objects will also + * be cloned, otherwise they will be assigned by reference. If a callback + * is provided it will be executed to produce the cloned values. If the + * callback returns `undefined` cloning will be handled by the method instead. + * The callback is bound to `thisArg` and invoked with one argument; (value). + * + * @static + * @memberOf _ + * @category Objects + * @param {*} value The value to clone. + * @param {boolean} [isDeep=false] Specify a deep clone. + * @param {Function} [callback] The function to customize cloning values. + * @param {*} [thisArg] The `this` binding of `callback`. + * @returns {*} Returns the cloned value. + * @example + * + * var characters = [ + * { 'name': 'barney', 'age': 36 }, + * { 'name': 'fred', 'age': 40 } + * ]; + * + * var shallow = _.clone(characters); + * shallow[0] === characters[0]; + * // => true + * + * var deep = _.clone(characters, true); + * deep[0] === characters[0]; + * // => false + * + * _.mixin({ + * 'clone': _.partialRight(_.clone, function(value) { + * return _.isElement(value) ? value.cloneNode(false) : undefined; + * }) + * }); + * + * var clone = _.clone(document.body); + * clone.childNodes.length; + * // => 0 + */ + function clone(value, isDeep, callback, thisArg) { + // allows working with "Collections" methods without using their `index` + // and `collection` arguments for `isDeep` and `callback` + if (typeof isDeep != 'boolean' && isDeep != null) { + thisArg = callback; + callback = isDeep; + isDeep = false; + } + return baseClone(value, isDeep, typeof callback == 'function' && baseCreateCallback(callback, thisArg, 1)); + } + + /** + * Assigns own enumerable properties of source object(s) to the destination + * object for all destination properties that resolve to `undefined`. Once a + * property is set, additional defaults of the same property will be ignored. + * + * @static + * @memberOf _ + * @type Function + * @category Objects + * @param {Object} object The destination object. + * @param {...Object} [source] The source objects. + * @param- {Object} [guard] Allows working with `_.reduce` without using its + * `key` and `object` arguments as sources. + * @returns {Object} Returns the destination object. + * @example + * + * var object = { 'name': 'barney' }; + * _.defaults(object, { 'name': 'fred', 'employer': 'slate' }); + * // => { 'name': 'barney', 'employer': 'slate' } + */ + var defaults = function(object, source, guard) { + var index, iterable = object, result = iterable; + if (!iterable) return result; + var args = arguments, + argsIndex = 0, + argsLength = typeof guard == 'number' ? 2 : args.length; + while (++argsIndex < argsLength) { + iterable = args[argsIndex]; + if (iterable && objectTypes[typeof iterable]) { + var ownIndex = -1, + ownProps = objectTypes[typeof iterable] && keys(iterable), + length = ownProps ? ownProps.length : 0; + + while (++ownIndex < length) { + index = ownProps[ownIndex]; + if (typeof result[index] == 'undefined') result[index] = iterable[index]; + } + } + } + return result + }; + + /** + * Iterates over own and inherited enumerable properties of an object, + * executing the callback for each property. The callback is bound to `thisArg` + * and invoked with three arguments; (value, key, object). Callbacks may exit + * iteration early by explicitly returning `false`. + * + * @static + * @memberOf _ + * @type Function + * @category Objects + * @param {Object} object The object to iterate over. + * @param {Function} [callback=identity] The function called per iteration. + * @param {*} [thisArg] The `this` binding of `callback`. + * @returns {Object} Returns `object`. + * @example + * + * function Shape() { + * this.x = 0; + * this.y = 0; + * } + * + * Shape.prototype.move = function(x, y) { + * this.x += x; + * this.y += y; + * }; + * + * _.forIn(new Shape, function(value, key) { + * console.log(key); + * }); + * // => logs 'x', 'y', and 'move' (property order is not guaranteed across environments) + */ + var forIn = function(collection, callback, thisArg) { + var index, iterable = collection, result = iterable; + if (!iterable) return result; + if (!objectTypes[typeof iterable]) return result; + callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3); + for (index in iterable) { + if (callback(iterable[index], index, collection) === false) return result; + } + return result + }; + + /** + * Iterates over own enumerable properties of an object, executing the callback + * for each property. The callback is bound to `thisArg` and invoked with three + * arguments; (value, key, object). Callbacks may exit iteration early by + * explicitly returning `false`. + * + * @static + * @memberOf _ + * @type Function + * @category Objects + * @param {Object} object The object to iterate over. + * @param {Function} [callback=identity] The function called per iteration. + * @param {*} [thisArg] The `this` binding of `callback`. + * @returns {Object} Returns `object`. + * @example + * + * _.forOwn({ '0': 'zero', '1': 'one', 'length': 2 }, function(num, key) { + * console.log(key); + * }); + * // => logs '0', '1', and 'length' (property order is not guaranteed across environments) + */ + var forOwn = function(collection, callback, thisArg) { + var index, iterable = collection, result = iterable; + if (!iterable) return result; + if (!objectTypes[typeof iterable]) return result; + callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3); + var ownIndex = -1, + ownProps = objectTypes[typeof iterable] && keys(iterable), + length = ownProps ? ownProps.length : 0; + + while (++ownIndex < length) { + index = ownProps[ownIndex]; + if (callback(iterable[index], index, collection) === false) return result; + } + return result + }; + + /** + * Checks if the specified property name exists as a direct property of `object`, + * instead of an inherited property. + * + * @static + * @memberOf _ + * @category Objects + * @param {Object} object The object to inspect. + * @param {string} key The name of the property to check. + * @returns {boolean} Returns `true` if key is a direct property, else `false`. + * @example + * + * _.has({ 'a': 1, 'b': 2, 'c': 3 }, 'b'); + * // => true + */ + function has(object, key) { + return object ? hasOwnProperty.call(object, key) : false; + } + + /** + * Checks if `value` is a DOM element. + * + * @static + * @memberOf _ + * @category Objects + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if the `value` is a DOM element, else `false`. + * @example + * + * _.isElement(document.body); + * // => true + */ + function isElement(value) { + return value && value.nodeType === 1 || false; + } + + /** + * Performs a deep comparison between two values to determine if they are + * equivalent to each other. If a callback is provided it will be executed + * to compare values. If the callback returns `undefined` comparisons will + * be handled by the method instead. The callback is bound to `thisArg` and + * invoked with two arguments; (a, b). + * + * @static + * @memberOf _ + * @category Objects + * @param {*} a The value to compare. + * @param {*} b The other value to compare. + * @param {Function} [callback] The function to customize comparing values. + * @param {*} [thisArg] The `this` binding of `callback`. + * @returns {boolean} Returns `true` if the values are equivalent, else `false`. + * @example + * + * var object = { 'name': 'fred' }; + * var copy = { 'name': 'fred' }; + * + * object == copy; + * // => false + * + * _.isEqual(object, copy); + * // => true + * + * var words = ['hello', 'goodbye']; + * var otherWords = ['hi', 'goodbye']; + * + * _.isEqual(words, otherWords, function(a, b) { + * var reGreet = /^(?:hello|hi)$/i, + * aGreet = _.isString(a) && reGreet.test(a), + * bGreet = _.isString(b) && reGreet.test(b); + * + * return (aGreet || bGreet) ? (aGreet == bGreet) : undefined; + * }); + * // => true + */ + function isEqual(a, b, callback, thisArg) { + return baseIsEqual(a, b, typeof callback == 'function' && baseCreateCallback(callback, thisArg, 2)); + } + + /** + * Checks if `value` is a function. + * + * @static + * @memberOf _ + * @category Objects + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if the `value` is a function, else `false`. + * @example + * + * _.isFunction(_); + * // => true + */ + function isFunction(value) { + return typeof value == 'function'; + } + + /** + * Checks if `value` is the language type of Object. + * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @category Objects + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if the `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(1); + * // => false + */ + function isObject(value) { + // check if the value is the ECMAScript language type of Object + // http://es5.github.io/#x8 + // and avoid a V8 bug + // http://code.google.com/p/v8/issues/detail?id=2291 + return !!(value && objectTypes[typeof value]); + } + + /** + * Checks if `value` is a number. + * + * Note: `NaN` is considered a number. See http://es5.github.io/#x8.5. + * + * @static + * @memberOf _ + * @category Objects + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if the `value` is a number, else `false`. + * @example + * + * _.isNumber(8.4 * 5); + * // => true + */ + function isNumber(value) { + return typeof value == 'number' || + value && typeof value == 'object' && toString.call(value) == numberClass || false; + } + + /** + * Checks if `value` is a string. + * + * @static + * @memberOf _ + * @category Objects + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if the `value` is a string, else `false`. + * @example + * + * _.isString('fred'); + * // => true + */ + function isString(value) { + return typeof value == 'string' || + value && typeof value == 'object' && toString.call(value) == stringClass || false; + } + + /** + * Creates a shallow clone of `object` excluding the specified properties. + * Property names may be specified as individual arguments or as arrays of + * property names. If a callback is provided it will be executed for each + * property of `object` omitting the properties the callback returns truey + * for. The callback is bound to `thisArg` and invoked with three arguments; + * (value, key, object). + * + * @static + * @memberOf _ + * @category Objects + * @param {Object} object The source object. + * @param {Function|...string|string[]} [callback] The properties to omit or the + * function called per iteration. + * @param {*} [thisArg] The `this` binding of `callback`. + * @returns {Object} Returns an object without the omitted properties. + * @example + * + * _.omit({ 'name': 'fred', 'age': 40 }, 'age'); + * // => { 'name': 'fred' } + * + * _.omit({ 'name': 'fred', 'age': 40 }, function(value) { + * return typeof value == 'number'; + * }); + * // => { 'name': 'fred' } + */ + function omit(object, callback, thisArg) { + var result = {}; + if (typeof callback != 'function') { + var props = []; + forIn(object, function(value, key) { + props.push(key); + }); + props = baseDifference(props, baseFlatten(arguments, true, false, 1)); + + var index = -1, + length = props.length; + + while (++index < length) { + var key = props[index]; + result[key] = object[key]; + } + } else { + callback = lodash.createCallback(callback, thisArg, 3); + forIn(object, function(value, key, object) { + if (!callback(value, key, object)) { + result[key] = value; + } + }); + } + return result; + } + + /** + * Creates an array composed of the own enumerable property values of `object`. + * + * @static + * @memberOf _ + * @category Objects + * @param {Object} object The object to inspect. + * @returns {Array} Returns an array of property values. + * @example + * + * _.values({ 'one': 1, 'two': 2, 'three': 3 }); + * // => [1, 2, 3] (property order is not guaranteed across environments) + */ + function values(object) { + var index = -1, + props = keys(object), + length = props.length, + result = Array(length); + + while (++index < length) { + result[index] = object[props[index]]; + } + return result; + } + + /*--------------------------------------------------------------------------*/ + + /** + * Checks if the given callback returns truey value for **all** elements of + * a collection. The callback is bound to `thisArg` and invoked with three + * arguments; (value, index|key, collection). + * + * If a property name is provided for `callback` the created "_.pluck" style + * callback will return the property value of the given element. + * + * If an object is provided for `callback` the created "_.where" style callback + * will return `true` for elements that have the properties of the given object, + * else `false`. + * + * @static + * @memberOf _ + * @alias all + * @category Collections + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|Object|string} [callback=identity] The function called + * per iteration. If a property name or object is provided it will be used + * to create a "_.pluck" or "_.where" style callback, respectively. + * @param {*} [thisArg] The `this` binding of `callback`. + * @returns {boolean} Returns `true` if all elements passed the callback check, + * else `false`. + * @example + * + * _.every([true, 1, null, 'yes']); + * // => false + * + * var characters = [ + * { 'name': 'barney', 'age': 36 }, + * { 'name': 'fred', 'age': 40 } + * ]; + * + * // using "_.pluck" callback shorthand + * _.every(characters, 'age'); + * // => true + * + * // using "_.where" callback shorthand + * _.every(characters, { 'age': 36 }); + * // => false + */ + function every(collection, callback, thisArg) { + var result = true; + callback = lodash.createCallback(callback, thisArg, 3); + + var index = -1, + length = collection ? collection.length : 0; + + if (typeof length == 'number') { + while (++index < length) { + if (!(result = !!callback(collection[index], index, collection))) { + break; + } + } + } else { + forOwn(collection, function(value, index, collection) { + return (result = !!callback(value, index, collection)); + }); + } + return result; + } + + /** + * Iterates over elements of a collection, executing the callback for each + * element. The callback is bound to `thisArg` and invoked with three arguments; + * (value, index|key, collection). Callbacks may exit iteration early by + * explicitly returning `false`. + * + * Note: As with other "Collections" methods, objects with a `length` property + * are iterated like arrays. To avoid this behavior `_.forIn` or `_.forOwn` + * may be used for object iteration. + * + * @static + * @memberOf _ + * @alias each + * @category Collections + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function} [callback=identity] The function called per iteration. + * @param {*} [thisArg] The `this` binding of `callback`. + * @returns {Array|Object|string} Returns `collection`. + * @example + * + * _([1, 2, 3]).forEach(function(num) { console.log(num); }).join(','); + * // => logs each number and returns '1,2,3' + * + * _.forEach({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { console.log(num); }); + * // => logs each number and returns the object (property order is not guaranteed across environments) + */ + function forEach(collection, callback, thisArg) { + var index = -1, + length = collection ? collection.length : 0; + + callback = callback && typeof thisArg == 'undefined' ? callback : baseCreateCallback(callback, thisArg, 3); + if (typeof length == 'number') { + while (++index < length) { + if (callback(collection[index], index, collection) === false) { + break; + } + } + } else { + forOwn(collection, callback); + } + return collection; + } + + /** + * Invokes the method named by `methodName` on each element in the `collection` + * returning an array of the results of each invoked method. Additional arguments + * will be provided to each invoked method. If `methodName` is a function it + * will be invoked for, and `this` bound to, each element in the `collection`. + * + * @static + * @memberOf _ + * @category Collections + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|string} methodName The name of the method to invoke or + * the function invoked per iteration. + * @param {...*} [arg] Arguments to invoke the method with. + * @returns {Array} Returns a new array of the results of each invoked method. + * @example + * + * _.invoke([[5, 1, 7], [3, 2, 1]], 'sort'); + * // => [[1, 5, 7], [1, 2, 3]] + * + * _.invoke([123, 456], String.prototype.split, ''); + * // => [['1', '2', '3'], ['4', '5', '6']] + */ + function invoke(collection, methodName) { + var args = slice(arguments, 2), + index = -1, + isFunc = typeof methodName == 'function', + length = collection ? collection.length : 0, + result = Array(typeof length == 'number' ? length : 0); + + forEach(collection, function(value) { + result[++index] = (isFunc ? methodName : value[methodName]).apply(value, args); + }); + return result; + } + + /** + * Creates an array of values by running each element in the collection + * through the callback. The callback is bound to `thisArg` and invoked with + * three arguments; (value, index|key, collection). + * + * If a property name is provided for `callback` the created "_.pluck" style + * callback will return the property value of the given element. + * + * If an object is provided for `callback` the created "_.where" style callback + * will return `true` for elements that have the properties of the given object, + * else `false`. + * + * @static + * @memberOf _ + * @alias collect + * @category Collections + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function|Object|string} [callback=identity] The function called + * per iteration. If a property name or object is provided it will be used + * to create a "_.pluck" or "_.where" style callback, respectively. + * @param {*} [thisArg] The `this` binding of `callback`. + * @returns {Array} Returns a new array of the results of each `callback` execution. + * @example + * + * _.map([1, 2, 3], function(num) { return num * 3; }); + * // => [3, 6, 9] + * + * _.map({ 'one': 1, 'two': 2, 'three': 3 }, function(num) { return num * 3; }); + * // => [3, 6, 9] (property order is not guaranteed across environments) + * + * var characters = [ + * { 'name': 'barney', 'age': 36 }, + * { 'name': 'fred', 'age': 40 } + * ]; + * + * // using "_.pluck" callback shorthand + * _.map(characters, 'name'); + * // => ['barney', 'fred'] + */ + function map(collection, callback, thisArg) { + var index = -1, + length = collection ? collection.length : 0; + + callback = lodash.createCallback(callback, thisArg, 3); + if (typeof length == 'number') { + var result = Array(length); + while (++index < length) { + result[index] = callback(collection[index], index, collection); + } + } else { + result = []; + forOwn(collection, function(value, key, collection) { + result[++index] = callback(value, key, collection); + }); + } + return result; + } + + /** + * Retrieves the value of a specified property from all elements in the collection. + * + * @static + * @memberOf _ + * @type Function + * @category Collections + * @param {Array|Object|string} collection The collection to iterate over. + * @param {string} property The name of the property to pluck. + * @returns {Array} Returns a new array of property values. + * @example + * + * var characters = [ + * { 'name': 'barney', 'age': 36 }, + * { 'name': 'fred', 'age': 40 } + * ]; + * + * _.pluck(characters, 'name'); + * // => ['barney', 'fred'] + */ + var pluck = map; + + /** + * Reduces a collection to a value which is the accumulated result of running + * each element in the collection through the callback, where each successive + * callback execution consumes the return value of the previous execution. If + * `accumulator` is not provided the first element of the collection will be + * used as the initial `accumulator` value. The callback is bound to `thisArg` + * and invoked with four arguments; (accumulator, value, index|key, collection). + * + * @static + * @memberOf _ + * @alias foldl, inject + * @category Collections + * @param {Array|Object|string} collection The collection to iterate over. + * @param {Function} [callback=identity] The function called per iteration. + * @param {*} [accumulator] Initial value of the accumulator. + * @param {*} [thisArg] The `this` binding of `callback`. + * @returns {*} Returns the accumulated value. + * @example + * + * var sum = _.reduce([1, 2, 3], function(sum, num) { + * return sum + num; + * }); + * // => 6 + * + * var mapped = _.reduce({ 'a': 1, 'b': 2, 'c': 3 }, function(result, num, key) { + * result[key] = num * 3; + * return result; + * }, {}); + * // => { 'a': 3, 'b': 6, 'c': 9 } + */ + function reduce(collection, callback, accumulator, thisArg) { + if (!collection) return accumulator; + var noaccum = arguments.length < 3; + callback = lodash.createCallback(callback, thisArg, 4); + + var index = -1, + length = collection.length; + + if (typeof length == 'number') { + if (noaccum) { + accumulator = collection[++index]; + } + while (++index < length) { + accumulator = callback(accumulator, collection[index], index, collection); + } + } else { + forOwn(collection, function(value, index, collection) { + accumulator = noaccum + ? (noaccum = false, value) + : callback(accumulator, value, index, collection) + }); + } + return accumulator; + } + + /*--------------------------------------------------------------------------*/ + + /** + * Creates an array excluding all values of the provided arrays using strict + * equality for comparisons, i.e. `===`. + * + * @static + * @memberOf _ + * @category Arrays + * @param {Array} array The array to process. + * @param {...Array} [values] The arrays of values to exclude. + * @returns {Array} Returns a new array of filtered values. + * @example + * + * _.difference([1, 2, 3, 4, 5], [5, 2, 10]); + * // => [1, 3, 4] + */ + function difference(array) { + return baseDifference(array, baseFlatten(arguments, true, true, 1)); + } + + /** + * Flattens a nested array (the nesting can be to any depth). If `isShallow` + * is truey, the array will only be flattened a single level. If a callback + * is provided each element of the array is passed through the callback before + * flattening. The callback is bound to `thisArg` and invoked with three + * arguments; (value, index, array). + * + * If a property name is provided for `callback` the created "_.pluck" style + * callback will return the property value of the given element. + * + * If an object is provided for `callback` the created "_.where" style callback + * will return `true` for elements that have the properties of the given object, + * else `false`. + * + * @static + * @memberOf _ + * @category Arrays + * @param {Array} array The array to flatten. + * @param {boolean} [isShallow=false] A flag to restrict flattening to a single level. + * @param {Function|Object|string} [callback=identity] The function called + * per iteration. If a property name or object is provided it will be used + * to create a "_.pluck" or "_.where" style callback, respectively. + * @param {*} [thisArg] The `this` binding of `callback`. + * @returns {Array} Returns a new flattened array. + * @example + * + * _.flatten([1, [2], [3, [[4]]]]); + * // => [1, 2, 3, 4]; + * + * _.flatten([1, [2], [3, [[4]]]], true); + * // => [1, 2, 3, [[4]]]; + * + * var characters = [ + * { 'name': 'barney', 'age': 30, 'pets': ['hoppy'] }, + * { 'name': 'fred', 'age': 40, 'pets': ['baby puss', 'dino'] } + * ]; + * + * // using "_.pluck" callback shorthand + * _.flatten(characters, 'pets'); + * // => ['hoppy', 'baby puss', 'dino'] + */ + function flatten(array, isShallow, callback, thisArg) { + // juggle arguments + if (typeof isShallow != 'boolean' && isShallow != null) { + thisArg = callback; + callback = (typeof isShallow != 'function' && thisArg && thisArg[isShallow] === array) ? null : isShallow; + isShallow = false; + } + if (callback != null) { + array = map(array, callback, thisArg); + } + return baseFlatten(array, isShallow); + } + + /** + * Gets the index at which the first occurrence of `value` is found using + * strict equality for comparisons, i.e. `===`. If the array is already sorted + * providing `true` for `fromIndex` will run a faster binary search. + * + * @static + * @memberOf _ + * @category Arrays + * @param {Array} array The array to search. + * @param {*} value The value to search for. + * @param {boolean|number} [fromIndex=0] The index to search from or `true` + * to perform a binary search on a sorted array. + * @returns {number} Returns the index of the matched value or `-1`. + * @example + * + * _.indexOf([1, 2, 3, 1, 2, 3], 2); + * // => 1 + * + * _.indexOf([1, 2, 3, 1, 2, 3], 2, 3); + * // => 4 + * + * _.indexOf([1, 1, 2, 2, 3, 3], 2, true); + * // => 2 + */ + function indexOf(array, value, fromIndex) { + if (typeof fromIndex == 'number') { + var length = array ? array.length : 0; + fromIndex = (fromIndex < 0 ? nativeMax(0, length + fromIndex) : fromIndex || 0); + } else if (fromIndex) { + var index = sortedIndex(array, value); + return array[index] === value ? index : -1; + } + return baseIndexOf(array, value, fromIndex); + } + + /** + * Creates an array of unique values present in all provided arrays using + * strict equality for comparisons, i.e. `===`. + * + * @static + * @memberOf _ + * @category Arrays + * @param {...Array} [array] The arrays to inspect. + * @returns {Array} Returns an array of shared values. + * @example + * + * _.intersection([1, 2, 3], [5, 2, 1, 4], [2, 1]); + * // => [1, 2] + */ + function intersection() { + var args = [], + argsIndex = -1, + argsLength = arguments.length, + caches = getArray(), + indexOf = getIndexOf(), + trustIndexOf = indexOf === baseIndexOf, + seen = getArray(); + + while (++argsIndex < argsLength) { + var value = arguments[argsIndex]; + if (isArray(value) || isArguments(value)) { + args.push(value); + caches.push(trustIndexOf && value.length >= largeArraySize && + createCache(argsIndex ? args[argsIndex] : seen)); + } + } + var array = args[0], + index = -1, + length = array ? array.length : 0, + result = []; + + outer: + while (++index < length) { + var cache = caches[0]; + value = array[index]; + + if ((cache ? cacheIndexOf(cache, value) : indexOf(seen, value)) < 0) { + argsIndex = argsLength; + (cache || seen).push(value); + while (--argsIndex) { + cache = caches[argsIndex]; + if ((cache ? cacheIndexOf(cache, value) : indexOf(args[argsIndex], value)) < 0) { + continue outer; + } + } + result.push(value); + } + } + while (argsLength--) { + cache = caches[argsLength]; + if (cache) { + releaseObject(cache); + } + } + releaseArray(caches); + releaseArray(seen); + return result; + } + + /** + * Gets the last element or last `n` elements of an array. If a callback is + * provided elements at the end of the array are returned as long as the + * callback returns truey. The callback is bound to `thisArg` and invoked + * with three arguments; (value, index, array). + * + * If a property name is provided for `callback` the created "_.pluck" style + * callback will return the property value of the given element. + * + * If an object is provided for `callback` the created "_.where" style callback + * will return `true` for elements that have the properties of the given object, + * else `false`. + * + * @static + * @memberOf _ + * @category Arrays + * @param {Array} array The array to query. + * @param {Function|Object|number|string} [callback] The function called + * per element or the number of elements to return. If a property name or + * object is provided it will be used to create a "_.pluck" or "_.where" + * style callback, respectively. + * @param {*} [thisArg] The `this` binding of `callback`. + * @returns {*} Returns the last element(s) of `array`. + * @example + * + * _.last([1, 2, 3]); + * // => 3 + * + * _.last([1, 2, 3], 2); + * // => [2, 3] + * + * _.last([1, 2, 3], function(num) { + * return num > 1; + * }); + * // => [2, 3] + * + * var characters = [ + * { 'name': 'barney', 'blocked': false, 'employer': 'slate' }, + * { 'name': 'fred', 'blocked': true, 'employer': 'slate' }, + * { 'name': 'pebbles', 'blocked': true, 'employer': 'na' } + * ]; + * + * // using "_.pluck" callback shorthand + * _.pluck(_.last(characters, 'blocked'), 'name'); + * // => ['fred', 'pebbles'] + * + * // using "_.where" callback shorthand + * _.last(characters, { 'employer': 'na' }); + * // => [{ 'name': 'pebbles', 'blocked': true, 'employer': 'na' }] + */ + function last(array, callback, thisArg) { + var n = 0, + length = array ? array.length : 0; + + if (typeof callback != 'number' && callback != null) { + var index = length; + callback = lodash.createCallback(callback, thisArg, 3); + while (index-- && callback(array[index], index, array)) { + n++; + } + } else { + n = callback; + if (n == null || thisArg) { + return array ? array[length - 1] : undefined; + } + } + return slice(array, nativeMax(0, length - n)); + } + + /** + * Uses a binary search to determine the smallest index at which a value + * should be inserted into a given sorted array in order to maintain the sort + * order of the array. If a callback is provided it will be executed for + * `value` and each element of `array` to compute their sort ranking. The + * callback is bound to `thisArg` and invoked with one argument; (value). + * + * If a property name is provided for `callback` the created "_.pluck" style + * callback will return the property value of the given element. + * + * If an object is provided for `callback` the created "_.where" style callback + * will return `true` for elements that have the properties of the given object, + * else `false`. + * + * @static + * @memberOf _ + * @category Arrays + * @param {Array} array The array to inspect. + * @param {*} value The value to evaluate. + * @param {Function|Object|string} [callback=identity] The function called + * per iteration. If a property name or object is provided it will be used + * to create a "_.pluck" or "_.where" style callback, respectively. + * @param {*} [thisArg] The `this` binding of `callback`. + * @returns {number} Returns the index at which `value` should be inserted + * into `array`. + * @example + * + * _.sortedIndex([20, 30, 50], 40); + * // => 2 + * + * // using "_.pluck" callback shorthand + * _.sortedIndex([{ 'x': 20 }, { 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x'); + * // => 2 + * + * var dict = { + * 'wordToNumber': { 'twenty': 20, 'thirty': 30, 'fourty': 40, 'fifty': 50 } + * }; + * + * _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) { + * return dict.wordToNumber[word]; + * }); + * // => 2 + * + * _.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function(word) { + * return this.wordToNumber[word]; + * }, dict); + * // => 2 + */ + function sortedIndex(array, value, callback, thisArg) { + var low = 0, + high = array ? array.length : low; + + // explicitly reference `identity` for better inlining in Firefox + callback = callback ? lodash.createCallback(callback, thisArg, 1) : identity; + value = callback(value); + + while (low < high) { + var mid = (low + high) >>> 1; + (callback(array[mid]) < value) + ? low = mid + 1 + : high = mid; + } + return low; + } + + /*--------------------------------------------------------------------------*/ + + /** + * Creates a function that, when called, invokes `func` with the `this` + * binding of `thisArg` and prepends any additional `bind` arguments to those + * provided to the bound function. + * + * @static + * @memberOf _ + * @category Functions + * @param {Function} func The function to bind. + * @param {*} [thisArg] The `this` binding of `func`. + * @param {...*} [arg] Arguments to be partially applied. + * @returns {Function} Returns the new bound function. + * @example + * + * var func = function(greeting) { + * return greeting + ' ' + this.name; + * }; + * + * func = _.bind(func, { 'name': 'fred' }, 'hi'); + * func(); + * // => 'hi fred' + */ + function bind(func, thisArg) { + return arguments.length > 2 + ? createWrapper(func, 17, slice(arguments, 2), null, thisArg) + : createWrapper(func, 1, null, null, thisArg); + } + + /** + * Defers executing the `func` function until the current call stack has cleared. + * Additional arguments will be provided to `func` when it is invoked. + * + * @static + * @memberOf _ + * @category Functions + * @param {Function} func The function to defer. + * @param {...*} [arg] Arguments to invoke the function with. + * @returns {number} Returns the timer id. + * @example + * + * _.defer(function(text) { console.log(text); }, 'deferred'); + * // logs 'deferred' after one or more milliseconds + */ + function defer(func) { + if (!isFunction(func)) { + throw new TypeError; + } + var args = slice(arguments, 1); + return setTimeout(function() { func.apply(undefined, args); }, 1); + } + + /** + * Creates a function that, when called, invokes `func` with any additional + * `partial` arguments prepended to those provided to the new function. This + * method is similar to `_.bind` except it does **not** alter the `this` binding. + * + * @static + * @memberOf _ + * @category Functions + * @param {Function} func The function to partially apply arguments to. + * @param {...*} [arg] Arguments to be partially applied. + * @returns {Function} Returns the new partially applied function. + * @example + * + * var greet = function(greeting, name) { return greeting + ' ' + name; }; + * var hi = _.partial(greet, 'hi'); + * hi('fred'); + * // => 'hi fred' + */ + function partial(func) { + return createWrapper(func, 16, slice(arguments, 1)); + } + + /*--------------------------------------------------------------------------*/ + + /** + * Produces a callback bound to an optional `thisArg`. If `func` is a property + * name the created callback will return the property value for a given element. + * If `func` is an object the created callback will return `true` for elements + * that contain the equivalent object properties, otherwise it will return `false`. + * + * @static + * @memberOf _ + * @category Utilities + * @param {*} [func=identity] The value to convert to a callback. + * @param {*} [thisArg] The `this` binding of the created callback. + * @param {number} [argCount] The number of arguments the callback accepts. + * @returns {Function} Returns a callback function. + * @example + * + * var characters = [ + * { 'name': 'barney', 'age': 36 }, + * { 'name': 'fred', 'age': 40 } + * ]; + * + * // wrap to create custom callback shorthands + * _.createCallback = _.wrap(_.createCallback, function(func, callback, thisArg) { + * var match = /^(.+?)__([gl]t)(.+)$/.exec(callback); + * return !match ? func(callback, thisArg) : function(object) { + * return match[2] == 'gt' ? object[match[1]] > match[3] : object[match[1]] < match[3]; + * }; + * }); + * + * _.filter(characters, 'age__gt38'); + * // => [{ 'name': 'fred', 'age': 40 }] + */ + function createCallback(func, thisArg, argCount) { + var type = typeof func; + if (func == null || type == 'function') { + return baseCreateCallback(func, thisArg, argCount); + } + // handle "_.pluck" style callback shorthands + if (type != 'object') { + return property(func); + } + var props = keys(func), + key = props[0], + a = func[key]; + + // handle "_.where" style callback shorthands + if (props.length == 1 && a === a && !isObject(a)) { + // fast path the common case of providing an object with a single + // property containing a primitive value + return function(object) { + var b = object[key]; + return a === b && (a !== 0 || (1 / a == 1 / b)); + }; + } + return function(object) { + var length = props.length, + result = false; + + while (length--) { + if (!(result = baseIsEqual(object[props[length]], func[props[length]], null, true))) { + break; + } + } + return result; + }; + } + + /** + * This method returns the first argument provided to it. + * + * @static + * @memberOf _ + * @category Utilities + * @param {*} value Any value. + * @returns {*} Returns `value`. + * @example + * + * var object = { 'name': 'fred' }; + * _.identity(object) === object; + * // => true + */ + function identity(value) { + return value; + } + + /** + * A no-operation function. + * + * @static + * @memberOf _ + * @category Utilities + * @example + * + * var object = { 'name': 'fred' }; + * _.noop(object) === undefined; + * // => true + */ + function noop() { + // no operation performed + } + + /** + * Creates a "_.pluck" style function, which returns the `key` value of a + * given object. + * + * @static + * @memberOf _ + * @category Utilities + * @param {string} key The name of the property to retrieve. + * @returns {Function} Returns the new function. + * @example + * + * var characters = [ + * { 'name': 'fred', 'age': 40 }, + * { 'name': 'barney', 'age': 36 } + * ]; + * + * var getName = _.property('name'); + * + * _.map(characters, getName); + * // => ['barney', 'fred'] + * + * _.sortBy(characters, getName); + * // => [{ 'name': 'barney', 'age': 36 }, { 'name': 'fred', 'age': 40 }] + */ + function property(key) { + return function(object) { + return object[key]; + }; + } + + /** + * Generates a unique ID. If `prefix` is provided the ID will be appended to it. + * + * @static + * @memberOf _ + * @category Utilities + * @param {string} [prefix] The value to prefix the ID with. + * @returns {string} Returns the unique ID. + * @example + * + * _.uniqueId('contact_'); + * // => 'contact_104' + * + * _.uniqueId(); + * // => '105' + */ + function uniqueId(prefix) { + var id = ++idCounter; + return String(prefix == null ? '' : prefix) + id; + } + + /*--------------------------------------------------------------------------*/ + + lodash.assign = assign; + lodash.bind = bind; + lodash.createCallback = createCallback; + lodash.defaults = defaults; + lodash.defer = defer; + lodash.difference = difference; + lodash.flatten = flatten; + lodash.forEach = forEach; + lodash.forIn = forIn; + lodash.forOwn = forOwn; + lodash.intersection = intersection; + lodash.invoke = invoke; + lodash.keys = keys; + lodash.map = map; + lodash.omit = omit; + lodash.partial = partial; + lodash.pluck = pluck; + lodash.property = property; + lodash.values = values; + + // add aliases + lodash.collect = map; + lodash.each = forEach; + lodash.extend = assign; + + /*--------------------------------------------------------------------------*/ + + // add functions that return unwrapped values when chaining + lodash.clone = clone; + lodash.every = every; + lodash.has = has; + lodash.identity = identity; + lodash.indexOf = indexOf; + lodash.isArguments = isArguments; + lodash.isArray = isArray; + lodash.isElement = isElement; + lodash.isEqual = isEqual; + lodash.isFunction = isFunction; + lodash.isNumber = isNumber; + lodash.isObject = isObject; + lodash.isString = isString; + lodash.noop = noop; + lodash.reduce = reduce; + lodash.sortedIndex = sortedIndex; + lodash.uniqueId = uniqueId; + + // add aliases + lodash.all = every; + lodash.foldl = reduce; + lodash.inject = reduce; + + /*--------------------------------------------------------------------------*/ + + lodash.last = last; + + /*--------------------------------------------------------------------------*/ + + /** + * The semantic version number. + * + * @static + * @memberOf _ + * @type string + */ + lodash.VERSION = '2.4.1'; + + /*--------------------------------------------------------------------------*/ + + // some AMD build optimizers like r.js check for condition patterns like the following: + if (typeof define == 'function' && typeof define.amd == 'object' && define.amd) { + // Expose Lo-Dash to the global object even when an AMD loader is present in + // case Lo-Dash is loaded with a RequireJS shim config. + // See http://requirejs.org/docs/api.html#config-shim + root._ = lodash; + + // define as an anonymous module so, through path mapping, it can be + // referenced as the "underscore" module + define(function() { + return lodash; + }); + } + // check for `exports` after `define` in case a build optimizer adds an `exports` object + else if (freeExports && freeModule) { + // in Node.js or RingoJS + if (moduleExports) { + (freeModule.exports = lodash)._ = lodash; + } + // in Narwhal or Rhino -require + else { + freeExports._ = lodash; + } + } + else { + // in a browser or Rhino + root._ = lodash; + } +}.call(this)); + +}).call(this,typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) +},{}],"lodash":[function(_dereq_,module,exports){ +module.exports=_dereq_('M4+//f'); +},{}],3:[function(_dereq_,module,exports){ +/*! + * EventEmitter2 + * https://github.com/hij1nx/EventEmitter2 + * + * Copyright (c) 2013 hij1nx + * Licensed under the MIT license. + */ +;!function(undefined) { + + var isArray = Array.isArray ? Array.isArray : function _isArray(obj) { + return Object.prototype.toString.call(obj) === "[object Array]"; + }; + var defaultMaxListeners = 10; + + function init() { + this._events = {}; + if (this._conf) { + configure.call(this, this._conf); + } + } + + function configure(conf) { + if (conf) { + + this._conf = conf; + + conf.delimiter && (this.delimiter = conf.delimiter); + conf.maxListeners && (this._events.maxListeners = conf.maxListeners); + conf.wildcard && (this.wildcard = conf.wildcard); + conf.newListener && (this.newListener = conf.newListener); + + if (this.wildcard) { + this.listenerTree = {}; + } + } + } + + function EventEmitter(conf) { + this._events = {}; + this.newListener = false; + configure.call(this, conf); + } + + // + // Attention, function return type now is array, always ! + // It has zero elements if no any matches found and one or more + // elements (leafs) if there are matches + // + function searchListenerTree(handlers, type, tree, i) { + if (!tree) { + return []; + } + var listeners=[], leaf, len, branch, xTree, xxTree, isolatedBranch, endReached, + typeLength = type.length, currentType = type[i], nextType = type[i+1]; + if (i === typeLength && tree._listeners) { + // + // If at the end of the event(s) list and the tree has listeners + // invoke those listeners. + // + if (typeof tree._listeners === 'function') { + handlers && handlers.push(tree._listeners); + return [tree]; + } else { + for (leaf = 0, len = tree._listeners.length; leaf < len; leaf++) { + handlers && handlers.push(tree._listeners[leaf]); + } + return [tree]; + } + } + + if ((currentType === '*' || currentType === '**') || tree[currentType]) { + // + // If the event emitted is '*' at this part + // or there is a concrete match at this patch + // + if (currentType === '*') { + for (branch in tree) { + if (branch !== '_listeners' && tree.hasOwnProperty(branch)) { + listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], i+1)); + } + } + return listeners; + } else if(currentType === '**') { + endReached = (i+1 === typeLength || (i+2 === typeLength && nextType === '*')); + if(endReached && tree._listeners) { + // The next element has a _listeners, add it to the handlers. + listeners = listeners.concat(searchListenerTree(handlers, type, tree, typeLength)); + } + + for (branch in tree) { + if (branch !== '_listeners' && tree.hasOwnProperty(branch)) { + if(branch === '*' || branch === '**') { + if(tree[branch]._listeners && !endReached) { + listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], typeLength)); + } + listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], i)); + } else if(branch === nextType) { + listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], i+2)); + } else { + // No match on this one, shift into the tree but not in the type array. + listeners = listeners.concat(searchListenerTree(handlers, type, tree[branch], i)); + } + } + } + return listeners; + } + + listeners = listeners.concat(searchListenerTree(handlers, type, tree[currentType], i+1)); + } + + xTree = tree['*']; + if (xTree) { + // + // If the listener tree will allow any match for this part, + // then recursively explore all branches of the tree + // + searchListenerTree(handlers, type, xTree, i+1); + } + + xxTree = tree['**']; + if(xxTree) { + if(i < typeLength) { + if(xxTree._listeners) { + // If we have a listener on a '**', it will catch all, so add its handler. + searchListenerTree(handlers, type, xxTree, typeLength); + } + + // Build arrays of matching next branches and others. + for(branch in xxTree) { + if(branch !== '_listeners' && xxTree.hasOwnProperty(branch)) { + if(branch === nextType) { + // We know the next element will match, so jump twice. + searchListenerTree(handlers, type, xxTree[branch], i+2); + } else if(branch === currentType) { + // Current node matches, move into the tree. + searchListenerTree(handlers, type, xxTree[branch], i+1); + } else { + isolatedBranch = {}; + isolatedBranch[branch] = xxTree[branch]; + searchListenerTree(handlers, type, { '**': isolatedBranch }, i+1); + } + } + } + } else if(xxTree._listeners) { + // We have reached the end and still on a '**' + searchListenerTree(handlers, type, xxTree, typeLength); + } else if(xxTree['*'] && xxTree['*']._listeners) { + searchListenerTree(handlers, type, xxTree['*'], typeLength); + } + } + + return listeners; + } + + function growListenerTree(type, listener) { + + type = typeof type === 'string' ? type.split(this.delimiter) : type.slice(); + + // + // Looks for two consecutive '**', if so, don't add the event at all. + // + for(var i = 0, len = type.length; i+1 < len; i++) { + if(type[i] === '**' && type[i+1] === '**') { + return; + } + } + + var tree = this.listenerTree; + var name = type.shift(); + + while (name) { + + if (!tree[name]) { + tree[name] = {}; + } + + tree = tree[name]; + + if (type.length === 0) { + + if (!tree._listeners) { + tree._listeners = listener; + } + else if(typeof tree._listeners === 'function') { + tree._listeners = [tree._listeners, listener]; + } + else if (isArray(tree._listeners)) { + + tree._listeners.push(listener); + + if (!tree._listeners.warned) { + + var m = defaultMaxListeners; + + if (typeof this._events.maxListeners !== 'undefined') { + m = this._events.maxListeners; + } + + if (m > 0 && tree._listeners.length > m) { + + tree._listeners.warned = true; + console.error('(node) warning: possible EventEmitter memory ' + + 'leak detected. %d listeners added. ' + + 'Use emitter.setMaxListeners() to increase limit.', + tree._listeners.length); + console.trace(); + } + } + } + return true; + } + name = type.shift(); + } + return true; + } + + // By default EventEmitters will print a warning if more than + // 10 listeners are added to it. This is a useful default which + // helps finding memory leaks. + // + // Obviously not all Emitters should be limited to 10. This function allows + // that to be increased. Set to zero for unlimited. + + EventEmitter.prototype.delimiter = '.'; + + EventEmitter.prototype.setMaxListeners = function(n) { + this._events || init.call(this); + this._events.maxListeners = n; + if (!this._conf) this._conf = {}; + this._conf.maxListeners = n; + }; + + EventEmitter.prototype.event = ''; + + EventEmitter.prototype.once = function(event, fn) { + this.many(event, 1, fn); + return this; + }; + + EventEmitter.prototype.many = function(event, ttl, fn) { + var self = this; + + if (typeof fn !== 'function') { + throw new Error('many only accepts instances of Function'); + } + + function listener() { + if (--ttl === 0) { + self.off(event, listener); + } + fn.apply(this, arguments); + } + + listener._origin = fn; + + this.on(event, listener); + + return self; + }; + + EventEmitter.prototype.emit = function() { + + this._events || init.call(this); + + var type = arguments[0]; + + if (type === 'newListener' && !this.newListener) { + if (!this._events.newListener) { return false; } + } + + // Loop through the *_all* functions and invoke them. + if (this._all) { + var l = arguments.length; + var args = new Array(l - 1); + for (var i = 1; i < l; i++) args[i - 1] = arguments[i]; + for (i = 0, l = this._all.length; i < l; i++) { + this.event = type; + this._all[i].apply(this, args); + } + } + + // If there is no 'error' event listener then throw. + if (type === 'error') { + + if (!this._all && + !this._events.error && + !(this.wildcard && this.listenerTree.error)) { + + if (arguments[1] instanceof Error) { + throw arguments[1]; // Unhandled 'error' event + } else { + throw new Error("Uncaught, unspecified 'error' event."); + } + return false; + } + } + + var handler; + + if(this.wildcard) { + handler = []; + var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice(); + searchListenerTree.call(this, handler, ns, this.listenerTree, 0); + } + else { + handler = this._events[type]; + } + + if (typeof handler === 'function') { + this.event = type; + if (arguments.length === 1) { + handler.call(this); + } + else if (arguments.length > 1) + switch (arguments.length) { + case 2: + handler.call(this, arguments[1]); + break; + case 3: + handler.call(this, arguments[1], arguments[2]); + break; + // slower + default: + var l = arguments.length; + var args = new Array(l - 1); + for (var i = 1; i < l; i++) args[i - 1] = arguments[i]; + handler.apply(this, args); + } + return true; + } + else if (handler) { + var l = arguments.length; + var args = new Array(l - 1); + for (var i = 1; i < l; i++) args[i - 1] = arguments[i]; + + var listeners = handler.slice(); + for (var i = 0, l = listeners.length; i < l; i++) { + this.event = type; + listeners[i].apply(this, args); + } + return (listeners.length > 0) || !!this._all; + } + else { + return !!this._all; + } + + }; + + EventEmitter.prototype.on = function(type, listener) { + + if (typeof type === 'function') { + this.onAny(type); + return this; + } + + if (typeof listener !== 'function') { + throw new Error('on only accepts instances of Function'); + } + this._events || init.call(this); + + // To avoid recursion in the case that type == "newListeners"! Before + // adding it to the listeners, first emit "newListeners". + this.emit('newListener', type, listener); + + if(this.wildcard) { + growListenerTree.call(this, type, listener); + return this; + } + + if (!this._events[type]) { + // Optimize the case of one listener. Don't need the extra array object. + this._events[type] = listener; + } + else if(typeof this._events[type] === 'function') { + // Adding the second element, need to change to array. + this._events[type] = [this._events[type], listener]; + } + else if (isArray(this._events[type])) { + // If we've already got an array, just append. + this._events[type].push(listener); + + // Check for listener leak + if (!this._events[type].warned) { + + var m = defaultMaxListeners; + + if (typeof this._events.maxListeners !== 'undefined') { + m = this._events.maxListeners; + } + + if (m > 0 && this._events[type].length > m) { + + this._events[type].warned = true; + console.error('(node) warning: possible EventEmitter memory ' + + 'leak detected. %d listeners added. ' + + 'Use emitter.setMaxListeners() to increase limit.', + this._events[type].length); + console.trace(); + } + } + } + return this; + }; + + EventEmitter.prototype.onAny = function(fn) { + + if (typeof fn !== 'function') { + throw new Error('onAny only accepts instances of Function'); + } + + if(!this._all) { + this._all = []; + } + + // Add the function to the event listener collection. + this._all.push(fn); + return this; + }; + + EventEmitter.prototype.addListener = EventEmitter.prototype.on; + + EventEmitter.prototype.off = function(type, listener) { + if (typeof listener !== 'function') { + throw new Error('removeListener only takes instances of Function'); + } + + var handlers,leafs=[]; + + if(this.wildcard) { + var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice(); + leafs = searchListenerTree.call(this, null, ns, this.listenerTree, 0); + } + else { + // does not use listeners(), so no side effect of creating _events[type] + if (!this._events[type]) return this; + handlers = this._events[type]; + leafs.push({_listeners:handlers}); + } + + for (var iLeaf=0; iLeaf 0) { + fns = this._all; + for(i = 0, l = fns.length; i < l; i++) { + if(fn === fns[i]) { + fns.splice(i, 1); + return this; + } + } + } else { + this._all = []; + } + return this; + }; + + EventEmitter.prototype.removeListener = EventEmitter.prototype.off; + + EventEmitter.prototype.removeAllListeners = function(type) { + if (arguments.length === 0) { + !this._events || init.call(this); + return this; + } + + if(this.wildcard) { + var ns = typeof type === 'string' ? type.split(this.delimiter) : type.slice(); + var leafs = searchListenerTree.call(this, null, ns, this.listenerTree, 0); + + for (var iLeaf=0; iLeaf 0) newOp.attributes = attributes; + return this.push(newOp); +}; + +Delta.prototype['delete'] = function (length) { + if (length <= 0) return this; + return this.push({ 'delete': length }); +}; + +Delta.prototype.retain = function (length, attributes) { + if (length <= 0) return this; + var newOp = { retain: length }; + if (is.object(attributes) && Object.keys(attributes).length > 0) newOp.attributes = attributes; + return this.push(newOp); +}; + +Delta.prototype.push = function (newOp) { + var index = this.ops.length; + var lastOp = this.ops[index - 1]; + newOp = op.clone(newOp); + if (is.object(lastOp)) { + if (is.number(newOp['delete']) && is.number(lastOp['delete'])) { + this.ops[index - 1] = { 'delete': lastOp['delete'] + newOp['delete'] }; + return this; + } + // Since it does not matter if we insert before or after deleting at the same index, + // always prefer to insert first + if (is.number(lastOp['delete']) && (is.string(newOp.insert) || is.number(newOp.insert))) { + index -= 1; + lastOp = this.ops[index - 1]; + if (!is.object(lastOp)) { + this.ops.unshift(newOp); + return this; + } + } + if (is.equal(newOp.attributes, lastOp.attributes)) { + if (is.string(newOp.insert) && is.string(lastOp.insert)) { + this.ops[index - 1] = { insert: lastOp.insert + newOp.insert }; + if (is.object(newOp.attributes)) this.ops[index - 1].attributes = newOp.attributes + return this; + } else if (is.number(newOp.retain) && is.number(lastOp.retain)) { + this.ops[index - 1] = { retain: lastOp.retain + newOp.retain }; + if (is.object(newOp.attributes)) this.ops[index - 1].attributes = newOp.attributes + return this; + } + } + } + this.ops.splice(index, 0, newOp); + return this; +}; + +Delta.prototype.chop = function () { + var lastOp = this.ops[this.ops.length - 1]; + if (lastOp && lastOp.retain && !lastOp.attributes) { + this.ops.pop(); + } + return this; +}; + +Delta.prototype.length = function () { + return this.ops.reduce(function (length, elem) { + return length + op.length(elem); + }, 0); +}; + +Delta.prototype.slice = function (start, end) { + start = start || 0; + if (!is.number(end)) end = Infinity; + var delta = new Delta(); + var iter = op.iterator(this.ops); + var index = 0; + while (index < end && iter.hasNext()) { + var nextOp; + if (index < start) { + nextOp = iter.next(start - index); + } else { + nextOp = iter.next(end - start); + delta.push(nextOp); + } + index += op.length(nextOp); + } + return delta; +}; + + +Delta.prototype.compose = function (other) { + var thisIter = op.iterator(this.ops); + var otherIter = op.iterator(other.ops); + this.ops = []; + while (thisIter.hasNext() || otherIter.hasNext()) { + if (otherIter.peekType() === 'insert') { + this.push(otherIter.next()); + } else if (thisIter.peekType() === 'delete') { + this.push(thisIter.next()); + } else { + var length = Math.min(thisIter.peekLength(), otherIter.peekLength()); + var thisOp = thisIter.next(length); + var otherOp = otherIter.next(length); + if (is.number(otherOp.retain)) { + var newOp = {}; + if (is.number(thisOp.retain)) { + newOp.retain = length; + } else { + newOp.insert = thisOp.insert; + } + // Preserve null when composing with a retain, otherwise remove it for inserts + var attributes = op.attributes.compose(thisOp.attributes, otherOp.attributes, is.number(thisOp.retain)); + if (attributes) newOp.attributes = attributes; + this.push(newOp); + // Other op should be delete, we could be an insert or retain + // Insert + delete cancels out + } else if (is.number(otherOp['delete']) && is.number(thisOp.retain)) { + this.push(otherOp); + } + } + } + return this.chop(); +}; + +Delta.prototype.diff = function (other) { + var strings = [this.ops, other.ops].map(function (ops) { + return ops.map(function (op) { + if (is.string(op.insert)) return op.insert; + if (is.number(op.insert)) return NULL_CHARACTER; + var prep = ops === other.ops ? 'on' : 'with'; + throw new Error('diff() called ' + prep + ' non-document'); + }).join(''); + }); + var diffResult = diff(strings[0], strings[1]); + var thisIter = op.iterator(this.ops); + var otherIter = op.iterator(other.ops); + var delta = new Delta(); + diffResult.forEach(function (component) { + var length = component[1].length; + while (length > 0) { + var opLength = 0; + switch (component[0]) { + case diff.INSERT: + opLength = Math.min(otherIter.peekLength(), length); + delta.push(otherIter.next(opLength)); + break; + case diff.DELETE: + opLength = Math.min(length, thisIter.peekLength()); + thisIter.next(opLength); + delta['delete'](opLength); + break; + case diff.EQUAL: + opLength = Math.min(thisIter.peekLength(), otherIter.peekLength(), length); + var thisOp = thisIter.next(opLength); + var otherOp = otherIter.next(opLength); + if (thisOp.insert === otherOp.insert) { + delta.retain(opLength, op.attributes.diff(thisOp.attributes, otherOp.attributes)); + } else { + delta.push(otherOp)['delete'](opLength); + } + break; + } + length -= opLength; + } + }); + return delta.chop(); +}; + +Delta.prototype.transform = function (other, priority) { + priority = !!priority; + if (is.number(other)) { + return this.transformPosition(other, priority); + } + var thisIter = op.iterator(this.ops); + var otherIter = op.iterator(other.ops); + var delta = new Delta(); + while (thisIter.hasNext() || otherIter.hasNext()) { + if (thisIter.peekType() === 'insert' && (priority || otherIter.peekType() !== 'insert')) { + delta.retain(op.length(thisIter.next())); + } else if (otherIter.peekType() === 'insert') { + delta.push(otherIter.next()); + } else { + var length = Math.min(thisIter.peekLength(), otherIter.peekLength()); + var thisOp = thisIter.next(length); + var otherOp = otherIter.next(length); + if (thisOp['delete']) { + // Our delete either makes their delete redundant or removes their retain + continue; + } else if (otherOp['delete']) { + delta.push(otherOp); + } else { + // We retain either their retain or insert + delta.retain(length, op.attributes.transform(thisOp.attributes, otherOp.attributes, priority)); + } + } + } + return delta.chop(); +}; + +Delta.prototype.transformPosition = function (index, priority) { + priority = !!priority; + var thisIter = op.iterator(this.ops); + var offset = 0; + while (thisIter.hasNext() && offset <= index) { + var length = thisIter.peekLength(); + var nextType = thisIter.peekType(); + thisIter.next(); + if (nextType === 'delete') { + index -= Math.min(length, index - offset); + continue; + } else if (nextType === 'insert' && (offset < index || !priority)) { + index += length; + } + offset += length; + } + return index; +}; + + +module.exports = Delta; + +},{"./is":6,"./op":7,"fast-diff":9}],6:[function(_dereq_,module,exports){ +module.exports = { + equal: function (a, b) { + if (a === b) return true; + if (a == null && b == null) return true; + if (a == null || b == null) return false; + if (Object.keys(a).length != Object.keys(b).length) return false; + for(var key in a) { + // Only compare one level deep + if (a[key] !== b[key]) return false; + } + return true; + }, + + array: function (value) { + return Array.isArray(value); + }, + + number: function (value) { + if (typeof value === 'number') return true; + if (typeof value === 'object' && Object.prototype.toString.call(value) === '[object Number]') return true; + return false; + }, + + object: function (value) { + if (!value) return false; + return (typeof value === 'function' || typeof value === 'object'); + }, + + string: function (value) { + if (typeof value === 'string') return true; + if (typeof value === 'object' && Object.prototype.toString.call(value) === '[object String]') return true; + return false; + } +}; + +},{}],7:[function(_dereq_,module,exports){ +var is = _dereq_('./is'); + + +var lib = { + attributes: { + clone: function (attributes, keepNull) { + if (!is.object(attributes)) return {}; + return Object.keys(attributes).reduce(function (memo, key) { + if (attributes[key] !== undefined && (attributes[key] !== null || keepNull)) { + memo[key] = attributes[key]; + } + return memo; + }, {}); + }, + + compose: function (a, b, keepNull) { + if (!is.object(a)) a = {}; + if (!is.object(b)) b = {}; + var attributes = this.clone(b, keepNull); + for (var key in a) { + if (a[key] !== undefined && b[key] === undefined) { + attributes[key] = a[key]; + } + } + return Object.keys(attributes).length > 0 ? attributes : undefined; + }, + + diff: function(a, b) { + if (!is.object(a)) a = {}; + if (!is.object(b)) b = {}; + var attributes = Object.keys(a).concat(Object.keys(b)).reduce(function (attributes, key) { + if (a[key] !== b[key]) { + attributes[key] = b[key] === undefined ? null : b[key]; + } + return attributes; + }, {}); + return Object.keys(attributes).length > 0 ? attributes : undefined; + }, + + transform: function (a, b, priority) { + if (!is.object(a)) return b; + if (!is.object(b)) return undefined; + if (!priority) return b; // b simply overwrites us without priority + var attributes = Object.keys(b).reduce(function (attributes, key) { + if (a[key] === undefined) attributes[key] = b[key]; // null is a valid value + return attributes; + }, {}); + return Object.keys(attributes).length > 0 ? attributes : undefined; + } + }, + + clone: function (op) { + var newOp = this.attributes.clone(op); + if (is.object(newOp.attributes)) { + newOp.attributes = this.attributes.clone(newOp.attributes, true); + } + return newOp; + }, + + iterator: function (ops) { + return new Iterator(ops); + }, + + length: function (op) { + if (is.number(op['delete'])) { + return op['delete']; + } else if (is.number(op.retain)) { + return op.retain; + } else { + return is.string(op.insert) ? op.insert.length : 1; + } + } +}; + + +function Iterator(ops) { + this.ops = ops; + this.index = 0; + this.offset = 0; +}; + +Iterator.prototype.hasNext = function () { + return this.peekLength() < Infinity; +}; + +Iterator.prototype.next = function (length) { + if (!length) length = Infinity; + var nextOp = this.ops[this.index]; + if (nextOp) { + var offset = this.offset; + var opLength = lib.length(nextOp) + if (length >= opLength - offset) { + length = opLength - offset; + this.index += 1; + this.offset = 0; + } else { + this.offset += length; + } + if (is.number(nextOp['delete'])) { + return { 'delete': length }; + } else { + var retOp = {}; + if (nextOp.attributes) { + retOp.attributes = nextOp.attributes; + } + if (is.number(nextOp.retain)) { + retOp.retain = length; + } else if (is.string(nextOp.insert)) { + retOp.insert = nextOp.insert.substr(offset, length); + } else { + // offset should === 0, length should === 1 + retOp.insert = nextOp.insert; + } + return retOp; + } + } else { + return { retain: Infinity }; + } +}; + +Iterator.prototype.peekLength = function () { + if (this.ops[this.index]) { + // Should never return 0 if our index is being managed correctly + return lib.length(this.ops[this.index]) - this.offset; + } else { + return Infinity; + } +}; + +Iterator.prototype.peekType = function () { + if (this.ops[this.index]) { + if (is.number(this.ops[this.index]['delete'])) { + return 'delete'; + } else if (is.number(this.ops[this.index].retain)) { + return 'retain'; + } else { + return 'insert'; + } + } + return 'retain'; +}; + + +module.exports = lib; + +},{"./is":6}],8:[function(_dereq_,module,exports){ +var Delta = _dereq_('./delta'); +var pkg = _dereq_('../package.json'); + + +module.exports = { + Delta: Delta, + name: 'rich-text', + uri: 'http://sharejs.org/types/rich-text/v1', + + create: function (initial) { + return new Delta(initial); + }, + + apply: function (snapshot, delta) { + snapshot = new Delta(snapshot); + delta = new Delta(delta); + return snapshot.compose(delta); + }, + + compose: function (delta1, delta2) { + delta1 = new Delta(delta1); + delta2 = new Delta(delta2); + return delta1.compose(delta2); + }, + + diff: function (delta1, delta2) { + delta1 = new Delta(delta1); + delta2 = new Delta(delta2); + return delta1.diff(delta2); + }, + + transform: function (delta1, delta2, side) { + delta1 = new Delta(delta1); + delta2 = new Delta(delta2); + // Fuzzer specs is in opposite order of delta interface + return delta2.transform(delta1, side === 'left'); + } +}; + +},{"../package.json":10,"./delta":5}],9:[function(_dereq_,module,exports){ +/** + * This library modifies the diff-patch-match library by Neil Fraser + * by removing the patch and match functionality and certain advanced + * options in the diff function. The original license is as follows: + * + * === + * + * Diff Match and Patch + * + * Copyright 2006 Google Inc. + * http://code.google.com/p/google-diff-match-patch/ + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +/** + * The data structure representing a diff is an array of tuples: + * [[DIFF_DELETE, 'Hello'], [DIFF_INSERT, 'Goodbye'], [DIFF_EQUAL, ' world.']] + * which means: delete 'Hello', add 'Goodbye' and keep ' world.' + */ +var DIFF_DELETE = -1; +var DIFF_INSERT = 1; +var DIFF_EQUAL = 0; + + +/** + * Find the differences between two texts. Simplifies the problem by stripping + * any common prefix or suffix off the texts before diffing. + * @param {string} text1 Old string to be diffed. + * @param {string} text2 New string to be diffed. + * @return {Array} Array of diff tuples. + */ +function diff_main(text1, text2) { + // Check for equality (speedup). + if (text1 == text2) { + if (text1) { + return [[DIFF_EQUAL, text1]]; + } + return []; + } + + // Trim off common prefix (speedup). + var commonlength = diff_commonPrefix(text1, text2); + var commonprefix = text1.substring(0, commonlength); + text1 = text1.substring(commonlength); + text2 = text2.substring(commonlength); + + // Trim off common suffix (speedup). + commonlength = diff_commonSuffix(text1, text2); + var commonsuffix = text1.substring(text1.length - commonlength); + text1 = text1.substring(0, text1.length - commonlength); + text2 = text2.substring(0, text2.length - commonlength); + + // Compute the diff on the middle block. + var diffs = diff_compute_(text1, text2); + + // Restore the prefix and suffix. + if (commonprefix) { + diffs.unshift([DIFF_EQUAL, commonprefix]); + } + if (commonsuffix) { + diffs.push([DIFF_EQUAL, commonsuffix]); + } + diff_cleanupMerge(diffs); + return diffs; +}; + + +/** + * Find the differences between two texts. Assumes that the texts do not + * have any common prefix or suffix. + * @param {string} text1 Old string to be diffed. + * @param {string} text2 New string to be diffed. + * @return {Array} Array of diff tuples. + */ +function diff_compute_(text1, text2) { + var diffs; + + if (!text1) { + // Just add some text (speedup). + return [[DIFF_INSERT, text2]]; + } + + if (!text2) { + // Just delete some text (speedup). + return [[DIFF_DELETE, text1]]; + } + + var longtext = text1.length > text2.length ? text1 : text2; + var shorttext = text1.length > text2.length ? text2 : text1; + var i = longtext.indexOf(shorttext); + if (i != -1) { + // Shorter text is inside the longer text (speedup). + diffs = [[DIFF_INSERT, longtext.substring(0, i)], + [DIFF_EQUAL, shorttext], + [DIFF_INSERT, longtext.substring(i + shorttext.length)]]; + // Swap insertions for deletions if diff is reversed. + if (text1.length > text2.length) { + diffs[0][0] = diffs[2][0] = DIFF_DELETE; + } + return diffs; + } + + if (shorttext.length == 1) { + // Single character string. + // After the previous speedup, the character can't be an equality. + return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]]; + } + + // Check to see if the problem can be split in two. + var hm = diff_halfMatch_(text1, text2); + if (hm) { + // A half-match was found, sort out the return data. + var text1_a = hm[0]; + var text1_b = hm[1]; + var text2_a = hm[2]; + var text2_b = hm[3]; + var mid_common = hm[4]; + // Send both pairs off for separate processing. + var diffs_a = diff_main(text1_a, text2_a); + var diffs_b = diff_main(text1_b, text2_b); + // Merge the results. + return diffs_a.concat([[DIFF_EQUAL, mid_common]], diffs_b); + } + + return diff_bisect_(text1, text2); +}; + + +/** + * Find the 'middle snake' of a diff, split the problem in two + * and return the recursively constructed diff. + * See Myers 1986 paper: An O(ND) Difference Algorithm and Its Variations. + * @param {string} text1 Old string to be diffed. + * @param {string} text2 New string to be diffed. + * @return {Array} Array of diff tuples. + * @private + */ +function diff_bisect_(text1, text2) { + // Cache the text lengths to prevent multiple calls. + var text1_length = text1.length; + var text2_length = text2.length; + var max_d = Math.ceil((text1_length + text2_length) / 2); + var v_offset = max_d; + var v_length = 2 * max_d; + var v1 = new Array(v_length); + var v2 = new Array(v_length); + // Setting all elements to -1 is faster in Chrome & Firefox than mixing + // integers and undefined. + for (var x = 0; x < v_length; x++) { + v1[x] = -1; + v2[x] = -1; + } + v1[v_offset + 1] = 0; + v2[v_offset + 1] = 0; + var delta = text1_length - text2_length; + // If the total number of characters is odd, then the front path will collide + // with the reverse path. + var front = (delta % 2 != 0); + // Offsets for start and end of k loop. + // Prevents mapping of space beyond the grid. + var k1start = 0; + var k1end = 0; + var k2start = 0; + var k2end = 0; + for (var d = 0; d < max_d; d++) { + // Walk the front path one step. + for (var k1 = -d + k1start; k1 <= d - k1end; k1 += 2) { + var k1_offset = v_offset + k1; + var x1; + if (k1 == -d || (k1 != d && v1[k1_offset - 1] < v1[k1_offset + 1])) { + x1 = v1[k1_offset + 1]; + } else { + x1 = v1[k1_offset - 1] + 1; + } + var y1 = x1 - k1; + while (x1 < text1_length && y1 < text2_length && + text1.charAt(x1) == text2.charAt(y1)) { + x1++; + y1++; + } + v1[k1_offset] = x1; + if (x1 > text1_length) { + // Ran off the right of the graph. + k1end += 2; + } else if (y1 > text2_length) { + // Ran off the bottom of the graph. + k1start += 2; + } else if (front) { + var k2_offset = v_offset + delta - k1; + if (k2_offset >= 0 && k2_offset < v_length && v2[k2_offset] != -1) { + // Mirror x2 onto top-left coordinate system. + var x2 = text1_length - v2[k2_offset]; + if (x1 >= x2) { + // Overlap detected. + return diff_bisectSplit_(text1, text2, x1, y1); + } + } + } + } + + // Walk the reverse path one step. + for (var k2 = -d + k2start; k2 <= d - k2end; k2 += 2) { + var k2_offset = v_offset + k2; + var x2; + if (k2 == -d || (k2 != d && v2[k2_offset - 1] < v2[k2_offset + 1])) { + x2 = v2[k2_offset + 1]; + } else { + x2 = v2[k2_offset - 1] + 1; + } + var y2 = x2 - k2; + while (x2 < text1_length && y2 < text2_length && + text1.charAt(text1_length - x2 - 1) == + text2.charAt(text2_length - y2 - 1)) { + x2++; + y2++; + } + v2[k2_offset] = x2; + if (x2 > text1_length) { + // Ran off the left of the graph. + k2end += 2; + } else if (y2 > text2_length) { + // Ran off the top of the graph. + k2start += 2; + } else if (!front) { + var k1_offset = v_offset + delta - k2; + if (k1_offset >= 0 && k1_offset < v_length && v1[k1_offset] != -1) { + var x1 = v1[k1_offset]; + var y1 = v_offset + x1 - k1_offset; + // Mirror x2 onto top-left coordinate system. + x2 = text1_length - x2; + if (x1 >= x2) { + // Overlap detected. + return diff_bisectSplit_(text1, text2, x1, y1); + } + } + } + } + } + // Diff took too long and hit the deadline or + // number of diffs equals number of characters, no commonality at all. + return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]]; +}; + + +/** + * Given the location of the 'middle snake', split the diff in two parts + * and recurse. + * @param {string} text1 Old string to be diffed. + * @param {string} text2 New string to be diffed. + * @param {number} x Index of split point in text1. + * @param {number} y Index of split point in text2. + * @return {Array} Array of diff tuples. + */ +function diff_bisectSplit_(text1, text2, x, y) { + var text1a = text1.substring(0, x); + var text2a = text2.substring(0, y); + var text1b = text1.substring(x); + var text2b = text2.substring(y); + + // Compute both diffs serially. + var diffs = diff_main(text1a, text2a); + var diffsb = diff_main(text1b, text2b); + + return diffs.concat(diffsb); +}; + + +/** + * Determine the common prefix of two strings. + * @param {string} text1 First string. + * @param {string} text2 Second string. + * @return {number} The number of characters common to the start of each + * string. + */ +function diff_commonPrefix(text1, text2) { + // Quick check for common null cases. + if (!text1 || !text2 || text1.charAt(0) != text2.charAt(0)) { + return 0; + } + // Binary search. + // Performance analysis: http://neil.fraser.name/news/2007/10/09/ + var pointermin = 0; + var pointermax = Math.min(text1.length, text2.length); + var pointermid = pointermax; + var pointerstart = 0; + while (pointermin < pointermid) { + if (text1.substring(pointerstart, pointermid) == + text2.substring(pointerstart, pointermid)) { + pointermin = pointermid; + pointerstart = pointermin; + } else { + pointermax = pointermid; + } + pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin); + } + return pointermid; +}; + + +/** + * Determine the common suffix of two strings. + * @param {string} text1 First string. + * @param {string} text2 Second string. + * @return {number} The number of characters common to the end of each string. + */ +function diff_commonSuffix(text1, text2) { + // Quick check for common null cases. + if (!text1 || !text2 || + text1.charAt(text1.length - 1) != text2.charAt(text2.length - 1)) { + return 0; + } + // Binary search. + // Performance analysis: http://neil.fraser.name/news/2007/10/09/ + var pointermin = 0; + var pointermax = Math.min(text1.length, text2.length); + var pointermid = pointermax; + var pointerend = 0; + while (pointermin < pointermid) { + if (text1.substring(text1.length - pointermid, text1.length - pointerend) == + text2.substring(text2.length - pointermid, text2.length - pointerend)) { + pointermin = pointermid; + pointerend = pointermin; + } else { + pointermax = pointermid; + } + pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin); + } + return pointermid; +}; + + +/** + * Do the two texts share a substring which is at least half the length of the + * longer text? + * This speedup can produce non-minimal diffs. + * @param {string} text1 First string. + * @param {string} text2 Second string. + * @return {Array.} Five element Array, containing the prefix of + * text1, the suffix of text1, the prefix of text2, the suffix of + * text2 and the common middle. Or null if there was no match. + */ +function diff_halfMatch_(text1, text2) { + var longtext = text1.length > text2.length ? text1 : text2; + var shorttext = text1.length > text2.length ? text2 : text1; + if (longtext.length < 4 || shorttext.length * 2 < longtext.length) { + return null; // Pointless. + } + + /** + * Does a substring of shorttext exist within longtext such that the substring + * is at least half the length of longtext? + * Closure, but does not reference any external variables. + * @param {string} longtext Longer string. + * @param {string} shorttext Shorter string. + * @param {number} i Start index of quarter length substring within longtext. + * @return {Array.} Five element Array, containing the prefix of + * longtext, the suffix of longtext, the prefix of shorttext, the suffix + * of shorttext and the common middle. Or null if there was no match. + * @private + */ + function diff_halfMatchI_(longtext, shorttext, i) { + // Start with a 1/4 length substring at position i as a seed. + var seed = longtext.substring(i, i + Math.floor(longtext.length / 4)); + var j = -1; + var best_common = ''; + var best_longtext_a, best_longtext_b, best_shorttext_a, best_shorttext_b; + while ((j = shorttext.indexOf(seed, j + 1)) != -1) { + var prefixLength = diff_commonPrefix(longtext.substring(i), + shorttext.substring(j)); + var suffixLength = diff_commonSuffix(longtext.substring(0, i), + shorttext.substring(0, j)); + if (best_common.length < suffixLength + prefixLength) { + best_common = shorttext.substring(j - suffixLength, j) + + shorttext.substring(j, j + prefixLength); + best_longtext_a = longtext.substring(0, i - suffixLength); + best_longtext_b = longtext.substring(i + prefixLength); + best_shorttext_a = shorttext.substring(0, j - suffixLength); + best_shorttext_b = shorttext.substring(j + prefixLength); + } + } + if (best_common.length * 2 >= longtext.length) { + return [best_longtext_a, best_longtext_b, + best_shorttext_a, best_shorttext_b, best_common]; + } else { + return null; + } + } + + // First check if the second quarter is the seed for a half-match. + var hm1 = diff_halfMatchI_(longtext, shorttext, + Math.ceil(longtext.length / 4)); + // Check again based on the third quarter. + var hm2 = diff_halfMatchI_(longtext, shorttext, + Math.ceil(longtext.length / 2)); + var hm; + if (!hm1 && !hm2) { + return null; + } else if (!hm2) { + hm = hm1; + } else if (!hm1) { + hm = hm2; + } else { + // Both matched. Select the longest. + hm = hm1[4].length > hm2[4].length ? hm1 : hm2; + } + + // A half-match was found, sort out the return data. + var text1_a, text1_b, text2_a, text2_b; + if (text1.length > text2.length) { + text1_a = hm[0]; + text1_b = hm[1]; + text2_a = hm[2]; + text2_b = hm[3]; + } else { + text2_a = hm[0]; + text2_b = hm[1]; + text1_a = hm[2]; + text1_b = hm[3]; + } + var mid_common = hm[4]; + return [text1_a, text1_b, text2_a, text2_b, mid_common]; +}; + + +/** + * Reorder and merge like edit sections. Merge equalities. + * Any edit section can move as long as it doesn't cross an equality. + * @param {Array} diffs Array of diff tuples. + */ +function diff_cleanupMerge(diffs) { + diffs.push([DIFF_EQUAL, '']); // Add a dummy entry at the end. + var pointer = 0; + var count_delete = 0; + var count_insert = 0; + var text_delete = ''; + var text_insert = ''; + var commonlength; + while (pointer < diffs.length) { + switch (diffs[pointer][0]) { + case DIFF_INSERT: + count_insert++; + text_insert += diffs[pointer][1]; + pointer++; + break; + case DIFF_DELETE: + count_delete++; + text_delete += diffs[pointer][1]; + pointer++; + break; + case DIFF_EQUAL: + // Upon reaching an equality, check for prior redundancies. + if (count_delete + count_insert > 1) { + if (count_delete !== 0 && count_insert !== 0) { + // Factor out any common prefixies. + commonlength = diff_commonPrefix(text_insert, text_delete); + if (commonlength !== 0) { + if ((pointer - count_delete - count_insert) > 0 && + diffs[pointer - count_delete - count_insert - 1][0] == + DIFF_EQUAL) { + diffs[pointer - count_delete - count_insert - 1][1] += + text_insert.substring(0, commonlength); + } else { + diffs.splice(0, 0, [DIFF_EQUAL, + text_insert.substring(0, commonlength)]); + pointer++; + } + text_insert = text_insert.substring(commonlength); + text_delete = text_delete.substring(commonlength); + } + // Factor out any common suffixies. + commonlength = diff_commonSuffix(text_insert, text_delete); + if (commonlength !== 0) { + diffs[pointer][1] = text_insert.substring(text_insert.length - + commonlength) + diffs[pointer][1]; + text_insert = text_insert.substring(0, text_insert.length - + commonlength); + text_delete = text_delete.substring(0, text_delete.length - + commonlength); + } + } + // Delete the offending records and add the merged ones. + if (count_delete === 0) { + diffs.splice(pointer - count_insert, + count_delete + count_insert, [DIFF_INSERT, text_insert]); + } else if (count_insert === 0) { + diffs.splice(pointer - count_delete, + count_delete + count_insert, [DIFF_DELETE, text_delete]); + } else { + diffs.splice(pointer - count_delete - count_insert, + count_delete + count_insert, [DIFF_DELETE, text_delete], + [DIFF_INSERT, text_insert]); + } + pointer = pointer - count_delete - count_insert + + (count_delete ? 1 : 0) + (count_insert ? 1 : 0) + 1; + } else if (pointer !== 0 && diffs[pointer - 1][0] == DIFF_EQUAL) { + // Merge this equality with the previous one. + diffs[pointer - 1][1] += diffs[pointer][1]; + diffs.splice(pointer, 1); + } else { + pointer++; + } + count_insert = 0; + count_delete = 0; + text_delete = ''; + text_insert = ''; + break; + } + } + if (diffs[diffs.length - 1][1] === '') { + diffs.pop(); // Remove the dummy entry at the end. + } + + // Second pass: look for single edits surrounded on both sides by equalities + // which can be shifted sideways to eliminate an equality. + // e.g: ABAC -> ABAC + var changes = false; + pointer = 1; + // Intentionally ignore the first and last element (don't need checking). + while (pointer < diffs.length - 1) { + if (diffs[pointer - 1][0] == DIFF_EQUAL && + diffs[pointer + 1][0] == DIFF_EQUAL) { + // This is a single edit surrounded by equalities. + if (diffs[pointer][1].substring(diffs[pointer][1].length - + diffs[pointer - 1][1].length) == diffs[pointer - 1][1]) { + // Shift the edit over the previous equality. + diffs[pointer][1] = diffs[pointer - 1][1] + + diffs[pointer][1].substring(0, diffs[pointer][1].length - + diffs[pointer - 1][1].length); + diffs[pointer + 1][1] = diffs[pointer - 1][1] + diffs[pointer + 1][1]; + diffs.splice(pointer - 1, 1); + changes = true; + } else if (diffs[pointer][1].substring(0, diffs[pointer + 1][1].length) == + diffs[pointer + 1][1]) { + // Shift the edit over the next equality. + diffs[pointer - 1][1] += diffs[pointer + 1][1]; + diffs[pointer][1] = + diffs[pointer][1].substring(diffs[pointer + 1][1].length) + + diffs[pointer + 1][1]; + diffs.splice(pointer + 1, 1); + changes = true; + } + } + pointer++; + } + // If shifts were made, the diff needs reordering and another shift sweep. + if (changes) { + diff_cleanupMerge(diffs); + } +}; + + +var diff = diff_main; +diff.INSERT = DIFF_INSERT; +diff.DELETE = DIFF_DELETE; +diff.EQUAL = DIFF_EQUAL; + + +module.exports = diff; + +},{}],10:[function(_dereq_,module,exports){ +module.exports={ + "name": "rich-text", + "version": "1.0.2", + "description": "Format for representing rich text documents and changes.", + "author": { + "name": "Jason Chen", + "email": "jhchen7@gmail.com" + }, + "homepage": "https://github.com/ottypes/rich-text", + "main": "index.js", + "dependencies": { + "fast-diff": "~1.0.0" + }, + "devDependencies": { + "chai": "~1.9.1", + "coveralls": "~2.11.1", + "grunt": "~0.4.5", + "istanbul": "~0.3.0", + "lodash": "~2.4.1", + "mocha": "~1.21.4", + "ot-fuzzer": "~1.0.0" + }, + "engines": { + "node": ">=0.10" + }, + "license": "MIT", + "scripts": { + "test": "grunt test" + }, + "repository": { + "type": "git", + "url": "https://github.com/ottypes/rich-text" + }, + "bugs": { + "url": "https://github.com/ottypes/rich-text/issues" + }, + "keywords": [ + "rich text", + "ot", + "operational transform", + "delta" + ], + "readme": "# Rich Text [![Build Status](https://travis-ci.org/ottypes/rich-text.svg?branch=master)](http://travis-ci.org/ottypes/rich-text) [![Coverage Status](https://img.shields.io/coveralls/ottypes/rich-text.svg)](https://coveralls.io/r/ottypes/rich-text)\n\nA format for representing rich text documents and changes. It aimes to be intuitive and human readable with the ability to express any change necessary to deal with rich text. A document can also be expressed with this format--as the change from an empty document.\n\n## Quick Example\n\n```js\nvar delta = new Delta([\n { insert: 'Gandalf', attributes: { bold: true } },\n { insert: ' the ' },\n { insert: 'Grey', attributes: { color: '#ccc' } }\n]);\n\n// Keep the first 12 characters, delete the next 4, and insert a white 'White'\nvar death = new Delta().retain(12)\n .delete(4)\n .insert('White', { color: '#fff' });\n// this produces:\n// {\n// ops: [\n// { retain: 12 },\n// { delete: '4 ' },\n// { insert: 'White', attributes: { color: '#fff' } }\n// ]\n// }\n\ndelta.compose(death);\n// delta is now:\n// {\n// ops: [\n// { insert: 'Gandalf ', attributes: { bold: true } },\n// { insert: 'the ' },\n// { insert: 'White', attributes: { color: '#fff' } }\n// ]\n// }\n\n```\n\nThis format is suitable for [Operational Transform](https://en.wikipedia.org/wiki/Operational_transformation) and defines several functions to support this use case.\n\n## Contents\n\n#### [Operations](#operations-1)\n\n- [insert](#insert-operation)\n- [delete](#delete-operation)\n- [retain](#retain-operation)\n\n#### [Deltas](#deltas-1)\n\n- [`constructor`](#constructor)\n- [`insert`](#insert)\n- [`delete`](#delete)\n- [`retain`](#retain)\n- [`length`](#length)\n- [`slice`](#slice)\n- [`compose`](#compose)\n- [`transform`](#transform)\n\n#### [Documents](#documents-1)\n\n- [`diff`](#diff)\n\n\n## Operations\n\nOperations describe a singular change to a document. They can be an [`insert`](#insert-operation), [`delete`](#delete-operation) or [`retain`](#retain-operation). Note operations do not take an index. They always describe the change at the current index. Use retains to \"keep\" or \"skip\" certain parts of the document.\n\n### Insert Operation\n\nInsert operations have an `insert` key defined. A String value represents inserting text. A Number value represents inserting an embed, with the value corresponding to an embed type (such as an image or video).\n\nHere we will use 1 to represent images and 2 to represent videos, but your application can choose whatever mapping is convenient.\n\nIn both cases of text and embeds, an optional `attributes` key can be defined with an Object to describe additonal formatting information. Formats can be changed by the [retain](#retain) operation.\n\n```js\n// Insert a bolded \"Text\"\n{ insert: \"Text\", attributes: { bold: true } }\n\n// Insert a link\n{ insert: \"Google\", attributes: { href: 'https://www.google.com' } }\n\n// Insert an image\n{\n insert: 1,\n attributes: {\n alt: \"Lab Octocat\",\n src: 'https://octodex.github.com/images/labtocat.png'\n }\n}\n\n// Insert a video\n{\n insert: 2,\n attributes: {\n src: \"https://www.youtube.com/watch?v=dMH0bHeiRNg\",\n width: 420,\n height: 315\n }\n}\n```\n\n### Delete Operation\n\nDelete operations have a Number `delete` key defined representing the number of characters to delete. All embeds have a length of 1.\n\n```js\n// Delete the next 10 characters\n{ delete: 10 }\n```\n\n### Retain Operation\n\nRetain operations have a Number `retain` key defined representing the number of characters to keep (other libraries might use the name keep or skip). An optional `attributes` key can be defined with an Object to describe formatting changes to the character range. A value of null in the `attributes` Object represents removal of that key.\n\n*Note: It is not necessary to retain the last characters of a document as this is implied.*\n\n```js\n// Keep the next 5 characters\n{ retain: 5 }\n\n// Keep and bold the next 5 characters\n{ retain: 5, attributes: { bold: true } }\n\n// Keep and unbold the next 5 characters\n// More specifically, remove the bold key in the attributes Object\n// in the next 5 characters\n{ retain: 5, attributes: { bold: null } }\n```\n\n\n## Deltas\n\nA Delta is made up of an array of operations. Unless otherwise specified all methods are self modifying and return `this` for chainability.\n\nAll methods also maintain the property that Deltas are represented in the most compact form. For example two consecutive insert operations of plain text will be merged into one.\n\n---\n\n### constructor\n\nCreates a new Delta object.\n\n#### Methods\n\n- `new Delta()`\n- `new Delta(ops)`\n- `new Delta(delta)`\n\n#### Parameters\n\n- `ops` - Array of operations\n- `delta` - Object with an `ops` key set to an array of operations\n\n*Note: No validity/sanity check is performed when constructed with ops or delta. The new delta's internal ops array will also be assigned to ops or delta.ops without deep copying.*\n\n#### Example\n\n```js\nvar delta = new Delta([\n { insert: 'Hello World' },\n { insert: '!', attributes: { bold: true }}\n]);\n\nvar packet = JSON.stringify(delta);\n\nvar other = new Delta(JSON.parse(packet));\n\nvar chained = new Delta().insert('Hello World').insert('!', { bold: true });\n```\n\n---\n\n### insert()\n\nAppends an insert operation.\n\n#### Methods\n\n- `insert(text, attributes)`\n- `insert(embed, attributes)`\n\n#### Parameters\n\n- `text` - String representing text to insert\n- `embed` - Number representing embed type to insert\n- `attributes` - Optional attributes to apply\n\n#### Example\n\n```js\ndelta.insert('Text', { bold: true, color: '#ccc' });\ndelta.insert(1, { src: 'https://octodex.github.com/images/labtocat.png' });\n```\n\n---\n\n### delete()\n\nAppends a delete operation.\n\n#### Methods\n\n- `delete(length)`\n\n#### Parameters\n\n- `length` - Number of characters to delete\n\n#### Example\n\n```js\ndelta.delete(5);\n```\n\n---\n\n### retain()\n\nAppends a retain operation.\n\n#### Methods\n\n- `retain(length, attributes)`\n\n#### Parameters\n\n- `length` - Number of characters to retain\n- `attributes` - Optional attributes to apply\n\n#### Example\n\n```js\ndelta.retain(4).retain(5, { color: '#0c6' });\n```\n\n---\n\n### length()\n\nReturns length of Delta.\n\n#### Methods\n\n- `length()`\n\n#### Example\n\n```js\nnew Delta().insert('Hello').length(); // Returns 5\n\nnew Delta().insert('A').retain(2).delete(1) // Returns 4\n```\n\n---\n\n### slice()\n\nReturns copy of delta with subset of operations.\n\n#### Methods\n\n- `slice()`\n- `slice(start)`\n- `slice(start, end)`\n\n#### Parameters\n\n- `start` - Start index of subset, defaults to 0\n- `end` - End index of subset, defaults to rest of operations\n\n#### Example\n\n```js\nvar delta = new Delta().insert('Hello', { bold: true }).insert(' World');\n\n// {\n// ops: [\n// { insert: 'Hello', attributes: { bold: true } },\n// { insert: ' World' }\n// ]\n// }\nvar copy = delta.slice();\n\n// { ops: [{ insert: 'World' }] }\nvar world = delta.slice(6);\n\n// { ops: [{ insert: ' ' }] }\nvar space = delta.slice(5, 6);\n```\n\n---\n\n### compose()\n\nCompose with another Delta, i.e. merge the operations of another Delta. This method is self modifying.\n\n#### Methods\n\n- `compose(other)`\n\n#### Parameters\n\n- `other` - Delta to compose\n\n#### Example\n\n```js\nvar a = new Delta().insert('abc');\nvar b = new Delta().retain(1).delete(1);\n\na.compose(b); // a == new Delta().insert('ac');\n```\n\n### transform()\n\nTransform given Delta against own operations.\n\n#### Methods\n\n- `transform(other, priority)`\n- `transform(index)` - Alias for [`transformPosition`](#tranformposition)\n\n#### Parameters\n\n- `other` - Delta to transform\n- `priority` - Boolean used to break ties\n\n#### Returns\n\n- `Delta` - transformed Delta\n\n#### Example\n\n```js\nvar a = new Delta().insert('a');\nvar b = new Delta().insert('b');\n\nb = a.transform(b, true); // new Delta().retain(1).insert('b');\n```\n\n---\n\n### transformPosition()\n\nTransform an index against the delta. Useful for representing cursor/selection positions.\n\n#### Methods\n\n- `transformPosition(index)`\n\n#### Parameters\n\n- `index` - index to transform\n\n#### Returns\n\n- `Number` - transformed index\n\n#### Example\n\n```js\nvar index = 12;\nvar transformedIndex = delta.transformPosition(index);\n```\n\n\n## Documents\n\nA Delta with only insert operations can be used to represent a rich text document. This can be thought of as a Delta applied to an empty document.\n\n---\n\n### diff()\n\nCalculates the difference between two documents expressed as a Delta.\n\n#### Methods\n\n- `diff(other)`\n\n#### Parameters\n\n- `other` - Document Delta to diff against\n\n#### Returns\n\n- `Delta` - difference between the two documents\n\n#### Example\n\n```js\nvar a = new Delta().insert('Hello');\nvar b = new Delta().insert('Hello!');\n\nvar diff = a.diff(b); // { ops: [{ retain: 5 }, { insert: '!' }] }\n```\n", + "readmeFilename": "README.md", + "_id": "rich-text@1.0.2", + "_from": "rich-text@~1.0.2" +} + +},{}],11:[function(_dereq_,module,exports){ +module.exports={ + "name": "quilljs", + "version": "0.18.1", + "description": "Cross browser rich text editor", + "author": "Jason Chen ", + "homepage": "http://quilljs.com", + "contributors": [ + "Byron Milligan ", + "Keegan Poppen " + ], + "main": "index.js", + "dependencies": { + "eventemitter2": "~0.4.13", + "lodash": "~2.4.1", + "rich-text": "~1.0.2" + }, + "devDependencies": { + "async": "~0.9.0", + "coffee-script": "~1.8.0", + "coffeeify": "~0.7.0", + "glob": "~4.0.4", + "grunt": "~0.4.3", + "grunt-browserify": "~2.1.0", + "grunt-contrib-clean": "~0.6.0", + "grunt-contrib-coffee": "~0.12.0", + "grunt-contrib-compress": "~0.12.0", + "grunt-contrib-concat": "~0.5.0", + "grunt-contrib-connect": "~0.8.0", + "grunt-contrib-copy": "~0.7.0", + "grunt-contrib-stylus": "~0.18.0", + "grunt-contrib-uglify": "~0.6.0", + "grunt-karma": "~0.9.0", + "grunt-lodash": "~0.3.0", + "grunt-protractor-runner": "~1.1.0", + "grunt-sauce-connect-launcher": "~0.3.0", + "harp": "~0.14.0", + "istanbul": "~0.3.0", + "jquery": "~2.1.1", + "karma": "~0.12.0", + "karma-chrome-launcher": "~0.1.2", + "karma-coffee-preprocessor": "~0.2.1", + "karma-coverage": "~0.2.0", + "karma-firefox-launcher": "~0.1.3", + "karma-html2js-preprocessor": "~0.1.0", + "karma-jasmine": "~0.2.0", + "karma-phantomjs-launcher": "~0.1.2", + "karma-safari-launcher": "~0.1.1", + "karma-sauce-launcher": "~0.2.2", + "load-grunt-tasks": "~0.6.0", + "protractor": "~1.3.1", + "stylus": "~0.49.2", + "watchify": "~0.10.2" + }, + "engines": { + "node": ">=0.10" + }, + "license": "BSD-3-Clause", + "repository": { + "type": "git", + "url": "https://github.com/quilljs/quill" + }, + "bugs": { + "url": "https://github.com/quilljs/quill/issues" + }, + "scripts": { + "prepublish": "grunt coffee:quill", + "postpublish": "grunt clean:coffee", + "test": "grunt test" + }, + "keywords": [ + "editor", + "rich text", + "wysiwyg" + ] +} + +},{}],12:[function(_dereq_,module,exports){ +var Delta, Document, Format, Line, LinkedList, Normalizer, dom, _; + +_ = _dereq_('lodash'); + +Delta = _dereq_('rich-text').Delta; + +dom = _dereq_('../lib/dom'); + +Format = _dereq_('./format'); + +Line = _dereq_('./line'); + +LinkedList = _dereq_('../lib/linked-list'); + +Normalizer = _dereq_('../lib/normalizer'); + +Document = (function() { + function Document(root, options) { + this.root = root; + if (options == null) { + options = {}; + } + this.formats = {}; + _.each(options.formats, _.bind(this.addFormat, this)); + this.setHTML(this.root.innerHTML); + } + + Document.prototype.addFormat = function(name, config) { + if (!_.isObject(config)) { + config = Format.FORMATS[name]; + } + if (this.formats[name] != null) { + console.warn('Overwriting format', name, this.formats[name]); + } + return this.formats[name] = new Format(this.root.ownerDocument, config); + }; + + Document.prototype.appendLine = function(lineNode) { + return this.insertLineBefore(lineNode, null); + }; + + Document.prototype.findLeafAt = function(index, inclusive) { + var line, offset, _ref; + _ref = this.findLineAt(index), line = _ref[0], offset = _ref[1]; + if (line != null) { + return line.findLeafAt(offset, inclusive); + } else { + return [null, offset]; + } + }; + + Document.prototype.findLine = function(node) { + var line; + while ((node != null) && (dom.BLOCK_TAGS[node.tagName] == null)) { + node = node.parentNode; + } + line = node != null ? this.lineMap[node.id] : null; + if ((line != null ? line.node : void 0) === node) { + return line; + } else { + return null; + } + }; + + Document.prototype.findLineAt = function(index) { + var curLine, length; + if (!(this.lines.length > 0)) { + return [null, index]; + } + length = this.toDelta().length(); + if (index === length) { + return [this.lines.last, this.lines.last.length]; + } + if (index > length) { + return [null, index - length]; + } + curLine = this.lines.first; + while (curLine != null) { + if (index < curLine.length) { + return [curLine, index]; + } + index -= curLine.length; + curLine = curLine.next; + } + return [null, index]; + }; + + Document.prototype.insertLineBefore = function(newLineNode, refLine) { + var line; + line = new Line(this, newLineNode); + if (refLine != null) { + if (!dom(newLineNode.parentNode).isElement()) { + this.root.insertBefore(newLineNode, refLine.node); + } + this.lines.insertAfter(refLine.prev, line); + } else { + if (!dom(newLineNode.parentNode).isElement()) { + this.root.appendChild(newLineNode); + } + this.lines.append(line); + } + this.lineMap[line.id] = line; + return line; + }; + + Document.prototype.mergeLines = function(line, lineToMerge) { + if (lineToMerge.length > 1) { + if (line.length === 1) { + dom(line.leaves.last.node).remove(); + } + _.each(dom(lineToMerge.node).childNodes(), function(child) { + if (child.tagName !== dom.DEFAULT_BREAK_TAG) { + return line.node.appendChild(child); + } + }); + } + this.removeLine(lineToMerge); + return line.rebuild(); + }; + + Document.prototype.optimizeLines = function() { + return _.each(this.lines.toArray(), function(line, i) { + line.optimize(); + return true; + }); + }; + + Document.prototype.rebuild = function() { + var lineNode, lines, _results; + lines = this.lines.toArray(); + lineNode = this.root.firstChild; + if ((lineNode != null) && (dom.LIST_TAGS[lineNode.tagName] != null)) { + lineNode = lineNode.firstChild; + } + _.each(lines, (function(_this) { + return function(line, index) { + var newLine, _ref; + while (line.node !== lineNode) { + if (line.node.parentNode === _this.root || ((_ref = line.node.parentNode) != null ? _ref.parentNode : void 0) === _this.root) { + lineNode = Normalizer.normalizeLine(lineNode); + newLine = _this.insertLineBefore(lineNode, line); + lineNode = dom(lineNode).nextLineNode(_this.root); + } else { + return _this.removeLine(line); + } + } + if (line.outerHTML !== lineNode.outerHTML) { + line.node = Normalizer.normalizeLine(line.node); + line.rebuild(); + } + return lineNode = dom(lineNode).nextLineNode(_this.root); + }; + })(this)); + _results = []; + while (lineNode != null) { + lineNode = Normalizer.normalizeLine(lineNode); + this.appendLine(lineNode); + _results.push(lineNode = dom(lineNode).nextLineNode(this.root)); + } + return _results; + }; + + Document.prototype.removeLine = function(line) { + if (line.node.parentNode != null) { + if (dom.LIST_TAGS[line.node.parentNode.tagName] && line.node.parentNode.childNodes.length === 1) { + dom(line.node.parentNode).remove(); + } else { + dom(line.node).remove(); + } + } + delete this.lineMap[line.id]; + return this.lines.remove(line); + }; + + Document.prototype.setHTML = function(html) { + html = Normalizer.stripComments(html); + html = Normalizer.stripWhitespace(html); + this.root.innerHTML = html; + this.lines = new LinkedList(); + this.lineMap = {}; + return this.rebuild(); + }; + + Document.prototype.splitLine = function(line, offset) { + var lineNode1, lineNode2, newLine, _ref; + offset = Math.min(offset, line.length - 1); + _ref = dom(line.node).split(offset, true), lineNode1 = _ref[0], lineNode2 = _ref[1]; + line.node = lineNode1; + line.rebuild(); + newLine = this.insertLineBefore(lineNode2, line.next); + newLine.formats = _.clone(line.formats); + newLine.resetContent(); + return newLine; + }; + + Document.prototype.toDelta = function() { + var delta, lines; + lines = this.lines.toArray(); + delta = new Delta(); + lines.forEach(function(line) { + return line.delta.ops.forEach(function(op) { + return delta.push(op); + }); + }); + return delta; + }; + + return Document; + +})(); + +module.exports = Document; + + + +},{"../lib/dom":21,"../lib/linked-list":22,"../lib/normalizer":23,"./format":14,"./line":16,"lodash":"M4+//f","rich-text":4}],13:[function(_dereq_,module,exports){ +var Document, Editor, Line, Renderer, Selection, dom, _; + +_ = _dereq_('lodash'); + +dom = _dereq_('../lib/dom'); + +Document = _dereq_('./document'); + +Line = _dereq_('./line'); + +Renderer = _dereq_('./renderer'); + +Selection = _dereq_('./selection'); + +Editor = (function() { + Editor.sources = { + API: 'api', + SILENT: 'silent', + USER: 'user' + }; + + function Editor(iframeContainer, quill, options) { + this.iframeContainer = iframeContainer; + this.quill = quill; + this.options = options != null ? options : {}; + this.renderer = new Renderer(this.iframeContainer, this.options); + dom(this.iframeContainer).on('focus', this.focus.bind(this)); + this.root = this.renderer.root; + this.doc = new Document(this.root, this.options); + this.delta = this.doc.toDelta(); + this.selection = new Selection(this.doc, this.renderer.iframe, this.quill); + this.timer = setInterval(_.bind(this.checkUpdate, this), this.options.pollInterval); + if (!this.options.readOnly) { + this.enable(); + } + } + + Editor.prototype.disable = function() { + return this.enable(false); + }; + + Editor.prototype.enable = function(enabled) { + if (enabled == null) { + enabled = true; + } + return this.root.setAttribute('contenteditable', enabled); + }; + + Editor.prototype.applyDelta = function(delta, source) { + var localDelta; + localDelta = this._update(); + if (localDelta) { + delta = localDelta.transform(delta, true); + localDelta = delta.transform(localDelta, false); + } + if (delta.ops.length > 0) { + delta = this._trackDelta((function(_this) { + return function() { + var index; + index = 0; + _.each(delta.ops, function(op) { + if (_.isString(op.insert)) { + _this._insertAt(index, op.insert, op.attributes); + return index += op.insert.length; + } else if (_.isNumber(op.insert)) { + _this._insertAt(index, dom.EMBED_TEXT, op.attributes); + return index += 1; + } else if (_.isNumber(op["delete"])) { + return _this._deleteAt(index, op["delete"]); + } else if (_.isNumber(op.retain)) { + _.each(op.attributes, function(value, name) { + return _this._formatAt(index, op.retain, name, value); + }); + return index += op.retain; + } + }); + return _this.selection.shiftAfter(0, 0, _.bind(_this.doc.optimizeLines, _this.doc)); + }; + })(this)); + this.delta = this.doc.toDelta(); + this.innerHTML = this.root.innerHTML; + if (delta && source !== Editor.sources.SILENT) { + this.quill.emit(this.quill.constructor.events.TEXT_CHANGE, delta, source); + } + } + if (localDelta && localDelta.ops.length > 0 && source !== Editor.sources.SILENT) { + return this.quill.emit(this.quill.constructor.events.TEXT_CHANGE, localDelta, Editor.sources.USER); + } + }; + + Editor.prototype.checkUpdate = function(source) { + var delta; + if (source == null) { + source = 'user'; + } + if ((this.renderer.iframe.parentNode == null) || (this.root.parentNode == null)) { + return clearInterval(this.timer); + } + delta = this._update(); + if (delta) { + this.delta.compose(delta); + this.quill.emit(this.quill.constructor.events.TEXT_CHANGE, delta, source); + } + if (delta) { + source = Editor.sources.SILENT; + } + return this.selection.update(source); + }; + + Editor.prototype.focus = function() { + if (dom.isIE(11)) { + this.selection.setRange(this.selection.range); + } + if (dom.isIOS()) { + this.renderer.iframe.focus(); + } + return this.root.focus(); + }; + + Editor.prototype.getDelta = function() { + return this.delta; + }; + + Editor.prototype._deleteAt = function(index, length) { + if (length <= 0) { + return; + } + return this.selection.shiftAfter(index, -1 * length, (function(_this) { + return function() { + var curLine, deleteLength, firstLine, mergeFirstLine, nextLine, offset, _ref; + _ref = _this.doc.findLineAt(index), firstLine = _ref[0], offset = _ref[1]; + curLine = firstLine; + mergeFirstLine = firstLine.length - offset <= length && offset > 0; + while ((curLine != null) && length > 0) { + nextLine = curLine.next; + deleteLength = Math.min(curLine.length - offset, length); + if (offset === 0 && length >= curLine.length) { + _this.doc.removeLine(curLine); + } else { + curLine.deleteText(offset, deleteLength); + } + length -= deleteLength; + curLine = nextLine; + offset = 0; + } + if (mergeFirstLine && firstLine.next) { + return _this.doc.mergeLines(firstLine, firstLine.next); + } + }; + })(this)); + }; + + Editor.prototype._formatAt = function(index, length, name, value) { + return this.selection.shiftAfter(index, 0, (function(_this) { + return function() { + var formatLength, line, offset, _ref, _results; + _ref = _this.doc.findLineAt(index), line = _ref[0], offset = _ref[1]; + _results = []; + while ((line != null) && length > 0) { + formatLength = Math.min(length, line.length - offset - 1); + line.formatText(offset, formatLength, name, value); + length -= formatLength; + if (length > 0) { + line.format(name, value); + } + length -= 1; + offset = 0; + _results.push(line = line.next); + } + return _results; + }; + })(this)); + }; + + Editor.prototype._insertAt = function(index, text, formatting) { + if (formatting == null) { + formatting = {}; + } + return this.selection.shiftAfter(index, text.length, (function(_this) { + return function() { + var line, lineTexts, offset, _ref; + text = text.replace(/\r\n/g, '\n').replace(/\r/g, '\n'); + lineTexts = text.split('\n'); + _ref = _this.doc.findLineAt(index), line = _ref[0], offset = _ref[1]; + return _.each(lineTexts, function(lineText, i) { + var nextLine; + if ((line == null) || line.length <= offset) { + if (i < lineTexts.length - 1 || lineText.length > 0) { + line = _this.doc.appendLine(_this.root.ownerDocument.createElement(dom.DEFAULT_BLOCK_TAG)); + offset = 0; + line.insertText(offset, lineText, formatting); + line.format(formatting); + nextLine = null; + } + } else { + line.insertText(offset, lineText, formatting); + if (i < lineTexts.length - 1) { + nextLine = _this.doc.splitLine(line, offset + lineText.length); + _.each(_.defaults({}, formatting, line.formats), function(value, format) { + return line.format(format, formatting[format]); + }); + offset = 0; + } + } + return line = nextLine; + }); + }; + })(this)); + }; + + Editor.prototype._trackDelta = function(fn) { + var delta, newDelta; + fn(); + newDelta = this.doc.toDelta(); + delta = this.delta.diff(newDelta); + return delta; + }; + + Editor.prototype._update = function() { + var delta; + if (this.innerHTML === this.root.innerHTML) { + return false; + } + delta = this._trackDelta((function(_this) { + return function() { + _this.selection.preserve(_.bind(_this.doc.rebuild, _this.doc)); + return _this.selection.shiftAfter(0, 0, _.bind(_this.doc.optimizeLines, _this.doc)); + }; + })(this)); + this.innerHTML = this.root.innerHTML; + if (delta.ops.length > 0) { + return delta; + } else { + return false; + } + }; + + return Editor; + +})(); + +module.exports = Editor; + + + +},{"../lib/dom":21,"./document":12,"./line":16,"./renderer":17,"./selection":18,"lodash":"M4+//f"}],14:[function(_dereq_,module,exports){ +var Format, dom, _; + +_ = _dereq_('lodash'); + +dom = _dereq_('../lib/dom'); + +Format = (function() { + Format.types = { + LINE: 'line' + }; + + Format.FORMATS = { + bold: { + tag: 'B', + prepare: 'bold' + }, + italic: { + tag: 'I', + prepare: 'italic' + }, + underline: { + tag: 'U', + prepare: 'underline' + }, + strike: { + tag: 'S', + prepare: 'strikeThrough' + }, + color: { + style: 'color', + "default": 'rgb(0, 0, 0)', + prepare: 'foreColor' + }, + background: { + style: 'backgroundColor', + "default": 'rgb(255, 255, 255)', + prepare: 'backColor' + }, + font: { + style: 'fontFamily', + "default": "'Helvetica', 'Arial', sans-serif", + prepare: 'fontName' + }, + size: { + style: 'fontSize', + "default": '13px', + prepare: function(doc, value) { + return doc.execCommand('fontSize', false, dom.convertFontSize(value)); + } + }, + link: { + tag: 'A', + attribute: 'href' + }, + image: { + tag: 'IMG', + attribute: 'src' + }, + align: { + type: Format.types.LINE, + style: 'textAlign', + "default": 'left' + }, + bullet: { + type: Format.types.LINE, + exclude: 'list', + parentTag: 'UL', + tag: 'LI' + }, + list: { + type: Format.types.LINE, + exclude: 'bullet', + parentTag: 'OL', + tag: 'LI' + } + }; + + function Format(document, config) { + this.document = document; + this.config = config; + } + + Format.prototype.add = function(node, value) { + var formatNode, inline, parentNode, _ref, _ref1; + if (!value) { + return this.remove(node); + } + if (this.value(node) === value) { + return node; + } + if (_.isString(this.config.parentTag)) { + parentNode = this.document.createElement(this.config.parentTag); + dom(node).wrap(parentNode); + if (node.parentNode.tagName === ((_ref = node.parentNode.previousSibling) != null ? _ref.tagName : void 0)) { + dom(node.parentNode.previousSibling).merge(node.parentNode); + } + if (node.parentNode.tagName === ((_ref1 = node.parentNode.nextSibling) != null ? _ref1.tagName : void 0)) { + dom(node.parentNode).merge(node.parentNode.nextSibling); + } + } + if (_.isString(this.config.tag)) { + formatNode = this.document.createElement(this.config.tag); + if (dom.VOID_TAGS[formatNode.tagName] != null) { + if (node.parentNode != null) { + dom(node).replace(formatNode); + } + node = formatNode; + } else if (this.isType(Format.types.LINE)) { + node = dom(node).switchTag(this.config.tag); + } else { + dom(node).wrap(formatNode); + node = formatNode; + } + } + if (_.isString(this.config.style) || _.isString(this.config.attribute) || _.isString(this.config["class"])) { + if (_.isString(this.config["class"])) { + node = this.remove(node); + } + if (dom(node).isTextNode()) { + inline = this.document.createElement(dom.DEFAULT_INLINE_TAG); + dom(node).wrap(inline); + node = inline; + } + if (_.isString(this.config.style)) { + if (value !== this.config["default"]) { + node.style[this.config.style] = value; + } + } + if (_.isString(this.config.attribute)) { + node.setAttribute(this.config.attribute, value); + } + if (_.isString(this.config["class"])) { + dom(node).addClass(this.config["class"] + value); + } + } + return node; + }; + + Format.prototype.isType = function(type) { + return type === this.config.type; + }; + + Format.prototype.match = function(node) { + var c, _i, _len, _ref, _ref1; + if (!dom(node).isElement()) { + return false; + } + if (_.isString(this.config.parentTag) && ((_ref = node.parentNode) != null ? _ref.tagName : void 0) !== this.config.parentTag) { + return false; + } + if (_.isString(this.config.tag) && node.tagName !== this.config.tag) { + return false; + } + if (_.isString(this.config.style) && (!node.style[this.config.style] || node.style[this.config.style] === this.config["default"])) { + return false; + } + if (_.isString(this.config.attribute) && !node.hasAttribute(this.config.attribute)) { + return false; + } + if (_.isString(this.config["class"])) { + _ref1 = dom(node).classes(); + for (_i = 0, _len = _ref1.length; _i < _len; _i++) { + c = _ref1[_i]; + if (c.indexOf(this.config["class"]) === 0) { + return true; + } + } + return false; + } + return true; + }; + + Format.prototype.prepare = function(value) { + if (_.isString(this.config.prepare)) { + return this.document.execCommand(this.config.prepare, false, value); + } else if (_.isFunction(this.config.prepare)) { + return this.config.prepare(this.document, value); + } + }; + + Format.prototype.remove = function(node) { + var c, _i, _len, _ref; + if (!this.match(node)) { + return node; + } + if (_.isString(this.config.style)) { + node.style[this.config.style] = ''; + if (!node.getAttribute('style')) { + node.removeAttribute('style'); + } + } + if (_.isString(this.config.attribute)) { + node.removeAttribute(this.config.attribute); + } + if (_.isString(this.config["class"])) { + _ref = dom(node).classes(); + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + c = _ref[_i]; + if (c.indexOf(this.config["class"]) === 0) { + dom(node).removeClass(c); + } + } + if (!node.getAttribute('class')) { + node.removeAttribute('class'); + } + } + if (_.isString(this.config.tag)) { + if (this.isType(Format.types.LINE)) { + if (_.isString(this.config.parentTag)) { + if (node.previousSibling != null) { + dom(node).splitAncestors(node.parentNode.parentNode); + } + if (node.nextSibling != null) { + dom(node.nextSibling).splitAncestors(node.parentNode.parentNode); + } + } + node = dom(node).switchTag(dom.DEFAULT_BLOCK_TAG); + } else { + node = dom(node).switchTag(dom.DEFAULT_INLINE_TAG); + if (dom.EMBED_TAGS[this.config.tag] != null) { + dom(node).text(dom.EMBED_TEXT); + } + } + } + if (_.isString(this.config.parentTag)) { + dom(node.parentNode).unwrap(); + } + if (node.tagName === dom.DEFAULT_INLINE_TAG && !node.hasAttributes()) { + node = dom(node).unwrap(); + } + return node; + }; + + Format.prototype.value = function(node) { + var c, _i, _len, _ref; + if (!this.match(node)) { + return void 0; + } + if (_.isString(this.config.attribute)) { + return node.getAttribute(this.config.attribute) || void 0; + } else if (_.isString(this.config.style)) { + return node.style[this.config.style] || void 0; + } else if (_.isString(this.config["class"])) { + _ref = dom(node).classes(); + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + c = _ref[_i]; + if (c.indexOf(this.config["class"]) === 0) { + return c.slice(this.config["class"].length); + } + } + } else if (_.isString(this.config.tag)) { + return true; + } + return void 0; + }; + + return Format; + +})(); + +module.exports = Format; + + + +},{"../lib/dom":21,"lodash":"M4+//f"}],15:[function(_dereq_,module,exports){ +var Format, Leaf, LinkedList, dom, _, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + +_ = _dereq_('lodash'); + +dom = _dereq_('../lib/dom'); + +Format = _dereq_('./format'); + +LinkedList = _dereq_('../lib/linked-list'); + +Leaf = (function(_super) { + __extends(Leaf, _super); + + Leaf.ID_PREFIX = 'leaf-'; + + Leaf.isLeafNode = function(node) { + return dom(node).isTextNode() || (node.firstChild == null); + }; + + function Leaf(node, formats) { + this.node = node; + this.formats = _.clone(formats); + this.id = _.uniqueId(Leaf.ID_PREFIX); + this.text = dom(this.node).text(); + this.length = this.text.length; + } + + Leaf.prototype.deleteText = function(offset, length) { + var textNode; + if (!(length > 0)) { + return; + } + this.text = this.text.slice(0, offset) + this.text.slice(offset + length); + this.length = this.text.length; + if (dom.EMBED_TAGS[this.node.tagName] != null) { + textNode = this.node.ownerDocument.createTextNode(this.text); + return this.node = dom(this.node).replace(textNode); + } else { + return dom(this.node).text(this.text); + } + }; + + Leaf.prototype.insertText = function(offset, text) { + var textNode; + this.text = this.text.slice(0, offset) + text + this.text.slice(offset); + if (dom(this.node).isTextNode()) { + dom(this.node).text(this.text); + } else { + textNode = this.node.ownerDocument.createTextNode(text); + if (this.node.tagName === dom.DEFAULT_BREAK_TAG) { + this.node = dom(this.node).replace(textNode); + } else { + this.node.appendChild(textNode); + this.node = textNode; + } + } + return this.length = this.text.length; + }; + + return Leaf; + +})(LinkedList.Node); + +module.exports = Leaf; + + + +},{"../lib/dom":21,"../lib/linked-list":22,"./format":14,"lodash":"M4+//f"}],16:[function(_dereq_,module,exports){ +var Delta, Format, Leaf, Line, LinkedList, Normalizer, dom, _, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + +_ = _dereq_('lodash'); + +Delta = _dereq_('rich-text').Delta; + +dom = _dereq_('../lib/dom'); + +Format = _dereq_('./format'); + +Leaf = _dereq_('./leaf'); + +Line = _dereq_('./line'); + +LinkedList = _dereq_('../lib/linked-list'); + +Normalizer = _dereq_('../lib/normalizer'); + +Line = (function(_super) { + __extends(Line, _super); + + Line.CLASS_NAME = 'line'; + + Line.ID_PREFIX = 'line-'; + + function Line(doc, node) { + this.doc = doc; + this.node = node; + this.id = _.uniqueId(Line.ID_PREFIX); + this.formats = {}; + dom(this.node).addClass(Line.CLASS_NAME); + this.rebuild(); + Line.__super__.constructor.call(this, this.node); + } + + Line.prototype.buildLeaves = function(node, formats) { + return _.each(dom(node).childNodes(), (function(_this) { + return function(node) { + var nodeFormats; + node = Normalizer.normalizeNode(node); + nodeFormats = _.clone(formats); + _.each(_this.doc.formats, function(format, name) { + if (!format.isType(Format.types.LINE) && format.match(node)) { + return nodeFormats[name] = format.value(node); + } + }); + if (Leaf.isLeafNode(node)) { + return _this.leaves.append(new Leaf(node, nodeFormats)); + } else { + return _this.buildLeaves(node, nodeFormats); + } + }; + })(this)); + }; + + Line.prototype.deleteText = function(offset, length) { + var deleteLength, leaf, _ref; + if (!(length > 0)) { + return; + } + _ref = this.findLeafAt(offset), leaf = _ref[0], offset = _ref[1]; + while ((leaf != null) && length > 0) { + deleteLength = Math.min(length, leaf.length - offset); + leaf.deleteText(offset, deleteLength); + length -= deleteLength; + leaf = leaf.next; + offset = 0; + } + return this.rebuild(); + }; + + Line.prototype.findLeaf = function(leafNode) { + var curLeaf; + curLeaf = this.leaves.first; + while (curLeaf != null) { + if (curLeaf.node === leafNode) { + return curLeaf; + } + curLeaf = curLeaf.next; + } + return null; + }; + + Line.prototype.findLeafAt = function(offset, inclusive) { + var leaf; + if (inclusive == null) { + inclusive = false; + } + if (offset >= this.length - 1) { + return [this.leaves.last, this.leaves.last.length]; + } + leaf = this.leaves.first; + while (leaf != null) { + if (offset < leaf.length || (offset === leaf.length && inclusive)) { + return [leaf, offset]; + } + offset -= leaf.length; + leaf = leaf.next; + } + return [this.leaves.last, offset - this.leaves.last.length]; + }; + + Line.prototype.format = function(name, value) { + var formats; + if (_.isObject(name)) { + formats = name; + } else { + formats = {}; + formats[name] = value; + } + _.each(formats, (function(_this) { + return function(value, name) { + var excludeFormat, format; + format = _this.doc.formats[name]; + if (format.isType(Format.types.LINE)) { + if (format.config.exclude && _this.formats[format.config.exclude]) { + excludeFormat = _this.doc.formats[format.config.exclude]; + if (excludeFormat != null) { + _this.node = excludeFormat.remove(_this.node); + delete _this.formats[format.config.exclude]; + } + } + _this.node = format.add(_this.node, value); + } + if (value) { + return _this.formats[name] = value; + } else { + return delete _this.formats[name]; + } + }; + })(this)); + return this.resetContent(); + }; + + Line.prototype.formatText = function(offset, length, name, value) { + var format, leaf, leafOffset, leftNode, nextLeaf, rightNode, targetNode, _ref, _ref1, _ref2; + _ref = this.findLeafAt(offset), leaf = _ref[0], leafOffset = _ref[1]; + format = this.doc.formats[name]; + if (!((format != null) && format.config.type !== Format.types.LINE)) { + return; + } + while ((leaf != null) && length > 0) { + nextLeaf = leaf.next; + if ((value && leaf.formats[name] !== value) || (!value && (leaf.formats[name] != null))) { + targetNode = leaf.node; + if (leaf.formats[name] != null) { + dom(targetNode).splitAncestors(this.node); + while (!format.match(targetNode)) { + targetNode = targetNode.parentNode; + } + } + if (leafOffset > 0) { + _ref1 = dom(targetNode).split(leafOffset), leftNode = _ref1[0], targetNode = _ref1[1]; + } + if (leaf.length > leafOffset + length) { + _ref2 = dom(targetNode).split(length), targetNode = _ref2[0], rightNode = _ref2[1]; + } + format.add(targetNode, value); + } + length -= leaf.length - leafOffset; + leafOffset = 0; + leaf = nextLeaf; + } + return this.rebuild(); + }; + + Line.prototype.insertText = function(offset, text, formats) { + var leaf, leafOffset, nextNode, node, prevNode, _ref, _ref1; + if (formats == null) { + formats = {}; + } + if (!(text.length > 0)) { + return; + } + _ref = this.findLeafAt(offset), leaf = _ref[0], leafOffset = _ref[1]; + if (_.isEqual(leaf.formats, formats)) { + leaf.insertText(leafOffset, text); + return this.resetContent(); + } else { + node = _.reduce(formats, (function(_this) { + return function(node, value, name) { + return _this.doc.formats[name].add(node, value); + }; + })(this), this.node.ownerDocument.createTextNode(text)); + _ref1 = dom(leaf.node).split(leafOffset), prevNode = _ref1[0], nextNode = _ref1[1]; + if (nextNode) { + nextNode = dom(nextNode).splitAncestors(this.node).get(); + } + this.node.insertBefore(node, nextNode); + return this.rebuild(); + } + }; + + Line.prototype.optimize = function() { + Normalizer.optimizeLine(this.node); + return this.rebuild(); + }; + + Line.prototype.rebuild = function(force) { + if (force == null) { + force = false; + } + if (!force && (this.outerHTML != null) && this.outerHTML === this.node.outerHTML) { + if (_.all(this.leaves.toArray(), (function(_this) { + return function(leaf) { + return dom(leaf.node).isAncestor(_this.node); + }; + })(this))) { + return false; + } + } + this.node = Normalizer.normalizeNode(this.node); + if (dom(this.node).length() === 0 && !this.node.querySelector(dom.DEFAULT_BREAK_TAG)) { + this.node.appendChild(this.node.ownerDocument.createElement(dom.DEFAULT_BREAK_TAG)); + } + this.leaves = new LinkedList(); + this.formats = _.reduce(this.doc.formats, (function(_this) { + return function(formats, format, name) { + if (format.isType(Format.types.LINE)) { + if (format.match(_this.node)) { + formats[name] = format.value(_this.node); + } else { + delete formats[name]; + } + } + return formats; + }; + })(this), this.formats); + this.buildLeaves(this.node, {}); + this.resetContent(); + return true; + }; + + Line.prototype.resetContent = function() { + if (this.node.id !== this.id) { + this.node.id = this.id; + } + this.outerHTML = this.node.outerHTML; + this.length = 1; + this.delta = new Delta(); + this.leaves.toArray().forEach((function(_this) { + return function(leaf) { + _this.length += leaf.length; + if (dom.EMBED_TAGS[leaf.node.tagName] != null) { + return _this.delta.insert(1, leaf.formats); + } else { + return _this.delta.insert(leaf.text, leaf.formats); + } + }; + })(this)); + return this.delta.insert('\n', this.formats); + }; + + return Line; + +})(LinkedList.Node); + +module.exports = Line; + + + +},{"../lib/dom":21,"../lib/linked-list":22,"../lib/normalizer":23,"./format":14,"./leaf":15,"./line":16,"lodash":"M4+//f","rich-text":4}],17:[function(_dereq_,module,exports){ +var DEFAULT_STYLES, LIST_STYLES, Normalizer, Renderer, dom, rule, _; + +_ = _dereq_('lodash'); + +dom = _dereq_('../lib/dom'); + +Normalizer = _dereq_('../lib/normalizer'); + +DEFAULT_STYLES = { + 'html': { + 'height': '100%', + 'width': '100%' + }, + 'body': { + 'box-sizing': 'border-box', + 'cursor': 'text', + 'font-family': "'Helvetica', 'Arial', sans-serif", + 'font-size': '13px', + 'height': '100%', + 'line-height': '1.42', + 'margin': '0px', + 'overflow-x': 'hidden', + 'overflow-y': 'auto', + 'padding': '12px 15px' + }, + '.editor-container': { + 'height': '100%', + 'outline': 'none', + 'position': 'relative', + 'tab-size': '4', + 'white-space': 'pre-wrap' + }, + '.editor-container div': { + 'margin': '0', + 'padding': '0' + }, + '.editor-container a': { + 'text-decoration': 'underline' + }, + '.editor-container b': { + 'font-weight': 'bold' + }, + '.editor-container i': { + 'font-style': 'italic' + }, + '.editor-container s': { + 'text-decoration': 'line-through' + }, + '.editor-container u': { + 'text-decoration': 'underline' + }, + '.editor-container img': { + 'max-width': '100%' + }, + '.editor-container blockquote': { + 'margin': '0 0 0 2em', + 'padding': '0' + }, + '.editor-container ol': { + 'margin': '0 0 0 2em', + 'padding': '0', + 'list-style-type': 'decimal' + }, + '.editor-container ul': { + 'margin': '0 0 0 2em', + 'padding': '0', + 'list-style-type': 'disc' + } +}; + +LIST_STYLES = ['decimal', 'lower-alpha', 'lower-roman']; + +rule = '.editor-container ol > li'; + +_.each([1, 2, 3, 4, 5, 6, 7, 8, 9], function(i) { + rule += ' > ol'; + DEFAULT_STYLES[rule] = { + 'list-style-type': LIST_STYLES[i % 3] + }; + return rule += ' > li'; +}); + +if (dom.isIE(10)) { + DEFAULT_STYLES[dom.DEFAULT_BREAK_TAG] = { + 'display': 'none' + }; +} + +Renderer = (function() { + Renderer.objToCss = function(obj) { + return _.map(obj, function(value, key) { + var innerStr; + innerStr = _.map(value, function(innerValue, innerKey) { + return "" + innerKey + ": " + innerValue + ";"; + }).join(' '); + return "" + key + " { " + innerStr + " }"; + }).join("\n"); + }; + + Renderer.buildFrame = function(container) { + var iframe, iframeDoc, root; + iframe = container.ownerDocument.createElement('iframe'); + dom(iframe).attributes({ + frameBorder: '0', + height: '100%', + width: '100%', + title: 'Quill Rich Text Editor', + role: 'presentation' + }); + container.appendChild(iframe); + iframeDoc = iframe.contentWindow.document; + iframeDoc.open(); + iframeDoc.write(''); + iframeDoc.close(); + root = iframeDoc.createElement('div'); + iframeDoc.body.appendChild(root); + return [root, iframe]; + }; + + function Renderer(container, options) { + var _ref; + this.container = container; + this.options = options != null ? options : {}; + this.container.innerHTML = ''; + _ref = Renderer.buildFrame(this.container), this.root = _ref[0], this.iframe = _ref[1]; + this.root.setAttribute('id', this.options.id); + this.iframe.setAttribute('name', this.options.id); + dom(this.root).addClass('editor-container'); + dom(this.container).addClass('ql-container'); + if (dom.isIOS()) { + dom(this.container).styles({ + 'overflow': 'auto', + '-webkit-overflow-scrolling': 'touch' + }); + } + this.addStyles(DEFAULT_STYLES); + if (this.options.styles != null) { + _.defer(_.bind(this.addStyles, this, this.options.styles)); + } + } + + Renderer.prototype.addContainer = function(className, before) { + var container, refNode; + if (before == null) { + before = false; + } + refNode = before ? this.root : null; + container = this.root.ownerDocument.createElement('div'); + dom(container).addClass(className); + this.root.parentNode.insertBefore(container, refNode); + return container; + }; + + Renderer.prototype.addStyles = function(css) { + var link, style; + if (typeof css === 'object') { + style = this.root.ownerDocument.createElement('style'); + style.type = 'text/css'; + css = Renderer.objToCss(css); + style.appendChild(this.root.ownerDocument.createTextNode(css)); + return this.root.ownerDocument.head.appendChild(style); + } else if (typeof css === 'string') { + link = this.root.ownerDocument.createElement('link'); + dom(link).attributes({ + type: 'text/css', + rel: 'stylesheet', + href: css + }); + return this.root.ownerDocument.head.appendChild(link); + } + }; + + return Renderer; + +})(); + +module.exports = Renderer; + + + +},{"../lib/dom":21,"../lib/normalizer":23,"lodash":"M4+//f"}],18:[function(_dereq_,module,exports){ +var Leaf, Normalizer, Range, Selection, dom, _; + +_ = _dereq_('lodash'); + +dom = _dereq_('../lib/dom'); + +Leaf = _dereq_('./leaf'); + +Normalizer = _dereq_('../lib/normalizer'); + +Range = _dereq_('../lib/range'); + +Selection = (function() { + function Selection(doc, iframe, emitter) { + this.doc = doc; + this.iframe = iframe; + this.emitter = emitter; + this.document = this.doc.root.ownerDocument; + this.focus = false; + this.range = new Range(0, 0); + this.nullDelay = false; + this.update('silent'); + } + + Selection.prototype.checkFocus = function() { + return this.document.activeElement === this.doc.root && document.activeElement === this.iframe; + }; + + Selection.prototype.getRange = function(ignoreFocus) { + var end, nativeRange, start; + if (ignoreFocus == null) { + ignoreFocus = false; + } + if (this.checkFocus()) { + nativeRange = this._getNativeRange(); + if (nativeRange == null) { + return null; + } + start = this._positionToIndex(nativeRange.startContainer, nativeRange.startOffset); + if (nativeRange.startContainer === nativeRange.endContainer && nativeRange.startOffset === nativeRange.endOffset) { + end = start; + } else { + end = this._positionToIndex(nativeRange.endContainer, nativeRange.endOffset); + } + return new Range(Math.min(start, end), Math.max(start, end)); + } else if (ignoreFocus) { + return this.range; + } else { + return null; + } + }; + + Selection.prototype.preserve = function(fn) { + var endNode, endOffset, nativeRange, startNode, startOffset, _ref, _ref1, _ref2, _ref3; + nativeRange = this._getNativeRange(); + if ((nativeRange != null) && this.checkFocus()) { + _ref = this._encodePosition(nativeRange.startContainer, nativeRange.startOffset), startNode = _ref[0], startOffset = _ref[1]; + _ref1 = this._encodePosition(nativeRange.endContainer, nativeRange.endOffset), endNode = _ref1[0], endOffset = _ref1[1]; + fn(); + _ref2 = this._decodePosition(startNode, startOffset), startNode = _ref2[0], startOffset = _ref2[1]; + _ref3 = this._decodePosition(endNode, endOffset), endNode = _ref3[0], endOffset = _ref3[1]; + return this._setNativeRange(startNode, startOffset, endNode, endOffset); + } else { + return fn(); + } + }; + + Selection.prototype.setRange = function(range, source) { + var endNode, endOffset, startNode, startOffset, _ref, _ref1, _ref2; + if (range != null) { + _ref = this._indexToPosition(range.start), startNode = _ref[0], startOffset = _ref[1]; + if (range.isCollapsed()) { + _ref1 = [startNode, startOffset], endNode = _ref1[0], endOffset = _ref1[1]; + } else { + _ref2 = this._indexToPosition(range.end), endNode = _ref2[0], endOffset = _ref2[1]; + } + this._setNativeRange(startNode, startOffset, endNode, endOffset); + } else { + this._setNativeRange(null); + } + return this.update(source); + }; + + Selection.prototype.shiftAfter = function(index, length, fn) { + var range; + range = this.getRange(); + fn(); + if (range != null) { + range.shift(index, length); + return this.setRange(range, 'silent'); + } + }; + + Selection.prototype.update = function(source) { + var emit, focus, range, toEmit; + focus = this.checkFocus(); + range = this.getRange(true); + emit = source !== 'silent' && (!Range.compare(range, this.range) || focus !== this.focus); + toEmit = focus ? range : null; + if (toEmit === null && source === 'user' && !this.nullDelay) { + return this.nullDelay = true; + } else { + this.nullDelay = false; + this.range = range; + this.focus = focus; + if (emit) { + return this.emitter.emit(this.emitter.constructor.events.SELECTION_CHANGE, toEmit, source); + } + } + }; + + Selection.prototype._decodePosition = function(node, offset) { + var childIndex; + if (dom(node).isElement()) { + childIndex = _.indexOf(dom(node.parentNode).childNodes(), node); + offset += childIndex; + node = node.parentNode; + } + return [node, offset]; + }; + + Selection.prototype._encodePosition = function(node, offset) { + var text; + while (true) { + if (dom(node).isTextNode() || node.tagName === dom.DEFAULT_BREAK_TAG || (dom.EMBED_TAGS[node.tagName] != null)) { + return [node, offset]; + } else if (offset < node.childNodes.length) { + node = node.childNodes[offset]; + offset = 0; + } else if (node.childNodes.length === 0) { + if (Normalizer.TAGS[node.tagName] == null) { + text = node.ownerDocument.createTextNode(''); + node.appendChild(text); + node = text; + } + return [node, 0]; + } else { + node = node.lastChild; + if (dom(node).isElement()) { + if (node.tagName === dom.DEFAULT_BREAK_TAG || (dom.EMBED_TAGS[node.tagName] != null)) { + return [node, 1]; + } else { + offset = node.childNodes.length; + } + } else { + return [node, dom(node).length()]; + } + } + } + }; + + Selection.prototype._getNativeRange = function() { + var range, selection; + selection = this.document.getSelection(); + if ((selection != null ? selection.rangeCount : void 0) > 0) { + range = selection.getRangeAt(0); + if (dom(range.startContainer).isAncestor(this.doc.root, true)) { + if (range.startContainer === range.endContainer || dom(range.endContainer).isAncestor(this.doc.root, true)) { + return range; + } + } + } + return null; + }; + + Selection.prototype._indexToPosition = function(index) { + var leaf, offset, _ref; + if (this.doc.lines.length === 0) { + return [this.doc.root, 0]; + } + _ref = this.doc.findLeafAt(index, true), leaf = _ref[0], offset = _ref[1]; + return this._decodePosition(leaf.node, offset); + }; + + Selection.prototype._positionToIndex = function(node, offset) { + var leaf, leafNode, leafOffset, line, lineOffset, _ref; + _ref = this._encodePosition(node, offset), leafNode = _ref[0], offset = _ref[1]; + line = this.doc.findLine(leafNode); + if (line == null) { + return 0; + } + leaf = line.findLeaf(leafNode); + lineOffset = 0; + while (line.prev != null) { + line = line.prev; + lineOffset += line.length; + } + if (leaf == null) { + return lineOffset; + } + leafOffset = 0; + while (leaf.prev != null) { + leaf = leaf.prev; + leafOffset += leaf.length; + } + return lineOffset + leafOffset + offset; + }; + + Selection.prototype._setNativeRange = function(startNode, startOffset, endNode, endOffset) { + var nativeRange, selection; + selection = this.document.getSelection(); + if (!selection) { + return; + } + if (startNode != null) { + if (!this.checkFocus()) { + this.doc.root.focus(); + } + nativeRange = this._getNativeRange(); + if ((nativeRange == null) || startNode !== nativeRange.startContainer || startOffset !== nativeRange.startOffset || endNode !== nativeRange.endContainer || endOffset !== nativeRange.endOffset) { + selection.removeAllRanges(); + nativeRange = this.document.createRange(); + nativeRange.setStart(startNode, startOffset); + nativeRange.setEnd(endNode, endOffset); + selection.addRange(nativeRange); + if (!this.checkFocus()) { + return this.doc.root.focus(); + } + } + } else { + selection.removeAllRanges(); + return this.doc.root.blur(); + } + }; + + return Selection; + +})(); + +module.exports = Selection; + + + +},{"../lib/dom":21,"../lib/normalizer":23,"../lib/range":25,"./leaf":15,"lodash":"M4+//f"}],19:[function(_dereq_,module,exports){ +_dereq_('./modules/authorship'); + +_dereq_('./modules/image-tooltip'); + +_dereq_('./modules/keyboard'); + +_dereq_('./modules/link-tooltip'); + +_dereq_('./modules/multi-cursor'); + +_dereq_('./modules/paste-manager'); + +_dereq_('./modules/toolbar'); + +_dereq_('./modules/tooltip'); + +_dereq_('./modules/undo-manager'); + +module.exports = _dereq_('./quill'); + + + +},{"./modules/authorship":26,"./modules/image-tooltip":27,"./modules/keyboard":28,"./modules/link-tooltip":29,"./modules/multi-cursor":30,"./modules/paste-manager":31,"./modules/toolbar":32,"./modules/tooltip":33,"./modules/undo-manager":34,"./quill":35}],20:[function(_dereq_,module,exports){ +var ColorPicker, Picker, dom, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + +dom = _dereq_('./dom'); + +Picker = _dereq_('./picker'); + +ColorPicker = (function(_super) { + __extends(ColorPicker, _super); + + function ColorPicker() { + ColorPicker.__super__.constructor.apply(this, arguments); + dom(this.container).addClass('ql-color-picker'); + } + + ColorPicker.prototype.buildItem = function(picker, option, index) { + var item; + item = ColorPicker.__super__.buildItem.call(this, picker, option, index); + item.style.backgroundColor = option.value; + return item; + }; + + return ColorPicker; + +})(Picker); + +module.exports = ColorPicker; + + + +},{"./dom":21,"./picker":24}],21:[function(_dereq_,module,exports){ +var SelectWrapper, Wrapper, dom, lastKeyEvent, _, + __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + +_ = _dereq_('lodash'); + +lastKeyEvent = null; + +Wrapper = (function() { + function Wrapper(node) { + this.node = node; + this.trigger = __bind(this.trigger, this); + } + + Wrapper.prototype.addClass = function(cssClass) { + if (this.hasClass(cssClass)) { + return; + } + if (this.node.classList != null) { + this.node.classList.add(cssClass); + } else if (this.node.className != null) { + this.node.className = (this.node.className + ' ' + cssClass).trim(); + } + return this; + }; + + Wrapper.prototype.attributes = function(attributes) { + var attr, i, value, _i, _len, _ref; + if (attributes) { + _.each(attributes, (function(_this) { + return function(value, name) { + return _this.node.setAttribute(name, value); + }; + })(this)); + return this; + } else { + if (this.node.attributes == null) { + return {}; + } + attributes = {}; + _ref = this.node.attributes; + for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) { + value = _ref[i]; + attr = this.node.attributes[i]; + attributes[attr.name] = attr.value; + } + return attributes; + } + }; + + Wrapper.prototype.child = function(offset) { + var child, length; + child = this.node.firstChild; + length = dom(child).length(); + while (child != null) { + if (offset < length) { + break; + } + offset -= length; + child = child.nextSibling; + length = dom(child).length(); + } + if (child == null) { + child = this.node.lastChild; + offset = dom(child).length(); + } + return [child, offset]; + }; + + Wrapper.prototype.childNodes = function() { + return _.map(this.node.childNodes); + }; + + Wrapper.prototype.classes = function() { + return this.node.className.split(/\s+/); + }; + + Wrapper.prototype.descendants = function() { + return _.map(this.node.getElementsByTagName('*')); + }; + + Wrapper.prototype.get = function() { + return this.node; + }; + + Wrapper.prototype.hasClass = function(cssClass) { + if (this.node.classList != null) { + return this.node.classList.contains(cssClass); + } else if (this.node.className != null) { + return _.indexOf(this.classes(), cssClass) > -1; + } + return false; + }; + + Wrapper.prototype.isAncestor = function(ancestor, inclusive) { + var node; + if (inclusive == null) { + inclusive = false; + } + if (ancestor === this.node) { + return inclusive; + } + node = this.node; + while (node) { + if (node === ancestor) { + return true; + } + node = node.parentNode; + } + return false; + }; + + Wrapper.prototype.isElement = function() { + var _ref; + return ((_ref = this.node) != null ? _ref.nodeType : void 0) === dom.ELEMENT_NODE; + }; + + Wrapper.prototype.isTextNode = function() { + var _ref; + return ((_ref = this.node) != null ? _ref.nodeType : void 0) === dom.TEXT_NODE; + }; + + Wrapper.prototype.length = function() { + var length; + if (this.node == null) { + return 0; + } + length = this.text().length; + if (this.isElement()) { + length += this.node.querySelectorAll(_.keys(dom.EMBED_TAGS).join(',')).length; + } + return length; + }; + + Wrapper.prototype.merge = function(node) { + var $node; + $node = dom(node); + if (this.isElement()) { + $node.moveChildren(this.node); + this.normalize(); + } else { + this.text(this.text() + $node.text()); + } + $node.remove(); + return this; + }; + + Wrapper.prototype.moveChildren = function(newParent) { + _.each(this.childNodes(), function(child) { + return newParent.appendChild(child); + }); + return this; + }; + + Wrapper.prototype.nextLineNode = function(root) { + var nextNode; + nextNode = this.node.nextSibling; + if ((nextNode == null) && this.node.parentNode !== root) { + nextNode = this.node.parentNode.nextSibling; + } + if ((nextNode != null) && (dom.LIST_TAGS[nextNode.tagName] != null)) { + nextNode = nextNode.firstChild; + } + return nextNode; + }; + + Wrapper.prototype.normalize = function() { + var $node, curNode, followingNode, nextNode; + curNode = this.node.firstChild; + while (curNode != null) { + nextNode = curNode.nextSibling; + $node = dom(curNode); + if ((nextNode != null) && dom(nextNode).isTextNode()) { + if ($node.text().length === 0) { + $node.remove(); + } else if ($node.isTextNode()) { + followingNode = nextNode.nextSibling; + $node.merge(nextNode); + nextNode = followingNode; + } + } + curNode = nextNode; + } + return this; + }; + + Wrapper.prototype.on = function(eventName, listener) { + this.node.addEventListener(eventName, (function(_this) { + return function(event) { + var arg, propagate; + arg = lastKeyEvent && (eventName === 'keydown' || eventName === 'keyup') ? lastKeyEvent : event; + propagate = listener.call(_this.node, arg); + if (!propagate) { + event.preventDefault(); + event.stopPropagation(); + } + return propagate; + }; + })(this)); + return this; + }; + + Wrapper.prototype.remove = function() { + var _ref; + if ((_ref = this.node.parentNode) != null) { + _ref.removeChild(this.node); + } + this.node = null; + return null; + }; + + Wrapper.prototype.removeClass = function(cssClass) { + var classArray; + if (!this.hasClass(cssClass)) { + return; + } + if (this.node.classList != null) { + return this.node.classList.remove(cssClass); + } else if (this.node.className != null) { + classArray = this.classes(); + classArray.splice(_.indexOf(classArray, cssClass), 1); + this.node.className = classArray.join(' '); + } + return this; + }; + + Wrapper.prototype.replace = function(newNode) { + this.node.parentNode.replaceChild(newNode, this.node); + this.node = newNode; + return newNode; + }; + + Wrapper.prototype.splitAncestors = function(root, force) { + var nextNode, parentClone, parentNode, refNode; + if (force == null) { + force = false; + } + if (this.node === root || this.node.parentNode === root) { + return this; + } + if ((this.node.previousSibling != null) || force) { + parentNode = this.node.parentNode; + parentClone = parentNode.cloneNode(false); + parentNode.parentNode.insertBefore(parentClone, parentNode.nextSibling); + refNode = this.node; + while (refNode != null) { + nextNode = refNode.nextSibling; + parentClone.appendChild(refNode); + refNode = nextNode; + } + return dom(parentClone).splitAncestors(root); + } else { + return dom(this.node.parentNode).splitAncestors(root); + } + }; + + Wrapper.prototype.split = function(offset, force) { + var after, child, childLeft, childRight, left, nextRight, nodeLength, right, _ref, _ref1; + if (force == null) { + force = false; + } + nodeLength = this.length(); + offset = Math.max(0, offset); + offset = Math.min(offset, nodeLength); + if (!(force || offset !== 0)) { + return [this.node.previousSibling, this.node, false]; + } + if (!(force || offset !== nodeLength)) { + return [this.node, this.node.nextSibling, false]; + } + if (this.node.nodeType === dom.TEXT_NODE) { + after = this.node.splitText(offset); + return [this.node, after, true]; + } else { + left = this.node; + right = this.node.cloneNode(false); + this.node.parentNode.insertBefore(right, left.nextSibling); + _ref = this.child(offset), child = _ref[0], offset = _ref[1]; + _ref1 = dom(child).split(offset), childLeft = _ref1[0], childRight = _ref1[1]; + while (childRight !== null) { + nextRight = childRight.nextSibling; + right.appendChild(childRight); + childRight = nextRight; + } + return [left, right, true]; + } + }; + + Wrapper.prototype.styles = function(styles, overwrite) { + var obj, styleString; + if (overwrite == null) { + overwrite = false; + } + if (styles) { + if (!overwrite) { + styles = _.defaults(styles, this.styles()); + } + styleString = _.map(styles, function(style, name) { + return "" + name + ": " + style; + }).join('; ') + ';'; + this.node.setAttribute('style', styleString); + return this; + } else { + styleString = this.node.getAttribute('style') || ''; + obj = _.reduce(styleString.split(';'), function(styles, str) { + var name, value, _ref; + _ref = str.split(':'), name = _ref[0], value = _ref[1]; + if (name && value) { + name = name.trim(); + value = value.trim(); + styles[name.toLowerCase()] = value; + } + return styles; + }, {}); + return obj; + } + }; + + Wrapper.prototype.switchTag = function(newTag) { + var attributes, newNode; + newTag = newTag.toUpperCase(); + if (this.node.tagName === newTag) { + return this; + } + newNode = this.node.ownerDocument.createElement(newTag); + attributes = this.attributes(); + if (dom.VOID_TAGS[newTag] == null) { + this.moveChildren(newNode); + } + this.replace(newNode); + return this.attributes(attributes).get(); + }; + + Wrapper.prototype.text = function(text) { + if (text != null) { + switch (this.node.nodeType) { + case dom.ELEMENT_NODE: + this.node.textContent = text; + break; + case dom.TEXT_NODE: + this.node.data = text; + } + return this; + } else { + switch (this.node.nodeType) { + case dom.ELEMENT_NODE: + if (this.node.tagName === dom.DEFAULT_BREAK_TAG) { + return ""; + } + if (dom.EMBED_TAGS[this.node.tagName] != null) { + return dom.EMBED_TEXT; + } + if (this.node.textContent != null) { + return this.node.textContent; + } + return ""; + case dom.TEXT_NODE: + return this.node.data || ""; + default: + return ""; + } + } + }; + + Wrapper.prototype.textNodes = function() { + var textNode, textNodes, walker; + walker = this.node.ownerDocument.createTreeWalker(this.node, NodeFilter.SHOW_TEXT, null, false); + textNodes = []; + while (textNode = walker.nextNode()) { + textNodes.push(textNode); + } + return textNodes; + }; + + Wrapper.prototype.toggleClass = function(className, state) { + if (state == null) { + state = !this.hasClass(className); + } + if (state) { + this.addClass(className); + } else { + this.removeClass(className); + } + return this; + }; + + Wrapper.prototype.trigger = function(eventName, options) { + var event, initFn, modifiers; + if (options == null) { + options = {}; + } + if (_.indexOf(['keypress', 'keydown', 'keyup'], eventName) < 0) { + event = this.node.ownerDocument.createEvent('Event'); + event.initEvent(eventName, options.bubbles, options.cancelable); + } else { + event = this.node.ownerDocument.createEvent('KeyboardEvent'); + lastKeyEvent = _.clone(options); + if (_.isNumber(options.key)) { + lastKeyEvent.which = options.key; + } else if (_.isString(options.key)) { + lastKeyEvent.which = options.key.toUpperCase().charCodeAt(0); + } else { + lastKeyEvent.which = 0; + } + if (dom.isIE(10)) { + modifiers = []; + if (options.altKey) { + modifiers.push('Alt'); + } + if (options.ctrlKey) { + modifiers.push('Control'); + } + if (options.metaKey) { + modifiers.push('Meta'); + } + if (options.shiftKey) { + modifiers.push('Shift'); + } + event.initKeyboardEvent(eventName, options.bubbles, options.cancelable, this.window(), 0, 0, modifiers.join(' '), null, null); + } else { + initFn = _.isFunction(event.initKeyboardEvent) ? 'initKeyboardEvent' : 'initKeyEvent'; + event[initFn](eventName, options.bubbles, options.cancelable, this.window(), options.ctrlKey, options.altKey, options.shiftKey, options.metaKey, 0, 0); + } + } + this.node.dispatchEvent(event); + lastKeyEvent = null; + return this; + }; + + Wrapper.prototype.unwrap = function() { + var next, ret; + ret = this.node.firstChild; + next = this.node.nextSibling; + _.each(this.childNodes(), (function(_this) { + return function(child) { + return _this.node.parentNode.insertBefore(child, next); + }; + })(this)); + this.remove(); + return ret; + }; + + Wrapper.prototype.window = function() { + return this.node.ownerDocument.defaultView || this.node.ownerDocument.parentWindow; + }; + + Wrapper.prototype.wrap = function(wrapper) { + var parent; + if (this.node.parentNode != null) { + this.node.parentNode.insertBefore(wrapper, this.node); + } + parent = wrapper; + while (parent.firstChild != null) { + parent = wrapper.firstChild; + } + parent.appendChild(this.node); + return this; + }; + + return Wrapper; + +})(); + +SelectWrapper = (function(_super) { + __extends(SelectWrapper, _super); + + function SelectWrapper() { + return SelectWrapper.__super__.constructor.apply(this, arguments); + } + + SelectWrapper.prototype["default"] = function() { + return this.node.querySelector('option[selected]'); + }; + + SelectWrapper.prototype.option = function(option, trigger) { + var child, i, value, _i, _len, _ref; + if (trigger == null) { + trigger = true; + } + value = _.isElement(option) ? option.value : option; + if (value) { + value = value.replace(/[^\w]+/g, ''); + _ref = this.node.children; + for (i = _i = 0, _len = _ref.length; _i < _len; i = ++_i) { + child = _ref[i]; + if (child.value.replace(/[^\w]+/g, '') === value) { + this.node.selectedIndex = i; + break; + } + } + } else { + this.node.selectedIndex = -1; + } + if (trigger) { + this.trigger('change'); + } + return this; + }; + + SelectWrapper.prototype.reset = function(trigger) { + var option; + if (trigger == null) { + trigger = true; + } + option = this["default"](); + if (option != null) { + option.selected = true; + } else { + this.node.selectedIndex = 0; + } + if (trigger) { + this.trigger('change'); + } + return this; + }; + + SelectWrapper.prototype.value = function() { + if (this.node.selectedIndex > -1) { + return this.node.options[this.node.selectedIndex].value; + } else { + return ''; + } + }; + + return SelectWrapper; + +})(Wrapper); + +dom = function(node) { + if ((node != null ? node.tagName : void 0) === 'SELECT') { + return new SelectWrapper(node); + } else { + return new Wrapper(node); + } +}; + +dom = _.extend(dom, { + ELEMENT_NODE: 1, + NOBREAK_SPACE: " ", + TEXT_NODE: 3, + ZERO_WIDTH_NOBREAK_SPACE: "\uFEFF", + DEFAULT_BLOCK_TAG: 'DIV', + DEFAULT_BREAK_TAG: 'BR', + DEFAULT_INLINE_TAG: 'SPAN', + EMBED_TEXT: '!', + FONT_SIZES: { + '10px': 1, + '13px': 2, + '16px': 3, + '18px': 4, + '24px': 5, + '32px': 6, + '48px': 7 + }, + KEYS: { + BACKSPACE: 8, + TAB: 9, + ENTER: 13, + ESCAPE: 27, + LEFT: 37, + UP: 38, + RIGHT: 39, + DOWN: 40, + DELETE: 46 + }, + BLOCK_TAGS: { + 'ADDRESS': 'ADDRESS', + 'ARTICLE': 'ARTICLE', + 'ASIDE': 'ASIDE', + 'AUDIO': 'AUDIO', + 'BLOCKQUOTE': 'BLOCKQUOTE', + 'CANVAS': 'CANVAS', + 'DD': 'DD', + 'DIV': 'DIV', + 'DL': 'DL', + 'FIGCAPTION': 'FIGCAPTION', + 'FIGURE': 'FIGURE', + 'FOOTER': 'FOOTER', + 'FORM': 'FORM', + 'H1': 'H1', + 'H2': 'H2', + 'H3': 'H3', + 'H4': 'H4', + 'H5': 'H5', + 'H6': 'H6', + 'HEADER': 'HEADER', + 'HGROUP': 'HGROUP', + 'LI': 'LI', + 'OL': 'OL', + 'OUTPUT': 'OUTPUT', + 'P': 'P', + 'PRE': 'PRE', + 'SECTION': 'SECTION', + 'TABLE': 'TABLE', + 'TBODY': 'TBODY', + 'TD': 'TD', + 'TFOOT': 'TFOOT', + 'TH': 'TH', + 'THEAD': 'THEAD', + 'TR': 'TR', + 'UL': 'UL', + 'VIDEO': 'VIDEO' + }, + EMBED_TAGS: { + 'IMG': 'IMG' + }, + LINE_TAGS: { + 'DIV': 'DIV', + 'LI': 'LI' + }, + LIST_TAGS: { + 'OL': 'OL', + 'UL': 'UL' + }, + VOID_TAGS: { + 'AREA': 'AREA', + 'BASE': 'BASE', + 'BR': 'BR', + 'COL': 'COL', + 'COMMAND': 'COMMAND', + 'EMBED': 'EMBED', + 'HR': 'HR', + 'IMG': 'IMG', + 'INPUT': 'INPUT', + 'KEYGEN': 'KEYGEN', + 'LINK': 'LINK', + 'META': 'META', + 'PARAM': 'PARAM', + 'SOURCE': 'SOURCE', + 'TRACK': 'TRACK', + 'WBR': 'WBR' + }, + convertFontSize: function(size) { + var i, s, sources, targets; + if (_.isString(size) && size.indexOf('px') > -1) { + sources = _.keys(dom.FONT_SIZES); + targets = _.values(dom.FONT_SIZES); + } else { + targets = _.keys(dom.FONT_SIZES); + sources = _.values(dom.FONT_SIZES); + } + for (i in sources) { + s = sources[i]; + if (parseInt(size) <= parseInt(s)) { + return targets[i]; + } + } + return _.last(targets); + }, + isIE: function(maxVersion) { + var version; + version = document.documentMode; + return version && maxVersion >= version; + }, + isIOS: function() { + return /iPhone|iPad/i.test(navigator.userAgent); + }, + isMac: function() { + return /Mac/i.test(navigator.platform); + } +}); + +module.exports = dom; + + + +},{"lodash":"M4+//f"}],22:[function(_dereq_,module,exports){ +var LinkedList, Node; + +Node = (function() { + function Node(data) { + this.data = data; + this.prev = this.next = null; + } + + return Node; + +})(); + +LinkedList = (function() { + LinkedList.Node = Node; + + function LinkedList() { + this.length = 0; + this.first = this.last = null; + } + + LinkedList.prototype.append = function(node) { + if (this.first != null) { + node.next = null; + this.last.next = node; + } else { + this.first = node; + } + node.prev = this.last; + this.last = node; + return this.length += 1; + }; + + LinkedList.prototype.insertAfter = function(refNode, newNode) { + newNode.prev = refNode; + if (refNode != null) { + newNode.next = refNode.next; + if (refNode.next != null) { + refNode.next.prev = newNode; + } + refNode.next = newNode; + if (refNode === this.last) { + this.last = newNode; + } + } else { + newNode.next = this.first; + this.first.prev = newNode; + this.first = newNode; + } + return this.length += 1; + }; + + LinkedList.prototype.remove = function(node) { + if (this.length > 1) { + if (node.prev != null) { + node.prev.next = node.next; + } + if (node.next != null) { + node.next.prev = node.prev; + } + if (node === this.first) { + this.first = node.next; + } + if (node === this.last) { + this.last = node.prev; + } + } else { + this.first = this.last = null; + } + node.prev = node.next = null; + return this.length -= 1; + }; + + LinkedList.prototype.toArray = function() { + var arr, cur; + arr = []; + cur = this.first; + while (cur != null) { + arr.push(cur); + cur = cur.next; + } + return arr; + }; + + return LinkedList; + +})(); + +module.exports = LinkedList; + + + +},{}],23:[function(_dereq_,module,exports){ +var Normalizer, dom, _; + +_ = _dereq_('lodash'); + +dom = _dereq_('./dom'); + +Normalizer = { + ALIASES: { + 'STRONG': 'B', + 'EM': 'I', + 'DEL': 'S', + 'STRIKE': 'S' + }, + ATTRIBUTES: { + 'color': 'color', + 'face': 'fontFamily', + 'size': 'fontSize' + }, + STYLES: { + 'background-color': 'background-color', + 'color': 'color', + 'font-family': 'font-family', + 'font-size': 'font-size', + 'text-align': 'text-align' + }, + TAGS: { + 'DIV': 'DIV', + 'BR': 'BR', + 'SPAN': 'SPAN', + 'B': 'B', + 'I': 'I', + 'S': 'S', + 'U': 'U', + 'A': 'A', + 'IMG': 'IMG', + 'OL': 'OL', + 'UL': 'UL', + 'LI': 'LI' + }, + handleBreaks: function(lineNode) { + var breaks; + breaks = _.map(lineNode.querySelectorAll(dom.DEFAULT_BREAK_TAG)); + _.each(breaks, (function(_this) { + return function(br) { + if ((br.nextSibling != null) && (!dom.isIE(10) || (br.previousSibling != null))) { + return dom(br.nextSibling).splitAncestors(lineNode.parentNode); + } + }; + })(this)); + return lineNode; + }, + normalizeLine: function(lineNode) { + lineNode = Normalizer.wrapInline(lineNode); + lineNode = Normalizer.handleBreaks(lineNode); + lineNode = Normalizer.pullBlocks(lineNode); + lineNode = Normalizer.normalizeNode(lineNode); + Normalizer.unwrapText(lineNode); + if ((lineNode != null) && (dom.LIST_TAGS[lineNode.tagName] != null)) { + lineNode = lineNode.firstChild; + } + return lineNode; + }, + normalizeNode: function(node) { + if (dom(node).isTextNode()) { + return node; + } + _.each(Normalizer.ATTRIBUTES, function(style, attribute) { + var value; + if (node.hasAttribute(attribute)) { + value = node.getAttribute(attribute); + if (attribute === 'size') { + value = dom.convertFontSize(value); + } + node.style[style] = value; + return node.removeAttribute(attribute); + } + }); + Normalizer.whitelistStyles(node); + return Normalizer.whitelistTags(node); + }, + optimizeLine: function(lineNode) { + var lineNodeLength, node, nodes, _results; + lineNodeLength = dom(lineNode).length(); + nodes = dom(lineNode).descendants(); + _results = []; + while (nodes.length > 0) { + node = nodes.pop(); + if ((node != null ? node.parentNode : void 0) == null) { + continue; + } + if (dom.EMBED_TAGS[node.tagName] != null) { + continue; + } + if (node.tagName === dom.DEFAULT_BREAK_TAG) { + if (lineNodeLength !== 0) { + _results.push(dom(node).remove()); + } else { + _results.push(void 0); + } + } else if (dom(node).length() === 0) { + nodes.push(node.nextSibling); + _results.push(dom(node).unwrap()); + } else if ((node.previousSibling != null) && node.tagName === node.previousSibling.tagName) { + if (_.isEqual(dom(node).attributes(), dom(node.previousSibling).attributes())) { + nodes.push(node.firstChild); + _results.push(dom(node.previousSibling).merge(node)); + } else { + _results.push(void 0); + } + } else { + _results.push(void 0); + } + } + return _results; + }, + pullBlocks: function(lineNode) { + var curNode; + curNode = lineNode.firstChild; + while (curNode != null) { + if ((dom.BLOCK_TAGS[curNode.tagName] != null) && curNode.tagName !== 'LI') { + if (curNode.previousSibling != null) { + dom(curNode).splitAncestors(lineNode.parentNode); + } + if (curNode.nextSibling != null) { + dom(curNode.nextSibling).splitAncestors(lineNode.parentNode); + } + if ((dom.LIST_TAGS[curNode.tagName] == null) || !curNode.firstChild) { + dom(curNode).unwrap(); + Normalizer.pullBlocks(lineNode); + } else { + dom(curNode.parentNode).unwrap(); + if (lineNode.parentNode == null) { + lineNode = curNode; + } + } + break; + } + curNode = curNode.nextSibling; + } + return lineNode; + }, + stripComments: function(html) { + return html.replace(//g, ''); + }, + stripWhitespace: function(html) { + html = html.replace(/^\s+/, '').replace(/\s+$/, ''); + html = html.replace(/^\s+/, '').replace(/\s+$/, ''); + html = html.replace(/(\r?\n|\r)+/g, ' '); + html = html.replace(/\>\s+\<'); + return html; + }, + whitelistStyles: function(node) { + var original, styles; + original = dom(node).styles(); + styles = _.omit(original, function(value, key) { + return Normalizer.STYLES[key] == null; + }); + if (_.keys(styles).length < _.keys(original).length) { + if (_.keys(styles).length > 0) { + return dom(node).styles(styles, true); + } else { + return node.removeAttribute('style'); + } + } + }, + whitelistTags: function(node) { + if (!dom(node).isElement()) { + return node; + } + if (Normalizer.ALIASES[node.tagName] != null) { + node = dom(node).switchTag(Normalizer.ALIASES[node.tagName]); + } else if (Normalizer.TAGS[node.tagName] == null) { + if (dom.BLOCK_TAGS[node.tagName] != null) { + node = dom(node).switchTag(dom.DEFAULT_BLOCK_TAG); + } else if (!node.hasAttributes() && (node.firstChild != null)) { + node = dom(node).unwrap(); + } else { + node = dom(node).switchTag(dom.DEFAULT_INLINE_TAG); + } + } + return node; + }, + wrapInline: function(lineNode) { + var blockNode, nextNode; + if (dom.BLOCK_TAGS[lineNode.tagName] != null) { + return lineNode; + } + blockNode = lineNode.ownerDocument.createElement(dom.DEFAULT_BLOCK_TAG); + lineNode.parentNode.insertBefore(blockNode, lineNode); + while ((lineNode != null) && (dom.BLOCK_TAGS[lineNode.tagName] == null)) { + nextNode = lineNode.nextSibling; + blockNode.appendChild(lineNode); + lineNode = nextNode; + } + return blockNode; + }, + unwrapText: function(lineNode) { + var spans; + spans = _.map(lineNode.querySelectorAll(dom.DEFAULT_INLINE_TAG)); + return _.each(spans, function(span) { + if (!span.hasAttributes()) { + return dom(span).unwrap(); + } + }); + } +}; + +module.exports = Normalizer; + + + +},{"./dom":21,"lodash":"M4+//f"}],24:[function(_dereq_,module,exports){ +var Normalizer, Picker, dom, _; + +_ = _dereq_('lodash'); + +dom = _dereq_('./dom'); + +Normalizer = _dereq_('./normalizer'); + +Picker = (function() { + Picker.TEMPLATE = ''; + + function Picker(select) { + this.select = select; + this.container = this.select.ownerDocument.createElement('span'); + this.buildPicker(); + dom(this.container).addClass('ql-picker'); + this.select.style.display = 'none'; + this.select.parentNode.insertBefore(this.container, this.select); + dom(this.select.ownerDocument).on('click', (function(_this) { + return function() { + _this.close(); + return true; + }; + })(this)); + dom(this.label).on('click', (function(_this) { + return function() { + _.defer(function() { + return dom(_this.container).toggleClass('ql-expanded'); + }); + return false; + }; + })(this)); + dom(this.select).on('change', (function(_this) { + return function() { + var item, option; + if (_this.select.selectedIndex > -1) { + item = _this.container.querySelectorAll('.ql-picker-item')[_this.select.selectedIndex]; + option = _this.select.options[_this.select.selectedIndex]; + } + _this.selectItem(item, false); + return dom(_this.label).toggleClass('ql-active', option !== dom(_this.select)["default"]()); + }; + })(this)); + } + + Picker.prototype.buildItem = function(picker, option, index) { + var item; + item = this.select.ownerDocument.createElement('span'); + item.setAttribute('data-value', option.getAttribute('value')); + dom(item).addClass('ql-picker-item').text(dom(option).text()).on('click', (function(_this) { + return function() { + _this.selectItem(item, true); + return _this.close(); + }; + })(this)); + if (this.select.selectedIndex === index) { + this.selectItem(item, false); + } + return item; + }; + + Picker.prototype.buildPicker = function() { + var picker; + _.each(dom(this.select).attributes(), (function(_this) { + return function(value, name) { + return _this.container.setAttribute(name, value); + }; + })(this)); + this.container.innerHTML = Normalizer.stripWhitespace(Picker.TEMPLATE); + this.label = this.container.querySelector('.ql-picker-label'); + picker = this.container.querySelector('.ql-picker-options'); + return _.each(this.select.options, (function(_this) { + return function(option, i) { + var item; + item = _this.buildItem(picker, option, i); + return picker.appendChild(item); + }; + })(this)); + }; + + Picker.prototype.close = function() { + return dom(this.container).removeClass('ql-expanded'); + }; + + Picker.prototype.selectItem = function(item, trigger) { + var selected, value; + selected = this.container.querySelector('.ql-selected'); + if (selected != null) { + dom(selected).removeClass('ql-selected'); + } + if (item != null) { + value = item.getAttribute('data-value'); + dom(item).addClass('ql-selected'); + dom(this.label).text(dom(item).text()); + dom(this.select).option(value, trigger); + return this.label.setAttribute('data-value', value); + } else { + this.label.innerHTML = ' '; + return this.label.removeAttribute('data-value'); + } + }; + + return Picker; + +})(); + +module.exports = Picker; + + + +},{"./dom":21,"./normalizer":23,"lodash":"M4+//f"}],25:[function(_dereq_,module,exports){ +var Range, _; + +_ = _dereq_('lodash'); + +Range = (function() { + Range.compare = function(r1, r2) { + if (r1 === r2) { + return true; + } + if (!((r1 != null) && (r2 != null))) { + return false; + } + return r1.equals(r2); + }; + + function Range(start, end) { + this.start = start; + this.end = end; + } + + Range.prototype.equals = function(range) { + if (range == null) { + return false; + } + return this.start === range.start && this.end === range.end; + }; + + Range.prototype.shift = function(index, length) { + var _ref; + return _ref = _.map([this.start, this.end], function(pos) { + if (index > pos) { + return pos; + } + if (length >= 0) { + return pos + length; + } else { + return Math.max(index, pos + length); + } + }), this.start = _ref[0], this.end = _ref[1], _ref; + }; + + Range.prototype.isCollapsed = function() { + return this.start === this.end; + }; + + return Range; + +})(); + +module.exports = Range; + + + +},{"lodash":"M4+//f"}],26:[function(_dereq_,module,exports){ +var Authorship, Delta, Quill, dom, _; + +Quill = _dereq_('../quill'); + +_ = Quill.require('lodash'); + +dom = Quill.require('dom'); + +Delta = Quill.require('delta'); + +Authorship = (function() { + Authorship.DEFAULTS = { + authorId: null, + color: 'transparent', + enabled: false + }; + + function Authorship(quill, options) { + this.quill = quill; + this.options = options; + if (this.options.button != null) { + this.attachButton(this.options.button); + } + if (this.options.enabled) { + this.enable(); + } + this.quill.addFormat('author', { + "class": 'author-' + }); + if (this.options.authorId == null) { + return; + } + this.quill.on(this.quill.constructor.events.PRE_EVENT, (function(_this) { + return function(eventName, delta, origin) { + var authorDelta, authorFormat; + if (eventName === _this.quill.constructor.events.TEXT_CHANGE && origin === 'user') { + authorDelta = new Delta(); + authorFormat = { + author: _this.options.authorId + }; + _.each(delta.ops, function(op) { + if (op["delete"] != null) { + return; + } + if ((op.insert != null) || ((op.retain != null) && (op.attributes != null))) { + op.attributes || (op.attributes = {}); + op.attributes.author = _this.options.authorId; + return authorDelta.retain(op.retain || op.insert.length || 1, authorFormat); + } else { + return authorDelta.retain(op.retain); + } + }); + return _this.quill.updateContents(authorDelta, Quill.sources.SILENT); + } + }; + })(this)); + this.addAuthor(this.options.authorId, this.options.color); + } + + Authorship.prototype.addAuthor = function(id, color) { + var styles; + styles = {}; + styles[".authorship .author-" + id] = { + "background-color": "" + color + }; + return this.quill.addStyles(styles); + }; + + Authorship.prototype.attachButton = function(button) { + var $button; + $button = dom(button); + return $button.on('click', (function(_this) { + return function() { + $button.toggleClass('ql-on'); + return _this.enable($dom.hasClass('ql-on')); + }; + })(this)); + }; + + Authorship.prototype.enable = function(enabled) { + if (enabled == null) { + enabled = true; + } + return dom(this.quill.root).toggleClass('authorship', enabled); + }; + + Authorship.prototype.disable = function() { + return this.enable(false); + }; + + return Authorship; + +})(); + +Quill.registerModule('authorship', Authorship); + +module.exports = Authorship; + + + +},{"../quill":35}],27:[function(_dereq_,module,exports){ +var Delta, ImageTooltip, Quill, Tooltip, dom, _, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + +Quill = _dereq_('../quill'); + +Tooltip = _dereq_('./tooltip'); + +_ = Quill.require('lodash'); + +dom = Quill.require('dom'); + +Delta = Quill.require('delta'); + +ImageTooltip = (function(_super) { + __extends(ImageTooltip, _super); + + ImageTooltip.DEFAULTS = { + styles: { + '.image-tooltip-container': { + 'margin': '25px', + 'padding': '10px', + 'width': '300px' + }, + '.image-tooltip-container:after': { + 'clear': 'both', + 'content': '""', + 'display': 'table' + }, + '.image-tooltip-container .preview': { + 'margin': '10px 0px', + 'position': 'relative', + 'border': '1px dashed #000', + 'height': '200px' + }, + '.image-tooltip-container .preview span': { + 'display': 'inline-block', + 'position': 'absolute', + 'text-align': 'center', + 'top': '40%', + 'width': '100%' + }, + '.image-tooltip-container img': { + 'bottom': '0', + 'left': '0', + 'margin': 'auto', + 'max-height': '100%', + 'max-width': '100%', + 'position': 'absolute', + 'right': '0', + 'top': '0' + }, + '.image-tooltip-container .input': { + 'box-sizing': 'border-box', + 'width': '100%' + }, + '.image-tooltip-container a': { + 'border': '1px solid black', + 'box-sizing': 'border-box', + 'display': 'inline-block', + 'float': 'left', + 'padding': '5px', + 'text-align': 'center', + 'width': '50%' + } + }, + template: '
Preview
Cancel Insert' + }; + + function ImageTooltip(quill, options) { + this.quill = quill; + this.options = options; + this.options.styles = _.defaults(this.options.styles, Tooltip.DEFAULTS.styles); + this.options = _.defaults(this.options, Tooltip.DEFAULTS); + ImageTooltip.__super__.constructor.call(this, this.quill, this.options); + this.preview = this.container.querySelector('.preview'); + this.textbox = this.container.querySelector('.input'); + dom(this.container).addClass('image-tooltip-container'); + this.initListeners(); + } + + ImageTooltip.prototype.initListeners = function() { + dom(this.container.querySelector('.insert')).on('click', _.bind(this.insertImage, this)); + dom(this.container.querySelector('.cancel')).on('click', _.bind(this.hide, this)); + dom(this.textbox).on('input', _.bind(this._preview, this)); + this.initTextbox(this.textbox, this.insertImage, this.hide); + return this.quill.onModuleLoad('toolbar', (function(_this) { + return function(toolbar) { + return toolbar.initFormat('image', _.bind(_this._onToolbar, _this)); + }; + })(this)); + }; + + ImageTooltip.prototype.insertImage = function() { + var index, url; + url = this._normalizeURL(this.textbox.value); + if (this.range == null) { + this.range = new Range(0, 0); + } + if (this.range) { + this.preview.innerHTML = 'Preview'; + this.textbox.value = ''; + index = this.range.end; + this.quill.insertEmbed(index, 'image', url, 'user'); + this.quill.setSelection(index + 1, index + 1); + } + return this.hide(); + }; + + ImageTooltip.prototype._onToolbar = function(range, value) { + if (value) { + if (!this.textbox.value) { + this.textbox.value = 'http://'; + } + this.show(); + this.textbox.focus(); + return _.defer((function(_this) { + return function() { + return _this.textbox.setSelectionRange(_this.textbox.value.length, _this.textbox.value.length); + }; + })(this)); + } else { + return this.quill.deleteText(range, 'user'); + } + }; + + ImageTooltip.prototype._preview = function() { + var img; + if (!this._matchImageURL(this.textbox.value)) { + return; + } + if (this.preview.firstChild.tagName === 'IMG') { + return this.preview.firstChild.setAttribute('src', this.textbox.value); + } else { + img = this.preview.ownerDocument.createElement('img'); + img.setAttribute('src', this.textbox.value); + return this.preview.replaceChild(img, this.preview.firstChild); + } + }; + + ImageTooltip.prototype._matchImageURL = function(url) { + return /^https?:\/\/.+\.(jp?g|gif|png)$/.test(url); + }; + + ImageTooltip.prototype._normalizeURL = function(url) { + if (!/^https?:\/\//.test(url)) { + url = 'http://' + url; + } + return url; + }; + + return ImageTooltip; + +})(Tooltip); + +Quill.registerModule('image-tooltip', ImageTooltip); + +module.exports = ImageTooltip; + + + +},{"../quill":35,"./tooltip":33}],28:[function(_dereq_,module,exports){ +var Delta, Keyboard, Quill, dom, _; + +Quill = _dereq_('../quill'); + +_ = Quill.require('lodash'); + +dom = Quill.require('dom'); + +Delta = Quill.require('delta'); + +Keyboard = (function() { + Keyboard.hotkeys = { + BOLD: { + key: 'B', + metaKey: true + }, + INDENT: { + key: dom.KEYS.TAB + }, + ITALIC: { + key: 'I', + metaKey: true + }, + OUTDENT: { + key: dom.KEYS.TAB, + shiftKey: true + }, + UNDERLINE: { + key: 'U', + metaKey: true + } + }; + + function Keyboard(quill, options) { + this.quill = quill; + this.hotkeys = {}; + this._initListeners(); + this._initHotkeys(); + this._initDeletes(); + } + + Keyboard.prototype.addHotkey = function(hotkeys, callback) { + if (!_.isArray(hotkeys)) { + hotkeys = [hotkeys]; + } + return _.each(hotkeys, (function(_this) { + return function(hotkey) { + var which, _base; + hotkey = _.isObject(hotkey) ? _.clone(hotkey) : { + key: hotkey + }; + hotkey.callback = callback; + which = _.isNumber(hotkey.key) ? hotkey.key : hotkey.key.toUpperCase().charCodeAt(0); + if ((_base = _this.hotkeys)[which] == null) { + _base[which] = []; + } + return _this.hotkeys[which].push(hotkey); + }; + })(this)); + }; + + Keyboard.prototype.toggleFormat = function(range, format) { + var delta, toolbar, value; + if (range.isCollapsed()) { + delta = this.quill.getContents(Math.max(0, range.start - 1), range.end); + } else { + delta = this.quill.getContents(range); + } + value = delta.ops.length === 0 || !_.all(delta.ops, function(op) { + var _ref; + return (_ref = op.attributes) != null ? _ref[format] : void 0; + }); + if (range.isCollapsed()) { + this.quill.prepareFormat(format, value); + } else { + this.quill.formatText(range, format, value, 'user'); + } + toolbar = this.quill.getModule('toolbar'); + if (toolbar != null) { + return toolbar.setActive(format, value); + } + }; + + Keyboard.prototype._initDeletes = function() { + return this.addHotkey([dom.KEYS.DELETE, dom.KEYS.BACKSPACE], (function(_this) { + return function() { + return _this.quill.getLength() > 1; + }; + })(this)); + }; + + Keyboard.prototype._initHotkeys = function() { + this.addHotkey(Keyboard.hotkeys.INDENT, (function(_this) { + return function(range) { + _this._onTab(range, false); + return false; + }; + })(this)); + this.addHotkey(Keyboard.hotkeys.OUTDENT, (function(_this) { + return function(range) { + return false; + }; + })(this)); + return _.each(['bold', 'italic', 'underline'], (function(_this) { + return function(format) { + return _this.addHotkey(Keyboard.hotkeys[format.toUpperCase()], function(range) { + _this.toggleFormat(range, format); + return false; + }); + }; + })(this)); + }; + + Keyboard.prototype._initListeners = function() { + return dom(this.quill.root).on('keydown', (function(_this) { + return function(event) { + var prevent; + prevent = false; + _.each(_this.hotkeys[event.which], function(hotkey) { + var metaKey; + metaKey = dom.isMac() ? event.metaKey : event.metaKey || event.ctrlKey; + if (!!hotkey.metaKey !== !!metaKey) { + return; + } + if (!!hotkey.shiftKey !== !!event.shiftKey) { + return; + } + if (!!hotkey.altKey !== !!event.altKey) { + return; + } + prevent = hotkey.callback(_this.quill.getSelection()) === false || prevent; + return true; + }); + return !prevent; + }; + })(this)); + }; + + Keyboard.prototype._onTab = function(range, shift) { + var delta; + if (shift == null) { + shift = false; + } + delta = new Delta().retain(range.start).insert("\t")["delete"](range.end - range.start).retain(this.quill.getLength() - range.end); + this.quill.updateContents(delta); + return this.quill.setSelection(range.start + 1, range.start + 1); + }; + + return Keyboard; + +})(); + +Quill.registerModule('keyboard', Keyboard); + +module.exports = Keyboard; + + + +},{"../quill":35}],29:[function(_dereq_,module,exports){ +var LinkTooltip, Quill, Tooltip, dom, _, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + +Quill = _dereq_('../quill'); + +Tooltip = _dereq_('./tooltip'); + +_ = Quill.require('lodash'); + +dom = Quill.require('dom'); + +LinkTooltip = (function(_super) { + __extends(LinkTooltip, _super); + + LinkTooltip.DEFAULTS = { + maxLength: 50, + styles: { + '.link-tooltip-container': { + 'padding': '5px 10px' + }, + '.link-tooltip-container input.input': { + 'width': '170px' + }, + '.link-tooltip-container input.input, .link-tooltip-container a.done, .link-tooltip-container.editing a.url, .link-tooltip-container.editing a.change': { + 'display': 'none' + }, + '.link-tooltip-container.editing input.input, .link-tooltip-container.editing a.done': { + 'display': 'inline-block' + } + }, + template: 'Visit URL:   -  Change Done' + }; + + function LinkTooltip(quill, options) { + this.quill = quill; + this.options = options; + this.options.styles = _.defaults(this.options.styles, Tooltip.DEFAULTS.styles); + this.options = _.defaults(this.options, Tooltip.DEFAULTS); + LinkTooltip.__super__.constructor.call(this, this.quill, this.options); + dom(this.container).addClass('link-tooltip-container'); + this.textbox = this.container.querySelector('.input'); + this.link = this.container.querySelector('.url'); + this.initListeners(); + } + + LinkTooltip.prototype.initListeners = function() { + this.quill.on(this.quill.constructor.events.SELECTION_CHANGE, (function(_this) { + return function(range) { + var anchor; + if (!((range != null) && range.isCollapsed())) { + return; + } + anchor = _this._findAnchor(range); + if (anchor) { + _this.setMode(anchor.href, false); + return _this.show(anchor); + } else { + _this.range = null; + return _this.hide(); + } + }; + })(this)); + dom(this.container.querySelector('.done')).on('click', _.bind(this.saveLink, this)); + dom(this.container.querySelector('.change')).on('click', (function(_this) { + return function() { + return _this.setMode(_this.link.href, true); + }; + })(this)); + this.initTextbox(this.textbox, this.saveLink, this.hide); + return this.quill.onModuleLoad('toolbar', (function(_this) { + return function(toolbar) { + return toolbar.initFormat('link', _.bind(_this._onToolbar, _this)); + }; + })(this)); + }; + + LinkTooltip.prototype.saveLink = function() { + var anchor, url; + url = this._normalizeURL(this.textbox.value); + if (this.range != null) { + if (this.range.isCollapsed()) { + anchor = this._findAnchor(this.range); + if (anchor != null) { + anchor.href = url; + } + } else { + this.quill.formatText(this.range, 'link', url, 'user'); + } + } + return this.setMode(url, false); + }; + + LinkTooltip.prototype.setMode = function(url, edit) { + var text; + if (edit == null) { + edit = false; + } + if (edit) { + this.textbox.value = url; + _.defer((function(_this) { + return function() { + _this.textbox.focus(); + return _this.textbox.setSelectionRange(url.length, url.length); + }; + })(this)); + } else { + this.link.href = url; + text = url.length > this.options.maxLength ? url.slice(0, this.options.maxLength) + '...' : url; + dom(this.link).text(text); + } + return dom(this.container).toggleClass('editing', edit); + }; + + LinkTooltip.prototype._findAnchor = function(range) { + var leaf, node, offset, _ref; + _ref = this.quill.editor.doc.findLeafAt(range.start, true), leaf = _ref[0], offset = _ref[1]; + if (leaf != null) { + node = leaf.node; + } + while (node != null) { + if (node.tagName === 'A') { + return node; + } + node = node.parentNode; + } + return null; + }; + + LinkTooltip.prototype._onToolbar = function(range, value) { + var nativeRange; + if (!(range && !range.isCollapsed())) { + return; + } + if (value) { + this.setMode(this._suggestURL(range), true); + nativeRange = this.quill.editor.selection._getNativeRange(); + return this.show(nativeRange); + } else { + return this.quill.formatText(range, 'link', false, 'user'); + } + }; + + LinkTooltip.prototype._normalizeURL = function(url) { + if (!/^(https?:\/\/|mailto:)/.test(url)) { + url = 'http://' + url; + } + return url; + }; + + LinkTooltip.prototype._suggestURL = function(range) { + var text; + text = this.quill.getText(range); + return this._normalizeURL(text); + }; + + return LinkTooltip; + +})(Tooltip); + +Quill.registerModule('link-tooltip', LinkTooltip); + +module.exports = LinkTooltip; + + + +},{"../quill":35,"./tooltip":33}],30:[function(_dereq_,module,exports){ +var EventEmitter2, MultiCursor, Quill, dom, _, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + +Quill = _dereq_('../quill'); + +EventEmitter2 = _dereq_('eventemitter2').EventEmitter2; + +_ = Quill.require('lodash'); + +dom = Quill.require('dom'); + +MultiCursor = (function(_super) { + __extends(MultiCursor, _super); + + MultiCursor.DEFAULTS = { + template: ' ', + timeout: 2500 + }; + + MultiCursor.events = { + CURSOR_ADDED: 'cursor-addded', + CURSOR_MOVED: 'cursor-moved', + CURSOR_REMOVED: 'cursor-removed' + }; + + function MultiCursor(quill, options) { + this.quill = quill; + this.options = options; + this.cursors = {}; + this.container = this.quill.addContainer('cursor-container', true); + this.quill.addStyles({ + '.cursor-container': { + 'position': 'absolute', + 'left': '0', + 'top': '0', + 'z-index': '1000' + }, + '.cursor': { + 'margin-left': '-1px', + 'position': 'absolute' + }, + '.cursor-flag': { + 'bottom': '100%', + 'position': 'absolute', + 'white-space': 'nowrap' + }, + '.cursor-name': { + 'display': 'inline-block', + 'color': 'white', + 'padding': '2px 8px' + }, + '.cursor-caret': { + 'height': '100%', + 'position': 'absolute', + 'width': '2px' + }, + '.cursor.hidden .cursor-flag': { + 'display': 'none' + }, + '.cursor.top > .cursor-flag': { + 'bottom': 'auto', + 'top': '100%' + }, + '.cursor.right > .cursor-flag': { + 'right': '-2px' + } + }); + this.quill.on(this.quill.constructor.events.TEXT_CHANGE, _.bind(this._applyDelta, this)); + } + + MultiCursor.prototype.clearCursors = function() { + _.each(_.keys(this.cursors), _.bind(this.removeCursor, this)); + return this.cursors = {}; + }; + + MultiCursor.prototype.moveCursor = function(userId, index) { + var cursor; + cursor = this.cursors[userId]; + cursor.index = index; + dom(cursor.elem).removeClass('hidden'); + clearTimeout(cursor.timer); + cursor.timer = setTimeout((function(_this) { + return function() { + dom(cursor.elem).addClass('hidden'); + return cursor.timer = null; + }; + })(this), this.options.timeout); + this._updateCursor(cursor); + return cursor; + }; + + MultiCursor.prototype.removeCursor = function(userId) { + var cursor; + cursor = this.cursors[userId]; + this.emit(MultiCursor.events.CURSOR_REMOVED, cursor); + if (cursor != null) { + cursor.elem.parentNode.removeChild(cursor.elem); + } + return delete this.cursors[userId]; + }; + + MultiCursor.prototype.setCursor = function(userId, index, name, color) { + var cursor; + if (this.cursors[userId] == null) { + this.cursors[userId] = cursor = { + userId: userId, + index: index, + color: color, + elem: this._buildCursor(name, color) + }; + this.emit(MultiCursor.events.CURSOR_ADDED, cursor); + } + _.defer((function(_this) { + return function() { + return _this.moveCursor(userId, index); + }; + })(this)); + return this.cursors[userId]; + }; + + MultiCursor.prototype.shiftCursors = function(index, length, authorId) { + if (authorId == null) { + authorId = null; + } + return _.each(this.cursors, (function(_this) { + return function(cursor, id) { + if (!(cursor && (cursor.index > index || cursor.userId === authorId))) { + return; + } + return cursor.index += Math.max(length, index - cursor.index); + }; + })(this)); + }; + + MultiCursor.prototype.update = function() { + return _.each(this.cursors, (function(_this) { + return function(cursor, id) { + if (cursor == null) { + return; + } + _this._updateCursor(cursor); + return true; + }; + })(this)); + }; + + MultiCursor.prototype._applyDelta = function(delta) { + var index; + index = 0; + _.each(delta.ops, (function(_this) { + return function(op) { + var length, _ref; + length = 0; + if (op.insert != null) { + length = op.insert.length || 1; + _this.shiftCursors(index, length, (_ref = op.attributes) != null ? _ref['author'] : void 0); + } else if (op["delete"] != null) { + _this.shiftCursors(index, -1 * op["delete"], null); + } else if (op.retain != null) { + _this.shiftCursors(index, 0, null); + length = op.retain; + } + return index += length; + }; + })(this)); + return this.update(); + }; + + MultiCursor.prototype._buildCursor = function(name, color) { + var cursor, cursorCaret, cursorFlag, cursorName; + cursor = this.container.ownerDocument.createElement('span'); + dom(cursor).addClass('cursor'); + cursor.innerHTML = this.options.template; + cursorFlag = cursor.querySelector('.cursor-flag'); + cursorName = cursor.querySelector('.cursor-name'); + dom(cursorName).text(name); + cursorCaret = cursor.querySelector('.cursor-caret'); + cursorCaret.style.backgroundColor = cursorName.style.backgroundColor = color; + this.container.appendChild(cursor); + return cursor; + }; + + MultiCursor.prototype._moveCursor = function(cursor, reference, side) { + var bounds, flag, win; + if (side == null) { + side = 'left'; + } + win = dom(reference).window(); + bounds = reference.getBoundingClientRect(); + cursor.elem.style.top = bounds.top + win.pageYOffset + 'px'; + cursor.elem.style.left = bounds[side] + 'px'; + cursor.elem.style.height = bounds.height + 'px'; + flag = cursor.elem.querySelector('.cursor-flag'); + dom(cursor.elem).toggleClass('top', parseInt(cursor.elem.style.top) <= flag.offsetHeight).toggleClass('left', parseInt(cursor.elem.style.left) <= flag.offsetWidth).toggleClass('right', this.quill.root.offsetWidth - parseInt(cursor.elem.style.left) <= flag.offsetWidth); + return this.emit(MultiCursor.events.CURSOR_MOVED, cursor); + }; + + MultiCursor.prototype._updateCursor = function(cursor) { + var didSplit, guide, leaf, leftNode, offset, rightNode, _ref, _ref1; + this.quill.editor.checkUpdate(); + _ref = this.quill.editor.doc.findLeafAt(cursor.index, true), leaf = _ref[0], offset = _ref[1]; + guide = this.container.ownerDocument.createElement('span'); + if (leaf != null) { + _ref1 = dom(leaf.node).split(offset), leftNode = _ref1[0], rightNode = _ref1[1], didSplit = _ref1[2]; + dom(guide).text(dom.ZERO_WIDTH_NOBREAK_SPACE); + leaf.node.parentNode.insertBefore(guide, rightNode); + } else { + dom(guide).text(dom.NOBREAK_SPACE); + this.quill.root.appendChild(guide); + } + this._moveCursor(cursor, guide); + dom(guide).remove(); + if (didSplit) { + dom(leaf.node.parentNode).normalize(); + } + return this.quill.editor.selection.update(Quill.sources.SILENT); + }; + + return MultiCursor; + +})(EventEmitter2); + +Quill.registerModule('multi-cursor', MultiCursor); + +module.exports = MultiCursor; + + + +},{"../quill":35,"eventemitter2":3}],31:[function(_dereq_,module,exports){ +var Delta, Document, PasteManager, Quill, dom, _; + +Quill = _dereq_('../quill'); + +Document = _dereq_('../core/document'); + +_ = Quill.require('lodash'); + +dom = Quill.require('dom'); + +Delta = Quill.require('delta'); + +PasteManager = (function() { + function PasteManager(quill, options) { + this.quill = quill; + this.options = options; + this.container = this.quill.addContainer('paste-container'); + this.container.setAttribute('contenteditable', true); + this.quill.addStyles({ + '.paste-container': { + 'left': '-10000px', + 'position': 'absolute', + 'top': '50%' + } + }); + dom(this.quill.root).on('paste', _.bind(this._paste, this)); + } + + PasteManager.prototype._paste = function() { + var iframe, iframeScrollY, oldDocLength, range, windowScrollX, windowScrollY; + oldDocLength = this.quill.getLength(); + range = this.quill.getSelection(); + if (range == null) { + return; + } + this.container.innerHTML = ""; + iframe = dom(this.quill.root).window(); + iframeScrollY = iframe.scrollY; + windowScrollX = window.scrollX; + windowScrollY = window.scrollY; + this.container.focus(); + return _.defer((function(_this) { + return function() { + var delta, doc, lengthAdded, line, lineBottom, offset, _ref; + doc = new Document(_this.container, _this.quill.options); + delta = doc.toDelta(); + lengthAdded = delta.length() - 1; + delta.compose(new Delta().retain(lengthAdded)["delete"](1)); + if (range.start > 0) { + delta.ops.unshift({ + retain: range.start + }); + } + delta["delete"](range.end - range.start); + _this.quill.updateContents(delta, 'user'); + _this.quill.setSelection(range.start + lengthAdded, range.start + lengthAdded); + _ref = _this.quill.editor.doc.findLineAt(range.start + lengthAdded), line = _ref[0], offset = _ref[1]; + lineBottom = line.node.offsetTop + line.node.offsetHeight; + if (lineBottom > iframeScrollY + _this.quill.root.offsetHeight) { + iframeScrollY = line.node.offsetTop - _this.quill.root.offsetHeight / 2; + } + iframe.scrollTo(0, iframeScrollY); + return window.scrollTo(windowScrollX, windowScrollY); + }; + })(this)); + }; + + return PasteManager; + +})(); + +Quill.registerModule('paste-manager', PasteManager); + +module.exports = PasteManager; + + + +},{"../core/document":12,"../quill":35}],32:[function(_dereq_,module,exports){ +var Quill, Toolbar, dom, _; + +Quill = _dereq_('../quill'); + +_ = Quill.require('lodash'); + +dom = Quill.require('dom'); + +Toolbar = (function() { + Toolbar.DEFAULTS = { + container: null + }; + + Toolbar.formats = { + LINE: { + 'align': 'align', + 'bullet': 'bullet', + 'list': 'list' + }, + SELECT: { + 'align': 'align', + 'background': 'background', + 'color': 'color', + 'font': 'font', + 'size': 'size' + }, + TOGGLE: { + 'bold': 'bold', + 'bullet': 'bullet', + 'image': 'image', + 'italic': 'italic', + 'link': 'link', + 'list': 'list', + 'strike': 'strike', + 'underline': 'underline' + }, + TOOLTIP: { + 'image': 'image', + 'link': 'link' + } + }; + + function Toolbar(quill, options) { + this.quill = quill; + this.options = options; + if (this.options.container == null) { + throw new Error('container required for toolbar', this.options); + } + this.container = _.isString(this.options.container) ? document.querySelector(this.options.container) : this.options.container; + this.inputs = {}; + this.preventUpdate = false; + this.triggering = false; + _.each(this.quill.options.formats, (function(_this) { + return function(format) { + if (Toolbar.formats.TOOLTIP[format] != null) { + return; + } + return _this.initFormat(format, function(range, value) { + if (_this.triggering) { + return; + } + if (range.isCollapsed()) { + _this.quill.prepareFormat(format, value); + } else if (Toolbar.formats.LINE[format] != null) { + _this.quill.formatLine(range, format, value, 'user'); + } else { + _this.quill.formatText(range, format, value, 'user'); + } + return _.defer(function() { + _this.updateActive(range, ['bullet', 'list']); + return _this.setActive(format, value); + }); + }); + }; + })(this)); + this.quill.on(this.quill.constructor.events.SELECTION_CHANGE, (function(_this) { + return function(range) { + if (range != null) { + return _this.updateActive(range); + } + }; + })(this)); + this.quill.onModuleLoad('keyboard', (function(_this) { + return function(keyboard) { + return keyboard.addHotkey([dom.KEYS.BACKSPACE, dom.KEYS.DELETE, dom.KEYS.ENTER], function() { + return _.defer(_.bind(_this.updateActive, _this)); + }); + }; + })(this)); + dom(this.container).addClass('ql-toolbar-container'); + if (dom.isIOS()) { + dom(this.container).addClass('ios'); + } + if (dom.isIE(11)) { + dom(this.container).on('mousedown', (function(_this) { + return function() { + return false; + }; + })(this)); + } + } + + Toolbar.prototype.initFormat = function(format, callback) { + var eventName, input, selector; + selector = ".ql-" + format; + if (Toolbar.formats.SELECT[format] != null) { + selector = "select" + selector; + eventName = 'change'; + } else { + eventName = 'click'; + } + input = this.container.querySelector(selector); + if (input == null) { + return; + } + this.inputs[format] = input; + return dom(input).on(eventName, (function(_this) { + return function() { + var range, value; + value = eventName === 'change' ? dom(input).value() : !dom(input).hasClass('ql-active'); + _this.preventUpdate = true; + _this.quill.focus(); + range = _this.quill.getSelection(); + if (range != null) { + callback(range, value); + } + _this.preventUpdate = false; + return true; + }; + })(this)); + }; + + Toolbar.prototype.setActive = function(format, value) { + var $input, input, selectValue, _ref; + input = this.inputs[format]; + if (input == null) { + return; + } + $input = dom(input); + if (input.tagName === 'SELECT') { + this.triggering = true; + selectValue = $input.value(input); + if (value == null) { + value = (_ref = $input["default"]()) != null ? _ref.value : void 0; + } + if (_.isArray(value)) { + value = ''; + } + if (value !== selectValue) { + if (value != null) { + $input.option(value, false); + } else { + $input.reset(false); + } + } + return this.triggering = false; + } else { + return $input.toggleClass('ql-active', value || false); + } + }; + + Toolbar.prototype.updateActive = function(range, formats) { + var activeFormats; + if (formats == null) { + formats = null; + } + range || (range = this.quill.getSelection()); + if (!((range != null) && !this.preventUpdate)) { + return; + } + activeFormats = this._getActive(range); + return _.each(this.inputs, (function(_this) { + return function(input, format) { + if (!_.isArray(formats) || formats.indexOf(format) > -1) { + _this.setActive(format, activeFormats[format]); + } + return true; + }; + })(this)); + }; + + Toolbar.prototype._getActive = function(range) { + var leafFormats, lineFormats; + leafFormats = this._getLeafActive(range); + lineFormats = this._getLineActive(range); + return _.defaults({}, leafFormats, lineFormats); + }; + + Toolbar.prototype._getLeafActive = function(range) { + var contents, formatsArr, line, offset, _ref; + if (range.isCollapsed()) { + _ref = this.quill.editor.doc.findLineAt(range.start), line = _ref[0], offset = _ref[1]; + if (offset === 0) { + contents = this.quill.getContents(range.start, range.end + 1); + } else { + contents = this.quill.getContents(range.start - 1, range.end); + } + } else { + contents = this.quill.getContents(range); + } + formatsArr = _.map(contents.ops, 'attributes'); + return this._intersectFormats(formatsArr); + }; + + Toolbar.prototype._getLineActive = function(range) { + var firstLine, formatsArr, lastLine, offset, _ref, _ref1; + formatsArr = []; + _ref = this.quill.editor.doc.findLineAt(range.start), firstLine = _ref[0], offset = _ref[1]; + _ref1 = this.quill.editor.doc.findLineAt(range.end), lastLine = _ref1[0], offset = _ref1[1]; + if ((lastLine != null) && lastLine === firstLine) { + lastLine = lastLine.next; + } + while ((firstLine != null) && firstLine !== lastLine) { + formatsArr.push(_.clone(firstLine.formats)); + firstLine = firstLine.next; + } + return this._intersectFormats(formatsArr); + }; + + Toolbar.prototype._intersectFormats = function(formatsArr) { + return _.reduce(formatsArr.slice(1), function(activeFormats, formats) { + var activeKeys, added, formatKeys, intersection, missing; + activeKeys = _.keys(activeFormats); + formatKeys = _.keys(formats); + intersection = _.intersection(activeKeys, formatKeys); + missing = _.difference(activeKeys, formatKeys); + added = _.difference(formatKeys, activeKeys); + _.each(intersection, function(name) { + if (Toolbar.formats.SELECT[name] != null) { + if (_.isArray(activeFormats[name])) { + if (_.indexOf(activeFormats[name], formats[name]) < 0) { + return activeFormats[name].push(formats[name]); + } + } else if (activeFormats[name] !== formats[name]) { + return activeFormats[name] = [activeFormats[name], formats[name]]; + } + } + }); + _.each(missing, function(name) { + if (Toolbar.formats.TOGGLE[name] != null) { + return delete activeFormats[name]; + } else if ((Toolbar.formats.SELECT[name] != null) && !_.isArray(activeFormats[name])) { + return activeFormats[name] = [activeFormats[name]]; + } + }); + _.each(added, function(name) { + if (Toolbar.formats.SELECT[name] != null) { + return activeFormats[name] = [formats[name]]; + } + }); + return activeFormats; + }, formatsArr[0] || {}); + }; + + return Toolbar; + +})(); + +Quill.registerModule('toolbar', Toolbar); + +module.exports = Toolbar; + + + +},{"../quill":35}],33:[function(_dereq_,module,exports){ +var Normalizer, Quill, Tooltip, dom, _; + +Quill = _dereq_('../quill'); + +Normalizer = _dereq_('../lib/normalizer'); + +_ = Quill.require('lodash'); + +dom = Quill.require('dom'); + +Tooltip = (function() { + Tooltip.DEFAULTS = { + offset: 10, + styles: { + '.tooltip': { + 'background-color': '#fff', + 'border': '1px solid #000', + 'top': '0px', + 'white-space': 'nowrap', + 'z-index': '2000' + }, + '.tooltip a': { + 'cursor': 'pointer', + 'text-decoration': 'none' + } + }, + template: '' + }; + + Tooltip.HIDE_MARGIN = '-10000px'; + + function Tooltip(quill, options) { + this.quill = quill; + this.options = options; + this.quill.addStyles(this.options.styles); + this.container = this.quill.addContainer('tooltip'); + this.container.innerHTML = Normalizer.stripWhitespace(this.options.template); + this.container.style.position = 'absolute'; + dom(this.quill.root).on('focus', _.bind(this.hide, this)); + this.hide(); + this.quill.on(this.quill.constructor.events.TEXT_CHANGE, (function(_this) { + return function(delta, source) { + if (source === 'user' && _this.container.style.left !== Tooltip.HIDE_MARGIN) { + _this.range = null; + return _this.hide(); + } + }; + })(this)); + } + + Tooltip.prototype.initTextbox = function(textbox, enterCallback, escapeCallback) { + return dom(textbox).on('keyup', (function(_this) { + return function(event) { + switch (event.which) { + case dom.KEYS.ENTER: + return enterCallback.call(_this); + case dom.KEYS.ESCAPE: + return escapeCallback.call(_this); + default: + return true; + } + }; + })(this)); + }; + + Tooltip.prototype.hide = function() { + this.container.style.left = Tooltip.HIDE_MARGIN; + if (this.range) { + this.quill.setSelection(this.range); + } + return this.range = null; + }; + + Tooltip.prototype.show = function(reference) { + var left, top, win, _ref, _ref1; + this.range = this.quill.getSelection(); + _ref = this._position(reference), left = _ref[0], top = _ref[1]; + _ref1 = this._limit(left, top), left = _ref1[0], top = _ref1[1]; + win = dom(this.quill.root).window(); + left += win.pageXOffset; + top += win.pageYOffset; + this.container.style.left = "" + left + "px"; + this.container.style.top = "" + top + "px"; + return this.container.focus(); + }; + + Tooltip.prototype._getBounds = function() { + var bounds, scrollX, scrollY, win; + bounds = this.quill.root.getBoundingClientRect(); + win = dom(this.quill.root).window(); + scrollX = win.pageXOffset; + scrollY = win.pageYOffset; + return { + left: bounds.left + scrollX, + right: bounds.right + scrollX, + top: bounds.top + scrollY, + bottom: bounds.bottom + scrollY, + width: bounds.width, + height: bounds.height + }; + }; + + Tooltip.prototype._limit = function(left, top) { + var editorRect, toolbarRect; + editorRect = this._getBounds(); + toolbarRect = this.container.getBoundingClientRect(); + left = Math.min(editorRect.right - toolbarRect.width, left); + left = Math.max(editorRect.left, left); + top = Math.min(editorRect.bottom - toolbarRect.height, top); + top = Math.max(editorRect.top, top); + return [left, top]; + }; + + Tooltip.prototype._position = function(reference) { + var editorRect, left, referenceBounds, toolbarRect, top; + toolbarRect = this.container.getBoundingClientRect(); + editorRect = this._getBounds(); + if (reference != null) { + referenceBounds = reference.getBoundingClientRect(); + left = referenceBounds.left + referenceBounds.width / 2 - toolbarRect.width / 2; + top = referenceBounds.top + referenceBounds.height + this.options.offset; + if (top + toolbarRect.height > editorRect.bottom) { + top = referenceBounds.top - toolbarRect.height - this.options.offset; + } + } else { + left = editorRect.left + editorRect.width / 2 - toolbarRect.width / 2; + top = editorRect.top + editorRect.height / 2 - toolbarRect.height / 2; + } + return [left, top]; + }; + + return Tooltip; + +})(); + +Quill.registerModule('tooltip', Tooltip); + +module.exports = Tooltip; + + + +},{"../lib/normalizer":23,"../quill":35}],34:[function(_dereq_,module,exports){ +var Delta, Quill, UndoManager, _; + +Quill = _dereq_('../quill'); + +_ = Quill.require('lodash'); + +Delta = Quill.require('delta'); + +UndoManager = (function() { + UndoManager.DEFAULTS = { + delay: 1000, + maxStack: 100 + }; + + UndoManager.hotkeys = { + UNDO: { + key: 'Z', + metaKey: true + }, + REDO: { + key: 'Z', + metaKey: true, + shiftKey: true + } + }; + + function UndoManager(quill, options) { + this.quill = quill; + this.options = options != null ? options : {}; + this.lastRecorded = 0; + this.emittedDelta = null; + this.clear(); + this.initListeners(); + } + + UndoManager.prototype.initListeners = function() { + this.quill.onModuleLoad('keyboard', (function(_this) { + return function(keyboard) { + keyboard.addHotkey(UndoManager.hotkeys.UNDO, function() { + _this.undo(); + return false; + }); + return keyboard.addHotkey(UndoManager.hotkeys.REDO, function() { + _this.redo(); + return false; + }); + }; + })(this)); + return this.quill.on(this.quill.constructor.events.TEXT_CHANGE, (function(_this) { + return function(delta, origin) { + if (_.isEqual(delta, _this.emittedDelta)) { + return; + } + _this.record(delta, _this.oldDelta); + return _this.oldDelta = _this.quill.getContents(); + }; + })(this)); + }; + + UndoManager.prototype.clear = function() { + this.stack = { + undo: [], + redo: [] + }; + return this.oldDelta = this.quill.getContents(); + }; + + UndoManager.prototype.record = function(changeDelta, oldDelta) { + var change, ignored, timestamp, undoDelta; + if (!(changeDelta.ops.length > 0)) { + return; + } + this.stack.redo = []; + try { + undoDelta = this.quill.getContents().diff(this.oldDelta); + timestamp = new Date().getTime(); + if (this.lastRecorded + this.options.delay > timestamp && this.stack.undo.length > 0) { + change = this.stack.undo.pop(); + undoDelta = undoDelta.compose(change.undo); + changeDelta = change.redo.compose(changeDelta); + } else { + this.lastRecorded = timestamp; + } + this.stack.undo.push({ + redo: changeDelta, + undo: undoDelta + }); + if (this.stack.undo.length > this.options.maxStack) { + return this.stack.undo.unshift(); + } + } catch (_error) { + ignored = _error; + return this.clear(); + } + }; + + UndoManager.prototype.redo = function() { + return this._change('redo', 'undo'); + }; + + UndoManager.prototype.undo = function() { + return this._change('undo', 'redo'); + }; + + UndoManager.prototype._getLastChangeIndex = function(delta) { + var index, lastIndex; + lastIndex = 0; + index = 0; + delta.ops.forEach(function(op) { + if (op.insert != null) { + return lastIndex = Math.max(index + (op.insert.length || 1), lastIndex); + } else if (op["delete"] != null) { + return lastIndex = Math.max(index, lastIndex); + } else if (op.retain != null) { + if (op.attributes != null) { + lastIndex = Math.max(index + op.retain, lastIndex); + } + return index += op.retain; + } + }); + return lastIndex; + }; + + UndoManager.prototype._change = function(source, dest) { + var change, index; + if (this.stack[source].length > 0) { + change = this.stack[source].pop(); + this.lastRecorded = 0; + this.emittedDelta = change[source]; + this.quill.updateContents(change[source], 'user'); + this.emittedDelta = null; + index = this._getLastChangeIndex(change[source]); + this.quill.setSelection(index, index); + this.oldDelta = this.quill.getContents(); + return this.stack[dest].push(change); + } + }; + + return UndoManager; + +})(); + +Quill.registerModule('undo-manager', UndoManager); + +module.exports = UndoManager; + + + +},{"../quill":35}],35:[function(_dereq_,module,exports){ +var Delta, Editor, EventEmitter2, Format, Quill, Range, dom, pkg, _, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }, + __slice = [].slice; + +_ = _dereq_('lodash'); + +pkg = _dereq_('../package.json'); + +Delta = _dereq_('rich-text').Delta; + +EventEmitter2 = _dereq_('eventemitter2').EventEmitter2; + +dom = _dereq_('./lib/dom'); + +Editor = _dereq_('./core/editor'); + +Format = _dereq_('./core/format'); + +Range = _dereq_('./lib/range'); + +Quill = (function(_super) { + __extends(Quill, _super); + + Quill.version = pkg.version; + + Quill.editors = []; + + Quill.modules = []; + + Quill.themes = []; + + Quill.DEFAULTS = { + formats: ['align', 'bold', 'italic', 'strike', 'underline', 'color', 'background', 'font', 'size', 'link', 'image', 'bullet', 'list'], + modules: { + 'keyboard': true, + 'paste-manager': true, + 'undo-manager': true + }, + pollInterval: 100, + readOnly: false, + theme: 'default' + }; + + Quill.events = { + MODULE_INIT: 'module-init', + POST_EVENT: 'post-event', + PRE_EVENT: 'pre-event', + SELECTION_CHANGE: 'selection-change', + TEXT_CHANGE: 'text-change' + }; + + Quill.sources = Editor.sources; + + Quill.registerModule = function(name, module) { + if (Quill.modules[name] != null) { + console.warn("Overwriting " + name + " module"); + } + return Quill.modules[name] = module; + }; + + Quill.registerTheme = function(name, theme) { + if (Quill.themes[name] != null) { + console.warn("Overwriting " + name + " theme"); + } + return Quill.themes[name] = theme; + }; + + Quill.require = function(name) { + switch (name) { + case 'lodash': + return _; + case 'delta': + return Delta; + case 'dom': + return dom; + default: + return null; + } + }; + + function Quill(container, options) { + var html, moduleOptions, themeClass; + if (options == null) { + options = {}; + } + if (_.isString(container)) { + container = document.querySelector(container); + } + if (container == null) { + throw new Error('Invalid Quill container'); + } + moduleOptions = _.defaults(options.modules || {}, Quill.DEFAULTS.modules); + html = container.innerHTML; + this.options = _.defaults(options, Quill.DEFAULTS); + this.options.modules = moduleOptions; + this.options.id = this.id = "quill-" + (Quill.editors.length + 1); + this.options.emitter = this; + this.modules = {}; + this.editor = new Editor(container, this, this.options); + this.root = this.editor.doc.root; + Quill.editors.push(this); + this.setHTML(html, Quill.sources.SILENT); + themeClass = Quill.themes[this.options.theme]; + if (themeClass == null) { + throw new Error("Cannot load " + this.options.theme + " theme. Are you sure you registered it?"); + } + this.theme = new themeClass(this, this.options); + _.each(this.options.modules, (function(_this) { + return function(option, name) { + return _this.addModule(name, option); + }; + })(this)); + } + + Quill.prototype.addContainer = function(className, before) { + if (before == null) { + before = false; + } + return this.editor.renderer.addContainer(className, before); + }; + + Quill.prototype.addFormat = function(name, format) { + return this.editor.doc.addFormat(name, format); + }; + + Quill.prototype.addModule = function(name, options) { + var moduleClass; + moduleClass = Quill.modules[name]; + if (moduleClass == null) { + throw new Error("Cannot load " + name + " module. Are you sure you registered it?"); + } + if (!_.isObject(options)) { + options = {}; + } + options = _.defaults(options, this.theme.constructor.OPTIONS[name] || {}, moduleClass.DEFAULTS || {}); + this.modules[name] = new moduleClass(this, options); + this.emit(Quill.events.MODULE_INIT, name, this.modules[name]); + return this.modules[name]; + }; + + Quill.prototype.addStyles = function(styles) { + return this.editor.renderer.addStyles(styles); + }; + + Quill.prototype.deleteText = function(start, end, source) { + var delta, formats, _ref; + if (source == null) { + source = Quill.sources.API; + } + _ref = this._buildParams(start, end, {}, source), start = _ref[0], end = _ref[1], formats = _ref[2], source = _ref[3]; + if (!(end > start)) { + return; + } + delta = new Delta().retain(start)["delete"](end - start); + return this.editor.applyDelta(delta, source); + }; + + Quill.prototype.emit = function() { + var args, eventName; + eventName = arguments[0], args = 2 <= arguments.length ? __slice.call(arguments, 1) : []; + Quill.__super__.emit.apply(this, [Quill.events.PRE_EVENT, eventName].concat(__slice.call(args))); + Quill.__super__.emit.apply(this, [eventName].concat(__slice.call(args))); + return Quill.__super__.emit.apply(this, [Quill.events.POST_EVENT, eventName].concat(__slice.call(args))); + }; + + Quill.prototype.focus = function() { + return this.editor.focus(); + }; + + Quill.prototype.formatLine = function(start, end, name, value, source) { + var formats, line, offset, _ref, _ref1; + _ref = this._buildParams(start, end, name, value, source), start = _ref[0], end = _ref[1], formats = _ref[2], source = _ref[3]; + _ref1 = this.editor.doc.findLineAt(end), line = _ref1[0], offset = _ref1[1]; + if (line != null) { + end += line.length - offset; + } + return this.formatText(start, end, formats, source); + }; + + Quill.prototype.formatText = function(start, end, name, value, source) { + var delta, formats, _ref; + _ref = this._buildParams(start, end, name, value, source), start = _ref[0], end = _ref[1], formats = _ref[2], source = _ref[3]; + formats = _.reduce(formats, (function(_this) { + return function(formats, value, name) { + var format; + format = _this.editor.doc.formats[name]; + if (!(value && value !== format.config["default"])) { + formats[name] = null; + } + return formats; + }; + })(this), formats); + delta = new Delta().retain(start).retain(end - start, formats); + return this.editor.applyDelta(delta, source); + }; + + Quill.prototype.getContents = function(start, end) { + if (start == null) { + start = 0; + } + if (end == null) { + end = null; + } + if (_.isObject(start)) { + end = start.end; + start = start.start; + } + return this.editor.getDelta().slice(start, end); + }; + + Quill.prototype.getHTML = function() { + return this.root.innerHTML; + }; + + Quill.prototype.getLength = function() { + return this.editor.getDelta().length(); + }; + + Quill.prototype.getModule = function(name) { + return this.modules[name]; + }; + + Quill.prototype.getSelection = function() { + this.editor.checkUpdate(); + return this.editor.selection.getRange(); + }; + + Quill.prototype.getText = function(start, end) { + if (start == null) { + start = 0; + } + if (end == null) { + end = null; + } + return _.map(this.getContents(start, end).ops, function(op) { + if (_.isString(op.insert)) { + return op.insert; + } else { + return ''; + } + }).join(''); + }; + + Quill.prototype.insertEmbed = function(index, type, url, source) { + return this.insertText(index, dom.EMBED_TEXT, type, url, source); + }; + + Quill.prototype.insertText = function(index, text, name, value, source) { + var delta, end, formats, _ref; + _ref = this._buildParams(index, 0, name, value, source), index = _ref[0], end = _ref[1], formats = _ref[2], source = _ref[3]; + if (!(text.length > 0)) { + return; + } + delta = new Delta().retain(index).insert(text, formats); + return this.editor.applyDelta(delta, source); + }; + + Quill.prototype.onModuleLoad = function(name, callback) { + if (this.modules[name]) { + return callback(this.modules[name]); + } + return this.on(Quill.events.MODULE_INIT, function(moduleName, module) { + if (moduleName === name) { + return callback(module); + } + }); + }; + + Quill.prototype.prepareFormat = function(name, value) { + var format, range; + format = this.editor.doc.formats[name]; + if (format == null) { + return; + } + range = this.getSelection(); + if (!(range != null ? range.isCollapsed() : void 0)) { + return; + } + if (format.isType(Format.types.LINE)) { + return this.formatLine(range, name, value, Quill.sources.USER); + } else { + return format.prepare(value); + } + }; + + Quill.prototype.setContents = function(delta, source) { + if (source == null) { + source = Quill.sources.API; + } + if (_.isArray(delta)) { + delta = { + ops: delta + }; + } + delta.ops.unshift({ + "delete": this.getLength() + }); + return this.updateContents(delta, source); + }; + + Quill.prototype.setHTML = function(html, source) { + if (source == null) { + source = Quill.sources.API; + } + if (!html) { + html = "<" + dom.DEFAULT_BLOCK_TAG + "><" + dom.DEFAULT_BREAK_TAG + ">"; + } + this.editor.doc.setHTML(html); + return this.editor.checkUpdate(source); + }; + + Quill.prototype.setSelection = function(start, end, source) { + var range; + if (source == null) { + source = Quill.sources.API; + } + if (_.isNumber(start) && _.isNumber(end)) { + range = new Range(start, end); + } else { + range = start; + source = end || source; + } + return this.editor.selection.setRange(range, source); + }; + + Quill.prototype.updateContents = function(delta, source) { + if (source == null) { + source = Quill.sources.API; + } + return this.editor.applyDelta(delta, source); + }; + + Quill.prototype._buildParams = function() { + var formats, params; + params = 1 <= arguments.length ? __slice.call(arguments, 0) : []; + if (_.isObject(params[0])) { + params.splice(0, 1, params[0].start, params[0].end); + } + if (_.isString(params[2])) { + formats = {}; + formats[params[2]] = params[3]; + params.splice(2, 2, formats); + } + if (params[3] == null) { + params[3] = Quill.sources.API; + } + return params; + }; + + return Quill; + +})(EventEmitter2); + +Quill.registerTheme('default', _dereq_('./themes/default')); + +Quill.registerTheme('snow', _dereq_('./themes/snow')); + +module.exports = Quill; + + + +},{"../package.json":11,"./core/editor":13,"./core/format":14,"./lib/dom":21,"./lib/range":25,"./themes/default":36,"./themes/snow":37,"eventemitter2":3,"lodash":"M4+//f","rich-text":4}],36:[function(_dereq_,module,exports){ +var DefaultTheme; + +DefaultTheme = (function() { + DefaultTheme.OPTIONS = {}; + + function DefaultTheme(quill) { + this.quill = quill; + this.editor = this.quill.editor; + this.editorContainer = this.editor.root; + } + + return DefaultTheme; + +})(); + +module.exports = DefaultTheme; + + + +},{}],37:[function(_dereq_,module,exports){ +var ColorPicker, DefaultTheme, Picker, SnowTheme, dom, _, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + +_ = _dereq_('lodash'); + +ColorPicker = _dereq_('../../lib/color-picker'); + +DefaultTheme = _dereq_('../default'); + +dom = _dereq_('../../lib/dom'); + +Picker = _dereq_('../../lib/picker'); + +SnowTheme = (function(_super) { + __extends(SnowTheme, _super); + + SnowTheme.COLORS = ["#000000", "#e60000", "#ff9900", "#ffff00", "#008A00", "#0066cc", "#9933ff", "#ffffff", "#facccc", "#ffebcc", "#ffffcc", "#cce8cc", "#cce0f5", "#ebd6ff", "#bbbbbb", "#f06666", "#ffc266", "#ffff66", "#66b966", "#66a3e0", "#c285ff", "#888888", "#a10000", "#b26b00", "#b2b200", "#006100", "#0047b2", "#6b24b2", "#444444", "#5c0000", "#663d00", "#666600", "#003700", "#002966", "#3d1466"]; + + SnowTheme.OPTIONS = { + 'multi-cursor': { + template: ' ' + } + }; + + SnowTheme.STYLES = { + '.snow .image-tooltip-container a': { + 'border': '1px solid #06c' + }, + '.snow .image-tooltip-container a.insert': { + 'background-color': '#06c', + 'color': '#fff' + }, + '.snow .cursor-name': { + 'border-radius': '4px', + 'font-size': '11px', + 'font-family': 'Arial', + 'margin-left': '-50%', + 'padding': '4px 10px' + }, + '.snow .cursor-triangle': { + 'border-left': '4px solid transparent', + 'border-right': '4px solid transparent', + 'height': '0px', + 'margin-left': '-3px', + 'width': '0px' + }, + '.snow .cursor.left .cursor-name': { + 'margin-left': '-8px' + }, + '.snow .cursor.right .cursor-flag': { + 'right': 'auto' + }, + '.snow .cursor.right .cursor-name': { + 'margin-left': '-100%', + 'margin-right': '-8px' + }, + '.snow .cursor-triangle.bottom': { + 'border-top': '4px solid transparent', + 'display': 'block', + 'margin-bottom': '-1px' + }, + '.snow .cursor-triangle.top': { + 'border-bottom': '4px solid transparent', + 'display': 'none', + 'margin-top': '-1px' + }, + '.snow .cursor.top .cursor-triangle.bottom': { + 'display': 'none' + }, + '.snow .cursor.top .cursor-triangle.top': { + 'display': 'block' + }, + '.snow a': { + 'color': '#06c' + }, + '.snow .tooltip': { + 'border': '1px solid #ccc', + 'box-shadow': '0px 0px 5px #ddd', + 'color': '#222' + }, + '.snow .tooltip a': { + 'color': '#06c' + }, + '.snow .tooltip .input': { + 'border': '1px solid #ccc', + 'margin': '0px', + 'padding': '5px' + }, + '.snow .image-tooltip-container .preview': { + 'border-color': '#ccc', + 'color': '#ccc' + }, + '.snow .link-tooltip-container a, .snow .link-tooltip-container span': { + 'display': 'inline-block', + 'line-height': '25px' + } + }; + + function SnowTheme(quill) { + this.quill = quill; + SnowTheme.__super__.constructor.apply(this, arguments); + this.quill.addStyles(SnowTheme.STYLES); + this.pickers = []; + this.quill.on(this.quill.constructor.events.SELECTION_CHANGE, (function(_this) { + return function(range) { + if (range != null) { + return _.invoke(_this.pickers, 'close'); + } + }; + })(this)); + dom(this.quill.root.ownerDocument.body).addClass('snow'); + this.quill.onModuleLoad('multi-cursor', _.bind(this.extendMultiCursor, this)); + this.quill.onModuleLoad('toolbar', _.bind(this.extendToolbar, this)); + } + + SnowTheme.prototype.extendMultiCursor = function(module) { + return module.on(module.constructor.events.CURSOR_ADDED, function(cursor) { + var bottomTriangle, topTriangle; + bottomTriangle = cursor.elem.querySelector('.cursor-triangle.bottom'); + topTriangle = cursor.elem.querySelector('.cursor-triangle.top'); + return bottomTriangle.style.borderTopColor = topTriangle.style.borderBottomColor = cursor.color; + }); + }; + + SnowTheme.prototype.extendToolbar = function(module) { + _.each(['color', 'background', 'font', 'size', 'align'], (function(_this) { + return function(format) { + var picker, select; + select = module.container.querySelector(".ql-" + format); + if (select == null) { + return; + } + switch (format) { + case 'font': + case 'size': + case 'align': + picker = new Picker(select); + break; + case 'color': + case 'background': + picker = new ColorPicker(select); + _.each(picker.container.querySelectorAll('.ql-picker-item'), function(item, i) { + if (i < 7) { + return dom(item).addClass('ql-primary-color'); + } + }); + } + if (picker != null) { + return _this.pickers.push(picker); + } + }; + })(this)); + return _.each(dom(module.container).textNodes(), function(node) { + if (dom(node).text().trim().length === 0) { + return dom(node).remove(); + } + }); + }; + + return SnowTheme; + +})(DefaultTheme); + +module.exports = SnowTheme; + + + +},{"../../lib/color-picker":20,"../../lib/dom":21,"../../lib/picker":24,"../default":36,"lodash":"M4+//f"}]},{},[19]) +(19) +}); \ No newline at end of file diff --git a/dist/quill.min.js b/dist/quill.min.js new file mode 100644 index 0000000000..519b631324 --- /dev/null +++ b/dist/quill.min.js @@ -0,0 +1,9 @@ +/*! Quill Editor v0.18.1 + * https://quilljs.com/ + * Copyright (c) 2014, Jason Chen + * Copyright (c) 2013, salesforce.com + */ +!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;"undefined"!=typeof window?b=window:"undefined"!=typeof global?b=global:"undefined"!=typeof self&&(b=self),b.Quill=a()}}(function(){var a;return function b(a,c,d){function e(g,h){if(!c[g]){if(!a[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);throw new Error("Cannot find module '"+g+"'")}var j=c[g]={exports:{}};a[g][0].call(j.exports,function(b){var c=a[g][1][b];return e(c?c:b)},j,j.exports,b,a,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g-1?0:-1:a?0:-1}function g(a){var b=this.cache,c=typeof a;if("boolean"==c||null==a)b[a]=!0;else{"number"!=c&&"string"!=c&&(c="object");var d="number"==c?a:fb+a,e=b[c]||(b[c]={});"object"==c?(e[d]||(e[d]=[])).push(a):e[d]=!0}}function h(a){var b=-1,c=a.length,d=a[0],e=a[c/2|0],f=a[c-1];if(d&&"object"==typeof d&&e&&"object"==typeof e&&f&&"object"==typeof f)return!1;var h=j();h["false"]=h["null"]=h["true"]=h.undefined=!1;var i=j();for(i.array=a,i.cache=h,i.push=g;++be?0:e);++d=gb&&d===e,j=[];if(i){var k=h(b);k?(d=f,b=k):i=!1}for(;++c-1:void 0});return e.pop(),f.pop(),s&&(k(e),k(f)),g}function w(a,b,c,d,e,f){var g=1&b,h=2&b,i=4&b,j=16&b,k=32&b;if(!h&&!E(a))throw new TypeError;j&&!c.length&&(b&=-17,j=c=!1),k&&!d.length&&(b&=-33,k=d=!1);var l=a&&a.__bindData__;if(l&&l!==!0)return l=m(l),l[2]&&(l[2]=m(l[2])),l[3]&&(l[3]=m(l[3])),!g||1&l[1]||(l[4]=e),!g&&1&l[1]&&(b|=8),!i||4&l[1]||(l[5]=f),j&&Ib.apply(l[2]||(l[2]=[]),c),k&&Jb.apply(l[3]||(l[3]=[]),d),l[1]|=b,w.apply(null,l);var n=1==b||17===b?o:s;return n([a,b,c,d,e,f])}function x(){var a=(a=n.indexOf)===R?e:a;return a}function y(a){return"function"==typeof a&&Fb.test(a)}function z(a){return a&&"object"==typeof a&&"number"==typeof a.length&&Eb.call(a)==lb||!1}function A(a,b,c,d){return"boolean"!=typeof b&&null!=b&&(d=c,c=b,b=!1),p(a,b,"function"==typeof c&&r(c,d,1))}function B(a,b){return a?Hb.call(a,b):!1}function C(a){return a&&1===a.nodeType||!1}function D(a,b,c,d){return v(a,b,"function"==typeof c&&r(c,d,2))}function E(a){return"function"==typeof a}function F(a){return!(!a||!wb[typeof a])}function G(a){return"number"==typeof a||a&&"object"==typeof a&&Eb.call(a)==qb||!1}function H(a){return"string"==typeof a||a&&"object"==typeof a&&Eb.call(a)==tb||!1}function I(a,b,c){var d={};if("function"!=typeof b){var e=[];Xb(a,function(a,b){e.push(b)}),e=t(e,u(arguments,!0,!1,1));for(var f=-1,g=e.length;++fc?Ob(0,d+c):c||0}else if(c){var f=U(a,b);return a[f]===b?f:-1}return e(a,b,c)}function S(){for(var a=[],b=-1,c=arguments.length,d=i(),g=x(),j=g===e,m=i();++b=gb&&h(b?a[b]:m)))}var o=a[0],p=-1,q=o?o.length:0,r=[];a:for(;++pe;){var g=e+f>>>1;c(a[g])2?w(a,17,m(arguments,2),null,b):w(a,1,null,null,b)}function W(a){if(!E(a))throw new TypeError;var b=m(arguments,1);return setTimeout(function(){a.apply(bb,b)},1)}function X(a){return w(a,16,m(arguments,1))}function Y(a,b,c){var d=typeof a;if(null==a||"function"==d)return r(a,b,c);if("object"!=d)return _(a);var e=Ub(a),f=e[0],g=a[f];return 1!=e.length||g!==g||F(g)?function(b){for(var c=e.length,d=!1;c--&&(d=v(b[e[c]],a[e[c]],null,!0)););return d}:function(a){var b=a[f];return g===b&&(0!==g||1/g==1/b)}}function Z(a){return a}function $(){}function _(a){return function(b){return b[a]}}function ab(a){var b=++eb;return String(null==a?"":a)+b}var bb,cb=[],db=[],eb=0,fb=+new Date+"",gb=75,hb=40,ib=/\w*$/,jb=/^\s*function[ \n\r\t]+\w/,kb=/\bthis\b/,lb="[object Arguments]",mb="[object Array]",nb="[object Boolean]",ob="[object Date]",pb="[object Function]",qb="[object Number]",rb="[object Object]",sb="[object RegExp]",tb="[object String]",ub={};ub[pb]=!1,ub[lb]=ub[mb]=ub[nb]=ub[ob]=ub[qb]=ub[rb]=ub[sb]=ub[tb]=!0;var vb={configurable:!1,enumerable:!1,value:null,writable:!1},wb={"boolean":!1,"function":!0,object:!0,number:!1,string:!1,undefined:!1},xb=wb[typeof window]&&window||this,yb=wb[typeof d]&&d&&!d.nodeType&&d,zb=wb[typeof c]&&c&&!c.nodeType&&c,Ab=zb&&zb.exports===yb&&yb,Bb=wb[typeof b]&&b;!Bb||Bb.global!==Bb&&Bb.window!==Bb||(xb=Bb);var Cb=[],Db=Object.prototype,Eb=Db.toString,Fb=RegExp("^"+String(Eb).replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/toString| for [^\]]+/g,".*?")+"$"),Gb=Function.prototype.toString,Hb=Db.hasOwnProperty,Ib=Cb.push,Jb=Cb.unshift,Kb=function(){try{var a={},b=y(b=Object.defineProperty)&&b,c=b(a,a,a)&&b}catch(d){}return c}(),Lb=y(Lb=Object.create)&&Lb,Mb=y(Mb=Array.isArray)&&Mb,Nb=y(Nb=Object.keys)&&Nb,Ob=Math.max,Pb={};Pb[mb]=Array,Pb[nb]=Boolean,Pb[ob]=Date,Pb[pb]=Function,Pb[rb]=Object,Pb[qb]=Number,Pb[sb]=RegExp,Pb[tb]=String;var Qb=n.support={};Qb.funcDecomp=!y(xb.WinRTError)&&kb.test(function(){return this}),Qb.funcNames="string"==typeof Function.name,Lb||(q=function(){function a(){}return function(b){if(F(b)){a.prototype=b;var c=new a;a.prototype=null}return c||xb.Object()}}());var Rb=Kb?function(a,b){vb.value=b,Kb(a,"__bindData__",vb)}:$,Sb=Mb||function(a){return a&&"object"==typeof a&&"number"==typeof a.length&&Eb.call(a)==mb||!1},Tb=function(a){var b,c=a,d=[];if(!c)return d;if(!wb[typeof a])return d;for(b in c)Hb.call(c,b)&&d.push(b);return d},Ub=Nb?function(a){return F(a)?Nb(a):[]}:Tb,Vb=function(a,b,c){var d,e=a,f=e;if(!e)return f;var g=arguments,h=0,i="number"==typeof c?2:g.length;if(i>3&&"function"==typeof g[i-2])var j=r(g[--i-1],g[i--],2);else i>2&&"function"==typeof g[i-1]&&(j=g[--i]);for(;++he;e++)a&&a.push(c._listeners[e]);return[c]}if("*"===o||"**"===o||c[o]){if("*"===o){for(h in c)"_listeners"!==h&&c.hasOwnProperty(h)&&(m=m.concat(f(a,b,c[h],d+1)));return m}if("**"===o){l=d+1===n||d+2===n&&"*"===p,l&&c._listeners&&(m=m.concat(f(a,b,c,n)));for(h in c)"_listeners"!==h&&c.hasOwnProperty(h)&&("*"===h||"**"===h?(c[h]._listeners&&!l&&(m=m.concat(f(a,b,c[h],n))),m=m.concat(f(a,b,c[h],d))):m=m.concat(h===p?f(a,b,c[h],d+2):f(a,b,c[h],d)));return m}m=m.concat(f(a,b,c[o],d+1))}if(i=c["*"],i&&f(a,b,i,d+1),j=c["**"])if(n>d){j._listeners&&f(a,b,j,n);for(h in j)"_listeners"!==h&&j.hasOwnProperty(h)&&(h===p?f(a,b,j[h],d+2):h===o?f(a,b,j[h],d+1):(k={},k[h]=j[h],f(a,b,{"**":k},d+1)))}else j._listeners?f(a,b,j,n):j["*"]&&j["*"]._listeners&&f(a,b,j["*"],n);return m}function g(a,b){a="string"==typeof a?a.split(this.delimiter):a.slice();for(var c=0,d=a.length;d>c+1;c++)if("**"===a[c]&&"**"===a[c+1])return;for(var e=this.listenerTree,f=a.shift();f;){if(e[f]||(e[f]={}),e=e[f],0===a.length){if(e._listeners){if("function"==typeof e._listeners)e._listeners=[e._listeners,b];else if(h(e._listeners)&&(e._listeners.push(b),!e._listeners.warned)){var g=i;"undefined"!=typeof this._events.maxListeners&&(g=this._events.maxListeners),g>0&&e._listeners.length>g&&(e._listeners.warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",e._listeners.length),console.trace())}}else e._listeners=b;return!0}f=a.shift()}return!0}var h=Array.isArray?Array.isArray:function(a){return"[object Array]"===Object.prototype.toString.call(a)},i=10;e.prototype.delimiter=".",e.prototype.setMaxListeners=function(a){this._events||b.call(this),this._events.maxListeners=a,this._conf||(this._conf={}),this._conf.maxListeners=a},e.prototype.event="",e.prototype.once=function(a,b){return this.many(a,1,b),this},e.prototype.many=function(a,b,c){function d(){0===--b&&e.off(a,d),c.apply(this,arguments)}var e=this;if("function"!=typeof c)throw new Error("many only accepts instances of Function");return d._origin=c,this.on(a,d),e},e.prototype.emit=function(){this._events||b.call(this);var a=arguments[0];if("newListener"===a&&!this.newListener&&!this._events.newListener)return!1;if(this._all){for(var c=arguments.length,d=new Array(c-1),e=1;c>e;e++)d[e-1]=arguments[e];for(e=0,c=this._all.length;c>e;e++)this.event=a,this._all[e].apply(this,d)}if("error"===a&&!(this._all||this._events.error||this.wildcard&&this.listenerTree.error))throw arguments[1]instanceof Error?arguments[1]:new Error("Uncaught, unspecified 'error' event.");var g;if(this.wildcard){g=[];var h="string"==typeof a?a.split(this.delimiter):a.slice();f.call(this,g,h,this.listenerTree,0)}else g=this._events[a];if("function"==typeof g){if(this.event=a,1===arguments.length)g.call(this);else if(arguments.length>1)switch(arguments.length){case 2:g.call(this,arguments[1]);break;case 3:g.call(this,arguments[1],arguments[2]);break;default:for(var c=arguments.length,d=new Array(c-1),e=1;c>e;e++)d[e-1]=arguments[e];g.apply(this,d)}return!0}if(g){for(var c=arguments.length,d=new Array(c-1),e=1;c>e;e++)d[e-1]=arguments[e];for(var i=g.slice(),e=0,c=i.length;c>e;e++)this.event=a,i[e].apply(this,d);return i.length>0||!!this._all}return!!this._all},e.prototype.on=function(a,c){if("function"==typeof a)return this.onAny(a),this;if("function"!=typeof c)throw new Error("on only accepts instances of Function");if(this._events||b.call(this),this.emit("newListener",a,c),this.wildcard)return g.call(this,a,c),this;if(this._events[a]){if("function"==typeof this._events[a])this._events[a]=[this._events[a],c];else if(h(this._events[a])&&(this._events[a].push(c),!this._events[a].warned)){var d=i;"undefined"!=typeof this._events.maxListeners&&(d=this._events.maxListeners),d>0&&this._events[a].length>d&&(this._events[a].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[a].length),console.trace())}}else this._events[a]=c;return this},e.prototype.onAny=function(a){if("function"!=typeof a)throw new Error("onAny only accepts instances of Function");return this._all||(this._all=[]),this._all.push(a),this},e.prototype.addListener=e.prototype.on,e.prototype.off=function(a,b){if("function"!=typeof b)throw new Error("removeListener only takes instances of Function");var c,d=[];if(this.wildcard){var e="string"==typeof a?a.split(this.delimiter):a.slice();d=f.call(this,null,e,this.listenerTree,0)}else{if(!this._events[a])return this;c=this._events[a],d.push({_listeners:c})}for(var g=0;gk;k++)if(c[k]===b||c[k].listener&&c[k].listener===b||c[k]._origin&&c[k]._origin===b){j=k;break}if(0>j)continue;return this.wildcard?i._listeners.splice(j,1):this._events[a].splice(j,1),0===c.length&&(this.wildcard?delete i._listeners:delete this._events[a]),this}(c===b||c.listener&&c.listener===b||c._origin&&c._origin===b)&&(this.wildcard?delete i._listeners:delete this._events[a])}return this},e.prototype.offAny=function(a){var b,c=0,d=0;if(a&&this._all&&this._all.length>0){for(b=this._all,c=0,d=b.length;d>c;c++)if(a===b[c])return b.splice(c,1),this}else this._all=[];return this},e.prototype.removeListener=e.prototype.off,e.prototype.removeAllListeners=function(a){if(0===arguments.length)return!this._events||b.call(this),this;if(this.wildcard)for(var c="string"==typeof a?a.split(this.delimiter):a.slice(),d=f.call(this,null,c,this.listenerTree,0),e=0;e0&&(c.attributes=b),this.push(c)},g.prototype["delete"]=function(a){return 0>=a?this:this.push({"delete":a})},g.prototype.retain=function(a,b){if(0>=a)return this;var c={retain:a};return d.object(b)&&Object.keys(b).length>0&&(c.attributes=b),this.push(c)},g.prototype.push=function(a){var b=this.ops.length,c=this.ops[b-1];if(a=e.clone(a),d.object(c)){if(d.number(a["delete"])&&d.number(c["delete"]))return this.ops[b-1]={"delete":c["delete"]+a["delete"]},this;if(d.number(c["delete"])&&(d.string(a.insert)||d.number(a.insert))&&(b-=1,c=this.ops[b-1],!d.object(c)))return this.ops.unshift(a),this;if(d.equal(a.attributes,c.attributes)){if(d.string(a.insert)&&d.string(c.insert))return this.ops[b-1]={insert:c.insert+a.insert},d.object(a.attributes)&&(this.ops[b-1].attributes=a.attributes),this;if(d.number(a.retain)&&d.number(c.retain))return this.ops[b-1]={retain:c.retain+a.retain},d.object(a.attributes)&&(this.ops[b-1].attributes=a.attributes),this}}return this.ops.splice(b,0,a),this},g.prototype.chop=function(){var a=this.ops[this.ops.length-1];return a&&a.retain&&!a.attributes&&this.ops.pop(),this},g.prototype.length=function(){return this.ops.reduce(function(a,b){return a+e.length(b)},0)},g.prototype.slice=function(a,b){a=a||0,d.number(b)||(b=1/0);for(var c=new g,f=e.iterator(this.ops),h=0;b>h&&f.hasNext();){var i;a>h?i=f.next(a-h):(i=f.next(b-a),c.push(i)),h+=e.length(i)}return c},g.prototype.compose=function(a){var b=e.iterator(this.ops),c=e.iterator(a.ops);for(this.ops=[];b.hasNext()||c.hasNext();)if("insert"===c.peekType())this.push(c.next());else if("delete"===b.peekType())this.push(b.next());else{var f=Math.min(b.peekLength(),c.peekLength()),g=b.next(f),h=c.next(f);if(d.number(h.retain)){var i={};d.number(g.retain)?i.retain=f:i.insert=g.insert;var j=e.attributes.compose(g.attributes,h.attributes,d.number(g.retain));j&&(i.attributes=j),this.push(i)}else d.number(h["delete"])&&d.number(g.retain)&&this.push(h)}return this.chop()},g.prototype.diff=function(a){var b=[this.ops,a.ops].map(function(b){return b.map(function(c){if(d.string(c.insert))return c.insert;if(d.number(c.insert))return f;var e=b===a.ops?"on":"with";throw new Error("diff() called "+e+" non-document")}).join("")}),h=c(b[0],b[1]),i=e.iterator(this.ops),j=e.iterator(a.ops),k=new g;return h.forEach(function(a){for(var b=a[1].length;b>0;){var d=0;switch(a[0]){case c.INSERT:d=Math.min(j.peekLength(),b),k.push(j.next(d));break;case c.DELETE:d=Math.min(b,i.peekLength()),i.next(d),k["delete"](d);break;case c.EQUAL:d=Math.min(i.peekLength(),j.peekLength(),b);var f=i.next(d),g=j.next(d);f.insert===g.insert?k.retain(d,e.attributes.diff(f.attributes,g.attributes)):k.push(g)["delete"](d)}b-=d}}),k.chop()},g.prototype.transform=function(a,b){if(b=!!b,d.number(a))return this.transformPosition(a,b);for(var c=e.iterator(this.ops),f=e.iterator(a.ops),h=new g;c.hasNext()||f.hasNext();)if("insert"!==c.peekType()||!b&&"insert"===f.peekType())if("insert"===f.peekType())h.push(f.next());else{var i=Math.min(c.peekLength(),f.peekLength()),j=c.next(i),k=f.next(i);if(j["delete"])continue;k["delete"]?h.push(k):h.retain(i,e.attributes.transform(j.attributes,k.attributes,b))}else h.retain(e.length(c.next()));return h.chop()},g.prototype.transformPosition=function(a,b){b=!!b;for(var c=e.iterator(this.ops),d=0;c.hasNext()&&a>=d;){var f=c.peekLength(),g=c.peekType();c.next(),"delete"!==g?("insert"===g&&(a>d||!b)&&(a+=f),d+=f):a-=Math.min(f,a-d)}return a},b.exports=g},{"./is":6,"./op":7,"fast-diff":9}],6:[function(a,b){b.exports={equal:function(a,b){if(a===b)return!0;if(null==a&&null==b)return!0;if(null==a||null==b)return!1;if(Object.keys(a).length!=Object.keys(b).length)return!1;for(var c in a)if(a[c]!==b[c])return!1;return!0},array:function(a){return Array.isArray(a)},number:function(a){return"number"==typeof a?!0:"object"==typeof a&&"[object Number]"===Object.prototype.toString.call(a)?!0:!1},object:function(a){return a?"function"==typeof a||"object"==typeof a:!1},string:function(a){return"string"==typeof a?!0:"object"==typeof a&&"[object String]"===Object.prototype.toString.call(a)?!0:!1}}},{}],7:[function(a,b){function c(a){this.ops=a,this.index=0,this.offset=0}var d=a("./is"),e={attributes:{clone:function(a,b){return d.object(a)?Object.keys(a).reduce(function(c,d){return void 0===a[d]||null===a[d]&&!b||(c[d]=a[d]),c},{}):{}},compose:function(a,b,c){d.object(a)||(a={}),d.object(b)||(b={});var e=this.clone(b,c);for(var f in a)void 0!==a[f]&&void 0===b[f]&&(e[f]=a[f]);return Object.keys(e).length>0?e:void 0},diff:function(a,b){d.object(a)||(a={}),d.object(b)||(b={});var c=Object.keys(a).concat(Object.keys(b)).reduce(function(c,d){return a[d]!==b[d]&&(c[d]=void 0===b[d]?null:b[d]),c},{});return Object.keys(c).length>0?c:void 0},transform:function(a,b,c){if(!d.object(a))return b;if(!d.object(b))return void 0;if(!c)return b;var e=Object.keys(b).reduce(function(c,d){return void 0===a[d]&&(c[d]=b[d]),c},{});return Object.keys(e).length>0?e:void 0}},clone:function(a){var b=this.attributes.clone(a);return d.object(b.attributes)&&(b.attributes=this.attributes.clone(b.attributes,!0)),b},iterator:function(a){return new c(a)},length:function(a){return d.number(a["delete"])?a["delete"]:d.number(a.retain)?a.retain:d.string(a.insert)?a.insert.length:1}};c.prototype.hasNext=function(){return this.peekLength()<1/0},c.prototype.next=function(a){a||(a=1/0);var b=this.ops[this.index];if(b){var c=this.offset,f=e.length(b);if(a>=f-c?(a=f-c,this.index+=1,this.offset=0):this.offset+=a,d.number(b["delete"]))return{"delete":a};var g={};return b.attributes&&(g.attributes=b.attributes),d.number(b.retain)?g.retain=a:g.insert=d.string(b.insert)?b.insert.substr(c,a):b.insert,g}return{retain:1/0}},c.prototype.peekLength=function(){return this.ops[this.index]?e.length(this.ops[this.index])-this.offset:1/0},c.prototype.peekType=function(){return this.ops[this.index]?d.number(this.ops[this.index]["delete"])?"delete":d.number(this.ops[this.index].retain)?"retain":"insert":"retain"},b.exports=e},{"./is":6}],8:[function(a,b){{var c=a("./delta");a("../package.json")}b.exports={Delta:c,name:"rich-text",uri:"http://sharejs.org/types/rich-text/v1",create:function(a){return new c(a)},apply:function(a,b){return a=new c(a),b=new c(b),a.compose(b)},compose:function(a,b){return a=new c(a),b=new c(b),a.compose(b)},diff:function(a,b){return a=new c(a),b=new c(b),a.diff(b)},transform:function(a,b,d){return a=new c(a),b=new c(b),b.transform(a,"left"===d)}}},{"../package.json":10,"./delta":5}],9:[function(a,b){function c(a,b){if(a==b)return a?[[m,a]]:[];var c=g(a,b),e=a.substring(0,c);a=a.substring(c),b=b.substring(c),c=h(a,b);var f=a.substring(a.length-c);a=a.substring(0,a.length-c),b=b.substring(0,b.length-c);var i=d(a,b);return e&&i.unshift([m,e]),f&&i.push([m,f]),j(i),i}function d(a,b){var d;if(!a)return[[l,b]];if(!b)return[[k,a]];var f=a.length>b.length?a:b,g=a.length>b.length?b:a,h=f.indexOf(g);if(-1!=h)return d=[[l,f.substring(0,h)],[m,g],[l,f.substring(h+g.length)]],a.length>b.length&&(d[0][0]=d[2][0]=k),d;if(1==g.length)return[[k,a],[l,b]];var j=i(a,b);if(j){var n=j[0],o=j[1],p=j[2],q=j[3],r=j[4],s=c(n,p),t=c(o,q);return s.concat([[m,r]],t)}return e(a,b)}function e(a,b){for(var c=a.length,d=b.length,e=Math.ceil((c+d)/2),g=e,h=2*e,i=new Array(h),j=new Array(h),m=0;h>m;m++)i[m]=-1,j[m]=-1;i[g+1]=0,j[g+1]=0;for(var n=c-d,o=n%2!=0,p=0,q=0,r=0,s=0,t=0;e>t;t++){for(var u=-t+p;t-q>=u;u+=2){var v,w=g+u;v=u==-t||u!=t&&i[w-1]v&&d>x&&a.charAt(v)==b.charAt(x);)v++,x++;if(i[w]=v,v>c)q+=2;else if(x>d)p+=2;else if(o){var y=g+n-u;if(y>=0&&h>y&&-1!=j[y]){var z=c-j[y];if(v>=z)return f(a,b,v,x)}}}for(var A=-t+r;t-s>=A;A+=2){var z,y=g+A;z=A==-t||A!=t&&j[y-1]z&&d>B&&a.charAt(c-z-1)==b.charAt(d-B-1);)z++,B++;if(j[y]=z,z>c)s+=2;else if(B>d)r+=2;else if(!o){var w=g+n-A;if(w>=0&&h>w&&-1!=i[w]){var v=i[w],x=g+v-w;if(z=c-z,v>=z)return f(a,b,v,x)}}}}return[[k,a],[l,b]]}function f(a,b,d,e){var f=a.substring(0,d),g=b.substring(0,e),h=a.substring(d),i=b.substring(e),j=c(f,g),k=c(h,i);return j.concat(k)}function g(a,b){if(!a||!b||a.charAt(0)!=b.charAt(0))return 0;for(var c=0,d=Math.min(a.length,b.length),e=d,f=0;e>c;)a.substring(f,e)==b.substring(f,e)?(c=e,f=c):d=e,e=Math.floor((d-c)/2+c);return e}function h(a,b){if(!a||!b||a.charAt(a.length-1)!=b.charAt(b.length-1))return 0;for(var c=0,d=Math.min(a.length,b.length),e=d,f=0;e>c;)a.substring(a.length-e,a.length-f)==b.substring(b.length-e,b.length-f)?(c=e,f=c):d=e,e=Math.floor((d-c)/2+c);return e}function i(a,b){function c(a,b,c){for(var d,e,f,i,j=a.substring(c,c+Math.floor(a.length/4)),k=-1,l="";-1!=(k=b.indexOf(j,k+1));){var m=g(a.substring(c),b.substring(k)),n=h(a.substring(0,c),b.substring(0,k));l.length=a.length?[d,e,f,i,l]:null}var d=a.length>b.length?a:b,e=a.length>b.length?b:a;if(d.length<4||2*e.lengthj[4].length?i:j:i;var k,l,m,n;a.length>b.length?(k=f[0],l=f[1],m=f[2],n=f[3]):(m=f[0],n=f[1],k=f[2],l=f[3]);var o=f[4];return[k,l,m,n,o]}function j(a){a.push([m,""]);for(var b,c=0,d=0,e=0,f="",i="";c1?(0!==d&&0!==e&&(b=g(i,f),0!==b&&(c-d-e>0&&a[c-d-e-1][0]==m?a[c-d-e-1][1]+=i.substring(0,b):(a.splice(0,0,[m,i.substring(0,b)]),c++),i=i.substring(b),f=f.substring(b)),b=h(i,f),0!==b&&(a[c][1]=i.substring(i.length-b)+a[c][1],i=i.substring(0,i.length-b),f=f.substring(0,f.length-b))),0===d?a.splice(c-e,d+e,[l,i]):0===e?a.splice(c-d,d+e,[k,f]):a.splice(c-d-e,d+e,[k,f],[l,i]),c=c-d-e+(d?1:0)+(e?1:0)+1):0!==c&&a[c-1][0]==m?(a[c-1][1]+=a[c][1],a.splice(c,1)):c++,e=0,d=0,f="",i=""}""===a[a.length-1][1]&&a.pop();var n=!1;for(c=1;c=0.10"},license:"MIT",scripts:{test:"grunt test"},repository:{type:"git",url:"https://github.com/ottypes/rich-text"},bugs:{url:"https://github.com/ottypes/rich-text/issues"},keywords:["rich text","ot","operational transform","delta"],readme:"# Rich Text [![Build Status](https://travis-ci.org/ottypes/rich-text.svg?branch=master)](http://travis-ci.org/ottypes/rich-text) [![Coverage Status](https://img.shields.io/coveralls/ottypes/rich-text.svg)](https://coveralls.io/r/ottypes/rich-text)\n\nA format for representing rich text documents and changes. It aimes to be intuitive and human readable with the ability to express any change necessary to deal with rich text. A document can also be expressed with this format--as the change from an empty document.\n\n## Quick Example\n\n```js\nvar delta = new Delta([\n { insert: 'Gandalf', attributes: { bold: true } },\n { insert: ' the ' },\n { insert: 'Grey', attributes: { color: '#ccc' } }\n]);\n\n// Keep the first 12 characters, delete the next 4, and insert a white 'White'\nvar death = new Delta().retain(12)\n .delete(4)\n .insert('White', { color: '#fff' });\n// this produces:\n// {\n// ops: [\n// { retain: 12 },\n// { delete: '4 ' },\n// { insert: 'White', attributes: { color: '#fff' } }\n// ]\n// }\n\ndelta.compose(death);\n// delta is now:\n// {\n// ops: [\n// { insert: 'Gandalf ', attributes: { bold: true } },\n// { insert: 'the ' },\n// { insert: 'White', attributes: { color: '#fff' } }\n// ]\n// }\n\n```\n\nThis format is suitable for [Operational Transform](https://en.wikipedia.org/wiki/Operational_transformation) and defines several functions to support this use case.\n\n## Contents\n\n#### [Operations](#operations-1)\n\n- [insert](#insert-operation)\n- [delete](#delete-operation)\n- [retain](#retain-operation)\n\n#### [Deltas](#deltas-1)\n\n- [`constructor`](#constructor)\n- [`insert`](#insert)\n- [`delete`](#delete)\n- [`retain`](#retain)\n- [`length`](#length)\n- [`slice`](#slice)\n- [`compose`](#compose)\n- [`transform`](#transform)\n\n#### [Documents](#documents-1)\n\n- [`diff`](#diff)\n\n\n## Operations\n\nOperations describe a singular change to a document. They can be an [`insert`](#insert-operation), [`delete`](#delete-operation) or [`retain`](#retain-operation). Note operations do not take an index. They always describe the change at the current index. Use retains to \"keep\" or \"skip\" certain parts of the document.\n\n### Insert Operation\n\nInsert operations have an `insert` key defined. A String value represents inserting text. A Number value represents inserting an embed, with the value corresponding to an embed type (such as an image or video).\n\nHere we will use 1 to represent images and 2 to represent videos, but your application can choose whatever mapping is convenient.\n\nIn both cases of text and embeds, an optional `attributes` key can be defined with an Object to describe additonal formatting information. Formats can be changed by the [retain](#retain) operation.\n\n```js\n// Insert a bolded \"Text\"\n{ insert: \"Text\", attributes: { bold: true } }\n\n// Insert a link\n{ insert: \"Google\", attributes: { href: 'https://www.google.com' } }\n\n// Insert an image\n{\n insert: 1,\n attributes: {\n alt: \"Lab Octocat\",\n src: 'https://octodex.github.com/images/labtocat.png'\n }\n}\n\n// Insert a video\n{\n insert: 2,\n attributes: {\n src: \"https://www.youtube.com/watch?v=dMH0bHeiRNg\",\n width: 420,\n height: 315\n }\n}\n```\n\n### Delete Operation\n\nDelete operations have a Number `delete` key defined representing the number of characters to delete. All embeds have a length of 1.\n\n```js\n// Delete the next 10 characters\n{ delete: 10 }\n```\n\n### Retain Operation\n\nRetain operations have a Number `retain` key defined representing the number of characters to keep (other libraries might use the name keep or skip). An optional `attributes` key can be defined with an Object to describe formatting changes to the character range. A value of null in the `attributes` Object represents removal of that key.\n\n*Note: It is not necessary to retain the last characters of a document as this is implied.*\n\n```js\n// Keep the next 5 characters\n{ retain: 5 }\n\n// Keep and bold the next 5 characters\n{ retain: 5, attributes: { bold: true } }\n\n// Keep and unbold the next 5 characters\n// More specifically, remove the bold key in the attributes Object\n// in the next 5 characters\n{ retain: 5, attributes: { bold: null } }\n```\n\n\n## Deltas\n\nA Delta is made up of an array of operations. Unless otherwise specified all methods are self modifying and return `this` for chainability.\n\nAll methods also maintain the property that Deltas are represented in the most compact form. For example two consecutive insert operations of plain text will be merged into one.\n\n---\n\n### constructor\n\nCreates a new Delta object.\n\n#### Methods\n\n- `new Delta()`\n- `new Delta(ops)`\n- `new Delta(delta)`\n\n#### Parameters\n\n- `ops` - Array of operations\n- `delta` - Object with an `ops` key set to an array of operations\n\n*Note: No validity/sanity check is performed when constructed with ops or delta. The new delta's internal ops array will also be assigned to ops or delta.ops without deep copying.*\n\n#### Example\n\n```js\nvar delta = new Delta([\n { insert: 'Hello World' },\n { insert: '!', attributes: { bold: true }}\n]);\n\nvar packet = JSON.stringify(delta);\n\nvar other = new Delta(JSON.parse(packet));\n\nvar chained = new Delta().insert('Hello World').insert('!', { bold: true });\n```\n\n---\n\n### insert()\n\nAppends an insert operation.\n\n#### Methods\n\n- `insert(text, attributes)`\n- `insert(embed, attributes)`\n\n#### Parameters\n\n- `text` - String representing text to insert\n- `embed` - Number representing embed type to insert\n- `attributes` - Optional attributes to apply\n\n#### Example\n\n```js\ndelta.insert('Text', { bold: true, color: '#ccc' });\ndelta.insert(1, { src: 'https://octodex.github.com/images/labtocat.png' });\n```\n\n---\n\n### delete()\n\nAppends a delete operation.\n\n#### Methods\n\n- `delete(length)`\n\n#### Parameters\n\n- `length` - Number of characters to delete\n\n#### Example\n\n```js\ndelta.delete(5);\n```\n\n---\n\n### retain()\n\nAppends a retain operation.\n\n#### Methods\n\n- `retain(length, attributes)`\n\n#### Parameters\n\n- `length` - Number of characters to retain\n- `attributes` - Optional attributes to apply\n\n#### Example\n\n```js\ndelta.retain(4).retain(5, { color: '#0c6' });\n```\n\n---\n\n### length()\n\nReturns length of Delta.\n\n#### Methods\n\n- `length()`\n\n#### Example\n\n```js\nnew Delta().insert('Hello').length(); // Returns 5\n\nnew Delta().insert('A').retain(2).delete(1) // Returns 4\n```\n\n---\n\n### slice()\n\nReturns copy of delta with subset of operations.\n\n#### Methods\n\n- `slice()`\n- `slice(start)`\n- `slice(start, end)`\n\n#### Parameters\n\n- `start` - Start index of subset, defaults to 0\n- `end` - End index of subset, defaults to rest of operations\n\n#### Example\n\n```js\nvar delta = new Delta().insert('Hello', { bold: true }).insert(' World');\n\n// {\n// ops: [\n// { insert: 'Hello', attributes: { bold: true } },\n// { insert: ' World' }\n// ]\n// }\nvar copy = delta.slice();\n\n// { ops: [{ insert: 'World' }] }\nvar world = delta.slice(6);\n\n// { ops: [{ insert: ' ' }] }\nvar space = delta.slice(5, 6);\n```\n\n---\n\n### compose()\n\nCompose with another Delta, i.e. merge the operations of another Delta. This method is self modifying.\n\n#### Methods\n\n- `compose(other)`\n\n#### Parameters\n\n- `other` - Delta to compose\n\n#### Example\n\n```js\nvar a = new Delta().insert('abc');\nvar b = new Delta().retain(1).delete(1);\n\na.compose(b); // a == new Delta().insert('ac');\n```\n\n### transform()\n\nTransform given Delta against own operations.\n\n#### Methods\n\n- `transform(other, priority)`\n- `transform(index)` - Alias for [`transformPosition`](#tranformposition)\n\n#### Parameters\n\n- `other` - Delta to transform\n- `priority` - Boolean used to break ties\n\n#### Returns\n\n- `Delta` - transformed Delta\n\n#### Example\n\n```js\nvar a = new Delta().insert('a');\nvar b = new Delta().insert('b');\n\nb = a.transform(b, true); // new Delta().retain(1).insert('b');\n```\n\n---\n\n### transformPosition()\n\nTransform an index against the delta. Useful for representing cursor/selection positions.\n\n#### Methods\n\n- `transformPosition(index)`\n\n#### Parameters\n\n- `index` - index to transform\n\n#### Returns\n\n- `Number` - transformed index\n\n#### Example\n\n```js\nvar index = 12;\nvar transformedIndex = delta.transformPosition(index);\n```\n\n\n## Documents\n\nA Delta with only insert operations can be used to represent a rich text document. This can be thought of as a Delta applied to an empty document.\n\n---\n\n### diff()\n\nCalculates the difference between two documents expressed as a Delta.\n\n#### Methods\n\n- `diff(other)`\n\n#### Parameters\n\n- `other` - Document Delta to diff against\n\n#### Returns\n\n- `Delta` - difference between the two documents\n\n#### Example\n\n```js\nvar a = new Delta().insert('Hello');\nvar b = new Delta().insert('Hello!');\n\nvar diff = a.diff(b); // { ops: [{ retain: 5 }, { insert: '!' }] }\n```\n",readmeFilename:"README.md",_id:"rich-text@1.0.2",_from:"rich-text@~1.0.2"} +},{}],11:[function(a,b){b.exports={name:"quilljs",version:"0.18.1",description:"Cross browser rich text editor",author:"Jason Chen ",homepage:"http://quilljs.com",contributors:["Byron Milligan ","Keegan Poppen "],main:"index.js",dependencies:{eventemitter2:"~0.4.13",lodash:"~2.4.1","rich-text":"~1.0.2"},devDependencies:{async:"~0.9.0","coffee-script":"~1.8.0",coffeeify:"~0.7.0",glob:"~4.0.4",grunt:"~0.4.3","grunt-browserify":"~2.1.0","grunt-contrib-clean":"~0.6.0","grunt-contrib-coffee":"~0.12.0","grunt-contrib-compress":"~0.12.0","grunt-contrib-concat":"~0.5.0","grunt-contrib-connect":"~0.8.0","grunt-contrib-copy":"~0.7.0","grunt-contrib-stylus":"~0.18.0","grunt-contrib-uglify":"~0.6.0","grunt-karma":"~0.9.0","grunt-lodash":"~0.3.0","grunt-protractor-runner":"~1.1.0","grunt-sauce-connect-launcher":"~0.3.0",harp:"~0.14.0",istanbul:"~0.3.0",jquery:"~2.1.1",karma:"~0.12.0","karma-chrome-launcher":"~0.1.2","karma-coffee-preprocessor":"~0.2.1","karma-coverage":"~0.2.0","karma-firefox-launcher":"~0.1.3","karma-html2js-preprocessor":"~0.1.0","karma-jasmine":"~0.2.0","karma-phantomjs-launcher":"~0.1.2","karma-safari-launcher":"~0.1.1","karma-sauce-launcher":"~0.2.2","load-grunt-tasks":"~0.6.0",protractor:"~1.3.1",stylus:"~0.49.2",watchify:"~0.10.2"},engines:{node:">=0.10"},license:"BSD-3-Clause",repository:{type:"git",url:"https://github.com/quilljs/quill"},bugs:{url:"https://github.com/quilljs/quill/issues"},scripts:{prepublish:"grunt coffee:quill",postpublish:"grunt clean:coffee",test:"grunt test"},keywords:["editor","rich text","wysiwyg"]}},{}],12:[function(a,b){var c,d,e,f,g,h,i,j;j=a("lodash"),c=a("rich-text").Delta,i=a("../lib/dom"),e=a("./format"),f=a("./line"),g=a("../lib/linked-list"),h=a("../lib/normalizer"),d=function(){function a(a,b){this.root=a,null==b&&(b={}),this.formats={},j.each(b.formats,j.bind(this.addFormat,this)),this.setHTML(this.root.innerHTML)}return a.prototype.addFormat=function(a,b){return j.isObject(b)||(b=e.FORMATS[a]),null!=this.formats[a]&&console.warn("Overwriting format",a,this.formats[a]),this.formats[a]=new e(this.root.ownerDocument,b)},a.prototype.appendLine=function(a){return this.insertLineBefore(a,null)},a.prototype.findLeafAt=function(a,b){var c,d,e;return e=this.findLineAt(a),c=e[0],d=e[1],null!=c?c.findLeafAt(d,b):[null,d]},a.prototype.findLine=function(a){for(var b;null!=a&&null==i.BLOCK_TAGS[a.tagName];)a=a.parentNode;return b=null!=a?this.lineMap[a.id]:null,(null!=b?b.node:void 0)===a?b:null},a.prototype.findLineAt=function(a){var b,c;if(!(this.lines.length>0))return[null,a];if(c=this.toDelta().length(),a===c)return[this.lines.last,this.lines.last.length];if(a>c)return[null,a-c];for(b=this.lines.first;null!=b;){if(a1&&(1===a.length&&i(a.leaves.last.node).remove(),j.each(i(b.node).childNodes(),function(b){return b.tagName!==i.DEFAULT_BREAK_TAG?a.node.appendChild(b):void 0})),this.removeLine(b),a.rebuild()},a.prototype.optimizeLines=function(){return j.each(this.lines.toArray(),function(a){return a.optimize(),!0})},a.prototype.rebuild=function(){var a,b,c;for(b=this.lines.toArray(),a=this.root.firstChild,null!=a&&null!=i.LIST_TAGS[a.tagName]&&(a=a.firstChild),j.each(b,function(b){return function(c){for(var d,e;c.node!==a;){if(c.node.parentNode!==b.root&&(null!=(e=c.node.parentNode)?e.parentNode:void 0)!==b.root)return b.removeLine(c);a=h.normalizeLine(a),d=b.insertLineBefore(a,c),a=i(a).nextLineNode(b.root)}return c.outerHTML!==a.outerHTML&&(c.node=h.normalizeLine(c.node),c.rebuild()),a=i(a).nextLineNode(b.root)}}(this)),c=[];null!=a;)a=h.normalizeLine(a),this.appendLine(a),c.push(a=i(a).nextLineNode(this.root));return c},a.prototype.removeLine=function(a){return null!=a.node.parentNode&&(i.LIST_TAGS[a.node.parentNode.tagName]&&1===a.node.parentNode.childNodes.length?i(a.node.parentNode).remove():i(a.node).remove()),delete this.lineMap[a.id],this.lines.remove(a)},a.prototype.setHTML=function(a){return a=h.stripComments(a),a=h.stripWhitespace(a),this.root.innerHTML=a,this.lines=new g,this.lineMap={},this.rebuild()},a.prototype.splitLine=function(a,b){var c,d,e,f;return b=Math.min(b,a.length-1),f=i(a.node).split(b,!0),c=f[0],d=f[1],a.node=c,a.rebuild(),e=this.insertLineBefore(d,a.next),e.formats=j.clone(a.formats),e.resetContent(),e},a.prototype.toDelta=function(){var a,b;return b=this.lines.toArray(),a=new c,b.forEach(function(b){return b.delta.ops.forEach(function(b){return a.push(b)})}),a},a}(),b.exports=d},{"../lib/dom":21,"../lib/linked-list":22,"../lib/normalizer":23,"./format":14,"./line":16,lodash:"M4+//f","rich-text":4}],13:[function(a,b){var c,d,e,f,g,h,i;i=a("lodash"),h=a("../lib/dom"),c=a("./document"),e=a("./line"),f=a("./renderer"),g=a("./selection"),d=function(){function a(a,b,d){this.iframeContainer=a,this.quill=b,this.options=null!=d?d:{},this.renderer=new f(this.iframeContainer,this.options),h(this.iframeContainer).on("focus",this.focus.bind(this)),this.root=this.renderer.root,this.doc=new c(this.root,this.options),this.delta=this.doc.toDelta(),this.selection=new g(this.doc,this.renderer.iframe,this.quill),this.timer=setInterval(i.bind(this.checkUpdate,this),this.options.pollInterval),this.options.readOnly||this.enable()}return a.sources={API:"api",SILENT:"silent",USER:"user"},a.prototype.disable=function(){return this.enable(!1)},a.prototype.enable=function(a){return null==a&&(a=!0),this.root.setAttribute("contenteditable",a)},a.prototype.applyDelta=function(b,c){var d;return d=this._update(),d&&(b=d.transform(b,!0),d=b.transform(d,!1)),b.ops.length>0&&(b=this._trackDelta(function(a){return function(){var c;return c=0,i.each(b.ops,function(b){return i.isString(b.insert)?(a._insertAt(c,b.insert,b.attributes),c+=b.insert.length):i.isNumber(b.insert)?(a._insertAt(c,h.EMBED_TEXT,b.attributes),c+=1):i.isNumber(b["delete"])?a._deleteAt(c,b["delete"]):i.isNumber(b.retain)?(i.each(b.attributes,function(d,e){return a._formatAt(c,b.retain,e,d)}),c+=b.retain):void 0}),a.selection.shiftAfter(0,0,i.bind(a.doc.optimizeLines,a.doc))}}(this)),this.delta=this.doc.toDelta(),this.innerHTML=this.root.innerHTML,b&&c!==a.sources.SILENT&&this.quill.emit(this.quill.constructor.events.TEXT_CHANGE,b,c)),d&&d.ops.length>0&&c!==a.sources.SILENT?this.quill.emit(this.quill.constructor.events.TEXT_CHANGE,d,a.sources.USER):void 0},a.prototype.checkUpdate=function(b){var c;return null==b&&(b="user"),null==this.renderer.iframe.parentNode||null==this.root.parentNode?clearInterval(this.timer):(c=this._update(),c&&(this.delta.compose(c),this.quill.emit(this.quill.constructor.events.TEXT_CHANGE,c,b)),c&&(b=a.sources.SILENT),this.selection.update(b))},a.prototype.focus=function(){return h.isIE(11)&&this.selection.setRange(this.selection.range),h.isIOS()&&this.renderer.iframe.focus(),this.root.focus()},a.prototype.getDelta=function(){return this.delta},a.prototype._deleteAt=function(a,b){return 0>=b?void 0:this.selection.shiftAfter(a,-1*b,function(c){return function(){var d,e,f,g,h,i,j;for(j=c.doc.findLineAt(a),f=j[0],i=j[1],d=f,g=f.length-i<=b&&i>0;null!=d&&b>0;)h=d.next,e=Math.min(d.length-i,b),0===i&&b>=d.length?c.doc.removeLine(d):d.deleteText(i,e),b-=e,d=h,i=0;return g&&f.next?c.doc.mergeLines(f,f.next):void 0}}(this))},a.prototype._formatAt=function(a,b,c,d){return this.selection.shiftAfter(a,0,function(e){return function(){var f,g,h,i,j;for(i=e.doc.findLineAt(a),g=i[0],h=i[1],j=[];null!=g&&b>0;)f=Math.min(b,g.length-h-1),g.formatText(h,f,c,d),b-=f,b>0&&g.format(c,d),b-=1,h=0,j.push(g=g.next);return j}}(this))},a.prototype._insertAt=function(a,b,c){return null==c&&(c={}),this.selection.shiftAfter(a,b.length,function(d){return function(){var e,f,g,j;return b=b.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),f=b.split("\n"),j=d.doc.findLineAt(a),e=j[0],g=j[1],i.each(f,function(a,b){var j;return null==e||e.length<=g?(b0)&&(e=d.doc.appendLine(d.root.ownerDocument.createElement(h.DEFAULT_BLOCK_TAG)),g=0,e.insertText(g,a,c),e.format(c),j=null):(e.insertText(g,a,c),b0?a:!1)},a}(),b.exports=d},{"../lib/dom":21,"./document":12,"./line":16,"./renderer":17,"./selection":18,lodash:"M4+//f"}],14:[function(a,b){var c,d,e;e=a("lodash"),d=a("../lib/dom"),c=function(){function a(a,b){this.document=a,this.config=b}return a.types={LINE:"line"},a.FORMATS={bold:{tag:"B",prepare:"bold"},italic:{tag:"I",prepare:"italic"},underline:{tag:"U",prepare:"underline"},strike:{tag:"S",prepare:"strikeThrough"},color:{style:"color","default":"rgb(0, 0, 0)",prepare:"foreColor"},background:{style:"backgroundColor","default":"rgb(255, 255, 255)",prepare:"backColor"},font:{style:"fontFamily","default":"'Helvetica', 'Arial', sans-serif",prepare:"fontName"},size:{style:"fontSize","default":"13px",prepare:function(a,b){return a.execCommand("fontSize",!1,d.convertFontSize(b))}},link:{tag:"A",attribute:"href"},image:{tag:"IMG",attribute:"src"},align:{type:a.types.LINE,style:"textAlign","default":"left"},bullet:{type:a.types.LINE,exclude:"list",parentTag:"UL",tag:"LI"},list:{type:a.types.LINE,exclude:"bullet",parentTag:"OL",tag:"LI"}},a.prototype.add=function(b,c){var f,g,h,i,j;return c?this.value(b)===c?b:(e.isString(this.config.parentTag)&&(h=this.document.createElement(this.config.parentTag),d(b).wrap(h),b.parentNode.tagName===(null!=(i=b.parentNode.previousSibling)?i.tagName:void 0)&&d(b.parentNode.previousSibling).merge(b.parentNode),b.parentNode.tagName===(null!=(j=b.parentNode.nextSibling)?j.tagName:void 0)&&d(b.parentNode).merge(b.parentNode.nextSibling)),e.isString(this.config.tag)&&(f=this.document.createElement(this.config.tag),null!=d.VOID_TAGS[f.tagName]?(null!=b.parentNode&&d(b).replace(f),b=f):this.isType(a.types.LINE)?b=d(b).switchTag(this.config.tag):(d(b).wrap(f),b=f)),(e.isString(this.config.style)||e.isString(this.config.attribute)||e.isString(this.config["class"]))&&(e.isString(this.config["class"])&&(b=this.remove(b)),d(b).isTextNode()&&(g=this.document.createElement(d.DEFAULT_INLINE_TAG),d(b).wrap(g),b=g),e.isString(this.config.style)&&c!==this.config["default"]&&(b.style[this.config.style]=c),e.isString(this.config.attribute)&&b.setAttribute(this.config.attribute,c),e.isString(this.config["class"])&&d(b).addClass(this.config["class"]+c)),b):this.remove(b)},a.prototype.isType=function(a){return a===this.config.type},a.prototype.match=function(a){var b,c,f,g,h;if(!d(a).isElement())return!1;if(e.isString(this.config.parentTag)&&(null!=(g=a.parentNode)?g.tagName:void 0)!==this.config.parentTag)return!1;if(e.isString(this.config.tag)&&a.tagName!==this.config.tag)return!1;if(e.isString(this.config.style)&&(!a.style[this.config.style]||a.style[this.config.style]===this.config["default"]))return!1;if(e.isString(this.config.attribute)&&!a.hasAttribute(this.config.attribute))return!1;if(e.isString(this.config["class"])){for(h=d(a).classes(),c=0,f=h.length;f>c;c++)if(b=h[c],0===b.indexOf(this.config["class"]))return!0;return!1}return!0},a.prototype.prepare=function(a){return e.isString(this.config.prepare)?this.document.execCommand(this.config.prepare,!1,a):e.isFunction(this.config.prepare)?this.config.prepare(this.document,a):void 0},a.prototype.remove=function(b){var c,f,g,h;if(!this.match(b))return b;if(e.isString(this.config.style)&&(b.style[this.config.style]="",b.getAttribute("style")||b.removeAttribute("style")),e.isString(this.config.attribute)&&b.removeAttribute(this.config.attribute),e.isString(this.config["class"])){for(h=d(b).classes(),f=0,g=h.length;g>f;f++)c=h[f],0===c.indexOf(this.config["class"])&&d(b).removeClass(c);b.getAttribute("class")||b.removeAttribute("class")}return e.isString(this.config.tag)&&(this.isType(a.types.LINE)?(e.isString(this.config.parentTag)&&(null!=b.previousSibling&&d(b).splitAncestors(b.parentNode.parentNode),null!=b.nextSibling&&d(b.nextSibling).splitAncestors(b.parentNode.parentNode)),b=d(b).switchTag(d.DEFAULT_BLOCK_TAG)):(b=d(b).switchTag(d.DEFAULT_INLINE_TAG),null!=d.EMBED_TAGS[this.config.tag]&&d(b).text(d.EMBED_TEXT))),e.isString(this.config.parentTag)&&d(b.parentNode).unwrap(),b.tagName!==d.DEFAULT_INLINE_TAG||b.hasAttributes()||(b=d(b).unwrap()),b},a.prototype.value=function(a){var b,c,f,g;if(!this.match(a))return void 0;if(e.isString(this.config.attribute))return a.getAttribute(this.config.attribute)||void 0;if(e.isString(this.config.style))return a.style[this.config.style]||void 0;if(e.isString(this.config["class"])){for(g=d(a).classes(),c=0,f=g.length;f>c;c++)if(b=g[c],0===b.indexOf(this.config["class"]))return b.slice(this.config["class"].length)}else if(e.isString(this.config.tag))return!0;return void 0},a}(),b.exports=c},{"../lib/dom":21,lodash:"M4+//f"}],15:[function(a,b){var c,d,e,f,g,h={}.hasOwnProperty,i=function(a,b){function c(){this.constructor=a}for(var d in b)h.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};g=a("lodash"),f=a("../lib/dom"),c=a("./format"),e=a("../lib/linked-list"),d=function(a){function b(a,c){this.node=a,this.formats=g.clone(c),this.id=g.uniqueId(b.ID_PREFIX),this.text=f(this.node).text(),this.length=this.text.length}return i(b,a),b.ID_PREFIX="leaf-",b.isLeafNode=function(a){return f(a).isTextNode()||null==a.firstChild},b.prototype.deleteText=function(a,b){var c;if(b>0)return this.text=this.text.slice(0,a)+this.text.slice(a+b),this.length=this.text.length,null!=f.EMBED_TAGS[this.node.tagName]?(c=this.node.ownerDocument.createTextNode(this.text),this.node=f(this.node).replace(c)):f(this.node).text(this.text)},b.prototype.insertText=function(a,b){var c;return this.text=this.text.slice(0,a)+b+this.text.slice(a),f(this.node).isTextNode()?f(this.node).text(this.text):(c=this.node.ownerDocument.createTextNode(b),this.node.tagName===f.DEFAULT_BREAK_TAG?this.node=f(this.node).replace(c):(this.node.appendChild(c),this.node=c)),this.length=this.text.length},b}(e.Node),b.exports=d},{"../lib/dom":21,"../lib/linked-list":22,"./format":14,lodash:"M4+//f"}],16:[function(a,b){var c,d,e,f,g,h,i,j,k={}.hasOwnProperty,l=function(a,b){function c(){this.constructor=a}for(var d in b)k.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};j=a("lodash"),c=a("rich-text").Delta,i=a("../lib/dom"),d=a("./format"),e=a("./leaf"),f=a("./line"),g=a("../lib/linked-list"),h=a("../lib/normalizer"),f=function(a){function b(a,c){this.doc=a,this.node=c,this.id=j.uniqueId(b.ID_PREFIX),this.formats={},i(this.node).addClass(b.CLASS_NAME),this.rebuild(),b.__super__.constructor.call(this,this.node)}return l(b,a),b.CLASS_NAME="line",b.ID_PREFIX="line-",b.prototype.buildLeaves=function(a,b){return j.each(i(a).childNodes(),function(a){return function(c){var f;return c=h.normalizeNode(c),f=j.clone(b),j.each(a.doc.formats,function(a,b){return!a.isType(d.types.LINE)&&a.match(c)?f[b]=a.value(c):void 0}),e.isLeafNode(c)?a.leaves.append(new e(c,f)):a.buildLeaves(c,f)}}(this))},b.prototype.deleteText=function(a,b){var c,d,e;if(b>0){for(e=this.findLeafAt(a),d=e[0],a=e[1];null!=d&&b>0;)c=Math.min(b,d.length-a),d.deleteText(a,c),b-=c,d=d.next,a=0;return this.rebuild()}},b.prototype.findLeaf=function(a){var b;for(b=this.leaves.first;null!=b;){if(b.node===a)return b;b=b.next}return null},b.prototype.findLeafAt=function(a,b){var c;if(null==b&&(b=!1),a>=this.length-1)return[this.leaves.last,this.leaves.last.length];for(c=this.leaves.first;null!=c;){if(a0;){if(k=g.next,e&&g.formats[c]!==e||!e&&null!=g.formats[c]){if(m=g.node,null!=g.formats[c])for(i(m).splitAncestors(this.node);!f.match(m);)m=m.parentNode;h>0&&(o=i(m).split(h),j=o[0],m=o[1]),g.length>h+b&&(p=i(m).split(b),m=p[0],l=p[1]),f.add(m,e)}b-=g.length-h,h=0,g=k}return this.rebuild()}},b.prototype.insertText=function(a,b,c){var d,e,f,g,h,k,l;return null==c&&(c={}),b.length>0?(k=this.findLeafAt(a),d=k[0],e=k[1],j.isEqual(d.formats,c)?(d.insertText(e,b),this.resetContent()):(g=j.reduce(c,function(a){return function(b,c,d){return a.doc.formats[d].add(b,c)}}(this),this.node.ownerDocument.createTextNode(b)),l=i(d.node).split(e),h=l[0],f=l[1],f&&(f=i(f).splitAncestors(this.node).get()),this.node.insertBefore(g,f),this.rebuild())):void 0},b.prototype.optimize=function(){return h.optimizeLine(this.node),this.rebuild()},b.prototype.rebuild=function(a){return null==a&&(a=!1),!a&&null!=this.outerHTML&&this.outerHTML===this.node.outerHTML&&j.all(this.leaves.toArray(),function(a){return function(b){return i(b.node).isAncestor(a.node)}}(this))?!1:(this.node=h.normalizeNode(this.node),0!==i(this.node).length()||this.node.querySelector(i.DEFAULT_BREAK_TAG)||this.node.appendChild(this.node.ownerDocument.createElement(i.DEFAULT_BREAK_TAG)),this.leaves=new g,this.formats=j.reduce(this.doc.formats,function(a){return function(b,c,e){return c.isType(d.types.LINE)&&(c.match(a.node)?b[e]=c.value(a.node):delete b[e]),b}}(this),this.formats),this.buildLeaves(this.node,{}),this.resetContent(),!0)},b.prototype.resetContent=function(){return this.node.id!==this.id&&(this.node.id=this.id),this.outerHTML=this.node.outerHTML,this.length=1,this.delta=new c,this.leaves.toArray().forEach(function(a){return function(b){return a.length+=b.length,null!=i.EMBED_TAGS[b.node.tagName]?a.delta.insert(1,b.formats):a.delta.insert(b.text,b.formats)}}(this)),this.delta.insert("\n",this.formats)},b}(g.Node),b.exports=f},{"../lib/dom":21,"../lib/linked-list":22,"../lib/normalizer":23,"./format":14,"./leaf":15,"./line":16,lodash:"M4+//f","rich-text":4}],17:[function(a,b){var c,d,e,f,g,h,i;i=a("lodash"),g=a("../lib/dom"),e=a("../lib/normalizer"),c={html:{height:"100%",width:"100%"},body:{"box-sizing":"border-box",cursor:"text","font-family":"'Helvetica', 'Arial', sans-serif","font-size":"13px",height:"100%","line-height":"1.42",margin:"0px","overflow-x":"hidden","overflow-y":"auto",padding:"12px 15px"},".editor-container":{height:"100%",outline:"none",position:"relative","tab-size":"4","white-space":"pre-wrap"},".editor-container div":{margin:"0",padding:"0"},".editor-container a":{"text-decoration":"underline"},".editor-container b":{"font-weight":"bold"},".editor-container i":{"font-style":"italic"},".editor-container s":{"text-decoration":"line-through"},".editor-container u":{"text-decoration":"underline"},".editor-container img":{"max-width":"100%"},".editor-container blockquote":{margin:"0 0 0 2em",padding:"0"},".editor-container ol":{margin:"0 0 0 2em",padding:"0","list-style-type":"decimal"},".editor-container ul":{margin:"0 0 0 2em",padding:"0","list-style-type":"disc"}},d=["decimal","lower-alpha","lower-roman"],h=".editor-container ol > li",i.each([1,2,3,4,5,6,7,8,9],function(a){return h+=" > ol",c[h]={"list-style-type":d[a%3]},h+=" > li"}),g.isIE(10)&&(c[g.DEFAULT_BREAK_TAG]={display:"none"}),f=function(){function a(b,d){var e;this.container=b,this.options=null!=d?d:{},this.container.innerHTML="",e=a.buildFrame(this.container),this.root=e[0],this.iframe=e[1],this.root.setAttribute("id",this.options.id),this.iframe.setAttribute("name",this.options.id),g(this.root).addClass("editor-container"),g(this.container).addClass("ql-container"),g.isIOS()&&g(this.container).styles({overflow:"auto","-webkit-overflow-scrolling":"touch"}),this.addStyles(c),null!=this.options.styles&&i.defer(i.bind(this.addStyles,this,this.options.styles))}return a.objToCss=function(a){return i.map(a,function(a,b){var c;return c=i.map(a,function(a,b){return""+b+": "+a+";"}).join(" "),""+b+" { "+c+" }"}).join("\n")},a.buildFrame=function(a){var b,c,d;return b=a.ownerDocument.createElement("iframe"),g(b).attributes({frameBorder:"0",height:"100%",width:"100%",title:"Quill Rich Text Editor",role:"presentation"}),a.appendChild(b),c=b.contentWindow.document,c.open(),c.write(""),c.close(),d=c.createElement("div"),c.body.appendChild(d),[d,b]},a.prototype.addContainer=function(a,b){var c,d;return null==b&&(b=!1),d=b?this.root:null,c=this.root.ownerDocument.createElement("div"),g(c).addClass(a),this.root.parentNode.insertBefore(c,d),c},a.prototype.addStyles=function(b){var c,d;return"object"==typeof b?(d=this.root.ownerDocument.createElement("style"),d.type="text/css",b=a.objToCss(b),d.appendChild(this.root.ownerDocument.createTextNode(b)),this.root.ownerDocument.head.appendChild(d)):"string"==typeof b?(c=this.root.ownerDocument.createElement("link"),g(c).attributes({type:"text/css",rel:"stylesheet",href:b}),this.root.ownerDocument.head.appendChild(c)):void 0},a}(),b.exports=f},{"../lib/dom":21,"../lib/normalizer":23,lodash:"M4+//f"}],18:[function(a,b){var c,d,e,f,g,h;h=a("lodash"),g=a("../lib/dom"),c=a("./leaf"),d=a("../lib/normalizer"),e=a("../lib/range"),f=function(){function a(a,b,c){this.doc=a,this.iframe=b,this.emitter=c,this.document=this.doc.root.ownerDocument,this.focus=!1,this.range=new e(0,0),this.nullDelay=!1,this.update("silent")}return a.prototype.checkFocus=function(){return this.document.activeElement===this.doc.root&&document.activeElement===this.iframe},a.prototype.getRange=function(a){var b,c,d;return null==a&&(a=!1),this.checkFocus()?(c=this._getNativeRange(),null==c?null:(d=this._positionToIndex(c.startContainer,c.startOffset),b=c.startContainer===c.endContainer&&c.startOffset===c.endOffset?d:this._positionToIndex(c.endContainer,c.endOffset),new e(Math.min(d,b),Math.max(d,b)))):a?this.range:null},a.prototype.preserve=function(a){var b,c,d,e,f,g,h,i,j;return d=this._getNativeRange(),null!=d&&this.checkFocus()?(g=this._encodePosition(d.startContainer,d.startOffset),e=g[0],f=g[1],h=this._encodePosition(d.endContainer,d.endOffset),b=h[0],c=h[1],a(),i=this._decodePosition(e,f),e=i[0],f=i[1],j=this._decodePosition(b,c),b=j[0],c=j[1],this._setNativeRange(e,f,b,c)):a()},a.prototype.setRange=function(a,b){var c,d,e,f,g,h,i;return null!=a?(g=this._indexToPosition(a.start),e=g[0],f=g[1],a.isCollapsed()?(h=[e,f],c=h[0],d=h[1]):(i=this._indexToPosition(a.end),c=i[0],d=i[1]),this._setNativeRange(e,f,c,d)):this._setNativeRange(null),this.update(b)},a.prototype.shiftAfter=function(a,b,c){var d;return d=this.getRange(),c(),null!=d?(d.shift(a,b),this.setRange(d,"silent")):void 0},a.prototype.update=function(a){var b,c,d,f;return c=this.checkFocus(),d=this.getRange(!0),b="silent"!==a&&(!e.compare(d,this.range)||c!==this.focus),f=c?d:null,null!==f||"user"!==a||this.nullDelay?(this.nullDelay=!1,this.range=d,this.focus=c,b?this.emitter.emit(this.emitter.constructor.events.SELECTION_CHANGE,f,a):void 0):this.nullDelay=!0},a.prototype._decodePosition=function(a,b){var c;return g(a).isElement()&&(c=h.indexOf(g(a.parentNode).childNodes(),a),b+=c,a=a.parentNode),[a,b]},a.prototype._encodePosition=function(a,b){for(var c;;){if(g(a).isTextNode()||a.tagName===g.DEFAULT_BREAK_TAG||null!=g.EMBED_TAGS[a.tagName])return[a,b];if(b0&&(a=b.getRangeAt(0),g(a.startContainer).isAncestor(this.doc.root,!0)&&(a.startContainer===a.endContainer||g(a.endContainer).isAncestor(this.doc.root,!0)))?a:null},a.prototype._indexToPosition=function(a){var b,c,d;return 0===this.doc.lines.length?[this.doc.root,0]:(d=this.doc.findLeafAt(a,!0),b=d[0],c=d[1],this._decodePosition(b.node,c))},a.prototype._positionToIndex=function(a,b){var c,d,e,f,g,h;if(h=this._encodePosition(a,b),d=h[0],b=h[1],f=this.doc.findLine(d),null==f)return 0;for(c=f.findLeaf(d),g=0;null!=f.prev;)f=f.prev,g+=f.length;if(null==c)return g;for(e=0;null!=c.prev;)c=c.prev,e+=c.length;return g+e+b},a.prototype._setNativeRange=function(a,b,c,d){var e,f;return(f=this.document.getSelection())?null==a?(f.removeAllRanges(),this.doc.root.blur()):(this.checkFocus()||this.doc.root.focus(),e=this._getNativeRange(),null!=e&&a===e.startContainer&&b===e.startOffset&&c===e.endContainer&&d===e.endOffset||(f.removeAllRanges(),e=this.document.createRange(),e.setStart(a,b),e.setEnd(c,d),f.addRange(e),this.checkFocus())?void 0:this.doc.root.focus()):void 0},a}(),b.exports=f},{"../lib/dom":21,"../lib/normalizer":23,"../lib/range":25,"./leaf":15,lodash:"M4+//f"}],19:[function(a,b){a("./modules/authorship"),a("./modules/image-tooltip"),a("./modules/keyboard"),a("./modules/link-tooltip"),a("./modules/multi-cursor"),a("./modules/paste-manager"),a("./modules/toolbar"),a("./modules/tooltip"),a("./modules/undo-manager"),b.exports=a("./quill")},{"./modules/authorship":26,"./modules/image-tooltip":27,"./modules/keyboard":28,"./modules/link-tooltip":29,"./modules/multi-cursor":30,"./modules/paste-manager":31,"./modules/toolbar":32,"./modules/tooltip":33,"./modules/undo-manager":34,"./quill":35}],20:[function(a,b){var c,d,e,f={}.hasOwnProperty,g=function(a,b){function c(){this.constructor=a}for(var d in b)f.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};e=a("./dom"),d=a("./picker"),c=function(a){function b(){b.__super__.constructor.apply(this,arguments),e(this.container).addClass("ql-color-picker")}return g(b,a),b.prototype.buildItem=function(a,c,d){var e;return e=b.__super__.buildItem.call(this,a,c,d),e.style.backgroundColor=c.value,e},b}(d),b.exports=c},{"./dom":21,"./picker":24}],21:[function(a,b){var c,d,e,f,g,h=function(a,b){return function(){return a.apply(b,arguments)}},i={}.hasOwnProperty,j=function(a,b){function c(){this.constructor=a}for(var d in b)i.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};g=a("lodash"),f=null,d=function(){function a(a){this.node=a,this.trigger=h(this.trigger,this)}return a.prototype.addClass=function(a){return this.hasClass(a)?void 0:(null!=this.node.classList?this.node.classList.add(a):null!=this.node.className&&(this.node.className=(this.node.className+" "+a).trim()),this)},a.prototype.attributes=function(a){var b,c,d,e,f,h;if(a)return g.each(a,function(a){return function(b,c){return a.node.setAttribute(c,b)}}(this)),this;if(null==this.node.attributes)return{};for(a={},h=this.node.attributes,c=e=0,f=h.length;f>e;c=++e)d=h[c],b=this.node.attributes[c],a[b.name]=b.value;return a},a.prototype.child=function(a){var b,c;for(b=this.node.firstChild,c=e(b).length();null!=b&&!(c>a);)a-=c,b=b.nextSibling,c=e(b).length();return null==b&&(b=this.node.lastChild,a=e(b).length()),[b,a]},a.prototype.childNodes=function(){return g.map(this.node.childNodes)},a.prototype.classes=function(){return this.node.className.split(/\s+/)},a.prototype.descendants=function(){return g.map(this.node.getElementsByTagName("*"))},a.prototype.get=function(){return this.node},a.prototype.hasClass=function(a){return null!=this.node.classList?this.node.classList.contains(a):null!=this.node.className?g.indexOf(this.classes(),a)>-1:!1},a.prototype.isAncestor=function(a,b){var c;if(null==b&&(b=!1),a===this.node)return b;for(c=this.node;c;){if(c===a)return!0;c=c.parentNode}return!1},a.prototype.isElement=function(){var a;return(null!=(a=this.node)?a.nodeType:void 0)===e.ELEMENT_NODE},a.prototype.isTextNode=function(){var a;return(null!=(a=this.node)?a.nodeType:void 0)===e.TEXT_NODE},a.prototype.length=function(){var a;return null==this.node?0:(a=this.text().length,this.isElement()&&(a+=this.node.querySelectorAll(g.keys(e.EMBED_TAGS).join(",")).length),a)},a.prototype.merge=function(a){var b;return b=e(a),this.isElement()?(b.moveChildren(this.node),this.normalize()):this.text(this.text()+b.text()),b.remove(),this},a.prototype.moveChildren=function(a){return g.each(this.childNodes(),function(b){return a.appendChild(b)}),this},a.prototype.nextLineNode=function(a){var b;return b=this.node.nextSibling,null==b&&this.node.parentNode!==a&&(b=this.node.parentNode.nextSibling),null!=b&&null!=e.LIST_TAGS[b.tagName]&&(b=b.firstChild),b},a.prototype.normalize=function(){var a,b,c,d;for(b=this.node.firstChild;null!=b;)d=b.nextSibling,a=e(b),null!=d&&e(d).isTextNode()&&(0===a.text().length?a.remove():a.isTextNode()&&(c=d.nextSibling,a.merge(d),d=c)),b=d;return this},a.prototype.on=function(a,b){return this.node.addEventListener(a,function(c){return function(d){var e,g;return e=!f||"keydown"!==a&&"keyup"!==a?d:f,g=b.call(c.node,e),g||(d.preventDefault(),d.stopPropagation()),g}}(this)),this},a.prototype.remove=function(){var a;return null!=(a=this.node.parentNode)&&a.removeChild(this.node),this.node=null,null},a.prototype.removeClass=function(a){var b;if(this.hasClass(a))return null!=this.node.classList?this.node.classList.remove(a):(null!=this.node.className&&(b=this.classes(),b.splice(g.indexOf(b,a),1),this.node.className=b.join(" ")),this)},a.prototype.replace=function(a){return this.node.parentNode.replaceChild(a,this.node),this.node=a,a},a.prototype.splitAncestors=function(a,b){var c,d,f,g;if(null==b&&(b=!1),this.node===a||this.node.parentNode===a)return this;if(null!=this.node.previousSibling||b){for(f=this.node.parentNode,d=f.cloneNode(!1),f.parentNode.insertBefore(d,f.nextSibling),g=this.node;null!=g;)c=g.nextSibling,d.appendChild(g),g=c;return e(d).splitAncestors(a)}return e(this.node.parentNode).splitAncestors(a)},a.prototype.split=function(a,b){var c,d,f,g,h,i,j,k,l,m;if(null==b&&(b=!1),j=this.length(),a=Math.max(0,a),a=Math.min(a,j),!b&&0===a)return[this.node.previousSibling,this.node,!1];if(!b&&a===j)return[this.node,this.node.nextSibling,!1];if(this.node.nodeType===e.TEXT_NODE)return c=this.node.splitText(a),[this.node,c,!0];for(h=this.node,k=this.node.cloneNode(!1),this.node.parentNode.insertBefore(k,h.nextSibling),l=this.child(a),d=l[0],a=l[1],m=e(d).split(a),f=m[0],g=m[1];null!==g;)i=g.nextSibling,k.appendChild(g),g=i;return[h,k,!0]},a.prototype.styles=function(a,b){var c,d;return null==b&&(b=!1),a?(b||(a=g.defaults(a,this.styles())),d=g.map(a,function(a,b){return""+b+": "+a}).join("; ")+";",this.node.setAttribute("style",d),this):(d=this.node.getAttribute("style")||"",c=g.reduce(d.split(";"),function(a,b){var c,d,e;return e=b.split(":"),c=e[0],d=e[1],c&&d&&(c=c.trim(),d=d.trim(),a[c.toLowerCase()]=d),a},{}))},a.prototype.switchTag=function(a){var b,c;return a=a.toUpperCase(),this.node.tagName===a?this:(c=this.node.ownerDocument.createElement(a),b=this.attributes(),null==e.VOID_TAGS[a]&&this.moveChildren(c),this.replace(c),this.attributes(b).get()) +},a.prototype.text=function(a){if(null!=a){switch(this.node.nodeType){case e.ELEMENT_NODE:this.node.textContent=a;break;case e.TEXT_NODE:this.node.data=a}return this}switch(this.node.nodeType){case e.ELEMENT_NODE:return this.node.tagName===e.DEFAULT_BREAK_TAG?"":null!=e.EMBED_TAGS[this.node.tagName]?e.EMBED_TEXT:null!=this.node.textContent?this.node.textContent:"";case e.TEXT_NODE:return this.node.data||"";default:return""}},a.prototype.textNodes=function(){var a,b,c;for(c=this.node.ownerDocument.createTreeWalker(this.node,NodeFilter.SHOW_TEXT,null,!1),b=[];a=c.nextNode();)b.push(a);return b},a.prototype.toggleClass=function(a,b){return null==b&&(b=!this.hasClass(a)),b?this.addClass(a):this.removeClass(a),this},a.prototype.trigger=function(a,b){var c,d,h;return null==b&&(b={}),g.indexOf(["keypress","keydown","keyup"],a)<0?(c=this.node.ownerDocument.createEvent("Event"),c.initEvent(a,b.bubbles,b.cancelable)):(c=this.node.ownerDocument.createEvent("KeyboardEvent"),f=g.clone(b),f.which=g.isNumber(b.key)?b.key:g.isString(b.key)?b.key.toUpperCase().charCodeAt(0):0,e.isIE(10)?(h=[],b.altKey&&h.push("Alt"),b.ctrlKey&&h.push("Control"),b.metaKey&&h.push("Meta"),b.shiftKey&&h.push("Shift"),c.initKeyboardEvent(a,b.bubbles,b.cancelable,this.window(),0,0,h.join(" "),null,null)):(d=g.isFunction(c.initKeyboardEvent)?"initKeyboardEvent":"initKeyEvent",c[d](a,b.bubbles,b.cancelable,this.window(),b.ctrlKey,b.altKey,b.shiftKey,b.metaKey,0,0))),this.node.dispatchEvent(c),f=null,this},a.prototype.unwrap=function(){var a,b;return b=this.node.firstChild,a=this.node.nextSibling,g.each(this.childNodes(),function(b){return function(c){return b.node.parentNode.insertBefore(c,a)}}(this)),this.remove(),b},a.prototype.window=function(){return this.node.ownerDocument.defaultView||this.node.ownerDocument.parentWindow},a.prototype.wrap=function(a){var b;for(null!=this.node.parentNode&&this.node.parentNode.insertBefore(a,this.node),b=a;null!=b.firstChild;)b=a.firstChild;return b.appendChild(this.node),this},a}(),c=function(a){function b(){return b.__super__.constructor.apply(this,arguments)}return j(b,a),b.prototype["default"]=function(){return this.node.querySelector("option[selected]")},b.prototype.option=function(a,b){var c,d,e,f,h,i;if(null==b&&(b=!0),e=g.isElement(a)?a.value:a){for(e=e.replace(/[^\w]+/g,""),i=this.node.children,d=f=0,h=i.length;h>f;d=++f)if(c=i[d],c.value.replace(/[^\w]+/g,"")===e){this.node.selectedIndex=d;break}}else this.node.selectedIndex=-1;return b&&this.trigger("change"),this},b.prototype.reset=function(a){var b;return null==a&&(a=!0),b=this["default"](),null!=b?b.selected=!0:this.node.selectedIndex=0,a&&this.trigger("change"),this},b.prototype.value=function(){return this.node.selectedIndex>-1?this.node.options[this.node.selectedIndex].value:""},b}(d),e=function(a){return"SELECT"===(null!=a?a.tagName:void 0)?new c(a):new d(a)},e=g.extend(e,{ELEMENT_NODE:1,NOBREAK_SPACE:" ",TEXT_NODE:3,ZERO_WIDTH_NOBREAK_SPACE:"",DEFAULT_BLOCK_TAG:"DIV",DEFAULT_BREAK_TAG:"BR",DEFAULT_INLINE_TAG:"SPAN",EMBED_TEXT:"!",FONT_SIZES:{"10px":1,"13px":2,"16px":3,"18px":4,"24px":5,"32px":6,"48px":7},KEYS:{BACKSPACE:8,TAB:9,ENTER:13,ESCAPE:27,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46},BLOCK_TAGS:{ADDRESS:"ADDRESS",ARTICLE:"ARTICLE",ASIDE:"ASIDE",AUDIO:"AUDIO",BLOCKQUOTE:"BLOCKQUOTE",CANVAS:"CANVAS",DD:"DD",DIV:"DIV",DL:"DL",FIGCAPTION:"FIGCAPTION",FIGURE:"FIGURE",FOOTER:"FOOTER",FORM:"FORM",H1:"H1",H2:"H2",H3:"H3",H4:"H4",H5:"H5",H6:"H6",HEADER:"HEADER",HGROUP:"HGROUP",LI:"LI",OL:"OL",OUTPUT:"OUTPUT",P:"P",PRE:"PRE",SECTION:"SECTION",TABLE:"TABLE",TBODY:"TBODY",TD:"TD",TFOOT:"TFOOT",TH:"TH",THEAD:"THEAD",TR:"TR",UL:"UL",VIDEO:"VIDEO"},EMBED_TAGS:{IMG:"IMG"},LINE_TAGS:{DIV:"DIV",LI:"LI"},LIST_TAGS:{OL:"OL",UL:"UL"},VOID_TAGS:{AREA:"AREA",BASE:"BASE",BR:"BR",COL:"COL",COMMAND:"COMMAND",EMBED:"EMBED",HR:"HR",IMG:"IMG",INPUT:"INPUT",KEYGEN:"KEYGEN",LINK:"LINK",META:"META",PARAM:"PARAM",SOURCE:"SOURCE",TRACK:"TRACK",WBR:"WBR"},convertFontSize:function(a){var b,c,d,f;g.isString(a)&&a.indexOf("px")>-1?(d=g.keys(e.FONT_SIZES),f=g.values(e.FONT_SIZES)):(f=g.keys(e.FONT_SIZES),d=g.values(e.FONT_SIZES));for(b in d)if(c=d[b],parseInt(a)<=parseInt(c))return f[b];return g.last(f)},isIE:function(a){var b;return b=document.documentMode,b&&a>=b},isIOS:function(){return/iPhone|iPad/i.test(navigator.userAgent)},isMac:function(){return/Mac/i.test(navigator.platform)}}),b.exports=e},{lodash:"M4+//f"}],22:[function(a,b){var c,d;d=function(){function a(a){this.data=a,this.prev=this.next=null}return a}(),c=function(){function a(){this.length=0,this.first=this.last=null}return a.Node=d,a.prototype.append=function(a){return null!=this.first?(a.next=null,this.last.next=a):this.first=a,a.prev=this.last,this.last=a,this.length+=1},a.prototype.insertAfter=function(a,b){return b.prev=a,null!=a?(b.next=a.next,null!=a.next&&(a.next.prev=b),a.next=b,a===this.last&&(this.last=b)):(b.next=this.first,this.first.prev=b,this.first=b),this.length+=1},a.prototype.remove=function(a){return this.length>1?(null!=a.prev&&(a.prev.next=a.next),null!=a.next&&(a.next.prev=a.prev),a===this.first&&(this.first=a.next),a===this.last&&(this.last=a.prev)):this.first=this.last=null,a.prev=a.next=null,this.length-=1},a.prototype.toArray=function(){var a,b;for(a=[],b=this.first;null!=b;)a.push(b),b=b.next;return a},a}(),b.exports=c},{}],23:[function(a,b){var c,d,e;e=a("lodash"),d=a("./dom"),c={ALIASES:{STRONG:"B",EM:"I",DEL:"S",STRIKE:"S"},ATTRIBUTES:{color:"color",face:"fontFamily",size:"fontSize"},STYLES:{"background-color":"background-color",color:"color","font-family":"font-family","font-size":"font-size","text-align":"text-align"},TAGS:{DIV:"DIV",BR:"BR",SPAN:"SPAN",B:"B",I:"I",S:"S",U:"U",A:"A",IMG:"IMG",OL:"OL",UL:"UL",LI:"LI"},handleBreaks:function(a){var b;return b=e.map(a.querySelectorAll(d.DEFAULT_BREAK_TAG)),e.each(b,function(){return function(b){return null==b.nextSibling||d.isIE(10)&&null==b.previousSibling?void 0:d(b.nextSibling).splitAncestors(a.parentNode)}}(this)),a},normalizeLine:function(a){return a=c.wrapInline(a),a=c.handleBreaks(a),a=c.pullBlocks(a),a=c.normalizeNode(a),c.unwrapText(a),null!=a&&null!=d.LIST_TAGS[a.tagName]&&(a=a.firstChild),a},normalizeNode:function(a){return d(a).isTextNode()?a:(e.each(c.ATTRIBUTES,function(b,c){var e;return a.hasAttribute(c)?(e=a.getAttribute(c),"size"===c&&(e=d.convertFontSize(e)),a.style[b]=e,a.removeAttribute(c)):void 0}),c.whitelistStyles(a),c.whitelistTags(a))},optimizeLine:function(a){var b,c,f,g;for(b=d(a).length(),f=d(a).descendants(),g=[];f.length>0;)c=f.pop(),null!=(null!=c?c.parentNode:void 0)&&null==d.EMBED_TAGS[c.tagName]&&(c.tagName===d.DEFAULT_BREAK_TAG?g.push(0!==b?d(c).remove():void 0):0===d(c).length()?(f.push(c.nextSibling),g.push(d(c).unwrap())):null!=c.previousSibling&&c.tagName===c.previousSibling.tagName&&e.isEqual(d(c).attributes(),d(c.previousSibling).attributes())?(f.push(c.firstChild),g.push(d(c.previousSibling).merge(c))):g.push(void 0));return g},pullBlocks:function(a){var b;for(b=a.firstChild;null!=b;){if(null!=d.BLOCK_TAGS[b.tagName]&&"LI"!==b.tagName){null!=b.previousSibling&&d(b).splitAncestors(a.parentNode),null!=b.nextSibling&&d(b.nextSibling).splitAncestors(a.parentNode),null!=d.LIST_TAGS[b.tagName]&&b.firstChild?(d(b.parentNode).unwrap(),null==a.parentNode&&(a=b)):(d(b).unwrap(),c.pullBlocks(a));break}b=b.nextSibling}return a},stripComments:function(a){return a.replace(//g,"")},stripWhitespace:function(a){return a=a.replace(/^\s+/,"").replace(/\s+$/,""),a=a.replace(/^\s+/,"").replace(/\s+$/,""),a=a.replace(/(\r?\n|\r)+/g," "),a=a.replace(/\>\s+\<")},whitelistStyles:function(a){var b,f;return b=d(a).styles(),f=e.omit(b,function(a,b){return null==c.STYLES[b]}),e.keys(f).length0?d(a).styles(f,!0):a.removeAttribute("style"):void 0},whitelistTags:function(a){return d(a).isElement()?(null!=c.ALIASES[a.tagName]?a=d(a).switchTag(c.ALIASES[a.tagName]):null==c.TAGS[a.tagName]&&(a=null!=d.BLOCK_TAGS[a.tagName]?d(a).switchTag(d.DEFAULT_BLOCK_TAG):a.hasAttributes()||null==a.firstChild?d(a).switchTag(d.DEFAULT_INLINE_TAG):d(a).unwrap()),a):a},wrapInline:function(a){var b,c;if(null!=d.BLOCK_TAGS[a.tagName])return a;for(b=a.ownerDocument.createElement(d.DEFAULT_BLOCK_TAG),a.parentNode.insertBefore(b,a);null!=a&&null==d.BLOCK_TAGS[a.tagName];)c=a.nextSibling,b.appendChild(a),a=c;return b},unwrapText:function(a){var b;return b=e.map(a.querySelectorAll(d.DEFAULT_INLINE_TAG)),e.each(b,function(a){return a.hasAttributes()?void 0:d(a).unwrap()})}},b.exports=c},{"./dom":21,lodash:"M4+//f"}],24:[function(a,b){var c,d,e,f;f=a("lodash"),e=a("./dom"),c=a("./normalizer"),d=function(){function a(a){this.select=a,this.container=this.select.ownerDocument.createElement("span"),this.buildPicker(),e(this.container).addClass("ql-picker"),this.select.style.display="none",this.select.parentNode.insertBefore(this.container,this.select),e(this.select.ownerDocument).on("click",function(a){return function(){return a.close(),!0}}(this)),e(this.label).on("click",function(a){return function(){return f.defer(function(){return e(a.container).toggleClass("ql-expanded")}),!1}}(this)),e(this.select).on("change",function(a){return function(){var b,c;return a.select.selectedIndex>-1&&(b=a.container.querySelectorAll(".ql-picker-item")[a.select.selectedIndex],c=a.select.options[a.select.selectedIndex]),a.selectItem(b,!1),e(a.label).toggleClass("ql-active",c!==e(a.select)["default"]())}}(this))}return a.TEMPLATE='',a.prototype.buildItem=function(a,b,c){var d;return d=this.select.ownerDocument.createElement("span"),d.setAttribute("data-value",b.getAttribute("value")),e(d).addClass("ql-picker-item").text(e(b).text()).on("click",function(a){return function(){return a.selectItem(d,!0),a.close()}}(this)),this.select.selectedIndex===c&&this.selectItem(d,!1),d},a.prototype.buildPicker=function(){var b;return f.each(e(this.select).attributes(),function(a){return function(b,c){return a.container.setAttribute(c,b)}}(this)),this.container.innerHTML=c.stripWhitespace(a.TEMPLATE),this.label=this.container.querySelector(".ql-picker-label"),b=this.container.querySelector(".ql-picker-options"),f.each(this.select.options,function(a){return function(c,d){var e;return e=a.buildItem(b,c,d),b.appendChild(e)}}(this))},a.prototype.close=function(){return e(this.container).removeClass("ql-expanded")},a.prototype.selectItem=function(a,b){var c,d;return c=this.container.querySelector(".ql-selected"),null!=c&&e(c).removeClass("ql-selected"),null!=a?(d=a.getAttribute("data-value"),e(a).addClass("ql-selected"),e(this.label).text(e(a).text()),e(this.select).option(d,b),this.label.setAttribute("data-value",d)):(this.label.innerHTML=" ",this.label.removeAttribute("data-value"))},a}(),b.exports=d},{"./dom":21,"./normalizer":23,lodash:"M4+//f"}],25:[function(a,b){var c,d;d=a("lodash"),c=function(){function a(a,b){this.start=a,this.end=b}return a.compare=function(a,b){return a===b?!0:null==a||null==b?!1:a.equals(b)},a.prototype.equals=function(a){return null==a?!1:this.start===a.start&&this.end===a.end},a.prototype.shift=function(a,b){var c;return c=d.map([this.start,this.end],function(c){return a>c?c:b>=0?c+b:Math.max(a,c+b)}),this.start=c[0],this.end=c[1],c},a.prototype.isCollapsed=function(){return this.start===this.end},a}(),b.exports=c},{lodash:"M4+//f"}],26:[function(a,b){var c,d,e,f,g;e=a("../quill"),g=e.require("lodash"),f=e.require("dom"),d=e.require("delta"),c=function(){function a(a,b){this.quill=a,this.options=b,null!=this.options.button&&this.attachButton(this.options.button),this.options.enabled&&this.enable(),this.quill.addFormat("author",{"class":"author-"}),null!=this.options.authorId&&(this.quill.on(this.quill.constructor.events.PRE_EVENT,function(a){return function(b,c,f){var h,i;return b===a.quill.constructor.events.TEXT_CHANGE&&"user"===f?(h=new d,i={author:a.options.authorId},g.each(c.ops,function(b){return null==b["delete"]?null!=b.insert||null!=b.retain&&null!=b.attributes?(b.attributes||(b.attributes={}),b.attributes.author=a.options.authorId,h.retain(b.retain||b.insert.length||1,i)):h.retain(b.retain):void 0}),a.quill.updateContents(h,e.sources.SILENT)):void 0}}(this)),this.addAuthor(this.options.authorId,this.options.color))}return a.DEFAULTS={authorId:null,color:"transparent",enabled:!1},a.prototype.addAuthor=function(a,b){var c;return c={},c[".authorship .author-"+a]={"background-color":""+b},this.quill.addStyles(c)},a.prototype.attachButton=function(a){var b;return b=f(a),b.on("click",function(a){return function(){return b.toggleClass("ql-on"),a.enable($dom.hasClass("ql-on"))}}(this))},a.prototype.enable=function(a){return null==a&&(a=!0),f(this.quill.root).toggleClass("authorship",a)},a.prototype.disable=function(){return this.enable(!1)},a}(),e.registerModule("authorship",c),b.exports=c},{"../quill":35}],27:[function(a,b){var c,d,e,f,g,h,i={}.hasOwnProperty,j=function(a,b){function c(){this.constructor=a}for(var d in b)i.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};e=a("../quill"),f=a("./tooltip"),h=e.require("lodash"),g=e.require("dom"),c=e.require("delta"),d=function(a){function b(a,c){this.quill=a,this.options=c,this.options.styles=h.defaults(this.options.styles,f.DEFAULTS.styles),this.options=h.defaults(this.options,f.DEFAULTS),b.__super__.constructor.call(this,this.quill,this.options),this.preview=this.container.querySelector(".preview"),this.textbox=this.container.querySelector(".input"),g(this.container).addClass("image-tooltip-container"),this.initListeners()}return j(b,a),b.DEFAULTS={styles:{".image-tooltip-container":{margin:"25px",padding:"10px",width:"300px"},".image-tooltip-container:after":{clear:"both",content:'""',display:"table"},".image-tooltip-container .preview":{margin:"10px 0px",position:"relative",border:"1px dashed #000",height:"200px"},".image-tooltip-container .preview span":{display:"inline-block",position:"absolute","text-align":"center",top:"40%",width:"100%"},".image-tooltip-container img":{bottom:"0",left:"0",margin:"auto","max-height":"100%","max-width":"100%",position:"absolute",right:"0",top:"0"},".image-tooltip-container .input":{"box-sizing":"border-box",width:"100%"},".image-tooltip-container a":{border:"1px solid black","box-sizing":"border-box",display:"inline-block","float":"left",padding:"5px","text-align":"center",width:"50%"}},template:'
Preview
Cancel Insert'},b.prototype.initListeners=function(){return g(this.container.querySelector(".insert")).on("click",h.bind(this.insertImage,this)),g(this.container.querySelector(".cancel")).on("click",h.bind(this.hide,this)),g(this.textbox).on("input",h.bind(this._preview,this)),this.initTextbox(this.textbox,this.insertImage,this.hide),this.quill.onModuleLoad("toolbar",function(a){return function(b){return b.initFormat("image",h.bind(a._onToolbar,a))}}(this))},b.prototype.insertImage=function(){var a,b;return b=this._normalizeURL(this.textbox.value),null==this.range&&(this.range=new Range(0,0)),this.range&&(this.preview.innerHTML="Preview",this.textbox.value="",a=this.range.end,this.quill.insertEmbed(a,"image",b,"user"),this.quill.setSelection(a+1,a+1)),this.hide()},b.prototype._onToolbar=function(a,b){return b?(this.textbox.value||(this.textbox.value="http://"),this.show(),this.textbox.focus(),h.defer(function(a){return function(){return a.textbox.setSelectionRange(a.textbox.value.length,a.textbox.value.length)}}(this))):this.quill.deleteText(a,"user")},b.prototype._preview=function(){var a;if(this._matchImageURL(this.textbox.value))return"IMG"===this.preview.firstChild.tagName?this.preview.firstChild.setAttribute("src",this.textbox.value):(a=this.preview.ownerDocument.createElement("img"),a.setAttribute("src",this.textbox.value),this.preview.replaceChild(a,this.preview.firstChild))},b.prototype._matchImageURL=function(a){return/^https?:\/\/.+\.(jp?g|gif|png)$/.test(a)},b.prototype._normalizeURL=function(a){return/^https?:\/\//.test(a)||(a="http://"+a),a},b}(f),e.registerModule("image-tooltip",d),b.exports=d},{"../quill":35,"./tooltip":33}],28:[function(a,b){var c,d,e,f,g;e=a("../quill"),g=e.require("lodash"),f=e.require("dom"),c=e.require("delta"),d=function(){function a(a){this.quill=a,this.hotkeys={},this._initListeners(),this._initHotkeys(),this._initDeletes()}return a.hotkeys={BOLD:{key:"B",metaKey:!0},INDENT:{key:f.KEYS.TAB},ITALIC:{key:"I",metaKey:!0},OUTDENT:{key:f.KEYS.TAB,shiftKey:!0},UNDERLINE:{key:"U",metaKey:!0}},a.prototype.addHotkey=function(a,b){return g.isArray(a)||(a=[a]),g.each(a,function(a){return function(c){var d,e;return c=g.isObject(c)?g.clone(c):{key:c},c.callback=b,d=g.isNumber(c.key)?c.key:c.key.toUpperCase().charCodeAt(0),null==(e=a.hotkeys)[d]&&(e[d]=[]),a.hotkeys[d].push(c)}}(this))},a.prototype.toggleFormat=function(a,b){var c,d,e;return c=a.isCollapsed()?this.quill.getContents(Math.max(0,a.start-1),a.end):this.quill.getContents(a),e=0===c.ops.length||!g.all(c.ops,function(a){var c;return null!=(c=a.attributes)?c[b]:void 0}),a.isCollapsed()?this.quill.prepareFormat(b,e):this.quill.formatText(a,b,e,"user"),d=this.quill.getModule("toolbar"),null!=d?d.setActive(b,e):void 0},a.prototype._initDeletes=function(){return this.addHotkey([f.KEYS.DELETE,f.KEYS.BACKSPACE],function(a){return function(){return a.quill.getLength()>1}}(this))},a.prototype._initHotkeys=function(){return this.addHotkey(a.hotkeys.INDENT,function(a){return function(b){return a._onTab(b,!1),!1}}(this)),this.addHotkey(a.hotkeys.OUTDENT,function(){return function(){return!1}}(this)),g.each(["bold","italic","underline"],function(b){return function(c){return b.addHotkey(a.hotkeys[c.toUpperCase()],function(a){return b.toggleFormat(a,c),!1})}}(this))},a.prototype._initListeners=function(){return f(this.quill.root).on("keydown",function(a){return function(b){var c;return c=!1,g.each(a.hotkeys[b.which],function(d){var e;return e=f.isMac()?b.metaKey:b.metaKey||b.ctrlKey,!!d.metaKey==!!e&&!!d.shiftKey==!!b.shiftKey&&!!d.altKey==!!b.altKey?(c=d.callback(a.quill.getSelection())===!1||c,!0):void 0}),!c}}(this))},a.prototype._onTab=function(a,b){var d;return null==b&&(b=!1),d=(new c).retain(a.start).insert(" ")["delete"](a.end-a.start).retain(this.quill.getLength()-a.end),this.quill.updateContents(d),this.quill.setSelection(a.start+1,a.start+1)},a}(),e.registerModule("keyboard",d),b.exports=d},{"../quill":35}],29:[function(a,b){var c,d,e,f,g,h={}.hasOwnProperty,i=function(a,b){function c(){this.constructor=a}for(var d in b)h.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};d=a("../quill"),e=a("./tooltip"),g=d.require("lodash"),f=d.require("dom"),c=function(a){function b(a,c){this.quill=a,this.options=c,this.options.styles=g.defaults(this.options.styles,e.DEFAULTS.styles),this.options=g.defaults(this.options,e.DEFAULTS),b.__super__.constructor.call(this,this.quill,this.options),f(this.container).addClass("link-tooltip-container"),this.textbox=this.container.querySelector(".input"),this.link=this.container.querySelector(".url"),this.initListeners()}return i(b,a),b.DEFAULTS={maxLength:50,styles:{".link-tooltip-container":{padding:"5px 10px"},".link-tooltip-container input.input":{width:"170px"},".link-tooltip-container input.input, .link-tooltip-container a.done, .link-tooltip-container.editing a.url, .link-tooltip-container.editing a.change":{display:"none"},".link-tooltip-container.editing input.input, .link-tooltip-container.editing a.done":{display:"inline-block"}},template:'Visit URL:   -  Change Done'},b.prototype.initListeners=function(){return this.quill.on(this.quill.constructor.events.SELECTION_CHANGE,function(a){return function(b){var c;if(null!=b&&b.isCollapsed())return c=a._findAnchor(b),c?(a.setMode(c.href,!1),a.show(c)):(a.range=null,a.hide())}}(this)),f(this.container.querySelector(".done")).on("click",g.bind(this.saveLink,this)),f(this.container.querySelector(".change")).on("click",function(a){return function(){return a.setMode(a.link.href,!0)}}(this)),this.initTextbox(this.textbox,this.saveLink,this.hide),this.quill.onModuleLoad("toolbar",function(a){return function(b){return b.initFormat("link",g.bind(a._onToolbar,a))}}(this))},b.prototype.saveLink=function(){var a,b;return b=this._normalizeURL(this.textbox.value),null!=this.range&&(this.range.isCollapsed()?(a=this._findAnchor(this.range),null!=a&&(a.href=b)):this.quill.formatText(this.range,"link",b,"user")),this.setMode(b,!1)},b.prototype.setMode=function(a,b){var c;return null==b&&(b=!1),b?(this.textbox.value=a,g.defer(function(b){return function(){return b.textbox.focus(),b.textbox.setSelectionRange(a.length,a.length)}}(this))):(this.link.href=a,c=a.length>this.options.maxLength?a.slice(0,this.options.maxLength)+"...":a,f(this.link).text(c)),f(this.container).toggleClass("editing",b)},b.prototype._findAnchor=function(a){var b,c,d,e;for(e=this.quill.editor.doc.findLeafAt(a.start,!0),b=e[0],d=e[1],null!=b&&(c=b.node);null!=c;){if("A"===c.tagName)return c;c=c.parentNode}return null},b.prototype._onToolbar=function(a,b){var c;if(a&&!a.isCollapsed())return b?(this.setMode(this._suggestURL(a),!0),c=this.quill.editor.selection._getNativeRange(),this.show(c)):this.quill.formatText(a,"link",!1,"user")},b.prototype._normalizeURL=function(a){return/^(https?:\/\/|mailto:)/.test(a)||(a="http://"+a),a},b.prototype._suggestURL=function(a){var b;return b=this.quill.getText(a),this._normalizeURL(b)},b}(e),d.registerModule("link-tooltip",c),b.exports=c},{"../quill":35,"./tooltip":33}],30:[function(a,b){var c,d,e,f,g,h={}.hasOwnProperty,i=function(a,b){function c(){this.constructor=a}for(var d in b)h.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};e=a("../quill"),c=a("eventemitter2").EventEmitter2,g=e.require("lodash"),f=e.require("dom"),d=function(a){function b(a,b){this.quill=a,this.options=b,this.cursors={},this.container=this.quill.addContainer("cursor-container",!0),this.quill.addStyles({".cursor-container":{position:"absolute",left:"0",top:"0","z-index":"1000"},".cursor":{"margin-left":"-1px",position:"absolute"},".cursor-flag":{bottom:"100%",position:"absolute","white-space":"nowrap"},".cursor-name":{display:"inline-block",color:"white",padding:"2px 8px"},".cursor-caret":{height:"100%",position:"absolute",width:"2px"},".cursor.hidden .cursor-flag":{display:"none"},".cursor.top > .cursor-flag":{bottom:"auto",top:"100%"},".cursor.right > .cursor-flag":{right:"-2px"}}),this.quill.on(this.quill.constructor.events.TEXT_CHANGE,g.bind(this._applyDelta,this))}return i(b,a),b.DEFAULTS={template:' ',timeout:2500},b.events={CURSOR_ADDED:"cursor-addded",CURSOR_MOVED:"cursor-moved",CURSOR_REMOVED:"cursor-removed"},b.prototype.clearCursors=function(){return g.each(g.keys(this.cursors),g.bind(this.removeCursor,this)),this.cursors={}},b.prototype.moveCursor=function(a,b){var c;return c=this.cursors[a],c.index=b,f(c.elem).removeClass("hidden"),clearTimeout(c.timer),c.timer=setTimeout(function(){return function(){return f(c.elem).addClass("hidden"),c.timer=null}}(this),this.options.timeout),this._updateCursor(c),c},b.prototype.removeCursor=function(a){var c;return c=this.cursors[a],this.emit(b.events.CURSOR_REMOVED,c),null!=c&&c.elem.parentNode.removeChild(c.elem),delete this.cursors[a]},b.prototype.setCursor=function(a,c,d,e){var f;return null==this.cursors[a]&&(this.cursors[a]=f={userId:a,index:c,color:e,elem:this._buildCursor(d,e)},this.emit(b.events.CURSOR_ADDED,f)),g.defer(function(b){return function(){return b.moveCursor(a,c)}}(this)),this.cursors[a]},b.prototype.shiftCursors=function(a,b,c){return null==c&&(c=null),g.each(this.cursors,function(){return function(d){return d&&(d.index>a||d.userId===c)?d.index+=Math.max(b,a-d.index):void 0}}(this))},b.prototype.update=function(){return g.each(this.cursors,function(a){return function(b){return null!=b?(a._updateCursor(b),!0):void 0}}(this))},b.prototype._applyDelta=function(a){var b;return b=0,g.each(a.ops,function(a){return function(c){var d,e;return d=0,null!=c.insert?(d=c.insert.length||1,a.shiftCursors(b,d,null!=(e=c.attributes)?e.author:void 0)):null!=c["delete"]?a.shiftCursors(b,-1*c["delete"],null):null!=c.retain&&(a.shiftCursors(b,0,null),d=c.retain),b+=d}}(this)),this.update()},b.prototype._buildCursor=function(a,b){var c,d,e,g;return c=this.container.ownerDocument.createElement("span"),f(c).addClass("cursor"),c.innerHTML=this.options.template,e=c.querySelector(".cursor-flag"),g=c.querySelector(".cursor-name"),f(g).text(a),d=c.querySelector(".cursor-caret"),d.style.backgroundColor=g.style.backgroundColor=b,this.container.appendChild(c),c},b.prototype._moveCursor=function(a,c,d){var e,g,h;return null==d&&(d="left"),h=f(c).window(),e=c.getBoundingClientRect(),a.elem.style.top=e.top+h.pageYOffset+"px",a.elem.style.left=e[d]+"px",a.elem.style.height=e.height+"px",g=a.elem.querySelector(".cursor-flag"),f(a.elem).toggleClass("top",parseInt(a.elem.style.top)<=g.offsetHeight).toggleClass("left",parseInt(a.elem.style.left)<=g.offsetWidth).toggleClass("right",this.quill.root.offsetWidth-parseInt(a.elem.style.left)<=g.offsetWidth),this.emit(b.events.CURSOR_MOVED,a)},b.prototype._updateCursor=function(a){var b,c,d,g,h,i,j,k;return this.quill.editor.checkUpdate(),j=this.quill.editor.doc.findLeafAt(a.index,!0),d=j[0],h=j[1],c=this.container.ownerDocument.createElement("span"),null!=d?(k=f(d.node).split(h),g=k[0],i=k[1],b=k[2],f(c).text(f.ZERO_WIDTH_NOBREAK_SPACE),d.node.parentNode.insertBefore(c,i)):(f(c).text(f.NOBREAK_SPACE),this.quill.root.appendChild(c)),this._moveCursor(a,c),f(c).remove(),b&&f(d.node.parentNode).normalize(),this.quill.editor.selection.update(e.sources.SILENT)},b}(c),e.registerModule("multi-cursor",d),b.exports=d},{"../quill":35,eventemitter2:3}],31:[function(a,b){var c,d,e,f,g,h;f=a("../quill"),d=a("../core/document"),h=f.require("lodash"),g=f.require("dom"),c=f.require("delta"),e=function(){function a(a,b){this.quill=a,this.options=b,this.container=this.quill.addContainer("paste-container"),this.container.setAttribute("contenteditable",!0),this.quill.addStyles({".paste-container":{left:"-10000px",position:"absolute",top:"50%"}}),g(this.quill.root).on("paste",h.bind(this._paste,this))}return a.prototype._paste=function(){var a,b,e,f,i,j;return e=this.quill.getLength(),f=this.quill.getSelection(),null!=f?(this.container.innerHTML="",a=g(this.quill.root).window(),b=a.scrollY,i=window.scrollX,j=window.scrollY,this.container.focus(),h.defer(function(e){return function(){var g,h,k,l,m,n,o;return h=new d(e.container,e.quill.options),g=h.toDelta(),k=g.length()-1,g.compose((new c).retain(k)["delete"](1)),f.start>0&&g.ops.unshift({retain:f.start}),g["delete"](f.end-f.start),e.quill.updateContents(g,"user"),e.quill.setSelection(f.start+k,f.start+k),o=e.quill.editor.doc.findLineAt(f.start+k),l=o[0],n=o[1],m=l.node.offsetTop+l.node.offsetHeight,m>b+e.quill.root.offsetHeight&&(b=l.node.offsetTop-e.quill.root.offsetHeight/2),a.scrollTo(0,b),window.scrollTo(i,j)}}(this))):void 0},a}(),f.registerModule("paste-manager",e),b.exports=e},{"../core/document":12,"../quill":35}],32:[function(a,b){var c,d,e,f;c=a("../quill"),f=c.require("lodash"),e=c.require("dom"),d=function(){function a(b,c){if(this.quill=b,this.options=c,null==this.options.container)throw new Error("container required for toolbar",this.options);this.container=f.isString(this.options.container)?document.querySelector(this.options.container):this.options.container,this.inputs={},this.preventUpdate=!1,this.triggering=!1,f.each(this.quill.options.formats,function(b){return function(c){return null==a.formats.TOOLTIP[c]?b.initFormat(c,function(d,e){return b.triggering?void 0:(d.isCollapsed()?b.quill.prepareFormat(c,e):null!=a.formats.LINE[c]?b.quill.formatLine(d,c,e,"user"):b.quill.formatText(d,c,e,"user"),f.defer(function(){return b.updateActive(d,["bullet","list"]),b.setActive(c,e)}))}):void 0}}(this)),this.quill.on(this.quill.constructor.events.SELECTION_CHANGE,function(a){return function(b){return null!=b?a.updateActive(b):void 0}}(this)),this.quill.onModuleLoad("keyboard",function(a){return function(b){return b.addHotkey([e.KEYS.BACKSPACE,e.KEYS.DELETE,e.KEYS.ENTER],function(){return f.defer(f.bind(a.updateActive,a))})}}(this)),e(this.container).addClass("ql-toolbar-container"),e.isIOS()&&e(this.container).addClass("ios"),e.isIE(11)&&e(this.container).on("mousedown",function(){return function(){return!1}}(this))}return a.DEFAULTS={container:null},a.formats={LINE:{align:"align",bullet:"bullet",list:"list"},SELECT:{align:"align",background:"background",color:"color",font:"font",size:"size"},TOGGLE:{bold:"bold",bullet:"bullet",image:"image",italic:"italic",link:"link",list:"list",strike:"strike",underline:"underline"},TOOLTIP:{image:"image",link:"link"}},a.prototype.initFormat=function(b,c){var d,f,g;return g=".ql-"+b,null!=a.formats.SELECT[b]?(g="select"+g,d="change"):d="click",f=this.container.querySelector(g),null!=f?(this.inputs[b]=f,e(f).on(d,function(a){return function(){var b,g;return g="change"===d?e(f).value():!e(f).hasClass("ql-active"),a.preventUpdate=!0,a.quill.focus(),b=a.quill.getSelection(),null!=b&&c(b,g),a.preventUpdate=!1,!0}}(this))):void 0},a.prototype.setActive=function(a,b){var c,d,g,h;return d=this.inputs[a],null!=d?(c=e(d),"SELECT"===d.tagName?(this.triggering=!0,g=c.value(d),null==b&&(b=null!=(h=c["default"]())?h.value:void 0),f.isArray(b)&&(b=""),b!==g&&(null!=b?c.option(b,!1):c.reset(!1)),this.triggering=!1):c.toggleClass("ql-active",b||!1)):void 0},a.prototype.updateActive=function(a,b){var c;return null==b&&(b=null),a||(a=this.quill.getSelection()),null==a||this.preventUpdate?void 0:(c=this._getActive(a),f.each(this.inputs,function(a){return function(d,e){return(!f.isArray(b)||b.indexOf(e)>-1)&&a.setActive(e,c[e]),!0}}(this)))},a.prototype._getActive=function(a){var b,c;return b=this._getLeafActive(a),c=this._getLineActive(a),f.defaults({},b,c)},a.prototype._getLeafActive=function(a){var b,c,d,e,g;return a.isCollapsed()?(g=this.quill.editor.doc.findLineAt(a.start),d=g[0],e=g[1],b=0===e?this.quill.getContents(a.start,a.end+1):this.quill.getContents(a.start-1,a.end)):b=this.quill.getContents(a),c=f.map(b.ops,"attributes"),this._intersectFormats(c)},a.prototype._getLineActive=function(a){var b,c,d,e,g,h;for(c=[],g=this.quill.editor.doc.findLineAt(a.start),b=g[0],e=g[1],h=this.quill.editor.doc.findLineAt(a.end),d=h[0],e=h[1],null!=d&&d===b&&(d=d.next);null!=b&&b!==d;)c.push(f.clone(b.formats)),b=b.next;return this._intersectFormats(c)},a.prototype._intersectFormats=function(b){return f.reduce(b.slice(1),function(b,c){var d,e,g,h,i;return d=f.keys(b),g=f.keys(c),h=f.intersection(d,g),i=f.difference(d,g),e=f.difference(g,d),f.each(h,function(d){if(null!=a.formats.SELECT[d])if(f.isArray(b[d])){if(f.indexOf(b[d],c[d])<0)return b[d].push(c[d])}else if(b[d]!==c[d])return b[d]=[b[d],c[d]]}),f.each(i,function(c){return null!=a.formats.TOGGLE[c]?delete b[c]:null==a.formats.SELECT[c]||f.isArray(b[c])?void 0:b[c]=[b[c]]}),f.each(e,function(d){return null!=a.formats.SELECT[d]?b[d]=[c[d]]:void 0}),b},b[0]||{})},a}(),c.registerModule("toolbar",d),b.exports=d},{"../quill":35}],33:[function(a,b){var c,d,e,f,g;d=a("../quill"),c=a("../lib/normalizer"),g=d.require("lodash"),f=d.require("dom"),e=function(){function a(b,d){this.quill=b,this.options=d,this.quill.addStyles(this.options.styles),this.container=this.quill.addContainer("tooltip"),this.container.innerHTML=c.stripWhitespace(this.options.template),this.container.style.position="absolute",f(this.quill.root).on("focus",g.bind(this.hide,this)),this.hide(),this.quill.on(this.quill.constructor.events.TEXT_CHANGE,function(b){return function(c,d){return"user"===d&&b.container.style.left!==a.HIDE_MARGIN?(b.range=null,b.hide()):void 0 +}}(this))}return a.DEFAULTS={offset:10,styles:{".tooltip":{"background-color":"#fff",border:"1px solid #000",top:"0px","white-space":"nowrap","z-index":"2000"},".tooltip a":{cursor:"pointer","text-decoration":"none"}},template:""},a.HIDE_MARGIN="-10000px",a.prototype.initTextbox=function(a,b,c){return f(a).on("keyup",function(a){return function(d){switch(d.which){case f.KEYS.ENTER:return b.call(a);case f.KEYS.ESCAPE:return c.call(a);default:return!0}}}(this))},a.prototype.hide=function(){return this.container.style.left=a.HIDE_MARGIN,this.range&&this.quill.setSelection(this.range),this.range=null},a.prototype.show=function(a){var b,c,d,e,g;return this.range=this.quill.getSelection(),e=this._position(a),b=e[0],c=e[1],g=this._limit(b,c),b=g[0],c=g[1],d=f(this.quill.root).window(),b+=d.pageXOffset,c+=d.pageYOffset,this.container.style.left=""+b+"px",this.container.style.top=""+c+"px",this.container.focus()},a.prototype._getBounds=function(){var a,b,c,d;return a=this.quill.root.getBoundingClientRect(),d=f(this.quill.root).window(),b=d.pageXOffset,c=d.pageYOffset,{left:a.left+b,right:a.right+b,top:a.top+c,bottom:a.bottom+c,width:a.width,height:a.height}},a.prototype._limit=function(a,b){var c,d;return c=this._getBounds(),d=this.container.getBoundingClientRect(),a=Math.min(c.right-d.width,a),a=Math.max(c.left,a),b=Math.min(c.bottom-d.height,b),b=Math.max(c.top,b),[a,b]},a.prototype._position=function(a){var b,c,d,e,f;return e=this.container.getBoundingClientRect(),b=this._getBounds(),null!=a?(d=a.getBoundingClientRect(),c=d.left+d.width/2-e.width/2,f=d.top+d.height+this.options.offset,f+e.height>b.bottom&&(f=d.top-e.height-this.options.offset)):(c=b.left+b.width/2-e.width/2,f=b.top+b.height/2-e.height/2),[c,f]},a}(),d.registerModule("tooltip",e),b.exports=e},{"../lib/normalizer":23,"../quill":35}],34:[function(a,b){var c,d,e,f;d=a("../quill"),f=d.require("lodash"),c=d.require("delta"),e=function(){function a(a,b){this.quill=a,this.options=null!=b?b:{},this.lastRecorded=0,this.emittedDelta=null,this.clear(),this.initListeners()}return a.DEFAULTS={delay:1e3,maxStack:100},a.hotkeys={UNDO:{key:"Z",metaKey:!0},REDO:{key:"Z",metaKey:!0,shiftKey:!0}},a.prototype.initListeners=function(){return this.quill.onModuleLoad("keyboard",function(b){return function(c){return c.addHotkey(a.hotkeys.UNDO,function(){return b.undo(),!1}),c.addHotkey(a.hotkeys.REDO,function(){return b.redo(),!1})}}(this)),this.quill.on(this.quill.constructor.events.TEXT_CHANGE,function(a){return function(b){return f.isEqual(b,a.emittedDelta)?void 0:(a.record(b,a.oldDelta),a.oldDelta=a.quill.getContents())}}(this))},a.prototype.clear=function(){return this.stack={undo:[],redo:[]},this.oldDelta=this.quill.getContents()},a.prototype.record=function(a){var b,c,d,e;if(a.ops.length>0){this.stack.redo=[];try{if(e=this.quill.getContents().diff(this.oldDelta),d=(new Date).getTime(),this.lastRecorded+this.options.delay>d&&this.stack.undo.length>0?(b=this.stack.undo.pop(),e=e.compose(b.undo),a=b.redo.compose(a)):this.lastRecorded=d,this.stack.undo.push({redo:a,undo:e}),this.stack.undo.length>this.options.maxStack)return this.stack.undo.unshift()}catch(f){return c=f,this.clear()}}},a.prototype.redo=function(){return this._change("redo","undo")},a.prototype.undo=function(){return this._change("undo","redo")},a.prototype._getLastChangeIndex=function(a){var b,c;return c=0,b=0,a.ops.forEach(function(a){return null!=a.insert?c=Math.max(b+(a.insert.length||1),c):null!=a["delete"]?c=Math.max(b,c):null!=a.retain?(null!=a.attributes&&(c=Math.max(b+a.retain,c)),b+=a.retain):void 0}),c},a.prototype._change=function(a,b){var c,d;return this.stack[a].length>0?(c=this.stack[a].pop(),this.lastRecorded=0,this.emittedDelta=c[a],this.quill.updateContents(c[a],"user"),this.emittedDelta=null,d=this._getLastChangeIndex(c[a]),this.quill.setSelection(d,d),this.oldDelta=this.quill.getContents(),this.stack[b].push(c)):void 0},a}(),d.registerModule("undo-manager",e),b.exports=e},{"../quill":35}],35:[function(a,b){var c,d,e,f,g,h,i,j,k,l={}.hasOwnProperty,m=function(a,b){function c(){this.constructor=a}for(var d in b)l.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a},n=[].slice;k=a("lodash"),j=a("../package.json"),c=a("rich-text").Delta,e=a("eventemitter2").EventEmitter2,i=a("./lib/dom"),d=a("./core/editor"),f=a("./core/format"),h=a("./lib/range"),g=function(a){function b(a,c){var e,f,g;if(null==c&&(c={}),k.isString(a)&&(a=document.querySelector(a)),null==a)throw new Error("Invalid Quill container");if(f=k.defaults(c.modules||{},b.DEFAULTS.modules),e=a.innerHTML,this.options=k.defaults(c,b.DEFAULTS),this.options.modules=f,this.options.id=this.id="quill-"+(b.editors.length+1),this.options.emitter=this,this.modules={},this.editor=new d(a,this,this.options),this.root=this.editor.doc.root,b.editors.push(this),this.setHTML(e,b.sources.SILENT),g=b.themes[this.options.theme],null==g)throw new Error("Cannot load "+this.options.theme+" theme. Are you sure you registered it?");this.theme=new g(this,this.options),k.each(this.options.modules,function(a){return function(b,c){return a.addModule(c,b)}}(this))}return m(b,a),b.version=j.version,b.editors=[],b.modules=[],b.themes=[],b.DEFAULTS={formats:["align","bold","italic","strike","underline","color","background","font","size","link","image","bullet","list"],modules:{keyboard:!0,"paste-manager":!0,"undo-manager":!0},pollInterval:100,readOnly:!1,theme:"default"},b.events={MODULE_INIT:"module-init",POST_EVENT:"post-event",PRE_EVENT:"pre-event",SELECTION_CHANGE:"selection-change",TEXT_CHANGE:"text-change"},b.sources=d.sources,b.registerModule=function(a,c){return null!=b.modules[a]&&console.warn("Overwriting "+a+" module"),b.modules[a]=c},b.registerTheme=function(a,c){return null!=b.themes[a]&&console.warn("Overwriting "+a+" theme"),b.themes[a]=c},b.require=function(a){switch(a){case"lodash":return k;case"delta":return c;case"dom":return i;default:return null}},b.prototype.addContainer=function(a,b){return null==b&&(b=!1),this.editor.renderer.addContainer(a,b)},b.prototype.addFormat=function(a,b){return this.editor.doc.addFormat(a,b)},b.prototype.addModule=function(a,c){var d;if(d=b.modules[a],null==d)throw new Error("Cannot load "+a+" module. Are you sure you registered it?");return k.isObject(c)||(c={}),c=k.defaults(c,this.theme.constructor.OPTIONS[a]||{},d.DEFAULTS||{}),this.modules[a]=new d(this,c),this.emit(b.events.MODULE_INIT,a,this.modules[a]),this.modules[a]},b.prototype.addStyles=function(a){return this.editor.renderer.addStyles(a)},b.prototype.deleteText=function(a,d,e){var f,g,h;return null==e&&(e=b.sources.API),h=this._buildParams(a,d,{},e),a=h[0],d=h[1],g=h[2],e=h[3],d>a?(f=(new c).retain(a)["delete"](d-a),this.editor.applyDelta(f,e)):void 0},b.prototype.emit=function(){var a,c;return c=arguments[0],a=2<=arguments.length?n.call(arguments,1):[],b.__super__.emit.apply(this,[b.events.PRE_EVENT,c].concat(n.call(a))),b.__super__.emit.apply(this,[c].concat(n.call(a))),b.__super__.emit.apply(this,[b.events.POST_EVENT,c].concat(n.call(a)))},b.prototype.focus=function(){return this.editor.focus()},b.prototype.formatLine=function(a,b,c,d,e){var f,g,h,i,j;return i=this._buildParams(a,b,c,d,e),a=i[0],b=i[1],f=i[2],e=i[3],j=this.editor.doc.findLineAt(b),g=j[0],h=j[1],null!=g&&(b+=g.length-h),this.formatText(a,b,f,e)},b.prototype.formatText=function(a,b,d,e,f){var g,h,i;return i=this._buildParams(a,b,d,e,f),a=i[0],b=i[1],h=i[2],f=i[3],h=k.reduce(h,function(a){return function(b,c,d){var e;return e=a.editor.doc.formats[d],c&&c!==e.config["default"]||(b[d]=null),b}}(this),h),g=(new c).retain(a).retain(b-a,h),this.editor.applyDelta(g,f)},b.prototype.getContents=function(a,b){return null==a&&(a=0),null==b&&(b=null),k.isObject(a)&&(b=a.end,a=a.start),this.editor.getDelta().slice(a,b)},b.prototype.getHTML=function(){return this.root.innerHTML},b.prototype.getLength=function(){return this.editor.getDelta().length()},b.prototype.getModule=function(a){return this.modules[a]},b.prototype.getSelection=function(){return this.editor.checkUpdate(),this.editor.selection.getRange()},b.prototype.getText=function(a,b){return null==a&&(a=0),null==b&&(b=null),k.map(this.getContents(a,b).ops,function(a){return k.isString(a.insert)?a.insert:""}).join("")},b.prototype.insertEmbed=function(a,b,c,d){return this.insertText(a,i.EMBED_TEXT,b,c,d)},b.prototype.insertText=function(a,b,d,e,f){var g,h,i,j;return j=this._buildParams(a,0,d,e,f),a=j[0],h=j[1],i=j[2],f=j[3],b.length>0?(g=(new c).retain(a).insert(b,i),this.editor.applyDelta(g,f)):void 0},b.prototype.onModuleLoad=function(a,c){return this.modules[a]?c(this.modules[a]):this.on(b.events.MODULE_INIT,function(b,d){return b===a?c(d):void 0})},b.prototype.prepareFormat=function(a,c){var d,e;return d=this.editor.doc.formats[a],null!=d&&(e=this.getSelection(),null!=e?e.isCollapsed():void 0)?d.isType(f.types.LINE)?this.formatLine(e,a,c,b.sources.USER):d.prepare(c):void 0},b.prototype.setContents=function(a,c){return null==c&&(c=b.sources.API),k.isArray(a)&&(a={ops:a}),a.ops.unshift({"delete":this.getLength()}),this.updateContents(a,c)},b.prototype.setHTML=function(a,c){return null==c&&(c=b.sources.API),a||(a="<"+i.DEFAULT_BLOCK_TAG+"><"+i.DEFAULT_BREAK_TAG+">"),this.editor.doc.setHTML(a),this.editor.checkUpdate(c)},b.prototype.setSelection=function(a,c,d){var e;return null==d&&(d=b.sources.API),k.isNumber(a)&&k.isNumber(c)?e=new h(a,c):(e=a,d=c||d),this.editor.selection.setRange(e,d)},b.prototype.updateContents=function(a,c){return null==c&&(c=b.sources.API),this.editor.applyDelta(a,c)},b.prototype._buildParams=function(){var a,c;return c=1<=arguments.length?n.call(arguments,0):[],k.isObject(c[0])&&c.splice(0,1,c[0].start,c[0].end),k.isString(c[2])&&(a={},a[c[2]]=c[3],c.splice(2,2,a)),null==c[3]&&(c[3]=b.sources.API),c},b}(e),g.registerTheme("default",a("./themes/default")),g.registerTheme("snow",a("./themes/snow")),b.exports=g},{"../package.json":11,"./core/editor":13,"./core/format":14,"./lib/dom":21,"./lib/range":25,"./themes/default":36,"./themes/snow":37,eventemitter2:3,lodash:"M4+//f","rich-text":4}],36:[function(a,b){var c;c=function(){function a(a){this.quill=a,this.editor=this.quill.editor,this.editorContainer=this.editor.root}return a.OPTIONS={},a}(),b.exports=c},{}],37:[function(a,b){var c,d,e,f,g,h,i={}.hasOwnProperty,j=function(a,b){function c(){this.constructor=a}for(var d in b)i.call(b,d)&&(a[d]=b[d]);return c.prototype=b.prototype,a.prototype=new c,a.__super__=b.prototype,a};h=a("lodash"),c=a("../../lib/color-picker"),d=a("../default"),g=a("../../lib/dom"),e=a("../../lib/picker"),f=function(a){function b(a){this.quill=a,b.__super__.constructor.apply(this,arguments),this.quill.addStyles(b.STYLES),this.pickers=[],this.quill.on(this.quill.constructor.events.SELECTION_CHANGE,function(a){return function(b){return null!=b?h.invoke(a.pickers,"close"):void 0}}(this)),g(this.quill.root.ownerDocument.body).addClass("snow"),this.quill.onModuleLoad("multi-cursor",h.bind(this.extendMultiCursor,this)),this.quill.onModuleLoad("toolbar",h.bind(this.extendToolbar,this))}return j(b,a),b.COLORS=["#000000","#e60000","#ff9900","#ffff00","#008A00","#0066cc","#9933ff","#ffffff","#facccc","#ffebcc","#ffffcc","#cce8cc","#cce0f5","#ebd6ff","#bbbbbb","#f06666","#ffc266","#ffff66","#66b966","#66a3e0","#c285ff","#888888","#a10000","#b26b00","#b2b200","#006100","#0047b2","#6b24b2","#444444","#5c0000","#663d00","#666600","#003700","#002966","#3d1466"],b.OPTIONS={"multi-cursor":{template:' '}},b.STYLES={".snow .image-tooltip-container a":{border:"1px solid #06c"},".snow .image-tooltip-container a.insert":{"background-color":"#06c",color:"#fff"},".snow .cursor-name":{"border-radius":"4px","font-size":"11px","font-family":"Arial","margin-left":"-50%",padding:"4px 10px"},".snow .cursor-triangle":{"border-left":"4px solid transparent","border-right":"4px solid transparent",height:"0px","margin-left":"-3px",width:"0px"},".snow .cursor.left .cursor-name":{"margin-left":"-8px"},".snow .cursor.right .cursor-flag":{right:"auto"},".snow .cursor.right .cursor-name":{"margin-left":"-100%","margin-right":"-8px"},".snow .cursor-triangle.bottom":{"border-top":"4px solid transparent",display:"block","margin-bottom":"-1px"},".snow .cursor-triangle.top":{"border-bottom":"4px solid transparent",display:"none","margin-top":"-1px"},".snow .cursor.top .cursor-triangle.bottom":{display:"none"},".snow .cursor.top .cursor-triangle.top":{display:"block"},".snow a":{color:"#06c"},".snow .tooltip":{border:"1px solid #ccc","box-shadow":"0px 0px 5px #ddd",color:"#222"},".snow .tooltip a":{color:"#06c"},".snow .tooltip .input":{border:"1px solid #ccc",margin:"0px",padding:"5px"},".snow .image-tooltip-container .preview":{"border-color":"#ccc",color:"#ccc"},".snow .link-tooltip-container a, .snow .link-tooltip-container span":{display:"inline-block","line-height":"25px"}},b.prototype.extendMultiCursor=function(a){return a.on(a.constructor.events.CURSOR_ADDED,function(a){var b,c;return b=a.elem.querySelector(".cursor-triangle.bottom"),c=a.elem.querySelector(".cursor-triangle.top"),b.style.borderTopColor=c.style.borderBottomColor=a.color})},b.prototype.extendToolbar=function(a){return h.each(["color","background","font","size","align"],function(b){return function(d){var f,i;if(i=a.container.querySelector(".ql-"+d),null!=i){switch(d){case"font":case"size":case"align":f=new e(i);break;case"color":case"background":f=new c(i),h.each(f.container.querySelectorAll(".ql-picker-item"),function(a,b){return 7>b?g(a).addClass("ql-primary-color"):void 0})}return null!=f?b.pickers.push(f):void 0}}}(this)),h.each(g(a.container).textNodes(),function(a){return 0===g(a).text().trim().length?g(a).remove():void 0})},b}(d),b.exports=f},{"../../lib/color-picker":20,"../../lib/dom":21,"../../lib/picker":24,"../default":36,lodash:"M4+//f"}]},{},[19])(19)}); \ No newline at end of file diff --git a/dist/quill.snow.css b/dist/quill.snow.css new file mode 100644 index 0000000000..5a60af3a9b --- /dev/null +++ b/dist/quill.snow.css @@ -0,0 +1,657 @@ +/*! Quill Editor v0.18.1 + * https://quilljs.com/ + * Copyright (c) 2014, Jason Chen + * Copyright (c) 2013, salesforce.com + */ +.ql-toolbar-container { + box-sizing: border-box; + padding: 8px; + user-select: none; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; +} +.ql-toolbar-container .ql-format-group { + display: inline-block; + margin-right: 15px; + vertical-align: middle; +} +.ql-toolbar-container .ql-format-separator { + box-sizing: border-box; + background-color: #ddd; + display: inline-block; + height: 14px; + margin-left: 4px; + margin-right: 4px; + vertical-align: middle; + width: 1px; +} +.ql-toolbar-container .ql-format-button { + box-sizing: border-box; + display: inline-block; + height: 24px; + line-height: 24px; + vertical-align: middle; + background-position: center center; + background-repeat: no-repeat; + background-size: 18px 18px; + box-sizing: border-box; + cursor: pointer; + text-align: center; + width: 24px; +} +.ql-picker { + box-sizing: border-box; + color: #444; + display: inline-block; + font-family: 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif; + font-size: 14px; + font-weight: 500; + position: relative; +} +.ql-picker .ql-picker-label { + box-sizing: border-box; + display: inline-block; + height: 24px; + line-height: 24px; + vertical-align: middle; + background-color: #fff; + background-position: right center; + background-repeat: no-repeat; + background-size: 18px 18px; + border: 1px solid transparent; + cursor: pointer; + position: relative; + width: 100%; +} +.ql-picker .ql-picker-label.ql-active, +.ql-picker .ql-picker-label:hover { + color: #06c; +} +.ql-picker .ql-picker-options { + background-color: #fff; + border: 1px solid transparent; + box-sizing: border-box; + display: none; + padding: 4px 8px; + position: absolute; + width: 100%; +} +.ql-picker .ql-picker-options .ql-picker-item { + background-position: center center; + background-repeat: no-repeat; + background-size: 18px 18px; + box-sizing: border-box; + cursor: pointer; + display: block; + padding-bottom: 5px; + padding-top: 5px; +} +.ql-picker .ql-picker-options .ql-picker-item.ql-selected, +.ql-picker .ql-picker-options .ql-picker-item:hover { + color: #06c; +} +.ql-picker.ql-expanded .ql-picker-label { + border-color: #ccc; + color: #ccc; + z-index: 2; +} +.ql-picker.ql-expanded .ql-picker-options { + border-color: #ccc; + box-shadow: rgba(0,0,0,0.2) 0 2px 8px; + display: block; + margin-top: -1px; + z-index: 1; +} +.ql-picker.ql-color-picker .ql-picker-label { + background-position: center center; + width: 28px; +} +.ql-picker.ql-color-picker .ql-picker-options { + padding: 5px; + width: 152px; +} +.ql-picker.ql-color-picker .ql-picker-options .ql-picker-item { + border: 1px solid transparent; + float: left; + height: 16px; + margin: 2px; + padding: 0px; + width: 16px; +} +.ql-picker.ql-color-picker .ql-picker-options .ql-picker-item.ql-primary-color { + margin-bottom: 8px; +} +.ql-picker.ql-color-picker .ql-picker-options .ql-picker-item.ql-selected, +.ql-picker.ql-color-picker .ql-picker-options .ql-picker-item:hover { + border-color: #000; +} +.ql-picker.ql-font { + width: 105px; +} +.ql-picker.ql-size { + width: 80px; +} +.ql-picker.ql-font .ql-picker-label, +.ql-picker.ql-size .ql-picker-label { + padding-left: 8px; + padding-right: 8px; +} +.ql-picker.ql-align .ql-picker-label { + background-position: center center; + width: 28px; +} +.ql-picker.ql-align .ql-picker-item { + box-sizing: border-box; + display: inline-block; + height: 24px; + line-height: 24px; + vertical-align: middle; + padding: 0px; + width: 28px; +} +.ql-picker.ql-align .ql-picker-options { + padding: 4px 0px; +} +.ql-toolbar-container .ql-picker .ql-picker-label { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASBAMAAACk4JNkAAAAKlBMVEUAAABJSUlAQEBERERFRUVERERERERERERERERFRUVEREREREREREREREQJcW6NAAAADXRSTlMAFRzExcbLzM/Q0dLbKbcyLwAAADVJREFUCNdjYCAeMKYJQFnSdzdCWbl3r0NZvnev4tFre/cKlNV79yaUpXP3EJTFtEqBBHcAAHyoDQk0vM/lAAAAAElFTkSuQmCC"); +} +.ql-toolbar-container .ql-picker.ql-expanded .ql-picker-label { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAdElEQVR42mP4//8/VfBINGjVqlUMhw4dEj148OBpEAaxQWKkGgQz5BIQ/4fiSyAxkg2CuuQ/Gj5DjkFHsRh0jJwwwooHzCCQ145g8dpRcgw6j8WgCyQbtH//fhmgxttIhtwGiZETRjDDLoIwiA0UG820FGAA5b25+qRqGXcAAAAASUVORK5CYII="); +} +.ql-toolbar-container .ql-picker.ql-active:not(.ql-expanded) .ql-picker-label, +.ql-toolbar-container:not(.ios) .ql-picker:not(.ql-expanded) .ql-picker-label:hover { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASBAMAAACk4JNkAAAAKlBMVEUAAAAAYc4AZMgAZcwAZs0AZs0AZs0AZ8wAZswAZs0AZswAZswAZswAZsx12LPhAAAADXRSTlMAFRzExcbLzM/Q0dLbKbcyLwAAADVJREFUCNdjYCAeMKYJQFnSdzdCWbl3r0NZvnev4tFre/cKlNV79yaUpXP3EJTFtEqBBHcAAHyoDQk0vM/lAAAAAElFTkSuQmCC"); +} +.ql-toolbar-container .ql-format-button.ql-bold, +.ql-toolbar-container .ql-picker.ql-bold .ql-picker-label, +.ql-toolbar-container .ql-picker .ql-picker-label[data-value=bold], +.ql-toolbar-container .ql-picker .ql-picker-item[data-value=bold] { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAMAAABhEH5lAAAAYFBMVEUAAACAgIBAQEA5OTlAQEBERERAQEBERERERERERERDQ0NERERERERERERDQ0NERERERERFRUVERERERERFRUVERERERERERERERERERERERERERERERERERERERERERESN6WzHAAAAH3RSTlMAAggJDA8cQEtTWHF/i4yTpau+xMXX3O7v8/f6+/z+qN9w2AAAAFZJREFUeNqlzMcSgCAMRVEsYO+9vv//S9FhNIYld5HFmSTCqQ66dazkRzA1lPSQGRZGIsDMKMxRW7+2yCIcyf/QUyUGSnc+dkaqoFumM32pf2BqY+HUBfQaCPgVIBc1AAAAAElFTkSuQmCC"); +} +.ql-toolbar-container .ql-format-button.ql-bold.ql-active, +.ql-toolbar-container .ql-picker.ql-bold .ql-picker-label.ql-active, +.ql-toolbar-container .ql-picker .ql-picker-label[data-value=bold].ql-active, +.ql-toolbar-container .ql-picker .ql-picker-item[data-value=bold].ql-selected, +.ql-toolbar-container:not(.ios) .ql-format-button.ql-bold:hover, +.ql-toolbar-container:not(.ios) .ql-picker.ql-bold .ql-picker-label:hover, +.ql-toolbar-container:not(.ios) .ql-picker .ql-picker-label[data-value=bold]:hover, +.ql-toolbar-container:not(.ios) .ql-picker .ql-picker-item[data-value=bold]:hover { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAMAAABhEH5lAAAAYFBMVEUAAAAAgP8AYL8AccYAatUAZswAZMgAZMsAZswAZcsAZcsAZssAZssAZ80AZswAZs0AZswAZ8wAZswAZcwAZs0AZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZsxCU9XcAAAAH3RSTlMAAggJDA8cQEtTWHF/i4yTpau+xMXX3O7v8/f6+/z+qN9w2AAAAFZJREFUeNqlzMcSgCAMRVEsYO+9vv//S9FhNIYld5HFmSTCqQ66dazkRzA1lPSQGRZGIsDMKMxRW7+2yCIcyf/QUyUGSnc+dkaqoFumM32pf2BqY+HUBfQaCPgVIBc1AAAAAElFTkSuQmCC"); +} +.ql-toolbar-container .ql-format-button.ql-italic, +.ql-toolbar-container .ql-picker.ql-italic .ql-picker-label, +.ql-toolbar-container .ql-picker .ql-picker-label[data-value=italic], +.ql-toolbar-container .ql-picker .ql-picker-item[data-value=italic] { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAi0lEQVR42mMYvoARl4SLi0sNkGoAYmY0qf+MjIztu3fvrkYWZGLADZhB8pS4CN1lQUBqLRDvAQJXHMqIstEISp8BEZQYZAIi/v//f5ZSg0xBBCMj4ymyDQKGjxKQEgLiV8DweUS2QUBXGEOZp0EEJV4zgdJnKDLo379/JsS6iJHSFA0DTDhT9CiAAQBbWyIY/pd4rQAAAABJRU5ErkJggg=="); +} +.ql-toolbar-container .ql-format-button.ql-italic.ql-active, +.ql-toolbar-container .ql-picker.ql-italic .ql-picker-label.ql-active, +.ql-toolbar-container .ql-picker .ql-picker-label[data-value=italic].ql-active, +.ql-toolbar-container .ql-picker .ql-picker-item[data-value=italic].ql-selected, +.ql-toolbar-container:not(.ios) .ql-format-button.ql-italic:hover, +.ql-toolbar-container:not(.ios) .ql-picker.ql-italic .ql-picker-label:hover, +.ql-toolbar-container:not(.ios) .ql-picker .ql-picker-label[data-value=italic]:hover, +.ql-toolbar-container:not(.ios) .ql-picker .ql-picker-item[data-value=italic]:hover { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAAk0lEQVR42u3SsQ3CMBBA0X/2BozACMQswg4EMQMUdOyQVdggdpagZAc4ihjJjYmU66K8xpZsfdnSsVxCzTFdEW6AB0oKcqdrLhQcNaK+PLc79QfapLTDgz8cU9Tv8ibZQqIBgI8OxhexH29KPz90jltgA7zownN+6C0Nowhg+JqEvCZbSDSHNDJBLBNdctWJXv18Ad5dJL0jVfDhAAAAAElFTkSuQmCC"); +} +.ql-toolbar-container .ql-format-button.ql-underline, +.ql-toolbar-container .ql-picker.ql-underline .ql-picker-label, +.ql-toolbar-container .ql-picker .ql-picker-label[data-value=underline], +.ql-toolbar-container .ql-picker .ql-picker-item[data-value=underline] { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAMAAABhEH5lAAAAM1BMVEUAAABLS0tFRUVDQ0NERERDQ0NFRUVFRUVERERDQ0NERERFRUVERERERERERERERERERESvCHKbAAAAEHRSTlMAERpMbW6Bgry9xMXh5PP51ZZfkwAAAEdJREFUeNq9yEEKgDAMRNHERDWq6dz/tFLBQUC6KfRtPnzpsh/sC2AHrcRUo0iuDXONI7gMxVW9wIQWPFb5sMgMk5YTdMmvGw2DA8yS9di7AAAAAElFTkSuQmCC"); +} +.ql-toolbar-container .ql-format-button.ql-underline.ql-active, +.ql-toolbar-container .ql-picker.ql-underline .ql-picker-label.ql-active, +.ql-toolbar-container .ql-picker .ql-picker-label[data-value=underline].ql-active, +.ql-toolbar-container .ql-picker .ql-picker-item[data-value=underline].ql-selected, +.ql-toolbar-container:not(.ios) .ql-format-button.ql-underline:hover, +.ql-toolbar-container:not(.ios) .ql-picker.ql-underline .ql-picker-label:hover, +.ql-toolbar-container:not(.ios) .ql-picker .ql-picker-label[data-value=underline]:hover, +.ql-toolbar-container:not(.ios) .ql-picker .ql-picker-item[data-value=underline]:hover { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAMAAABhEH5lAAAAM1BMVEUAAAAAadIAYs4AZc0AZcwAZswAZ84AZswAZs0AZ8wAZcwAZs0AZswAZswAZswAZswAZsycBlETAAAAEHRSTlMAERpMbW6Bgry9xMXh5PP51ZZfkwAAAEdJREFUeNq9yEEKgDAMRNHERDWq6dz/tFLBQUC6KfRtPnzpsh/sC2AHrcRUo0iuDXONI7gMxVW9wIQWPFb5sMgMk5YTdMmvGw2DA8yS9di7AAAAAElFTkSuQmCC"); +} +.ql-toolbar-container .ql-format-button.ql-strike, +.ql-toolbar-container .ql-picker.ql-strike .ql-picker-label, +.ql-toolbar-container .ql-picker .ql-picker-label[data-value=strike], +.ql-toolbar-container .ql-picker .ql-picker-item[data-value=strike] { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAMAAABhEH5lAAAAn1BMVEUAAAAAAACAgIBAQEA7OztAQEBLS0tHR0dAQEBJSUlGRkZERERCQkJERERDQ0NERERERERDQ0NFRUVERERERERERERERERERERFRUVERERERERERERFRUVDQ0NFRUVERERFRUVFRUVERERFRUVFRUVFRUVERERFRUVFRUVERERERERERERERERERERERERERERERERERERERERERERERERfrjwTAAAANHRSTlMAAQIMDRAREhQVKCk6PEhLT1xkZWZ4e4CCg4SIiZucoaersLK2wcTFydLX2ODi5err8fX3BKZfrQAAAH5JREFUGBmlwOEWgTAYBuC3isgMxCYAmwRh++7/2qRzttP/HnQTZjdjilkALzhR4wBvQiaLk8WXOJwlHVHjYgxnSmbeR0swGEkpxWZ3vt7fL/w9P4/ist+KdZ7zYYiWiCnScFYiRq1HFo4mxaKIKdJw0ooaVQovkaW1pUzQyQ86Agx4yKmWPAAAAABJRU5ErkJggg=="); +} +.ql-toolbar-container .ql-format-button.ql-strike.ql-active, +.ql-toolbar-container .ql-picker.ql-strike .ql-picker-label.ql-active, +.ql-toolbar-container .ql-picker .ql-picker-label[data-value=strike].ql-active, +.ql-toolbar-container .ql-picker .ql-picker-item[data-value=strike].ql-selected, +.ql-toolbar-container:not(.ios) .ql-format-button.ql-strike:hover, +.ql-toolbar-container:not(.ios) .ql-picker.ql-strike .ql-picker-label:hover, +.ql-toolbar-container:not(.ios) .ql-picker .ql-picker-label[data-value=strike]:hover, +.ql-toolbar-container:not(.ios) .ql-picker .ql-picker-item[data-value=strike]:hover { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAMAAABhEH5lAAAAolBMVEUAAAAAAP8AgP8AatUAYsQAYM8AadIAY8YAZswAYc4AZswAZM0AZcoAZswAZ8oAZswAZMsAZ8oAZswAZcoAZ8sAZswAZssAZssAZs0AZswAZ8wAZs0AZ8wAZs0AZswAZ8wAZ8wAZs0AZ8wAZ8wAZs0AZs0AZs0AZcwAZs0AZcwAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZsyiCU+yAAAANXRSTlMAAQIMDRAREhQVKCk6PEhLT1xkZWZ4e4CAgoOEiImbnKGnq7CytsHExcnS19jg4uXq6/H190B1i7AAAAB/SURBVBgZpcDhFoEwGAbgt4pIBmImAJsEYfvu/9ZU52yn/z3oxk/vWuczD453psYRzoR0GkaLHzFYSzqhwvgY1pT0vI8WbzASQvDt/nJ7fN6ovb7P/HrYrTdZxoY+WoJEkoK14iEqPTKwFMkkCBJJClZcUqOM4USiMKYQETr5A2SVDLpJv6ZtAAAAAElFTkSuQmCC"); +} +.ql-toolbar-container .ql-format-button.ql-link, +.ql-toolbar-container .ql-picker.ql-link .ql-picker-label, +.ql-toolbar-container .ql-picker .ql-picker-label[data-value=link], +.ql-toolbar-container .ql-picker .ql-picker-item[data-value=link] { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAMAAABhEH5lAAAAllBMVEUAAAD///9VVVVJSUk5OTlAQEBHR0dFRUVCQkJHR0dBQUFCQkJGRkZDQ0NGRkZFRUVCQkJDQ0NERERDQ0NERERFRUVERERFRUVDQ0NERERFRUVERERERERFRUVERERERERERERERERFRUVERERFRUVFRUVERERERERERERERERERERERERERERERERERERERERERERERETx5KUoAAAAMXRSTlMAAAYHCQwZGiMkJzIzOUJOYGNlfoCJl5ibnaCxtLa8xsfIycrQ1OHi5uvs7e/19vn8NGTYeAAAAJdJREFUeNqN0McOgkAARdGnFJWiKGBhEEFpSn3//3OGjMmQ6MK7PMuLxVe/CXDTPl5DJmk3cOTTmZE7MDQES11RyhBY5vQU9aOB2z3gWVFMsXywYx3t9Q9tXsyDjlOVLQlOyanOL1ibkqB7l5odM01QSJqK6GdXmGwUHVhowImJIr2iMI9sLUWwa5LtFjPCSjSJBUl//HoDlmQPy0DFuCkAAAAASUVORK5CYII="); +} +.ql-toolbar-container .ql-format-button.ql-link.ql-active, +.ql-toolbar-container .ql-picker.ql-link .ql-picker-label.ql-active, +.ql-toolbar-container .ql-picker .ql-picker-label[data-value=link].ql-active, +.ql-toolbar-container .ql-picker .ql-picker-item[data-value=link].ql-selected, +.ql-toolbar-container:not(.ios) .ql-format-button.ql-link:hover, +.ql-toolbar-container:not(.ios) .ql-picker.ql-link .ql-picker-label:hover, +.ql-toolbar-container:not(.ios) .ql-picker .ql-picker-label[data-value=link]:hover, +.ql-toolbar-container:not(.ios) .ql-picker .ql-picker-item[data-value=link]:hover { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAMAAABhEH5lAAAAmVBMVEUAAAD///8AVdUAbdsAccYAatUAZswAYs4AZswAY80AacsAZswAZM0AZ8kAZM0AZcsAZcoAZMsAZcoAZcoAZssAZs0AZs0AZ8wAZs0AZswAZs0AZswAZs0AZswAZs0AZs0AZs0AZ8wAZswAZcwAZs0AZs0AZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZsy/jsjWAAAAMnRSTlMAAAYHCQwZGiMkJzIzOUJOYGNlfoCAiZeYm52gsbS2vMbHyMnK0NTh4ubr7O3v9fb5/BM/koAAAACXSURBVHjajdDbEoFQAIXhpROqiAjaSdGJSq33fzjTbDO7GS78l9/lj9lXvwnw0le8gEzSuufAhzshr2doCpaGopQhoOX0Fb0GE9fbnidFMYV2Z8c62hgfWj6Z7zqOVY4kuCXHuqBgbUmC4Z9rdsx0QSFpLGKQXWCxUbRloQNHJoqMisI6sLUVwalJtitMCHPRJDYk/fHrDdIHECSPJag6AAAAAElFTkSuQmCC"); +} +.ql-toolbar-container .ql-format-button.ql-image, +.ql-toolbar-container .ql-picker.ql-image .ql-picker-label, +.ql-toolbar-container .ql-picker .ql-picker-label[data-value=image], +.ql-toolbar-container .ql-picker .ql-picker-item[data-value=image] { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASBAMAAACk4JNkAAAAElBMVEUAAABERERERERFRUVEREREREQbmEZBAAAABXRSTlMAeMTFxj7M9NAAAABBSURBVAjXY2DAD1RDQSAYyAqFABALLANmMRnAWMwODIIMUFnGUAEIS1A0NADMYgTqhLBY4SyEKXCTTcGMEAJuAgBa9RKl6Fva+wAAAABJRU5ErkJggg=="); +} +.ql-toolbar-container .ql-format-button.ql-image.ql-active, +.ql-toolbar-container .ql-picker.ql-image .ql-picker-label.ql-active, +.ql-toolbar-container .ql-picker .ql-picker-label[data-value=image].ql-active, +.ql-toolbar-container .ql-picker .ql-picker-item[data-value=image].ql-selected, +.ql-toolbar-container:not(.ios) .ql-format-button.ql-image:hover, +.ql-toolbar-container:not(.ios) .ql-picker.ql-image .ql-picker-label:hover, +.ql-toolbar-container:not(.ios) .ql-picker .ql-picker-label[data-value=image]:hover, +.ql-toolbar-container:not(.ios) .ql-picker .ql-picker-item[data-value=image]:hover { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASBAMAAACk4JNkAAAAElBMVEUAAAAAZswAZcwAZs0AZs0AZszYB6XUAAAABXRSTlMAeMTFxj7M9NAAAABBSURBVAjXY2DAD1RDQSAYyAqFABALLANmMRnAWMwODIIMUFnGUAEIS1A0NADMYgTqhLBY4SyEKXCTTcGMEAJuAgBa9RKl6Fva+wAAAABJRU5ErkJggg=="); +} +.ql-toolbar-container .ql-format-button.ql-list, +.ql-toolbar-container .ql-picker.ql-list .ql-picker-label, +.ql-toolbar-container .ql-picker .ql-picker-label[data-value=list], +.ql-toolbar-container .ql-picker .ql-picker-item[data-value=list] { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAMAAABhEH5lAAAAS1BMVEUAAABCQkJFRUVGRkZFRUVCQkJFRUVDQ0NFRUVFRUVFRUVERERERERERERERERFRUVERERERERERERERERERERERERERERERERERET32eciAAAAGHRSTlMAMjRCQ0lOfYKQlJmaocTFxuHi5OXm9falfyKhAAAATElEQVR42mMgFnCKYIpJMDDwSUABP1yIHyYkABYRlBAmwngucV50IXZGIXTjmQTZ0I0XIcp4DjEedCFWFlF041mZRdCN5xDjZiAdAACXwgbrzvG+ZgAAAABJRU5ErkJggg=="); +} +.ql-toolbar-container .ql-format-button.ql-list.ql-active, +.ql-toolbar-container .ql-picker.ql-list .ql-picker-label.ql-active, +.ql-toolbar-container .ql-picker .ql-picker-label[data-value=list].ql-active, +.ql-toolbar-container .ql-picker .ql-picker-item[data-value=list].ql-selected, +.ql-toolbar-container:not(.ios) .ql-format-button.ql-list:hover, +.ql-toolbar-container:not(.ios) .ql-picker.ql-list .ql-picker-label:hover, +.ql-toolbar-container:not(.ios) .ql-picker .ql-picker-label[data-value=list]:hover, +.ql-toolbar-container:not(.ios) .ql-picker .ql-picker-item[data-value=list]:hover { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAMAAABhEH5lAAAAS1BMVEUAAAAAZswAZ8kAZM0AZ8oAZcsAZcsAZswAZswAZ80AZs0AZs0AZ80AZ8wAZcwAZs0AZs0AZswAZswAZswAZswAZswAZswAZswAZswCB3gJAAAAGHRSTlMAMjRCQ0lOfYKQlJmaocTFxuHi5OXm9falfyKhAAAATElEQVR42mMgFnCKYIpJMDDwSUABP1yIHyYkABYRlBAmwngucV50IXZGIXTjmQTZ0I0XIcp4DjEedCFWFlF041mZRdCN5xDjZiAdAACXwgbrzvG+ZgAAAABJRU5ErkJggg=="); +} +.ql-toolbar-container .ql-format-button.ql-bullet, +.ql-toolbar-container .ql-picker.ql-bullet .ql-picker-label, +.ql-toolbar-container .ql-picker .ql-picker-label[data-value=bullet], +.ql-toolbar-container .ql-picker .ql-picker-item[data-value=bullet] { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASBAMAAACk4JNkAAAAD1BMVEUAAABERERFRUVERERERETRGyWnAAAABHRSTlMAxMXG4b8ciAAAABxJREFUCNdjYMAPhBhdgMAJyFJmArGcGRgGXAcA/t0ImAOSO9kAAAAASUVORK5CYII="); +} +.ql-toolbar-container .ql-format-button.ql-bullet.ql-active, +.ql-toolbar-container .ql-picker.ql-bullet .ql-picker-label.ql-active, +.ql-toolbar-container .ql-picker .ql-picker-label[data-value=bullet].ql-active, +.ql-toolbar-container .ql-picker .ql-picker-item[data-value=bullet].ql-selected, +.ql-toolbar-container:not(.ios) .ql-format-button.ql-bullet:hover, +.ql-toolbar-container:not(.ios) .ql-picker.ql-bullet .ql-picker-label:hover, +.ql-toolbar-container:not(.ios) .ql-picker .ql-picker-label[data-value=bullet]:hover, +.ql-toolbar-container:not(.ios) .ql-picker .ql-picker-item[data-value=bullet]:hover { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASBAMAAACk4JNkAAAAD1BMVEUAAAAAZcwAZs0AZs0AZsyEYJIjAAAABHRSTlMAxMXG4b8ciAAAABxJREFUCNdjYMAPhBhdgMAJyFJmArGcGRgGXAcA/t0ImAOSO9kAAAAASUVORK5CYII="); +} +.ql-toolbar-container .ql-format-button.ql-authorship, +.ql-toolbar-container .ql-picker.ql-authorship .ql-picker-label, +.ql-toolbar-container .ql-picker .ql-picker-label[data-value=authorship], +.ql-toolbar-container .ql-picker .ql-picker-item[data-value=authorship] { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAMAAABhEH5lAAAARVBMVEUAAABFRUVFRUUAAAAAAABERERDQ0NEREQAAABERERERERERERERERERERFRUVERERERERERERERERERERERERERERERERVeSBUAAAAFnRSTlMAMDtOT1JfYmassMfN09Ta6vD4+fz9w8DTTwAAAExJREFUGBmVwEkSgCAMBMBRQUEU4zb/f6oFF5KbNLp4EQ8rkxnWQ76whBRYkYwwxo08ZijDzWJBs7La0ZysLjSJVUKXKSgOhQuKw08fJOYE1SddZQoAAAAASUVORK5CYII="); +} +.ql-toolbar-container .ql-format-button.ql-authorship.ql-active, +.ql-toolbar-container .ql-picker.ql-authorship .ql-picker-label.ql-active, +.ql-toolbar-container .ql-picker .ql-picker-label[data-value=authorship].ql-active, +.ql-toolbar-container .ql-picker .ql-picker-item[data-value=authorship].ql-selected, +.ql-toolbar-container:not(.ios) .ql-format-button.ql-authorship:hover, +.ql-toolbar-container:not(.ios) .ql-picker.ql-authorship .ql-picker-label:hover, +.ql-toolbar-container:not(.ios) .ql-picker .ql-picker-label[data-value=authorship]:hover, +.ql-toolbar-container:not(.ios) .ql-picker .ql-picker-item[data-value=authorship]:hover { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAMAAABhEH5lAAAARVBMVEUAAAAAZcoAaMsAZc4AZ8sAZ8oAZswAZcsAZ80AZs0AZ8wAZ8wAZswAZswAZswAZs0AZswAZswAZswAZswAZswAZswAZszAoUIuAAAAFnRSTlMAMDtOT1JfYmassMfN09Ta6vD4+fz9w8DTTwAAAExJREFUGBmVwEkSgCAMBMBRQUEU4zb/f6oFF5KbNLp4EQ8rkxnWQ76whBRYkYwwxo08ZijDzWJBs7La0ZysLjSJVUKXKSgOhQuKw08fJOYE1SddZQoAAAAASUVORK5CYII="); +} +.ql-toolbar-container .ql-format-button.ql-color, +.ql-toolbar-container .ql-picker.ql-color .ql-picker-label, +.ql-toolbar-container .ql-picker .ql-picker-label[data-value=color], +.ql-toolbar-container .ql-picker .ql-picker-item[data-value=color] { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAMAAABhEH5lAAAAgVBMVEUAAAAAAACAgIBAQEBVVVVDQ0NGRkZGRkZFRUVERERDQ0NDQ0NDQ0NCQkIAAABFRUUAAABDQ0NEREREREREREQAAABDQ0NDQ0NERERFRUVERERERERERERDQ0NERERERERFRUVFRUVERERERERERERERERERERERERERERERERERERLPkdWAAAAKnRSTlMAAQIEBhMWISUtLkVMTU5OT1BTVlpmeX6OkJmdvL3GztTj5/Hy8/b3/f5utmv0AAAAX0lEQVR42pXIRQ6AQABDUdzd3bX3PyCWwAwr+Is2ecyvuKriXmQD5otKoKBFQz+sKkU5khQZKdK8yMoyiQTFOIseEbqLWv6mAPW+bAPvJmN0j/N7nfmTFRI5Jzk0fWwD4sYJPnqIyzwAAAAASUVORK5CYII="); +} +.ql-toolbar-container .ql-format-button.ql-color.ql-active, +.ql-toolbar-container .ql-picker.ql-color .ql-picker-label.ql-active, +.ql-toolbar-container .ql-picker .ql-picker-label[data-value=color].ql-active, +.ql-toolbar-container .ql-picker .ql-picker-item[data-value=color].ql-selected, +.ql-toolbar-container:not(.ios) .ql-format-button.ql-color:hover, +.ql-toolbar-container:not(.ios) .ql-picker.ql-color .ql-picker-label:hover, +.ql-toolbar-container:not(.ios) .ql-picker .ql-picker-label[data-value=color]:hover, +.ql-toolbar-container:not(.ios) .ql-picker .ql-picker-item[data-value=color]:hover { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAMAAABhEH5lAAAAgVBMVEUAAAAAAP8AgP8AgL8AVdUAa8kAaNEAZMkAZ8gAZswAZM0AZMsAZc0AZ8oAZcsAZc4AZ8sAZswAZcsAZc0AZswAZ80AZcoAZcoAZs0AZ80AZs0AZs0AZs0AZ8wAZs0AZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZsy3JBcuAAAAKnRSTlMAAQIEBhMWISUtLkVMTU5OT1BTVlpmeX6OkJmdvL3GztTj5/Hy8/b3/f5utmv0AAAAX0lEQVR42pXIRQ6AQABDUdzd3bX3PyCWwAwr+Is2ecyvuKriXmQB5otKoKBFQz+sKkU5khQZKdK8yMoyiQTFOIseEbqLWv6mAPW+bAPvJmN0j/N7nfmTHRI5Jzk0fWwD4foJPqgJbeoAAAAASUVORK5CYII="); +} +.ql-toolbar-container .ql-format-button.ql-background, +.ql-toolbar-container .ql-picker.ql-background .ql-picker-label, +.ql-toolbar-container .ql-picker .ql-picker-label[data-value=background], +.ql-toolbar-container .ql-picker .ql-picker-item[data-value=background] { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAMAAABhEH5lAAAAnFBMVEUAAAAAAACAgIBAQEAAAABVVVUAAAAAAAAAAABDQ0MAAABGRkZGRkYAAABFRUVERERDQ0MAAAAAAAAAAAAAAABDQ0MAAABDQ0MAAABCQkJFRUVDQ0NERERERERERERDQ0NDQ0NERERFRUVERERERERERERDQ0NERERERERFRUVFRUVERERERERERERERERERERERERERERERERERETMTXVbAAAAM3RSTlMAAQIEBgYHCBMTFBYhIyUtLjE2N0JFS0xNTU5QU1ZaeX6OkJmdvL3GztTj5/Hy8/b3/f5Qd6EEAAAAf0lEQVR42o2PRw6DQBRDHVJISCUhvTd69/3vhgT6MLPDmoX15KfRR++c6mdKgVIOTRFoeJ6hE+tCnjXRgUv+oc02jJNyrYk/vj/8jhRxnheLVZHNupn1Yp3nVIgzjhoUDlvxQR/AIOBtKbNjerUB+x7vhZjARPkLyslbYIe+qQDqMQxGJwkBGwAAAABJRU5ErkJggg=="); +} +.ql-toolbar-container .ql-format-button.ql-background.ql-active, +.ql-toolbar-container .ql-picker.ql-background .ql-picker-label.ql-active, +.ql-toolbar-container .ql-picker .ql-picker-label[data-value=background].ql-active, +.ql-toolbar-container .ql-picker .ql-picker-item[data-value=background].ql-selected, +.ql-toolbar-container:not(.ios) .ql-format-button.ql-background:hover, +.ql-toolbar-container:not(.ios) .ql-picker.ql-background .ql-picker-label:hover, +.ql-toolbar-container:not(.ios) .ql-picker .ql-picker-label[data-value=background]:hover, +.ql-toolbar-container:not(.ios) .ql-picker .ql-picker-item[data-value=background]:hover { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAMAAABhEH5lAAAAllBMVEUAAAAAAP8AgP8AgL8AVdUAbbYAYL8Aa8kAZswAaNEAZMkAZswAZ8gAZswAZM0AaMsAaNAAZswAZM0AZMsAZswAZc0AZ8oAZ80AZcsAZswAZcsAZc0AZswAZcoAZcoAZs0AZ80AZs0AZs0AZs0AZ8wAZs0AZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZsy8dW5vAAAAMXRSTlMAAQIEBgcIExQWISMlLS4xNjdCRUtMTU1OUFNWWnl+jpCZnby9xs7U4+fx8vP29/3+dqGBzgAAAH5JREFUeNqNj0cOg0AUQx1CgFQS0nujd9//ckigDzM7rFlYT34afYzOuX2WFCjl0BWBRhAYOnEu5EkTPfjkH9pswzSr15r44/vDr6mI87JarKrCHmbOi22ethDPTDoUT3vxwRDAJOJtKbNjfnUB957uhVjATPkLyslbYIexaQB/ngudkm14XQAAAABJRU5ErkJggg=="); +} +.ql-toolbar-container .ql-format-button.ql-left, +.ql-toolbar-container .ql-picker.ql-left .ql-picker-label, +.ql-toolbar-container .ql-picker .ql-picker-label[data-value=left], +.ql-toolbar-container .ql-picker .ql-picker-item[data-value=left] { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASBAMAAACk4JNkAAAAD1BMVEUAAABERERFRUVERERERETRGyWnAAAABHRSTlMAxMXG4b8ciAAAAClJREFUCNdjYMAPRFxcnCAsFRcXZwYiAFCHC0STCpjlTJwOJwaYDoIaAKIACBBRNsu4AAAAAElFTkSuQmCC"); +} +.ql-toolbar-container .ql-format-button.ql-left.ql-active, +.ql-toolbar-container .ql-picker.ql-left .ql-picker-label.ql-active, +.ql-toolbar-container .ql-picker .ql-picker-label[data-value=left].ql-active, +.ql-toolbar-container .ql-picker .ql-picker-item[data-value=left].ql-selected, +.ql-toolbar-container:not(.ios) .ql-format-button.ql-left:hover, +.ql-toolbar-container:not(.ios) .ql-picker.ql-left .ql-picker-label:hover, +.ql-toolbar-container:not(.ios) .ql-picker .ql-picker-label[data-value=left]:hover, +.ql-toolbar-container:not(.ios) .ql-picker .ql-picker-item[data-value=left]:hover { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASBAMAAACk4JNkAAAAD1BMVEUAAAAAZcwAZs0AZs0AZsyEYJIjAAAABHRSTlMAxMXG4b8ciAAAAClJREFUCNdjYMAPRFxcnCAsFRcXZwYiAFCHC0STCpjlTJwOJwaYDoIaAKIACBBRNsu4AAAAAElFTkSuQmCC"); +} +.ql-toolbar-container .ql-format-button.ql-right, +.ql-toolbar-container .ql-picker.ql-right .ql-picker-label, +.ql-toolbar-container .ql-picker .ql-picker-label[data-value=right], +.ql-toolbar-container .ql-picker .ql-picker-item[data-value=right] { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASBAMAAACk4JNkAAAAD1BMVEUAAABERERFRUVERERERETRGyWnAAAABHRSTlMAxMXG4b8ciAAAAChJREFUCNdjYCAIRFxcnCAsFRcXZ2KUu0B0qIBZzgzEaXFigGkhpAMAmbwIEMJ9k/cAAAAASUVORK5CYII="); +} +.ql-toolbar-container .ql-format-button.ql-right.ql-active, +.ql-toolbar-container .ql-picker.ql-right .ql-picker-label.ql-active, +.ql-toolbar-container .ql-picker .ql-picker-label[data-value=right].ql-active, +.ql-toolbar-container .ql-picker .ql-picker-item[data-value=right].ql-selected, +.ql-toolbar-container:not(.ios) .ql-format-button.ql-right:hover, +.ql-toolbar-container:not(.ios) .ql-picker.ql-right .ql-picker-label:hover, +.ql-toolbar-container:not(.ios) .ql-picker .ql-picker-label[data-value=right]:hover, +.ql-toolbar-container:not(.ios) .ql-picker .ql-picker-item[data-value=right]:hover { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASBAMAAACk4JNkAAAAD1BMVEUAAAAAZcwAZs0AZs0AZsyEYJIjAAAABHRSTlMAxMXG4b8ciAAAAChJREFUCNdjYCAIRFxcnCAsFRcXZ2KUu0B0qIBZzgzEaXFigGkhpAMAmbwIEMJ9k/cAAAAASUVORK5CYII="); +} +.ql-toolbar-container .ql-format-button.ql-center, +.ql-toolbar-container .ql-picker.ql-center .ql-picker-label, +.ql-toolbar-container .ql-picker .ql-picker-label[data-value=center], +.ql-toolbar-container .ql-picker .ql-picker-item[data-value=center] { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASBAMAAACk4JNkAAAAD1BMVEUAAABERERFRUVERERERETRGyWnAAAABHRSTlMAxMXG4b8ciAAAAC1JREFUCNdjYCAAGF1cXBTALCYgy4CBIBBxAQEnIEsFzHJmIMYKiCVMYBYhSwCyqQhMfft6AQAAAABJRU5ErkJggg=="); +} +.ql-toolbar-container .ql-format-button.ql-center.ql-active, +.ql-toolbar-container .ql-picker.ql-center .ql-picker-label.ql-active, +.ql-toolbar-container .ql-picker .ql-picker-label[data-value=center].ql-active, +.ql-toolbar-container .ql-picker .ql-picker-item[data-value=center].ql-selected, +.ql-toolbar-container:not(.ios) .ql-format-button.ql-center:hover, +.ql-toolbar-container:not(.ios) .ql-picker.ql-center .ql-picker-label:hover, +.ql-toolbar-container:not(.ios) .ql-picker .ql-picker-label[data-value=center]:hover, +.ql-toolbar-container:not(.ios) .ql-picker .ql-picker-item[data-value=center]:hover { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASBAMAAACk4JNkAAAAD1BMVEUAAAAAZcwAZs0AZs0AZsyEYJIjAAAABHRSTlMAxMXG4b8ciAAAAC1JREFUCNdjYCAAGF1cXBTALCYgy4CBIBBxAQEnIEsFzHJmIMYKiCVMYBYhSwCyqQhMfft6AQAAAABJRU5ErkJggg=="); +} +.ql-toolbar-container .ql-format-button.ql-justify, +.ql-toolbar-container .ql-picker.ql-justify .ql-picker-label, +.ql-toolbar-container .ql-picker .ql-picker-label[data-value=justify], +.ql-toolbar-container .ql-picker .ql-picker-item[data-value=justify] { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASBAMAAACk4JNkAAAAD1BMVEUAAABERERFRUVERERERETRGyWnAAAABHRSTlMAxMXG4b8ciAAAABpJREFUCNdjYMAPRFxAwAnIUgGznBkYBlwHAJGzCjB/C3owAAAAAElFTkSuQmCC"); +} +.ql-toolbar-container .ql-format-button.ql-justify.ql-active, +.ql-toolbar-container .ql-picker.ql-justify .ql-picker-label.ql-active, +.ql-toolbar-container .ql-picker .ql-picker-label[data-value=justify].ql-active, +.ql-toolbar-container .ql-picker .ql-picker-item[data-value=justify].ql-selected, +.ql-toolbar-container:not(.ios) .ql-format-button.ql-justify:hover, +.ql-toolbar-container:not(.ios) .ql-picker.ql-justify .ql-picker-label:hover, +.ql-toolbar-container:not(.ios) .ql-picker .ql-picker-label[data-value=justify]:hover, +.ql-toolbar-container:not(.ios) .ql-picker .ql-picker-item[data-value=justify]:hover { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAYAAABWzo5XAAAALklEQVR42mMYvoARzko9cwTIsyZR+zGGWcZgPUwIMUZGShwyGtijgT0a2EMMAADESwwWta/i5QAAAABJRU5ErkJggg=="); +} +@media (-webkit-min-device-pixel-ratio: 2) { + .ql-toolbar-container .ql-picker .ql-picker-label { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkBAMAAAATLoWrAAAAIVBMVEUAAABCQkJDQ0NDQ0NERERERERERERERERERERERERERERehmmoAAAACnRSTlMATVRbaeXo6fz+NPhZJgAAAF9JREFUKM9jYBjkQC0JXYS5a4UBmpDFqlXN6IpWrUJTprEKCJpQhLJAQsswhZaiCImDhAJp5kMxkPGJZLjLEiQ0GUWIZdaqVSsdUM33XLVqCpqVLLPQFTEwmAcP9qQAAFUgKabkwE6gAAAAAElFTkSuQmCC"); + } + .ql-toolbar-container .ql-picker.ql-expanded .ql-picker-label { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkBAMAAAATLoWrAAAAJFBMVEWqqqr////AwMDAwMDAwMDBwcHBwcHBwcHBwcHBwcHBwcHBwcEexLCPAAAAC3RSTlMAAE1UW2nl6On8/tZA57EAAABxSURBVHjazc4hFkBAGMTxL3AAp+AGniYiyaLnBETHoKkknbc7l7OrzW7zhP3HX5mRxCskEsknEaZoU6VDNbAyRRugSqICpoVotnT7dBFllnpefPuHUpjGD78aSztRfAK65cUOOIQpPnXrkFSDEFFB0APtK1HCkKpz1wAAAABJRU5ErkJggg=="); + } + .ql-toolbar-container .ql-picker.ql-active:not(.ql-expanded) .ql-picker-label, + .ql-toolbar-container:not(.ios) .ql-picker:not(.ql-expanded) .ql-picker-label:hover { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkBAMAAAATLoWrAAAAIVBMVEUAAAAAZ8oAZMsAZc0AZswAZswAZswAZswAZswAZswAZswhMkyGAAAACnRSTlMATVRbaeXo6fz+NPhZJgAAAF9JREFUKM9jYBjkQC0JXYS5a4UBmpDFqlXN6IpWrUJTprEKCJpQhLJAQsswhZaiCImDhAJp5kMxkPGJZLjLEiQ0GUWIZdaqVSsdUM33XLVqCpqVLLPQFTEwmAcP9qQAAFUgKabkwE6gAAAAAElFTkSuQmCC"); + } + .ql-toolbar-container .ql-format-button.ql-bold, + .ql-toolbar-container .ql-picker.ql-bold .ql-picker-label, + .ql-toolbar-container .ql-picker .ql-picker-label[data-value=bold], + .ql-toolbar-container .ql-picker .ql-picker-item[data-value=bold] { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAMAAADW3miqAAAAxlBMVEUAAABVVVUzMzNVVVVJSUlGRkZAQEBJSUlAQEBAQEBAQEBHR0dCQkJGRkZAQEBGRkZCQkJERERDQ0NDQ0NGRkZERERDQ0NFRUVCQkJFRUVERERDQ0NDQ0NFRUVDQ0NERERERERERERERERERERERERERERERERERERFRUVDQ0NERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERfjmwgAAAAQXRSTlMAAwUGBwsMDhAUGBkbHSAhIykuOUJERUpNUVZYXGRne3yAi4+SmqWmq67R1tfY2dve5ujp7/Dy8/T19vf4+fv8/mUg1b0AAACrSURBVDjL5dPFDgJBEEXRxt3d3d11gPv/P8WCEAgZuno/b1WLk1TqJaWUI1Jc8852Mqz5bdHHALDK2CF+ckgYIHp/0GtypxpHYKlFSqkycJeQD7hIKADMJFQHulrkSrYs2MflCnZZgzKvo7RJmZeSAWIf1V3nihSGAG19BUq1gKmEQsBZQkHAklATmOuQN5zvP4COQQWnmIxuFfERWOTsXmrztWg8qHqUU/IEzOhNFx6Ncl4AAAAASUVORK5CYII="); + } + .ql-toolbar-container .ql-format-button.ql-bold.ql-active, + .ql-toolbar-container .ql-picker.ql-bold .ql-picker-label.ql-active, + .ql-toolbar-container .ql-picker .ql-picker-label[data-value=bold].ql-active, + .ql-toolbar-container .ql-picker .ql-picker-item[data-value=bold].ql-selected, + .ql-toolbar-container:not(.ios) .ql-format-button.ql-bold:hover, + .ql-toolbar-container:not(.ios) .ql-picker.ql-bold .ql-picker-label:hover, + .ql-toolbar-container:not(.ios) .ql-picker .ql-picker-label[data-value=bold]:hover, + .ql-toolbar-container:not(.ios) .ql-picker .ql-picker-item[data-value=bold]:hover { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAMAAADW3miqAAAAxlBMVEUAAAAAVaoAZswAVdUAbdsAXdEAatUAbcgAYM8AZswAasoAZswAaNAAasoAaMcAZMkAZswAZM0AZM0AZ8kAZM0AZcsAZMsAZMsAZ8oAZc0AZc0AZcsAZ8oAZswAZssAZssAZcwAZssAZ80AZs0AZ8wAZ80AZswAZ8wAZ8wAZ8wAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZsyeO+aMAAAAQXRSTlMAAwUGBwsMDhAUGBkbHSAhIykuOUJERUpNUVZYXGRne3yAi4+SmqWmq67R1tfY2dve5ujp7/Dy8/T19vf4+fv8/mUg1b0AAACrSURBVDjL5dPFDgJBEEXRxt3d3d11gPv/P8WCEAgZuno/b1WLk1TqJaWUI1Jc8852Mqz5bdHHALDK2CF+ckgYIHp/0GtypxpHYKlFSqkycJeQD7hIKADMJFQHulrkSrYs2MflCnZZgzKvo7RJmZeSAWIf1V3nihSGAG19BUq1gKmEQsBZQkHAklATmOuQN5zvP4COQQWnmIxuFfERWOTsXmrztWg8qHqUU/IEzOhNFx6Ncl4AAAAASUVORK5CYII="); + } + .ql-toolbar-container .ql-format-button.ql-italic, + .ql-toolbar-container .ql-picker.ql-italic .ql-picker-label, + .ql-toolbar-container .ql-picker .ql-picker-label[data-value=italic], + .ql-toolbar-container .ql-picker .ql-picker-item[data-value=italic] { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAMAAADW3miqAAAAjVBMVEUAAAAAAACAgIBAQEBVVVVAQEBAQEBCQkJCQkJFRUVDQ0NBQUFDQ0NDQ0NDQ0NFRUVERERERERERERDQ0NERERDQ0NERERERERERERFRUVFRUVERERFRUVERERERERDQ0NERERERERERERDQ0NFRUVEREREREREREREREREREREREREREREREREREREREQUqV1+AAAALnRSTlMAAQIEBggMGyMlKisuUFhZXmJmb3R9hIiKjZGTlKWprrG0uL3BxObt8PL19/j9SqrrawAAAIJJREFUOMvl0jUOQgEQRVHc3d1dzv6XRwch+WRq4NYnmVdMKvU35RZXz+7LQiJqe6uXiDrvqJuI8vM7ALd14fOwIabR+i1agUmfUA1QGedMgJrYRZPGGEVoh0ZgMmeUAlTBMbrWwiZCEwwitEc9MNkLigGq4RBda2MVoRn6X/jfv9YDjuYgGnCpSqcAAAAASUVORK5CYII="); + } + .ql-toolbar-container .ql-format-button.ql-italic.ql-active, + .ql-toolbar-container .ql-picker.ql-italic .ql-picker-label.ql-active, + .ql-toolbar-container .ql-picker .ql-picker-label[data-value=italic].ql-active, + .ql-toolbar-container .ql-picker .ql-picker-item[data-value=italic].ql-selected, + .ql-toolbar-container:not(.ios) .ql-format-button.ql-italic:hover, + .ql-toolbar-container:not(.ios) .ql-picker.ql-italic .ql-picker-label:hover, + .ql-toolbar-container:not(.ios) .ql-picker .ql-picker-label[data-value=italic]:hover, + .ql-toolbar-container:not(.ios) .ql-picker .ql-picker-item[data-value=italic]:hover { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAMAAADW3miqAAAAjVBMVEUAAAAAAP8AgP8AgL8AVdUAYL8AatUAaNAAZswAZ8gAZ8gAZcoAZM0AZswAZcsAZMsAZMsAZcsAZ8sAZcoAZcoAZswAZs0AZ8wAZs0AZ8wAZswAZs0AZs0AZswAZ8wAZ8wAZs0AZswAZ8wAZ8wAZs0AZcwAZswAZswAZswAZswAZswAZswAZswAZswAZsyyI9XbAAAALnRSTlMAAQIEBggMGyMlKisuUFhZXmJmb3R9hIiKjZGTlKWprrG0uL3BxObt8PL19/j9SqrrawAAAIJJREFUOMvl0jUOQgEQRVHc3d1dzv6XRwch+WRq4NYnmVdMKvU35RZXz+7LQiJqe6uXiDrvqJuI8vM7ALd14fOwIabR+i1agUmfUA1QGedMgJrYRZPGGEVoh0ZgMmeUAlTBMbrWwiZCEwwitEc9MNkLigGq4RBda2MVoRn6X/jfv9YDjuYgGnCpSqcAAAAASUVORK5CYII="); + } + .ql-toolbar-container .ql-format-button.ql-underline, + .ql-toolbar-container .ql-picker.ql-underline .ql-picker-label, + .ql-toolbar-container .ql-picker .ql-picker-label[data-value=underline], + .ql-toolbar-container .ql-picker .ql-picker-item[data-value=underline] { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAMAAADW3miqAAAAWlBMVEUAAAAAAAAzMzNAQEBGRkZERERERERCQkJERERDQ0NFRUVERERERERFRUVERERERERERERFRUVERERERERERERDQ0NFRUVERERERERERERERERERERERERERET15sOLAAAAHXRSTlMAAQUMLC04TU9UVYePkJKkxMXG2Nrf4+jz9/n6/qlZ0HQAAACUSURBVHja7Y3BDsIgEAW3UCmCFatQxLL//5uuiQ0py1EPxs5tHhMW/oMhxoF5TUSMzGuQqH2PfiO60yiLStIHi260qqKKNLDI0XouOpI6Fh1f/x9W6xOpYZHwNM/9u5lJvACGzvSQRiWlOiUkNDSwuMFCi87mkmTbQRvt18aXWwxhXFiW4IyAr3LBJtMmmtrRFT7ME0B0HEswIOSJAAAAAElFTkSuQmCC"); + } + .ql-toolbar-container .ql-format-button.ql-underline.ql-active, + .ql-toolbar-container .ql-picker.ql-underline .ql-picker-label.ql-active, + .ql-toolbar-container .ql-picker .ql-picker-label[data-value=underline].ql-active, + .ql-toolbar-container .ql-picker .ql-picker-item[data-value=underline].ql-selected, + .ql-toolbar-container:not(.ios) .ql-format-button.ql-underline:hover, + .ql-toolbar-container:not(.ios) .ql-picker.ql-underline .ql-picker-label:hover, + .ql-toolbar-container:not(.ios) .ql-picker .ql-picker-label[data-value=underline]:hover, + .ql-toolbar-container:not(.ios) .ql-picker .ql-picker-item[data-value=underline]:hover { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAMAAADW3miqAAAAWlBMVEUAAAAAAP8AZswAatUAaMsAZswAZM0AZ8oAZMsAZMsAZswAZswAZs0AZ80AZ8wAZ8wAZcwAZs0AZs0AZswAZs0AZswAZswAZswAZswAZswAZswAZswAZswAZszogqY1AAAAHXRSTlMAAQUMLC04TU9UVYePkJKkxMXG2Nrf4+jz9/n6/qlZ0HQAAACUSURBVHja7Y3BDsIgEAW3UCmCFatQxLL//5uuiQ0py1EPxs5tHhMW/oMhxoF5TUSMzGuQqH2PfiO60yiLStIHi260qqKKNLDI0XouOpI6Fh1f/x9W6xOpYZHwNM/9u5lJvACGzvSQRiWlOiUkNDSwuMFCi87mkmTbQRvt18aXWwxhXFiW4IyAr3LBJtMmmtrRFT7ME0B0HEswIOSJAAAAAElFTkSuQmCC"); + } + .ql-toolbar-container .ql-format-button.ql-strike, + .ql-toolbar-container .ql-picker.ql-strike .ql-picker-label, + .ql-toolbar-container .ql-picker .ql-picker-label[data-value=strike], + .ql-toolbar-container .ql-picker .ql-picker-item[data-value=strike] { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAMAAADW3miqAAABLFBMVEUAAACAgIBVVVVAQEAzMzNVVVVAQEA5OTlNTU1JSUlERERHR0dDQ0NGRkZDQ0NAQEBCQkJAQEBGRkZAQEBGRkZERERBQUFERERGRkZCQkJGRkZERERFRUVERERDQ0NFRUVERERDQ0NFRUVCQkJDQ0NFRUVCQkJDQ0NERERDQ0NERERERERDQ0NFRUVERERERERERERERERFRUVERERDQ0NFRUVERERERERFRUVERERERERDQ0NDQ0NFRUVERERERERFRUVERERERERFRUVERERERERDQ0NERERFRUVERERERERERERFRUVERERERERERERERERFRUVERERERERERERFRUVERERERERERERERERERERERERERERERERERERERERERERERERERERERET5TTiyAAAAY3RSTlMAAgMEBQYICQoODxITFhcYGxwdICEtLzEzNjc4P0BFRkdISk1YWWBjaWtsdHZ3f4CHiImKjJGSk5SVl5ufo6Smp625uru8vb/BwsPExcbMzs/Q0dPi4+Tl6+zv8PL19vf4+/z2SQ4sAAABE0lEQVQ4y2NgGDmAV8c5PCkxxFGDE6cSDuOEZCiI0WXGroY/OBkJeHJhU8Pkm4wCXBixKFIHyUTqibJzS5lEgNhqWBT5AMWD+CFsHg8gxxuLoniguCyMIwLkxGFRBPKZDKEw8gMqCuAloEgb7HADMTZ8ijisjHTUlCSFOdgFxeVUNPXM7Z38QmJ9EApQxFFCyxeuxhtFPC7U39nBQl9LVV5CiAMpiFDEOYQlldR0jGwM8DmOVVDRLBpkpDIBr/KBXOBKKNSEgYpiMUQjgaLChBQ5A0W94AHO6wXkumEoUgY5NcpUUYCFRUDBNAqHw22T0YAdNp9bo6qxZMLqI4VAhJIgBZwelzZ0D4uLC3M3lB5B5QgAFQdgZ6NzzvYAAAAASUVORK5CYII="); + } + .ql-toolbar-container .ql-format-button.ql-strike.ql-active, + .ql-toolbar-container .ql-picker.ql-strike .ql-picker-label.ql-active, + .ql-toolbar-container .ql-picker .ql-picker-label[data-value=strike].ql-active, + .ql-toolbar-container .ql-picker .ql-picker-item[data-value=strike].ql-selected, + .ql-toolbar-container:not(.ios) .ql-format-button.ql-strike:hover, + .ql-toolbar-container:not(.ios) .ql-picker.ql-strike .ql-picker-label:hover, + .ql-toolbar-container:not(.ios) .ql-picker .ql-picker-label[data-value=strike]:hover, + .ql-toolbar-container:not(.ios) .ql-picker .ql-picker-item[data-value=strike]:hover { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAMAAADW3miqAAABLFBMVEUAAAAAgP8AVaoAgL8AZswAVdUAYL8AccYAZswAbcgAZswAY8YAa8kAaNEAZMgAasoAaNAAZMgAasoAaMcAZMkAZswAZ8kAaMsAZM0AaMsAZswAZM0AZcoAZMsAZMsAZswAZc0AZ8oAZMsAZ8oAZcsAZMsAZcoAZMsAZswAZssAZssAZcoAZssAZcwAZssAZs0AZswAZ8wAZs0AZs0AZswAZswAZ8wAZs0AZs0AZ80AZ8wAZswAZ8wAZs0AZ8wAZ8wAZs0AZs0AZswAZ8wAZs0AZs0AZ8wAZcwAZs0AZ8wAZswAZcwAZs0AZs0AZ8wAZswAZswAZs0AZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswL5dPDAAAAY3RSTlMAAgMEBQYICQoODxITFhcYGxwdICEtLzEzNjc4P0BFRkdISk1YWWBjaWtsdHZ3f4CHiImKjJGSk5SVl5ufo6Smp625uru8vb/BwsPExcbMzs/Q0dPi4+Tl6+zv8PL19vf4+/z2SQ4sAAABE0lEQVQ4y2NgGDmAV8c5PCkxxFGDE6cSDuOEZCiI0WXGroY/OBkJeHJhU8Pkm4wCXBixKFIHyUTqibJzS5lEgNhqWBT5AMWD+CFsHg8gxxuLoniguCyMIwLkxGFRBPKZDKEw8gMqCuAloEgb7HADMTZ8ijisjHTUlCSFOdgFxeVUNPXM7Z38QmJ9EApQxFFCyxeuxhtFPC7U39nBQl9LVV5CiAMpiFDEOYQlldR0jGwM8DmOVVDRLBpkpDIBr/KBXOBKKNSEgYpiMUQjgaLChBQ5A0W94AHO6wXkumEoUgY5NcpUUYCFRUDBNAqHw22T0YAdNp9bo6qxZMLqI4VAhJIgBZwelzZ0D4uLC3M3lB5B5QgAFQdgZ6NzzvYAAAAASUVORK5CYII="); + } + .ql-toolbar-container .ql-format-button.ql-link, + .ql-toolbar-container .ql-picker.ql-link .ql-picker-label, + .ql-toolbar-container .ql-picker .ql-picker-label[data-value=link], + .ql-toolbar-container .ql-picker .ql-picker-item[data-value=link] { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAMAAADW3miqAAABDlBMVEUAAAD///8AAACAgIBVVVVAQEAzMzNVVVVAQEBNTU1HR0dAQEBJSUlGRkZDQ0NAQEBERERHR0dGRkZDQ0NBQUFGRkZERERCQkJGRkZFRUVCQkJFRUVERERDQ0NDQ0NCQkJFRUVDQ0NERERDQ0NFRUVDQ0NFRUVFRUVFRUVFRUVERERDQ0NFRUVERERFRUVERERERERDQ0NFRUVFRUVERERERERERERERERFRUVERERERERERERFRUVDQ0NERERERERFRUVERERERERERERERERERERERERERERERERERERERERFRUVERERERERERERERERERERERERERERERERERERERERERERERERERERERESFPz0UAAAAWXRSTlMAAAECAwQFBggKEhQVFhccHiQoKissLTIzNDpGR0hMTU5QUlRVW12BgoaHjI2PmJmam5ygpKWosbKztLW6vcDD0NLT2Nna3N7g4eLj5Ofo6err7u/w8vn7/A90CXkAAAFqSURBVDjLzdTHUgJREIXho8yo6JgFc0LFjAkVMZAFJYrCzP/+L+JCtJipS5U7Patbt79Vd1dr6BfRHyBJUiie6dSSiwrEh2aeAPAO7cEoUqWXdHgQirQAOh7A46gZzVQBzsfmSgAnRhR6AjiS5OQAd9aE4t9GmqoCCRPKAGe9zzhQDxlQBzpjknab9c2RD2DBgGrgzUlqQnfrHlg3oGug6Eh1oFsAEtvLVhAteUBuSjseP2lfzQf6dARQjY/s9SncY9uH7DQA7+ky/XkI+8YSfvRVC6k3AO4s34BHT90+1N2yYq8A+/5V0Wyi0ac2NJkD3KgfSaGF9QRQ9oCC5JSAiyCStA2k9jzISooCFQNaBlpWrJBdkTThQsOA7DYQ+3pbKeDWgHQFvDiSNJwEWDWheRfIOZKVBLiRCekYoBiZSAHkx83IfgDABXielhkpfAcAkJ/WICTrwAXgZlyDkRS9rDRu1wJL98/u0yeVYHcP1mwWWgAAAABJRU5ErkJggg=="); + } + .ql-toolbar-container .ql-format-button.ql-link.ql-active, + .ql-toolbar-container .ql-picker.ql-link .ql-picker-label.ql-active, + .ql-toolbar-container .ql-picker .ql-picker-label[data-value=link].ql-active, + .ql-toolbar-container .ql-picker .ql-picker-item[data-value=link].ql-selected, + .ql-toolbar-container:not(.ios) .ql-format-button.ql-link:hover, + .ql-toolbar-container:not(.ios) .ql-picker.ql-link .ql-picker-label:hover, + .ql-toolbar-container:not(.ios) .ql-picker .ql-picker-label[data-value=link]:hover, + .ql-toolbar-container:not(.ios) .ql-picker .ql-picker-item[data-value=link]:hover { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAMAAADW3miqAAABDlBMVEUAAAD///8AAP8AgP8AVaoAgL8AZswAVdUAYL8AZswAY8YAZswAYc4AaNEAZMgAZMgAZswAY80AZswAZ8gAZcoAaMsAZswAZswAZM0AZ8kAZcoAZswAZc0AZ8oAZc0AZ8oAZcsAZswAZ8oAZMsAZswAZc0AZcsAZ84AZswAZ84AZswAZswAZ8wAZs0AZs0AZs0AZ80AZswAZ8wAZswAZ8wAZswAZs0AZs0AZs0AZ8wAZswAZ8wAZ8wAZ8wAZs0AZswAZs0AZswAZswAZswAZswAZs0AZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZsxCnEEHAAAAWXRSTlMAAAECAwQFBggKEhQVFhccHiQoKissLTIzNDpGR0hMTU5QUlRVW12BgoaHjI2PmJmam5ygpKWosbKztLW6vcDD0NLT2Nna3N7g4eLj5Ofo6err7u/w8vn7/A90CXkAAAFqSURBVDjLzdTHUgJREIXho8yo6JgFc0LFjAkVMZAFJYrCzP/+L+JCtJipS5U7Patbt79Vd1dr6BfRHyBJUiie6dSSiwrEh2aeAPAO7cEoUqWXdHgQirQAOh7A46gZzVQBzsfmSgAnRhR6AjiS5OQAd9aE4t9GmqoCCRPKAGe9zzhQDxlQBzpjknab9c2RD2DBgGrgzUlqQnfrHlg3oGug6Eh1oFsAEtvLVhAteUBuSjseP2lfzQf6dARQjY/s9SncY9uH7DQA7+ky/XkI+8YSfvRVC6k3AO4s34BHT90+1N2yYq8A+/5V0Wyi0ac2NJkD3KgfSaGF9QRQ9oCC5JSAiyCStA2k9jzISooCFQNaBlpWrJBdkTThQsOA7DYQ+3pbKeDWgHQFvDiSNJwEWDWheRfIOZKVBLiRCekYoBiZSAHkx83IfgDABXielhkpfAcAkJ/WICTrwAXgZlyDkRS9rDRu1wJL98/u0yeVYHcP1mwWWgAAAABJRU5ErkJggg=="); + } + .ql-toolbar-container .ql-format-button.ql-image, + .ql-toolbar-container .ql-picker.ql-image .ql-picker-label, + .ql-toolbar-container .ql-picker .ql-picker-label[data-value=image], + .ql-toolbar-container .ql-picker .ql-picker-item[data-value=image] { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkBAMAAAATLoWrAAAAFVBMVEUAAABCQkJEREREREREREREREREREQL6X1nAAAABnRSTlMATXjl6OmAFiJpAAAAZklEQVR42sXQsQ3AIAxEUeQZoKdyzwg0DALo9h8hiCYXo4R0/MbSK1ycO5EHlScVpj4Jj97p/vtJPi9U+kptXIlMIY2r1b4XIBpSoDJJFIyYtKohAWBIV8Ke9kv8X7WwtEmBKbkDXfWkWdehkaSCAAAAAElFTkSuQmCC"); + } + .ql-toolbar-container .ql-format-button.ql-image.ql-active, + .ql-toolbar-container .ql-picker.ql-image .ql-picker-label.ql-active, + .ql-toolbar-container .ql-picker .ql-picker-label[data-value=image].ql-active, + .ql-toolbar-container .ql-picker .ql-picker-item[data-value=image].ql-selected, + .ql-toolbar-container:not(.ios) .ql-format-button.ql-image:hover, + .ql-toolbar-container:not(.ios) .ql-picker.ql-image .ql-picker-label:hover, + .ql-toolbar-container:not(.ios) .ql-picker .ql-picker-label[data-value=image]:hover, + .ql-toolbar-container:not(.ios) .ql-picker .ql-picker-item[data-value=image]:hover { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkBAMAAAATLoWrAAAAFVBMVEUAAAAAZ8oAZswAZswAZswAZswAZsx4QzxlAAAABnRSTlMATXjl6OmAFiJpAAAAZklEQVR42sXQsQ3AIAxEUeQZoKdyzwg0DALo9h8hiCYXo4R0/MbSK1ycO5EHlScVpj4Jj97p/vtJPi9U+kptXIlMIY2r1b4XIBpSoDJJFIyYtKohAWBIV8Ke9kv8X7WwtEmBKbkDXfWkWdehkaSCAAAAAElFTkSuQmCC"); + } + .ql-toolbar-container .ql-format-button.ql-list, + .ql-toolbar-container .ql-picker.ql-list .ql-picker-label, + .ql-toolbar-container .ql-picker .ql-picker-label[data-value=list], + .ql-toolbar-container .ql-picker .ql-picker-item[data-value=list] { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAMAAADW3miqAAAAw1BMVEUAAAAAAABVVVVAQEBERERAQEBJSUlGRkZHR0dFRUVCQkJERERAQEBGRkZDQ0NFRUVDQ0NCQkJGRkZDQ0NCQkJERERDQ0NFRUVERERFRUVERERDQ0NERERERERDQ0NFRUVERERERERERERERERERERERERERERFRUVERERERERERERFRUVERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERESFbZw4AAAAQHRSTlMAAQYIDxAVFhkaGx4gKCo0NTY3OU10fYKIiYqMj56fo6SmqKmvtLe6vr/ExcbLz9fh4uXm5+jp7O/w8vP3+vv9Z7IwDAAAAK1JREFUOMvV0scOglAQQFGwYO+oiIq9YldEFPX+/1e5cGEii2FFdNY3b/JORlF+dAqNrS1GQyDEW+9Id/gaRw9EgQacMNEhuO4caD7rlgDS/2yAVWTiia53HWeEaMLzwUKIdvt08n4TxLMptc1UEo/38YqCuGZzKknimxDi6jpa8Vjn6I4kcQNgLkSmVSvjizeeb9ITbzxXxxLETatSxRfEWwAzicC4uANN+at5AdptTQ0Ubk4LAAAAAElFTkSuQmCC"); + } + .ql-toolbar-container .ql-format-button.ql-list.ql-active, + .ql-toolbar-container .ql-picker.ql-list .ql-picker-label.ql-active, + .ql-toolbar-container .ql-picker .ql-picker-label[data-value=list].ql-active, + .ql-toolbar-container .ql-picker .ql-picker-item[data-value=list].ql-selected, + .ql-toolbar-container:not(.ios) .ql-format-button.ql-list:hover, + .ql-toolbar-container:not(.ios) .ql-picker.ql-list .ql-picker-label:hover, + .ql-toolbar-container:not(.ios) .ql-picker .ql-picker-label[data-value=list]:hover, + .ql-toolbar-container:not(.ios) .ql-picker .ql-picker-item[data-value=list]:hover { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAMAAADW3miqAAAAw1BMVEUAAAAAAP8AVdUAYL8AZswAYM8AYc4AaNEAZswAYs4AaNAAZswAaMcAZswAZ8gAZ8kAZcoAaMsAZswAZ8kAZ8oAZcoAZswAZswAZ8wAZs0AZs0AZswAZs0AZs0AZ8wAZs0AZ8wAZ8wAZs0AZ8wAZswAZswAZs0AZ8wAZswAZcwAZcwAZs0AZs0AZs0AZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZszno9YmAAAAQHRSTlMAAQYIDxAVFhkaGx4gKCo0NTY3OU10fYKIiYqMj56fo6SmqKmvtLe6vr/ExcbLz9fh4uXm5+jp7O/w8vP3+vv9Z7IwDAAAAK1JREFUOMvV0scOglAQQFGwYO+oiIq9YldEFPX+/1e5cGEii2FFdNY3b/JORlF+dAqNrS1GQyDEW+9Id/gaRw9EgQacMNEhuO4caD7rlgDS/2yAVWTiia53HWeEaMLzwUKIdvt08n4TxLMptc1UEo/38YqCuGZzKknimxDi6jpa8Vjn6I4kcQNgLkSmVSvjizeeb9ITbzxXxxLETatSxRfEWwAzicC4uANN+at5AdptTQ0Ubk4LAAAAAElFTkSuQmCC"); + } + .ql-toolbar-container .ql-format-button.ql-bullet, + .ql-toolbar-container .ql-picker.ql-bullet .ql-picker-label, + .ql-toolbar-container .ql-picker .ql-picker-label[data-value=bullet], + .ql-toolbar-container .ql-picker .ql-picker-item[data-value=bullet] { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkBAMAAAATLoWrAAAAElBMVEUAAABCQkJEREREREREREREREQc4xmxAAAABXRSTlMATeXo6UtNtyIAAAAzSURBVCjPY2AYACBsyCAcCgOGYCHTYAZTuFAwRCgISSgILCSiyCACF1JkGBgw6voBcj0AFsUtDasGrUcAAAAASUVORK5CYII="); + } + .ql-toolbar-container .ql-format-button.ql-bullet.ql-active, + .ql-toolbar-container .ql-picker.ql-bullet .ql-picker-label.ql-active, + .ql-toolbar-container .ql-picker .ql-picker-label[data-value=bullet].ql-active, + .ql-toolbar-container .ql-picker .ql-picker-item[data-value=bullet].ql-selected, + .ql-toolbar-container:not(.ios) .ql-format-button.ql-bullet:hover, + .ql-toolbar-container:not(.ios) .ql-picker.ql-bullet .ql-picker-label:hover, + .ql-toolbar-container:not(.ios) .ql-picker .ql-picker-label[data-value=bullet]:hover, + .ql-toolbar-container:not(.ios) .ql-picker .ql-picker-item[data-value=bullet]:hover { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkBAMAAAATLoWrAAAAElBMVEUAAAAAZ8oAZswAZswAZswAZsxixJGvAAAABXRSTlMATeXo6UtNtyIAAAAzSURBVCjPY2AYACBsyCAcCgOGYCHTYAZTuFAwRCgISSgILCSiyCACF1JkGBgw6voBcj0AFsUtDasGrUcAAAAASUVORK5CYII="); + } + .ql-toolbar-container .ql-format-button.ql-authorship, + .ql-toolbar-container .ql-picker.ql-authorship .ql-picker-label, + .ql-toolbar-container .ql-picker .ql-picker-label[data-value=authorship], + .ql-toolbar-container .ql-picker .ql-picker-item[data-value=authorship] { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAMAAADW3miqAAAAllBMVEUAAACAgIBAQEBCQkIAAABCQkJAQEBGRkZERERERERCQkJGRkZDQ0NDQ0NDQ0MAAAAAAAAAAABDQ0NFRUVERERFRUVERERFRUVERERFRUVERERERERERERERERERERERERERERFRUVEREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREREQe3JVeAAAAMXRSTlMAAhgbHx8gIS0xMjM5VFdcXWZyd3yChImPkKy4yMrO0tPj5ebq7e7v8PLz9/j6/P3+mEwo9QAAAJxJREFUGBnVwNcOgjAYBeCj4l7FjeAGUZzn/V9O0kikSftf44c/0A+Tc9iFqHll7tKEJKAWQLKjtockpZZC8qL2hiSjlkESUYsgmVNbQtKhNoCgNrwz95w14NTe8Os2gUP9wJ8p7NYsebRg06NhAZsVDRFstjQksMlogs2Rhhg2o5glpxGqz1O+g/JQUL6TQkH5TmMUPOU7jD1U1AdG8S1kERvjygAAAABJRU5ErkJggg=="); + } + .ql-toolbar-container .ql-format-button.ql-authorship.ql-active, + .ql-toolbar-container .ql-picker.ql-authorship .ql-picker-label.ql-active, + .ql-toolbar-container .ql-picker .ql-picker-label[data-value=authorship].ql-active, + .ql-toolbar-container .ql-picker .ql-picker-item[data-value=authorship].ql-selected, + .ql-toolbar-container:not(.ios) .ql-format-button.ql-authorship:hover, + .ql-toolbar-container:not(.ios) .ql-picker.ql-authorship .ql-picker-label:hover, + .ql-toolbar-container:not(.ios) .ql-picker .ql-picker-label[data-value=authorship]:hover, + .ql-toolbar-container:not(.ios) .ql-picker .ql-picker-item[data-value=authorship]:hover { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAMAAADW3miqAAAAllBMVEUAAAAAgP8AasoAaNAAY84AaMcAZMkAZswAaMsAZswAZM0AZ8kAZMsAZ8oAZ8oAZcsAZc4AZ80AZcwAZcwAZcwAZswAZs0AZs0AZs0AZ80AZs0AZ8wAZswAZs0AZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZsyCDIYeAAAAMXRSTlMAAhgbHyAhLTEyMzlUV1xdXWZyd3yChImPkKy4yMrO0tPj5ebq7e7v8PLz9/j6/P3+PxHOPAAAAJxJREFUGBnVwNcOgjAYBeCj1j0q7oEbRHGe9385SSORJu1/jR/+QGcdn9ctiNSVmYuCZEljCcmOxh6ShEYCyYvGG5KURgpJSCOEZEpjDkmTRheCSu/OzHNSg1djw6/bCB7VA3/GcFux4FGHS5uWGVwWtIRw2dISwyWlDS5HWiK49CMWnPooP6UDD62Q04GXRk4HXgPk1DDwGCiU1AcZWy1RmD8CRQAAAABJRU5ErkJggg=="); + } + .ql-toolbar-container .ql-format-button.ql-color, + .ql-toolbar-container .ql-picker.ql-color .ql-picker-label, + .ql-toolbar-container .ql-picker .ql-picker-label[data-value=color], + .ql-toolbar-container .ql-picker .ql-picker-item[data-value=color] { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAMAAADW3miqAAAAz1BMVEUAAAAAAACAgIBVVVVAQEBVVVU5OTk7OztLS0tHR0dGRkZCQkIAAABERERDQ0NDQ0NDQ0NDQ0NGRkZERERERERCQkJFRUVERERFRUVEREQAAAAAAABDQ0NFRUVEREQAAABERERFRUVERERDQ0NDQ0NERERERERERERERERERERERERERERERERERERFRUVFRUVERERERERERERERERERERDQ0NERERERERERERERERERERERERERERERERERERERERERERERERERERERERERERbYaT1AAAARHRSTlMAAQIDBAYJDRESFhsfIiYqNUFCREtNVVZZWlxdY2RlZm1zdXZ9hI6Tl6Sws7nExcnS09XY2d/g5ejp6+zt8PP09/n9/idH/qoAAADKSURBVBgZ1cDXUsJAAIXhg2KMGruxsGoUe8cWoij1f/9nYiZDGJjsLrfwaRHEWRZrhuAXWoH8zgBO5VVpADTktU9uVz5P5B7lsdUn19+U2x3w+gbcyilsA0cnwP+qXOpAWl1pAhdyqKZAXboGvpZkdwi0Q2m9CxzI7oUJz7LaYdJgWzYPTLmXxUaPKZ01ld0A7xXllr+BK5VlwLlGLoFPlWXQCjQSduBDZfFPM9bY8V+6p7kXmcTBRCqYxMmoYBKnmgqRSRxqkebUEKsKOlxMa6IbAAAAAElFTkSuQmCC"); + } + .ql-toolbar-container .ql-format-button.ql-color.ql-active, + .ql-toolbar-container .ql-picker.ql-color .ql-picker-label.ql-active, + .ql-toolbar-container .ql-picker .ql-picker-label[data-value=color].ql-active, + .ql-toolbar-container .ql-picker .ql-picker-item[data-value=color].ql-selected, + .ql-toolbar-container:not(.ios) .ql-format-button.ql-color:hover, + .ql-toolbar-container:not(.ios) .ql-picker.ql-color .ql-picker-label:hover, + .ql-toolbar-container:not(.ios) .ql-picker .ql-picker-label[data-value=color]:hover, + .ql-toolbar-container:not(.ios) .ql-picker .ql-picker-item[data-value=color]:hover { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAMAAADW3miqAAAA0lBMVEUAAAAAAP8AgP8AVaoAgL8AVdUAccYAYsQAadIAY8YAaNEAaNAAY84AacsAZckAZ8gAZcoAZswAZM0AZcsAZswAZ8oAZswAZc0AZMsAZswAZ8oAZcsAZc4AZMsAZswAZcoAZ80AZcwAZswAZssAZssAZswAZs0AZs0AZs0AZ8wAZ8wAZ8wAZ8wAZswAZcwAZs0AZcwAZswAZswAZs0AZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswVaivDAAAARXRSTlMAAQIDBAYJDRESFhsfIiYqNUFCREtNVVZZWlxdXWNkZWZtc3V2fYSOk5eksLO5xMXJ0tPV2Nnf4OXo6evs7fDz9Pf5/f6Y2SWXAAAAy0lEQVQYGdXA11LCQACF4YNijBq7sbCWKPaOLURREPjf/5WYyRAGJrvLLXyaB3GWxZoi+IFWIL9TgBN5VRoADXntktuWzyO5B3ls9Mj11uV2C7y8AjdyCtvAwRHwtyyXOpBWl5rAuRyqKVCXroDPBdntA+1QWv0H9mT3zJgnWW0xrr8pm3sm3MlircuEzorKroG3inKLX8ClyjLgTEMXwIfKMmgFGgo78K6y+LsZa+TwN93RzItM4mAiFUziZFQwiVNNheg4cahFmlEDFzs7cwmPHM8AAAAASUVORK5CYII="); + } + .ql-toolbar-container .ql-format-button.ql-background, + .ql-toolbar-container .ql-picker.ql-background .ql-picker-label, + .ql-toolbar-container .ql-picker .ql-picker-label[data-value=background], + .ql-toolbar-container .ql-picker .ql-picker-item[data-value=background] { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAMAAADW3miqAAAA4VBMVEUAAAAAAACAgIBVVVVAQEBVVVU5OTk7OztLS0tHR0dGRkZCQkJERERDQ0NDQ0NDQ0NDQ0NERERCQkJEREQAAAADAwMGBgZDQ0NEREQODg5ERERDQ0NFRUVERERERERERERDQ0MiIiJDQ0MmJiZEREQrKytEREREREQyMjIyMjJEREREREREREQ4ODhERERERERFRUVFRUVERERERERERERERERAQEBERERERERBQUFERERERERERERBQUFERERERERERERBQUFERERERERERERDQ0NERERERERDQ0NERERERESZD8GyAAAASnRSTlMAAQIDBAYJDRESFhsiJio1QURJS01QU1RWWVpjZGVtdXZ4fYCEiI6TnZ6ksLO3ucTFydLT193g4OLl5ebn6enq6+7w8vP39/n+/rihcb4AAADbSURBVHjazZPFDsMwEERdZkpTZmbmpszd//+grhpFSaS1e+khc1jbmrG1z7KZdSXLgvo79M9ziKCkKJIeoUPJA8AxKT6H5QGVE3dlmwJqKqaLwVdRIV1fDfVEdKGXGnoFBXQtDIwnWJp8uswd/XQWy8XD7aqD9srp2uJQ5NElVuiWGKvisLFz6Bpo3ryM+R84iXO6GoFBQ5ouAka9wyRdF0waUHSBpzl09xF0dTRmNnXu2OOiTNDtAKCg7W3jYk7QnQGObu0KvVeAJUFXU9aS/h5Sp0VFtui/s6w+XSJAbiVJ3G0AAAAASUVORK5CYII="); + } + .ql-toolbar-container .ql-format-button.ql-background.ql-active, + .ql-toolbar-container .ql-picker.ql-background .ql-picker-label.ql-active, + .ql-toolbar-container .ql-picker .ql-picker-label[data-value=background].ql-active, + .ql-toolbar-container .ql-picker .ql-picker-item[data-value=background].ql-selected, + .ql-toolbar-container:not(.ios) .ql-format-button.ql-background:hover, + .ql-toolbar-container:not(.ios) .ql-picker.ql-background .ql-picker-label:hover, + .ql-toolbar-container:not(.ios) .ql-picker .ql-picker-label[data-value=background]:hover, + .ql-toolbar-container:not(.ios) .ql-picker .ql-picker-item[data-value=background]:hover { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAMAAADW3miqAAAA5FBMVEUAAAAAAP8AgP8AVaoAgL8AZswAVdUAYL8AccYAYsQAadIAY8YAaNEAasoAZswAYsQAaNAAacsAZckAadEAZ8gAZcoAZswAZswAZMkAZM0AZcsAZ8sAZswAaM0AZ8oAZ80AZswAZc0AZMsAZswAZMsAZswAZcoAZcwAZswAZssAZssAZswAZs0AZs0AZs0AZ8wAZ8wAZ8wAZ8wAZswAZcwAZs0AZcwAZswAZswAZs0AZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZswAZsxJPDLdAAAAS3RSTlMAAQIDBAUGCAkNERIWGBkaGyImJyo1N0FCQkRFS0xNTVVWWVpjZGVtc3V2fYSOk5eksLO5xMXJ0tPV2Nnf4OXo6evs7fDz9Pf5/f60OfwzAAABG0lEQVR42s2T6VKDQBCEGyUJoqgSjcYg8dZ43/EieCUa5/3fx661qMAu7O98P4bZnq5lZlkwvXS7k1hf1BTdZFEsFpvUMU15IU7TuKiYJu9d5MODZZ8WcCBk39ZVAKcvpG+ZrgNsimIdTtV0TeBGFNewdBWORTFesUx3QcP9A8N59XT+kPWdPYavOQQVXfVYTtz6gI8jvfUsdRNWe8ApHy8z5ftgm8WhDyx8M4nKumoBd5LjVkkaAdYkz+8qpQLqtK+kwKU5XRPLP1JgNF8y3RkLjw4Us69cnMDb0qdLqR9myjEXz2brNPG2NSKQqOGPRJ5gEr8NYoT/9yHE7mfShoarovYptDw7kiWLyZTbNZBa9saK33tDWZlPK39U3ELkzhssBgAAAABJRU5ErkJggg=="); + } + .ql-toolbar-container .ql-format-button.ql-left, + .ql-toolbar-container .ql-picker.ql-left .ql-picker-label, + .ql-toolbar-container .ql-picker .ql-picker-label[data-value=left], + .ql-toolbar-container .ql-picker .ql-picker-item[data-value=left] { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkBAMAAAATLoWrAAAAElBMVEUAAABCQkJEREREREREREREREQc4xmxAAAABXRSTlMATeXo6UtNtyIAAABCSURBVCjPY2AYACAcCgaGSEKmEKFgTKEgJCERiJAiw0ACqOuR/WCKLBSMKRSE7PqB9YMwuttRnBqMKRSEGvYD6HYAD8opyeJDvUUAAAAASUVORK5CYII="); + } + .ql-toolbar-container .ql-format-button.ql-left.ql-active, + .ql-toolbar-container .ql-picker.ql-left .ql-picker-label.ql-active, + .ql-toolbar-container .ql-picker .ql-picker-label[data-value=left].ql-active, + .ql-toolbar-container .ql-picker .ql-picker-item[data-value=left].ql-selected, + .ql-toolbar-container:not(.ios) .ql-format-button.ql-left:hover, + .ql-toolbar-container:not(.ios) .ql-picker.ql-left .ql-picker-label:hover, + .ql-toolbar-container:not(.ios) .ql-picker .ql-picker-label[data-value=left]:hover, + .ql-toolbar-container:not(.ios) .ql-picker .ql-picker-item[data-value=left]:hover { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkBAMAAAATLoWrAAAAElBMVEUAAAAAZ8oAZswAZswAZswAZsxixJGvAAAABXRSTlMATeXo6UtNtyIAAABCSURBVCjPY2AYACAcCgaGSEKmEKFgTKEgJCERiJAiw0ACqOuR/WCKLBSMKRSE7PqB9YMwuttRnBqMKRSEGvYD6HYAD8opyeJDvUUAAAAASUVORK5CYII="); + } + .ql-toolbar-container .ql-format-button.ql-right, + .ql-toolbar-container .ql-picker.ql-right .ql-picker-label, + .ql-toolbar-container .ql-picker .ql-picker-label[data-value=right], + .ql-toolbar-container .ql-picker .ql-picker-item[data-value=right] { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkBAMAAAATLoWrAAAAElBMVEUAAABCQkJEREREREREREREREQc4xmxAAAABXRSTlMATeXo6UtNtyIAAABCSURBVCjPY2AYMCAcCgaGSEKmEKFgTKEgJCERiJDiwLob2fWmyELBmEJByO4eWNejuN8QNZCRw94U3fUo7h8Q1wMAuRspyVIXC2UAAAAASUVORK5CYII="); + } + .ql-toolbar-container .ql-format-button.ql-right.ql-active, + .ql-toolbar-container .ql-picker.ql-right .ql-picker-label.ql-active, + .ql-toolbar-container .ql-picker .ql-picker-label[data-value=right].ql-active, + .ql-toolbar-container .ql-picker .ql-picker-item[data-value=right].ql-selected, + .ql-toolbar-container:not(.ios) .ql-format-button.ql-right:hover, + .ql-toolbar-container:not(.ios) .ql-picker.ql-right .ql-picker-label:hover, + .ql-toolbar-container:not(.ios) .ql-picker .ql-picker-label[data-value=right]:hover, + .ql-toolbar-container:not(.ios) .ql-picker .ql-picker-item[data-value=right]:hover { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkBAMAAAATLoWrAAAAElBMVEUAAAAAZ8oAZswAZswAZswAZsxixJGvAAAABXRSTlMATeXo6UtNtyIAAABCSURBVCjPY2AYMCAcCgaGSEKmEKFgTKEgJCERiJDiwLob2fWmyELBmEJByO4eWNejuN8QNZCRw94U3fUo7h8Q1wMAuRspyVIXC2UAAAAASUVORK5CYII="); + } + .ql-toolbar-container .ql-format-button.ql-center, + .ql-toolbar-container .ql-picker.ql-center .ql-picker-label, + .ql-toolbar-container .ql-picker .ql-picker-label[data-value=center], + .ql-toolbar-container .ql-picker .ql-picker-item[data-value=center] { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkBAMAAAATLoWrAAAAElBMVEUAAABCQkJEREREREREREREREQc4xmxAAAABXRSTlMATeXo6UtNtyIAAABCSURBVCjPY2AYGCAcCgaGSEKmEKFgTKEgJCERiJAiw4ABqNORPWCKLBSMKRSE7PQB9oAwuuNR3BqMKRSEGvID53gA5GspyQ9EElMAAAAASUVORK5CYII="); + } + .ql-toolbar-container .ql-format-button.ql-center.ql-active, + .ql-toolbar-container .ql-picker.ql-center .ql-picker-label.ql-active, + .ql-toolbar-container .ql-picker .ql-picker-label[data-value=center].ql-active, + .ql-toolbar-container .ql-picker .ql-picker-item[data-value=center].ql-selected, + .ql-toolbar-container:not(.ios) .ql-format-button.ql-center:hover, + .ql-toolbar-container:not(.ios) .ql-picker.ql-center .ql-picker-label:hover, + .ql-toolbar-container:not(.ios) .ql-picker .ql-picker-label[data-value=center]:hover, + .ql-toolbar-container:not(.ios) .ql-picker .ql-picker-item[data-value=center]:hover { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkBAMAAAATLoWrAAAAElBMVEUAAAAAZ8oAZswAZswAZswAZsxixJGvAAAABXRSTlMATeXo6UtNtyIAAABCSURBVCjPY2AYGCAcCgaGSEKmEKFgTKEgJCERiJAiw4ABqNORPWCKLBSMKRSE7PQB9oAwuuNR3BqMKRSEGvID53gA5GspyQ9EElMAAAAASUVORK5CYII="); + } + .ql-toolbar-container .ql-format-button.ql-justify, + .ql-toolbar-container .ql-picker.ql-justify .ql-picker-label, + .ql-toolbar-container .ql-picker .ql-picker-label[data-value=justify], + .ql-toolbar-container .ql-picker .ql-picker-item[data-value=justify] { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkBAMAAAATLoWrAAAAElBMVEUAAABCQkJEREREREREREREREQc4xmxAAAABXRSTlMATeXo6UtNtyIAAAAoSURBVCjPY2AYACAcigQMwUKmyELBmEJBYCERZCFFhoEBo64fINcDAAcQNGkJNhVcAAAAAElFTkSuQmCC"); + } + .ql-toolbar-container .ql-format-button.ql-justify.ql-active, + .ql-toolbar-container .ql-picker.ql-justify .ql-picker-label.ql-active, + .ql-toolbar-container .ql-picker .ql-picker-label[data-value=justify].ql-active, + .ql-toolbar-container .ql-picker .ql-picker-item[data-value=justify].ql-selected, + .ql-toolbar-container:not(.ios) .ql-format-button.ql-justify:hover, + .ql-toolbar-container:not(.ios) .ql-picker.ql-justify .ql-picker-label:hover, + .ql-toolbar-container:not(.ios) .ql-picker .ql-picker-label[data-value=justify]:hover, + .ql-toolbar-container:not(.ios) .ql-picker .ql-picker-item[data-value=justify]:hover { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkBAMAAAATLoWrAAAAElBMVEUAAAAAZ8oAZswAZswAZswAZsxixJGvAAAABXRSTlMATeXo6UtNtyIAAAAoSURBVCjPY2AYACAcigQMwUKmyELBmEJBYCERZCFFhoEBo64fINcDAAcQNGkJNhVcAAAAAElFTkSuQmCC"); + } +}